#clojure log - Apr 28 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:01 unlink1: oh

0:01 My NPEs are from map or dorun then

0:01 hiredman: ...

0:03 unlink1: er.

0:05 qmrw: sssdd~.

2:39 Lau_of_DK: Top of the morning gents

5:44 unlink1: I'm using vimclojure tip, but my syntax highlighting isn't working right (e.g. "def" doesn't get highlighted, it doesn't consider "when-let" a single word, nor does it highlight "-let".

5:44 )

8:44 rhickey: how are people holding up with new jar filenames?

8:45 * cemerick gets the feeling he should get up to HEAD

8:51 cemerick: rhickey: eh, that's fine by me...but I'll bet that will mess a lot of people up, though, especially people that set up clojure as an svn:external or git submodule, and then point their IDE at projectname/ext/clojure/clojure.jar, etc. I'd suggest copying the jar files to their usual locations as well (clojure.jar, clojure-slim.jar, etc).

8:52 gnuvince: New jar names?

8:53 rhickey: cemerick: I expected that suggestion. I wonder though, once most people are on releases, if they should instead have clojure-1.0.0.jar as their IDE dependency. Trunk will be for devs/patchers

8:53 * hoeck agrees with cemerick

8:54 rhickey: most libs are now distributed with versions in their jar names, no?

8:54 cemerick: rhickey: setting up an svn:externals/git submodule tied to a particular rev/tag is *very* common, and I view referring to version-numbered jar files as a guarantee of future breakage/irritation.

8:55 rhickey: mv foo-1.2.3.jar foo.jar is the first thing I do when I pull in a new dep.

8:56 to be clear, this is irrelevant to me (as we keep the clojure/clojure-contrib we use in a separate internal git repo we pull in via a submodule, so it's trivial to rename when we update that repo).

8:56 rhickey: I'm not opposed, I just wonder if it will give people bad habits

8:57 cemerick: tangential Q: why does the compiled-clojure jar retain the .clj files?

8:58 rhickey: cemerick: for tools?

8:59 cemerick: isn't all of the metadata in the class files anyway?

8:59 rhickey: not the source

9:00 cemerick: huh -- if one wanted that, wouldn't one set the 'source' attribute on the clojure.jar entry in the classpath to the clojure-sources.jar file?

9:00 (that's what I thought the sources jar was for)

9:01 rhickey: better to ask this on the group

9:01 people complained when no source in the main jar

9:01 cemerick: that was mostly rhetorical :-)

9:01 rhickey: I don't care

9:01 cemerick: huh

9:01 rhickey: not a big space savings

9:02 slim and sources were invented by others

9:05 cgray: hi, I'm having trouble with doseq: (doseq [x (list 1 2 3)] (doseq [y (list 1 2 3)] (print (str x) (str y)))) is printing some 1-digit numbers, which is not what I would expect...

9:05 cemerick: mmm, filenames in reflection warnings. That's tasty.

9:07 rhickey: cgray: print puts paces between its args, try: (doseq [x (list 1 2 3)] (doseq [y (list 1 2 3)] (print (str x y " "))))

9:08 also, doseq support multiple seqs: (doseq [x (list 1 2 3) y (list 1 2 3)] (print (str x y " ")))

9:11 cgray: rhickey: thanks, at least that isolates the bug to my program :)

11:32 what is the syntax to override a method in a proxy?

11:33 never mind, i made a mistake

13:18 technomancy: the JVM still supports green threads as an option, correct?

13:24 p_l: technomancy: afaik no

13:27 technomancy: it seems like there's still an advantage to green threads for i/o bound tasks, right? since they're so much cheaper to spin up?

13:27 or does pooling threads make that cheap enough with native threads?

13:30 danlarkin_: I think theoretically thread pools slim the gap

13:39 AWizzArd: Does Clojure offer the functionality to append data to a file on disk? If not, what jvm class is the right one for that job?

13:39 kotarak: AWizzArd: probably java.io.FileOutputStream with some option?

13:40 maybe duck-streams with some option?

14:55 technomancy: slime's macroexpand makes me so happy

