#clojure log - Apr 03 2010

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

0:12 technomancy: riddochc: leiningen doesn't impose any version of clojure on you except for using the "lein repl" task, which is a known bug

0:12 if you use nailgun or swank for your repls you won't have any issues

0:21 hugod: hey, did you have more stuff in swank-clojure you wanted me to look at?

0:34 brian__: noob question: how do I do 2 things on true condition, this throws error after executing : (if (true? true) ((prn "y") (prn "yy")))

0:40 tensorpudding: brian__: you can wrap it in a do

0:40 brian__: ok tp

0:40 lancepantz: according to this http://osdir.com/ml/clojure/2010-03/msg00001.html keywords can only be alphanumeric

0:41 but i can't find any examples in which using non-alphanumeric characters cause any problems

0:42 is that spec still true?

1:12 technomancy: lancepantz: generally things like that mean "using only alphanumeric characters for keyword names is guaranteed to be safe for future versions of clojure"

1:12 rather than "only alphas may be used"

1:13 lancepantz: i see

1:17 joshua-choi: ,(> Double/POSITIVE_INFINITY 0)

1:17 clojurebot: true

1:17 joshua-choi: Is Double/POSITIVE_INFINITY stored in a standard clojure.core or clojure.contrib var?

1:17 It is a useful value

1:20 tomoj: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html

1:20 oh

1:20 heh

1:20 I misunderstood the question

2:20 TakeV: Is there a way to define a struct that also has all the keys of another struct?

2:40 defn: hmm, i have a (def myref (ref {})) that i conj onto inside a dosync naturally -- i watch the count of items that go into the ref, and it goes up up up, and then drops back down to 0 and starts growing again -- this is not the intended behavior

2:40 i know that's vague -- but perhaps there is something about refs which i dont understand that might explain such behavior

2:42 Crowb4r: defn: do you ever actually sleep?

2:42 defn: Crowb4r: no, i dont believe so

2:42 Crowb4r: at least not explicitly

2:43 Crowb4r: i can show you some code

2:44 http://gist.github.com/354197

2:44 see: add-sexps

2:46 Crowb4r: hee hee conj sexp

2:46 defn: Crowb4r: i don't follow?

2:46 * Crowb4r gets head out of toilet

2:46 defn: ohhhhhhh ;)

2:47 (use 'clojure.contrib.dick-streams)

2:47 Crowb4r: LMAO

2:49 defn: So, I wonder what clears the ref

2:49 defn: me too! :)

2:49 something is...wrong

2:50 Crowb4r: What is walton anyways?

2:51 defn: http://github.com/defn/walton

2:51 Crowb4r: ohh that seems cool

2:52 defn: if i can get this part fixed it will be way cooler ;)

2:52 Crowb4r: That would be amazingly helpful.

2:52 defn: there'll be a web interface and an irc bot

2:52 fun fact: walton is indiana jones' middle name

2:52 Crowb4r: I'm trying to build an ircbot myself

2:53 defn: Crowb4r: i had a cool howto awhile back

2:54 a very simple irc bot

2:54 clojurebot is probably a great place to look but i havent started working on the bot yet

2:54 in fact -- in lieu of fixing this bug i am going to do that :)

2:55 Crowb4r: Hey, you might know this. How come in emacs I can only get autocomplete to work on clojure and clojure.contrib and not any of the other libs I have in the path?

2:56 defn: as in auto-complete-mode?

2:57 ohhh i see what you mean

2:57 in your .clj file or in the REPL

2:57 also, are you using fuzzy-completion with slime?

2:57 Crowb4r: probbably not

2:58 I fired up a swank session from lein

3:00 defn: hmm, Crowb4r im not sure :\

3:00 once you (use 'lib) it should let you complete

3:01 at least on the library part, then i throw a / at the end like clojure.contrib.duck-streams/[TAB]

3:01 to see its fns

3:01 Crowb4r: when I do C-c TAB, M-TAB or just TAB in the repl it only does those two libs.

3:03 tomoj: Crowb4r: are they available the repl?

3:03 in the repl I mean

3:04 Crowb4r: Yeah, I can call them, but I can't auto complete them

3:04 only what is in clojrue and clojure.contrib

3:05 tomoj: is one of those bound to slime-indent-and-complete-symbol?

3:05 or something like it?

3:06 Crowb4r: let me look

3:06 defn: weee -- simple irc client working

3:06 tomoj: defn: what's the UI?

3:06 Crowb4r: according to the cheatsheet not.

3:06 tomoj: Crowb4r: C-h k TAB

3:06 (and C-h k M-TAB, etc..)

3:07 defn: tomoj: my repl :)

3:07 tomoj: defn: ah, heh

3:07 I wish I could make curses tools with clojure

3:07 defn: hi

3:07 oops :)

3:07 tomoj: curses-style I mean

3:08 Crowb4r: "It is bound to ^C TAB, ⌥TAB, <menu-bar> <SLIME> <Complete Symbol>."

3:08 slime-complete-symbol

3:08 that is

3:09 defn: tomoj: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/

3:09 im starting with that to build a bot

3:09 Crowb4r: defn: I did that just a little bit, but was thinking of moving to pircbot the java lib

3:10 defn: more fun to roll something more hack-ish :)

3:10 Crowb4r: Ohh I agree

3:11 So, How would I set "slime-indent-and-complete-symbol" or "slime-fuzzy-complete-symbol"

3:11 ?

3:11 * Crowb4r is an emacs newb

3:12 defn: Crowb4r: fuzzy is nice and all, but i dont like it because it breaks my namespace completion

3:12 tomoj: Crowb4r: slime-complete-symbol should be enough

3:13 are you trying to complete the name of a function?

3:13 with or without a namespace?

3:13 also, did you use clojure-mode from elpa?

3:13 Crowb4r: I can call and use the other clojure libs, but I can't auto complete them.

3:14 I tried with both

3:14 tomoj: yes, then I tried from the git repo

3:14 tomoj: very odd

3:14 where'd you get slime?

3:15 Crowb4r: elpa

3:16 tomoj: me too

3:17 swank-clojure version?

3:17 I don't know if that matters, but..

3:17 Crowb4r: Could be something with aquamacs, but I figured that was trivial.

3:18 tomoj: hmm aquamacs

3:18 I have aquamacs in the other room, I can try there

3:18 (in a while)

3:18 Crowb4r: swank-clojure I've tried 1.1.0 and 1.2.0-SNAPSHOT

3:24 defn: i wonder what would happen if i just turned this ref into an agent

3:25 Crowb4r: It might work out better. seems like a hack though

3:29 defn: Crowb4r: yeah -- i need to step through this very slowlllyyy

3:29 Crowb4r: LOL, WTF! I just reinstalled all the packages from the elpa and it seems to be working

3:29 defn: Crowb4r: *shrug* :)

3:30 Crowb4r: just deleted the whole elpa folder except for package.el and reinstalled all my packaged and ta-da

3:30 packages*

3:30 3:30am--

3:42 tomoj: Crowb4r: weird

3:42 defn: I don't think using an agent is a hack

3:42 rich did it in ants.clj

3:42 with a running var to stop it

3:42 Crowb4r: tomoj: I was not suggesting agents are a hack

