#clojure log - Dec 05 2008

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

0:15 hiredman: clojurebot: latest is 1144

0:15 clojurebot: Alles klar

0:16 svn rev 1145; made RT.DEFAULT_COMPARATOR use Util.compare

1:05 bradbev: I'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 :(

1:08 hiredman: do you have ./classes in your classpath?

1:08 well

1:08 it needs to be ./classes/

1:09 I think the last slash in important

1:11 bradbev: hmm, I've just found that

1:11 and, no

1:11 so I guess I should fix that....

1:13 ah, thanks - that was it

1:13 hiredman: np

1:43 bradbev: maybe I'm doing this wrong. What is the best way to compile AOT my clojure files? using (compile ...) or the standalone compiler?

6:38 blackdog: wherre can i find the syntax hilighter used on clojure.org?

7:53 rhickey: I'm considering - auto mem-fning - given Classname.methodname in value position, create (possibly arity-overloaded) fn

8:23 gnuvince: hello

8:26 rhickey: gnuvince: hey

8:27 tomhickey: blackdog: clojure.org is using Dan Webb's codehighlighter script, http://svn.danwebb.net/external/CodeHighlighter/

8:27 blackdog: ah thanks

8:27 gnuvince: rhickey: how's it going?

8:28 rhickey: well

8:28 blackdog: tomhickey, do you have a clojure style?

8:28 for addStyle()

8:28 no worries i'll find it one the site

8:29 tomhickey: blackdog: http://clojure.org/file/view/clojure.js

8:29 blackdog: ok, thanks!

8:29 tomhickey: it's not the best regex, but it works

8:30 blackdog: np

8:30 gnuvince: tomhickey: hopefully you had a script to generate that function regex ;)

8:31 tomhickey: gnuvince: with help from rich, yes ;)

8:47 Chouser: rhickey: cool! Constructors too? (map Integer. (.split "1 2 3"))

8:48 rhickey: Chouser: why not? (while we're talking vaporware ::)

8:48 Chouser: :-)

8:49 rhickey: Only considering this because if not overloaded on type for same arity, I can make non-reflective

8:50 so you'll want to map Integer/parseInt

8:51 hmm... longer than #(Integer. %)

8:51 Chouser: You can tell at compile time that map will be passing in one arg?

8:52 rhickey: No, I'll make an arity-overloaded fn for all arities for method

8:52 Chouser: yeah, I noticed that. But 80% less line noise.

8:52 oh, sure.

8:52 rhickey: so, efficient, _and_ apply will work

9:10 AWizzArd: rhickey: what would the other solutions look like? One is efficient but doesn't work with apply?

9:11 rhickey: AWizzArd: ?

9:13 AWizzArd: you said it is efficient plus that apply will work

9:13 rhickey: AWizzArd: what more could you want?

9:13 AWizzArd: It sounded as if there was a solution where at least one of those two characteristics wouldn't be true.

9:13 I like it :-)

9:13 rhickey: you can't apply methods now

9:14 AWizzArd: I am just curious what the alternative would be

9:14 oh I see

9:14 rhickey: memfn is reflective

9:14 as is jcall etc

9:59 AWizzArd: (def x {1 2 3 4}) <-- how can I flatten this into (1 2 3 4)?

9:59 Chouser: (apply concat x)

9:59 AWizzArd: sure, thx

9:59 Chouser: but the pairs might come out in a different order

10:00 AWizzArd: right

10:00 although a key/value pair will always be together

10:00 Chouser: yes

10:06 AWizzArd: Is JavaFX interesting? Today I read the first time about it.

10:08 tomhickey: is 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:08 rhickey: Chouser: any better name for scanl for Clojure? just scan?

10:09 blackdog: it 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:09 RSchulz: tomhickey: It sounds like you want a multimap

10:09 rhickey: user=> (merge-with merge {:a {:x 1 :y 2}} {:a {:x 3 :b 2}})

10:09 {:a {:x 3, :y 2, :b 2}}

10:09 RSchulz: It seems like multimap and multiset would be good things to have in Contrib.

10:10 AWizzArd: What is scanl doing?

10:10 Chouser: (scanl + 10 [1 2 3 4]) ==> (10 11 13 16 20)

10:10 gnuvince: Did you guys catch the nice quote from Raganwald in his Ruby.rewrite(Ruby) pr�sentation?

10:10 rhickey: RSchulz: I don't know that multimaps/sets are really different data structures, just functions that treat maps and sets a certain way

10:10 gnuvince: "Whatever feature your IDE gives you is a design flaw in your programming language"

10:11 tomhickey: rhickey: thanks

10:11 Chouser: Haskell's scanr doesn't seem very clojury, but just 'scan' reminds me of reading from stdin in C

10:11 RSchulz: Well, 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:11 AWizzArd: I think scanl is not too bad.

10:12 rhickey: scanl = ick

10:12 AWizzArd: l stands for left?

10:12 Chouser: scanl is like reduce that emits a new item for each iteration

10:12 RSchulz: What is the "scanl" you're talking about. I don't see it anywhere.

10:12 stuarthalloway: why is the ordering in sets sometimes inconsistent when the sets contain identical data?

10:13 rhickey: RSchulz: http://paste.lisp.org/display/68046#3

10:13 stuarthalloway: I 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:13 gnuvince: RSchulz: from Haskell

10:13 Chouser: 'scan-reduce'?

10:13 AWizzArd: left-scan, scan-left, scan-reduce

10:13 RSchulz: What's the concept?

10:14 AWizzArd: RSchulz: (04:10:28 PM) Chouser: scanl is like reduce that emits a new item for each iteration

10:14 rhickey: reduce-seq?

10:14 RSchulz: How is it not map, then?

10:14 AWizzArd: RSchulz: how does the map for (04:08:17 PM) Chouser: (scanl + 10 [1 2 3 4]) ==> (10 11 13 16 20) look like?

10:14 Chouser: RSchulz: did you see my example run above? try writing it with just 'map'

10:14 rhickey: RSchulz: there's a propagation from one call to the next

10:15 RSchulz: I see.

10:15 rhickey: reduce-keep

10:15 RSchulz: The name is kind of arbitrary.

10:15 Chouser: I was actually using the name 'propagate' before rhickey reminded me we'd been over this before.

10:15 RSchulz: Yes, reduce-keep is at least somewhat descriptive. Scan certainly isn't.

10:15 rhickey: reduces

10:16 Chouser: ooh

10:16 if that's not too subtle, I like it.

10:17 rhickey: reduces == as defined by my lazy scanl?

10:18 Chouser: sure, how else would it be defined?

10:18 AWizzArd: something with a ,,-" inside sounds lispy, but is long. So reduces looks nicer to me

10:18 rhickey: just asking, you had a strict one and had been playing with it

10:19 Chouser: oh, eager? no. lazy is good.

10:19 RSchulz: Maybe "reducing"?

10:20 AWizzArd: reducify :-)

10:21 step-reduce

10:22 rhickey: reduce [f init coll] - "Returns a lazy seq of the intermediate values of the reduction (as

10:22 per reduce) of coll by f, starting with init"

10:22 er, reduces

10:23 reduction?

10:24 AWizzArd: that sounds too much like reduce

