#clojure log - Aug 25 2008

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

9:53 scook0: is there a function to test whether a given value is a list?

9:53 I see "vector?" and "map?", but no "list?"

9:56 Chouser: you mean specifically a PersistentList, or any seq?

10:13 scook0: specifically a PersistentList, since it's part of a macro transformation

10:13 I'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:15 Chouser: you probably want (instance? clojure.lang.IPersistentList x)

10:16 scook0: seems like that's the case

10:17 (I'm getting the impression that actual lists are something of a "second-tier" data structure in clojure)

10:17 most code seems to operate on vectors, or on arbitrary sequences

10:17 Chouser: clojure.contrib/list? is the same thing.

10:18 scook0: perhaps, although of course code is made up mostly of lists.

10:18 I suppose that's why writing macros is where you notice.

10:19 scook0: perhaps I should say that lists seem to be used to represent code much more often than they are used to represent data

10:19 Chouser: could be. In the same vein, maps are perhaps used more often for data than either lists or vectors are.

11:18 Is there any way to get a list of Java classes in a package?

11:51 According to ##java the answer is "no", at least not without opening up the .jar and digging through its contents.

11:58 drewr: :-/

11:58 albino: jat -tf ?

12:08 Chouser: (defmacro dofor [& body] `(dorun (for ~@body)))

12:08 to replace doseq

13:04 rhickey: hi all - I'm back from vacation, just working my way through the messages on the group...

13:15 shoover: welcome back. it's good to have the enforcer around, answering questions with certainty :)

13:16 (I mean that in the good way)

13:16 rhickey: shoover: that's my job :) Actually I'm really proud of the Clojure community and the dialogue that occurred in my absence.

13:41 dlowe: is there a way to use closure to produce stand-alone jar files?

13:41 clojure :p

13:42 every use-case I can find involves the repl

13:43 Chouser: you can bundle the contents of clojure.jar along with your .clj files in your own .jar.

13:45 dlowe: Is there a tree shaker or the possibility of one?

13:45 I ask because I'm really interested in using it for mobile development

13:46 rhickey: dlowe: I imagine there would be very little shaken out. I saw Clojure running on an iPhone the other day...

13:47 roblally: You 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:48 dlowe: rhickey: I suspect the Powers That Be[tm] would look dimly on a compiler being embedded into the phone

13:48 * rhickey has no comment

13:50 cemerick: rhickey: welcome back :-)

13:50 rhickey: cemerick: thanks - I hope to get to your genclass/IFn issue today

13:51 cemerick: Sure. By no means a showstopper -- more of a curiosity :-)

13:52 rhickey: 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:52 I see a couple other people mentioning that (Goetz atm), but references seem to be sparse.

13:55 rhickey: cemerick: 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:25 Chouser: are leading underscores on private functions discouraged enough that they should be avoided in the wiki?

14:25 rhickey: Chouser: yes please

14:46 Lau_of_DK: Evening gents

14:47 I'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:47 java -cp clojure.jar clojure.lang.Repl works

14:47 (defun clojure ()

14:47 (interactive)

14:47 ;;(setup-slime???)

14:47 (setq slime-net-coding-system 'utf-8-unix)

14:47 (setq inferior-lisp-program "/usr/lib/java/bin/java -cp ~/coding/lisp/clojure/clojure.jar clojure.lang.Repl")

14:47 (require 'clojure-mode)

14:47 (add-hook 'lisp-mode-hook (lambda () (slime-mode t)))

14:47 (require 'slime)

14:47 (slime))

14:47 this doesn't

14:47 anybody able to spot the bug?

14:50 dlowe: wow. I had no idea there was a clojure swank.

14:50 hoeck: Lau_of_DK: maybe the "~/coding/.." path, at least my xemacs doesnt expand that

14:51 Lau_of_DK: dlowe, its a bit tricky to set up, but worth it

14:51 hoeck, when using full path, I get this:

14:51 java.lang.Exception: Unable to resolve symbol: progn in this context

14:51 clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:1: Unable to resolve symbol: progn in this context

14:51 But it does actually launch a Repl after that

14:51 drewr: dlowe: http://github.com/jochu/swank-clojure/tree/master

14:54 hoeck: Lau_of_DK: progn comes from common lisp, maybe swank tries to load some foreign code

14:54 Lau_of_DK: hoeck, you might be right, I'm actually running SBCL on the same swank

14:56 hoeck: i modified inferior-lisp-mode myself, and there where lots of commands wrapped in progn's which were executed at startup

15:00 Lau_of_DK: My trouble is now, that I cant get the buffers to interact with the Repl

15:00 Its like it cannot evaluate to it

15:01 "no lisp sub-process"

15:05 shoover: Do 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:07 Lau_of_DK: Yes its brand new

15:08 But 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:09 shoover: I don't see a (require 'swank-clojure) in there. That needs to be loaded before running (slime)

15:10 Lau_of_DK: uh, good lookin' shoover

15:13 dlowe: Hm. Looks like I can't use clojure for this project. There's a maximum of 200kb.

15:14 rhickey: dlowe: 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:25 dlowe: It's ok. You can't be all things to all people.

15:27 I'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:36 drewr: :-)

15:37 Since it can be greenspunned, Clojure is now an official language.

15:53 Chouser: dlowe: it might be interesting to start with just the classes you know you'll need and add the rest in as dependency demands.

15:53 Surely a few hours exploration there might yield half a Clojure that's not bug-ridden or interpreted. :-)

15:54 or if not, at least you'll have tried before you spend a week on your own version

15:55 dlowe: Chouser: I suspect it would take a few hours. Interpreted lisps are pretty easy to implement. Your point is well taken, though.

16:10 Chouser: dunno if this would help you at all, but it's a good excuse to bring up supers

16:11 Great for introspection at the repl: (supers (class {}))

16:21 drewr: Chouser: I could have used that the other day.

16:23 dlowe: (supers (class "foo")) => java.lang.Exception: Unable to resolve symbol: supers in this context

16:24 Is there a (quit) equivalent?

16:25 rhickey: dlowe: (System/exit 0)

16:27 dlowe: thanks

16:28 Chouser: dlowe: supers is pretty new -- you'll need a recent CVS version.

17:14 gak, I mean SVN. sheesh.

17:23 rhickey: ericthor: Is the only p[roblem with SMAP when it is load-file?

Logging service provided by n01se.net