#clojure log - Mar 02 2009

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

0:32 technomancy: not sure what it counts for, but Clojure just passed Scala on the Github languages count: http://github.com/languages/Clojure

0:33 Github is definitely biased towards dynamic languages, but still.

0:36 replaca: at less the 2%, but still :-)

0:37 slashus2: I can't believe that Ruby is more popular than python. I wouldn't think that would be the case.

0:37 technomancy: It was beating Groovy on Friday, but no longer. They must be neck and neck.

0:38 replaca: slashus2: well, github was basically created by ruby folk

0:38 technomancy: slashus2: that's mostly because github is implemented in Ruby and the Python community isn't as excited about git.

0:38 slashus2: Okay, that makes sense.

0:39 technomancy: whereas with Clojure I think Clojure itself and contrib are very nearly the only clj projects that aren't hosted on github. =)

0:40 gregh: github rocks. Despite my pythonic tendencies and having used mercurial in the past, I still prefer git

0:40 technomancy: is it accurate to say that metadata can be attached to vars?

0:40 durka42: yes

0:41 technomancy: but really it can be attached to any symbol or collection? it's just usually used with vars?

0:42 I'm not sure I'm 100% clear on the relationship between symbols and vars.

0:42 a symbol by itself is just a name, but a var is the relationship between that symbol and its value in a namespace?

0:43 durka42: yeah, but vars also have STM connotations

0:43 and don't have to have a root binding

0:43 er, not STM, thread local bindings

0:43 technomancy: right; ok

0:44 it's a little weird how many punctuation marks are needed to extract metadata, but I guess it makes sense when you realize what's going on.

0:44 replaca: it's kind of awesome that you can actually find big hunks of fortran on github

0:45 technomancy: replaca: there's even three projects in Self

0:46 replaca: technomancy: yeah. I have to say, I love github - it represents something so much cooler than sourceforge

0:46 technomancy: these are good times to be a hacker. =)

