#clojure logs

2008-03-02

09:36rhickey_Clojure TV! - http://clojure.blip.tv/
09:40arbschtoh nice
09:40arbschtadd that to the channel topic
11:06jonathan_is that one of your talks ... I think I found the one on reddit.
11:19rhickey_this is new, from a lunchtime think-tank I do with some friends, last Thursday
11:23arbschtI posted it to reddit a half hour ago
11:23arbschtmaybe he saw it just then
12:05rhickey_ah
12:33arbschtsweet, it's on the front page and getting some votes
12:44pjb3rhickey_: you there?
12:44rhickey_yup
12:44pjb3I've been watching your screencasts, they are awesome, very helpful
12:44rhickey_great, I hope to do more
12:45pjb3I see you are using Aquamacs, I have a quick question about getting that setup with clojure
12:45pjb3I see the instructions on the wiki
12:45pjb3So you have to put the clojure-mode.el in your load-path
12:46pjb3Is there a standard place people put that stuff, extra .el files you want to add to your load path?
12:46pjb3Obviously I'm not an emacs guy :)
12:46pjb3~/Library/Application Support/Aquamacs Emacs?
12:47rhickey_mine's in ~/Library/Preferences/Aquamacs
12:47rhickey_Emacs
12:49pjb3so is that already in the load-path, or do I need to modify Preferences.el to add that to the load-path?
12:49rhickey_that's automatic AFAIK
13:02pjb3so I think I got that working, when I open hello-world.clj
13:02pjb3which just has (println "Hello, World!") in it
13:02pjb3it is in Clojure mode
13:02pjb3but if I press C-x C-e
13:03pjb3it says Symbol's function definition is void: lisp-eval-last-sexp
13:03rhickey_do you have Clojure running in inferior-lisp? (C-c C-z)
13:05pjb3oh, no, now I do, the REPL comes up and it works
13:05rhickey_cool
13:05ericthorany possibility of seq supporting enumerations winding up in clojure libs? Rolling my own for now...not much to it.
13:05pjb3but if I press C-x C-e in the buffer, nothing happens in the REPL
13:06rhickey_yes, definitely, as you see, a 10 minute project
13:06rhickey_pjb3: I've never used C-x C-e, someone more experienced with emacs needs to chime in...
13:07pjb3how do I get it to evaluate the buffer in the REPL?
13:07pjb3Is is not C-x C-e?
13:08rhickey_I've done C-M-x to eval the current sexpr
13:09pjb3ah, thanks, I just found that from reading the wiki
13:09pjb3I see now
13:09pjb3C-M-x evals it
13:10rhickey_my emacs knowledge is pretty limited - using it for the first time for Clojure
13:10pjb3and then I can use C-c C-e to eval it again
13:10pjb3You've been doing lisp for a long time though, right? What editor have you used previously?
13:11rhickey_When I use Lispworks I use their IDE
13:11rhickey_For Java I use IntelliJ
13:12pjb3Yeah, I use Intellij for Java too
13:12pjb3ok, thanks for your help, now I can play along at home with the screencasts
13:13arbschtwith any luck, you'll be able to use slime with clojure in a couple of years :/
13:15rhickey_that would be fun
13:15arbschtby the way, generalized multimethods are awesome
13:16rhickey_I don't think too many people have grokked them yet
13:17arbschtI won't insist that I have, but it has made my life easier already
13:18arbschtthe swank backend CL code jumps through hoops to implement an interface/implementor system without using generic functions
13:18arbschtmuch easier with clojure multimethods
14:03rhickey_added destructuring to loop
14:04ericthorgreat!
14:05ericthorwhat about 'binding' ? :)
14:05rhickey_I don't think so - is there much need?
15:57pjb3is there a way in emacs clojure-mode to evaluate an entire buffer
15:59hoeck_pjb3: which clojure mode do you use?
15:59pjb3http://www.lysator.liu.se/~lenst/darcs/clojure-mode/clojure-mode.el
16:01hoeck_you could try 'm-x mark-whole-buffer'
16:01hoeck_and then 'c-c c-r' for 'lisp-eval-region'
16:02hoeck_if you do this more often, then you could write a function to do it
16:02arbscht(lisp-eval-region (point-min) (point-max))
16:03arbschtput that in a lambda and bind to the keychord of your choice
16:32pjb3how do you define a function in a separate namespace with that has the same name as a function in the clojure namespace?
16:32pjb3like (defn foo/find [] (1 2 3))
16:36hoeck_you can unmap the symbol from your namespace
16:36hoeck_like: (ns-unmap (find-ns 'user) 'find)
16:40pjb3will that allow you to refer to the regular find still?
16:41pjb3so you can do (find) or (my/find)
16:44pjb3user=> (create-ns 'my)
16:44pjb3user=> (defn my/find [] (1 2 3))
16:45pjb3clojure.lang.Compiler$CompilerException: REPL:6: Can't refer to qualified var that doesn't exist
16:48hoeck_it seems that you can't def vars in other namespaces
16:49arbschthrm, I forget: does the guy who maintains clojure-mode.el hang out here?
16:51hoeck_pjb3: you can refer to both finds through my/find and clojure/find
16:52pjb3how can you define my/find?
16:53hoeck_(create-ns 'my)
16:53hoeck_(in-ns 'my)
16:53hoeck_(clojure/refer 'clojure)
16:53hoeck_(defn find [] 'my-find)
16:54hoeck_(find) -> my-find
16:55hoeck_(clojure/find {:a 'a} :a) -> a
16:55pjb3(defn find[] 'my-find)
16:55pjb3throws an error
16:55pjb3Name conflict, can't def find because namespace: my refers to:# at
16:56hoeck_oh, sorry, forgot: (ns-unmap (find-ns 'my) 'find) after (clojure/refer 'clojure)
16:57pjb3oh, ok
16:58pjb3You do this too
16:58pjb3(clojure/refer 'clojure :exclude '(find))
17:13hoeck_yeah, thats a better way
17:41arbschtwoo, clojure-mode playing nicely with other multiple inferior-lisps
17:53hoeck_i'd like to have something like 'highlight-the-current-function' signature as in slime
17:54hoeck_but i think this is not possible with comint-mode
17:56arbschtyeah, I'm not trying to extend clojure-mode too much. I'd rather try implementing a swank backend in clojure and get slime itself
17:59hoeck_that would be really nice!
18:58rhickey_Part 2 of the screencast is live: http://blip.tv/file/707982