#clojure logs

2008-08-25

09:53scook0is there a function to test whether a given value is a list?
09:53scook0I see "vector?" and "map?", but no "list?"
09:56Chouseryou mean specifically a PersistentList, or any seq?
10:13scook0specifically a PersistentList, since it's part of a macro transformation
10:13scook0I'm trying to find the first subform that is a vector or list, where some of the intervening forms might be strings or maps
10:15Chouseryou probably want (instance? clojure.lang.IPersistentList x)
10:16scook0seems like that's the case
10:17scook0(I'm getting the impression that actual lists are something of a "second-tier" data structure in clojure)
10:17scook0most code seems to operate on vectors, or on arbitrary sequences
10:17Chouserclojure.contrib/list? is the same thing.
10:18Chouserscook0: perhaps, although of course code is made up mostly of lists.
10:18ChouserI suppose that's why writing macros is where you notice.
10:19scook0perhaps I should say that lists seem to be used to represent code much more often than they are used to represent data
10:19Chousercould be. In the same vein, maps are perhaps used more often for data than either lists or vectors are.
11:18ChouserIs there any way to get a list of Java classes in a package?
11:51ChouserAccording to ##java the answer is "no", at least not without opening up the .jar and digging through its contents.
11:58drewr:-/
11:58albinojat -tf ?
12:08Chouser(defmacro dofor [& body] `(dorun (for ~@body)))
12:08Chouserto replace doseq
13:04rhickeyhi all - I'm back from vacation, just working my way through the messages on the group...
13:15shooverwelcome back. it's good to have the enforcer around, answering questions with certainty :)
13:16shoover(I mean that in the good way)
13:16rhickeyshoover: that's my job :) Actually I'm really proud of the Clojure community and the dialogue that occurred in my absence.
13:41dloweis there a way to use closure to produce stand-alone jar files?
13:41dloweclojure :p
13:42dloweevery use-case I can find involves the repl
13:43Chouseryou can bundle the contents of clojure.jar along with your .clj files in your own .jar.
13:45dloweIs there a tree shaker or the possibility of one?
13:45dloweI ask because I'm really interested in using it for mobile development
13:46rhickeydlowe: I imagine there would be very little shaken out. I saw Clojure running on an iPhone the other day...
13:47roblallyYou can't have .. Apple don't provide a JVM for the iPhone and there's no other way to put software onto it than the App Store *grin*.
13:48dlowerhickey: I suspect the Powers That Be[tm] would look dimly on a compiler being embedded into the phone
13:50cemerickrhickey: welcome back :-)
13:50rhickeycemerick: thanks - I hope to get to your genclass/IFn issue today
13:51cemerickSure. By no means a showstopper -- more of a curiosity :-)
13:52cemerickrhickey: I remember you mentioning something about lock contention in JDK 5+ -- do know of any papers off the top of your head that compare and contrast JDK 5 and prior impls in that regard?
13:52cemerickI see a couple other people mentioning that (Goetz atm), but references seem to be sparse.
13:55rhickeycemerick: I don't know of any papers offhand. I'll be speaking at the JVM Language Summit in Sept, and hope to get some good info from the Sun folks, but, it is an implementation detail, and likely has a complex description as to what can be optimized when
14:25Chouserare leading underscores on private functions discouraged enough that they should be avoided in the wiki?
14:25rhickeyChouser: yes please
14:46Lau_of_DKEvening gents
14:47Lau_of_DKI've had a funny HD crash, wherein I lost all my code, applications, settings, the works. Now I cant get my emacs integration back on track.
14:47Lau_of_DKjava -cp clojure.jar clojure.lang.Repl works
14:47Lau_of_DK(defun clojure ()
14:47Lau_of_DK (interactive)
14:47Lau_of_DK ;;(setup-slime???)
14:47Lau_of_DK (setq slime-net-coding-system 'utf-8-unix)
14:47Lau_of_DK (setq inferior-lisp-program "/usr/lib/java/bin/java -cp ~/coding/lisp/clojure/clojure.jar clojure.lang.Repl")
14:47Lau_of_DK (require 'clojure-mode)
14:47Lau_of_DK (add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
14:47Lau_of_DK (require 'slime)
14:47Lau_of_DK (slime))
14:47Lau_of_DKthis doesn't
14:47Lau_of_DKanybody able to spot the bug?
14:50dlowewow. I had no idea there was a clojure swank.
14:50hoeckLau_of_DK: maybe the "~/coding/.." path, at least my xemacs doesnt expand that
14:51Lau_of_DKdlowe, its a bit tricky to set up, but worth it
14:51Lau_of_DKhoeck, when using full path, I get this:
14:51Lau_of_DKjava.lang.Exception: Unable to resolve symbol: progn in this context
14:51Lau_of_DKclojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:1: Unable to resolve symbol: progn in this context
14:51Lau_of_DKBut it does actually launch a Repl after that
14:51drewrdlowe: http://github.com/jochu/swank-clojure/tree/master
14:54hoeckLau_of_DK: progn comes from common lisp, maybe swank tries to load some foreign code
14:54Lau_of_DKhoeck, you might be right, I'm actually running SBCL on the same swank
14:56hoecki modified inferior-lisp-mode myself, and there where lots of commands wrapped in progn's which were executed at startup
15:00Lau_of_DKMy trouble is now, that I cant get the buffers to interact with the Repl
15:00Lau_of_DKIts like it cannot evaluate to it
15:01Lau_of_DK"no lisp sub-process"
15:05shooverDo you have a recent version of slime from CVS? I recently got swank-clojure working. My first problem was the java process never getting off the ground. Then I had another problem, which went away with slime from CVS.
15:07Lau_of_DKYes its brand new
15:08Lau_of_DKBut I can get it working, by manually doing M-x run-lisp once the Repl is active, so I guess Im just looking for a little bug in my init script
15:09shooverI don't see a (require 'swank-clojure) in there. That needs to be loaded before running (slime)
15:10Lau_of_DKuh, good lookin' shoover
15:13dloweHm. Looks like I can't use clojure for this project. There's a maximum of 200kb.
15:14rhickeydlowe: at least half of Clojure's jar is ASM, which I haven't tried to trim down very aggressively, but Clojure itself is over 200k of the jar.
15:25dloweIt's ok. You can't be all things to all people.
15:27dloweI'll probably end up writing my own bug-ridden, ad hoc, interpreted version of half of Clojure to try and get under the limit.
15:36drewr:-)
15:37drewrSince it can be greenspunned, Clojure is now an official language.
15:53Chouserdlowe: it might be interesting to start with just the classes you know you'll need and add the rest in as dependency demands.
15:53ChouserSurely a few hours exploration there might yield half a Clojure that's not bug-ridden or interpreted. :-)
15:54Chouseror if not, at least you'll have tried before you spend a week on your own version
15:55dloweChouser: I suspect it would take a few hours. Interpreted lisps are pretty easy to implement. Your point is well taken, though.
16:10Chouserdunno if this would help you at all, but it's a good excuse to bring up supers
16:11ChouserGreat for introspection at the repl: (supers (class {}))
16:21drewrChouser: I could have used that the other day.
16:23dlowe(supers (class "foo")) => java.lang.Exception: Unable to resolve symbol: supers in this context
16:24dloweIs there a (quit) equivalent?
16:25rhickeydlowe: (System/exit 0)
16:27dlowethanks
16:28Chouserdlowe: supers is pretty new -- you'll need a recent CVS version.
17:14Chousergak, I mean SVN. sheesh.
17:23rhickeyericthor: Is the only p[roblem with SMAP when it is load-file?