#clojure logs

2008-09-17

01:09Chouserow, my head: (->[i(range 10)](for i))
01:15arohnerChouser: uh, huh?
01:15arohnerwhat does that do?
01:43ChouserIt's the same as (for [i (range 10)] i)
01:44ChouserWhich is the same as (range 10)
01:44Chouserbut it sure looks scary, eh?
01:45arohneryeah
11:15parth_mHello. Does (import ..) have a * equivalent. E.g (import '(java.io *)) doesnt seem to work.
11:17rhickeyparth_m: no *, by design
11:17parth_mOk. Thanks.
13:08rhickeyinteresting diff, what's new in API docs: http://clojure.org/page/diff/api/38385322
13:19StartsWithKReturns the immediate superclass and direct interfaces of c, if any
13:19StartsWithKits missing a dot at the end.
13:20StartsWithKwhat software are you using for clojure.org?
13:20rhickeywikispaces
13:21achim_pvery cool. rhickey: congrats on the release!
13:21rhickeyachim_p: thanks
13:23StartsWithKrhickey: when using genclass with :main true, maybe there could be some switch to tell clojure to process command line arguments like it would when used with clojure.lang.Script
13:23achim_prhickey: do you generate these or convert them by hand?
13:24rhickeyStartsWithK: I don't see why
13:24achim_pthere are newlines missing before ":state" in gen-class
13:24rhickeyachim_p: I generate them from the in-source comments
13:26StartsWithKrhickey: now *command-line-args* are not populated with command line arguments
13:26achim_pthey were missing earlier. not that i mind much - just thought i'd mention it :)
13:27rhickeyachim_p: the trick is for me to remember to fix them while I'm in the file for a real change...
13:28rhickeyStartsWithK: It seems to me once you write main you can do whatever you want, whereas in a script there is no alternative to *command-line-args*
13:35achim_pbtw., regarding gen-class: there's no way to call super.anything() in an overridden method, is there?
13:37rhickeyachim_p: there is this trick - binding the method handler to nil, then re-invoking the method on this
13:42StartsWithKwill (Class.) be expanded to (clojure/new Class) and (.method Obj) to (clojure/. Obj (method))?
13:43StartsWithKi have this stupid idea about replacing standard . and new..
13:43rhickeyStartsWithK: I can't help you with that
13:46achim_prhickey: i'm not quite sure how to do that :) is there any example code on this somewhere? i scanned the obvious places ...
13:47rhickeysomething like: (defn Foo-method [this arg] (binding [Foo-method nil] (.method this arg)))
13:48achim_pah, i see. thanks a lot!
13:53StartsWithKi wasn't thinking about replacing . and new functionality, just to wrap them
13:53rhickeyStartsWithK: as special ops, that seems perilous
13:55StartsWithKthats why i still didn't to it, still thinking about thing that could go wrong
13:55rhickeyStartsWithK: what are you trying to achieve?
13:56StartsWithKfor now i have (setp obj :UseSomething true :FirstName "Kreso")
13:56StartsWithKso i woudl integrate that wiht doto
13:56StartsWithKthat wourks ok
13:56StartsWithKoh setp expands to (doto obj (setUseSomething tru) (setFirstName "kreso"))
13:57rhickeyStartsWithK: JavaBean property support might come to . at some point
13:57StartsWithKnext i would add multimethods patch and ctor, one would let me use (doto (object) (myMethod args))
13:58StartsWithKthis would let me not write wrappers to libs, just patch parts i would like to change
13:59StartsWithKlets say (doto (JMenuItem "&Exit [ctrl+x") :Enabled false (on :action-performed (fn [e] (bla))))
13:59StartsWithK* JMenuItem.
13:59StartsWithKso there would be my ctor, one that can read "&Exit [ctrl+x]" and patcheh method (on)
14:01StartsWithKso far (on) setp and similar can't be used with doto.. i just don't know how smart this would be
14:54ChouserIs that any better than using def to mutate global state?
14:58ChouserThe docs for descendants says it works on Java type inheritance. In practice it doesn't work on Java classes.
21:44gnuvince_How do I load the set library?
21:46rhickey_it's loaded automatically, called clojure.set
21:48gnuvince_Does that also import the union/difference/etc functions into the user namespace?
21:49Chouseryou can say (use 'clojure.set) to import all the names into your current namespace
21:50rhickey_no, just loads it, you can (refer 'clojure.set)
21:50Chouseroh, sorry.
21:50Chouser(ns user (:use clojure.set))
21:51Chouseror (ns user (:require [clojure.set :as set])) and then you can use set/union, set/select, etc.
21:53gnuvince_Ah
21:53gnuvince_I didn't know about the / syntax
21:54gnuvince_(clojure.set/union s1 s2)
21:54Chouserah, right.
21:55gnuvince_Is it syntactic sugar for a special form?
21:56ChouserI think that's the full syntax for a symbol -- symbols have an optional namespace part, and the name part
21:57gnuvince_OK.
21:57gnuvince_By the way, I just want to say that I find Clojure to be a *very* nice language.
22:03rhickey_gnuvince_: great!
22:05gnuvince_Hopefully I can try to convert my Python webcomic scraper to Clojure to try it with something a little more "real"
22:09ChouserI've done some scraping with tagsoup and zip-filter