10:24 * rhickey likes reduction best so far

10:24 AWizzArd: condense

10:25 gnuvince: What are we naming?

10:25 scanl?

10:25 AWizzArd: yes

10:25 Chouser: Does it make any sense for 'init' to be optional as it is in reduce?

10:26 rhickey: Chouser: yes - you sending patch?

10:26 Chouser: heh. can do.

10:26 gnuvince: continuously?

10:26 Nah, doesn't work...

10:26 rhickey: reduction

10:27 RSchulz: (As Marge Simpson said--funny, I was just thinking about that episode earlier--"Names are hard.")

10:27 gnuvince: Not sure about reduction; you have reduce which returns a single value, so you'd expect reduction to do something similar.

10:27 rhickey: I'm sure

10:28 AWizzArd: slash? taper?

10:28 rhickey: it describes the process of reducing

10:28 RSchulz: Crush?

10:28 Chousuke: accumulate? :/

10:28 RSchulz: Too side-effecty.

10:28 Actually, though, accumulate doesn't sound bad.

10:29 gnuvince: It's not bad, but again, I feel that htis conveys that you'll get a final, atomic value.

10:29 AWizzArd: gnuvince: it sounds very much like reduce, yes

10:30 rhickey: user=> (reduce + 0 [1 2 3 4])

10:30 10

10:30 user=> (reduction + 0 [1 2 3 4])

10:30 (0 1 3 6 10)

10:31 RSchulz: "Peephole?"

10:31 Too risque?

10:31 AWizzArd: I personally think that reduce sounds more like producing (0 1 3 6 10) and reduction will return the final reduction of this expression.

10:32 reduction gives you the reduction, while reduce as a verb sounds more active imo

10:32 gnuvince: I guess we can talk about this all day, but the BDFL has decided on reduction ;)

10:32 RSchulz: Is this function, whatever it ends up being called, going into Contrib? Core?

10:33 rhickey: AWizzArd: It's not a subjective thing - reduction: the action of making something smaller, reduce: to make something smaller

10:34 AWizzArd: What about minify? ;-)

10:34 Chousuke: maybe call it "reductions" as it produces the reduction of every subsequence.

10:34 AWizzArd: also nice

10:35 bestest name so far

10:36 RSchulz: But nothing is being made smaller here, is it?

10:37 AWizzArd: "reductions" even has the flair of lazyness

10:37 RSchulz: There is no aspect of decreasing (-ness) about it, right?

10:37 rhickey: RSchulz: reduce does, reduction is the enumerated process of reduce

10:37 RSchulz: Yes, reduce does, but this new thing we don't want to call scanl does not.

10:38 Also, does it generalize in any way to larger scopes over which the individually applied actions operate within the target sequence?

10:38 Or is it strictly pair-wise?

10:38 rhickey: it is the intermediate results of reduce

10:39 i.e. the reduciton

10:39 reeduction

10:39 reduction

10:39 * rhickey will learn to type soon

10:39 AWizzArd: *g*

10:39 RSchulz: Nah. Spelling's only important to computers. And publishers.

10:39 AWizzArd: Btw, it is very cheap to rseq a vector yes? So reducing from the right side is no problem.

10:40 rhickey: AWizzArd: for anything reversible, including vector

10:43 RSchulz: I wonder if mapcat offers a naming precedence that should be respected?

10:43 _precedent_, that is.

11:17 drewolson: i'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:18 are namespaces with "-" an issue in AOT?

11:18 Chouser: drewolson: shouldn't be, but they are converted to "_" in class, file, and directory names.

11:18 drewolson: Chouser: yep, and i see the outputed classes are named exactly like that

11:19 however, when i run java, it doesn't want to find my class files

11:19 the command is basically:

11:19 java -cp clojure.jar:clojure-contrib.jar:classes:test/classes org.drewolson.test-foo

11:20 and the comipled test classes is sitting in test/classes/org/drewolson/foo

11:20 s/comipled/compiled/

11:20 Chouser: try: org.drewolson.test_foo

11:20 drewolson: k

11:20 Chouser: java's expecting a class name there, which can't have "-"

11:20 drewolson: that did the trick, thanks :)

11:21 Chouser: np

11:23 drewolson: hrm, still not convinced i'm actually running the file

11:24 no errors now, but i don't see any test output

11:24 i should be able to include :gen-class in my ns macro and then call (run-tests) from -main, correct?

11:28 i take that back, it's working fine

11:28 ant just doesn't print output :)

11:40 Chouser: clojurebot: atom discussion is http://groups.google.com/group/clojure/msg/fd0371eb7238e933

11:40 clojurebot: 'Sea, mhuise.

11:40 Chouser: clojurebot: brain dump?

11:40 clojurebot: brain dump is http://clj.thelastcitadel.com/clojurebot

11:42 Chouser: rhickey: you saw cgrand's timing tests of vector vs. closure creation?

11:44 drewolson: ok, i'm going crazy: http://gist.github.com/32396

11:44 that runs fine, but outputs nothing

11:44 the tests aren't running and i have no idea why

11:49 Chouser: drewolson: no output, or "Ran 0 tests"?

11:49 drewolson: Chouser: no output at all

11:50 Chouser: pre-compiled only, or also when run from .clj sources?

11:50 drewolson: how would i run this from the .clj sources?

11:50 would main run?

11:51 right now i'm running the compiled code