14:57 heh: "If none of the macros in Clojure seems complex to you, my company is hiring." (from the book)

14:58 Chouser: 'for' is so easy to understand, would be so easy to write if I needed it, I don't see why it's even included in core.

14:59 Cark: hehe

15:00 cgrand: Chouser: how about destructure? :-)

15:01 Cark: ~def for

15:02 Chousuke: cgrand: luckily destructure is not a macro!

15:04 cgrand: Chousuke: that's true it doesn't say "If none of the macros (nor their helper fns) in Clojure seems complex to you, my company is hiring."

15:06 Chousuke: it's amusing how most logic in destructure is inside the let form :P

15:06 AWizzArd: Yes, I noticed the same.

15:07 rhickey: when I have a (def x (ref { ... })) then @x is always a snapshot, that was valid at the time I read it, right? When I am printing a huuge @x into a file and transactions change the contents of this hashmap, it will not interfer with my printing right?

15:08 Chousuke: that's correct.

15:08 AWizzArd: ok

15:11 Chousuke: you need to take care not to do @foo too many times in your code, though

15:12 AWizzArd: why?

15:12 Chousuke: I mean, it's pretty easy to make the mistake of reading it too many times, and expecting the value to be the same each time.

15:12 kotarak: Because you might get different @x's.

15:13 AWizzArd: Ah ok, that. I thought it would cost too much memory or something like that. No no, I am aware that each @x could potentially be a different one.

15:13 But when I pass it to some function F I need to be sure that inside of F it will not change.

15:14 hiredman: :(

15:14 Chousuke: it's evaluated when the function F is called

15:14 so you pass the value you get from the deref

15:14 AWizzArd: yes

15:15 hiredman: all I get from the latest smack when trying to login is NPE

15:15 kotarak: AWizzArd: that's the trick of alter..

15:15 AWizzArd: What trick?

15:16 kotarak: alter passes a the current value of the ref to a function. So you don't need multiple @x's...

15:18 AWizzArd: yes

15:35 technomancy: is sorted-map the only way to get a map that guarantees order?

15:36 kotarak: array-map also does, I think.

15:36 technomancy: kotarak: thanks; that's what I needed.

15:53 cemerick: FYI but OT: my company and another in the area are sponsoring a presentation by Ben Fry (the Processing guy) in Northampton, MA. It's sure to be interesting. http://blog.snowtide.com/2009/04/28/snowtide-informatics-welcomes-ben-fry-of-processing-fame-to-northampton Northampton is about 2.5 hrs from Boston and NYC, so it might be worth the trip if you're interested in data visualization.

16:03 clojurebot: testing new-send-out

16:03 durka42: hiredman: it works

16:07 hiredman: sorry I forgot to send that to #clojurebot

16:11 lisppaste8: technomancy pasted "metadata on proxies" at http://paste.lisp.org/display/79367

16:11 technomancy: any ideas why this fails?

16:11 I get java.lang.UnsupportedOperationException

16:12 but dnolen was saying yesterday that proxying fns allows you to put metadata on them

16:12 Chouser: yeah, you can't change metadata on an AFn

16:13 technomancy: I wonder what dnolen meant then. he seemed to imply that this would work; maybe I misunderstood him

16:13 Chouser: you can use proxy to give a fn metadata right when you create it.

16:14 technomancy: Chouser: you mean don't use with-meta; use the reader syntax instead?

16:15 Chouser: no, I mean use proxy as you do there.

16:15 ^(make-funcallable (fn []))

16:15 normally a fn has no metadata at all

16:16 technomancy: oh, the new metadata needs to go inside the second param to proxy then?

16:16 I see.

16:16 Chouser: yes

16:16 technomancy: thanks!

16:17 Chouser: sure, hope it helps...

16:17 technomancy: it's an unfortunate hack, but I feel better about using it knowing that metadata directly on fns is planned

16:17 hopefully in the not-too-distant future

16:18 unlink: I'm using the exact same vim configuration with vimclojure tip on both machines. On one installation, Ubuntu 8.10 VIM 7.1, vimclojure works as expected. On the other, Ubuntu 9.04 VIM 7.2, I am experiencing problems such as keywords spanning hyphens not matching (like when-let) and regular ^N completion not obeying vimclojure's word redefinition (such as *command-line-args* not completing).

16:18 I suppose the configuration is not identical -- one runs on top of the 7.1 VIM runtime, and the other on top of the 7.2 runtime.

16:19 kotarak: unlink: did you install a previous version on the second machine before?

16:20 unlink: I don't think so.

16:20 kotarak: I would expect 7.2 to work more smooth than 7.1...

16:21 unlink: Yeah, it works just fine on 7.1. I'm not using ng or anything though.

16:21 kotarak: hmmm...

16:22 Is something else different between the two machines? other plugins, settings, etc...

16:23 unlink: Let me try again with a minimal vimrc.

16:30 Oh, the problem is that I didn't RTFM. I had set filetype indent on, which apparently is synonymous with filetype indent plugin on, but only with VIM 7.1.

16:32 kotarak: unlink: k. Good that it works now. :)

