#clojure log - Mar 02 2008

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

9:36 rhickey_: Clojure TV! - http://clojure.blip.tv/

9:40 arbscht: oh nice

9:40 add that to the channel topic

11:03 * hoeck_ downloading sho

11:03 * hoeck_ downloading show

11:06 jonathan_: is that one of your talks ... I think I found the one on reddit.

11:19 rhickey_: this is new, from a lunchtime think-tank I do with some friends, last Thursday

11:23 arbscht: I posted it to reddit a half hour ago

11:23 maybe he saw it just then

12:05 rhickey_: ah

12:33 arbscht: sweet, it's on the front page and getting some votes

12:44 pjb3: rhickey_: you there?

12:44 rhickey_: yup

12:44 pjb3: I've been watching your screencasts, they are awesome, very helpful

12:44 rhickey_: great, I hope to do more

12:45 pjb3: I see you are using Aquamacs, I have a quick question about getting that setup with clojure

12:45 I see the instructions on the wiki

12:45 So you have to put the clojure-mode.el in your load-path

12:46 Is there a standard place people put that stuff, extra .el files you want to add to your load path?

12:46 Obviously I'm not an emacs guy :)

12:46 ~/Library/Application Support/Aquamacs Emacs?

12:47 rhickey_: mine's in ~/Library/Preferences/Aquamacs

12:47 Emacs

12:49 pjb3: so is that already in the load-path, or do I need to modify Preferences.el to add that to the load-path?

12:49 rhickey_: that's automatic AFAIK

13:02 pjb3: so I think I got that working, when I open hello-world.clj

13:02 which just has (println "Hello, World!") in it

13:02 it is in Clojure mode

13:02 but if I press C-x C-e

13:03 it says Symbol's function definition is void: lisp-eval-last-sexp

13:03 rhickey_: do you have Clojure running in inferior-lisp? (C-c C-z)

13:05 pjb3: oh, no, now I do, the REPL comes up and it works

13:05 rhickey_: cool

13:05 ericthor: any possibility of seq supporting enumerations winding up in clojure libs? Rolling my own for now...not much to it.

13:05 pjb3: but if I press C-x C-e in the buffer, nothing happens in the REPL

13:06 rhickey_: yes, definitely, as you see, a 10 minute project

13:06 pjb3: I've never used C-x C-e, someone more experienced with emacs needs to chime in...

13:07 pjb3: how do I get it to evaluate the buffer in the REPL?

13:07 Is is not C-x C-e?

13:08 rhickey_: I've done C-M-x to eval the current sexpr

13:09 pjb3: ah, thanks, I just found that from reading the wiki

13:09 I see now

13:09 C-M-x evals it

13:10 rhickey_: my emacs knowledge is pretty limited - using it for the first time for Clojure

13:10 pjb3: and then I can use C-c C-e to eval it again

13:10 You've been doing lisp for a long time though, right? What editor have you used previously?

13:11 rhickey_: When I use Lispworks I use their IDE

13:11 For Java I use IntelliJ

13:12 pjb3: Yeah, I use Intellij for Java too

13:12 ok, thanks for your help, now I can play along at home with the screencasts

13:13 arbscht: with any luck, you'll be able to use slime with clojure in a couple of years :/

13:15 rhickey_: that would be fun

13:15 arbscht: by the way, generalized multimethods are awesome

13:16 rhickey_: I don't think too many people have grokked them yet

13:17 arbscht: I won't insist that I have, but it has made my life easier already

13:18 the swank backend CL code jumps through hoops to implement an interface/implementor system without using generic functions

13:18 much easier with clojure multimethods

14:03 rhickey_: added destructuring to loop

14:04 ericthor: great!

14:05 what about 'binding' ? :)

14:05 rhickey_: I don't think so - is there much need?

15:57 pjb3: is there a way in emacs clojure-mode to evaluate an entire buffer

15:59 hoeck_: pjb3: which clojure mode do you use?

15:59 pjb3: http://www.lysator.liu.se/~lenst/darcs/clojure-mode/clojure-mode.el

16:01 hoeck_: you could try 'm-x mark-whole-buffer'

16:01 and then 'c-c c-r' for 'lisp-eval-region'

16:02 if you do this more often, then you could write a function to do it

16:02 arbscht: (lisp-eval-region (point-min) (point-max))

16:03 put that in a lambda and bind to the keychord of your choice

16:32 pjb3: how do you define a function in a separate namespace with that has the same name as a function in the clojure namespace?

16:32 like (defn foo/find [] (1 2 3))

16:36 hoeck_: you can unmap the symbol from your namespace

16:36 like: (ns-unmap (find-ns 'user) 'find)

16:40 pjb3: will that allow you to refer to the regular find still?

16:41 so you can do (find) or (my/find)

16:44 user=> (create-ns 'my)

16:44 user=> (defn my/find [] (1 2 3))

16:45 clojure.lang.Compiler$CompilerException: REPL:6: Can't refer to qualified var that doesn't exist

16:48 hoeck_: it seems that you can't def vars in other namespaces

16:49 arbscht: hrm, I forget: does the guy who maintains clojure-mode.el hang out here?

16:51 hoeck_: pjb3: you can refer to both finds through my/find and clojure/find

16:52 pjb3: how can you define my/find?

16:53 hoeck_: (create-ns 'my)

16:53 (in-ns 'my)

16:53 (clojure/refer 'clojure)

16:53 (defn find [] 'my-find)

16:54 (find) -> my-find

16:55 (clojure/find {:a 'a} :a) -> a

16:55 pjb3: (defn find[] 'my-find)

16:55 throws an error

16:55 Name conflict, can't def find because namespace: my refers to:# at

16:56 hoeck_: oh, sorry, forgot: (ns-unmap (find-ns 'my) 'find) after (clojure/refer 'clojure)

16:57 pjb3: oh, ok

16:58 You do this too

16:58 (clojure/refer 'clojure :exclude '(find))

17:13 hoeck_: yeah, thats a better way

17:41 arbscht: woo, clojure-mode playing nicely with other multiple inferior-lisps

17:53 hoeck_: i'd like to have something like 'highlight-the-current-function' signature as in slime

17:54 but i think this is not possible with comint-mode

17:56 arbscht: yeah, 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:59 hoeck_: that would be really nice!

18:58 rhickey_: Part 2 of the screencast is live: http://blip.tv/file/707982

Logging service provided by n01se.net