11:51 Chouser: you could start a clojure repl, then: (require 'org.drewolson.test-dragon) (org.drewolson.test-dragon/-main)

11:52 drewolson: let me give that a shot

11:53 Chouser: I think I'm reproducing your error, and I think it has to do with *test-out*

11:53 drewolson: hrm, i see

11:53 Chouser: yes, tests do run from the repl

11:55 Chouser: i take that back...i see output, but it says "0 tests run"

11:55 somehow, running (run-tests) from main is not seeing the deftest declarations

11:57 Chouser: drewolson: yes, it looks like you have to say: (run-tests 'org.drewolson.test-dragon)

11:57 drewolson: ah, i see

11:58 Chouser: ok, tests now run from the Repl, but still nothing running the compiled class from the command line

11:59 Chouser: or, at least, i can't see the output, i'll look into *test-out*

12:00 Chouser: If i write directly to *out* and *test-out* from inside the compiled -main, I see neither.

12:00 but prn works

12:00 drewolson: hrm, very strange

12:01 i'm trying to get a feel for how i would unit tests apps in clojure, not sure how else to do it

12:02 Chouser: ah, manual flush is required

12:02 drewolson: Chouser: not sure I understand, can you pastie?

12:02 Chouser: http://gist.github.com/32403

12:02 drewolson: awesome, thanks

12:02 god bless gist

12:03 although hooks into irc would be nice. notification similiar to the lisp paste site you use

12:03 Chouser: yeah, I've not used it much. seems pretty nice, plus it even colors Clojure nicely.

12:03 drewolson: yes, if it had that, I'd definitely prefer gist.

12:03 drewolson: yep.

12:04 i'm wondering how i would create a test suite, roll all my tests into a single run

12:04 but have them in multiple files

12:04 Chouser: drewolson: 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:05 drewolson: gotcha, thanks for the help

12:05 Chouser: if nobody else here chimes in, you could bring it up on the google group.

12:08 drewolson: maybe i'll see if i can actually write some code to solve it

12:09 dudleyf: I'm kind of leaning towards specjure for testing

12:09 but I haven't used it extensively

12:09 duck1123: does anyone know if there is a gist mode for emacs?

12:09 drewolson: duck1123: there is

12:09 duck1123: http://github.com/defunkt/gist.el/tree/master

12:10 duck1123: drewolson: thanks. I'll check it out

12:10 drewolson: np

12:10 dudleyf: heh

12:10 The first result for "gist irc bot" is clojurebot

12:12 hiredman: clojurebot: copious is <reply>pffft, I'll give you copious, hiredmn's free time is copious

12:12 clojurebot: 'Sea, mhuise.

12:12 hiredman: clojurebot: waht can you tell me about the copious amount of russian spam I recieve?

12:12 clojurebot: pffft, I'll give you copious, hiredmn's free time is copious

12:14 RSchulz: And now it knows a typo forever...

12:15 * hiredman does some hand wavy stuff and fixes it

12:16 RSchulz: Yeah, you reach inside its brainbox. Creepy.

12:16 hiredman: actually I just privmsg...

12:17 RSchulz: It's good you have such copious free time.

12:25 hiredman: lisppaste8: url?

12:25 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

12:25 blackdog: i 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:26 i guess a short macro will do the trick

12:27 lisppaste8: hiredman pasted "chute example" at http://paste.lisp.org/display/71645

12:30 hiredman: oops

12:30 I missed a spot there

12:31 lisppaste8: hiredman annotated #71645 with "missed a spot" at http://paste.lisp.org/display/71645#1

13:13 AWizzArd: rhickey: What do you see as core parst that you still wish to see integrated into Clojure before 1.0?

13:54 rhickey: Chouser: I did see that - closure creation is fast, that's ok by me

13:56 Lau_of_DK: Good evening gents

13:56 gnuvince: I'm not an agent, I'm a ref!

13:56 </retarded Clojure-related joke>

13:57 Lau_of_DK: hehe

13:57 gnuvince: 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:58 gnuvince: Hahahaha

13:59 technomancy: heh

13:59 gnuvince: Lau_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:59 I'm not saying I'm better than other programmers, I'm definitely not.

14:00 But you wouldn't see a doctor asking what a CAT scan is...

14:00 Lau_of_DK: gnuvince: I think primarily the problem is actually religious attitude

14:01 +s

14:01 I have spoken with people who would defend PHP to death instead of looking twice at Lisp

14:02 And Im not speaking CEO level or any such thing, but just programmers who have found their comfort zone, and love it

14:02 technomancy: Lau_of_DK: see the first quote on this page: http://technomancy.us/27

14:02 Leo Tolstoy agrees!

14:03 gnuvince: Lau_of_DK: yeah, it is a problem too, though one that I can understand.

14:04 Lau_of_DK: technomancy: My goodness, what a wonderful insightful quote

14:05 But I cant get annoyed, in the end it plays out to my advantage

14:05 gnuvince: If 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:06 Lau_of_DK: "Zeal is its own excuse"

14:08 hiredman: hmmm

14:08 Chouser: technomancy: great quotes!

14:08 hiredman: clojurebot look up needs to be case insensitive

14:09 technomancy: Chouser: thanks. I like the last one too. =)

14:09 Lau_of_DK: hiredman: Isnt ^i the regex suffix for case-ignorance?

14:09 hiredman: clojurebot: Richard Stallman is <reply>who?

14:09 clojurebot: Titim gan �ir� ort.

14:09 gnuvince: Lau_of_DK: /foo/i

14:09 Lau_of_DK: k

14:09 hiredman: Lau_of_DK: but I am using keys in a hash for lookup

14:09 Lau_of_DK: gnuvince: you cant to that in ASM

14:10 hiredman: so you gotta run it all in lower-case?

14:10 hiredman: I think I will have to do that

14:10 but, meh, later

14:10 Lau_of_DK: hhe

14:10 +e

14:15 hiredman: http://img.thedailywtf.com/images/ads/Learn-Lisp-small.png <-- learn lisp, only $75

14:17 duck1123: W.L. Whipple likes it

14:18 "Interactively and Write Real Programs with TransLISP for Only $75"

14:18 technomancy: what a deal.

14:19 ... and people wonder if you can go anywhere as a language using primarily proprietary implementations.

14:19 "Sure you can, that's why everyone is using Smalltalk these days."

14:20 Lau_of_DK: I know this question has been asked a million times before, but besides viaWeb, what larger projects have been done in a Lisp ?

14:20 technomancy: Emacs. =)

14:20 autocad is another big one

14:20 Lau_of_DK: technomancy: Emacs is written in C

14:20 technomancy: and there's that big airline scheduling system by ITA

14:20 AWizzArd: Emacs is written in Elisp

14:20 technomancy: Lau_of_DK: Emacs Lisp is implemented in C.

14:21 Lau_of_DK: AWizzArd: Emacs is written in C, its a Elisp interpreter

14:21 We're repeating each other, but the answer is still, its not written in Lisp

14:21 AWizzArd: some parts of it are written in c, yes

14:21 technomancy: ITA definitely has the biggest Lisp system in production to my knowledge.

14:22 duck1123: most of the cool stuff I use in emacs *is* written in elisp

14:22 technomancy: unless some other folks are keeping it secret for a competitive advantage.

14:22 AWizzArd: I think ITA employs around 100 Lisp developers.

14:22 Lau_of_DK: uuh, cool

14:24 technomancy: anyway, 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:24 AWizzArd: Yes

14:24 We can say that Emacs is not purely written in Lisp

14:25 What about Clojure? Is it written in Java or Clojure?

14:25 Which part is bigger?

14:25 Currently it's both, but the Clojure part is growing.

14:25 technomancy: the java part is bigger, but it's much less expressive

14:26 plus everyone uses clojure contrib; that's got to count for something.

14:26 AWizzArd: rhickey probably has his reasons why he does not want to rewrite the java parts in Clojure, now as its compiler is bootstrapped.

14:26 kotarak: There are two parts of Cojure: the Java part building the infrastructure and the core library running on the Java part.

14:26 duck1123: do you consider things like dired, erc, proced, etc. to be part of emacs, or applications that run on the emacs platform?

14:27 Chousuke: how much of emacs is non-elisp that doesn't actually involve interpreting elisp :P

14:28 duck1123: Chousuke: quite a bit, but I'm sure 3/4 of it could've been written in elisp

14:29 Chouser: Clojure 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:29 duck1123: man, it's amazing the stuff you learn when you actually sit down and read the slime manual

14:29 * technomancy should do that some day

14:29 cemerick: duck1123: just imagine all the stuff you'll need to unlearn eventually ;-)

14:29 * cemerick ducks, runs

14:29 Chousuke: it'd be cool if clojure were written purely in clojure, but that brings all kinds of bootstrapping problems.

14:29 duck1123: I was looking for a function that would allow me to build something... it's already there

14:30 Chousuke: you'd still need a clojure implementation done in java to get it running :/

14:30 duck1123: Chousuke: but you only need one

