#clojure logs

2008-12-05

00:15hiredmanclojurebot: latest is 1144
00:15clojurebotAlles klar
00:16clojurebotsvn rev 1145; made RT.DEFAULT_COMPARATOR use Util.compare
01:05bradbevI'm having trouble using compile because of classpath reasons. I have /foo/ in my classpath, and my file is /foo/bar/main.clj (compile 'bar.main) gives "No such file or directory (main.clj):1) I can't figure out what I'm doing wrong :(
01:08hiredmando you have ./classes in your classpath?
01:08hiredmanwell
01:08hiredmanit needs to be ./classes/
01:09hiredmanI think the last slash in important
01:11bradbevhmm, I've just found that
01:11bradbevand, no
01:11bradbevso I guess I should fix that....
01:13bradbevah, thanks - that was it
01:13hiredmannp
01:43bradbevmaybe I'm doing this wrong. What is the best way to compile AOT my clojure files? using (compile ...) or the standalone compiler?
06:38blackdogwherre can i find the syntax hilighter used on clojure.org?
07:53rhickeyI'm considering - auto mem-fning - given Classname.methodname in value position, create (possibly arity-overloaded) fn
08:23gnuvincehello
08:26rhickeygnuvince: hey
08:27tomhickeyblackdog: clojure.org is using Dan Webb's codehighlighter script, http://svn.danwebb.net/external/CodeHighlighter/
08:27blackdogah thanks
08:27gnuvincerhickey: how's it going?
08:28rhickeywell
08:28blackdogtomhickey, do you have a clojure style?
08:28blackdogfor addStyle()
08:28blackdogno worries i'll find it one the site
08:29tomhickeyblackdog: http://clojure.org/file/view/clojure.js
08:29blackdogok, thanks!
08:29tomhickeyit's not the best regex, but it works
08:30blackdognp
08:30gnuvincetomhickey: hopefully you had a script to generate that function regex ;)
08:31tomhickeygnuvince: with help from rich, yes ;)
08:47Chouserrhickey: cool! Constructors too? (map Integer. (.split "1 2 3"))
08:48rhickeyChouser: why not? (while we're talking vaporware ::)
08:48Chouser:-)
08:49rhickeyOnly considering this because if not overloaded on type for same arity, I can make non-reflective
08:50rhickeyso you'll want to map Integer/parseInt
08:51rhickeyhmm... longer than #(Integer. %)
08:51ChouserYou can tell at compile time that map will be passing in one arg?
08:52rhickeyNo, I'll make an arity-overloaded fn for all arities for method
08:52Chouseryeah, I noticed that. But 80% less line noise.
08:52Chouseroh, sure.
08:52rhickeyso, efficient, _and_ apply will work
09:10AWizzArdrhickey: what would the other solutions look like? One is efficient but doesn't work with apply?
09:11rhickeyAWizzArd: ?
09:13AWizzArdyou said it is efficient plus that apply will work
09:13rhickeyAWizzArd: what more could you want?
09:13AWizzArdIt sounded as if there was a solution where at least one of those two characteristics wouldn't be true.
09:13AWizzArdI like it :-)
09:13rhickeyyou can't apply methods now
09:14AWizzArdI am just curious what the alternative would be
09:14AWizzArdoh I see
09:14rhickeymemfn is reflective
09:14rhickeyas is jcall etc
09:59AWizzArd(def x {1 2 3 4}) <-- how can I flatten this into (1 2 3 4)?
09:59Chouser(apply concat x)
09:59AWizzArdsure, thx
09:59Chouserbut the pairs might come out in a different order
10:00AWizzArdright
10:00AWizzArdalthough a key/value pair will always be together
10:00Chouseryes
10:06AWizzArdIs JavaFX interesting? Today I read the first time about it.
10:08tomhickeyis there anything like merge that will also merge values if they are maps? e.g. i want (merge {:a {:x 1 :y 2}} {:a {:x 3 :b 2}}) to give me back {:a {:x 3 :y 2 :b 4}}
10:08rhickeyChouser: any better name for scanl for Clojure? just scan?
10:09blackdogit looks interesting but I'm a bit worried about the need to use a proprietary tool to create cross platform content, completely stupid - anyhoo, i think by using scenario.jar from clojure could get most of the same
10:09RSchulztomhickey: It sounds like you want a multimap
10:09rhickeyuser=> (merge-with merge {:a {:x 1 :y 2}} {:a {:x 3 :b 2}})
10:09rhickey{:a {:x 3, :y 2, :b 2}}
10:09RSchulzIt seems like multimap and multiset would be good things to have in Contrib.
10:10AWizzArdWhat is scanl doing?
10:10Chouser(scanl + 10 [1 2 3 4]) ==> (10 11 13 16 20)
10:10gnuvinceDid you guys catch the nice quote from Raganwald in his Ruby.rewrite(Ruby) pr�sentation?
10:10rhickeyRSchulz: I don't know that multimaps/sets are really different data structures, just functions that treat maps and sets a certain way
10:10gnuvince"Whatever feature your IDE gives you is a design flaw in your programming language"
10:11tomhickeyrhickey: thanks
10:11ChouserHaskell's scanr doesn't seem very clojury, but just 'scan' reminds me of reading from stdin in C
10:11RSchulzWell, multisets have to count their members, so they could be implemented with maps, of course, and multimaps can be maps whose values are sets.
10:11AWizzArdI think scanl is not too bad.
10:12rhickeyscanl = ick
10:12AWizzArdl stands for left?
10:12Chouserscanl is like reduce that emits a new item for each iteration
10:12RSchulzWhat is the "scanl" you're talking about. I don't see it anywhere.
10:12stuarthallowaywhy is the ordering in sets sometimes inconsistent when the sets contain identical data?
10:13rhickeyRSchulz: http://paste.lisp.org/display/68046#3
10:13stuarthallowayI know you can't count on the ordering, but it surprises me that it changes from one run to the next with identical data
10:13gnuvinceRSchulz: from Haskell
10:13Chouser'scan-reduce'?
10:13AWizzArdleft-scan, scan-left, scan-reduce
10:13RSchulzWhat's the concept?
10:14AWizzArdRSchulz: (04:10:28 PM) Chouser: scanl is like reduce that emits a new item for each iteration
10:14rhickeyreduce-seq?
10:14RSchulzHow is it not map, then?
10:14AWizzArdRSchulz: how does the map for (04:08:17 PM) Chouser: (scanl + 10 [1 2 3 4]) ==> (10 11 13 16 20) look like?
10:14ChouserRSchulz: did you see my example run above? try writing it with just 'map'
10:14rhickeyRSchulz: there's a propagation from one call to the next
10:15RSchulzI see.
10:15rhickeyreduce-keep
10:15RSchulzThe name is kind of arbitrary.
10:15ChouserI was actually using the name 'propagate' before rhickey reminded me we'd been over this before.
10:15RSchulzYes, reduce-keep is at least somewhat descriptive. Scan certainly isn't.
10:15rhickeyreduces
10:16Chouserooh
10:16Chouserif that's not too subtle, I like it.
10:17rhickeyreduces == as defined by my lazy scanl?
10:18Chousersure, how else would it be defined?
10:18AWizzArdsomething with a ,,-" inside sounds lispy, but is long. So reduces looks nicer to me
10:18rhickeyjust asking, you had a strict one and had been playing with it
10:19Chouseroh, eager? no. lazy is good.
10:19RSchulzMaybe "reducing"?
10:20AWizzArdreducify :-)
10:21AWizzArdstep-reduce
10:22rhickeyreduce [f init coll] - "Returns a lazy seq of the intermediate values of the reduction (as
10:22rhickey per reduce) of coll by f, starting with init"
10:22rhickeyer, reduces
10:23rhickeyreduction?
10:24AWizzArdthat sounds too much like reduce
10:24AWizzArdcondense
10:25gnuvinceWhat are we naming?
10:25gnuvincescanl?
10:25AWizzArdyes
10:25ChouserDoes it make any sense for 'init' to be optional as it is in reduce?
10:26rhickeyChouser: yes - you sending patch?
10:26Chouserheh. can do.
10:26gnuvincecontinuously?
10:26gnuvinceNah, doesn't work...
10:26rhickeyreduction
10:27RSchulz(As Marge Simpson said--funny, I was just thinking about that episode earlier--"Names are hard.")
10:27gnuvinceNot sure about reduction; you have reduce which returns a single value, so you'd expect reduction to do something similar.
10:27rhickeyI'm sure
10:28AWizzArdslash? taper?
10:28rhickeyit describes the process of reducing
10:28RSchulzCrush?
10:28Chousukeaccumulate? :/
10:28RSchulzToo side-effecty.
10:28RSchulzActually, though, accumulate doesn't sound bad.
10:29gnuvinceIt's not bad, but again, I feel that htis conveys that you'll get a final, atomic value.
10:29AWizzArdgnuvince: it sounds very much like reduce, yes
10:30rhickeyuser=> (reduce + 0 [1 2 3 4])
10:30rhickey10
10:30rhickeyuser=> (reduction + 0 [1 2 3 4])
10:30rhickey(0 1 3 6 10)
10:31RSchulz"Peephole?"
10:31RSchulzToo risque?
10:31AWizzArdI personally think that reduce sounds more like producing (0 1 3 6 10) and reduction will return the final reduction of this expression.
10:32AWizzArdreduction gives you the reduction, while reduce as a verb sounds more active imo
10:32gnuvinceI guess we can talk about this all day, but the BDFL has decided on reduction ;)
10:32RSchulzIs this function, whatever it ends up being called, going into Contrib? Core?
10:33rhickeyAWizzArd: It's not a subjective thing - reduction: the action of making something smaller, reduce: to make something smaller
10:34AWizzArdWhat about minify? ;-)
10:34Chousukemaybe call it "reductions" as it produces the reduction of every subsequence.
10:34AWizzArdalso nice
10:35AWizzArdbestest name so far
10:36RSchulzBut nothing is being made smaller here, is it?
10:37AWizzArd"reductions" even has the flair of lazyness
10:37RSchulzThere is no aspect of decreasing (-ness) about it, right?
10:37rhickeyRSchulz: reduce does, reduction is the enumerated process of reduce
10:37RSchulzYes, reduce does, but this new thing we don't want to call scanl does not.
10:38RSchulzAlso, does it generalize in any way to larger scopes over which the individually applied actions operate within the target sequence?
10:38RSchulzOr is it strictly pair-wise?
10:38rhickeyit is the intermediate results of reduce
10:39rhickeyi.e. the reduciton
10:39rhickeyreeduction
10:39rhickeyreduction
10:39AWizzArd*g*
10:39RSchulzNah. Spelling's only important to computers. And publishers.
10:39AWizzArdBtw, it is very cheap to rseq a vector yes? So reducing from the right side is no problem.
10:40rhickeyAWizzArd: for anything reversible, including vector
10:43RSchulzI wonder if mapcat offers a naming precedence that should be respected?
10:43RSchulz_precedent_, that is.
11:17drewolsoni'm having some AOT compilation issues. I'm trying to run a file consisting of unit tests. It's definitely in my path the java can't find it
11:18drewolsonare namespaces with "-" an issue in AOT?
11:18Chouserdrewolson: shouldn't be, but they are converted to "_" in class, file, and directory names.
11:18drewolsonChouser: yep, and i see the outputed classes are named exactly like that
11:19drewolsonhowever, when i run java, it doesn't want to find my class files
11:19drewolsonthe command is basically:
11:19drewolsonjava -cp clojure.jar:clojure-contrib.jar:classes:test/classes org.drewolson.test-foo
11:20drewolsonand the comipled test classes is sitting in test/classes/org/drewolson/foo
11:20drewolsons/comipled/compiled/
11:20Chousertry: org.drewolson.test_foo
11:20drewolsonk
11:20Chouserjava's expecting a class name there, which can't have "-"
11:20drewolsonthat did the trick, thanks :)
11:21Chousernp
11:23drewolsonhrm, still not convinced i'm actually running the file
11:24drewolsonno errors now, but i don't see any test output
11:24drewolsoni should be able to include :gen-class in my ns macro and then call (run-tests) from -main, correct?
11:28drewolsoni take that back, it's working fine
11:28drewolsonant just doesn't print output :)
11:40Chouserclojurebot: atom discussion is http://groups.google.com/group/clojure/msg/fd0371eb7238e933
11:40clojurebot'Sea, mhuise.
11:40Chouserclojurebot: brain dump?
11:40clojurebotbrain dump is http://clj.thelastcitadel.com/clojurebot
11:42Chouserrhickey: you saw cgrand's timing tests of vector vs. closure creation?
11:44drewolsonok, i'm going crazy: http://gist.github.com/32396
11:44drewolsonthat runs fine, but outputs nothing
11:44drewolsonthe tests aren't running and i have no idea why
11:49Chouserdrewolson: no output, or "Ran 0 tests"?
11:49drewolsonChouser: no output at all
11:50Chouserpre-compiled only, or also when run from .clj sources?
11:50drewolsonhow would i run this from the .clj sources?
11:50drewolsonwould main run?
11:51drewolsonright now i'm running the compiled code
11:51Chouseryou could start a clojure repl, then: (require 'org.drewolson.test-dragon) (org.drewolson.test-dragon/-main)
11:52drewolsonlet me give that a shot
11:53ChouserI think I'm reproducing your error, and I think it has to do with *test-out*
11:53drewolsonhrm, i see
11:53drewolsonChouser: yes, tests do run from the repl
11:55drewolsonChouser: i take that back...i see output, but it says "0 tests run"
11:55drewolsonsomehow, running (run-tests) from main is not seeing the deftest declarations
11:57Chouserdrewolson: yes, it looks like you have to say: (run-tests 'org.drewolson.test-dragon)
11:57drewolsonah, i see
11:58drewolsonChouser: ok, tests now run from the Repl, but still nothing running the compiled class from the command line
11:59drewolsonChouser: or, at least, i can't see the output, i'll look into *test-out*
12:00ChouserIf i write directly to *out* and *test-out* from inside the compiled -main, I see neither.
12:00Chouserbut prn works
12:00drewolsonhrm, very strange
12:01drewolsoni'm trying to get a feel for how i would unit tests apps in clojure, not sure how else to do it
12:02Chouserah, manual flush is required
12:02drewolsonChouser: not sure I understand, can you pastie?
12:02Chouserhttp://gist.github.com/32403
12:02drewolsonawesome, thanks
12:02drewolsongod bless gist
12:03drewolsonalthough hooks into irc would be nice. notification similiar to the lisp paste site you use
12:03Chouseryeah, I've not used it much. seems pretty nice, plus it even colors Clojure nicely.
12:03Chouserdrewolson: yes, if it had that, I'd definitely prefer gist.
12:03drewolsonyep.
12:04drewolsoni'm wondering how i would create a test suite, roll all my tests into a single run
12:04drewolsonbut have them in multiple files
12:04Chouserdrewolson: I've done nothing with test-is (or any other clojure test framework for that matter), so I'm the wrong one to ask.
12:05drewolsongotcha, thanks for the help
12:05Chouserif nobody else here chimes in, you could bring it up on the google group.
12:08drewolsonmaybe i'll see if i can actually write some code to solve it
12:09dudleyfI'm kind of leaning towards specjure for testing
12:09dudleyfbut I haven't used it extensively
12:09duck1123does anyone know if there is a gist mode for emacs?
12:09drewolsonduck1123: there is
12:09drewolsonduck1123: http://github.com/defunkt/gist.el/tree/master
12:10duck1123drewolson: thanks. I'll check it out
12:10drewolsonnp
12:10dudleyfheh
12:10dudleyfThe first result for "gist irc bot" is clojurebot
12:12hiredmanclojurebot: copious is <reply>pffft, I'll give you copious, hiredmn's free time is copious
12:12clojurebot'Sea, mhuise.
12:12hiredmanclojurebot: waht can you tell me about the copious amount of russian spam I recieve?
12:12clojurebotpffft, I'll give you copious, hiredmn's free time is copious
12:14RSchulzAnd now it knows a typo forever...
12:16RSchulzYeah, you reach inside its brainbox. Creepy.
12:16hiredmanactually I just privmsg...
12:17RSchulzIt's good you have such copious free time.
12:25hiredmanlisppaste8: url?
12:25lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
12:25blackdogi want to start with a map then conj onto it based on a variet of predicates - is there a nice way of doing that? it's almost like a (when) but it returns the original map if the predicate is false
12:26blackdogi guess a short macro will do the trick
12:27lisppaste8hiredman pasted "chute example" at http://paste.lisp.org/display/71645
12:30hiredmanoops
12:30hiredmanI missed a spot there
12:31lisppaste8hiredman annotated #71645 with "missed a spot" at http://paste.lisp.org/display/71645#1
13:13AWizzArdrhickey: What do you see as core parst that you still wish to see integrated into Clojure before 1.0?
13:54rhickeyChouser: I did see that - closure creation is fast, that's ok by me
13:56Lau_of_DKGood evening gents
13:56gnuvinceI'm not an agent, I'm a ref!
13:56gnuvince</retarded Clojure-related joke>
13:57Lau_of_DKhehe
13:57Lau_of_DKgnuvince: I had a horrible experience at work, where I said "Its wonderful to work with streams that are infinate in length.... unless you accidentally print them", and then I almost choked laughing, and when I stopped, I realise nobody else thought it was funny / knew what a stream was :(
13:58gnuvinceHahahaha
13:59technomancyheh
13:59gnuvinceLau_of_DK: without wanting to diss your co-workers, isn't that the root of the problem in the computer software industry: people who don't know?
13:59gnuvinceI'm not saying I'm better than other programmers, I'm definitely not.
14:00gnuvinceBut you wouldn't see a doctor asking what a CAT scan is...
14:00Lau_of_DKgnuvince: I think primarily the problem is actually religious attitude
14:01Lau_of_DK+s
14:01Lau_of_DKI have spoken with people who would defend PHP to death instead of looking twice at Lisp
14:02Lau_of_DKAnd Im not speaking CEO level or any such thing, but just programmers who have found their comfort zone, and love it
14:02technomancyLau_of_DK: see the first quote on this page: http://technomancy.us/27
14:02technomancyLeo Tolstoy agrees!
14:03gnuvinceLau_of_DK: yeah, it is a problem too, though one that I can understand.
14:04Lau_of_DKtechnomancy: My goodness, what a wonderful insightful quote
14:05Lau_of_DKBut I cant get annoyed, in the end it plays out to my advantage
14:05gnuvinceIf it doesn't turn into zeal, I guess it can be useful. "You can't do X in language Y" "Oh yeah?! <hack hack hack>"
14:06Lau_of_DK"Zeal is its own excuse"
14:08hiredmanhmmm
14:08Chousertechnomancy: great quotes!
14:08hiredmanclojurebot look up needs to be case insensitive
14:09technomancyChouser: thanks. I like the last one too. =)
14:09Lau_of_DKhiredman: Isnt ^i the regex suffix for case-ignorance?
14:09hiredmanclojurebot: Richard Stallman is <reply>who?
14:09clojurebotTitim gan �ir� ort.
14:09gnuvinceLau_of_DK: /foo/i
14:09Lau_of_DKk
14:09hiredmanLau_of_DK: but I am using keys in a hash for lookup
14:09Lau_of_DKgnuvince: you cant to that in ASM
14:10Lau_of_DKhiredman: so you gotta run it all in lower-case?
14:10hiredmanI think I will have to do that
14:10hiredmanbut, meh, later
14:10Lau_of_DKhhe
14:10Lau_of_DK+e
14:15hiredmanhttp://img.thedailywtf.com/images/ads/Learn-Lisp-small.png <-- learn lisp, only $75
14:17duck1123W.L. Whipple likes it
14:18duck1123"Interactively and Write Real Programs with TransLISP for Only $75"
14:18technomancywhat a deal.
14:19technomancy... and people wonder if you can go anywhere as a language using primarily proprietary implementations.
14:19technomancy"Sure you can, that's why everyone is using Smalltalk these days."
14:20Lau_of_DKI know this question has been asked a million times before, but besides viaWeb, what larger projects have been done in a Lisp ?
14:20technomancyEmacs. =)
14:20technomancyautocad is another big one
14:20Lau_of_DKtechnomancy: Emacs is written in C
14:20technomancyand there's that big airline scheduling system by ITA
14:20AWizzArdEmacs is written in Elisp
14:20technomancyLau_of_DK: Emacs Lisp is implemented in C.
14:21Lau_of_DKAWizzArd: Emacs is written in C, its a Elisp interpreter
14:21Lau_of_DKWe're repeating each other, but the answer is still, its not written in Lisp
14:21AWizzArdsome parts of it are written in c, yes
14:21technomancyITA definitely has the biggest Lisp system in production to my knowledge.
14:22duck1123most of the cool stuff I use in emacs *is* written in elisp
14:22technomancyunless some other folks are keeping it secret for a competitive advantage.
14:22AWizzArdI think ITA employs around 100 Lisp developers.
14:22Lau_of_DKuuh, cool
14:24technomancyanyway, there's significantly more lisp in Emacs than C, and since lisp is more expressive, the amount of functionality that's actually implemented in C is pretty slim.
14:24AWizzArdYes
14:24AWizzArdWe can say that Emacs is not purely written in Lisp
14:25AWizzArdWhat about Clojure? Is it written in Java or Clojure?
14:25AWizzArdWhich part is bigger?
14:25AWizzArdCurrently it's both, but the Clojure part is growing.
14:25technomancythe java part is bigger, but it's much less expressive
14:26technomancyplus everyone uses clojure contrib; that's got to count for something.
14:26AWizzArdrhickey probably has his reasons why he does not want to rewrite the java parts in Clojure, now as its compiler is bootstrapped.
14:26kotarakThere are two parts of Cojure: the Java part building the infrastructure and the core library running on the Java part.
14:26duck1123do you consider things like dired, erc, proced, etc. to be part of emacs, or applications that run on the emacs platform?
14:27Chousukehow much of emacs is non-elisp that doesn't actually involve interpreting elisp :P
14:28duck1123Chousuke: quite a bit, but I'm sure 3/4 of it could've been written in elisp
14:29ChouserClojure is written in Clojure and Java. The JVM is written in C (or perhaps C++), right? C++ is written in C++, C, and assembly. Assemblers are written in C and assembly. What was the point of this again?
14:29duck1123man, it's amazing the stuff you learn when you actually sit down and read the slime manual
14:29cemerickduck1123: just imagine all the stuff you'll need to unlearn eventually ;-)
14:29Chousukeit'd be cool if clojure were written purely in clojure, but that brings all kinds of bootstrapping problems.
14:29duck1123I was looking for a function that would allow me to build something... it's already there
14:30Chousukeyou'd still need a clojure implementation done in java to get it running :/
14:30duck1123Chousuke: but you only need one
14:30duck1123kinda like the head vampire
14:30AWizzArdin 2005 there was a study that analyzed in what languages programs for Debian where written in. Funnily Number one was C (57%), then came C++(16,8%), then Shell (9%) and on place 4 it was Lisp with 3% :-)
14:31Chousukeheh
14:31Chousukethat 3% was emacs.
14:31hiredmanheh
14:31hiredmanbeat me to it
14:31AWizzArdyes, and sbcl + cumcl
14:31AWizzArdbut mostly emacs
14:31AWizzArdhttp://www.dwheeler.com/sloc/
14:31Lau_of_DKguys this is really boring :)
14:32technomancyChousuke: wow; nice.
14:32hiredmanis anyone writing distrubuted message passing stuff for clojure?
14:32technomancyespecially when you consider how much less verbose lisp is
14:34hiredmanI am toying with something I will call "chutes and ladders" using xmpp
14:34hiredmanhttp://paste.lisp.org/display/71645
14:34Lau_of_DKhiredman: check lisp paste, someone pasted something a couple of days ago
14:34hiredmanexample little session
14:35AWizzArdLau_of_DK: you are the gui guy, I have a question and maybe you know more about it. Did you hear about this new JavaFX thing?
14:35AWizzArdAs in http://www.javafx.com/
14:36AWizzArdMy question is: can one use Clojure to write javafx apps, or is one forced to do it with JavaFX-Script?
14:37hiredmanholy crap
14:38hiredmanclojurebot is then less two weeks old according to lisppaste
14:38ChousukeAWizzArd: if you can use java to write them, you can use clojure
14:38Lau_of_DKAWizzArd: Im sorry, Ive not heard about javaFX
14:38technomancyhiredman: I remember suggesting you write him right when I joined the channel two Fridays ago. =)
14:38AWizzArdLau_of_DK: I also heard about it today for the first time. Seems interesting though, a flash/silverlight competitor
14:39duck1123I really like JavaFX's javadoc
14:39AWizzArdChousuke: I am not so sure. For example when you want to use the web framework Rife, then this rule is not true.
14:39Lau_of_DKBut I have made one of the most extensive .emacs known to man, incl. email, msn, irc, flymake, ya-snippet (intellisense), org-mode and much much :) When Im totally done, its back to Qt :)
14:39Lau_of_DKAWizzArd: I'll check it out
14:39AWizzArdChousuke: one can use .class files or .java files for Rife (as long the .class files where compiled with javac).
14:40AWizzArdyeah, please have a look at it, would be nice to know if this would be possible
14:40Chousukeso rife has some weird compiler dependencies then? :/
14:40AWizzArdI don't know this. I will maybe find out during the weekend.
14:40AWizzArdI just know that for Groovy they did some work, and since then Rife also can work with .groovy files.
14:41ChouserAWizzArd: so you've given up on Clojure + Rife?
14:42Lau_of_DKAWizzArd: JavaFX looks wild
14:42AWizzArdChouser: nope, not given up yet. I will write a detailed report (basically the description I showed you) to the Rife mailinglist. The author of Rife would like to reproduce it, to understand better what is going on.
14:49Lau_of_DKolgen: Hej Jacob, velkommen til
14:49olgenLaust?
14:49Lau_of_DKNej
14:49gnuvincemath question guys: natural numbers are the integers equal to and larger than 0? N = {x | x <- Z, x >= 0}?
14:49Lau_of_DKS� bare en anden dansker og t�nkte jeg ville hilse p�
14:50olgenah hehe
14:50olgenog tak
14:50Lau_of_DKgnuvince: I believe that group excludes 0
14:50Lau_of_DKolgen: np :)
14:51hiredmanhold on to your hats
14:51hiredmanhttp://en.wikipedia.org/wiki/Natural_number#History_of_natural_numbers_and_the_status_of_zero
14:51Lau_of_DKoops, blush
14:52hiredmanLau_of_DK: don't worry, I just did a quick edit to make you look wrong before pasting the url
14:52Lau_of_DKcool
14:52Lau_of_DK:)
14:52technomancyhiredman: I always wonder about that when people refer to wikipedia.
14:52Lau_of_DKIve never claimed to be smart, but Ive faked it a few times
14:53kotarakgnuvince: I encountered the notation N for natural numbers without 0 and N_0 including 0.
14:54gnuvinceThat 0 is a real nuisance
14:54gnuvinceWe should do away with it
14:54gnuvince;)
14:55kotarakIt was a major achievement to recognise it as "something".
14:55kotarakSince it represents actually nothing.
14:55technomancykotarak: you mean like the empty list in CL? =)
14:56kotarakHmm.. maybe more like nil? Don't know. Early notations from babylon showed a missing place as zero. But it was actually that: an empty place.
14:56technomancykotarak: in CL nil is the same thing as the empty list
14:56kotarakLater on someone came to the idea, that zero is more than an empty place.
14:59kotarakWow. I really have a talent to kill conversations...
14:59Lau_of_DKYes you've always been good at that :)
15:00kotarakmaybe I should go over to the lurker faction.
15:16danlarkinok guys I just read the past 2 hours of conversation. technomancy: I love the quotes on that page, hiredman: chutes & ladders looks very neat!, kotarak: no! stay away from the dark side
15:17Lau_of_DKphew, danlarkin broke kotarak spell which paralyzed the channel for 20 minutes
15:18kotarakLau_of_DK: Beware of the dark wizard. *muhahaha*
15:19kotarakLau_of_DK: See? It works. :|
15:22lisppaste8hiredman annotated #71645 with "code" at http://paste.lisp.org/display/71645#2
15:31technomancyis there an expected date for the JVM 7?
15:34Chouserblackdog: Sorry I didn't remember this til just now: (conj {:a 1} (when true {:b 2}))
15:37Chouseryou can have multiple 'when's in a single conj.
15:37Chouserthat only works on maps, though. your conj-when would also work on vectors, lists, etc.
15:39lisppaste8craigmcd pasted "Tracing Library" at http://paste.lisp.org/display/71656
15:40AWizzArdrhickey: What do you see as core parst that you still wish to see integrated into Clojure before 1.0?
15:45hiredmanAWizzArd: I think he that most of want he wants at this point is to get the code out so people can try it out at test it
15:45Lau_of_DKhehe
15:46Lau_of_DKYou think "he that most of want he wants" ?
15:46hiredman2008:Dec:01:12:10:16 rhickey technomancy: it's really almost done, just want to let people use the latest changes a bit and incorporate any feedback
15:46hiredmanhas
15:46hiredmanwhat ever
15:47gnuvinceShould functions like every? accept more than one collection? So you could say: (let [coll [1 2 3 4]] (every? #(= (inc %1) %2) coll (rest coll)))
15:48gnuvince(though that'd be best written as (monotonic? #(= (inc %1) %2) [1 2 3 4])
15:48AWizzArdthose colls could be concatenated
15:49AWizzArdoh, I see what you mean
15:49gnuvince?
15:49Chouserthat's not what he wants, though. he wants it to work like map
15:49gnuvinceChouser: exactly
15:49AWizzArdwell, then probably map+every
15:50hiredmanthat would be ugly
15:51AWizzArdI think the suggestion is nice, to have more than one sequence
15:51AWizzArdhttp://www.lispworks.com/documentation/HyperSpec/Body/f_everyc.htm
15:52Chouser(every? identity (map = (map inc coll) (rest coll)))
15:54AWizzArdChouser: do you really want two maps here?
15:55ChouserI think so. Would you prefer:
15:55Chouser(every? identity (map #(= (inc %) %2) coll (rest coll)))
15:55AWizzArdI think that could be more efficient
15:56ChouserI prefer the former unless I'm sure I need some extra performance.
15:56AWizzArdAlthough the Common Lisp way to do it is allowing any number of colls to every
15:57AWizzArdChouser: in a side effect free language the compiler could eliminate one map for us
15:58AWizzArdSo you can write it with two maps, but the coll is only traversed once.
15:58AWizzArdIn principle Clojure could do the same.
15:59AWizzArdBut people who won't play after the rules of functional programming might run into some nasty bugs this way.
16:12lisppaste8gnuvince pasted "Something like that" at http://paste.lisp.org/display/71658
16:15Chouserinteresting. I think I could get used to using that.
16:15gnuvinceThe implementation could probably be improved
16:16Chouseryeah, it's probably a bit slower.
16:17ChouserI suppose you could do that for everything that takes a predicate and a collection.
16:18gnuvinceProbably
16:18gnuvinceI might check it out this weekend.
16:21AWizzArdgnuvince: and for example when you have an IF in Lisp that returns true/false then you can easily replace it with (when ...) or (when-not ...)
16:22AWizzArdfor returning false I mean
16:22triddellblackdog: I just reviewed the jetty sample you put together for Lau. Did you write the iph.utils.servlets piece?
16:22AWizzArdyour (if expr then true) can also be written as: (and expr then)
16:22AWizzArd(and tuples (if ...))
16:22AWizzArd(and tuples (when .. ))
16:23gnuvinceAWizzArd: I find using explicit ifs clearer of my intentions than using and or or as control structures
16:23AWizzArdRich explicitly defined that as idiomatic for Clojure
16:23AWizzArdI asked him some days ago about it.
16:24gnuvinceI'll check it out during the weekend
16:24AWizzArdIt is idiomatic to use when and make use of the implicit return value of nil
16:24AWizzArdof false
16:24gnuvinceI'll use cond :)
16:25gnuvinceNo fighting!
16:25Chousukeif you have multiple different functions to use for "searching" an answer then I find 'or a very nice way of expressing that
16:26Chousukeespecially if you have a default value.
16:26lisppaste8Chouser annotated #71658 with "or use a helper" at http://paste.lisp.org/display/71658#1
16:28Chouserthat way the current 'every?', 'any?', etc. can stay nice and fast, but you can easily get your multi-collection behavior just by tacking an 'apply-map' on the front.
16:29AWizzArd(every? identity coll) is basically (apply and coll), but as and is a macro...
16:29ChouserAWizzArd: yes, I know.
16:31blackdogtriddell, yes i did
16:32gnuvinceGoing home
16:34triddellblackdog: I'm thinking about creating a simple json service layer in clojure for a GWT application using some Jetty servlets and maybe danlarkin's json library. Have you done anything similar? How are you doing database interaction?
16:35blackdogtriddell, yes, that's exactly what I'm doing - no gwt, but danlarkin;s json lib and the servlet
16:35blackdogi'm using clojure.contrib.sql
16:35blackdognothing fancy
16:37triddellblackdog: ok cool, thanks... I like the approach you took. looks nice. I also checked out the pure.js stuff which I hadn't seen before... that was interesting.
16:37blackdogwell ihope to keep it as simple as possible
16:44lisppaste8blackdog pasted "servlets" at http://paste.lisp.org/display/71662
16:44blackdogtriddell, that's a newer version
16:45lisppaste8blackdog annotated #71662 with "jsonp example" at http://paste.lisp.org/display/71662#1
16:46hiredmanclojurebot: servlets?
16:46clojurebotTitim gan �ir� ort.
16:46hiredmanclojurebot: servlets is http://paste.lisp.org/display/71662
16:46clojurebotAck. Ack.
16:47triddellblackdog: thx. I'll try that one for a spin soon :-)
16:51AWizzArdDo you see a more idiomatic way to do (for [x (range 100)] [x (* x x)]) than doing it this way?
16:52drewrIt doesn't look like I can throw an ad-hoc keyword arg in a binding form, can I?
16:52ChouserAWizzArd: looks good to me, for whatever that's worth.
16:52drewrPython: def foo(a, b, c=None): return (a, b, c)
16:53Chouserdrewr: you mean to mix positional and keyword ... no.
16:53drewrI can call foo(1, 2, 3) or foo(1, 2), etc.
16:53drewrChouser: OK, just making sure I wasn't missing something.
16:54AWizzArddrewr: in clojure you can have a function that takes keyword arguments, but then you must always specifiy all keywords. You could not say foo(1, c=4) but would have to say instead foo(a=1, c=4)
16:54drewolsonhey all, how can i set compile-path from the command line?
16:55AWizzArdI would be interested to know how to set it in swank-clojure :-)
16:56AWizzArdcurrently I always do something like (binding [*compile-path* "my/path"] ...) in the repl
16:56kotarakThe new repl-ln is awesome. :)
16:56kotarakGot Gorilla working with it. :)
16:56AWizzArdgrats
16:56dudleyfdrewolson: java -Dclojure.compile.path=/path ...
16:56Chouseryou can do (defn foo [a b & kw] (let [{:keys [c]} (apply hash-map kw)] ...))
16:56drewolsondudleyf: thanks
16:57AWizzArdChouser: yes, good
16:57drewrChouser: I was thinking about something like that. Thanks.
16:57AWizzArdif one regularily makes use of it a macro (def-kwfn foo ...)
16:58ChouserI think someone wrote a macro already for it, perhaps with extra features
16:58AWizzArdto remove the leak out of this abstraction
17:03drewrdefnk
17:04drewrdefn+
17:04Chouserhttp://groups.google.com/group/clojure/msg/51bb53ca077154f8
17:04Chousersomeone == Rich
17:04drewrrhickey is a freak with macros.
17:05Chouserhe notes elsewhere "(note: that macro could probably be done more simply now...)"
17:06AWizzArddrewr a macro really makes sense here. I don't find this very freakish in that case.
17:07AWizzArdwb vince
17:07Chouserclojurebot: keyword arguments is http://groups.google.com/group/clojure/msg/51bb53ca077154f8
17:07clojurebotc'est bon!
17:08drewrAWizzArd: I mean in general. Have you looked at for?
17:08Chouser'for' is indeed nuts. very useful, though!
17:08AWizzArddrewr: some weeks ago I read the full boot.clj
17:09AWizzArdDoes clojure have something like a pipe operator?
17:09kotarak->
17:09AWizzArd(def x (-> #(+ 3 %) #(* 2 %) inc)) ==> Exception
17:10kotarak(-> x (+ 3) (* 2) inc)
17:10AWizzArdIt's not really what I want
17:11kotarakcomp?
17:11AWizzArdnope, but (def x (apply comp (reverse [#(+ 3 %) #(* 2 %) inc])))
17:11drewolsonwhat is syntax for :methods in :gen-class, specifically the param types
17:11AWizzArd(pipe #(+ 3 %) #(* 2 %) inc)
17:12AWizzArdso that I can read from left to right
17:12AWizzArdsimilar to ->
17:12kotarak#(->% (+ 3) (* 2) inc))
17:13kotarakYou can define your own pipe: (defn pipe [& fs] (apply comp (reverse fs)))
17:13hiredmanAWizzArd: I wrote one of those too
17:14AWizzArdkotarak: your
17:14AWizzArdoops
17:14AWizzArdkotarak: your #(-> ...) is good
17:14Chouserdrewolson: there's an exampe at http://clojure.org/compilation
17:14AWizzArdnow it even looks like real currying :-)
17:14kotarakBeware: It always expans to (-> x (f y)) => (f x y).
17:15drewolsonChouser: all examples have no params it seems
17:16AWizzArdkotarak: that makes sense I think. Can you think of an example where one doesn't want that behaviour?
17:16Chouserdrewolson: oh, I guess so. param types belong in those empty [] brackets. are you having a problem?
17:16drewolsonChouser: so if my argument is a java.awt.Graphics
17:16AWizzArd(def x #(-> % (+ 3) (/ 2) inc)) - I would think: add 3, divide this by 2 and inc it
17:16AWizzArdand yeah, it does
17:16kotarakAWizzArd: "(-> x (/ 3 %))"
17:16Chouser[foo [java.awt.Graphics] String]
17:17AWizzArdkotarak: but it is what you suggested first: #(-> % (/ 3))
17:17drewolsonChouser: hrm, that's what I tried
17:17drewolsonlet me try again
17:17Chouserdrewolson: you got some kind of error?
17:18kotarakAWizzArd: that expands to (/ x 3), but what if you want (/ 3 x).
17:18AWizzArdthis makes no sense for piping
17:18AWizzArdI want to divide the result of the previous operation by 3
17:19drewolsonChouser: yes ... No matching field found: getSimpleName for class clojure.lang.Symbol (dragon.clj:1)
17:19drewolsonstrange
17:19Chouserdrewolson: can you paste your code and stack trace?
17:19kotarakAWizzArd: and maybe you want to divide 3 by the result of the previous operation sometimes.
17:19drewolsonyes, one second
17:19Chousukethat doesn't look very functional in style though :/
17:20drewolsonChouser: http://gist.github.com/32532
17:28Chouserdrewolson: Canvas already has a paint method with that signature.
17:29drewolsonChouser: right, we're trying to override
17:29Chouserno need to specify it in :methods
17:29drewolsonChouser: would i stil prefix the method with -
17:29Chouseryes
17:30drewolsonalright, i've done that paint doesn't appear to be called at all
17:30Chouser"The :methods option defines a new method foo not present in any superclass/interfaces."
17:30drewolsonmaybe i should actually READ the documentation
17:32Chouserdo you get a Canvas on the screen? my guess is no.
17:33drewolsonChouser: nope
17:34ChouserAre you sure you're using Canvas correctly?
17:35drewolsoni thought so, but it's not looking like it
17:37hiredmanclojurebot: gen-class?
17:37clojurebotNo, hiredman, you want gen-interface + proxy
17:37danlarkinfancyyyy
17:42danlarkinre: blackdog and triddell from an hour ago: how important is it to either of you for me to add a decoder? I received a really nice email from someone with a (mostly) working decoder based on java's StreamTokenizer. I'm considering including it as an interim before I get a fancier one together
17:42blackdogyea, I think it's useful
17:44blackdogit would be better to have all in one package
17:44Chouserdrewolson: either of these work for me: http://gist.github.com/32536
17:45blackdogi routinely use both
17:45ChouserI don't see text in the frame, but that's got to be a Java API issue, not a Clojure compilation or interop thing.
17:47hiredmanI have yet to use gen-class for that kind of stuff
17:47hiredmanI always use proxy
17:47danlarkinblackdog: what do you do for decoding ATM?
17:48blackdoghang on,let me check the file
17:49blackdogdoesn't have a license, I think i got it off the group somewhere
17:49danlarkinah sam colby's
17:50RSchulzAre all the modules in clojure.* meant to be (use)-able?
17:50RSchulz1:14 user=> (use 'clojure.zip)
17:50RSchulzjava.lang.IllegalStateException: replace already refers to: #'clojure.core/replace in namespace: user (repl-1:14)
17:50RSchulz.../clojure/zip.clj starts with:
17:50RSchulz(ns clojure.zip
17:50RSchulz (:refer-clojure :exclude (replace remove)))
17:51hiredmanRSchulz: yes, but that only excludes from the clojure.zip ns
17:51RSchulzBut am I supposed to be able to (use 'clojure.zip)?
17:51hiredmanyou need to exclude replace
17:52triddelldanlarkin: I'm just starting to think about a new project... but decoding support in the same package would be nice
17:52RSchulzSo I'm expected to read the source of Clojure core module to be able to use it??
17:52hiredmanactually
17:52kotarakRSchulz: I always use (require '[clojure.zip :as zip])
17:52kotarakRSchulz: certainly not.
17:52RSchulzWhen is (use ...) appropriate and when is (require ...) called for?
17:52hiredmanRSchulz: looks like you defined your own function called replace in the user ns
17:53RSchulz(Not that I don't need to read a _lot_ of Clojure code!)
17:53hiredmaner
17:53hiredmannm
17:53RSchulzNope. I started again from scratch and did the (use ...) and got the same diagnostic.
17:53hiredmanyeah
17:53hiredmanI misread
17:53kotarakRSchulz: always require, use only with :only. As a rule of thumb.
17:54RSchulzIt seems that clojure.zip should rename the conflicting functions in its public interface, no?
17:55RSchulzBecause (if I'm not mistaken) that require _is_ part of its public interface.
17:55danlarkintriddell, blackdog: ok then, I think I'll include this contribution I was sent... at least until kotarak gets me a parser-combinator library I can use :)
17:55RSchulzAnd if not, it should be defined private, right?
17:55drewolsonChouser: sorry, was away
17:56RSchulz... Sorry, I meant to say "that (version of) _replace_ is part of the public interface".
17:56kotarakdanlarkin: heavily working on the monad part.
17:57kotarakdanlarkin: want to get this right. The parser code is currently a total mess.
17:58danlarkinkotarak: I fully understand :) I have subscribed to your updates on bitbucket
17:58kotarak:)
17:58drewolsonChouser: the first snippet from the gist works for me, however no text appears in the frame
17:59hiredman.repaint?
18:00hiredmanI remember something like this
18:00hiredmanmaybe I called .pack and that made stuff render?
18:03triddellquestion: does slime/swank pickup jars from any default locations and add them to the classpath? I used to use (setq swank-clojure-binary "/path/to/script") to start slime. That just broke when I updated to the most recent. Using (setq swank-clojure-jar-path "/path/to/clojure.jar") works but it also includes jars in the classpath that I was previously using the script to include.
18:03triddellthe included jars are in ~/.clojure directory
18:05triddellso, things seem to work but I'm wondering how it is picking up the jars for the classpath without me explicitly setting it up
18:08hiredmantriddell: the clojure swank looks in ~/.clojure and adds the jars there to the classpath
18:08gnuvince_Damn...
18:08gnuvince_I just saw that map is defined in terms of every? :-/
18:09triddellhiredman: ok, thanks... thought I was crazy for a second
18:10hiredmanclojurebot: please explain this whole "jar directory" thing to me
18:10clojurebotjar directory is -Djava.ext.dirs=$LIBS
18:20gnuvince_Chouser: I think we can forget the modification to every? for now
18:38danlarkinWhy does (re-find #"[eE][+-]?" "4e+4") == "e+"? I expected + to need to be escaped, is it because it's inside [] that it doesn't?
18:40RSchulzdanlarkin: Correct
18:40RSchulzSince + is positive closure which is not meaningful inside a character class, you don't have to escape it.
18:41RSchulzHowever, if you want to use a hyphen _literally_ inside a character class, you have to put it first.
18:41RSchulz... At least you used to in old ASCII-limited REs...
18:41hiredmanhuh
18:41hiredmangood to know
18:42hiredman(- 3 2)
18:42clojurebot1
18:42RSchulzI guess that (the hyphen bit) is _not_ true in Java REs.
18:43RSchulzBut do keep in mind that [a-z] means a, b, c, d, ..., x, y, z.
18:44danlarkinRSchulz: oh true, tricky. Makes sense that it should come first then
18:45RSchulzThat was the old way. It used to be that if you left off the end of the range, it would default to "infinity" (the end of the ASCII 7-bit range).
18:45RSchulzOh, the good old days.
18:45hiredmancute
18:48danlarkinso why does (re-find #"[eE][\+-]?" "4e+4") still match "e+"? Because it's looking for a backslash too? If that's the case why does (re-find #"[eE][+-]?" "4e\\4") only match "e"?
18:50RSchulzBecause the ? is tighly binding. It applies only to the [\+-]
18:50RSchulzWait. That's not right.
18:50RSchulzYou can escape non-special characters. It just leaves them as they were.
18:51danlarkinah, so the plus is a plus
18:51RSchulzInside character classes, there are only two special character, the ^ when first (to invert) and the - when neither first nor last, to specify a range.
18:53danlarkinand \, right?
18:54RSchulzThe java.util.regex.Pattern JavaDocs are a reasonable synopsis, but keep in mind that "Mastering Regular Expressions" is in its third edition. The 2nd ed. is 462 pages...
18:55RSchulzBackslash is significant only when it directly precedes one of the otherwise special occurrences.
18:55danlarkin:)
18:55danlarkinregular expressions master _you_
18:55RSchulzActually, I lied (again)... There are more special character-class notations oriented around set arithmetic.
18:56RSchulzIt can get pretty funky, but it's not that hard to understand, if you really need such esoterica. Check out the JavaDocs.
18:57RSchulzYou know, I love REs and I've been using them for a very long time (since I started out on v6 Bell Labs Unix), and still I rarely get non-trivial ones right on the first go-'round.
18:58danlarkinour brains don't function well pretending to be state machines
19:00RSchulzEh? My brain _is_ a state machine.
19:00RSchulzLast I checked...
19:00RSchulzWhich explains all the bugs in my code, I suppose.
19:04charlesg3any chimp users out there?
19:04RSchulzI have one of those helper monkeys like Homer Simpson got once.
19:27aperottehello all, I wanted to know if someone could help me out with the new gen-class
19:27aperotteI'm trying to extend an abstract class
19:28aperottewith one method that needs to be implemented and one ancestrally inherited field that needs to be exposed
19:29danlarkincharlesg3: I don't use vi/vim myself but there's a project called gorilla that you may want to check okut
19:29danlarkins/okut/out
19:29charlesg3I just got chimp working... I was a little put off by the "expect problems" warning on the gorilla page
19:29charlesg3but I guess I may try that out well anyway, thanks though
19:31hiredmanmost of the dudes here about are emacs users
19:31hiredmanclojurebot: what do you think of emacs?
19:31clojurebotuggada buggada
19:32technomancywhat's that mean?
19:32Chousukeclojurebot probably doesn't think much
19:32technomancytrue
19:50Chouseraperotte: it's not working?
20:03aperotteChouser: I used (ns ... (:gen-class)) and that evaluated without any errors
20:03aperotteChouser: but then I tried to define an instance of the class
20:03aperotteChouser: and it gave me a java.lang.ClassNotFoundException
20:05aperotteChouser: do I necessarily have to define the methods before creating a new instance?
20:09aperotteChouser: I have to run, but thanks for offering to help.
20:27rhickeyChouser: thanks for writing up the watchers thing
20:28Chousersure. I hope the point wasn't lost in my wordiness.
20:28rhickeyno, it was very good
20:28Chouserok, great. I nearly deleted the first half or so.
20:30rhickeyI think that separation of concerns is important - I haven't liked how other sends have crept into my actions
20:30rhickeyI want to refine and unify the watcher/reaction/effect concept to the other vars
20:31rhickeyer, references, not vars
20:31Chouser:-) watchers on refs seem like they'd be very natural.
20:32Chouserpre-1.0 on that?
20:33rhickeyI don't know - kind of wary of the import people are putting on 1.0. My main concern is to get past breaking changes, not freeze forward motion
20:33mfredrickson_what is the best way to create disjoint types in Clojure?
20:33mfredrickson_e.g. (my-type? x) => true
20:33mfredrickson_(list? x) => flase
20:34rhickeyOne breaking change is coming in this area - validators will be supplied with keyword args (ref 42 :validator blah), leaving room for other reference options
20:34mfredrickson_even if I really want my-type to be a list (for now)
20:34ChouserI'm asking, at least in this case, to get a sense of timing. I imagine the release will cause a bit of a stall because of doc updates, etc.
20:35rhickeyI work on things given time and inclination - these days atoms, wrapping queues, watchers, maybe Class/method fns - small things
20:36Chouserok
20:36rhickeyreminds me I've got to get reduction in - did you match reduce on zero and one args?
20:36Chousermfredrickson_: why do you need 'list?' to return false?
20:37mfredrickson_i suppose I don't. information hiding - the implementation
20:38Chouserrhickey: do you mean 2 and 3 args? collections with count of 0 and 1?
20:38mfredrickson_Chouser: not a big deal. mostly an idle thought
20:39Chousermfredrickson_: have you looked at 'derive' and 'isa?'
20:40mfredrickson_Chouser: thanks. this is my first programming with Clojure. I'm porting a scheme lib I wrote
20:40mfredrickson_i'll take a look at those
20:42ChouserI haven't needed them for anything real, but they're pretty powerful.
20:43Chouserhalloway's section on multimethods covers them really well.
20:43Chouserrhickey: have you seen that chapter yet? I was impressed.
20:44Chouserhm, looks like reduction with no init and a zero-length coll may be wrong.
20:46Chouser(reduce + []) ==> 0 but (reduction + []) ==> nil ... should that be (0)?
20:52rhickeyChouser: that's the question
20:53rhickeyreduce with no args calls f with no args
20:55rhickeysorry not no args, no elements and no init
20:57rhickeycopied that from CL, where I presumed it was there for a good reason. Probably no good reason to deviate from reduce with reduction, as then it can be described in terms of reduce
21:01Chouserin all other cases, though, reduction returns the same number of elements as the input collection. Should it deviate from that for zero-length collection?
21:02Chouseroh, that's not ture
21:02Chousertrue
21:04rhickeyI think you should follow reduce
22:02Chouserbother. that lastest reduction differs from haskell's scanl1
22:05Chouserwith no init, scanl1 includes the first element of the coll
22:05Chouserwhich seems right to me
22:06Chouseramazing how much I can mess up so few lines of code.
22:06hiredmansounds good
22:17heathIs anyone familiar with the general procedure for getting something into clojure.contrib?
22:22danlarkinclojurebot: brain dump?
22:22clojurebotbrain dump is http://clj.thelastcitadel.com/clojurebot
22:24Chouserheath: probably start with sending in a CA
22:25heathSorry, the only acronym I'm coming up with is Certificate Authority :)
22:25Chouserheath: http://clojure.org/contributing
22:27heathGotcha, saw that. I don't think I'm going to be a regular contributor - I just have a complete JSON lib that I think would be useful up there
22:28Chousercontrib requires the Contributor Agreement as well
22:28heathThough now that I think of it, if it's a liability issue then skirting the paperwork doesn't help anyone out I suppose
22:30Chouseronce that's in, I'd try posting to the google group with your code attached
22:30heathChouser: I asked a question about a week ago, but I noticed that you were in the middle of a conversation with rhickey
22:31heathMore clearly, the question is this: I have a horrible, ugly function:
22:31heath(defn is-non-json-value? [value] (get {:comma true, :colon true, :end-object true, :end-array true} value))
22:31heathThat I would like to replace
22:31heathFor the life of me I can find the canonical way to determine if a value is a member of a collection
22:32heath%s/can/can't
22:32Chouser(def is-non-json-value? #{:comma :colon :end-object :end-array})
22:32heathThis function takes all sorts of values, not just keywords
22:33heathMy bad
22:33heathJust tried it, could have sworn that threw an exception when you sent a non-keyword value at it
22:33heathThank you very much...
22:34Chousersets, maps, and vectors can be using in function position.
22:34Chouseryou're welcome
22:35RSchulzKeywords, too.
22:35RSchulzIf their arguments are sets or maps.
22:35ChouserAnd Symbols!
22:36RSchulzActually, regardless of their argument.
22:36RSchulzSo simple. So elegant. So useful.
22:37heathThis is what I did that made me think it could only handle keywords: (defn is-non-json-value? [value] (value #{:comma :colon :end-object :end-array}))
22:37Chouserah, yep.
22:37heathThat makes sense now. Very clever facility :)
22:37RSchulzYes, not everything can be a function.
22:37RSchulzBut keywords, maps and sets are functions of anything.
22:38RSchulzTotal functions, in the mathematical sense.
22:39heathI realize that this has probably been hashed out before, but is there any plan in the Clojure community to have a central directory of non-clojure.contrib libraries?
22:39RSchulzYou mean non-official contribute libraries?
22:39heathYes
22:39RSchulzWe don't really need non-Cojure code...
22:39RSchulzIn a sense, the Google group file upload are is that.
22:40Chouserick
22:40RSchulzAnd there's paste.lisp.org (if I have that name right).
22:40RSchulzAnd nothing stops people from just posting stuff.
22:40RSchulzAnd there's the Wiki.
22:40Chouserthere has been talk of a project-hosting site targetting Clojure in particular.
22:40RSchulzThe thing about the Clojure core and Contrib are that authors must file a contributor agreement with Rich, first.
22:41RSchulzIt's much more of an official repository.
22:41heathRight
22:41heathWhen the community grows larger, I imagine that more and more people are going to try to avoid that bottleneck
22:42RSchulzSure. And there will Google Code projects. And SourceForge projects. And magazine articles. And on and on.
22:42RSchulzI have little doubt that Clojure will have a long lifetime.
22:42heathI'm trying to think of other languages that have a 3rd party place for libs... I guess CPAN?
22:42ChouserRSchulz: 100 years? :-)
22:42RSchulzAnd many users and a lot fo open-source libraries and applications of various sorts.
22:42heathNot if Paul Graham has his way :)
22:42RSchulzWell, I don't make predictions about things that will outlive me...
22:43RSchulzActually, I'm not much of a prognosticator.
22:43RSchulzBut I think anybody in these parts is probably pretty confident that Clojure is not just a flash-in-the-pan, fad type thing.
22:43RSchulzDoes Graham have something against Clojure?
22:43heathTo put my previous question in context: JSON is a pretty important thing in a standard library these days
22:44RSchulzNIH, perhaps?
22:44heathGraham is shooting for Arc to be the 100 year language
22:44heathAs far as I know there's no animosity, however
22:44RSchulzSure. And JSON is eminently compatible with Clojure. I have a parser and writer for it.
22:44waltersRSchulz: i'm pretty convinced at least that new languages are going to embrace a STM and readonly data structures
22:44Chouserboth Graham and Yegge have acknowledged Clojure's existance while admitting they know nothing about it.
22:44RSchulzSo in a sense, I have it supported in Clojure, though I'm working on eliminating the seams, right now.
22:44heathHave you released it anywhere?
22:45RSchulzNo. So far, the bulk of my work is proprietary. We're a tiny operation, and have not yet decided to go open-source.
22:45heathI went looking for a JSON lib, and all I found were a couple of writers
22:45danlarkinheath: I also have one, http://github.com/danlarkin/clojure-json/tree/master -- doesn't have a decoder ATM but I'm working on it as we speak
22:45RSchulzActually, the parser, which uses ANTLR, is derived form an open-source example from the ANTLR parser repository, so you could always start with that.
22:46heathdanlarkin: Yes, that's one I found
22:46RSchulzAfter all, JSON is pretty simple to parse.
22:46heathCompletely
22:46RSchulzAlso, the underlying data structures are one-off, in a sense.
22:46RSchulzThe parser is no good without them.
22:46heathWriting one was a great intro to Clojure, actually
22:47heathAnyway, but I was originally trying to get a CouchDB project going, got two steps in and then discovered that there's no JSON in clojure.contrib
22:47RSchulzwalters: I think it remains to be seen how well STM scales. I am pretty certain that bare-bones threading as it exists in Java is _not_ going to be how we conquer concurrent l/ parellel programming.
22:47ChouserA directory or clojure libraries would be pretty useful.
22:47RSchulzWhat will supplant it, I don't know.
22:48waltersRSchulz: right, well there is also distributed map/reduce hadoop type model that we'll likely see more
22:48heathGithub is kind of my first place to look now
22:48danlarkinheath: interested in collaborating on that couchdb library? That's what motivated me towards a json library too
22:48RSchulzThere's some kind of JavaScript something, I though. Some sort of Clojure -> JavaScript translator or something?
22:49heathThere's a copy of clojure.contrib up on Github for some reason
22:49heathWhich I think tells you something...
22:49heathdanlarkin: Sure
22:49heathdanlarkin: I was originally going to contact you with the parser side of your JSON lib
22:50danlarkinwell the one I plan on committing soon uses StreamTokenizer which is less-than-optimal
22:50heathdanlarkin: Got carried away :) Your writer is nicer than mine: indentation, and the writer option
22:50danlarkinso there's much room for improvement
22:50ChouserRSchulz: are you referring to ClojureScript?
22:51heathMine basically just (first) and (rest)'s it's way through a string
22:51RSchulzI think it's tojs.clj
22:52RSchulzYes. The package is apparently clojurescript.
22:52ChouserRSchulz: that's the one. poorly documented.
22:52RSchulzI don't know what it does, really.
22:52heathIt's slow (about half the speed of an equivalent Python lib)
22:52danlarkinRSchulz: it's chouser's baby
22:52RSchulzWell, I'm like a broken record with Open Source projects on this point, but almost everything is poorly documented if you ask me...
22:52mfredrickson_how does one add methods to (* ...) ? Is it a multi?
22:53RSchulz; Reads Clojure code and emits equivalent JavaScript
22:53RSchulz...is not good enough documentation for you?
22:53heathdanlarkin: here's the code in case you're interested: http://elesi.org/json.clj
22:53ChouserRSchulz: it's good enough for me. :-)
22:54waltersthat is one nice thing about FOSS Java, the culture has a strong doc bent
22:54RSchulzmfredrickson_: I think multiplication a plain function. You're going to be able to extend it using the multimethod approach unless you replace / supplant it entirely.
22:54heathdanlarkin: To answer your question, yes, collabing on a CouchDB lib would be excellent
22:54RSchulzI'm not sure how practical that is for things in the core.
22:54RSchulzWoops.
22:54mfredrickson_RSchulz: did you miss a "not" in there? I think I follow
22:54RSchulzYou're _not_ going to be able to extend it...
22:54heathdanlarkin: I'm porting my site off of Google App Engine (holy unstable!), and it's a perfect fit
22:55mfredrickson_RSchulz: well shucks, but thanks
22:55RSchulzHoly... Some typos are a lot funnier than others.
22:56danlarkinheath: aye I know, it's a very smart design
22:56RSchulzI know of at least one core package that replaces two clojure.core functions, so I guess it's not impossible.
22:56RSchulzBut you'd have to totall take over multiplication, including for rationals, primitives and BigIntegers.
22:57kwertiiIs there any way to dynamically load .jars from within a Clojure program, or do you need to specify them in advance on the Java command line?
22:58heathdanlarkin: Just realized, that code up there won't run. Halfway done integrating Chouser's function...
22:58RSchulzCheck out (add-classpath ...)
22:59RSchulzTechnically, only classes are dynamically loaded. JARs just supply one or more classes for when the classloader decides they're needed.
22:59kwertiiRSchulz: awesome. thanks!
23:00Chouserbe careful with add-classpath, though -- use it too much and rhickey might take it away. :-)
23:00RSchulzNah. Just don't tell him about it.
23:00mfredrickson_RSchulz: do you think rhickey would take a patch to turn all math into multi methods? love it or hate it operator overload is here to stay
23:00RSchulzUnless you think he's got a snoopbot here...
23:00Chousermfredrickson_: nope. too slow
23:00RSchulzWell, I can't say, but you'd want to discuss it on the list first. Probably not, though.
23:01mfredrickson_Chouser: JIT? but yes, i'll get on the list and ask
23:01RSchulzExactly how much is the rock-bottom added overhead of a multimethod dispatch over a plain function call?
23:01RSchulzI figured at a minimum it's an extra function call, right?
23:02Chousercold cache it has to do 'isa?' which I think involves some kind tree search.
23:04RSchulzIs the isa? part inherent? That's the basis of the comparison between the result of the dispatcher and the individual method signatures?
23:04RSchulzSo there's at least two extra calls?
23:05RSchulzOne to compute the dispatch value and another to check the isa? And the latter is done repeatedly until a success is found?
23:05RSchulzThat does seem a bit excessive...
23:05Chouserbut even with a hot cache it would have to check the cache and make antoher function call
23:05kwertiiChouser: one of the big selling points is dynamicity, no? must I know in advance what libraries my program may require? ;)
23:05RSchulzYou could use one of the rapid sub-type tests. I implemented one for my theorem prover. The dispatch cost is amazinly low.
23:07RSchulzkwertii: Well, I think well in excess of 90% of all programs use fixed libraries. Only things like servers and servlet containers have dynamicity at that level.
23:07RSchulzBut I doubt (add-classpath) or an equivalent will go away permanently.
23:08RSchulzAnd you can always go around Clojure and deal with the underlying JVM facilities directly, if necessary.
23:08kwertiianother angle: what about REPL dev in SLIME? I will write many different programs; each one needs different libs... so without that, I have to go edit my .emacs to put whatever jars that particular program needs on the command line.
23:08RSchulzI don't know. You'll have to ask an Emacser.
23:09RSchulzThough once it's working, I guess the same issues will exist for Enclojure and whatever Peter Wolf comes up with for IDEA.
23:13danlarkinhiredman: this looks an awful lot like your room... http://www.viceland.com/int/v14n8/htdocs/anti/2_large.jpg