#clojure logs

2009-02-04

00:06cooldude127knapr: well, you can't even even change a
00:07hiredmancooldude127: well, a could be a mutable java something or other
00:07cooldude127oh, true
00:07hiredman:P
00:07cooldude127that would change x tho, wouldn't it?
00:08hiredmanno, x is a ref(erence)
00:08hiredmanx -> a
00:08cooldude127well, it would change the value of @x then
00:08hiredman@x is a
00:08cooldude127exactly
00:09hiredmanbut up is down
00:09hiredman@x is not x it is a, so mutating a somehow would not change x
00:10cooldude127true
02:44yangsxsorry, but what's the name for progn in Clojure?
02:49yangsxok, it's do.
03:02gordongeckodo you guys think hacking Lisp is more fun than programming other languages? I feel so now, Lisp has something hackish and something elegant over it at the same time. it feels very unbeauracratic, i can do what i want. i really like python but it doesnt feel as fun anymore. but maybe it is just me learning smething new when using Lisp.
03:04jdz_gordongecko: do you expect anything but a positive answer to the question?
03:04jdz_(note the channel)
03:13adakkak_can someone tell me what defmulti is closest to in the imperative world and whether there is something similar in lisp?
03:14jdzadakkak_: it's kind of similar to defgeneric/defmethod of Common Lisp
03:14jdzadakkak_: with a bit of hand waving
03:15adakkak_is it similar to haskell or erlang style pattern recognition (I should not have asked how similar it is to lisp, since I do not know lisp :)
03:18jdzi think it is similar to pattern mathing in those languages, but not in the sense of destructuring, but fixed argument value checking
03:19adakkak_what do you mean by destructuring?
03:20jdzlook for "destructuring" in http://clojure.org/special_forms
03:21gordongeckohow do i flatten?
03:22jdzgordongecko: type "/leave", that should do it.
03:22gordongeckoconcat and reduce conj, neither works
03:24felzixI'm having classpath problems. I read that I shouldn't use add-classpath. What is the preferred method?
03:24adakkak_,(apply concat '(1,2,3,4,'(1,2,3)))
03:24clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer
03:25jdzfelzix: provide classpath when starting clojure?
03:25felzixI'm doing so through slime.
03:26jdzfelzix: you're using swank-clojure-extra-classpaths, right?
03:26adakkak_,(apply concat (list (list 1 2 3) (list 1 2 3) (list 1 2 3)))
03:26clojurebot(1 2 3 1 2 3 1 2 3)
03:26felzixyes
03:26felzixdoes that work for .clj's?
03:26jdzwell yes
03:27felzixok, thanks. something else is wrong, then, so I will investigate after sleep
03:27jdzfelzix: you don't have to add the .clj's to classpath, only the directories they are in
03:27felzixoh
03:28jdzand the namespace resolution also works with hierarchical directory structure (same as Java)
03:28felzixso should I match namespace and file name?
03:29jdzhttp://clojure.org/libs
03:30felzixah, thanks
03:30felzixI think that's the problem
03:40gordongeckowhy are hashmaps O(log32) and not O(1)?
03:49jdzgordongecko: you fail at trolling.
03:50gordongeckoim not trolling im gordon gecko
03:50gordongeckoim askign a question how is that trolling?
03:50gordongeckois it because hashmaps are functional inc lojrue and not mutable?
03:51jdzgordongecko: where have you seen O(1) hashmaps? O(1) inserts or lookups?
03:52jdzgordongecko: and the answer is simple anyway: it's that way (i don't really know if it is) because it is implemented that way.
03:52gordongeckoyes insert and lookups, i thought that was standard fo rhashmaps?
03:53jdzgordongecko: was that an answer to a question?
03:53gordongeckoyes but then why is it implemented that way would be the natural follow-up question?
03:54gordongeckowhat?
03:54jdzhashtables have never been constant time insert/lookup
03:56gordongeckono not amortized constand but most of the time constant
03:56gordongeckoos log32 worst case scarnio then?
04:00Lau_of_DKJava gurus, why does this fail (.exec (Runtime/getRuntime) (into-array "ls") nil (java.io.File. "/home/lau/")) ?
04:01gordongeckowhats wrong with this syntax: (throw (Exception. "Matrices not of the same size.")) ?
04:02jdzLau_of_DK: do you really mean (into-array "ls")?
04:02Lau_of_DKnothing gordongecko
04:02Lau_of_DKjdz: Yes
04:03Lau_of_DKwait
04:03Lau_of_DKjdz: No I dont
04:03Lau_of_DKthanks
04:08gordongeckowhat is the right exception to throw when someone triees to multiply to matrices that are not valid to multiply with each other?
04:08gordongeckoillegalargumentexception?
04:10Lau_of_DKI guess thats correct, though not very descriptive
04:10Lau_of_DKAnyone here very comfortable with Javas Process class ?
04:13jdzthe documentation looks sane
04:13hiredmanLau_of_DK: into-array takes some kind of seq
04:13hiredman(into-array "ls")
04:13hiredman,(into-array "ls")
04:13clojurebot#<Character[] [Ljava.lang.Character;@1846aed>
04:14hiredman,(into-array ["ls"])
04:14clojurebot#<String[] [Ljava.lang.String;@18b0b4a>
04:14Lau_of_DKIt sure does, but when a process takes longer than 5 secs to complet, it seems that the process just hangs there, and I dont know how to debug it
04:14Lau_of_DKhiredman: We've left the into-array discussion, it was just a mistake
04:14hiredmanso you have
04:14jdzLau_of_DK: does the process produce output or wait for input?
04:15Lau_of_DKhiredman: try ERC
04:15hiredmanor maybe just ignore joins/parts
04:15Lau_of_DKjdc it just fires "git log --numstat" in a very big repo
04:15Lau_of_DKSo its supposed to run for 10 - 15 secs, and then I can pull the Inputstream
04:16jdzLau_of_DK: you should start reading the strem earlier because i think the process blocks on standard output (buffer being full)
04:16Lau_of_DKoh you may be right
04:18Lau_of_DK(let [ pr (.exec (Runtime/getRuntime)
04:18Lau_of_DK "git log --numstat"
04:18Lau_of_DK nil
04:18Lau_of_DK (java.io.File. "/home/lau/coding/bigrepo/")) ]
04:18Lau_of_DK (apply str
04:18Lau_of_DK (pmap char (stream-seq (.getInputStream pr)))))
04:18Lau_of_DK
04:18Lau_of_DKShouldnt this be as fast as I can go ?
04:19jdzdon't you want lines from the output?
04:20jdzanyway reading character by character is usually not a very good idea
04:20jdzand then, why do you use pmap?
04:20jdzi'd expect the resulting string to be a permutation of what was output by the process actually
04:21Lau_of_DKHmm :)
04:21Lau_of_DKIt worked, BUT it shouldnt have printed the output
04:21Lau_of_DK:)
04:21Lau_of_DKThanks for the tip jdz
04:21jdzdid it print the output, or just return it?
04:22Lau_of_DKIt returned it, but its close to 65k lines, so I should just have (count x) it
04:37Lau_of_DKdk.bestinclass.gitdoc> (count (get-log))
04:37Lau_of_DK2698927
04:37Lau_of_DK
04:37Lau_of_DKThats quite a few lines
04:37jdzis it lines or characters?
04:42Lau_of_DKits chars :)
04:57Lau_of_DK(doc apply)
04:57clojurebotApplies fn f to the argument list formed by prepending args to argseq.; arglists ([f args* argseq])
04:57Lau_of_DKLazy?
05:01liwpare you asking if apply is lazy?
05:02cgrandif the seq passed to apply is lazy then it's the applied function that will drives evaluation of the seq
05:04jdzi don't agree
05:05jdzapply must fully realize the sequence before passing it to the function
05:05hiredman nope
05:05jdzi might be wrong, ofc
05:05hiredmanapply is lazy
05:05hiredmanthis comes up every other day
05:05jdz(off to reading documentation)
05:06hiredman,(let [f (fn [& x] (first x))] (apply f (interate inc 0)))
05:06clojurebotjava.lang.Exception: Unable to resolve symbol: interate in this context
05:06hiredman,(let [f (fn [& x] (first x))] (apply f (iterate inc 0)))
05:06clojurebot0
05:07hiredman^- apply to an infinite seq
05:07hiredman*tadda*
05:07cgrandit's a good candidate for FAS
05:07cgrandFAQ
05:08Lau_of_DKOk - So apply is lazy, disregarding the supplied function ?
05:08jdzhiredman: (apply #(+ %1 %2) (iterate inc 0))
05:08hiredmanjdz: what about it?
05:09jdzhiredman: it's a counterexapmle to yours
05:09hiredman,(apply #(+ %1 %2) (iterate inc 0)
05:09clojurebotEval-in-box threw an exception:EOF while reading
05:09hiredman,(apply #(+ %1 %2) (iterate inc 0))
05:09jdzgz, you blew up clojurebot
05:09clojurebotExecution Timed Out
05:09hiredmansure I did
05:10hiredmananyway, if that wasn't an infinite seq, that would throw an exception
05:11hiredman,(apply #(+ %1 %2) [1 2 3])
05:11clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1445$fn
05:11jdzhiredman: yes, but since it is infinite, apply tries to realize it
05:11jdzand blows up
05:11hiredmanyeah, but that is the function's fault
05:12jdzhow?
05:13hiredmanif the function behaved like the one I used then apply would be lazy
05:13cgrandrealizing the whole seq is the default behaviour for non var-arg functions only
05:14jdzwell, only a small fraction of the functions behave like your function
05:14cgrand,(apply (fn [x y & etc] (+ x y)) (iterate inc 0))
05:14clojurebot1
05:14hiredman"the functions"
05:14hiredmanI submit that there are an infinite amount of functions
05:15hiredmanso a small fraction is, infact, a lot
05:15jdzyou are not suggesting making all functions taking variable number of arguments, do you?
05:16jdzand ignoring extra arguments
05:16Lau_of_DKhehe
05:16jdznot only ignoring, but dropping them into oblivion
05:16Lau_of_DKI really appreciate you guys duking it out - I'm really happy now, I did one better than contrib, again :)
05:17jdzwe're just having a friendly discussion here
05:18cgrandit's a bug on the clojure part to not throw an exception when you pass an infinite seq of args to a bounded-arity function
05:18jdzcgrand: how can you tell if a sequence is infinite?
05:19jdzor finite, for that matter
05:19cgrandyou can't but you can tell if a function is vararg or not
05:19jdzcgrand: apply already does that
05:19jdzas far as can be deduced from the effects
05:20cgrandjdz: not quite
05:20cgrandwhen you call apply on a non-vargarg function
05:21cgrandclojure tries to realize the twenty first items
05:23liwpso it seems that apply realizes all fun non-rest fun args and then passes the rest of the args list to the rest arg
05:23cgrandif it get less than twenty items then everything is fine and you get an error if you passed the wrong number of args
05:23liwpi.e. apply is not lazy
05:24liwpit just happens to not both to go through the remaining arg list after it has realized the non-rest args for the fun
05:24liwps/both/bother/
05:24cgrandif it gets 20 items, it realizes the whole seq and pass it to the function (remember that we are in the non-vararg case, the programmer is not intended to pass an infinite seq)
05:24liwpthat's right
05:24liwpwhich also implies that it's not lazy
05:25Lau_of_DKI can tell you have I've just made a parser, which uses apply #func 2 times during the parsing over 2.5 million characters, if both applys realized the whole stream, it would take forever, but it doesnt
05:26liwpsurely you do not have a fn with 2.5M args?
05:26Lau_of_DKIts a stream
05:26liwpi.e. some of the fn args are either seqs or a rest arg
05:26liwphow do you call apply? can you show the code?
05:27Lau_of_DK (pmap #(apply concat %)
05:27Lau_of_DK (partition 2
05:27Lau_of_DK (partition-by #(re-seq #"^commit .*" %)
05:27Lau_of_DK (line-seq (BufferedReader.
05:27Lau_of_DK (StringReader.
05:27Lau_of_DK (apply str
05:27Lau_of_DK (pmap char (stream-seq
05:27Lau_of_DK (.getInputStream pr))))))))))))
05:27Lau_of_DK
05:27jdzapplying a function and calling it are different things
05:27jdzwell, kinda
05:27cgrandliwp: yes it's lazyness for the rest arg (other args have to be computed, there's no thunks in Clojure)
05:27Lau_of_DKNo comprende senior?
05:28liwpcgrand: AFAICT we're in agreement here...
05:28Lau_of_DKisnt that the definition of lazy? That the car is computed and the cdr (rest) is not ?
05:28cgrandliwp: I agree :-)
05:28liwp;)
05:29Lau_of_DKdk.bestinclass.gitdoc> (time (def all-commits (pmap build-struct (get-log))))
05:29Lau_of_DK"Elapsed time: 67989.686049 msecs"
05:29Lau_of_DK
05:29Lau_of_DKThis is a bit much though
05:29Lau_of_DKFor 2.6M chars, 1860 commits.
05:30cgrandLau_of_DK: why are you doing (apply str (pmap char... ?
05:30achim_pLau_of_DK: are you sure you need pmap?
05:30achim_p:)
05:30jdzLau_of_DK: how about (... (line-seq (new BufferedReader (.getInputStream pr)))?
05:30Lau_of_DKachim_p: It slows down alot without pmap
05:32cgrandLau_of_DK: pmap does not guarantee the order of the result and your function (char) is inexpensive
05:32Lau_of_DKjdz, then it breaks
05:32Lau_of_DKk
05:33Lau_of_DKjdz: But at the time of breaking, I actually imagine apply str has realized the whole seq...
05:33Lau_of_DKcgrand: pmap => map gets it to 37 secs, instead of 67..... suprising to me
05:34ChousukeI don't think str is lazy :/
05:34Lau_of_DKachim_p: I appologize :)
05:34Lau_of_DKChousuke: I think youre right
05:35cgrandpmap incurs a parallelization overhead which for such a simple function as 'char isn't worth it
05:36Lau_of_DKok, I thought I had to consider both the function and the amount of data, and since the amount is unpredictable, so I opted for pmap
05:37achim_pLau_of_DK: no need for that :)
05:39cgrandLau_of_DK: can you paste the code somewhere?
05:39jdz(let [pr (.exec (Runtime/getRuntime) (into-array ["ls" "-l" "-h"]))]
05:39jdz (line-seq (new java.io.BufferedReader (new java.io.InputStreamReader (.getInputStream pr)))))
05:39Lau_of_DK2 sec
05:41Lau_of_DKcgrand: Its in engine.clj : http://github.com/Lau-of-DK/gitdoc/tree/master
05:41jdzthere, no apply, no pmap, no waste
05:42Lau_of_DKcgrand: If you try to run it, to avoid the UI, just use ($set :path "/path/to/repo") and (get-log)
05:42Lau_of_DKor (pmap build-struct (get-log))
05:44Lau_of_DKjdz: look at the code on Github, yours is what I have, but it doesnt fit with my parser
05:45ChousukeLau_of_DK: If you cut'n'paste functions from contrib I think you need to identify the copyrights separately
05:45ChousukeLau_of_DK: the EPL states "Contributors may not remove or alter any copyright notices contained within the"
05:45jdzLau_of_DK: where exactly is a code like mine?
05:46Lau_of_DKChousuke: I think they're under the same license, both projects
05:46ChousukeLau_of_DK: they are, but there are numerous copyrights
05:46Lau_of_DKjdz: Where I pull the stream, I use BufReader/StrReader
05:46ChousukeLau_of_DK: and you can't remove those :/
05:46Lau_of_DKChousuke: Ok, I'll rewrite it a little, so its no longer contribs :)
05:46jdzLau_of_DK: what StrReader are you talking about?
05:46Lau_of_DKStringReader.
05:47jdzmy code does not have any StringReader
05:47ChousukeLau_of_DK: I don't think that works :P
05:47Lau_of_DKoh..
05:47Lau_of_DKChousuke: It'll work
05:47Lau_of_DKjdz: I see now
05:47lisppaste8cgrand pasted "get-log without map nor apply str" at http://paste.lisp.org/display/74861
05:47ChousukeLau_of_DK: see, it would be much easier just to use contrib as a dependency.
05:48Lau_of_DKjdz: 1 sec, youre a genious
05:49Lau_of_DKThanks cgrand, yours is similar to jdz's i see
05:49jdz(i fail to see similarity, though)
05:49Lau_of_DKYou use InputStreamReader, he uses StreamReader
05:49jdzwell, ok, i failed
05:50jdzyeah, i'm not used to all the Java stream*{reade/writer}*moreRandomStuff
05:50cgranderr StreamReader does not exist
05:51cgrandInputStreamReader is what I meant
05:52Lau_of_DKk, then to me they look the same, running at 1 sec
05:52Lau_of_DKthats an improvement of 66 secs... thats pretty wild
05:53Lau_of_DKHow do I reach that conclusion myself the next time?
05:53jdzLau_of_DK: try not to overengineer
05:53jdzi'm still not sure that function does what it should
05:54Lau_of_DKjdz: I really dont - If picture the solution, and write it up, then I usually hit 45 type-casting errors, and I try to accomodate = just to get it running
05:54jdzbut that maybe because i have not yet used partition
05:54Lau_of_DKjdz: It works perfectly
05:55jdzLau_of_DK: that approach of yours is wrong. if something does not work you first explain to yourself why it does not, then you should be able to fix it. if after fixing it it still fails, return to step one.
05:55Lau_of_DKThat fits pretty well with something cgrand told me a while ago... its back to the basics I believe :)
05:55jdzrandomly poking code until it seems to do what you want is what Perl coders do\
05:56Lau_of_DKthat was cruel jdz, just plain cruel
05:56ChousukeLau_of_DK: you might also try breaking the function into smaller pieces
05:56jdzwell, you don't want to associate yourself with Perl programmers, now do you? :)
05:56Chousukefor example, returning the line-seq should probably be separated from chopping it into commits.
05:57Lau_of_DKtrue, it needs refactoring
05:57ChousukeThough I take that to the extreme sometimes :P
05:58ChousukeI write 5 one-liner functions just so I can make the final function read easily and be small as well :P
05:59ChousukeI just find it easier to follow if each sub-operation has its own name that specifies what the sub-operation is, instead of just code that does it.
06:00Lau_of_DKJust remember, that when I read your code, I have to go look up all of your smaller function to understand to final cute function...
06:00Lau_of_DKDoesnt always work well in teams
06:00Chousukewell, that depends on how well I've named them :)
06:01Chousukein functional programs you don't need to look them up if they're named well enough *and* you can be reasonably convinced that they work correctly.
06:01Lau_of_DKYes I do, otherwise I'll violate cgrands principle, that I should understand every I do
06:01Lau_of_DKAnd I dare not do that
06:02jdzif you can't think of a name for a function you want to write then the function is wrong (and doomed to failure anyway)
06:02jdz(most of the time)
06:02Chousukeyou wouldn't really understand anything useful by looking at how the functions are implemented.
06:03Chousukeif the naming is not a failure, your conclusion would be that it does what its name says :)
06:03jdzLau_of_DK: also, the name of the function discussed here should be something like "get-commits"
06:04jdzbecause otherwise it contradicts with the function documentation
06:07gordongeckodo you unittest or prove?
06:08jdzgordongecko: do you prove your unittests?
06:08gordongeckodo you test your proofs?
06:09gordongeckoi always found the idea of unittests a bit insane.
06:09gordongeckoand stupid
06:09jdzwhy?
06:10jdz(i don't)
06:10gordongeckobut i dont have the mathskills to prove all my code yet
06:10knaprand youd end up doing loads of work it turns out you dont have to
06:12jdzknapr: and then after 2 years of development you wish you had written those tests but can't afford to start doing it because all your code is a big pile of spaghetti
06:12Lau_of_DKjdz: Why bring Ruby into this?
06:13jdzhuh, where?
06:13Lau_of_DKyou said spagehetti code.. come on, keep up
06:13jdzi mean, it wasn't be :)
06:13jdz*me even
06:13jdzspaghetti code is language independent!
06:14Lau_of_DKok, we'll cancel the jokes for today :)
06:14p_ljdz: And if written in certain way, can still be proven correct with little amount of testing :P
06:16jdzp_l: i thought that spaghetti code is a style of writing code in certain way. did not know there are still intricate ways in what the spaghetti code differs...
06:17p_ljdz: when most of it can be mathematically proven... why not? There's always "spaghetti on crack sprinkled with crackpot fiction in comments" style
06:17jdzoh, right. forgot about spaghetti code written in Haskell.
06:20AWizzArdWell, it is basically nonsense about this provability of code. Noone is sitting down, proving that his 20k LOC are correct.
06:20AWizzArdFor type safety - sure, a lot can be done there.
06:21AWizzArdBut if the program is actually *doing* what we want is very different.
06:21jdzany haskeller can tell you that if his program compiles it is correct
06:21AWizzArd;-)
06:22AWizzArdwell, by that logic it is also true for any other program in any language.
06:22AWizzArdWhen a Clojure program compiles, it is also correct.
06:22jdzhence all ruby programs are incorrect because they don't compile! yay, proven!
06:23AWizzArdWhat did Morpheus say to Neo? "Welcome in the real world."
06:23p_llol
06:28p_las for "program in <lang. with very strong typesystem> is proven correct when it compiles"... it reminds of a joke about ML, where it was "It's proven bugfree when it compiles, however you never get rid of type errors so your program never compiles"
06:34metaperlCould someone please help me get slime and clojure working ... here is my problem - http://groups.google.com/group/clojure/browse_thread/thread/39ff69778f8ac93a
06:39Lau_of_DKmetaperl: How comfortable are you with emacs?
06:40metaperlLau_of_DK: I have used it since 1992
06:41Lau_of_DKmetaperl: Then you'll want this: http://github.com/technomancy/clojure-mode/tree/installer
06:41Lau_of_DKThat'll try to download the latest clojure/contrib/clojure-mode/slime and configure them/suggest how to configure them
06:47metaperlLau_of_DK: are you being serious? That is just a single .el file
06:47gordongeckoif doing (def a (ref m)), does changing one of a or m chnage the other?
06:48Lau_of_DKmetaperl: Yes I am, put the file in your load-path, require it, and M-x clojure-install
06:48metaperloh
06:48Lau_of_DKgordongecko: @a will change if you change m
06:48metaperlwow, the file itself says none of that
06:49Lau_of_DKmetaperl: Its a work in progress, the author camps in here, look at the very bottom for the definitions
06:50Lau_of_DKuser> (def m 5)
06:50Lau_of_DKuser> (def a (ref m))
06:50Lau_of_DKuser> (def m 10)
06:50Lau_of_DKuser> @a
06:50Lau_of_DK5
06:50Lau_of_DK
06:50AWizzArd@a is a reader macro for (deref a)
06:51metaperlLau_of_DK: the clojure website points you to this - http://github.com/jochu/clojure-mode/tree/master
06:57metaperlthis is freakin weird. everytime I try to get technomancy's version, I pull down jochu's version instead
07:00Lau_of_DKLook at .git/config - It probably still point to Jochu
07:00lisppaste8gekko pasted "gauss jordan elimination" at http://paste.lisp.org/display/74864
07:00gordongeckowhy isnt the ref being changed?
07:00gordongeckowhy isnt the ref being changed? ^^
07:01ayrnieuthe second (def m 10) does not change the m of the first (def m 5); m's value is already irrelevant by the second def of m. (def a (ref m)) is simply (def a (ref 5)).
07:01Lau_of_DK(doc ref-set)
07:01clojurebotMust be called in a transaction. Sets the value of ref. Returns val.; arglists ([ref val])
07:14gordongeckowas that for me?
07:14gordongeckoi saw i had some errors (and somehow they were never acknowledged, makes me msis haskella little)
07:14gordongeckobut it still doesnt work
07:14ayrnieuask a question, then.
07:16gordongeckowell, it seems nothing happens to the refs, and why sint stuff printed out?
07:17ayrnieuOK, I'll get right on using my psychic powers to see the program you're having trouble with, what you want to do, the refs you mean, the stuff you want printed, etc.
07:18cgrandgordongecko: for is not a loop, use doseq instead. But really there is too many mutations, you need to understand how tio turn imperative for loops into reduces
07:19gordongeckoit was psoted above...
07:20gordongeckohttp://paste.lisp.org/display/74864
07:21lisppaste8gekko annotated #74864 with "untitled" at http://paste.lisp.org/display/74864#1
07:21ayrnieufine. Starting the top: (dosync alter maxrow (fn [] y)) should be (dosync (alter maxrow (fn [_] y))) . Or you can use set-ref instead of that fn
07:21gordongeckoyeha i changed that, see annotation
07:22ayrnieuno, you changed one part of it.
07:22gordongeckowhat does _ mean?
07:23ayrnieu(fn [_] y) is equivalpent to (fn [a] y). It's just a throway binding.
07:23ayrnieu,((fn [_ x _ _] x) 1 2 3 4)
07:23clojurebot2
07:24rhickeygordongecko: If you really want to learn Clojure and functional programming, I'd advise you stay away from refs/vars/atoms/agents/set! at first
07:24ayrnieuthe function your passing should take the present value of the ref as an argument.
07:24ayrnieuugh. you're.
07:28lisppaste8metaperl pasted "How to get technomancy's clojure mode working under win32" at http://paste.lisp.org/display/74865
07:31Lau_of_DKmetaperl: Im glad it works - that approach goes for Linux as well
07:31lisppaste8gekko annotated #74864 with "untitled" at http://paste.lisp.org/display/74864#2
07:32metaperlyes, I had to unzip the technomancy git directory...
07:32metaperlgit clone simply would keep getting jochu's stuff! it was crazy
07:32Lau_of_DKWeird
07:33cgrandrhickey: (if you had time to look at it) can I open an issue (and attach a patch) for the bug with zip/remove?
07:34rhickeycgrand: yes, thanks
07:49knaprah of cim not usign dorun
07:50knapris doseq = dorun for?
07:51rhickeyknapr: logically, yes, but doseq will be faster as it doesn't produce a lazy sequence that you don't need.
07:51knapr(dorun (for [x vlah] (do ....))) is that (doseq ...) ?
07:52ayrnieu,(doc doseq)
07:52clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
07:53gordongeckoa common idiom is (dorun (for (do /// how do i replace that?
07:53gordongeckodoseq?
07:55ayrnieu,(doseq [x (range 10)] (print x))
07:55clojurebot0123456789
07:59gordongeckohow the hell can:
07:59gordongecko(def a (ref 10))
07:59gordongecko(doseq [x [1 2 3]] (dosync (alter a (fn [y] (+ y @a)))))
07:59gordongeckouser=> @a
07:59gordongecko80
07:59gordongecko?
07:59lisppaste8gekko annotated #74864 with "untitled" at http://paste.lisp.org/display/74864#3
08:00ayrnieugordon, what is y bound to?
08:00durka42the fn you pass to alter gets @a as its parameter
08:00durka42so you double a three times
08:01durka4210 * 2^3 = 80
08:01rhickeygordongecko: stop using refs
08:01jdzand the looping variable x is not used
08:01gordongeckoim using + not *...
08:02gordongeckoi see now
08:03gordongeckorhickey: well it is pretty hard to redo some stuff into functional stuff
08:04AWizzArdjust requires some training.. after a while it will feel natural
08:04AWizzArdAnd it is difficult to *not* do it functional.
08:04AWizzArdRefs are cool for keeping state in your app. It is much easier than keeping it around in every function as a parameter.
08:04rhickeygordongecko: (reduce + 10 [1 2 3])
08:04jdzgordongecko: you will never learn to do it in functional style if you keep doing it in imperative style
08:05AWizzArdA few days ago I translated a Lisp program with 53 SETFs in it into Clojure. I did not need one ref.
08:05jdzAWizzArd: i'm pretty sure they were not needed in the original program either?
08:05AWizzArdNot *needed*, right.
08:06jdzone can program fortran in any programming language.
08:06AWizzArdBut it just makes sense to write idiomatic (vs idiotic) code in the host lang.
08:07Chousukegordongecko: you can't start looking for a functional approach by simply translating an imperative algorithm :/
08:09ChousukeI wrote a functional matrix multiplication thingy (it's probably too slow for real use because it uses vectors of vectors, but it seems to work)
08:13Chousukehttp://gist.github.com/58093 like this
08:14Chousukeit might be faster to use a similar approach, but with java arrays and some copying.
08:14rhickeyILC registration open - no per diem rate, but conference early reg pretty cheap (IMO): http://www.regonline.com/builder/site/Default.aspx?eventid=688757
08:15AWizzArdDo you plan to talk about Clojure there?
08:17rhickeyAWizzArd: I'm doing a full-day tutorial
08:17AWizzArduh *thumbs up*
08:19gordongeckoChousuke: i did normal matrix mult, though using refs to, i giot it haskell usifn rlistcomprehensiosn though
08:21Chousuketry translating that haskell into clojure
08:21AWizzArdrhickey: is nil in the new lazy filter still false?
08:22ayrnieu(if nil 1 2) still evaluates to 2
08:22rhickeyAWizzArd: you mean in the lazy branch? yes, nil is still false :)
08:22AWizzArdso would it support (filter #(re-find #"xyz") (duck-streams/read-line "myfile"))?
08:22AWizzArdah good
08:27lisppaste8gekko annotated #74864 with "fixed" at http://paste.lisp.org/display/74864#4
08:27gordongeckothere it is
08:27gordongeckounfunctional but functioning
08:28gordongeckonot sure if it gives the right results though :)
08:28rhickeyseeing code like that in Clojure makes me sad :(
08:32Chousukerefactored the matrix multiplication a bit, should be even easier to understand it now
08:35AWizzArdrhickey: you will see it more and more often, but at the same time the quality of code will also go up.
08:35AWizzArdThe newcomers to functional programming or programming in general will have their problems.
08:36Chousukethough, hm... (count m1) is not probably correct for row-width for other than square matrices :P
08:36AWizzArdBut luckily a person is a newbi only for the shortest amount of time of her programmer carreer.
08:39AWizzArdif you want to transpose a matrix you can do it in an elegant way, as Peter Norvig suggests.
08:39AWizzArdIf you have (def some-matrix '[[1 0 0 0] [1 0 0 0] [1 0 0 0]])
08:39AWizzArdand (defn matrix-transpose [matrix] (when matrix (apply map vector matrix)))
08:39AWizzArdthen you can simply (matrix-transpose some-matrix) ==> ([1 1 1] [0 0 0] [0 0 0] [0 0 0])
08:40gordongeckoi use hashmaps
08:40gordongeckogood later on for sparse ones
08:40gordongeckoand seems to simplify some things too
08:41gordongeckoinv(s.matrix([[2,3],[1,-1]])) -> array([[ 0.2, 0.6], [ 0.2, -0.4]]) in scipy, but i get: ((2 0) (0 -5/2))
08:42gordongeckohmm and the algorith i translated from gives: [[1, 0], [1, 1]]
08:42gordongeckobah!
08:42AWizzArdthen the algorithm is not translated yet
09:11cooldude127gordongecko: what method are you using for inverses?
09:12AWizzArdWhen I have a list of vectors x and want to collect from each vector of x the 1st, 2nd and 5th element, is then (map #(vector (% 1) (% 2) (% 5)) x) the best approach?
09:13cooldude127AWizzArd: seems like the simplest
09:16Chousuke,(let [vectors [[1 2 3] [4 5 6]]] (for [x vectors] (map #(get x %) [0 2])))
09:16clojurebot((1 3) (4 6))
09:16ChousukeAWizzArd: ^
09:18Chousukeor #(x %) instead of #(get x %)
09:18ayrnieu,(map (fn [[a b _ _ e & _]] (vector a b e)) [[1 2 3 4 5 6] [-1 -2 -3 -4 -5 -6]])
09:18clojurebot([1 2 5] [-1 -2 -5])
09:22AWizzArdChousuke: why you prefer it with get?
09:23Chousukethat was just the first thing that came to my mind :)
09:24AWizzArdrhickey: can we maybe also get ("012345" 2) ==> \2 ? :)
09:25ChousukeI think that's unlikely, as Strings don't implement IFn :)
09:27Chouserclojurebot should have a nice set of sample data pre-defined
09:27gordongeckouser=> (map (partial apply +) [[1 2 3] [4 5 6]]) vs user=> (map #(reduce + %) [[1 2 3] [4 5 6]])
09:27gordongeckowhy partial apply?
09:28ChousukeI wonder. :p
09:28gordongeckocooldude127: gauss-jordan elim
09:28rhickey,(map (fn [{a 0 b 1 c 4}] [a b c]) [[1 2 3 4 5 6] [-1 -2 -3 -4 -5 -6]])
09:28clojurebot([1 2 5] [-1 -2 -5])
09:28Chouser,(let [vectors [[1 2 3] [4 5 6]]] (for [x vectors] (map x [0 2])))
09:28clojurebot((1 3) (4 6))
09:28ChousukeI edited the matrix thingy not to use (partial apply +)
09:28ChousukeI also fixed some bugs...
09:30rhickeyayrnieu: associative destructuring works on vectors too
09:30rhickeyayrnieu: easier than _s when you want the 17th thing
09:31ayrnieu:-)
09:33zakwilsonI remember seeing an addon or patch for Arc that allowed user-defined behavior for any type when it appears at the head of a list. I thought it was a cool idea, though I have no idea how practical it would be to implement something like that in Clojure.
09:34rhickeyzakwilson: I'm not doing that in Clojure for perf reasons - if you want to make a callable thing you can derive from IFn, but yes, that rules out adding callability to String
09:35AWizzArdah okay, because Strings are final?
09:36rhickeyAWizzArd: even if they weren't, you get Strings from others who wouldn't know to create a ClojureString for you
09:36AWizzArdic
09:37rhickeyIt's an inherent weakness to 'just derive from my interface' design - no one outside of a captive audience will
09:37Chouserwasn't making regex's callable on the todo at some point?
09:38rhickeyChouser: it has come up - what would they do?
09:38ayrnieu,(proxy [java.util.regex.Pattern] [])
09:38clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
09:39ayrnieuOK. Or: java.lang.VerifyError: Cannot inherit from final class
09:39ChouserI've not been sure, but I think re-seq would be pretty good.
09:39rhickeyChouser: those are the 2 issues, it won't be a Pattern anymore, and what to do when called
09:40rhickeyThe process has stalled here every time :)
09:41Chouserre-seq would be a fine thing for it to do, but I'm not sure that's worth making it no longer a Pattern
09:43gordongeckowhy do you pople prefer clojure over haskell? for java interop?
09:44AWizzArdBecause it is a Lisp, dynamic, is hosted on the more practical VM and because it is easier.
09:44ChouserI started learning Clojure before Haskell because I require macros.
09:44zakwilsonFor syntactic abstraction and dynamic typing.
09:44zakwilsonOr, as AWizzArd said: because it's a Lisp.
09:44ayrnieugordon - I despise Haskell.
09:45zakwilsonI'd like to learn Haskell, actually. Still, I get the sense that its design isn't about me getting things done with as little fuss as possible.
09:46knaprthen what is it?
09:46knaprit is about getting stuff done correctly and having your program perform well on several cores
09:46zakwilsonHaskell, or Clojure?
09:48AWizzArdknapr: when we want stuff get done correctly, then we better come up with an AI system that is actually cappable of programming. Humans are so lousy at it, we will never get complex systems right without help.
09:49Chouser"correctly enough"
09:49AWizzArdright
10:32gnuvincezakwilson: I believe it's as little fuss as can be (currently) managed by a static typing system
10:37AWizzArdclojurebot: max people
10:37clojurebotmax people is 137
10:44AWizzArdslightly offtopic: can one change event handler for swing objects during runtime? For example the action event for a button.
10:46opqdonutshould be possible
10:46achim_pAWizzArd: you an dynamically add/remove listeners
10:46opqdonutthere might of course be some concurrency issues
11:00brianhAWizzArd: if you haven't seen it, you need to check this out http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html#event_dispatching
11:19Chouserdoesn't "continue" seem like a more accurate name than "restart"?
11:19Chouserthough I suppose that's in danger of sounding like a continuation
11:20brianhChouser: exactly what i was thinking
11:20Chouserwhich?
11:20brianhsounds like continuation
11:20Chouser"proceed"?
11:21danlarkin-1 for proceed
11:22Chouser"restart" is better? it sounds like something's going to be done over again, like a retry. But that's not accurate.
11:23brianhproceed sounds too much like a mutex/threading kind of thing
11:24Chouseruncatch
11:24brianhteleport
11:24danlarkincontinue sounds fine to me imo
11:24brianh:)
11:24Chouseryeah, teleport gives about the right feeling.
11:24Chouserdanlarkin: why is continue better than proceed?
11:25brianhbeam as in 'Beam me up Scotty"
11:25brianhk i'll stop now...
11:26brianhis 'transfer' already taken?
11:27danlarkinChouser: I guess just the aesthetics of the word
11:27Chouserwell, I'll proceed with continue for now. We can restart this conversation later.
11:30cooldude127are sets in clojure ordered?
11:30gnuvincesorted-sets are
11:30gnuvince,(set [1 2 3])
11:30clojurebot#{1 2 3}
11:30gnuvince,(sorted-set [1 2 3])
11:30clojurebot#{[1 2 3]}
11:30gnuvince,(sorted-set 1 2 3)
11:30clojurebot#{1 2 3}
11:30gnuvinceI guess my first example wasn't the best one
11:31opqdonut:D
11:31cooldude127eh, they probably aren't right for what i need
11:31gnuvince,(set [:a :b :c])
11:31clojurebot#{:a :b :c}
11:31cooldude127i think vectors may make more sense
11:31gnuvincedamnit
11:34Chouser,#{-2 -1 0 1 2}
11:34clojurebot#{0 1 2 -2 -1}
11:35cooldude127ahhh something messed up clojure and slime?
11:35cooldude127it says evaluation aborted at every expression
11:36cooldude127java.lang.NoClassDefFoundError: clojure/lang/StringSeq
11:37jbondesoncooldude127: are you running off of one of the branches?
11:38cooldude127jbondeson: i don't think so
11:38cooldude127i'm using clojure-install
11:38jbondesoni just did a full rebuild of everything and it works for me.
11:38boxbeatare there arrays in clojure?
11:38cooldude127boxbeat: vectors
11:38boxbeatmake-array creates a java array
11:38cooldude127or you can use java arrays
11:38boxbeathow do i index it?
11:39jbondesonnth
11:39boxbeator it is not for use in pure clojure just for java interop?
11:39cooldude127boxbeat: ,([1 2 3] 0)
11:39cooldude127,([1 2 3] 0)
11:39clojurebot1
11:39jbondesonor that shortcut
11:39cooldude127,([1 2 3] 2)
11:39clojurebot3
11:39boxbeatyes but the array
11:39cooldude127boxbeat: don't use it for pure clojure
11:39cooldude127use vectors
11:40boxbeati want to create a videoplayer
11:40boxbeatis that hard?
11:41cooldude127boxbeat: probably
11:41jbondesondepends how heavily you lean on existing java media libraries
11:41cooldude127jmf might be helpful
11:43jbondesonyou'll probably spend most of your time just with java interop and ui stuff.
11:43jbondesonvideo players are exactly a very functional problem.
11:43cooldude127jbondeson: found my problem. i had bad form in my file i had compiled
11:44jbondesonare -> aren't
11:44jbondesoncooldude127: sweet.
11:53boxbeatjbondeson: how come?
11:53boxbeatif im just doing the interface (not the decoding) then it is just heavy java interop no?
11:53boxbeatis doing the coding in Clojure a good idea(if doing it form scratch)?
11:54Chouserboxbeat: you're going to implement a video codec?
11:55jbondesonif all you're doing is the interface, then clojure isn't really your best bet. if you were implementing a new codec, then that would be more suitable to clojure (depending on the codec)
11:56Chouserjbondeson: you don't like Clojure for UIs?
11:57jbondesonhaven't done much of it, but from what i've seen you're not exactly doing much different from java
11:59Chouserbut at least you have macros to reduce repitition, unlike in Java.
11:59jbondesontrue.
12:01jbondesonsome of the cell stuff can be nicely integrated into UI as well.
12:01jbondesoni'm actually just about to put together some visualizations for my swarm code, so i guess i'll know first hand all the difficulties.
12:03jbondesonwas there ever a consensus on the form removal reader macro?
12:03boxbeati did an mp3player in clojure using swing +contrib-miglayout. while the code is prob shorter than it is in Java it felt like i was mainly wrapping java code and some things was hard to do from Clojure + I actually was missing checked exceptions.
12:04boxbeatI can call clojure code form Java if i do gen-class, right?
12:04boxbeatso codec in clojure, UI in Java...
12:04jbondesonyes
12:04jbondesonyou could
12:04djpowellor you can call clojure code from java dynamically, in a similar way to clojure.lang.Script does
12:08AWizzArdIn Java it is: new javax.swing.filechooser.FileNameExtensionFilter("JPEG file", "jpg", "jpeg"); Now I try in Clojure: (javax.swing.filechooser.FileNameExtensionFilter. "JPEG file" "jpg" "jpeg") which does not work. How can I make it work?
12:09djpowellit should work - what is the error?
12:11AWizzArdOne can paste it into the repl.. it says it doesn't find a right constructor.
12:11djpowellah
12:11AWizzArdIn the javadocs Sun lists the method header as FileNameExtensionFilter(String description, String... extensions)
12:11djpowelli see, that method has varargs
12:11AWizzArdthe ... looks strange
12:11AWizzArdyes
12:11AWizzArdI guess :-)
12:11djpowellvarargs in Java are syntactic sugar for String[] extensions
12:12djpowellso you need to make an array for the last parameter
12:12Chouser(javax.swing.filechooser.FileNameExtensionFilter. "JPEG file" (into-array ["jpg" "jpeg"]))
12:15jbondesonthat's a bit ugly
12:16waltersseems like a clojure bug
12:16AWizzArdworks though
12:16AWizzArdthx
12:18jbondesonyou gotta love the ability to get a 25% increase by adding a 'p' in one place...
12:18cooldude127jbondeson: what?
12:20jbondesonjust changed a map to a pmap in one of my functions to parallelize it
12:21jbondesoncut the runtime by 25%
12:21AWizzArdnice
12:21jbondesonmy swarms are swarmier than ever
12:21AWizzArdwhat are you doing?
12:21AWizzArdsimulation?
12:21AWizzArdGA? GP?
12:22jbondesonparticle swarms
12:22opqdonutswarm optimization?
12:22djpowelli was wondering if wrapping a seque around some resultset-seq derived sequence might smooth out the doing cpu vs waiting on blocking io from the database, but i guess jdbc drivers do a load of buffering anyway
12:22jbondesonopqdonut: yes, one of the varieties.
12:23opqdonutsweet, what's the problem?
12:23jbondesonright now i'm just running on some test problems to make sure my port works.
12:24jbondesonI've used it for neural network training before, much faster than many BP methods
12:24opqdonutinteresting, I guess I should try that
12:25jbondesoni did the NN+Swarm in C a couple years ago, going to try to put together a functional NN library in clojure. That should be fun.
12:25jbondesonfor fun i'm going to see how the PS works with the mona lisa problem that's all the rage
12:27opqdonutbe sure to blog about it ;)
12:27jbondesonoh so no.
12:27opqdonut(j/k)
12:27BigTomjbondeson: hasn't someone done a clojure version? (he saysjoining halfway througha conversation)
12:28jbondesonyeah, but he used a GA-ish algorithm.
12:28BigTomah
12:28jbondesonjust want to see how the PS would perform. it's good at numerical optimization, so the fun part is reworking the problem to be easily optimized by a PS
12:29BigTomPS?
12:29jbondesonsorry, particle swarm
12:29BigTomAh, interesting
12:34BigTomCan everyone bear it if I ask another swank/slime question?
12:35BigTomI can do the basics now but I am having a problem with dependencies (in clojurebox on windows)
12:37BigTomI have put this in may .emacs (add-to-list 'swank-clojure-extra-classpaths "C:\dev\clojure\compojure\compojure\deps\fact.clj")
12:37BigTomas suggested in th ereadme
12:37BigTomand get - Symbol's value as variable is void: swank-clojure-extra-classpaths
12:37AWizzArdIf you use Emacs+Slime+Clojure, can you please open a fresh repl and do: (javax.swing.JFileChooser.)
12:37AWizzArdWhat happens for you?
12:38AWizzArdDoes it immediately return a JFileChooser object?
12:39jbondesonBigTom: I think you want the actual file name in the classpath like that, but I could be wrong...
12:39AWizzArdOr is it like on my system, that it crashes? Emacs won't respond to anything anymore?!
12:39jbondesonerr don't think
12:39jbondesonsorry
12:40jbondesonAWizzArd: if i drop off irc, its because it hung my emacs
12:40BigTomAWizzard: it hangs
12:41jbondesonmine returns
12:41Carkawizard : you're on windows ?
12:41AWizzArdyes
12:41AWizzArdWindows here
12:41Carki have the same problem
12:41jbondesonclojurebox?
12:41AWizzArdjbondeson: what Clojure version do you use?
12:41jbondesoni just updated
12:41BigTomemacs is ok, but I have a dead REPL
12:41AWizzArdNope, my own emacs+slime setup
12:41Carkswitch to the inferior-lisp and press enter a couple times
12:41jbondesonand i also just yesterday went to the most recent build of EmacsW32
12:42BigTomCark: What is the inferior-lisp?
12:43Carka buffer in emacs
12:43Cark=P
12:43Carkbecause of this problem i actally decided to do without emacs
12:43Carki mean without slime
12:43BigTomThe editing buffer?
12:44Carkthat's another repl, not the slime repl
12:44BigTomah, how do I fire it up?
12:44jbondesonthe buffer will be called "*inferior-lisp*" and should have a prompt like "user=>"
12:44jbondesonif you hold control and right click you should get a buffer menu
12:44BigTomI guess I use "start inferior lisp"
12:44CarkC-X C-B should give you a list of buffers
12:44jbondesonerr left
12:44AWizzArdcfunny behaviour
12:45AWizzArdjbondeson: do you also have newest versions of clojure-swank and clojure-mode?
12:45jbondesonAWizzArd: I do a full rebuild, so yes.
12:46Carkmy understanding is that this is not a clojure problem, but rather a compatibility problem between emaxs and swing
12:46Carkyou have the same without slime too
12:46AWizzArdjbondeson: what OS are you using? XP?
12:47jbondesonVista
12:47Carkthat's only under windows yes
12:48BigTomWhat is the difference between Slime and inferior-lisp?
12:48Carkthe slime repl lives in a separate thread
12:49Carkinferior lisp is the direct pipe to the clojure process
12:49Carkat least that's how i understand it
12:51AWizzArdCark: but jbondeson doesn't have our problem.
12:51Carkit works fine after it worked once
12:52AWizzArdyes :-)
12:52Carkstill very annoying
12:52AWizzArdindeed
12:52jbondesonwhat jvm version are you targeting?
12:52Cark1.6 latest
12:52AWizzArdjava 6 update 11 (server, 32 bit)
12:53jbondesonsame
12:53AWizzArdk
12:53Carkso maybe it doesn't break under vista ?
12:53jbondesonseems to be the only real difference
12:53AWizzArdthen I will now update to the newest Clojure, to the newest swank and emacs mode and see if that helps.
12:53AWizzArdI remember I did *not* have these problems one month ago.
12:54Carki always had this problem
12:54AWizzArdor Cark, do you also have a fresh copy of all components for Clojure?
12:54BigTomI think it happened to me on the previous versions
12:54Carkawizzard : not right now
12:54AWizzArdjbondeson maybe has the more intense Windows. The fresher one. The one that simply feels better.
12:54Carki learned to live with it
12:54BigTomI now have the latest clojurebox versions on XP and the SLIME REPL hung (emacs didn't)
12:55AWizzArdah okay, so you have the clojurebox setup, while I am using my own install
13:01BigTomI'm going to have to go, reception is getting bad
13:10jbondeson`anyone know how to force a total reload of swank?
13:11jbondeson`I updated the extra-classpaths and it doesn't seem to want to take it when i kill buffers and reload.
13:12Chouseris there a better way to check if a var has been dynamically bound, other than (= @thevar (.getRoot thevar))
13:23Lau_of_DKGood evening everyone
13:29Lau_of_DKDesign question. Imagine I have large quantities of data Im parsing by passing them through a map or something similar. How would I go about showing the progress to a UI?
13:29jbondesonmost common way would be some form of callback at intervals in the processing
13:30jbondesonthe other way would be some kind of mutable object that stores the current progress
13:31ChousukeI suppose you could wrap the function you're mapping in something that keeps a counter and notifies the UI
13:31Chouseror even more fun, create a generic seq filter that does it
13:32Chousukenot too difficult I suppose
13:32Chouser(map dowork (showprogress my-ui-obj (line-seq foo)))
13:33Lau_of_DKhmm, Chouser, thats blows the 'interval' idea doesnt it ?
13:33ChouserHm, why aren't Vars Named? They clearly have names.
13:33ChouserLau_of_DK: I don't think so
13:34ChouserLau_of_DK: thought I suppose you'd have to tell it how much work to expect.
13:34Chouserthough
13:34Lau_of_DKjbondeson: If you take a look at this system, where would you implement callbacks ? http://paste.lisp.org/display/74861
13:34Lau_of_DKChouser: Thats a tough one
13:35Chousukethe imperative case is no different though. :)
13:35Chouserrhickey: may I add a Named implementation to Var? I want to use vars in a heirarchy.
13:38Lau_of_D`Sorry X froze on me, last thing I saw was my own question, any answers?
13:39cooldude127Lau_of_DK`: what'd ya ask?
13:39jbondesonLau_of_DK: I'm trying to think how pmap is going to consume and process your file.
13:40Lau_of_DKYes, I cant really visualize it
13:40jbondesonyou may be able to add a call in the function pmap is using to map.
13:40jbondesoncalculate, call, return calculation
13:40Lau_of_DKBut you realize that pmap = map right?
13:41jbondesonyes.
13:41Lau_of_DKk
13:41jbondesonthe biggest issue is adding in more side effects.
13:41jbondesonline-seq is lazy, right?
13:42Lau_of_DKYea
13:42jbondesonwell...
13:44jbondesonI think changing your work function in the map to signal "one more work item complete" would work.
13:45jbondesonyou just have to deal with the concurrency problems with that
13:45jbondesonor if you don't mind have a mutable object you could just have an inc in that function.
13:45jbondesonnot pretty, but it gives you what you need.
13:46Lau_of_DKI think actually, since the workload in size is practically unpredictable, the best think might be to increment a ref during mapping, and then doing the whole parse in a seperate thread, just keeping an eye on the ref
13:47jbondesonyeah.
13:48Lau_of_DKAlright, thanks for your input guys
13:49ChousukeLau_of_DK: http://gist.github.com/58262
13:49Chousukemy take at the side-effector :P
13:50Chousukeclosures <3
13:51Lau_of_DK(doc swap!)
13:51clojurebotAtomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns the value that was swapped in.; arglists ([atom f] [atom f x] [atom f x y] [atom f x y & args])
13:51Lau_of_DKSame speed as commute?
13:51Chousukeprobably faster.
13:51Chousukeworks only on atoms though.
13:51Chousukeand you don't need a transaction :)
13:51Lau_of_DKcool
13:51Lau_of_DKThanks man
13:53jawolfeHi, anyone know if it's possible to efficiently get "the object that is held in the set which compares equal to x, if found" in a Java Set?
13:54jawolfeI can't find any corresponding method in the API
13:55Chouserjawolfe: wow. That seems like a bit of an oversight.
13:55Chouseryou can do .contains, but then you just know you found something. getting the actual identity of the object in the Set doesn't seem possible.
13:55Chousukehm, but if you already have an equal object, do you need the *actual* object in the set?
13:56jawolfeWell, I'm trying to extend Clojure contains? and get to work on Sets
13:56jawolfeand I believe the contract of "get" is that it should get the identical? object from the set
13:56jawolfenot just an .equal one
13:56jawolfeChouser: Yeah, I'm surprised, but that looks like how it is
13:57jawolfeSo, maybe this was Rich's way of making me find the answer to my question of why contains? doesn't work on Sets
13:57jawolfe:)
13:58Chouserjawolfe: :-) wouldn't shock me.
13:58jawolfeAm I right on the contract of Clojure "get"?
13:59jawolfeAll I can find is from the data_structures page, where it says returns "the object that is held in the set which compares equal to the key"
13:59jawolfewhich I take to mean the identical? object
14:01Chousukehmm
14:01jawolfethis is way it currently works for clojure sets
14:01jawolfe'(let [x [1] y #{x}] (identical? x (get y [1])))
14:02jawolfe==> true
14:03Chousukejawolfe: it uses .equals
14:04Chousukejawolfe: I created a string that was not identical to a constant string, but still equal to it, and was able to retrieve it from a set containing a constant string
14:04ayrnieu,(let [x [1] y [1] z #{x y}] (map #(identical? % (get z [1])) [x y]))
14:04clojurebot(false true)
14:06jawolfeChousuke: You mean it returns the actual object from the set, not the .equal query, right?
14:06jawolfe,(let [x [1] y [1] z #{x y}] z)
14:06clojurebot#{[1]}
14:07Chousukejawolfe: yeah, it returns the thing in the set
14:07jawolfeSo, right ... it does seem that "get" currently returns the actual (identical?) object from the set that's .equal to the query, not just an object .equal to the query
14:08jawolfeAnd it looks like there's no way to get this behavior in sublinear time from a java.util.Set
14:08Chousuke,(let [a "foo" b (apply str (seq "foo"))] [(identical? a b) (identical? a (get #{a} b))]
14:08clojurebotEval-in-box threw an exception:EOF while reading
14:08Chousukeoops
14:08Chousuke,(let [a "foo" b (apply str (seq "foo"))] [(identical? a b) (identical? a (get #{a} b))])
14:08clojurebot[false true]
14:09jawolfeSo, the only question is whether this is the contract of "get" on sets or just an implementation artifact; from the wording, I suspect the former
14:10jawolfeSo, I give up on this :) ... thanks all!
14:23Mijegod bless shawn hoover
14:24Mijeclojure box is a relief for the newbie :)
14:24kefkaI have a problem where I include a .jar file in my classpath but can't load the classes into Clojure. I get the following error:
14:24kefka"java.lang.NoClassDefFoundError: package/SQLCore (wrong name: SQLCore) (NO_SOURCE_FILE:0)"
14:25kefkaThis is different from the error I get when the *.class is not supplied at all in the .jar, which is:
14:25kefkauser=> (import '(package Foo))
14:25kefkajava.lang.ClassNotFoundException: package.Foo (NO_SOURCE_FILE:0)
14:26kefkaWhat is happening here? What's behind the NoClassDefFoundError that fires when the *.class is, in fact, found?
14:26hiredmanwhere is there a '/' in package/SQLCore?
14:26hiredmanwhy
14:26kefkaI called (import '(package SQLCore))
14:28kefkaI'm not sure why it adds the '
14:28kefkathe '/'
14:28hiredmankefka: that class is in the wrong package, it looks like
14:28hiredmanhttp://mail-archives.apache.org/mod_mbox/tomcat-users/200411.mbox/%3Cs19b6e5c.076@gwmail.media.utah.edu%3E
14:29kefkaOk. So I need to put it in a package?
14:30hiredmanuh
14:30kefkaI was hoping to avoid that. I don't like how the directory structure has to match the package structure exactly.
14:30Chousukekefka: you can't avoid that.
14:30Chousukeit'll just keep your code organised anyway
14:30kefkahiredman, Chousuke: Ok, thanks.
14:31Chousukeyou can always have files that are just included by other files, of course; they have no structure rules.
14:32Chousukebut in general it's good to have a clear namespace structure, and the directory layout has to match that at least for the files that declare a namespace.
14:35technomancycontrib committers: there's still a CPL.txt file in the contrib repo; shouldn't that be removed?
14:35technomancyalso, it wouldn't hurt to maybe toss a README in there... =)
14:36technomancyheh
14:49duck1123clojurebot: CPL.txt is <reply>Pay no attention to the CPL.txt
14:49clojurebot'Sea, mhuise.
15:16jayfieldswhat do you use in Clojure similar to a ternary operator. (e.g. [ruby] foo = condition ? "1" : "0")
15:17technomancyjayfields: in Clojure if is pretty succinct
15:17kotarak(let [foo (if condition 1 0)] ...)
15:17technomancyjayfields: actually even more succinct than the ternary operator. =)
15:17cooldude127jayfields: if is the ternary operator :)
15:17technomancyThe Original Ternary Operator.
15:18jayfieldsI was trying to do (.setSide (if (< quantity 0) "buy" "sell"))
15:18technomancy(literally; lisp was the first language to have an else clause with if)
15:18jayfieldsand getting a weird error
15:18technomancyjayfields: you're trying to call setSide on an object, but it looks like you're missing that object
15:18technomancysetSide is a method, right?
15:19jayfieldsyeah, I'm in a (doto ...)
15:19kotarakWhat is the error?
15:19kotarakWeird are many errors....
15:19cooldude127^ was about to ask
15:19technomancyoh, ok that's different then. more of a problem with how you're using doto than if
15:19kotaraklisppaste8: url
15:19lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:19jayfields(doto msg (.setSide (if (< quantity 0) "buy" "sell")))
15:19kotarakYou can paste the problematic code and the error there.
15:19ozy`jayfields: if/then/else/end is an expression in ruby, too, you know :p
15:19ayrnieu,(doto "hi" (.contains (if (< 1 3) "h" "x")))
15:19clojurebot"hi"
15:20ayrnieueheh.
15:20kotarakI'm still missing the error....
15:21jayfieldsone sec, I'll see if I can isolate and paste
15:21technomancyjayfields: doto is a macro, so your regular assumptions about evaluation order may not apply. (I haven't used it myself.)
15:22jayfields(doto msg (.setSide (if (< quantity 0) 1 0))) seems fine
15:22jayfieldsbut if I try to replace 1 & 0 with enum values I get failure.
15:22jayfields*failures
15:22technomancyenum values?
15:22technomancyyou mean strings?
15:23jayfieldspublic class BuySellEnum {
15:23jayfields public BuySellEnum() {
15:23jayfields }
15:23jayfields public static final int BUY = 0;
15:23jayfields public static final int SELL = 1;
15:23jayfields}
15:23kotarakjayfields: please paste the code in question together with the exception you get. Like this is only guessing.
15:23kotaraklisppaste8: url
15:23lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:23kotarakPlease there. ^
15:24kotarak(doto msg (.setSide (if (< quantity 0) BuySellEnum/BUY BySellEnum/SELL))
15:24technomancyjayfields: yeah, that sounds like your problem. strings are not the same as enums.
15:25jayfieldsI suck. I think it was a typo the whole time. sorry.
15:25cooldude127lol
15:26jayfieldsI had BuySellEnum/Sell instead of BuySellEnum/SELL
15:26kotarakjayfields: no problem. But be clear in how the code looks like. Otherwise others have a hard time to help. :)
15:26jayfieldsgot it, next time I try the paste thing. Thanks.
15:26jayfields*I'll
15:27technomancyit helps a lot to get paste integration with your editor.
15:27jayfieldsdo you have a link for IntelliJ integration, or should I google?
15:28technomancyI don't know about that, no.
15:28kotaraktry to google in the google group of clojure.
15:28kotarakThere you should find the announcement.
15:28jayfieldscool. thanks. The clojure plugin for IntelliJ is pretty young unfortunately.
15:28kotarakhttp://code.google.com/p/clojure-intellij-plugin/
15:29kotarakHopefully correct. :]
15:38jbondesonsorry about all the bouncing in/out today.
15:38cooldude127NO APOLOGIES ACCEPTED
15:38jbondeson;-;
15:39cooldude127lol
15:52BigTomtechnomancy?
15:53technomancyBigTom: ahoy
15:53BigTomtechnomancy: Hi, I saw your blog re Slime
15:54BigTomIf I wanted to give it a go should I clean out my clojure box and start from straight emacs?
15:54gnuvinceIs there a command-line debugger that I can use with Clojure?
15:54BigTomI don't have a big enough investment for that to be a problem
15:55technomancyBigTom: you shouldn't need to do that, no.
15:55technomancybut if you feel like starting from a clean slate, you could check out the Emacs Starter Kit.
15:55kotarakgnuvince: there is jdb...
15:56hiredmanhttp://java.sun.com/j2se/1.3/docs/tooldocs/solaris/jdb.html
15:56hiredman^- manpage which for some reason I don't have, even though I have jdb
15:57technomancyBigTom: is this on Windows?
15:58gnuvincekotarak: great
15:58gnuvincethanks
15:58gnuvincehiredman: thanks to you too :)
15:58BigTomtechnomancy: I thought I would try it on Linux first
15:59technomancyBigTom: ok, that's the only thing *I've* tested on, though it sounds like it may only need small tweaks for win
15:59technomancygnuvince: that or it means your test suite isn't good enough
16:00BigTomdo I just follow the instructions in the top of clojure-mode.el
16:00technomancyBigTom: that should do it; yeah
16:00gnuvincetechnomancy: hold on to your chair: no tests for this part :)
16:00technomancygnuvince: =(
16:00gnuvincetechnomancy: I'm not sure how I'm gonna handle them.
16:04technomancygnuvince: getting started on tests can be the trickiest part. the project I was just on took a whole day to get the test suite even running; once I had that in place the implementation took only half a day. =\
16:04technomancymetaperl: hey, I heard you were using M-x clojure-install on Windows?
16:05gnuvincetechnomancy: I mean, it's all side effects stuff with packed binary data
16:05metaperlgnuvince: hi
16:05metaperlgnuvince: yes, it works
16:05metaperltechnomancy: thank you for your work
16:05gnuvincemetaperl: pardon?
16:05cooldude127wait, really? that works on windows?
16:05metaperlodd thing is, with windows git, I kept getting the old version of clojure-mode even though I was cloning from technomancy's archive
16:05metaperloh
16:05technomancymetaperl: no problem. it sounds like you had to mess around with the path a bit? I pushed out a new version which should make that unnecessary.
16:06metaperlgnuvince: sorry
16:06technomancymetaperl: were you using the installer branch?
16:06technomancyI haven't merged to master yet.
16:07lisppaste8metaperl pasted "what worked for me" at http://paste.lisp.org/display/74882
16:08metaperltechnomancy: what is the installer branch? I tried git clone git://github.com/technomancy/clojure-mode.git ... over and over and I kept ending up with the soure code in jochu's github instead... so I downloaded a zip of the git and unpacked it
16:08metaperloh maybe that is why I kept getting his source code?
16:08metaperlit was frustrating :)
16:08cooldude127metaperl: there are two branches, master and installer
16:08metaperli thought it was a bug with github or git win32
16:08technomancymetaperl: yeah, sorry... I want to communicate with jochu about the installer before I merge to master.
16:08cooldude127installer is the one with the cool stuff in it
16:09metaperldoes the git hub page infer that somehow?
16:09metaperlwhat clone command would I use for that?
16:09Chousukeyou should get both branches
16:09technomancymetaperl: anyway, it sounds like on windows probably nobody is going to use the default value of clojure-src-root anyway...
16:09metaperli dont know how to do that?
16:09Chousukejust git checkout installer afterwards
16:09Chousuke(by default master is checked out)
16:10hiredmanI am not sure what is more annoying, so much emacs talk, or irssi coloring all the nicks the same
16:10metaperlagain, how do I look at the github page and see the fact that there are two main branches?
16:10cooldude127Chousuke: nope
16:10cooldude127Chousuke: only master is cloned by default
16:10technomancymetaperl: oh! I didn't realize that the github checkout instructions wouldn't mention the fact that you were on another branch
16:10Chousukeoh.
16:10technomancyI can see how that would be very confusing.
16:10metaperltechnomancy: I did git clone
16:10metaperlgit clone git://github.com/technomancy/clojure-mode.git
16:10technomancyChousuke: actually git clone only pulls master across by default iirc
16:10Chousukewell, git checkout -b installer origin/installer I guess :/
16:10technomancymetaperl: yeah, that's my bad; should have explained that.
16:11metaperlso you are saying I should h ave done a git checkout installer in the clojure-mode directory afterwards?
16:11technomancymetaperl: what Chousuke said
16:11technomancybut I will merge this into the master branch; this is too confusing
16:11technomancyand I'm pretty sure we'll want to keep it since it's been working out so well.
16:11metaperlhe didnt say where to do it, but I'm assuming the root directory of what was checked out
16:11technomancysorry for the confusion.
16:11metaperlok I will wait for the merge
16:12Chousuketechnomancy: better yet: swap the two brances ;)
16:12Chousukebranches*
16:13Chousukethough I guess you could just make a tag for the old master too, instead of a branch
16:13metaperlthe git grandmasters hash it over :)
16:13metaperli have perl professional work to do, so I will check in with you cats after 5pm
16:13metaperl(1 hr from now)
16:14Chousukegit actually makes a lot of sense once you get the basics
16:14technomancymetaperl: thanks for getting this working; nice to know it's cross-platform.
16:15metaperl:)
16:15cooldude127technomancy: it was cross-platform before, just not windows :)
16:15technomancyheh
16:16technomancycooldude127: usually I have a "Windows support is entirely accidental" disclaimer on my codes.
16:16cooldude127i noticed
16:17Chousuke:)
16:17cooldude127technomancy: i saw it on mire too
16:18ChousukeI'd extend that to support of environments besides my own...
16:18cooldude127i make sure technomancy's code works on os x
16:19technomancyI delegate my OS X testing.
16:19technomancysince it's "illegal" for me to run a VM with it.
16:19hiredmaneh?
16:20technomancyhiredman: I can't test on OS X without either buying a Mac or violating the EULA.
16:20technomancywhich is pretty silly.
16:20BigTomtechnomancy: Its installing now
16:20hiredmanah
16:20BigTomI'll have a go with Windows tomorrow
16:20technomancyhiredman: even MS is not that restrictive. =\
16:21ChousukeMS mainly sells software though.
16:21cooldude127apple is a hardware company
16:21technomancyChousuke: sure, they have their motivations. doesn't make it reasonable.
16:21cooldude127they'd be broke if you didn't have to buy a mac
16:21technomancyChousuke: I'm trying to make things work better on OS X, and they are opposing me.
16:22ChousukeI can see your point.
16:22technomancyit's not as bad as the iPhone where you have to ask permission to enrich the developer and application ecosystem, but it still offendsn me.
16:22Chousukemaybe they should provide a "tester licence" for running in a VM for testing purposes.
16:22technomancyChousuke: on the other hand, outsourcing cross-platform testing has been working out great for me so far. =)
16:23Chousuke:)
16:23technomancyso I can't complain *too* much
16:23cooldude127technomancy: i'm a good tester :)
16:23ChousukeAt least OS X is pretty unixy
16:23technomancycooldude127: you do indeed have a knack for finding my dumb mistakes. =)
16:23Chousukeso if you don't make any unreasonable assumptions it'll just work most of the time.
16:24cooldude127technomancy: i have a skill for spotting problems in other people's code
16:24cooldude127Chousuke: yeah that is true
16:24technomancyChousuke: a lot of it is BSD-isms like the crazy behaviour of cp -r if you add a trailing slash to a directory entry
16:24cooldude127technomancy taught me to tell aquamacs to fuck off, albeit very indirectly and probably without his knowledge
16:25hiredmanBSD is Unix, GNU is Not Unix
16:25hiredman:P
16:25cooldude127lol
16:25hiredmanI mean, it even says so, right in the name
17:06cadshas clojure ever been anything other than a lisp?
17:06ayrnieuit hasn't.
17:06cadsthanks ayrnieu
17:07ChouserI believe in it's oldest form it was a common lisp program that generated Java and C# source code.
17:07Chouserits
17:08ayrnieuhttp://dotlisp.sourceforge.net/dotlisp.htm
17:09kotarako.O
17:10cadswow :D
17:12kotarakSo it was a Scheme. :)
17:14technomancy`nice; like half of lisp.reddit.com is clojure now.
17:15ChouserI really thought the compiler was originally in CL, but I'm not finding it now.
17:21shooverdotlisp was a different project. you can find clojure in CL in the svn history
17:26RaynesClojure is gaining popularity fast. Looks like a JVM LISP is everyones dream.
17:26technomancy`Raynes: a *modern* lisp is the big draw for me.
17:27technomancy`just losing all the 80s-ish trappings (like the big hair and the synths)
17:27turbo24prgis there a "built-in" to find the entry for a value in a map?
17:27ayrnieuanother JVM Lisp: http://common-lisp.net/project/armedbear/
17:27hiredmanI was looking for a .Net lisp the first few times I stumbled across clojure
17:27ayrnieu,({1 2, 3 4} 1)
17:27clojurebot2
17:28Raynestechnomancy`: The fact that the community is already huge, and that the language rocks, and that Rich actually hangs out in here, people are already working on IDE support for Clojure and a book is 2 months away from shipping did it for me.
17:28hiredmanturbo24prg: java Map or clojure map?
17:28RaynesDid I mention the language rocks?
17:28technomancy`heh
17:28hiredman,(:a {:a 1 :b 2})
17:28clojurebot1
17:28hiredman,(get {:a 1 :b 2} :a)
17:28clojurebot1
17:28turbo24prgayrnieu: with the value (like 2), not with the key
17:29ayrnieuthe language is very cool, and the book (that you can already get on PDF, beta 6 now) does a very good job of showing this
17:29Chouser,(find {:a 1, :b 2} :a)
17:29clojurebot[:a 1]
17:29kotarakturbo24prg: (filter #(= (second %) value-to-look-for) the-map) untested.
17:29turbo24prgin cl you can give find a :test method
17:29hiredmanturbo24prg: you want a bimap?
17:30hiredmanlook up keys with values, look up values with keys?
17:30turbo24prgright
17:30hiredmanick
17:31durka42you could use two maps...
17:31hiredman,(reduce #(assoc %1 (second %2) (first %2)) {} {:a 1 :b 2})
17:31clojurebot{2 :b, 1 :a}
17:31Chouser,((into {} (map (fn [[x y]] [y x]) {:a 1, :b 2})) 2)
17:31clojurebot:b
17:31kotarakturbo24prg: (merge (zipmap keys values) (zipmap values keys))
17:31jbondeson`kotarak has what you want.
17:32kotarakBut with lots of assumptions.
17:32kotarakunique keys, unique values, ...
17:32hiredman(doc zipmap)
17:32clojurebotReturns a map with the keys mapped to the corresponding vals.; arglists ([keys vals])
17:32turbo24prgare strings stored multiple times then (when using two maps)?
17:32hiredmanhuh
17:32Chouserno
17:32Chousernot unless you try very hard
17:33turbo24prgChouser: what does that mean? :)
17:33jbondeson`if you're not doing it a million times the previous filter statement works.
17:33jbondeson`the real issue is non-unique values.
17:34Chouserturbo24prg: string literals in Clojure are interned and objects are hardly ever deep-copied.
17:34Chouser,(identical? "foo" "foo") ; interned
17:34clojurebottrue
17:35turbo24prgwell, thanks for your help!
17:35ayrnieu,(let [d {1 2 2 3 3 2}] (map count [(set (keys d)) (set (vals d))]))
17:35clojurebot(3 2)
17:37Chouser,(let [a [1 "foo"] b [(second a) 2]] (identical? (second a) (first b))) ; copy reference, not object
17:37clojurebottrue
17:37Chouser,(identical? "foo" (String. "foo")) ; explicit copy
17:37clojurebotfalse
17:37gnuvince_hiredman: trying to convert Haskellers to Clojure? :)
17:41turbo24prgso i don't have to role my own dictionary encoding when i use a string in several maps, because it actually stores references?
17:42Chouserturbo24prg: sounds right to me.
17:42hiredmangnuvince_: well, I would just sort of like all the haskell code out there to be translated to clojure so I can use it
17:42technomancy`hiredman: speaking of haskell... think you'll make it to seafunc or not?
17:43ayrnieuthis is the only haskell code of note: http://www.willamette.edu/~fruehr/haskell/evolution.html
17:43turbo24prgawesome.
17:43hiredmantechnomancy`: nah, I have to go fix someones internet
17:43technomancy`hiredman: bummer
17:44hiredmanI am really geting fed up with cheapo router/gateway/nat boxes
17:44albinotime to by a soekris
17:44albinos/by/buy
17:46hiredmanalbino: price*4
17:46hiredmanbut yeah
17:46hiredmanthat would be best
17:47hiredmanthat would be awesome infact
17:47technomancy`I get out of a lot of that kind of stuff by saying that I haven't used Windows in over 5 years since that's usually where the problem lies.
17:47albinoisn't it like $300 or something like that?
17:47hiredman$278
17:48hiredmantechnomancy`: nah
17:48albinohiredman: dude, you can make 80k+ a year hacking java, you should be able to afford it
17:48technomancy`albino: sounds like it's for someone else
17:48albinooh
17:48albinoI thought it was for his house
17:48hiredmankwatz. I do not hack java so I do not make that kind of money
17:49hiredmananway, this is sort of off topic, I guess
17:49albinohiredman: stop painting start hacking :). 1) Obtain job hacking java 2) Sneak in clojure instead of java 3) profit
17:49hiredmanalthough, I think sablevm is in the package repo for some of the opensource firmwares
17:50hiredmandunno if clojure runs on sablevm though
17:50technomancy`sablevm?
17:51technomancy`would make a good logo
17:51technomancy`*on
17:51technomancy`(heraldry jokes are not very funny.)
17:51hiredmanNOTE: THIS PROJECT HAS MET ITS RESEARCH GOALS AND IS NOT ACTIVELY MAINTAINED ANYMORE.
17:51hiredman^- sablevm homepage
17:52albinoahh, that's where the academic world fails the real world
17:52albinowhere research goals are met
17:58technomancy`but it met its research goals! so it must be good.
18:26BigTomtechnomancy: Your install script works so far for me on Linux
18:26gnuvince_,(+ (byte 254) 3)
18:26clojurebot1
18:26BigTomI even ran one of those swing snake apps that were popular a few weeks back
18:26gnuvince_,(+ (int (byte 254)) 3)
18:26clojurebot1
18:27technomancyBigTom: great
18:27BigTomtechnomancy: I'll give it a go on Windows tomorrow, thanks
18:27technomancycool
18:27BigTomg'night
18:28cooldude127technomancy: clojure-install is a hit!
18:28technomancyout of the park.
18:28cooldude127technomancy: is clojure-update in yet?
18:28cooldude127oh yeah it is
18:28cooldude127i'm forgetful
18:28technomancycooldude127: it is, but the save-window-excursion I added wasn't working.
18:28cooldude127really?
18:29technomancyyeah, I may not have exactly what you wrote at first though.
18:29cooldude127technomancy: weird, cuz i think i'm using what you put in, and it works for me
18:30gnuvince_Is it possible to convert from byte to int?
18:30technomancymaybe I was using an older copy... sometimes I get confused since the my clojure-mode repo and starter kit aren't always in sync
18:30cooldude127technomancy: could be. i copied clojure-mode.el over from clojure-mode repo
18:33cooldude127technomancy: did you talk to jochu? your master has been merged
18:33cooldude127from installer
18:33cooldude127in your repo
18:33technomancycooldude127: I've just sent a pull request; haven't heard back
18:34cooldude127oh ok cool
18:34technomancyI figured this stuff wasn't going away though.
18:34cooldude127yeah
18:34cooldude127everybody likes easy installers
18:34Chousukehm
18:34cooldude127and this is definitely the kinda thing clojure can use
18:34Chousukethe new clojure-mode is not going to screw up my git-svn repos is it? :)
18:34ChousukeI see you have added automagixk
18:34Chousukemagicks*
18:35cooldude127Chousuke: if you don't use clojure-install or clojure-update
18:35gnuvince_,(byte 255)
18:35clojurebot-1
18:35gnuvince_hmmm
18:35cooldude127it shouldn't mess up anything
18:35gnuvince_Does Clojure have unsigned versions of its numerical types?
18:35cp2so, whats the story with lazy-cons?
18:35Chousukejava doesn't, so no.
18:35cp2is cons now lazy?
18:35ayrnieuhttp://darksleep.com/player/JavaAndUnsignedTypes.html
18:36gnuvince_damn
18:36ayrnieucp2 - in the lazy branch, (first (cons 1 (repeat 1))) => 1
18:36gnuvince_I have a program that *needs* to read unsigned bytes
18:36cp2i see
18:36ayrnieuoh well, that's 1 in trunk as well.
18:36technomancyChousuke: you can use clojure-install or clojure-update with a different src-root and it won't conflict. but if you don't touch those commands, there's no way it would mess you up.
18:36technomancyno side-effects. =)
18:37cooldude127Chousuke: and clojure-update assumes you are using git for all, as in it just does git pull in those directories
18:37cp2oh ayrnieu, i only brought that up because i thought it was removed
18:37cp2rhickey was here explaining a few days ago
18:37cp2it appears its still there
18:38cp2im using 1235 (from clojure box)
18:39Chousukecooldude127: hm, maybe make that configurable?
18:39ChousukeI need git svn rebase :)
18:39Chousuke... for clojure and clojure-contrib
18:39technomancyChousuke: it's more targeted at people who are just getting started... but that might make sense
18:40technomancydo you use git-svn because you need to be able to commit?
18:40cooldude127Chousuke: well, clojure-update is meant to be used after doing clojure-install
18:40Chousuketechnomancy: nah. the git repo is just too lagged
18:40cooldude127gnuvince_: apparently you need to use a short
18:41technomancyChousuke: the github one is updated manually?
18:41Chousukemaybe with a cron script or something; I don't know.
18:41Chousukecertainly not automatically when the SVN repo changes.
18:41technomancyChousuke: hows about I replace "git pull" with "git pull || git svn pull"
18:42technomancyerr--rebase
18:42technomancyso if it fails it will fall back to git-svn
18:42ayrnieuclojurebot notices svn updates. Have *it* update a git repo :-)
18:42cooldude127clojurebot: latest?
18:42clojurebotlatest is 1250
18:42cooldude127yeah github is 9 revs behind
18:42technomancyhuh; didn't realize it was that bad
18:43ChousukeGoogle should implement git support for google code.
18:43cooldude127Chousuke: hell yeah
18:43Chousukewould be easier to persuade rhickey too :P
18:43gnuvince_cooldude127: so I'll need to convert all my data types up one level?
18:43cooldude127gnuvince_: looks like it based on the link that was on here
18:43ayrnieugnuvince, it depends on what you're doing.
18:44ayrnieugvunince - signed bytes and unsigned bytes are the same at the bit level, after all.
18:44cp2is the sf svn for clojure the "official" one
18:44cooldude127cp2: i think it's on google code now
18:45Chousukeit moved to google code a while ago.
18:45cp2i see
18:45Chousukeas did contrib
18:45cp2k, thank you
18:45ChousukeI see it as an improvement, but still wish it was git instead of SVN :)
18:45cooldude127should have gone to github :)
18:45cp2personally i like bazaar
18:45Chousukeor actually, any DVCS would do
18:45Chousukehg, bzr, or even darcs I guess.
18:46waltersChousuke: i think it depends on Google internally giving up on improving SVN; last I heard they were still paying someone to do that
18:46cooldude127lol
18:46ayrnieuyou can use svk with the existing svn repo.
18:46cp2Server Error
18:46cp2burn in hell google
18:46cooldude127ayrnieu: right now i think people are using git-svn
18:46Chousukeayrnieu: I haven't heard good things about svk.
18:47cooldude127i don't like it
18:47Chousukegit-svn is great, though.
18:47ayrnieusvk was a little slow on my 412Mhz Zaurus.
18:47technomancyI heard the github guys gave a training talk at Google; don't know if that means they're using git-svn or considering going all-git on some teams
18:47Chousukeinitial checkout is a pain, but after that it's like SVN was never there... at least for local stuff.
18:47ayrnieuOther people may dislike it for being written in Perl, or for not being something that they already prefer -- git, etc.
18:48cooldude127i have never used git-svn
18:48gnuvince_ayrnieu: I need to do an addition to specify a terminaision clause, and when it wraps to -100, it wreaks havoc
18:48cooldude127i think i'm just scared
18:48Chousukecooldude127: do you use git though?
18:48cooldude127Chousuke: yes :)
18:48cooldude127all the damn time
18:48Chousukethen you should check out git-svn
18:49technomancycooldude127: is that because you're a student and don't have to deal with Legacy Stuff? =)
18:49cooldude127technomancy: i think so
18:49waltersayrnieu: i think the argument against SVK is that it's sort of like trying to build a skyscraper on top of the foundations built for a house
18:49cooldude127technomancy: i can't think of anything i need to checkout from svn
18:49jbondeson`i still don't trust these new fangle-dangle dcvs things
18:49cooldude127lol
18:50ayrnieuwalters - uh, OK.
18:50Chousukejbondeson: you can use them like traditional VCS systems too!
18:50technomancyjbondeson: back in *my* day, we had to keep each file in its own RCS repository... and it was uphill both ways!
18:51Chousukethough using git with a SVN-like workflow is really not effective.
18:51ayrnieujbondeson, watch the git screencasts.
18:51jbondesonit doesn't help that git on windows sucks
18:51Chousukegit is best used by committing often and cleaning up the mess later.
18:51gnuvince_jbondeson: git isn't the only DVCS
18:51cooldude127Chousuke: git rebase -i ftw :)
18:51Chousukeyou don't need to worry about committing broken stuff, as long as you don't push it, which is a huge win :)
18:52Chousukecould probably make emacs autocommit on every save :/
18:52cooldude127Chousuke: but then your git log would suck
18:53Chousukecooldude127, well, that's easy to fix.
18:53Chousukejust squash together the commits
18:53cooldude127damn i love git sometimes
18:53Chousukeand throw away the ugly development branch
18:53technomancythe peepcode on git is really good
18:53Chousukeand master will look like you never make errors (not even spelling errors in log messages)
18:53cooldude127AS IS THE ONE ON EMACS
18:53technomancyheh
18:54technomancyChousuke: I wrote an Emacs mode that would autocommit to git on an idle-timer and then synchronize with other repos over zeroconf for near-realtime collaborative editing
18:54technomancyit were a blast
18:54Chousukeheh
18:54cooldude127geoffrey grosenbach is a screencasting bad-ass
18:55technomancyChousuke: http://github.com/technomancy/conspire/tree/master
18:55Chousukeanother thing I love about git is that I can actually make the commits meaningful
18:55cooldude127technomancy: i was looking at that code
18:55Chousukelog messages, rather
18:55jbondesontechnomancy: why does that sound like it would be fun to screw with your coworkers using that...
18:55technomancyjbondeson: heh
18:55cooldude127technomancy: how good is the conspire code?
18:55Chousukeoften, you end up making unrelated edits in a single commit, or during a series of commits
18:55technomancycooldude127: i never actually tested it with more than two conspirators
18:56Chousukegit makes separating that mess into clean, well-labeled commits *trivial*
18:56technomancyso probably not very good. I'm sure the timing code needs improvement.
18:56cooldude127technomancy: does it work when you're on different networks?
18:56technomancycooldude127: not currently; it autodetects peers using zeroconf
18:56technomancyaka bonjour
18:57cooldude127yeah
18:57cooldude127technomancy: wtf is roastbeef?
18:57technomancycooldude127: it's just some lame checkout tool I wrote
18:58technomancyfor compiling the absolute latest version of a program
18:58cooldude127oh
18:58technomancyRoast Beef is also a character in the excellent web comic Achewood.
18:58cooldude127i'm more interested in the first answer :)
18:59technomancythe second answer is probably more entertaining
18:59cooldude127lol
19:00technomancyyou've got to start at the beginning with reading Achewood though. it's high-context humor.
19:05Chousukehmm, running git gc every once in a while is useful
19:05cooldude127lol
19:06Chousukemy clojure repo went from 32MB to 11MB and contrib from 16MB to 4.7MB
19:06technomancyChousuke: are you running clojure on your phone or something? =)
19:06technomancythat's not a lot of mega bytes
19:07Chousukenah, operations weren't really getting slow or anything
19:07Chousukebut if this were a bigger project...
19:07cooldude127like...linux!
19:07Chousukeusing 262MB right now
19:08Chousukethough it hasn't changed that much since I last repacked it. :/
19:08cooldude127emacs is a fatty
19:08technomancya long-lived one at that
19:08Chousukeemacs contains a lot of software :)
19:09bitbcktjust needs a decent editor
19:09cooldude127like tetris
19:09Chousukebitbckt: M-x viper
19:09bitbcktI kid, I kid.
19:11jbondesontyping M-x viper is admitting defeat
19:11Chousukedefeat of what?
19:11Chousukeit
19:11jbondesonof mind, body, and soul!
19:11Chousukeit's just enabling a superior UI!
19:12jbondesonso sad...
19:12Chousukethe fact that it's possible to write vim in emacs proves that emacs is, as an editor, superior, but its UI is still crappy :/
19:12cooldude127lol
19:14jbondesonsee the problem is you're thinking of it as a UI or editor, and not a full blown operating syste!
19:14jbondeson+m
19:14Chousukeor maybe I shouldn't call emacs an editor... it's more of a set of composable features
19:14waltersemacs is a buffer-oriented toolkit
19:15cooldude127an awesome toolkit
19:15cooldude127made of composable awesome
19:15Chousukeemacs is kind of like maths; if you have 1 and 2, you can have 3, or 1/2, or -1
19:18Chousukeand then someone writes a bunch of elisp that does something no-one though of before and that is like a whole new branch of maths; and all the old stuff can be re-examined
19:18Chousukethought*
19:19cooldude127lol
19:23notyouravgjoelhow does one find the length of a list?
19:24Chouser(doc count)
19:24clojurebotReturns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps; arglists ([coll])
19:24notyouravgjoelthanks!
19:25zakwilsonI read somewhere that emacs is a great operating system... it's just too bad about the text editor.
19:27Chousukenot everyone agrees that a *text* editor is best for code anyway :)
19:28cooldude127i happen to like the text editor, so...suck it
19:28zakwilsonI saw some interesting new language that used some sort of flowchart-like interface constructed by drag-and-drop.
19:29zakwilsonI can never remember what it's called.
19:29ChousukeI know what you're talking about
19:29ChousukeI forgot the name too
19:29cooldude127i wish i did
19:29ChousukeIt seemed very cumbersome though
19:29jbondesonany interface that relies upon the mouse is inherently flawed =P
19:29zakwilsonThat was my first impression too.
19:30danleithere was something like that back when i had an amiga ...
19:30danleii hated it :)
19:33zakwilsonMaybe program code shouldn't always be text, but I have yet to see a compelling alternative.
19:33Chousukewell, lisp code is *not* text but I suppose you mean the visual representation :)
19:34Chousukehmm
19:34zakwilsonLisp code is a bunch of object literals. Object literals are text.
19:34Chousukeno, the actual lisp code is a data structure
19:34Chousukeyou never see it; you just see your textual representation of it.
19:35peter_12has anyone written a Clojure interpreter in JavaScript?
19:35Chousukethere's a translator.
19:35ChousukeClojureScript, in clojure-contrib
19:35danleii think the interlisp guys used structure editors, not textual representation of code
19:35Chousukea work-in-progress though.
19:35peter_12I was specifically interested in an interpreter
19:36Chousukewrite one in clojure! and then translate it with clojurescript.
19:37peter_12Chousuke: :-)
19:37zakwilsonI suppose it depends on whether you're talking about in-memory code or source code.
19:37Chousukezakwilson: well, I'm talking about what the compiler sees.
19:37Chousukeor the interpreter.
19:37zakwilsonAnd I'm talking about what the reader sees.
19:38Chousukewell, that is text, yeah.
19:38Chousukecould be images as well I suppose.
19:38zakwilsonDoesn't PLT have some support for images in source code?
19:38Chousukecut and paste things together, scan it, use some kind of image recognition as the "reader"...
19:39Chousukecut and paste in this case is to be taken literally.
19:40zakwilsonhttp://docs.plt-scheme.org/drscheme/Graphical_Syntax.html
19:40Chouserwhat a pain
19:44notyouravgjoelis there any namespace stuff I have to do to use the set stuff?
19:44cooldude127i think sets are in core, so no
19:45notyouravgjoelthe api says its in clojure.set
19:45ayrnieu,index
19:45clojurebotjava.lang.Exception: Unable to resolve symbol: index in this context
19:45cooldude127,(doc union)
19:45clojurebotjava.lang.Exception: Unable to resolve var: union in this context
19:45ayrnieu,clojure.set/index
19:45clojurebot#<set$index__5686 clojure.set$index__5686@1adceb8>
19:45cooldude127ok i was wrong
19:46cooldude127basic set structure is in core, but the operations are not
19:52danleioh, that's interesting. i googled a bit for interlisp + structure editor and there's even a thread about it in the clojure group, which also has a link to xerox. nice ...
19:56durka42,(int (Byte/parseByte "3"))
19:56clojurebot3
19:56durka42,(.intValue (Byte/parseByte "3"))
19:56clojurebot3
20:11ozy`,(apply #'hack [the-internets])
20:11clojurebotjava.lang.Exception: Unable to resolve var: hack in this context
20:13ayrnieuspeaking of which, fun fact: no matter how well you obfuscate your JS, at some point the browser makes a tangible request.
20:27jayfieldslisppaste8
20:27jayfieldslisppaste8: url
20:27lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
20:28lisppaste8jayfields pasted "java - clojure running code" at http://paste.lisp.org/display/74893
20:29lisppaste8jayfields pasted "should.clj" at http://paste.lisp.org/display/74894
20:30lisppaste8jayfields pasted "example.clj" at http://paste.lisp.org/display/74895
20:30ayrnieuplease use annotations instead of all these separate pastes.
20:30jayfieldssorry, this is my first attempt at using pastie.
20:31lisppaste8jayfields annotated #74893 with "should.clj" at http://paste.lisp.org/display/74893#1
20:31lisppaste8jayfields annotated #74893 with "untitled" at http://paste.lisp.org/display/74893#2
20:32jayfieldsokay, so I'm trying to run the last annotated snippet
20:32jayfieldswhich uses "should.clj"
20:32jayfieldsand the whole thing is launched via the Java code
20:32jayfieldsbut I get java.lang.Exception: Can't refer to qualified var that doesn't exist (Example.clj:5)
20:33jayfieldsI assume because main is being defined on helpers.Should
20:33jayfieldsis there any way I can get around this?
20:33ayrnieu`(defn ~'main ...)
20:34ayrnieu,[`a `~'a]
20:34clojurebot[sandbox/a a]
20:34jayfieldscool, thanks.
20:37jayfieldsokay, I can't figure it out from the examples, do you guys have any links to docs I can read?
20:38ayrnieucan't figure what out?
20:38jayfieldsif I change should to
20:38jayfields(defmacro should [form]
20:38jayfields `(defn ~'main [] ~@form))
20:38jayfieldsI get Can't take value of a macro: #'clojure.contrib.test-is/is (Example.clj:5)
20:41ayrnieutwo options. One: `(defn ~'main [] ~form) Two: (defmacro should [& form] ...)
20:42ayrnieu(macroexpand '(should (is (= 50 50)))) => (def main (clojure.core/fn is (= 50 50)))
20:42timothypratleysilly question -> what's the equivalent of an enum in Clojure
20:42ayrnieumore idiomatic: [& exprs]
20:43ayrnieutimothy - symbols.
20:44ayrnieujayfields, do you see the problem?
20:46jayfieldsit looks like 'is is expanding in a way that's causing me problems.
20:46timothypratleyayrnieu: I suppose I could create a macro that takes a sequence of symbols and defs them to a number:
20:46jayfieldssince I'm getting Can't take value of a macro: #'clojure.contrib.test-is/is (Example.clj:5)
20:46timothypratley(myenum [foo bar baz])
20:47ayrnieupresently your macro takes its one argument, '(is (= 50 50)), and is flattening it onto the end of `(defn ~'main [] ...)
20:47ayrnieutimothy - or, you could think of symbols as already being named numbers.
20:48jayfieldsah, right, thanks.
20:49timothypratleyayrnieu: they still need to be defed though right? So I figure if the enum is going to be put in a DB later for instance or sent over a wire... having a number would be handy...
20:49durka42you don't have to def keywords
20:49timothypratleyI think I'm just dense
20:49ayrnieutimothy - for that, use a map.
20:49timothypratleyah keywords!
20:49timothypratleyto the rescue
20:49ayrnieu,(class :a)
20:49clojurebotclojure.lang.Keyword
20:50timothypratleyyeah ok so I can just use keywords and create a map if I need to translate them to external
20:50durka42right
20:50timothypratleythanks!!!
20:50ayrnieuhmph.
20:51ayrnieu,(map #(-> class ancestors count) ['a :a])
20:51clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1633$fn
20:51ayrnieu,(map #(-> % class ancestors count) ['a :a])
20:51clojurebot(11 6)
20:51ozy`,cycle
20:51clojurebot#<core$cycle__3720 clojure.core$cycle__3720@45064f>
20:51ozy`,(cycle '(infinity))
20:51clojurebotExecution Timed Out
21:11ozy`,(/ 0 0)
21:11clojurebotjava.lang.ArithmeticException: Divide by zero
21:11ozy`,(/ 0.0 0.0)
21:11clojurebotjava.lang.ArithmeticException: Divide by zero
21:11ozy`FINE
21:11ozy`be that way
21:13RaynesWhy does Double/parseDouble throw a NumberFormatException? :(
21:14Chouserwhat arg did you give it?
21:14Chouser,(Double/parseDouble "x")
21:14clojurebotjava.lang.NumberFormatException: For input string: "x"
21:14cemerickjust out of curiosity, is r1155 when the (.staticFunction Classname args) form went away for invoking static functions?
21:14Chouser,(Double. "x")
21:14clojurebotjava.lang.NumberFormatException: For input string: "x"
21:15Chousercemerick: with just a quick glance at the patch, my guess is "no".
21:16RaynesChouser: Doesn't matter what I give it.
21:17cemerickChouser: Thanks for looking. I'm "porting" various projects up to clojure head (from pre-AOT clojure), and that change surprised me, I hadn't caught wind of it before
21:17Raynes,(Double/parseDouble "2.5")
21:17clojurebot2.5
21:17Raynes. . .
21:17RaynesOh really?
21:17RaynesHmmm
21:18RaynesI bet it's the version of Clojure I'm using. I'll have to check that.
21:18Chousercemerick: git bisect is a decent way to pin down the exact commit that changed a behavior like that.
21:20cemerickChouser: I'll check it out. I just did a quick commit-comment search using gitx, and 1155 is the only plausible one that mentions "static" in the last few months -- not that that means anything
21:20cemerickit's *exceedingly* ironic that we're now using git, after all of my pooh-poohing it :-P
21:22Chouseryou're coming off of svn? has the transition gone well?
21:22ayrnieuthe internet's a fad.
21:22cemerickpretty decently. The trick was figuring out a good time to flip the switch.
21:23cemerickWe're actually in the middle of it now. This week is all about moving to git, "porting" to clojure head, and getting going with the new enclojure.
21:23cemerickoh, and moving from using ivy to git submodules for dependency management. That's been the trickiest needle to thread.
21:24Chouserhm, I don't know anything about git submodules.
21:24cemerickquite handy -- svn:externals for the most part
21:25cemerickthey're sort of dumb for dependency management, but there's a good stopgap until we decide on what to use long-term among what's available: http://twitter.com/cemerick/status/1174146543
21:26cemericks/there's/they're
21:29vjrhowdy all!
21:29notyouravgjoelis there an any function that doesnt need clojure.parallel?
21:29Chousernotyouravgjoel: I can't imagine what you mean.
21:30Chouservjr: hi
21:31notyouravgjoelsorry, the "pany" function in clojure.parallel
21:31Chousergah, I'm getting dragged into writing some kind of object system. this is not what I meant to be doing.
21:31Chousernotyouravgjoel: ah, no, I think the only parallel fn in core is pmap
21:32vjrhello I'm using the riddell.us doco to setup slime. Getting Exception in thread "main" java.lang.NoClassDefFoundError: jline/ConsoleRunner?
21:32notyouravgjoelerm no no, I just wanted a simple way to return a random item from a list. not hard to implement, I know
21:32vjrThe jar is in .closure
21:32danlarkinChouser: re: object system: for conditions/restarts?
21:33Chouserdanlarkin: :-/ yeah
21:33vjrsorry .clojure
21:34danlarkinChouser: perk up!
21:34Chouser,(nth mylist (rand-int (count mylist)))
21:34clojurebotjava.lang.Exception: Unable to resolve symbol: mylist in this context
21:34notyouravgjoelthanks though =)
21:34Chouserhah. yeah, anyway, like that. no builtin.
21:34notyouravgjoelhaha, thats exacty what I did
21:35notyouravgjoelrandom note to the community: clojure is pretty sweet, I'm really enjoying using it
21:40danlarkinwoo hoo, I have hash-map lookups working in my django templating language!
21:41ryszard_szopawhat is the correct way to define an Exception class?
21:41ryszard_szopagen-class?
21:41Chouserryszard_szopa: I'm trying to make that unnecessary at this very moment.
21:42danlarkinryszard_szopa: you've stumbled upon a mole-hill
21:42Chouserryszard_szopa: but yes, gen-class or gen-interface
21:42Chouserand then you have to AOT compile
21:43ryszard_szopaChouser: could you please expand AOT?
21:43ChouserAhead Of Time
21:43Chouserhttp://clojure.org/compilation
21:44Chouseryou need it for bullet 3 on that page: generate named class
21:45ChouserI'd recommend avoiding custom Exception classes if you can. There's a large number of builtin ones available.
21:45Chouser~exceptions
21:45clojurebothttp://paste.lisp.org/display/74305
21:45ryszard_szopahum, do I understand correctly that the present state of affairs regarding exceptions is not what most people would desire?
21:46cemerickIllegalArg, IllegalState, and IOException are generally sufficient for 90% of all error conditions
21:46cemerickIMvHO, anyway
21:48ryszard_szopaI don't know a lot about Java, so I'm a little puzzled
21:48ryszard_szopain Python I am supposed to generate a new exception class every time I need it
21:48ryszard_szopaie. when there's no exception defined for that specific situation
21:48ryszard_szopais that not the case in Java?
21:49waltersthat is the case for Java (though reusing exceptions is also fine if there's one available)
21:50Chouserbut generating a new named class in Clojure is often more trouble than its worth
21:50cemerickI think it depends on what circles you travel in. That approach can get pathological pretty fast, and has in various libraries. CannotConnectToCustomServerForThisReasonException, etc
21:50Chouserand there are better options, just not fully realized yet...
21:50ryszard_szopaChouser: what did you mean when you said you were trying to make that unnecessary?
21:51walterscemerick: right, well i've seen people do exception + enum too
21:51ryszard_szopaChouser: are you implementing a common lisp like condition/restart thing or something?
21:51danlarkinryszard_szopa: I know what you mean about the difference coming from python
21:51ChouserCommon Lisp has a condition/restart system that has a superset of the features of Java exception handling, and I'm working on a lib to provide many (most) of those features for Clojure.
21:52Chouserincluding defining new error (condition) types without requiring AOT compilation.
21:52waltersa key difference with python is that python is source-interpreted (though it does have bytecode as a semi-implementation detail)
21:52ryszard_szopaChouser: and how is it going?
21:53Chouserwell, I've got the core of it sketched out, but now i'm on an object-system tangent that I don't like
21:53ChouserI've only been working on it for a couple evenings.
21:53cemerickwalters: that's just as crazy to me. Who's writing recovery paths for all of these statically-defined error conditions?
21:54ryszard_szopaChouser: doesn't the normal exception-handling mechanism interfere with what you are trying to do?
21:54Chouserpossibly. :-)
21:55walterscemerick: there weren't a lot; i forget where i saw it though
21:56cemerickwalters: I've seen some pretty pathological stuff. For that matter, http://paste.lisp.org/display/74305 is pretty bad as it is.
21:57walterscemerick: well, a large chunk of those are implementation bits
21:57ryszard_szopaChouser: good luck then. I am counting on you ;-)
21:57cemerickwalters: sure, but I won't let that blunt my rhetoric! ;-)
21:57walterscemerick: =)
21:58walterscemerick: but yeah, it's a valid point
22:25notyouravgjoelis there an else for cond?
22:26Chouserany true value will do. :else is conventional
22:26notyouravgjoelthanks
22:34cemericknotyouravgjoel: use :else as the always-true last "predicate" for cond
22:39notyouravgjoeljava.lang.ClassCastException: clojure.lang.PersistentList (hello-world.clj:0) any ideas?
22:40cooldude127paste it
22:42lisppaste8notyouravgjoel pasted "class exception problem" at http://paste.lisp.org/display/74902
22:42notyouravgjoelhttp://paste.lisp.org/display/74902
22:42notyouravgjoel=)
22:43vjrIs jline worth it?
22:43notyouravgjoelthe last line is the problem, I believe
22:43notyouravgjoelor, that's what causes it to fail
22:44danlarkinvjr: I use rlwrap
22:44vjrdanlarkin: thanks, i'll check it out
22:45notyouravgjoelah
22:46notyouravgjoeli think it is the cons
22:47arbschtnotyouravgjoel: yes, you're calling (currently-on) as a function
22:47notyouravgjoeloh my nevermind. That was moronic
22:47vjrfinally got jline to work. Not the worst hair puller by far but still annoying.
22:48danlarkinvjr: what platform are you on?
22:48vjrdanlarkin: mac os x
22:49danlarkinvjr: mmhmm, I've heard of annoyances on osx, that's why I use rlwrap and avoid it all together
22:49danlarkinsorry, altogether
22:49vjrdanlarkin: gotcha. so much to learn so little time.
22:49arbschtnotyouravgjoel: incidentally, for fns that are not overloaded, you can omit the extra parens. i.e. (defn foo [x] ...) instead of (defn foo ([x] ...))
23:01notyouravgjoel,-1/2
23:01clojurebot-1/2
23:09vjrdanlarkin: rlwrap works very nicely. Thanks.
23:09cemerickanyone know why gen-and-load-class is commented out?
23:10danlarkinvjr: *cheer*
23:10danlarkincemerick: replaced by :gen-class in the ns macro
23:11cemerickdanlarkin: hrm, not entirely, especially if one is generating a lot of classes and impls progammatically....
23:15Chousercemerick: generating classes is now only allowed when compiling.
23:15Chousernamed classes, that is.
23:17cemerickChouser: That's OK I think. I just need to have some shell of the class being generated loaded as well so that I can have type-hints right afterwards in the implementation fns.
23:18Chouserwell, you can call gen-class directly (you don't have to use :gen-class in the 'ns' macro)
23:18cemerickthat's the plan -- but by my reading, gen-class doesn't load the generated bytecode in addition to saving it...
23:20ChouserI think you're right. I wonder if that's intentional. Everything else that happens during compile is available for use immediately.
23:21Chouserwait, I've done this.
23:23Chouserwell, I can't find it now, but I think I was doing type hints in the same .clj file as I did the :gen-class
23:26cemerickyeah, we've been doing that, but it required using gen-and-load-class as well as gen-and-save-class at "compile" time in order for the subsequent import and type hinting to not fail
23:26cemerickif gen-class does load the generated bytecode (perhaps while it's on its way through the compiler itself), then all will be well
23:27ChouserI'm having a hard time thinking of why it shouldn't, but I don't see in the code anywhere that it does.
23:31cemerickyeah, that's why I was asking :-)
23:31cemerickI guess I'll just jump in and see how it goes
23:33cemerickOr, maybe: has anything developed of late in terms of being able to have some designated map instances automagically implement javabean properties based on key/value pairs?
23:34cemerickI wouldn't mind not bothering with my "genbean" gizmo if something better has come along in the interim.
23:34danlarkinheh, un-bean
23:35Chousercemerick: I don't think so, but Rich won't take any patches to struct maps. I think he wants it to do all your fanciness for you.
23:36cemerickChouser: I guess I got my patch into PersistentStructMap just in time, then :-)
23:38Chouserthis one's just sittin' there: http://code.google.com/p/clojure/issues/detail?id=46
23:39cemerickChouser: is there any particular reason why struct maps are a DMZ at the moment? Big plans?
23:40cemerickI remember he mentioned generating slots in struct maps as java fields, which would be pretty slick.
23:41cemerick...though Object.clone isn't the fastest thing in the world (probably slower than consing an array and doing arraycopy, actually)
23:41Chouseryeah, I seem to recall it was something along those lines.
23:42ChouserI don't know if he has solid plans or not, but I think he's pretty busy redoing seqs right now
23:43cemerickI'm much too far away from that to be happy or sad about it.
23:44ChouserI ought to try the lazy branch and see how much of my code breaks with nil punning gone, but I'm too ... lazy.
23:44cemerickwe're producing a lot of code lately, so I'm just trying to keep from tripping over breakage everywhere
23:44cemerickyeah, the loss of nil punning is going to be quite a shock, I think
23:45cemerickI *almost* feel like problems are being solved that I simply don't have, but I'm going to end up having to work with the solutions anyway, etc.
23:46cemerick'course, I barely figured out how to open the code editor after this last hiatus of mine :-)
23:47Chouseryeah, I understand that. I think it's telling though that both streams and lazier seqs require giving up nil punning.
23:47Chouserbut that's just about the only thing that either of them break
23:47cemericksee, I can't even conceptualize the difference between the two. My own little blub paradox.
23:48Chouserwhich makes nil punning itself seem like a bit of a fragile construct that we might be better off without anyway, to future proof our code.
23:48Chouseroh, they're very different. I can understand if you don't want to put in the time to grok them at this point though.
23:48Chouserdid you see the comparison Rich posted?
23:49Chouserhttp://paste.lisp.org/display/74721
23:49cemerickno. my unread clojure list folder has 1125 messages in it right now :-(
23:50Chouserstreams are very stateful, like normal-language iterators with 'next!' functions and such
23:50cemerick*gack*
23:51Chouseryeah. he packaged them all up so they're pretty safe, and apparently they run 2x faster than seqs
23:51cemericksee, lazy-cons and lazy-cat serve me *very* well. Pythonesque generators don't interest me much at the moment.
23:52Chouserthe lazy branch is a pretty minor tweak on what seqs already do. lazy-seq instead of lazy-cons, and you're not as likely to consume more than you need, even with deep pipelines.
23:52cemerickI guess I've got to be zen about it and all. Otherwise, I'm one of the arses that would go off and try to create "Common Clojure" or some nonsense. ;-)
23:52cemerickbad analogy, but it's late
23:52blbrownwhat does 'code should equal data' really mean. For example, http://paste.lisp.org/display/74903 here this data structure looks like a CSV file. Looks good to me, but at the same time, I feel like it contains bad desgn, say if I have to refactor the code.
23:53ChouserI haven't tried the lazy branch yet, but I don't think lazy-cons is going away in either branch. these are just new alternatives the provide performance and/or more laziness.
23:53Chousernil punning is just about the only victim
23:54cemerickI'm guessing that, barring hitting a bug, we'll be sitting on the current head for a while. Lot of deep diving into domain-specific stuff over the next month or so.
23:54cemerickI'm glad things are moving along so nicely though, community and organization-wise. I wish I could do more (or, anything), but things have been nuts for a while.
23:58blbrowncemerick, contribute by writing code and talking about it. That is what I am doing.
23:59cemerickblbrown: the code flows aplenty. We're still trying to be mostly stealthy about things until we figure out a variety of tech and business issues, though.
23:59cemerickI talk up clojure pretty constantly locally, though, via http://wmassdevs.com and other forums