2009-01-18
| 01:10 | technomancy | I'm trying to read-line from a socket... the docs imply that it works on streams, but it doesn't work with the java.net.SocketInputStream that I get back from (.getInputStream socket) |
| 01:11 | technomancy | maybe I need a reader? how does that work? |
| 01:14 | Cark | use an InputStreamReader |
| 01:16 | technomancy | nope, not quite: No matching method found: readLine for class java.io.InputStreamReader |
| 01:16 | Cark | that's only the first step i guess let me see |
| 01:17 | durka42 | perhaps a BufferedReader? |
| 01:17 | Cark | ah there you go |
| 01:18 | Cark | still need the InputStreamReader though |
| 01:18 | technomancy | I guess there's still a ways to go before claims of low-ceremony can hold. =\ |
| 01:18 | technomancy | thanks tho |
| 01:18 | durka42 | i wonder if contrib.duck-streams/reader can handle sockets |
| 01:18 | technomancy | was about to wonder aloud about duck-streams... |
| 01:18 | technomancy | will peruse the source |
| 01:19 | durka42 | " Argument may be an instance of Reader, |
| 01:19 | durka42 | BufferedReader, InputStream, ...." |
| 01:19 | Cark | (-> (.getInputStream socket) InputStreamReader. BufferedReader.) will get something which you can readline from i suppose |
| 01:22 | Cark | that's how they do it in duck-streams anyways |
| 01:24 | technomancy | I'd like something clean; duck-streams looks best. |
| 01:24 | technomancy | of course, that means figuring out how to put contrib on my path. grrr... |
| 01:25 | durka42 | just add the jar to the classpath |
| 01:26 | Cark | funny i'd rather avoid the dependency. Seems longer but it conveys the meaning pretty well |
| 01:27 | Cark | you only need it in one place in your code, so there's no need for more abstraction |
| 01:27 | Cark | except maybe for the polution of your ns form |
| 01:27 | technomancy | well, I'm sure I'll be using other things from contrib eventually |
| 01:27 | technomancy | there's no need to go into that level of detail just to say "I want a line. From this socket... capiche?" |
| 01:27 | Cark | hehe sure, that's matter of opinion anyways |
| 01:28 | durka42 | yeah, one of my gripes about java is the long lines of nested constructors just to say something like that |
| 01:29 | technomancy | it's pretty silly. good thing we've got duck-streams. |
| 01:29 | Cark | there's no nesting required with clojure ! |
| 01:29 | technomancy | there was talk of duck-streams going into core; is that right? |
| 01:29 | durka42 | anyway, (Thread/sleep) |
| 01:29 | durka42 | goodnight |
| 01:29 | Cark | bye durka |
| 01:32 | technomancy | what's the function to find if a symbol has a binding? |
| 01:32 | technomancy | (boundp in CL) |
| 01:39 | Cark | i don't think there's a way |
| 01:45 | technomancy | heh; all the google hits are for clojure Emacs code |
| 01:45 | technomancy | clojurebot: bound? |
| 01:45 | clojurebot | excusez-moi |
| 01:58 | hiredman | ,(find-var (symbol "println")) |
| 01:58 | clojurebot | java.lang.IllegalArgumentException: Symbol must be namespace-qualified |
| 01:59 | hiredman | ,(find-var (symbol (name *ns*) "println")) |
| 01:59 | clojurebot | java.lang.IncompatibleClassChangeError |
| 02:00 | hiredman | ,(find-var (symbol (str *ns*) "println")) |
| 02:00 | clojurebot | nil |
| 02:01 | technomancy | thanks hiredman |
| 02:02 | hiredman | well |
| 02:02 | hiredman | it makes symbols |
| 02:03 | technomancy | oh, totally misread that. |
| 02:03 | technomancy | so it's like intern |
| 02:05 | technomancy | thanks |
| 02:05 | technomancy | time for some shut-eye for /me |
| 02:55 | hiredman | java.io.FileNotFoundException: Could not locate hiredman/clojurebot/core__init.class or hiredman/clojurebot/core.clj on classpath: (clojurebot.clj:0) |
| 02:55 | hiredman | damn |
| 03:09 | hiredman | ,(doc partition) |
| 03:09 | clojurebot | "([n coll] [n step coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap." |
| 03:23 | Lau_of_DK | Top of the morning gents |
| 03:24 | kotarak | Morning Lau. |
| 07:23 | mibu | anyone knows how to change parentheses' color to DimGray in clojure-mode? |
| 08:20 | Chousuke | hmm |
| 08:29 | Lau_of_DK | Chousuke: Thinking out loud? |
| 08:31 | Chousuke | Just wondering what exactly does *print-dup* do :/ |
| 08:31 | Chousuke | and what's the point of *print-readably* |
| 08:33 | kotarak | I think it prints things like, eg. sorted-map, as #=(sorted-map ....). So it can be read again. Otherwise it's printed as {} and would result in a hash-map when read. |
| 08:34 | Chousuke | also, for documenting these variables, would it be enough to simply add the documentation at the end of core.clj? |
| 08:35 | kotarak | Why at the end? |
| 08:37 | Chousuke | well, adding the documentation is easier if I can use set-meta! and defmacro |
| 08:38 | kotarak | Is that so much easier than a #^{:doc ...} where the are def'd? |
| 08:38 | Chousuke | yes, because some of them are def'd in java code. |
| 08:38 | kotarak | Ok. That's a problem, I guess. |
| 10:01 | edw | The documentation to COND is written in such a way as to suggest it looks like a traditional COND. Or, alternatively, I am not reading the definition closely enough. "Takes a set of test/expr pairs." That screams "(cond (test expr) (test expr))" to me. If it did work like a traditional CONS, how would it best be described? |
| 10:08 | Chousuke | hmm |
| 10:10 | Chousuke | well, it doesn't work like COND in CL; but I wonder how to best describe that. |
| 10:12 | edw | Right. In fewer then a jillion words. |
| 10:13 | edw | Oof! s/then/than/ |
| 10:14 | Chousuke | you could mention that "the result expressions are not wrapped in an implicit do block" |
| 10:14 | Chousuke | but that would probably confuse CL'ers even more... |
| 10:15 | edw | This BTW is one of the regrets McCarthy expressed re: the original LISP design. |
| 10:15 | arbscht_ | clhs uses a modified BNF for a reason :) |
| 10:15 | edw | A series of alternating test and expression forms? |
| 10:15 | Chousuke | "cond takes an even number of forms, interpreted pairwise as a single test expression and a single result expression." |
| 10:16 | edw | A series of alternating test and expression expressions? |
| 10:16 | kotarak | How about not taking notions of CL over to Clojure? A "pair" in the CL is completely uninteresting in Clojure. |
| 10:16 | edw | Yes, we saw the movie. |
| 10:18 | edw | kotarak, oh language notion guardian, does the concept "form" exist in Clojure? |
| 10:19 | edw | And does "expression" imply a "normal", non-macro, non-special form? |
| 10:20 | kotarak | edw: I didn't say I am a guardian of what so ever. I just made a suggestion, that leaving notions from CL at CL and read Clojure as Clojure. Maybe then it's easier to get along with the syntax. |
| 10:25 | edw | But your comment does bring up a good point. What is the vocabulary that people should be using to discuss concepts in Clojure. Taking Scheme as an example, a "procedure" is something that computes the value of a function, a definition much different than most other programming languages, and I'm careful when discussing Scheme to respect that definition. In Clojure, a "function" computes a function, so I use that word. |
| 10:29 | edw | The "don't use pair" rule is a no-brainer, given the explicit discarding of pairs in Clojure. I didn't think the "pairwise" usage in Chousuke's comment was a technical usage, simply a plain-English usage, those my jumping down your throat. |
| 10:29 | edw | s/those/thus/ |
| 11:03 | wlr | kotarak: you said 'A "pair" in the CL is completely uninteresting in Clojure.' A "pair" is a Scheme, not, CL, term. Also the closest, but different, concept in CL for Clojure's cond arguments is "property list". |
| 11:04 | Lau_of_DK | Good evening gents |
| 11:05 | kotarak | wlr: I have only Scheme background, no CL. So if pair is not CL term, then be it. I just suggest, that looking at the code as Clojure code and not as language X code, could help to overcome such problems. |
| 11:06 | kotarak | I remember this troll, who started on the google group with "Why does (define (foo bar) ...) not work?". |
| 11:08 | wlr | kotarak: i agree with your larger point, just a one-time nitpick regarding the details. :) |
| 11:28 | edw | kotarak: So if you have no CL background and therefore have no knowledge of whether or not "pair" is an "interesting" concept in CL, why did you write what you did? If you're going to play the part of a know-it-all, you should probably make sure you do in fact know it all in whatever domain you're swinging your dong. |
| 11:28 | rhickey | edw: we don't talk to each other like that here |
| 11:29 | rhickey | there's no reason not to be respectful |
| 11:30 | edw | I apologize. |
| 11:37 | edw | The example for the `def' special form uses a `defn' as an example. |
| 11:37 | karmazilla | newsflash: textjure* now has a GUI for opening and switching between files! :D |
| 11:38 | Lau_of_DK | Wohoo :) Where are you hosting it ? |
| 11:38 | kotarak | \o/ |
| 11:39 | karmazilla | on github: http://github.com/karmazilla/textjure/tree/master |
| 11:40 | Lau_of_DK | Oh yea.. Right next to http://github.com/Lau-of-DK/clojureql/tree/master |
| 11:40 | Lau_of_DK | I'll check it out :) |
| 11:41 | karmazilla | it's only an editor for people who don't need all these modern bells and wistles such as syntax color, indenting, and... oh, I don't know, _closing_ files :) |
| 11:42 | Chouser | heh. well, karmazilla, you have now touched more lines of textjure than I have. Congrats! |
| 11:46 | Chouser | karmazilla: are you able to use textjure to work on textjure code yet, or is it still too young? |
| 11:46 | Chouser | bah |
| 11:49 | Chouser | karmazilla: are you able to use textjure to work on textjure code yet, or are the features you need not quite there? |
| 12:04 | danlarkin | hiredman: checking my RSS feed now... you know you don't have to push to github every time you commit :-p |
| 13:23 | Lau_of_DK | Good evening gents |
| 13:26 | danlarkin | afternoon Lau |
| 13:26 | Lau_of_DK | :) |
| 13:30 | Lau_of_DK | danlarkin: What are you working on these days? |
| 13:30 | danlarkin | a yet-to-be-released port of django to clojure |
| 13:31 | danlarkin | mostly-port |
| 13:31 | danlarkin | some things I'm changing as I go |
| 13:32 | Cark | lisppaste8: url |
| 13:32 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 13:33 | danlarkin | I think I will be using clojureql to build the ORM |
| 13:33 | lisppaste8 | cark pasted "huh ?" at http://paste.lisp.org/display/73813 |
| 13:34 | Lau_of_DK | danlarkin: Sounds very interesting, got it hosted somewhere? |
| 13:34 | Cark | anybody has an idea on why this is not working ? |
| 13:34 | Cark | when evaluationg the macroexpanded form it works but not the macro itself |
| 13:34 | Lau_of_DK | danlarkin: And also very interesting about CQL - I would be very interested in all feedback you might have |
| 13:36 | Chousuke | Cark: why do you evaluate the AbstractAction? |
| 13:36 | Cark | ahhh yes must be that ! |
| 13:37 | Cark | right that's it, thanks |
| 13:37 | danlarkin | Lau_of_DK: no, it's not hosted anywhere yet, I want to have it at least to a "usable" state before I put it up anywhere. I don't expect anyone to use it, but I at least want to add docstrings and stuff before I release it for others to see |
| 13:38 | antifuchs | danlarkin: sounds like a big project. |
| 13:38 | Lau_of_DK | So ehm... Hurry up and add some docstrings :) |
| 13:38 | antifuchs | (also, yay, would be very interested in seeing it) |
| 13:38 | danlarkin | antifuchs: it is... probably too big |
| 13:38 | danlarkin | I'm very happy with my progress so far, though |
| 13:39 | Lau_of_DK | danlarkin: How much do I get for free when using cjango, compared to compojure? |
| 13:40 | danlarkin | definitely not calling it cjango :) |
| 13:40 | Lau_of_DK | hehe, sorry :| |
| 13:40 | Chousuke | congo? :( |
| 13:41 | antifuchs | djosure? |
| 13:41 | Chousuke | clango! |
| 13:41 | danlarkin | 100% no way it's ending in -jure |
| 13:41 | antifuchs | tee hee |
| 13:43 | Lau_of_DK | Clangojure, pronounced like Klank-GO-sjuuuure |
| 13:43 | danlarkin | Lau_of_DK: are you familiar with django at all? |
| 13:44 | Lau_of_DK | No, I just skimmed their website |
| 13:44 | danlarkin | Lau_of_DK: that would help illustrate what you get "for free" |
| 13:44 | danlarkin | ah |
| 13:44 | Lau_of_DK | And how are you porting it? Do I get both Clojure and Python overhead? |
| 13:44 | danlarkin | no no |
| 13:44 | danlarkin | I'm rewriting it |
| 13:46 | cmvjkl_ | what's the easiest way to check and see if a variable is a number? |
| 13:47 | cmvjkl_ | there's not a specific function for it is there? |
| 13:47 | danlarkin | it is a lot of work though, so I would like some help eventually :) |
| 13:47 | Cark | in the rewriting department i'd love to see a port of hunchentoot |
| 13:47 | Chousuke | cmvjkl_: number? perhaps |
| 13:47 | Chousuke | (doc number?) |
| 13:47 | clojurebot | Returns true if x is a Number; arglists ([x]) |
| 13:47 | cmvjkl_ | oh man, there is. |
| 13:48 | cmvjkl_ | my fault, but to be honest, there should be an easier way to look that up too...under the data structures page for 'numbers', that isn't listed at all. |
| 13:48 | Lau_of_DK | danlarkin: Thats sounds like a huge job - You should consider doing a 'linus' on it :) |
| 13:49 | danlarkin | Lau_of_DK: and what is a 'linus"? |
| 13:50 | Chousuke | cmvjkl_: find-doc is your friend ) |
| 13:50 | Lau_of_DK | danlarkin: Thats a 'delegate wildly' approach to writing software |
| 13:50 | Lau_of_DK | which means, Git :) |
| 13:50 | danlarkin | it's in git :) just not anywhere except my computer |
| 13:50 | cmvjkl_ | oh man i didn't realize that existed either. thanks! |
| 13:52 | danlarkin | really the only people who could help with the major stuff at this point are those extremely familiar with django and all the python tricks they use, and with a working knowledge of clojure |
| 13:52 | danlarkin | which might be like |
| 13:52 | danlarkin | only me |
| 13:52 | danlarkin | hahah |
| 13:57 | Lau_of_DK | hehe - Im really biting my tongue not to say something right now :) |
| 13:57 | danlarkin | a python diss? |
| 13:58 | danlarkin | bah! |
| 13:59 | Chousuke | I think everyone knows Lau_of_DK's opinion of python by now. |
| 13:59 | Chousuke | I also think you're wrong, but I'm not willing to debate that here. |
| 14:00 | danlarkin | yes no sense in flame wars |
| 14:11 | Lau_of_DK | danlarkin: It was actually a mounting flamewar which got me into SBCL from C# :) |
| 14:11 | danlarkin | ha |
| 14:11 | danlarkin | so maybe there is sense in flamewars? |
| 14:12 | Lau_of_DK | or maybe I just caught a break :) |
| 14:13 | Lau_of_DK | I mean, all the stuff being said was lame and hurtful, but one guy shot of some Lisp to prove his point, which he did well enough |
| 14:15 | danlarkin | well that's good |
| 14:15 | danlarkin | it's rare for something positive to come of bickering |
| 14:17 | Lau_of_DK | True |
| 14:25 | danlarkin | the only feature I haven't been able to match 100% from django yet is their url dispatch can use named groups |
| 14:25 | danlarkin | and java's regex engine doesn't have named groups |
| 14:25 | antifuchs | might try porting cl-ppcre (: |
| 14:26 | danlarkin | haha |
| 14:26 | antifuchs | hey, it would be neat to compare speeds |
| 14:26 | danlarkin | I think I'll stick with unnamed groups until someone else does the heavy lifting |
| 14:32 | danlarkin | antifuchs: are you familiar with django at all? or are you just interested in the project in general |
| 14:33 | antifuchs | danlarkin: I am working on a rails project, and am hearing left and right that django would be much better |
| 14:33 | antifuchs | that is most of the familiarity I have with django itself (: |
| 14:34 | danlarkin | well I've never used rails myself, but I know a lot of people that have moved rails->django, and zero django->rails :) |
| 14:34 | antifuchs | yeah, I bet |
| 14:34 | antifuchs | ((-: |
| 14:35 | danlarkin | right now I could use joshua choi to help me use his fnparse library :) |
| 14:36 | antifuchs | anyway, I would love to have something lispy (and sane enough to show to my teammates and not have to tell them that the ANSI committee didn't think this concept would one day dominate the world) to do this in (: |
| 14:40 | danlarkin | maybe I'll post to the group when I decide to put it on github |
| 14:41 | Lau_of_DK | You do that - Im looking forward to seeing it |
| 14:41 | Lau_of_DK | Which license are you putting it under? |
| 14:41 | danlarkin | BSD |
| 14:41 | Lau_of_DK | Why? |
| 14:42 | danlarkin | because I like free code |
| 14:42 | Lau_of_DK | So why not EPL? |
| 14:42 | Lau_of_DK | Or LGPL? |
| 14:42 | danlarkin | why not just BSD |
| 14:43 | danlarkin | bsd is compatible with both of those licenses |
| 14:43 | Lau_of_DK | Arent you forcing me to answer your question now? |
| 14:45 | danlarkin | are you asking me why I don't want a more restrictive license? |
| 14:46 | antifuchs | may be interesting to get a lawyerly opinion on whether lgpl is more compatible with clojure code than with cl code |
| 14:46 | Lau_of_DK | I understand GPL, LGPL, CPL and EPL fairly well, and I understand EPL to be very free, without any unessarcy restrictions. But I dont understand BSD or what it offers compared to one of the others |
| 14:47 | antifuchs | AIUI, lgpl has very explicit terms defined that probably don't work with languages that have macroexpand |
| 14:48 | antifuchs | IANAL and have been told this only by nonlawyers wo took this issue with regards to CL code up to rms, also not a lawyer |
| 14:48 | mattrepl | BSD is short and very free: http://www.opensource.org/licenses/bsd-license.php |
| 14:48 | antifuchs | so well. lawyers would be nice to have... especially those who know lisp (: |
| 14:49 | apage43 | also i keep trying to get my paralegal buddy into lisp but meh |
| 14:50 | danlarkin | mattrepl: that version is known as the 3-clause BSD |
| 14:50 | danlarkin | an author can omit any (or all) of the 3 clauses at one's leisure |
| 14:50 | mattrepl | the simplified one is mentioned in the text as well.. just remove the third clause about endorsement |
| 14:51 | danlarkin | I'm using 3 clauses for clojure-json |
| 14:51 | mattrepl | danlarkin: interesting. hadn't heard of that, thought it was only the third one. |
| 14:52 | danlarkin | mattrepl: well it's customary to use either 1 & 2 or 1, 2 & 3... but it's up to the author. The license could say "You can't use this work on tuesdays" and it would be just as binding |
| 14:53 | apage43 | http://sam.zoy.org/wtfpl/ |
| 14:53 | mattrepl | =) |
| 15:41 | rhickey | is (educe iter enum) too subtle/cute/quirky for "Runs the enumeration into the iteratee and returns the result", for LFEs i nthe style of: http://okmij.org/ftp/Haskell/Iteratee/DEFUN08-talk-notes.pdf |
| 15:43 | Lau_of_DK | Too cute for what purpose? A presentation of sorts? |
| 15:53 | rhickey | (educe ((comp (ifilter even?) (imap inc)) (ifold + 0)) |
| 15:53 | rhickey | (ecat (erange 100) (erange 100))) |
| 15:53 | rhickey | 5000 |
| 15:54 | Chouser | what's the etymology of 'educe'? |
| 15:54 | danlarkin | looks like haskell with parens |
| 15:54 | Chouser | oh, i see |
| 15:55 | rhickey | danlarkin: the Haskell looks a lot worse, IMO |
| 15:56 | rhickey | Chouser: "lead out", also a pun on reduce |
| 15:59 | lisppaste8 | rhickey pasted "LFE stuff" at http://paste.lisp.org/display/73823 |
| 15:59 | rhickey | for those wanting to play along ^^ |
| 16:01 | AWizzArd | rhickey: could you maybe add something like (defn pipe [& fs] (apply comp (reverse fs))) to Clojure? Or is that not needed iyo? |
| 16:02 | rhickey | AWizzArd: I haven't needed it yet |
| 16:02 | AWizzArd | in some situations it could make things a bit more readable than comp, and easier to think about |
| 16:04 | rhickey | That LFE stuff is as simple as I can make it, and yet I'm still concerned about the complexity of te model and ability of people to write their own enums/iters |
| 16:04 | rhickey | plus I hate the names |
| 16:05 | danlarkin | I'll say I hate the names too... even though I have no better ones |
| 16:08 | rhickey | "iteratee" in the original work is particularly bad. I think accumulator might be better |
| 16:09 | kotarak | how is io-scope (or what it is called now) coming along? |
| 16:10 | rhickey | kotarak: io-scope is fine, and a nice idea in general. I think it handles the resources management problem at least as well as LFEs |
| 16:10 | kotarak | will it be included soon? |
| 16:10 | rhickey | just looking at LFEs for feasibility, also they are purely functional while streams are very much not |
| 16:16 | Chousuke | I find that LFE stuff difficult to understand :/ |
| 16:17 | AWizzArd | rhickey: can you already say something about the performance? |
| 16:18 | rhickey | AWizzArd: of LFEs? |
| 16:19 | AWizzArd | yes |
| 16:21 | rhickey | less overhead than seqs |
| 16:21 | AWizzArd | actually they could be interesting for a proxy server/request broker that I will soon begin to implement |
| 16:21 | rhickey | but the value is not perf, but resource management safety when used with resource-based sources |
| 16:21 | Chousuke | It seems to me that first you compose "iterator transformers" (ifilter and imap), then feed an "iterator operation" (ifold) to produce the final iterator that will consume the enumeration somehow. but it still escapes me how educe works. ...hmmh |
| 16:22 | Chousuke | could seriously use some kind of visualisation of what the hell is happening. :) |
| 16:24 | rhickey | enums are logical collections of items represented by a function that, when passed an iter, feeds each item to the iter. An iter can accumulate anything it wants to, and can signal early termination of the enumeration |
| 16:25 | Chousuke | so a single iterator can gobble multiple items of the enumeration |
| 16:25 | rhickey | imap and ifilter are iter transformers, yes |
| 16:26 | rhickey | still missing is ichain, which will allow a set of iters to act sequentially as one iter |
| 16:26 | Chousuke | at one "step" that is, before yielding output to to the "next" level in the transformation chain? or does every transformer have access to all of the enumeration somehow? |
| 16:27 | rhickey | Chousuke: one item at a time, unlike the paper which passed 'chunks' of items |
| 16:28 | rhickey | but a stage could collapse (like ifilter) or even expand in passing to next stage |
| 16:29 | Chousuke | defining those things looks really cumbersome though :/ |
| 16:30 | rhickey | Chousuke: I agree, the model is rather involved |
| 16:31 | rhickey | but the usage is straightforward |
| 17:25 | dnolen | is it possible to get the name of a namespace object as a string? I've looked at the API but I don't see anything applicable. |
| 17:25 | kotarak | (doc ns-name) |
| 17:25 | clojurebot | Returns the name of the namespace, a symbol.; arglists ([ns]) |
| 17:25 | kotarak | (doc name) |
| 17:25 | clojurebot | Returns the name String of a symbol or keyword.; arglists ([x]) |
| 17:27 | dnolen | kotarak thanks, i see it now on the clojure page on namespaces, still getting used to getting around. |
| 17:28 | kotarak | dnolen: np, find-doc in the repl is also helpful to investigate such things. |
| 18:19 | karmazilla | Chouser: have a minute? |
| 18:33 | durka42 | kotarak: i have a proposal for a gorilla feature |
| 18:53 | blbrown | here is rich hickey from? |
| 18:56 | drewr | blbrown: NYC. |
| 19:10 | dnolen | is it possible to convert a list/vector of keys and values into a hash-map? |
| 19:11 | durka42 | (doc zipmap) |
| 19:11 | clojurebot | Returns a map with the keys mapped to the corresponding vals.; arglists ([keys vals]) |
| 19:11 | durka42 | is that what you meant? |
| 19:11 | Chousuke | ,(apply hash-map '(:a 1 :b 2)) |
| 19:11 | clojurebot | {:b 2, :a 1} |
| 19:13 | dnolen | chousuke thanks, zipmap looks useful as well durka. |
| 19:15 | hiredman | ,(doc zipmap) |
| 19:15 | clojurebot | "([keys vals]); Returns a map with the keys mapped to the corresponding vals." |
| 19:54 | jli | Is it just me, or does blip.tv not allow skipping to part of the video you haven't downloaded yet? |
| 20:15 | blbrown | what can be done with the 'doc' meta data. Is there a javadoc like tool in clojure? |
| 20:16 | Chouser | blbrown: doc and find-doc use it. |
| 20:16 | Chouser | (doc find-doc) |
| 20:16 | clojurebot | Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern; arglists ([re-string-or-pattern]) |
| 20:16 | blbrown | Chouser, but there isn't a javadoc tool, I guess I could write my own |
| 20:30 | gnuvince_ | What tool do you guys use to profile Clojure code? |
| 20:36 | blbrown | This is my first real clojure app, only like 800 lines, http://botnode.com/src/text_viewer_1.png |
| 20:39 | gnuvince_ | I really ought to get a Java book to learn about Swing so that I could make interfaces for the (small) apps I write. |
| 20:40 | Cark | there are tons of nice tutorials at sun |
| 20:41 | blbrown | I would use swt. I am done with swing |
| 20:42 | Cark | swing is no good ? |
| 20:43 | blbrown | Cark, I don't think so, and SWT is so much cleaner and easier to work with. There are also plug and play widgets that come with SWT like a working web browser |
| 20:44 | gnuvince_ | Is SWT shipped with the JRE? |
| 20:44 | blbrown | Nope, Eclipse is based on SWT, so it is here. http://www.eclipse.org/swt/ |
| 20:45 | blbrown | but then again, I haven't tried swing with clojure, clojure may improve on swing |
| 20:51 | lisppaste8 | gnuvince pasted "Does that look okay?" at http://paste.lisp.org/display/73836 |
| 21:08 | lisppaste8 | rhickey pasted "scope blocks" at http://paste.lisp.org/display/73838 |
| 21:09 | rhickey | io-scope has evolved into ^^ |
| 21:10 | rhickey | general system for resource management |
| 21:10 | Chouser | exits first, then succeeds/fails |
| 21:10 | rhickey | reverse order of declaration |
| 21:11 | Chouser | wow |
| 21:11 | rhickey | irrespective of cause |
| 21:15 | antifuchs | rhickey: wouldn't it make more sense to be by order of arguments? |
| 21:15 | blbrown | is that feature found in other languages |
| 21:15 | rhickey | antifuchs: I don't think so |
| 21:15 | antifuchs | unix shells with their trap function/ |
| 21:15 | aperotte | Chouser: I saw your discussion on the google group about adding post-init to gen-class, has there been any more discussion on it? |
| 21:16 | rhickey | blbrown: D has a similar feature, but you can't control the scopes, they are the nearest enclosing language-level block |
| 21:16 | antifuchs | rhickey: hm, why? |
| 21:17 | aperotte | Chouser: I've come up against the same issue trying to use the restlets library and was wondering if there was a way around the issue |
| 21:18 | antifuchs | I think boa is the default for many things... it seems pretty exceptional to have stuff come out in reverse order sometimes |
| 21:19 | rhickey | antifuchs: not sure what you mean by boa here, but most times resources are freed in reverse order |
| 21:20 | antifuchs | ah, that's true |
| 21:20 | rhickey | in any case, you have control as it is based on the order of calls to when-scope |
| 21:21 | antifuchs | I'm used to resources getting freed through stacking of with- forms, but as a cleanup thing it does make sense. |
| 21:23 | rhickey | stacking with-s unwinds in reverse too |
| 21:37 | rhickey | scope names ok? |
| 21:38 | danlarkin | I think so |
| 21:38 | danlarkin | so in your example, you're just putting a few when-scopes in a function for convenience, right? There's no semantics involved with that? |
| 21:39 | danlarkin | or.. not semantics, I mean it could just be in the body of the (scope) form? |
| 21:40 | rhickey | danlarkin: just trying to demonstrate it is a truly dynamic scope, not just lexical |
| 21:40 | danlarkin | mmhmm |
| 21:41 | rhickey | the different when-scopes happen due to different scope termination situations |
| 21:42 | rhickey | :exits matches any, :fails matches exits w/exception, :succeeds matches exit normally |
| 21:43 | rhickey | when-scope not within any scope throws exception |
| 21:43 | rhickey | so nested contexts can create, register, and return resources knowing they will get cleaned up |
| 21:46 | danlarkin | I like this |
| 21:50 | hiredman | very useful |
| 21:57 | blbrown | You guys might be able to help me. In lisp/clojure, I think of 'macros' as DEFINE's in C (#define ABC 123), a syntax for replacing values in code. Is this true or is it a lot more complex. |
| 21:58 | apage43 | a lot more complex |
| 22:00 | apage43 | see http://clojure.org/macros |
| 22:00 | Chouser | well, it's the same core idea, though |
| 22:01 | apage43 | Chouser: well, far from a "#define ABC 123". I don't think i've ever seen a lisp macro used to store a constant =P |
| 22:01 | Chouser | two big differences are that #define produces text instead of structured code/data (s-exprs). The other is that lisp macros can use any *function* defined earlier, not just other macros. |
| 22:02 | Chouser | apage43: the #define rabbit hole goes deeper than that, though. :-) |
| 22:02 | apage43 | of course |
| 22:02 | apage43 | but #define is still not near as powerful |
| 22:03 | apage43 | also complex #define's are terrrrible to debug |
| 22:04 | Chouser | yes, of course, that's all true. |
| 22:05 | Chouser | but it's not a completely unrelated concept, like for example Excel macros. |
| 22:15 | Chouser | and I've used #define to add control structures, just like lisp macros. 'foreach' |
| 22:15 | Chouser | but yes, terrible |
| 22:20 | danlarkin | Chouser: oh jeez. that's awful |
| 22:26 | blbrown | look at the linux kernel source...that is some scary use of macros |
| 22:58 | blbrown | I also never totally understood when you should write a macro and when just a function would do |
| 22:59 | danlarkin | in lisps? |
| 23:00 | Cark | you mean in the linux kernel or using clojure ? |
| 23:00 | danlarkin | you only need a macro if you want to control evaluation of forms |
| 23:00 | blbrown | in lisps |
| 23:00 | Cark | danlarkin : nope, you can do this with high order functions |
| 23:01 | blbrown | danlarkin, I think I see what you are saying. When I need more than a <function-call args>? |
| 23:01 | Cark | you need macros to make your code pretty, that's about it |
| 23:01 | danlarkin | Cark: functions can't control evaluation of their arguments |
| 23:01 | durka42 | or to avoid repetition |
| 23:02 | Cark | (defn my-if [cond-fn true-fn false-fn] ....) |
| 23:02 | Cark | that's what i mean |
| 23:02 | Cark | of course that's ugly |
| 23:02 | Cark | though not that ugly with clojure |
| 23:02 | durka42 | true, but what about lazy and/or |
| 23:03 | Cark | same thing |
| 23:03 | durka42 | short-circuiting is the word i was looking for |
| 23:03 | durka42 | oh if you wrap everything in a #() i suppose |
| 23:03 | Cark | (defn my-or [& list-of-predicate-functions] ...) |
| 23:03 | Cark | so really, maccros are only there to make it pretty |
| 23:04 | danlarkin | Cark: (defn my-if [cond-fn true-fn false-fn] ....) doesn't control evaluation of arguments, cond-fn, true-fn and false-fn will all be evaluated. They won't be /executed/ unless you call them, but they're still evaluated |
| 23:04 | durka42 | if you want to use things that won't resolve as symbols you need a macro |
| 23:04 | apage43 | Cark: somewhat. the my-or and my-if would a, have to take -functions-, which means using them uses more stack space than the macro version |
| 23:05 | Cark | hehe sure, but that's implementation detail |
| 23:07 | Cark | i beleive in some smalltalks that's how if is defined |
| 23:09 | Cark | danlarkin: the point is i can still call (if #(identity true) #(identity 1) #(/ 1 0)) |
| 23:09 | Cark | i mean "my-if" |
| 23:09 | danlarkin | There are things macros can do that functions cannot, and those things rely on delaying (or canceling) evaluation of arguments. Sure, "if" could be written with functions, but that would be a different language |
| 23:10 | Cark | of course noone would rewrite an if function, that's only an exemple of controling evaluation using high order functions |
| 23:11 | Cark | what's really bad in this my-if thing, is that it's leaking implementation detail |
| 23:11 | Cark | that's why you want a macro |
| 23:11 | Cark | so the user don't need to know oh that works |
| 23:11 | Cark | *how |
| 23:12 | Chouser | but users generally do need to know if the thing they're calling is a macro or a function |
| 23:12 | Cark | ahh true |
| 23:12 | apage43 | eh, not as such, they just need to know what the thing they're calling returns |
| 23:12 | Chouser | macros can do things like capture names, which fns cannot |
| 23:13 | Chouser | apage43: no, the fact that 'and' short-circuits is sometimes important. |
| 23:13 | Chouser | macros can do things at compile-time, which fns cannot. Clojure uses this for 'proxy', for example. |
| 23:13 | Cark | chouser : going purely functional you wouldn't need to capture names at all |
| 23:14 | blbrown | this is a good discussion, someone save it. |
| 23:14 | durka42 | clojurebot: logs |
| 23:14 | clojurebot | logs is http://clojure-log.n01se.net/ |
| 23:14 | Cark | chouser : hum you could use function calls directly in your source file, and call the api |
| 23:14 | Cark | like creating namespaces and such |
| 23:15 | Cark | of course macros are nice don't get me wrong ! |
| 23:15 | durka42 | that might be difficult without the . macro |
| 23:15 | Chouser | but usages of 'proxy' aren't at the top level, so if it were a function it couldn't do anything at compile time. |
| 23:16 | Cark | right, though that's specific to clojure |
| 23:17 | apage43 | anyway |
| 23:17 | apage43 | the end purpose of macros is to allow you to write -less code- |
| 23:17 | apage43 | which they can do in ways functions cannot |
| 23:17 | Cark | and prettier ! |
| 23:18 | Chouser | I'm pretty sure name capture would still be useful in a pure functional language. |
| 23:18 | Cark | well you do it this way : (my-hf (fn [captured-name] ....)) |
| 23:19 | Chouser | Cark: ah, you're right. Good point. |
| 23:20 | Cark | i couple months ago i wanted to have the prog1 macro included in clojure |
| 23:21 | Cark | then some person (andre thieme?) reminded me that this could be done with a function |
| 23:23 | Chouser | so yes, macros are for simplifing code that cannot be simplified sufficiently using a function. |
| 23:25 | Cark | nice flamme war on c.l.l ...thei're talking a bit about clojure and implementing lisp on the jvm |
| 23:27 | gnuvince_ | lik? |
| 23:27 | gnuvince_ | link |
| 23:28 | Cark | hum i'm reading from a newsgroup reader =/ ... it's "Making lisp popular - can it be done" in comp.lang.lisp |
| 23:29 | durka42 | http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/be5630a07e123df2/3e06f2cb3734c9ab?lnk=gst&q=making+lisp+popular#3e06f2cb3734c9ab |
| 23:29 | durka42 | bah, cut before &q to lose the highlighting |
| 23:33 | danlarkin | jeez |
| 23:33 | danlarkin | these people are _angry_ |
| 23:36 | Cark | that's c.l.l for you =) |
| 23:36 | Cark | still they're very helpfull |
| 23:37 | Cark | ...usually |