16:35 unlink: kotarak: How do you set omnifunc?

16:35 kotarak: set omnifunc=theFunc()

16:35 w/o checking the exact syntax.

16:37 unlink: I mean, it would be setl omnifunc=theFunc, but I mean, I'm asking the correct way to do it for clojure. Am I expected to do it in a filetype aucmd?

16:37 kotarak: unlink: you don't have to do it. VimClojure does it for you.

16:37 Just use <C-x><C-o> in a Clojure file. Eg. r-s<C-x><C-o> => read-string, resultset-seq, ...

16:38 unlink: Ok. ^X^O says Option 'omnifunc' is not set.

16:38 kotarak: unlink: did you put "let clj_want_gorilla = 1" in your .vimrc?

16:39 unlink: yes.

16:39 kotarak: Hmm...

16:40 Did you start the ng-server?

16:42 unlink: Thanks for your help, I have to go.

16:42 kotarak: k

16:42 Chousuke: gorilla seems to blow up quite spectacularly if the ng server is not running.

16:43 kotarak: Chousuke: not anymore

16:43 Chousuke: maybe I should upgrade then

16:43 kotarak: It just turns off interactivity.

16:44 But it blows up with (namespaced) files not being in the classpath or containing syntax errors.

16:45 Basic highlighting and <C-n> completion work also without the server.

17:45 kadaver: how do you say :string in clojure contrib sql?

17:45 i mena isntead of :int

17:52 eevar__: kadaver: "varchar(255)"

17:52 or text, or clob

18:10 technomancy: where does console output go when an agent performs it?

18:10 ~(send (agent "hi") println)

18:10 clojurebot: No entiendo

18:11 technomancy: is there a separate *out* for agents?

18:11 or are you just not supposed to have side-effects in functions you send them?

18:14 Chousuke: they can have side effects... dunno about the output though :)

18:17 drewr: ,(set [4 5 2 8 1])

18:17 clojurebot: #{1 2 4 5 8}

18:17 drewr: ,(sorted-set [4 5 2 8 1])

18:17 clojurebot: #{[4 5 2 8 1]}

