#clojure logs

2009-04-28

00:01unlink1oh
00:01unlink1My NPEs are from map or dorun then
00:01hiredman...
00:03unlink1er.
00:05qmrwsssdd~.
02:39Lau_of_DKTop of the morning gents
05:44unlink1I'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".
05:44unlink1)
08:44rhickeyhow are people holding up with new jar filenames?
08:51cemerickrhickey: 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).
08:52gnuvinceNew jar names?
08:53rhickeycemerick: 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
08:54rhickeymost libs are now distributed with versions in their jar names, no?
08:54cemerickrhickey: 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.
08:55cemerickrhickey: mv foo-1.2.3.jar foo.jar is the first thing I do when I pull in a new dep.
08:56cemerickto 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).
08:56rhickeyI'm not opposed, I just wonder if it will give people bad habits
08:57cemericktangential Q: why does the compiled-clojure jar retain the .clj files?
08:58rhickeycemerick: for tools?
08:59cemerickisn't all of the metadata in the class files anyway?
08:59rhickeynot the source
09:00cemerickhuh -- 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?
09:00cemerick(that's what I thought the sources jar was for)
09:01rhickeybetter to ask this on the group
09:01rhickeypeople complained when no source in the main jar
09:01cemerickthat was mostly rhetorical :-)
09:01rhickeyI don't care
09:01cemerickhuh
09:01rhickeynot a big space savings
09:02rhickeyslim and sources were invented by others
09:05cgrayhi, 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...
09:05cemerickmmm, filenames in reflection warnings. That's tasty.
09:07rhickeycgray: print puts paces between its args, try: (doseq [x (list 1 2 3)] (doseq [y (list 1 2 3)] (print (str x y " "))))
09:08rhickeyalso, doseq support multiple seqs: (doseq [x (list 1 2 3) y (list 1 2 3)] (print (str x y " ")))
09:11cgrayrhickey: thanks, at least that isolates the bug to my program :)
11:32cgraywhat is the syntax to override a method in a proxy?
11:33cgraynever mind, i made a mistake
13:18technomancythe JVM still supports green threads as an option, correct?
13:24p_ltechnomancy: afaik no
13:27technomancyit 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:27technomancyor does pooling threads make that cheap enough with native threads?
13:30danlarkin_I think theoretically thread pools slim the gap
13:39AWizzArdDoes 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:39kotarakAWizzArd: probably java.io.FileOutputStream with some option?
13:40kotarakmaybe duck-streams with some option?
14:55technomancyslime's macroexpand makes me so happy
14:57technomancyheh: "If none of the macros in Clojure seems complex to you, my company is hiring." (from the book)
14:58Chouser'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:59Carkhehe
15:00cgrandChouser: how about destructure? :-)
15:01Cark~def for
15:02Chousukecgrand: luckily destructure is not a macro!
15:04cgrandChousuke: 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:06Chousukeit's amusing how most logic in destructure is inside the let form :P
15:06AWizzArdYes, I noticed the same.
15:07AWizzArdrhickey: 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:08Chousukethat's correct.
15:08AWizzArdok
15:11Chousukeyou need to take care not to do @foo too many times in your code, though
15:12AWizzArdwhy?
15:12ChousukeI 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:12kotarakBecause you might get different @x's.
15:13AWizzArdAh 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:13AWizzArdBut when I pass it to some function F I need to be sure that inside of F it will not change.
15:14hiredman:(
15:14Chousukeit's evaluated when the function F is called
15:14Chousukeso you pass the value you get from the deref
15:14AWizzArdyes
15:15hiredmanall I get from the latest smack when trying to login is NPE
15:15kotarakAWizzArd: that's the trick of alter..
15:15AWizzArdWhat trick?
15:16kotarakalter passes a the current value of the ref to a function. So you don't need multiple @x's...
15:18AWizzArdyes
15:35technomancyis sorted-map the only way to get a map that guarantees order?
15:36kotarakarray-map also does, I think.
15:36technomancykotarak: thanks; that's what I needed.
15:53cemerickFYI 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:03clojurebottesting new-send-out
16:03durka42hiredman: it works
16:07hiredmansorry I forgot to send that to #clojurebot
16:11lisppaste8technomancy pasted "metadata on proxies" at http://paste.lisp.org/display/79367
16:11technomancyany ideas why this fails?
16:11technomancyI get java.lang.UnsupportedOperationException
16:12technomancybut dnolen was saying yesterday that proxying fns allows you to put metadata on them
16:12Chouseryeah, you can't change metadata on an AFn
16:13technomancyI wonder what dnolen meant then. he seemed to imply that this would work; maybe I misunderstood him
16:13Chouseryou can use proxy to give a fn metadata right when you create it.
16:14technomancyChouser: you mean don't use with-meta; use the reader syntax instead?
16:15Chouserno, I mean use proxy as you do there.
16:15Chouser^(make-funcallable (fn []))
16:15Chousernormally a fn has no metadata at all
16:16technomancyoh, the new metadata needs to go inside the second param to proxy then?
16:16technomancyI see.
16:16Chouseryes
16:16technomancythanks!
16:17Chousersure, hope it helps...
16:17technomancyit's an unfortunate hack, but I feel better about using it knowing that metadata directly on fns is planned
16:17technomancyhopefully in the not-too-distant future
16:18unlinkI'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:18unlinkI 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:19kotarakunlink: did you install a previous version on the second machine before?
16:20unlinkI don't think so.
16:20kotarakI would expect 7.2 to work more smooth than 7.1...
16:21unlinkYeah, it works just fine on 7.1. I'm not using ng or anything though.
16:21kotarakhmmm...
16:22kotarakIs something else different between the two machines? other plugins, settings, etc...
16:23unlinkLet me try again with a minimal vimrc.
16:30unlinkOh, 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:32kotarakunlink: k. Good that it works now. :)
16:35unlinkkotarak: How do you set omnifunc?
16:35kotarakset omnifunc=theFunc()
16:35kotarakw/o checking the exact syntax.
16:37unlinkI 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:37kotarakunlink: you don't have to do it. VimClojure does it for you.
16:37kotarakJust use <C-x><C-o> in a Clojure file. Eg. r-s<C-x><C-o> => read-string, resultset-seq, ...
16:38unlinkOk. ^X^O says Option 'omnifunc' is not set.
16:38kotarakunlink: did you put "let clj_want_gorilla = 1" in your .vimrc?
16:39unlinkyes.
16:39kotarakHmm...
16:40kotarakDid you start the ng-server?
16:42unlinkThanks for your help, I have to go.
16:42kotarakk
16:42Chousukegorilla seems to blow up quite spectacularly if the ng server is not running.
16:43kotarakChousuke: not anymore
16:43Chousukemaybe I should upgrade then
16:43kotarakIt just turns off interactivity.
16:44kotarakBut it blows up with (namespaced) files not being in the classpath or containing syntax errors.
16:45kotarakBasic highlighting and <C-n> completion work also without the server.
17:45kadaverhow do you say :string in clojure contrib sql?
17:45kadaveri mena isntead of :int
17:52eevar__kadaver: "varchar(255)"
17:52eevar__or text, or clob
18:10technomancywhere does console output go when an agent performs it?
18:10technomancy~(send (agent "hi") println)
18:10clojurebotNo entiendo
18:11technomancyis there a separate *out* for agents?
18:11technomancyor are you just not supposed to have side-effects in functions you send them?
18:14Chousukethey can have side effects... dunno about the output though :)
18:17drewr,(set [4 5 2 8 1])
18:17clojurebot#{1 2 4 5 8}
18:17drewr,(sorted-set [4 5 2 8 1])
18:17clojurebot#{[4 5 2 8 1]}
18:17technomancyworks but is lame: (let [my-out *out*] (send (agent "hi") #(binding [*out* my-out] (println %&))))
18:17drewr,(sorted-set 4 5 2 8 1)
18:17clojurebot#{1 2 4 5 8}
18:17drewrWhy does set and sorted-set both sort their sets?
18:18technomancydrewr: I don't think order is guaranteed with set
18:19technomancyit's sorted for this instance, but you shouldn't rely on it.
18:19drewrI actually wanted it unsorted :-)
18:20technomancy,(hash-set 4 5 2 8 1)
18:20clojurebot#{1 2 4 5 8}
18:20technomancyhrm; dunno.
18:21technomancy,(array-map 4 4 5 5 2 2 8 8 1 1)
18:21clojurebot{4 4, 5 5, 2 2, 8 8, 1 1}
18:21technomancyworks the same way, but is six kinds of hacky
18:21technomancyif you want insertion order, I mean
18:23hiredman,(into #{} 8 93 2 1 3)
18:23clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$into
18:23hiredman,(into #{} '(8 93 2 1 3))
18:23clojurebot#{1 2 3 8 93}
18:30technomancywow, the indentation in the Java implementation of Clojure is pretty weird. =)
18:30ctdeanYou might need to set your tabs
18:31drewrtechnomancy: :-)
18:31duncanmhmmm
18:31duncanmi can't have two overloads with the same arity?
18:31duncanmwhat if I distinguish them by a type hint?
18:31technomancyctdean: maybe, but some nesting levels don't increase the level of indentation
18:32ctdeanThat is funny.
18:32ctdeanWhat file?
18:32technomancyctdean: Agent.java, but I've seen it other places too
18:32technomancyis it meant for 4-space tabs then?
18:34ctdeanYes, 4 space tabs
18:34ctdeanYea, I hate hard tabs myself. But some people like them. cest la vie
18:35technomancywell at 4 spaces it looks a bit more reasonable
18:35hiredmanduncanm: if you want to distinguish beyond arity you need multimethods
18:36hiredmanthe (defn f ([])([])) form only distinguishes based on arity
18:36hiredman(dispatches)
18:37technomancyjust 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:38technomancyto each his own. it's not stuff I'm reading often. =)
19:00kadaverjava.sql.SQLSyntaxErrorException: Syntax error: Encountered "LIMIT" at line 1, column 47. (NO_SOURCE_FILE:0)
19:00kadaver"select * from songs order by timesplayed desc limit 10" ; that gives syntax error on limit 10,why?
19:02cp2try putting it before the order by maybe?
19:02unlinkDoes it work from your SQL shell?
19:05kadaverdont have a sql shell
19:05kadaverjdbc only
19:05kadaverbefore didnt work
19:05kadaver"select * from songs limit 10 order by timesplayed desc"
19:05kadaverjava.sql.SQLSyntaxErrorException: Syntax error: Encountered "10" at line 1, column 27. (NO_SOURCE_FILE:0)
19:08unlinka HA! not=
19:12kadaver?
19:12clojurebotnamespaces 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:13technomancywhat specifically is wrong with single-segment namespaces?
19:13technomancyis it just due to an arbitrary JVM bug?
19:13technomancysorry, "decision". =)
19:15Chousukethe chance of collisions would be rather high if single-segment namespaces were common. :/
19:16technomancyif 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:16Chousukeand your source directory will be a mess :)
19:17technomancypicking a good name is hard
19:18Chousukemost 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:18Chousukeunless it's a single file or something.
19:19technomancywell, 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:20technomancythen when I wanted to AOT it, I had to move "mire" to "mire.server" for no good reason.
19:20technomancyit's a nitpick for sure; just seems really arbitrary.
19:21technomancyand whenever it's arbitrary, I assume it's due to the JVM rather than a specific limitation of Clojure. =)
19:22powr-toctechnomancy: Were you behind the peepcode screencast?
19:22technomancypowr-toc: yeah, I wrote the script.
19:23technomancypowr-toc: got some feedback?
19:25powr-toctechnomancy: 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:25powr-tocor rather the level it was pitched at
19:25technomancypowr-toc: yeah, I could see that.
19:26technomancyit's hard to be all things to everyone. wanted to cover a wide variety of topics, but it did feel rushed at parts.
19:26powr-toctechnomancy: 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:27technomancyI think for people who are really serious about learning Clojure, the screencast and the book complement each other.
19:27technomancythe 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:27powr-toctechnomancy: I think so... as an indicator of clojure adoption do you know how well it's selling btw?
19:28technomancypowr-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:28powr-toc(not meaning to pry btw ;-) )
19:28technomancythe thing is that everyone knows what Emacs is, so everyone who wanted to buy it got it in the first few days.
19:29technomancywith Clojure I expect the interest to build more over time, especially as 1.0 is released soon
19:30powr-tocgood point... I was always curious about that Emacs screencast, maybe I'll have to get that too :-)
19:31technomancyit was kind of an experiment to begin with as most PeepCode screencasts have been targeted towards the Ruby community in the past.
19:31technomancypowr-toc: people seemed to like the Emacs one a lot. it was definitely more obvious who the audience was. =)
19:33powr-toctechnomancy: well, the Ruby communities seems to be a good one for that kinda thing, as they tend to be early adopters etc...
19:33technomancyyeah, the git screencast was particularly popular
19:33powr-toctechnomancy: I know a lot of ruby guys who rave about peepcode too
19:33technomancythere's always a risk involved in investing in cutting-edge topics, but I think this one paid off.
19:34powr-toctechnomancy: definitely
19:35powr-tocI thought the http://www.youtube.com/user/briantwill presentations were very good too
19:36kadaver(loop [[x & xs] res
19:36kadaver acc []]
19:36kadaver (if (nil? x)
19:36kadaver acc
19:36kadaver (recur xs (conj acc x))))
19:36technomancyyeah, _very_ different style though
19:36kadavercan you simplify that?
19:36technomancyhis are more like lectures
19:36danlarkinkadaver: please don't paste multiple lines of code to the channel, use a pastebin like paste.lisp.org
19:37powr-toctechnomancy: 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:39kadaverhmm its a fold
19:39technomancydoes anyone have a slime macroexpand hack that pretty-prints the results?
19:41powr-toctechnomancy: 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:42technomancypowr-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:43technomancypowr-toc: we decided covering slime would take too much time, so we're doing a separate (free) screencast on clojure editor support.
19:43powr-tocsweet!
19:43technomancyit 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:43powr-toctechnomancy: yeah, that wouldn't have pleased me ;-)
19:44technomancythe editors one was supposed to be a teaser, but it got delayed... oh well.
19:44technomancyhopefully it can still drive interest
19:45powr-tocI'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:45technomancypowr-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:45technomancythat's actually orthogonal to regular slime though.
19:46technomancybut you can just wait for the screencast if you want. =)
19:46powr-tochehe... maybe I'll wait a little longer... what killer features does slime give?
19:46powr-toc(over clojure-mode/paredit)
19:46technomancyoh man... where to start. =)
19:47powr-tochehe... I thought that'd be the answer
19:48technomancythe slime manual is pretty comprehensive too
19:48technomancythough some of it is CL-specific
19:55technomancyif 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:55technomancye
19:56dreishLooks like they get added to the same queue.
19:56dreishAw, you drove rhickey away in exasperation.
19:57technomancyyeah, that's handy.
19:57technomancyheh
19:58rhickeyhttp://clojure.org/todo
20:00dnolencool!
20:03technomancy"regex literals as fns" <= yes. definitely.
20:03dnolenrhickey: what would || for arbitrary symbols be used for?
20:04kadaver_how do I ask not emty?
20:04kadaver_this isnt very good:
20:04kadaver_(if [] 10 20) -> 10
20:04kadaver_very bad
20:05technomancykadaver_: you could just say first
20:05technomancythough that will fail if its first element is false or nil.
20:05technomancy(not (empty? [])) is not too bad
20:05dnolen,(seq [])
20:05clojurebotnil
20:05dnolen,(seq #{})
20:05clojurebotnil
20:05dnolen,(seq '())
20:05clojurebotnil
20:05technomancydnolen wins
20:06technomancydnolen: thanks for that metadata-on-fns hack from yesterday. was a little confused at first but it's working great now
20:06rhickeydnolen: for symbolic applications that want to use arbitrary symbols, but not really for program identifiers
20:06dnolentechnomancy: great! glad to be of help.
20:15kadaverbah
20:15kadaverhaskell >>>> clojure
20:17unlinkVimclojure 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:17durka42i believe that operator is defined as
20:17durka42(>>>>) = unsafeTakeOverTheWorld
20:21kadaverrather much,much,much, greater than
20:23technomancyand here I was taking it to be a military rank.
20:23technomancyMajor-Sergeant? Fourth Lieutenant?
20:30spaceman_stuis there a library or standard way of performing validation on a map?
20:33spaceman_stui'd like to verify that its structure its fields match some standard, and also taht the values are legal
20:42kadaverhow do you make an sql statement ?
20:42kadaverliek delete
20:43kadaverDELETE FROM TABLE WHERE SOMECOLUMN = 'HELLO'
20:43dnolenkadaver: have you looked clojureql? or using the built in facilities?
20:44kadaverDELETE FROM TABLE WHERE SOMECOLUMN = 'HELLO'
20:44kadavercontrib/sql, ic ant find docs
20:44kadaverhow do I make that statement?
20:47dnolenI would look at clojureql, it seems to present and interface that's much closer to sql syntax.
20:47dnolenhttp://github.com/Lau-of-DK/clojureql/blob/615527c7d61d0d93f3851079a5729cbaf35c1202/src/dk/bestinclass/clojureql/demo.clj
20:56arohnerdoes anyone have a good link on java resources, i.e. the things in jar files
20:56arohnergoogle is failing me
20:58arohnerah: http://java.sun.com/j2se/1.4.2/docs/guide/resources/resources.html
21:22arohnergah, classloaders are arcane beasts
21:23arohnerfor reasons I don't understand, (clojure.lang.RT/baseLoader) is not the same as the loader that loaded my first clojure class
21:26kadaverisnt there just a way to make a delete-statement?
21:27kadaverwhere is contrib?
21:36arohnerclojurebot: contrib
21:36clojurebotcontrib is http://code.google.com/p/clojure-contrib/
21:39kadavermeh its a prett useless wrapper of you cant do delete
22:29unlink1Is there a shorthand for (fn [] x)? (i.e. wrapping x in a fn that simply returns it)
22:29stuhood(constantly x)
22:30unlink1Er, that's longer than fn []
22:31stuhoodheh. true.
22:31stuhood#(do x)?
22:31stuhood7 chars instead of 9 =P
22:34unlink1heh
22:34unlink1lambda: x in python
22:34unlink1Actually does clojure have continuations or anything like that?
22:35unlink1I mean, besides exceptions.
22:37stuhoodi guess you could imitation continuations with closures/lambdas
22:38unlink1oh
22:38unlink1:(
22:38kadaverhow can you set primary keys from contrib-sql?
22:38stuhoodunlink1: what languages have continuations built in?
22:39unlink1scheme, haskell, ml
22:40hiredmanI am going to build a clojure powered digital picture frame / internet dashboard widget
22:40stuhoodinteresting. yea... they aren't first class in clojure, but i think you could get pretty close by just trampolining functions
22:40arohnerdon't you have to capture the entire "state of the world" in a continuation?
22:41chessguyi don't thinkn continuations are built in to haskell
22:41chessguythere are libraries for it
22:42kadaveris there a jar of the latest clojure cntrib?
22:42kadaverso i cna jsut switch them out?
22:42stuhoodarohner: probably just more like thread state...
22:43unlink1python has something approaching the usefulness of continuations
22:43chessguy,(doc read)
22:43arohnerstuhood: oh right, or else you wouldn't be able to get things done when resuming an old continuation...
22:43clojurebot"([] [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:44stuhoodunlink1: generator functions?
22:44unlink1yes
22:45stuhoodyea... lazy sequences are definitely more difficult to wrap your head around
22:46chessguy,(doc print)
22:46clojurebot"([& 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:47unlink1My 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:47chessguywhy does my repl hang when i evaluate (read)?
22:56kadaverwhy do you use clojure?
23:05hiredmanchessguy: it is trying to read something
23:05chessguywhat terminates the input?
23:07stuhoodit says it reads an object, which i assume would be any valid clojure literal?
23:08stuhoodyea... execute something like: `(read) 1` at a repl, and the result is 1
23:10arohnerread turns strings into data structures
23:10chessguy"(read) 1" hangs for me too
23:11arohnerpress enter afterwards
23:11kadaverjava.lang.Exception: Unable to resolve symbol: next in this context (def.clj:102)
23:11kadaveruser=>
23:11kadaverdef.clj is where?
23:12chessguyarohner: i did that
23:12arohnerchessguy: how are you starting the repl?
23:13chessguyin slime
23:14arohnerhmm. that works for me
23:14arohneruser=> (read) 1
23:14arohner(read) 1
23:14arohner1
23:14stuhoodworks when running clojure.main from the command line
23:14chessguyuser> (read) 1
23:14chessguyuser> (read) 1
23:14chessguybah
23:15chessguythat didn't paste right
23:15stuhood,(read) (println 1)
23:15clojurebotExecution Timed Out
23:15stuhoodhahaha
23:16chessguyso is my slime broken?
23:16arohnertry it from the command line and see what happens
23:17chessguytry what?
23:17chessguysorry, quite a newbie here
23:17kadaveruser=>
23:18arohnerchessguy: np. Start a repl from the command line, and see if read works there
23:19arohnerjava -cp clojure.jar clojure.main -r
23:19arohner(read) 1
23:19chessguyoh, i need to have clojure.jar in the current directory to do that i guess?
23:20arohneryou can replace clojure.jar with the path to clojure.jar
23:20chessguyassuming i know it :)
23:20chessguyhang on
23:20cadshey chessguy, are you in a *nix?
23:21arohnerhow'd you get it started then? :-)
23:21chessguyos x, yeah
23:23chessguyok got the repl
23:23cadsclojure.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:24chessguynew-host:Clojure awagner$ java -cp core/clojure.jar clojure.main -r
23:24chessguyClojure
23:24chessguyuser=> (read 1)
23:24chessguyjava.lang.ClassCastException: java.lang.Integer (NO_SOURCE_FILE:0)
23:24arohnertry "(read) 1"
23:24chessguyin quotes?
23:24cadsno
23:24hiredmantry reading the docstring
23:24chessguyoh
23:24chessguyok that works
23:25chessguyhiredman: the docstring doesn't say what terminates the input
23:25hiredman(doc read)
23:25clojurebotReads 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:25hiredman"Reads the next object from stream, which must be an instance of java.io.PushbackReader"
23:25cadshey, do you guys know a better way of getting command completion than using rlwrap and a completion file?
23:25hiredman1 is certainly not an instance of java.io.PushbackReader
23:25chessguyi guess i'm not understanding what that means
23:25arohnerchessguy: it reads one whole valid "thing"
23:26arohnerone whole valid express
23:26chessguyfrom stdin (by default) right?
23:26arohner*expression
23:26arohnerchessguy: yes
23:26chessguyterminated by \n?
23:27chessguythat seems to be the case in the repl. it's just broken in slime for some reason
23:27arohnerwhat version of clojure are you running?
23:27kadaverwhere is the latestclojure?
23:27kadaveris 1.0 out yet?
23:27hiredmanchessguy: type some in parens with a newline in it
23:27chessguyfor the repl, i just pulled the zip off of google code
23:27hiredmanclojurebot: latest?
23:27clojurebotlatest is 1359
23:28chessguyhm
23:28jmanesschessguy: Take a look at clojure.lang.LispReader
23:28chessguythis repl also hangs if i just evaluate (read)
23:29chessguys/hangs/seems to hang/
23:29hiredmanyou need to type in something for it to read
23:29chessguyi did
23:29hiredmanwhat?
23:29chessguyif i just type (read)
23:29chessguyand then hit enter a bunch of times
23:30hiredman...
23:30chessguyit never stops
23:30hiredmanread ignores whitespace
23:30chessguyoh
23:30chessguywell
23:30hiredmanjust like writing clojure code
23:30chessguysilly me
23:30arohnerright, read reads an expression
23:31chessguyok
23:31chessguybut that's still not what happens in my slime
23:31chessguyin slime, if i type (read)
23:31chessguyfollowed by 3\n
23:31chessguyfollowed by 3\n
23:31chessguyetc.
23:31chessguyit doesn't stop
23:32arohnerchessguy: what version are you running? trunk or a release?
23:32hiredmanslime I know nothing about
23:32chessguywhat version of clojure you mean?
23:32arohnerright
23:33chessguyhm, not sure off-hand what version is driving my slime
23:34hiredmanI kind of doubt (read) ever behaved differently
23:34chessguyi concur
23:34hiredmangiven how central it is
23:34arohnerright, but slime has changed significantly
23:35chessguynot that you need my opinion
23:35arohnerand I know that my slime works, and I'm running a fairly recent version
23:35hiredmanwell, he should just upgrade his slime
23:35arohnerright, but slime versions are somewhat tied to clojure versions
23:37arohneri.e. upgrading clojure from before the file layout change or the seq change would require upgrading slime
23:37chessguybah
23:37chessguyit's not worth the pain
23:37chessguyi'll just live with it
23:38arohnermy swank-clojure's last commit is from 2009/04/17
23:50kadaverbah has namespaxces been chnaged since february?
23:50kadaverava.lang.Exception: No such namespace: clojure (NO_SOURCE_FILE:2)
23:51kadaverclojure.contrib.sql not the contrib namespace?
23:54hiredmankadaver: best to have code and the exception it causes, not one or the other
23:55hiredman~url
23:55clojurebotTitim gan �ir� ort.
23:55hiredmanlisppaste8: url?
23:55lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
23:55kadaverhttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=4385#a4385
23:56kadaverhttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=4385#a4386
23:56hiredmanerm
23:56hiredmanare you sure that is the exact exception?
23:57hiredmananyway, contrib in that code should be clojure.contrib
23:57kadaveryes
23:57hiredmanbut 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:58hiredmanbut nothing there references the clojure namespace
23:58kadaverthats the problem i guess?
23:58hiredmanI suspect the code you pasted is not what is generating that exception
23:59kadaverit isnt