14:30 kinda like the head vampire

14:30 AWizzArd: in 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:31 Chousuke: heh

14:31 that 3% was emacs.

14:31 hiredman: heh

14:31 beat me to it

14:31 AWizzArd: yes, and sbcl + cumcl

14:31 but mostly emacs

14:31 http://www.dwheeler.com/sloc/

14:31 Lau_of_DK: guys this is really boring :)

14:32 technomancy: Chousuke: wow; nice.

14:32 hiredman: is anyone writing distrubuted message passing stuff for clojure?

14:32 technomancy: especially when you consider how much less verbose lisp is

14:34 hiredman: I am toying with something I will call "chutes and ladders" using xmpp

14:34 http://paste.lisp.org/display/71645

14:34 Lau_of_DK: hiredman: check lisp paste, someone pasted something a couple of days ago

14:34 hiredman: example little session

14:35 AWizzArd: Lau_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:35 As in http://www.javafx.com/

14:36 My question is: can one use Clojure to write javafx apps, or is one forced to do it with JavaFX-Script?

14:37 hiredman: holy crap

14:38 clojurebot is then less two weeks old according to lisppaste

14:38 Chousuke: AWizzArd: if you can use java to write them, you can use clojure

14:38 Lau_of_DK: AWizzArd: Im sorry, Ive not heard about javaFX

14:38 technomancy: hiredman: I remember suggesting you write him right when I joined the channel two Fridays ago. =)

14:38 AWizzArd: Lau_of_DK: I also heard about it today for the first time. Seems interesting though, a flash/silverlight competitor

14:39 duck1123: I really like JavaFX's javadoc

14:39 AWizzArd: Chousuke: I am not so sure. For example when you want to use the web framework Rife, then this rule is not true.

14:39 * technomancy loves it when other people write code for him when he asks

14:39 Lau_of_DK: But 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:39 AWizzArd: I'll check it out

14:39 AWizzArd: Chousuke: one can use .class files or .java files for Rife (as long the .class files where compiled with javac).

14:40 yeah, please have a look at it, would be nice to know if this would be possible

14:40 Chousuke: so rife has some weird compiler dependencies then? :/

14:40 AWizzArd: I don't know this. I will maybe find out during the weekend.

14:40 I just know that for Groovy they did some work, and since then Rife also can work with .groovy files.

14:41 Chouser: AWizzArd: so you've given up on Clojure + Rife?

14:42 Lau_of_DK: AWizzArd: JavaFX looks wild

14:42 AWizzArd: Chouser: 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:49 Lau_of_DK: olgen: Hej Jacob, velkommen til

14:49 olgen: Laust?

14:49 Lau_of_DK: Nej

14:49 gnuvince: math question guys: natural numbers are the integers equal to and larger than 0? N = {x | x <- Z, x >= 0}?

14:49 Lau_of_DK: S� bare en anden dansker og t�nkte jeg ville hilse p�

14:50 olgen: ah hehe

14:50 og tak

14:50 Lau_of_DK: gnuvince: I believe that group excludes 0

14:50 olgen: np :)

14:51 hiredman: hold on to your hats

14:51 http://en.wikipedia.org/wiki/Natural_number#History_of_natural_numbers_and_the_status_of_zero

14:51 Lau_of_DK: oops, blush

14:52 hiredman: Lau_of_DK: don't worry, I just did a quick edit to make you look wrong before pasting the url

14:52 Lau_of_DK: cool

14:52 :)

14:52 technomancy: hiredman: I always wonder about that when people refer to wikipedia.

14:52 Lau_of_DK: Ive never claimed to be smart, but Ive faked it a few times

14:53 kotarak: gnuvince: I encountered the notation N for natural numbers without 0 and N_0 including 0.

14:54 gnuvince: That 0 is a real nuisance

14:54 We should do away with it

14:54 ;)

14:55 kotarak: It was a major achievement to recognise it as "something".

14:55 Since it represents actually nothing.

14:55 technomancy: kotarak: you mean like the empty list in CL? =)

14:56 kotarak: Hmm.. 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:56 technomancy: kotarak: in CL nil is the same thing as the empty list

14:56 kotarak: Later on someone came to the idea, that zero is more than an empty place.

14:59 Wow. I really have a talent to kill conversations...

14:59 * Lau_of_DK pats kotarak on the back

14:59 Lau_of_DK: Yes you've always been good at that :)

15:00 kotarak: maybe I should go over to the lurker faction.

15:16 danlarkin: ok 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:17 Lau_of_DK: phew, danlarkin broke kotarak spell which paralyzed the channel for 20 minutes

15:18 kotarak: Lau_of_DK: Beware of the dark wizard. *muhahaha*

15:19 Lau_of_DK: See? It works. :|

15:20 * Chousuke sticks a sealing talisman on kotarak

15:22 lisppaste8: hiredman annotated #71645 with "code" at http://paste.lisp.org/display/71645#2

15:31 technomancy: is there an expected date for the JVM 7?

15:34 Chouser: blackdog: Sorry I didn't remember this til just now: (conj {:a 1} (when true {:b 2}))

15:37 you can have multiple 'when's in a single conj.

15:37 that only works on maps, though. your conj-when would also work on vectors, lists, etc.

15:39 lisppaste8: craigmcd pasted "Tracing Library" at http://paste.lisp.org/display/71656

15:40 AWizzArd: rhickey: What do you see as core parst that you still wish to see integrated into Clojure before 1.0?

15:45 hiredman: AWizzArd: 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:45 Lau_of_DK: hehe

15:46 You think "he that most of want he wants" ?

15:46 hiredman: 2008: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:46 has

15:46 what ever

