#clojure log - Jun 01 2008

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

4:05 jochu: Aw, I was hoping to catch Lau of DK lounging about to let him know the swank clojure bug he hit was fixed. Ah well.

4:50 jteo: is "do" documented anywhere?

5:11 arbscht: jteo: http://clojure.sourceforge.net/reference/special_forms.html

5:11 jteo: ah. sorrie for my blindness. :)

6:42 jacksmack: I've recently set up Emacs as my Clojure IDE, and it starts fine, but there's one problem. Everytime I hit SPACE in the REPL, it spawns an error "Unable to resolve symbol: user in this context" - Anybody know whats up with that ?

6:45 Lau_of_DK: I've recently set up Emacs as my Clojure IDE, and it starts fine, but there's one problem. Everytime I hit SPACE in the REPL, it spawns an error "Unable to resolve symbol: user in this context" - Anybody know whats up with that ?

7:17 come on boys - anybody?

7:59 I've recently set up Emacs as my Clojure IDE, and it starts fine, but there's one problem. Everytime I hit SPACE in the REPL, it spawns an error "Unable to resolve symbol: user in this context" - Anybody know whats up with that ?

8:14 fezzle: whoa, no idea man. i'm trying to use enlojure

8:16 Lau_of_DK: I just feel like emacs is quicker for small things. But ok, do you have any small examples of how to get started with enclojure?

8:21 fezzle, ?

8:22 Hey jgracin :)

8:22 jgracin: Hi Lau_of_DK! How's Slime? :-)

8:22 Lau_of_DK: Oh, so so :)

8:23 After you hit the sack last night, I managed to compile the package using mvn, so thats all good

8:23 jgracin: then everything must work perfectly. doesn't it? ;-)

8:23 Lau_of_DK: Now emacs connects to swank all fine, and it uses correct indentation and all that, so I can assume that advanced-clojure-mode is working. Secondly it does evaluate clojure code correctly, so I can write an run programs..

8:23 but... there's one little bug... :(

8:25 jgracin: what is it?

8:25 Lau_of_DK: when I'm in the REPL, and I type "user>(+ 2 2)", it evaluated to 4 like it should, but when I hit SPACE it pop an error everytime saying "unable to resolve symbol: user in this context"

8:25 so (+<SPACE>2<SPACE>2) means 2 errors, which is PRETTY annoying

8:27 jgracin: do you type that "user>" part as well? or you just type (+ 2 2)?

8:27 Lau_of_DK: just (+2 2), user is the default prompt, I havent touched it

8:28 jgracin: sorry for asking. :-)

8:28 Lau_of_DK: hehe

8:28 Like I said, I'm fairly good with Lisp, its Emacs that I'm super-noob with :)

8:29 jgracin: start by making sure you have the latest slime from CVS. And the latest swank-clojure.

8:29 Lau_of_DK: I know I have the lastest swank-clojure, but I can check the slime

8:30 yea Im also running the latest slime

8:31 but normally when you press SPACE, you'd get a function description at the bottom right? I assume thats what you get?

8:31 (brb, gotta take of the baby)

8:40 jgracin: bbl

8:41 Lau_of_DK: arg :(

14:33 jgracin: Lau, the instructions for checking out the latest SLIME version are on its home page (downloads link).

15:22 Lau_of_DK: jgracin, yea thanks, I've updated Slime now but the error persists. Its somehow connected to the SLDB.

15:24 YES

15:24 Is finally got it working

15:25 Praise God

15:26 jgracin: what did it?

15:27 Lau_of_DK: I just mailed the Googlegroup if youre a part of it. The wiki site has a script, which does everything except "run-lisp", so it connects through swank and all that, but it still hasnt executed that function

15:27 so solution: M-x run-lisp

15:27 Anyway jgracin, I never would have made it this far if it wasn't for all your help, so you get 25 stars in my book! :)

15:28 jgracin: no problem :-)

15:32 Lau_of_DK: Any emacs experts here? I have a binding for C-M-x which evalutes the function at the cursor - how do I changed this binding to C-c c ?

15:36 dabd: lau: get the bound function by C-h k which executes the describe key function

15:36 then you type C-M-x and Emacs will show you the bounf f

15:37 bound function

15:37 Lau_of_DK: (slime-reevaluate-defvar)

15:37 thats what M-C-x is