0:46 replaca: (and sf was pretty cool in it's day)

0:46 technomancy: you got that right

0:46 * technomancy is rooting for ELisp to unseat Objective-C for tenth place.

0:47 technomancy: sure it's a braindead dialect, but having a Lisp in the top 10 would make me very happy. =)

0:47 replaca: technomancy: I noticed you're helping your cause there :-)

0:47 It is odd that Obj-C is so low, though

0:48 cp2: obj-c...ew

0:48 replaca: I would have expected there to be more sharing among the mac crowd

0:48 rlb: Is there anything like for-each? i.e. traverse a seq calling a function on each element, but don't build anything.

0:48 technomancy: replaca: nah, they're all off hoping to make millions in a top-sekrit iphone app =P

0:48 cp2: ,(doseq [x '(1 2 3 4 5)] (prn x))

0:48 rlb: I saw dorun, but I don't want to build the result seq in the first place.

0:48 clojurebot: 1 2 3 4 5

0:48 replaca: technomancy: I think you're right

0:49 technomancy: the whole culture surrounding the language thrives on secrecy

0:50 replaca: technomancy: yeah, that's the fundamental nastiness of the mac world

0:50 cp2: rlb: is that what you are looking for?

0:50 rlb: cp2: I think that's exactly it. I misunderstood doseq's documentation. Thanks.

0:50 cp2: no problem

0:51 technomancy: speaking of misunderstanding documentation, does anyone else think reduce's docstring could use some love?

0:51 (doc reduce)

0:51 clojurebot: f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the result of applying f to val

0:51 technomancy: it makes sense if you already know what reduce is, but otherwise: good luck figuring it out from that description!

0:52 replaca: technomancy: It should begin: "in conjunction with map, reduce will lead the way to first order nirvana" :-)

0:52 cp2: technomancy: *blink*

0:52 rlb: I'm not sure I have it completely right yet, but it looks like clojure's going to make this easy:

0:52 (defn map-files [fn root]

0:52 (map fn (tree-seq #(.isDirectory %) #(.listFiles %) root)))

0:53 nice.

0:53 replaca: It is actually kind of hard to grok reduce unless you're aware of the motivation

0:53 technomancy: it would probably be helpful to mention the intention, like "reduce accumulates a single value by calling a function on each member of a collection"

0:53 durka42: rlb: i recommend not naming parameters "fn"

0:53 technomancy: nice; didn't know about tree-seq

0:54 rlb: durka42: oh, wait -- I forgot that clojure uses that.

0:54 replaca: technomancy: then the noobs might figure out our magic!

0:54 rlb: cp2: and wrt doseq --

0:54 (defn for-each-file [fn root]

0:54 (doseq [x (tree-seq #(.isDirectory %) #(.listFiles %) root)]

0:54 (fn x)))

0:54

0:54 s/fn/something-else/

0:54 cp2: heh

0:54 rlb: durka42: thanks.

0:55 So far I'm consistently impressed by the various facilities clojure provides. Some of them are things I'd been thinking about myself to various degrees for a while.

0:56 cp2: (doc tree-seq)

0:56 clojurebot: Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree.; arglists ([branch? children root])

0:57 cp2: cool

0:57 replaca: wow, that's sweet

0:57 technomancy: type hints provide the greatest speed boost for code that makes heavy use of numerics, correct?

0:57 replaca: I always feel like I'm seeing only small corners of the language in my coding

0:57 brennanc: not sure what you are trying to do in the previous code there but you might want to look into file-seq as well

0:57 rlb: I saw line-seq. Are there other lazy file readers like that (i.e. other than line or regex oriented)?

0:58 brennanc: oh... heh -- obviously missed that.

0:58 brennanc: thanks.

0:58 technomancy: replaca: yeah, I get the feeling that just sitting down and reading through src/clj/clojure/core* would be a wise investment.

0:59 replaca: technomancy: I've done a little of that, but more is good. I always need the motivation of using stuff to really get it onto my toolbelt.

0:59 brennanc: I've been going through the Programming Clojure book and it's pretty good.

1:00 this is only my second day learning lisp and it's really natural already

1:00 replaca: I was just thinking of inventing file-seq the other day as a way to get test fata for my pretty-printer

1:00 not knowing that it already existed

1:01 technomancy: replaca: every time I dive into the implementation I'm surprised at how readable it is. It's a good feeling.

1:01 brennanc: is there some kind of pretty printer?

1:01 replaca: technomancy: yes, very rewarding to the fairly casual reader

1:01 technomancy: brennanc: someone mentioned they were working on one on the mailing list

1:01 replaca: brennanc: I'm building one in the flavor of common lisps - its almost ready

1:02 brennanc: looking for something like PHP's print_var. I think ruby has something as well but I forget the name of it.

1:02 replaca: *it's (I can't deal with apostrophes tonight)

1:02 technomancy: brennanc: probably Ruby's inspect

1:03 replaca: it's amazing to even consider how many man years have been spent on pretty printers in the history of lisp

1:03 although clojure differs from lisp in that lists aren't the only first class data structures and that changes your approach a little bit

1:04 (although the core algorithms end up being about the same)

1:04 technomancy: brennanc: print might be good enough for you if you don't care about indentation

1:05 hiredman: well, prn

1:05 technomancy: right, that

1:07 brennanc: when looking at nested sets it's really hard to tell what is where

1:07 replaca: brennanc: do you use eamcs?

1:08 *emacs

1:08 brennanc: haven

1:08 haven't tried before

1:08 just been using the repl with jline on the console

1:08 cp2: famous last words

1:09 replaca: brennanc: ahh, I just copy forms into a buffer and use clojure mode. I would think vim and other environments would have something similar

1:09 cmvkk: hmm...

1:09 replaca: but that's not really satisfactory, which is why I'm building a pretty printer :-)

1:09 cmvkk: ,(defmacro get-an-atom [] (atom nil))

1:09 clojurebot: DENIED

1:09 cmvkk: heh

1:09 no defmacro

1:10 or no atom?

1:10 durka42: no def

1:10 cmvkk: well anyway, if you define that macro and then try to call it, it gives an error.

1:10 durka42: ,(atom nil)

1:10 clojurebot: #<Atom@7544a6: nil>

1:11 cmvkk: you can't return anything from a macro that is unprintable maybe

1:11 brennanc: what are the strengths of emacs and what is the best way to learn it?

1:11 durka42: well calling that macro effectively does:

1:11 ,((atom nil))

1:11 clojurebot: java.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn

1:11 brennanc: I used to use vi all the time when I was on windows but use TextMate mostly on mac

1:11 cmvkk: no, that's not the error.

1:11 durka42: wait, no it doesn't

1:11 cmvkk: it's this "java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.Atom@1c99db7 (NO_SOURCE_FILE:0)"

1:11 technomancy: brennanc: Emacs is written in Lisp, so it's a lot more extensible than textmate.

1:11 durka42: yeah i see it

1:12 anyway if you want (get-an-atom) to expand to (atom nil) then you should quote it

1:12 cmvkk: i don't; i wanted it to expand to an atom.

1:12 technomancy: brennanc: basically people have been using Emacs to write Lisp for about as long as I've been alive, so they've had a lot of time to streamline it.

1:12 rlb: brennanc: I'm sure you'll hear it again, but fwiw I'd highly recommend you try emacs... esp. if you're going to hack on a lisp like language.

1:13 (actually I'd recommend it regardless, but...)

1:13 technomancy: brennanc: I wrote a screencast introducing emacs that a lot of people seem to find helpful: http://peepcode.com/products/meet-emacs

1:13 replaca: but I've also heard good things about textmate and I think some people are using it for clojure

1:14 technomancy: unfortunately textmate is abandonware, and its license prohibits its users from improving it. =\

1:14 rlb: Also, emacs runs essentially everywhere.

1:14 p_l: Even if not in elisp form

1:14 replaca: technomancy: wow, I didn't know that

1:14 p_l: technomancy: abandonware?

1:15 technomancy: p_l: two years ago I was trying to write a cross-editor tool that textmate didn't have the functionality to support, but they said it would be supported in Textmate 2, which was "just around the corner". nothing significant has happened in its development since then.

1:15 banisterfiend: technomancy: why didn't you release your screencast for free? :(

1:16 technomancy: banisterfiend: because then I wouldn't have been able to afford to spend four weeks writing it.

1:16 banisterfiend: are you making any money from it?

1:16 technomancy: I better be if I spent that much time on it. =)

1:17 banisterfiend: a lot of the code that it uses is available in the Emacs Starter Kit: https://github.com/technomancy/emacs-starter-kit/tree ... you can get along decently with that and the built-in documentation if you're really short on cash.

1:19 durka42: (doc recur)

1:19 clojurebot: Titim gan �ir� ort.

1:20 durka42: ,(doc recur)

1:20 clojurebot: java.lang.Exception: Unable to resolve var: recur in this context

1:20 cp2: lol

1:20 Raynes: > Son of a bitch. Just spent 2 hours trying to figure out why (re-split #"=" f) was returning (text.txt). Turned out, I was using the wrong variable name, f was the name of the file given to the function which was slurped into a var called file. :|

1:21 Minus the >

1:21 cmvkk: those are the best kind of mistakes

1:21 brennanc: I think we can all relate. :)

1:21 cmvkk: because it means your concept was sound, you just screwed up the implementation slightly

1:22 and all you have to do to fix it is switch the variable names around.

1:22 cp2: igh

1:22 cmvkk: instead of having to retool the whole program or something.

1:22 cp2: i cant begin to tell you how many rage fits those have spawned :|

1:22 Raynes: Night guys. Happy LISPing.

1:41 cmvkk: i wish NullPointerExceptions were worth money.

2:14 lethalcode: Hrm. Any way to make the clojure compiler independent of what it's compiling?

2:14 I'm trying to compile a modified clojure/core.clj, but since it's in the classpath as required, clojure.lang.Compile is barfing.

2:14 brennanc: lethalcode: still on it. :)

2:15 any luck?

2:19 lethalcode: brennanc: Some. Not enough :D.

2:33 brennanc: where is lazy-seq found?

2:33 cmvkk: you mean in what file?

2:33 brennanc: yeah, what do I need to include

2:34 cmvkk: pretty sure that's just core.clj

2:34 brennanc: java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (NO_SOURCE_FILE:10)

2:34 cmvkk: ,(doc lazy-seq)

2:34 clojurebot: "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. Any closed over locals will be cleared prior to the tail call of body."

2:34 cmvkk: did you do something weird to the namespace or something?

2:35 brennanc: not that I'm aware of

2:35 user=> (doc lazy-seq)

2:35 java.lang.Exception: Unable to resolve var: lazy-seq in this context (NO_SOURCE_FILE:11)

2:35 just restarted the repl, same error

2:35 cmvkk: are you using the old december 18th release?

2:35 because lazy-seq didn't exist back then.

2:36 brennanc: I'm using the codebase that came with the programming clojure book

2:36 cmvkk: try this: (rest [])

2:36 brennanc: maybe it's old, I downloaded the new book today, let me try on the other repl environment

2:37 it returns nil

2:37 cmvkk: yeah, you're using an old version.

2:37 ,(rest [])

2:37 clojurebot: ()

2:38 brennanc: good to know. thanks

2:38 I can just replace the clojure.jar?

2:39 cmvkk: you have to replace core.clj etc also

2:39 or wait

2:39 is that included in clojure.jar? actually it probably is.

2:39 brennanc: the book has a lot of stuff it needs to run the examples so I don't want to use the pure clojure version

2:40 cmvkk: right. heh, does the book talk about lazy-seq then come packaged with a version that doesn't have it?

2:41 brennanc: I'm trying on the original version I downloaded a few days ago. same issue

2:41 ah, must have downloaded it from the google code site

2:42 it says 20081217

2:42 cmvkk: there aren't 'releases' available that are post lazy.

2:42 brennanc: gonna get the svn

2:42 cmvkk: you have to get an SVN release.

2:42 yeah.

2:43 http://people.ku.edu/~wlipe/ksowen.mp3 <-- check it out, clojure-generated guitar.

2:44 cp2: nice

2:45 brennanc: what do you mean by clojure generated? is it playing wav's or are you outputting the sample values from some kind of synthesizer

2:46 cmvkk: the latter. it's totally synthesized with just clojure, not from recording or anything.

2:46 well, the original wav file was, anyway.

2:47 brennanc: you seen that book "the physics of musical instruments"?

2:47 cmvkk: i don't think so... is it about doing this sort of thing?

2:47 brennanc: it has mathematical models for synthesizing a bunch of instruments

2:47 cmvkk: i'll have to look at that.

2:47 brennanc: a bit over my head with my limited math background

2:48 cmvkk: i'm building a clojure framework for implementing that kind of thing, but i don't know much about it myself.

2:49 brennanc: would be nice to have something like reason functionality but with an API

2:49 cmvkk: what's that?

2:51 brennanc: http://www.youtube.com/watch?v=yl1nHaRbDiE

2:52 http://www.youtube.com/watch?v=sWi-07Ov-IE&feature=related

2:52 it's insane the things you can do with it

2:53 cmvkk: wow that looks like a pretty complicated system.

2:53 can you build songs with it?

2:53 i guess you must be able to.

2:54 brennanc: yeah, you hit tab and it flips to the back where you connect things with virtual wires like an old-school switchboard

2:54 cmvkk: so it's mostly about simulating a physical synthesizer i guess.

2:54 brennanc: that's like 5% of it

2:56 I have my midi keyboard hooked up to this: http://www.youtube.com/watch?v=DrgJkY9E11s

2:56 it's insanely realistic sounding

2:57 cmvkk: it's amazing what you can do digitally these days.

2:58 brennanc: it's around 2 GB of sample data just for the pianos

2:58 cmvkk: the file i linked above is about the naivest of naive implementations of that guitar algorithm, and it doesn't sound TOO terrible

2:59 so professionals can make really good sounding synth stuff

2:59 http://people.ku.edu/~wlipe/ksowen.txt <-- you can see it's just a low pass filter and a delay.

3:01 brennanc: that's pretty cool, is that using a library of some kind?

3:01 cmvkk: just what i've written... plus java's Math and FileOutputStream or whatever

3:02 brennanc: that's pretty cool

3:03 cmvkk: it's slow as hell, though, and i don't know how to fix that.

3:03 that 8 second track takes like 35 seconds to render...really slow.

3:03 clojure isn't the best for lots of quick math i guess

3:04 cp2: type hinting might help

3:04 but idunno

3:04 depends on your implementation

3:04 cmvkk: i suppose so. there's a lot of (int ...) and so forth, but the way it's implemented makes it hard to infer anything.

3:04 brennanc: are you using type hints?

3:05 cmvkk: it's all closures calling closures calling closures, very dynamic, which makes it hard to do that.

3:05 hiredman: cmvkk: are you using unchecked math?

3:05 cmvkk: how do i do that?

3:05 oh, and a lot of it is floating point math, which maybe makes it slower.

3:06 hiredman: (find-doc "unchecked")

3:06 cmvkk: wow, how did I not know that existed?

3:07 the other thing i have to do is make it concurrent, but that's going to require a major overhaul of some things

3:07 brennanc: (let [n (int n)])

3:07 forces n to be an int primitive

3:07 cmvkk: yeah, well, i do a lot of that

3:17 zakwilson: cmvkk: coercing to int is much more useful if you're using unchecked math.

3:18 cmvkk: it seems so. unfortunately the large majority of the math involved is floating-point math.

3:18 the 'waveforms' are designed to return amplitudes between 1 and -1.

3:19 zakwilson: Unchecked doesn't work for floats, but you can get a speed boost with coercions and type hints.

3:20 Are you using a profiler?

3:20 cmvkk: no; i should try that.

3:20 i don't know much about profiling for java, but i wonder if the fact that most of the performance-intensive functions are anonymous closures would be a problem?

3:20 zakwilson: I bet you'll find a lot of reflection going on somewhere.

3:21 No, not really. They'll have funny names, but you should be able to get some idea of what's going on.

3:21 cmvkk: well i've run the thing with *warn-on-reflection* on before and i don't remember there being anything particularly alarming...but it's been a while.

3:22 zakwilson: I bet the profiler turns up an obvious hot spot of some sort.

3:23 cmvkk: is there a program you can reccomend that works well with clojure?

3:42 zakwilson: cmvkk: I had good luck with Yourkit. It's heavy and slow though.

3:43 cmvkk: hmm, i'll look into that. thanks.

3:51 stuhood: cmvkk: jrat has worked reasonably well for me (but i haven't tried any others): http://jrat.sourceforge.net/

4:57 lisppaste8: djpowell pasted "type hinting" at http://paste.lisp.org/display/76352

4:58 djpowell: I get reflection warnings here. Is it something to do with the char array?

4:59 jdz: djpowell: what's with the dangling parens?

4:59 djpowell: er, dunno - is that a lisp faux pas?

5:00 leafw: djpowell: don't use parens like you would use { } in java/c++

5:01 lisppaste8: jdz annotated #76352 "proper formatting" at http://paste.lisp.org/display/76352#1

5:01 leafw annotated #76352 "untitled" at http://paste.lisp.org/display/76352#2

5:03 djpowell: you don't need #^StringBuffer - constructor calls infer the result type

5:04 it seems that make-array should do the same

5:04 leafw: djpowell: interesting, didn't know that one. Is it new, or was it always there?

5:04 djpowell: (btw - I never knew about chars)

5:04 no always there

5:04 leafw: ok

5:04 djpowell: lots of things do inference, eg catch infers the exception type

5:04 leafw: I think they are all supported (after I "complained"): ints, doubles, chars, ...

5:05 djpowell: (def x cs (make-array Character/TYPE 100))

5:06 oops wrong windows :)

5:10 '(source make-array)

5:10 ,(source make-array)

5:10 clojurebot: java.lang.Exception: Unable to resolve symbol: source in this context

5:11 djpowell: the code for make-array looks suspiciously int-y

5:11 leafw: djpowell: about array types, see Compiler.java:816 http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=clojure/.git;a=blob;f=src/jvm/clojure/lang/Compiler.java;h=846b9d2f0811abe0f5e6fe34007aa812180750dc;hb=12a79925ad0b92240870a8efc4363129dd0eaf52#l816

5:13 djpowell: hmm, could make-array do that for you though... I'll fire up the debugger and try to find out what's going on

5:14 leafw: make-array does that: no warning on reflection with make-array.

5:14 by the way, can one specify the type of a returned object, in the function declaration?

5:14 djpowell: it doesn't work in my example though - I get a reflection warning if I don't type hint the returned make-array

5:15 leafw: are you up to date?

5:15 hum true!

5:15 I wasn't looking at stdout

5:15 sorry

5:16 actually it's the (StringBuffer.) which doesn't do it. make-array does.

5:16 wrong again

5:16 it's the fact that the .append call can't be mapped ... so indeed, make-array is not tagging.

5:17 AWizzArd: clojurebot: max people

5:17 clojurebot: max people is 149

5:33 djpowell: ah, I suppose the compiler can't necessarily know the type of your array at compile-time, whereas it can with the constructor form, so if you make arrays of a fixed type you need to hint them

5:58 lisppaste8: djpowell annotated #76352 "untitled" at http://paste.lisp.org/display/76352#3

5:58 djpowell: Hmm, the #^chars notation works on local declarations, but doesn't work at the function level for some reason

6:08 banisterfiend: clojurebot: !ban AWizzArd

6:08 clojurebot: Excuse me?

6:08 banisterfiend: clojurebot: !kick-ban AWizzArd

6:08 clojurebot: Gabh mo leithsc�al?

6:12 lisppaste8: djpowell annotated #76352 "untitled" at http://paste.lisp.org/display/76352#4

6:14 leafw: djpowell: so you've found a missing feature--chars support was added recently, relative to doubles, ints.

7:04 djpowell: I'd never realised that #^"[C" was valid syntax, till I saw it in core.clj

7:19 Holcxjo: djpowell: Well, it's not exactly pretty nor clear, is it? Is there some function that translates some more verbose but more readable description into this internal Java format?

7:20 djpowell: Noo, I agree, i think #^chars should work on functions

7:21 Holcxjo: ints, doubles, etc work for other types, but chars only works in a let, not on a defn

7:24 Holcxjo: Well, I was thinking more generally -- what if you want to declare some non-standard type? I was thinking something like #^[Array com.some.package.SomeClass]

7:25 rather than #^"[jcom.some.package.SomeClass" -- or whatever the Java mangling of that type is

7:26 djpowell: Yeah, that would be useful

7:27 Chouser: array-of: http://groups.google.com/group/clojure/msg/0e3438dfd241d8ef

7:28 But I'm only mentioning that, not recommending it.

7:36 Holcxjo: Chouser: Indeed. Something a bit more general would be nice... :-)

7:36 BTW: Why is #= not mentioned on http://clojure.org/reader#toc2 ?

7:36 Deliberate or oversight?

7:37 rhickey: Holcxjo: Deliberate

7:38 AWizzArd: btw, what is #= good for?

7:39 Holcxjo: Read-time evaluation AFAIK

7:59 Chouser: I think the most stable description is that #= is a mechanism used by 'print-dup' to otherwise unprinted details to 'read'.

8:04 cemerick: djpowell: on what line is #^"[C"?

8:08 Holcxjo: ,(doc print-dup)

8:08 clojurebot: "; "

8:08 Holcxjo: Very verbose that doc string. :-)

8:08 cemerick: I'd like to see #= grow into a generalized serialization mechanism. You can already get there if you stub out fns to handle construction edge cases, but that feels very much like a temporary hack.

8:09 djpowell: cemerick: it is used in make-array in core.clj

8:10 cemerick: you can put it after a defn to declare the return type of the function to be an array, but it seems a bit hacky

8:11 cemerick: huh, it must be in a different rev then what I have locally. I've got a #^"[I" there.

8:12 leafw: the y combinator in arc and in java: http://arcfn.com/2009/03/y-combinator-in-arc-and-java.html

8:13 haven't seen a clojure version yet -- can't be so hard, can it.

8:13 cemerick: Interesting, though. I'm hoping for ways to define signatures in gen-class that include array and parameterized types. Maybe a String found in a gen-class could be interpreted as necessary; e.g. "[I", "List<String>", etc

8:13 djpowell: cemerick: sorry, yeah it is [I, i got the idea of using [C after seeing [I

8:14 cemerick: (that part of make-array seems a bit quirky)

9:31 lenst: (defn Y [r] (#(% %) #(r (fn [x] ((% %) x)))))

9:35 clojurebot: svn rev 1318; fixed header comment

10:00 hiredman: ~max people?

10:00 clojurebot: max people is 149

10:02 leafw: hiredman and AWizzArd keep asking ~max people ... I wonder why

10:08 jdz: to annoy people?

10:09 kotarak: to check the conjecture, that (max people) * 10 = members of the google group

10:10 jdz: well, anybody can talk privately to bots if they want

10:37 gnuvince: Anybody read "Head First Java"?

10:38 Chouser: I now believe that the similarities between doseq and for are not caused by an underlying similarity in implementation.

10:38 they code that could have in common is so small compared to the code that must differ.

10:41 rhickey: Chouser: interesting, but makes sense

10:42 gnuvince: Chouser: hmmmr?

10:50 Chouser: The parsing of the binding vector could be the same, and the code produced by :let is the same.

10:51 both have a similar loop-seq-recur form for each nested level

10:52 but that's it. 'for' has other extra stuff per nested level. the code produces for :when and :while are different

10:52 even more damaging to any attempt to factor out commonality is that each need different kinds of information about sub-nested levels

10:53 doseq needs to understand where the tail positions are, such that it can inser 'recur', while 'for' doesn't care at all.

10:53 but 'for' needs to have access to the sub-seq (if any) for each level, while 'doseq' does not.

10:55 and finally, 'doseq' is required sooner in core.clj, and so can't use destrucutring, while 'for' is sufficiently more complex that destructuring helps reduce clutter quite a bit.

10:57 but that means it's a significant feature that 'for' and 'doseq' have such a similar interface. They provide an useful abstraction between lazy and imerative iteration.

10:57 imperative

10:57 gnuvince: you asked. :-)

10:59 Lau_of_DK: Hey guys - Any Java wiz's around?

10:59 gnuvince: Chouser: I still don't understand your point. What, different functions do different things?

11:02 Chouser: different macros with nearly identical (relatively complex) interfaces that do conceptually very similar things require almost completely different implementations.

11:06 brianh: Lau: wouldn't

11:08 sry bout that... let me try again. wouldn't say i'm a wiz, but you might get lucky. shoot!

11:14 Lau_of_DK: brianh: http://www.jmonkeyengine.com/jmeforum/index.php?topic=6870.0 The second linke jME2.zip can you get those to compile ?

11:15 brianh: Lau: i can try. give me a few... ;)

11:16 Lau_of_DK: Take all the fews you want :)

11:24 brianh: Lua: k just got the svn. interesting side note. The guy who started jMonkey (Mark Powwell) used to work on the project I'm on now.

11:25 Lau_of_DK: Cool - Which project is that?

11:25 brianh: Lua: this gives me an excuse to see where he's taken it :)

11:26 Lau_of_DK: http://gpwiki.org/forums/viewtopic.php?t=3351

11:26 He's come quite far

11:26 brianh: Lua: we do some simulation stuff. nothing too fancy

11:27 Lau_of_DK: k - btw, its Lau, not Lua - thats a scripting language

11:29 brianh: Lau: sorry (it's Monday AM for me)

11:30 zakwilson: I like Lua! Oh, and Lau seems like an OK guy too.

11:30 Lau_of_DK: no probs :) Did you catch the link with the pics ?

11:30 :)

11:31 brianh: Lau: yes. pretty nice.

11:33 Lau_of_DK: brianh: Im not too hot with Java, but is it possible to compile those files into a little .jar that I can just import?

11:35 brianh: Lau: don't see why you couldn't.

11:36 Lau_of_DK: oh - I cant because I dont know how, but I was hoping you could :)

11:40 brianh: Lau: i don't do to much jarring by hand anymore (Eclipse has made me terribly lazy). just google jarring for cmd line instructions

11:40 Lau: here's one: http://www3.ntu.edu.sg/home/ehchua/programming/java/J9d_Jar.html

11:41 Lau_of_DK: ok, so thats packaging, did you work out how to compile?

11:42 brianh: Lau: not yet. trying to get all the dependencies resolved in the main jmonkey project (swt & gl)

11:44 Lau_of_DK: k, cool

12:05 brianh: Lau: sorry bout the delay. had an interruption. anyway, looks like that zip file is missing the com.gibbon.jme package to me

12:06 Lau_of_DK: brianh: no probs - thats sounds possible, is it available somewhere?

12:07 brianh: Lau: maybe try looking in the first zip in case he did a delta only between jME1 & jME2 (or just google 4 it)

12:08 Lau_of_DK: Theres nothing in the first, google will take some time

12:09 Typical - Its written by some 19 year old kid who was in such a hurry that the project is now useless... :)

12:11 brianh: Lau: probably. I'm sure I've never done that myself! ;)

