#clojure log - Mar 28 2009

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

0:22 * Raynes is waiting for an approaching severe weather event that very well has the potential to kill him, and others in Alabama.

1:18 slashus2: Raynes: Looks pretty bad.

1:20 I don't see any tornado reports in Alabama as of 1512 UTC.

1:20 cmvkk_: Here in Kansas we're getting snow and sleet.

1:21 oh well. if i can't go anywhere that just means i can work on coding all day

1:23 Raynes: slashus2: The severe weather is rather limited to south Alabama tonight. Around 5AM is when the real shit starts.

1:24 slashus2: Raynes: According to the storm prediction center, the greatest tornado risk is in Louisiana and Mississippi.

1:25 Raynes: http://www.spc.noaa.gov/products/outlook/day1otlk.html

1:26 valid through another 6 hours

1:26 Raynes: slashus2: I've already read everything. The severe weather risk for day 1 which is part of tonight is over there. Day 2 Saturday is the issue.

1:27 They should update the Day 1 outlook at 1.

1:27 1AM central time at least.

1:27 I'm not sleeping tonight.

1:27 cmvkk_: i'm amazed to find that i don't understand the finer points of whether i'm holding onto the head of a lazy seq or not.

1:29 slashus2: Raynes: I always find tracking storms to be fun.

1:30 Raynes: slashus2: Me too. Until they are coming towards me, then it gets a little less exciting.

1:30 slashus2: That is the thrill ride.

1:31 Going outside when you are under a tornado warning at night trying to spot a wall cloud.

1:31 cmvkk_: slashus2 is the kind of person who drives a pickup into a corn field to release a bunch of tiny robots into a tornado

1:31 Raynes: slashus2: That's called being stupid.

1:32 At night, it's impossible to see anything. You can hardly ever see anything during the day in Alabama. Tornadoes are /always/ wrapped in rain.

1:32 slashus2: It wasn't raining outside.

1:33 I wouldn't call it being stupid. Being curious. As long as one is knowledgeable about the behavior of storms.

1:34 Raynes: It's stupid if you don't know which direction you have to be in too see a tornado.

1:35 to*

1:35 slashus2: I was paying close attention to the rotation of the storm.

1:35 This is getting way off topic.

1:37 Raynes: Did you know that the tornado was not moving towards you at the time?

1:37 We should totally make a channel #Weather

1:37 slashus2: Yes, the rotation was to the north.

1:38 Raynes: I wish they would update the day 1 outlook.

1:39 slashus2: You are correct that it was issued 5 hours ago.

1:39 pretty outdated.

1:39 Raynes: It should be updated within the next 30 minutes.

1:40 Virtually the entire state is under 45% risk for day 2. It will be upgraded to a moderate or high risk I'm sure.

1:44 For the books, I live in northwest central Alabama. To be specific, extreme northwest Walker county.

1:48 It's been updated.

1:49 slashus2: Raynes: Looks like NW Alabama may miss the brunt of the tornado onslaught.

1:50 Raynes: slashus2: I hope so.

1:51 Just have to see what happens :\

1:57 * Raynes hides under slashus2's bed.

2:03 Raynes: I don't trust the SPC.

2:03 slashus2: hehe

2:04 * Raynes waits for the only meteorologists he trusts to update the Weather blog at www.alabamawx.com

2:14 Raynes: duck1123: Why would you ever want to learn lojban?

2:18 cmvkk_: lojban is like the haskell of conlangs. it's totally pure, but nobody ever uses it for anything real

2:18 clojurebot: Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute.

2:19 cmvkk_: hello clojurebot

2:21 Raynes: cmvkk_: Haskell is awesome, but Clojure is awesomer from a "Holy shit, a functional language someone might actually use." point of view.

2:22 clojurebot: 'Sup hiredman.

2:22 clojurebot: Titim gan �ir� ort.

2:22 Raynes: <3 You're still my hero.

2:25 cmvkk_: I keep opening stuff in vim then typing "C-x C-s" to try and save it, which causes vim to freeze up instead.

