#clojure logs

2009-03-28

01:18slashus2Raynes: Looks pretty bad.
01:20slashus2I don't see any tornado reports in Alabama as of 1512 UTC.
01:20cmvkk_Here in Kansas we're getting snow and sleet.
01:21cmvkk_oh well. if i can't go anywhere that just means i can work on coding all day
01:23Raynesslashus2: The severe weather is rather limited to south Alabama tonight. Around 5AM is when the real shit starts.
01:24slashus2Raynes: According to the storm prediction center, the greatest tornado risk is in Louisiana and Mississippi.
01:25slashus2Raynes: http://www.spc.noaa.gov/products/outlook/day1otlk.html
01:26slashus2valid through another 6 hours
01:26Raynesslashus2: 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.
01:27RaynesThey should update the Day 1 outlook at 1.
01:27Raynes1AM central time at least.
01:27RaynesI'm not sleeping tonight.
01:27cmvkk_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.
01:29slashus2Raynes: I always find tracking storms to be fun.
01:30Raynesslashus2: Me too. Until they are coming towards me, then it gets a little less exciting.
01:30slashus2That is the thrill ride.
01:31slashus2Going outside when you are under a tornado warning at night trying to spot a wall cloud.
01:31cmvkk_slashus2 is the kind of person who drives a pickup into a corn field to release a bunch of tiny robots into a tornado
01:31Raynesslashus2: That's called being stupid.
01:32RaynesAt night, it's impossible to see anything. You can hardly ever see anything during the day in Alabama. Tornadoes are /always/ wrapped in rain.
01:32slashus2It wasn't raining outside.
01:33slashus2I wouldn't call it being stupid. Being curious. As long as one is knowledgeable about the behavior of storms.
01:34RaynesIt's stupid if you don't know which direction you have to be in too see a tornado.
01:35Raynesto*
01:35slashus2I was paying close attention to the rotation of the storm.
01:35slashus2This is getting way off topic.
01:37RaynesDid you know that the tornado was not moving towards you at the time?
01:37RaynesWe should totally make a channel #Weather
01:37slashus2Yes, the rotation was to the north.
01:38RaynesI wish they would update the day 1 outlook.
01:39slashus2You are correct that it was issued 5 hours ago.
01:39slashus2pretty outdated.
01:39RaynesIt should be updated within the next 30 minutes.
01:40RaynesVirtually the entire state is under 45% risk for day 2. It will be upgraded to a moderate or high risk I'm sure.
01:44RaynesFor the books, I live in northwest central Alabama. To be specific, extreme northwest Walker county.
01:48RaynesIt's been updated.
01:49slashus2Raynes: Looks like NW Alabama may miss the brunt of the tornado onslaught.
01:50Raynesslashus2: I hope so.
01:51RaynesJust have to see what happens :\
02:03RaynesI don't trust the SPC.
02:03slashus2hehe
02:14Raynesduck1123: Why would you ever want to learn lojban?
02:18cmvkk_lojban is like the haskell of conlangs. it's totally pure, but nobody ever uses it for anything real
02:18clojurebotYo 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.
02:19cmvkk_hello clojurebot
02:21Raynescmvkk_: Haskell is awesome, but Clojure is awesomer from a "Holy shit, a functional language someone might actually use." point of view.
02:22Raynesclojurebot: 'Sup hiredman.
02:22clojurebotTitim gan �ir� ort.
02:22Raynes<3 You're still my hero.
02:25cmvkk_I keep opening stuff in vim then typing "C-x C-s" to try and save it, which causes vim to freeze up instead.
02:25RaynesWhat language is that :(
02:25RaynesI don't speak Clojurenerd quite as well as the others here just yet.
02:26cmvkk_what?
02:27Raynescmvkk_: (= vim crap) true
02:28cmvkk_i like it about as well as emacs to be honest. i'm not a 'power user' by any means
02:28cmvkk_between it and anything else, it's the easiest editor to just quick open a file in the terminal in.
02:29RaynesI'm an Enclojure user. I don't judge.
02:32Raynesclojurebot: May you fall without rising.
02:32clojurebotI don't understand.
02:32RaynesNeither to I.
02:32Raynes:|
02:38RaynesDid someone actually make a "Clojure vs Scala" thread.
02:38RaynesHaven't we had enough of those. :\
02:40cmvkk_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.
02:43brennanc_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.
02:44cmvkk_brennanc_: the blub paradox?
02:44brennanc_is that something like the lamer it is the more they swear by it?
02:46cmvkk_it basically says people won't understand the features of another language if their language doesn't have those features,
02:46Raynesbrennanc_: Fish breathe too :(
02:46cmvkk_or something like that...
02:53hiredmanhave you seen php's answer to lambda?
02:54hiredmanit creates a function with random name, and returns that name as a string
02:54Raynes...
02:55cmvkk_if it works it works I guess
02:56brennanc_I saw something where they were proposing lambda syntax. The syntax for it looked really "noisy"
02:57hiredmanalmost makes me want to finish my lisp.php
02:57hiredmanI think the only thing left is lexical and dynamic bindings
03:01Rayneshiredman: Touch me so some of your knowledge may rub off on me.
03:01brennanc_are there any tutorials on how to get emacs working with clojure support?
03:02brennanc_I'm using textmate but it's not indenting things correctly
03:02hiredmanI would say something like "I am but a man" but that may be pompous
03:02Raynesbrennanc_: There are more than I can count.
03:03hiredmanclojurebot: clojure-install?
03:03clojurebotclojure is a language to use if you want to up your game
03:04Raynesclojurebot: clojure?
03:04clojurebotclojure is a language to use if you want to up your game
03:04hiredmanhttp://github.com/technomancy/clojure-mode/tree/master comes with some sort of "install clojure and make it all work for me" stuff
03:04RaynesI see what you did there.
03:09brennanc_what are some of the common editing setups / environments people use for coding clojure?
03:10brennanc_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.
03:11hiredmanI vim
03:17mrsoloyea a book is helpful
03:17mrsoloemacs has steep learning curve
03:17brennanc_more than vi?
03:17mrsoloyes
03:18brennanc_vi took me a week to get up to the proficiency level of MS notepad
03:18brennanc_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
03:19mrsoloemacs is a bit more involved
03:20brennanc_is it worth it or should I stick with vi?
03:20hiredmanvim
03:20Raynesmrsolo: The learning curve isn't more than vim...
03:20hiredmanyou don't want vi
03:20RaynesIf anything it's less.
03:21RaynesSaying Emacs is harder to use is pure speculation and opinion. I hear both Editors have good support for Clojure however.
03:21mrsolowell i dunno
03:21mrsoloi am wrong person to ask.
03:21RaynesSo choose which ever one looks uglier.
03:21mrsoloi learned vim decades ago
03:21hiredmanhttp://garbagehill.files.wordpress.com/2008/04/editor-learning-curves.jpg
03:21mrsoloand eamcs recently ... so i pretty much forgot vi learning curse
03:23mrsolowell eamcs has slime.. i heard vim has beefed up clojure support recently?
03:23hiredmanhttp://img.skitch.com/20090108-8b31mucqnmb3wnpi1pg5wtd28i.png <-- is pretty impressive for a text editor
03:23Raynesmrsolo: Type 'Emacs' slower ;). Vim got VimClojure. It's supposed to be hawt.
03:23mrsolobrennanc: it is worth learning both
03:27Rayneshiredman: Mac user.
03:27hiredmanme/
03:28hiredman?
03:28RaynesYes.
03:28RaynesYoiu.
03:28RaynesYou*
03:28hiredmanI couldn't afford a mac
03:29RaynesOh, I thought that was your screenshot.
03:29hiredmannope
03:30hiredmana xmpp client, with avatar support, in your text editor
03:30hiredmancrazy
03:31mrsolonaw :-)
03:31mrsoloemacs does it all
03:40cmvkk_I wonder if it's a bad idea to write my documentation at 2:30am
03:41cmvkk_am i gonna wake up tomorrow morning, look at it and go "what the hell"
03:41cmvkk_"that sentence doesn't make any sense"
03:56RaynesWriting doc strings when you are tired is a mistake. The proves itself true more often that I can stress.
03:57cmvkk_Heh. You're right, and I wasn't even doing that. I was writing the readme file.
04:15RaynesI Hate People Who Capitalize Every Single Word.
04:28texoduswhat rv?
08:46leafwanybody can point to usage of -> ?
08:46leafwI never get it right, and the doc is too high level for me
08:47leafwand example is worth 10 docs
08:53laurumleafw: For example the following expressions have the same result: (f1 (f2 (f3 x))) (-> x f3 f2 f1)
08:55leafwand applied to a map?
08:55laurumit calls a series of functions, passing the result of each as an argument to the next
08:56Raynesslashus2: Looks like I might live through the next round of storms due in here soon. :D
09:09cgrandleafw: (-> {:a {:b {:c 1}}} :a :b :c) yields 1 (this works only with keywords)
09:10cgrand(-> {"a" {"b" {"c" 1}}} (get "a") (get "b") (get "c")) when keys aren't keywords
09:11leafwcgrand: nice example. So that's for reading. Can one put in to :c some value, and get the returned new map?
09:18cgrandleafw: I don't know of a -> base idiom deep association, you have to use assoc-in
09:26cgrand(now without missing words and letters) I don't know of a -> based idiom for deep association, you have to use assoc-in
09:33qwert666i 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 ?
09:40leafwcgrand: thanks, assoc-in does it.
09:42Chousukeqwert666: m is not a symbol. 'm is
09:42cgrandqwert666: (name 'm) ; without the quote, m is resolved
11:36rhickeylpetit: sorry, I got called away last night
11:43AWizzArdChousuke: apropos symbol: it seems that symbols are not allowd to start with a digit
11:44AWizzArd,'3*x
11:44clojurebotInvalid number: 3*x
11:44AWizzArd,'x*3
11:44clojurebotx*3
11:44AWizzArdso (def 3*x (* 3 x)) is not allowed
12:07blbrownis rhickey here?
12:13blbrownI 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:41AWizzArdhi kotarak
12:41kotarakhi Wizz
12:45AWizzArdblbrown: 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:46AWizzArdif require ==> if I require
12:46kotarakX,Y,Z should be loaded only once.
12:47AWizzArdthis is typically what I want
12:47AWizzArdalthough, now as we talk about this: what if Z changes during runtime?
12:48kotarakIf the rest references the Vars of Z (not taking it's value), the new Z code will be used.
12:49cmvkk_you can also do (require :reload ...) to reload stuff
12:49kotarakand :reload-all...
12:50kotarakI 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:51kotarakThe 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:02brennanc_how do I undefine something?
13:03brennanc_I'm trying to load some external code and it's complaining it already exists in the REPL's user namespace
13:04kotarak(doc ns-unmap)
13:04clojurebotRemoves the mappings for the symbol from the namespace.; arglists ([ns sym])
13:04brennanc_thanks
13:05slashus2,(reduce #(concat %1 [%2]) [] (range 3500))
13:05clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
13:06cmvkk_what's going on with that is that concat returns a lazy-seq.
13:06cmvkk_so when you reduce that way, you just have lazy-seq on top of lazy-seq and so on
13:07slashus2,(reduce + (reduce #(conj %1 %2) [] (range 3500)))
13:07clojurebot6123250
13:09cmvkk_,(last (reduce #(doall (concat %1 [%2])) [] (range 3500)))
13:09clojurebot3499
13:09cmvkk_if you add a doall, it stops blowing the stack.
13:10cmvkk_conj works too, because it isn't lazy in the first place.
13:10slashus2So doall forces concat to realize?
13:10kotarak(dfoc doall)
13:11kotarak(doc doall)
13:11clojurebotWhen 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:11kotarak(doc dorun)
13:11clojurebotWhen 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:18cmvkk_it's interesting because it's a gotcha that there's no real fix for.
13:18cmvkk_if something takes a lazy-seq and makes a new lazy-seq that uses it, you shouldn't compound calls to it.
13:19cmvkk_and that's all you can say.
14:05slashus2cmvkk_: A gotcha of lazy sequences. It is a good thing to know.
14:49johnwdo the docs on clojure.org talk about how to use pattern matching anywhere?
14:49cmvkk_do you mean regexes?
14:50johnwno, I mean functional programming-style pattern matching
14:50johnwi think it's (defn foo [x] ([x] ..) ([x & rest] ..))
14:50johnwor does clojure not do this?
14:51cmvkk_that's not really built in, per se.
14:51cmvkk_you can define functions with multiple arities like that.
14:51cmvkk_but that's just multiple arities, not pattern matching as a whole.
14:51johnwoh
14:51johnwi see
14:51cmvkk_on the other hand, there is destructuring which works kind of like that
14:51cmvkk_and you can do that inside function arguments... a la (defn foo [x & xs] ...)
14:52cmvkk_docs for that are maybe under 'let'?
14:52johnwk, thanks
14:52cmvkk_which would be on the special forms page.
14:52dnolenalso you have multimethods which allow to define what you want to dispatch on.
14:53dnolen,(doc defmulti)
14:53clojurebot"([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:16AWizzArd~seen jcowan
15:16clojurebotno, I have not seen jcowan
15:30Lau_of_DKGood evening gents
15:30kotarak_Hi Lau
15:32Lau_of_DKI just tried installing Linux Mint - Its pretty cool, but Im in the wrong IRC client, brb
15:32Lau_of_DKThere we go :)
15:33kotarak_Lau_of_DK: you are switching linux distro far more often than I change my shirt. ;)
15:33Lau_of_DKthats.... pretty disgusting
15:34AWizzArdLau, do you install those Linuxes in VirtualBox?
15:34Lau_of_DKAWizzArd, Nope - I have my /home on a separet partition, so I just flush /
15:35AWizzArdkotarak: please check if any windows on your compi were updated
15:35kotarakAWizzArd: ??? What do you mean?
15:35AWizzArdthe one with the cat icon
15:36kotarakAh ok. Sorry.
15:37Lau_of_DKIm actually considering trying to isntall OpenBSD - I attended a security lecture from some of their community regulars... Raised some interesting points
15:37Lau_of_DKIn the Linux world - Nothing beats Arch Im sure
15:38kotarakHmmmm... I saw people ripping OpenBSD apart. With some very bad code down the kernel...
15:38Lau_of_DKSounds unlikely
15:38Lau_of_DKPresent your evidense Mr. Kota
15:38Lau_of_DKAnd I'll present a spell-checker :)
15:38AWizzArdI think the Kernel was not written in Clojure. It must be bad then.
15:39Lau_of_DKtrue - 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:39cmvkk_oh man what kind of freaky operating system would that
15:39cmvkk_be
15:39AWizzArd:)
15:39kotarakLau_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:39AWizzArdcmvkk_: there were for many years Lisp Machines
15:39Lau_of_DKkotarak, Integer overflow is probably the most widely exploitable bug there is today, not specific to OpenBSD
15:40Lau_of_DKHowever OpenBSD is probably uniquely protected from Bufferoverflows
15:43kotarakLau_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:43Lau_of_DKeh?
15:44kotarakLau_of_DK: let me see....
15:44Lau_of_DKYou compare Linux and FreeBSD? Linux covers everything from Gentoo, Arch to Slackware to Ubuntu/PC-Linux and such...
15:44Lau_of_DKAnyway, if there's not a heavy performance gain then I wont even try it out - I wanted something that could match Arch
15:50kotarakLau_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:51Lau_of_DKAmazing.... Ive never seen that ugly charts before
15:51kotarakWell they are ugly, but there is no junk.
15:51kotarakI've seen much more "prettier" charts only consisting of chart junk.
15:52Lau_of_DKhehe
15:52Lau_of_DKInteresting, that you chose to mention that :)
15:52kotarakWhat?
15:52Lau_of_DKAnyway, lets talk shop
15:53Lau_of_DKIf its not Swing/AWT and its not Qt - What is it that I can develop Java UIs in ?
15:53kotarakSWT?
15:53leafwLau_of_DK: SWT
15:53Lau_of_DKSWT?
15:53leafwLau_of_DK: clipse toolkit.
15:53leafws/clipse/eclipse/
15:54Lau_of_DKk - any pros compared to Swing?
15:55leafwLau_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:56Lau_of_DKouch
15:56Lau_of_DKThats sounds bad
15:56Lau_of_DKIm 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:57leafwonly AWT remains, but it's quite limited.
15:57leafwSwing is OK if you understand its threading model.
15:58leafwin short, any swing-related operations must be done in a Runnable that is executed by the SwingUtilities.invokeLater(runnable);
15:58Lau_of_DKSeems simple enough
15:58leafwit's quite fault-tolerant too, so it will work fine in most situations even when ignoring its threading model.
15:58Lau_of_DKleafw, Is it also laggy in your experience?
15:58Lau_of_DKsluggish is more the word
15:59leafwnot in my experience.
15:59leafwjdk 1.6.0 repaints swing components very fast.
15:59leafwif you use images, be sure to learn how to use VolatileImage for super fast transparencies and what not.
15:59leafw(graphic card resident images)
16:00Lau_of_DKI'll remember that, thanks
16:03Lau_of_DKkotarak, , this isnt signed, but it looks like your handy work? http://www.dadhacker.com/blog/?p=1112
16:09cconstantine Say I wanted to make a compiled clojure program, how would I go about doing that?
16:09blbrown,doc compile
16:09clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
16:09blbrown,(doc compile)
16:09clojurebot"([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:10Lau_of_DKcconstantine, try downloading clojure from SVN, type "ant", watch it compile, mimic that structure + build.xml in your own project
16:12cconstantinethanks
16:14kotarakLau_of_DK: sorry. I'm more or less afk. What was it with this link?
16:15Lau_of_DKJust 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:16kotarakHehe. Could happen in other companies, too. ;)
16:18blbrownLau_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:20Lau_of_DK(load "b") doesnt do it for you ?
16:21blbrownLau_of_DK, you know how to do that from Java code
16:21Lau_of_DKI'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:22blbrownLau_of_DK, even something like java:CurrentClojureInstance?.runScript("(load 'b')"); would wokr
16:22blbrownok
16:22Lau_of_DKSorry - Dont remember specifically
16:22Lau_of_DKIts a form of loadResource I believe
16:22blbrownah, I saw that method
16:27Lau_of_DKI 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:28AWizzArdLau: have you tried a similar thing before, and did it work then?
16:28Lau_of_DKYes and yes
16:28Lau_of_DKI have an almost identical setup in a another compojure program, which runs without any problems
16:29AWizzArdok, 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:29lpetitrhickey: 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:33AWizzArdBtw, Lau_of_DK, is there a book or detailed tutorial for Compojure?
16:33blbrownLau_of_DK, you can use my web framework...when I am done with it. It is more 'java' oriented though
16:34Lau_of_DKAWizzArd, They have a pretty good wiki site set up now, and Technomancys concourse is fantastic (github)
16:38danlarkinget outta here with your competing "web framework", blbrown :D
16:40cmvkk_no matter how competitive, we all know the first truly successful framework will be the first one with a rails ripoff name.
16:40cmvkk_'clojure on clouds' or something.
16:40blbrowndanlarkin, 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:42cconstantineI'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:42blbrown"and it's not working" I cringe when I hear that in IRC
16:42cconstantinethe error I'm geting is: "ERROR: Must set system property clojure.compile.path"
16:43cconstantineblbrown: I say that because the error I'm getting isn't all that helpful ;)
16:43blbrownactually, it is pretty accurate. on the command line try -Dclojure.compile.path=classes (maybe make a classes directory)
16:44cconstantineaccurate almost never means helpful :P
16:44cconstantineI'l try that
16:44blbrowngood point
16:46cconstantinesame error
16:48cconstantinethis is not being done through ant... if that helps
16:50cconstantine,(doc compile)
16:50clojurebot"([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:54Lau_of_DK...seems in the latest version of compojure, POST parameters are taken from "name" not "id"
16:56blbrownisn't that standard HTML. where you have an input field and the input fields are identified by the 'name' attribute
16:57danlarkinblbrown: indeed
16:59cconstantineany other ideas on how to set the clojure.comp.path property?
17:01Mecis that the same as the *compile-path*?
17:01cconstantineno idea, I got an error saying it needs to be set
17:02hiredman~def clojure.lang.Compile
17:04hiredmancconstantine: how have you tried setting it?
17:05cconstantine-Dclojure.compile.path
17:05cconstantineevidently it has to be one of the first arguments to java
17:06hiredmanis there a reason you are using clojure.lang.Compile directly?
17:07cconstantineI want to make a compiled clojure program
17:07cconstantine.jar/.class whatever I can run directly
17:07hiredmanuse compile
17:07blbrowncconstantine, 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:07hiredmanjava clojure.main -e "(compile 'some.name.space)"
17:08cconstantineyeah, I got that set now I'm getting other wierdness
17:08cconstantinethat was for blbrown
17:08cconstantinehiredman: trying now
17:08cconstantinejava.io.FileNotFoundException: Could not locate prob_4__init.class or prob_4.clj on classpath: (NO_SOURCE_FILE:0)
17:09cconstantineprob_4.clj is the name of the file prob_4 ns is defined in
17:09hiredmanyou need to set your classpath of course
17:09hiredmancconstantine: do you have a good namespace declaration?
17:09hiredman~namespace
17:09clojurebotnamespaces 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:10cconstantineis "(ns prob_4)" good?
17:10hiredmanno
17:10blbrownhehe
17:10hiredmancconstantine: for a few reasons
17:10hiredmanone of which clojurebot just told you
17:11blbrownthe standard for java packages is normally '<com/org>.<company name>.<project>.WHATEVER'
17:11hiredmanthe other reason is something that may not be a reason
17:11cmvkk_as an aside, that format doesn't make sense from a free software perspective does it?
17:12hiredmandashes in namespaces are mapped to underscores in filenames
17:12blbrowncmvkk_, not necessarily, but yea, I guess you could leave off the company name
17:12hiredmannot sure about underscores in namespaces
17:12hiredmanI've been using hiredman.*
17:13cmvkk_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:13blbrowni just hate naming files/directories with minus '-'
17:13cmvkk_i think for clojure, project.file is a good enough format.
17:13hiredmancmvkk_: one of the original ideas of java was the jvm could go out and find the classes it was looking for
17:14blbrownmuahahhaa
17:14hiredmanso package names where basically urls
17:14hiredmanwere
17:14cmvkk_yeah, i get that. that still seems like a bad idea, though...
17:14hiredmanneedless to say, this never took off
17:14cmvkk_because now, if your website name changes, all the code has to change too!!
17:15cmvkk_and all the code for everything that uses that library, etc.
17:15hiredmancmvkk_: luckily sun has hung onto their websites
17:15blbrownyea, 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:16hiredmanhttp://www.faqs.org/rfcs/rfc4151.html
17:17Lau_of_DKAnybody here been able to work out, how compojures (decorate-with) works ?
17:17cconstantineright, 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:17blbrownhehe
17:18hiredman*shrug*
17:19cmvkk_this is why namespace-dependent stuff annoys me in general... it doesn't make sense for throwaway stuff.
17:19hiredmanin clojure you compile namespaces not files
17:19cmvkk_there should be a (compile-file "foo.clj") that just works for foo.clj.
17:20cmvkk_i guess that wouldn't work with java, though, since the compiled stuff has to have a namespace of some sort
17:20hiredmanwhy compile things that are "throwaway"?
17:21brennanc_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:21cconstantinehow do I see what the current namespace is from within clojure?
17:21hiredman*ns*
17:21hiredman,(doc *ns*)
17:21clojurebot"; A clojure.lang.Namespace object representing the current namespace."
17:21cmvkk_,*ns*
17:21clojurebot#<Namespace sandbox>
17:22cconstantineerm, classpath
17:22hiredmanSystem/getProperty
17:22blbrowncmvkk_, 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:23blbrownsacrelig!
17:23cmvkk_blbrown, I agree. If i'm writing a file or whatever, I make up something dumb at least
17:23cmvkk_although this usually amounts to (ns cmvkk.blah)
17:23slashus2You have to do a gen-class before you can compile something?
17:24hiredmannope
17:24hiredmangen-class, if you use it, happens when you run compile, otherwise it s nop
17:25slashus2You are talking about compiling into a .class file?
17:25hiredmanexplinations get a little tricky here
17:26hiredmanbecause clojure is always compiled to jvm byte code which is what a .class file is
17:26slashus2yeah
17:26Mecanyone know the O of (set )
17:26hiredmanbut that byte code is not written to disk unless you use compile
17:27hiredman~def set
17:27hiredman,(class (set '(a)))
17:27clojurebotclojure.lang.PersistentHashSet
17:27hiredmanit just has to compare the hashcode I guess
17:28hiredmanbut it has to walk what you pass it, so maybe n?
17:29hiredmangen-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:29Mecwell im running out of heapspace so guess it doesnt matter how long it will take
17:30cmvkk_you can't 'run' a class generated without genclass, right?
17:30cmvkk_i.e. java foo__1234.class or whatever
17:30hiredmancmvkk_: I am usre if you really tried you could
17:30hiredmansure
17:30cmvkk_well it would have to have a main method right? and those Fn classes don't do they?
17:31hiredmanoh, if you mean cannot run by calling java on the command line, sure
17:31Mecanyone familiar with clojurebox know how to change the size of the heap space?
17:32hiredmanbut they are java classes, so I am sure from java you could instantiate them
17:32cmvkk_right.
17:33kotarakcmvkk_: you can specify generation of a main method via (gen-class ... :main true ...) resp. (gen-class ... :main false ...)
17:39kotarakcmvkk_: sorry misread your message...
17:44slashus2I can't even get the gen-class Example to work.
17:47slashus2java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.examples.hello$_main__4 (NO_SOURCE_FILE:0)
17:51slashus2This is highly frustrating.
17:58stuhoodslashus2: you have everything on the classpath that you need, right? the output directory for your classfiles is easy to miss
17:59slashus2It worked after I added the classes directory.
17:59slashus2thanks
17:59slashus2Sometimes the classpath stuff is a pain.
18:01blbrown,(doc comment)
18:01clojurebot"([& body]); Ignores body, yields nil"
18:02blbrowncan you load the comment body through code. say if you want to print the file comment
18:16stuhood~defn print-doc
18:16clojurebotIt's greek to me.
18:16stuhood~def print-doc
18:16stuhood,(:doc min)
18:16clojurebotnil
18:17hjlee,(doc min)
18:17clojurebot"([x] [x y] [x y & more]); Returns the least of the nums."
18:18stuhoodyea... i'm trying to answer blbrown's question: that prints the doc, so i'm trying to get it as a string
18:18stuhood,(:doc (var min))
18:18clojurebotnil
18:19stuhood,(:doc (var ^min))
18:19clojurebotjava.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol
18:20stuhood,(:doc ^(var min))
18:20clojurebot"Returns the least of the nums."
18:20stuhoodsigh
18:22blbrownif I put (comment \n ;lksjdkflskdjfskl \n ) at the top of a file, I guess I can't get that comment
18:31stuhoodblbrown: the reader would be able to get it, but it would throw it away immediately
18:34stuhoodblbrown: and it doesn't look like you can attach metadata to the namespace
18:36hiredman,(class *ns*)
18:36clojurebotclojure.lang.Namespace
18:36stuhood,(with-meta *ns* {:comment "Hello World"})
18:36clojurebotjava.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.IObj
18:37hiredman,(map #(.getName %) (.getMethods (class *ns*)))
18:37clojurebot("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:37stuhoodhmm
18:37hiredman,(ancestors (class *ns*))
18:37clojurebot#{clojure.lang.IMeta java.lang.Object clojure.lang.AReference clojure.lang.IReference}
18:37stuhoodso it contains mutable metadata?
18:37hiredman,(doc alter-meta)
18:37clojurebotjava.lang.Exception: Unable to resolve var: alter-meta in this context
18:37hiredman,(doc vary-meta)
18:37clojurebot"([obj f & args]); Returns an object of the same type and value as obj, with (apply f (meta obj) args) as its metadata."
18:38hiredman,(vary-meta *ns* assoc :a 1)
18:38clojurebotjava.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.IObj
18:38hiredmanhmmm
18:38slashus2,(doc alter-meta!)
18:38clojurebot"([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:38hiredmanah!
18:38stuhoodsweeet
18:38hiredman,(alter-meta! *ns* assoc :a 1)
18:38clojurebot{:a 1}
18:38hiredman,(meta *ns*)
18:38clojurebot{:a 1}
18:39slashus2oh dear..
18:39stuhoodhiredman: that probably wiped out whatever metadata was already attached to the ns
18:39hiredman,(alter-meta! *ns* assoc :killroy-was-here true)
18:39clojurebot{:killroy-was-here true, :a 1}
18:39hiredmannah
18:39stuhoodhiredman: if it had any
18:39slashus2It didn't have anything.
18:39hiredman(apply assoc (meta *ns*) :a 1) would not wipe out anything in the metadata map
18:40stuhoodahh, indeed... my bad
18:40slashus2(meta *ns*) is nil
18:40stuhoodblbrown: 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:42hiredmanstuhood: he seems to wnat a literal comment
18:42hiredmannot a docstring
18:43stuhoodwell, 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:44hiredman~def comment
18:45kotarakcomment is actually a macro.
18:45slashus2simple macro
18:46stuhoodyea... so in order to get the contents, he'd have to write another macro that nullified the effect of (comment)
18:47stuhoodit'd be interesting if (comment) attached your comment to the metadata of whatever var/namespace it was in
18:49hiredman(defmacro comment [&body] (alter-meta! *ns* update-in [:comments] assoc (str body)) nil)
18:49hiredman,(doc update-in)
18:49clojurebot"([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:49hiredmanoh
18:49hiredmanwiat
18:49hiredman(defmacro comment [&body] (alter-meta! *ns* update-in [:comments] conj (str body)) nil)
18:50hiredman,(update-in {} [:comments] conj :a)
18:50clojurebot{:comments (:a)}
18:52stuhoodheh, ask and ye shall receive
18:53kotarakIsn't the docstring of the namespace sufficient?
18:54stuhoodkotarak: yea, should be: changing (comment) was just a fun whatif
19:11slashus2Looks like javamail became open source March 2. That is neat.
19:22stuhoodslashus2: 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:28stuhoodslashus2: are you using the IMAP portion of that api?
19:28clojurebotthe website api refers to last release
19:28slashus2nope
19:28stuhoodgotcha
19:31hiredmanclojurebot: botsnack
19:31clojurebotthanks; that was delicious. (nom nom nom)
19:32AWizzArdhiredman: why do you feed it?
19:33hiredmanit's a computer program, feeding it would be silly
19:33hiredmanI reward it
23:15slashus2,(.pow (bigint 10) (.pow (bigint 10) 100))
23:16clojurebot1
23:17slashus2not quite a googolplex
23:17cmvkkis the problem that the 100 at the end has to be a bigint maybe
23:17slashus2Do the last part by itself
23:17slashus2It comes out to be a googol
23:18gnuvince_,(.pow (bigint 10) 100)
23:18clojurebot10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
23:19gnuvince_,(.pow (bigint 10) (bigint 100))
23:19clojurebot10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
23:19cmvkk,(.pow (bigint 10) (.pow (bigint 10) (bigint 100)))
23:19clojurebot1
23:19slashus2:-(
23:19cmvkk,(.pow (bigint 10) (.pow (bigint 10) (bigint 10)))
23:19cmvkkthat should just time out.
23:19clojurebotExecution Timed Out
23:20cmvkkso i wonder why it doesn't work after a while
23:20slashus2It should time out on the other one as well.
23:20cmvkkyeah.
23:20slashus2Not return 1...
23:20slashus2I will try to confirm that this is the behavior in java when I get time.
23:22cmvkkI see no reason why it wouldn't be the case
23:22slashus2I was watching cosmos and Carl Sagan mentioned a googolplex, I wanted to see what a googol looked like.
23:23cmvkkof course even with unlimited time, you couldn't write out a googolplex with a computer
23:23cmvkkor rather, you couldn't define one as a bigint
23:23slashus2oh I see.
23:24slashus2BigInt's power function only takes an integer
23:24cmvkkbecause you'd need at least a googol bits to do it, and more like 2.5*googol or whatever
23:24cmvkkoh, it coerces to int?
23:24slashus2I think so
23:25slashus2 �BigInteger pow(int�exponent)
23:25slashus2It is strange that it doesn't take another BigInteger.
23:25cmvkkwell it makes sense to a degree.
23:26cmvkkon a 32-bit system, you won't ever have enough memory to define a number raised to a power above max_int.
23:26slashus2That you will probably never use a pow greater than max_int
23:27cmvkkbecause 2^max_int is exactly the maximum amount of memory a 32-bit system can have.
23:27slashus2On a 64-bit system max_int will be the max amount of memory a 64-bit system can have :-)
23:28cmvkkor the highest number your memory can represent, i mean.
23:28slashus2right
23:28cmvkkwell based on java numbers, for a 64-bit system it would be max_long.
23:28cmvkki think java ints are 32 bits and longs are 64 bits no matter what the chip archetecture is
23:36WizardofWestmarccmvkk: I'd hope so else you lose some of the consistance java is supposed to give across hardware...
23:53slashus2Maybe when a majority of systems are 64-bit, they will switch it over to use long?
23:53WizardofWestmarcthat 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:54slashus2I mean the pow function in BigInteger
23:54slashus2Not the whole system
23:55WizardofWestmarcah
23:55WizardofWestmarcyeah big int I'd hope they'd change
23:56WizardofWestmarc'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:56WizardofWestmarcas I doubt anyone relies on big int erroring <_<