12:12 zakwilson: Code done in a hurry that's now useless? Like this? http://paste.lisp.org/display/76132

12:12 (yes, that's real code from something I'm being paid to fix)

12:13 brianh: zak: be careful please. you almost sent me into an epileptic seizure!

12:14 zakwilson: I actually *have* sent someone in to an epileptic seizure.

12:14 Though I did it with a strobing LED panel, not a printf call.

12:16 * zakwilson considers submitting it to the daily WTF.

12:17 zakwilson: But something makes me think they get submissions like that several times a day.

12:24 djpowell: The epl says that I can redistribute the clojure object code as part of a product under a commercial license. Presumably the object code is just the .jar file? So I don't need to redistribute clojure's readme.txt, but I do need to add an EPL compatible license, and I'd have to state that clojure.jar was copyright Rich Hickey somewhere?

12:27 zakwilson: djpowell: Yes, that's my reading of the EPL, but IANAL. There's a FAQ page for the EPL that might answer your question.

12:31 djpowell: zakwilson: yeah I read the FAQ. It is quite a complicated license. I'd expected the FAQ to include some boiler-plate text illustrating what a compatable license would look like, but I can't find anything anywhere.

12:32 It isn't clear who 'The Contributors' would be defined as in a compatable license in the case where you weren't distributing any patches to clojure.