2:25 Raynes: What language is that :(

2:25 I don't speak Clojurenerd quite as well as the others here just yet.

2:26 cmvkk_: what?

2:26 * Raynes puts some finishing touches on his crappy Notepad-like Clojure text editor.

2:27 Raynes: cmvkk_: (= vim crap) true

2:27 * Raynes hides from the Vimmers he knows he will be attacked by.

2:28 cmvkk_: i like it about as well as emacs to be honest. i'm not a 'power user' by any means

2:28 between it and anything else, it's the easiest editor to just quick open a file in the terminal in.

2:29 Raynes: I'm an Enclojure user. I don't judge.

2:32 clojurebot: May you fall without rising.

2:32 clojurebot: I don't understand.

2:32 Raynes: Neither to I.

2:32 :|

2:38 Did someone actually make a "Clojure vs Scala" thread.

2:38 Haven't we had enough of those. :\

2:40 cmvkk_: now now, it's an important flamewar that we need to practice having over and over again, so that we're good at it once both languages get popular.

2:43 brennanc_: I was trying to explain the advantages of functional programming to a coworker (PHP guy). It was like trying to teach a fish what air is.

2:44 cmvkk_: brennanc_: the blub paradox?

2:44 brennanc_: is that something like the lamer it is the more they swear by it?

2:46 cmvkk_: it basically says people won't understand the features of another language if their language doesn't have those features,

2:46 Raynes: brennanc_: Fish breathe too :(

2:46 cmvkk_: or something like that...

2:53 hiredman: have you seen php's answer to lambda?

2:54 it creates a function with random name, and returns that name as a string

2:54 * hiredman dies

2:54 Raynes: ...

2:55 cmvkk_: if it works it works I guess

2:56 brennanc_: I saw something where they were proposing lambda syntax. The syntax for it looked really "noisy"

2:57 hiredman: almost makes me want to finish my lisp.php

2:57 I think the only thing left is lexical and dynamic bindings

3:01 Raynes: hiredman: Touch me so some of your knowledge may rub off on me.

3:01 * Raynes eye's sparkle.

3:01 brennanc_: are there any tutorials on how to get emacs working with clojure support?

3:02 I'm using textmate but it's not indenting things correctly

3:02 hiredman: I would say something like "I am but a man" but that may be pompous

3:02 Raynes: brennanc_: There are more than I can count.

3:03 hiredman: clojurebot: clojure-install?

3:03 clojurebot: clojure is a language to use if you want to up your game

3:04 Raynes: clojurebot: clojure?

3:04 clojurebot: clojure is a language to use if you want to up your game

3:04 hiredman: http://github.com/technomancy/clojure-mode/tree/master comes with some sort of "install clojure and make it all work for me" stuff

3:04 Raynes: I see what you did there.

3:09 brennanc_: what are some of the common editing setups / environments people use for coding clojure?

3:10 I'm really curious about emacs but I'm a complete noob. It looks a little overwhelming. I ordered one of the emacs books that should be arriving in the mail in a few days.

3:11 hiredman: I vim

3:17 mrsolo: yea a book is helpful

3:17 emacs has steep learning curve

3:17 brennanc_: more than vi?

3:17 mrsolo: yes

3:18 brennanc_: vi took me a week to get up to the proficiency level of MS notepad

3:18 of course, it probably would have been a lot faster if I didn't force myself to learn the home row arrow keys but I'm glad I did

3:19 mrsolo: emacs is a bit more involved

3:20 brennanc_: is it worth it or should I stick with vi?

3:20 hiredman: vim

3:20 Raynes: mrsolo: The learning curve isn't more than vim...

3:20 hiredman: you don't want vi

3:20 Raynes: If anything it's less.

3:21 Saying Emacs is harder to use is pure speculation and opinion. I hear both Editors have good support for Clojure however.

3:21 mrsolo: well i dunno

3:21 i am wrong person to ask.

3:21 Raynes: So choose which ever one looks uglier.

3:21 mrsolo: i learned vim decades ago

3:21 hiredman: http://garbagehill.files.wordpress.com/2008/04/editor-learning-curves.jpg

3:21 mrsolo: and eamcs recently ... so i pretty much forgot vi learning curse

3:23 well eamcs has slime.. i heard vim has beefed up clojure support recently?

3:23 hiredman: http://img.skitch.com/20090108-8b31mucqnmb3wnpi1pg5wtd28i.png <-- is pretty impressive for a text editor

3:23 Raynes: mrsolo: Type 'Emacs' slower ;). Vim got VimClojure. It's supposed to be hawt.

3:23 mrsolo: brennanc: it is worth learning both

3:27 Raynes: hiredman: Mac user.

3:27 hiredman: me/

3:28 ?

3:28 Raynes: Yes.

3:28 Yoiu.

3:28 You*

3:28 hiredman: I couldn't afford a mac

3:29 Raynes: Oh, I thought that was your screenshot.

3:29 hiredman: nope

3:30 a xmpp client, with avatar support, in your text editor

3:30 crazy

3:31 mrsolo: naw :-)

3:31 emacs does it all

3:40 cmvkk_: I wonder if it's a bad idea to write my documentation at 2:30am

3:41 am i gonna wake up tomorrow morning, look at it and go "what the hell"

3:41 "that sentence doesn't make any sense"

3:56 Raynes: Writing doc strings when you are tired is a mistake. The proves itself true more often that I can stress.

3:57 cmvkk_: Heh. You're right, and I wasn't even doing that. I was writing the readme file.

4:15 Raynes: I Hate People Who Capitalize Every Single Word.

4:28 texodus: what rv?

8:46 leafw: anybody can point to usage of -> ?

8:46 I never get it right, and the doc is too high level for me

8:47 and example is worth 10 docs

8:53 laurum: leafw: For example the following expressions have the same result: (f1 (f2 (f3 x))) (-> x f3 f2 f1)

8:55 leafw: and applied to a map?

8:55 laurum: it calls a series of functions, passing the result of each as an argument to the next

8:56 Raynes: slashus2: Looks like I might live through the next round of storms due in here soon. :D

9:09 cgrand: leafw: (-> {:a {:b {:c 1}}} :a :b :c) yields 1 (this works only with keywords)

9:10 (-> {"a" {"b" {"c" 1}}} (get "a") (get "b") (get "c")) when keys aren't keywords