18:17 technomancy: works but is lame: (let [my-out *out*] (send (agent "hi") #(binding [*out* my-out] (println %&))))

18:17 drewr: ,(sorted-set 4 5 2 8 1)

18:17 clojurebot: #{1 2 4 5 8}

18:17 drewr: Why does set and sorted-set both sort their sets?

18:18 technomancy: drewr: I don't think order is guaranteed with set

18:19 it's sorted for this instance, but you shouldn't rely on it.

18:19 drewr: I actually wanted it unsorted :-)

18:20 technomancy: ,(hash-set 4 5 2 8 1)

18:20 clojurebot: #{1 2 4 5 8}

18:20 technomancy: hrm; dunno.

18:21 ,(array-map 4 4 5 5 2 2 8 8 1 1)

18:21 clojurebot: {4 4, 5 5, 2 2, 8 8, 1 1}

18:21 technomancy: works the same way, but is six kinds of hacky

18:21 if you want insertion order, I mean

18:23 hiredman: ,(into #{} 8 93 2 1 3)

18:23 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$into

18:23 hiredman: ,(into #{} '(8 93 2 1 3))

18:23 clojurebot: #{1 2 3 8 93}

18:30 technomancy: wow, the indentation in the Java implementation of Clojure is pretty weird. =)

18:30 ctdean: You might need to set your tabs

18:31 drewr: technomancy: :-)

18:31 duncanm: hmmm

18:31 i can't have two overloads with the same arity?

18:31 what if I distinguish them by a type hint?

18:31 technomancy: ctdean: maybe, but some nesting levels don't increase the level of indentation

18:32 ctdean: That is funny.

18:32 What file?

18:32 technomancy: ctdean: Agent.java, but I've seen it other places too

18:32 is it meant for 4-space tabs then?

18:33 * technomancy has had the good fortune to never have had to work with a tabbed codebase before.

18:34 ctdean: Yes, 4 space tabs

18:34 Yea, I hate hard tabs myself. But some people like them. cest la vie

18:35 technomancy: well at 4 spaces it looks a bit more reasonable

18:35 hiredman: duncanm: if you want to distinguish beyond arity you need multimethods

18:36 the (defn f ([])([])) form only distinguishes based on arity

18:36 (dispatches)

18:37 technomancy: just the top-level class defintion of a file doesn't increase the indentation, which I guess is not too weird if you know every file is going to contain only a single class

18:38 to each his own. it's not stuff I'm reading often. =)

19:00 kadaver: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "LIMIT" at line 1, column 47. (NO_SOURCE_FILE:0)

19:00 "select * from songs order by timesplayed desc limit 10" ; that gives syntax error on limit 10,why?

19:02 cp2: try putting it before the order by maybe?

19:02 unlink: Does it work from your SQL shell?

19:05 kadaver: dont have a sql shell

19:05 jdbc only

19:05 before didnt work

19:05 "select * from songs limit 10 order by timesplayed desc"

19:05 java.sql.SQLSyntaxErrorException: Syntax error: Encountered "10" at line 1, column 27. (NO_SOURCE_FILE:0)

19:08 unlink: a HA! not=

19:12 kadaver: ?

19:12 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

19:13 technomancy: what specifically is wrong with single-segment namespaces?

19:13 is it just due to an arbitrary JVM bug?

19:13 sorry, "decision". =)

19:15 Chousuke: the chance of collisions would be rather high if single-segment namespaces were common. :/

19:16 technomancy: if your project has the same name as another project, the fact that your classes go in the same namespace is the least of your worries

19:16 Chousuke: and your source directory will be a mess :)

19:17 technomancy: picking a good name is hard

19:18 Chousuke: most of the time you'll want more than one segment in your namespaces anyway, because it doesn't make sense to put everything under one name even within one project.

19:18 unless it's a single file or something.

19:19 technomancy: well, for mire I had a "mire" namespace that launched the server, but the meat of the code was in "mire.commands", "mire.rooms" etc.

19:20 then when I wanted to AOT it, I had to move "mire" to "mire.server" for no good reason.

19:20 it's a nitpick for sure; just seems really arbitrary.

19:21 and whenever it's arbitrary, I assume it's due to the JVM rather than a specific limitation of Clojure. =)

19:22 powr-toc: technomancy: Were you behind the peepcode screencast?

19:22 technomancy: powr-toc: yeah, I wrote the script.

19:23 powr-toc: got some feedback?

19:25 powr-toc: technomancy: I got my boss to buy it for me today... I posted to the google group today... basically I thought the illustrative example was really good, but that it wasn't clear who it was pitched at

19:25 or rather the level it was pitched at

19:25 technomancy: powr-toc: yeah, I could see that.

19:26 it's hard to be all things to everyone. wanted to cover a wide variety of topics, but it did feel rushed at parts.

19:26 powr-toc: technomancy: I totally understand the pressures though... I did a 20 minute talk on erlang once, and was desperate to get to the good stuff, but felt I had to give some intro/background

