#clojure log - Dec 11 2008

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

0:00 Chouser: "it" being not what I wrote, but what eventually became of the idea once rhickey had refined it.

0:00 drewr: :-)

0:01 jvoorhis: so i can take input from a midi keyboard as an infinite list, map it, do whatever, and pipe it into doseq :)

0:06 Chouser: wow, sounds cool.

0:07 jvoorhis: yeah, i'm wondering what i can do with that

0:07 do we have an equivalent to haskell's scanl?

0:09 drewr: jvoorhis: http://clojure-log.n01se.net/date/2008-10-06.html#11:29

0:09 hiredman: clojurebot: scanl

0:09 clojurebot: scanl is http://paste.lisp.org/display/68046#2

0:10 jvoorhis: thanks

0:10 * jvoorhis wonders if that's going into core

0:10 drewr: Ah, even better.

0:11 hiredman: clojurebot: reduction?

0:11 clojurebot: Huh?

0:11 jvoorhis: what's reduction?

0:12 hiredman: a scanl sort of thing that I think is going to be in core

0:12 Chouser: clojurebot: reduction is http://groups.google.com/group/clojure/msg/4f7e3ca1af3b8b18

0:12 clojurebot: Roger.

0:12 Chouser: I expect it will go into core, but there must be something wrong with it as-is, or it would be there already.

0:13 but that groups link is the latest version I'm aware of -- more mature that the earlier pastes.

0:16 jvoorhis: ah

0:17 reduction is pretty, though i would still name it scan

0:17 Chouser: really?

0:19 jvoorhis: it's still very close to reduce, which makes sense, but the name implies to *me* that it would return a scalar

0:20 but it's not my language, `scan` is valuable symbol real estate, etc

0:20 Chouser: naming discussion here, if you care enough: http://clojure-log.n01se.net/date/2008-12-05.html#10:08a

0:22 and it's not checked in yet, so you have a better chance of getting its name changed now than you will later.

0:24 jvoorhis: i liked reduces better

0:24 but it's awfully close :)

0:24 reducing?

0:24 Chouser: close to 'reduce' or close to how much you like 'reduction'?

0:24 hiredman: reduction is kind of long

0:26 jvoorhis: Chouser: close to reduce

0:26 Chouser: I don't mind the length, but I also feel like 'reduction' implies a single value, despite rhickey's assertions.

0:26 reductions would be fine too.

0:26 jvoorhis: yeah, i'd call the value produced by "reduce" a "reduction"

0:26 hiredman: mreduce?

0:27 Chouser: ultimately, though, I don't care as long as I don't have to write the dumb thing each time I need it. :-)

0:27 hiredman: rollover

0:27 jvoorhis: byproducts-of-reduce

0:28 Chouser: I doubt he'll read this, though, so there's not much point in discussing it now.

0:29 jvoorhis: true

0:29 Chouser: ...unless it leads to one of you making a case on that groups thread.

0:29 jvoorhis: i haven't even subscribed to the mailing list yet, to be honest :(

0:29 or downloaded clojure-contrib, or setup slime, etc

0:29 i'm still very... green

0:29 Chouser: The traffic's way up from a couple months ago. Hard to keep up with now.

0:30 oh, you want clojure-contrib, though, if for nothing more than duck-streams and str-utils

0:30 danlarkin: darn newcomers! ... me being one of them

0:30 Chouser: and maybe seq-utils

0:30 jvoorhis: those sound like good things

0:31 i have a couple thousand lines of computer music code written in ruby, and i've been considering porting some of it

0:31 Chouser: I wonder if it'd be worth splitting the group -- clojure-dev and clojure-help or something.

0:32 jvoorhis: straight ruby or jruby?

0:32 jvoorhis: C ruby

0:32 the midi output lib doesn't support jruby *yet*, and i use a C extension in this ad hoc scheduler i wrote

0:33 Chouser: so you've got a ruby lib and a C extension?

0:33 jvoorhis: most of the pieces to the scheduler would be handed to me via java.util.concurrent, and i'd actually be able to use it from the repl

0:34 Chouser: scheduler as in a real-time thing?

0:34 jvoorhis: the C extension is just a priority queue

0:34 Chouser: yes, though i'm calling it *plush* realtime

0:35 it's susceptible to jitter from the GC

0:36 maybe 10ms at best

0:37 and receiving midi input is difficult, since most libraries assume you aren't trapped inside a single thread

0:52 so keywords are analogous to symbols in ruby -�cheap, interned strings

0:53 are symbols always meant to resolve to an entry in a symbol table, or can they be interpreted otherwise in a macro?

0:54 danlarkin: jvoorhis: the clojure reader doesn't intern

0:54 Chouser: I think "entry in a symbol table" translates to "var in a namespace" in clojure, and symbols can be used lots of ways -- keys in a hash-map, locals, etc.

0:56 Clojure keywords are lot like ruby Symbols, though keywords can be namespace-qualified

0:56 jvoorhis: thanks -�in ruby, interning a string is the same as casting it to a ruby symbol

0:56 do symbols always have to be quoted when using them as keys, etc

0:57 e.g. can i write a macro that accepts bare symbols and treats them as strings?

0:59 danlarkin: (doc name)

0:59 clojurebot: Returns the name String of a symbol or keyword.; arglists ([x])

1:01 jvoorhis: thanks, that's what i was looking for

1:04 Chouser: I just typed several lines of Clojure into irb, and was completely baffled by the errors.

1:04 hiredman: hwa

1:04 jvoorhis: maybe irb bug!!

1:05 Chouser: jvoorhis: note that (name :my-namespace/my-name) returns just "my-name"

1:05 jvoorhis: interesting, so it's almost as if the namespace is metadata

1:09 Chouser: well, 'namespace' return "my-namespace", so it's all in there.

1:09 What Clojure calls metadata doesn't participate in equality, while the namespace part of symbols and keywords definitely does.

1:10 jvoorhis: right; i'm still pretty inexperienced, but it seems as if everything has a secret identity through metadata

1:13 it seems numbers and strings cannot have metadata?

1:14 Chouser: right

1:14 jvoorhis: seems like a fair tradeoff if it avoids extra boxing, but throwing java.lang.IncompatibleClassChangeError is a little confusing

1:15 Chouser: also no metadata on keywords

1:15 jvoorhis: hm, symbols can but keywords cannot

1:15 Chouser: right

1:16 to see part of why, compare (identical? 'foo 'foo) with (identical? :foo :foo)

1:17 jvoorhis: ok, that's not what i expected