15:47 gnuvince: Should 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:48 (though that'd be best written as (monotonic? #(= (inc %1) %2) [1 2 3 4])

15:48 AWizzArd: those colls could be concatenated

15:49 oh, I see what you mean

15:49 gnuvince: ?

15:49 Chouser: that's not what he wants, though. he wants it to work like map

15:49 gnuvince: Chouser: exactly

15:49 AWizzArd: well, then probably map+every

15:50 hiredman: that would be ugly

15:51 AWizzArd: I think the suggestion is nice, to have more than one sequence

15:51 http://www.lispworks.com/documentation/HyperSpec/Body/f_everyc.htm

15:52 Chouser: (every? identity (map = (map inc coll) (rest coll)))

15:54 AWizzArd: Chouser: do you really want two maps here?

15:55 Chouser: I think so. Would you prefer:

15:55 (every? identity (map #(= (inc %) %2) coll (rest coll)))

15:55 AWizzArd: I think that could be more efficient

15:56 Chouser: I prefer the former unless I'm sure I need some extra performance.

15:56 AWizzArd: Although the Common Lisp way to do it is allowing any number of colls to every

15:57 Chouser: in a side effect free language the compiler could eliminate one map for us

15:58 So you can write it with two maps, but the coll is only traversed once.

15:58 In principle Clojure could do the same.

15:59 But people who won't play after the rules of functional programming might run into some nasty bugs this way.

16:12 lisppaste8: gnuvince pasted "Something like that" at http://paste.lisp.org/display/71658

16:15 Chouser: interesting. I think I could get used to using that.

16:15 gnuvince: The implementation could probably be improved

16:16 Chouser: yeah, it's probably a bit slower.

16:17 I suppose you could do that for everything that takes a predicate and a collection.

16:18 gnuvince: Probably

16:18 I might check it out this weekend.

16:21 AWizzArd: gnuvince: 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:22 for returning false I mean

16:22 triddell: blackdog: I just reviewed the jetty sample you put together for Lau. Did you write the iph.utils.servlets piece?

16:22 AWizzArd: your (if expr then true) can also be written as: (and expr then)

16:22 (and tuples (if ...))

16:22 (and tuples (when .. ))

16:23 gnuvince: AWizzArd: I find using explicit ifs clearer of my intentions than using and or or as control structures

16:23 AWizzArd: Rich explicitly defined that as idiomatic for Clojure

16:23 I asked him some days ago about it.

16:24 gnuvince: I'll check it out during the weekend

16:24 AWizzArd: It is idiomatic to use when and make use of the implicit return value of nil

16:24 of false

16:24 gnuvince: I'll use cond :)

16:25 No fighting!

16:25 Chousuke: if you have multiple different functions to use for "searching" an answer then I find 'or a very nice way of expressing that

16:26 especially if you have a default value.

16:26 lisppaste8: Chouser annotated #71658 with "or use a helper" at http://paste.lisp.org/display/71658#1

16:28 Chouser: that 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:29 AWizzArd: (every? identity coll) is basically (apply and coll), but as and is a macro...

16:29 Chouser: AWizzArd: yes, I know.

16:31 blackdog: triddell, yes i did

16:32 gnuvince: Going home

16:34 triddell: blackdog: 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:35 blackdog: triddell, yes, that's exactly what I'm doing - no gwt, but danlarkin;s json lib and the servlet

16:35 i'm using clojure.contrib.sql

16:35 nothing fancy

16:37 triddell: blackdog: 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:37 blackdog: well ihope to keep it as simple as possible

16:44 lisppaste8: blackdog pasted "servlets" at http://paste.lisp.org/display/71662

16:44 blackdog: triddell, that's a newer version

16:45 lisppaste8: blackdog annotated #71662 with "jsonp example" at http://paste.lisp.org/display/71662#1

16:46 hiredman: clojurebot: servlets?

16:46 clojurebot: Titim gan �ir� ort.

16:46 hiredman: clojurebot: servlets is http://paste.lisp.org/display/71662

16:46 clojurebot: Ack. Ack.

16:47 triddell: blackdog: thx. I'll try that one for a spin soon :-)

16:51 AWizzArd: Do you see a more idiomatic way to do (for [x (range 100)] [x (* x x)]) than doing it this way?

16:52 drewr: It doesn't look like I can throw an ad-hoc keyword arg in a binding form, can I?

16:52 Chouser: AWizzArd: looks good to me, for whatever that's worth.

16:52 drewr: Python: def foo(a, b, c=None): return (a, b, c)

16:53 Chouser: drewr: you mean to mix positional and keyword ... no.

16:53 drewr: I can call foo(1, 2, 3) or foo(1, 2), etc.

16:53 Chouser: OK, just making sure I wasn't missing something.

16:54 AWizzArd: drewr: 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:54 drewolson: hey all, how can i set compile-path from the command line?

16:55 AWizzArd: I would be interested to know how to set it in swank-clojure :-)

16:56 currently I always do something like (binding [*compile-path* "my/path"] ...) in the repl

16:56 kotarak: The new repl-ln is awesome. :)

16:56 Got Gorilla working with it. :)

16:56 AWizzArd: grats

16:56 dudleyf: drewolson: java -Dclojure.compile.path=/path ...

16:56 Chouser: you can do (defn foo [a b & kw] (let [{:keys [c]} (apply hash-map kw)] ...))

16:56 drewolson: dudleyf: thanks

16:57 AWizzArd: Chouser: yes, good

16:57 drewr: Chouser: I was thinking about something like that. Thanks.

16:57 AWizzArd: if one regularily makes use of it a macro (def-kwfn foo ...)

16:58 Chouser: I think someone wrote a macro already for it, perhaps with extra features

16:58 AWizzArd: to remove the leak out of this abstraction

17:03 drewr: defnk

17:04 defn+

17:04 Chouser: http://groups.google.com/group/clojure/msg/51bb53ca077154f8

17:04 someone == Rich

17:04 drewr: rhickey is a freak with macros.

17:05 Chouser: he notes elsewhere "(note: that macro could probably be done more simply now...)"

17:06 AWizzArd: drewr a macro really makes sense here. I don't find this very freakish in that case.

17:07 * gnuvince_ is back

17:07 AWizzArd: wb vince

17:07 * gnuvince_ is eating quiche

17:07 Chouser: clojurebot: keyword arguments is http://groups.google.com/group/clojure/msg/51bb53ca077154f8

17:07 clojurebot: c'est bon!

17:08 drewr: AWizzArd: I mean in general. Have you looked at for?

17:08 Chouser: 'for' is indeed nuts. very useful, though!

17:08 AWizzArd: drewr: some weeks ago I read the full boot.clj

17:09 Does clojure have something like a pipe operator?

17:09 kotarak: ->