19:27 technomancy: I think for people who are really serious about learning Clojure, the screencast and the book complement each other.

19:27 the screencast can get you excited and it will probably help cement a few of the trickier concepts that are hard to cover in just text, but it's a lousy reference, so the book is still important.

19:27 powr-toc: technomancy: I think so... as an indicator of clojure adoption do you know how well it's selling btw?

19:28 technomancy: powr-toc: well I did a screencast on Emacs earlier in December, and it's not quite selling as fast as that, but pretty close.

19:28 powr-toc: (not meaning to pry btw ;-) )

19:28 technomancy: the thing is that everyone knows what Emacs is, so everyone who wanted to buy it got it in the first few days.

19:29 with Clojure I expect the interest to build more over time, especially as 1.0 is released soon

19:30 powr-toc: good point... I was always curious about that Emacs screencast, maybe I'll have to get that too :-)

19:31 technomancy: it was kind of an experiment to begin with as most PeepCode screencasts have been targeted towards the Ruby community in the past.

19:31 powr-toc: people seemed to like the Emacs one a lot. it was definitely more obvious who the audience was. =)

19:33 powr-toc: technomancy: well, the Ruby communities seems to be a good one for that kinda thing, as they tend to be early adopters etc...

19:33 technomancy: yeah, the git screencast was particularly popular

19:33 powr-toc: technomancy: I know a lot of ruby guys who rave about peepcode too

19:33 technomancy: there's always a risk involved in investing in cutting-edge topics, but I think this one paid off.

19:34 powr-toc: technomancy: definitely

19:35 I thought the http://www.youtube.com/user/briantwill presentations were very good too

19:36 kadaver: (loop [[x & xs] res

19:36 acc []]

19:36 (if (nil? x)

19:36 acc

19:36 (recur xs (conj acc x))))

19:36 technomancy: yeah, _very_ different style though

19:36 kadaver: can you simplify that?

19:36 technomancy: his are more like lectures

19:36 danlarkin: kadaver: please don't paste multiple lines of code to the channel, use a pastebin like paste.lisp.org

19:37 powr-toc: technomancy: yeah, it's nice with yours to see a bit of the development cycle... it's new to just about everyone who isn't a lisper

19:39 kadaver: hmm its a fold

19:39 technomancy: does anyone have a slime macroexpand hack that pretty-prints the results?

19:41 powr-toc: technomancy: actually, elaborating on that... I find the (emacs) lisp style of development where you eval sexp's into the REPL to be a big improvement over just having a REPL, as is common in ruby circles... having more demonstrations around that would doubtless wow some people

19:42 technomancy: powr-toc: yeah, I wanted to use slime more in the video, but there were some problems getting it set up due to some instability at the time

19:43 powr-toc: we decided covering slime would take too much time, so we're doing a separate (free) screencast on clojure editor support.

19:43 powr-toc: sweet!

19:43 technomancy: it already felt rushed; I'm sure you can imagine how it would feel if we spend some time getting slime set up and explaining its features; heh

19:43 powr-toc: technomancy: yeah, that wouldn't have pleased me ;-)

19:44 technomancy: the editors one was supposed to be a teaser, but it got delayed... oh well.

19:44 hopefully it can still drive interest

19:45 powr-toc: I've not yet taken jumped to slime, mostly because of the apparant brittleness around versions... clojure-mode with paredit seems pretty good, until you get into using namespaces

19:45 technomancy: powr-toc: last week I would have told you not to worry about breakage, but a few days ago a change to test-is broke clojure-test-mode. =\

19:45 that's actually orthogonal to regular slime though.

19:46 but you can just wait for the screencast if you want. =)

19:46 powr-toc: hehe... maybe I'll wait a little longer... what killer features does slime give?

19:46 (over clojure-mode/paredit)

19:46 technomancy: oh man... where to start. =)

19:47 powr-toc: hehe... I thought that'd be the answer

19:48 technomancy: the slime manual is pretty comprehensive too

19:48 though some of it is CL-specific