9:11 leafw: cgrand: nice example. So that's for reading. Can one put in to :c some value, and get the returned new map?

9:18 cgrand: leafw: I don't know of a -> base idiom deep association, you have to use assoc-in

9:26 (now without missing words and letters) I don't know of a -> based idiom for deep association, you have to use assoc-in

9:33 qwert666: i have defined a m symbol (defn m) and then i hit (name m) what is wrong with it , the doc is saying that i can pass a symbol ... ? i`m passing a symbol so it should work... i mean with the (name (gensym)) it works fine why not with the m symbol ?

9:40 leafw: cgrand: thanks, assoc-in does it.

9:42 Chousuke: qwert666: m is not a symbol. 'm is

9:42 cgrand: qwert666: (name 'm) ; without the quote, m is resolved

11:36 rhickey: lpetit: sorry, I got called away last night

11:43 AWizzArd: Chousuke: apropos symbol: it seems that symbols are not allowd to start with a digit

11:44 ,'3*x

11:44 clojurebot: Invalid number: 3*x

11:44 AWizzArd: ,'x*3

11:44 clojurebot: x*3

11:44 AWizzArd: so (def 3*x (* 3 x)) is not allowed

12:07 blbrown: is rhickey here?

12:13 I was trying to see if there is a way to load SCRIPT A and then load SCRIPT B which depends on SCRIPT A but not have to reload SCRIPT A more than once. Kind of cache script A through java code. http://paste.lisp.org/display/77719

12:41 AWizzArd: hi kotarak

12:41 kotarak: hi Wizz

12:45 AWizzArd: blbrown: your point is interesting. Just yesterday I was wondering if any double loading needs to happen if require libs A, B, C and X, Y, Z, where A, B and C also require/use themselves X, Y and Z.

12:46 if require ==> if I require

12:46 kotarak: X,Y,Z should be loaded only once.

12:47 AWizzArd: this is typically what I want

12:47 although, now as we talk about this: what if Z changes during runtime?

12:48 kotarak: If the rest references the Vars of Z (not taking it's value), the new Z code will be used.

12:49 cmvkk_: you can also do (require :reload ...) to reload stuff

12:49 kotarak: and :reload-all...

12:50 I think there was some difference between (send *agent* z/some-fun) and (send *agent* #'z/some-fun). But I'm not sure, whether IIRC.

12:51 The first using the value, while the second using the new code, when z is reloaded. But as I said: only some dark shadows of memory... Might be wrong.

13:02 brennanc_: how do I undefine something?

13:03 I'm trying to load some external code and it's complaining it already exists in the REPL's user namespace

13:04 kotarak: (doc ns-unmap)

13:04 clojurebot: Removes the mappings for the symbol from the namespace.; arglists ([ns sym])

13:04 brennanc_: thanks

13:05 slashus2: ,(reduce #(concat %1 [%2]) [] (range 3500))

13:05 clojurebot: Eval-in-box threw an exception:java.lang.StackOverflowError

13:06 cmvkk_: what's going on with that is that concat returns a lazy-seq.

13:06 so when you reduce that way, you just have lazy-seq on top of lazy-seq and so on

13:07 slashus2: ,(reduce + (reduce #(conj %1 %2) [] (range 3500)))

13:07 clojurebot: 6123250

13:09 cmvkk_: ,(last (reduce #(doall (concat %1 [%2])) [] (range 3500)))

13:09 clojurebot: 3499

13:09 cmvkk_: if you add a doall, it stops blowing the stack.

13:10 conj works too, because it isn't lazy in the first place.

13:10 slashus2: So doall forces concat to realize?

13:10 kotarak: (dfoc doall)

13:11 (doc doall)

13:11 clojurebot: When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time.; arglists ([coll] [n coll])

13:11 kotarak: (doc dorun)

13:11 clojurebot: When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil.; arglists ([coll] [n coll])

13:18 cmvkk_: it's interesting because it's a gotcha that there's no real fix for.

13:18 if something takes a lazy-seq and makes a new lazy-seq that uses it, you shouldn't compound calls to it.

13:19 and that's all you can say.

14:05 slashus2: cmvkk_: A gotcha of lazy sequences. It is a good thing to know.

14:49 johnw: do the docs on clojure.org talk about how to use pattern matching anywhere?

14:49 cmvkk_: do you mean regexes?

14:50 johnw: no, I mean functional programming-style pattern matching

14:50 i think it's (defn foo [x] ([x] ..) ([x & rest] ..))

14:50 or does clojure not do this?

14:51 cmvkk_: that's not really built in, per se.

14:51 you can define functions with multiple arities like that.

14:51 but that's just multiple arities, not pattern matching as a whole.

14:51 johnw: oh

14:51 i see

14:51 cmvkk_: on the other hand, there is destructuring which works kind of like that

14:51 and you can do that inside function arguments... a la (defn foo [x & xs] ...)

14:52 docs for that are maybe under 'let'?

14:52 johnw: k, thanks

14:52 cmvkk_: which would be on the special forms page.

14:52 dnolen: also you have multimethods which allow to define what you want to dispatch on.

14:53 ,(doc defmulti)

14:53 clojurebot: "([name docstring? attr-map? dispatch-fn & options]); Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :default the default dispatch value, defaults to :default :hierarchy the isa? hierarchy to use for dispatching defaults to the global hierarchy"

15:16 AWizzArd: ~seen jcowan

15:16 clojurebot: no, I have not seen jcowan

15:30 Lau_of_DK: Good evening gents

15:30 kotarak_: Hi Lau

15:32 Lau_of_DK: I just tried installing Linux Mint - Its pretty cool, but Im in the wrong IRC client, brb

15:32 There we go :)

15:33 kotarak_: Lau_of_DK: you are switching linux distro far more often than I change my shirt. ;)

15:33 Lau_of_DK: thats.... pretty disgusting

15:34 AWizzArd: Lau, do you install those Linuxes in VirtualBox?

15:34 Lau_of_DK: AWizzArd, Nope - I have my /home on a separet partition, so I just flush /

15:35 AWizzArd: kotarak: please check if any windows on your compi were updated

15:35 kotarak: AWizzArd: ??? What do you mean?

15:35 AWizzArd: the one with the cat icon

15:36 kotarak: Ah ok. Sorry.

15:37 Lau_of_DK: Im actually considering trying to isntall OpenBSD - I attended a security lecture from some of their community regulars... Raised some interesting points

15:37 In the Linux world - Nothing beats Arch Im sure

15:38 kotarak: Hmmmm... I saw people ripping OpenBSD apart. With some very bad code down the kernel...

15:38 Lau_of_DK: Sounds unlikely

15:38 Present your evidense Mr. Kota

15:38 And I'll present a spell-checker :)

15:38 AWizzArd: I think the Kernel was not written in Clojure. It must be bad then.

15:39 Lau_of_DK: true - A part of the lecture covered some arguments for using strlcpy for copying bytes, instead of strcpy or strncat...... I was half-asleep while thinking 'come on, this is 2008, get over it'

15:39 cmvkk_: oh man what kind of freaky operating system would that

15:39 be

15:39 AWizzArd: :)

15:39 kotarak: Lau_of_DK: Ah. I don't remember it was three or four years back. Concerning integer overflow and casting int to uint unsafely and such things. I'm not an expert....

15:39 AWizzArd: cmvkk_: there were for many years Lisp Machines

15:39 Lau_of_DK: kotarak, Integer overflow is probably the most widely exploitable bug there is today, not specific to OpenBSD

15:40 However OpenBSD is probably uniquely protected from Bufferoverflows

15:43 kotarak: Lau_of_DK: And the performance of OpenBSD seemed very bad in a comparison, where Linux and FreeBSD performed roughly similar, NetBSD slightly worse and OpenBSD more or less broke completely down... *kotarakisnoexportanddoesn'tknowhowmuchtruthisinthis*

15:43 Lau_of_DK: eh?

15:44 kotarak: Lau_of_DK: let me see....

15:44 Lau_of_DK: You compare Linux and FreeBSD? Linux covers everything from Gentoo, Arch to Slackware to Ubuntu/PC-Linux and such...

15:44 Anyway, if there's not a heavy performance gain then I wont even try it out - I wanted something that could match Arch

15:50 kotarak: Lau_of_DK: Linux is also a kernel, which provides certain functionality for all distros. Here is what I remembered. It's quite out-dated now.... So read at your own risk ;) http://bulk.fefe.de/scalability/

15:51 Lau_of_DK: Amazing.... Ive never seen that ugly charts before

15:51 kotarak: Well they are ugly, but there is no junk.

15:51 I've seen much more "prettier" charts only consisting of chart junk.

15:52 Lau_of_DK: hehe

15:52 Interesting, that you chose to mention that :)

15:52 kotarak: What?

15:52 Lau_of_DK: Anyway, lets talk shop

15:53 If its not Swing/AWT and its not Qt - What is it that I can develop Java UIs in ?

15:53 kotarak: SWT?

15:53 leafw: Lau_of_DK: SWT

15:53 Lau_of_DK: SWT?

15:53 leafw: Lau_of_DK: clipse toolkit.

15:53 s/clipse/eclipse/

15:54 Lau_of_DK: k - any pros compared to Swing?

15:55 leafw: Lau_of_DK: SWT is, IMO, not worth it. No threaing issues, but has a native component to it that must be installed separately for each platform.

15:56 Lau_of_DK: ouch

15:56 Thats sounds bad

15:56 Im just not liking Swing very much, it seems laggy and somewhat ugly - and Qt is great, but depends on Jambi, which is quite large

15:57 leafw: only AWT remains, but it's quite limited.

15:57 Swing is OK if you understand its threading model.

15:58 in short, any swing-related operations must be done in a Runnable that is executed by the SwingUtilities.invokeLater(runnable);

15:58 Lau_of_DK: Seems simple enough

15:58 leafw: it's quite fault-tolerant too, so it will work fine in most situations even when ignoring its threading model.

15:58 Lau_of_DK: leafw, Is it also laggy in your experience?

15:58 sluggish is more the word

15:59 leafw: not in my experience.

15:59 jdk 1.6.0 repaints swing components very fast.

15:59 if you use images, be sure to learn how to use VolatileImage for super fast transparencies and what not.

15:59 (graphic card resident images)

16:00 Lau_of_DK: I'll remember that, thanks

16:03 kotarak, , this isnt signed, but it looks like your handy work? http://www.dadhacker.com/blog/?p=1112

16:09 cconstantine: Say I wanted to make a compiled clojure program, how would I go about doing that?

16:09 blbrown: ,doc compile

16:09 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/doc

16:09 blbrown: ,(doc compile)

16:09 clojurebot: "([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."

16:10 Lau_of_DK: cconstantine, try downloading clojure from SVN, type "ant", watch it compile, mimic that structure + build.xml in your own project

16:12 cconstantine: thanks

16:14 kotarak: Lau_of_DK: sorry. I'm more or less afk. What was it with this link?

16:15 Lau_of_DK: Just a guy who wrote a command-line formatting utility which instead of yes/no prompts, asked you to type "Yes Mother, I do want to format my drive." - and by a mistake, this was widely used in an asian factory, resulting in the workers having little notes with this sentense written on, in order to remember it

16:16 kotarak: Hehe. Could happen in other companies, too. ;)

16:18 blbrown: Lau_of_DK, you have an idea on this. I want to load script B at the bottom but only have it loaded once and then load other scripts and still have script B 'cached'. within that clojure instance. http://paste.lisp.org/display/77719

16:20 Lau_of_DK: (load "b") doesnt do it for you ?

16:21 blbrown: Lau_of_DK, you know how to do that from Java code

16:21 Lau_of_DK: I've seen it done, but I forgot how - I think you might be able to find an old snippit in the paste-bin from Rich regarding this, or check out docs for Enclojure

16:22 blbrown: Lau_of_DK, even something like java:CurrentClojureInstance?.runScript("(load 'b')"); would wokr

16:22 ok

16:22 Lau_of_DK: Sorry - Dont remember specifically

16:22 Its a form of loadResource I believe

16:22 blbrown: ah, I saw that method

16:27 Lau_of_DK: I have a weird problem with Compojure - I have html form {:action "/" :method "POST" :id "foo"} which when posting, gives an empty {} as params... what gives?

16:28 AWizzArd: Lau: have you tried a similar thing before, and did it work then?

16:28 Lau_of_DK: Yes and yes

16:28 I have an almost identical setup in a another compojure program, which runs without any problems

16:29 AWizzArd: ok, so in principle it should work, and it worked for you in the past. But this time it does not do what you expected.

16:29 lpetit: rhickey: no problem, I slept a little then, and today I'm not that sure that the solution I had envisioned would be that easy, and that universal. So since I'm not myself currently faced to the problem, I'll delay rethinking about that when I personnaly am concerned with it.

16:33 AWizzArd: Btw, Lau_of_DK, is there a book or detailed tutorial for Compojure?

16:33 blbrown: Lau_of_DK, you can use my web framework...when I am done with it. It is more 'java' oriented though

16:34 Lau_of_DK: AWizzArd, They have a pretty good wiki site set up now, and Technomancys concourse is fantastic (github)

16:38 danlarkin: get outta here with your competing "web framework", blbrown :D

16:40 cmvkk_: no matter how competitive, we all know the first truly successful framework will be the first one with a rails ripoff name.

16:40 'clojure on clouds' or something.

16:40 blbrown: danlarkin, don't worry I don't generally tend to finish things but there are things that I want to add to a framework. Plus, compojure is pure clojure. Mine won't be. I am using existing j2ee libraries

16:42 cconstantine: I'm trying to compile a clojure file via "java -cp <paths to clojure .jars> clojure.lang.Compile clojure-source.clj" and it's not working

16:42 blbrown: "and it's not working" I cringe when I hear that in IRC

16:42 cconstantine: the error I'm geting is: "ERROR: Must set system property clojure.compile.path"

16:43 blbrown: I say that because the error I'm getting isn't all that helpful ;)

16:43 blbrown: actually, it is pretty accurate. on the command line try -Dclojure.compile.path=classes (maybe make a classes directory)

16:44 cconstantine: accurate almost never means helpful :P

16:44 I'l try that

16:44 blbrown: good point

16:46 cconstantine: same error

16:48 this is not being done through ant... if that helps

16:50 ,(doc compile)

16:50 clojurebot: "([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."

16:54 Lau_of_DK: ...seems in the latest version of compojure, POST parameters are taken from "name" not "id"

16:56 blbrown: isn't that standard HTML. where you have an input field and the input fields are identified by the 'name' attribute

16:57 danlarkin: blbrown: indeed

16:59 cconstantine: any other ideas on how to set the clojure.comp.path property?

17:01 Mec: is that the same as the *compile-path*?

17:01 cconstantine: no idea, I got an error saying it needs to be set

17:02 hiredman: ~def clojure.lang.Compile

17:04 cconstantine: how have you tried setting it?

17:05 cconstantine: -Dclojure.compile.path

17:05 evidently it has to be one of the first arguments to java

17:06 hiredman: is there a reason you are using clojure.lang.Compile directly?

17:07 cconstantine: I want to make a compiled clojure program

17:07 .jar/.class whatever I can run directly

17:07 hiredman: use compile

17:07 blbrown: cconstantine, so it worked. You will get there that is why I didnt say anything. Basically you need that value set for clojure to compile the classes to. And there are several different ways to do it

17:07 hiredman: java clojure.main -e "(compile 'some.name.space)"

17:08 cconstantine: yeah, I got that set now I'm getting other wierdness

17:08 that was for blbrown

17:08 hiredman: trying now

17:08 java.io.FileNotFoundException: Could not locate prob_4__init.class or prob_4.clj on classpath: (NO_SOURCE_FILE:0)

17:09 prob_4.clj is the name of the file prob_4 ns is defined in

17:09 hiredman: you need to set your classpath of course

17:09 cconstantine: do you have a good namespace declaration?

17:09 ~namespace

17:09 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

17:10 cconstantine: is "(ns prob_4)" good?

17:10 hiredman: no

17:10 blbrown: hehe

17:10 hiredman: cconstantine: for a few reasons

17:10 one of which clojurebot just told you

17:11 blbrown: the standard for java packages is normally '<com/org>.<company name>.<project>.WHATEVER'

17:11 hiredman: the other reason is something that may not be a reason

17:11 cmvkk_: as an aside, that format doesn't make sense from a free software perspective does it?

17:12 hiredman: dashes in namespaces are mapped to underscores in filenames

17:12 blbrown: cmvkk_, not necessarily, but yea, I guess you could leave off the company name

17:12 hiredman: not sure about underscores in namespaces

17:12 I've been using hiredman.*

17:13 cmvkk_: it seems like bad practice to hardcode the author's name or organization into any piece of code, and if the first unit is always com/org, why even bother?

17:13 blbrown: i just hate naming files/directories with minus '-'

17:13 cmvkk_: i think for clojure, project.file is a good enough format.

17:13 hiredman: cmvkk_: one of the original ideas of java was the jvm could go out and find the classes it was looking for

17:14 blbrown: muahahhaa

17:14 hiredman: so package names where basically urls

17:14 were

17:14 cmvkk_: yeah, i get that. that still seems like a bad idea, though...

17:14 * cconstantine agrees

17:14 hiredman: needless to say, this never took off

17:14 cmvkk_: because now, if your website name changes, all the code has to change too!!

17:15 and all the code for everything that uses that library, etc.

17:15 hiredman: cmvkk_: luckily sun has hung onto their websites

17:15 blbrown: yea, if you are insane. I see a lot of people do that when they move from sourceforge projects. I say, why have to completely rename your package structure

17:16 hiredman: http://www.faqs.org/rfcs/rfc4151.html

17:17 Lau_of_DK: Anybody here been able to work out, how compojures (decorate-with) works ?

17:17 cconstantine: right, so in the meantime I have a single clj file I want to compile that desn't have anything to do with the internet

17:17 blbrown: hehe

17:18 hiredman: *shrug*

17:19 cmvkk_: this is why namespace-dependent stuff annoys me in general... it doesn't make sense for throwaway stuff.

17:19 hiredman: in clojure you compile namespaces not files

17:19 cmvkk_: there should be a (compile-file "foo.clj") that just works for foo.clj.

17:20 i guess that wouldn't work with java, though, since the compiled stuff has to have a namespace of some sort

17:20 hiredman: why compile things that are "throwaway"?

17:21 brennanc_: you guys know of any good templating systems like smarty for lisp/clojure? I'd like to allow the user to submit a page that has runnable code but don't want it to be anything that he can cause damage to the system or that could get stuck in infinite loops or hog resources.

17:21 cconstantine: how do I see what the current namespace is from within clojure?

17:21 hiredman: *ns*

17:21 ,(doc *ns*)

17:21 clojurebot: "; A clojure.lang.Namespace object representing the current namespace."

17:21 cmvkk_: ,*ns*

17:21 clojurebot: #<Namespace sandbox>

17:22 cconstantine: erm, classpath

17:22 hiredman: System/getProperty

17:22 blbrown: cmvkk_, at least the project name is a relevant namespace <clojure>.file.clj. because you avoid conflicts and it REALLY is in a different namespace. I never put anything in a default namespace/package even for throwaway code

17:23 sacrelig!

17:23 cmvkk_: blbrown, I agree. If i'm writing a file or whatever, I make up something dumb at least

17:23 although this usually amounts to (ns cmvkk.blah)

17:23 slashus2: You have to do a gen-class before you can compile something?

17:24 hiredman: nope

17:24 gen-class, if you use it, happens when you run compile, otherwise it s nop

17:25 slashus2: You are talking about compiling into a .class file?

17:25 hiredman: explinations get a little tricky here

17:26 because clojure is always compiled to jvm byte code which is what a .class file is

17:26 slashus2: yeah

17:26 Mec: anyone know the O of (set )

17:26 hiredman: but that byte code is not written to disk unless you use compile

17:27 ~def set

17:27 ,(class (set '(a)))

17:27 clojurebot: clojure.lang.PersistentHashSet

17:27 hiredman: it just has to compare the hashcode I guess

17:28 but it has to walk what you pass it, so maybe n?

17:29 gen-class generates a, erm, named class? in the sense that you give the class a meaningful name instead of just a random number clojure generates for the classes it generates under the hood

17:29 Mec: well im running out of heapspace so guess it doesnt matter how long it will take

17:30 cmvkk_: you can't 'run' a class generated without genclass, right?

17:30 i.e. java foo__1234.class or whatever

17:30 hiredman: cmvkk_: I am usre if you really tried you could

17:30 sure

17:30 cmvkk_: well it would have to have a main method right? and those Fn classes don't do they?

17:31 hiredman: oh, if you mean cannot run by calling java on the command line, sure

17:31 Mec: anyone familiar with clojurebox know how to change the size of the heap space?

17:32 hiredman: but they are java classes, so I am sure from java you could instantiate them

17:32 cmvkk_: right.

17:33 kotarak: cmvkk_: you can specify generation of a main method via (gen-class ... :main true ...) resp. (gen-class ... :main false ...)

17:39 cmvkk_: sorry misread your message...

17:44 slashus2: I can't even get the gen-class Example to work.

17:47 java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.examples.hello$_main__4 (NO_SOURCE_FILE:0)

17:51 This is highly frustrating.

17:58 stuhood: slashus2: you have everything on the classpath that you need, right? the output directory for your classfiles is easy to miss

17:59 slashus2: It worked after I added the classes directory.

17:59 thanks

17:59 Sometimes the classpath stuff is a pain.

18:01 blbrown: ,(doc comment)

18:01 clojurebot: "([& body]); Ignores body, yields nil"

18:02 blbrown: can you load the comment body through code. say if you want to print the file comment

18:16 stuhood: ~defn print-doc

18:16 clojurebot: It's greek to me.

18:16 stuhood: ~def print-doc

18:16 ,(:doc min)

18:16 clojurebot: nil

18:17 hjlee: ,(doc min)

18:17 clojurebot: "([x] [x y] [x y & more]); Returns the least of the nums."

18:18 stuhood: yea... i'm trying to answer blbrown's question: that prints the doc, so i'm trying to get it as a string

18:18 ,(:doc (var min))

18:18 clojurebot: nil

18:19 stuhood: ,(:doc (var ^min))

18:19 clojurebot: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol

18:20 stuhood: ,(:doc ^(var min))

18:20 clojurebot: "Returns the least of the nums."

18:20 stuhood: sigh

18:22 blbrown: if I put (comment \n ;lksjdkflskdjfskl \n ) at the top of a file, I guess I can't get that comment

18:31 stuhood: blbrown: the reader would be able to get it, but it would throw it away immediately

18:34 blbrown: and it doesn't look like you can attach metadata to the namespace

18:36 hiredman: ,(class *ns*)

18:36 clojurebot: clojure.lang.Namespace

18:36 stuhood: ,(with-meta *ns* {:comment "Hello World"})

18:36 clojurebot: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.IObj

18:37 hiredman: ,(map #(.getName %) (.getMethods (class *ns*)))

18:37 clojurebot: ("findOrCreate" "getMappings" "importClass" "refer" "findInternedVar" "lookupAlias" "removeAlias" "toString" "getName" "intern" "find" "remove" "unmap" "getMapping" "addAlias" "getAliases" "all" "alterMeta" "resetMeta" "meta" "wait" "wait" "wait" "hashCode" "getClass" "equals" "notify" "notifyAll")

18:37 stuhood: hmm

18:37 hiredman: ,(ancestors (class *ns*))

18:37 clojurebot: #{clojure.lang.IMeta java.lang.Object clojure.lang.AReference clojure.lang.IReference}

18:37 stuhood: so it contains mutable metadata?

18:37 hiredman: ,(doc alter-meta)

18:37 clojurebot: java.lang.Exception: Unable to resolve var: alter-meta in this context

18:37 hiredman: ,(doc vary-meta)

18:37 clojurebot: "([obj f & args]); Returns an object of the same type and value as obj, with (apply f (meta obj) args) as its metadata."

18:38 hiredman: ,(vary-meta *ns* assoc :a 1)

18:38 clojurebot: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.IObj

18:38 hiredman: hmmm

18:38 slashus2: ,(doc alter-meta!)

18:38 clojurebot: "([iref f & args]); Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects"

18:38 hiredman: ah!

18:38 stuhood: sweeet

18:38 hiredman: ,(alter-meta! *ns* assoc :a 1)

18:38 clojurebot: {:a 1}

18:38 hiredman: ,(meta *ns*)

18:38 clojurebot: {:a 1}

18:39 slashus2: oh dear..

18:39 stuhood: hiredman: that probably wiped out whatever metadata was already attached to the ns

18:39 hiredman: ,(alter-meta! *ns* assoc :killroy-was-here true)

18:39 clojurebot: {:killroy-was-here true, :a 1}

18:39 hiredman: nah

18:39 stuhood: hiredman: if it had any

18:39 slashus2: It didn't have anything.

18:39 hiredman: (apply assoc (meta *ns*) :a 1) would not wipe out anything in the metadata map

18:40 stuhood: ahh, indeed... my bad

18:40 slashus2: (meta *ns*) is nil

18:40 stuhood: blbrown: to attach a comment to a file, make sure the contents of a file are part of a namespace, and then attach metadata to the namespace like we did above

18:42 hiredman: stuhood: he seems to wnat a literal comment

18:42 not a docstring

18:43 stuhood: well, he wanted to get it programmatically, and i don't think he'll be able to achieve that with (comment) without modifying the reader

18:44 hiredman: ~def comment

18:45 kotarak: comment is actually a macro.

18:45 slashus2: simple macro

18:46 stuhood: yea... so in order to get the contents, he'd have to write another macro that nullified the effect of (comment)

18:47 it'd be interesting if (comment) attached your comment to the metadata of whatever var/namespace it was in

18:49 hiredman: (defmacro comment [&body] (alter-meta! *ns* update-in [:comments] assoc (str body)) nil)

18:49 ,(doc update-in)

18:49 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

18:49 hiredman: oh

18:49 wiat

18:49 (defmacro comment [&body] (alter-meta! *ns* update-in [:comments] conj (str body)) nil)

18:50 ,(update-in {} [:comments] conj :a)

18:50 clojurebot: {:comments (:a)}

18:52 stuhood: heh, ask and ye shall receive

18:53 kotarak: Isn't the docstring of the namespace sufficient?

18:54 stuhood: kotarak: yea, should be: changing (comment) was just a fun whatif

19:11 slashus2: Looks like javamail became open source March 2. That is neat.

19:22 stuhood: slashus2: yea, i'm really excited: we try not to look behind the api when we use it, but it really helps with debugging performance issues

19:28 slashus2: are you using the IMAP portion of that api?

19:28 clojurebot: the website api refers to last release

19:28 slashus2: nope

19:28 stuhood: gotcha

19:31 hiredman: clojurebot: botsnack

19:31 clojurebot: thanks; that was delicious. (nom nom nom)

19:32 AWizzArd: hiredman: why do you feed it?

19:33 hiredman: it's a computer program, feeding it would be silly

19:33 I reward it

23:15 slashus2: ,(.pow (bigint 10) (.pow (bigint 10) 100))

23:16 clojurebot: 1

23:17 slashus2: not quite a googolplex

23:17 cmvkk: is the problem that the 100 at the end has to be a bigint maybe

23:17 slashus2: Do the last part by itself

23:17 It comes out to be a googol

23:18 gnuvince_: ,(.pow (bigint 10) 100)

23:18 clojurebot: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

23:19 gnuvince_: ,(.pow (bigint 10) (bigint 100))

23:19 clojurebot: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

23:19 cmvkk: ,(.pow (bigint 10) (.pow (bigint 10) (bigint 100)))

23:19 clojurebot: 1

23:19 slashus2: :-(

23:19 cmvkk: ,(.pow (bigint 10) (.pow (bigint 10) (bigint 10)))

23:19 that should just time out.

23:19 clojurebot: Execution Timed Out

23:20 cmvkk: so i wonder why it doesn't work after a while

23:20 slashus2: It should time out on the other one as well.

23:20 cmvkk: yeah.

23:20 slashus2: Not return 1...

23:20 I will try to confirm that this is the behavior in java when I get time.

23:22 cmvkk: I see no reason why it wouldn't be the case

23:22 slashus2: I was watching cosmos and Carl Sagan mentioned a googolplex, I wanted to see what a googol looked like.

23:23 cmvkk: of course even with unlimited time, you couldn't write out a googolplex with a computer

23:23 or rather, you couldn't define one as a bigint

23:23 slashus2: oh I see.

23:24 BigInt's power function only takes an integer

23:24 cmvkk: because you'd need at least a googol bits to do it, and more like 2.5*googol or whatever

23:24 oh, it coerces to int?

23:24 slashus2: I think so

23:25 �BigInteger pow(int�exponent)

23:25 It is strange that it doesn't take another BigInteger.

23:25 cmvkk: well it makes sense to a degree.

23:26 on a 32-bit system, you won't ever have enough memory to define a number raised to a power above max_int.

23:26 slashus2: That you will probably never use a pow greater than max_int

23:27 cmvkk: because 2^max_int is exactly the maximum amount of memory a 32-bit system can have.

23:27 slashus2: On a 64-bit system max_int will be the max amount of memory a 64-bit system can have :-)

23:28 cmvkk: or the highest number your memory can represent, i mean.

23:28 slashus2: right

23:28 cmvkk: well based on java numbers, for a 64-bit system it would be max_long.

23:28 i think java ints are 32 bits and longs are 64 bits no matter what the chip archetecture is

23:36 WizardofWestmarc: cmvkk: I'd hope so else you lose some of the consistance java is supposed to give across hardware...

23:53 slashus2: Maybe when a majority of systems are 64-bit, they will switch it over to use long?

23:53 WizardofWestmarc: that or introduce a new type for 128 bit numbers, 'cause you'd potentially break a lot of legacy code if you changed the length of ints vs longs

23:54 slashus2: I mean the pow function in BigInteger

23:54 Not the whole system

23:55 WizardofWestmarc: ah

23:55 yeah big int I'd hope they'd change

23:56 'cause once we can start having things bigger then even 64 bit numbers, we'll really need big int to kick it up a notch

23:56 as I doubt anyone relies on big int erroring <_<

Logging service provided by n01se.net