15:37 dabd, Im fishing for the syntax for emacs, how do I then make the binding for C + 2x c. or C-c c ?

15:38 dabd: then you associate the new binding with define-key

15:39 Lau_of_DK: (define-key slime-re-evaluate-defvar [C-c c] 'slime-re-evaluate-defvar)

15:39 would that work ?

15:39 dabd: (define-key <insert clojure mode map here> "C-c b" '<your function here>)

15:39 Lau_of_DK: clojure mode map?

15:42 dabd: try this (define-key clojure-mode-map "C-c c" 'lisp-eval-defun)

15:47 Lau_of_DK: Hmm, it says "C-c c" is undefined

15:47 oh.. it recognized it as C-cSPACEc

15:47 :)

15:48 dabd: Let me see

15:50 sorry it should be: (define-key clojure-mode-map "\C-cc" 'lisp-eval-defun)

15:51 Lau_of_DK: sweet, lemme try

15:52 Yes sir, its working - Thanks alot

15:52 dabd: you can put that definition in your .emacs

15:52 no problem

15:53 jgracin: Lau_of_DK: I really think you should do yourself a favor and at least skim (if not read) through the first 200 (PDF) pages of GNU Emacs Manual. Trades a lot of frustration for a lot of fun.

15:54 Lau_of_DK: jgracin, Ok, I'll try to get through it, but only because its you who's asking :)

15:54 jgracin: :-)

15:56 trust me. It is very difficult to learn how to use Emacs by guessing and asking on chat. But reading that manual will give you a real boost.

15:58 Lau_of_DK: Alright, but first things first. I have to let off a few bullets in Clojure, if this is half as good as I think it is, its going to be my "home sweet home" in the land of languages :)

16:00 jgracin: That's exactly how I feel about Clojure. A Lisp which is at the same time more clean and more practical/pragmatic then other Lisps.

16:01 Lau_of_DK: and more portable, and sports huge libraries and has immutable persistant datastructures - its really a dream come true

16:09 before I hit the manual though - Is there anyway I can trade with insanely ugly font that emacs defaults to, to something like Bitstream Vera Sans ?

16:11 rhickey: Lau_of_DK: that's a bit off topic

16:11 Lau_of_DK: rhickey, sure, but since nobody else is busy debating something clojure related, I figured we had the time

16:12 rhickey: actually it's a bit distracting

16:12 Lau_of_DK: k, sorry, I'll hit the manual :)

16:18 jgracin: why am I getting "No matching method: addURL" when I eval: (. DynamicClassLoader (addURL (new URL "something")))

16:21 rhickey: it's an instance method, not static. Anything wrong with add-classpath ?

16:23 jgracin: silly me. thanks.

16:23 rhickey: np

16:24 Lau_of_DK: The "Context Free Art" example from the Wiki wont run by itself and the comments state that some libraries need to be compiled independant - Is there an exact guide to where I can find these libs, how I compile/include them in the project anywhere?

16:29 rhickey: math stuff shaping up:

16:29 This Java:

16:29 static public float[] vmul(float[] x, float[] ys){

16:29 final float[] xs = x.clone();

16:29 for(int i = 0; i < xs.length; i++)

16:29 xs[i] *= ys[i];

16:29 return xs;

16:29 }

16:29 this Clojure:

16:29 (defn amul [#^floats xs #^floats ys]

16:29 (amap xs i ret

16:29 (* (aget ret i) (aget ys i))))

16:29 Same exact speed

16:30 This Java:

16:30 static public float vsum(float[] xs){

16:30 float ret = 0;

16:30 for(int i = 0; i < xs.length; i++)

16:30 ret += xs[i];

16:30 return ret;

16:30 }

16:30 This Clojure:

16:30 (defn asum [#^floats xs]

16:30 (areduce xs i ret (float 0)

16:30 (+ ret (aget xs i))))

16:30 same exact speed

17:02 albino: rhickey: nice

17:03 rhickey: it's built on a new ability of let-vars to hold primitives directly

17:57 Lau_of_DK: The "Context Free Art" example from the Wiki wont run by itself and the comments state that some libraries need to be compiled independant - Is there an exact guide to where I can find these libs, how I compile/include them in the project anywhere?

17:57 (asking as one who is using Java for the first time)

18:55 rhickey: new primitives support is up

18:56 tire-kickers welcome, lots of changes under the hood

Logging service provided by n01se.net