19:55 if you queue some actions to an agent using send and others to send-off, they're not guaranteed to run in the order you send them, are they?

19:55 * technomancy heads to the sourc

19:55 technomancy: e

19:56 dreish: Looks like they get added to the same queue.

19:56 Aw, you drove rhickey away in exasperation.

19:57 technomancy: yeah, that's handy.

19:57 heh

19:58 rhickey: http://clojure.org/todo

20:00 dnolen: cool!

20:03 technomancy: "regex literals as fns" <= yes. definitely.

20:03 dnolen: rhickey: what would || for arbitrary symbols be used for?

20:04 kadaver_: how do I ask not emty?

20:04 this isnt very good:

20:04 (if [] 10 20) -> 10

20:04 very bad

20:05 technomancy: kadaver_: you could just say first

20:05 though that will fail if its first element is false or nil.

20:05 (not (empty? [])) is not too bad

20:05 dnolen: ,(seq [])

20:05 clojurebot: nil

20:05 dnolen: ,(seq #{})

20:05 clojurebot: nil

20:05 dnolen: ,(seq '())

20:05 clojurebot: nil

20:05 technomancy: dnolen wins

20:06 dnolen: thanks for that metadata-on-fns hack from yesterday. was a little confused at first but it's working great now

20:06 rhickey: dnolen: for symbolic applications that want to use arbitrary symbols, but not really for program identifiers

20:06 dnolen: technomancy: great! glad to be of help.

20:15 kadaver: bah

20:15 haskell >>>> clojure

20:17 unlink: Vimclojure seems to indent only one space more after an open [ on the next line (where I would want two spaces) -- is this desired behavior?

20:17 durka42: i believe that operator is defined as

20:17 (>>>>) = unsafeTakeOverTheWorld

20:21 kadaver: rather much,much,much, greater than

20:23 technomancy: and here I was taking it to be a military rank.

20:23 Major-Sergeant? Fourth Lieutenant?

20:30 spaceman_stu: is there a library or standard way of performing validation on a map?

20:33 i'd like to verify that its structure its fields match some standard, and also taht the values are legal

20:42 kadaver: how do you make an sql statement ?

20:42 liek delete


20:43 dnolen: kadaver: have you looked clojureql? or using the built in facilities?


20:44 contrib/sql, ic ant find docs

20:44 how do I make that statement?

20:47 dnolen: I would look at clojureql, it seems to present and interface that's much closer to sql syntax.

20:47 http://github.com/Lau-of-DK/clojureql/blob/615527c7d61d0d93f3851079a5729cbaf35c1202/src/dk/bestinclass/clojureql/demo.clj

20:56 arohner: does anyone have a good link on java resources, i.e. the things in jar files

20:56 google is failing me

20:58 ah: http://java.sun.com/j2se/1.4.2/docs/guide/resources/resources.html

21:22 gah, classloaders are arcane beasts

21:23 for reasons I don't understand, (clojure.lang.RT/baseLoader) is not the same as the loader that loaded my first clojure class

21:26 kadaver: isnt there just a way to make a delete-statement?

21:27 where is contrib?

21:36 arohner: clojurebot: contrib

21:36 clojurebot: contrib is http://code.google.com/p/clojure-contrib/

21:39 kadaver: meh its a prett useless wrapper of you cant do delete

22:29 unlink1: Is there a shorthand for (fn [] x)? (i.e. wrapping x in a fn that simply returns it)

22:29 stuhood: (constantly x)

22:30 unlink1: Er, that's longer than fn []

22:31 stuhood: heh. true.

22:31 #(do x)?

22:31 7 chars instead of 9 =P

22:34 unlink1: heh

22:34 lambda: x in python

22:34 Actually does clojure have continuations or anything like that?

22:35 I mean, besides exceptions.

22:37 stuhood: i guess you could imitation continuations with closures/lambdas

22:38 unlink1: oh

22:38 :(

22:38 kadaver: how can you set primary keys from contrib-sql?

22:38 stuhood: unlink1: what languages have continuations built in?

22:39 unlink1: scheme, haskell, ml

22:40 hiredman: I am going to build a clojure powered digital picture frame / internet dashboard widget

22:40 stuhood: interesting. yea... they aren't first class in clojure, but i think you could get pretty close by just trampolining functions

22:40 arohner: don't you have to capture the entire "state of the world" in a continuation?

22:41 chessguy: i don't thinkn continuations are built in to haskell

22:41 there are libraries for it

22:42 kadaver: is there a jar of the latest clojure cntrib?

22:42 so i cna jsut switch them out?

22:42 stuhood: arohner: probably just more like thread state...

22:43 unlink1: python has something approaching the usefulness of continuations

22:43 chessguy: ,(doc read)

22:43 arohner: stuhood: oh right, or else you wouldn't be able to get things done when resuming an old continuation...

22:43 clojurebot: "([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."

22:44 stuhood: unlink1: generator functions?

22:44 unlink1: yes

22:45 stuhood: yea... lazy sequences are definitely more difficult to wrap your head around

22:46 chessguy: ,(doc print)

22:46 clojurebot: "([& more]); Prints the object(s) to the output stream that is the current value of *out*. print and println produce output for human consumption."

22:47 unlink1: My use case is generating HTML. I have a function responsible for generating the common skeleton elements of the page, and then other pages which interleave different regions of that function with custom HTML.

22:47 chessguy: why does my repl hang when i evaluate (read)?

22:56 kadaver: why do you use clojure?

23:05 hiredman: chessguy: it is trying to read something

23:05 chessguy: what terminates the input?

23:07 stuhood: it says it reads an object, which i assume would be any valid clojure literal?

23:08 yea... execute something like: `(read) 1` at a repl, and the result is 1

23:10 arohner: read turns strings into data structures

23:10 chessguy: "(read) 1" hangs for me too

23:11 arohner: press enter afterwards

23:11 kadaver: java.lang.Exception: Unable to resolve symbol: next in this context (def.clj:102)

23:11 user=>

23:11 def.clj is where?

23:12 chessguy: arohner: i did that

23:12 arohner: chessguy: how are you starting the repl?

23:13 chessguy: in slime

23:14 arohner: hmm. that works for me

23:14 user=> (read) 1

23:14 (read) 1

23:14 1

23:14 stuhood: works when running clojure.main from the command line

23:14 chessguy: user> (read) 1

23:14 user> (read) 1

23:14 bah

23:15 that didn't paste right

23:15 stuhood: ,(read) (println 1)

23:15 clojurebot: Execution Timed Out

23:15 stuhood: hahaha

23:16 chessguy: so is my slime broken?

23:16 arohner: try it from the command line and see what happens

23:17 chessguy: try what?

23:17 sorry, quite a newbie here

23:17 kadaver: user=>

23:18 arohner: chessguy: np. Start a repl from the command line, and see if read works there

23:19 java -cp clojure.jar clojure.main -r

23:19 (read) 1

23:19 chessguy: oh, i need to have clojure.jar in the current directory to do that i guess?

23:20 arohner: you can replace clojure.jar with the path to clojure.jar

23:20 chessguy: assuming i know it :)

23:20 hang on

23:20 cads: hey chessguy, are you in a *nix?

23:21 arohner: how'd you get it started then? :-)

23:21 chessguy: os x, yeah

23:23 ok got the repl

23:23 cads: clojure.jar has to be in the classpath that you give to java, like : "java -cp $LIBS:$CLOJURE_JAR clojure.lang.Repl" , where LIBS points to clojure.contrib jar

23:24 chessguy: new-host:Clojure awagner$ java -cp core/clojure.jar clojure.main -r

23:24 Clojure

23:24 user=> (read 1)

23:24 java.lang.ClassCastException: java.lang.Integer (NO_SOURCE_FILE:0)

23:24 arohner: try "(read) 1"

23:24 chessguy: in quotes?

23:24 cads: no

23:24 hiredman: try reading the docstring

23:24 chessguy: oh

23:24 ok that works

23:25 hiredman: the docstring doesn't say what terminates the input

23:25 hiredman: (doc read)

23:25 clojurebot: Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* .; arglists ([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?])

23:25 hiredman: "Reads the next object from stream, which must be an instance of java.io.PushbackReader"

23:25 cads: hey, do you guys know a better way of getting command completion than using rlwrap and a completion file?

23:25 hiredman: 1 is certainly not an instance of java.io.PushbackReader

23:25 chessguy: i guess i'm not understanding what that means

23:25 arohner: chessguy: it reads one whole valid "thing"

23:26 one whole valid express

23:26 chessguy: from stdin (by default) right?

23:26 arohner: *expression

23:26 chessguy: yes

23:26 chessguy: terminated by \n?

23:27 that seems to be the case in the repl. it's just broken in slime for some reason

23:27 arohner: what version of clojure are you running?

23:27 kadaver: where is the latestclojure?

23:27 is 1.0 out yet?

23:27 hiredman: chessguy: type some in parens with a newline in it

23:27 chessguy: for the repl, i just pulled the zip off of google code

23:27 hiredman: clojurebot: latest?

23:27 clojurebot: latest is 1359

23:28 chessguy: hm

23:28 jmaness: chessguy: Take a look at clojure.lang.LispReader

23:28 chessguy: this repl also hangs if i just evaluate (read)

23:29 s/hangs/seems to hang/

23:29 hiredman: you need to type in something for it to read

23:29 chessguy: i did

23:29 hiredman: what?

23:29 chessguy: if i just type (read)

23:29 and then hit enter a bunch of times

23:30 hiredman: ...

23:30 chessguy: it never stops

23:30 hiredman: read ignores whitespace

23:30 chessguy: oh

23:30 well

23:30 hiredman: just like writing clojure code

23:30 chessguy: silly me

23:30 arohner: right, read reads an expression

23:31 chessguy: ok

23:31 but that's still not what happens in my slime

23:31 in slime, if i type (read)

23:31 followed by 3\n

23:31 followed by 3\n

23:31 etc.

23:31 it doesn't stop

23:32 arohner: chessguy: what version are you running? trunk or a release?

23:32 hiredman: slime I know nothing about

23:32 chessguy: what version of clojure you mean?

23:32 arohner: right

23:33 chessguy: hm, not sure off-hand what version is driving my slime

23:34 hiredman: I kind of doubt (read) ever behaved differently

23:34 chessguy: i concur

23:34 hiredman: given how central it is

23:34 arohner: right, but slime has changed significantly

23:35 chessguy: not that you need my opinion

23:35 arohner: and I know that my slime works, and I'm running a fairly recent version

23:35 hiredman: well, he should just upgrade his slime

23:35 arohner: right, but slime versions are somewhat tied to clojure versions

23:37 i.e. upgrading clojure from before the file layout change or the seq change would require upgrading slime

23:37 chessguy: bah

23:37 it's not worth the pain

23:37 i'll just live with it

23:38 arohner: my swank-clojure's last commit is from 2009/04/17

23:50 kadaver: bah has namespaxces been chnaged since february?

23:50 ava.lang.Exception: No such namespace: clojure (NO_SOURCE_FILE:2)

23:51 clojure.contrib.sql not the contrib namespace?

23:54 hiredman: kadaver: best to have code and the exception it causes, not one or the other

23:55 ~url

23:55 clojurebot: Titim gan �ir� ort.

23:55 hiredman: lisppaste8: url?

23:55 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

23:55 kadaver: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4385#a4385

23:56 http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4385#a4386

23:56 hiredman: erm

23:56 are you sure that is the exact exception?

23:57 anyway, contrib in that code should be clojure.contrib

23:57 kadaver: yes

23:57 hiredman: but I don't see how that would get you an exception about the clojure namespace (which doesn't exist, it was moved to clojure.core)

23:58 but nothing there references the clojure namespace

23:58 kadaver: thats the problem i guess?

23:58 hiredman: I suspect the code you pasted is not what is generating that exception

23:59 kadaver: it isnt

Logging service provided by n01se.net