#clojure logs

2008-02-07

11:31rhickeyClojure has a logo - courtesy of my brother Tom - http://groups.google.com/group/clojure
12:52bgeronnice
17:12sweezei want to somehting like (. object (strcat("set" "Attribute"))).... is this possible?
17:14sweeze(alternatively, if there's another way to dynamically call a method....)
17:26ChouserI'm still very new at this, so excuse the question ... if I have a function (foo) that returns a fn, can't I invoke that fn just by putting it at the head of a list? ((foo)) ?
17:30Chouseroh. It appears I can do that, or use (apply (foo)). My error must be coming from elsewhere.
17:34Chouserah, got it. I'm such a lisp newbie.
17:34bgerondoesn't matter, everyone was a beginner once :)
17:35bgeronsweeze: you might want to ask the question again when rhickey (the author of Clojure) is here, he must know
17:35Chouserok, so I'm running my foo.clj file like the 'getting started' page says, with my file on the end: java -cp ... src/boot.clj foo.clj
17:36sweezeok, thanks bgeron... does he keep regular hours? :)
17:36ChouserThat works, but it gives me a prompt. any way to skip the prompt? ... quit before it gets that for or something?
17:36bgeronsweeze: yesterday he was here at this time
17:37bgeronI don't see a pattern in his joining/leaving, just wait and I'm sure he'll come
17:38bgeronso I'm afraid I can't answer your question
17:39bgeronmaybe someone else here?
17:41Chousersweeze: I guess you want to convert a string to a symbol?
17:41sweezeChouser: yeah, pretty much
17:43ChouserSeems like there ought to be a way, but I don't see how.
17:44ChouserAh, (sym "setAttribute")
17:45sweezethnks, i'll try taht out
17:50sweezewell, it creates the symbol, but i think the magic of how (.) works just looks at the literals... i'll have to ask again when rich is around
18:04la_mersweeze: what are you trying to do, exactly?
18:06la_merFWIW, calling a method on a java object goes like so:
18:07la_mer(def sb (new StringBuffer))
18:07la_mer(. sb (append "foo"))
18:07la_mer(. sb (toString)) => "foo"
18:13sweezela_mer: yeah, i can call a method that i know ahead of time, but i'd like to construct the desired method @ runtime
18:14sweezespecifically, i'd like to be able to pass a map of {attr : value}, and then call (. obj (setAttr value))
19:11scramflotIs there a way to silence the nils in the output?
19:12scramflotmake it "pretty" and such
19:15scramflotrhickey: hey, I've made some progress on my directory walker.. is there a way to silence the returned nills? to make the output more pretty?
20:08scramflotnm.. I think the nils are accidental
20:36ChouserAny idea how to get the logarithm of an number?
20:36Chouseror convert it to a string?
20:38rhickey(. Math (log 42))
20:38rhickey(str 42)
20:38Chouserperfect, thanks!
20:39scramflotwhich function might one use for "for a in coll, if a == b, return a"? filter?
20:39rhickeysee also http://groups.google.com/group/clojure/msg/4b900ecf29b58f29
21:03rhickeyfilter or for
21:11scramflotsweet thanks.
21:12scramflotThis is weired: http://pastebin.com/m2940a048 Looks like a nullpointerexception half way through a map
21:21scramflotah, for is in the svn
21:29scramflothmm.. maybe dirs is undefined if x isn't a directory?
22:31scramflotI've pretty much spent two days of my free time working on this directory walker function, having a real hard time getting it to work
22:31scramflotIt's been floating around 10 and 12 lines
22:32scramflotand then bam... this hits me: (defn dw [d] (println d) (map dw (seq (. (new File (str d)) (listFiles))))
22:32scramflotso much simpler
22:33scramflot(dw "home/name/whatever") and away it goes
22:36scramflotnow if I can just get it those nils to go away
23:08jaygreetings mates
23:09jayIs there something like a (time (some expressions)) macro for timing a call?
23:14scramflotyea, (time (whatever))
23:16scramflotuser=> (time (pr "hi")) -> "hi""Elapsed time: 0.152053 msecs"