#clojure logs

2010-04-03

00:12technomancyriddochc: leiningen doesn't impose any version of clojure on you except for using the "lein repl" task, which is a known bug
00:12technomancyif you use nailgun or swank for your repls you won't have any issues
00:21technomancyhugod: hey, did you have more stuff in swank-clojure you wanted me to look at?
00:34brian__noob question: how do I do 2 things on true condition, this throws error after executing : (if (true? true) ((prn "y") (prn "yy")))
00:40tensorpuddingbrian__: you can wrap it in a do
00:40brian__ok tp
00:40lancepantzaccording to this http://osdir.com/ml/clojure/2010-03/msg00001.html keywords can only be alphanumeric
00:41lancepantzbut i can't find any examples in which using non-alphanumeric characters cause any problems
00:42lancepantzis that spec still true?
01:12technomancylancepantz: generally things like that mean "using only alphanumeric characters for keyword names is guaranteed to be safe for future versions of clojure"
01:12technomancyrather than "only alphas may be used"
01:13lancepantzi see
01:17joshua-choi,(> Double/POSITIVE_INFINITY 0)
01:17clojurebottrue
01:17joshua-choiIs Double/POSITIVE_INFINITY stored in a standard clojure.core or clojure.contrib var?
01:17joshua-choiIt is a useful value
01:20tomojhttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html
01:20tomojoh
01:20tomojheh
01:20tomojI misunderstood the question
02:20TakeVIs there a way to define a struct that also has all the keys of another struct?
02:40defnhmm, 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
02:40defni know that's vague -- but perhaps there is something about refs which i dont understand that might explain such behavior
02:42Crowb4rdefn: do you ever actually sleep?
02:42defnCrowb4r: no, i dont believe so
02:42defnCrowb4r: at least not explicitly
02:43defnCrowb4r: i can show you some code
02:44defnhttp://gist.github.com/354197
02:44defnsee: add-sexps
02:46Crowb4rhee hee conj sexp
02:46defnCrowb4r: i don't follow?
02:46defnohhhhhhh ;)
02:47defn(use 'clojure.contrib.dick-streams)
02:47Crowb4rLMAO
02:49Crowb4rdefn: So, I wonder what clears the ref
02:49defnme too! :)
02:49defnsomething is...wrong
02:50Crowb4rWhat is walton anyways?
02:51defnhttp://github.com/defn/walton
02:51Crowb4rohh that seems cool
02:52defnif i can get this part fixed it will be way cooler ;)
02:52Crowb4rThat would be amazingly helpful.
02:52defnthere'll be a web interface and an irc bot
02:52defnfun fact: walton is indiana jones' middle name
02:52Crowb4rI'm trying to build an ircbot myself
02:53defnCrowb4r: i had a cool howto awhile back
02:54defna very simple irc bot
02:54defnclojurebot is probably a great place to look but i havent started working on the bot yet
02:54defnin fact -- in lieu of fixing this bug i am going to do that :)
02:55Crowb4rHey, 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?
02:56defnas in auto-complete-mode?
02:57defnohhh i see what you mean
02:57defnin your .clj file or in the REPL
02:57defnalso, are you using fuzzy-completion with slime?
02:57Crowb4rprobbably not
02:58Crowb4rI fired up a swank session from lein
03:00defnhmm, Crowb4r im not sure :\
03:00defnonce you (use 'lib) it should let you complete
03:01defnat least on the library part, then i throw a / at the end like clojure.contrib.duck-streams/[TAB]
03:01defnto see its fns
03:01Crowb4rwhen I do C-c TAB, M-TAB or just TAB in the repl it only does those two libs.
03:03tomojCrowb4r: are they available the repl?
03:03tomojin the repl I mean
03:04Crowb4rYeah, I can call them, but I can't auto complete them
03:04Crowb4ronly what is in clojrue and clojure.contrib
03:05tomojis one of those bound to slime-indent-and-complete-symbol?
03:05tomojor something like it?
03:06Crowb4rlet me look
03:06defnweee -- simple irc client working
03:06tomojdefn: what's the UI?
03:06Crowb4raccording to the cheatsheet not.
03:06tomojCrowb4r: C-h k TAB
03:06tomoj(and C-h k M-TAB, etc..)
03:07defntomoj: my repl :)
03:07tomojdefn: ah, heh
03:07tomojI wish I could make curses tools with clojure
03:07defnhi
03:07defnoops :)
03:07tomojcurses-style I mean
03:08Crowb4r"It is bound to ^C TAB, ⌥TAB, <menu-bar> <SLIME> <Complete Symbol>."
03:08Crowb4rslime-complete-symbol
03:08Crowb4rthat is
03:09defntomoj: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/
03:09defnim starting with that to build a bot
03:09Crowb4rdefn: I did that just a little bit, but was thinking of moving to pircbot the java lib
03:10defnmore fun to roll something more hack-ish :)
03:10Crowb4rOhh I agree
03:11Crowb4rSo, How would I set "slime-indent-and-complete-symbol" or "slime-fuzzy-complete-symbol"
03:11Crowb4r?
03:12defnCrowb4r: fuzzy is nice and all, but i dont like it because it breaks my namespace completion
03:12tomojCrowb4r: slime-complete-symbol should be enough
03:13tomojare you trying to complete the name of a function?
03:13tomojwith or without a namespace?
03:13tomojalso, did you use clojure-mode from elpa?
03:13Crowb4rI can call and use the other clojure libs, but I can't auto complete them.
03:14Crowb4rI tried with both
03:14Crowb4rtomoj: yes, then I tried from the git repo
03:14tomojvery odd
03:14tomojwhere'd you get slime?
03:15Crowb4relpa
03:16tomojme too
03:17tomojswank-clojure version?
03:17tomojI don't know if that matters, but..
03:17Crowb4rCould be something with aquamacs, but I figured that was trivial.
03:18tomojhmm aquamacs
03:18tomojI have aquamacs in the other room, I can try there
03:18tomoj(in a while)
03:18Crowb4rswank-clojure I've tried 1.1.0 and 1.2.0-SNAPSHOT
03:24defni wonder what would happen if i just turned this ref into an agent
03:25Crowb4rIt might work out better. seems like a hack though
03:29defnCrowb4r: yeah -- i need to step through this very slowlllyyy
03:29Crowb4rLOL, WTF! I just reinstalled all the packages from the elpa and it seems to be working
03:29defnCrowb4r: *shrug* :)
03:30Crowb4rjust deleted the whole elpa folder except for package.el and reinstalled all my packaged and ta-da
03:30Crowb4rpackages*
03:30Crowb4r3:30am--
03:42tomojCrowb4r: weird
03:42tomojdefn: I don't think using an agent is a hack
03:42tomojrich did it in ants.clj
03:42tomojwith a running var to stop it
03:42Crowb4rtomoj: I was not suggesting agents are a hack
03:43Crowb4rJust with his code it would be a hack in.
03:43tomojoh, not that irc code?
03:43Crowb4rno
03:43Crowb4rhttp://gist.github.com/354197
03:43Crowb4r02:44 < defn> see: add-sexps
03:44tomojah
03:45Crowb4rSo, Is clojure going to be even better when java 7 comes out?
03:45defntomoj: what is your feeling about refs versus agents there?
03:45defn(in that gist (specifically (add-sexps...)))
03:45tomojI don't know, I don't understand the code yet
03:45tomojI don't see "(add-sexps" in the gist
03:45defnadd-sexp..., sorry
03:46defnline 106
03:47tomojwell, you could use assoc-in, for one thing, maybe?
03:47tomoj,(assoc-in {} [:good '(foo)] 3)
03:47clojurebot{:good {(foo) 3}}
03:47Crowb4r,(doc assoc-in)
03:47clojurebot"([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."
03:48tomojoh, wait
03:48tomoj(:good *sexps*) isn't a map, is it
03:48defnno
03:49tomojwhat is that, an alist?
03:49tomoj,(-> nil (conj ['(foo) 3]) (conj ['(bar) 4]) (conj ['(foo) 5]))
03:49clojurebot([(foo) 5] [(bar) 4] [(foo) 3])
03:49lithper2_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?
03:49Crowb4rHoly hell, that will be so useful for an assignment that I will have in a class in the next couple of months.
03:50Crowb4rAssoc-in that is
03:50tomoj(alter _ update-in _ conj _) confuses me :)
03:50lithper2_to be specific, i create a project with swank-clojure-project.
03:51tomojlithper2_: if you change the classpath, you need to restart the jvm
03:51Crowb4rlithper2_: Yes, because the JVM is static when started
03:51Crowb4rthe JVM classpath
03:51tomojif you have src/ in the classpath, then you should be able to add files in there and use them without restarting
03:51Crowb4rYou can however load a file in from the repl though
03:51Crowb4ryou keep beating me to it tomoj
03:52tomojsorry :)
03:52Crowb4rheh, it's just funny
03:52lithper2_so loading as opposed to require-ing them is the way to go to avoid restarts.
03:53tomojno
03:54tomojwell, don't require them in the repl manually by typing (require '...), yeah
03:54tomojif you hit C-c C-k on a clojure file, it should be loaded
03:54lithper2_i was manually doing requires just to see what happens
03:54tomojit will also load whatever files it depends on in the ns macro
03:55tomojyes, it's fine to manually require things, just a hassle
03:55defntomoj: Crowb4r: do you guys have any fancy ways of automagically doing M-x slime-set-default-directory after the REPL has been loaded?
03:55lithper2_thanks for the tip.
03:55Crowb4rdefn: nope
03:55tomojdefn: I don't even know what that does
03:55defnid like to automatically set slime-set-default-directory to the project root directory
03:55Crowb4rme = emacs newb
03:55defntomoj: let's say you run M-x swank-clojure-project on your lein project...
03:56defntomoj: you have a logs/ directory in the root of the project dir
03:56defntomoj: unless you explicitly tell slime which directory you're in, you'll default to something like ~/
03:56tomojwhen you C-x C-f, you mean?
03:56tomojthat is interesting
03:56tomojI wonder if the default only matters when you're at the slime repl?
03:57Crowb4rdefn: I usuall do a M-x cd and set my root to the project
03:57tomojI use slime-connect so it would have to be extra magic
03:58defnwhy slime-connect? that just seems like extra work to me
03:58defni have to keep a repl open in a term
03:58Crowb4rhowever 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.
03:58tomojI use screen
03:58defnnever heard of it :P
03:58tomojand I want the environment I use the repl in to be created by lein
03:59tomojbecause lein will create the environment the project will eventually run in
03:59Crowb4rlein swank
03:59tomojyeah
04:00tomojdefn: does the ":P" mean you're joking?
04:00Crowb4rjust make sure swank-clojure is in the lib folder or in your :dev-depenencies of project.clj
04:00Crowb4rI'm guessing that means he is joking
04:00tomojI don't need swank-clojure, just lein-swank is enough
04:00Crowb4rtomoj: your right lein-swank
04:00Crowb4rmy bad
04:00defntomoj: yeah of course
04:01tomojgood :)
04:01tomojsometimes I don't even need lein-swank
04:01defni would lose myself without good ole gnu screen
04:01defntomoj: do you use emacs in a terminal then?
04:01defnor are you a vim guy?
04:01tomojno, emacs in gtk or whatever it is
04:01Crowb4remacs-gtk
04:01tomojbut this group has emacs and a small terminal running screen at all times
04:02Crowb4rI use aquamacs mainly
04:02tomojso yeah I have to switch to the terminal, cd, lein swank, go back to emacs
04:03defnhow do I add values to the vector inside this map: {:good [], :bad []}
04:03Crowb4rI rebound the screen escape to C-space from C-a
04:03tomojwell, what do the values need to look like
04:04tomojcurrently it looks like they are added two at a time, the first being the sexp and the second being... the result of evaluation?
04:04Crowb4rI have a friend who writes a lot of bash and his escape is set to ` .... not a common key at all 0.o
04:04Crowb4rjust `
04:04tomojCrowb4r: that doesn't sound like a bad idea
04:05Crowb4rthe ` or C-space
04:05tomojwell, I meant C-SPC, but ` doesn't sound that bad either
04:05tomojexcept for me ` is $
04:05tomojclojure never uses $, does it?
04:06Crowb4rI rebound it because I want my C-a for working in my shell
04:06Crowb4rtomoj: I don't think so
04:06defnCrowb4r: C-space breaks my marks though! :)
04:06tomojah yes, forgot about that
04:06defni think there's one hotkey which was suggested because it's the only thing that emacs doesn't use
04:07defnC-i or C-7 or something
04:07Crowb4rgeeesh
04:07Crowb4rC-i would break BASH
04:07Crowb4rno, maybe not....
04:08defnso erm, sorry to bother about this but, how do you conj onto a vector inside a map? {:x [] :y []}
04:09tomojdefn: you're already doing it right
04:09tomojI mean, it works at least, doesn't it?
04:09tomoj,(update-in {:good []} [:good] conj 3)
04:09clojurebot{:good [3]}
04:09defni was looking for "update-in"
04:10defnsorry, being lazy
04:10tomojI'm confused, I got that idea from your gist :)
04:11Crowb4rdefn: 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.
04:11defnCrowb4r: yeah that is cool
04:11defnCrowb4r: any suggestions for building a reader for this: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/
04:12tomojsend-off whenever you receive or send something?
04:13Crowb4rI 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)
04:13defn,(update-in {} [:good] conj "100")
04:13clojurebot{:good ("100")}
04:13defnis it possible to make sure that the value is a vector rather than a list?
04:14tomojoh, I see
04:14Crowb4rtomoj: basicially whenever my bot did an eval on a new message it would thread on any keyword
04:14tomojthis seems related to the ensure-coll problem from a couple days ago
04:14defntomoj: that's exactly what im thinking about
04:15defnperformance guarantees are nice :)
04:15defn,(update-in {:good []} [:good] conj "100")
04:15clojurebot{:good ["100"]}
04:15defnthere we are
04:16tomojso just define it with vectors, I guess?
04:16Crowb4rSo, 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.
04:17Crowb4rmakes it so when some jack-ass gives it a horrible query on a webservice it does not get hung-up.
04:18Crowb4rAlright, I need a few hours of sleep, but I'm sure defn will be here still when I get up. :p
04:19Crowb4rdefn: 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.
04:19Crowb4rwork*
04:20defnCrowb4r: we could work together
04:20defni made a repo: defn-bot
04:20defnit's just a blank slate lein project
05:58pdis it possible to get the list of keys given at a struct's definition?
06:41defnpd: id imagine so, though I haven't tried it. :)
06:42BorkdudeCan anyone guide me how to import this git project in Eclipse, build it and use the jar in a Counter Clockwise Eclipse project?
06:42Borkdudegit://github.com/mattrepl/clojure-twitter.git
06:43BorkdudeI have EGit installed
06:47defnpd: you could place some metadata on it
06:58defn(defstruct #^{:keys [:my, :keys]} my-struct :my :keys)
06:58defnalthough (meta #'my-struct) doesn't seem to show that metadata
06:59RaynesKill it with fire.
06:59defn#^{:keys [:my, :keys]}
06:59defn,#^{:keys [:my, :keys]}
06:59clojurebotEOF while reading
07:00defn(defn #^{:tag String} shout [#^{:tag String s] (.toUpperCase s))
07:00defnthat's pretty neat
07:00defn(defn #^{:tag String} shout [#^{:tag String} s] (.toUpperCase s))
07:00Raynesdefn: Any progress on getclojure?
07:19Borkdudegtg
07:38defnRaynes: not really no -- im stuck on where the bug is ATM
07:38defnRaynes: want to answer a question or two for me? :)
07:38Raynesdefn: I want. So hurry. ;)
07:38RaynesI can try. :p
07:38tufflaxHm, 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?
07:38defnthis is actually fairly simple (i think)
07:39defn(defn fib-seq [] ((fn rfib [a b] (cons a (lazy-seq (rfib b (+ a b))))) 1 2))
07:39Raynestufflax: Doesn't appear to work for me either.
07:39defnRaynes: actually nevermind -- im just struggling to explain this to a friend
07:40Raynes:o
07:41tufflaxBtw, 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
07:42Raynesdefn: (defn fib-seq [] ((fn rfib [a b] (->> (+ a b) (rfib b) lazy-seq (cons a))) 1 2)) :D
07:42defnwell played :)
07:42tomojtufflax: it's a java method
07:43Raynesdefn: I'm trying to make a habit of using the arrow forms. :D
07:44tufflaxtomoj 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?
07:44tomojtry this (.printStackTrace *e (java.io.PrintWriter. *out*))
07:45tomojthe .foo form is special
07:45RaynesWorks.
07:45tufflaxok... regular symbols can't start with .?
07:46tomojthey can, but you wouldn't be able to use them as functions, I suppose
07:46tufflaxhm, ok. Well thank you!
07:46tomoj,(letfn [(.foo [] 23)] (.foo))
07:46clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)
07:46tomojI dunno why .printStackTrace doesn't work without giving it a wrapped *out*
07:47defnactually Raynes, would you mind stepping through the fib-seq with me?
07:47tomojactually, it must be using System.out
07:47tomoj(.println System/out "foo")
07:47tomojthis prints nothing
07:48tomojbecause *out* is some swank magic
07:49tomojusing lein-swank for example, (.printStackTrace *e) prints to stdout where you ran lein swank
07:49tomojit's a java issue I guess
07:50Raynesdefn: I don't think I'd be very helpful. I suck at explaining things.
07:50Raynes:|
07:50tomojwhen you are seeing output print into the repl, that's because you've got some magic happening that is telling clojure where to print
07:50defnRaynes: I think I can explain this by just walking through it, but he's pretty new and I don't want to overwhelm him
07:50npoektophi! what does mean "Caused by: java.lang.IllegalStateException: -main already refers to: #'awesome.iCipher/-main in namespace: awesome.iCipher"?
07:51RaynesBreak it apart into tiny pieces. Show what the individual pieces of code do.
07:51defnjust going to do the old "step through this recursive thing step by step"
07:52RaynesI understand what the code does, but it would be difficult for me to explain it.
07:52defn*nod*
07:52RaynesSuch are reasons why I don't intend to write a book about Clojure.
07:53RaynesI'll leave that to chouser, with his slow ass MEAP of Joy.
07:53Raynes(Not chouser and fogus who are slow, but Manning for not updating the MEAP)
07:54defnRaynes: 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?
07:54RaynesThe function must be first in the list.
07:54defnthanks
07:55RaynesThe inner parens are a call to fn, and the outer parens are a call to the anonymous fn defined by fn.
07:56tomojI don't think the ->> helps
07:56tomoj(cons a (lazy-seq (rfib b (+ a b))))
07:56Raynestomoj: I doubt he is using that example. :)
07:56RaynesI was just being snarky.
07:56defni enjoy lots of snark
07:56tomojoh, whoops
07:57RaynesThe ->> example would be way too overwhelming to a new guy.
07:57RaynesExplain that AFTER he has the function down.
07:57Raynes;P
07:57defni put it in there for fun Raynes
07:57defnat the end of my email :)
07:57RaynesHehe.
07:58tomojso (rfib 1 2) == (cons 1 (lazy-seq (rfib 2 3))) == (cons 1 (lazy-seq (cons 2 (lazy-seq (rfib 3 5))))) ...
08:00tomojI didn't know you could do it that way
08:00tomojI always do like (rfib 1 2) == (lazy-seq (cons 1 (rfib 2 3))) == (lazy-seq (cons 1 (lazy-seq (cons 2 (rfib 3 5))))) ...
08:01defnwhat is a being cons'd onto?
08:01defn'a, that is
08:01tomoj'a is not being cons'd
08:03defnit's funny im answering his question and now im lost
08:03defn(cons a...) turns out to just be (cons 1 ...)
08:04Raynes(doc cons)
08:04clojurebot"([x seq]); Returns a new seq where x is the first element and seq is the rest."
08:04RaynesWhat's being cons'd, then? A coke can?
08:05RaynesAn invisible one with the 6 flags coupon on it?
08:05Raynessix*
08:05Raynestomoj: We need halp. You can't drop bombs on us like that and then just run off.
08:05defnA new invisible coke can made of waffle with a 6 flags coupon underneath it?
08:05Rayness_s
08:06tomojRaynes: the value of a?
08:06Raynes...
08:07RaynesYou just sa... Oh. 'a.
08:07RaynesNever mind.
08:07Raynes$eval 'a
08:07RaynesOh yeah, my bot isn't here. :|
08:07Raynes,'a
08:07clojurebota
08:07Raynes:D
08:07defni just added a tick mark to make it recognizable
08:07tomojah I see
08:07defnsince it looked funny in that sentence
08:07tomojI thought you were referring to the symbol
08:08Raynestomoj: If this were stackoverflow, I'd be forced to vote you down. ;p
08:08tomojyeah
08:08RaynesDon't scare me like that.
08:08defnso lazy-seq, when it executes it's body 3 times recursively gives us (cons 1 (2 3))
08:09defnis that a nice way to explain it?
08:09tomojwell, no
08:10tomoj(fib-seq) is (cons 1 (lazy-seq (rfib 2 3)))
08:10tomojwhen you ask for (rest (fib-seq)), that lazy-seq is evaluated
08:11tomojso (rest (fib-seq)) is (rfib 2 3) which is (cons 2 (lazy-seq (rfib 3 5)))
08:11tomojand so on
08:12tomojat every stage you have (cons <the current element> (lazy-seq <some code which computes the remaining elements>))
08:14tomoj(that's what a cons cell is - an element and the rest of the elements in a tuple)
08:14defnhad to re-read that a few times -- that makes a lot of sense now
08:14defnthanks tomoj
08:17chousera little pednatic correction -- (rest (fib-seq)) is actually just (lazy-seq (rfib 2 3)).
08:18chouserthat is, 'rest' doesn't force that lazy-seq to execute.
08:18chouser'next' does, as does calling 'first' or 'rest' on the lazy-seq
08:19chousersorry if that muddles things -- sometimes that detail isn't important so feel free to ignore me. :-)
08:20tomojthat means I can bind something to (rest (fib-seq)) without ever realizing a lazy-seq?
08:20defnchouser: quite alright -- but i am a bit confused on that point.
08:20defn@tomoj my question exactly
08:21tomojbut if I bind something to (next (fib-seq)), the first lazy-seq will be realized?
08:21defni thought calling rest would just make it run to infinity
08:21tomojwell, trying to print the result of calling rest
08:21tomojI didn't realize next and rest had this difference
08:22tomojor (first (rest (fib-seq)) would cause the lazy-seq to be executed, I guess?
08:23defni think im just missing some terminology here
08:23defnwhat does execute mean in this case?
08:24defnbecause if i do (rest (fib-seq)) at my repl, it seems like it's executing lazy-seq to me
08:24defnor is it only executing the stuff inside of the (lazy-seq (...))
08:27tomojclojurebot: ping
08:27clojurebotPONG!
08:29tomoj,(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated")))] (take 1 foo-seq))
08:29clojurebot(nil)
08:29tomoj,(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated"))) bar (rest foo-seq)])
08:29clojurebotlazy-seq evaluated
08:29tomoj,(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated"))) bar (rest foo-seq)] (take 1 bar))
08:29clojurebot(nil)
08:30clojurebotlazy-seq evaluated
08:30tomojwell, that didn't work at all
08:30tomojthe first and second examples print once, the last prints twice
08:30tufflaxEh, 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?
08:30tomojyou can bind bar to (rest foo-seq) and it still doesn't evaluate the second lazy-seq
08:30tomojbecause (rest foo-seq) IS just a LazySeq value, it won't evaluate until you ask for an element out of it
08:31tomoj(or next or whatever)
08:31tomojI feel like "evaluate" is the wrong word
08:33tomojtufflax: typically you will want to get the jars in the lib/ directory
08:33tomojI don't know anything about clojurebox
08:33tufflaxok
08:33tomojthere's leiningen for this
08:34tomojbut you may not want to bother learning it right now, if not try just dropping the jars in lib/
08:35tufflaxok, thanks
08:36tufflaxAnd what if they are just .clj files, do they go into lib too?
08:36defnlazy-seq's body is being
08:36defnerr oops
08:37tufflax...apparently yes.
08:46defntomoj: re:"evaluate" is the wrong word. Yeah, what you said makes sense... It's sort of like the potential for evaluation, "partial" evaluation?
08:51defntufflax: do you have leiningen?
08:51tufflaxno
08:51defnhighly recommended
08:51tufflaxwhat do I need that for? :P
08:52defndependencies, no more moving jars in lib/, just run a command and it is done for you
08:52defnhttp://github.com/technomancy/leiningen
08:53tufflaxHm, 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
09:00defntufflax: *nod* -- it makes things quite a bit easier when you want to toy with a library
09:01defnheck, the programming clojure source might use lein now...
09:02tufflaxHm, how do I restart the REPL in slime/emacs/whatever? So that it forgets all defs?
09:28defntufflax: you could just create a new one
09:29tufflaxI found out that M-x slime-restart-inferior-lisp did it
09:29defntufflax: you could also just switch namespaces arbitrarily
09:29tufflaxhehe yeah
09:29defn(ns djsafkfdsakjfdjsk)
09:30defntufflax: i recommend using the elpa packages if you're new
09:30tufflaxuhm, what's that
09:30defntufflax: http://devinwalters.com/posts/24
09:33tufflaxHm, but im on windows, and I have alomst all that from clojure box
09:35tufflaxOr, wait, maybe i didnt understand what epla was
09:36defnif you have emacs you can use it
09:36defnleiningen works for windows
09:43chouserit'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.
09:44chouser,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] xs)
09:44clojurebot(forced 1 2)
09:45chouser,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] (first xs))
09:45clojurebot1
09:45chouser,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] (rest xs) :foo)
09:45clojurebot:foo
09:46chouserso 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
09:46chouserbut calling 'next' instead of 'rest' *does* force it:
09:46chouser,(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] (next xs) :foo)
09:46clojurebot:foo
09:46clojurebotforced
09:49tufflaxdefn: I evaled the code on that ELPA page and got an error: could not find directory for package-0.9 :p
09:50tufflaxAnd now I'm lost :P
09:52defntufflax: oof
09:52defntufflax: which emacs v?
09:52tufflax23. something
09:52defn(ive never done this on windows so i cant guarantee anything)
09:53tufflaxGNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600)
09:56defntufflax: checking into something...
09:56defntufflax: how did you eval the code?
09:57tufflaxpasted it into a new buffer and chose "eval buffer" from the menu
09:57tufflaxif that's what you mean
09:58tufflaxIt started downloading something but alas...
09:58tufflaxand i was in elisp mode of course
09:59defnthat 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 )
09:59tufflaxok...
09:59defnand then hit C-j
10:00defnso 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:00tufflaxis scrath elisp mode? :P
10:00tufflaxscratch*
10:01defnidk, your error just seems weird
10:01defni cant seem to find anything about it
10:02tufflaxhm, now it doesnt do that, it seems to work :P
10:02defnyour best bet would be to switch to another OS ;)
10:02defnbut anyway, let me know if you need anything else
10:02tufflaxhehe yeah i tried, but my sound card wouldnt work on ubuntu and i play a lot of games :p
10:03defntufflax: *shrug* -- clojure is clojure
10:03tufflax:)
10:03defni just have found *nixes to be a lot more accommodating for the discerning emacs hacker
10:03tufflaxOk, so what cool packages can i get now to pimp my emacs
10:03defnwell, it is an absolute must that you get paredit
10:03tufflaxok
10:03defnthat is truly awesome
10:04RaynesWell, not everybody loves paredit.
10:04RaynesLauJensen has deep German (or whatever he is) hatred for it.
10:04defncheck 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:04RaynesHe hates it almost as much as he hates je...
10:04RaynesSorry, inappropriate. :|
10:05defnRaynes: je? like "I" in French?
10:05Raynesdefn: Jew.
10:05defnoh, eighr
10:05defnright*
10:05RaynesWhoa. How did the r end up at the end?
10:05RaynesI'm not that talented.
10:06defncheck your keyboard :)
10:06tufflaxhm, when i type in paredit it says [no match]
10:06defndid you install the package via elpa?
10:07defnif yes, you may need to (require 'paredit) in your .emacs or .emacs.d/init.e;l
10:07tufflaxoh, maybe i must restart emacs first
10:07defnel*
10:07defnoh yes, and that
10:09defntufflax: i have some stuff ill recommend...
10:09tufflaxhehe sounds good
10:10defn(require 'cl) (require 'saveplace) (require 'ffap) (require 'uniquify) (require 'ansi-color) (require 'recentf)
10:10defnyou should have all of those
10:10tufflaxshould i get them all at the same time right now? :P
10:11defnthings you'd need to go and get on your own: (require 'magit) (require 'yasnippet) (require 'tramp) (require 'color-theme) (require 'auto-complete-config)
10:11defntufflax: the ones above you can just add to your .emacs or .emacs.d/init.el and they are already available
10:11tufflaxok
10:12defntufflax: http://gist.github.com/354513
10:12defnthat's my init.el
10:13bsteuberhow can I call the type constructer from within the deftype definition?
10:14bsteuber(deftype Foo [x] IFoo (bar [] (Foo (inc x)) gives an error
10:16tufflaxdefn I used your init.el and when i started emacs i was supposed to select a file, and it said "dired"
10:16defntufflax: you wont be able to just use my init.el
10:16Raynesbsteuber: Foo.
10:16tufflaxoh
10:17defntufflax: 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:17bsteuberRaynes: thx :)
10:17defntufflax: google for emacs color theme
10:17Rayneshttp://www.reddit.com/r/programming/comments/bgbrr/webbased_emacs_colortheme_creator/
10:17RaynesThat thing is awesome.
10:17RaynesMore awesome than you can comprehend.
10:18defnyeah raynes
10:18defnhave you seen the other generator?
10:18RaynesNo.
10:18defnhttp://inspiration.sweyla.com/code/
10:18defnhttp://inspiration.sweyla.com/code/seed/891972/
10:18defni like that one
10:19RaynesHaha. You said seed.
10:19RaynesI'm easily distracted this early in the morning, I suppose. ._.
10:19defnI'm easily distracted nearly every moment of my natural life.
10:20RaynesThat generator is teh pwn
10:20defnyeah it generates some nice bright themes
10:20Rayneshttp://inspiration.sweyla.com/code/seed/712659/ That one is an eye bleeder
10:20defnhttp://inspiration.sweyla.com/code/seed/208256/
10:23underdevblack background, muted aqua colors, its like a code bonzai
10:24underdev.. tranquel
10:28tufflaxdefn what was supposed to happen with those cl, saveplace, ffap etc
10:28defnstuff ;)
10:28defngoogle 'em
10:28tufflaxhehe
10:34underdevSeriously?
10:34underdevoh, someone killed it
10:38underdevstructured editing + sexps ... how did i ever code with it?
10:38underdevwithout*
10:40tomoj..paredit? or what
10:40underdevoh yeah
10:41underdevthe efficiency is... just amazing
11:23tomojis there a way to conditionally splice a form into a syntax quoted list?
11:23tomojI mean, conditionally expand to (foo bar) or (foo bar baz)
11:23tomojwithout having to say "foo bar" twice
11:26arbschttomoj: `(foo bar ~@(when condition `(baz)) ?
11:26tomojoh, splicing, of course
11:26tomojI had just tried ~nil and gave up
11:27tomoj,`(foo ~@nil)
11:27clojurebot(sandbox/foo)
11:27tomojthanks
11:32ct__(is (= 2 1) "equals") doesn't print 'equals' with (run-tests). Any idea why?
11:33tomojanybody still out there interested in neural networks?
11:43Fossihmm. seem you can't xml/parse some file, json-write and read-json it and work on it with zip-filters
11:57ct__VC requires binding *test-out* like this:(defn my-run-tests
11:57ct__ []
11:57ct__ (binding [*test-out* *out*] (run-tests)))
11:59underdev` + ~ = teh hotness
11:59underdevso cool
12:00underdevoh, @~ ... sick
12:01underdeverr ~@
12:02underdevi think i can implement a delimited version of tcl with macros and exception handling
12:02underdevsingle typing > dynamic typing in certain domains
12:26dnoleninteresting conundrum. is it possible to define a deftype method that can be used with reduce?
13:02chouserdeftype doesn't define methods, only implements them.
13:05tomojbut sure, why not?
13:06tomojit just needs to be a function of two args that returns an instance that also implements whatever interface
13:07tomojI guess you'll have to use #(.fun %) though?
13:08dnolenchouser: yes :). tomoj: well reduce fns need to be able to accept no arguments, right?
13:08tomojah, hm
13:09licoresseIs it not allowed to have destructuring in defmethod?
13:10licoresse(defmethod paint-slot :normal [{:keys [g x y this slot-state layer index-i] :as p}] ....
13:11tomojone problem I've had is wanting to define something like static methods for deftypes
13:12tomojreally like haskell's typeclasses
13:12tomojand in this case the 0-ary is just a constant in the typeclass
13:13tomojbut in clojure we can't call a static method the same way as the 2-ary nonstatic one :/
13:14Crowb4ri've never used haskell, how is HUGS?
13:14tomojin java you specify the class explicitly, in haskell the type is inferred or explicitly specified
13:14tomojcan clojure do something about this?
13:14tomojCrowb4r: I use ghc personally, but haven't really tried hugs
13:14Crowb4rwell How is haskell in general
13:15tomojI would say, awesome, but quite confusing, and syntax makes me said
13:15tomojs/said/sad/
13:16Crowb4rI see
13:16underdevyeah, i got through about a page of examples before i was like "uh.. no".
13:17Crowb4rSo, I know this seems a little odd, but what does using java -server vs java -client gain you?
13:17tomojextra memory for one thing
13:17tomojnot sure what else really..
13:17underdevdifferent optimizations for hotspot
13:18hiredmanit kind of depends these days -client seems to be falling out of use
13:18joshua-choiI'm told that client's supposed to start up faster but server is generally faster over a long time
13:18hiredmanused to be the vm you got with -client wasn't hotspot
13:18Crowb4rI 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:19Crowb4rThat is the only reason people think java is slow IMO
13:19joshua-choiAye, it is the biggest reason
13:20underdevalso waiting for applet to watch a from catch flies over their dialup
13:20tomojcould you like, write out a virgin JVM to disk and load it directly into memory to start a new one?
13:20underdevyou never get a second chance to make a first impression
13:20Crowb4rJava 7 will hopfully change that since it's a major change of th JVM.
13:21patrickdloganCrowb4r: 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:22patrickdloganCrowb4r: I think it is commercial, but imagine clojure would run on it.
13:22hugodtechnomancy: 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:22Crowb4rDoesn't nail-gun speed it up as well?
13:22patrickdloganCrowb4r: nailgun keeps a hot process running, so not the same as starting up a cold vm from scratch.
13:27Crowb4rpatrickdlogan: So, you start nailgun, then write a nail that connects to that nailgun?
13:28patrickdloganCrowb4r: 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:28candellerhi, 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:37LauJensenRaynes: I'm danish, and no I dont hate paredit, its great for the kids :)
13:38joshua-choicandeller: This is why: validate-message-list needs a list, or a sequence.
13:38joshua-choi(validate-message-list user) will be false because it is a struct, not a list.
13:39joshua-choiuser is an *element* of the list.
13:43candellerhmm, suppose I rewrite it that a body of a function is: (every? (fn [r] (:sender r) (:text r)) (seq arg-struct))
13:44candellerbut 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:48joshua-choicandeller: Nope. The collection in the *ref* is a seq of chat structs.
13:48tomoj,(every? #(not %) [])
13:48clojurebottrue
13:49hiredmanin the case of an empty collection every? may not even run
13:49hiredman,(every? #(/ % 1 0) [])
13:49clojurebottrue
13:50candellerok that explains why it returns true on an empty collection
13:50tomojI guess candeller needs to check that every single message is OK?
13:50tomojor if you're always conj'ing, you only need to check the first element
13:51joshua-choiIf you even want a list.
13:58RaynesLauJensen: Danish, German, it's all the same to me. ;)
14:07Crowb4rSo, I got nailgun up, and it's fairly neat.
14:08qbgnailgun is neat, until you realize that there isn't much security.
14:09Crowb4rqbg: Yeah, but it still is a neat thing, just the total lack of security is a problem.
14:09qbgDoesn't slime/swank have similar security problems also?
14:09Crowb4rI don't know
14:10Crowb4rSomeone was asking for nailgun clojure bindings, now that I see how it works I might write those today.
14:10Crowb4rAs an easy project I could do, that as what was suggested.
14:10qbgI have my own script that launches clojure using nailgun
14:11qbgIt can startup, and evaluate (System/exit 0) in 10 msec
14:12qbgThe most painful part was determining if the nailgun server was already running
14:13Crowb4rThat would maybe be a bit painful
14:14qbgI ended up just checking the return value of ng ng-stats
14:15hiredmanI had a @reboot entry in the cron on my netbook to startup a nailgun server
14:19qbgIf I can figure out how to get slime to use nailgun, that would be awesome
14:23Crowb4rqbg: I see that nailgun is not on clojars.org, is it in the maven repo?
14:23Crowb4rso lein can find it?
14:24qbgThere is lein-nailgun: http://clojars.org/lein-nailgun
14:24qbgDon't know what it does
14:24qbgWell, it says it runs a nailgun server, but I've never used it
14:29ct__,(Long. 3)
14:29clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.lang.Long
14:29ct__?
14:30qbg,(Long. (long 3))
14:30clojurebot3
14:30ct__weird
14:30ct__,(class 3)
14:30clojurebotjava.lang.Integer
14:31ct__ah
14:32ct__qbg: ty
14:33qbg,(class (long 3))
14:33clojurebotjava.lang.Long
14:35Crowb4rWell, I will put that dep in the project.clj later then
14:57hiredmansyntax-quote being in the reader is kind of a drag
15:03MrEvilstupid question, why does: (println (* (range 1 101))) result in:java.lang.ClassCastException (NO_SOURCE_FILE:0)
15:03hiredmanMrEvil: range returns a sequence of numbers
15:03hiredman* takes numbers, not a sequence of numbers
15:04hiredman,(range 1 101)
15:04clojurebot(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:04MrEviloh, just realized that. thanks
15:09qbgThe problem with nailgun: neither jline nor rlwrap seem to play well with it
15:10hiredmanhuh?
15:10hiredmanrlwrap has always worked with it for me
15:12qbgStrange, it works when I don't redirect the output of nailgun server...
15:15rlbI'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:19pd,(apply * (range 1 20))
15:19clojurebot121645100408832000
15:19chouserrlb: yes
15:22qbgrlwrap works fine if I start the nailgun server in another bash which I redirect the output of in the main bash session
15:22qbgStrange.
15:23rlbchouser: ok, thx. Is it always run twice (if you know offhand)?
15:27rlbnm - at least in some tests here it is, and that's as much as I need to know for now.
16:03arohner_is there already a function for testing whether two floats are approximately equal?
16:08LauJensenarohner: like (< 0.0 (Math/abs (- 0.54 0.541)) 0.1) ?
16:09arohnerLauJensen: exactly. thanks
16:09arohnernm
16:09arohneryes, like that
17:17bmasonI'm looking for a maven repo for Cupboard so that I can include it in my lein dependencies
17:17bmasonis there a quick way to search for maven repos?
17:20stacktracerIs there any way to pass a non-array primitive argument into a function defined in Clojure, without it being boxed?
17:20stacktracercan I do this with gen-class?
17:22bmasonprimitive argument like an Int?
17:22qbgIFns take Objects as arguments
17:25LauJensenstacktracer: sure, use macros :)
17:25stacktracer:)
17:25LauJensenAnd if you're unsure how, read this http://www.bestinclass.dk/index.php/2010/03/functional-fluid-dynamics-in-clojure/
17:27stacktracerdumb question: are macros 1st-class in clojure? can I pass around a macro the way I pass a function?
17:28qbgNo
17:28Borkdudehow do you use 'use' with :only outside of a ns
17:29Borkdude(use 'clojure.contrib.macro-utils ...)
17:29qbg(use 'namespace :only '(symbols))
17:30BorkdudeI do this: (use 'clojure.contrib.macro-utils :only '(mexpand-all))
17:30Borkdudebut I get: Unsupported option(s) supplied: :only (repl-1:87)
17:31qbgSorry, (use ['clojure.contrib.macro-utils :only '(mexpand-all)])
17:31Borkdudeah tnx
17:32stacktracerin the :methods clause of a gen-class, can a method be specified to take primitive args?
17:32arohnerBorkdude: another way is (use '[clojure.contrib.macro-utils :only (mexpand-all)])
17:33arohnerquoting outside the vector means you don't need to quote inside it
17:33Borkdudeok tnx
17:33arohnerstacktracer: probably, but I'm not sure
17:34stacktracerlooks like yes
17:34stacktracer:methods [[blah [int] void]]
17:35stacktraceryay!
18:36sethsDoes anyone know of a really shiny version of the Clojure logo?
18:36sethsthe ones I've found on clojure.org and google code are sort of small
18:40sethssmall, upscaled gifs look bad in a presentation
18:44underdevwe definitely need to ask Rich for a vector version
18:45underdevi 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:46underdevriches brother designed the logo, so there is hope :)
18:47sethsit's a great logo, very creative. people chuckle when they realize "that's... not a peace sign..."
18:59_atoseths: there's both a larger version and a SVG here: http://groups.google.com/group/clojure/files
19:00_atoClojure_300x300.png and Clojure.svg
19:01sethsyay!
19:01seths_ato: thank you!
19:02underdevcool!
19:42cheezeyso 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:43qbgRegular expressions?
19:43chouser,(re-seq #"%s" ":%s...%s!")
19:43clojurebot("%s" "%s")
19:47cheezeywell %s are arbitrary
19:48underdevare you doing xml?
19:48cheezeyunderdev: no, but i guess the same technique would could be applied there..
19:48underdevwhen i see %s..%s i think xml
19:48underdevdo you know in advance what %s you are looking for?
19:49cheezeyunderdev: no but i know what it's surrounded by. so it's like reverse of re-seq.. i think?
19:49underdevis the string guarenteed to be seperated by spaces
19:49chouser,(re-find #":(.*)\.\.\.(.*)!" "do you want:this like...this?!")
19:49clojurebot[":this like...this?!" "this like" "this?"]
19:50cheezeychouser: yeah! tahnks :P
19:50cheezeyi am bad at this >_>
19:52sethschouser: any news on new MEAP content?
19:56bmasonanyone else using berkeleydb / cupboard that can clue me in on what to include in my lein project.clj?
19:58Crowb4rMEAP?
19:59bmasonshould I just compile the cupboard library into a jar and put that in my 'lib' directory?
19:59sethsCrowb4r: sorry. MEAP = Manning Early Access Program. Chouser is a co-author of a neat new book from Manning called the Joy of Clojure.
20:00Crowb4rAhhh
20:00sethsCrowb4r: a few chapters have been released, eager for more :-)
20:01Crowb4rSpeaking of books. I'm waiting for practical clojure to get released from apress
20:01Crowb4rSeeing as I pre-ordered the print version
20:03bmasoninteresting
20:04sethsthe Apress website says May 2010
20:04Crowb4rTHe first chapter of "Joy of Clojure" is pretty good
20:04bmasonthough I don't think he gets to be the *first* definitive reference :)
20:04sethsbmason: I think that's still waiting to be written
20:04bmasonhis "what you'll learn section" all seems to have been covered by Stuart Holloway's book
20:05Crowb4rThere is the "programming clojure" book that was released.
20:05sethsthings like Clojure in Clojure, cells, and such have to settle before a definitive guide has a good shot
20:05bmasonaye
20:05bmasonthat's Stuart's
20:05Crowb4ryep
20:05Crowb4rI bought that one as well.
20:05bmasonyeah, this one looks good too though :)
20:05sethsCrowb4r: Rich and Stu signed my copy of Programming Clojure :-)
20:06bmasonawesome :)
20:07Crowb4rthat is awesome
20:08Crowb4rlater
20:10bmasonwhere would I find out about clojure conventions/presentations?
20:11bmasonare there any coming up?
20:11sethsbmason: one suggestion is following the Clojure Google Group
20:11bmasonk
20:11sethsuser groups are popping up widely
20:12sethsthat raises the question of whether a Clojure event was still being planned to coincide with Java One
20:12bmasonI get email summaries from the google group, so I should see anything that pops up there :)
20:13sethsCrowb4r: there's one in the State Down South
20:13sethsrhymes with "Nohio" :-)
20:14bmasonI think Rich should tour like a rock band
20:14bmasonevangelizing clojure wherever he goes
20:15sethspersonally I'd vote that Rich keep writing code
20:15bmasonah well :)
20:15sethsall of us can spread the word
20:18hiredman,(* 8 50)
20:18clojurebot400
21:39andrewlmurrayHello
21:40andrewlmurrayA 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:40andrewlmurray(defn call-foo-from-namespace [namespace-str]
21:40andrewlmurray (let [namespace-symbol (symbol namespace-str)]
21:40andrewlmurray (require namespace-symbol)
21:41andrewlmurray ((ns-resolve (find-ns namespace-symbol) 'foo)
21:41andrewlmurray
21:41andrewlmurray(call-foo-from-namespace "some.random.namespace")
22:25Crowb4remacs in a pure shell is sure a pita
22:26qbgEmacs works just for me from a shell
22:27Crowb4rI'm still a newb with it
22:27Crowb4rso, it can be a little much
22:28qbgIf you know how to bring up the menu, you should be good
22:28qbgmaybe
22:29Crowb4rit helps I have a ref card printed out. :)
22:30cemerickDon't bring a menu to an emacs fight. ;-)
22:32underdevbash is telling me i don't have either a JAVA_HOME or CLASS_PATH set...
22:33Crowb4rSo, put them in your bash profile
22:33underdevCLASSPATH i mean
22:33cemerickI was going to say...
22:33Crowb4rwow
22:33underdevso it's finding java based on the PATH, i assume
22:34cemerickMan, setting CLASSPATH in the shell. That takes me back.
22:34Crowb4ryep
22:34underdevmaven docs are suggesting it
22:35cemerickunderdev: link?
22:35underdevhttp://maven.apache.org/download.html
22:35cemerickheh
22:35underdevide?
22:35clojurebotsicp videos is http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
22:36cemerickunderdev: OK, it's telling you to set JAVA_HOME if need be, but not classpath
22:36cemerickunderdev: NetBeans for a while now
22:36underdevcheater
22:36cemerickpast ~2 years or os
22:36cemerickyou bet
22:37Crowb4rcemerick: netbeans + enclojure are nice
22:37cemerickqbg: that's a road of pain you're going down :-)
22:37cemerickgood luck ;-)
22:38cemerickCrowb4r: Oh yeah.
22:38cemerickI'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:39underdevprobably not worth the effort
22:39cemerickunderdev: that's cool, but don't let that be a blocker on getting stuff done. Parallelize, and all that.
22:40cemerickYou absolutely will need to understand various parts of the JVM, but that comes with time.
22:40cemerickIt's a *big* world.
22:40d2dchatSorry 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:40d2dchatwhich in OS X I think is included by default in the Java class path
22:41d2dchatso shouldn't it just work if I say java -cp clojure.jar clojure.main ?
22:41qbgNo
22:41qbgYou need to run clojure.main using jline
22:41d2dchatqbg: how?
22:41qbgjline.ConsoleRunner clojure.main
22:41d2dchatjava -cp clojure.jar jline.ConsoleRunner clojure.main ?
22:42qbgyes
22:42d2dchatException in thread "main" java.lang.ClassNotFoundException: clojure.main
22:42d2dchatis there a way to figure out what the default class paths are in my java install?
22:42d2dchatis it CLASSPATH?
22:42d2dchatif so, that hasn't been set yet
22:43cemerickOS X rigs up an implicit classpath without the env variable
22:44qbgclojure.jar is in the current directory?
22:44d2dchatqbg: yes
22:45d2dchatjava -cp clojure.jar clojure.main works
22:46defnhmm, 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:47qbgd2dchat: What if you explicitly put jline on the classpath?
22:48d2dchatjava -cp /System/Library/Java/Extensions/jline.jar:clojure.jar clojure.main jline.ConsoleRunner
22:48d2dchatException in thread "main" java.io.FileNotFoundException: jline.ConsoleRunner (No such file or directory)
22:48d2dchathmm
22:49d2dchatit just doesn't like me
22:49d2dchat:)
22:49d2dchatoh wait
22:49d2dchatnope
22:49d2dchatthe reverse does't work eitehr
22:49d2dchatjava -cp /System/Library/Java/Extensions/jline.jar:clojure.jar jline.ConsoleRunner clojure.main
22:49d2dchatException in thread "main" java.lang.ClassNotFoundException: clojure.main
22:49qbgAre you sure the jar is "jline.jar"?
22:50d2dchatyes, I moved it there
22:50d2dchatls /System/Library/Java/Extensions/ | grep jline
22:50d2dchatjline.jar
22:53d2dchathaha
22:53d2dchatclojure works fine independently
22:53d2dchatjust would be nice to have the jline functionality
22:54cemerickis rlwrap an option?
22:54cemerick(not that I use either)
22:54d2dchatjava -cp /System/Library/Java/Extensions/jline.jar jline.ConsoleRunner gave me the help screen for jline
22:57d2dchatwhat's the rlwrap option?
23:00d2dchatheh I figured it out
23:00cemerickd2dchat: it's what jline attempts to replicate AFAIK: http://freshmeat.net/projects/rlwrap/
23:00d2dchatmismatched permissions
23:01cemerickoh, jline.jar needed to be in ~/Library/Java/Extensions?
23:01d2dchatI moved the jline file to the same directory as the clojure file
23:01d2dchatand now it works
23:05d2dchathmm, well I moved it to ~/Library/Java/Extensions and tried to add that to the cp instead and
23:05d2dchatsame error
23:05d2dchatJava hates me :(
23:20underdevHAHAHAHHAHAHAHAHAHHAAHA - all that to get this: The program 'mvn' is currently not installed. You can install it by typing:
23:20underdevsudo apt-get install maven2
23:20underdevthat's awesome
23:26d2dchatah wow http://clojars.org/ is cool
23:27cemerickyeah; it is just a maven repository underneath tho
23:44cemerickThat's a big state. :-)
23:45cemerickMaybe the silverdome is big enough?
23:45Crowb4rcemerick: pretty much, but thats no where they play anymore
23:45cemerickoh?
23:46Crowb4rthey main arena is ford field
23:47cemerickreally...when did that happen?
23:47Crowb4ralmost 10 years ago
23:47cemericksheesh
23:47cemerickI guess I internalized things from teh last time I was really following things
23:47cemerickthe past 10 years have been busy :-P
23:47cemerickI always like that name, tho