#clojure logs

2009-05-11

00:11unlink1Does lazy-seq create a recur target?
00:12cadsyeah, maybe I'll write all my source with an awk header that processes the file when clojure loads it
00:13cadsbut it might be better to do it in the reader :)
00:13cadsis that stuff documented/
00:18hiredmanunlink1: I believe so
01:09eyerisI need to reference a static field that is defined in a Java interface named Cell. I am unable to import the interface, using the ns macro but if I refer to a field as Cell/field_name, I get an exception due to the Cell namespace not existing.
01:11cmvkki didn't realize you could refer to a static field in an interface anyway.
01:12eyerishttp://poi.apache.org/apidocs/index.html
01:12eyerisSee the fields inherited from org.apache.poi.ss.usermodel.Cell?
01:13cmvkkyeah...
01:14cmvkkcan you reference those fields in java itself?
01:14eyerisI don't know. I don't have much java experience :/
01:15cmvkki think you might actually need to reference the fields in a class that implements Cell.
01:15cmvkk(this is pure untested speculation on my part, but why would an interface have concrete values? that's not what they're for)
01:16eyerisReferring to the field in an implementing class worked.
01:16eyerisThanks.
01:19cmvkkapparently you can have concrete fields in an interface like that. hmm.
01:19cmvkkguess it's possible you just can't access them from clojure.
01:19eyerisIn this case, it makes some sense.
01:20eyerisThe interface is used to represent a MS Excel cell, while the implementing classes represent two different file formats.
01:20eyerisBut the cell types don't change.
01:20cmvkkright.
01:20eyerisLike I said, "some" sense :0
01:49unlinkany bitterness in that api?
03:28unlinkWhat's the point of clojure.core/when?
03:31cp2,(when (= 1 1) (println "1 is 1"))
03:31clojurebot1 is 1
03:31cp2,(when (= 1 2) (println "1 is 1"))
03:31clojurebotnil
03:31cp2etc
03:31unlink,(macroexpand-1 '(when :a :b))
03:31clojurebot(if :a (do :b))
03:32unlinkI mean, it doesn't seem to add any value over if
03:32cp2well yeah
03:32cp2its just for convenience
03:32unlinkBut how is it more convenient?
03:32cp2cleaner code in some respects
03:32cp2its really personal preference
03:35hiredmanif requires an explicit do
03:35hiredmanwhen does not
03:35hoeckunlink: I was using when in common lisp code alot, because it wraps the then-expr in a do block, and so saves some nesting and typing when using multiple then-expressions
03:35unlinkWhat confuses me is how it's used synonymously with if in clojure/core.clj.
03:35hiredmanif the else exp returns nil, when is the idomatic choice in clojure
03:36hiredmanwell, if it is nil
03:37unlinkWhen is if idiomatic?
03:37hiredmanif is idomatic when you have something and something else
03:37hiredman(if foo a b) should be if (if foo a nil) should be when
03:38unlinkI see
03:38hiredmanit isn't a huge thing
03:38unlinkSo when do I use if-not and when do I use when-not?
03:38hiredmanit's in the manual of style :P
03:38hiredmansame
03:38hiredmanI dunno why you would ever use if-not
03:38unlinkthat's what I mean
03:39unlinkactually
03:39unlinkIn Python, I sometimes do (if-not (nil? a) (do something-with a) (something else))
03:39unlink(well, in Python syntax)
03:40hiredmanI am teh first to admit the manual of style does not address all issues
03:41hiredmanbut it does address when
03:41unlinkOh, you were being serious about a manual of style?
03:41hiredmanno, just rhickey called using when idiomatic
03:42hiredmanThe All Inclusive Clojurebot Compendium of Coding Style
03:42unlinkgotcha
03:42Carkthe AICCS, a must read...
03:43Carkgood morning =)
03:43hiredmanthe awks
03:43AWizzArdHey Cark
03:43hiredmanakes?
03:43unlinkIs 1 function : 1 class intended to forever be The Way Clojure Works (TM)?
03:44hiredmanI dunno, but it does not seem like something that is a good idea to depend on
03:45Carkwell my guess is that it will stay that way, so functions can implement interfaces
03:45Carkand for closures state too
03:45hiredmanhmmm
03:46Carkmhhh actually i'm not sure about the latter, how are closures closed over in clojure ?
03:46hiredmanno idea
03:46AWizzArdCark: what are the alternatives?
03:46unlink,+
03:47unlink,(do +)
03:47hiredman:(
03:47Carki don't know, i know they are objects in c#
03:47unlink:-(
03:47hiredman~ping
03:47Carkthen you have the stack for real lisps
03:47Carkthez stack frame i mean
03:47unlink,(lazy-seq (recur))
03:47hiredmanclojurebot must be lagged or something
03:47unlinkneeds to be woken up
03:48unlinkanyway, this is slightly disturbing: user=> (new clojure.core$_PLUS___3332)
03:48unlink#<core$_PLUS___3332 clojure.core$_PLUS___3332@2d1e233>
03:49clojurebotTest
03:49hiredmanhuh
03:49unlink,(println "I'm awake")
03:49hiredmanmaybe I broke something
03:49unlinkis it hosted on google code?
03:49hiredman,a
03:49unlinks/code/appengine/
03:49hiredmanno
03:50hiredmanit's weird, no exceptions or anything in the repl
03:50unlinkin clojurebot's?
03:50hiredmanyeah
03:50hiredmanclojurebot: hello?
03:50clojurebot#<core$_PLUS___3330 clojure.core$_PLUS___3330@1b51af1>
03:50clojurebot#<core$_PLUS___3330 clojure.core$_PLUS___3330@1b51af1>
03:50hiredmanuh oh
03:50clojurebotPONG!
03:51clojurebotExecution Timed Out
03:51unlinkhahahaha
03:51clojurebotI'm awake
03:51clojurebotjava.lang.Exception: Unable to resolve symbol: a in this context
03:51clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline hiredman
03:51hiredmanok
03:51hiredman~ping
03:51clojurebotPONG!
03:51AWizzArd~ max people
03:51clojurebotmax people is 164
03:51hiredmansomething lodged in his pipe maybe
03:51unlink,(reduce (new clojure.core$_PLUS___3330) (range 10))
03:51clojurebot45
03:53unlinkAnyway, that makes me cringe.
03:54hiredmanso don't do it
03:55unlinkI don't think whether I do it changes whether the underlying issue bothers me or not.
03:56hiredmanwhat issue?
03:56hiredmanthat functions are classes?
03:57unlinkright
03:57hiredmanwhy is that an issue?
03:58unlinkI mean, I can't think of a more efficient way of implementing them on the JVM.
03:58hiredmanwell, generally they are only instanciated once
03:59hiredmanexcept maybe anonymous functions
03:59hiredmanbut even with those, object allocation is cheaper on the jvm then with c++
03:59unlinkFunction invocation = instantiation?
03:59hiredmannah
04:00opqdonutFunction invocation = .invoke(args..)
04:00hiredmanfunction invocation is a method call
04:00hoeckI think the clojure function implementation maps perfectly on the closures == objects analogy
04:00hiredmanor .run or .call(Object)
04:00unlinkok
04:01hiredman,+
04:01clojurebot#<core$_PLUS___3330 clojure.core$_PLUS___3330@1b51af1>
04:01hiredmanthat is an instance
04:01hiredman.(.invoke + 1 2)
04:01unlinkIt has obvious advantages with Java interop, but means degraded performance compared to, for example, OCaml's implementation.
04:01hiredman,(.invoke + 1 2)
04:01clojurebot3
04:02jdzunlink: why?
04:02hiredmanCallable is tailor made for function objects
04:02unlinkAt a minimum, all bindings which are closed on must be on the heap.
04:04jdzunlink: so how do you pass closures to different threads in OCaml?
04:05jdzif the bindings are not on the heap
04:05unlinkOCaml cheats.
04:05unlinkIt knows when it can get away with putting them on the stack.
04:06hiredman~literal [1] clojure
04:06clojurebotcheating
04:06jdzyou know, JIT does some crazy things, too
04:06jdzyou never know what it comes up with sometimes
04:06__macDoesn't the 1.6 hotspot do escape analysis to put local stuff on the stack
04:06__mac?
04:07opqdonutadditionally, jvm really isn't a general purpose virtual machine
04:07opqdonutyou can't mess with the stack for one
04:07AWizzArdjdz: is that good or bad? :)
04:07jdzAWizzArd: both.
04:07AWizzArd(to not know what it will come up with)
04:07AWizzArdic
04:07jdzi mean, i'm old enough to not care about that stuff
04:07jdzbut i can understand some people being nervous
04:07AWizzArd:p
04:08jdzwhen they don't have full control/knowledge of the underlying stuff
04:08__macI'm hoping I will stop caring about that stuff one day. I have developed an unhealthy fascination with llvm...
04:08jdznow i feel really releaved that i can rely on amazing things others have created, like JVM and Clojure
04:09jdzand CL implementations :)
04:09unlinkI never got past the (which CL implementation should I use) phase.
04:10__macsbcl ;)
04:10AWizzArdor Allegro Enterprise
04:10unlinkActually, that's sort of a lie.
04:10unlinkI got past that phase after losing interest in CL.
04:10__macSo the correct answer is "none, use clojure"?
04:11AWizzArdunlink: so after you lost interest in CL you found knew which CL you should use? ;)
04:11unlinkYeah...not currently using any other lisps.
04:11AWizzArd-found
04:12unlinkAWizzArd: Yes, but if I evaluated that by trying to use CL I would get an NPE.
04:12AWizzArdunlink: when you interact with our world your are indirectly using other Lisps. The universe was coded in Lisp: http://www.gnu.org/fun/jokes/eternal-flame.ogg
04:14jdzc'mon, it's common knowledge that our world was cobbled together with perl in the very late night of 7th day
04:15jdzand nobody can fix it because it's a big pile of mess
04:16unlinkBut I heard all these jokes so many years ago :(
04:17jdzwhich jokes?
04:17hiredmanoh wow
04:17hiredmanthat ogg crashes mplayer
04:17hiredmanGreat
04:18unlinkmust be too old
04:18hiredmanhah
04:19hiredmanI found a post on the mplayer list complaing about the same ogg
04:20__macYou all probably saw this already, but it's still good stuff:
04:20__machttp://xkcd.com/224/
04:26unlinkI find it amusing that lazy-seq creates a recur target, since a recur pointing to one can only ever cause it to diverge.
04:27opqdonuterr?
04:27opqdonuta lazy-seq needn't be infinite
04:28unlinkHow is a recur pointing to lazy-seq ever useful?
04:28hiredmanlazy-seq wraps in a fn
04:28hiredmanI think
04:29hiredmanwhich is where the recur target comes from
04:29unlinkoh you're right
04:29unlink (list 'new 'clojure.lang.LazySeq (list* '#^{:once true} fn* [] body)))
04:32unlinkWow, LazySeq is so magical.
04:32unlink,(class (rest (lazy-seq [1 2 3])))
04:32clojurebotclojure.lang.APersistentVector$Seq
04:32hiredmanyep
04:32hiredman~literal [1] clojure
04:32clojurebotcheating
04:32unlink?
04:33hiredmanit's a joke
04:33hiredmanclojure's (and other lisps) simplicity often feels like cheating
04:33hiredman~clojure
04:33clojurebotclojure is the brand
04:33unlinkoh
04:33hiredman~clojure
04:33clojurebotclojure is like life: you make trade-offs
04:33hiredman~clojure
04:33clojurebotclojure is far closer to perfection then python
04:33hiredmanhmmm
04:34unlinkI'm surprised that rest of a LazySeq isn't some other opaque object like another LazySeq
04:34hiredmansomewhere in there it will say "clojure is cheating"
04:34hiredmanit can be
04:35hiredmanif the lazy-seq yields (cons 'foo (lazy-seq 'something))
04:35unlinkwell, right
04:41unlinkwhy does lazy-seq need to be implementedin Java?
04:43hiredman~def clojure.lang.LazySeq
04:44unlinkI mean, I've read that
04:44taliosis there a "clojure" way of getting resources off the class path? Using (.getResourceAsStream (.getClass some.class) "/foo") seems to work (has issues with compiled clojure thou), but I get the feeling there should be something more clojure based?
04:44hiredmanmaybe a performance thing?
04:46hiredmantalios: I have been using that with aot compiled clojure with no issues
04:49taliosI was trying it using clojure.lang.RT as the class, which worked but wouldnt find my resources, and it doesn't seem to find my own classes that the clojure compiler is generating, unless I work out some kinda two-pass thing
04:50taliosactually - using clojure.lang.RT worked when running locally, but not when deployed to my web container, I suspect class loader poopage
04:51hiredman(.getResourceAsStream (clojure.lang.RT/baseLoader) "version") is actually what I am using
04:51taliosIll try that using the loader
04:53hiredmanif you are using your own gen-class you need to not do the getresource durring the compile, only durring runtime
04:53hiredman(when-not *compile-files* ...
04:54taliosmmm - didn't know that (when-not trick! that could be handy
05:04taliosgah - it -was- working, not I just get nulls. hrm.
05:05unlink~def clojure.core.ns
05:05unlinkaw
06:07cadshey, I was wondering if anyone here knows about clojure.set, and the relational set operations defined there
06:11cadswe have union and intersection and difference, and select, which operate on sets, but there is also rename, join, and project which seem to work with sets of maps
06:14cadscan we better represent set theoretic constructions and operations in terms of operations on rel-sets?
06:54unlinkDoes such a macro as http://dpaste.com/42928/ exist in the standard library, or is it just a good idea?
07:15AWizzArdHello rhickey. I wanted to ask you how easy it would be to get a hook into the compile function. Interesting for me would be to reach some level of basic code obfuscation: removing docstrings, renaming functions and the resulting .class files.
07:15AWizzArdIs that easily possible or would that require a loot of work?
07:16AWizzArd(existing code obfuscators may not be able to do that)
07:17rhickeyAWizzArd: things like that are definitely not a priority. I guess you could get come mileage from Java obfuscators? The only thing I think will come any tome soon would be dropping docs strings, useful for memory-limited targets
07:17rhickeytime
07:32AWizzArdRemoving the docstrings would already be a good thing.
07:32AWizzArdrhickey: is it possible to run compile not on files on disk, but instead on what exists in the image?
07:33rhickeyAWizzArd: there isn
07:33rhickeyt really an image,
07:33AWizzArdI can write a function which makes up gensym'ed aliaes of all function names in a namespace and then ns-unmaps the original names
07:33rhickeyeverything is already compiled once running
07:34AWizzArdand can one write those compiled objects to disk?
07:35rhickeyAWizzArd: this (obfuscation) isn't something I want to spend time on
07:36AWizzArdi mean i could write such a function, and it may work if one could write the compiled objects to disk
07:37AWizzArdfor example if there is a function foo then i could do a (intern *ns* (gensym) (get (ns-interns *ns*) 'foo)) and then (ns-unmap *ns* 'foo)
07:37eevar2obfuscation is a daft idea anyway
07:37eevar2*concept
07:37AWizzArdagreed
07:37rhickeyAWizzArd: doesn't compile write compiled files to disk?
07:39AWizzArdrhickey: it does, but it loads my .clj files on disk. What I have in mind would be a process like: I load my files from disk, now everything is compiled. Then I replace the names of all functions (in ram) and write those to disk. If that can be done somehow.
07:40rhickeyAWizzArd: why does it load .clj files from disk?
07:40AWizzArdCurrently I can replace my function names in ram. But on disk in my .clj files all names stay the same. So a call to compile would take a secret.clj and produce a secret__init.class or something like that.
07:41AWizzArdrhickey: I start a fresh clojure and do: (ns foo) (defn bar [] 100)
07:41AWizzArdThen: (binding [*compile-path* "/my/build/dir/"] (compile 'foo))
07:41AWizzArd==> java.io.FileNotFoundException: Could not locate foo__init.class or foo.clj on classpath
07:45AWizzArdI imagine to have a file foo.clj with the contents: (ns foo) (defn bar [] 100) Now in my build process I would (load "foo"). Then (intern *ns* (gensym) (get (ns-interns *ns*) 'bar)) and then (ns-unmap *ns* 'bar). Now I can call bar and it returns 100.
07:45AWizzArdIf I could now store that manipulated namespace to disk it may do what I want.
07:55ittaydHi, I have a question about multimethods
07:57AWizzArdYes?
07:58ittaydThe documentation has an example for defining an area multimethod
07:59ittaydthe dispatching value is :Shape
07:59ittaydand then to define area for rectangles:
07:59ittayd(defmethod area :Circle [c]
07:59ittaydis used
07:59ittayddoes this mean that :Shaped is applied on c and then isa? is used to match :Circle?
08:01AWizzArdwhat first happens when you call area is that the dispatch function (defmulti area :Shape)
08:01AWizzArdgets called
08:01AWizzArd:Shape can be a function in Clojure
08:01AWizzArdone could have said instead: (defmulti area (fn [object] (get object :Shape)))
08:02AWizzArdWhen you have (def H {:a 1, :b 2, :c 3}) then (get H :a) ==> 1
08:02AWizzArdBut (:a H) is also ==> 1
08:03AWizzArdok so far?
08:04AWizzArdIn the example on the Clojure website r is {:Shape :Rect :wd 4 :ht 13}
08:05AWizzArd(area r) === (area {:Shape :Rect :wd 4 :ht 13})
08:05ittaydyes
08:05AWizzArdand (:Shape {:Shape :Rect :wd 4 :ht 13}) ==> :Rect
08:05AWizzArdso, (area r) will first call :Shape
08:05AWizzArdAnd that returns a value. In this case it returns :Rect
08:06AWizzArdNow after that happened Clojure will look up all defmethod's.
08:06AWizzArdOne of those is: (defmethod area :Rect [r] (* (:wd r) (:ht r)))
08:07AWizzArdThat is the one that gets executed
08:07AWizzArd[r] is the parameter - that gets bound to the orginial input of the call to area. That was {:Shape :Rect :wd 4 :ht 13}.
08:07ittaydthanks for the explanation
08:07AWizzArdnp, hope it shed some light into multimethods
08:08ittaydsure did. it would be useful if this explanation of the flow appeared in the docs.
08:10AWizzArdittayd: for another example look at http://paste.lisp.org/display/68846
08:12ittaydnice and confusing
09:07AWizzArdrhickey: did you get my email (it may have landed in a filter)?
09:35chessguy_work'morning
09:37AWizzArdHi chess
09:37chessguy_workso i think i'm going to take on a chess project in clojure
09:37chessguy_worka truly symbolic chess engine
09:38chessguy_workshould be fun
09:52chessguy_workwow don't everyone get all excited at once :)
09:56AWizzArdah, but that sounds good, yes
09:57AWizzArdWill it be an open source project?
09:57kotarak:D
09:58hiredmanobviously all the money is in closed source chess engines...
09:58AWizzArdhiredman: maybe chessguy_work should also make a closed source one. It is possible that he can come up with the strongest chess engine ever.
09:59AWizzArdI was very surprised about Rybka. Some companies were working for 20 years, with international chess experts, but the Rybka programmer came up with a new idea and within 6 months he got the strongest program. Duh!
10:01chessguy_workheh
10:02chessguy_workrhickey, one step at a time
10:02chessguy_workas for whther or not it will be open source....we'll see
10:03gnuvincechessguy_work: do you have a blog?
10:03chessguy_worknot one i keep updated
10:03gnuvinceok
10:03gnuvinceIt would've been interesting to follow your progress
10:03chessguy_workjust hang around here :)
10:04chessguy_workand/or the mailing list
10:04gnuvinceLet me know if you find optimization techniques ;)
10:04chessguy_workwhat sort of optimization techniques are you interested in?
10:05gnuvincechessguy_work: pretty much anything that can bring a Clojure program within 1.5-2x the speed of an equivalent Java program.
10:05gnuvinceSee this: http://gnuvince.wordpress.com/2009/05/11/clojure-performance-tips/
10:05chessguy_workoh
10:05chessguy_worki'm more interested in algorithmic techniques
10:05gnuvincechessguy_work: in the case of my project, I don't know what algorithmic techniques I could use to improve the efficiency of the program
10:06chessguy_workwhat project would that be?
10:06gnuvinceIt reads data from a ByteBuffer and transforms it into Clojure data structures.
10:06liebkegnuvince: nice tips
10:06chessguy_workoh sorry
10:06gnuvincechessguy_work: clj-stracraft. There's a quick background in the post.
10:06chessguy_worki guess i should have read your link
10:07AWizzArdgnuvince: do you constantly update that site?
10:07gnuvinceAWizzArd: I try to. Maybe 3-4 posts per month
10:08AWizzArdMaybe you could set up a static link that will always stay valid and has an overview about everything you found out?
10:08gnuvinceAWizzArd: if I have enough material, I could probably do that, Wordpress allows "static" pages.
10:09chessguy_workgnuvince looks like a great blog
10:09chessguy_workdon't see an RSS link though
10:11gnuvincechessguy_work: if you use Firefox, you should see an orange RSS icon in your address bar
10:11gnuvinceOtherwise: http://gnuvince.wordpress.com/feed/
10:12chessguy_workah, nice. added
10:12chessguy_worki was using chrome :)
10:12gnuvinceOK
10:13gnuvinceIf you have comments (positive or negatives), corrections, suggestions, don't hesitate to post them.
11:30dnolencurious, why would in some case using aset-int slow down a tight loop over using aset?
11:31durka42is it an array of primitives?
11:31dnolenyes
11:32Chouserare you sure? :-)
11:32dnolenpretty sure
11:33durka42or are you giving aset-int Integers
11:33Chouseralso, are you setting the value to an Integer or a primitive int?
11:33dnolenon comp.lang.lisp some time ago, there was a performance metric on the speed of array-primes in Clojure vs. SBCL.
11:33dnolenhere let me paste and you all can see.
11:36lisppaste8dnolen pasted "array-primes" at http://paste.lisp.org/display/80027
11:37dnolenthis has been tweaked a little, (hopefully I didn't mess it up) from what I saw on the mailing list.
11:38dnolenis it possible to get for loop performance over java primitive arrays in Clojure, or is something best done in Java?
11:38dnolenthat's really what I think the question is here.
11:38Chouseryou should be able to get there.
11:38dnolenChouser: that's what I thought
11:38dnolenbut I've tried a lot of things and haven't been able to figure it out.
11:38Chouserand loop/recur with primitives is the way to get there.
11:39dnolenyes
11:39dnolenthat what's being used here
11:39Chouserok, outer-index is a non-primitive
11:39Chouserwhich means inner-index is non-primitive
11:40Chouserwhich means the * operations will have to box/unbox (I think), etc.
11:40Chouserperhaps try (loop [outer-index (int 2)] ...) instead of the #^Integer hint?
11:40dnolenit said I can't type hint a local
11:41dnolenwith primitive initializer
11:42Chouser,(loop [i (int 2)] (if (< i 10) (recur (unchecked-inc i)) i))
11:42clojurebot10
11:42lisppaste8dnolen pasted "aset vs. aset-in" at http://paste.lisp.org/display/80028
11:43dnolenhere's the example of aset-int being slower than aset
11:43dnolenaset-int takes about 1.2s while aset takes ~120ms
11:44stuhood~def aset-int
11:45stuartsierra1For these situations, it might be useful to have a "disassemble" function that shows the generated bytecode.
11:46dnolenstuartsierra: true.
11:47dnolen,(loop [#^Integer i (int 2)] (if (< i 10) (recur (unchecked-inc i)) i))
11:47clojurebotjava.lang.UnsupportedOperationException: Can't type hint a local with a primitive initializer
11:47lisppaste8rhickey annotated #80027 "faster array-primes" at http://paste.lisp.org/display/80027#1
11:49hiredmanso unchecked-inc -> inc
11:50rhickeyless is more, avoid unchecked if you can
11:50durka42(neg? (unchecked-subtract (int aidx) (int limit))) seems to be much baster than (< (int aidx) (int limit))
11:50rhickeycoercing at point of use is always a mistake, coerce at point of binding
11:51rhickeyi.e. let/loop
11:51Chouseris that why aset-inc in his second example is slower than aset?
11:53rhickeya trick, if you fn takes something you want to be considered primitive, re-let it: (defn integers [limit] (let [limit (int limit) ...
11:53ChouserI guess with a hinted array, aset is resolving a direct method-call anyway. Perhaps there's simply nothing faster than that.
11:53rhickeyChouser: yes, hinted array + aset is fastest, aset-int is not a fast thing at all
11:53stuhoodChouser: beat me to it... the array is already type hinted
11:54stuartsierraDoes aset compile to a method call or to a bytecode array operation?
11:54stuhoodmethod call: Array.setBlah
11:55rhickeystuartsierra: with all hints in place, the static method it resolves to is optimized by HotSpot into single array instructions, but I never have to emit them
11:55stuartsierraok, cool
11:56rhickeystuhood: no, aset can do much better than Array.setBlah
11:56stuhoodrhickey: after hotspot has compiled it? the implementation of aset just looks like it calls Arrays.set
11:57rhickeystuartsierra: that's one reason why disassembly won't show full story, but you can see what hotspot does using some flags I think
11:57stuartsierraok. I was about to ask if there was a way to see what Hotspot is doing.
11:57Chouserso aset-<type> is for convience to avoid reflection, not performance when you're willing to type hint for primitives.
11:57dnolenwow
11:57dnolenthis is great
11:57cgrand1stuhood: look at the :inline meta
11:58dnolenso array-prime minus all the aset-int cruft when from taking forever to taking 900ms
11:58rhickeystuhood: aset has an inline definition
11:58dnolenso filter is eager correct?
11:58dnolennot lazy.
11:58rhickeyto RT.aset, which is overloaded for specific arrays
11:58kotarakdnolen: filter is lazy
11:58stuhoodahhh
11:59dnolenOK so maybe not 900ms :)
12:03rhickeyI wrote about optimization tips here: http://groups.google.com/group/clojure/browse_frm/thread/61f236e830d98cb3/9cc8e1572b793c7e?lnk=gst&amp;q=optimization#9cc8e1572b793c7e
12:03rhickeyno one replied
12:03Chouser heh
12:05stuartsierrathose might be good tips to add to clojure.org
12:05dnolenyes
12:06stuhoodcgrand1: regarding the inline definitions: when does it have to fall back to the clojure implementation?
12:06dnolenAlso perhaps a clarification about what aset-* does? its seems easy to get confused.
12:10chessguy_worka witch!!!
12:11cgrandstuhood: when the arity is not supported by the inline definition (here for aset, only calls to aset with 3 arguments get inlined).
12:12hiredmanclojurebot: optimizing?
12:12clojurebotexcusez-moi
12:12hiredmanclojurebot: optimizing is http://groups.google.com/group/clojure/browse_frm/thread/61f236e830d98cb3/9cc8e1572b793c7e?lnk=gst&amp;q=optimization&amp;pli=1
12:12clojurebotIk begrijp
12:13chessguy_workclojurebot, ptimizing?
12:13chessguy_workclojurebot: optimizing?
12:13clojurebotoptimizing is http://groups.google.com/group/clojure/browse_frm/thread/61f236e830d98cb3/9cc8e1572b793c7e?lnk=gst&amp;q=optimization&amp;pli=1
12:14rhickeyhttp://clojure.org/java_interop#optimization
12:14Chouserstuhood: also when getting the function as a value, like if you're passing it to 'map'
12:15hiredmanclojurebot: forget optimizing
12:15clojurebotI forgot optimizing
12:15hiredmanclojurebot: optimizing is http://clojure.org/java_interop#optimization
12:15clojurebotRoger.
12:17stuhoodChouser,cgrand: gotcha, thanks.
12:30cadshey, does clojure have a way to exhaustively search an infinite sequence?
12:31hiredmanhow would you do that?
12:31hiredmanif it is an ordered infinite sequence I imagine you chould do something with take-while
12:32hiredmanbut otherwise you would just search forever
12:43danlarkinreplaca: ping
12:48replacadanlarkin: pong
12:48danlarkinI got your github message, tried to run your clojure-json branch but I get an error on line 60 of json.clj
12:49danlarkinUnable to resolve symbol: write in this context
12:50replacadanlarkin: oops, a use but - I think I have uncommited code. One sec
12:50replaca*but => bug
12:52replacadanlarkin: sorry. Try now
12:54replacadanlarkin: I have too many git & svn projs going at once! All with alternate repositories and such. Gets confusing :-(.
12:54danlarkinreplaca: agreed
12:55danlarkinreplaca: have you run the tests? I get a stackoverflow error when it tries the big "pass1" test
12:56replacadanlarkin: no, I just ran it over the contrib API Index. That's just meant as a quick "concept" idea rather than finished code anyway
13:02danlarkinreplaca: currently it's an awful lot slower than the master branch
13:02danlarkin500ms versus 10ms
13:02danlarkinmicrobenchmark, admittedly
13:03danlarkinbut the proof of concept is sound
13:03replacadanlarkin: yeah, pretty printing has to work harder cause it's all conditional
13:04replacadanlarkin: but there's also lots of work that can be done to speed it up (I've just begun on that).
13:04danlarkinwhat about only running it through the pretty printer if the :indent option is passed
13:04replaca(by conditional I mean it will keep things on the same line when it can)
13:04danlarkinor some equivalent flag
13:05replacaas I've thought about it more, I think it makes sense to have a separate pretty printing encoder in contrib
13:06replacaso you'd have json.{read,write,pretty} or something like that
13:06danlarkinsomething like (contrib.prettify (contrib.json.write foo))?
13:06replacacause it's a big switch
13:07replacadanlarkin: no, that doesn't work cause pretty printing works on s-exps, not strings
13:07replacaso it can't happen on the output
13:07danlarkin:-/
13:08replacarather, it's thinking about the data structure as it's constructing the output to decide where
13:08replacaline breaks and indents go
13:08danlarkinso you're trying to pass the indenting that the pretty printer gives you on through the encoder function?
13:08replacano, the pretty printer *is* the encoder function
13:09danlarkinis it not possible to make the pretty printer deal with strings? or is that just too much of a different job
13:09replacabasically it's a recursive dispatch mechanism
13:09danlarkinoh, right
13:09replacacompletely different job & then you need a parser
13:10replacathe pretty printer (like lots of lisp stuff) operates on structure
13:10replacabut dispatch means you can get any kind of structure out
13:10danlarkinmmmhmm
13:11replacaThe big advantage is that it's easy for it to be very smart about when and where to put line breaks
13:11tbbhi all, i have a problem i hope someone can help me with. i'm writing some sort of algorithmic animation tool. i define some algorithms that change the visuals over time. i'd also like to add some algorithms together in another algorithm. whenever these algorithms are called, i want it to show in the logs, but.. i want to know whether the lowlevel algorithm calls belong to the highlevel call or whether they are separate calls. i defined the followin
13:11tbb(def *action-id* nil)
13:11tbb(defn action-id []
13:11tbb (if (nil? *action-id*)
13:11tbb (gensym "action-")
13:11tbb *action-id*))
13:11tbb(defn action-id-test []
13:11replacaso it doesn't put a whole bunch of unnecessary line breaks in
13:11tbb (println (action-id))
13:11tbb (loop [counter 0]
13:11tbb (binding [*action-id* (action-id)]
13:11tbb (println (action-id))
13:11tbb (println counter)
13:11tbb (if (> counter 5)
13:11tbb nil
13:12tbb (recur (inc counter))))))
13:12tbboops
13:12danlarkintbb: please do not spam the channel with code, that's incredibly rude
13:12tbbmy problem is: the binding gets cached somehow
13:12tbbi'm sorry
13:12danlarkinreplaca: brb
13:12replacatbb: you can use lisppaste
13:12tbbi thought it would show up nicer
13:12replacadanlarkin: gotta run to the office
13:12replacalisppaste8: url?
13:12lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
13:12danlarkinreplaca: we'll talk later, then
13:13replacaok, sounds good. I'll fix that bug somewhere along the way
13:13tbbpast number 80033, the problem is the binding gets cached
13:14tbbthe weird thing is that it is cached in the repl, but not c-x c-e in the file
13:14lisppaste8tbb pasted "cached-binding" at http://paste.lisp.org/display/80034
13:15tbbsorry for the spamming, i like this lisppaste :)
13:16replacatbb: what do you mean by "cached?"
13:17tbbreplaca: when i evaluate *action-id* in the repl it has the value of the gensym, which should be rebound to nil (right?)
13:20tbbwithout the recursion it works properly
13:22lisppaste8hiredman annotated #80034 "output at repl" at http://paste.lisp.org/display/80034#1
13:23hiredmanI dunno why you would put the binding in the loop like that anyway
13:23lisppaste8tbb pasted "first-run-second-run" at http://paste.lisp.org/display/80036
13:23hiredmanI would definetly put it outside the loop
13:25tbbhiredman: this is just a test to see if the bindings worked, i'll be using this in different algorithms, compounded algorithms should all log with the same id
13:25tbbi'll make an example
13:25replacahiredman: well, if he wants a different binding for each recursion step (I assume this is a simplified example)
13:25replaca*fdr => for
13:25hiredmantbb: the problem is the extra println at the top of the function
13:25hiredmanit is making you think something is happen, which isn't
13:26hiredmanbinding definetly works
13:26hiredmanbut keep in mind binding is not assignment
13:26tbbhiredman: what do you get if you evaluate *action-id* in the repl now?
13:26replacatbb: but afterwards, what does the repl think the value of *action-id* is?
13:27replacahiredman: tbb think the binding is "sticky" all the way back to the repl
13:27replacatbb: right?
13:27tbbreplaca: it thinks it's "action-id-###", it doesn't return to nil
13:27tbbyes
13:27tbbthis is the output of two consequent runs: lisppaste8: tbb pasted "first-run-second-run" at http://paste.lisp.org/display/80036
13:27replacatbb: that seems wrong to me, too
13:28hiredmantbb: you should lookup gensym
13:28hiredman~def gensym
13:28replacahiredman: I don't think tbb is talking about the gensym
13:29replacahiredman: the fact that it has two differnt vals is OK
13:29tbbi'll make a clearer example
13:29replacatbb: when you use lisppaste, just keep annotating the same paste rather than creating new ones
13:29tbbok
13:30lisppaste8tbb annotated #80036 "clear-example" at http://paste.lisp.org/display/80036#1
13:30replacameans I can type ^r inmy browser :-)
13:30tbbhaha
13:31tbbsomehow, the recursion makes it sticky
13:32replacatbb: I agree that *action-id* should be nil after that, but maybe there's something I don't understand about binding here
13:32replacatbb: Maybe a group post would shed more light on this
13:32tbbreplaca: i'm coding an example of how i intend to use it
13:33tbbi'll do that
13:33replacatbb: I've got to run, but I'm also interested in the answer here cause I would think that the result you're getting is impossible. But clearly, we're both wrong :-)
13:34tbbhaha, ok, i'll post it to the group
13:34tbbthanks for your time :)
13:34replacatb: no prob
13:35hiredmanhmmm
13:36hiredmanit looks like the bindings are not being removed
13:36tbbwhat i've found out is they are removed if there aren't any recursive bindings, and it only happens in the repl
13:36lisppaste8hiredman annotated #80034 "set!" at http://paste.lisp.org/display/80034#2
13:37tbbhiredman: yes, that's what i get too
13:39lisppaste8hiredman annotated #80034 "close the binding before recur" at http://paste.lisp.org/display/80034#3
13:40hiredmanthat gives what I assume is the expected behaviour
13:43tbbhiredman: the intended behavior is that *action-id* is bound to a gensym and stays bound to it all the way down the function calls, it should only be bound at the toplevel
13:43tbbso the every time i call action-id-test the gensym should be the same for all the print outs, but the next time i call it they should be different than before
13:44hiredmanah
13:44hiredmanhmm
13:47lisppaste8hiredman annotated #80034 "binding outside the loop" at http://paste.lisp.org/display/80034#4
13:48tbbhiredman: it seems like loop is the culprit indeed
13:48hiredmanyeah
13:48tbbalthough in this way i can't test the recursiveness i'm after
13:49tbbi made a new example that shows the intended use
13:49cp2hello folks
13:50lisppaste8tbb annotated #80034 "intended" at http://paste.lisp.org/display/80034#5
13:50tbbhi cp2
13:51tbbhiredman: that one works just fine
13:51hiredmantbb: I don't see anything that precludes the use of binding outside the loop
13:52hiredmanit is troubling none the less
13:52tbbhiredman: i used it inside the loop to simulate functions calls that all rebind *action-id*, like in the new annotation
13:52hiredmanyou are sending something to the group?
13:53tbbit seems to work for what i wanted to use it for, but i'd like to know why we get this behavior so i'll post something
13:54hiredmanugh
13:54hiredmanwriting guis is such a drag (everywhere) I wish someone would do something about that
13:55slashus2Make a DSL for GUI programming?
13:55technomancystop using GUIs? =)
13:55dnolen___hiredman: I'd say Cocoa + Interface Builder is damn good. sad so few GUI programming systems have learned from it.
13:55hiredmantechnomancy: Word
13:56dnolen___Interface Builder was originally a Lisp program.
13:58chrizelThere should be a functional way of making GUIs... :-/
13:58hiredmanthere are
13:59hiredman~google functional reactive programing
13:59clojurebotFirst, out of 46000 results is:
13:59clojurebotFunctional reactive programming - Wikipedia, the free encyclopedia
13:59clojurebothttp://en.wikipedia.org/wiki/Functional_reactive_programming
14:03dnolen___http://www.cs.virginia.edu/~robins/papers/Signal_Constellation_Design_Tool_A_Case_Study_in_User_Interface_Synthesis.pdf
14:03dnolen___history of original Interface Builder as Lisp program running on Macintosh
14:03rfgpfeifferis there a continuation-based web framework for Clojure?
14:04hiredmannope
14:04dnolen___rfgpfeiffer: I'm still working on it
14:04dnolen___but not a whole framework
14:04dnolen___just middleware
14:04dnolen___then you can use whatever webframework you want.
14:04stuartsierraThe JVM cannot support continuations natively.
14:04dnolen___you don't need to support full continuations for building webapps tho.
14:04dnolen___just delimited continuations, this what Seaside and Weblocks use.
14:04stuartsierrayes
14:05stuartsierraRight, you can simulate continuations up to a point.
14:05rhickeystuartsierra: sorry I can't make it tomorrow - conflict w/school band concert!
14:05dnolen___stuartsierra: yeah, you only need to capture use interactions, not the whole state of the web stack.
14:05dnolen___user interactions.
14:06rfgpfeifferhttp://github.com/nex3/arc/blob/b3d2199f52fc0ef96ae78656e5baff0b18cb6cf3/srv.arc only uses closures
14:06stuartsierrarhickey: that's ok. We're still sketchy on the venue anyway.
14:06rhickeystuartsierra: I wonder what the attendance might be for a NYC Clojure meetup group
14:07hiredmanrhickey: did you see tbb's issue with binding and recur?
14:07danlarkinre: NYC meetup: on the right day I would go
14:08stuartsierrarhickey: I've wondered the same thing
14:23tbbhiredman: i just posted it to the group :)
14:26hiredmantbb: is this your first post?
14:26tbbyes
14:27hiredmanok, so it will sit in the moderation queue until rhickey gives it the go ahead
14:27tbbah, i see
14:28tbbwell, i'm not in a hurry :)
14:28tbbthanks for your time man
14:40stuartsierraand I'm back
14:50mattreplwb
14:51rhickeystuartsierra: any thoughts on a meeting place?
14:57stuartsierrarhickey: Hmm. Columbia's too expensive, unless I can a group will sponsor it.
14:58stuartsierraLet me think about it. Got to prepare for LispNYC tomorrow and an exam on Wednesday.
14:58rhickeystuartsierra: I guess that's why lispnyc meets in churches and bars :)
14:58stuartsierrarhickey: exactly.
15:01smauelhey guys so when is the 'programming clojure' book coming out?
15:02cp2how about a clojure meet in dc
15:02rhickeycp2: http://groups.google.com/group/clojure-study-dc
15:02cp2oh neat
15:03smauelanyone know?
15:03stuartsierrasmauel: soon :)
15:04stuartsierraYou can get the PDF now.
15:04smauelya but it's delayed isn't it?
15:04smauelit was meant to be out on the 28th april
15:04stuartsierrayes, it was delayed for the lazy sequence branch of Clojure, completed now
15:05Chouseryeah, someone changed the language.
15:05cp2those bastards =p
15:05sdfd
15:05smauel`sorry i dc
15:16replacastuartsierra, rhickey: Can you do what we do here in SF? Find a friendly company with a big conference room.
15:17rhickeyreplaca: maybe, stuartsierra said he'd think on it
15:18grzmI think I'm misunderstanding the use of (ns com.example.foo (:use (com.example [bar :as bar])))
15:18replacaI mean, Lisp is a religion, but actually going to church seems a bit much :-)
15:18stuartsierraheh
15:19rhickeyI've given a few talks at that church - it's very bizarre
15:19grzmI was thinking that I would need to refer to all of the com.example.bar objects using bar/some-bar-obj, but it seems like some-bar-obj works just fine by itself.
15:19hiredmangrzm: replace :user with :require
15:19hiredmaner
15:19hiredman:user
15:19hiredman:use
15:19hiredmanblah
15:19Chouseror add :only []
15:20grzmhiredman: thanks for confirming
15:20grzmChouser: I actually want the shortened namespace scoping as I have objects with the same names in different namespaces, so if I'm understanding correctly, I'd still get collisions with :only
15:21rhickeyWhat's up with Scandinavia? Is there a big Clojure base there? I've been invited to speak at 3 separate conferences in Denmark, Norway and Sweden
15:21stuartsierraMaybe it's all those mobile phone folk.
15:22stuartsierraAsk them when I can get a Lisphone.
15:22Chousergrzm: by default, 'use' will bring all the names into your new namespace. but if you say :only, then it will bring in just the ones you specify
15:23Chousergrzm: so :only [] will bring in none -- just like 'require' does by default.
15:23rhickeystuartsierra: as soon as we get Clojure compiling to ObjectiveC
15:23grzmChouser: thanks for confirming
15:23stuartsierraObjectiveC, really? Oh, the iPhone, right.
15:23grzmoh, I see: you meant explicitly an empty array
15:23Chousergrzm: yes
15:23Chouserempty vector
15:24grzmChouser: vector :) cheers
15:24cp2rhickey: er.. really?
15:25cp2oh i see, didnt notice what stuartsierra said
15:25rhickeystuartsierra: on android already
15:25Chouserrefcount instead of garbage collection (for ObjectiveC)?
15:26rhickeyChouser: that is the problem, even though Objc 2 has GC, iPhone doesn't?
15:26dnolenObjC has garbage collection now, just not on phone. Probably a matter of time tho. There is a usable Lisp for iPhone Dev, Nu, but it's not nearly as nice as Clojure.
15:26cemerickis it realistic to think that clojure will eventually have more (full-featured) backends beyond the jvm and clr? Getting to the point where 90% is self-hosting obviously simplifies things, but that last 10% (concurrency primitives, memory model, etc) get *really* tricky on other signficantly-different platforms (objc, llvm, etc?)
15:26Chouserrhickey: so someone said.
15:26cp2how is clojure on clr doing anyway?
15:27Chousercemerick: but looking at contrib, for example, may demonstrate how little that 10% is required for some large set of apps.
15:27rhickeycemerick: I'm not sure any would be 'full-featured' other than jvm/clr, but those are two huge targets. Still plenty of utility in partially-featured JS/ActionScript/ObjC, IMO
15:27stuartsierraagreed
15:28dnolenbtw, if a Clojure NYC user group happens, I host a small study group in Brooklyn that would definitely be interested in coming.
15:29stuartsierraIt will happen. How does mid-June sound?
15:29dnolengreat
15:29rhickeyChouser: I got sidetracked a bit with this modularity stuff (it's a big deal for Netbeans/OSGi et al), because it looks like I can deliver some benefit pre-clojure-on-clojure. Then I'm onto c-i-c
15:30replacarhickey: have you thought about Blackberry at all? I know it's mostly J2ME which I remember being an issue for Clojure. I have a good friend who's an evangelist there and could help us make that happen if it made sense.
15:30rhickeystuartsierra: sounds good, just as long as post-JavaOne
15:30stuartsierraok
15:30Chouserrhickey: ok. I've been sidetracked by a new job and lack of non-work computer to do any side projects.
15:31ChouserI haven't touched c-i-c in weeks, probably not since ILC
15:31rhickeyreplaca: I'm not going to go crazy trying to fit Clojure on very small profile Java, but plans include splitting out ASM and compiler stuff for smaller footprint, as well as options to drop docstrings etc
15:32rhickeyChouser: I have thought about it a lot, mostly making a huge list of things it needs to address :(
15:33Chousernice
15:33rhickeyI think I need to do instance/make whatever in Java prior to c-i-c so we have it when defining c-i-c
15:33hiredmanj2me is horrible
15:33hiredman(btw)
15:33smauel`is clojure as fast as scala?
15:33replacarhickey: makes sense. I think they're moving towards a biger footprint (to compete with iphone). Are there particular things we would need from them for it to make sense?
15:34rhickeyreplaca: the closer it is to j2se the better, more memory is always good too
15:36hiredmanj2me is java 2, which is jdk 1.4 which is pre-Collections
15:36dnolensmauel: probably depends on what you are doing, both compile to bytecode so perf is probably comparable.
15:36hiredmanwiat
15:36rhickeyChouser: I also had ideas about HIP (host-in-parens), basically a completely transparent non-abstracted DSL for generating host code, but homoiconic and thus allowing for macros. I don't like what gen-class is growing towards
15:36hiredmanI lie
15:36replacarhickey: are there any specific things along that continuum that I should probe for? I can do some reconnaissance and report back.
15:37hiredmanjdk 1.4 has Collections
15:37stuartsierrahost-in-parens sounds awesome
15:38rhickeystuartsierra: yeah the idea is that clojure in clojure would be 90% clojure, 10% host in parens, and host-in-parens would reduce pressure to cram every host feature into some Clojure feature
15:38Chouserhuh
15:38stuartsierraSo, in theory, you could emit x86 assembly if you wanted to?
15:39Chouseronce you had written HIP-for-x86-assembly
15:39stuartsierraright
15:39rhickeyby the time we add all access specifiers, package qualifiers, annotations etc into gen-class, I'd rather write Java
15:40stuartsierrayeah, that makes sense
15:40rhickeyerm, I don't think assembly is going to be a viable host. We're still talking simple-object-based hosts
15:40stuartsierrafair enough
15:41stuartsierraThat still leaves a lot of options. JVM, CLR, Parrot, ...?
15:41Chouserdid anyone see my little JNA bit? Makes C look more dynamic that I would have guessed.
15:41Chouserthan
15:41dnolenrhickey: this would grealy simplify getting Clojure subset to run ObjC? ... that would be sweet.
15:41duncanmChouser: link?
15:41Chouserhttp://github.com/Chouser/clojure-jna/tree/master
15:42cp2Chouser: yeah, jna is pretty nice
15:42cp2oh, clojure jna
15:42cp2havent seen that ye
15:42cp2t.
15:42rhickeydnolen: I don't know enough about ObjC to say definitively. I'd love to target the iPhone, but don't know if lack of GC is prohibitive. Everything else has GC
15:42cp2looks good
15:42ChouserIt's hardly anything but it's fun. With no other in-clojure setup or declarations: (jna-invoke Integer c/printf "My number: %d\n" 5)
15:43rhickeyah, printf
15:43rhickeybeen a while
15:43Chouserright, because that's what you really want from libc
15:43Chouser:-)
15:43cp2heh
15:43cp2I guess it's the number of bytes printed or
15:43cp2something? Anyway, feel free to ignore it just like all C programs do.
15:43cp2i chuckled
15:44ChouserI'm hoping this will be the solution to my dbus-java pain.
15:44ChousukeI didn't even realise printf had a return value
15:44sohailChouser, that is effing hardcore man :-)
15:44ChousukeI'm sure I've read the manual page more than once.
15:44cp2yeah i didnt know that either
15:44cp2learn something new everyday =)
15:45cp2oh, jna-fn is nice
15:45Chouseryeah, I think many C programmers would be startled by: int i = printf(...)
15:46sohailI thought printf returns int... why is that startling?
15:47danlarkinah university programming, where they made us check the return value of printf
15:48cp2seriously? uck
15:48cp2if (!printf(....)) printf("error printing\n");
15:48cp2oh wait...
15:48danlarkinyeah it was all if(printf("foo") > 0) style
15:49Chouserif printf didn't segfault, that sounds like success to me
15:49rhickeythere you go
15:49danlarkinnot so much with printf, but with sprintf it's useful
15:49ChouserThat's the other thing you realize using jna, esp. with strings. One little misstep and down goes the JVM.
15:50cp2well, jna automagically converts java String to c style strings
15:50cp2so shouldnt be too problematic
15:50Chouser(c-printf "My number: %s\n" 5)
15:50Chouser*boom*
15:50hiredmanouch
15:51rhickeyChouser: that was my problem with jFli (embedding JVM in CL), one interop problem and the JVM goes down, taking CL with it or at least rendering the JVM non-restartable
15:51cp2oh right Chouser
15:51stuartsierrawew
15:51Chouserrhickey: you had to do JNI stuff to get the two to talk?
15:51stuartsierrawow
15:51rhickeyChouser: big time JNI
15:51cp2yeah
15:52rhickeynot fun
15:52cp2jni is disgusting =p
15:52rhickeybut it was a one-time thing, once jFli was working you could new up and call Java objects as if they were CLOS objects
15:52Chouserjna is about as pretty as one could hope for.
15:53Chouserrhickey: well, no offense, but I'm glad you gave up on it.
15:53rhickeyThat's the biggest relief with Clojure, the host/implementation lang and Clojure share GC/memory model/ type system etc. interop is perilous
15:54rhickeyChouser: me too :)
15:54drewrrhickey: How reluctant were you at first to create a new lisp dialect? Was it a last resort?
15:55rhickeyOTOH, it works - Nick Levine polished up jFli a bit subsequently and its perfectly useable
15:57rhickeydrewr: when I first learned CL after a dozen years of C++ I thought, "WT heck have I been doing with my life!? I want to eventually program like this (Lisp)". Only with Clojure does that now seem possible.
15:58dnolen:)
15:58stuartsierra"Clojure: Lisp for people who need to get s*** done."
15:58rhickeyexactly
15:58drewrrhickey: I mean, was creating a separate lisp ever a definite "no" in your mind, an end you eventually had to compromise with?
15:58clojurebotrhickey is a T-1000 sent from the future
15:59rhickeythough I'd prefer an expletive-free slogan :)
15:59dnolenat my study group the other day we were talking about the insanity of C++ const, and how you can avoid that alltogether if everything is immutable by default.
15:59hiredman~optimizing
15:59clojurebotoptimizing is http://clojure.org/java_interop#optimization
15:59drewrI'm guessing the answer is yes since you tried everything else first, but I didn't know how reluctant you were.
16:00rhickeydrewr: creating a new language is a crazy thing to do. The only reason I did that, rather than keep pursuing interop or move to ABCL/Kawa was I had some new ideas about mixing Lisp and FP
16:00stuartsierrarhickey: Yeah, might not sit too well for the corporate folks. But the college kids will like it.
16:01technomancyclojurebot: optimazating is http://wondermark.com/481/
16:01clojurebotAlles klar
16:03rhickeystuartsierra: after the "Ruby: Perform Like a Pr0n Star" slides scandal, I think Clojure should stay on the high road
16:03drewrlol
16:03technomancythere could be ladies present
16:03Chouseror gentlemen
16:04technomancythat too. =)
16:04stuartsierraWell, if you insist. :)
16:05stuartsierra"Clojure: Lisp without Weenies."
16:08Raynes"Clojure: Lisp of the Rings."
16:08sohailI thought pr0n stars only fake performance by doing the same scenes over and over to make it look longer
16:09dmilesbtw: clojure on IKVM is pretty cool
16:09stuartsierraYes, but we call it recursion.
16:09dmileshaha
16:09sohailruby doesn't support tail recursion!
16:09sohailok I'm done
16:10dmilesAs far as introp with ABCL.Net.Dll its going to take more work.. almost better maybe if i have the interop in Java first
16:10sohailtail call optimization, now I'm done
16:11rhickeyuh oh, time to switch to Axum: http://msdn.microsoft.com/en-us/devlabs/dd795202.aspx
16:11rhickeysays MS
16:12Chouser"builds upon the architecture of the Web"!?
16:12RaynesAxum looks infinitely boring.
16:12technomancy"Should I Use Axum? Yes!" <= well, I guess that settles it then.
16:12ataggartlol
16:13ataggartthe hivemind has spoken
16:13hiredmanI opened the programmer's guide, saw the visual studio "create a new project" stuff, and ran away
16:14Chouserhiredman: I just did the same thing.
16:14technomancyhiredman: maybe if you installed the Silverlight plugin you could be wowed by the video.
16:14ChouserThe Basics ... screenshot ... close pdf viewer.
16:14hiredmantechnomancy: possibly
16:14ChouserBut then again, I'm probably being closed-minded.
16:16ChouserIt's so much easier to dismiss a new language than to expend the effort to find out if it has anything worth learning about.
16:16Chousukeit kind of looks like it's C# with new keywords and syntactic sugar
16:17hiredmanChouser: exactly
16:18Chousukepity the lesser languages.. if you want syntactic sugar all you can do is invent a new language ;(
16:19technomancyRaynes: does it say it works on Mono? IronRuby doesn't.
16:19Raynestechnomancy: No, I just don't feel like installing Mono. For any of those Microsoft languages.
16:22edgar_hello
16:23edgar_i got clojure
16:23edgar_but when i try to run it, i got an error
16:23Chouseredgar_: you downloaded the 1.0.0 zip file?
16:23edgar_i'm going to publish the error in pastebin.com
16:23edgar_for you can see it
16:23edgar_Chouser yes
16:23edgar_<Chouser>
16:24hiredman...
16:24Chouserhiredman: you spilled some dots
16:24Raynes...
16:24edgar_http://pastebin.com/d446275a2
16:25hiredmanedgar_: replace clojure.lang.Repl with clojure.main
16:25edgar_there is the pastebin link where is the error i got
16:25edgar_ok let me see
16:25stuhoodor run `java -jar clojure.jar`
16:25hiredmanthat too
16:25edgar_well i got a similar error
16:27edgar_okok, now it runs with java -jar clojure.jar
16:28edgar_i got other problem with the clojure netbeans plugin
16:28edgar_i installed but it wont create a clojure project
16:28edgar_it seems that is in development
16:29edgar_and also i have netbeans 6.7 beta, so maybe isn't compatible
16:30replacathe axum guys lost me at "start Visual Studio...."
16:31chrizelis there an apply for methods? like (apply method-name object args)?
16:31replacaI see hiredman had the same reaction
16:31Chouserchrizel: the method takes varargs?
16:31hiredmanedgar_: I do not believe there are too many netbeans users here, maybe Raynes can help?
16:32Chouserchrizel: or you just want to unpack a fixed number of args from a seq?
16:32RaynesI certainly can. NetBeans 6.7 is currently not supported.
16:32RaynesYou'll have to use 6.5 for now.
16:32edgar_so you are saying that netbeans isn't used by many users?
16:32chrizelChouser, a fixed number of args i get from an vector - ok, then i could just unpack them before...
16:33Chouserchrizel: yeah, you can either use a macro, or just (.foo obj (v 0) (v 1) (v 2))
16:33hiredmanedgar_: as far as this this channel goes the only one I know of off the top of my head is Raynes
16:33Raynesedgar_: Most people just use Emacs. The NetBean's plugin is pretty good, I switched to Eclipse simply because I use it more. Both plugins will improve in the future. They are quite new.
16:33hiredmanI dunno about the community at large
16:34edgar_ok
16:34RaynesWell, /they work/. That's all I can promise. ;)
16:34chrizelChouser, thx
16:34edgar_and so...most of the people prefer emacs over vim?
16:35cadshiredman: I think we can search certain classes of compact uncountable spaces in finite time. http://www.cs.bham.ac.uk/~mhe/papers/exhaustive.pdf
16:35stuhoodChouser, chrizel: this might be a usecase for 'memfn': (apply (memfn method-name) obj args)
16:35hiredmanI use vim
16:36stuhoodoh, no, nvm.
16:36edgar_maybe in the future we see other kind of plugin for vim
16:36hiredman~vimclojure
16:36clojurebotvimclojure is state-of-the-art
16:37hiredmanwow, that was not so useful
16:37hiredman~google vimclojure
16:37clojurebotFirst, out of 131 results is:
16:37clojurebotKotka : Projects : Clojure : VimClojure
16:37clojurebothttp://kotka.de/projects/clojure/vimclojure.html
16:37chrizelstuhood, oh thanks, i'll try
16:38hiredmanedgar_: vimclojure is pretty nice, I have some issues with it's more advanced features, but most vimers find it acceptable
16:38edgar_ok
16:38stuhoodchrizel: that code won't work directly, but i think it is a start... still trying to figure it out
16:38hiredman~VIM
16:38clojurebotexcusez-moi
16:38hiredman~vim
16:38clojurebotGesundheit!
16:39hiredmanhmm
16:39kotarakEven without the advanced features <C-n> eg. should get you quite far.
16:39kotarakThe advanced features need introspection of Clojure. That implies certain constraints on the way the source looks like.
16:39hiredmanI honestly never remember the shortcuts, so I just live with identing and highlighting
16:40kotarakhiredman: me too :) I'm getting used to <C-n> and <C-x><C-o> only slowly.
16:40hiredmanhuh
16:40hiredmantab seems to do the same thing as <C-n> for me
16:40hiredmanI wonder's whose .vimrc I picked that up from
16:41kotarakhiredman: maybe the supertab plugin?
16:41cadshiredman, I don't think I can understand the topology and computability theory behind it, but the guy wrote a haskell monad that lets you define and search infinite yet exhaustible sets
16:42hiredmanah
16:42hiredmanwell those are not sequences :P
16:42hiredman?
16:43cadsyeah, sequences have an order topology that makes them inexhaustible I guess :)
16:43hiredmanI imagine that would use specific knowledge in the domain of sets
16:44cadsI'm going to see if can write the cantor set search function in clojure
16:44cadsI have to say the haskell version looks spiffy: http://math.andrej.com/2008/11/21/a-haskell-monad-for-infinite-search-in-finite-time/
16:44stuhoodchrizel: it looks like memfn requires you to name all the arguments you'll be passing, but if that works for you, it will generate a function that you can apply to: (apply (memfn split sep) ["blah" "a"])
16:44cadsapparently, a few of the functions can be generated for free just from their type specification
16:47hiredman,^#'+
16:47clojurebot{:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 569, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__3327 clojure.core$fn__3327@189fe1e>, :doc "Returns the sum of nums. (+) returns 0."}
16:49chrizelstuhood, i did it with let and destructuring, but good to know about memfn, could be useful sometime
16:50stuhoodchrizel: yea... memfn just expands into a (let) wrapped in a (fn)
16:54kotaraktechnomancy: it should return a full path for a file read with load-file, no?
16:55technomancykotarak: maybe... I haven't used load-file in months
16:55kotarakme neither...
16:55technomancyit's not much good if it doesn't return consistent results
16:55hiredmantechnomancy: well java sort of ignores the filesystem outside of jars files and the classpath
16:59technomancyquite a shame
17:00technomancythere's no problem with binding vars outside the current namespace, right?
17:01Chouserusing 'binding'? should just work.
17:02hiredmanit makes sense if you think of the jvm as vm
17:02hiredmanas a
17:04hiredmanit is some what analogous to how I have heard old ur-unix hackers talk about the unix vm
17:17technomancyI can't def in clojurebot, can I?
17:18hiredmannope
17:18technomancyoh bugger. a lazy seq inside a binding will get realized after it exits the binding.
17:18technomancygah!
17:18hiredmanyep
17:19stuhoodunless you use (doall)
18:23AWizzArdDid anyone else also get this invitation email for a "facevibe" project?
18:25AWizzArdis that some modern kind of spam email?
18:26hiredmansounds like spam
18:27ataggart~optimizing
18:27clojurebotoptimizing is http://clojure.org/java_interop#optimization
18:29AWizzArdsomeone got my email address from the google groups and told me he wants to start a new project and is looking for others to join it
18:29AWizzArdBut the interesting part is that he says hello to me with my real name, he talks about Clojure and Compojure
18:29AWizzArdbut the mail very much looks like spam
18:29hiredmanit might not be spam spam
18:30hiredmanit might just be some random guy out to change the world and show everyone how wrong they are
18:30AWizzArdand the website he linked to looks empty to me
18:30technomancywell a smart way to get stuff by spam filters is to grab keywords from publicly available mailing lists in an effort to look legitimate
18:31AWizzArdtechnomancy: yes, maybe a bot with some human input
18:31AWizzArdI don't want to post the link here, but maybe someone can check if the page is empty?
18:31technomancyAWizzArd: adblock?
18:31AWizzArdhiredman: you want to take a look? :)
18:31technomancyyou could curl it
18:32AWizzArdtechnomancy: I turned that on yes, but I expect that if someone invites me to a project, there will be something visible
18:32hiredmanAWizzArd: my curiosity is piqued
18:53AWizzArdwb chessguy
18:53chessguywhy thanky
18:53AWizzArdmaybe you can give hiredman an api, so he can make Clojurebot play chess using your engine? :p
18:54chessguyhmm
18:55Raynes"honestly? i would rather date a girl who uses heroin than a girl who uses emacs"
18:56hiredmanclojurebot: e4 is <reply>I resign
18:56clojurebotAlles klar
18:56hiredmanclojurebot: pawn to e4!
18:56clojurebotI resign
18:56hiredmanthere, it plays chess
18:57AWizzArdnow it can even play chess!
19:01dysingerheh
19:01dysingerRaynes das funny
19:01Raynesdysinger: BONUS from #Haskell twittered that a moment ago.
19:02dysingerI would rather lick the bathroom clean than use VIM
19:28dnolentechnomancy: how far is the clojure httpclient along, are you planning on using this with couchdb?
19:29technomancydnolen: it's pretty usable at this point.
19:29technomancyI've used it with couch; it seems to be pretty straightforward.
19:29dnolennice!
19:31technomancydnolen: it could be more performant if it used keepalive connections
19:31technomancyI think that's the only significant thing left, unless others can think of any further enhancements.
19:31dnolenis keepalive difficult?
19:31technomancynot sure. =)
19:32dnolen:)
19:35unlink1Is there a more elegant way of expressing (concat (when x (list x)) coll) ?
19:37cmvkkto remove false values from a collection, you mean?
19:37cmvkker, wait
19:38cmvkkyou want to add x to the beginning but only if it isn't false
19:41unlink1I guess something like (defmacro cons-when [x xs] (let [tmp# x] (concat (when tmp# (list tmp#)) xs)))
19:42unlink1I mean, (defmacro cons-when [x xs] `(let [tmp# ~x] (concat (when tmp# (list tmp#)) ~xs))
19:42clojurebotx is y
19:42cmvkkyeah. although for the record, concat isn't exactly cons.
19:42unlink1no, but I'm logically consing.
19:46unlink1It could be implemented with cons. (defmacro cons-when [x xs] `(let [first# ~x rest# ~xs] (if first# (cons first# rest#) rest#)))
19:46cmvkkit's probably more efficient that way.
19:47unlink1Well whatever the implementation, I'm sure I'm not the first person to have the idea.
19:48cmvkkif you didn't care until the end, you could always just cons everything and then do (filter identity coll) afterwards.
19:49cmvkkprobably not faster but maybe shorter
19:56unlink1Is this a correct/idiomatic implementation? (defmacro cons-when [x xs] `(let [first# ~x rest# ~xs] (if first# (cons first# rest#) rest#)))
21:55chessguysure got quiet in here
22:51eyerisHow can I instantiate an array of Java objects from Clojure?
22:53eyerisI want to use the Gtk java bindings, but the ListStore class requires a DataColumn[].
22:54eyerisAhh, nevermind, I see (to-array coll) on the java_interop page.
22:54danlarkineyeris: there's a few ways to create arrays, make-array being another
23:09jmanessdoes anyone know if there is an easy way to partition a collection based on a function?
23:10Chouseris the collection in order -- split it once? or collect things from where-ever into two groups?
23:10durka42there is partition-by
23:11jmanessah thanks
23:11jmanessthe collection isn't in order but partition-by in contrib looks like it will work
23:11Chousergood