17:09 AWizzArd: (def x (-> #(+ 3 %) #(* 2 %) inc)) ==> Exception

17:10 kotarak: (-> x (+ 3) (* 2) inc)

17:10 AWizzArd: It's not really what I want

17:11 kotarak: comp?

17:11 AWizzArd: nope, but (def x (apply comp (reverse [#(+ 3 %) #(* 2 %) inc])))

17:11 drewolson: what is syntax for :methods in :gen-class, specifically the param types

17:11 AWizzArd: (pipe #(+ 3 %) #(* 2 %) inc)

17:12 so that I can read from left to right

17:12 similar to ->

17:12 kotarak: #(->% (+ 3) (* 2) inc))

17:13 You can define your own pipe: (defn pipe [& fs] (apply comp (reverse fs)))

17:13 hiredman: AWizzArd: I wrote one of those too

17:14 AWizzArd: kotarak: your

17:14 oops

17:14 kotarak: your #(-> ...) is good

17:14 Chouser: drewolson: there's an exampe at http://clojure.org/compilation

17:14 AWizzArd: now it even looks like real currying :-)

17:14 kotarak: Beware: It always expans to (-> x (f y)) => (f x y).

17:15 drewolson: Chouser: all examples have no params it seems

17:16 AWizzArd: kotarak: that makes sense I think. Can you think of an example where one doesn't want that behaviour?

17:16 Chouser: drewolson: oh, I guess so. param types belong in those empty [] brackets. are you having a problem?

17:16 drewolson: Chouser: so if my argument is a java.awt.Graphics

17:16 AWizzArd: (def x #(-> % (+ 3) (/ 2) inc)) - I would think: add 3, divide this by 2 and inc it

17:16 and yeah, it does

17:16 kotarak: AWizzArd: "(-> x (/ 3 %))"

17:16 Chouser: [foo [java.awt.Graphics] String]

17:17 AWizzArd: kotarak: but it is what you suggested first: #(-> % (/ 3))

17:17 drewolson: Chouser: hrm, that's what I tried

17:17 let me try again

17:17 Chouser: drewolson: you got some kind of error?

17:18 kotarak: AWizzArd: that expands to (/ x 3), but what if you want (/ 3 x).

17:18 AWizzArd: this makes no sense for piping

17:18 I want to divide the result of the previous operation by 3

17:19 drewolson: Chouser: yes ... No matching field found: getSimpleName for class clojure.lang.Symbol (dragon.clj:1)

17:19 strange

17:19 Chouser: drewolson: can you paste your code and stack trace?

17:19 kotarak: AWizzArd: and maybe you want to divide 3 by the result of the previous operation sometimes.

17:19 drewolson: yes, one second

17:19 Chousuke: that doesn't look very functional in style though :/

17:20 drewolson: Chouser: http://gist.github.com/32532

17:28 Chouser: drewolson: Canvas already has a paint method with that signature.

17:29 drewolson: Chouser: right, we're trying to override

17:29 Chouser: no need to specify it in :methods

17:29 drewolson: Chouser: would i stil prefix the method with -

17:29 Chouser: yes

17:30 drewolson: alright, i've done that paint doesn't appear to be called at all

17:30 Chouser: "The :methods option defines a new method foo not present in any superclass/interfaces."

17:30 drewolson: maybe i should actually READ the documentation

17:32 Chouser: do you get a Canvas on the screen? my guess is no.

17:33 drewolson: Chouser: nope

17:34 Chouser: Are you sure you're using Canvas correctly?

17:35 drewolson: i thought so, but it's not looking like it

17:37 hiredman: clojurebot: gen-class?

17:37 clojurebot: No, hiredman, you want gen-interface + proxy

17:37 danlarkin: fancyyyy

17:42 re: 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:42 blackdog: yea, I think it's useful

17:44 it would be better to have all in one package

17:44 Chouser: drewolson: either of these work for me: http://gist.github.com/32536

17:45 blackdog: i routinely use both

17:45 Chouser: I 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:47 hiredman: I have yet to use gen-class for that kind of stuff

17:47 I always use proxy

17:47 danlarkin: blackdog: what do you do for decoding ATM?

17:48 blackdog: hang on,let me check the file

17:49 doesn't have a license, I think i got it off the group somewhere

17:49 danlarkin: ah sam colby's

17:50 RSchulz: Are all the modules in clojure.* meant to be (use)-able?

17:50 1:14 user=> (use 'clojure.zip)

17:50 java.lang.IllegalStateException: replace already refers to: #'clojure.core/replace in namespace: user (repl-1:14)

17:50 .../clojure/zip.clj starts with:

17:50 (ns clojure.zip

17:50 (:refer-clojure :exclude (replace remove)))

17:51 hiredman: RSchulz: yes, but that only excludes from the clojure.zip ns

17:51 RSchulz: But am I supposed to be able to (use 'clojure.zip)?

17:51 hiredman: you need to exclude replace

17:52 triddell: danlarkin: I'm just starting to think about a new project... but decoding support in the same package would be nice

17:52 RSchulz: So I'm expected to read the source of Clojure core module to be able to use it??

17:52 hiredman: actually

17:52 kotarak: RSchulz: I always use (require '[clojure.zip :as zip])

17:52 RSchulz: certainly not.

17:52 RSchulz: When is (use ...) appropriate and when is (require ...) called for?

17:52 hiredman: RSchulz: looks like you defined your own function called replace in the user ns

17:53 RSchulz: (Not that I don't need to read a _lot_ of Clojure code!)

17:53 hiredman: er

17:53 nm

17:53 RSchulz: Nope. I started again from scratch and did the (use ...) and got the same diagnostic.

17:53 hiredman: yeah

17:53 I misread

17:53 kotarak: RSchulz: always require, use only with :only. As a rule of thumb.

17:54 RSchulz: It seems that clojure.zip should rename the conflicting functions in its public interface, no?

17:55 Because (if I'm not mistaken) that require _is_ part of its public interface.

17:55 danlarkin: triddell, 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:55 RSchulz: And if not, it should be defined private, right?

17:55 drewolson: Chouser: sorry, was away

17:56 RSchulz: ... Sorry, I meant to say "that (version of) _replace_ is part of the public interface".

17:56 kotarak: danlarkin: heavily working on the monad part.

17:57 danlarkin: want to get this right. The parser code is currently a total mess.

17:58 danlarkin: kotarak: I fully understand :) I have subscribed to your updates on bitbucket

17:58 kotarak: :)

17:58 drewolson: Chouser: the first snippet from the gist works for me, however no text appears in the frame

17:59 hiredman: .repaint?

18:00 I remember something like this

18:00 maybe I called .pack and that made stuff render?

18:03 triddell: question: 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:03 the included jars are in ~/.clojure directory

18:05 so, 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:08 hiredman: triddell: the clojure swank looks in ~/.clojure and adds the jars there to the classpath

18:08 gnuvince_: Damn...

18:08 I just saw that map is defined in terms of every? :-/

18:09 triddell: hiredman: ok, thanks... thought I was crazy for a second

18:10 hiredman: clojurebot: please explain this whole "jar directory" thing to me

18:10 clojurebot: jar directory is -Djava.ext.dirs=$LIBS

18:20 gnuvince_: Chouser: I think we can forget the modification to every? for now

18:38 danlarkin: Why 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:40 RSchulz: danlarkin: Correct

18:40 Since + is positive closure which is not meaningful inside a character class, you don't have to escape it.

18:41 However, if you want to use a hyphen _literally_ inside a character class, you have to put it first.

18:41 ... At least you used to in old ASCII-limited REs...

18:41 hiredman: huh

18:41 good to know

18:42 (- 3 2)

18:42 clojurebot: 1

18:42 RSchulz: I guess that (the hyphen bit) is _not_ true in Java REs.

18:43 But do keep in mind that [a-z] means a, b, c, d, ..., x, y, z.

18:44 danlarkin: RSchulz: oh true, tricky. Makes sense that it should come first then

18:45 RSchulz: That 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:45 Oh, the good old days.

18:45 hiredman: cute

18:48 danlarkin: so 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:50 RSchulz: Because the ? is tighly binding. It applies only to the [\+-]

18:50 Wait. That's not right.

18:50 You can escape non-special characters. It just leaves them as they were.

18:51 danlarkin: ah, so the plus is a plus

18:51 RSchulz: Inside 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:53 danlarkin: and \, right?

18:54 RSchulz: The 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:55 Backslash is significant only when it directly precedes one of the otherwise special occurrences.

18:55 danlarkin: :)

18:55 regular expressions master _you_

18:55 RSchulz: Actually, I lied (again)... There are more special character-class notations oriented around set arithmetic.

18:56 It can get pretty funky, but it's not that hard to understand, if you really need such esoterica. Check out the JavaDocs.

18:57 You 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:58 danlarkin: our brains don't function well pretending to be state machines

19:00 RSchulz: Eh? My brain _is_ a state machine.

19:00 Last I checked...

19:00 Which explains all the bugs in my code, I suppose.

19:04 charlesg3: any chimp users out there?

19:04 RSchulz: I have one of those helper monkeys like Homer Simpson got once.

19:27 aperotte: hello all, I wanted to know if someone could help me out with the new gen-class

19:27 I'm trying to extend an abstract class

19:28 with one method that needs to be implemented and one ancestrally inherited field that needs to be exposed

19:29 danlarkin: charlesg3: I don't use vi/vim myself but there's a project called gorilla that you may want to check okut

19:29 s/okut/out

19:29 charlesg3: I just got chimp working... I was a little put off by the "expect problems" warning on the gorilla page

19:29 but I guess I may try that out well anyway, thanks though

19:30 * charlesg3 is a clojure newbie and loving what I see already...

19:30 * charlesg3 loves the repl and interactive coding environment

19:31 hiredman: most of the dudes here about are emacs users

19:31 clojurebot: what do you think of emacs?

19:31 clojurebot: uggada buggada

19:32 technomancy: what's that mean?

19:32 Chousuke: clojurebot probably doesn't think much

19:32 technomancy: true

19:50 Chouser: aperotte: it's not working?

20:03 aperotte: Chouser: I used (ns ... (:gen-class)) and that evaluated without any errors

20:03 Chouser: but then I tried to define an instance of the class

20:03 Chouser: and it gave me a java.lang.ClassNotFoundException

20:05 Chouser: do I necessarily have to define the methods before creating a new instance?

20:09 Chouser: I have to run, but thanks for offering to help.

20:27 rhickey: Chouser: thanks for writing up the watchers thing

20:28 Chouser: sure. I hope the point wasn't lost in my wordiness.

20:28 rhickey: no, it was very good

20:28 Chouser: ok, great. I nearly deleted the first half or so.

20:30 rhickey: I think that separation of concerns is important - I haven't liked how other sends have crept into my actions

20:30 I want to refine and unify the watcher/reaction/effect concept to the other vars

20:31 er, references, not vars

20:31 Chouser: :-) watchers on refs seem like they'd be very natural.

20:32 pre-1.0 on that?

20:33 rhickey: I 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:33 mfredrickson_: what is the best way to create disjoint types in Clojure?

20:33 e.g. (my-type? x) => true

20:33 (list? x) => flase

20:34 rhickey: One 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:34 mfredrickson_: even if I really want my-type to be a list (for now)

20:34 Chouser: I'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:35 rhickey: I work on things given time and inclination - these days atoms, wrapping queues, watchers, maybe Class/method fns - small things

20:36 Chouser: ok

20:36 rhickey: reminds me I've got to get reduction in - did you match reduce on zero and one args?

20:36 Chouser: mfredrickson_: why do you need 'list?' to return false?

20:37 mfredrickson_: i suppose I don't. information hiding - the implementation

20:38 Chouser: rhickey: do you mean 2 and 3 args? collections with count of 0 and 1?

20:38 mfredrickson_: Chouser: not a big deal. mostly an idle thought

20:39 Chouser: mfredrickson_: have you looked at 'derive' and 'isa?'

20:40 mfredrickson_: Chouser: thanks. this is my first programming with Clojure. I'm porting a scheme lib I wrote

20:40 i'll take a look at those

20:42 Chouser: I haven't needed them for anything real, but they're pretty powerful.

20:43 halloway's section on multimethods covers them really well.

20:43 rhickey: have you seen that chapter yet? I was impressed.

20:44 hm, looks like reduction with no init and a zero-length coll may be wrong.

20:46 (reduce + []) ==> 0 but (reduction + []) ==> nil ... should that be (0)?

20:52 rhickey: Chouser: that's the question

20:53 reduce with no args calls f with no args

20:55 sorry not no args, no elements and no init

20:57 copied 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:01 Chouser: in 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:02 * Chouser tries to read about Haskell

21:02 Chouser: oh, that's not ture

21:02 true

21:03 * Chouser ponders some more

21:04 rhickey: I think you should follow reduce

22:02 Chouser: bother. that lastest reduction differs from haskell's scanl1

22:05 with no init, scanl1 includes the first element of the coll

22:05 which seems right to me

22:06 amazing how much I can mess up so few lines of code.

22:06 hiredman: sounds good

22:17 heath: Is anyone familiar with the general procedure for getting something into clojure.contrib?

22:22 danlarkin: clojurebot: brain dump?

22:22 clojurebot: brain dump is http://clj.thelastcitadel.com/clojurebot

22:24 Chouser: heath: probably start with sending in a CA

22:25 heath: Sorry, the only acronym I'm coming up with is Certificate Authority :)

22:25 Chouser: heath: http://clojure.org/contributing

22:27 heath: Gotcha, 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:28 Chouser: contrib requires the Contributor Agreement as well

22:28 heath: Though now that I think of it, if it's a liability issue then skirting the paperwork doesn't help anyone out I suppose

22:30 Chouser: once that's in, I'd try posting to the google group with your code attached

22:30 heath: Chouser: I asked a question about a week ago, but I noticed that you were in the middle of a conversation with rhickey

22:31 More clearly, the question is this: I have a horrible, ugly function:

22:31 (defn is-non-json-value? [value] (get {:comma true, :colon true, :end-object true, :end-array true} value))

22:31 That I would like to replace

22:31 For the life of me I can find the canonical way to determine if a value is a member of a collection

22:32 %s/can/can't

22:32 Chouser: (def is-non-json-value? #{:comma :colon :end-object :end-array})

22:32 heath: This function takes all sorts of values, not just keywords

22:33 My bad

22:33 Just tried it, could have sworn that threw an exception when you sent a non-keyword value at it

22:33 Thank you very much...

22:34 Chouser: sets, maps, and vectors can be using in function position.

22:34 you're welcome

22:35 RSchulz: Keywords, too.

22:35 If their arguments are sets or maps.

22:35 Chouser: And Symbols!

22:36 RSchulz: Actually, regardless of their argument.

22:36 So simple. So elegant. So useful.

22:37 heath: This 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:37 Chouser: ah, yep.

22:37 heath: That makes sense now. Very clever facility :)

22:37 RSchulz: Yes, not everything can be a function.

22:37 But keywords, maps and sets are functions of anything.

22:38 Total functions, in the mathematical sense.

22:39 heath: I 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:39 RSchulz: You mean non-official contribute libraries?

22:39 heath: Yes

22:39 RSchulz: We don't really need non-Cojure code...

22:39 In a sense, the Google group file upload are is that.

22:40 Chouser: ick

22:40 RSchulz: And there's paste.lisp.org (if I have that name right).

22:40 And nothing stops people from just posting stuff.

22:40 And there's the Wiki.

22:40 Chouser: there has been talk of a project-hosting site targetting Clojure in particular.

22:40 RSchulz: The thing about the Clojure core and Contrib are that authors must file a contributor agreement with Rich, first.

22:41 It's much more of an official repository.

22:41 heath: Right

22:41 When the community grows larger, I imagine that more and more people are going to try to avoid that bottleneck

22:42 RSchulz: Sure. And there will Google Code projects. And SourceForge projects. And magazine articles. And on and on.

22:42 I have little doubt that Clojure will have a long lifetime.

22:42 heath: I'm trying to think of other languages that have a 3rd party place for libs... I guess CPAN?

22:42 Chouser: RSchulz: 100 years? :-)

22:42 RSchulz: And many users and a lot fo open-source libraries and applications of various sorts.

22:42 heath: Not if Paul Graham has his way :)

22:42 RSchulz: Well, I don't make predictions about things that will outlive me...

22:43 Actually, I'm not much of a prognosticator.

22:43 But I think anybody in these parts is probably pretty confident that Clojure is not just a flash-in-the-pan, fad type thing.

22:43 Does Graham have something against Clojure?

22:43 heath: To put my previous question in context: JSON is a pretty important thing in a standard library these days

22:44 RSchulz: NIH, perhaps?

22:44 heath: Graham is shooting for Arc to be the 100 year language

22:44 As far as I know there's no animosity, however

22:44 RSchulz: Sure. And JSON is eminently compatible with Clojure. I have a parser and writer for it.

22:44 walters: RSchulz: i'm pretty convinced at least that new languages are going to embrace a STM and readonly data structures

22:44 Chouser: both Graham and Yegge have acknowledged Clojure's existance while admitting they know nothing about it.

22:44 RSchulz: So in a sense, I have it supported in Clojure, though I'm working on eliminating the seams, right now.

22:44 heath: Have you released it anywhere?

22:45 RSchulz: No. So far, the bulk of my work is proprietary. We're a tiny operation, and have not yet decided to go open-source.

22:45 heath: I went looking for a JSON lib, and all I found were a couple of writers

22:45 danlarkin: heath: 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:45 RSchulz: Actually, 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:46 heath: danlarkin: Yes, that's one I found

22:46 RSchulz: After all, JSON is pretty simple to parse.

22:46 heath: Completely

22:46 RSchulz: Also, the underlying data structures are one-off, in a sense.

22:46 The parser is no good without them.

22:46 heath: Writing one was a great intro to Clojure, actually

22:47 Anyway, 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:47 RSchulz: walters: 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:47 Chouser: A directory or clojure libraries would be pretty useful.

22:47 RSchulz: What will supplant it, I don't know.

22:48 walters: RSchulz: right, well there is also distributed map/reduce hadoop type model that we'll likely see more

22:48 heath: Github is kind of my first place to look now

22:48 danlarkin: heath: interested in collaborating on that couchdb library? That's what motivated me towards a json library too

22:48 RSchulz: There's some kind of JavaScript something, I though. Some sort of Clojure -> JavaScript translator or something?

22:49 heath: There's a copy of clojure.contrib up on Github for some reason

22:49 Which I think tells you something...

22:49 danlarkin: Sure

22:49 danlarkin: I was originally going to contact you with the parser side of your JSON lib

22:50 danlarkin: well the one I plan on committing soon uses StreamTokenizer which is less-than-optimal

22:50 heath: danlarkin: Got carried away :) Your writer is nicer than mine: indentation, and the writer option

22:50 danlarkin: so there's much room for improvement

22:50 Chouser: RSchulz: are you referring to ClojureScript?

22:51 heath: Mine basically just (first) and (rest)'s it's way through a string

22:51 RSchulz: I think it's tojs.clj

22:52 Yes. The package is apparently clojurescript.

22:52 Chouser: RSchulz: that's the one. poorly documented.

22:52 RSchulz: I don't know what it does, really.

22:52 heath: It's slow (about half the speed of an equivalent Python lib)

22:52 danlarkin: RSchulz: it's chouser's baby

22:52 RSchulz: Well, I'm like a broken record with Open Source projects on this point, but almost everything is poorly documented if you ask me...

22:52 mfredrickson_: how does one add methods to (* ...) ? Is it a multi?

22:53 RSchulz: ; Reads Clojure code and emits equivalent JavaScript

22:53 ...is not good enough documentation for you?

22:53 heath: danlarkin: here's the code in case you're interested: http://elesi.org/json.clj

22:53 Chouser: RSchulz: it's good enough for me. :-)

22:54 walters: that is one nice thing about FOSS Java, the culture has a strong doc bent

22:54 RSchulz: mfredrickson_: 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:54 heath: danlarkin: To answer your question, yes, collabing on a CouchDB lib would be excellent

22:54 RSchulz: I'm not sure how practical that is for things in the core.

22:54 Woops.

22:54 mfredrickson_: RSchulz: did you miss a "not" in there? I think I follow

22:54 RSchulz: You're _not_ going to be able to extend it...

22:54 heath: danlarkin: I'm porting my site off of Google App Engine (holy unstable!), and it's a perfect fit

22:55 mfredrickson_: RSchulz: well shucks, but thanks

22:55 RSchulz: Holy... Some typos are a lot funnier than others.

22:56 danlarkin: heath: aye I know, it's a very smart design

22:56 RSchulz: I know of at least one core package that replaces two clojure.core functions, so I guess it's not impossible.

22:56 But you'd have to totall take over multiplication, including for rationals, primitives and BigIntegers.

22:57 kwertii: Is 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:58 heath: danlarkin: Just realized, that code up there won't run. Halfway done integrating Chouser's function...

22:58 RSchulz: Check out (add-classpath ...)

22:59 Technically, only classes are dynamically loaded. JARs just supply one or more classes for when the classloader decides they're needed.

22:59 kwertii: RSchulz: awesome. thanks!

23:00 Chouser: be careful with add-classpath, though -- use it too much and rhickey might take it away. :-)

23:00 RSchulz: Nah. Just don't tell him about it.

23:00 mfredrickson_: 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:00 RSchulz: Unless you think he's got a snoopbot here...

23:00 Chouser: mfredrickson_: nope. too slow

23:00 RSchulz: Well, I can't say, but you'd want to discuss it on the list first. Probably not, though.

23:01 mfredrickson_: Chouser: JIT? but yes, i'll get on the list and ask

23:01 RSchulz: Exactly how much is the rock-bottom added overhead of a multimethod dispatch over a plain function call?

23:01 I figured at a minimum it's an extra function call, right?

23:02 Chouser: cold cache it has to do 'isa?' which I think involves some kind tree search.

23:04 RSchulz: Is the isa? part inherent? That's the basis of the comparison between the result of the dispatcher and the individual method signatures?

23:04 So there's at least two extra calls?

23:05 One to compute the dispatch value and another to check the isa? And the latter is done repeatedly until a success is found?

23:05 That does seem a bit excessive...

23:05 Chouser: but even with a hot cache it would have to check the cache and make antoher function call

23:05 kwertii: Chouser: one of the big selling points is dynamicity, no? must I know in advance what libraries my program may require? ;)

23:05 RSchulz: You could use one of the rapid sub-type tests. I implemented one for my theorem prover. The dispatch cost is amazinly low.

23:07 kwertii: 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:07 But I doubt (add-classpath) or an equivalent will go away permanently.

23:08 And you can always go around Clojure and deal with the underlying JVM facilities directly, if necessary.

23:08 kwertii: another 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:08 RSchulz: I don't know. You'll have to ask an Emacser.

23:09 Though once it's working, I guess the same issues will exist for Enclojure and whatever Peter Wolf comes up with for IDEA.

23:13 danlarkin: hiredman: this looks an awful lot like your room... http://www.viceland.com/int/v14n8/htdocs/anti/2_large.jpg

Logging service provided by n01se.net