1:19 hmmm, (identical? true 'true) ; => true

1:19 Chouser: so you can have two different symbol objects with the same name, and each can have different metadata. They're still = but different objects.

1:19 hiredman: jvoorhis: (class 'true)

1:20 Chouser: but two keywords with the same name (and namespace) are the very same object. Adding metadata would mess that up.

1:20 jvoorhis: right, that all makes sense now - i'm still stuck on ruby's identity semantics

1:21 cemerick: this is unfortunate: (assoc (seq [1 2 3 4]) 0 5) => ClassCastException

1:21 hiredman: uh

1:21 Chouser: cemerick: you want assoc to do something with a seq?

1:22 hiredman: a seq is a view over a collection

1:22 think an iterator (just for this, it is not an iterator)

1:23 Chouser: I think cemerick understands what a seq is, some I'm curious to know what he's driving at.

1:23 wanting to crawl back up from a seq to it's "underlying collection" ... if there even is such a thing?

1:23 I guess that's be crawling down :-)

1:24 jvoorhis: but that isn't possible, is it?

1:24 cemerick: I was hoping that a concrete PersistentVector would return itself from seq

1:25 of course, I see now that PV doesn't implement ISeq

1:25 ...which is surprising to me, I suppose.

1:25 Chouser: the only collection that does is PersistentList, I think.

1:26 the others' internal structure differs too much from what ISeq requires.

1:28 cemerick: surely that's not the case with PV -- its seq() impl returns an instance of an inner class that just delegates back to the PV's .nth() impl for first and rest

1:29 APV, I should say. Rich has a note on APV.Seq that looks like he's planning on something more efficient there, at which point having the separate Seq impl might make more sense to me.

1:31 jvoorhis: what's the protocol for creating string representations from java objects?

1:32 is .toString used if it's defined?

1:33 Chouser: jvoorhis: 'str' uses .toString, yes.

1:35 cemerick: but that inner Seq class tracks it's index inthe underlying vector, right? You'd want all vectors to know their own index, and 'rest' would return a new vector with a new index?

1:36 conj'ing onto that would probably carry forward the now unreachable head of the seq.

1:37 Or could, I suppose copy all the still-reachable vals from the old vector into the new one.

1:40 cemerick: Chouser: well, APV.Seq.rest does just that, and it always retains the head of the original vector as far as I can see...

1:40 I don't know, I'm pretty tired :-)

1:41 Chouser: hm, I guess you're right. You can't conj onto it of course, but I guess maybe that doesn't help much.

1:42 cemerick: do you want to be using PersistentQueue instead?

1:42 cemerick: it's a super-minor point, but was surprising to me, since (at least to my intuition) a vector should be able to serve as its own seq as efficiently as anything else

1:43 Chouser: you can pop your way along a PQ and still conj on the other end.

1:43 cemerick: I happen to need assoc in this case...

1:43 it's fine, though, now that I'm conscious of the situation

1:44 Chouser: ok

1:46 jvoorhis: seque doesn't quite do what i want with a LinkedBlockingQueue

1:46 the iterable doesn't call .take, and therefore never blocks

1:50 Chouser: every time you call 'rest' on the thing seque returns, it'll call .take

1:54 jvoorhis: that doesn't seem to be the case

1:55 it seems to be using a non-destructive iterator instead

1:58 Chouser: (def slow-producer (iterate #(do (Thread/sleep 1000) (inc %)) 0))

1:58 (take 5 slow-producer)

1:59 that'll take 5 seconds and then you'll see all 5. Those are now cached in the seq, so calling the same 'take' again will be fast.

2:00 Now as soon as you do this, the producer will start going: (def q (seque slow-producer))

2:00 if you quickly (take 10 q) it may take a couple seconds or perhaps not.

2:00 jvoorhis: thanks, that's a good example for me

2:01 i wish the docs contained examples for most things

2:01 Chouser: but if you (take 60 q) it'll block for nearly a minute.

2:01 yes, I agree. That needs to be done. we need a wiki with a page per function.

2:02 of course the examples will get out of date if unless they can be automatically checked somehow. :-/

2:02 jvoorhis: yes

2:26 cemerick: yeah, the auto-testing wiki would be a really nice touch. I unfortunately seem to be a continual state of 'buried', tho.

3:20 Lau_of_DK: Good morning all

3:23 lisppaste8: cut-the-bs pasted "to-be-fair" at http://paste.lisp.org/display/71967

4:28 Lau_of_DK: lisppaste8: url

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

9:00 rafting: I have a little trouble with a macro

9:03 or i dont. damn never need macros. functions always do it...

9:04 Lau_of_DK: rafting: what was your question ?

9:05 rafting: when i do (defn f [a & args] ...) , how do i call args?

9:05 it is a list then right?

9:05 so

9:05 Lau_of_DK: (defn f [a & args] (class args))

9:05 try that

9:14 user> (defn t [a & args] (class args))

9:14 #'user/t

9:14 user> (t [1 2 3] [1 2 3])

9:14 clojure.lang.ArraySeq


9:14 rafting: yes

9:15 so how do I write a function that applies a function that can differ to a different amiunts of arguments?

9:15 is that when I use then (fn [x] [x y]...)?

9:16 Lau_of_DK: You mean a multimethod?

9:16 Or just arity ?

9:16 mehrheit: rafting: there's `apply'

9:18 rafting: ah yes ofc

9:18 Lau: some method s have liekdouble argumentlists

9:19 Lau_of_DK: You have multimethods which do various things depending on the arguments that are passed to them

9:19 (doc multimethod)

9:19 clojurebot: Gabh mo leithsc�al?

9:19 mehrheit: rafting: do you mean variable arity?

9:20 i.e. when a function does different things depending on the number of arguments passed?

9:23 Chousuke: rafting: if you want to overload arity, you need to do (defn foo ([x] arity-1-body) ([x y] arity-2-body) ...)

9:25 rafting: ah i see

9:32 clojurebot: svn rev 1151; added if-not, memoize, and io! io! blocks will throw exceptions when run in transactions made await and await-for use io!

9:37 rhickey: user=> (dosync (io! 42))

9:37 java.lang.IllegalStateException: I/O in transaction (NO_SOURCE_FILE:0)

9:40 Chouser: nice

9:40 Can I still use prn for debugging?

9:41 rhickey: yes, because prn can't be marked io, not all usage is unsafe, for instance printing into string streams

9:41 only await and await-for have io!

9:42 AWizzArd: if-not is really nice

9:43 rhickey: you'd need a very sophisticated type system to tell the difference between safe and not

9:43 AWizzArd: thank cemerick

9:44 * AWizzArd shakes cemericks hand.

9:44 cemerick: hrm, what did I do now? :-)

9:45 rhickey: clojurebot: rev

9:45 clojurebot: Pardon?

9:45 rhickey: clojurebot: svn

9:45 clojurebot: excusez-moi

9:45 rhickey: clojurebot: version

9:45 clojurebot: Huh?

9:45 rhickey: nice

9:45 Lau_of_DK: clojurebot: where are you?

9:45 clojurebot: http://gist.github.com/27733

9:46 cemerick: ah-ha, if-not! Lightness and mirth! :-P

9:46 AWizzArd: Yes yes, I like it.

9:46 * cemerick curses the useless nonexistent irc scrollback

9:46 AWizzArd: Sometimes it's the small things that can make us happy :-)

9:46 cemerick: rhickey: so, were you saying last night that you don't think that using if-not is good style?

9:47 AWizzArd: for recursive functions it can be nice, for readability

9:47 rhickey: cemerick: I wasn't making any value judgment, just wanted to understand your use case

9:48 cemerick: I've been up for around 40 hours, so intelligent communication is a little beyond me at the moment.

9:49 Lau_of_DK: cemerick: You going for some kind of record?

9:49 cemerick: nah, my record is 50 hours, back in college. I'll be done around 2PM.

9:51 Chouser: clojurebot: latest?

9:51 clojurebot: latest is 1151

9:52 cemerick: clojurebot: log?

9:52 clojurebot: No entiendo

9:52 cemerick: clojurebot: svn log?

9:52 clojurebot: Gabh mo leithsc�al?

9:53 Chouser: clojurebot: svn rev 1151

9:53 clojurebot: I don't understand.

9:53 Chouser: svn rev 1151

9:53 clojurebot: svn rev 1151; added if-not, memoize, and io! io! blocks will throw exceptions when run in transactions made await and await-for use io!

9:53 AWizzArd: There we have it

9:54 cemerick: I can't wait to upgrade to svn-head

9:54 rhickey: cemerick: awaiting your feedback on gen-class

9:54 * cemerick blushes

9:54 Chouser: ah, now I understand. Very good.

9:55 cemerick: I've messed with it a bunch -- it should go smoothly. I'm hoping for early next week.

9:55 Chouser: rhickey: I approve of 'io!' ;-)

9:55 rhickey: Chouser: great!

9:55 Chouser: now you understand what?

9:56 cemerick: rhickey: it seems like you're weaving towards a "1.0" soon. Do you have a date (month?) in mind yet?

9:57 Chouser: that it's just an assert. I wondered if 'io!' was related to LFEs or something.

9:57 any style recommendations for if-not?

9:57 rhickey: I want to cut a release shortly, not labeled 1.0, sort of a release candidate

9:59 Chouser: it ends up very few things can be categorically tainted as io!, since there are often 'ok' usages, where a transactional retry is no harm, so this puts it in the hands of users who understand the application/library

9:59 Chouser: yep. again, I fully approve (I'm sure you were waiting breathlessly for my opinion).

10:00 rhickey: Chouser: tho io stuff I've been working on is mostly 'i', so I'm thinking of streams/generators for the lingo

10:00 Chouser: I have a growing swing app to which I added (doswing) and (assert-swing) recently to help control UI stuff in inappropriate threads.

10:02 asserts are a nice complement to dynamism -- just as much protection as you think you need.

10:03 rhickey: just thinking about the complexity of a type system that would understand when prn would be ok without precluding any ok usage makes me glad for a dynamic system once again

10:04 AWizzArd: too sad that static typing comes with a good bit of complexity *sigh*

10:04 rhickey: I don't know of a static system that could do it yet, they just prevent anything that might be bad

10:05 AWizzArd: Yes

10:05 rhickey: and this is really about effects

10:05 AWizzArd: Although I am not sure if this preventing bad stuff could also introduce new bad stuff. For example if you divide something by zero in Haskell, then / returns Infinity.

10:06 What happens if you continue to calculate with that result? Will it stay infinity?

10:06 gnuvince: rhickey: I was reading that Java 7 is getting multi-catch for exceptions. Have you considered something like that for Clojure? (catch [FooException BarException BazException] e (println e))?

10:07 rhickey: gnuvince: I really don't like exception types as error codes

10:07 either the thing you wanted to have happen happened or it didn't

10:08 AWizzArd: That's always true :-)

10:08 rhickey: the problem with switching on type is you don't know that that type being thrown is related to the cause you presume

10:09 Chousuke: AWizzArd: hm, does it really return infinity? isn't that plain incorrect.

10:09 AWizzArd: It returns infinity.

10:10 Chousuke: I wonder why. It should return something saying "undefined" :/

10:10 AWizzArd: no, that would be a runtime type error, and Haskell tries to avoid those :-)

10:10 gnuvince: That's because (/) works with IEEE Floating points or something; div and quot raise an error

10:10 Prelude> 2/0

10:10 Infinity

10:10 Prelude> 2 `div` 0

10:10 *** Exception: divide by zero

10:10 Chousuke: ah

10:11 well in that case it makes sense.

10:11 AWizzArd: either they can throw an exception, they could return infinity or they can give a warning if the compiler is not able to prove that b in a/b is definitly not equal 0.

10:13 For the last case they could require the programmer to put an if before each division, checking if b is equal zero, and make the program not go into this branch then. In that case the compiler would be able to proof that the division won't throw a runtime error.

10:14 gnuvince: what happens if you add 5 to the result of 2/0?

10:14 gnuvince: AWizzArd: Infinity + 5 is probably Infinity

10:14 let me check

10:15 > 4 + (1 / 0)

10:15 Infinity

10:15 AWizzArd: if that is really the case then the bad thing they tried to avoid with it is even worse.

10:15 Now this Infinity thing could jump through 13 functions and suddenly pop up, and you won't know where it came from.

10:16 In my opinion the compiler should not compile as long it is 100% certain that you won't divide by 0.

10:16 Chousuke: I don't think that's possible :/

10:17 AWizzArd: It is possible at least to proof it in several cases.

10:17 Chousuke: yeah, but not in the general case.

10:17 gnuvince: AWizzArd: user=> (/ (float 3) (float 0))

10:17 Infinity

10:17 AWizzArd: If you say a/b and b never gets in touch with data that comes in only when the program is running, then in principle the information about it is in the program.

10:17 gnuvince: evil

10:18 Chousuke: sometimes you actually want the infinity, too :/

10:18 RSchulz: What if I want Aleph-2?

10:18 AWizzArd: ;-)

10:18 gnuvince: AWizzArd: I am not smart enough to know why the Intel engineers decided that division by 0 for floating points is Infinity, but if it's been untouched for 15 years, it's either not a bad idea or just not a problem.

10:19 RSchulz: It's not really Intel, it whatever expert group IEEE formed to create that spec.

