#clojure logs

2008-12-11

00:00Chouser"it" being not what I wrote, but what eventually became of the idea once rhickey had refined it.
00:00drewr:-)
00:01jvoorhisso i can take input from a midi keyboard as an infinite list, map it, do whatever, and pipe it into doseq :)
00:06Chouserwow, sounds cool.
00:07jvoorhisyeah, i'm wondering what i can do with that
00:07jvoorhisdo we have an equivalent to haskell's scanl?
00:09drewrjvoorhis: http://clojure-log.n01se.net/date/2008-10-06.html#11:29
00:09hiredmanclojurebot: scanl
00:09clojurebotscanl is http://paste.lisp.org/display/68046#2
00:10jvoorhisthanks
00:10drewrAh, even better.
00:11hiredmanclojurebot: reduction?
00:11clojurebotHuh?
00:11jvoorhiswhat's reduction?
00:12hiredmana scanl sort of thing that I think is going to be in core
00:12Chouserclojurebot: reduction is http://groups.google.com/group/clojure/msg/4f7e3ca1af3b8b18
00:12clojurebotRoger.
00:12ChouserI expect it will go into core, but there must be something wrong with it as-is, or it would be there already.
00:13Chouserbut that groups link is the latest version I'm aware of -- more mature that the earlier pastes.
00:16jvoorhisah
00:17jvoorhisreduction is pretty, though i would still name it scan
00:17Chouserreally?
00:19jvoorhisit's still very close to reduce, which makes sense, but the name implies to *me* that it would return a scalar
00:20jvoorhisbut it's not my language, `scan` is valuable symbol real estate, etc
00:20Chousernaming discussion here, if you care enough: http://clojure-log.n01se.net/date/2008-12-05.html#10:08a
00:22Chouserand it's not checked in yet, so you have a better chance of getting its name changed now than you will later.
00:24jvoorhisi liked reduces better
00:24jvoorhisbut it's awfully close :)
00:24jvoorhisreducing?
00:24Chouserclose to 'reduce' or close to how much you like 'reduction'?
00:24hiredmanreduction is kind of long
00:26jvoorhisChouser: close to reduce
00:26ChouserI don't mind the length, but I also feel like 'reduction' implies a single value, despite rhickey's assertions.
00:26Chouserreductions would be fine too.
00:26jvoorhisyeah, i'd call the value produced by "reduce" a "reduction"
00:26hiredmanmreduce?
00:27Chouserultimately, though, I don't care as long as I don't have to write the dumb thing each time I need it. :-)
00:27hiredmanrollover
00:27jvoorhisbyproducts-of-reduce
00:28ChouserI doubt he'll read this, though, so there's not much point in discussing it now.
00:29jvoorhistrue
00:29Chouser...unless it leads to one of you making a case on that groups thread.
00:29jvoorhisi haven't even subscribed to the mailing list yet, to be honest :(
00:29jvoorhisor downloaded clojure-contrib, or setup slime, etc
00:29jvoorhisi'm still very... green
00:29ChouserThe traffic's way up from a couple months ago. Hard to keep up with now.
00:30Chouseroh, you want clojure-contrib, though, if for nothing more than duck-streams and str-utils
00:30danlarkindarn newcomers! ... me being one of them
00:30Chouserand maybe seq-utils
00:30jvoorhisthose sound like good things
00:31jvoorhisi have a couple thousand lines of computer music code written in ruby, and i've been considering porting some of it
00:31ChouserI wonder if it'd be worth splitting the group -- clojure-dev and clojure-help or something.
00:32Chouserjvoorhis: straight ruby or jruby?
00:32jvoorhisC ruby
00:32jvoorhisthe midi output lib doesn't support jruby *yet*, and i use a C extension in this ad hoc scheduler i wrote
00:33Chouserso you've got a ruby lib and a C extension?
00:33jvoorhismost 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
00:34Chouserscheduler as in a real-time thing?
00:34jvoorhisthe C extension is just a priority queue
00:34jvoorhisChouser: yes, though i'm calling it *plush* realtime
00:35jvoorhisit's susceptible to jitter from the GC
00:36jvoorhismaybe 10ms at best
00:37jvoorhisand receiving midi input is difficult, since most libraries assume you aren't trapped inside a single thread
00:52jvoorhisso keywords are analogous to symbols in ruby -�cheap, interned strings
00:53jvoorhisare symbols always meant to resolve to an entry in a symbol table, or can they be interpreted otherwise in a macro?
00:54danlarkinjvoorhis: the clojure reader doesn't intern
00:54ChouserI 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.
00:56ChouserClojure keywords are lot like ruby Symbols, though keywords can be namespace-qualified
00:56jvoorhisthanks -�in ruby, interning a string is the same as casting it to a ruby symbol
00:56jvoorhisdo symbols always have to be quoted when using them as keys, etc
00:57jvoorhise.g. can i write a macro that accepts bare symbols and treats them as strings?
00:59danlarkin(doc name)
00:59clojurebotReturns the name String of a symbol or keyword.; arglists ([x])
01:01jvoorhisthanks, that's what i was looking for
01:04ChouserI just typed several lines of Clojure into irb, and was completely baffled by the errors.
01:04hiredmanhwa
01:04jvoorhismaybe irb bug!!
01:05Chouserjvoorhis: note that (name :my-namespace/my-name) returns just "my-name"
01:05jvoorhisinteresting, so it's almost as if the namespace is metadata
01:09Chouserwell, 'namespace' return "my-namespace", so it's all in there.
01:09ChouserWhat Clojure calls metadata doesn't participate in equality, while the namespace part of symbols and keywords definitely does.
01:10jvoorhisright; i'm still pretty inexperienced, but it seems as if everything has a secret identity through metadata
01:13jvoorhisit seems numbers and strings cannot have metadata?
01:14Chouserright
01:14jvoorhisseems like a fair tradeoff if it avoids extra boxing, but throwing java.lang.IncompatibleClassChangeError is a little confusing
01:15Chouseralso no metadata on keywords
01:15jvoorhishm, symbols can but keywords cannot
01:15Chouserright
01:16Chouserto see part of why, compare (identical? 'foo 'foo) with (identical? :foo :foo)
01:17jvoorhisok, that's not what i expected
01:19jvoorhishmmm, (identical? true 'true) ; => true
01:19Chouserso you can have two different symbol objects with the same name, and each can have different metadata. They're still = but different objects.
01:19hiredmanjvoorhis: (class 'true)
01:20Chouserbut two keywords with the same name (and namespace) are the very same object. Adding metadata would mess that up.
01:20jvoorhisright, that all makes sense now - i'm still stuck on ruby's identity semantics
01:21cemerickthis is unfortunate: (assoc (seq [1 2 3 4]) 0 5) => ClassCastException
01:21hiredmanuh
01:21Chousercemerick: you want assoc to do something with a seq?
01:22hiredmana seq is a view over a collection
01:22hiredmanthink an iterator (just for this, it is not an iterator)
01:23ChouserI think cemerick understands what a seq is, some I'm curious to know what he's driving at.
01:23Chouserwanting to crawl back up from a seq to it's "underlying collection" ... if there even is such a thing?
01:23ChouserI guess that's be crawling down :-)
01:24jvoorhisbut that isn't possible, is it?
01:24cemerickI was hoping that a concrete PersistentVector would return itself from seq
01:25cemerickof course, I see now that PV doesn't implement ISeq
01:25cemerick...which is surprising to me, I suppose.
01:25Chouserthe only collection that does is PersistentList, I think.
01:26Chouserthe others' internal structure differs too much from what ISeq requires.
01:28cemericksurely 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
01:29cemerickAPV, 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.
01:31jvoorhiswhat's the protocol for creating string representations from java objects?
01:32jvoorhisis .toString used if it's defined?
01:33Chouserjvoorhis: 'str' uses .toString, yes.
01:35Chousercemerick: 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?
01:36Chouserconj'ing onto that would probably carry forward the now unreachable head of the seq.
01:37ChouserOr could, I suppose copy all the still-reachable vals from the old vector into the new one.
01:40cemerickChouser: well, APV.Seq.rest does just that, and it always retains the head of the original vector as far as I can see...
01:40cemerickI don't know, I'm pretty tired :-)
01:41Chouserhm, I guess you're right. You can't conj onto it of course, but I guess maybe that doesn't help much.
01:42Chousercemerick: do you want to be using PersistentQueue instead?
01:42cemerickit'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
01:43Chouseryou can pop your way along a PQ and still conj on the other end.
01:43cemerickI happen to need assoc in this case...
01:43cemerickit's fine, though, now that I'm conscious of the situation
01:44Chouserok
01:46jvoorhisseque doesn't quite do what i want with a LinkedBlockingQueue
01:46jvoorhisthe iterable doesn't call .take, and therefore never blocks
01:50Chouserevery time you call 'rest' on the thing seque returns, it'll call .take
01:54jvoorhisthat doesn't seem to be the case
01:55jvoorhisit seems to be using a non-destructive iterator instead
01:58Chouser(def slow-producer (iterate #(do (Thread/sleep 1000) (inc %)) 0))
01:58Chouser(take 5 slow-producer)
01:59Chouserthat'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.
02:00ChouserNow as soon as you do this, the producer will start going: (def q (seque slow-producer))
02:00Chouserif you quickly (take 10 q) it may take a couple seconds or perhaps not.
02:00jvoorhisthanks, that's a good example for me
02:01jvoorhisi wish the docs contained examples for most things
02:01Chouserbut if you (take 60 q) it'll block for nearly a minute.
02:01Chouseryes, I agree. That needs to be done. we need a wiki with a page per function.
02:02Chouserof course the examples will get out of date if unless they can be automatically checked somehow. :-/
02:02jvoorhisyes
02:26cemerickyeah, the auto-testing wiki would be a really nice touch. I unfortunately seem to be a continual state of 'buried', tho.
03:20Lau_of_DKGood morning all
03:23lisppaste8cut-the-bs pasted "to-be-fair" at http://paste.lisp.org/display/71967
04:28Lau_of_DKlisppaste8: url
04:28lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
09:00raftingI have a little trouble with a macro
09:03raftingor i dont. damn never need macros. functions always do it...
09:04Lau_of_DKrafting: what was your question ?
09:05raftingwhen i do (defn f [a & args] ...) , how do i call args?
09:05raftingit is a list then right?
09:05raftingso
09:05Lau_of_DK(defn f [a & args] (class args))
09:05Lau_of_DKtry that
09:14Lau_of_DKuser> (defn t [a & args] (class args))
09:14Lau_of_DK#'user/t
09:14Lau_of_DKuser> (t [1 2 3] [1 2 3])
09:14Lau_of_DKclojure.lang.ArraySeq
09:14Lau_of_DK
09:14raftingyes
09:15raftingso how do I write a function that applies a function that can differ to a different amiunts of arguments?
09:15raftingis that when I use then (fn [x] [x y]...)?
09:16Lau_of_DKYou mean a multimethod?
09:16Lau_of_DKOr just arity ?
09:16mehrheitrafting: there's `apply'
09:18raftingah yes ofc
09:18raftingLau: some method s have liekdouble argumentlists
09:19Lau_of_DKYou have multimethods which do various things depending on the arguments that are passed to them
09:19Lau_of_DK(doc multimethod)
09:19clojurebotGabh mo leithsc�al?
09:19mehrheitrafting: do you mean variable arity?
09:20mehrheiti.e. when a function does different things depending on the number of arguments passed?
09:23Chousukerafting: if you want to overload arity, you need to do (defn foo ([x] arity-1-body) ([x y] arity-2-body) ...)
09:25raftingah i see
09:32clojurebotsvn rev 1151; added if-not, memoize, and io! io! blocks will throw exceptions when run in transactions made await and await-for use io!
09:37rhickeyuser=> (dosync (io! 42))
09:37rhickeyjava.lang.IllegalStateException: I/O in transaction (NO_SOURCE_FILE:0)
09:40Chousernice
09:40ChouserCan I still use prn for debugging?
09:41rhickeyyes, because prn can't be marked io, not all usage is unsafe, for instance printing into string streams
09:41rhickeyonly await and await-for have io!
09:42AWizzArdif-not is really nice
09:43rhickeyyou'd need a very sophisticated type system to tell the difference between safe and not
09:43rhickeyAWizzArd: thank cemerick
09:44cemerickhrm, what did I do now? :-)
09:45rhickeyclojurebot: rev
09:45clojurebotPardon?
09:45rhickeyclojurebot: svn
09:45clojurebotexcusez-moi
09:45rhickeyclojurebot: version
09:45clojurebotHuh?
09:45rhickeynice
09:45Lau_of_DKclojurebot: where are you?
09:45clojurebothttp://gist.github.com/27733
09:46cemerickah-ha, if-not! Lightness and mirth! :-P
09:46AWizzArdYes yes, I like it.
09:46AWizzArdSometimes it's the small things that can make us happy :-)
09:46cemerickrhickey: so, were you saying last night that you don't think that using if-not is good style?
09:47AWizzArdfor recursive functions it can be nice, for readability
09:47rhickeycemerick: I wasn't making any value judgment, just wanted to understand your use case
09:48cemerickI've been up for around 40 hours, so intelligent communication is a little beyond me at the moment.
09:49Lau_of_DKcemerick: You going for some kind of record?
09:49cemericknah, my record is 50 hours, back in college. I'll be done around 2PM.
09:51Chouserclojurebot: latest?
09:51clojurebotlatest is 1151
09:52cemerickclojurebot: log?
09:52clojurebotNo entiendo
09:52cemerickclojurebot: svn log?
09:52clojurebotGabh mo leithsc�al?
09:53Chouserclojurebot: svn rev 1151
09:53clojurebotI don't understand.
09:53Chousersvn rev 1151
09:53clojurebotsvn rev 1151; added if-not, memoize, and io! io! blocks will throw exceptions when run in transactions made await and await-for use io!
09:53AWizzArdThere we have it
09:54cemerickI can't wait to upgrade to svn-head
09:54rhickeycemerick: awaiting your feedback on gen-class
09:54Chouserah, now I understand. Very good.
09:55cemerickI've messed with it a bunch -- it should go smoothly. I'm hoping for early next week.
09:55Chouserrhickey: I approve of 'io!' ;-)
09:55rhickeyChouser: great!
09:55rhickeyChouser: now you understand what?
09:56cemerickrhickey: it seems like you're weaving towards a "1.0" soon. Do you have a date (month?) in mind yet?
09:57Chouserthat it's just an assert. I wondered if 'io!' was related to LFEs or something.
09:57Chouserany style recommendations for if-not?
09:57rhickeyI want to cut a release shortly, not labeled 1.0, sort of a release candidate
09:59rhickeyChouser: 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
09:59Chouseryep. again, I fully approve (I'm sure you were waiting breathlessly for my opinion).
10:00rhickeyChouser: tho io stuff I've been working on is mostly 'i', so I'm thinking of streams/generators for the lingo
10:00ChouserI have a growing swing app to which I added (doswing) and (assert-swing) recently to help control UI stuff in inappropriate threads.
10:02Chouserasserts are a nice complement to dynamism -- just as much protection as you think you need.
10:03rhickeyjust 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:04AWizzArdtoo sad that static typing comes with a good bit of complexity *sigh*
10:04rhickeyI don't know of a static system that could do it yet, they just prevent anything that might be bad
10:05AWizzArdYes
10:05rhickeyand this is really about effects
10:05AWizzArdAlthough 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:06AWizzArdWhat happens if you continue to calculate with that result? Will it stay infinity?
10:06gnuvincerhickey: 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:07rhickeygnuvince: I really don't like exception types as error codes
10:07rhickeyeither the thing you wanted to have happen happened or it didn't
10:08AWizzArdThat's always true :-)
10:08rhickeythe problem with switching on type is you don't know that that type being thrown is related to the cause you presume
10:09ChousukeAWizzArd: hm, does it really return infinity? isn't that plain incorrect.
10:09AWizzArdIt returns infinity.
10:10ChousukeI wonder why. It should return something saying "undefined" :/
10:10AWizzArdno, that would be a runtime type error, and Haskell tries to avoid those :-)
10:10gnuvinceThat's because (/) works with IEEE Floating points or something; div and quot raise an error
10:10gnuvincePrelude> 2/0
10:10gnuvinceInfinity
10:10gnuvincePrelude> 2 `div` 0
10:10gnuvince*** Exception: divide by zero
10:10Chousukeah
10:11Chousukewell in that case it makes sense.
10:11AWizzArdeither 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:13AWizzArdFor 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:14AWizzArdgnuvince: what happens if you add 5 to the result of 2/0?
10:14gnuvinceAWizzArd: Infinity + 5 is probably Infinity
10:14gnuvincelet me check
10:15gnuvince> 4 + (1 / 0)
10:15gnuvinceInfinity
10:15AWizzArdif that is really the case then the bad thing they tried to avoid with it is even worse.
10:15AWizzArdNow this Infinity thing could jump through 13 functions and suddenly pop up, and you won't know where it came from.
10:16AWizzArdIn my opinion the compiler should not compile as long it is 100% certain that you won't divide by 0.
10:16ChousukeI don't think that's possible :/
10:17AWizzArdIt is possible at least to proof it in several cases.
10:17Chousukeyeah, but not in the general case.
10:17gnuvinceAWizzArd: user=> (/ (float 3) (float 0))
10:17gnuvinceInfinity
10:17AWizzArdIf 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:17AWizzArdgnuvince: evil
10:18Chousukesometimes you actually want the infinity, too :/
10:18RSchulzWhat if I want Aleph-2?
10:18AWizzArd;-)
10:18gnuvinceAWizzArd: 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:19RSchulzIt's not really Intel, it whatever expert group IEEE formed to create that spec.
10:20AWizzArdAnyway, 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:20AWizzArdA lot of nice things could be done in principle. Even in a dynamically typed language.
10:20Chousukewell, nothing should prevent you from writing a type system.
10:20AWizzArdAlthough this would bring you back (when you optionally chose to check your program) to something similar as an Edit->Compile->Run cycle
10:21AWizzArdChousuke: time constraints prevent it at the moment.
10:21AWizzArdOtherwise I would like to begin something like the Erlang Dialyzer: http://www.it.uu.se/research/group/hipe/dialyzer/
10:22AWizzArdSo, 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:23AWizzArdOf 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:23AWizzArdBut lot's of information already exists in dynamically typed languages.
10:24alphazerohi all.
10:24AWizzArdSuch a Clojure Dialyzer could in a later step be integrated into an IDE, and analyze (on some idle cores) while you are typing.
10:24AWizzArdHey alpha
10:25alphazeroAWizzArd: hi
10:25rhickeyAWizzArd: I think Qi has a neat approach to types that might be applicable a la carte to Clojure
10:26alphazerorhickey: how many instances of RT can run on a given jvm?
10:26AWizzArdyes
10:26rhickeyplus you get a mini prolog-like thing in the process
10:26AWizzArdwould be very cool
10:26rhickeyalphazero: one per classloader
10:26AWizzArdActually I was thinking about how one could convince Mark to port it to Clojure :-)
10:27alphazerorhickey: cool. so i would bootstrap the repl myself on custom loaders?
10:28RSchulzThose wishing to prove properties of Clojure programs should (if they're not already) familiarize themselves with ACL2.
10:28rhickeyalphazero: if you wanted repl independence, yes
10:28RSchulzhttp://www.cs.utexas.edu/~moore/acl2/
10:28AWizzArdI think he rewrote Qi three times in the past, so maybe a fourth time would be acceptable.
10:29alphazerorhickey: and any hooks for RTs in each to find each other or would it have to be through some java api (like jms)?
10:29RSchulzGoogle seach on "Qi" alone turns up too much stuff. What's another keyword I can use to find it?
10:29rhickeyalphazero: nothing built in
10:30AWizzArdRSchulz: http://www.lambdassociates.org/
10:30RSchulzThanks.
10:30AWizzArd(google after "qi lisp")
10:30AWizzArdIt's a lib for Common Lisp.
10:30rhickeyRSchulz: sequent calculus as type system - very neat
10:31RSchulzFascinating.
10:31alphazerorhickey: 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:32rhickeyalphazero: an AFn per fn, not per expression
10:32rhickeynot sure how that relates to import
10:32alphazero.. excuse my newb-ness :/ what's an fn?
10:32RSchulzIs it first-order? HOL? ... Nevermind. I'll read.
10:33gnuvincefn == function
10:33RSchulzWow. Actual Gentzen notation!
10:33rhickeyfn = what you get when you say (fn ...)
10:33rhickeythe actual types vary
10:34RSchulzrhickey: You believe the Qi type system would be orthogonal to Clojure's existing formalisms?
10:35AWizzArdalphazero: 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:35duck1123does anyone know if it's possible to restrict Java's security policy enough that it's not dangerously stupid to expose a repl?
10:35alphazerothanks 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:35AWizzArdRSchulz: yes
10:36rhickeyRSchulz: yes, that's the neat bit, you just make logical assertions about Clojure functions and prove them on the side
10:36alphazero(+) .. 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:37rhickeyalphazero: right, there is one Clojure world per classloader
10:37alphazerorhickey: so no chance of clojure really doing aspect weaving, right?
10:38rhickeyalphazero: I'm not sure how they are related
10:38alphazerorhickey: i say (import '(...)), that's a function, right?
10:38RSchulzHow do you pronounce Qi?
10:38rhickeykyu eye
10:39alphazero(+) 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:41RSchulzReally? Like Vi with a Q?
10:41RSchulz(Old-schoolers from the pre-Vim days know Vi is pronounced vee eye)
10:41alphazerorhickey: .. and when you exec that import, you are not using the default classloader, but one that weaves advices, etc.
10:41rhickeyRSchulz: I believe that's how Mark pronounced it when I saw him speak
10:41AWizzArdyes
10:41RSchulzOK.
10:43rhickeyalphazero: if the weaving classloader is the one that loaded Clojure, all of its loaders are delegating children
10:43duck1123shouldn't Qi be pronounced Chi?
10:44RSchulzHe who creates the thing, names the thing.
10:44RSchulz(That's why being a god is so very much work.)
10:45duck1123god left all the naming to Adam because finding good names is hard
10:45RSchulzSlacker.
10:45duck1123"You name this stuff... I need a break"
10:45alphazerorhickey: 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:46duck1123I had a guy tell me the other day that "Clojure" was a bad name because people would mis-pronounce the J
10:47duck1123that, and it was "overly clever"
10:47RSchulzDid this guy happen to work for Clozure?
10:47RSchulzhttp://www.clozure.com/index.html
10:48duck1123no, it was a guy in #tomcat
10:48alphazeroduck1123: name and logo are ++ good, imo.
10:48rhickeyActually the folks from Clozure have been very positive about Clojure, the language if not the name
10:49alphazeroduck1123: btw, diid you ever find out why tomcat 5.5 didn't like your servlet?
10:49duck1123alphazero: no, but I'm using 6.0 now, so I don't really care :)
10:50alphazeroduck1123: did the classloader stuff change from 5.5 to 6.0? i'm guessing that may have been the issue.
10:50raftinganyone ahve a fairly simple GUI program with miglayout that they want to share?
10:51duck1123afaik, quite a bit changed under the covers for the two
10:52duck1123I'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:53duck1123The only reason I was using 5.5 is because that was all Debian had.
10:53alphazeroduck1123: 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:54alphazeroclojure on oSGI would rock, my guess ..
10:54cemerickare there still issues on osgi?
10:55alphazerocemerick: i haven't tried yet, but if I do i'll probably run it on felix (apache)
10:55cemerickI 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:56alphazero(+) .. actually that should be the most ideal platform. curious why that would have entailed troubleshooting ..
10:56duck1123anyone know how to close a swank connection, or otherwise get rid of a leftover binding?
10:56blackdogthe aot stuff will make it easier i think
10:57duck1123by connection, I mean swank binding the port, not emacs connecting to it
10:57alphazeroblackdog: haven't tried aot yet, but I would agree that should remove all ambiguities regarding classloaders and clj.
10:58blackdogwhich wasn't available when i read the osgi threads originally
10:59AWizzArdLet'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:00alphazeroblackdog: 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:00blackdogi bet, it's not something I have to dealt with
11:02lisppaste8blackdog pasted "actionlistener" at http://paste.lisp.org/display/71983
11:03raftingIm 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:03blackdografting, I've seen the light with clojure in this respect too
11:05alphazerorafting: back to the future ... :/
11:07alphazeroalphazero: 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:07AWizzArdblackdog: thanks
11:07blackdog yw
11:08blackdogi've more or less only used OO languages so the lisp simplicity in comparison is very welcome
11:08raftingIm 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:09Chousukeclass-based OO is just a special case of multimethods ;)
11:10Chouserrafting: I knew that about you.
11:10alphazeroblackdog: 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:11Chouseralphazero: what about lisp do you think is so hard?
11:12blackdogfor me, after javascript lisp was pretty straightforward, once i got closures and first order functions
11:12Chousukethere's nothing inherently difficult about lisp I would say. it's just that lisp-based languages tend to favour difficult concepts.
11:12blackdognot that i know it very well
11:12blackdogyet
11:12blackdogbut i'm comfortable
11:12alphazeroChouser: :) 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:13alphazero(+) i'm sure you've read "worse is better" ..
11:14Chouseralphazero: 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:14Chouserand if even one member of your team can a macro is necessary, then you're in good shape.
11:15zakwilsonblackdog: Javascript has closures and first class functions.
11:15blackdogyes exactly after finding out about them in that context
11:15Chouserbeing able to write a macro is not a pervasively necessary skill like not screwing up thread saftey is.
11:15blackdogclojure was easier to digest
11:16RSchulzChouser: If you're going to eschew macro programming, you might as well program in Blub.
11:16frodwithRSchulz: There's a lot more to like about lisp than macros.
11:17RSchulzYes, but metaprogrammability is what makes it different.
11:17alphazeroChouser: 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:17frodwithIt's a huge plus for the lisp crowd too, since they've been marginalized for the last 20 years.
11:18zakwilsonI'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:19raftingRSchulz: 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:19zakwilsonThe 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:19alphazero(+).. 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:20AWizzArdalphazero: what is the "(+)" thing that you do?
11:20charlesis there a way to get the help/docstring from within the repl?
11:20duck1123I like Clojure because rich didn't bother to hang onto strange conventions just because they have historical significance
11:20RSchulzcharles: (doc name)
11:20charlesthx
11:20RSchulz(doc doc)
11:20clojurebotPrints documentation for a var or special form given its name; arglists ([name])
11:20raftingChouser: you knew what about me?
11:20frodwithI like Clojure because it fixes everything I hate about Common Lisp and Scheme.
11:20Chousukealphazero: sure, you can use the persistent data structures from java. but clojure is designed to work with them.
11:21RSchulz(doc find-doc)
11:21clojurebotPrints documentation for any var whose documentation or name contains a match for re-string; arglists ([re-string])
11:21frodwithLet's throw a party!
11:21alphazeroAWizzArd: :) i'm a total newb. both clojure and irc. its supposed to indicate continue without retyping the <who>: bit.
11:21Chouserrafting: just a joke -- you pasted the same thing twice, so the second time I already knew about it from the first time.
11:21raftinglol
11:21Chousukealphazero: java isn't exactly good for functional style programing.
11:21Chousuke+m
11:21alphazeroChousuke: haven't drank the FP coolaid yet ..
11:22Chousukealphazero: heh
11:22ChousukeI think it's fairly stupid to not allow standalone functions.
11:22RSchulzFP is, it seems to me, an even bigger mindset thing that Lisp is.
11:22Chousukethen you need workarounds like static methods that are meh.
11:22alphazeroChousuke: you mean in the JVM?
11:22Chouseroh, I've tried to understand Qi's sequent notation before. freaks me out.
11:23Chousukealphazero: no, in the java language.
11:23frodwithRSchulz: I'd say they're orthogonal and about the same size.
11:23RSchulzBut 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:23deklundhi all... is this the standard/idiomatic way of generating a blank string X long ? : (apply str (take X (repeat " ")))
11:23alphazeroChousuke: Then what do you call RT.java?
11:23rhickeyalphazero: 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:23RSchulzSequent notation is far older than Qi!
11:23Chouserdeklund: looks pretty good
11:23Chousukealphazero: it's a class, isn't it?
11:23alphazerorhickey: can you elaborate please?
11:24Chousukealphazero: why does a method have to belong to a class?
11:24deklundchouser: thanks
11:24RSchulzIt was invented by a guy named Gentzen to allow a formal notation for aribtrary logical calculi.
11:24Chousukealphazero: I just think that's a fundamental error :)
11:24alphazeroChousuke: sure, but its not like its impossible and with static import its not that ugly to call them either.
11:24Chousukeit's still not a first-class object by itself.
11:25Chousukeyou can't pass a method as a parameter.
11:25lisppaste8AWizzArd annotated #71983 with "NullPointerException ??" at http://paste.lisp.org/display/71983#1
11:25alphazeroChousuke: that we agree on.
11:25AWizzArdrhickey: do you have an idea why compiling this can throw a NullPointerException?
11:26rhickeyalphazero: you'd have to try it to truly appreciate the difference
11:27AWizzArdWhat I find strange is that I get an error during compile time, so when I (load-file "/path/myfile.clj")
11:28alphazerorhickey: 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:28AWizzArdIt reports the line number of "(proxy [KeyListener] []"
11:28Chousercan 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:28ChousukeSmalltalk 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:28rhickeyChouser: yes
11:29frodwithWhat is conceptually hard to grock about lisp exactly, alphazero?
11:29AWizzArdChouser: 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:29rhickeyalphazero: and I'm saying you can't just add fp-style programming as a library for Java - just as alien
11:29alphazeroChousuke: I said we agree! :) But my understanding is (could be wrong) that its a JVM issue, not the language.
11:29AWizzArdMaybe a more general one is easier to answer: under what circumstances can NullPointerExceptions occur when loading a file?
11:30drewrrhickey: Isn't there a functionalj that tried that?
11:30Chousukealphazero: nah, clojure has first-class functions (though they're emulated through anonymous classes); java doesn't.
11:31drewrhttp://functionalj.sourceforge.net/
11:31ChousukeI guess you could easily add a pre-processor for java to ...
11:31Chousukeright.
11:31alphazerorhickey: I am sure you are correct. i guess I just have to try it to understand the precise issues.
11:31Chousukeshould've known someone had done it already :)
11:31AWizzArdChousuke: Java has them through what you mentioned: (annon inner classes). It just takes more chatty syntax to create them.
11:32alphazeroChousuke: Callable objects, under the hood.
11:33ChousukeAWizzArd: yeah. it is mostly a syntax thing I'm complaining about. but it's an important one.
11:33AWizzArdyes
11:34alphazeroAWizzArd: Wouldn't a true closure/method-object need automagic context binding too?
11:36alphazeroAWizzArd: scratch that. Meant with callable. Anon inner, is compile time magic.
11:36AWizzArdChouser: 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:37alphazeroGotta run. Thanks to all. Check this out if you haven't seen it: http://www.subtextual.org/ /R
11:37AWizzArdAh, I found it.
11:38AWizzArdI set up a namespace and did not import (java.awt.event KeyListener). That caused a NullPointerException in the line where I used it.
11:41raftingjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Ratio
11:41raftingWhat is that and how can I get where the actual error happened, the only anoying thing about Clojure is debugging.
11:41AWizzArdrhickey: do you see an easy way on how to get in a different/more descriptive error message? For referencing not important classes?
11:42mfredricksonrafting: i saw that message when I would define a function liike (fn (a b) ...)
11:43mfredricksonnote the parens instead of braces. correct: (fn [a b] ....)
11:43mfredricksoni know i've also seen it elsewhere. it does seem to be a catch all
11:45mfredricksonrafting: do you have some arguments in the wrong order? e.g. (cons '() 3/4)
11:45mfredricksoncorrect: (cons 3/4 '())
11:58Chouserrafting: (.printStackTrace *e)
12:12AWizzArdIs there a way to automatically let proxy fill in empty implementations of all methods that need to be implemented?
12:12raftingChouser: ok but where do I use that?
12:16ChousukeAWizzArd: doesn't it already do that?
12:18AWizzArdWell, 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:20AWizzArdTo 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:20Chousukehm. I thought proxy supplies a default implementation that throws UnsupportedOperationException
12:21ChousukeI might be wrong though.
12:21AWizzArdOn the clojure website it said an UnsupportedOperationException should be thrown. This is what happens for me.
12:22Chousukethen if you want a do-nothing implementation then you'll need to specify them manually.
12:23AWizzArdRight, 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:23Chousukeyou might be able to use some macro magic.
12:24Chousukebut I guess that'd be rather complex
12:24AWizzArdWell yes, for such a common task I will macro these proxy calls away anyway.
12:24AWizzArdChousuke: for a very general macro yes. But for specific Event handlers not, because I will provide empty implementations in the macro.
12:24Chousukeyeah
12:25ChousukePerhaps you could write a macro that uses reflection to get the functions required by an interface and generates a proxy form
12:26Chousukebut maybe that's overkill :P
12:30AWizzArdI don't know very much about this reflection thing in Java.
12:36RSchulzYou 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:37AWizzArdYes, nice vid.
12:37RSchulzThank you for the pointer, alphazero!
12:39RSchulzHere's my rule about reflection: Don't go beyond Class.forName(), Class.newInstance() and Class.isAssignableFrom().
12:39RSchulzThat's what I use for all my "poor-man's plug-in" mechanisms.
12:51raftingcan i define a multimethod for 2 different dispatches?
12:51raftinglike if list o vector do this
12:51raftingor if hashmap do this instead
12:55raftingI 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:55raftingi guess i ciuld just if hashmap then else
12:57RSchulzI 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:57raftingi see
12:57raftingbut is there a way to dispatch several values to the same multimethod?
12:58rafting(defmethod member? clojure.lang.PersistentList ...
12:58raftinginstaead
12:58RSchulzI'm not really up on Clojure multimethods, but I believe they admit arbitrary dispatching logic.
12:58rafting (defmethod member? clojure.lang.PersistentList clojure.lang.PersistentList
12:59RSchulzYou might want to consider getting the PDF of Stuart's book (currently beta4); it has a whole chapter on Clojure multimethods.
13:00raftingfree as in free beer?
13:00RSchulzNope. $$
13:00RSchulzWorth it, I'd say.
13:00RSchulzBut then, I'm a book freak.
13:02RSchulzhttp://www.pragprog.com/titles/shcloj/programming-clojure
13:03Chouserrafting: multimethods use 'isa?' so you could use Sequential to get vectors and lists, and IPersistentMap for hash-maps
13:03Chouserrafting: http://clojure.googlegroups.com/web/chart.png
13:07RSchulzWhat a tangled web we weave...
13:07RSchulzIs that up-to-date?
13:08rafting(isa? '(1 2 3) clojure.lang.Sequential)
13:08raftingfalse
13:09raftingshould id ispathc on clojure.lang.Sequential?
13:12Chouserhm.
13:13Chouser(isa? (class '(1 2 3)) clojure.lang.Sequential)
13:13Chouser(instance? clojure.lang.Sequential '(1 2 3))
13:14RSchulzThis is why I always argue to carefully distinguish the terms "is-a" and "a-kind-of". But no one ever listens.
13:14raftingbut how do i ask and dispatch on it?
13:15Chouseruse 'class' as your dispatch function in defmulti, and clojure.lang.Sequential as your dispatch value in defmethod
13:15Chouserbiab
13:23zakwilsonI'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:25raftingthanks chousr
13:25raftingisnt there a member? method in clojure?
13:26zakwilsonI don't think there is... since I wrote one for some reason.
13:26RSchulz(doc member?)
13:26clojurebotNo entiendo
13:26RSchulz(doc contains?)
13:26clojurebotReturns true if key is present, else false.; arglists ([map key])
13:27RSchulzBut note that contains? is only for maps.
13:27lisppaste8zakwilson pasted "member? function" at http://paste.lisp.org/display/71991
13:28zakwilsonthough it might be more useful to return x instead of true.
13:28zakwilsonand shorter to use when instead of if
13:28lisppaste8zakwilson annotated #71991 with "better member?" at http://paste.lisp.org/display/71991#1
13:42raftingWhat 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:43raftingBut they should quote it or reference it if they use it.
13:43danm_BSD?
13:45raftingok
13:45raftingjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number
13:45raftingexactly what am I dong then? can someone give an example?
13:46rafting(+ 'x 1)
13:47hoeckrafting: exactly :)
13:49RSchulzrafting: What's the question, exactly? You don't expect to be able to add a symbol and a number, naturally.
13:50gnuvincerafting: (+ x 1)
13:50zakwilsonwhere x is bound to a number
13:51raftingclojure.lang.LazyCons
13:51raftingjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number
13:51rafting(println "here be xmin")
13:51rafting (println (class coll))
13:51rafting (pr coll)
13:51rafting (println "//xmin")
13:51raftinghow can pr or println cause that error?
13:52zakwilsonWhat's coll?
13:52raftinga lazy-cons
13:52zakwilsonIf it's a lazy seq of some sort, it probably contains whatever is throwing the exception.
13:53zakwilsonsince every element is evaluated when you pr it.
13:53RSchulzKeep 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:53RSchulzThat naturally leaves open the possibility of that computation being erroneous in some way.
13:57zakwilson(def lazy-error (lazy-cons (+ 1 2) (+ 1 'a)))
13:58zakwilsononly throws an exception when you ask for the second element
13:58Lau_of_DKGood evening gents
13:58Lau_of_DKZak, hows the light show coming along ?
14:02zakwilsonNo 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:02raftingweird thing is im usign keywords not symbols...
14:03Lau_of_DKzakwilson: only on field, but everything else is clear?
14:04zakwilsonYes.
14:05zakwilsonI suspect it's calculated using some sort of bit-twiddling.
14:05Lau_of_DKYou decide what goes in right? And then the trouble now is understanding the output/the reading of the file?
14:06zakwilsonThe files themselves are CSV, so that's easy enough to deal with.
14:06zakwilsonThe trouble is figuring out how one value is calculated.
14:06Lau_of_DKOk, how about keep all the information static and changing 1 value at a time, watching the change in that field?
14:07zakwilsonSounds reasonable... now I just have to fix my Virtualbox problem.
14:08Lau_of_DKWhats its complaint?
14:08zakwilsonNo complaint. POSTs then shows a black screen.
14:09zakwilsonI should probably delete the images and reinstall.
14:09RSchulzWinXP? That takes most of a day!
14:10zakwilsonWhich is why I haven't done it yet.
14:10RSchulzDoes VB have something like VMware "appliances?" Pre-built images you can use as starting points?
14:10zakwilsonIt doesn't really need all the updates though - so that makes it a little quicker.
14:11Lau_of_DKRSchulz: No not directly, but I believe there are images like that freely available (for a test period like 30 days) on MS.com
14:11RSchulzVM is commercial? Open-source?
14:11RSchulzVB, that is.
14:12RSchulzI use VMware for those times I need Windows.
14:12zakwilsonActually, 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:12Lau_of_DKzakwilson: You could whip up a little Citrix Xen Server :)
14:13zakwilsonAnd I don't have any experience to speak of with Citrix or Xen.
14:13Lau_of_DKzakwilson: Any chance your could wine your way out of this?
14:13zakwilsonNope. Tried it.
14:14Lau_of_DKThats a shame
14:14raftingif i cant do (count some-lazy-cons-seq) , what is the error then?
14:14zakwilsonThe app is really buggy.
14:14raftingjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number
14:14Lau_of_DKWell, 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:14raftingagain but why?
14:14Lau_of_DKrafting: Which code are you executing?
14:14zakwilsonrafting: 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:14raftingits too mucht o paste
14:15Lau_of_DKlisppaste8: url
14:15lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
14:15zakwilsonThanks, Lau_of_DK.
14:15Lau_of_DKnp :)
14:20Lau_of_DKChouser: You there?
14:20Chouserno
14:20Chouseroops
14:20Lau_of_DKk
14:20Lau_of_DK:)
14:20danlarkin liar!
14:20Chouser:-)
14:20ChouserI'm here. what's up?
14:20Lau_of_DKChouser: Did you put in any work on transforming SQL queries to higher order functions since last we talked?
14:21Chousernope
14:21Lau_of_DKzakwilson: http://www.microsoft.com/downloads/details.aspx?familyid=c2c27337-d4d1-4b9b-926d-86493c7da1aa&amp;displaylang=en
14:21Lau_of_DKChouser: k
14:24duck1123Does 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:24RSchulzduck1123: Why would anything get wiped out?
14:24RSchulzAre you deploying a WAR file or loose files?
14:25duck1123currently loose files, but I'd eventually like to be able to package this as a wr
14:25RSchulzBesides, you shouln't have your original source code in a deployment environment.
14:25RSchulzIs this a Linux or Unix host?
14:26duck1123currently on Debian
14:26RSchulzOK. Then check out the recursive and update options of the "cp" command.
14:26duck1123When I go to deploy, I'd probably compile and package only the classes
14:28RSchulzGiven 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:29RSchulzAre you using AOT compilation, or deploying .clj files?
14:29duck1123aren't some build tools designed to wipe out the classes folder when cleaning?
14:29duck1123AOT
14:30hiredmanJust Use make
14:30RSchulzI suppose, but like I said, you _really_ don't want your primary source to be in the running Web App.
14:30RSchulzMake? Bit your tongue!
14:30hiredmanbit yours!
14:31hiredmanmake won't nuke the classes folder
14:31Lau_of_DKzakwilson: Did u get my link ?
14:31duck1123RSchulz: My running webapp is currently only development. I'm just trying to make it as simple as possible.
14:31RSchulzMake 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:31RSchulzduck1123: Simple is one thing, but foolish quite another.
14:32hiredmanRSchulz: what's wrong with make+java?
14:32hiredmanseems to work fine to me
14:32zakwilson_Lau_of_DK: no
14:32RSchulzBetween Ant, make and "cp -Ru", you have all you need to keep your working code separate from your running code.
14:32RSchulzMake just knows nothing of Java. It doesn't even know that Java automatically compiles dependencies.
14:33Lau_of_DKzakwilson_: http://www.microsoft.com/downloads/details.aspx?familyid=c2c27337-d4d1-4b9b-926d-86493c7da1aa&amp;displaylang=en#RelatedLinks
14:38duck1123perhaps Clojure needs a *src-path* variable. It'll look in this directory for *.clj files only when compiling.
14:39RSchulzAre you sure it doesn't?
14:39zakwilson_Lau_of_DK: That looks like it requires MS VirtualPC and a Windows host.
14:39Lau_of_DKoh :( I thought it was just an image
14:39Lau_of_DKsorry
14:40zakwilson_It might be possible to convert. Trying to reinstall vmware before I do anything else, as that should be reasonably easy.
14:40duck1123RSchulz: I think compile only uses the classpath
14:41hiredmanyou can put the source in one place in the classpath and have the compiler output to another
14:42duck1123hiredman: 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:43hiredman*shrug*
14:47jphrAny 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:48Chouserjphr: you want the index? or what?
14:48jphrChouser: index is best
14:49jphrhiredman: ACM competition I did a while back, redoing the problem in clojure
14:50Chouserjphr: if you know the length of the sublist you're looking for, 'partition' might be helpful.
14:51jphrChouser: I am, and I'll take a look at the api docs
14:53Lau_of_DK(doc partition)
14:53clojurebotReturns 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:54jphrChouser: that works perfectly, thanks for the advice
14:54Chouseryou're welcome.
14:56Chouserhere's what I've got: (some (fn [[lst i]] (when (= lst '(1 1)) i)) (map list (partition 2 1 longlist) (iterate inc 0)))
14:58jphrI'll probably be able to adapt that to work. so much for studying for exams
14:59Lau_of_DKMany futures have been crushed by Euler
15:03Lau_of_DKAWizzArd: JavaFX looks very straight forward to dive into, only problem is its only for Windows and Mac thus far
15:05AWizzArdLau_of_DK: thanks for the update
15:05AWizzArdsounds good
15:05AWizzArd(the first part)
15:06Lau_of_DKhttp://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec.html
15:07Lau_of_DKAlso good :)
15:07mmcgranais there some trick to be able to pass java classes around for later instantiation, or is it not possible?
15:07mmcgranaeg (let [c/class String] (new c "foo")) doesn't work
15:07mmcgranaerr sorry
15:08mmcgrana(let [c String] (new c "foo"))
15:08mmcgranaany way to get something like that to work?
15:09Lau_of_DKIf its not yet instantiated (unique in anyway) why do you want to pass it around?
15:09Chousukepass in an instance and use .getClass and .newInstance?
15:10Chousuke(fn [x] (-> x .getClass .newInstance)) or something
15:10Chouseryou can pass around classes
15:10Chouserinstances of Class
15:11mmcgranaChousuke: this works (let [c (.getClass "foo")] (.newInstance c))
15:11Chousukeright, you can also do (defn instantiate [cls] (.newInstance cls)) and (instantiate String)
15:11karmazillarhickey: I found a fix to my memory issue with nth
15:13mmcgranahuh, so (defn instantiate [cls] (.newInstance cls)) (instantiate String) works but (.newInstance String) doesn't
15:14Chousukeright... hm.
15:14Chousukeweird.
15:14Chousermmcgrana: right, the latter is trying to call the "newInstance" method of the String class
15:14Chouserwhich doesn't exist
15:14Chouserclojurebot: FAQ #1
15:14clojurebotFAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b
15:15mmcgranathanks
15:15Chousermmcgrana: there is no actual FAQ, so don't feel bad. :-)
15:16mmcgranabtw (unrelated to this class stuff) I contemplating a Java / Clojure port of a subset of Hpricot
15:17gnuvincemmcgrana: that's an HTML scrapping library, right?
15:18mmcgranaright, for ruby, its very nice
15:18Chouser(clojure.lang.Reflector/invokeConstructor String (to-array ["foo"]))
15:18gnuvincemmcgrana: let me know if you get something working
15:18gnuvincemmcgrana: I'm writing a series of blog posts on Clojure and the example I'm using is an HTML scraping script
15:19mmcgranao right i was looking at that yesterday
15:19gnuvinceI was actually thinking of doing such a library myself eventually
15:19gnuvinceBut if you beat me to it, I'd love to know
15:20mmcgranasomeone has to do it, the state of java html parsers for screen scrappers is depressing
15:20gnuvinceTotally agree
15:20danm_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:20alecmmcgrana: I got tagsoup working in Clojure, but abandoned it for regexps after futzing with xml zippers
15:20gnuvinceHTMLParser does the job, but it's definitely limited and way too verbose.
15:21hiredmanoh man
15:21blackdogdanm_, use (declare)
15:21danm_Chouser: in trying to load a file using slime, for example
15:21danm_ok
15:21Chouserwhat blackdog said
15:21Chouser(doc declare)
15:21clojurebotdefs the supplied var names with no bindings, useful for making forward declarations.; arglists ([& names])
15:21danm_thanks
15:21hiredmanChouser: have you seen the xml/parse message that just showed up on the ml
15:21Chouserhiredman: just reading it now
15:21hiredmananother ('a b x) -> nil
15:21danm_so is it idiomatic to declare a sort of api at the top of a source file?
15:21hiredman"wtf?"
15:22Chouserdanm_: I pretty rarely have co-dependencies that require pre-declaration.
15:22ChouserI usually try to keep my def's in order so that I don't need declare.
15:22danm_well, I suppose I could just reorder my defns
15:22danm_ok, fair enough
15:22danm_thanks
15:23Chousernp
15:23mmcgranaI 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:24ChouserI don't want code in a string, even if it's just CSS.
15:25mmcgranait might make sense to offer a purely data-structure based interface, yeah
15:25mmcgranabut you get the idea
15:27clojurebotsvn rev 1152; release coll on nth of seq
15:27hiredmanooo
15:28RSchulzHuh? What's that say?
15:28Chouserthat looks like karmazilla's fix
15:29Chouseryep,
15:29RSchulzGack! BUILD FAILED!
15:29Chouserooh, plus a new Stream class. Bet that leaked in from another patch.
15:29RSchulzIt doesn't like RT.java
15:30RSchulzThat's what's not compiling.
15:30Chouseryeah
15:30hiredmanouch
15:30hiredmanclojurebot: build is broken
15:30clojurebotIk begrijp
15:30hiredmanclojurebot: what is the status of the build?
15:30clojurebotbuild is broken
15:30rhickeyI needed to put up a few new files: 1153
15:31ChouserI can never tell if clojurebot is confirming, reporting an error, or just going crazy.
15:31RSchulzWhen in doubt: Going crazy.
15:31hiredmanclojurebot: build is working
15:31clojurebotYou don't have to tell me twice.
15:31RSchulzAritificial Lunacy.
15:31rhickeystreams are there for perusing only, not final
15:32RSchulzBUILD SUCCESSFUL
15:32RSchulzThank you!
15:32clojurebotsvn rev 1153; release coll on nth of seq, stream work in progress
15:32rhickeyI know, git/mercurial...
15:35Chouser:-)
15:36karmazillaarigatou! :)
15:36rhickeykarmazilla: thanks for chasing, I haven't had any time for that one
15:46Chousukewonder if I'm doing something wrong.
15:47ChousukeI 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:48Chousukeit works, but it's probably not going to be very nice after a hundred more revisions. or two hundred :P
15:50Chousukeclojurebot: svn?
15:50clojurebotI don't understand.
15:50Chouserclojurebot: latest?
15:50clojurebotlatest is 1153
15:50Chousersvn rev 1153
15:50clojurebotsvn rev 1153; release coll on nth of seq, stream work in progress
15:50ChousukeI wanted the url :/
15:50Chouseroh. :-) sorry
15:51ChousukeI know clojurebot knows it but I don't remember the factoid :P
15:51ChouserI don't think he knows it. Perhaps he forgot.
15:51Chousukeclojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/
15:51clojurebotc'est bon!
15:52ChousukeI'm going to try doing an SVN clone for the nth time now.
15:52ChousukeI hope it goes through this time
16:12raftingif i catch an exception doesnt the computation still go on?
16:13raftingyes it dfoes
16:13Lau_of_DKDepends on your design I think. Usually it will go own, but sometimes I can imagine that it wont be possible
16:14raftingah
16:14raftingi should catch Exception,not java.lang.Exception
16:15raftingwait both works wtf
16:15RSchulzClojure shares with Java the automatic importation of everything in java.lang
16:16raftinghow do I catch 2 different exceptions?
16:16Chousercatch their common ancestor and then use an 'if'
16:16Lau_of_DKuse a bigger net
16:17RSchulzEach distinct exception type caught needs a separate catch clause in the (try ...) form.
16:17blackdogyou can have multipe catch clauses
16:18Lau_of_DKBtw Mr. Schulz, a Regex for catching " word" is that just #"\ word" ? (note the prefixed space)
16:18RSchulzJust as it would in a Java try {} catch() {} ... finally {} construct.
16:18RSchulzA single "word" charcter is signified by \w. One or more would be \w+
16:19RSchulzSorry. I misunderstood. #" word"
16:19RSchulzYou don't need a backslash in front of the space.
16:19gnuvinceLau_of_DK: why do you escape the space?
16:20Lau_of_DKOh okay - Just wondering, thanks guys
16:22Chouseroh, clojure does support multiple 'catch' in a single 'try'. I guess it's ClojureScript that doesn't. :-)
16:23RSchulzYou mean Clojure--?
16:23Chouserthat's the one
16:25ChouserExcept that'd be spelled (dec Clojure)
16:26RSchulzChouser: 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:27Lau_of_DKClojure--?
16:27RSchulzWe're in a <levity> ... </levity> element...
16:27Lau_of_DKoh
16:27Lau_of_DKNoobs
16:27hiredmanitym [:levity ...]
16:28RSchulz(with-levity :magnitude 'minor ...)
16:28Lau_of_DKuser=> (filter #(slowBoyInTheClass? %) #clojure)
16:28Lau_of_DKRSchulz
16:29Lau_of_DKNice IRC integration...
16:29Chousukebut hm
16:30Chousukenever mind :P
16:34Lau_of_DKChousuke: ?
16:44raftingis there no Array in Clojure?
16:44raftingi need O(1) lookup but only ekys, no values
16:44stuarthallowayrafting: vector isn't fast enough?
16:57mchurchCan I ask about some code that is behaving in a counterintuitive way?
16:58stuarthallowaymchurch: sure
16:58mchurchOk. I'm trying to convert a vector into a byte[] so I can make a ByteArrayInputStream out of it.
17:01mchurchThe code is: (defn primitive-byte-array [vec]
17:01mchurch (let [out (make-array (. Byte TYPE) (count vec))]
17:01mchurch (for [i (range (count vec))]
17:01mchurch (aset-byte out i (nth vec i)))
17:01mchurch out))
17:01mchurchIt's not the prettiest piece of code. Anyway, it returns a byte[] that's holding zeros.
17:01stuarthallowaymchurch: paste it into http://paste.lisp.org/
17:01stuarthallowaybut it looks like you need to doseq or otherwise force "for" which is lazy
17:01mchurchAh.
17:02lisppaste8mchurch pasted "byte[] example " at http://paste.lisp.org/display/72004
17:03mchurchThis makes sense. I assumed that the FOR loop would force the execution
17:03stuarthallowayif it does not start with "do" it probably will not "do" anything :-)
17:04mchurchI'm new to the sequence/list distinction, etc.
17:04mchurchIt's funny because I'm working in the space between a really cool, beautiful, functional language (Clojure) and Java which is, well...
17:04stuarthallowayas long as it is a Clojure data structure, it is likely to be lazy, whether list or generic sequence
17:05mchurchI 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:06sohailthere is no non-hideous way to do anything in Java
17:06mchurchsohail: I agree with that.
17:07mchurchI took CS 1 in Java in college (now my school uses Python, thankfully)
17:07mchurchI remember the first time I encountered int/Integer et al...
17:08mchurchstuarthalloway: DOSEQ worked. Thanks.
17:08mchurchOne interesting concept in Java is that of having two type systems. It's an interesting idea.
17:08mchurchBecause, as I see it, there are fundamentally 2 types of type systems.
17:09mchurchBottom-up using ADTs from primitives, like Ocaml's system.
17:09mchurchVs. top-down hierarchical, which is the OO way.
17:10mchurchJava has a top-down system starting from Object, and a separate C-inspired type system of primitives, [], etc.
17:11stuarthallowayso it (Java) is the best possible language, because it get more check marks on the side of the box? :-)
17:12hiredmanwell, clojure gets everything java gets
17:12hiredmanso, uh, clojure > java
17:12lisppaste8stuart.halloway annotated #72004 with "refactoring" at http://paste.lisp.org/display/72004#1
17:12hiredmanclojurebot: clojure?
17:12clojurebotclojure is the bestest programming language available.
17:13stuarthallowaymchurch: check out http://paste.lisp.org/display/72004#1: refactored to use indexed, static sugar...
17:21RSchulzclojurebot: grammar?
17:21clojurebotTitim gan �ir� ort.
17:45hiredmanhah
18:11hiredmanclojurebot: are you broken?
18:11clojurebotPardon?
18:37raftingis there no operator for focring to floats?
18:38raftingforcing
18:38hiredman(doc float)
18:38clojurebotCoerce to float; arglists ([x])
18:39hiredmanclojurebot: botsnack
18:39clojurebotthanks; that was delicious. (nom nom nom)
18:42raftingsure but i meant: (defn div [& args] (float (apply / args)))
18:42hiredman...
18:53RSchulzhiredman: You spoil that bot!
18:59raftinggosh multifunctions are so cute
18:59raftinghiredman from the office?
19:00hiredmanwhat?
19:08RSchulzrafting: "multimethods"
19:09RSchulzMultifunction is what you get from a DVM.
19:13raftingclojure.lang.MultiFn@2a5ab9
19:13raftingbut ok
19:13raftingis there a function to convert to fractal expression? ie 6.33 -> 19/3
19:14raftingdvm?
19:14RSchulzFractal? Or fractional?
19:16raftingfractional i guess? as shown above
19:16hiredman6.33 != 19/3
19:17rhickeyrafting: rationalize
19:17raftingto clojure.lang.Ratio
19:17rhickey(doc rationalize)
19:17clojurebotreturns the rational value of num; arglists ([num])
19:17rhickeyuser=> (rationalize 6.33)
19:17rhickey633/100
19:18RSchulz19/3 most certainly is _not_ 6.33!
19:21raftingyes but you know what i mean
19:21raftinganyway name a function that overloads on arity, i want to see how to write them
19:21RSchulzYou're never going to get a rational from a 3-significant-digit approxmiation thereof.
19:23RSchulz(doc map)
19:23clojurebotReturns 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:23RSchulzThere. Four overloads.
19:23hiredmanyou make the multimethod dispatch somthing like (fn [& x] (count x))
19:24hiredmaner
19:24hiredmannot that you need to bother with that
19:24hiredmandefn will do it for you
19:24hiredmansilly me
19:27RSchulzrafting: The "how to write them" is made clear in the Clojure docs at http://clojure.org/api#defn
19:32raftingis the http://hpaste.org/12985
19:32raftingdoesnt work forme
19:35Kerris7(+ 1 1)
19:35clojurebot2
19:37raftingCaused by: java.lang.Exception: Can't have fixed arity function with more params than variadic function
19:37RSchulzIf your'e going to overload a function definition, each arity's argument list and body must be individually enclosed in parentheses.
19:37RSchulzAs shown in the docs...
19:37raftingtheya re now then i get above error
19:38RSchulzPaste again.
19:38raftinghttp://hpaste.org/12986
19:39RSchulzYou need to have a way to distinguish the two (same as Java with varargs, actually)
19:40RSchulzAs you wrote it, it's ambiguous.
19:40RSchulzLook at the API page and see the pattern exhibited by overloaded functions shown there.
19:40RSchulzThat should make it clear.
19:40hiredmanrafting: [& args] also covers the single arg case
19:40raftingok
19:40RSchulz(By the way, the Java comparison has type to help disambiguate, Clojure does not.)
19:41RSchulzrafting: What hiredman said.
19:41hiredman[x y & args]
19:41hiredmanRSchulz: well, it does, you just have tell it to dispatch on type
19:42RSchulzActually, rafting, the diagnostic you got does make it pretty clear what's wrong, does it not?
19:42RSchulzhiredman: Which "it" is that?
19:42hiredmanRSchulz: demulti
19:42hiredmandefmulti
19:43RSchulzYes, but we're talking about ordinary, arity-overloaded Clojure functions, not multimethods.
19:44raftingbut perhaps it should be a multimethod sicne im dispatching on type as well
19:45RSchulzIf you really need a non-arity-based decision of which concrete function to invoke, then multimethods are required.
19:46raftingwell I need to differ between (average 1) and (average [1]) so yeah
19:46RSchulzDon't be so sure. That looks like arity to me.
19:47RSchulzIs the single-argument case even inherently special?
19:47raftingwell i want an average function for seqs and for just passing numbers
19:48hiredmanyou can just put an if in the function
19:48RSchulzBut 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:49raftingwhich fucntion is that?
19:50hiredman(doc flatten)
19:50clojurebotIt's greek to me.
19:50hiredmandamn you
19:51raftingreduce concat
19:51hiredmanmapcat
19:51RSchulzcontrib.seq-utils/flatten
19:51hiredmanapply concat
19:53RSchulzMake that clojure.contrib.seq-utils
19:53RSchulzD'Oh! ... clojure.contrib.seq-utils/flatten
19:53RSchulz(use 'clojure.contrib.seq-utils) first, of course.
19:54hiredmanclojurebot: flatten is clojure.contrib.seq-utils/flatten
19:54clojurebotIk begrijp
19:54RSchulz(doc clojure.contrib.seq-utils/flatten)
19:54clojurebotNo entiendo
19:54RSchulzhiredman: Shouldn't clojurebot know about contrib?
19:54hiredmanit only looks up stuff in clojure.core
19:54RSchulzHmm... I guess it would have to (use ...) them all, and I've discovered that they're not all mutually compatible.
19:55hiredmanRSchulz: well, I don't have contrib installed
19:55RSchulzuser=> (doc clojure.contrib.seq-utils/flatten)
19:55RSchulz-------------------------
19:55RSchulzclojure.contrib.seq-utils/flatten
19:55RSchulz([x])
19:55RSchulz Takes any nested combination of sequential things (lists, vectors,
19:55RSchulz etc.) and returns their contents as a single, flat sequence.
19:55RSchulzGah? Contrib not installed? Eh?
19:55raftinganyways if use the same airty [& args] they both become array-seq
19:56raftinghow do I use a multimethod with varying arguments and type?
19:56hiredmanrafting: http://clojure.org/multimethods
19:57hiredmanwatch out, the example on the page is not really that simple for someone new to clojure
19:58RSchulzrafting: I really think you're going for an excessively complex solution to a simple problem.
19:59raftinglol yes
19:59raftingbut i have ti now
20:01raftinghttp://hpaste.org/12987
20:01raftingor not
20:01raftingduh
20:02raftingstill the same arity problem
20:03raftinghow do I differ (av 1) from (av [1])?
20:05Chousukeeasy. 1 is not a vector
20:07RSchulzI told you: Flatten them all and then process the flattened sequence.
20:10raftingbut how do i differ between the types to flatten?
20:10raftingbut both are arrayseqs...
20:11Chousukewhy do you need to differentiate them? :/
20:11raftingi see
20:12raftingchousuke: because i cant apply + t both
20:12RSchulz(use 'clojure.contrib.seq-utils)
20:13RSchulz(defn avg
20:13RSchulz [& vals]
20:13RSchulz (let
20:13RSchulz [flat-vals (flatten vals)]
20:13RSchulz (/ (reduce + 0 flat-vals)
20:13RSchulz (count flat-vals))))
20:13RSchulzuser=> (avg 1 [2 3] 4 '(5) '((6) 7))
20:13RSchulz4
20:13RSchulzSatisfied?
20:15raftingflatten?
20:15raftingdont have contrib
20:15RSchulzYou need contrib.
20:18Chousukerafting: why not? you can sum a collection by doing (apply + coll), can't you?
20:21gnuvince_Is there a limit to the number of elements that apply can apply?
20:21RSchulzAvailable RAM.
20:21RSchulz(Even the whole universe is finite...)
20:21gnuvince_So no problem like some languages have where you can't pass more than 255 arguments?
20:22RSchulzNot for functions that operate on sequences.
20:22RSchulzBut there's a fixed upper limit on function arity.
20:23gnuvince_Doesn't apply just change (apply + [2 3]) into (+ 2 3)?
20:23RSchulzIt's overloaded (at the Java level) up to arity 20.
20:23gnuvince_and if that's the case, wouldn't you hit that arity limit?
20:23Chousukegnuvince_: apply is not a macro.
20:23RSchulzBut there's a 20 args + "..." (varargs) overload, too.
20:23ChousukeI think apply does some magic behind the scenes.
20:24RSchulzWho said anytying about macros?
20:24gnuvince_RSchulz: probably when I said "change ... into"
20:24ChousukeI'll have to get some sleep though.
20:25RSchulzIn Clojure, "apply" is not a macro. It's a function.
20:26RSchulzSleep is good. Research continues to emphasize the health (physical and mental) of good sleep.
20:27RSchulzrafting, hiredman: Should we not consider Contrib to be essentially integral to the language as it's used in everyday Clojure programming?
20:28RSchulzEven thought it's not Core and not literally essential.
20:46raftingwait i noticed, i can dispatch on type and then have a different arity to catch?
20:51raftingmy multi works but doesnt make sense
20:52RSchulzrafting: Really, use Contrib (everyone does) and take advantage of it. Why are you trying to make this so difficult?
20:58raftingit works now
20:59RSchulzMazel Tov!
21:09RSchulzrafting: Care to share?
21:33raftingwtf i made some change in emacs so now when i press ) it becomes ( instead
21:34raftingRSchulz: http://hpaste.org/12991
21:34raftingdont know how good that solution is but it works
21:35RSchulzAnd why is that better than what I showed you?
21:38raftingbecause i made it bitch
21:38rafting;)
21:38RSchulzThank you. Goodbye.
21:39raftinga
21:44charliekilonoob questions - how to 'invoke'/eval function that is value of hashmap? see http://paste.lisp.org/display/72011
21:44Chouser((my-foo :bar))
21:47gpAnyone doing something really cool with Clojure? I'm doing genetic programming.
21:47charliekilo Chouser: thanks ... makes sense now, one () for de-referencing the map, and one () for eval ... at least thats what I come up with ;)..
21:48Chousercharliekilo: right. If the fn in the map took args, ((my-foo :bar) they would go here)
21:49holmakgp: 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:50charliekiloChouser: yep, makes sense ... thanks again
21:51thoughtpolicehi, 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:51gpholmak: 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:52hiredmanRSchulz: 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:52thoughtpolicei believe I need to be able to do AOT compilation, so I can use hadoop's script to launch the jar file
21:53holmakgp: Are you trying to evolve algorithms, then? Is that what the strings and eval are for?
21:53hiredmanthoughtpolice: you need to have the directory where clojure puts the compiled class files in the classpath, this defaults to ./classes/
21:54hiredmanthere is some *variable* you can define to set it
21:55lisppaste8ck pasted "assoc fn" at http://paste.lisp.org/display/72012
21:56thoughtpolicehiredman: 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:56Chouserthoughtpolice: "classes" must also be in your classpath
21:57charliekiloChouser: 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:58Chousercharliekilo: 'assoc' does not change or mutate anything.
21:58thoughtpoliceChouser: 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:59hiredmanthoughtpolice: ./classes needs to be in you classpath
22:00Chousercharliekilo: 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:01charliekiloChouser: you're right, I need to think in terms of functions/functional programming, not oo ... thanks again ... you make might night
22:01charliekiloI did (((assoc my-foo :blah (fn [] (str "BLAH hello"))) :blah)), which worked!
22:01Chouserthere you go.
22:02ChouserI'm happy I could make might night.
22:02charliekiloLOL sorry, 'my' night ... just to excited ;)
22:02Chouser:-)
22:02hiredmanclojurebot: Chouser is also <reply>Chouser might make night
22:02clojurebotIn Ordnung
22:28sage_jochis there a way to express (say) the equivalent of String.class? (String/class) doesn't seem to be the answer
22:29Chouser(indentity String), or often just String
22:29sage_jochah, thanks
22:30Chouserclojurebot: can you explain FAQ #1?
22:30clojurebotTitim gan �ir� ort.
22:30Chouserclojurebot: FAQ #1
22:30clojurebotFAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b
22:34clojurebotsvn rev 1154; emit string constants directly
22:41rhickeyhmm... getting 13k messages/sec via embedded ActiveMQ in same JVM
22:43rhickeynot too shabby
23:18gpcan i eval a cloure program?
23:19gpor just specific forms?