12:35 I guess if it is straight from rich, then 'the contributors', would just be rich.

13:12 Chouser: cgrand: are you around? would you have any objection to merging javadoc and repl-utils into the same namespace?

13:24 __marius__: in java/clojure, is there any way to have a "wildcard" classpath, eg. point it to a directory so that any jar i have in there gets added?

13:25 i see you can add /*, but that seems to do the expansion invocation time

13:26 Chouser: I have -Djava.ext.dirs=/usr/share/java:$HOME/.clojure/classpaths on my java command line

13:26 that finds all the .jar's that Ubuntu installs in /usr/share/java

13:26 hiredman: I have added some stuff to my .zshrc to try and manage my classpath

13:27 Chouser: and I put symlinks in ./clojure/classpaths to other .jar places that ubuntu doesn't know about, like clojure-contrib/src

13:27 __marius__: Chouser: cool, that's exactly what i'm looking for, thanks!

13:28 hiredman: http://gist.github.com/72895

13:30 danlarkin: I modified stephen's clj bash script to search for .jars and .clj source trees in ~/clojure/src

13:30 my CLASSPATH ends up being huge but I don't have to mess with anything to install a new library, just drop it in the directory

13:33 Chouser: I had been using stephen's script, but upon further reading of the java docs, I don't see any reason to avoid java.ext.dirs instead.

13:53 Lau_of_D`: Good evening gents

13:55 durka42: good afternoon Lau

13:56 danlarkin: hiya lau

13:57 Lau_of_D`: danlarkin: Madison on Github yet?

13:57 durka42: durka durka :)

13:58 durka42: :)

13:58 danlarkin: Lau_of_D`: I thought I should write some basic tests before I put it up

14:08 Lau_of_DK: Wonder who that guy was

14:09 oh.. the blessing of multiple desktops

14:09 ayrnieu: --! SOME JERK IS STEALING MY NAME

14:10 /msg #nickserv ghost ayrnieu

14:10 Lau_of_DK: huh.. Someone would actually steal 'ayrnieu' ? :)

14:11 ayrnieu: I'll have you know that millions of gaelic afficionados would love to have my name.

14:11 Lau_of_DK: does that mean millions of 'garlic addicts' ?

14:11 ayrnieu: ... I'm not addicted to garlic anymore.

14:11 Lau_of_DK: oh ok

14:12 WizardofWestmarc: why would you ever want to become NOT addicted to garlic?

14:14 ayrnieu: Wizard - it's delicious, and good for you, and you taste its goodness for hours after each session, but spiteful, hateful people will complain.

14:14 Lau_of_DK: I say let them

14:24 danlarkin: Lau will you write my tests for me please?

14:28 Lau_of_DK: No!

14:28 Are you seriously asking for help, or are you just complaining?

14:28 Barkin' larkin' ?

14:31 danlarkin: haha little bit of both

14:32 Lau_of_DK: To be honest, I think you'd want someone who has a little more experience with Django than me (I have nil) ?

14:32 danlarkin: but what better way to learn than writing tests

14:32 :-D

14:35 Lau_of_DK: Thats true - If you can wait until I get a little more functionality into this game of mine (ie. 10 - 12 effects, music, fixed huge terrains, texture splatting and music), then I'd actually be happy to help

14:38 cmvkk: are you writing a specific game Lau, or just a physics simulator/renderer?

14:40 Lau_of_DK: cmvkk: I writing a game for small kids, who just appreciate slamming the keyboard, jerking the mouse, and watch the computer do stuff in response. (this is for my own 2 year old) - So Im going to have a 3d landscape which you'll be flown around in :)

14:40 Raynes: Does Clojure have a logical negation operator like ! in Java?

14:40 Lau_of_DK: (doc not)

14:40 clojurebot: Returns true if x is logical false, false otherwise.; arglists ([x])

14:40 Raynes: Awesome.

14:41 Thanks.

14:41 Lau_of_DK: Gnarly

14:41 np

14:41 durka42: (doc not=)

14:41 clojurebot: Same as (not (= obj1 obj2)); arglists ([x] [x y] [x y & more])

14:42 Raynes: That's neat.

14:42 Handy.

14:55 danlarkin: Lau_of_DK: sure I'd appreciate your help of course

14:57 Lau_of_DK: Alright, I'll let you know once its done

14:57 I like the name "Madison Square Clabango"

15:01 danlarkin: clabango sounds like an STD

15:48 yonatan__: hello

15:48 did anything happen to lazy-cons?

15:48 kotarak: yonatan__: yes. it's gone. lazy-cons is dead, long live lazy-seq.

15:48 yonatan__: which does the same thing?

15:48 kotarak: http://clojure.org/lazy

15:49 Lau_of_DK: yonatan__: cons does what lazy-cons did

15:49 yonatan__: caches results?

15:50 kotarak: (lazy-cons foo bar) is now basically (lazy-seq (cons foo bar))

15:50 But more details are at the above link.

15:50 yonatan__: ok, thanks.

16:19 Lau_of_DK: In Java, when you declare a public abstract someClass somename() - What are you doing?

16:19 cmvkk: is it...declaring an abstract method that returns someClass?

16:20 i think that's what it is.

16:21 Lau_of_DK: Is this just to avoid "someClass someInstance = new someClass();" ? So you can instead type somename() ?

16:22 cmvkk: unless i'm not understanding the context, somename() would be a method name, not a class name.

16:23 someClass would be the return value of the method.

16:23 the class of the return value, i mean.

16:23 there's no definition, right? it's a method without a definition.

16:23 Lau_of_DK: Exactly

16:23 public abstract TerraView getView();

16:23 cmvkk: it's an abstract method, those are used in abstract classes.

16:24 Lau_of_DK: TerraView tv;

16:24 tv = getView();

16:24 cmvkk: abstract classes are classes that you can't instantiate (because some of their methods have no definition)

16:24 what you're supposed to do is extend them, and then define those methods in the subclass.

16:24 so you need to be looking into the subclasses of that class to find a definition for that method.

16:26 Lau_of_DK: Is this a way of avoiding statics?

16:27 cmvkk: i don't know; i think it's just a way of providing a general superclass for some stuff when there's no general method to do some things

16:27 but why it's used instead of an interface (which does the same sort of thing?) i'm not sure.

16:27 Lau_of_DK: I wonder if this will be tricky to reach from Clojure

16:32 Bracki: You use that to implement the Strategy Pattern e.g.

16:32 Lau_of_DK: huh?

16:32 * ayrnieu invokes the Hail Mary Pattern

16:33 Bracki: Have an abstract class that implements some method. The method will call the abstract method which you must provide.

16:36 Lau_of_DK: But getView is not defined anyway

16:36 anywhere

16:37 hiredman: it must be defined somewhere

16:37 or else it is uncallable

16:37 Lau_of_DK: Then its defined in the superclass

16:54 Chouser: if a method is abstract, there must be a subclass provdied by the library or by yourself that extends the class and provides a definition for that method.

16:55 Lau_of_DK: So its likely its tucked away in the super somewhere?

16:55 Chouser: no, you probably are expected to privide it in your own subclass.

16:56 Lau_of_DK: But Im looking through a test which supposedly demos this class, which is being extended

16:56 Chouser: how does it instantiate the class?

16:58 nullman`: i'm looking for a recomended way to remove duplicate integers from an ordered vector (e.g. [1 2 2 3 3 3 4] => [1 2 3 4])

16:59 durka42: ,(distinct [1 2 2 3 3 3 4])

16:59 clojurebot: (1 2 3 4)

16:59 nullman`: hehe, i didn't find that one in the api docs! thanks

16:59 cmvkk: does distinct run faster on ordered input?

16:59 durka42: although, that doesn't return vector and there might be a faster way if you know it's sorted...

17:01 nullman`: speed is not an issue, it happens once at the end of a function (and the list size is always small)

17:01 durka42: cmvkk: i don't think so, i checks every element against all the ones it's seen before

17:02 ~source distinct

17:03 hiredman: huh

17:03 that is not correct

17:03 damn

17:04 cmvkk: heh

17:04 Chousuke: close enough :P

17:04 cmvkk: actually yeah. it puts the def nicely in the middle of the page.

17:04 durka42: ,^#'distinct

17:04 clojurebot: {:ns #<Namespace clojure.core>, :name distinct, :file "core.clj", :line 2983, :arglists ([coll]), :doc "Returns a lazy sequence of the elements of coll with duplicates removed"}

17:05 durka42: clojurebot's build is a tiny bit out of date

17:06 hiredman: well, the revision clojurebot thinks it is running, is not what it is infact running

17:07 cmvkk: it left out of shame.

17:10 hiredman: ~def distinct

17:14 Raynes: not= should be /= :(

17:15 Lau_of_DK: eww

17:15 cmvkk: i thought it was !=

17:15 Raynes: It should be /anything/ but not=

17:15 Chouser: why?

17:15 Raynes: Because not= is ugly.

17:16 cmvkk: it's probably the most intuitive to people who aren't used to something else.

17:16 since it's actually (not (= ...))

17:16 Raynes: Well, too late for a name change anyways.

17:16 But, ick.

17:17 Lau_of_DK: Raynes: Youre not a true Lisper, I BANISH THEE!

17:18 cmvkk: ...wait, is it not= in other lisps too?

17:18 Raynes: Lau_of_DK: CL defines /=. That's why I said it should be /=.

17:18 I just don't like the not= look of it.

17:18 Lau_of_DK: yea CL is really hot these days, lets implement everything from it into Clojure

17:18 Raynes: But, if I'm the only one ^_^.

17:18 Lau_of_DK: (oops, I was sarcastic again)

17:18 ayrnieu: not= is pretty startling. Maybe it tests the equality of different kinds of knots.

17:19 Chousuke: I think /= would be problematic. / is not allowed in unqualifiedsymbols (except /)

17:19 with a space.

17:19 :P

17:19 cmvkk: that's true too.

17:19 ayrnieu: Lau - I especially enjoy childish CL bashing when it's in the context of something CL gets right.

17:19 Chousuke: but if you ask me, not= is better than /=

17:20 Lau_of_DK: Chousuke: Do you think /= is better than not= ?

17:20 ayrnieu: <> also a decent name.

17:20 Raynes: Lau_of_DK: I just said I don't like the name, and was saying it should have probably been /= since that's what it is in CL. I didn't say we should implement everything from CL.

17:20 Chousuke: Lau_of_DK: I just said the opposite.

17:20 Lau_of_DK: No Chousuke, you said "if you ask me", so I did

17:20 Raynes: Anything but not= would be good.

17:20 Chousuke: Lau_of_DK: :P

17:20 Lau_of_DK: I think not= is great

17:20 Raynes: Of course you do.

17:20 cmvkk: what was wrong with != ? didn't it used to be !=

17:21 Chousuke: I don't see the problem with not= :/

17:21 Raynes: It doesn't matter, it's too late for a name change anyways.

17:21 Chousuke: it's easy to read

17:21 cmvkk: I like not= too.

17:21 Chousuke: as opposed to /= that doesn't really say anything

17:21 it's just slash-equal,

17:21 Raynes: not= is ugly, just my opinion. If one person thinks it's ugly then it doesn't matter. -_-

17:21 ayrnieu: this is also the problem with + - * /

17:21 Raynes: I don't even care.

17:21 cmvkk: yeah i totally wouldn't understand /=. i would think it was the same as C /=

17:22 Chouser: I very rarely use not=

17:22 I prefer if-not and when-not

17:23 cmvkk: oh i didn't know those existed. actually what's the point of any of this?

17:23 ayrnieu: unless is a good name for whe-not

17:23 cmvkk: how hard is it to add (not ...) when needed?

17:23 ayrnieu: cmvkk - the grander point is that it isn't enough to throw the old ways to the wind when you have people in your community for whom any part of the status quo is an old way worth defending.

17:24 cmvkk: well yeah, sure

17:24 Chousuke: ayrnieu: I think when-not is clearer than unless though

17:24 cmvkk: oh man, coming from perl, i miss 'unless'...

17:24 Chousuke: ayrnieu: unless is more elegant but when-not is just impossible to misunderstand.

17:25 ayrnieu: Chousuke - this is why I never write functions. I'm just adding to the conceptual burden of any reader.

17:25 Chousuke: hm?

17:25 cmvkk: ahaha

17:25 ayrnieu: cmvkk - so write it. Clojure has defmacro

17:26 cmvkk: no no, i don't actually care enough about any of this. not= and when-not are fine.

17:26 ayrnieu: (you can even write a do-like that notices infix if/unless , although that woud be horrid.)

17:26 Chousuke: (defmacro unless [& body] `(when-not ~@body)); :P

17:26 cmvkk: saying things like "i miss unless" is mostly idle chatting without any purpose...

17:26 ayrnieu: cmvkk... you don't care about how you write your own program?

17:27 cmvkk: not enough to use nonstandard functions for things for which there are standard functions.

17:28 Raynes: Chouser: Those ideas for wall papers are nice, make one in 1440x900 :>

17:28 Chouser: Raynes: which?

17:28 Raynes: The lambda one.

17:29 I got Cajun Train Mix :D

17:33 Chouser: http://groups.google.com/group/clojure/web/clojure-wallpaper-03-1440x900.png

17:33 durka42: dead link

17:33 Chouser: http://clojure.googlegroups.com/web/clojure-wallpaper-03-1440x900.png

17:34 durka42: sorry, i wasn't logged in

17:34 why does google do the "found - click link to continue" thing

17:34 Chouser: my guess is to prevent general image hosting

17:35 cmvkk: they don't want you to embed it in your webpage somewhere else.

17:35 durka42: ah, that makes sense

17:36 but a meta refresh tag can't be that much trouble

17:37 duncanm: how do i load a jar file into the repl?

17:38 durka42: you can use import as long as it's on the classpath

17:38 (doc import)

17:38 clojurebot: import-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly.; arglists ([& import-symbols-or-lists])

17:38 durka42: that's not a very helpful doc at all

17:39 (import '[java.io File FileInputStream])

17:39 Chouser: if it's on the classpath, you don't need to import

17:39 actually, you never have to import.

17:39 duncanm: Chouser: how do i add something to the classpath?

17:39 add-classpath

17:40 Chouser: duncanm: on the java command line, with -cp

17:40 you can try add-classpath, but it's not well supported.

17:41 duncanm: Chouser: i'm using a bash script for running clojure

17:41 Chouser: is it a bad idea to add pwd to the classpath?

17:41 Chouser: it's probably ok.

17:42 hiredman: duncanm: adding pwd to the classpath will not let you use the jars in the pwd

17:42 Chouser: hiredman: good point

17:42 hiredman: (incase you were going to do that)

17:42 duncanm: hmm

17:43 hiredman: jars have to be in the classpath

17:46 cmvkk: wait, why doesn't that work? if the jar is in pwd and pwd is in the class path, then...?

17:47 hiredman: a jar is like a sub-directory

17:48 if foo/ is in your PATH, foo/bar/ is not

17:48 if foo/ is in your CLASSPATH, foo/bar.jar is not

17:48 cmvkk: so: just having a jar in a directory that's in the classpath doesn't add the jar to your classpath.

17:48 you have to add the jar itself to the classpath.

17:49 hiredman: correct

17:49 cmvkk: hmmmm

17:49 hiredman: unless you use stull like ext.dirs or whatever

17:50 stuff

18:13 WizardofWestmarc: ahhh, netsplits

18:13 bitbckt: noising ones, even

18:14 ayrnieu: (people don't die, they've just connected to a schismatic server)

18:14 cmvkk: i always imagine people talking in a big room, then suddenly the room cracks in half and the other side floats away across a giant chasm.

18:14 clojurebot: svn rev 1319; use openConnection().getLastModified() only for non-jars

18:24 duncanm: what does it mean when i see this error (java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:4)) ?

18:25 hiredman: ~jdoc ExceptionInInitializerError

18:27 duncanm: hiredman: does that usually mean i'm not loading a class file somewhere?

18:28 hiredman: duncanm: dunno

18:28 mbana: this might seem stupid, i apologise if it is; but is it possible to somehow run emacs on the jvm

18:28 hiredman: you would have to port it

18:28 duncanm: mbana: there was a project called jemacs a few years ago

18:29 hiredman: or use a jvm x86 emulator

18:29 mbana: how different is clojure from, say, emacs lisp?

18:29 hiredman: it would be easier to just start from scratch

18:29 mbana: very

18:29 and emacs is not all elisp

18:30 cmvkk: i like the idea of a java x86 emulator. you could run arbitrary layers of it and java alternating.

18:30 hiredman: :(

18:31 taking a performance hit every time

18:31 mbana: i'd fed up of applications shipping with lame editors, especially academics ones, e.g., alloy from MIT

18:33 hiredman: mbana: there are at least two editors written in clojure, but they are both still in the early stages

18:39 rhickey: Thanks to Chouser, (for [x (range 10) :let [x2 (* x x)] y (range 100) :when (< y x2)] [y x2]) now works!

18:39 clojurebot: svn rev 1320; added :let option to for and doseq, order-sensitivity for options, [issue 88], patch from Chouser

18:41 Raynes: I need a new firefox theme.

19:30 duncanm: is there a clojure-helpers library where people are gathering convenience functions to be used with Clojure?

19:30 ayrnieu: clojure.contrib._

19:36 Raynes: Someone should totally fix issue 82.

19:48 keithb: How can I find out which version of Clojure I'm running?

19:48 ayrnieu: you can't.

19:49 keithb: Is there any reason why I should consider *not* upgrading to the most recent version?

19:49 ayrnieu: cd ~/clojure/src/dir; svn up # oh, I was on that version.

19:49 keithb - not at present.

19:49 duncanm: in C#, there's a nice syntax @"C:\temp" which is very handy for writing pathnames in Windows

19:49 it'd be nice in clojure's reader can do something similar

19:50 s/in/if/

19:50 ayrnieu: duncanm - clojure doesn't have read macros, but you only need a (w32 "c:/temp") that translates the /

19:50 duncanm: what's w32?

19:51 ayrnieu: duncanm - clojure doesn't have read macros, but you only need a (pick-some-name "c:/temp") that translates the /

19:51 keithb: duncanm, what are you trying to do? You can specify a path with forward slashes in Clojure (Java), and the runtime will convert them as necessary.

19:51 duncanm: oh

20:03 keithb: ayrnieu, thanks.

20:08 slashus2: Raynes: Is this correct? http://pastebin.com/d38671ee1

20:09 ayrnieu: (.readLine *in*) ; please consider http://paste.lisp.org/new/clojure

20:10 Raynes: paste.pocoo.org > both of those.

20:10 ayrnieu: ,(sort (map #(.getName %) (.getMethods (class *in*))))

20:10 clojurebot: ("atLineStart" "close" "equals" "getClass" "getLineNumber" "hashCode" "mark" "markSupported" "notify" "notifyAll" "read" "read" "read" "read" "readLine" "ready" "reset" "skip" "toString" "unread" "unread" "unread" "wait" "wait" "wait")

20:11 Raynes: And what ayrnieu said. There might be a reason Rich has it as BufferedReader. I personally used an if statement in my version.

20:11 lisppaste8: slashus2 pasted "read-line" at http://paste.lisp.org/display/76392

20:12 slashus2: My version is a little faster than (.readLine *in*)

20:13 lisppaste8: slashus2 annotated #76392 "difference" at http://paste.lisp.org/display/76392#1

20:14 Rayne@acidrayne.net pasted "read-line" at http://paste.lisp.org/display/76393

20:15 slashus2: That is much more flexible, and has good performance.

20:15 Raynes: I believe it's the same thing a guy proposed on the group.

20:16 slashus2: Someone make a patch?

20:17 Raynes: No one has done anything to fix it.

20:17 "read-line" at http://paste.lisp.org/display/76393 <- is what I was referring to.

20:18 slashus2: Chouser: What do you think?

20:19 Chouser: slashus2: my opinion doesn't matter :-)

20:19 Raynes: The reason I made mine the way I did is I figure there might have been a reason that Rich used BufferedReader.

20:19 Chouser: one of the benefits of not being rhickey.

20:20 ayrnieu: clojure seems amenable to some static dispatch. It already has type annotations, it already has compiler support for these; it could have functions that say to the compiler "if it's asserted that my arguments have these types, use this code" -- with even "if my arguments don't have any of these types, complain right away."

20:20 slashus2: rhickey: Is there a reason that BufferedReader was used in read-line?

20:20 Chouser: I believe the Repl used to set up *in* as a BufferedReader

20:21 It may have changed to what it is now when the Repl was re-written in Clojure instead of Java.

20:22 Raynes: Then it was most likely a mistake on rhickey's part and slashus2's version is better than mine :(.

20:22 * Raynes hides in the shadows.

21:09 Chouser: read-line stopped working at svn rev 1229

21:10 Jan 24 removes many reflection warnings from clojure.core files

21:11 scgilardi: reflection was being used to good effect in read-line: both LineNumberingPushbackReader (the default for *in*) and BufferedReader support readLine. With reflection, either works. With a type hint in favor of BufferedReader, LNPBR is not an acceptable argument.

21:13 * Chouser concurs

21:17 scgilardi: Chouser: nice job on the "for" and "doseq" additions. I saw an article from the Haskell guys on supporting "order by" "group by" and "limit" in comprehensions based on those operations in SQL. It sounded useful. The papers on some of this often move quickly into some heavy theory quickly.

21:17 Chouser: hm.. interesting.

21:18 scgilardi: "comprehensive comprehensions" (for your googling pleasure)

21:20 Chouser: doseq and for are now arranged such that extra keyword features should be easier to add.

21:21 scgilardi: cool. I'll go take a look

21:21 Chouser: I don't know about 'order by' though. ;-)

21:23 scgilardi: I would think "group by" would be the scarier

21:30 lisppaste8: Rayne@acidrayne.net pasted ":|" at http://paste.lisp.org/display/76397

21:32 hiredman: re-find doesn't always return a seq

21:32 sometimes it returns a string

21:32 which means your destructuring sometimes converts a string into a seq of characters

21:32 durka42: wouldn't :order-by and :group-by just be calls to sort and group-by?

21:33 hiredman: ,(re-find #"foo" "foo")

21:33 pp

21:33 clojurebot: "foo"

21:33 hiredman: er

21:33 or maybe not

21:33 that is re-split not re-find

21:34 what is the advantage of re-split over String's .split?

21:35 Chouser: it takes a Pattern instead of a String.

21:35 hiredman: ,(.toString #"foo")

21:35 clojurebot: "foo"

21:36 Raynes: hiredman: Thanks.

21:39 Drakeson: how can I create a stand-alone swank instance in clojure so that I can later connect to it?

21:40 actually, can I just use the normal M-x slime, and then do something to detach from the running clojure instance, and then later reconnect to it?

21:48 scgilardi: Drakeson: in googling, I seem some folks using "screen" for that. Leaving the emacs running and then detaching and re-attaching from the whole terminal session. (I don't know whether or not there's a more slime-specific way.)

22:00 Drakeson: scgilardi: I know all that. what I want is the clojure equivalent of (asdf:oos 'asdf:load-op :swank)(setf swank:*use-dedicated-output-stream* nil)(swank:create-server)

22:08 scgilardi: durka42: it seems likely that something like group-by and sort-by would be called. in the paper there is also the option to further process the groups that would be produced by group-by via something like reduce: the sum of individual salaries, grouped by department which produces one sum per department.

22:09 durka42: seems like at this point we start in on the CL loop macro debate

22:10 scgilardi: just pointing it out as interesting

22:11 durka42: it does sound interesting and powerful

22:11 but also cryptic

22:12 scgilardi: the corresponding concepts in SQL are very commonly used and would read similarly.

22:12 durka42: you can do that reduce thing in sql?

22:13 scgilardi: yes. there's an example here: http://www.w3schools.com/sql/sql_groupby.asp

22:15 durka42: ah, i sort of remember doing that

22:17 Raynes: If anyone has any clue how to fix the function I posted, let me know :|.

22:18 scgilardi: have you looked at what re-split is returning?

22:18 Raynes: Yes.

22:18 durka42: Raynes: want to paste example input?

22:18 Raynes: One moment.

22:19 scgilardi: I tried (re-split #" = " "a = b c = d") -> ("a" "b c" "d") which doesn't look like what you want (even if there's a newline between b and c)

22:19 Raynes: http://paste.lisp.org/display/76398

22:20 that returns ("foo" "bar" "bar" "foo")

22:21 hiredman: ,(doc re-replit)

22:21 clojurebot: java.lang.Exception: Unable to resolve var: re-replit in this context

22:21 hiredman: ,(doc re-resplit)

22:21 clojurebot: java.lang.Exception: Unable to resolve var: re-resplit in this context

22:21 Raynes: It's in contrib.

22:21 hiredman: ah

22:21 Raynes: I'm using (.split ..) now.

22:21 Does the same thing anyways.

22:21 Was just messing with re-split.

22:22 hiredman: hmmm

22:22 [a b] is not going to do what you think it does there

22:22 Raynes: I can't figure out any way to do it differently :|

22:23 hiredman: ,(doseq [[a b] '("foo" "bar")] (println a b))

22:23 clojurebot: f o b a

22:23 durka42: you need to operate on separate lines

22:23 hiredman: (apply hash-map '("foo" "bar" "bar "foo"))

22:24 ,(apply hash-map '("foo" "bar" "bar "foo"))

22:24 clojurebot: EOF while reading string

22:24 hiredman: ,(apply hash-map '("foo" "bar" "bar" "foo"))

22:24 clojurebot: {"foo" "bar", "bar" "foo"}

22:24 hiredman: bah

22:24 durka42: (doc line-seq)

22:24 clojurebot: Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.; arglists ([rdr])

22:24 Raynes: I do believe you just fixed mah problem.

22:24 scgilardi: also when you conj into keyvm, you probably want [a b] rather than a b. a b would be appropriate for assoc, not conj

22:24 Raynes: I forgot about hash-map.

22:24 hiredman: ,(conj {} :a :b)

22:25 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword

22:25 Raynes: x_x

22:25 hiredman: ,(conj {} [:a :b])

22:25 clojurebot: {:a :b}

22:25 hiredman: ah ha

22:25 Raynes: I wish NullPointerExceptions were worth money.

22:26 cmvkk: i know!

22:29 Drakeson: I have clojure-contrib. Is there a nice recipe to make a repl more endurable? (a plain "java clojure.main.Repl" kinda sucks)

22:29 hiredman: rlwrap

22:29 twism: ,(re-split #" = " "a = b c = d")

22:29 clojurebot: java.lang.Exception: Unable to resolve symbol: re-split in this context

22:29 Drakeson: hiredman: does it give you completion?

22:29 hiredman: where in contrib is re-split?

22:29 Drakeson: I think it can

22:30 Chouser: clojure.contrib.str-utils

22:30 hiredman: but I've never done it

22:30 ,(require '[clojure.contrib.str-utils :as s])

22:30 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath:

22:30 * hiredman dies

22:31 hiredman: ,(s/re-split #" = " "a = b c = d")

22:31 clojurebot: ("a" "b c" "d")

22:37 lisppaste8: Chouser annotated #76397 "re-seq and reduce" at http://paste.lisp.org/display/76397#1

22:38 Chouser: Raynes ^^^

22:38 hiredman: I am sure you meant to use ^ and $ in that regex

22:39 * Chouser shrugs

22:39 hiredman: well, I am

22:39 Raynes: Was my function really /that/ bad?

22:39 Chouser: do you have an example where mine fails but ^ and $ fixes it?

22:40 Raynes: Man, I should just give up. Everytime I show someone a function I write in Clojure they end up rewriting it completely. :|

22:40 Chouser: :-( don't give up!

22:41 Raynes: Well shit. I can't write a single function that isn't hideous. @_@.

22:41 cmvkk: also that doesn't mean yours is wrong, there's often a lot of ways to do something.

22:41 hiredman: I would find one, but I am rebuilding all of freebsd on my wind atm so doing anything that involves starting the jvm is not going to happen

22:41 Raynes: But his is so pretty.

22:41 Drakeson: whate is clojure.contrib.repl_utils for? can I get a usable readline out of it?

22:41 Raynes: Chouser: Thanks ^_^. I can just use hash-map anyways though.

22:42 hiredman: Drakeson: if you want a java readline, there is jline, but rlwrap is better

22:42 jline does some unicode mangling

22:56 Drakeson: I run: "rlwrap java clojure.lang.Repl", but "(de<TAB><TAB><TAB>" only gives me frustration :p

22:56 does jline provide any symbol completion?

22:56 hiredman: you have to set up completion

22:56 for rlwrap

22:56 I have never done it, but others here have

22:57 I suggest taking a look at the manpage

22:58 durka42: there's a clj.sh script somewhere

23:00 opeckojo: Drakeson: i got rlwrap working by following the instructions here, http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_Clojure_REPL_with_rlwrap

23:04 te_: Just got back from Daniel Dennett lecture -- some incredible insights into computer science

23:04 believe it or not

23:05 durka42: what was he lecturing on?

23:06 te: hmm well, he explained how creationists have a top-down approach, whereas evolution is the bubble up

23:07 but then he proceeded to give the means of combination for the bubble up

23:07 the way things bubble up

23:08 he described us as a combination of trillions of tiny robots, robots that interact in ways that they are not conscious of

23:08 Drakeson: opeckojo: cool, thanks

23:08 te: but i began thinking about clojure/lisp/etc. in that framework

23:09 and i began thinking about metadata as ways of expressing the reason why a block of code might be executed

23:10 the "design space" is increased in utility when blocks of code interact in a way that is fit

23:10 im probably rambling by now, but i think he really gave a sort of roadmap for AI programming

23:11 durka42: does that answer your question? ;)

23:11 durka42: i think so

23:12 cognitive science is fasinating

23:12 te: durka42: could i run something by you?

23:13 durka42: code or philosophy? ;)

23:13 te: a bit of both tbh

23:13 this is a bit of pseudocode that i dreamed up:

23:14 durka42: ~paste

23:14 clojurebot: lisppaste8, url

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

23:14 te: [(+ (a 1)) {meta: greater, add, 1}]

23:14 [(+ (a 2)) {meta: greater, add, 2}]

23:15 The user asks: "How can I add 2 to 1?"

23:15 I know there are a lot of little what-ifs and what-have-yous in this example, but some combination of the above two functions produces 3.

23:16 brute forcing their combination is just mutating and generating both sequences based on their metadata

23:16 durka42: so we need an AI that can write/understand comments :)

23:16 te: exactly

23:16 :)

23:17 but i mean, if you define the initial set of designs possible in a way that is accurate enough to promote desired states

23:17 then you should be able to set it down and let it go wild, no?

23:17 for instance, one of those functions might pass on metadata that proved to be fit to provide the correct answer

23:17 durka42: isn't this sort of the idea behind prolog

23:17 * durka42 does not know prolog

23:18 te: in this case, '1', 'and', '2' would have been instrumental in providing the correct answer

23:18 durka42: right

23:18 te: so that would be fit data

23:18 the return value might be valid metadata,

23:19 durka42: i dont know anything about prolog

23:19 im just fascinated by the idea of combination of code based on "fit" metadata

23:21 durka42: it's a cool concept

23:21 then again do we want our machines knowing how to write clojure?

23:21 that might be too much power

23:21 ;)

23:22 te: haha, touche

23:22 durka42: did you have a lot of epiphanies when you first learned a lisp-ish language?

23:23 i truly feel like my brain has bent into a different shape just by meditating on what lisp lets you do

23:23 durka42: i don't really know if there were epiphany points

23:23 i remember when lambda and map and especially reduce just made my brain hurt

23:23 but now they make so much sense

23:23 ...usually

23:23 te: im still trying to get map and lambda

23:24 durka42: i don't understand monads

23:24 te: i guess im just fascinated by what is possible when you consider code as data

23:24 the parentheses also provide this clarity that ive never really seen in other languages

23:25 MyThing.do.this.other.thing.now.please?.please

23:25 Drakeson: does swank in clojure has something equivalent to (setf swank:*use-dedicated-output-stream* nil) ?

23:27 te: durka42: I'm just thinking that the parens do an excellent job of compartmentalizing code blocks

23:27 durka42: it's true

23:28 te: it also is in the same vein of something that humans who have a 5th grade math education have been brought up to understand, even if the effects of these parentheses are not equivalent

23:28 there is something "right" about using parentheses, trying to put my finger on it

23:29 there's something ambiguous about doing it to every "part" that seems natural, like the way we put spaces in sentences

23:30 those spaces exist to improve readability, give a context for other symbols to express meaning, etc.

23:37 durka42: i have to go

23:37 but i think te needs a blog

23:37 (is that the web 2.0 equivalent of "i would like to subscribe to your newsletter"?)

23:42 Raynes: Is there a Clojure function that takes a string and returns the string with x removed?

23:51 slashus2: Raynes: Just use replace? (.replace "hello" "h" "")

23:51 Raynes: Works for me.

23:52 Thanks.

23:55 durka42: ,(.replace "hello" "l" "")

23:55 clojurebot: "heo"

23:55 durka42: ~jdoc String

Logging service provided by n01se.net