10:20 AWizzArd: Anyway, each static type system has its limits. But it would still be cool to have an optional type system for Clojure. I was discussing it with kotarak some days ago over Skype.

10:20 A lot of nice things could be done in principle. Even in a dynamically typed language.

10:20 Chousuke: well, nothing should prevent you from writing a type system.

10:20 AWizzArd: Although this would bring you back (when you optionally chose to check your program) to something similar as an Edit->Compile->Run cycle

10:21 Chousuke: time constraints prevent it at the moment.

10:21 Otherwise I would like to begin something like the Erlang Dialyzer: http://www.it.uu.se/research/group/hipe/dialyzer/

10:22 So, it would be an external program that takes .clj files as input and begins a conversation with you where it tells you what it found out and asks questions where it is not sure.

10:23 Of course, ultra dynamic stuff could never be checked. For example: reading keyboard entries, make a symbol out of them and call a function with that name.

10:23 But lot's of information already exists in dynamically typed languages.

10:24 alphazero: hi all.

10:24 AWizzArd: Such a Clojure Dialyzer could in a later step be integrated into an IDE, and analyze (on some idle cores) while you are typing.

10:24 Hey alpha

10:25 alphazero: AWizzArd: hi

10:25 rhickey: AWizzArd: I think Qi has a neat approach to types that might be applicable a la carte to Clojure

10:26 alphazero: rhickey: how many instances of RT can run on a given jvm?

10:26 AWizzArd: yes

10:26 rhickey: plus you get a mini prolog-like thing in the process

10:26 AWizzArd: would be very cool

10:26 rhickey: alphazero: one per classloader

10:26 AWizzArd: Actually I was thinking about how one could convince Mark to port it to Clojure :-)

10:27 * rhickey waits for the Qi II book to arrive...

10:27 alphazero: rhickey: cool. so i would bootstrap the repl myself on custom loaders?

10:28 RSchulz: Those wishing to prove properties of Clojure programs should (if they're not already) familiarize themselves with ACL2.

10:28 rhickey: alphazero: if you wanted repl independence, yes

10:28 RSchulz: http://www.cs.utexas.edu/~moore/acl2/

10:28 AWizzArd: I think he rewrote Qi three times in the past, so maybe a fourth time would be acceptable.

10:29 alphazero: rhickey: and any hooks for RTs in each to find each other or would it have to be through some java api (like jms)?

10:29 RSchulz: Google seach on "Qi" alone turns up too much stuff. What's another keyword I can use to find it?

10:29 rhickey: alphazero: nothing built in

10:30 AWizzArd: RSchulz: http://www.lambdassociates.org/

10:30 RSchulz: Thanks.

10:30 AWizzArd: (google after "qi lisp")

10:30 It's a lib for Common Lisp.

10:30 rhickey: RSchulz: sequent calculus as type system - very neat

10:31 RSchulz: Fascinating.

10:31 alphazero: rhickey: ok. Btw, been trying to understand the code, somewhat mind bending with all the bytecode gens, but basically, are you creating a AFn per expression? (Trying to understand how import works.)

10:32 rhickey: alphazero: an AFn per fn, not per expression

10:32 not sure how that relates to import

10:32 alphazero: .. excuse my newb-ness :/ what's an fn?

10:32 RSchulz: Is it first-order? HOL? ... Nevermind. I'll read.

10:33 gnuvince: fn == function

10:33 RSchulz: Wow. Actual Gentzen notation!

10:33 rhickey: fn = what you get when you say (fn ...)

10:33 the actual types vary

10:34 RSchulz: rhickey: You believe the Qi type system would be orthogonal to Clojure's existing formalisms?

10:35 AWizzArd: alphazero: it is like (defn foo [x] (+ x 5)), but just without a name: (fn [x] (+ x 5)). So, fn is similar to defn, but (usually) no function name follows.

10:35 duck1123: does anyone know if it's possible to restrict Java's security policy enough that it's not dangerously stupid to expose a repl?

10:35 alphazero: thanks to both. rhickey: mentioned this yesterday. seems clojure's multimethods may be a very effective way to do aspect specifications. That's why was interested in import. After stepping through the code ..

10:35 AWizzArd: RSchulz: yes

10:36 rhickey: RSchulz: yes, that's the neat bit, you just make logical assertions about Clojure functions and prove them on the side

10:36 alphazero: (+) .. I realized I had the wrong notion. Is this correct: clojure creates individual anonymous classes on the fly per function, and then it gets invoked in context of RT and its namespaces, etc?

10:37 rhickey: alphazero: right, there is one Clojure world per classloader

10:37 alphazero: rhickey: so no chance of clojure really doing aspect weaving, right?

10:38 rhickey: alphazero: I'm not sure how they are related

10:38 alphazero: rhickey: i say (import '(...)), that's a function, right?

10:38 RSchulz: How do you pronounce Qi?

10:38 rhickey: kyu eye

10:39 alphazero: (+) so lets say we have a import2, and that uses a classloader that is aware of some specs we loaded earlier regarding crosscuts (-> using multimethods)

10:41 RSchulz: Really? Like Vi with a Q?

10:41 (Old-schoolers from the pre-Vim days know Vi is pronounced vee eye)

10:41 alphazero: rhickey: .. and when you exec that import, you are not using the default classloader, but one that weaves advices, etc.

10:41 rhickey: RSchulz: I believe that's how Mark pronounced it when I saw him speak

10:41 AWizzArd: yes

10:41 RSchulz: OK.

10:43 rhickey: alphazero: if the weaving classloader is the one that loaded Clojure, all of its loaders are delegating children

10:43 duck1123: shouldn't Qi be pronounced Chi?

10:44 RSchulz: He who creates the thing, names the thing.

10:44 (That's why being a god is so very much work.)

10:45 duck1123: god left all the naming to Adam because finding good names is hard

10:45 RSchulz: Slacker.

10:45 duck1123: "You name this stuff... I need a break"

10:45 alphazero: rhickey: right, but this was more about exploring scripting aspects in clojure rather than bootstrapping clojure from a weaving classloader. (perhaps its a silly idea, but just exploring the possibilities.)

10:46 duck1123: I had a guy tell me the other day that "Clojure" was a bad name because people would mis-pronounce the J

10:47 that, and it was "overly clever"

10:47 RSchulz: Did this guy happen to work for Clozure?

10:47 http://www.clozure.com/index.html

10:48 duck1123: no, it was a guy in #tomcat

10:48 alphazero: duck1123: name and logo are ++ good, imo.

10:48 rhickey: Actually the folks from Clozure have been very positive about Clojure, the language if not the name

10:49 alphazero: duck1123: btw, diid you ever find out why tomcat 5.5 didn't like your servlet?

10:49 duck1123: alphazero: no, but I'm using 6.0 now, so I don't really care :)

10:50 alphazero: duck1123: did the classloader stuff change from 5.5 to 6.0? i'm guessing that may have been the issue.

10:50 rafting: anyone ahve a fairly simple GUI program with miglayout that they want to share?

10:51 duck1123: afaik, quite a bit changed under the covers for the two

10:52 I'm still curious to know what the problem was, but I expect the number of people using Clojure (cutting-edge) with Tomcat 5.x (outdated) should be reletively few

10:53 The only reason I was using 5.5 is because that was all Debian had.

10:53 alphazero: duck1123: well, not sure if that's a safe bet. a lot of people are probably still using older versions and we want clojure everywhere, right? ;/

10:54 clojure on oSGI would rock, my guess ..

10:54 cemerick: are there still issues on osgi?

10:55 alphazero: cemerick: i haven't tried yet, but if I do i'll probably run it on felix (apache)

10:55 cemerick: I remember someone putting quite a lot of work into troubleshooting clojure-on-osgi over the summer. I'm sure there's some record of it in the group.

10:56 alphazero: (+) .. actually that should be the most ideal platform. curious why that would have entailed troubleshooting ..

10:56 duck1123: anyone know how to close a swank connection, or otherwise get rid of a leftover binding?

10:56 blackdog: the aot stuff will make it easier i think

10:57 duck1123: by connection, I mean swank binding the port, not emacs connecting to it

10:57 alphazero: blackdog: haven't tried aot yet, but I would agree that should remove all ambiguities regarding classloaders and clj.

10:58 blackdog: which wasn't available when i read the osgi threads originally

10:59 AWizzArd: Let's say we have (def input (new JTextField)). How can I add an Actionlistener that puts "Hello Moon" into the text field when enter was pressed inside that field? Could someone maybe show me a paste?

11:00 alphazero: blackdog: even sun micro got bit by the classloader complexity. there was a bunch of issues with jump start if i remember correctly. its the golden key of jvm but gets pretty hairy with all the containers and stuff.

11:00 blackdog: i bet, it's not something I have to dealt with

11:02 lisppaste8: blackdog pasted "actionlistener" at http://paste.lisp.org/display/71983

11:03 rafting: Im really starting to see how important multimethods are for abstracting away code and making it more understandable. seems I dont really need OO. AT ALL...

11:03 blackdog: rafting, I've seen the light with clojure in this respect too

11:05 alphazero: rafting: back to the future ... :/

11:07 alphazero: i definitely agree with rhickey regarding overuse of OO and think clojure's ad-hoc taxonomies are a great idea, but not yet convinced that OO should be (entirely) abandoned.

11:07 AWizzArd: blackdog: thanks

11:07 blackdog: yw

11:08 i've more or less only used OO languages so the lisp simplicity in comparison is very welcome

11:08 rafting: Im really starting to see how important multimethods are for abstracting away code and making it more understandable. seems I dont really need OO. AT ALL...

11:09 Chousuke: class-based OO is just a special case of multimethods ;)

11:10 Chouser: rafting: I knew that about you.

11:10 alphazero: blackdog: its elegant for sure, but not sure about "simplicity". with all due respect to rhickey, if concurrent programming is beyond "mere programmers", then i'd venture so is lisp.

11:11 Chouser: alphazero: what about lisp do you think is so hard?

11:12 blackdog: for me, after javascript lisp was pretty straightforward, once i got closures and first order functions

11:12 Chousuke: there's nothing inherently difficult about lisp I would say. it's just that lisp-based languages tend to favour difficult concepts.

11:12 blackdog: not that i know it very well

11:12 yet

11:12 but i'm comfortable

11:12 alphazero: Chouser: :) well, to start with, i've been trolling a bit here and there and it seems you always need an expert around to figure out how to write a proper macro.

