#clojure logs

2009-07-23

00:24AnniepooSome architectural advice pls - I have a classic MVC pattern desktop editor that edits a bunch of rectangles
00:25Anniepoothe rectangles will need to interact - they have a bunch of constraints one to the next
00:26AnniepooI've built the shell of the UI that does this, but am ready to add the model and start adding widgets
00:27AnniepooI know that this is the classic situation where it's hard to keep the view out of the model, cause there's all this current state info that the two have to interact on
00:28AnniepooSo I'm trying to figure out how to make them play together better than Java allows.
00:28Anniepooanybody have a design pattern for this?
01:44JomyootIf you will have lots and lots of updates. is hashmap in clojure much slower than Java hashmap?
01:51JomyootDoes Slime or any IDE support refactoring in Clojure yet?
02:02mebaran151your definition of lots is key
02:02mebaran151it's a log32 n datastructure as opposed to a constant time datastructure
02:02mebaran151so plan accordingly
02:12duncanmwhen using the PROXY form, is there a way to access the this pointer?
02:16Mark_Addlemanchouser, thanks for the hint. i've got this now: (for [x (for [[p c] x] (map #(cons p %) c))] x)
02:17Mark_Addlemanthat yields (((1235 0 17)) ((1236 0 15) (1236 16 8))) which is awfully close to what i want except for all the sublists. is there a function that will partially flatten that list?
02:21fffej,'(1 , 2)
02:21clojurebot(1 2)
02:21fffejis there any way to get the "," as a symbol in the above expression? (e.g. an escaping like Lisps |,|)
02:22Mark_Addlemanffej: is this what you want: (interpose (symbol ",") [1 2]) ?
02:22Mark_Addleman,(interpose (symbol ",") [1 2])
02:22clojurebot(1 , 2)
02:23fffejperfect, thanks
02:25Jomyootwhat is the macro to combine the result of (while something is ok) into a seq?
02:27duncanmJomyoot: huh?
02:29notostracafilter?
02:29notostracanot sure what you are asking
02:29mebaran151Jomyoot, reduce will do almost anything you want
02:30Jomyooti can write this with loop and recurse
02:30Jomyootbut hope something is already out there
02:32zmyrgelWhere can I find the info how to build apps with clojure?
02:32Jomyootis there good listing of all these (loop) (map) (while) (for) in one place?
02:32duncanmthen it's probably reduce
02:32zmyrgelI don't mean the syntax, more in the way how functional programs are designed
02:33fffejtry SICP or HTDP
02:33duncanmJomyoot: can you show your code? if your'e doing it like that, you're probably not using the right combinators
02:33zmyrgelfffej: HTDP?
02:33mebaran151zmyrgel, Paul Graham's On Lisp is decent
02:33duncanmHow To Design Programs
02:34zmyrgelok, SICP has been on my to-do list for some time. I might be go with that
02:34fffejzmyrgel: they're both awesome books on designing functional programmes
02:34fffejzmyrgel: and you can watch the videos on your iPod
02:34mebaran151SICP is sort of the magic koolaid of programming
02:34zmyrgel:)
02:35mebaran151or the electric koolaid acid test if you would
02:35mebaran151everything from the 60's was just a little more farout
02:35zmyrgelOne of the clojures nice features is that it works on platforms.
02:36mebaran151it's great to have a good lisp to suggest to people on Windows
02:36mebaran151what's the best way to run tests in Clojure
02:36zmyrgelI have been trying to get Haskell to work on my computers but it seems a losing battle
02:36mebaran151I'd love to be able to put them in the test dir of clojure project in netbeans and pound F11 until the pass
02:36mebaran151but I haven't figured out how to hook in the runner
02:36mebaran151zmyrgel, I once tried to compile it from scratch: and so lost 5 hours of my life
02:36zmyrgelwell, theres some older haskell compiler present as the newer fail to compile or contain bugs
02:37zmyrgelOtherwise Haskell would be pretty interresting language
02:37mebaran151the thing goes through a Perl mangler to optimize the bytecodes
02:37zmyrgelHas anyone read the Programming Clojure?
02:37mebaran151have you tried OCaml?
02:37mebaran151Ocaml tends to actually work
02:38zmyrgelI've installed it but haven't tried it
02:38mebaran151and it's in the same spirit as Haskell, with a little less ocd about purity
02:38mebaran151a colleague bought the Clojure Book
02:38mebaran151it's actually one of the better Pragmatic ones
02:38mebaran151Halloway wrote really clearly
02:38mebaran151much better than the Ruby reference
02:39zmyrgelDoes the book have anything related to how design apps or does it focus on the syntax stuff that can be learned from wiki/tutorials etc?
02:41zmyrgelwtf does that sicp contain?... Its priced 170 EUR on local bookstore
02:43duncanmzmyrgel: you can watch the online lectures instead, those are free
02:44hiredmanclojurebot: sicp?
02:44clojurebotsicp is http://web.mit.edu/alexmv/6.001/sicp.pdf
02:44hiredmanshare and enjoy
02:44zmyrgelduncanm: I prefer good solid book for reading :)
02:44hiredmanclojurebot: literal [?] sicp
02:44clojurebot2
02:44hiredmanclojurebot: literal [0] sicp
02:44clojurebothttp://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages:Clojure:Chapter_1
02:45hiredmanclojurebot: literal [2] sicp
02:45clojurebot2 is out of range
02:45duncanmthe lectures are really good, it's given by the same people who wrote the book
02:45zmyrgelAt least Amazon has it cheaper
02:45hiredmanclojurebot: literal [1] sicp
02:45clojurebothttp://web.mit.edu/alexmv/6.001/sicp.pdf
02:45hiredmanclojurebot: delicious
02:45clojurebotdelicious is http://delicious.com/clojurebot
02:46hiredmanclojurebot: sicp is also <reply>http://sicpinclojure.com/
02:46clojurebotRoger.
02:47zmyrgelHow would you start web programming with clojure?
02:48hiredmanclojurebot: compojure?
02:48clojurebotcompojure is http://github.com/weavejester/compojure/tree/master
02:48hiredmanI think compojure must be the easiest place to start
02:48zmyrgelcan the jetty be replaced with Apache + tomcat?
02:49hiredmanI am pretty sure compojure has been deployed in tomcat
02:49zmyrgelGood :)
02:50zmyrgelI have more experience with that combo and my server has Apache as default so I don't have to make unnecessary changes
02:51hiredmaneasiest might be to just have apache proxy for jetty
02:51hiredmanwhich is what I am doing for my jetty install
02:51hiredmanbut I really have not played with compojure in many months
02:52zmyrgelGotta look into that once I get my new server up and running
02:52zmyrgelshould arrive tonight :)
02:52zmyrgelmore toys for me to play with :)
02:53mebaran151I just setup up compojure behind a jetty proxy
02:53mebaran151jetty is classy software
02:53mebaran151*jetty behind a lighttpd proxy
02:53mebaran151was actually a pretty smooth experience
02:54mebaran151you could even probaby just take advantage of the embedded jetty server, compile it as jar and never have to worry about any deployment stuff again
02:55zmyrgelok
02:55zmyrgelhmm, but now I think I need to focus why my script loses ~3k customers at some point...
02:57mebaran151loses 3k customers?
02:59zmyrgelparses customer data from our servers and now gets about 3k less than before
03:01Jomyooti am naive here: but if each time you add a new item to hash map. it creates a new hash map. isn't that very expensive action then?
03:01Jomyootsince a hash-map will be copied over and over
03:03mebaran151Jomyoot, hash maps in clojure are persistent
03:03mebaran151it uses the old hashmap as the basis of the new one
03:03Jomyootis that the same for all collections in clojure?
03:03mebaran151yep
03:04hiredmanJomyoot: please checkout the clojure website, clojure.org, and in specific http://clojure.org/data_structures
03:04hiredman~bliptv
03:04clojurebotTitim gan éirí ort.
03:04hiredmanbah
03:04hiredman~blip.tv
03:04clojurebotblip.tv is http://clojure.blip.tv/
03:05hiredmanthere are some good intro to clojure videos there
03:05mebaran151what's the nest way to turn a clojure map into a byte array?
03:05duncanmhey hiredman
03:05duncanmhiredman: do you do any swing programming with Clojure?
03:06hiredmannot much
03:06hiredmanvery littel, in fact, but some
03:06duncanmi'm trying to follow some tutorial, but it requires extending a JComponent
03:06duncanmi tried getting by with just using the PROXY form, but i can't get hold of the 'this' pointer
03:07hiredmanduncanm: this is bound to the proxy object inside the fns implementing methods
03:08duncanmthe keyword 'this' ?
03:08hiredmanthe symbol this
03:08duncanmright
03:08duncanmhmm
03:09hiredmanhmmm
03:10hiredmanyeah
03:10hiredmanuser=> @(proxy [clojure.lang.IDeref] [] (deref [] (class this)))
03:10hiredmanclojure.proxy.java.lang.Object$IDeref
03:12hiredmanmebaran151: do you mean some kind of serialization process?
03:12mebaran151yep
03:12mebaran151right now I just string and read back in
03:12mebaran151(str myhashmap
03:13hiredmanmaybe prn-str and .getBytes
03:13mebaran151but I feel like there is probably a more efficient opcode built in somewhere
03:13hiredmannah
03:13hiredmanbut use prn-str
03:15mebaran151currently doing that for my little bdb wrapper
03:16mebaran151you wouldn't happen to know the easiest way to simply deflate a string and reinflate it
03:16mebaran151the Java libraries seem to demand a lot of ceremony
03:16hiredmandeflate? like compress?
03:17mebaran151yeah
03:17mebaran151as in the deflate algo
03:18hiredmandunno deflate, java has built in zip support since jars are just zips
03:20jdzalso has a gzip support
03:20jdzdon't know what you are talking, though
03:21jdzabout
03:21mebaran151it has deflate built in too
03:21mebaran151I just haven't found a simple way to take a string and return gzipped version, and unzip that version
03:21mebaran151I was hoping there was an easier than way than having to manually manage the byte buffers all myself
03:22hiredmanI have a wrapper for zipping and unzipping strings
03:23mebaran151oh, that sounds perfect
03:23hiredmanhttp://gist.github.com/152502
03:23mebaran151thanks hiredman
03:23hiredmanI haven't touched it in a while so there may be bitrot
03:23mebaran151it looks like a fine starting point
03:24hiredmanwell good luck
03:24mebaran151for all the bloat of Java libraries, I wish they'd provide more convenience methods
03:24hiredmanheh
03:25jdzhttp://paste.lisp.org/display/68935
03:26lisppaste8jdz pasted "my current version" at http://paste.lisp.org/display/84048
03:27mebaran151I'm still trying to figure out the best place to put tests too
03:28mebaran151I'm using the rather excellent enclojure plugin, but I'm not sure how to integrate it with Junit or not
03:28mebaran151I'm debating doing it old school python style, putting them as executable code at the bottom of my file that will only be evaluated if a special variable is set, but that feels pretty hack
03:28hiredmantest-is just got moved from contrib into clojure under clojure.test
03:29mebaran151how would I run test-is under junit?
03:29hiredmandunno
03:30mebaran151I also have an async http agent implementation using apache commons that works a lot better than the http agent in clojure.contrib
03:30mebaran151could a clojure contrib library have a dependency outside the standard library?
03:30hiredmansome of it does
03:30hiredmancontrib is kind of a sprawl
03:31hiredmanor I think it does, I don't really keep up with contrib
03:31ataggartavoiding external deps would be a good thing
03:32mebaran151I'll be putting up some stuff on github pretty soon that I'd be happy to share
03:32mebaran151async io in Java though can be really nasty with some common sense wrapping
03:33mebaran151clojure could use a nice package manager: rubygems spoiled me
03:35mebaran151*without some common sense wrappings
05:00mebaran151I'm getting a strange error: can multimethods be used within macros?
05:03gulagong_hi
05:03lisppaste8ataggart pasted "Updated contrib logging" at http://paste.lisp.org/display/84053
05:04gulagong_i want to combine -> with map - any better solution than #(map %2 %1) ?
05:08mebaran151I'm getting this weird error when I nest two macros: can't embed object in code: maybe print-dup not defined
05:10gulagong_is there a possibility to beautify this? (-> '(1 2 3 4) (#(map %2 %1) #(inc %1)))
05:12AWizzArd,(-> '(1 2 3 4) (#(map %2 %1) #(inc %1)))
05:12clojurebot(2 3 4 5)
05:12AWizzArdwhat is wrong about
05:12AWizzArd,(map inc [1 2 3 4])
05:12clojurebot(2 3 4 5)
05:13gulagong_ok... increasing is not really what i want to do :)
05:13Chousukemy best advice is: don't
05:13gulagong_i want to map a bunch of complex operations on a map
05:14AWizzArdgulagong_: good ideas are: reduce, for, loop.
05:14Chousukeuse comp?
05:14Chousuke(map (comp op1 op2 op3 op4) coll)
05:14AWizzArdloop and reduce can do anything, but loop can be cleaner for very complex stuff.
05:14gulagong_oh, cool
05:14AWizzArdmap and filter are only special cases of reduce.
05:14gulagong_comp looks like what i want
05:14gulagong_thx :)
05:14jdzgulagong_: there's also partial
05:36Fossidoes anybody here know what the 'CA' is, that is needed to get into the clojure Assembla thing?
05:37FossiCertificate Authority?
05:37Fossibut then, what's the deal with that?
05:38rottcoddhttp://clojure.org/contributing
05:39Fossiah, ok. that makes more sense
05:45Fossigen-html-docs: "* Figure out why the source doesn't show up for most things"
05:46Fossii have that exact problem when running from console. i really wonder what the fix was supposed to be
05:46Fossii guess it's time to dig into the logs
05:51Fossitoo bad the import into contrib lost the history of whereever it has been developed before...
06:00derikssonWhy is there an asterisk in duck stream's "slurp*"? Is this a convention or a way of avoiding collisions with "slurp".
06:16rottcoddderiksson: in common lisp, there is a convention that f* a variation of f
06:16derikssonthanks, rottcodd!
06:40djpowellanyone know much about the jmx stuff in contrib?
06:55fsmHello everyone.
06:55AWizzArdHi fsm, how is that Raytracer going?
06:55fsmHere is my Clojure raytracer source code.
06:55fsmhttp://tu.be/graphics/tracer.zip
07:07Thornfsm: seems about as fast as povray
07:10Thornvector math in lisp looks pretty painful
07:12fsmThe vector math in clojure is OK
07:12fsmYou can basically use java primitive arrays
07:12fsmUnfortunately you cannot use SSE so that is the bottleneck
07:13AWizzArdCan Java code use SSE?
07:13fsmYou can use it via JNI calls
07:14fsmbut for operations on small vectors, the JNI overhead kills it
07:14fsmplus, the data has to be allocated on the native side so it is word-aligned properly
07:14fsm(at least that is my understanding)
07:15fsmIf you are in C/C++ you can use the intel performance library where common 3d operations are practically a cpu instruction
07:15fsm(again at least that is my understanding)
07:21ThornI wonder if CUDA can be efficiently used from jvm
07:23AWizzArdrhickey: do you currently (mainly) work on data parallelism for Clojure? Some days ago I read something from you about parallel vectors, etc.
07:23AWizzArdThorn: yeah, that would be very very interesting. I would so very much like to have a way to run some Clojure functions on my video card.
07:24rhickeyAWizzArd: parallel map and reduce (pvmap and pvreduce) for ordinary Clojure vectors is up now in the par branch
07:24AWizzArdah ok, so the par branch is what I want :)
07:25rhickeyAWizzArd: check the irc log from yesterday - I described how to get going with it
07:27AWizzArdk
07:28ThornAWizzArd: whatever code you need to run on video card using cuda you'd need to compile it into their C dialect if I'm not mistaken
07:35fsmI believe it is standardising on OpenCL
07:37fsmWhat is the execution time for that example render on your machine, out of interest?
07:38AWizzArdThorn: yes, for today this is true. But there may be limited compilers from Java Bytecode to Video_Card_Bytecode, or they may be JREs in the future, running on video cards.
07:39Thornfsm: 75.8 sec, 2111 pixels/sec (cpu is Q9300)
07:40ThornAWizzArd: what about architecture differences between CPUs and GPUs? is it even possible?
07:40fsmHm, I am 173 seconds on macbook pro 2.53ghz
07:41Thornlinux 64-bit, jdk is sun 1.6.0.14
07:42djpowelldid you use "java -server"
07:42Thornnope, I'll rerun with it
07:43djpowelli get 93.8 seconds on a quad core q6600, with -server
07:43Thorn76.7 sec with -server
07:52fsmThanks everyone, goodnight.
07:53Thornhm, http://www.jcuda.org/
07:56AWizzArdThorn: I don't think that with todays technology it is possible to have a (nearly) full JRE on video cards. But that may change in the next years.
07:56AWizzArdPerhaps before 2020 it will be possible.
07:57AWizzArdThis is not "soon", but still close enough.
08:14rhickeywe hit 20000 messages on the Google Group!
08:26sgtarr_I see there is an upcoming OReilly LISP book
08:27sgtarr_It'll cover CL and Clojure
08:27sgtarr_Sweet!
08:36AWizzArdsgtarr_: link?
08:39rottcoddhttp://enlivend.livejournal.com/tag/book
08:42AWizzArdthx
08:56Fossianybody know by chance who 'nt' is: http://markmail.org/message/fnzwqaa7lxbyme4i#query:log-info%20clojure+page:1+mid:fnzwqaa7lxbyme4i+state:results
08:57Fossiand/or where the logger code is from
09:01duck1123I can't believe that a book like that is going to put clojure off to chapter 31
09:02achimhi all!
09:02achimlisppaste8: url
09:02lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
09:03rsynnottduck1123: well, it seems to be primarily about common lisp
09:03duck1123fair enough
09:03lisppaste8achim pasted "arities" at http://paste.lisp.org/display/84063
09:03rsynnott(it seems to be taking an odd approach; slime introduced in chaper 18?)
09:03achimis there a less hackish way than this to retrieve the arities of a fn?
09:04rhickeyduck1123: I don't have high hopes for its coverage of Clojure - we'll see
09:05duck1123any press for lisp is good, I guess
09:05rsynnott"The rest of the book revolves around specific proprietary and non-proprietary libraries; each part focuses more or less on a different lisp implementation: Allegro, Clozure, SBCL, LispWorks, Clojure." - that just sounds silly
09:06Chouserachim: that's brilliant
09:06durka42rsynnott: what struck me as strange about that sentence is that all of those (except clj) are CL implementations
09:06rhickeyKind of a shame that when OReilly finally gets around to a Lisp book it's about old Lisp, and having done that they will probably be even less likely to do a Clojure book
09:07Chouserachim: a better approach by far than any I've thought or heard of.
09:07rsynnottthe difference between various implementations of common lisp and one non-CL thing seems a strange thing for such a book to cover
09:07duck1123I hope OReilly puts out a clojure book
09:08achimChouser: but it feels ... wrong! :)
09:09Chouserachim: I'm not really saying it isn't, but it's a brilliant hack.
09:10rsynnottachim: as a matter of interest, why do you want to get arities of a function at runtime?
09:10duck1123what seems wrong about it? It seems pretty clear.
09:10Fossiit's kinda implementation specific though
09:10Fossiat least the 'invoke' part
09:19achimrsynnott: i wanted it for debugging a while ago, but the question, how to do it, outlived the bug ;)
09:22rsynnottah :)
09:26FossiAWizzArd: afaik some shader languages are turing complete, so it should be possible to implement a jre. just a pita
09:33kylesmithI need to calculate the nearest neighbors within a specified cutoff radius. Switching from the N^2 brute force method to a NlogN binary space partition tree got me a 5X performance improvement. There are structures called "cell-linked lists" which could be faster. Can anyone advise me on this, or should I just code it up and compare?
09:51cemerickwow, O'Reilly gave the green light to a new CL book http://lisp-book.org/
10:02AWizzArdcemerick: sgtarr_ mentioned it nearly 2 hours ago :p
10:03cemerickI guess I'm behind the times
10:03drewrno, just behind the time zones
10:08AWizzArdIs there something simple that lets me leave out the class for calling a static method? So instead of (or (Character/isSpaceChar %) (Character/isWhitespace %)) I would "import" isSpaceChar and isWhitespace.
10:09drewrdefn or defmacro
10:10Chouserclojure.contrib.import-static
10:10ChouserAWizzArd: clojure.contrib.import-static
10:11AWizzArdgood
10:14drewrwhoa
10:49Chouserdrewr: ?
10:55drewrChouser: that was more tongue-in-cheek than it sounded
11:00Chouseroh, I see now. Sorry, I actually just misunderstood the topic at hand
11:06Lau_of_DKDoes S Halloway camp here regularily ?
11:07drewrLau_of_DK: couple times a week maybe; not too often
11:07cemerickwhoo-wee, perst appears to be pretty nifty (yeah, I'm still OT on key-value stores)
11:07Lau_of_DKdrewr, thanks
11:07stuartsierra1I'm on an RDF kick again, heaven help me: http://github.com/stuartsierra/clojure-rdf
11:09duck11231stuartsierra1: You're going to go with a fresh implementation?
11:10stuartsierra1Well, I'm trying to define an abstract API that is pure Clojure, then add various Java libs as back-ends.
11:10duck1123I did some work on a clojure wrapper for jena, but i abandoned it to go a different way
11:11stuartsierra1I did the same thing with Sesame a couple of years ago, and abandoned it as well.
11:11rhickeystuartsierra1: how did you find Sesame?
11:12stuartsierra1Not bad, nicer API than Jena, but too slow for my purposes.
11:12rhickeyusing the native store? with how many triples?
11:13stuartsierra1Yes, the native store, with a few hundred thousand triples.
11:13stuartsierra1It wasn't the retrieval times that were too slow, it was bulk load/deletes.
11:14rhickeyI've just started looking at Sesame and Open Link Virtuoso
11:14stuartsierra1Virtuoso is definitely interesting, haven't tried it.
11:15duck1123a clojure library for working with talis would be kinda cool
11:39stuartsierra1How can I un-import a java.lang class from a namespace?
11:41stuartsierra1(ns-unmap *ns* 'Class)
12:17Fossihow in hell do you create an ordered list?
12:18Fossiwithout having to cons all the items together
12:18Chousereasier to do when not in hell.
12:18Chouser,(list 1 2 3 4) ?
12:18clojurebot(1 2 3 4)
12:18cemerickheh
12:18Lau_of_DKFossi: Dont let Chouser catch you swearing in #Clojure, he'll not be merciful
12:18FossiLau_of_DK: i noticed
12:18rzoomFossi: can't be done. hell doesn't have clojure
12:18ChousukeD:
12:19Lau_of_DKHell might have Python though, so look into that
12:19ChouserFossi: is 'list' what you wanted there, or are you asking for something else?
12:19Chousukerzoom: it does, but it has no immutable collections.
12:19ChouserChousuke: ouch
12:19Fossiso, if in a macro, how can i "(list "foo" (func ~some-param))"?
12:19Fossihmm or wait
12:20Chouser, `(foo ~@(list 1 2 3))
12:20clojurebot(sandbox/foo 1 2 3)
12:20Chouser,(cons `foo (list 1 2 3))
12:20clojurebot(sandbox/foo 1 2 3)
12:20Fossiyeah, i'm more or less just being stupid
12:20Fossithe macro was right, just the usage was off
12:21Chousernp... writing macros can put you in a weird state of mind.
12:21Fossimacros have to be the most "horrible" thing language feature ever apart from monads maybe
12:22Fossibut then again... so tempting :D
12:22Chousukehorrible? syntactic abstraction is horrible? :)
12:22Lau_of_DKAgreed Fossi - Macros hurt people
12:23Chousukepeople hurt people!
12:23Fossiit horrible to wrap your head around
12:23Fossiactually it feels more like being wrapped around it
12:23ChousukeFossi: a macro is just a transformation function
12:23ChousukeFossi: its arguments are clojure data structures, and its output is clojure code.
12:23Chousukethat's all.
12:23Fossiyeah, yeah. i get the concept
12:23Chousermonads help you work around restriction you or the language are putting on yourself
12:24Lau_of_DKChousuke: Its like Rocket science - You've got your rockets and your science... that's all.
12:24Chousermacros let you write code that would otherwise be impossible
12:24Fossibut with flexible parameter lists and wanting to do something to those you get into a lot of strange "code" sooner or later
12:25Chousukecomplex macros can be difficult, but I don't really see them as any worse than complex functions.
12:26Chousukeclojure's macro system is nice in that it's pretty difficult to accidentally write a "bad" macro.
12:26Lau_of_DKChousuke: Funny, I dont have that much trouble with it :)
12:26Chousukewriting bad macros? :P
12:28Lau_of_DKYea
12:29ChousukeWell, I usually end up with a macro that doesn't work rather than one that works but breaks your code in mysterious ways if accidentally used in the wrong environment.
12:30Fossiyeah, common lisp mine tend to go bad like that
12:30Fossi*in
12:31Lau_of_DKBut for a fantastic shiny example of macros used in the right way - I encourage everybody to check out ClojureQL
12:31mebaran151what's the best choice for simple light full text search for clojure: is Java the main option
12:33Lau_of_DKmebaran151: full text search ?
12:33mebaran151*lucene
12:33mebaran151I just want a full text search addon to complement some stuff I'm doing in BerkeleyDB
12:34mebaran151that's why it would be nice if it were light
12:36stuartsierra1full-text search isn't really a "light" problem :)
12:37duck1123Clojure has made me a snob when it comes to the literal representation of deeply nested series hashmaps and vectors
12:38duck1123I'm dealing with PHP right now, and I want to re-write this data
12:39Fossimebaran151: what's wrong with lucene?
12:39mebaran151it always just seemed a little clunky
12:40mebaran151thought that maybe since I'd been away, the Java world had developed something better
12:40Fossidoes the job for me
12:40Fossion a pretty good scale as well
12:40mebaran151it's good to hear that
12:40mebaran151I using solr, which never seemed too inspirational
12:41technomancylucene's API is pretty sane.
12:44cemerickmebaran151: compass is interesting, insofar as it tries to eliminate the datastore/FTI mismatch
12:44mebaran151I'll check it out
12:45mebaran151yeah, I have basic inverted word index running on top of bdb, but it seems like including something more sophisticated would be nice
12:45cemerickthe disappointing thing about it is that it really wants to be hooked into JPA, and (primarily) uses annotations to determine what fields to index in your object model.
12:46cemerickmebaran151: I'm eval'ing perst right now, which has baked-in fulltext, as well as lucene integration. So far, so good.
12:46mebaran151the thing that was most disappointing about most of these utilities was they required me to fix the field types up front, which is a no go for this project
12:47mebaran151oh perst does look pretty nifty
12:48drewrbledg
12:49drewrwrong window
12:49drewri think my laptop keyboard is going out
12:49cemerickmebaran151: yeah -- the spec page had me saying "oh, yeah, right!", but so far, it's working out nicely.
12:50mebaran151what's their license like? is it similar to berkeleydb, where if it stays on your own sever, you're covered?
12:50cemerickyeah, it's GPL, or commercially-licensed
12:51cemerickI'm particularly interested in seeing if its lucene FTS works out nicely -- being able to have the DB and FTI in one file will be huge.
12:52mebaran151that would be really nice
12:52cemericklucene has a BDB backend, but the benchmarks I saw for it aren't pretty
12:53mebaran151bdb usually seems pretty performant
12:53cemerickyeah, I'm sure it has far more to do with the lucene Directory impl
12:54mebaran151that surprises: it's a fairly light layer over simple btree disks
12:54mebaran151an even my naive downcase, split words and attach to secondary index actually worked out pretty well
12:56shooverThruDB has a key-value database and full text search via Thrudoc and Thrudex. When I looked, it felt like bdb with a simpler api. New BSD license. http://code.google.com/p/thrudb/
12:56shooverOh, it's client/server. Maybe you need embedded
12:56mebaran151I'd like to embed this
12:56cemerickyeah, embedded is a major constraint
12:57cemerickshoover: thanks though, hadn't seen thudb
12:57cemerickthrudb*
12:57mebaran151well I also like to have control of my data: for backing it up and what not
12:59mebaran151also if you don't need multiple processes hitting the db
13:00shoovermebaran151: you would control your data
13:00mebaran151oh its not like an amazon service?
13:00shooverno, it's client/server but you run both
13:01shooverI bet the server only runs on unix, but it looks like they're working on a java implementation of that too
13:01mebaran151ah that's a little better but the added complexity of client server rarely seems worth it, and it hurts performance on smaller deployments to pay for the IPC when you only have one process
13:18hserushas test-is been moved out of contrib recently?
13:18stuartsierra1yes, now it's clojure.test
13:18hserusah, ok.. thanks
13:19Chouserhserus: also some changes to the 'are' syntax
13:19hseruswill check it out
13:24replacadoes anyone understand why JSON strings seem to want \ before /?
13:24replacado they really care?
13:25danlarkinI don't think / needs to be escaped, does it?
13:26ChouserI wouldn't think so
13:26Chousernot listed at json.org
13:26Chouserhm, though it is accepted.
13:26danlarkinwell that makes sense
13:26danlarkinescaped slash is slash
13:26Chouserescape b is backspace
13:27danlarkinI think all non-control characters escape to themselves, right?
13:27replacayeah, it's accepted but it doesn't say what's "required" that's what confused me
13:29replacawhy would it even be "accepted"? If you look at the grammar at json.org, it doesn't seem to allow anything to be escaped, but it explicitly includes /
13:29hseruswhere can i find clojure.test? dont seem to be able to find it
13:29Chousukehserus: it's only in git clojure right now
13:29ieurereplaca, For some reason, lots of people escape forward slashes in JSON. I don’t know why; it’s not necessary, as far as I know.
13:29ieurereplaca, I just string-replace them back to / before deserializing.
13:30Chousukehserus: if you need to use test-is with 1.0.0, use the 1.0.0-compatible branch of clojure.
13:30hserusChousuke: thanks
13:30Chousukehserus: er, contrib
13:30replacaweird
13:31ieurereplaca, Yeah. It’s really dumb. This has a quasi-reasonable rationale: http://tech.groups.yahoo.com/group/json/message/249
13:32ieureThough I think that’s an example of Doctor It Hurts When I Do This.
13:32replacastuart was escaping it in c.c.json.write and I copied that for my pprint json disspatch func, but now I'm wondering if it's necessary
13:32ieureWhy would you want to put HTML in a JSON-encoded string in a <script> in HTML?
13:33ieurereplaca, I think it’s very slightly safer to escape it, but most decoders won’t _unescape_ it. Which blows.
13:34replacaOK, I understand the rationale at that link: a JSON string is at it's core a javascript string and javascript strings have HTML in them quite often.
13:34replacaBut that makes me think that I *don't* want to escape it here.
13:36replacathanks for the pointer, ieure!
13:36ieureNo problem. I ran into it a while back when I was working with the Twitter streaming API.
13:37ieureIt definitely doesn’t make sense for that.
13:41cschreinerI am looking at the clojure-src-root variable in emacs
13:42cschreinerhow important is this for slime /et al to work correctly? It says: Directory that contains checkouts for clojure, clojure-contrib, slime, and swank-clojure. This value is used by `clojure-install' and `clojure-slime-config'.
13:42technomancycschreiner: if you don't use that you can still configure slime manually
13:42technomancybut it's more complicated
13:42cschreinerok
13:43cschreinerI guess there are some features I am not using in slime
13:44technomancynobody uses all the features of slime. =)
13:44lisppaste8Anniepoo pasted "drawString" at http://paste.lisp.org/display/84077
13:45Anniepoothis is unhappy (.drawString g #^String str xpt y)
13:45Anniepoog is a graphics, drawString has an override that takes 3 args with some iterator fancy text thingy
13:46Anniepooso I'm trying to type hint to tell awt that the first (java) arg is a String
13:47Anniepooit's not working. Annie is sad, and feels like she should go back to making hammurabi in BASIC
13:48RaynesDon't be drastic!
13:48Anniepoo(swap! Annie #(set-drastic % false))
13:49Anniepooso, what's wrong with my type hint?
13:49Chousukehmm
13:50Chousukelooks like the method takes ints too
13:50Chousuketried wrapping xpt and y in (int ..)?
13:50Anniepoonope
13:50Anniepoowrapping? so (int xpt) ??
13:50Chousukeyeah
13:50Anniepoois the return of str type hinted like that?
13:51Chousukehm? no, it's just telling clojure that xpt and y should be native ints and not Integers
13:51Chousukethough it should happen automatically :/
13:51Chousukethe String type hint for str should be okay.
13:52Anniepoothe int fixed it
13:52Anniepoo(.drawString g #^String str (int xpt) (int y))
13:54cemerickfwiw, that likely only failed because xpt or y aren't ints already (or java.lang.Integers)
13:55Anniepooah, they're the result of (/ i-am-int 2)
13:55cemerickright, so if i-am-int is 3, then the result of that is a Ratio, for which there isn't an obvious conversion to int
13:57RaynesIf Rich Hickey was God, would Chris Houser be Jesus Christ?
13:57danlarkinwow, that is a bold statement
13:58ataggartquite
13:58RaynesI went there.
13:58ataggartwhat's the trick to submitting a ticket via assembla? My CA has been accepted, I'm logged in, I'm watching the clojure anc lojure-contrib spaces... yet I can't find any way to do it.
14:00cemerickataggart: there should be a big "new ticket" button at the top of the "tickets" tab/page
14:01ataggartnot that I see
14:01lpetitataggart: have you already asked for being enabled on assembla ?
14:01ataggartah I see it there in clojure, but not clojure-contrib
14:02lpetitataggart: as a member of the assembla spaces ? (not just a public reader)
14:02ataggartI'm unclear on the distinction
14:02ataggartdo I need to do something other than "watch this sspace"?
14:02cemerickataggart: a project admin has to enable you as a contributor (or something, not sure of the terminology)
14:02lpetitdunno
14:03lpetitataggart: if nobody here can do it, then you'll have to ask for it at clojure-dev@googlegroups.com
14:04ataggartok thanks
14:08lpetitIs there a way to easily handle a state for a proxy instance, as is done for gen-classed instances ? Currently, I must resort to something like (let [state (atom {})] (proxy [SomeClass] (someMethod [] (... (swap! state assoc :some-key some-value))))
14:08lpetit?
14:10hiredmanlpetit: looks good to me
14:12lpetithiredman: well, yes, but I thought there were a possibility to have more uniformity between proxy and gen-class here. There also the problem that it's not easy to initialize the state (or call super-class methods via (proxy-super)) at construction time
14:14Chouserataggart: you should be able to create tickets using the "support" tab
14:14lpetitI'm in a situation where I want to avoid having to use AOT compilation because I want to introduce clojure without having all my collegues having to add (yet) clojuredev to their eclipse (introducing clojure from the back door)
14:14Chouserlpetit: you're doing it right.
14:16lpetitChouser: how would you simulate finishing initializing the proxied instance ? By just calling methods on it after having created it ? What if for terminating initialization I have to call super class methods that I then override ?
14:19Chouserproxy is definitely missing desirable features (newnew, come quickly) so it's possible you may not be able to do what you want.
14:19Chouserbut yes, your instincts are sound
14:20Chousera common model for using proxy is something like (defn make-foo [args] (let [some-state ...] (proxy [AClass] [args] ...)))
14:20lpetitchouser: ok, I'll wait then, no problem :-)
14:21Chouserso if you need to call some methods on the proxy instance before make-foo returns it, you can toss a doto around proxy inside the let
14:23Chouserif you need to call methods of the superclass that are hidden by your own overrides, you may be able to use proxy-call-with-super
14:23Chousernote that's not thread-safe, but should be ok in the context of make-foo
14:25lpetitOh I didn't know about proxy-call-with-super, I was missing this part, thanks.
14:27cemericklpetit: note that the super-method you call won't invoke any methods you've overridden in your proxy, if you happen to be extending a concrete class
14:28hiredmanhttp://spanx.wordpress.com/2009/07/23/clojure-robot-on-google-wave/
14:29lpetitis proxy-call-with-super a post 1.0 fn ? I can't see it in the current clojure.org doc site ?
14:30lpetitnon ok I see it in the jar
14:31cemerickit would be *very* convenient if the core values / collections in clojure were Serializable
14:31cemerick(I know that might get dicey in certain areas)
14:33lpetitcemerick: are you sure about what you say concerning the super-method that won't invoke any methods overriden in the proxy ?
14:34Chouserlpetit: it has no doc string. I guess you're expected to use the proxy-super macro, but that captures 'this which may not be appropriate in your case.
14:34cemerickpretty sure. I got burned by that recently...called super.foo(), which called bar(), overridden in my proxy. The proxy's impl never saw that call.
14:34cemerickmaybe that's different since 1.0?
14:35Chouserhuh, I wonder if proxy-call-with-super should use try/finally so it doesn't lose the proxy override if there's an exception.
14:35Chouserbleh, it's such a hack anyway...
14:35lpetitI read the code of proxy-call-with-super, and it's just removing the mapping for the method to make the super's method visible again, not touching other overriden methods
14:37lpetitchouser: yeah, it's a hack. Wondering how it would work if the method launches a work in another thread ... and the call to the super class method is done lately from the thread, that could lead to interesting bugs or infinite loops, wouldn't it ?
14:37Chouseryes, not thread safe.
14:38Chouserthe behavior of that particular proxy object (not the whole class) is temporarily changed in a way that is 'visible' to all threads.
14:38Chousernewnew come quickly...
14:39cemerickagreed. It will make so much possible.
14:39lpetitcemerick: OK I now remember the problem. But it's not related to using proxy-call-with-super, I think ? It's the same kind of problem one has with spring AOP when not using Aspect J : if the class makes a reflexive call, no AOP injected behavior will happen
14:40lpetitchouser: yes, not thread safe, not resisting exception throwing, it's a can of worms right now ...
14:40cemerickI never had the (dis?)pleasure of using spring or aspectj. I encountered the issue when using processing, which is compiled for java 1.4 *shrug*
14:41cemerickIt's entirely possible that I was doing something wrong, of course. :-)
14:46lpetitcemerick: I'm sorry, but I finished writing my proxy, and I have overriden some methods that are known to be called from the super class, and it works correctly.
14:47cemerickexcellent
14:47cemerickjust to be clear, I hit my problem when a proxy-super call would directly cause a call to an overridden method
14:47lpetitcemerick: ok, I didn't test that
14:52lpetitwhat is the state of this newnew operator ? Is there somewhere some doc or an early implementation ?
14:53Chouserlpetit: http://www.assembla.com/wiki/show/clojure/New_new
14:53lpetitthx
14:53Chouserno implementation that I'm aware of.
14:55cemerickRich is going to blow in one morning, and say, "hey, check it out the initial newnew impl", after having said the night before that he hasn't started in on it yet. :-)
14:55ataggart_master of managing expectations
14:56Chousernot just that he hasn't started it yet, but that there's some deep internal requirement clash
14:58Chouserthe morning's implementation will be based on a design that solves all key requirements, but looks only vaguely like the design suggested in the New_new doc
14:59lpetitnot that it is bad, though :)
15:00cemerickhuh, we're edging up again...
15:00cemerick~max
15:00clojurebotmax people is 164
15:01lpetit~min
15:01clojurebotis_rhickey_a_minor_god is yes
15:02lpetit;)
15:02Chousuke:P
15:02ataggart_http://www.google.com/trends?q=clojure
15:03cemerickhrm. Scary amount of literal idolatry today.
15:03ataggart_what's up with Norway?
15:03technomancyone-man-search-army?
15:03drewrprops to rhickey for a search-friendly name
15:03technomancyoops! sorry. =\
15:03cemerickut-oh!
15:03drewrouch!
15:03cemericktechnomancy: thanks, I needed that! ;-)
15:04drewrscandinavia looks like one country from all the way over here
15:04cemerickman, and Austin is beating Boston? Lisp capital of the world? *sigh*
15:04ChousukeTechnically, Finland isn't part of scandinavia either. ;P
15:04Chousukebut everyone forgets that.
15:04Chousukeeven Finns
15:04drewrhaha
15:04ataggart_It's part of Russia, right?
15:04ataggart_;)
15:05cemerickAnd Korean is the top language? Something very odd about these rankings.
15:05danlarkincemerick: it's the illusive Korean Norse
15:05cemerickataggart_: there lie dragons.... :-D
15:05drewrclojure is probably being used in nuclear projectile telemetry
15:07ChousukeIncidentally, the Finnish name for Norway is Norja, which also happens to be a word that means "(physically) lean" and Korea is also Finnish, means something that is well-decorated :P
15:07cemerick...and if you choose either Korean nation, you get no results.
15:07Chousukeso, of course people are searching for something lean and beautiful.
15:08cemerickChousuke: yours is the land of sauna, right?
15:08technomancyI guess that spike was the 1.0 and book release?
15:08Chousukecemerick: yeah
15:08cemerickthat's what I thought
15:09Chousukedanlarkin: maybe they were the ones that did the DDoS attacks a while ago. :/
15:09Chousukedanlarkin: and at the same time, spammed Google with clojure searches
15:10danlarkinThey used agents to perform the attacks :o
15:12technomancyhttp://www.evri.com/product/clojure-0x151efb <- my former employer's profile page for clojure
15:13technomancythey do NLP news analysis... has some interesting links
15:13technomancywhoa; a second book? http://www.amazon.com/Definitive-Guide-Clojure-Luke-VanderHart/dp/1430272317%3FSubscriptionId%3D1BRRVPQYSE5BWCE26RG2%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1430272317
15:14cemerickwow, neat!
15:14technomancyfrom apress... they published practical CL
15:14cemerickLuke VanderHart? "...a very active member of the Clojure community..."
15:14cemerickpaging Luke?
15:15cemericknm, found him on the group
15:17technomancyit's also going to be covered in the O'Reilly book on CL
15:19technomancyangerman: what's up?
15:19lpetittechnomancy: poor laptop !
15:19angermanClojure installation step failed: git clone git://github.com/kevinoneill/clojure.git
15:19technomancyangerman: looks like you've got an old version of clojure-mode
15:19angermantechnomancy: that's up :/ I do have git. I guess it fails to find it ..
15:19technomancytime to update
15:20angermantechnomancy: I took the one from elpa just a few secs ago
15:20technomancyangerman: oh.... my bad. I need to send the updated version to elpa
15:20angermansays v. 1.1
15:20technomancyget it from http://github.com/technomancy/clojure-mode for now.
15:20angermancan I simply overwrite the one elpa installed?
15:20technomancysure
15:21technomancythanks for the reminder; /me sends off an update
15:21angermanshould I take the slime install from the clojure mode or the one that aquamacs wants me to install from the aquamacs website?
15:22AnniepooI like evri, hope being a former of it isn't a bad thing.
15:22technomancyangerman: I don't know much about aquamacs... I think it's better to use the one from git.
15:22technomancyangerman: it's still a manual process unfortunately. =\
15:23angermanhhmm ..
15:23technomancyAnniepoo: they had to do some cutbacks a few months ago but are still afloat. =\ but I get to work in Clojure now. =)
15:23fogusI use clojure-mode without problems in Aquamacs
15:23angermanhmm feels better
15:24angermanfogus: dunno I had an issue with it using git .
15:24technomancyAquamacs has some tricky edge-case incompatibilities, and I can't test it since it's not portable.
15:25technomancybut if it works for you that's great
15:25angermanno ... No such directory found via CDPATH environment variable
15:25angermantechnomancy: here I am, your testcase :p
15:26Anniepoo@technomancy, Ah, then it's a good thing!
15:28technomancyangerman: can you paste the steps you took and the contents of the *Messages* buffer as well as any other error messages?
15:28angermantechnomancy: it's git again
15:28angermanbut I'll past it
15:29technomancyangerman: if you do M-x eshell, can you run git?
15:29technomancyjust try git -v or something
15:29angermangithub's so slow :/
15:29angermantechnomancy: it only failed on slime
15:30angermanhttp://gist.github.com/153465
15:32technomancyangerman: that's very strange... it looks like it might be related to aquamacs hacks
15:32technomancyangerman: you should be able to manually check out slime in the clojure-src-root directory if you want to try again without re-downloading everything
15:33technomancythen put "(clojure-slime-config "/path/to/clojure-src-root/")" in your config somewhere
15:33angermani'll try once more
15:34angermantechnomancy: maybe you could split the install process into a download and a compile and rest function
15:34angermanthat way if the download fails, one could just continue with the compilation after fixing it by hand
15:35technomancynot a bad idea
15:37technomancyI need to get it to AOT contrib too
15:39angermanthe Error arose from the (dolist (repo clojure-last-known-good-revision) ....
15:41technomancyangerman: oh... I may have messed something up.
15:41cemerickhrm, Delay needs an isForced method or somesuch
15:42angermanwhee, now I a working slime
15:42technomancyI did a shallow copy of slime so it wouldn't take forever, but that may have missed the last-known-good revision for swank-clojure
15:42angermantechnomancy: well if reporting bugs helps, whee :)
15:42technomancygenius
15:42angermantechnomancy: well wait
15:42angermantechnomancy: I did just install git clone --depth 2 ... slime
15:42angermanand then commented everyting out of clojure-mode till the compilation step and rand clojure-install again
15:43angermannow it works
15:43angermandunno about swank so ... how would I test?
15:43technomancyjust do M-x slime
15:44angermandoes work.
15:44technomancywonder if there's a way to make a shallow clone in git starting from a given revision...
15:45technomancyI guess I could just make my own fork and only update it when I've tested it with swank.
15:45technomancythat sounds easier
15:46angermantechnomancy: well as I said that CDPATH issue came from the (dolist (repo ... )) part between the git clones and the compiling
15:47angermanhow would I add additional jars?
15:47angermane.g. if I want to use compojure, ...
15:47technomancyangerman: check out the clojure-project function in http://technomancy.us/126#projects
15:49angermantechnomancy: so I bacaislly unpack the .jars into the dependency folder
15:49technomancyright; then the clojure-project function will set up slime's classpath for you
15:50angermantechnomancy: couldn't it just use the jars?
15:54angermantechnomancy: I hope my questions don't bug you too much
15:55RaynesWe all enjoy annoying questions. Annoying questions are typically trivial ones, and therefore easy to answer.
15:57ataggartthe eclipse plugin serves me well. Rainbow parens ftw.
16:15technomancyangerman: you can use the jars, but I've found unpacking them has its advantages
16:15angermantechnomancy: tell me about them :)
16:16technomancywell mostly that you can add deps at runtime without restarting the JVM
16:16angermanohh and how would I define JNI bindings? -Djava.library.path
16:16technomancyalso, your classpath can be the same for every project you work on, which is less confusing
16:16technomancyI... don't know what JNI is.
16:16technomancyquestions are fine as long as you're OK with a slow response. =)
16:17angermanwell for example if I want to use Tokyo Cabinet. I need to have some native code libary
16:17angermanso that's why I need to define a -Djava.librar.path=...
16:17technomancyoh, if you just want to set a command-line flag, you can add it to the swank-clojure-extra-vm-args list
16:18angermantechnomancy: so basically I add all the jars into the dep folder and run clojure-project ? and the swank-clojure-jar-path does automatically list them all up?
16:19technomancyangerman: I think you can do that, but I haven't used that myself
16:19angermantechnomancy: could we have a clojure-create-project fun too? that sets up the project folders?
16:20technomancysure; that's not a bad idea.
16:22technomancyangerman: you can use a .dir-locals.el file for project-wide elisp variables if you're using 23
16:22angermanas the project structure might be different, e.g. for a deployment
16:22angermantechnomancy: hmm. well src target/classes and test are hardcoded in clojure-project or am I mistaken?
16:23technomancyangerman: that's right. but clojure-project is just my own personal helper function, it's not part of clojure-mode or anything
16:23angermantechnomancy: yes. but why not turn it into one :)
16:24technomancyI should.
16:25technomancyI've been using target/ because that's what corkscrew uses (mvn under the covers).
16:25technomancybut it doesn't seem to be a common convention
16:26technomancyprobably not, it's an awful lot of impl-specific code
16:28angermanhmm...
16:28angermancan I somehow attach SLIME to an already running process somehow?
16:29technomancyangerman: it's doable, but I haven't done it myself.
16:37angermantechnomancy: so to get the REPL i need to use swank.loader?
16:37angermanat least, that's the way I understand it :/
16:38drewrangerman: currently only via emacs
16:38drewrat least I haven't success embedding swank
16:38drewrhaven't had
16:38technomancyothers have done it
16:39angermanok, but it works like this: run swank in clojure to open a port and then connect to that with slime?
16:39technomancyI asked them to post to the list about it, but haven't heard back yet.
16:39drewrangerman: yes
16:39angermanok, that could get messy with GAE as the environment permits to open a socket .
16:41Chouser(some #(when-not (second %) (first %)) (partition 2 1 (map deref (map deref (map #(send-off (agent (promise)) deliver %) (iterate inc 0))))))
16:41ChouserI don't think that should ever return. But for me it does.
16:44Chouser(some (fn [[a b]] (when-not a b)) (partition 2 1 (map (fn [x] @@(send-off (agent (promise)) deliver x)) (iterate inc 0))))
16:44hiredmangithub is sloooooow today
16:44Chousersame thing, just simplified the expression.
16:44Chouserwhat number does that return for you, or does it spin forever (as I think it should)?
16:46hiredmanjokes on you, my local clojure install is so old the result is java.lang.Exception: Unable to resolve symbol: promise in this context (NO_SOURCE_FILE:1)
16:46Chouser:-)
16:49Chouserah, I think I see it.
16:49rhickey1
16:49Chouser(.await d) may unblock before (reset! v x)
16:52Chouserreversing the order of (reset! v x) and (.countDown d) seems to solve it
16:53Chouserat least, my test runs into the 10000s instead of always failing < 6000
16:54Chouserrhickey: you want the whole ticket/patch dance for that?
16:54rhickeynope
16:54angermanhmm I can't compile clojure-contrib it's missing clojure/walk :/
16:54Chouserrhickey: cool
16:55rhickeyglad someone's trying some of this stuff
16:55rhickey:)
16:55Chouserthat's no made up test, either.
16:55Chousukeangerman: contrib master depends on git clojure at the moment. there's a branch that is still compatible with 1.0.0 though.
16:55rhickeyChouser: all the better
16:56Chouserwell, wheat I posted was, but I was seeing nil's in impossible places in code we're actually using
16:56angermanChousuke: hmm I think i took both git repos
16:56Chouserwhat
16:57Chousukeangerman: hmm. from the right source? :P
16:57hiredmanwhoops
16:57angermanChousuke: the ones that clojure-install pulled
16:58technomancyangerman: I'll update clojure-install to mention the 1.0-compatible branch too
16:58technomancyit didn't exist when I wrote the last-known-good stuff
16:58angermanThe way I understood Chousuke would be that if i take both from git it should still work
16:59technomancyangerman: yes, but clojure-install uses clojure 1.0.0 by default
16:59ChouserI'm just not doing anything that would push ensure or take advantage of par.
16:59Chousukeangerman: well, clojure-install may checkout some branch other than master
16:59technomancyangerman: you can run "git checkout master" in the clojure dir if you'd rather stay with the cutting-edge
16:59technomancymaybe I could make it an option in clojure-install
17:00angermanhmm.
17:02technomancyangerman: it's in the "last-known-good" section
17:03angermanyes, but that's what I commented out because it broke with the CDPATH thing.
17:04angermanok, the checkout when through somehow
17:17blbrown_winin terms of clojure performance, aren't most functions and use of clojure really just calls on top of the JVM. So, for most code we should see comparable performance with Java code. ...is that safe to say?
17:20Chousukewell, java code that uses function objects, lazy seqs and immutable collections, yes :)
17:22blbrown_winSo it really depends on the approach you use with Clojure. There isn't going to be a one to one, Clojure code runs as fast as Java code (say if they end up at the same outcome)
17:23blbrown_winChousuke, that was directed at you
17:23Chousukehmm.
17:23Chousukewell, you can write loops that compile down to the same bytecode as a java loop
17:24blbrown_winChouser, sounds like the response is that "it depends"
17:24Chousukebut most clojure code tends to be rather different from idiomatic java code.
17:24Chousukewith higher-order functions and all.
17:25ChouserChousuke: I wonder how often I get unspoken credit for things you say...
17:25ChousukeChouser: heh :P
17:25blbrown_winI thought you guys were the same for a second
17:25ChouserChousuke: how'd you end up with that nick anyway. Your g.group name is nice and unique...
17:26blbrown_winLike they always say, "don't guess, measure". I was writing some performance test code. Of course, my tests will get a lot of flack...performance tests always do
17:26ChousukeChouser: I was given this nickname :P
17:27Chousukeblbrown_win: heh.
17:27stuartsierraJust remember to use *warn-on-reflection* true, that makes a huge difference.
17:27Chousukeblbrown_win: rhickey posted some interesting microbenchmarks from his "par" branch yesterday :)
17:28blbrown_winstuartsierra, Yea I see that a lot. Most of my code will not use Java oriented code though.
17:28Chousukeblbrown_win: http://paste.lisp.org/display/84027
17:29blbrown_winis clojure.par ...parallel?
17:29Chousukeof course, it's only that much faster because it utilises four cores instead of one, but...
17:29Chousukeyeah.
17:29blbrown_winisn't that jvm specific stuff
17:30Chousukewell, the library uses forkjoin apparently, which is something that will appear in JDK7
17:31ChouserI think it's running into trouble in that process.
17:31blbrown_winyea, that is what I am kind of saying. Some clojure code is kind of a wrapper on top of JVM functionality.
17:31Chousukeblbrown_win: the parallel vector stuff isn't though.
17:31Chousukeblbrown_win: it works with clojure vectors.
17:31blbrown_winah
17:32ChousukeI don't seem to get much improvement from clojure.par though :/
17:33Chousukeit does help a bit, and is indeed faster than the (mutable!) arraylist, but I suspect my RAM might be a bottleneck
17:35rhickeyChouser: where did you see/hear that?
17:35Chouserrhickey: I thought you said that.
17:35ChousukeAnd then I get really inconsistent results if I enable escape analysis: anywhere from 50ms to 1200ms for the last parallel vector operation. :P
17:36Chouserah, maybe ParallelArray is the only casualty so far?
17:37rhickeyChouser: right, afaik, the division into jsr166y and extra166y reflects what's in/out of JDK 7
17:37angermanrhickey: did you get a sore throught thoughout the clojure presentations?
17:38rhickeyangerman: which presentations?
17:38angermanClojure for Java.
17:39angermanrhickey: just wondering. Because you really talk a lot.
17:39rhickeyI see
17:43blbrown_winangerman, are you in industry now?
17:44angermanblbrown_win: I'm in my final year doing my (German Diplom) in Mathematics at Technical University of Munich
17:44blbrown_winnice
17:45angermaninstead of studing I'm once again exploring a new language [...] :)
17:45kotaraksounds familiar ;)
17:46angermanif only clojure would be dead fast for linear algebra, I could try some of my classification algorithms ...
17:46angermankotarak: since when? ;)
17:46kotarak5 years
17:47ChouserJNI's still kicking me around.
17:47angermanwell that's close to when I started.
17:47angermanChouser: I had my share with Tokyo Cabinet ... never had so much trouble compiling any source :/
17:48Chousereverything appears to compile, and the .so loads. but I still can call into the native code.
17:49angermanChouser: ohh. Well TC had it's java bindings already, but compiling the JNI libs against TC was really messy. Especially figuring out that I needed x86_64 binaries and the configure didn't figure that out :/
17:50angermanappengine-clj does have a datastore layer but that one is somewhat verbose and not really "nice"
17:50kotarakangerman: would have been the first configure script which figured something out... :/
17:51angermankotarak: yea. this whole autoconf stuff keeps on being the biggest mess ever
18:03angermangood night everyone. The Clojure for Lisp Programmers and Clojure for Java Programmers presentations are quite good :)
18:11Chouseraaaaaaaaaaa!!!!!!!
18:12hiredmansomeone kick your football?
18:12Chouserhad an old .so under an old name. That's the one I was loading and testing.
18:12Chouserhad a new .so under a new name. That's one I was changing and compiling. :-(
18:13Chousuke:|
18:14Chouserok. sheesh. well, now it works from java but not clojure.
18:19Chouserdinnertime...
18:19stuartsierralater dudes
19:19blbrown_winwith clojure contrib how do you use the group-by function
19:19blbrown_win(group-by 3 (1 2 3))
19:19blbrown_win'(group-by 3 (1 2 3))
19:19hiredman,(doc group-by)
19:19clojurebot"([f coll]); Returns a sorted map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."
19:20blbrown_winI see the doc,
19:20blbrown_winoh
19:20hiredmanyou most likely want partition
19:20hiredmanor partition-by
19:20blbrown_win,(group-by (fn [x] true) (1 2 3 ))
19:20clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
19:24blbrown_win,(group-by (comp #(.toString %) class) [1 2 "three" :four])
19:24clojurebot{"class clojure.lang.Keyword" [:four], "class java.lang.Integer" [1 2], "class java.lang.String" ["three"]}
19:28blbrown_wininteresting
19:30RaynesI wish Factor had GTK bindings. :\
19:36blbrown_winyou can write them. the FFI is pretty easy
19:37Raynesblbrown_win: I don't wanna. :p
19:37blbrown_winRaynes are you a factor guy (user). I was thinking of writing benchmarks and comparing the factor benchmarks to clojure hhmm
19:42blbrown_win,(loop [a () i 1e2] (if (= i 0) a (recur (conj a "a") (- i 1))))
19:42clojurebot("a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a")
19:45Raynesblbrown_win: I'm kind of new to Factor. I'm not really a /Factor/ guy.
19:45blbrown_winI wrote the mysql driver, hehe long time agop
19:55technomancyhas anyone encountered the geostd8 encoding before?
19:56fsmA cleaned-up version of my raytracer: http://tu.be/graphics/tracer.zip
19:56fsmFixed bug in depth-of-field calculations
19:57technomancynot finding any way of handing that in Java
19:57technomancyit's pretty obscure
19:57beutdeuceis apply similar to haskell's map or fold?
20:03mebaran151georgian encoding?
20:04technomancymebaran151: yeah
20:04mebaran151that is a bit obscure....
20:08mebaran151looks like it's a standard 8 bit encoding: what do you have to do with it?
20:16technomancymebaran151: reading it without an exception would be a good start. =)
20:18beutdeucewhats wrong with this => http://gist.github.com/153755
20:20beutdeuceactually this =. http://pastie.org/557150
20:28fsmI posted some sample images: http://tu.be/graphics/
20:29technomancyfsm: looks nice!
20:29fsmThanks
20:29blbrown_win,(doc immigrate)
20:29clojurebot"/;nil; "
21:54rabidsnailhello all
21:56JAS415i have a question about classpath
21:56RaynesShoot.
21:56JAS415i have my bash script setup like so: java -cp $CLOJURE_DIR/jline-0.9.94.jar:$CLOJURE_JAR:$CONTRIB_JAR \
21:56JAS415 jline.ConsoleRunner clojure.lang.Repl
21:56JAS415with the environment variables set to the various paths
21:57JAS415yet when i execute the script and do (for example) (in-ns clojure.contrib.math)
21:57JAS415i get "ClassNotFoundException: clojure.contrib.math"
21:58arohnerquote it
21:58arohner(in-ns 'clojure.contrib.math)
21:58JAS415ahhh
21:58JAS415thanks :-)
21:59arohnernp. without the quote, clojure tries to get the value of the symbol clojure.contrib.math
22:00arohneri.e. (let [x (symbol "clojure.contrib.math")] (in-ns x))
22:01rabidsnailWhat's the proper way to do an sequence slice?
22:04JAS415i'm still not sure i've got this right with the loading of the contrib though
22:04arohnerrabidsnail: what do you mean?
22:04JAS415shouldn't all of the contrib ns be loaded?
22:04rabidsnailThe equivalent of my_array[5:10] in Python.
22:04JAS415so when i do (all-ns) from use it would return them?
22:05rabidsnailTake a range of elements from a sequence between two indices.
22:05arohnerJAS415: no, the individual contrib ns's will be loaded after calls to require
22:05arohnerand there's no require clojure.contrib.*
22:05JAS415ah okay
22:06JAS415i'm gonna write this stuff down or else i'll forget
22:07arohnerrabidsnail: if you have a vector, you can use subvec
22:07arohner,(doc subvec)
22:07clojurebot"([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."
22:07arohnerif you have something else, i.e. a list or a map, I think you'll have to use drop and take