3:43 Just with his code it would be a hack in.

3:43 tomoj: oh, not that irc code?

3:43 Crowb4r: no

3:43 http://gist.github.com/354197

3:43 02:44 < defn> see: add-sexps

3:44 tomoj: ah

3:45 Crowb4r: So, Is clojure going to be even better when java 7 comes out?

3:45 defn: tomoj: what is your feeling about refs versus agents there?

3:45 (in that gist (specifically (add-sexps...)))

3:45 tomoj: I don't know, I don't understand the code yet

3:45 I don't see "(add-sexps" in the gist

3:45 defn: add-sexp..., sorry

3:46 line 106

3:47 tomoj: well, you could use assoc-in, for one thing, maybe?

3:47 ,(assoc-in {} [:good '(foo)] 3)

3:47 clojurebot: {:good {(foo) 3}}

3:47 Crowb4r: ,(doc assoc-in)

3:47 clojurebot: "([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."

3:48 tomoj: oh, wait

3:48 (:good *sexps*) isn't a map, is it

3:48 defn: no

3:49 tomoj: what is that, an alist?

3:49 ,(-> nil (conj ['(foo) 3]) (conj ['(bar) 4]) (conj ['(foo) 5]))

3:49 clojurebot: ([(foo) 5] [(bar) 4] [(foo) 3])

3:49 lithper2_: when i need to add a new .clj file to the classpath to be used, it seems like i have to restart swank. is this default behavior?

3:49 Crowb4r: Holy hell, that will be so useful for an assignment that I will have in a class in the next couple of months.

3:50 Assoc-in that is

3:50 tomoj: (alter _ update-in _ conj _) confuses me :)

3:50 lithper2_: to be specific, i create a project with swank-clojure-project.

3:51 tomoj: lithper2_: if you change the classpath, you need to restart the jvm

3:51 Crowb4r: lithper2_: Yes, because the JVM is static when started

3:51 the JVM classpath

3:51 tomoj: if you have src/ in the classpath, then you should be able to add files in there and use them without restarting

3:51 Crowb4r: You can however load a file in from the repl though

3:51 you keep beating me to it tomoj

3:52 tomoj: sorry :)

3:52 Crowb4r: heh, it's just funny

3:52 lithper2_: so loading as opposed to require-ing them is the way to go to avoid restarts.

3:53 tomoj: no

3:54 well, don't require them in the repl manually by typing (require '...), yeah

3:54 if you hit C-c C-k on a clojure file, it should be loaded

3:54 lithper2_: i was manually doing requires just to see what happens

3:54 tomoj: it will also load whatever files it depends on in the ns macro

3:55 yes, it's fine to manually require things, just a hassle

3:55 defn: tomoj: Crowb4r: do you guys have any fancy ways of automagically doing M-x slime-set-default-directory after the REPL has been loaded?

3:55 lithper2_: thanks for the tip.

3:55 Crowb4r: defn: nope

3:55 tomoj: defn: I don't even know what that does

3:55 defn: id like to automatically set slime-set-default-directory to the project root directory

3:55 Crowb4r: me = emacs newb

3:55 defn: tomoj: let's say you run M-x swank-clojure-project on your lein project...

3:56 tomoj: you have a logs/ directory in the root of the project dir

3:56 tomoj: unless you explicitly tell slime which directory you're in, you'll default to something like ~/

3:56 tomoj: when you C-x C-f, you mean?

3:56 that is interesting

3:56 I wonder if the default only matters when you're at the slime repl?

3:57 Crowb4r: defn: I usuall do a M-x cd and set my root to the project

3:57 tomoj: I use slime-connect so it would have to be extra magic

3:58 defn: why slime-connect? that just seems like extra work to me

3:58 i have to keep a repl open in a term

3:58 Crowb4r: however I've moved to slime-connect because it's just a hell of a lot easier to have multiple enviroments of clorue ready to go.

3:58 tomoj: I use screen

3:58 defn: never heard of it :P

3:58 tomoj: and I want the environment I use the repl in to be created by lein

3:59 because lein will create the environment the project will eventually run in

3:59 Crowb4r: lein swank

3:59 tomoj: yeah

4:00 defn: does the ":P" mean you're joking?

4:00 Crowb4r: just make sure swank-clojure is in the lib folder or in your :dev-depenencies of project.clj

4:00 I'm guessing that means he is joking

4:00 tomoj: I don't need swank-clojure, just lein-swank is enough

4:00 Crowb4r: tomoj: your right lein-swank

4:00 my bad

4:00 defn: tomoj: yeah of course

4:01 tomoj: good :)

4:01 sometimes I don't even need lein-swank

4:01 defn: i would lose myself without good ole gnu screen

4:01 tomoj: do you use emacs in a terminal then?

4:01 or are you a vim guy?

4:01 tomoj: no, emacs in gtk or whatever it is

4:01 Crowb4r: emacs-gtk

4:01 tomoj: but this group has emacs and a small terminal running screen at all times

4:02 Crowb4r: I use aquamacs mainly

4:02 tomoj: so yeah I have to switch to the terminal, cd, lein swank, go back to emacs

4:03 defn: how do I add values to the vector inside this map: {:good [], :bad []}

4:03 Crowb4r: I rebound the screen escape to C-space from C-a

4:03 tomoj: well, what do the values need to look like

4:04 currently it looks like they are added two at a time, the first being the sexp and the second being... the result of evaluation?

4:04 Crowb4r: I have a friend who writes a lot of bash and his escape is set to ` .... not a common key at all 0.o

4:04 just `

4:04 tomoj: Crowb4r: that doesn't sound like a bad idea

4:05 Crowb4r: the ` or C-space

4:05 tomoj: well, I meant C-SPC, but ` doesn't sound that bad either

4:05 except for me ` is $

4:05 clojure never uses $, does it?

4:06 Crowb4r: I rebound it because I want my C-a for working in my shell

4:06 tomoj: I don't think so

4:06 defn: Crowb4r: C-space breaks my marks though! :)

4:06 tomoj: ah yes, forgot about that

4:06 defn: i think there's one hotkey which was suggested because it's the only thing that emacs doesn't use

4:07 C-i or C-7 or something

4:07 Crowb4r: geeesh

4:07 C-i would break BASH

4:07 no, maybe not....

4:08 defn: so erm, sorry to bother about this but, how do you conj onto a vector inside a map? {:x [] :y []}

4:09 tomoj: defn: you're already doing it right

4:09 I mean, it works at least, doesn't it?

4:09 ,(update-in {:good []} [:good] conj 3)

4:09 clojurebot: {:good [3]}

4:09 defn: i was looking for "update-in"

4:10 sorry, being lazy

4:10 tomoj: I'm confused, I got that idea from your gist :)

4:11 Crowb4r: defn: I was going to tell you that the nice thing about a clojure irc bot is that it's ease of threading will not make it hang on something and miss it's ping and get disconnected.

4:11 defn: Crowb4r: yeah that is cool

4:11 Crowb4r: any suggestions for building a reader for this: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/

4:12 tomoj: send-off whenever you receive or send something?

4:13 Crowb4r: I found that out and about jumped out of my chair. My non-clojure friends thought I made something really complex and overkill due to on;y understanding C(insert variant here)

4:13 defn: ,(update-in {} [:good] conj "100")

4:13 clojurebot: {:good ("100")}

4:13 defn: is it possible to make sure that the value is a vector rather than a list?

4:14 tomoj: oh, I see

4:14 Crowb4r: tomoj: basicially whenever my bot did an eval on a new message it would thread on any keyword

4:14 tomoj: this seems related to the ensure-coll problem from a couple days ago

4:14 defn: tomoj: that's exactly what im thinking about

4:15 performance guarantees are nice :)

4:15 ,(update-in {:good []} [:good] conj "100")

4:15 clojurebot: {:good ["100"]}

4:15 defn: there we are

4:16 tomoj: so just define it with vectors, I guess?

4:16 Crowb4r: So, I know it's a lot of trivial things, so it's not going ot be super expensive to just thread everything and return it into a message.

4:17 makes it so when some jack-ass gives it a horrible query on a webservice it does not get hung-up.

4:18 Alright, I need a few hours of sleep, but I'm sure defn will be here still when I get up. :p

4:19 defn: Let me know how the irc bot goes. If I wor on mine I will just toss it on github for you to look at for some ideas if you want.

4:19 work*

4:20 defn: Crowb4r: we could work together

4:20 i made a repo: defn-bot

4:20 it's just a blank slate lein project

5:58 pd: is it possible to get the list of keys given at a struct's definition?

6:41 defn: pd: id imagine so, though I haven't tried it. :)

6:42 Borkdude: Can anyone guide me how to import this git project in Eclipse, build it and use the jar in a Counter Clockwise Eclipse project?

6:42 git://github.com/mattrepl/clojure-twitter.git

6:43 I have EGit installed

6:47 defn: pd: you could place some metadata on it

6:58 (defstruct #^{:keys [:my, :keys]} my-struct :my :keys)

6:58 although (meta #'my-struct) doesn't seem to show that metadata

6:59 Raynes: Kill it with fire.

6:59 defn: #^{:keys [:my, :keys]}

6:59 ,#^{:keys [:my, :keys]}

6:59 clojurebot: EOF while reading

7:00 defn: (defn #^{:tag String} shout [#^{:tag String s] (.toUpperCase s))

7:00 that's pretty neat

7:00 (defn #^{:tag String} shout [#^{:tag String} s] (.toUpperCase s))

7:00 Raynes: defn: Any progress on getclojure?

7:19 Borkdude: gtg

7:38 defn: Raynes: not really no -- im stuck on where the bug is ATM

7:38 Raynes: want to answer a question or two for me? :)

7:38 Raynes: defn: I want. So hurry. ;)

7:38 I can try. :p

7:38 tufflax: Hm, I'm using clojure box (emacs and stuff for windows), and I've read that I should be able to print the last stack trace with (.printStackTrace *e) but it just returns nil and doesn't print anything for me. What's wrong?

7:38 defn: this is actually fairly simple (i think)

7:39 (defn fib-seq [] ((fn rfib [a b] (cons a (lazy-seq (rfib b (+ a b))))) 1 2))

7:39 Raynes: tufflax: Doesn't appear to work for me either.

7:39 defn: Raynes: actually nevermind -- im just struggling to explain this to a friend

7:40 Raynes: :o

7:41 tufflax: Btw, I don't understand how (.printStackTrace *e) works, I mean there isn't a function called .printStackTrace in the user namespace right? I find this a little bit odd. :P

7:42 Raynes: defn: (defn fib-seq [] ((fn rfib [a b] (->> (+ a b) (rfib b) lazy-seq (cons a))) 1 2)) :D

7:42 defn: well played :)

7:42 tomoj: tufflax: it's a java method

7:43 Raynes: defn: I'm trying to make a habit of using the arrow forms. :D

7:44 tufflax: tomoj yes, I know. But doesn't the evaluator (or whatever) look up the first element of a list and try to call that as a function? And then what happens when .printstackTrace isn't in the user namespace?

7:44 tomoj: try this (.printStackTrace *e (java.io.PrintWriter. *out*))

7:45 the .foo form is special

7:45 Raynes: Works.

7:45 tufflax: ok... regular symbols can't start with .?

7:46 tomoj: they can, but you wouldn't be able to use them as functions, I suppose

7:46 tufflax: hm, ok. Well thank you!

7:46 tomoj: ,(letfn [(.foo [] 23)] (.foo))

7:46 clojurebot: java.lang.RuntimeException: java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)

7:46 tomoj: I dunno why .printStackTrace doesn't work without giving it a wrapped *out*

7:47 defn: actually Raynes, would you mind stepping through the fib-seq with me?

7:47 tomoj: actually, it must be using System.out

7:47 (.println System/out "foo")

7:47 this prints nothing

7:48 because *out* is some swank magic

7:49 using lein-swank for example, (.printStackTrace *e) prints to stdout where you ran lein swank

7:49 * tufflax listens but doesn't quite follow

7:49 tomoj: it's a java issue I guess

7:50 Raynes: defn: I don't think I'd be very helpful. I suck at explaining things.

7:50 :|

7:50 tomoj: when you are seeing output print into the repl, that's because you've got some magic happening that is telling clojure where to print

7:50 defn: Raynes: I think I can explain this by just walking through it, but he's pretty new and I don't want to overwhelm him

7:50 npoektop: hi! what does mean "Caused by: java.lang.IllegalStateException: -main already refers to: #'awesome.iCipher/-main in namespace: awesome.iCipher"?

7:51 Raynes: Break it apart into tiny pieces. Show what the individual pieces of code do.

7:51 * defn nods

7:51 defn: just going to do the old "step through this recursive thing step by step"

7:52 Raynes: I understand what the code does, but it would be difficult for me to explain it.

7:52 defn: *nod*

7:52 Raynes: Such are reasons why I don't intend to write a book about Clojure.

7:53 I'll leave that to chouser, with his slow ass MEAP of Joy.

7:53 (Not chouser and fogus who are slow, but Manning for not updating the MEAP)

7:54 defn: Raynes: the outer parens on: ((fn [x y]) 1 2), do those ecapsulate the output from rfib in a list, or is it for a reaosn like (function 1 2), the function must be first in the list?

7:54 Raynes: The function must be first in the list.

7:54 defn: thanks

7:55 Raynes: The inner parens are a call to fn, and the outer parens are a call to the anonymous fn defined by fn.

7:56 tomoj: I don't think the ->> helps

7:56 (cons a (lazy-seq (rfib b (+ a b))))

7:56 Raynes: tomoj: I doubt he is using that example. :)

7:56 I was just being snarky.

7:56 defn: i enjoy lots of snark

7:56 tomoj: oh, whoops

7:57 Raynes: The ->> example would be way too overwhelming to a new guy.

7:57 Explain that AFTER he has the function down.

7:57 ;P

7:57 defn: i put it in there for fun Raynes

7:57 at the end of my email :)

7:57 Raynes: Hehe.

7:58 tomoj: so (rfib 1 2) == (cons 1 (lazy-seq (rfib 2 3))) == (cons 1 (lazy-seq (cons 2 (lazy-seq (rfib 3 5))))) ...

8:00 I didn't know you could do it that way

8:00 I always do like (rfib 1 2) == (lazy-seq (cons 1 (rfib 2 3))) == (lazy-seq (cons 1 (lazy-seq (cons 2 (rfib 3 5))))) ...

8:01 defn: what is a being cons'd onto?

8:01 'a, that is

8:01 tomoj: 'a is not being cons'd

8:03 defn: it's funny im answering his question and now im lost

8:03 (cons a...) turns out to just be (cons 1 ...)

8:04 Raynes: (doc cons)

8:04 clojurebot: "([x seq]); Returns a new seq where x is the first element and seq is the rest."

8:04 Raynes: What's being cons'd, then? A coke can?

8:05 An invisible one with the 6 flags coupon on it?

8:05 six*

8:05 tomoj: We need halp. You can't drop bombs on us like that and then just run off.

8:05 defn: A new invisible coke can made of waffle with a 6 flags coupon underneath it?

8:05 Raynes: s_s

8:06 tomoj: Raynes: the value of a?

8:06 Raynes: ...

8:07 You just sa... Oh. 'a.

8:07 Never mind.

8:07 $eval 'a

8:07 Oh yeah, my bot isn't here. :|

8:07 ,'a

8:07 clojurebot: a

8:07 Raynes: :D

8:07 defn: i just added a tick mark to make it recognizable

8:07 tomoj: ah I see

8:07 defn: since it looked funny in that sentence

8:07 tomoj: I thought you were referring to the symbol

8:08 Raynes: tomoj: If this were stackoverflow, I'd be forced to vote you down. ;p

8:08 tomoj: yeah

8:08 Raynes: Don't scare me like that.

8:08 defn: so lazy-seq, when it executes it's body 3 times recursively gives us (cons 1 (2 3))

8:09 is that a nice way to explain it?

8:09 tomoj: well, no

8:10 (fib-seq) is (cons 1 (lazy-seq (rfib 2 3)))

8:10 when you ask for (rest (fib-seq)), that lazy-seq is evaluated

8:11 so (rest (fib-seq)) is (rfib 2 3) which is (cons 2 (lazy-seq (rfib 3 5)))

8:11 and so on

8:12 at every stage you have (cons <the current element> (lazy-seq <some code which computes the remaining elements>))

8:14 (that's what a cons cell is - an element and the rest of the elements in a tuple)

8:14 defn: had to re-read that a few times -- that makes a lot of sense now

8:14 thanks tomoj

8:17 chouser: a little pednatic correction -- (rest (fib-seq)) is actually just (lazy-seq (rfib 2 3)).

8:18 that is, 'rest' doesn't force that lazy-seq to execute.

8:18 'next' does, as does calling 'first' or 'rest' on the lazy-seq

8:19 sorry if that muddles things -- sometimes that detail isn't important so feel free to ignore me. :-)

8:20 tomoj: that means I can bind something to (rest (fib-seq)) without ever realizing a lazy-seq?

8:20 defn: chouser: quite alright -- but i am a bit confused on that point.

8:20 @tomoj my question exactly

8:21 tomoj: but if I bind something to (next (fib-seq)), the first lazy-seq will be realized?

8:21 defn: i thought calling rest would just make it run to infinity

8:21 tomoj: well, trying to print the result of calling rest

8:21 I didn't realize next and rest had this difference

8:22 or (first (rest (fib-seq)) would cause the lazy-seq to be executed, I guess?

8:23 defn: i think im just missing some terminology here

8:23 what does execute mean in this case?

8:24 because if i do (rest (fib-seq)) at my repl, it seems like it's executing lazy-seq to me

8:24 or is it only executing the stuff inside of the (lazy-seq (...))

8:24 * defn puzzles

8:27 tomoj: clojurebot: ping

8:27 clojurebot: PONG!

8:29 tomoj: ,(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated")))] (take 1 foo-seq))

8:29 clojurebot: (nil)

8:29 tomoj: ,(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated"))) bar (rest foo-seq)])

8:29 clojurebot: lazy-seq evaluated

8:29 tomoj: ,(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated"))) bar (rest foo-seq)] (take 1 bar))

8:29 clojurebot: (nil)

8:30 lazy-seq evaluated

8:30 tomoj: well, that didn't work at all

8:30 the first and second examples print once, the last prints twice

8:30 tufflax: Eh, I'm using clojure box, and I want to install a library so I can "require" it, does know anybody what I should do? Where should I put the downloaded library?

8:30 tomoj: you can bind bar to (rest foo-seq) and it still doesn't evaluate the second lazy-seq

8:30 because (rest foo-seq) IS just a LazySeq value, it won't evaluate until you ask for an element out of it

8:31 (or next or whatever)

8:31 I feel like "evaluate" is the wrong word

8:33 tufflax: typically you will want to get the jars in the lib/ directory

8:33 I don't know anything about clojurebox

8:33 tufflax: ok

8:33 tomoj: there's leiningen for this

8:34 but you may not want to bother learning it right now, if not try just dropping the jars in lib/

8:35 tufflax: ok, thanks

8:36 And what if they are just .clj files, do they go into lib too?

8:36 defn: lazy-seq's body is being

8:36 err oops

8:37 tufflax: ...apparently yes.

8:46 defn: tomoj: re:"evaluate" is the wrong word. Yeah, what you said makes sense... It's sort of like the potential for evaluation, "partial" evaluation?

8:51 tufflax: do you have leiningen?

8:51 tufflax: no

8:51 defn: highly recommended

8:51 tufflax: what do I need that for? :P

8:52 defn: dependencies, no more moving jars in lib/, just run a command and it is done for you

8:52 http://github.com/technomancy/leiningen

8:53 tufflax: Hm, I might look at it later, right now I don't feel I need it. I'm just reading "Programming Clojure" right now trying to learn the language :P

9:00 defn: tufflax: *nod* -- it makes things quite a bit easier when you want to toy with a library

9:01 heck, the programming clojure source might use lein now...

9:02 tufflax: Hm, how do I restart the REPL in slime/emacs/whatever? So that it forgets all defs?

9:28 defn: tufflax: you could just create a new one

9:29 tufflax: I found out that M-x slime-restart-inferior-lisp did it

9:29 defn: tufflax: you could also just switch namespaces arbitrarily

9:29 tufflax: hehe yeah

9:29 defn: (ns djsafkfdsakjfdjsk)

9:30 tufflax: i recommend using the elpa packages if you're new

9:30 tufflax: uhm, what's that

9:30 defn: tufflax: http://devinwalters.com/posts/24

9:33 tufflax: Hm, but im on windows, and I have alomst all that from clojure box

9:35 Or, wait, maybe i didnt understand what epla was

9:36 * defn nods -- it's just elisp

9:36 defn: if you have emacs you can use it

9:36 leiningen works for windows

9:43 chouser: it's tricky to work with lazy-seqs at the repl and avoid unintended forcing, because if the repl prints a seq, it'll force it.

9:44 ,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] xs)

9:44 clojurebot: (forced 1 2)

9:45 chouser: ,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] (first xs))

9:45 clojurebot: 1

9:45 chouser: ,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] (rest xs) :foo)

9:45 clojurebot: :foo

9:46 chouser: so there, we can call 'first' or 'rest' on that cons and (if we're careful not to print the result of rest) neither forces the lazy-seq

9:46 but calling 'next' instead of 'rest' *does* force it:

9:46 ,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] (next xs) :foo)

9:46 clojurebot: :foo

9:46 forced

9:49 tufflax: defn: I evaled the code on that ELPA page and got an error: could not find directory for package-0.9 :p

9:50 And now I'm lost :P

9:52 defn: tufflax: oof

9:52 tufflax: which emacs v?

9:52 tufflax: 23. something

9:52 defn: (ive never done this on windows so i cant guarantee anything)

9:53 tufflax: GNU Emacs (i386-mingw-nt5.1.2600)

9:56 defn: tufflax: checking into something...

9:56 tufflax: how did you eval the code?

9:57 tufflax: pasted it into a new buffer and chose "eval buffer" from the menu

9:57 if that's what you mean

9:58 It started downloading something but alas...

9:58 and i was in elisp mode of course

9:59 defn: that sounds like it should work, but just to be sure could you just restart emacs, paste that top sexp into emacs, and go to the end of the sexp and place your cursor exactly one character after the last )

9:59 tufflax: ok...

9:59 defn: and then hit C-j

10:00 so you'll likely just have a scratch buffer -- just paste it in there and hit C-j when your cursor is directly after the closing ) in the block

10:00 tufflax: is scrath elisp mode? :P

10:00 scratch*

10:01 defn: idk, your error just seems weird

10:01 i cant seem to find anything about it

10:02 tufflax: hm, now it doesnt do that, it seems to work :P

10:02 defn: your best bet would be to switch to another OS ;)

10:02 but anyway, let me know if you need anything else

10:02 tufflax: hehe yeah i tried, but my sound card wouldnt work on ubuntu and i play a lot of games :p

10:03 defn: tufflax: *shrug* -- clojure is clojure

10:03 tufflax: :)

10:03 defn: i just have found *nixes to be a lot more accommodating for the discerning emacs hacker

10:03 tufflax: Ok, so what cool packages can i get now to pimp my emacs

10:03 defn: well, it is an absolute must that you get paredit

10:03 tufflax: ok

10:03 defn: that is truly awesome

10:04 Raynes: Well, not everybody loves paredit.

10:04 LauJensen has deep German (or whatever he is) hatred for it.

10:04 defn: check out technomancy's emacs-starter-kit for a lot of really good emacs usability ideas, and cool package ideas: http://github.com/technomancy/emacs-starter-kit

10:04 Raynes: He hates it almost as much as he hates je...

10:04 Sorry, inappropriate. :|

10:05 defn: Raynes: je? like "I" in French?

10:05 Raynes: defn: Jew.

10:05 defn: oh, eighr

10:05 right*

10:05 Raynes: Whoa. How did the r end up at the end?

10:05 I'm not that talented.

10:06 defn: check your keyboard :)

10:06 tufflax: hm, when i type in paredit it says [no match]

10:06 defn: did you install the package via elpa?

10:07 if yes, you may need to (require 'paredit) in your .emacs or .emacs.d/init.e;l

10:07 tufflax: oh, maybe i must restart emacs first

10:07 defn: el*

10:07 oh yes, and that

10:09 tufflax: i have some stuff ill recommend...

10:09 tufflax: hehe sounds good

10:10 defn: (require 'cl) (require 'saveplace) (require 'ffap) (require 'uniquify) (require 'ansi-color) (require 'recentf)

10:10 you should have all of those

10:10 tufflax: should i get them all at the same time right now? :P

10:11 defn: things you'd need to go and get on your own: (require 'magit) (require 'yasnippet) (require 'tramp) (require 'color-theme) (require 'auto-complete-config)

10:11 tufflax: the ones above you can just add to your .emacs or .emacs.d/init.el and they are already available

10:11 tufflax: ok

10:12 defn: tufflax: http://gist.github.com/354513

10:12 that's my init.el

10:13 bsteuber: how can I call the type constructer from within the deftype definition?

10:14 (deftype Foo [x] IFoo (bar [] (Foo (inc x)) gives an error

10:16 tufflax: defn I used your init.el and when i started emacs i was supposed to select a file, and it said "dired"

10:16 defn: tufflax: you wont be able to just use my init.el

10:16 Raynes: bsteuber: Foo.

10:16 tufflax: oh

10:17 defn: tufflax: it is just a palette of ideas -- many of those things needed to be compiled from source, downloaded, or written in the case of the defn-* requires

10:17 bsteuber: Raynes: thx :)

10:17 defn: tufflax: google for emacs color theme

10:17 Raynes: http://www.reddit.com/r/programming/comments/bgbrr/webbased_emacs_colortheme_creator/

10:17 That thing is awesome.

10:17 More awesome than you can comprehend.

10:18 defn: yeah raynes

10:18 have you seen the other generator?

10:18 Raynes: No.

10:18 defn: http://inspiration.sweyla.com/code/

10:18 http://inspiration.sweyla.com/code/seed/891972/

10:18 i like that one

10:19 Raynes: Haha. You said seed.

10:19 I'm easily distracted this early in the morning, I suppose. ._.

10:19 defn: I'm easily distracted nearly every moment of my natural life.

10:20 Raynes: That generator is teh pwn

10:20 defn: yeah it generates some nice bright themes

10:20 Raynes: http://inspiration.sweyla.com/code/seed/712659/ That one is an eye bleeder

10:20 defn: http://inspiration.sweyla.com/code/seed/208256/

10:21 * defn likes that one a lot

10:23 underdev: black background, muted aqua colors, its like a code bonzai

10:24 .. tranquel

10:26 * defn downloads every possible seed

10:28 tufflax: defn what was supposed to happen with those cl, saveplace, ffap etc

10:28 defn: stuff ;)

10:28 google 'em

10:28 tufflax: hehe

10:34 underdev: Seriously?

10:34 oh, someone killed it

10:38 structured editing + sexps ... how did i ever code with it?

10:38 without*

10:40 tomoj: ..paredit? or what

10:40 underdev: oh yeah

10:41 the efficiency is... just amazing

11:23 tomoj: is there a way to conditionally splice a form into a syntax quoted list?

11:23 I mean, conditionally expand to (foo bar) or (foo bar baz)

11:23 without having to say "foo bar" twice

11:26 arbscht: tomoj: `(foo bar ~@(when condition `(baz)) ?

11:26 tomoj: oh, splicing, of course

11:26 I had just tried ~nil and gave up

11:27 ,`(foo ~@nil)

11:27 clojurebot: (sandbox/foo)

11:27 tomoj: thanks

11:32 ct__: (is (= 2 1) "equals") doesn't print 'equals' with (run-tests). Any idea why?

11:33 tomoj: anybody still out there interested in neural networks?

11:43 Fossi: hmm. seem you can't xml/parse some file, json-write and read-json it and work on it with zip-filters

11:57 ct__: VC requires binding *test-out* like this:(defn my-run-tests

11:57 []

11:57 (binding [*test-out* *out*] (run-tests)))

11:59 underdev: ` + ~ = teh hotness

11:59 so cool

12:00 oh, @~ ... sick

12:01 err ~@

12:02 i think i can implement a delimited version of tcl with macros and exception handling

12:02 single typing > dynamic typing in certain domains

12:26 dnolen: interesting conundrum. is it possible to define a deftype method that can be used with reduce?

13:02 chouser: deftype doesn't define methods, only implements them.

13:05 tomoj: but sure, why not?

13:06 it just needs to be a function of two args that returns an instance that also implements whatever interface

13:07 I guess you'll have to use #(.fun %) though?

13:08 dnolen: chouser: yes :). tomoj: well reduce fns need to be able to accept no arguments, right?

13:08 tomoj: ah, hm

13:09 licoresse: Is it not allowed to have destructuring in defmethod?

13:10 (defmethod paint-slot :normal [{:keys [g x y this slot-state layer index-i] :as p}] ....

13:11 tomoj: one problem I've had is wanting to define something like static methods for deftypes

13:12 really like haskell's typeclasses

13:12 and in this case the 0-ary is just a constant in the typeclass

13:13 but in clojure we can't call a static method the same way as the 2-ary nonstatic one :/

13:14 Crowb4r: i've never used haskell, how is HUGS?

13:14 tomoj: in java you specify the class explicitly, in haskell the type is inferred or explicitly specified

13:14 can clojure do something about this?

13:14 Crowb4r: I use ghc personally, but haven't really tried hugs

13:14 Crowb4r: well How is haskell in general

13:15 tomoj: I would say, awesome, but quite confusing, and syntax makes me said

13:15 s/said/sad/

13:16 Crowb4r: I see

13:16 underdev: yeah, i got through about a page of examples before i was like "uh.. no".

13:17 Crowb4r: So, I know this seems a little odd, but what does using java -server vs java -client gain you?

13:17 tomoj: extra memory for one thing

13:17 not sure what else really..

13:17 underdev: different optimizations for hotspot

13:18 hiredman: it kind of depends these days -client seems to be falling out of use

13:18 joshua-choi: I'm told that client's supposed to start up faster but server is generally faster over a long time

13:18 hiredman: used to be the vm you got with -client wasn't hotspot

13:18 Crowb4r: I wish the vm would just stay in a lower running background state after it was first called to lower the start-up time of the JVM

13:19 That is the only reason people think java is slow IMO

13:19 joshua-choi: Aye, it is the biggest reason

13:20 underdev: also waiting for applet to watch a from catch flies over their dialup

13:20 tomoj: could you like, write out a virgin JVM to disk and load it directly into memory to start a new one?

13:20 underdev: you never get a second chance to make a first impression

13:20 Crowb4r: Java 7 will hopfully change that since it's a major change of th JVM.

13:21 patrickdlogan: Crowb4r: IBM has been developing a jvm for their "project zero" that is fast to startup, has socket takeover, etc.. http://www.projectzero.org/sMash/1.0.x/docs/zero.devguide.doc/zero.management.zso/ZSOManagementExtensions.html

13:22 Crowb4r: I think it is commercial, but imagine clojure would run on it.

13:22 hugod: technomancy: compile-string branch ensures usage of file and line number when you C-c C-c defn's. It is a bit of a hack though, as it calls clojure.lang.Compiler/load directly. Otherwise the autodoc and hyperdoc branches could do with testing. hyperdoc links to clojure api web pages. autodoc is for slime-autodoc.

13:22 Crowb4r: Doesn't nail-gun speed it up as well?

13:22 * Crowb4r really does not understand nail-gun

13:22 patrickdlogan: Crowb4r: nailgun keeps a hot process running, so not the same as starting up a cold vm from scratch.

13:27 Crowb4r: patrickdlogan: So, you start nailgun, then write a nail that connects to that nailgun?

13:28 patrickdlogan: Crowb4r: yes, the jvm is up and running and has a protocol for small apps in other languages to initiate a service in the jvm.

13:28 candeller: hi, i am just reading through the programming clojure book and I came accross the ref chapter and I have a question regarding the validation of refs: http://ideone.com/etMtPntr <--- How does the ref get updated, when the validation function retuns false on the struct object?

13:37 LauJensen: Raynes: I'm danish, and no I dont hate paredit, its great for the kids :)

13:38 joshua-choi: candeller: This is why: validate-message-list needs a list, or a sequence.

13:38 (validate-message-list user) will be false because it is a struct, not a list.

13:39 user is an *element* of the list.

13:43 candeller: hmm, suppose I rewrite it that a body of a function is: (every? (fn [r] (:sender r) (:text r)) (seq arg-struct))

13:44 but it appears it would still return false? the collection would consist of [key value] pairs, so not every of them can respond to :text and :sender? Doh I dont know ;p

13:48 joshua-choi: candeller: Nope. The collection in the *ref* is a seq of chat structs.

13:48 tomoj: ,(every? #(not %) [])

13:48 clojurebot: true

13:49 hiredman: in the case of an empty collection every? may not even run

13:49 ,(every? #(/ % 1 0) [])

13:49 clojurebot: true

13:50 candeller: ok that explains why it returns true on an empty collection

13:50 tomoj: I guess candeller needs to check that every single message is OK?

13:50 or if you're always conj'ing, you only need to check the first element

13:51 joshua-choi: If you even want a list.

13:58 Raynes: LauJensen: Danish, German, it's all the same to me. ;)

14:07 Crowb4r: So, I got nailgun up, and it's fairly neat.

14:08 qbg: nailgun is neat, until you realize that there isn't much security.

14:09 Crowb4r: qbg: Yeah, but it still is a neat thing, just the total lack of security is a problem.

14:09 qbg: Doesn't slime/swank have similar security problems also?

14:09 Crowb4r: I don't know

14:10 Someone was asking for nailgun clojure bindings, now that I see how it works I might write those today.

14:10 As an easy project I could do, that as what was suggested.

14:10 qbg: I have my own script that launches clojure using nailgun

14:11 It can startup, and evaluate (System/exit 0) in 10 msec

14:12 The most painful part was determining if the nailgun server was already running

14:13 Crowb4r: That would maybe be a bit painful

14:14 qbg: I ended up just checking the return value of ng ng-stats

14:15 hiredman: I had a @reboot entry in the cron on my netbook to startup a nailgun server

14:19 qbg: If I can figure out how to get slime to use nailgun, that would be awesome

14:23 Crowb4r: qbg: I see that nailgun is not on clojars.org, is it in the maven repo?

14:23 so lein can find it?

14:24 qbg: There is lein-nailgun: http://clojars.org/lein-nailgun

14:24 Don't know what it does

14:24 Well, it says it runs a nailgun server, but I've never used it

14:29 ct__: ,(Long. 3)

14:29 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Long

14:29 ct__: ?

14:30 qbg: ,(Long. (long 3))

14:30 clojurebot: 3

14:30 ct__: weird

14:30 ,(class 3)

14:30 clojurebot: java.lang.Integer

14:31 ct__: ah

14:32 qbg: ty

14:33 qbg: ,(class (long 3))

14:33 clojurebot: java.lang.Long

14:35 Crowb4r: Well, I will put that dep in the project.clj later then

14:57 hiredman: syntax-quote being in the reader is kind of a drag

15:03 MrEvil: stupid question, why does: (println (* (range 1 101))) result in:java.lang.ClassCastException (NO_SOURCE_FILE:0)

15:03 hiredman: MrEvil: range returns a sequence of numbers

15:03 * takes numbers, not a sequence of numbers

15:04 ,(range 1 101)

15:04 clojurebot: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100)

15:04 MrEvil: oh, just realized that. thanks

15:09 qbg: The problem with nailgun: neither jline nor rlwrap seem to play well with it

15:10 hiredman: huh?

15:10 rlwrap has always worked with it for me

15:12 qbg: Strange, it works when I don't redirect the output of nailgun server...

15:15 rlb: I'm trying to make sure I understand commute. It sounds like its function may be run twice, once where it occurs, and then again at commit time. Is that right?

15:19 pd: ,(apply * (range 1 20))

15:19 clojurebot: 121645100408832000

15:19 chouser: rlb: yes

15:22 qbg: rlwrap works fine if I start the nailgun server in another bash which I redirect the output of in the main bash session

15:22 Strange.

15:23 rlb: chouser: ok, thx. Is it always run twice (if you know offhand)?

15:27 nm - at least in some tests here it is, and that's as much as I need to know for now.

16:03 arohner_: is there already a function for testing whether two floats are approximately equal?

16:08 LauJensen: arohner: like (< 0.0 (Math/abs (- 0.54 0.541)) 0.1) ?

16:09 arohner: LauJensen: exactly. thanks

16:09 nm

16:09 yes, like that

17:17 bmason: I'm looking for a maven repo for Cupboard so that I can include it in my lein dependencies

17:17 is there a quick way to search for maven repos?

17:20 stacktracer: Is there any way to pass a non-array primitive argument into a function defined in Clojure, without it being boxed?

17:20 can I do this with gen-class?

17:22 bmason: primitive argument like an Int?

17:22 qbg: IFns take Objects as arguments

17:25 LauJensen: stacktracer: sure, use macros :)

17:25 stacktracer: :)

17:25 LauJensen: And if you're unsure how, read this http://www.bestinclass.dk/index.php/2010/03/functional-fluid-dynamics-in-clojure/

17:27 stacktracer: dumb question: are macros 1st-class in clojure? can I pass around a macro the way I pass a function?

17:28 qbg: No

17:28 Borkdude: how do you use 'use' with :only outside of a ns

17:29 (use 'clojure.contrib.macro-utils ...)

17:29 qbg: (use 'namespace :only '(symbols))

17:30 Borkdude: I do this: (use 'clojure.contrib.macro-utils :only '(mexpand-all))

17:30 but I get: Unsupported option(s) supplied: :only (repl-1:87)

17:31 qbg: Sorry, (use ['clojure.contrib.macro-utils :only '(mexpand-all)])

17:31 Borkdude: ah tnx

17:32 stacktracer: in the :methods clause of a gen-class, can a method be specified to take primitive args?

17:32 arohner: Borkdude: another way is (use '[clojure.contrib.macro-utils :only (mexpand-all)])

17:33 quoting outside the vector means you don't need to quote inside it

17:33 Borkdude: ok tnx

17:33 arohner: stacktracer: probably, but I'm not sure

17:34 stacktracer: looks like yes

17:34 :methods [[blah [int] void]]

17:35 yay!

18:36 seths: Does anyone know of a really shiny version of the Clojure logo?

18:36 the ones I've found on clojure.org and google code are sort of small

18:40 small, upscaled gifs look bad in a presentation

18:44 underdev: we definitely need to ask Rich for a vector version

18:45 i vectorized the one the website for a background. It came out funky, sort of painterly, i loved it, but it didn't quite look the official version.

18:46 riches brother designed the logo, so there is hope :)

18:47 seths: it's a great logo, very creative. people chuckle when they realize "that's... not a peace sign..."

18:59 _ato: seths: there's both a larger version and a SVG here: http://groups.google.com/group/clojure/files

19:00 Clojure_300x300.png and Clojure.svg

19:01 seths: yay!

19:01 _ato: thank you!

19:02 underdev: cool!

19:42 cheezey: so i have a string and it follows some format for example ":%s...%s!" or something. i want to break that up into just (%s %s)... how would i do that :O

19:43 qbg: Regular expressions?

19:43 chouser: ,(re-seq #"%s" ":%s...%s!")

19:43 clojurebot: ("%s" "%s")

19:47 cheezey: well %s are arbitrary

19:48 underdev: are you doing xml?

19:48 cheezey: underdev: no, but i guess the same technique would could be applied there..

19:48 underdev: when i see %s..%s i think xml

19:48 do you know in advance what %s you are looking for?

19:49 cheezey: underdev: no but i know what it's surrounded by. so it's like reverse of re-seq.. i think?

19:49 underdev: is the string guarenteed to be seperated by spaces

19:49 chouser: ,(re-find #":(.*)\.\.\.(.*)!" "do you want:this like...this?!")

19:49 clojurebot: [":this like...this?!" "this like" "this?"]

19:50 cheezey: chouser: yeah! tahnks :P

19:50 i am bad at this >_>

19:52 seths: chouser: any news on new MEAP content?

19:56 bmason: anyone else using berkeleydb / cupboard that can clue me in on what to include in my lein project.clj?

19:58 Crowb4r: MEAP?

19:59 bmason: should I just compile the cupboard library into a jar and put that in my 'lib' directory?

19:59 seths: Crowb4r: sorry. MEAP = Manning Early Access Program. Chouser is a co-author of a neat new book from Manning called the Joy of Clojure.

20:00 Crowb4r: Ahhh

20:00 seths: Crowb4r: a few chapters have been released, eager for more :-)

20:01 Crowb4r: Speaking of books. I'm waiting for practical clojure to get released from apress

20:01 Seeing as I pre-ordered the print version

20:03 bmason: interesting

20:04 seths: the Apress website says May 2010

20:04 Crowb4r: THe first chapter of "Joy of Clojure" is pretty good

20:04 bmason: though I don't think he gets to be the *first* definitive reference :)

20:04 seths: bmason: I think that's still waiting to be written

20:04 bmason: his "what you'll learn section" all seems to have been covered by Stuart Holloway's book

20:05 Crowb4r: There is the "programming clojure" book that was released.

20:05 seths: things like Clojure in Clojure, cells, and such have to settle before a definitive guide has a good shot

20:05 bmason: aye

20:05 that's Stuart's

20:05 Crowb4r: yep

20:05 I bought that one as well.

20:05 bmason: yeah, this one looks good too though :)

20:05 seths: Crowb4r: Rich and Stu signed my copy of Programming Clojure :-)

20:06 bmason: awesome :)

20:07 Crowb4r: that is awesome

20:08 * Crowb4r goes to eat dinner.

20:08 Crowb4r: later

20:10 bmason: where would I find out about clojure conventions/presentations?

20:11 are there any coming up?

20:11 seths: bmason: one suggestion is following the Clojure Google Group

20:11 bmason: k

20:11 seths: user groups are popping up widely

20:12 that raises the question of whether a Clojure event was still being planned to coincide with Java One

20:12 bmason: I get email summaries from the google group, so I should see anything that pops up there :)

20:12 * Crowb4r wishes there was one in detroit

20:13 seths: Crowb4r: there's one in the State Down South

20:13 rhymes with "Nohio" :-)

20:14 bmason: I think Rich should tour like a rock band

20:14 evangelizing clojure wherever he goes

20:15 seths: personally I'd vote that Rich keep writing code

20:15 bmason: ah well :)

20:15 seths: all of us can spread the word

20:18 hiredman: ,(* 8 50)

20:18 clojurebot: 400

21:39 andrewlmurray: Hello

21:40 A quick question: if I have a namespace on my classpath and I want to dynamically require it at runtime (from a string lets say) and call a set function on it, is there a better way to do this than:

21:40 (defn call-foo-from-namespace [namespace-str]

21:40 (let [namespace-symbol (symbol namespace-str)]

21:40 (require namespace-symbol)

21:41 ((ns-resolve (find-ns namespace-symbol) 'foo)


21:41 (call-foo-from-namespace "some.random.namespace")

22:25 Crowb4r: emacs in a pure shell is sure a pita

22:26 qbg: Emacs works just for me from a shell

22:27 Crowb4r: I'm still a newb with it

22:27 so, it can be a little much

22:28 qbg: If you know how to bring up the menu, you should be good

22:28 maybe

22:29 Crowb4r: it helps I have a ref card printed out. :)

22:30 cemerick: Don't bring a menu to an emacs fight. ;-)

22:32 underdev: bash is telling me i don't have either a JAVA_HOME or CLASS_PATH set...

22:33 Crowb4r: So, put them in your bash profile

22:33 underdev: CLASSPATH i mean

22:33 cemerick: I was going to say...

22:33 Crowb4r: wow

22:33 underdev: so it's finding java based on the PATH, i assume

22:34 cemerick: Man, setting CLASSPATH in the shell. That takes me back.

22:34 Crowb4r: yep

22:34 underdev: maven docs are suggesting it

22:35 cemerick: underdev: link?

22:35 underdev: http://maven.apache.org/download.html

22:35 cemerick: heh

22:35 * cemerick hasn't run a build from the command line for real work in years

22:35 underdev: ide?

22:35 clojurebot: sicp videos is http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/

22:36 * qbg presents a public horror: http://github.com/qbg/gml

22:36 cemerick: underdev: OK, it's telling you to set JAVA_HOME if need be, but not classpath

22:36 underdev: NetBeans for a while now

22:36 underdev: cheater

22:36 cemerick: past ~2 years or os

22:36 you bet

22:36 * cemerick is lazy, except where he chooses to be pedantically rigorous

22:37 Crowb4r: cemerick: netbeans + enclojure are nice

22:37 cemerick: qbg: that's a road of pain you're going down :-)

22:37 good luck ;-)

22:38 Crowb4r: Oh yeah.

22:38 * underdev is trying to actually understand the underlying technologies i'm using... so long since i coded java...

22:38 cemerick: I've been hearing really good things about counterclockwise (the eclipse plugin), but I'm pretty hooked into NB in a couple of ways at the moment.

22:39 underdev: probably not worth the effort

22:39 cemerick: underdev: that's cool, but don't let that be a blocker on getting stuff done. Parallelize, and all that.

22:40 You absolutely will need to understand various parts of the JVM, but that comes with time.

22:40 It's a *big* world.

22:40 d2dchat: Sorry if this is a really noobish question but.. I'm trying to get jLine to work and I just want it to be included by default. I downloaded the jar and moved it to /System/Library/Java/Extensions/

22:40 which in OS X I think is included by default in the Java class path

22:41 so shouldn't it just work if I say java -cp clojure.jar clojure.main ?

22:41 qbg: No

22:41 You need to run clojure.main using jline

22:41 d2dchat: qbg: how?

22:41 qbg: jline.ConsoleRunner clojure.main

22:41 d2dchat: java -cp clojure.jar jline.ConsoleRunner clojure.main ?

22:42 qbg: yes

22:42 d2dchat: Exception in thread "main" java.lang.ClassNotFoundException: clojure.main

22:42 is there a way to figure out what the default class paths are in my java install?

22:42 is it CLASSPATH?

22:42 if so, that hasn't been set yet

22:43 cemerick: OS X rigs up an implicit classpath without the env variable

22:44 qbg: clojure.jar is in the current directory?

22:44 d2dchat: qbg: yes

22:45 java -cp clojure.jar clojure.main works

22:46 defn: hmm, i wonder how difficult it would be to autoindent functions given in a single line across several lines. ie; (reduce + (map #(+ 1 %) [1 2 3 4 5]))

22:47 qbg: d2dchat: What if you explicitly put jline on the classpath?

22:48 d2dchat: java -cp /System/Library/Java/Extensions/jline.jar:clojure.jar clojure.main jline.ConsoleRunner

22:48 Exception in thread "main" java.io.FileNotFoundException: jline.ConsoleRunner (No such file or directory)

22:48 hmm

22:49 it just doesn't like me

22:49 :)

22:49 oh wait

22:49 nope

22:49 the reverse does't work eitehr

22:49 java -cp /System/Library/Java/Extensions/jline.jar:clojure.jar jline.ConsoleRunner clojure.main

22:49 Exception in thread "main" java.lang.ClassNotFoundException: clojure.main

22:49 qbg: Are you sure the jar is "jline.jar"?

22:50 d2dchat: yes, I moved it there

22:50 ls /System/Library/Java/Extensions/ | grep jline

22:50 jline.jar

22:53 * qbg thinks java hates d2dchat

22:53 d2dchat: haha

22:53 clojure works fine independently

22:53 just would be nice to have the jline functionality

22:54 cemerick: is rlwrap an option?

22:54 (not that I use either)

22:54 d2dchat: java -cp /System/Library/Java/Extensions/jline.jar jline.ConsoleRunner gave me the help screen for jline

22:57 what's the rlwrap option?

23:00 heh I figured it out

23:00 cemerick: d2dchat: it's what jline attempts to replicate AFAIK: http://freshmeat.net/projects/rlwrap/

23:00 d2dchat: mismatched permissions

23:01 cemerick: oh, jline.jar needed to be in ~/Library/Java/Extensions?

23:01 d2dchat: I moved the jline file to the same directory as the clojure file

23:01 and now it works

23:05 hmm, well I moved it to ~/Library/Java/Extensions and tried to add that to the cp instead and

23:05 same error

23:05 Java hates me :(

23:20 underdev: HAHAHAHHAHAHAHAHAHHAAHA - all that to get this: The program 'mvn' is currently not installed. You can install it by typing:

23:20 sudo apt-get install maven2

23:20 that's awesome

23:26 d2dchat: ah wow http://clojars.org/ is cool

23:27 cemerick: yeah; it is just a maven repository underneath tho

23:44 * Crowb4r is pondering trying to maybe start-up a michigan clojure group

23:44 cemerick: That's a big state. :-)

23:45 Maybe the silverdome is big enough?

23:45 * cemerick wonders if he got the stadium name right

23:45 Crowb4r: cemerick: pretty much, but thats no where they play anymore

23:45 cemerick: oh?

23:46 Crowb4r: they main arena is ford field

23:47 cemerick: really...when did that happen?

23:47 Crowb4r: almost 10 years ago

23:47 cemerick: sheesh

23:47 I guess I internalized things from teh last time I was really following things

23:47 the past 10 years have been busy :-P

23:47 I always like that name, tho

Logging service provided by n01se.net