#clojure logs

2009-02-09

05:30bakkdoori have trouble with defining a macro that expands into a defmacro form... anyone here who might be able to help me?
05:31hoeckbakkdoor: sure
05:31bakkdoorcool
05:31bakkdoorwait i'll paste my code
05:31hoeckk
05:31AWizzArdDo you want to write your own macro engine?
05:36bakkdoorhttp://paste.lisp.org/display/75111
05:37bakkdoorthats my code
05:42bakkdoorbut i basically get this error message: java.lang.Exception: Unable to resolve symbol: actionPerformed in this context (NO_SOURCE_FILE:1)
05:42hoeckbakkdoor: and the problem is?
05:42bakkdoorand i dont know how to solve it.
05:44bakkdoorheres what it expands into: http://paste.lisp.org/display/75111#1
05:46bakkdooram i missing a quote or unquote or something? i guess it has to do with the double backquoting within the defevent macro, but i cant find the error. and it only tells me it cant resolve actionPerformed. but i dont even want it to be resolved i guess, it should just take it as a symbol for the call to the with-event-listener macro
05:46bakkdoorwhich itself calls the proxy macro predefined in clojure
05:49bakkdoorheres the expansion via macroexpand-1: http://paste.lisp.org/display/75111#2
05:54hoeckbakkdoor: hmm, looks like you need to quote actionPerfomed like this: ~'~actionPerformed
05:54bakkdoorhm ok
05:55hoeckusing this leads me to a correctly expanded [java.awt.event.ActionListener actionPerformed] arg-vector to with-event-listener
05:56Chousuke~'~? :/
05:56clojurebotI don't understand.
05:56Chousuke,`~'~actionPerformer
05:56clojurebot(clojure.core/unquote actionPerformer)
05:56Chousuke,`~'actionPerformer
05:56clojurebotactionPerformer
05:56hoeck,`(`~'~actionPerfomed)
05:56clojurebotjava.lang.Exception: Unable to resolve symbol: actionPerfomed in this context
05:57Chousuke,`'~actionPerformer
05:57clojurebotjava.lang.Exception: Unable to resolve symbol: actionPerformer in this context
05:57Chousukeokay, so it's ~'
05:58hoeck,(let [sym 'actionPerformed] `(~'~sym))
05:58clojurebot((clojure.core/unquote sym))
05:58hoeck,(let [sym 'actionPerformed] `(`~'~sym))
05:58clojurebot((quote actionPerformed))
05:58hoeckmhh
05:59Chousuke,(let [sym 'ap] `'~sym)
05:59clojurebot(quote ap)
05:59Chousuke,(let [sym 'ap] `~sym)
05:59clojurebotap
05:59Chousuke,(let [sym 'ap] `~'sym)
05:59clojurebotsym
06:00bakkdoorhoeck: defevent now doesnt complain anymore. it also generates the macro. but i call the generated macro, i get an error: http://paste.lisp.org/display/75111#3
06:03Chousukewait, you're using nested defmacros? :/
06:04hoeckChousuke: yes
06:05Chousukehmmh
06:06Chousukethat might be problematic, as ~ is kind of special inside `
06:07hoeckbakkdoor: untquote-quote-unqote the event-listener-sym in the defevent macro
06:09bakkdoorhm
06:11hoeckwhile expanding, ~~ evaluates event-listener-sym to a class object, but proxy somehow wants a symbol and not a class
06:11hoecki guess
06:13bakkdoorhm ok
06:18ChousukeI think ~@~body-sym is not going to work
06:31hoeckChousuke: strangely enough, ~@~ expands correctly :)
06:32hoeckbakkdoor: is it working now?
06:51djpowellam I generally better off using (into {} (map ...)), rather than (reduce (assoc ...) {} ...)
07:03Chousukedjpowell: I think (into {} ...) is more idiomatic
07:04Chousuke(doc into=
07:04clojurebotReturns a new coll consisting of to-coll with all of the items of from-coll conjoined.; arglists ([to from])
07:04Chousukeoops
07:04Chousukeheh
07:05ChousukeI created a github repo for small clojure utils. for now, I only have two functions in it though :P
07:24djpowellhmm, I wonder if an implementation of "selection sort" would be useful for seqs. handy if you are going to call first on the sorted seq, or just get the first few elements from it, cause it wouldn't need to sort the rest of the list.
07:26Chousukehmm
07:31djpowelli found myself calling (first (sort xs)), and thought that that was probably a bit wasteful
07:32Chousukeisn't there a function in contrib for finding the smallest/greatest item.
07:34djpowellmaybe, i've been a bit slow at looking at contrib. likewise, i'm still using inferior-lisp rather than slime
07:34zakwilson(doc max)
07:34clojurebotReturns the greatest of the nums.; arglists ([x] [x y] [x y & more])
07:34djpowellzakwilson: doesn't work with strings
07:34zakwilsonSo I see from the docstring.
07:35zakwilsonSo what you want is a generic max, or one that can take a comparison function as an argumnet.
07:35djpowellyeah, i think there is one in contrib
07:35djpowelli kind of got a massive boost from using clojure and inferior-lisp, and doing stuff with them is taking priority over the lesser boost i'd get from looking at contrib and slime. i'm lazy
09:33hellaskah so nice, sometimes in clojure i feel like i wish there was something like X and Im not evenr sure I know exactly what X is but then I find X and it is awes ome :). last one was ->
09:34hellaskanyonme here a good webdeisnger?
09:36jdzdefine good. but thickey might be, anyway.
09:41hellaskhow do I set public fields?
09:41hellaskhttp://www.textpresso.org/clustering-software/javadoc/libsvm/SVM_Problem.html
09:41Chouser'set!'
09:42Chouser(set! (.l problem) 5) ; or some such
09:49cemerickI wonder if anyone else has been caught by this ClassFormatError?: http://groups.google.com/group/clojure/browse_frm/thread/4049115d4d1205c8?hl=en#
09:50ChouserNobody compiles Clojure like you do, cemerick. ;-)
09:50cemerickChouser: hrm, rhickey said something similar last week. :-)
09:52cemerickI'm about 3/4 of the way towards having a solid clojure build subant file. That might hit github eventually.
09:52rhickeycemerick: that doesn't seem to be related to partial building per se, but a large codelength - do you have large data literals in your code files?
09:52cemerickI guess my problem is that I generally assume that I'm trailing everyone else, at least when it comes to pure geekery.
09:52Chousernext time you hit the error, you might tar up your classes before clearing them out.
09:52Chouserthat tarfile would give people a place to start hunting for the bug
09:54cemerickChouser: true, but we'd have to identify which classfiles are involved so that nothing sensitive was released
09:54cemerickrhickey: that's interesting -- yes, we have one file in a test lib that has a literal list of ~2500 objects
09:55rhickeycemerick: there are classfile size limits that come into play - for large data I recommend using read instead of compiling a literal
09:57cemerickrhickey: ah ha. That's certainly doable, though unfortunate. Why doesn't it fail all the time, though?
09:57rhickeycemerick: I can't tell from that info
09:58hellaskhow do i get an attribute?
09:59cemerickrhickey: Would it help if I posted the classfile?
10:00rhickeycemerick: I don't think so - that classfile is over the limit, the question is why only on a partial build
10:03Chouserhellask: (.instanceMember instance) documented http://clojure.org/java_interop
10:04cemerickrhickey: and only sporadically, for that matter. Does c.l.Compile (or the stuff it hooks into) always load classfiles for each lib it's provided, or does it do so only when the corresponding source files have changed?
10:06rhickeycemerick: compile should be a no op if nothing has changed, but possibly something is being loaded due to reference
10:10cemerickanyone going to ILC 2009? http://ilc09.org
10:11rhickeycemerick: I hope so!
10:12Chousercemerick: trying to decide it it's worth it for me. Should I go?
10:12cemerickrhickey: yeah, I saw you on the schedule for Sunday. Are you there only Sunday? It looks like a scheme and CL-fest otherwise.
10:12AWizzArdFor me it's in the wrong Cambridge ;)
10:12ChouserI don't know how much good a week of CL is going to do.
10:13cemerickChouser: I can't vouch for it, having never gone. Myself and wwmorgan are probably going to go if rhickey and the enclojure guys are there.
10:13rhickeycemerick: I'm also on the Future of Lisp panel
10:13AWizzArdHas anyone of you been on the ELC 2006?
10:13AWizzArdrhickey: I would say *you are* that panel :)
10:14rhickeyAWizzArd: Lisp has many futures
10:14cemerickrhickey: nice :-P
10:15cemerickAWizzArd: Agreed. Lots of love for clojure here, but as entertaining it is to watch the scheme and CL worlds from afar, I don't see much point (for me/us) in getting hip-deep in them.
10:15rhickeyThere are many interesting talks throughout the week - even if they are CL/Scheme, the domains they are tackling are those Clojure could too
10:16danlarkinHmmm are they not doing per diem this year?
10:16rhickeydanlarkin: no, but $210 early reg is not bad
10:16Chouserdanlarkin: the week price seems to me to be about the same as the per diem last time.
10:17ChouserIf I go, it's unlikely I'll stay the whole week. Maybe through Tuesday or something.
10:18cemerickrhickey: See, we rely on you to bring all that forward-thinking back to the sane, broader world ;-)
10:19rhickeyNext time you guys should submit some Clojure papers!
10:23AWizzArdcemerick: I am doing CL now since 6 years and actually work as a CL dev :) But currently I am transforming this in a full time Clojure job *g*
10:24Chouserrhickey: I don't even know how that works. Do they just waive the fees if they accept your paper, or do the fees start flowing the other direction?
10:25cemerickrhickey: wwmorgan might have something for a lisp-focussed group, but I'd end up presenting something like "Integrating Clojure with JMS for Sane Scalability" or somesuch. I'd have to wear a poncho.
10:25cemerickAWizzArd: good on you. BTW, did you ever put Jambi through its paces?
10:25rhickeyChouser: there's no money flowing my way, that's for sure :(
10:26rhickeyNor, at those rates, for anyone else either - just an educational/intellectual endeavor
10:27cemerickI was pretty shocked by the low rate, actually. $200 is nothing compared to most conferences.
10:28rhickeycemerick: yeah, it's great, and if you've never heard Sussman or Moon et al - these guys are tops
10:28AWizzArdcemerick: Never touched Jambi. I am a swing person so far, and not the happiest. For example just today I learned that one can not simply change the background color of a cell in a JTable. I hoped for something like (.setBackgroundColor my-table cell-x cell-y [r g b]). But instead one needs to provide a rendering method.
10:29Chousercemerick: that's a good point. Perhaps I should seize the chance. It's just a pretty long drive and big slice of time for a lark.
10:29AWizzArdrhickey: if possible please let someone record you. Would be nice to have new Clojure vids online.
10:29cemerickChouser: hey, I'll buy ya a beer. Should make it *all* worthwhile. :-P
10:31rsynnottwhat would the most sensible way to go about making clojure available from a larger java application (jetty or something) be?
10:31cemerickAWizzArd: yeah, the table stuff is not pretty. If you can believe it, it's a metric ton better than the document model, though.
10:32rsynnott(that is, allow the java app to call clojure functions/methods)
10:34AWizzArdcemerick: you mean like writing texts into an editor pane and have there specific words in red color and italic and such?
10:35cemerickAWizzArd: yeah, the whole javax.swing.text.* mess. Pain, pain, pain, and nothing but.
10:36cemerickof course, Swing the worst UI toolkit -- except for all of the others. :-P
10:41AWizzArdmaybe doing these things is really much easier with qt
10:41AWizzArdbut qt is not free for commercial development as I see it
10:42cemerickAWizzArd: even with the LGPL that's coming down the pike?
10:42forestAWizzArd it will be soon)
10:46jbondeson4.5 RC1 was released last week, so it currently is.
10:49AWizzArdoh, hmm
10:50AWizzArdlet me know when this happened.. could be interesting
10:50WizardofWestmarccouple weeks ago?
10:50WizardofWestmarcit's pretty recent
10:52cemerickAWizzArd: I was actually just reading about this over the weekend. Link with attendant peanut gallery: http://www.reddit.com/goto?id=7plau
10:54jbondesonthey announced LGPL on Jan 14th, and the first RC of 4.5 dropped Feb 5th
10:54jbondesonhttp://www.qtsoftware.com/about/news/qt-4.5-release-candidate-available
10:56AWizzArdthx
10:56cemerickI don't think Jambi will ever work for us, just because of the difficulties (known and unknown) of having to track distributions for multiple platforms. That, and it's strictly impossible to deploy in the browser.
10:56AWizzArdso, as I understand this lgpl stuff: if I use qt as a lib (jambi) I won't need to open my sources.
10:57AWizzArdcemerick: didn't Chouser and Lau work with Jambi some months ago?
10:57cemerickAWizzArd: right -- only modifications to the lib need to be LGPL'ed as well.
10:58cemerickAWizzArd: I don't know -- I was absent from the goings on here for a couple of months.
10:59AWizzArdChouser: you got the qt gui-builder working some time ago, yes?
11:01ChouserAWizzArd: yes
11:01hellaskhow the hell do I come up with a good name for a visual search engine?
11:02ChouserI don't think I've yet seen a correct Clojure repl interacting with a correct Qt/Jambi thread, though I've seen some broken attempts.
11:02ChouserAWizzArd: it shouldn't be hard, and maybe somebody's done it, but I've not seen it yet.
11:03hellaskwhat is better about jambi? webkit interop?
11:03hellaskbecause i love swing+miglayout
11:08rsynnotthellask: QT tends to look more native on its supported platforms
11:09clojurebotsvn rev 1253; added #_ ignore form reader macro added IDeref above IRef, made delays and futures implement IDeref renamed/moved IRef.get() -> IDeref.deref() deref/@ maps to IDeref/deref added future-calls and future implement pmap on future implement pcalls on pmap
11:10rhickeynew goodies: futures
11:12jwinterWhat are futures?
11:13hellaskconcurrency constructs i think
11:13rhickeyjwinter: references to a computation on another thread, deref/@ blocks until done
11:14jwinteroh
11:14hiredmanlike a FutureTask?
11:15rhickeyhiredman: a thin wrapp on j.u.concurrent.Futures, supports @
11:15hiredmanNeat
11:15danlarkinohhhh yeah very neat
11:15rhickeyalso future macro, packages up exprs in closure and fires off in thread pool
11:16rhickeyalso pmap now written with futures, so can nest
11:16Chousernice
11:17jwinterFutures: http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Future.html . This is like 20 pages ahead of where I am in Java Concurrency in Practice.
11:18AWizzArdhellask: the mean thing about swing is that in some areas it sucks. For example: when you have a JTable and want to change the background color of a specific cell. How can you do it?
11:18rhickeyChouser: yeah, pmap much tidier: http://code.google.com/p/clojure/source/browse/trunk/src/clj/clojure/core.clj?spec=svn1253&r=1253#3924
11:19AWizzArdhellask: I hoped for something like (.setBackgroundColor my-table cell-x cell-y [r g b]).
11:19Chouserbut now I'm going to have to figure out when I want futures.
11:19ChouserAWizzArd: I don't think it's terribly hard. I may even have some example code...
11:19rhickeyChouser: anytime you are using agents only for threads, i.e. not identity
11:19AWizzArdChouser: it is much harder than what I dreamed of :)
11:20hellaskAWizzArd: ok wasnt aware of that, I was mainly speaking from an amateur point of view on that matter, I have never made professional GUIs but for making an mp3player or something it was betetr than anythign else ive tried like tkinter and the c++ suicide winapi
11:20AWizzArdrhickey: is there an idiom for (swap! my-atom (fn [_ x] x) new-value)?
11:21rhickey(doc reset!)
11:21clojurebotSets the value of atom to newval without regard for the current value. Returns newval.; arglists ([atom newval])
11:21AWizzArdhellask: and about 30 minutes or so ago cemerick also mentioned that it is not trivial to have a text pane in which you want to change the color and font size of specific words/letters. All very evil.
11:21AWizzArdrhickey: great
11:21ChouserAWizzArd: http://gist.github.com/60851
11:21rsynnottAWizzArd: do you still have to subclass the JTable or something?
11:22drewrjwinter: my JCIP reading has been slow
11:23cemerickAWizzArd: just to be clear, it's *easy* to set an arbitrary style over a range of text as a single operation -- however, in order to support interleaving document types, embedded images and other media, and support all of the usual interactions you'd like to have in such a document, you're in for a load of pain
11:24ChouserAWizzArd: line 62 of that gist sets the cell renderer so that each row's foreground color depends on a particular value for that row.
11:24AWizzArdChouser: yes thanks. Around line 62 it starts. You have to provide your own renderer!
11:24AWizzArdyes
11:24Chouseryes
11:24AWizzArd;)
11:24cemerickusing the UI toolkit for stuff like that is the wrong approach anyway, though the mere existence of javax.swing.document leads people to attempt it anyway. A useful web pane component should take care of all of that, as well as integration with your application's custom functionality.
11:24cemerickOf course, I didn't know all these things when I wasted 6 months of my life on document model stuff back in 2001/2002. :-/
11:25ayrnieu,(let [ag1 (agent nil) ag2 (agent 0)] (send ag1 #(do % (send ag2 inc) (await ag2) (println @ag2)))) ;; can't await in an agent
11:25clojurebot#<Agent@ad97f5: nil>
11:25ayrnieu,(let [ag1 (agent nil) ag2 (agent 0)] (send ag1 #(do % (doto (future (send ag2 inc)) deref) (println @ag2)))) ;; can do :-)
11:25clojurebotjava.lang.Exception: Unable to resolve symbol: future in this context
11:25AWizzArdI just hoped that the designers of Swing would offer one simple method for doing so typical stuff. They must have known that people typically want to center Windows, change colors of table cells, or do what cemerick just described.
11:26AWizzArdOne can of course abstract this stupidity away and write ones own Clojure functions, but the fact that his is needed is what seems suboptimal to me.
11:26ayrnieu,(doto (agent nil) (send inc) (await) (-> agent-errors first (.printStackTrace))) ;; -- aside: this has a race condition. Sometimes it'll print the stacktrace.
11:26clojurebotAgent has errors
11:26rsynnottis clojurebot supposed to do that?
11:26rsynnott,(+ 5 4)
11:26clojurebot9
11:26rsynnottheh
11:27AWizzArdyes, it should eval most of our code
11:27Chousukeit's pretty easy to DoS though :/
11:27cemerickAWizzArd: fundamentally, one has to remember that Swing is always doing all of its own drawing -- so, anytime you want to diverge from what you can get right out the box, you're going to have to do your own drawing, too
11:27AWizzArdomg
11:28AWizzArdI will ask Lau later if this is the same with qt
11:28cemerickThe other tradeoff is to use SWT or QT, where there's a lot more that's provided in terms of widgets, but it's also a lot more difficult (last I experimented) to do something outside the box.
11:29cemerickand you're also dragging along native libs in any other scenario, so it's a tricky balancing act depending on your requirements
11:30AWizzArdPersonally I still prefer to offer a swing solution.
11:31jbondesonswing is great if you want to do web stuff, but if you're using it as a stand alone app it's seriously lacking.
11:31cemericksame here, if only because it keeps down the build and deployment complexity, not to mention cuts down significantly on the cognitive overhead of yet another framework/api to learn
11:31ChouserThe only reason textjure uses swing is to reduce download/install requirements. I started it in Qt.
11:33AWizzArdmakes sense (to have it in Swing)
11:33AWizzArdjbondeson: what do you mean with Swing+Webstuff?
11:33jbondesonif you're going a web launch or something
11:33AWizzArdOh, you mean Webstart?
11:35hellaskwhen people do very flashy GUIs, what do they use? write their own GUI-lib?
11:36jbondesonusually native
11:37hiredman flashy GUIs, what do they use? write their own
11:37hiredman GUI-lib?
11:37hiredmaner
11:37hiredmansorry
11:42ChouserQt's got a lot of flashiness.
11:44AWizzArdIs there an easier way than (into {} java-hash-map) to cast a java.util.HashMap into a clojure.lang.PersistentArrayMap? If I have an array of HashMaps and want to do (map to-clojure-hashmap array-of-java-hashmaps)
11:44clojurebotsvn rev 1254; improved ref printing, patch from Chouser
11:46ChousukeAWizzArd: you can't cast them since the java hashmap is not a subclass of persistenthashmap
11:46Chousukeor whichever.
11:46Chousukeif you want the persistent behaviour, copying is your only option :/
11:46AWizzArdoki
11:47Chousukefortunately copying references is relatively cheap :)
11:48AWizzArdclojurebot: namespace of partition-by?
11:48clojurebotNo entiendo
11:48AWizzArdclojurebot: partition-by
11:48clojurebotPardon?
11:48jbondesonChouser: Qt does go down to native, and also I believe that you can test to see if your platform supports certain Qt features before use so you can go from flashy Win/OSX to non-flashy Handheld
11:48Chousuke,`partition-by
11:48clojurebotclojure.core/partition-by
11:48AWizzArdtricky
11:49jbondesonits been a while since i last used Qt extensively, but that's my recolection.
11:49Chouserjbondeson: you're probably right. they work hard to support handhelds and get good rendering speeds on a variety of graphics hardware.
11:49AWizzArdChousuke: hmm, my clojure.jar is 4 days old. Since when is partition-by in the core?
11:50Chousukehmm
11:50Chousukeactually, that might not be correct.
11:50Chousuke.. yeah, it's not in core
11:50hiredmanugh
11:50Chouser(doc partition-by)
11:50jbondesonThe amount of time they've spent on the non-GUI parts of their library in the last couple years is pretty crazy too.
11:51AWizzArd,(doc partition-by)
11:51clojurebotjava.lang.Exception: Unable to resolve var: partition-by in this context
11:51AWizzArdyup
11:51hellaskshould i name my inagesearch site to imagejure?
11:51hellasktihi
11:51hiredmanmy fix to read so it runs in the sandbox namespace may have been lost it git somewhere
11:51AWizzArd,#'partition-by
11:51clojurebotjava.lang.Exception: Unable to resolve var: partition-by in this context
11:51Chousukehiredman: lost?
11:51ChousukeI can see it
11:51AWizzArdhellask: imajine
11:51jbondesonhaha
11:51hellasklol
11:51jbondesoni thought we said no j's last week.
11:51Chouser,(doc partition-by)
11:51clojurebot"([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of lazy seqs."
11:52Chousukehiredman: it's commit 0ede20b5563b54f11dcfe20fe6d3c2969c701c72 if that helps :p
11:52Chousukeor do you mean you've accidentally undone it? :)
11:52jbondesonah yes, commit 0ede20b5563b54f11dcfe20fe6d3c2969c701c72, i remember it well.
11:52AWizzArdChousuke: why does your doc do something different than mine? Did hiredman do some magic inbetween?
11:52hiredman,`partition-by
11:52clojurebotclojure.contrib.seq-utils/partition-by
11:52AWizzArdthx
11:53Chousukethis is why lisp is fun
11:53hiredmanclojurebot: weirdo
11:53clojurebotGabh mo leithsc�al?
11:53Chouserjbondeson: we use Qt extensively at my job, and almost never use any of the GUI classes.
11:53Chousukestuff changes while you're using the system and the user is left confused!
11:53Chouserhiredman: I ran 'use' in a private chat with clojurebot
11:53hiredmanChouser: yeah
11:54Chouseryeah
11:55AWizzArdso, partition-by can not be used if I have a vector of 200 hashmaps where each hashmap contains a k/v pair :type :some-type and where 6 different :some-types exist, and I just want 6 result lists, each containing data from the respective hashmaps, right?
11:55AWizzArdUhm, does that make sense?
11:56AWizzArdpartition-by creates a new result list as soon f returns a new val.. but it can't go back to previous vals.
11:57Chouseryou want 'group-by'?
11:58AWizzArd,(doc group-by)
11:58clojurebot"([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."
11:59clojurebotsvn rev 1255; fixed `()
12:00AWizzArdChouser: good idea, thx
12:04rsynnottthe machine (clojurebot) speaks irish?!
12:06cemerickrhickey: regarding the code size limitation from before -- I think it'd be very helpful if the compiler (or reader?) could emit an exception as soon as a too-large literal is encountered
12:06AWizzArdrsynnott: yes, and german and french too
12:06rhickeycemerick: it's the sum of literals, + code, not any one, that matters
12:07cemerickrhickey: OK -- so then the compiler would be able to make a determination, perhaps after writing the classfile at least, perhaps?
12:08cemerickit just seems that that kind of late failure (which will only hit when the classfile is loaded) should be eliminated if at all possible
12:09cemerick:-/
12:14clojurebotsvn rev 1256; fixed Ratio to floating point conversion, patch from jbondeson
12:19clojurebotsvn rev 1257; fixed Ratio->bigdec, patch from jbondeson
12:21hiredmana maelstorm of activity
12:21jbondesonrich is on a roll
12:22hiredmanclojurebot: rhickey?
12:22clojurebothe works hard so you don't have to
12:23jbondesonnow i have to find a couple more math bugs to keep him on his toes.
12:26jbondesonso now that printing a reference actually does the deref, and then the addition of the future feature, I take it that means that if you're not careful at the repl you'll get a blocked print
12:27hiredmanoooh
12:28ayrnieuor uncareful with debugging prints.
12:29clojurebotsvn rev 1258; clojure.main should not exit if there was an exception in an --init file and the user requested a repl, patch from arohner
12:48Chousergood point. future is the first thing where a deref can block.
12:50jbondesoni don't know if it's truly a problem, but it does have a couple interesting ramifications.
12:51Chouserby my count, 17 people (beside Rich) have gotten patches into Clojure. That's a really good sign.
12:52rhickeyChouser: yes, it's great - thanks all!
12:53rhickeyIt's going to be needed in order to keep the fixes/complaints ratio high
12:53ChouserUp from zero one year ago.
12:54rhickeysadly the days are gone when I could keep fixes/complaints at 1 by myself
12:55rsynnottdid the license ever change in the end?
12:55technomancyany suggestions? =)
12:56Chousukewhat's the status of pretty-printing?
12:56ayrnieuanyway, future-call is so simple, a concerned person can just roll another
12:57Chousertechnomancy: there's a whole list of issues -- take your pick.
12:58Chouserhttp://code.google.com/p/clojure/issues/list
13:00Chouser13 might be a good place to start. or 17 might be fun.
13:01technomancyI don't know much about how compilation works... so for 13 the point is you shouldn't be able to create symbols/keywords that contain unprintable characters? or what?
13:01technomancythe description is a little terse
13:01ChousukeI poked at 13 some but gave up. I think it should be determined clearly first what actually constitutes a valid symbol
13:02Chousertechnomancy: unreadable
13:02technomancysounds like a good pre-requisite. =)
13:02technomancyChouser: oh sure; that makes sense
13:02Chouser,(symbol "spaces in symbol?")
13:02clojurebotspaces in symbol?
13:02Chouserrunning that back through the reader will not give you what you put in
13:02hiredmanhmmm
13:02Chousuke/ is one interesting corner case too
13:02Chouserthus shouldn't be allowed in the first place.
13:02Chousuke,/
13:02clojurebot#<core$_SLASH___3201 clojure.core$_SLASH___3201@12088db>
13:02Chousuke,/foo
13:02clojurebotEval-in-box threw an exception:Invalid token: /foo
13:03ChousukeI wonder if simething simple as trying to read what (symbol) outputs would be enough :/
13:05ayrnieuCL: '|symbol with spaces| (read-from-string "|symbol with spaces|") => |symbol with spaces|
13:05jbondesondoesn't reading a symbol potentially have effects?
13:05ChouserChousuke: that would be correct, but I'm not sure if that would be efficient enough.
13:05Chouserjbondeson: no
13:06jbondesonno potential to de-lazify (so calling MW for that word) anything?
13:06ayrnieuclojure.org already has a definition of what's valid in a symbol.
13:06ayrnieujbondeson - do you want dorun , doall ?
13:06Chousernot at read time. CL might do interning or something, but Clojure does not (at read time).
13:07jbondesoncool, just checking.
13:07jbondesonhaha
13:07jbondesonjust make sure to do that in a c.l.lisp conversation
13:07ChouserI had to correct my statement above. No need to offend anyone.
13:08WizardofWestmarconly if Kenny's sure to read it <_<
13:08ayrnieuif you wanted to stick to present tense, you should've said "CL may do"
13:08Chouser"CL might do" is much more polite than "CL might have done"
13:10danlarkinayrnieu: "CL may do" is future tense!
13:11ayrnieujbondeson - what does "calling MW for that word" mean?
13:11jbondesoncan't we all just agree that engineers suck as linguists?
13:11jbondesonayrnieu: as in call merrian-webster, sorry
13:11ayrnieuno, we can't.
13:12ayrnieuah.
13:12jbondesonyes, but engineer-linquists are invariably bad engineers ;)
13:19clojurebotsvn rev 1259; zip/remove does not return the correct loc, patch from cgrand fixed refer-clojure doc
13:24jbondesonI hereby dub today: "Clojure Defect Closeout Day", or alternatively "Rick Diffs His Heart Out Day"
13:25gnuvince?
13:26jbondesonhalf dozen bugs closed out and it's not even 2 on the east coast!
13:28jbondesonhahah just saw "Rick" and not "Rich" sorry
13:29clojurebotsvn rev 1260; add a warn-on-reflection option to clojure.lang.Compile, patch from cemerick
13:31Chouserthe last such session was Jan 23 and 24th -- 7 contributed patches in 2 days.
13:35ChousukeIt seems rich just goes through the issue list at random intervals and applies patches.
13:36ayrnieuhuh, clj just blocked forever on a simple (defn broadcast (msg WRONG THIS SHOULD BE A VECTOR) ...)
13:38Chouserayrnieu: ?
13:38ayrnieuI just played commenting games to see that it was holding up on that line.
13:38Chousermsg?
13:38Chousukeayrnieu: you sure you didn't just forget a closing paren?
13:38Chouserdid you forget a vector of formal args?
13:38ayrnieuChouser - instead of throwing java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol
13:38ayrnieuChousuke - yes, but even if it had been that, is that reasonable?
13:39ayrnieuChouser - instead of throwing that, it just hung.
13:39Chousukewell, the repl doesn't stop reading until it has a complete form.
13:39jbondesonmight have been in a parse loop.
13:39Chouseroh, I see what your example means now
13:40ayrnieuChousuke, this wasn't at the repl.
13:40Chouserbecause your msg function was blocking?
13:41ayrnieuthere's no 'msg' function, and defn would've complained about the impropriety of not having [msg] before anything could evaluate (msg)
13:43ChouserI'm failing to reproduce the blocking behavior here.
13:44jbondesonhow much code was around it?
13:52ayrnieuit's repeatable, but weirdly dependent on enough odd factors that I can't just paste the code
13:53technomancyChouser: are the rules the same for what's allowed in a keyword vs a symbol?
13:53jbondesonsounds like the parser freaking out.
13:53jbondesonis the parser auto-generated? I've never looked at that part of clojure.
13:54Chouserjbondeson: no, it's hand-written Java
13:55Chousertechnomancy: good question.
13:56Hunparser generators are not really useful for parsing lisp (you need less code handcoding than for the parser)
13:56Hundoesn't really matter which one
13:58ayrnieuhere, if you get the latest clojure and the latest clj-actors , you can 'make watcher' and see the hang
13:59jbondesonwell, clojure is slightly less "regular" than something like CL due to special forms requiring square brackets rather than sexprs
13:59ayrnieuhttp://github.com/ayrnieu/clj-actors/tree/master ; if you comment out the unrelated forms before the (defn broadcast (msg) on line 15 of examples/watcher.clj , it doesn't hang
14:00ayrnieuif you don't :use act.actors , it doesn't hang.
14:00Hunjbondeson: you have a lot more problems parsing CL due to reader macros, e.g. #()
14:04jbondesonHun: true, user defined reader macros make that part of it harder.
14:04Hunthe default ones are bad enough.
14:08ayrnieuI can defn- to make something private. Can I make something not exported by default, so that (:use mylib) alone won't bring it into the caller's namespace?
14:09technomancyayrnieu: you mean like a regular def?
14:09technomancyoh, never mind
14:10danlarkin,`defvar-
14:10clojurebotsandbox/defvar-
14:10danlarkin:(
14:10technomancyyou mean private-by-default-but-with-workarounds?
14:13ayrnieuat present you have a namespace that you can load and then ns/foo things, you can bring some of those things into your namespace, and you can bring all of those things into your namespace. I'd like a "bring useful non-polluting things into my namespace, and then still refer to ns/shortname"
14:14danlarkinwell there's always :only
14:14technomancybut some kind of "only by default" so users wouldn't have to think about it would be nice
14:15ayrnieuthat's the "bring some of those things into your namespace".
14:15ayrnieu(ns foo) (defn x [] (println *ns*)) (ns user) (foo/x) ;; prints #<Namespace user>
14:15ayrnieuso maybe a foo/import can do this.
14:23ChouserIn error-kit I'm currently marking things private, but if I need to get to them (say from a macro) I use cgrand's idea of @#'error-kit/private-thing
14:25jbondesonChouser: i wonder if that's an officially sanctioned work around, after cgrand said that i also used it for some things that i needed, but i'm worried it'll be changed to respect the privacy of the ns.
14:25technomancywhat's the right way to do this?
14:25technomancy(< (java.util.Date.) (java.util.Date.))
14:26Chouser(.before (java.util.Date.) (java.util.Date.))
14:26ChouserI would think
14:26technomancythanks... is there a way to make < DTRT?
14:32danlarkinew, marking things as private and then using them with @#'foo/bar is evil!
14:32technomancydanlarkin: aka "Ruby-style private". =)
14:32danlarkinif you need to use it from a different namespace then it should be public, end of story
14:32danlarkinIMO anyway
14:33ChouserYou might be able make clojure.lang.Numbers fall back to 'compare' when dealing with non-numbers.
14:33Chouserdone that way, I don't think it'd hurt performance for numbers.
14:33Chouserdanlarkin: even if the only way it "should" be used is via a macro?
14:34jbondesonit's a very common situation to have only "approved" access to a method
14:34technomancyChouser: maybe I'm just stuck on duck typing, but it seems to me that < and > should be a little more capable.
14:34danlarkinChouser: yeah that's when you name it _private-thing
14:34hiredmanugh
14:35ayrnieudenlarkin - so the end of story is that users of your library have to deal with this extra undocumented element after they :use your library ?
14:35hiredmanwhat is this, python?
14:35hiredman:P
14:35danlarkin:)
14:35jbondesonyeah, but then you have all these underscore methods polluting your namespace
14:35Chousertechnomancy: sure, but there's a whole batch of people who will complain very loudly if you take away even a tiny bit of the primitive number performance.
14:35kotarakIsn't "private references from macros" on the todo list?
14:35danlarkinprivate or public! it's binary!
14:36jbondesonChouser: that'd be math heads like me! don't screw with my primitive math performance ;)
14:36Chouserkotarak: not that I know of.
14:36technomancyjbondeson: but... but... < barfs with dates!
14:37jbondesondon't mess with numbers speed >=|
14:37ayrnieu(def farty-primitive-< <) (defmulti glorious-DTRT-< (fn [x & _] (class x)))
14:37jbondesonmake your own that's slow!
14:38ayrnieuor you can just (defmulti < ...) and then clojure.core/<
14:38jbondesonit would be nice to have some sort of default speed/capability libraries that you could import.
14:38ChouserNumbers.java is 4371 lines
14:38kotarakChouser: I thought it was. But the backpackit site is gone.
14:38kotarakAnyway: would be nice to have.
14:39jbondesonIt could default to DTRT, and then bit heads could get the "really-fast-<"
14:39drewrI've gotten so used to ns that I forget how to use require and use outside of it
14:39drewrwhat's wrong with (require 'com.notifymd.wm.core :as 'wm)?
14:40hiredmanneed a vector
14:40drewrah, (require '[com.notifymd.wm.core :as wm])
14:40drewrI wasn't quoting it
14:40kotarakwhich you need inside ns, too, btw. ;)
14:41jbondesonthe different syntaxes in and out of ns is slightly annoying.
14:41drewrkotarak: not the quote
14:41kotarakdrewr: you quoted everything, but forget the vector.
14:41drewrkotarak: yes to the vector
14:42technomancyjbondeson: that's what I'm thinking; it'd be nice, but I don't think I'm ready to push for that at this point since there would be lots of opposition.
14:43jbondesonprimitive comparison methods being actual methods would be nice as it would add extensibility
14:43Chouseryou'd want the plain functions available still, but perhaps they could be pushed off to 'require*' and such
14:45Chouserhmph. Methods in Numbers take args of type Number. For some reason I thought they were Object in some places.
14:45ayrnieuyou can write (defmulti < ...), refer to clojure.core/<, offer it as clojure.contrib.flexi-prims
14:46Chouserhttp://github.com/gnuvince/clojure-greatest-least/blob/5d139382cf0a8b5b74fd222de180faaf4204f749/clojure/contrib/greatest_least.clj
14:47ayrnieuone day github will have terse DTRT URLs.
14:48hiredmansay the word and clojurebot will start tinyurling everything again
14:48Chouserit only helps if nobody has to see the long one
14:49Chouserfor example if i were less lazy and tinyurl'ed it first.
14:49kotarakmaybe a private msg to clojurebot, which tinyurls and then posts?
14:50gnuvinceI don't see the point of tinyurlizing an URL that's already posted: just click on it
14:50hiredmanI was mostly kidding out turning it back on
15:02lisppaste8ayrnieu pasted "multiple arities make me happy inside" at http://paste.lisp.org/display/75134
15:17fandahello! i have question about namespaces... i am sure, it was discussed before, but why is "ns" better than "namespace"?
15:17fandawe have "require", "import", "use"
15:18Chouserfanda: you're asking for a longer name for the existing macro?
15:18fandawould be "namespace" better to clearly mark the beginning of one such?
15:19fandaChouser: yes, to me it would make sense
15:19Chouser'namespace' is currently a function that returns that part of a symbol or keyword
15:19Chouser(doc namespace)
15:19clojurebotReturns the namespace String of a symbol or keyword, or nil if not present.; arglists ([x])
15:19Chouser,(namespace 'foo/bar)
15:19clojurebot"foo"
15:19fandaoooh, I see
15:20fandahm, what to do, what to do :-)
15:22fandaok, then
15:24fandaso we got ns, in-ns, namespace, name
15:26fandais there anybody, who oversees issues for clojure-contrib?
15:26fandahttp://code.google.com/p/clojure-contrib/issues/list
15:27fandanew issues for tests haven't made it in
15:27fandai would like to write more tests, but patches will soon cause merging issues
15:29fandathese patches influence only test_clojure, so they are not really breaking anything except tests itself
15:29Chouserfanda: the problem is there are several people, with vague responsibilities.
15:32fandais there a chance for me to be resposible for test_clojure?
15:32fandarhickey has my CA, i wrote him an email too
15:32fandai believe he is the only one with the right to include me to developers, right?
15:32Chouserfanda: yes
15:33fandai will write more patches, if you want me to
15:34fandaso you can see my Clojure style
15:35kotarakSlightly offtopic question for gorilla: are there any Windows Vim users around?
15:35fandaotherwise, I would be happy to take care of test_clojure
15:35jbondesonkotarak: we cull those kinds of people so they don't spread.
15:36ChouserI'm barely following the test_clojure code, so I don't feel I'm in a position to evaluate or apply patches there. I would hope Stuart Sierra or Stephen Gilardi would handle your patches for you.
15:37Chouserfanda: or if Rich gives you write permissions, then you can do it yourself.
15:39kotarakjbondeson: That's a pity. You are missing some bright heads, then.
15:39jbondesonvim users, yeck ;)
15:39forest_is there someone using gentoo clojure ovrelay, is it sexy ?
15:40kotarakWell, vim has now omni completion with docstring and arglist preview for Vars and imported functions.
15:40kotarakThe problem is: it doesn't work on Windows. :/
15:40fandaChouser: ok, I will contact Stuart Sierra or Stephen Gilardi, that should do it :-)
15:40danlarkinforest_: I use it
15:40danlarkinforest_: I would not recommend it
15:41forest_yes, that is what i was afraid of)
15:41hiredmanclojurebot: emacs?
15:41clojurebotuggada buggada
15:41hiredmanclojurebot: emacs?
15:41clojurebotuggada buggada
15:41hiredmanhmmm
15:43forest_clojurebot: uggada buggada
15:43clojurebotexcusez-moi
15:46scottjWhat are good reasons for the name reset! not replacing ref-set?
15:47kotarakscottj: what are good reasons for the name reset! to replace ref-set?
15:47cooldude127scottj: isn't reset misleading?
15:47cooldude127ref-set is a tad more clear
15:48ayrnieu(commute some-ref #(do %2) new-value)
15:48jbondesonref-set and reset! do different things though.
15:48jbondesonreset! only works on atoms.
15:48cooldude127wait we already have something called reset?
15:49jbondesonyes
15:49jbondeson,(doc reset!)
15:49clojurebot"([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."
15:49cooldude127i haven't reeducated myself. i only remember when there were vars, refs, and agents
15:49cooldude127,(doc ref-set!)
15:49clojurebotjava.lang.Exception: Unable to resolve var: ref-set! in this context
15:49jbondesonno ~
15:49cooldude127,(doc ref-set)
15:49jbondesonerr !
15:49clojurebot"([ref val]); Must be called in a transaction. Sets the value of ref. Returns val."
15:50cooldude127wtf are atoms?
15:50Chousercooldude127: http://clojure.org/atoms
15:50ayrnieucooldude, now we have vars, refs, atoms, agents, and futures.
15:51durka42futures?
15:51ayrnieuand I think we don't have enough :-) Concurrency is hard.
15:51jbondesonjust don't mess with oil futures!
15:51ayrnieu,(doc future)
15:51clojurebotjava.lang.Exception: Unable to resolve var: future in this context
15:51jbondesonjust got added today
15:51jbondesonclojurebot isn't updated
15:51cooldude127oh god
15:51scottjreset! is for atoms, ref-set is for refs. superficially the difference seems to be one needs to be called in a transaction, the other doesn't.
15:52cooldude127scottj: sounds right
15:52jbondesonatoms and refs are different
15:52ayrnieudurka - (let [fut (future expr expr expr)] @fut (comment BLOCKING))
15:52scottjjbondeson: yeah, but you're reseting both of them aren't you?
15:52ayrnieurefs offer STM. atoms have simple spinlocks.
15:52jbondesonatoms are simplified refs
15:53cooldude127oh
15:53technomancyit seems strange to me that test_clojure is treated like any other contrib library
15:53jbondesonyou want to have different syntax when they are doing different things.
15:53jbondesonthat's why the bangs are there.
15:54ayrnieutechnomancy - it'd be odd if you were doing TDD yourself. But if someone else wants to provide tests?
15:54jbondesonthough slightly confusingly you have bangs (!) on some other functions as well...
15:55kotarakI would expect reset to re-set something to some predefined value....
15:56hiredmankotarak: it makes sense if you think of when you initially set the value
15:56hiredmanyou don't use a function like you do with swap!
15:56kotarakThen I don't "re"set it.
15:56forest_,(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
15:56clojurebotjava.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
15:56kotarak(I know: set! is already gone)
15:56jbondesonyes you do, you "set again" since it was already set once.
15:57blippetdudes what do you thnk of phowser or powser for an image search engine(phowser=photo browser)
15:57blippet?
15:57durka42so a future is sort of like a one-time agent?
15:58hiredmanhmmm
15:58jbondesondurka42: it also blocks if you attempt to deref before computation is completed
15:58durka42so @future has an implied await
15:58technomancyayrnieu: it makes sense that it's part of contrib (if shipping clojure itself without tests in the first place can be said to make sense), but it seems odd that it lives under src/ and gets shipped out with every app that makes use of contrib.
15:58durka42whereas if you deref an agent before it finishes you'll get the old value?
15:58jbondesoncorrect.
15:59jbondesonagent, atom, and refs are all non-blocking.
15:59jbondesonfutures are now blocking
15:59durka42can futures have watchers
16:00ayrnieuadd-watcher doesn't mention it, but you can easily spawn off an agent to block on a future and then send a message.
16:00danlarkinlet's say I want to create a list of the return values of a list of functions. except one of the functions returns a two-vector but I want to insert both of the items into my list separately, not the two-vector itself... anyone have a better way than looping through and checking the return type?
16:00ayrnieuadd-watcher on futures would be odd, though, because futures only 'change' once.
16:00jbondesonummm... no i don't thing so
16:00jbondesonthere is a isDone method on the returned object though
16:01ayrnieudanlarkin - other than "don't do that", no.
16:01jbondesonI believe that's one of the reasons he removed "get" from IRef, and added a IDeref and "deref"
16:01danlarkinayrnieu: but... but.. that's what I want :(
16:01jbondesonreevaluate what you want ;)
16:02Chouserif they all return vectors then you can just concat or mapcat
16:02cooldude127danlarkin: wrap your functions in another function that checks the return type
16:02cooldude127then do what Chouser said
16:02ayrnieudanlarkin - you could flatten the vector later on.
16:04jbondesoni wonder if there was a reason future-call is implemented with a proxy rather than a concrete object in clojure.lang
16:04danlarkinChouser: yes, there we go, I suppose I could have them all return vectors, thanks :)
16:04Chouserproxy is more fun to write than .java
16:04jbondesonChouser: hahaha true
16:04Chouseratom was just a proxy for a while too
16:05hiredmanmmmmm
16:05ayrnieuand in addition, people complaining about future can look at the proxy and say "oh, I'll just do something like that."
16:12blippethow do I set an arrays values?
16:12jbondesonkubrick is splitting waaaay too often recently
16:12blippet(def a (make-array Integer 3))
16:12blippethow do I set a[0]?
16:13jbondeson,(doc aset)
16:13clojurebot"([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."
16:13durka42(doc into-array)
16:13clojurebotReturns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.; arglists ([aseq] [type aseq])
16:13durka42might also be useful
16:14ayrnieu,(into-array Byte/TYPE (map byte [127 0 0 1]))
16:14clojurebot#<byte[] [B@1a99836>
16:14ayrnieu,(seq (into-array Byte/TYPE (map byte [127 0 0 1])))
16:14clojurebot(127 0 0 1)
16:15jbondesondealing with java arrays involves prefixing with 'a' quite a bit
16:42cemerickis ! being held over for potential future syntax? I actually have a fn or two I'd like to name !.
16:42blippetdoes anyone think podular is a good name for a podcastaggregator/recommender site?
16:43jbondesoncemerick: it seems to be used on any function that modifies a reference object outside a transaction
16:44cemerickjbondeson: I was actually talking only about ! itself -- which I just noticed isn't defined at all anymore. It was the old name for send-off, I think.
16:44jbondesonif things like twitter, and reddit are any indication, you don't need a good name. in fact a good name may be a deterrent.
16:44jbondesonah
16:45danlarkinjust two adjacent consonants
16:45cooldude127lol
16:45technomancycooldude127: how's the date lib?
16:45cooldude127technomancy: i haven't been working on it lately
16:45jbondesonright, the less pronoucable, the better the name.
16:45WizardofWestmarcor just get drunk and start scribbling, then when you wake up the next morning see what looks the trendiest ;-)
16:46jbondesongogwitter
16:46cooldude127technomancy: caught in school work. data structures are a bitch
16:46cemerickrhickey: just to make sure: are you planning on using ! for any future syntax?
16:46technomancycooldude127: bleh; school is useless.
16:47jbondesontechnomancy: come now, school's good for learning how to learn. which is good cause they're going to have to reteach you when you get a real job ;)
16:48cooldude127school is finally getting me back into actually coding tho
16:48technomancywell it's decent for learning stuff like literature and what have you I guess
16:49technomancycooldude127: anyway, I'm not working on the project that was going to use the date lib right now, but when I finish up with Mire I'm probably going to bug you about it
16:49cooldude127technomancy: sounds fine, let me know what kind of stuff you need most
16:51blippettwitter is good in my opinin
16:53jbondesonthe only way twitter could be worse is if it was twittr. oh wait it was twittr
16:53technomancy... says the guy with two adjacent consonants in its name
16:53blippetlol
16:53cooldude127lol
16:53WizardofWestmarcwhat ever happened to your secret weapon url jbondeson? :P
16:53mofmogif i can do something in java, i should be able to do the same in clojure correct? Say there was tutorial to make a java facebook app. If I knew decent amount of clojure, translating the java code to clojure would be relatviely painfree, albeit not idiomatic clojure
16:54jbondesonWizardofWestmarc: let it lapse, was never going to get it done. something tells me it will still be available if i get it again...
16:54cooldude127mofmog: i think for the most part, although if you're not doing idiomatic clojure, it probably wouldn't be all that fun
16:54technomancyfun or worthwhile
16:54mofmogcooldude: well true, but i just want to get a proof of concept up
16:55jbondesonyeah, you may want to take the time to actually attempt a functional implementation.
16:55cooldude127mofmog: yeah, the point i'm making is if you're writing it in the style of java, you might as well use java
16:55mofmogtrue true
16:55mofmogbut i just want to see if i have all the dependencies needed to accomplish the task
16:55cooldude127oh
16:56blippetmofmog: it should work since you can compile to class-files
16:56mofmogbecause i plan on getting a server with tomcat installed and i was wondering if that's enough
16:56mofmogand the people who run it need to know that i need tomcat since it's university web hostin
16:57mofmogand if there is java library X i can use X in clojure like anything else right? becuase the professor i'm doing this for, i told him that anything java can do you can do it in clojure
16:57cooldude127mofmog: yes you would probably be fine
16:57mofmogyeah, the whole point of using clojure is that scheme is taught here, so when i leave he can easily find a new replacement
16:57mofmogwell, not the whole point, but a significant point
16:58mofmogand then, it could be pointed to as an example of, "hey, using SICP isn't impractical after all!"
17:38hiredmanclojurebot: help is <reply>http://www.khanacademy.org/
17:38clojurebotIk begrijp
17:39durka42clojurebot: help meee!11one
17:39clojurebothttp://www.khanacademy.org/
17:40jbondesonkhan acadamey sounds more like where you go to learn how to be a cheesy star trek villan
17:40danlarkinobligatory KHAAAAAAAANNNN!
17:40WizardofWestmarcI was expecting that when I clicked the link :(
17:53ayrnieuOK, I don't like automatic derefs at the REPL.
17:53jbondesonhahaha
17:53Chouserayrnieu: really?
17:53Chouserayrnieu: just because of futures, or something else?
17:53ayrnieuI haven't hit blocking futures yet, but I have self-referential agents.
17:54ayrnieuso I get {:self #<Agent@430d2f: {:self #<Agent@430d2f: {:self #<Agent@430d2f: {:self #<Agent@430d2f: {:self #<Agent@430d2f: whereas before I just got the #<Agent ...>
17:54Chouserah, sure.
17:55Chouserwell, for now it's easy to override, but I wonder what the best solution would be.
17:55jbondesonrepl setting?
17:55jbondesonor a meta :fortheloveofgoddontderefme
17:55Chousereh
17:56ayrnieuCL has variables to control printing at the REPL, circularity detection, etc. But here a depth limit on derefs would be OK.
17:56Chouserayrnieu: (remove-method print-method clojure.lang.IDeref)
17:56ayrnieubut that's harder to do than to just have my library say "you don't want to print our agents"
17:56ayrnieuright.
17:56Chouserthere's already a variable for limiting depth
17:58ayrnieu,(let [ag (agent {})] (send ag assoc :self ag) (await ag) ag)
17:58clojurebotEval-in-box threw an exception:java.lang.reflect.InvocationTargetException
17:58Chouserayrnieu: (set! *print-level* 6)
17:58ayrnieuaha, OK.
17:59Chouserbut that doesn't strike me as a particularly nice solution for your situation.
17:59Chouserare you sure you need the :self reference?
17:59ayrnieuYes.
17:59Chouserevery agent action gets *agent* bound to itself.
17:59ayrnieuOK, no :-)
17:59Chouser:-)
17:59jbondesoncircular detection would probably get a bit messy in there.
17:59foreztcan clojure help us to overcome world crisis ?
18:00technomancythe implementation of symbol calls intern with only one arg, but intern doesn't have a single-arg version. how does that work?
18:01Chousertechnomancy: it's right there, line 43
18:01hiredmanuh
18:01hiredmanyeah
18:02hiredmanwait
18:02hiredmanare we talking clojure side or java side
18:02Chouserhttp://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/Symbol.java#43
18:02technomancyclojure-side
18:02hiredman(. clojure.lang.Symbol (intern ns name))
18:03hiredmanline 340
18:03technomancyhiredman: what about line 339?
18:03Chouserline 339 calls the java method I just posted a link to.
18:04technomancyChouser: so you can have a lisp function with the same name as a java function without any conflict?
18:05technomancyI mean, as long as they have different arities?
18:05hiredmanuh, there are no java functions, and . is a special form
18:06Chouseroh!
18:06Chouser(. clojure.lang.Symbol (intern ns name)) is the same as (clojure.lang.Symbol/intern ns name)
18:06walterstechnomancy: AIUI each clojure function is in a separate java class
18:06Chouserit's the older/internal syntax
18:06technomancyChouser: gotcha. I was taking (intern name) as a clojure function call
18:07walters(in the future the anonymous classloader will make that a lot nicer)
18:07technomancythat's ... pretty funky
18:07Chousertechnomancy: yeah, I just realised that. :-)
18:07technomancythanks
18:07Chouseras far as I know, rhickey isn't writing any new code with that style.
18:08technomancyright; if I update that I'll "modernize" it
18:08Chousergood. :-)
18:09technomancyChouser: but enforcing symbol names sounds like it might be better as Java-side change?
18:10durka42*print-level* doesn't seem to prevent this... http://rafb.net/p/jAzQJx40.html
18:10durka42(the output was large the JVM and lisppaste choked on it...)
18:11jbondesonowch
18:11durka42so large*
18:12Chouserdurka42: ah, indeed. I tested it with a hash-map in-between each level. *sigh*
18:12Chouserthat'll teach Rich to take patches from me. :-P
18:12durka42i mean, i don't see why one would ever do what i did there
18:12durka42but i did break it :p
18:12jbondesonso sad Chouser, so sad...
18:13jbondesonso your next patch is cirular reference detection, right?
18:15lisppaste8ayrnieu pasted "@*this-node*" at http://paste.lisp.org/display/75151
18:16lisppaste8ayrnieu annotated #75151 with "the explanation" at http://paste.lisp.org/display/75151#1
18:19lisppaste8Chouser pasted "print deref counts toward *print-level* patch" at http://paste.lisp.org/display/75152
18:21durka42oh, *print-level* was pre-existing?
18:21durka42what else does it apply to?
18:21ayrnieu(repeat 1)
18:22ayrnieunah, not that.
18:22durka42:)
18:23ayrnieu,(take 10 (iterate list 1))
18:23clojurebot(1 (1) ((1)) (((1))) ((((1)))) (((((1))))) ((((((1)))))) (((((((1))))))) ((((((((1)))))))) (((((((((1))))))))))
18:23ayrnieu,(binding [*print-level* 2] (take 10 (iterate list 1)))
18:23clojurebot(1 (1) ((1)) (((1))) ((((1)))) (((((1))))) ((((((1)))))) (((((((1))))))) ((((((((1)))))))) (((((((((1))))))))))
18:23durka42,*print-level*
18:23clojurebotnil
18:23durka42(doc *print-level*)
18:23clojurebot*print-level* controls how many levels deep the printer will print nested objects. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum level to print. Each argument to print is at level 0; if an argument is a collection, its items are at level 1; and so on. If an object is a collection and is at a level greater than or equal to the value bound to *print-leve
18:25ayrnieu,(set! *print-level* 5)
18:25clojurebotjava.lang.NoClassDefFoundError: clojure/lang/Compiler$AssignExpr
18:25durka42,(binding [*print-level* 3] (print (take 10 (iterate list 1))))
18:25clojurebot(1 (1) ((1)) ((#)) ((#)) ((#)) ((#)) ((#)) ((#)) ((#)))
18:26ayrnieu,(first (reverse (take 100 (iterate list 1)))))
18:26clojurebot(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((1)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
18:27ayrnieuanyway, it should probably not print exceptions.
18:28durka42printing (first (agent-errors %)) wouldn't be terrible
18:29ayrnieuwell, I need to see the object before I can decide to do something special with it.
18:30ayrnieu,(ref :a)
18:30clojurebot#<Ref@f9cbe5: :a>
18:30ayrnieu,(let [ag1 (agent nil) ag2 (agent 0)] (send ag1 #(do % (doto (future (send ag2 inc)) deref) (println @ag2))))
18:30clojurebotjava.lang.Exception: Unable to resolve symbol: future in this context
18:31durka42#<Agent@75a30f: nil>
18:31durka42user=> 1
18:31durka42but sometimes the 1 arrives before the nil
18:32ayrnieuoh, sorry, that was an example of awaiting -- agents can't await, but futures can.
18:33hiredmanweird
18:34hiredmanah
18:34hiredmanI want future-call
18:34ayrnieu,(let [ag (agent nil)] (send ag inc) (Thread/sleep 1000) ag) ;; race condition if you try to await here.
18:34clojurebotAgent has errors
18:35ayrnieu,(let [ag (agent nil)] (send ag inc) (Thread/sleep 1000) [1 2 ag])
18:35aplmausin clojure, do we have a way of specifying java classes and interfaces so that we expose normal seeming functionality to programmers using java?
18:35clojurebotAgent has errors
18:36ayrnieuaplmaus - gen-class
18:37hiredmanclojurebot: url?
18:37clojurebotIt's greek to me.
18:37hiredmaner
18:37aplmausdo the generated classes have a very different feel in java, or can it be made so that people using them don't even need to know they were made in clojure?
18:37hiredmanlisppaste8: url?
18:37lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:40lisppaste8hiredman pasted "I don't \get\ it" at http://paste.lisp.org/display/75155
18:40jbondesonaplmaus: i believe that gen-class will give you perfectly normal java classes (not a java expert), the only caveat would be how heavily you lean on the java lang data structures in your interface
18:41jbondesoni mean clojure lang data structures
18:41jbondesonnot java, sorry
18:41jbondesonhiredman .deref not .get
18:42hiredmanjbondeson: but the proxy has a get method
18:42hiredmanwith no args
18:42RaynesThere isn't a logical 'and' operator like && in Clojure is there? Man would that be useful.
18:42jbondesonworked for me with deref.
18:42ChousukeRaynes: ... and is not enough?
18:42jbondesonbut you are right
18:42Chousuke,(and true false)
18:42clojurebotfalse
18:42RaynesOh!
18:43RaynesI didn't know that existed.
18:43hiredmanjbondeson: clojure futures are java Futures which is an interface with a few methods
18:43RaynesChousuke: I haven't read the API yet.
18:43hiredmaninclude a get method that takes a timeout
18:43ChousukeRaynes: there's or too
18:43hiredmanwhich is what I am really interested in
18:43RaynesChousuke: Thanks :D
18:44jbondesonhiredman: yeah, i see that now, i was just saying that .deref works as you'd expect
18:44Chousukeor has the useful property that it returns the first non-false value
18:44hiredmanjbondeson: so does @
18:44Chousuke,(or nil 1 (iterate inc 0))
18:44clojurebot1
18:44jbondesonis there a reason you want .get ?
18:44hiredmanbut I want a get that times out
18:45jbondesonahh
18:45hiredmanright now I am using a proxy on FutureTask
18:45hiredmanwhich is a Future
18:45hiredmanand it is just weird that the proxy acts like that
18:47jbondesonhiredman: (.get a 30 java.util.concurrent.TimeUnit/MILLISECONDS)
18:47jbondesonusing the time, timeunit version seems to work
18:47hiredmanugh
18:47hiredmanbut the .get with no args still doesn't
18:47hiredmanwhich bugs me
18:48jbondesonthat is a bit odd
18:48durka42is that a general proxy problem?
18:48hiredmandunno
18:48hiredmanI don't know what the problem is
18:49hiredmanit seems like it should just work
18:49Chousukethe proxy doesn't implement a no-argument version of .get?
18:49Chousukeno, it does
18:49Chousuke(get [] (.get fut))
18:50hiredmanI am well aware
18:50hiredmanI have been staring at it
18:50hiredmanit is all there, but it does not appear to work
18:51Chousukepossibly a bug in proxy?
18:52hiredmanI guess?
18:54durka42when i try and define a proxy with methods overloaded by arity, it doesn't work at all
18:55durka42calling the no-arg version says wrong # of args
18:55durka42calling the one-arg version says no method found
18:55Chousukehahha
18:55ChousukeI made it work
18:55durka42mm?
18:55ChousukeI switched the order of the get definitions in proxy...
18:55jbondesonhmmm
18:55durka42i was wondering if that was it
18:55Chousukeno-arg version first, no-arg version works
18:56Chousukedid not try if the two-arg version still works :/
18:56jbondesonyou can't overload based on arity...
18:56hiredmanerm
18:57jbondesonproxy blows on it
18:57jbondesonheh
18:57jbondesonnow the two-arg version blows with a generic ClassCastException
18:58jbondesonwait
18:58hiredmananyway
18:58jbondesonthat might be me
18:58Chousukeno wait, got confused: the version which comes *last* is effective.
18:58jbondesonyes
18:58hiredmanfutures just cut 3 lines of code from clojurebot
18:58jbondesonlast-in wins
18:58Chousukedefinitely a bug in proxy...
18:59ChousukeSomeone file an issue, please. it's 02:00 here soon and I must go to sleep.
18:59hiredmanclojurebot: bat signal is <reply>/summon Chouser
18:59clojurebotOk.
19:00hiredmanis the issue thing next? don't I need to go to mailing list first or something?
19:00hiredmanChousuke: I will assign it to me in my head and do something
19:01hiredman(e.g. assign it to someone else in the issue tracker)
19:06jbondesondamn, generate-proxy is certainly dense
19:12jbondesonfigured it out
19:12jbondesonThe proxy definition is wrong
19:12jbondesonyou have to write it like any other variable arity function
19:13durka42ah!
19:13durka42so it is a bug in future-call, not in proxy
19:13jbondeson(get ([] ...) ([one two] ...))
19:13jbondesoncorrect
19:13jbondesonproxy should probably blow on that
19:13durka42clojurebot: bat signal is also <reply>/summon rhickey
19:13clojurebotc'est bon!
19:14jbondesonthink i should drop that on the group?
19:14durka42yeah
19:14durka42or the issues page
19:14durka42it should be a simple fix to future-call
19:15jbondesoni'll throw it on the issues page.
19:15jbondesonlemme double check the patch first
19:18durka42i guess you can't implement a two-arg version of a method if the proxied class doesn't have one?
19:18jbondesoni believe so
19:18jbondesongenerate-proxy loops through all the supers and generates potential methods
19:18jbondesonyup that worked
19:19durka42you have a CA to submit patches?
19:19jbondesonyes
19:24clojurebotsvn rev 1261; fixed get overload in future-call
19:25jbondesonhaha
19:25jbondesonguess i'll just cancel that.
19:25durka42nice timing
19:34jbondesoni wonder if proxy shouldn't throw an error on that.
19:37jbondesonrhickey: would you accept a patch that would generate some sort of parser error when you try to have multiple methods of the same name?
19:37danlarkinjbondeson: it's a dynamic language! :)
19:38jbondesonbut it's technically not correct.
19:38jbondesoncurrently proxy is just taking the second method defined.
19:38jbondesonit's not DTRT
19:39rhickeyjbondeson: sure
19:42jbondesonrhickey: is there a more specific exception i should use, or would a straight Exception with a good description ok?
19:42rhickeyjbondeson: IllegalArgumentException
19:44jbondesonrhickey: will do, thanks
19:44Chouserrhickey: should I re-open the old issue for the IDeref print recursion, or open a new one? or you do you care?
19:45ayrnieu,(let [ag (agent nil)] (send ag inc) (Thread/sleep 1000) [1 2 ag])
19:45clojurebotAgent has errors
19:45rhickeyChouser: new, thanks
20:01iceyis there anyone here who can speak to the relative stability of 'weld', or the lack thereof?
20:02iceyor, more plainly; am I asking for heartache if I start using it for a live site?
20:07Chouser,(let [m1 (java.util.HashMap.) m2 (java.util.HashMap. {:m1 m1})] (.put m1 :m m2) m1)
20:07clojurebotEval-in-box threw an exception:java.lang.reflect.InvocationTargetException
20:07Chouser,(let [m1 (java.util.HashMap.) m2 (java.util.HashMap. {:m1 m1})] (.put m1 :m m2) (prn m1))
20:07clojurebotjava.lang.StackOverflowError
20:08hiredmanwell
20:08hiredmanI guess that is taken care of
20:09clojurebotsvn rev 1262; added per-defmulti hierarchies, patch from mb
20:14clojurebotsvn rev 1263; ~@x outside of syntax-quote yields: (unquote-splicing x), patch from mb
22:28AzmodanI was wondering if there was a roadmap for Clojure 1.0, I couldn't find one on the net.
22:28ChouserAzmodan: not that I know of.
22:29ChouserIt seems to me that Rich has specifically resisted any firm list of features for 1.0
22:29AzmodanAny idea what reaching 1.0 means?
22:29ChouserHe has suggested that the first release after Nov 2009 would be called 2.0, so perhaps we can assume 1.0 will be out before then.
22:30hiredmanhuh
22:31ChouserI think 1.0 will mean he's ready to fork a stable branch and port bug fixes to both branches. Anything more than that, I can't really say.
22:32dreishI would think it would mean no more breaking changes like regex syntax.
22:32dreishBut that's probably too firm.
22:33AzmodanIt's not *too* firm if 2.0 is less than a year after :)
22:33Chousersure, after 1.0 is released I would expect breaking changes would only happen in the dev branch.
22:33dreishThough that's only meaningful if there are two actively-maintained branches.
22:33dreishAs you described above.
22:38Chouserthe plan, I think, is for the major version number to indicate which year since Clojure's announcement.
22:38Chouserso 1.x for stable versions released between Nov 2008 and Nov 2009, 2.x until Nov 2010, etc.
22:39dreishInteresting theory.
22:39Chouserminor versions would just count up throughout the year
22:39dreishHe could go the �ber-Lisp route and number the versions like this:
22:40dreish,(dorun (map #(println %) (take 5 (iterate #(list '() (list %)) '()))))
22:40clojurebot() (() (())) (() ((() (())))) (() ((() ((() (())))))) (() ((() ((() ((() (()))))))))
22:40dreishA la http://en.wikipedia.org/wiki/Set-theoretic_definition_of_natural_numbers
22:41ayrnieu,(first (reverse (take 20 (iterate list '()))))
22:41clojurebot(((((((((((((((((((())))))))))))))))))))
22:42hiredmanwhy not just call last?
22:42Chouser,(nth (iterate list ()) 20)
22:42clojurebot((((((((((((((((((((()))))))))))))))))))))
22:42Chouserno need to quote ()
22:43dreishThat never seems right.