#clojure logs

2008-05-05

01:14jteoChouser: ;)
06:52bubblegumtatedoes anyone know why emacs would fail to run clojure as an inferior lisp? I set inferior-lisp-program to "java -cp ~/src/Clojure/clojure.jar clojure.lang.Repl" which runs clojure fine from the shell. It even works from the shell within emacs. When I try M-x run-lisp I get "NoClassDefFoundError"
06:57bubblegumtateoh good one... ignore that, I checked the groups and found the answer
09:56akingwow.. I just 'got' agents - cool :) now the ants demo makes sense. That's a topic that needs a tutorial..
09:59Chouserthe ants demo isn't a tutorial?
09:59rhickey:)
09:59akingheh - it's almost - though some hand waving about agents in it - the *agent* kept throwing me off
09:59akingnow to get erlang's jinterface working so I can talk tot he server..
10:00rhickeyaking: true, *agent* is not documented yet
10:00rhickeyaking: you've got an Erlang server?
10:01akingrhickey: yup - going to try writing a gui server monitor in clojure
10:01akingShould be a good starter project
10:02rhickeycool! A generic Clojure-jinterface interface would be very welcome
10:02rhickeye.g. the marshalling
10:02akingThat's something I was planning on.. we'll see how far it goes.
10:03akingAs for agents, once I started thinking of them as similar to an erlang's 'process', then it made more sense (immutable state and all)
10:04rhickeyaking: just be careful, the analogy only goes so far
10:04akingrhickey: agreed - though it help get over the hump in understanding.
10:05rhickeyyes, they are most similar in the problem they solve, less so in how they work
10:07akingyup - erlang's functions in the process module working on it's state vs. clojure's functions *applied* independently and asynchronously to state
10:07rhickeyyou've got it
10:22Chouserrhickey: oh, fwiw, I used gen-and-load-class successfully last night.
10:23rhickeygreat - any issues?
10:23ChouserActually, I had a lot of trouble getting it to work.
10:23Chouser...until I realized I had fetched the latest .clj's, but hadn't rebuilt the Java.
10:23rhickeywhat kind of trouble?
10:24rhickeyoh :)
10:24ChouserRight. So then it worked perfectly.
10:25ChouserI did find it a bit tricky to set up the class's namespace correctly, to include the clojure functions I needed without getting conflicts.
10:26rhickeyusing :exclude/:only/:rename?
10:26Chouserright.
10:26rhickeywhat were you extending?
10:27ChouserIt took me a while to figure out that where the conflict error was coming from. Once I did, adding the necessarly :excludes wasn't particularly hard.
10:28Chouserjavax.swing.text.Document -- I'm working on a patch for enclojure's REPL.
10:28Chouserdid you consider using a map instead of a namespace?
10:28rhickeyso Document had function names conflicting with Clojure's?
10:28Chouseroh, you want it to be mutable, don't you..
10:29ChouserDocument has a "replace" method
10:29rhickeyChouser: yes, you end up with Java classes that you can incrementally develop/fix at runtime
10:29rhickeyI had considered some method- prefix
10:29rhickeyor suffix
10:30rhickeye.g. would be replace-method
10:30Chouseryeah, can't say that feels right either.
10:31rhickeyname injection is always tricky
10:31Chouserthis is certainly sufficient. namespaces have all the tools you need for disambiguation.
10:31rhickeythat's where I ended up, but need to see how tedious in practice...
10:32Chouserpython handles cases like this by having more than one place where a name is looked up.
10:32ChouserSomething like where "def" only modifies the top-most namespace, but lookups fall back to other namespaces.
10:33rhickeywouldn't be a good fit with Clojure's compilation model
10:33rhickeyClojure calls have no runtime lookup
10:33Chouserok.
10:45Chouser(defmacro super [methname instance & args] `(binding [~methname nil] (. ~instance ~methname ~@args)))
10:46ChouserI guess that kind of thing would be trickier if the methods were in a map instead of a namespace.
10:59Chouseroh, and here's a fun detail: I know I want to extend Document, but it's abstract and I'm not sure what concrete type is actually being used. so I did:
10:59Chouser(gen-and-load-class "chouser.ReplDoc" :extends (class (.getDocument e)))
11:00Chouser...whwere e is the JEditorPane that someone else has set up.
11:23cgrandMinor trouble using gen-and-save-class: it doesn't create directories before writing the class to disk. I added (when-let dir (.getParentFile file) (.mkdirs dir)) to gen-and-save-class. BTW gen-and-save-class is refered to as "gen-and-store-class" in the docstring of gen-class.
11:30rhickeycgrand: I had added the 'directories must already exist' proviso to the docs, considering auto-create, will fix reference to store
11:31rhickeycgrand: the servlets turn into practically nothing to do
11:33cgrandrhickey: sorry
11:34rhickeycgrand: ?
11:34cgrandfor reporting something you documented
11:34rhickeynp!