11:13 (+) i'm sure you've read "worse is better" ..

11:14 Chouser: alphazero: macros are hard, I'll grant you that. But if you pretend you're not allowed to write macros, Clojure is still at least as good as other langauges.

11:14 and if even one member of your team can a macro is necessary, then you're in good shape.

11:15 zakwilson: blackdog: Javascript has closures and first class functions.

11:15 blackdog: yes exactly after finding out about them in that context

11:15 Chouser: being able to write a macro is not a pervasively necessary skill like not screwing up thread saftey is.

11:15 blackdog: clojure was easier to digest

11:16 RSchulz: Chouser: If you're going to eschew macro programming, you might as well program in Blub.

11:16 frodwith: RSchulz: There's a lot more to like about lisp than macros.

11:17 RSchulz: Yes, but metaprogrammability is what makes it different.

11:17 alphazero: Chouser: i like clojure (or I wouldn't bother with it!). Simply for the fact that it seems to be dragging the lisp crowd onto the jvm is *huge* + for java (the platform).

11:17 frodwith: It's a huge plus for the lisp crowd too, since they've been marginalized for the last 20 years.

11:18 zakwilson: I'm not sure who gains more from it, but I've found the options for making desktop apps with other Lisps to be less than attractive.

11:19 rafting: RSchulz: metaprogrammign sint only macros is it? imdoign genetic programming now and im not using a single macro, just eval and rewriting lists at runtime.

11:19 zakwilson: The fact that it's fairly easy to make a swing app and package it in a jar is what originally attracted me to Clojure.

11:19 alphazero: (+).. just not sure if I am sold on the concurrency aspect, for the following reasons: a framework using rhickey's persistent datastructs and executors could get you the same thing. (or am I missing something here?)

11:20 AWizzArd: alphazero: what is the "(+)" thing that you do?

11:20 charles: is there a way to get the help/docstring from within the repl?

11:20 duck1123: I like Clojure because rich didn't bother to hang onto strange conventions just because they have historical significance

11:20 RSchulz: charles: (doc name)

11:20 charles: thx

11:20 RSchulz: (doc doc)

11:20 clojurebot: Prints documentation for a var or special form given its name; arglists ([name])

11:20 rafting: Chouser: you knew what about me?

11:20 frodwith: I like Clojure because it fixes everything I hate about Common Lisp and Scheme.

11:20 Chousuke: alphazero: sure, you can use the persistent data structures from java. but clojure is designed to work with them.

11:21 RSchulz: (doc find-doc)

11:21 clojurebot: Prints documentation for any var whose documentation or name contains a match for re-string; arglists ([re-string])

11:21 frodwith: Let's throw a party!

11:21 alphazero: AWizzArd: :) i'm a total newb. both clojure and irc. its supposed to indicate continue without retyping the <who>: bit.

11:21 Chouser: rafting: just a joke -- you pasted the same thing twice, so the second time I already knew about it from the first time.

11:21 rafting: lol

11:21 Chousuke: alphazero: java isn't exactly good for functional style programing.

11:21 +m

11:21 alphazero: Chousuke: haven't drank the FP coolaid yet ..

11:22 Chousuke: alphazero: heh

11:22 I think it's fairly stupid to not allow standalone functions.

11:22 RSchulz: FP is, it seems to me, an even bigger mindset thing that Lisp is.

11:22 Chousuke: then you need workarounds like static methods that are meh.

11:22 alphazero: Chousuke: you mean in the JVM?

11:22 Chouser: oh, I've tried to understand Qi's sequent notation before. freaks me out.

11:23 Chousuke: alphazero: no, in the java language.

11:23 frodwith: RSchulz: I'd say they're orthogonal and about the same size.

11:23 RSchulz: But as with Lisp, when it clicks, then it's a good thing (that's what I'm expecting, anyway; it hasn't clicked for me, yet!)

11:23 deklund: hi all... is this the standard/idiomatic way of generating a blank string X long ? : (apply str (take X (repeat " ")))

11:23 alphazero: Chousuke: Then what do you call RT.java?

11:23 rhickey: alphazero: you can use Clojure's data structures, STM etc from Java right now. If you do, you'll see the difference it makes having a language that is built around them

11:23 RSchulz: Sequent notation is far older than Qi!

11:23 Chouser: deklund: looks pretty good

11:23 Chousuke: alphazero: it's a class, isn't it?

11:23 alphazero: rhickey: can you elaborate please?

11:24 Chousuke: alphazero: why does a method have to belong to a class?

11:24 deklund: chouser: thanks

11:24 RSchulz: It was invented by a guy named Gentzen to allow a formal notation for aribtrary logical calculi.

11:24 Chousuke: alphazero: I just think that's a fundamental error :)

11:24 alphazero: Chousuke: sure, but its not like its impossible and with static import its not that ugly to call them either.

11:24 Chousuke: it's still not a first-class object by itself.

11:25 you can't pass a method as a parameter.

11:25 lisppaste8: AWizzArd annotated #71983 with "NullPointerException ??" at http://paste.lisp.org/display/71983#1

11:25 alphazero: Chousuke: that we agree on.

11:25 AWizzArd: rhickey: do you have an idea why compiling this can throw a NullPointerException?

11:26 rhickey: alphazero: you'd have to try it to truly appreciate the difference

11:27 AWizzArd: What I find strange is that I get an error during compile time, so when I (load-file "/path/myfile.clj")

11:28 alphazero: rhickey: i have no doubt that clojure is the best way to use your STMs. the ants.clj is just lovely. The context of the comment was the notion of over burdening your typical it shop programmer and as I said, i am not sure if lisp is something they can grock.

11:28 AWizzArd: It reports the line number of "(proxy [KeyListener] []"

11:28 Chouser: can we agree it's a bit impolite to ask for help on code that is missing the import statements needed to reproduce the error?

11:28 Chousuke: Smalltalk shows that having first class "code" objects that you can pass around does not go against OO principles, so languages that force you to make methods bound to classes or objects are just wrong. ;(

11:28 rhickey: Chouser: yes

11:29 frodwith: What is conceptually hard to grock about lisp exactly, alphazero?

11:29 AWizzArd: Chouser: maybe there is an obvious problem inside that an expert could easily spot. The other problem is that I don't have the code on this compi, so I would have to do retype everything. It was just a fast question.

11:29 rhickey: alphazero: and I'm saying you can't just add fp-style programming as a library for Java - just as alien

11:29 alphazero: Chousuke: I said we agree! :) But my understanding is (could be wrong) that its a JVM issue, not the language.

11:29 AWizzArd: Maybe a more general one is easier to answer: under what circumstances can NullPointerExceptions occur when loading a file?

11:30 drewr: rhickey: Isn't there a functionalj that tried that?

11:30 Chousuke: alphazero: nah, clojure has first-class functions (though they're emulated through anonymous classes); java doesn't.

11:31 drewr: http://functionalj.sourceforge.net/

11:31 Chousuke: I guess you could easily add a pre-processor for java to ...

11:31 right.

11:31 alphazero: rhickey: I am sure you are correct. i guess I just have to try it to understand the precise issues.

11:31 Chousuke: should've known someone had done it already :)

11:31 AWizzArd: Chousuke: Java has them through what you mentioned: (annon inner classes). It just takes more chatty syntax to create them.

11:32 alphazero: Chousuke: Callable objects, under the hood.

11:33 Chousuke: AWizzArd: yeah. it is mostly a syntax thing I'm complaining about. but it's an important one.

11:33 AWizzArd: yes

11:34 alphazero: AWizzArd: Wouldn't a true closure/method-object need automagic context binding too?

11:36 AWizzArd: scratch that. Meant with callable. Anon inner, is compile time magic.

11:36 AWizzArd: Chouser: can you think of an example on how to produce a NullPointerException while doing (load-file ..)? What would need to be in that file that loading it throws this Exception?

11:37 alphazero: Gotta run. Thanks to all. Check this out if you haven't seen it: http://www.subtextual.org/ /R

11:37 AWizzArd: Ah, I found it.

11:38 I set up a namespace and did not import (java.awt.event KeyListener). That caused a NullPointerException in the line where I used it.

11:41 rafting: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Ratio

11:41 What is that and how can I get where the actual error happened, the only anoying thing about Clojure is debugging.

11:41 AWizzArd: rhickey: do you see an easy way on how to get in a different/more descriptive error message? For referencing not important classes?

11:42 mfredrickson: rafting: i saw that message when I would define a function liike (fn (a b) ...)

11:43 note the parens instead of braces. correct: (fn [a b] ....)

11:43 i know i've also seen it elsewhere. it does seem to be a catch all

11:45 rafting: do you have some arguments in the wrong order? e.g. (cons '() 3/4)

11:45 correct: (cons 3/4 '())

11:58 Chouser: rafting: (.printStackTrace *e)

12:12 AWizzArd: Is there a way to automatically let proxy fill in empty implementations of all methods that need to be implemented?

12:12 rafting: Chouser: ok but where do I use that?

12:16 Chousuke: AWizzArd: doesn't it already do that?

12:18 AWizzArd: Well, if yes then there could be a problem in swank-clojure or slime. Because I get several exceptions in the *inferior-lisp* buffer when I leave them out.

12:20 To proxy a java.awt.event.KeyListener I commented out (keyPressed [e]) and (keyTyped [e]) and get these Exceptions during runtime. If they put them back in no errors and everything works as expected.

12:20 Chousuke: hm. I thought proxy supplies a default implementation that throws UnsupportedOperationException

12:21 I might be wrong though.

12:21 AWizzArd: On the clojure website it said an UnsupportedOperationException should be thrown. This is what happens for me.

12:22 Chousuke: then if you want a do-nothing implementation then you'll need to specify them manually.

12:23 AWizzArd: Right, this is what I do now. The question is if there is a way to have them implemented automatically. It seems this makes sometimes sense. For example when I want a Swing KeyEvent handler, that just reacts when a key is released, but not when it is pressed.

12:23 Chousuke: you might be able to use some macro magic.

12:24 but I guess that'd be rather complex

12:24 AWizzArd: Well yes, for such a common task I will macro these proxy calls away anyway.

12:24 Chousuke: for a very general macro yes. But for specific Event handlers not, because I will provide empty implementations in the macro.

12:24 Chousuke: yeah

12:25 Perhaps you could write a macro that uses reflection to get the functions required by an interface and generates a proxy form

12:26 but maybe that's overkill :P

12:30 AWizzArd: I don't know very much about this reflection thing in Java.

12:36 RSchulz: You know, I'm usually put off by "manifestos" and talk of "vast grass-roots movement" but http://www.subtextual.org/ is fascinating. Check out the video (40 minutes) at http://www.subtextual.org/subtext2.html

12:37 AWizzArd: Yes, nice vid.

12:37 RSchulz: Thank you for the pointer, alphazero!

12:39 Here's my rule about reflection: Don't go beyond Class.forName(), Class.newInstance() and Class.isAssignableFrom().

12:39 That's what I use for all my "poor-man's plug-in" mechanisms.

12:51 rafting: can i define a multimethod for 2 different dispatches?

12:51 like if list o vector do this

12:51 or if hashmap do this instead

12:55 I have a multimethod member? to see fi a value is in a collection. so for different types of vectors and lists it is the same and for hash-maps it is different.

12:55 i guess i ciuld just if hashmap then else

12:57 RSchulz: I would suggest that if the range of target types is fixed (truly fixed), then an embedded conditional is fine. If there's any need for the domain to be open (as in open-ended), the use a multimethod.

12:57 rafting: i see

12:57 but is there a way to dispatch several values to the same multimethod?

12:58 (defmethod member? clojure.lang.PersistentList ...

12:58 instaead

12:58 RSchulz: I'm not really up on Clojure multimethods, but I believe they admit arbitrary dispatching logic.

12:58 rafting: (defmethod member? clojure.lang.PersistentList clojure.lang.PersistentList

12:59 RSchulz: You might want to consider getting the PDF of Stuart's book (currently beta4); it has a whole chapter on Clojure multimethods.

13:00 rafting: free as in free beer?

13:00 RSchulz: Nope. $$

13:00 Worth it, I'd say.

13:00 But then, I'm a book freak.

13:02 http://www.pragprog.com/titles/shcloj/programming-clojure

13:03 Chouser: rafting: multimethods use 'isa?' so you could use Sequential to get vectors and lists, and IPersistentMap for hash-maps

13:03 rafting: http://clojure.googlegroups.com/web/chart.png

13:07 RSchulz: What a tangled web we weave...

13:07 Is that up-to-date?

13:08 rafting: (isa? '(1 2 3) clojure.lang.Sequential)

13:08 false

13:09 should id ispathc on clojure.lang.Sequential?

13:12 Chouser: hm.

13:13 (isa? (class '(1 2 3)) clojure.lang.Sequential)

13:13 (instance? clojure.lang.Sequential '(1 2 3))

13:14 RSchulz: This is why I always argue to carefully distinguish the terms "is-a" and "a-kind-of". But no one ever listens.

13:14 rafting: but how do i ask and dispatch on it?

13:15 Chouser: use 'class' as your dispatch function in defmulti, and clojure.lang.Sequential as your dispatch value in defmethod

13:15 biab

13:23 zakwilson: I'd like to see a way to do duck-typed method dispatch such that you could say "use this method when it is possible to (concat arg0 arg1)".

13:25 rafting: thanks chousr

13:25 isnt there a member? method in clojure?

13:26 zakwilson: I don't think there is... since I wrote one for some reason.

13:26 RSchulz: (doc member?)

13:26 clojurebot: No entiendo

13:26 RSchulz: (doc contains?)

13:26 clojurebot: Returns true if key is present, else false.; arglists ([map key])

13:27 RSchulz: But note that contains? is only for maps.

13:27 lisppaste8: zakwilson pasted "member? function" at http://paste.lisp.org/display/71991

13:28 zakwilson: though it might be more useful to return x instead of true.

13:28 and shorter to use when instead of if

13:28 lisppaste8: zakwilson annotated #71991 with "better member?" at http://paste.lisp.org/display/71991#1

13:42 rafting: What license should I use if I want: Anyone could do anything they want with this but they can't sue me for anything. I don't want gnu-restrictions like if they change something they have to publish that. Just use and do whatever you like.

13:43 But they should quote it or reference it if they use it.

13:43 danm_: BSD?

13:45 rafting: ok

13:45 java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number

13:45 exactly what am I dong then? can someone give an example?

13:46 (+ 'x 1)

13:47 hoeck: rafting: exactly :)

13:49 RSchulz: rafting: What's the question, exactly? You don't expect to be able to add a symbol and a number, naturally.

13:50 gnuvince: rafting: (+ x 1)

13:50 zakwilson: where x is bound to a number

13:51 rafting: clojure.lang.LazyCons

13:51 java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number

13:51 (println "here be xmin")

13:51 (println (class coll))

13:51 (pr coll)

13:51 (println "//xmin")

13:51 how can pr or println cause that error?

13:52 zakwilson: What's coll?

13:52 rafting: a lazy-cons

13:52 zakwilson: If it's a lazy seq of some sort, it probably contains whatever is throwing the exception.

13:53 since every element is evaluated when you pr it.

13:53 RSchulz: Keep in mind that lazy anything are code, not just inert data. When you evaluate them, you're asking for another incrment of the computation that produces the lazy whatever to be executed.

13:53 That naturally leaves open the possibility of that computation being erroneous in some way.

13:57 zakwilson: (def lazy-error (lazy-cons (+ 1 2) (+ 1 'a)))

13:58 only throws an exception when you ask for the second element

13:58 Lau_of_DK: Good evening gents

13:58 Zak, hows the light show coming along ?

14:02 zakwilson: No progress. One field in this file format used by Compulite doesn't make any sense at all, and Virtualbox is now refusing to boot WinXP (required for Compulite's device file editor).

14:02 rafting: weird thing is im usign keywords not symbols...

14:03 Lau_of_DK: zakwilson: only on field, but everything else is clear?

14:04 zakwilson: Yes.

14:05 I suspect it's calculated using some sort of bit-twiddling.

14:05 Lau_of_DK: You decide what goes in right? And then the trouble now is understanding the output/the reading of the file?

14:06 zakwilson: The files themselves are CSV, so that's easy enough to deal with.

14:06 The trouble is figuring out how one value is calculated.

14:06 Lau_of_DK: Ok, how about keep all the information static and changing 1 value at a time, watching the change in that field?

14:07 zakwilson: Sounds reasonable... now I just have to fix my Virtualbox problem.

14:08 Lau_of_DK: Whats its complaint?

14:08 zakwilson: No complaint. POSTs then shows a black screen.

14:09 I should probably delete the images and reinstall.

14:09 RSchulz: WinXP? That takes most of a day!

14:10 zakwilson: Which is why I haven't done it yet.

14:10 RSchulz: Does VB have something like VMware "appliances?" Pre-built images you can use as starting points?

14:10 zakwilson: It doesn't really need all the updates though - so that makes it a little quicker.

14:11 Lau_of_DK: RSchulz: No not directly, but I believe there are images like that freely available (for a test period like 30 days) on MS.com

14:11 RSchulz: VM is commercial? Open-source?

14:11 VB, that is.

14:12 I use VMware for those times I need Windows.

14:12 zakwilson: Actually, it occured to me that I did have winxp installed on vmware too, and it'll be a lot easier to reinstall vmware than winxp.

14:12 Lau_of_DK: zakwilson: You could whip up a little Citrix Xen Server :)

14:12 * zakwilson would still need winxp installed on something.

14:13 zakwilson: And I don't have any experience to speak of with Citrix or Xen.

14:13 Lau_of_DK: zakwilson: Any chance your could wine your way out of this?

14:13 zakwilson: Nope. Tried it.

14:14 Lau_of_DK: Thats a shame

14:14 rafting: if i cant do (count some-lazy-cons-seq) , what is the error then?

14:14 zakwilson: The app is really buggy.

14:14 rafting: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number

14:14 Lau_of_DK: Well, let me know when you get it running, if its still cryptic you can list-paste a few files/their inputs and we can have a look at it

14:14 rafting: again but why?

14:14 Lau_of_DK: rafting: Which code are you executing?

14:14 zakwilson: rafting: whatever is making the lazy-cons is trying to add a symbol to a number. Anything that evaluates the bad element will throw an exception.

14:14 rafting: its too mucht o paste

14:15 Lau_of_DK: lisppaste8: url

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

14:15 zakwilson: Thanks, Lau_of_DK.

14:15 Lau_of_DK: np :)

14:20 Chouser: You there?

14:20 Chouser: no

14:20 oops

14:20 Lau_of_DK: k

14:20 :)

14:20 danlarkin: liar!

14:20 Chouser: :-)

14:20 I'm here. what's up?

14:20 Lau_of_DK: Chouser: Did you put in any work on transforming SQL queries to higher order functions since last we talked?

14:21 Chouser: nope

14:21 Lau_of_DK: zakwilson: http://www.microsoft.com/downloads/details.aspx?familyid=c2c27337-d4d1-4b9b-926d-86493c7da1aa&displaylang=en

14:21 Chouser: k

14:24 duck1123: Does anyone have any recommendations on where I should put my clojure src files when running under Tomcat? Neither lib/ or classes/ seem right. And I'm afraid of my classes folder getting wiped out.

14:24 RSchulz: duck1123: Why would anything get wiped out?

14:24 Are you deploying a WAR file or loose files?

14:25 duck1123: currently loose files, but I'd eventually like to be able to package this as a wr

14:25 RSchulz: Besides, you shouln't have your original source code in a deployment environment.

14:25 Is this a Linux or Unix host?

14:26 duck1123: currently on Debian

14:26 RSchulz: OK. Then check out the recursive and update options of the "cp" command.

14:26 duck1123: When I go to deploy, I'd probably compile and package only the classes

14:28 RSchulz: Given the fact that Tomcat itself will set up the class path to include WEB-INF/classes, my first thought is to put them there.

14:29 Are you using AOT compilation, or deploying .clj files?

14:29 duck1123: aren't some build tools designed to wipe out the classes folder when cleaning?

14:29 AOT

14:30 hiredman: Just Use make

14:30 RSchulz: I suppose, but like I said, you _really_ don't want your primary source to be in the running Web App.

14:30 Make? Bit your tongue!

14:30 hiredman: bit yours!

14:31 make won't nuke the classes folder

14:31 Lau_of_DK: zakwilson: Did u get my link ?

14:31 duck1123: RSchulz: My running webapp is currently only development. I'm just trying to make it as simple as possible.

14:31 RSchulz: Make isn't a good fit for Java. I tried to use it once upon a time, but I gave up and just used Ant, hideous though its build.xml files are.

14:31 duck1123: Simple is one thing, but foolish quite another.

14:32 hiredman: RSchulz: what's wrong with make+java?

14:32 seems to work fine to me

14:32 zakwilson_: Lau_of_DK: no

14:32 RSchulz: Between Ant, make and "cp -Ru", you have all you need to keep your working code separate from your running code.

14:32 Make just knows nothing of Java. It doesn't even know that Java automatically compiles dependencies.

14:33 Lau_of_DK: zakwilson_: http://www.microsoft.com/downloads/details.aspx?familyid=c2c27337-d4d1-4b9b-926d-86493c7da1aa&displaylang=en#RelatedLinks

14:38 duck1123: perhaps Clojure needs a *src-path* variable. It'll look in this directory for *.clj files only when compiling.

14:39 RSchulz: Are you sure it doesn't?

14:39 zakwilson_: Lau_of_DK: That looks like it requires MS VirtualPC and a Windows host.

14:39 Lau_of_DK: oh :( I thought it was just an image

14:39 sorry

14:40 zakwilson_: It might be possible to convert. Trying to reinstall vmware before I do anything else, as that should be reasonably easy.

14:40 duck1123: RSchulz: I think compile only uses the classpath

14:41 hiredman: you can put the source in one place in the classpath and have the compiler output to another

14:42 duck1123: hiredman: the problem is my only choices (AFAICT) are WEB-INF/lib or WEB-INF/classes and neither seem like a good place to put my src files when developing

14:43 hiredman: *shrug*

14:47 jphr: Any advice on the best way to find a list within a list? (i.e. find (1 1) in ( 0 5 1 3 6 3 5 7 1 1 4 6) )?

14:48 * hiredman smells project euler

14:48 Chouser: jphr: you want the index? or what?

14:48 jphr: Chouser: index is best

14:49 hiredman: ACM competition I did a while back, redoing the problem in clojure

14:50 Chouser: jphr: if you know the length of the sublist you're looking for, 'partition' might be helpful.

14:51 jphr: Chouser: I am, and I'll take a look at the api docs

14:53 Lau_of_DK: (doc partition)

14:53 clojurebot: Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap.; arglists ([n coll] [n step coll])

14:54 jphr: Chouser: that works perfectly, thanks for the advice

14:54 Chouser: you're welcome.

14:56 here's what I've got: (some (fn [[lst i]] (when (= lst '(1 1)) i)) (map list (partition 2 1 longlist) (iterate inc 0)))

14:58 jphr: I'll probably be able to adapt that to work. so much for studying for exams

14:59 Lau_of_DK: Many futures have been crushed by Euler

15:03 AWizzArd: JavaFX looks very straight forward to dive into, only problem is its only for Windows and Mac thus far

15:05 AWizzArd: Lau_of_DK: thanks for the update

15:05 sounds good

15:05 (the first part)

15:06 Lau_of_DK: http://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec.html

15:07 Also good :)

15:07 mmcgrana: is there some trick to be able to pass java classes around for later instantiation, or is it not possible?

15:07 eg (let [c/class String] (new c "foo")) doesn't work

15:07 err sorry

15:08 (let [c String] (new c "foo"))

15:08 any way to get something like that to work?

15:09 Lau_of_DK: If its not yet instantiated (unique in anyway) why do you want to pass it around?

15:09 Chousuke: pass in an instance and use .getClass and .newInstance?

15:10 (fn [x] (-> x .getClass .newInstance)) or something

15:10 Chouser: you can pass around classes

15:10 instances of Class

15:11 mmcgrana: Chousuke: this works (let [c (.getClass "foo")] (.newInstance c))

15:11 Chousuke: right, you can also do (defn instantiate [cls] (.newInstance cls)) and (instantiate String)

15:11 karmazilla: rhickey: I found a fix to my memory issue with nth

15:13 mmcgrana: huh, so (defn instantiate [cls] (.newInstance cls)) (instantiate String) works but (.newInstance String) doesn't

15:14 Chousuke: right... hm.

15:14 weird.

15:14 Chouser: mmcgrana: right, the latter is trying to call the "newInstance" method of the String class

15:14 which doesn't exist

15:14 clojurebot: FAQ #1

15:14 clojurebot: FAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b

15:15 mmcgrana: thanks

15:15 Chouser: mmcgrana: there is no actual FAQ, so don't feel bad. :-)

15:16 mmcgrana: btw (unrelated to this class stuff) I contemplating a Java / Clojure port of a subset of Hpricot

15:17 gnuvince: mmcgrana: that's an HTML scrapping library, right?

15:18 mmcgrana: right, for ruby, its very nice

15:18 Chouser: (clojure.lang.Reflector/invokeConstructor String (to-array ["foo"]))

15:18 gnuvince: mmcgrana: let me know if you get something working

15:18 mmcgrana: I'm writing a series of blog posts on Clojure and the example I'm using is an HTML scraping script

15:19 mmcgrana: o right i was looking at that yesterday

15:19 gnuvince: I was actually thinking of doing such a library myself eventually

15:19 But if you beat me to it, I'd love to know

15:20 mmcgrana: someone has to do it, the state of java html parsers for screen scrappers is depressing

15:20 gnuvince: Totally agree

15:20 danm_: Chouser: can you tell me, is there a way to avoid the need to define things in order, ie, fn a calls fn b, it seems that unless b is already defined, it won't work

15:20 alec: mmcgrana: I got tagsoup working in Clojure, but abandoned it for regexps after futzing with xml zippers

15:20 gnuvince: HTMLParser does the job, but it's definitely limited and way too verbose.

15:21 hiredman: oh man

15:21 blackdog: danm_, use (declare)

15:21 danm_: Chouser: in trying to load a file using slime, for example

15:21 ok

15:21 Chouser: what blackdog said

15:21 (doc declare)

15:21 clojurebot: defs the supplied var names with no bindings, useful for making forward declarations.; arglists ([& names])

15:21 danm_: thanks

15:21 hiredman: Chouser: have you seen the xml/parse message that just showed up on the ml

15:21 Chouser: hiredman: just reading it now

15:21 hiredman: another ('a b x) -> nil

15:21 danm_: so is it idiomatic to declare a sort of api at the top of a source file?

15:21 hiredman: "wtf?"

15:22 Chouser: danm_: I pretty rarely have co-dependencies that require pre-declaration.

15:22 I usually try to keep my def's in order so that I don't need declare.

15:22 danm_: well, I suppose I could just reorder my defns

15:22 ok, fair enough

15:22 thanks

15:23 Chouser: np

15:23 mmcgrana: I just want (let [doc (hpricot-jam/parse (http-get "someurl"))] (hpricot-jam/search doc "some css expression")) no reason for 90% of cases to be more complicated than that

15:24 Chouser: I don't want code in a string, even if it's just CSS.

15:25 mmcgrana: it might make sense to offer a purely data-structure based interface, yeah

15:25 but you get the idea

15:27 clojurebot: svn rev 1152; release coll on nth of seq

15:27 hiredman: ooo

15:28 RSchulz: Huh? What's that say?

15:28 Chouser: that looks like karmazilla's fix

15:29 yep,

15:29 RSchulz: Gack! BUILD FAILED!

15:29 Chouser: ooh, plus a new Stream class. Bet that leaked in from another patch.

15:29 RSchulz: It doesn't like RT.java

15:30 That's what's not compiling.

15:30 Chouser: yeah

15:30 hiredman: ouch

15:30 clojurebot: build is broken

15:30 clojurebot: Ik begrijp

15:30 hiredman: clojurebot: what is the status of the build?

15:30 clojurebot: build is broken

15:30 rhickey: I needed to put up a few new files: 1153

15:31 Chouser: I can never tell if clojurebot is confirming, reporting an error, or just going crazy.

15:31 RSchulz: When in doubt: Going crazy.

15:31 hiredman: clojurebot: build is working

15:31 clojurebot: You don't have to tell me twice.

15:31 RSchulz: Aritificial Lunacy.

15:31 rhickey: streams are there for perusing only, not final


15:32 Thank you!

15:32 clojurebot: svn rev 1153; release coll on nth of seq, stream work in progress

15:32 rhickey: I know, git/mercurial...

15:35 Chouser: :-)

15:36 karmazilla: arigatou! :)

15:36 rhickey: karmazilla: thanks for chasing, I haven't had any time for that one

15:46 Chousuke: wonder if I'm doing something wrong.

15:47 I managed to convert the clojure git mirror from github to follow the svn repo, but I have to do a rebase every time, and it reapplies every patch since rev 1147 :P

15:48 it works, but it's probably not going to be very nice after a hundred more revisions. or two hundred :P

15:50 clojurebot: svn?

15:50 clojurebot: I don't understand.

15:50 Chouser: clojurebot: latest?

15:50 clojurebot: latest is 1153

15:50 Chouser: svn rev 1153

15:50 clojurebot: svn rev 1153; release coll on nth of seq, stream work in progress

15:50 Chousuke: I wanted the url :/

15:50 Chouser: oh. :-) sorry

15:51 Chousuke: I know clojurebot knows it but I don't remember the factoid :P

15:51 Chouser: I don't think he knows it. Perhaps he forgot.

15:51 Chousuke: clojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/

15:51 clojurebot: c'est bon!

15:52 Chousuke: I'm going to try doing an SVN clone for the nth time now.

15:52 I hope it goes through this time

16:12 rafting: if i catch an exception doesnt the computation still go on?

16:13 yes it dfoes

16:13 Lau_of_DK: Depends on your design I think. Usually it will go own, but sometimes I can imagine that it wont be possible

16:14 rafting: ah

16:14 i should catch Exception,not java.lang.Exception

16:15 wait both works wtf

16:15 RSchulz: Clojure shares with Java the automatic importation of everything in java.lang

16:16 rafting: how do I catch 2 different exceptions?

16:16 Chouser: catch their common ancestor and then use an 'if'

16:16 Lau_of_DK: use a bigger net

16:17 RSchulz: Each distinct exception type caught needs a separate catch clause in the (try ...) form.

16:17 blackdog: you can have multipe catch clauses

16:18 Lau_of_DK: Btw Mr. Schulz, a Regex for catching " word" is that just #"\ word" ? (note the prefixed space)

16:18 RSchulz: Just as it would in a Java try {} catch() {} ... finally {} construct.

16:18 A single "word" charcter is signified by \w. One or more would be \w+

16:19 Sorry. I misunderstood. #" word"

16:19 You don't need a backslash in front of the space.

16:19 gnuvince: Lau_of_DK: why do you escape the space?

16:20 Lau_of_DK: Oh okay - Just wondering, thanks guys

16:22 Chouser: oh, clojure does support multiple 'catch' in a single 'try'. I guess it's ClojureScript that doesn't. :-)

16:23 RSchulz: You mean Clojure--?

16:23 Chouser: that's the one

16:25 Except that'd be spelled (dec Clojure)

16:26 RSchulz: Chouser: True. We wouldn't want a derivative language to take away from Clojure itself. The problem with C++ was that we paid AT&T for a new language, got C and AT&T kept the enhanced C...

16:27 Lau_of_DK: Clojure--?

16:27 RSchulz: We're in a <levity> ... </levity> element...

16:27 Lau_of_DK: oh

16:27 Noobs

16:27 hiredman: itym [:levity ...]

16:28 RSchulz: (with-levity :magnitude 'minor ...)

16:28 Lau_of_DK: user=> (filter #(slowBoyInTheClass? %) #clojure)

16:28 RSchulz

16:29 Nice IRC integration...

16:29 Chousuke: but hm

16:30 never mind :P

16:34 Lau_of_DK: Chousuke: ?

16:44 rafting: is there no Array in Clojure?

16:44 i need O(1) lookup but only ekys, no values

16:44 stuarthalloway: rafting: vector isn't fast enough?

16:57 mchurch: Can I ask about some code that is behaving in a counterintuitive way?

16:58 stuarthalloway: mchurch: sure

16:58 mchurch: Ok. I'm trying to convert a vector into a byte[] so I can make a ByteArrayInputStream out of it.

17:01 The code is: (defn primitive-byte-array [vec]

17:01 (let [out (make-array (. Byte TYPE) (count vec))]

17:01 (for [i (range (count vec))]

17:01 (aset-byte out i (nth vec i)))

17:01 out))

17:01 It's not the prettiest piece of code. Anyway, it returns a byte[] that's holding zeros.

17:01 stuarthalloway: mchurch: paste it into http://paste.lisp.org/

17:01 but it looks like you need to doseq or otherwise force "for" which is lazy

17:01 mchurch: Ah.

17:02 lisppaste8: mchurch pasted "byte[] example " at http://paste.lisp.org/display/72004

17:03 mchurch: This makes sense. I assumed that the FOR loop would force the execution

17:03 stuarthalloway: if it does not start with "do" it probably will not "do" anything :-)

17:04 mchurch: I'm new to the sequence/list distinction, etc.

17:04 It's funny because I'm working in the space between a really cool, beautiful, functional language (Clojure) and Java which is, well...

17:04 stuarthalloway: as long as it is a Clojure data structure, it is likely to be lazy, whether list or generic sequence

17:05 mchurch: I find it amusing that Java has two type systems that don't always like each other much, e.g. there's no non-hideous way (that I know of, at least) to convert a Byte[] to byte[].

17:06 sohail: there is no non-hideous way to do anything in Java

17:06 mchurch: sohail: I agree with that.

17:07 I took CS 1 in Java in college (now my school uses Python, thankfully)

17:07 I remember the first time I encountered int/Integer et al...

17:08 stuarthalloway: DOSEQ worked. Thanks.

17:08 One interesting concept in Java is that of having two type systems. It's an interesting idea.

17:08 Because, as I see it, there are fundamentally 2 types of type systems.

17:09 Bottom-up using ADTs from primitives, like Ocaml's system.

17:09 Vs. top-down hierarchical, which is the OO way.

17:10 Java has a top-down system starting from Object, and a separate C-inspired type system of primitives, [], etc.

17:11 stuarthalloway: so it (Java) is the best possible language, because it get more check marks on the side of the box? :-)

17:12 hiredman: well, clojure gets everything java gets

17:12 so, uh, clojure > java

17:12 lisppaste8: stuart.halloway annotated #72004 with "refactoring" at http://paste.lisp.org/display/72004#1

17:12 hiredman: clojurebot: clojure?

17:12 clojurebot: clojure is the bestest programming language available.

17:13 stuarthalloway: mchurch: check out http://paste.lisp.org/display/72004#1: refactored to use indexed, static sugar...

17:21 RSchulz: clojurebot: grammar?

17:21 clojurebot: Titim gan �ir� ort.

17:45 hiredman: hah

18:11 clojurebot: are you broken?

18:11 clojurebot: Pardon?

18:37 rafting: is there no operator for focring to floats?

18:38 forcing

18:38 hiredman: (doc float)

18:38 clojurebot: Coerce to float; arglists ([x])

18:39 hiredman: clojurebot: botsnack

18:39 clojurebot: thanks; that was delicious. (nom nom nom)

18:42 rafting: sure but i meant: (defn div [& args] (float (apply / args)))

18:42 hiredman: ...

18:53 RSchulz: hiredman: You spoil that bot!

18:59 rafting: gosh multifunctions are so cute

18:59 hiredman from the office?

19:00 hiredman: what?

19:08 RSchulz: rafting: "multimethods"

19:09 Multifunction is what you get from a DVM.

19:13 rafting: clojure.lang.MultiFn@2a5ab9

19:13 but ok

19:13 is there a function to convert to fractal expression? ie 6.33 -> 19/3

19:14 dvm?

19:14 RSchulz: Fractal? Or fractional?

19:16 rafting: fractional i guess? as shown above

19:16 hiredman: 6.33 != 19/3

19:17 rhickey: rafting: rationalize

19:17 rafting: to clojure.lang.Ratio

19:17 rhickey: (doc rationalize)

19:17 clojurebot: returns the rational value of num; arglists ([num])

19:17 rhickey: user=> (rationalize 6.33)

19:17 633/100

19:18 RSchulz: 19/3 most certainly is _not_ 6.33!

19:21 rafting: yes but you know what i mean

19:21 anyway name a function that overloads on arity, i want to see how to write them

19:21 RSchulz: You're never going to get a rational from a 3-significant-digit approxmiation thereof.

19:23 (doc map)

19:23 clojurebot: Returns a lazy seq consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.; arglists ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])

19:23 RSchulz: There. Four overloads.

19:23 hiredman: you make the multimethod dispatch somthing like (fn [& x] (count x))

19:24 er

19:24 not that you need to bother with that

19:24 defn will do it for you

19:24 silly me

19:27 RSchulz: rafting: The "how to write them" is made clear in the Clojure docs at http://clojure.org/api#defn

19:32 rafting: is the http://hpaste.org/12985

19:32 doesnt work forme

19:35 Kerris7: (+ 1 1)

19:35 clojurebot: 2

19:37 rafting: Caused by: java.lang.Exception: Can't have fixed arity function with more params than variadic function

19:37 RSchulz: If your'e going to overload a function definition, each arity's argument list and body must be individually enclosed in parentheses.

19:37 As shown in the docs...

19:37 rafting: theya re now then i get above error

19:38 RSchulz: Paste again.

19:38 rafting: http://hpaste.org/12986

19:39 RSchulz: You need to have a way to distinguish the two (same as Java with varargs, actually)

19:40 As you wrote it, it's ambiguous.

19:40 Look at the API page and see the pattern exhibited by overloaded functions shown there.

19:40 That should make it clear.

19:40 hiredman: rafting: [& args] also covers the single arg case

19:40 rafting: ok

19:40 RSchulz: (By the way, the Java comparison has type to help disambiguate, Clojure does not.)

19:41 rafting: What hiredman said.

19:41 hiredman: [x y & args]

19:41 RSchulz: well, it does, you just have tell it to dispatch on type

19:42 RSchulz: Actually, rafting, the diagnostic you got does make it pretty clear what's wrong, does it not?

19:42 hiredman: Which "it" is that?

19:42 hiredman: RSchulz: demulti

19:42 defmulti

19:43 RSchulz: Yes, but we're talking about ordinary, arity-overloaded Clojure functions, not multimethods.

19:44 rafting: but perhaps it should be a multimethod sicne im dispatching on type as well

19:45 RSchulz: If you really need a non-arity-based decision of which concrete function to invoke, then multimethods are required.

19:46 rafting: well I need to differ between (average 1) and (average [1]) so yeah

19:46 RSchulz: Don't be so sure. That looks like arity to me.

19:47 Is the single-argument case even inherently special?

19:47 rafting: well i want an average function for seqs and for just passing numbers

19:48 hiredman: you can just put an if in the function

19:48 RSchulz: But an argument list that is [& stuff] gets you a sequence. And there is a function to flatten arbitrarily nested structure, so you could apply that to an [& rest] argument list and be done with it.

19:49 rafting: which fucntion is that?

19:50 hiredman: (doc flatten)

19:50 clojurebot: It's greek to me.

19:50 hiredman: damn you

19:51 rafting: reduce concat

19:51 hiredman: mapcat

19:51 RSchulz: contrib.seq-utils/flatten

19:51 hiredman: apply concat

19:53 RSchulz: Make that clojure.contrib.seq-utils

19:53 D'Oh! ... clojure.contrib.seq-utils/flatten

19:53 (use 'clojure.contrib.seq-utils) first, of course.

19:54 hiredman: clojurebot: flatten is clojure.contrib.seq-utils/flatten

19:54 clojurebot: Ik begrijp

19:54 RSchulz: (doc clojure.contrib.seq-utils/flatten)

19:54 clojurebot: No entiendo

19:54 RSchulz: hiredman: Shouldn't clojurebot know about contrib?

19:54 hiredman: it only looks up stuff in clojure.core

19:54 RSchulz: Hmm... I guess it would have to (use ...) them all, and I've discovered that they're not all mutually compatible.

19:55 hiredman: RSchulz: well, I don't have contrib installed

19:55 RSchulz: user=> (doc clojure.contrib.seq-utils/flatten)

19:55 -------------------------

19:55 clojure.contrib.seq-utils/flatten

19:55 ([x])

19:55 Takes any nested combination of sequential things (lists, vectors,

19:55 etc.) and returns their contents as a single, flat sequence.

19:55 Gah? Contrib not installed? Eh?

19:55 rafting: anyways if use the same airty [& args] they both become array-seq

19:56 how do I use a multimethod with varying arguments and type?

19:56 hiredman: rafting: http://clojure.org/multimethods

19:57 watch out, the example on the page is not really that simple for someone new to clojure

19:58 RSchulz: rafting: I really think you're going for an excessively complex solution to a simple problem.

19:59 rafting: lol yes

19:59 but i have ti now

20:01 http://hpaste.org/12987

20:01 or not

20:01 duh

20:02 still the same arity problem

20:03 how do I differ (av 1) from (av [1])?

20:05 Chousuke: easy. 1 is not a vector

20:07 RSchulz: I told you: Flatten them all and then process the flattened sequence.

20:10 rafting: but how do i differ between the types to flatten?

20:10 but both are arrayseqs...

20:11 Chousuke: why do you need to differentiate them? :/

20:11 rafting: i see

20:12 chousuke: because i cant apply + t both

20:12 RSchulz: (use 'clojure.contrib.seq-utils)

20:13 (defn avg

20:13 [& vals]

20:13 (let

20:13 [flat-vals (flatten vals)]

20:13 (/ (reduce + 0 flat-vals)

20:13 (count flat-vals))))

20:13 user=> (avg 1 [2 3] 4 '(5) '((6) 7))

20:13 4

20:13 Satisfied?

20:15 rafting: flatten?

20:15 dont have contrib

20:15 RSchulz: You need contrib.

20:18 Chousuke: rafting: why not? you can sum a collection by doing (apply + coll), can't you?

20:21 gnuvince_: Is there a limit to the number of elements that apply can apply?

20:21 RSchulz: Available RAM.

20:21 (Even the whole universe is finite...)

20:21 gnuvince_: So no problem like some languages have where you can't pass more than 255 arguments?

20:22 RSchulz: Not for functions that operate on sequences.

20:22 But there's a fixed upper limit on function arity.

20:23 gnuvince_: Doesn't apply just change (apply + [2 3]) into (+ 2 3)?

20:23 RSchulz: It's overloaded (at the Java level) up to arity 20.

20:23 gnuvince_: and if that's the case, wouldn't you hit that arity limit?

20:23 Chousuke: gnuvince_: apply is not a macro.

20:23 RSchulz: But there's a 20 args + "..." (varargs) overload, too.

20:23 Chousuke: I think apply does some magic behind the scenes.

20:24 RSchulz: Who said anytying about macros?

20:24 gnuvince_: RSchulz: probably when I said "change ... into"

20:24 Chousuke: I'll have to get some sleep though.

20:25 RSchulz: In Clojure, "apply" is not a macro. It's a function.

20:26 Sleep is good. Research continues to emphasize the health (physical and mental) of good sleep.

20:27 rafting, hiredman: Should we not consider Contrib to be essentially integral to the language as it's used in everyday Clojure programming?

20:28 Even thought it's not Core and not literally essential.

20:46 rafting: wait i noticed, i can dispatch on type and then have a different arity to catch?

20:51 my multi works but doesnt make sense

20:52 RSchulz: rafting: Really, use Contrib (everyone does) and take advantage of it. Why are you trying to make this so difficult?

20:58 rafting: it works now

20:59 RSchulz: Mazel Tov!

21:09 rafting: Care to share?

21:33 rafting: wtf i made some change in emacs so now when i press ) it becomes ( instead

21:34 RSchulz: http://hpaste.org/12991

21:34 dont know how good that solution is but it works

21:35 RSchulz: And why is that better than what I showed you?

21:38 rafting: because i made it bitch

21:38 ;)

21:38 RSchulz: Thank you. Goodbye.

21:39 rafting: a

21:44 charliekilo: noob questions - how to 'invoke'/eval function that is value of hashmap? see http://paste.lisp.org/display/72011

21:44 Chouser: ((my-foo :bar))

21:47 gp: Anyone doing something really cool with Clojure? I'm doing genetic programming.

21:47 charliekilo: Chouser: thanks ... makes sense now, one () for de-referencing the map, and one () for eval ... at least thats what I come up with ;)..

21:48 Chouser: charliekilo: right. If the fn in the map took args, ((my-foo :bar) they would go here)

21:49 holmak: gp: I too was inspired by the recent wave of genetic programming I saw on reddit, and I'm trying to do some of my own.

21:50 charliekilo: Chouser: yep, makes sense ... thanks again

21:51 thoughtpolice: hi, i've checked out and built clojure's svn as i'm trying to use (compile), but it's not finding my .clj file for some reason? http://rafb.net/p/1hglWW52.html

21:51 gp: holmak: i wrote a simple genetic algorithm in python, now im writing a genetic programming framework in clojure. i could write it in python too thoguh since it has eval and nice string-manipulation,

21:52 hiredman: RSchulz: I don't have contrib, nor have I used it, so, uh, telling me that everyone has it and uses it doesn't fly

21:52 thoughtpolice: i believe I need to be able to do AOT compilation, so I can use hadoop's script to launch the jar file

21:53 holmak: gp: Are you trying to evolve algorithms, then? Is that what the strings and eval are for?

21:53 hiredman: thoughtpolice: you need to have the directory where clojure puts the compiled class files in the classpath, this defaults to ./classes/

21:54 there is some *variable* you can define to set it

21:55 lisppaste8: ck pasted "assoc fn" at http://paste.lisp.org/display/72012

21:56 thoughtpolice: hiredman: I did 'mkdir classes' and then tried (compile 'org.myorg.WordCount) again and I got "java.lang.RuntimeException: java.lang.ClassNotFoundException: org.myorg.WordCount$_main__4 (NO_SOURCE_FILE:0)" ?

21:56 Chouser: thoughtpolice: "classes" must also be in your classpath

21:57 charliekilo: Chouser: Followup question, if you don't mind. Why does same thing not work using adding function as value to struct using assoc (see http://paste.lisp.org/display/72012)?

21:58 Chouser: charliekilo: 'assoc' does not change or mutate anything.

21:58 thoughtpolice: Chouser: it is? I did (System/getProperty "java.class.path") and the first directory returned is the one where ./org/myorg/WordCount.clj is (see http://rafb.net/p/1hglWW52.html ), so I just did mkdir ./classes

21:59 hiredman: thoughtpolice: ./classes needs to be in you classpath

22:00 Chouser: charliekilo: it creates a new map, which you see displayed. but the value of my-foo is unchanged, so when you look up :blah you will get nil

22:01 charliekilo: Chouser: you're right, I need to think in terms of functions/functional programming, not oo ... thanks again ... you make might night

22:01 I did (((assoc my-foo :blah (fn [] (str "BLAH hello"))) :blah)), which worked!

22:01 Chouser: there you go.

22:02 I'm happy I could make might night.

22:02 charliekilo: LOL sorry, 'my' night ... just to excited ;)

22:02 Chouser: :-)

22:02 hiredman: clojurebot: Chouser is also <reply>Chouser might make night

22:02 clojurebot: In Ordnung

22:28 sage_joch: is there a way to express (say) the equivalent of String.class? (String/class) doesn't seem to be the answer

22:29 Chouser: (indentity String), or often just String

22:29 sage_joch: ah, thanks

22:30 Chouser: clojurebot: can you explain FAQ #1?

22:30 clojurebot: Titim gan �ir� ort.

22:30 Chouser: clojurebot: FAQ #1

22:30 clojurebot: FAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b

22:34 svn rev 1154; emit string constants directly

22:41 rhickey: hmm... getting 13k messages/sec via embedded ActiveMQ in same JVM

22:43 not too shabby

23:18 gp: can i eval a cloure program?

23:19 or just specific forms?

Logging service provided by n01se.net