#clojure logs

2009-12-08

01:20konrDoes you swing code look like a giant block of code with minor functions? I think something is wrong with mine.
01:22arbschtkonr: I can't imagine how to interpret that description. can you paste an example instead?
01:38twbrayProfiler tells me I'm spending all my time in java.lang.reflect.Array.get ... hmm...
01:39dnolentwbray: sounds like a missing type hint, you dereferencing a multi-dim array by chance?
01:39hiredmanhave you seen cgrand's post on arrays?
01:40twbrayI suspect (let [ ... [client _ _ _ _ _ uri bstring status _ ref] (. #" " split line) ]
01:40twbrayhiredman: Nope, but I think google just found it for me
01:40hiredmanhttp://clj-me.cgrand.net/2009/08/06/what-warn-on-reflection-doesnt-tell-you-about-arrays/
01:40hiredmanyou google faster than me
01:41twbrayI've also been getting good results with hints
01:43hiredmanoh
01:43hiredmanI see the destructuring let
01:43twbray#<CompilerException java.lang.Exception: Name conflict, can't def *warn-on-reflection* because namespace: user refers to:#'clojure.core/*warn-on-reflection* (NO_SOURCE_FILE:9)>
01:44hiredmanset!
01:44hiredman,(set! *warn-on-reflection* true)
01:44clojurebotjava.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set
01:44hiredmananyway, it will work at the repl
01:44dnolentwbray: wow, I didn't know that you could destructure a java array into a vector, I suspect you're right there's reflection happening there tho.
01:45hiredmanthe repl is run inside a binding where bindings for a bunch of stuff are setup so you can set! them
01:45hiredmandestructuring is actually a pretty complex macro
01:45hiredmanit's neat, but I would not bet the farm on it
01:46twbrayPreviously I was doing (let [ fields (. #" " split line) client (get fields 0) uri (get fields 6) etc ] changing to destruct had no effect on profiler output. Digging
01:46hiredmanhuh
01:46twbray40% of all CPU going into java.lang.reflect.Array.get, snicker
01:46hiredmanno effect is good I guess...
01:47hiredmanI think you'd use aget + a type hint instead of get
01:48hiredmannow you … half the … etc
01:49twbrayOK, will wire in aget, brb
01:52dnolentwbray: http://gist.github.com/251463
01:53dnolenon my machine destructure is considerably slower, ~250ms vs ~150ms for that microbenchmark
01:53twbraydnolen: thanks
01:53dnolenbecause that's a java method call to split the string you don't need to type hint
01:55twbrayWhen you get reflection perf hogs, it's usually pretty obvious int he -Xprof output
01:56twbrayHah, switching to aget made java.lang.reflect.Array.get go away :) ...
01:56hiredman:D
01:56hiredmanmagic
01:56twbray... but bought me a reflection problem, java.lang.Class.forName0 all over the -Xprof :(
01:56twbrayNeed to find the right type hing
01:56twbrayhint
01:56twbrayShouldn't be too hard
02:00_atoIIRC you need to hint both the array and the index
02:00_atolike (aget #^objects my-array (int i))
02:01hiredmanmagic
02:01hiredmaner
02:01hiredman_ato: the array is in a local and is the result of a java call, so the array type will propagate
02:02_atoah cool.
02:08twbrayhiredman: not sure... I just decorated all those aget values with type-hints and it made a big difference
02:08twbraye.g. #^String uri (aget fields 6)
02:14hiredmantwbray: ok
02:17dnolentwbray: hiredman: is mostly right, types do flow down let bindings, the issue is the boxing of values returned from functions.
02:17dnolenthat is the return value of aget is boxed, and needs to be type hinted if you want to do something fast with that return value
02:18twbraydnolen: OK. Not pretending I understand why that needs to be the case.
02:19dnolentwbray: simple rule, java methods return type to a let binding. Clojure functions won't. aget is a clojure function whereas (. #" " split ...) is a java method.
02:20dnolenthus you don't need to typehint the return value of (. #" " split ...), but you have to type hint aget
02:20dnolenthe return value of aget.
02:20twbraydnolen: That's a little surprising since aget exists specifically to reach into Java arrays
02:22_atobut isn't aget inlined?
02:22dnolentwbray: it is, aget is a weird, it's an "inline" fn, not sure I really understand it all that well myself. but what I've described is the basic mental model for type-hinting.
02:22_ato:inline (fn [a i] `(. clojure.lang.RT (aget ~a ~i))
02:23hiredmanhmmm
02:23_atoyou think it could at least typehint it's second argument as an int
02:23_ato:/
02:23twbrayAlso btw *warn-on-reflection* didn't
02:25dnolenorder of magnitude difference: http://gist.github.com/251483
02:25_atoI guess it's not warning on reflection because of this: static public Object aget(Object xs, int i){ return Reflector.prepRet(Array.get(xs, i)); }
02:25hiredmantwbray: yes, as cgrand mentioned in his post, *warn-on-reflection* doesn't catch array reflection
02:26twbraybtw, thanks for the cgrand pointer; hadn't noticed him previously
02:26dnolencgrand == crazy clojure hacker
02:26hiredmanpitty about the font
02:27twbrayEmacs is good for lots of things but not my fave for reading Java
02:28hiredmanthis is the second time I've installed emacs
02:28twbrayhiredman: you on a mac? Aquamacs ftw
02:28hiredmanthe first time I just sort of stared at the empty editor for a while and then went back to vim
02:28hiredmanfreebsd
02:29hiredmana few clicks on emacswiki seems to indicate changing the font to dejavu sans mono is going to be a big deal
02:29slyrustwbray: the nextstep build isn't bad either
02:31twbrayA line of output from "top" on one of those Sun multicore boxes, when Clojure's running hot:
02:31twbray 26278 twbray 130 40 0 5195M 5164M cpu 380:40 2815% java
02:32hiredman:D
02:32hiredmanman, I want one of those
02:32twbraywell, they're a little weird to work with. But when you get the code tuned, they can grind through an *amazing* amount of work. Good I/O too.
02:40_atohiredman: btw add this to your emacs configuration: (set-default-font "DejaVu Sans Mono-11")
02:41_ato(assuming you're using emacs 23, older versions probably need that awful font syntax with all the dashes in it)
02:41twbrayrecent WF run, reasonably well-tuned CLojure code right now, 24 minutes elapsed, 10+ hours of CPU time.
02:42_ato-*-dejavu sans mono-*-*-*-*-*-*-*-*-*-*-*-* or whatever it is
02:42hiredman_ato: .emacs.el or .emacs or ...?
02:42twbrayhiredman: ~/.emacs
02:42_atohiredman: .emacs if you're not using the emacs starter kit
02:43hiredmanmy pinky is already killing me
02:43hiredmanwhat a rough life
02:43_atoyeah, most emacs users swap ctrl and caps-lock
02:44JAS415really?
02:44twbrayOn the mac, you can set caps-lock=>ctrl globally for all apps. Very helpful.
02:44polypusyeah or just leave ctrl as ctrl and change caps
02:45JAS415IN CASE YOU GET ANGRY :-)
02:45hiredman_ato: just did that
02:45hiredmanI had capslock mapped to compose
02:45JAS415or for writing really old lisp code
02:45hiredmanso I could make accented i's
02:46hiredmanclojurebot: emacs?
02:46clojurebotemacs is best configured for Clojure with instructions at http://technomancy.us/126
02:48hiredmanC-j is eval elisp?
02:48_atoonly in *scratch*, I use C-x C-e as that works when editing .el files and such
02:49_atoand C-x C-e is eval clojure code in a .clj file as well
02:50_atoactually maybe not even in scratch
02:50_atoC-j is newline for me
02:51_atoah.. looks like in a fresh install C-j is eval and insert the output into the buffer
02:54polypusyou can also C-c v for eval buffer as elisp. i set slime C-c v to slime-eval-lisp as well
02:54hiredmanhmmm
02:55JAS415you can also bind it however you want
02:55polypussure
02:58_atoI'm totally useless when it comes to using other people's PCs these days. I keep hitting Capslock-a instead of Home and such.
03:02hiredmanugh, paste inserts where the mouse is
03:02hiredman(middle button paste in X)
03:04_atoI usually use the keyboard to paste (C-y)
03:04_atoyou might need: (setq x-select-enable-clipboard t)
03:04_atoto make it paste stuff that's been selected
03:06_atohiredman: looks like (setq mouse-yank-at-point t) might do the trick
03:06_atothat makes the middle-mouse paste at the cursor location
03:06_atoinstead of the mouse pointer location
03:08hiredmanI see
03:08hiredmanC-j seems to somehow be bound to both newline and eval elisp
03:09hiredmandoesn't work out well
03:09_atoyou can check what function a key press is bound to with: C-h k <keypress>
03:10_atoso like C-h k C-j
03:11hiredmanM-:
03:11hiredmanexcellent
03:12hiredmansays newline-and-indent, but in the scratch buffer it also does eval
03:13hiredmanyay! color-theme
03:32triyoI have a leiningen project.clj file where my project name is nutrifact and my version is ""0.1.0-SNAPSHOT". When I run "lein jar" or "lein uberjar" it builds a nutrifact.jar instead of the desired snapshot ver as per my project.clj. Am I issing something?
03:33triyoso should be nutrifact-0.1.0-SNAPSHOT.jar
03:34hiredmanhmmm
03:34hiredmanis there rainbow parens for emacs?
03:37_atonot built-in as far as I know. There's this: http://nschum.de/src/emacs/highlight-parentheses/
03:38eevar2do you get rainbow parens for anything but emacs?
03:41hiredmanvimclojure
03:41_atotriyo: you can do "lein jar whatever-you-like.jar" to call the jar something different if you want
03:42_atoby default lein just calls it project-name.jar
03:42_atols
03:42hiredman_ato: close
03:42hiredmanI guess that is close enough :/
03:43triyo_ato: do you run the stable ver of leiningen or latest from master repo?
03:45_atotriyo: I run with master because I code on leiningen a fair bit
03:46hamzaguys, is there a repeat like function that will execute a function repeatedly?
03:47_ato,(take 10 (repeatedly rand))
03:47clojurebot(0.8813602039501953 0.3653268991300669 0.6732810028855468 0.3679588982322579 0.6001436027276109 0.6081804356412707 0.7722853209560046 0.6811660555016636 0.18603216492432617 0.7955644218452835)
03:48hamzalol, so the answer was in my question, :) thanks...
05:21adityo,'(nil 1 2 nil)
05:21clojurebot(nil 1 2 nil)
05:21adityohow do i remove the nils from this list
05:22_ato,(remove nil? '(nil 1 2 nil))
05:22clojurebot(1 2)
05:23adityodamn, how did i miss nil?
05:23adityothanks _ato
05:51scellusadityo: you missed it because it was removed? :)
05:54adityo:)
06:10LauJensenAnybody here running Mac OSX who can spend 25 secs with me in priv? :)
06:16AWizzArdgithub down?
06:17_atogithub's up for me
06:17defnHow do I add compojure's jar and deps/*.jar to my classpath in my REPL?
06:18AWizzArddefn: you want to add it while the jvm is already running?
06:19AWizzArd_ato: thx for checking
06:21_atoI'd create a directory for your project, copy all the jars you need (including swank-clojure and clojure.jar and contrib) into project/lib and then use M-x swank-clojure-project
06:21defni have a swank-clojure-import
06:21_atoah, you must have a pre 1.0 version of swank-clojure then
06:22_atoif you're using java 6 then adding ".../compojure.jar" and "deps/*" to swank-clojure-extra-classpaths should work
06:22defndo you run jochu's?
06:23defni had trouble with technomancy's vers. with my current config so i switched back to jochu's
06:23_atoI run technomancy's with no config
06:24defnbut that forces you to run it on projects right?
06:24defndo you have it via elpa?
06:24hoeck1defn: have you restarted emacs?
06:24defnhoeck1: no, i opened a new REPL, d'oh, one sec
06:25hoeck1jochu's swank-clojure only builds the classpath on an emacs restart
06:25_atoit doesn't force you to run it on projects, you can use M-x slime as well
06:25defnhoeck1: that fixed it thanks
06:25defn_ato: did you get it via elpa?
06:26_atoI think so
06:26_atoI've tried both ways
06:26_atoI think I'm currently with ELPA
06:38defnbah wtf
06:38defni removed the init.el entry for my clojure.el stuff -- installed swank-clojure, clojure-mode, etc. via ELPA
06:39defnand now it complains when i start emacs that it cannot load swank-clojure, cant find it
06:39defnDebugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "lisp")
06:39LauJensendefn, sounds like you need (setq swank-clojure-binary "/some/shell/script.sh") ?
06:41defnLauJensen: i dont even get that far
06:41defnit wont load swank
06:43_atostupid ELPA
06:43_atomake sure you have nothing to do with swank-clojure in your init.el (no requires or anything)
06:44defnyeah im pretty sure i dont, maybe this is cached from loaddefs.el or something?
06:44LauJensendefn, I posted a 'get started with clojure' link on my blog once, want me to dig it up ?
06:44_ato:/
06:45defnheh this is embarrassing
06:45LauJensenoh, youre not a noob? :) Sorry
06:45defni think i fixed it
06:45_atoI guess have a poke in ~/.emacs.d/elpa/swank-clojure-1.0 and make sure the files are there
06:45_atoah, cool
06:45defni think i just needed slime-repl from ELPA
06:45defni figured that'd be a dependency or something
06:45_atoyeah it should have been
06:45_atostrange
06:46defnswank-clojure-project still seems broken
06:47_atowhat does it do?
06:47defnjust keeps polling on the project dir
06:47defnuntil i have to abort with slime-abort-connection
06:48_atoyou copied in clojure.jar clojure-contrib.jar and swank-clojure.jar right?
06:48defni thought it copied those automatically for you
06:48_atonah
06:48_atocauses you might want to use different versions
06:49defnright, just thought if it couldnt find them that it'd give you something to work with
06:49_atoif you want to use the versions it downloaded they're in ~/.swank-clojure
06:49defnbut ok
06:49defnthanks :)
06:50_atothat worked?
06:50_atoyeah it'd be nice if it did do it for you if they aren't there, but I guess it can't reliably detect if they're there or not, cause they could be named something different
06:52LauJensenI thought it was possible just to install clojure-mode via Elpa, and then M-x clojure-mode-install, which would pull down everything, build and configure?
06:52adityoLauJensen: whats the link for your blog
06:52LauJensenhttp://www.bestinclass.dk
06:52LauJensenLink the right-most pane named 'blog'
06:53LauJensenIn this context, link means click :)
06:54_atoI think clojure-mode-install is now deprecated in favor of ELPA
06:54somniumI got the latest version to install itself only after putting in a clean .emacs.d and removing my .clojure dir. It works great now.
06:55somnium_ato: is it possible to use clojure-new as a dep with lein/clojars?
06:55adityoyes i can confirm from technomancy's blog post that clojure-install is deprecated
06:56LauJensenAh ok
06:56LauJensenWonder why, I've seen it work quite well on both Linux and *sigh* Windows :)
06:56adityohttp://technomancy.us/126
07:02defnthat's awesome (leiningen)
07:02_atohe's just using the compojure jar I uploaded, that's why it's org.clojars.ato/compojure
07:02defnomg so glad i went through the minor headache of switching to technomancy's version
07:02_atoand yes leiningen is pretty nice
07:02defnactually being able to tab complete clojure.contrib.* stuff
07:03_ato:)
07:03micampeoh gosh. every time I come here I learn a new tool I should learn.
07:05micampeso, since I always hated ant and maven, I think I'm going to look at leiningen now
07:05defnno need to copy all of the stuff i need by hand, I can just setup package.clj and hit `lein deps`
07:10Chousukehm, the font at clojars.org is huge
07:10Chousukemaybe my resolution is a bit too small :P
07:10ChousukeBut it's a refreshing change. Usually I get to complain about the font being too small.
07:10_atoyeah I made it huge on purpose
07:11_atothough maybe it's too huge, probably some of the longer package names will go off the edge of the page
07:14Chousuke_ato: at 80% zoom the font size looks fine to me. Hmm.
07:23interferonanyone know of good clojure blogs?
07:25liebkeinterferon: a good place to start is http://disclojure.org/ and then check its blogroll
07:32interferonthanks
08:40fliebelHow can I find out if the function supplied to a macro is really a function?
08:40fliebel,(fn? (first '(print "hi")))
08:40clojurebotfalse
08:40_fogus_,(fn? (first `(print "hi")))
08:40clojurebotfalse
08:41_fogus_hmm
08:41fliebelI tried symbol, but that returns true, even for jerhlaf, or skdjbl.
08:42fliebelAre there by chance Clojure functions named like that? :D
08:44arbscht,(fn? (var-get (resolve (first '(print "hi")))))
08:44clojurebottrue
08:44_fogus_D'oh!! Of course.
08:44Chousukefliebel: unless it's a function defined with def though, you can't.
08:44Chousukealso, var-get = deref = @ :)
08:45fliebelthanks
08:45fliebeland resolve?
08:45Chousukeresolve resolves a symbol to a var
08:45arbscht,(doc resolve)
08:45clojurebot"([sym]); same as (ns-resolve *ns* symbol)"
08:45arbscht...
08:46arbscht,(doc ns-resolve)
08:46clojurebot"([ns sym]); Returns the var or Class to which a symbol will be resolved in the namespace, else nil. Note that if the symbol is fully qualified, the var/Class to which it resolves need not be present in the namespace."
08:47fliebelso what you are doing is tracing down and following all the references until you find the actual fn.
08:47fliebelWhat if the user supplied a #function?
08:47Chousukethen it won't work
08:47Chousukemacros have no access to runtime data.
08:48fliebelah, ok
08:49fliebelHow suitable it a Scheme mode in my editor for editing Clojure? It does not support CL or Clojure.
08:49Chousukewhich editor?
08:49arbschtChousuke: macros?
08:49fliebelI tried Netbeans, but that did not work for me, I'm using Komodo Edit.
08:50Chousukearbscht: yes?
08:50arbschtChousuke: I don't see any macros
08:50_fogus_http://home.pipeline.com/~hbaker1/
08:51Chousukearbscht: the original question was how to tell if a macro was passed a function
08:51arbschtoh!
08:51arbscht:-)
08:51Chousukewhich is not possible in the general case because macros operate with symbols and lists, not functions :/
08:53arbschtfliebel: I would not expect it to be suitable. it won't know conventional indentation rules, for example
08:57cp2mornin'
08:57cp2clojurebot: good morning ^_^
08:57clojurebotGabh mo leithscéal?
09:00fliebelAre there other Mac editors suitable for editing Clojure except emacs and Netbeans?
09:01cp2vim :D
09:01cp2eclipse has an alright clojure plugin, intellij has a nicer clojure plugin and there is a free/open source version now
09:02cp2although ive found that you really dont need a java ide for writing clojure, and that the overhead is unnecessary because of the lack of features of the plugins
09:03cp2my advice is stick with vim or emacs, and get really good at using them
09:05cp2er, them being the one you choose of course
09:05cemerickman, two editor discussions in two days :-/
09:05cp2cemerick: heh, im being careful to not say 'x is better than y'
09:05chouserpeople keep asking. *shrug*
09:06chouserI guess there could be a page we could just point to.
09:06rhickeyhow are people making out with latest new branch? (fine-grained locals clearing)
09:06chouserhey look, there is: http://stackoverflow.com/questions/257333/clojure-editor-ide-recommendations-on-os-x
09:06cemerickThe best answer is almost always going to be "whatever you're using now for everything else"; besides that, it's all personal preference.
09:07cemerickI've found SO to be a ghetto for the most part.
09:11chouserrhickey: have been using the latest 'new' branch for misc. light clojure activity -- nothing to report.
09:11rhickeychouser: no news is good news :)
09:12chouserexactly
09:12chouserI don't have much code sitting around that used to blow the heap to try out now.
09:13cp2rhickey: but what if they shot the messenger?
09:13rhickeychouser: yeah, I have to go back through and find some old problem reports in the group
09:13chouserhm. thrilling.
09:14rhickeythere was some destructuring thing
09:15chouserI think I have it
09:16chouser(defn loop-test [] (loop [[head & tail] (repeat 1)] (recur tail)))
09:16rhickeymight have been something jdk 6 could figure out that 5 couldn't
09:16chouseryes, that's this one
09:17somniumis (:field my-type) still equivalent to (.field my-type)?
09:20chousersomnium: in the 'new' branch when my-type is a deftype instance, they should be equally fast once hotspot is done doing what it does.
09:20somniumhave type with field 'then', (.then type) returns the value, (:then type) returns #<Type$__lookup__then ...>
09:20chouserI think. :-)
09:20somniumyeah, ^^ this odd behavior just now
09:20chousersomnium: are you sure you've got the latest 'new'?
09:21somniuma few days old I think
09:21chouseryeah, better upgrade. the edge bleeds, gotta keep moving.
09:22somniumI saw it seemed to break swank yesterday so Ive been holding off
09:22somniumcan anyone confirm?
09:22chouserah. I think that's been fixed now.
09:22AWizzArdis there a new behaviour in deftype? I upgraded today. Now I do: (deftype foo [a b]) and then (:b (foo 10 20)) ==> nil
09:22chousersomnium: hang on -- booting the computer that has 'new'...
09:23somniumAWizzArd: does (.b foo) work?
09:23AWizzArdyes
09:24chouserhmm
09:24chouserI'm seeing AWizzArd's bug.
09:24AWizzArdNow (.b (foo 10 20)) ==> 20, but I am very sure that (:b (foo 10 20)) ==> 20 also before
09:25chouserbut not somnium's -- nil returns, not lookup methods.
09:26chousersomnium: you probably want version a3e95cf
09:26somniumat least once (:a foo) worked here, then suddenly seemed to break
09:26chousersomnium: yes, that was a bug that was fixed
09:26rhickeysomnium: that's fixed, move on
09:26somniumthanks
09:27AWizzArdSo, what is official now? Should I wait for an update so that (:b my-foo) ==> 20 again, or should I change my code to (.b my-foo) now?
09:27chouserAWizzArd: "official"? Is 1.0 :-)
09:27AWizzArdofficial for alpha I mean :-)
09:27rhickeyAWizzArd: don't use (.b, I'm looking at your problem
09:28AWizzArdI want to use the New branch, because it is a) very helpful and b) I want to help by alpha testing it.
09:32pjstadigemacs question
09:32pjstadigM-x swank-clojure-project
09:32pjstadigthe class path is missing clojure and swank-clojure
09:33pjstadigis this intended? or a bug?
09:35AWizzArdYou should put swank on your classpath.
09:35AWizzArdSome months ago this was not needed.
09:37AWizzArdAnd the slime version that you use should not be too new.
09:37pjstadigi installed with elpa
09:37clojurebotelpa is a package manager for Emacs: http://tromey.com/elpa
09:37pjstadigthank you clojurebot, i knew that
09:37pjstadig:)
09:38hipertracker(+ (/ 1 3) (/ 1 2)) -> 5/6 zajebiste
09:38pjstadigeverything works fine
09:38AWizzArdCurrently there is a problem, the new slime does not work anymore. I think it has to do with names of symbols. Slime now uses symbols that begin with a digit, or it uses symbols that contain spaces, something like that.
09:38AWizzArdAnd now there is the discussion who should care about that: slime or the clojure side ;)
09:38AWizzArd(in swank-clojure)
09:39pjstadigi thought M-x swank-clojure-project would be cool, but it doesn't load slime or clojure which i guess is probably a better way of doing it
09:39pjstadigthen you can control what version of clojure, etc. you use by putting them in lib
09:39AWizzArdIt is also a bit unfortunate that the new slime needs an internet connection. People behind a firewall won't be able to install slime+clojure this way.
09:40devlinsfhipertracker: Let clojurebot do the work for you
09:41devlinsf,(+ (/ 1 3) (/ 1 2))
09:41clojurebot5/6
09:41hipertrackerdevlinsf: sorry, wrong window.
09:41devlinsfhipertracker: n/p
09:42AWizzArd,(+ 1/3 1/2)
09:42clojurebot5/6
09:43chouser,1/3+1/2
09:43clojurebotInvalid number: 1/3+1/2
09:45AWizzArdi think symbol names must not start with digits
09:52devlinsfHey, is there a way to force division to be a double through a binding? What I specifically want to AVOID is (double (/ 1 3))
09:52devlinsfnm - just answer my own question at the REPL
09:52devlinsf,(/ 1.0 3)
09:52clojurebot0.3333333333333333
09:54AWizzArd,(let [a 2, b 3] [(class a) (class b) (/ a b)])
09:54clojurebot[java.lang.Integer java.lang.Integer 2/3]
09:54AWizzArdif it is a function parameter you should convert it at one point to a double or BigDecimal
09:54fliebelWhy does Clojure not support 1+1 etc, but does support 3/2?
09:55AWizzArdbecause 3/2 is not a function call
09:55AWizzArdit is the notation for rational numbers
09:55cemerickfliebel: because the former is an operation, the latter is a value
09:55chouserfliebel: 3/2 is a literal form of a Ratio instance. like "foo" is a String
09:55_fogus_fliebel: It's read: 3 over 2
09:56AWizzArd,12E+2
09:56clojurebot1200.0
09:56fliebelstrange thing to make a "devision" a literal, although it might save some headaches.
09:57AWizzArdit is not a division
09:57cemerickit's not division
09:57AWizzArdit is the notation for a number
09:57pjstadigfor an exact number
09:57pjstadigfloating points aren't exact
09:57cemerick,1/3
09:57clojurebot1/3
09:57cemerick,(float 1/3)
09:57clojurebot0.33333334
09:57AWizzArdhelpfull for us poor humans who can't work successfully with sequences of 0s and 1s
09:58cemerickthe latter is division
09:58devlinsfRight, they're only good for a relative error of 1E-16
09:58cemerickor, it makes the division represented by the ratio concrete
09:58fliebel,(* 22/7 2)
09:58clojurebot44/7
09:58devlinsf,pi
09:58clojurebotjava.lang.Exception: Unable to resolve symbol: pi in this context
09:58AWizzArd,Math/PI
09:58clojurebot3.141592653589793
09:59devlinsfAh
09:59cemerickwhich is defined as a double, I think.
09:59devlinsf,(class Math/PI)
09:59clojurebotjava.lang.Double
09:59fliebelWould be cool to have PI as a… something
09:59devlinsfA what?
09:59cemerick22/7 is always just 22/7, unless you explicitly force it into a float or double
10:00esj22/7 is not pi
10:00AWizzArd,(rationalize Math/PI)
10:00clojurebot3141592653589793/1000000000000000
10:00fliebelWell, something that is more precise...
10:00esjmathematical impossibility
10:00cemerickyeah, closer than Math/PI
10:00devlinsfThank you esj
10:01devlinsfPlease, Math/PI is great as a double
10:01fliebelI won't launch a rocket with double persoanly, but I guess it's okay in 99.9999% of the time.
10:02AWizzArdand ifs someone cares then he/she can have pi as a rational number, which will not be less exact
10:02esj i suppose using the series representation as a lazy sequence is possible
10:02devlinsffliebel: Ever here of Apollo?
10:03fliebeldevlinsf: Yea, I know they launched that with less computer power than in my iPod….
10:03devlinsffliebel: study analog & digital controls sometime. You'll realize that the limits of double are nothing compared to the limits of the algorithms
10:03AWizzArdJust (def π 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067M)
10:03devlinsfPerfect!
10:03AWizzArdthat's the first 100 digits, as a BigDecimal
10:04devlinsfTotally useless in production, buyt perfect
10:04AWizzArd;-)
10:04rhickeyAWizzArd: fixed
10:04AWizzArdwow rhickey, this is very nice thanks *handshaking*
10:05rhickeywas actually a problem mwith case
10:06shr3kst3rtests are a fine idea
10:07_fogus_fliebel: What does this mean? "compared to the limits of the algorithms"
10:07devlinsf_fogus_: right here
10:07Licenser_Oha odd thing, I've a server socket, created with create-server, now when I connect to it via telnet and type in stuff it works fine, connecting with a java.net.Socket and writing stuff to it works too but when the socket is closed the line seq created from the server crasehs with a runtime exception :/ (Exception in thread "Thread-1" java.lang.RuntimeException: java.lang.RuntimeException: java.net.SocketException: Software caused connection abort: recv fa
10:08Licenser_any ideas cause I am not entirely sure what to make from this
10:08fliebel_fogus_: no idea…
10:08_fogus_devlinsf: Sorry, clicked wrong name
10:08devlinsf*WARNING - MATH CONTENT*
10:08_fogus_devlinsf: Bring it on ;)
10:10devlinsf_fogus_: Forgive the following question. You've studied calculus before, right?
10:11_fogus_devlinsf: Once upon a time
10:12devlinsfdevlinsf: Perfect. That will be enough. I will be using the process of integration as an example
10:12devlinsf_focus_: Sorry, wrong name :)
10:12devlinsf_fogus_ :Ah!
10:12Licenser_I knid of have tom think of fungus o.O
10:12devlinsfOkay, forget it
10:13devlinsfYou have certain integrals that don't have a solution
10:13devlinsfbut as an engineer one needs to solve them all the time
10:14devlinsfFor example, consider the Gaussian function, (fn[x] (Math/exp (* -1 x x)))
10:14angermanhow do I add custom jar's to leiningen?
10:14devlinsfdef that as gauss
10:15_fogus_,(def gauss (fn[x] (Math/exp (* -1 x x))))
10:15clojurebotDENIED
10:15_fogus_:(
10:15AWizzArduse let
10:15devlinsf,(gauss -7)
10:15clojurebotjava.lang.Exception: Unable to resolve symbol: gauss in this context
10:16devlinsfHave a REPL open?
10:16devlinsfYou'll see that (gauss -7) is very close to 0
10:16_fogus_,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -7))
10:16clojurebot5.242885663363464E-22
10:16devlinsfAs is (guass 7)
10:17_fogus_sure
10:17esjto back up devlinsf - in addition, in getting stuff from the real world into the computer, the sensors that we use often less than double precision accuracy once you account for noise, so using greater precision in your maths is often (not always) unneccessary.
10:18devlinsfesj: Agreed - But I want to attack the problem mathematically, not as an engineer
10:18devlinsfesj: I'm an engineer myself, so I agree with you 110%
10:18esjdevlinsf: sorry, just glanced over and wanted to comment, will sit back now :)
10:19devlinsfesj : :)
10:19fliebeldevlinsf: why do you include −1 of both 7 and −1 return the same result?
10:20devlinsfUmm??
10:20fliebelof = if and the last 1 = 7
10:20devlinsf,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -1))
10:20clojurebot0.36787944117144233
10:20devlinsf,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -7))
10:20clojurebot5.242885663363464E-22
10:20devlinsf,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -1))
10:20clojurebot0.36787944117144233
10:20devlinsf,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss 7))
10:20clojurebot5.242885663363464E-22
10:20devlinsfSorry to spam
10:21devlinsffliebel: could you clarify?
10:21fliebel,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (= (gauss 7) (gauss −7)))
10:21clojurebotjava.lang.Exception: Unable to resolve symbol: −7 in this context
10:21fliebelwell, both the result of 7 and −7 are 5.242885663363464E-22
10:21devlinsfRight
10:21_fogus_,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (= (gauss 7) (gauss -7)))
10:21clojurebottrue
10:22devlinsfThey should, it's an even fn
10:23fliebelso why do you include −1 in the function, this would only make −7 -> 7 and 7 -> −7 right?
10:23devlinsfbecause that's the definition of the gaussion
10:23devlinsfe^-(x^2)
10:23devlinsf*gaussian
10:24fliebeldevlinfsL ok, fine, i never did so much math...
10:24fliebeli'll sit back and listen
10:24devlinsfThat's okay, questions are good
10:25devlinsfhttp://www.codersource.net/published/view/279/guassian_smoothing_in_csharp.aspx
10:25devlinsfThere's a good graph of the function
10:26devlinsfOften, you need to find the area under the curve, starting at -infinity, to some value of x
10:27devlinsfNow, as we demonstrated, -7 is close to zero, so I'm gonna assume that the area to the left of 7 is zero
10:27devlinsfOr really reall really close
10:28devlinsfThe first attempt to approximate the area is to create a lot of rectangles.
10:28devlinsfLet's start with a base width of 1
10:29devlinsf(let [gauss (fn[x] (Math/exp (* -1 x x)))] (map gauss (range -7 7))
10:29devlinsf,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (map gauss (range -7 7))
10:29clojurebotEOF while reading
10:29Licenser_FYI: My problem was the socket closing too fast and line-seq still wanting to read from it, having the client wait for a second before closing the socket fixed it - not nice but it works
10:29devlinsf,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (map gauss (range -7 7)))
10:29clojurebot(5.242885663363464E-22 2.3195228302435696E-16 1.3887943864964021E-11 1.1253517471925912E-7 1.2340980408667956E-4 0.01831563888873418 0.36787944117144233 1.0 0.36787944117144233 0.01831563888873418 1.2340980408667956E-4 1.1253517471925912E-7 1.3887943864964021E-11 2.3195228302435696E-16)
10:29devlinsfThere
10:29devlinsfSo, we know the height of the rectangle, and we know that it has a width of 1.
10:30devlinsfWe can simply add up these values and get an approimation at each point.
10:31devlinsfWorks for integers, but falls appart if we want to find the value everything less than say -.25
10:31devlinsfSo, the obvious thing to due here is to use smaller rectangles
10:32devlinsfIt turns out, that if you make your rectangles twice as small you get twice as good a result, etc.
10:32devlinsfBut now we have to do twice as much work.
10:32devlinsfBoo :(
10:32fliebelyou are trying to find the point where the gauss is 0?
10:32devlinsfNow, you trying to find the area under the curve to the left of a point x
10:32devlinsfI.E, and integral
10:33devlinsf*No
10:33fliebeloh, sorry… I should redo my math...
10:33devlinsfIt's cool stuff, really.
10:33devlinsfHaskell will make more sense as you do... but i digress
10:34devlinsfSo, as I change the width of my rectange (w), the error improves by (w)
10:34devlinsfKinda sucks
10:34devlinsfThere's a well know algoritm called Runge-Kutta
10:35devlinsfhttp://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods
10:35fliebeldevlinfs: I liked it quite much until I came to sin and cos, which are fine, as long as you understand what is the point.
10:35devlinsffliebel: sin & cos a great
10:35devlinsf*are
10:36devlinsfRK has an interesting property
10:37devlinsfAs we change the size of our rectagle, our error goes down dramatically. Specically w/ RK4, a change in w results in an error size of w^4
10:37devlinsfSo a 2x smaller rectangle is 16 times more accurate
10:37fliebeldevlinsf: I agree… I tried my best to learn them, and I understand them to some extent now, but after that I kind of gave up.
10:38devlinsffliebel: If you like physics, it'll be easier to understand
10:39devlinsfWhat is so interesting is that RK4 doesn't depend on a decimal apprimation. You could do all of you arithmatic exactly, and the same property would apply
10:41devlinsfQuestions so far?
10:42_fogus_not yet
10:42devlinsfOkay, cool
10:43fliebelIf I knew integrals, I'm sure I'd understand :D
10:44devlinsfSo, the guass function is fairly straightforward
10:44devlinsfgauss
10:44devlinsfThe real problem arrises when you move from simple integration to differential equations
10:45esjfliebel: its like zooming in on the answer, but where it takes time to zoom, so you can have a high a resolution as you want, but to get it takes unlimited time to get it.
10:45fliebelI kind of understood that, only failed to understand the goal and the means of doing so.
10:46_fogus_devlinsf: I think I see the point of your original statement
10:46devlinsfOkay
10:47_fogus_devlinsf: But by all means continue
10:47devlinsfThere is this concept of stability with differential equations
10:47cp2is there a 'conventional' way of storing a seq (specifically a vector) in a db (via c.c.sql) ?
10:47fliebelI think even I do… You'd need incredible small squares to need more than a float.
10:47esjfliebel: yes, but it gets worse, watch !
10:47devlinsfWhat stability means is that "If I ask the same questions, do I get the same anser"
10:48devlinsfA stable equation behaves like you expect. If I use smaller rectangles, my answer gets better
10:48fliebeldevlinfs: are there cases in math where you can get different answers without treads or random numbers?
10:49devlinsfAn unstable equation is painful. The more rectangles you throw at it, the worse it gets
10:49fliebelshow us :)
10:49notallamaa gaussian doesn't have an antiderivative, right? maybe you could integrate the first n terms of the taylor series around 0. i dnno if that will help, though
10:50devlinsfboss
10:51esji think I know where devlinsf may be going, so i'll have a go at continuing
10:51esjif you want to land your rocket on the moon you need to solve some differential equations
10:52esjwhich you do through the same technique of successively small rectangles
10:52esjbut if your recantangles are too big, your answer is inaccurate, as with the integral example
10:53esjthe problem now is, that if you make your recangles small, to get higher accuracy, your numerics blows up
10:53esjits not just that it takes forever to get the answer, but you actually stop moving and cant.
10:53devlinsfThanks esj
10:53devlinsfGotta go, you got it
10:54esjdevlinsf: np
10:54fliebelthanks! :)
10:54_fogus_devlinsf: Thanks for the run-down
10:54esja lot of stuff that you want to calculate is like this
10:55esjso having \pi greater than double is usually not useful
10:56fliebelcalculating pi to be greater than float is fun though...
10:56esjyou can calculate it as accurately as you like
10:56angermandoes anyone know how to add a classpath element to the leiningen project.clj?
10:56angermanI want to add a .jar file that is not on clojars
10:56notallamayou could keep a lazy seq of the digits of pi : p
10:57esjyou could us this for instance to make a lazy sequence of pi to whatever accuracy you desired: http://en.wikipedia.org/wiki/Leibniz_formula_for_pi
10:57fliebelI must confess I rather like PI, and can name more than 10 decimals, without wikipedia :)
11:04fliebelHow can I compile or run a clj file? So far I only played with the REPL. Just entering a file to clj gives me an exception that --file.clj does not exist.
11:06_fogus_fliebel: What command are you using?
11:07fliebelclj test.clj
11:07_fogus_What is clj?
11:08somniumfliebel: clj is a bash script?
11:08somniumfliebel: may need to make sure it accepts arguments
11:09micampefliebel: have you seen Darren Aronofsky movie Pi?
11:09somniummicampe: thats a great movie
11:09micampeindeed
11:10micampeI love the BW treatment
11:10somniumthey even play go!
11:10somniumsomeone should write a go engine in clojure
11:10esjspeaking of intractable algorithms... :P
11:11somnium:P
11:11angermanis anyone using lein-swank + emacs?
11:11karmazillaspeaking of clj the bash script. My homebrew related e-mail from a couple of days back; I wonder if people have opinions or if I'm the only person caring :)
11:11somniumtheyve gotten better than anyone thought they would already
11:12angermanwhen ever I hit C-c C-c it tries to fontify something and runs regexps pretty long
11:13micampeeh. I have enough problems wrapping my head around sockets in clojure, go would be a bit far a away at the moment.
11:14somniummicampe: I think its the only game left where humans still can regularly beat engines.
11:15fliebelsomnium: I just thought about that yesterday, after trying to learn go.
11:15fliebelmicampe: I have not seen the movie I think.
11:15micampefliebel: you should.
11:16fliebeldomnium: I'll have a look at clj, it's just what macports istalled.
11:16fliebelmicampe: youtube?
11:16somniumIve been struggling with nio but more due to lack of java familiarity than clojure
11:16esjits a similar-ish thing to our previous discussion. A computer playing chess knows all the possible "sure thing" endings an figures out all possible paths from the current state to one of those. But go is not like that, there are too many possibilities, so you need to guess... computers are not so good at that... yet.
11:17micampefliebel: there are probably pieces of it on youtube. I have it on dvd.
11:18esjof course in emacs you just press C-C M-^ alt-cokebottle handbrake and it figures out how to win the game... but thats entirely something else
11:18fliebelesj: this kind of problem always make me think in force fields....
11:19esjfliebel: that is excellent intuition, and the guesses that are made are based exactly on that sort of idea.
11:20fliebelesj: I guess it's easier to write robocode bots :D
11:20somniumesj: I think table-bases only go to 6-pieces currently
11:20fliebelsomnium: clj is a bash script full of nonsens....
11:20somniumI wonder how many terabytes it would take for all 20
11:21esjsomnium: wow, that's pretty crazy.
11:21somniumer, 16 rather
11:22somnium32, ok I cant count
11:22esj:)
11:22fliebelsomnium: (19) that makes me thing of my java book, where they represented a playing field by the pieces and their position rather than a 2d list.
11:27somniumfliebel: in some ways its unfortunate, I suspect the world champion probably has a negative score against his cell phone these days (chess)
11:27polypusesj: they are making great strides now with statistical methods in go
11:27cp2is there a 'conventional' way of storing a seq (specifically a vector) in a db (via c.c.sql) ?
11:28polypusi just read this "The var metadata can be used for application-specific purposes as well. Consider using namespace-qualified keys (e.g. :myns/foo) to avoid clashes." in the doc on def.
11:28somnium,(str [1 2])
11:28clojurebot"[1 2]"
11:28somnium,(read-string "[1 2]")
11:28clojurebot[1 2]
11:28polypusi don't get how this is namespace qualified?
11:29cp2ah
11:29esjpolypus: thanks.
11:29cp2somnium: i didnt think of that, thanks
11:29_fogus_,::foo
11:29clojurebot:sandbox/foo
11:30_fogus_sandbox is the ns
11:31fliebelwhat is the normal way of compiling or running a clj file? my clj script is not working and the getting started pages talk only about repl.
11:32somniumhttp://clojure.org/repl_and_main
11:33pjstadigis there a maven repo that contains clojure-contrib-1.0-compat.jar?
11:33fliebelsomnium: and how about compiling to java?
11:33somniumfliebel: ^^ this is the bare minimum a clj script should need to do
11:34somniumhmm, probably leiningen is easiest
11:34pjstadighow is one supposed to setup lein to find clojure-contrib-1.0-compat? i don't see the jar in any of the default repos (central, clojure snapshots, clojars)
11:35polypus_fogus_: ty
11:41fliebelAm I really supposed to compile Clojure code to Java by running compile form the repl?
11:42_fogus_,(doc compile)
11:42clojurebot"([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."
11:43somniumfliebel: the ant versions Ive seen just invoke clojure.main and pass "(compile ...)"
11:44fliebelthanks… kind of odd though.
11:49lisppaste8fogus pasted "Minimal Ant Clojure compile" at http://paste.lisp.org/display/91773
11:49fliebeldoes Clojure have these templates python has, like: "I eat $s apples every $s" % [2 "day"]
11:49somnium,(doc format)
11:49clojurebot"([fmt & args]); Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax"
11:49stuartsierrafliebel: there's a clojure.lang.Compile class that does that
11:50fliebelthanks
11:50_fogus_fliebel: L@@k my link above
11:51fliebelI noticed, thanks all for helping me out over and over and over etc… again.
11:55_fogus_fliebel: Not exactly the same as in ptyhon, but close
11:55_fogus_,(format "I eat %d apples every %s" 2 'day)
11:55clojurebot"I eat 2 apples every day"
11:59DeusExPikachuwhen you run a concurrent clojure program on a cluster jvm, does it "just work"? In other words, is there anything special you have to do to get clojure code to work on a cluster?
12:01esjDeusExPikachu: I don't think clojure directly supports distributed processing, for that you'd want Erlang
12:02chouseror one of the many Java libs that helps support distributed processing
12:14DeusExPikachuso basically I need to find a cluster JVM that automatically distributes threads among nodes?
12:14DeusExPikachuif I want to not have to make any code changes
12:16esjDeusExPikachu: I know nothing about this stuff, but there exists libraries such as http://www.terracotta.org/ that might be able to shed light on the state of the art.
12:18tolstoyWhen I 'require clojure.contrib.logging, I get: java.lang.Exception: Unable to find static field: TRACE in class org.apache.log4j.Level
12:18tolstoySurely that can't be right.
12:22angermantechnomancy: what's the advantage of starting lein with -client?
12:23angermanDeusExPikachu: as esj said, terracotta is waht you are looking for. There is a blog somewhere that discusses setting up clojure and terracotta. Google should be able to find it for you
12:23tolstoyAh. Trace is in 1.2.12, and I've 1.2.7.
12:24DeusExPikachuyeah I've been reading the site as soon as I asked you guys, was hoping for some firsthand experience, thanks though
13:15tcrayfordis there an easy way to test if two hash maps are equal?
13:15tcrayford(ie have exactly the same keys and vals)
13:16tcrayford= doesn't work
13:16tcrayford,(= {:a 1 :b 2} {:a 1 :b 2 :c 3})
13:16clojurebotfalse
13:16the-kenny,(== {:a 1 :b 2} {:a 1 :b 2 :c 3})
13:16clojurebotfalse
13:16tcrayfordooh
13:16tcrayfordweird
13:17the-kennyUhm, they aren't equal. There is one key more in the second
13:17tcrayfordI want that to return false
13:17tcrayfordneed to go and rephrase my question methinks
13:18tcrayfordI have a test which passes: (deftest test-new-message
13:18tcrayford (is (= (new-message "Tom" "foo")) (struct message "Toom" "foo" (long-now))))
13:18tcrayfordwhere new-message is (defn new-message [user text]
13:18tcrayford (struct message user text (long-now)))
13:19chouserwhere the values are equal for the keys they have in common?
13:19tcrayfordexcept I am calling "Toom" and "Tom"
13:19tcrayfordand the test still passes
13:20chouserI don't get it. Does the test ever fail?
13:20tcrayfordI don't think so
13:20tcrayfordand it should
13:20tcrayfordwith different values
13:20chouseroh, you want it to fail in the example you gave?
13:20tcrayfordc
13:20tcrayfordI altered the example from the proper test
13:21tcrayfordcheers for the help
13:22tcrayfordweird, as
13:22chouser,(let [m1 {:a 1, :b 2}, m2 {:a 1, :b 2, :c 3}] (= m1 (select-keys m2 (keys m1))))
13:22clojurebottrue
13:22tcrayford,(= {:a "Tom" :b 2} {:a "Toom" :b 3})
13:22clojurebotfalse
13:23hiredman
13:23hiredmantcrayford: that (is ...) you pasted is not checking for equality
13:24hiredmancheck the parens on =
13:24tcrayfordhah
13:25tcrayfordyeah confirm I was being dumb with parens
13:26tcrayfordcheers hiredman
13:43fliebelWhat are the advantages of using an unstable version of Clojure?
13:44slashus2You get the try out new ideas?
13:44konrnew (and not proved to be stable) features?
13:44fliebelHow unstable is unstable?
13:46konrwell, I'm always using them, and I've never had any problem with any development-version software, but perhaps I'm just lucky
13:48fliebelHmmm, then my only concern is that devel ports in Macports do not get updates very often. What is worsen then using an old development version? That is like the worst of the 2 sides!
13:48stuartsierrafliebel: git master branch is pretty stable. git "new" branch is where new features go, it tends to be less stable and change more frequently.
13:49fliebelHow old is 20091128? Wait… that looks to much like a date to me...
13:49hiredmanjeez
13:49hiredmanancient history :P
13:49devlinsfrhickey: Question for 1.1. Is juxt going to change name in the future, or is the name now fixed? Use (doc juxt) to see what I am refering to.
13:50Chousuke(doc juxt)
13:50clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
13:51devlinsf*clojure-version*
13:51devlinsf,*clojure-version*
13:51clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}
13:53rhickeydevlinsf: I don't know - I expected more complaints about juxt
13:54devlinsfrhickey: Any problem keeping the name?
13:55fliebelWhat is the difference between next and rest? From the doc it seems the only difference is the one possibly returns nil.
13:55polypusis there any emacs support for lein?
13:55Chousukefliebel: next is less lazy :)
13:56polypusemacs integration is really what i mean
13:56fliebelchousuke: let's go for rest then, as long as I don't have to test it's content.
14:03defnbah no wonder s halloway's clojure talk at rubyconf 2009 isnt online yet
14:03defnconfreaks just told me they had a bunch of syncing issues
14:04defnwhoa holy shit
14:04defnintel is buying invidia
14:04defnnvidia
14:05fliebelSo, finally Intel boards without GMA?
14:05defnit makes good sense
14:08KirinDave_I also imagine intel wants some of that go-juice for their new designs.
14:08KirinDave_Micro-graphics-card as a parallel arithmetic assist. An altivec for the new millennium. :)
14:08DeusExPikachulink?
14:09devlinsfrhickey: My thought on juxt is that if it isn't mature enough to have a frozen name, it isn't mature enough to be in 1.1
14:09devlinsfrhickey: Conversely, if it is mature enough to be in 1.1, people must be used to the name
14:09hiredmandefn: actually, or just cringley's speculation?
14:10defnspeculation still i guess, but it wouldn't be a shock if it were true
14:11fliebelwoa! Clojure got stuck…
14:12fliebel,(let (def t '(str "joi" "bla")) (keyword (name (first t)))
14:12clojurebotEOF while reading
14:12fliebelsorry :$
14:13bjorkintoshXach> bjorkintosh: #clojure can give you a case for clojure.
14:13bjorkintoshis clojure anything like sbcl?
14:13bjorkintosh... or such?
14:13defnit's a lisp...
14:13the-kennybjorkintosh: Clojure is another lisp dialect. Like Common Lisp is one.
14:13ohpauleezthat is particularly good at concurrent things
14:13the-kennySBCL is an implementation of the common lisp spec.
14:13defnand uses the JVM
14:14the-kenny...and runs in the jvm
14:14bjorkintoshah ...
14:14defn:)
14:14bjorkintoshso clojure is more like erlang then?
14:14hiredman~rationale
14:14clojurebotrationale is http://clojure.org/rationale
14:14defnno not really
14:14polypusnot really like erlang
14:14defnthere are hints of erlang in clojrue
14:14defnclojure*
14:14polypusin process concurrency
14:14bjorkintoshhmm.
14:14ohpauleezit feels lightweight, it has a "hack as I think" feeling like python for me personally
14:14polypusbut even w/o the concurrency stuff io it's the nicest lisp i've seen
14:15polypuss/io/imo
14:15defnit's my first lisp and im enjoying it
14:15the-kennypolypus: Yes, I think so too
14:15bjorkintoshso it isn't possible to harness all the computers at a lab to run a clojure program concurrently?
14:15defnlearning some elisp in tandem and its been a good experienc
14:15defnbjorkintosh: sure
14:15bjorkintoshit is?! cool!
14:15ohpauleezI was a die hard CL lover, and did most of my work and enjoyment project in Python
14:15ohpauleezand Clojure is easily becoming my favorite language
14:15bjorkintoshthat's what i meant by the erlang comparison.
14:16gravitybjorkintosh: You'd need to use something like hadoop to do it
14:16the-kennybjorkintosh: Clojure isn't designed around this "My program can run on then tousand machines at once" like erlang is. But it's possible.
14:16defnbjorkintosh: clojure has agent-based concurrency
14:16the-kennys/then//
14:16pjstadigI'm blowing stack and I don't know why
14:16bjorkintoshbut how does the concurrent bit work?
14:16bjorkintoshis there something to read on that?
14:16defnbetter to read about it than have us explain it
14:16slashus2It isn't really about distributed concurrency as much as shared memory concurrency. There are java libraries that will allow you to do that though.
14:16defnhttp://clojure.org/concurrency
14:16pjstadigi have a collection of 7393 collections that i'm trying to concatenate together
14:16defnoops bad link
14:16konrIs there a way to make SLIME automatically add /foo/lib/*jar to the classpath, when editing some file from /foo/src/?
14:17defnhttp://clojure.org/refs, http://clojure.org/agents, http://clojure.org/agents
14:17bjorkintoshhmm. hadoop...
14:17pjstadig,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393))
14:17clojurebotEOF while reading
14:17bjorkintoshokay.
14:17pjstadig,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393)))
14:17clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
14:17the-kennykonr: Use leiningen or swank-clojure-project
14:17DeusExPikachubjorkintosh: a big part of clojure over CL is first class datastructures besides the list
14:17ohpauleezpjstadig: is there a reason for not doing it lazily? Are calculating these things?
14:17defnkonr: yeah listen to the-kenny, leiningen + clojars + swank-clojure = pure win
14:17bjorkintoshdo hadoop and clojure play nicely together?
14:18the-kennydefn: Yes, exactly :)
14:18defni believe someone wrote something to do hadoop stuff with clj
14:18pjstadig,(reduce lazy-cat (map (constantly (vector 1 2 3)) (range 0 7393)))
14:18clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/lazy-cat
14:18slashus2Clojure allows for wrapper free access to java libraries.
14:18defnbjorkintosh: http://github.com/stuartsierra/clojure-hadoop
14:18pjstadig,(reduce #(lazy-cat %1 %2) (map (constantly (vector 1 2 3)) (range 0 7393)))
14:18clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
14:19bjorkintoshokay.
14:19DeusExPikachuits got great standardized reader macros too, makes code concise
14:19pjstadigi guess i would be fine with a lazy sequence if I could figure out how to get it to work
14:19defnlazy-seq
14:19pjstadigbesides it shouldn't blow stack doing a reduce should it?
14:19DeusExPikachuespecially for coding macros
14:19pjstadigi would expect to maybe run out of memory
14:20bjorkintoshso are clojure and commonlisp close enough that the examples from the books i have on common lisp can be implemented in it?
14:20the-kennybjorkintosh: Yes, except for reader macros
14:20stuartsierrabjorkintosh: no
14:20bjorkintoshreader macros. okay.
14:20stuartsierraI mean, you can implement all the same things, but the syntax and names will be different.
14:21DeusExPikachubjorkintosh: I'd say so, coming from Pratical Common Lisp
14:21pjstadigdefn: how would i use lazy-seq?
14:21bjorkintoshcool.
14:21DeusExPikachuif you need a reference, someone went ahead and ported the PCL code to clojure, just google it up
14:22bjorkintoshi'm apt-get-ing clojure right now.
14:22the-kennybjorkintosh: The biggest difference is the persistence in data structures.. you can't change for example a map, but you'll get a copy of the back with the element added back from assoc. Like in Haskell
14:22bjorkintoshis there a nice IDE for it?
14:22the-kennyemacs + slime
14:22the-kenny(+ leiningen)
14:22DeusExPikachuI use slime, clojure-mode
14:22bjorkintoshoh. nothing vim-ey like?
14:22bjorkintosh(emacs makes me cry)
14:23defnand yet you use parentheses to explain your disgust
14:23the-kennymy experience is, that hacking lisp in vim is very painful
14:23bjorkintoshhehehe
14:23gbtthere is vim-clojure, but I've not tried it
14:23defni tried using vim with clojure, many people use it in here, but i found the swank-clojure stuff to be such an incredibly powerful tool that i learned emacs and havent looked back
14:24DeusExPikachuI can't live without paredit mode
14:24bjorkintoshi'm an agnostic, but i prefer to think the world was created in vi. (hides)
14:24defnparedit is very nice as well
14:24defnbjorkintosh: tools are tools
14:24fliebelWhat does it mean when I get a java.lang.NullPointerException in Clojure?
14:24defnpick what you want and go for it, but personally emacs was made for lisp hacking
14:24the-kennyI've learned Emacs just for Common Lisp and now I use it for everything from LaTeX to ToDo-Management (org-mode ftw!)
14:24defnorg-mode > *
14:24bjorkintosh*sigH*
14:24defnand yeah, latex is so nice
14:24the-kennydefn: Exactly :)
14:25bjorkintoshyou poor things. tools are tools, as defn said.
14:25defnmobileorg is quite cool also :)
14:25the-kennydefn: I'm thinking about writing a parser for org-mode in clojure
14:25defnhave you seen babel?
14:25chouserwhy is the frequency of editor conversations going up!?
14:25bjorkintoshokay.
14:25the-kennydefn: babel?
14:25defnit's in org-mode's contrib
14:25fliebelchouser: partly because of me....
14:25bjorkintoshso how does clojure talk to the jvm? i'm at the prompt... is that it?
14:26chouserbjorkintosh: depends on what you want to tell the JVM.
14:26gravitybjorkintosh: clojure is compiled to jvm bytecode
14:26bjorkintoshah okay.
14:26defnthe-kenny: http://orgmode.org/worg/org-contrib/babel/org-babel.php
14:26defnthere is support for clojure now :)
14:26the-kennydefn: Woah, cool :)
14:26bjorkintoshi think i'll use it for a while to see how it wears.
14:26the-kennydefn: But I was thinking about an external parser, written in clojure
14:26fliebelbjorkintosh: you can also do aot compiling and run scripts of course.
14:26DeusExPikachuthe blip.tv talks are good too
14:27defnthe-kenny: sure, different story, but i just thought id pass that along since it seemed sort of related
14:27the-kennydefn: Yeah, maybe it's helpful :)
14:27the-kennyThanks
14:27defnthe-kenny: i was thinking something like a little blogging platform similar to jekyll that runs on clojure and org-mode
14:27pjstadig,*clojure-version*
14:28clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}
14:28fliebeldefn: Woa, I wanted to do just that… not sure about the org-mode though. But at least something liek Jekyll
14:28defnfliebel: got a repo?
14:28pjstadigam I wrong in thinking that reduce shouldn't blow stack?
14:29fliebeldefn: nope, I'm trying to learn Clojure first.
14:29defnim thinking compojure + lein
14:29the-kennyhm.. I'm just learning Markdown for blog-posts and such things
14:29defnfliebel: cool well, buzz me if you're working on anything
14:29defnand ill do the same
14:29fliebelsure :)
14:29defni started a repo last night to do some compojure stuff, my first experience with lein + clojars
14:29defnpretty awesome
14:30somnium`! google chrome for linux released
14:30defnpjstadig: i dont think you're wrong, but that code doesn't seem "right" to me for some reason
14:30fliebeldefn: I have been trying to make my own template language for ages now… but I'd possible use the one in contrib for the final thing.
14:30fliebelsomnium: now for the mac version...
14:30defnfliebel: the html templating stuff?
14:31defnlike (html-tree [:h1 "hello"]) ?
14:31fliebeldefn: yea, that one...
14:31defnyeah thats what im playing with
14:32fliebeldefn: I made something like that in Python a while back.
14:32fliebelhttp://metapep.wordpress.com/2009/10/04/pymlpython-markup-language-template-engine/
14:33fliebelThen I decided to learn Clojure and make my CMS with that instead.
14:33defnIt's pretty neat: I was just messing with some really basic stuff last night: (defn default-layout [title, content-tree] (html-tree [:html [:head [:title title] [:body content-tree]]]))
14:33defnsometing like that
14:34defnand then you can (html (default-layout "home" [:h1 "Home"]))
14:34defnor somesuch
14:34fliebelIs that instantly converted to a string, or more in the lazy and editable way?
14:34chouserpjstadig: generally, reduce should not blow the stack, at least not by itself.
14:34defnfliebel: i believe it's converted to a string right away, but i dont really know that much about it yet tbh
14:34defn,(html-tree [:h1 "abc")
14:35clojurebotUnmatched delimiter: )
14:35defnoops
14:35defn,(html-tree [:h1 "abc])
14:35clojurebotEOF while reading string
14:35defnbahhh!
14:35defn,(html-tree [:h1 "abc"])
14:35clojurebotjava.lang.Exception: Unable to resolve symbol: html-tree in this context
14:35pjstadigchouser: so i think this is a general case, does this mean its a bug?
14:35defni give up on life
14:35fliebeldefn: That is one of the key points for me. make a template, fiddle with it and then print it.
14:35defn,(use 'compojure)
14:35clojurebotjava.io.FileNotFoundException: Could not locate compojure__init.class or compojure.clj on classpath:
14:36defnfliebel: yeah it's easy enough, pretty easy to template with
14:36chouserpjstadig: you have a small test case we can look at?
14:36fliebeldefn: I even had basic xpath in my Python lib.
14:36defncool
14:36pjstadig,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393))
14:36clojurebotEOF while reading
14:36pjstadig,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393)))
14:36clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
14:37defni get an awfully weird stack trace when i run that code pjstadig
14:37pjstadigmay depend on the JVM config, but you can bump the range down to 1900
14:37chouser,(let [x (reduce concat (map (constantly (vector 1 2 3)) (range 0 7393)))])
14:37clojurebotnil
14:37pjstadig,(reduce concat (map (constantly (vector 1 2 3)) (range 0 1900)))
14:37clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
14:38chouserpjstadig: reduce is not blowing the stack.
14:38pjstadig,(let [x (reduce concat (map (constantly (vector 1 2 3)) (range 0 1900)))])
14:38clojurebotnil
14:38pjstadig,(let [x (reduce concat (map (constantly (vector 1 2 3)) (range 0 1900)))] x)
14:38clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
14:38konrthe-kenny: I installed lein, moved my .jar to /project/lib/, and started swank-clojure-project on /project/, yet /project/myjar.jar is not on the classpath - do I need to add it somehow to project.clj?
14:38fliebeldefn: In Python objects have a string representation, which allowed me to build the template as some complicated list and then the whole thing shows up as html when printed. Does Clojure objects have a editable representation?
14:38konr*project/lib/myjar.jar
14:38pjstadigit's blowing stack when it tries to print i guess
14:38ChousukeI suspect it's the concats
14:38Chousukesince concat is lazy.
14:38chouserpjstadig: the lazy structure being produced by concat blows the stack when you try to get the first element.
14:39Chousukeyou're generating a whole lot of chunks.
14:39Chousukeer.
14:39Chousukethunks
14:39hiredmanconcat is :(
14:39chouser,(reduce concat (map #(list %) (range 1e4)))
14:39clojurebotEval-in-box threw an exception:java.lang.StackOverflowError
14:39pjstadigso it blows stack trying to realize the lazy seq
14:40chousertry (apply concat ...) instead
14:40pjstadig,(apply concat (map (constantly (vector 1 2 3)) (range 0 1900)))
14:40clojurebot(1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2
14:40pjstadigk
14:41the-kennykonr: hm... should work. Maybe ask the author of swank-clojure-project?
14:41defn(def fooseq (lazy-seq (repeat (vector 1 2 3)))
14:41defndoes that work at all?
14:41the-kennys/-project//
14:41defnor are we stuck with the same problem
14:41Chousukedefn: the lazy-seq there is redundant
14:41chouserdefn: doesn't produce the same output.
14:42fliebelWhat does it mean in Clojure if I get a java.lang.NullPointerException?
14:42hiredman,(.foo nil)
14:42the-kennykonr: You can also check the contents of (get (System/getProperties) "java.class.path")
14:42clojurebotjava.lang.NullPointerException
14:42the-kenny(That'll get you the classpath of the running clojure instance)
14:42Chousukefliebel: exactly what it means in java :)
14:43Chousukefliebel: nil is java null
14:43fliebelchousuke: So I did a function call somewhere without a proper argument?
14:43Chousukefliebel: yeah. or a method call.
14:43hiredmanalways a method a call
14:44fliebelwhat si the difference between function and method?
14:44hiredmanat the bottom an NPE means you called a method on null
14:44konrthe-kenny: It's strange... perhaps my swank is not configured right. Thanks!
14:44Chousukefliebel: functions mean clojure functions, methods are java methods (interop)
14:44_fogus_,(+ 1 nil)
14:44clojurebotjava.lang.NullPointerException
14:44defnchouser: that does produce the same output
14:44the-kennykonr: Where do you get the not-in-classpath-thing in clojure?
14:45_fogus_nil could also be an argument
14:45Chousukefliebel: behind the scenes though a function call is also a method call but that's an implemetation detail :)
14:45defn(= (apply concat (map (constantly (vector 1 2 3)) (range 0 1900))) (reduce concat (take 1900 fooseq)))
14:45defn=>true
14:45fliebelchousuke: http://pastebin.com/m7ee2fd0
14:46chouser,(first (lazy-seq (repeat (vector 1 2 3)))
14:46fliebelI think it's line 11
14:46clojurebotEOF while reading
14:46chouser,(first (lazy-seq (repeat (vector 1 2 3))))
14:46clojurebot[1 2 3]
14:46hiredman_fogus_: I think if you follow + down the call chain you will find a method being called on nil
14:46Chousukefliebel: resolve is returning nil
14:46chouserdefn: the lazy-seq/repeat example returns a list of vectors. The apply and reduce concat examples return a list of numbers.
14:47konrthe-kenny: Well, my library is not in java.class.path, and I get a class not found exception when I try to use one of its classes
14:47Chousukefliebel: you don't have an "a" fucntion
14:47defnchouser: ah, ok, thanks
14:47fliebelchousuke: that is supposed to tigger the else case...
14:47defnwhat are all the bit twiddling forms in clojure?
14:48Chousuke,(fn? nil[D[D[D[C[C[C[C[C[C[C[C[C  [A[B[A   [A[B[A[A  )
14:48clojurebotUnmatched delimiter: )
14:48Chousukeeh
14:48_fogus_hiredman: I think in that case the nil is an argument to an Integer ctor
14:48Chousuke,(fn? nil)
14:48clojurebotfalse
14:48Chousuke,(fn? @nil)
14:48clojurebotjava.lang.NullPointerException
14:48Chousukethere
14:49hiredman_fogus_: basically a method call :P
14:49Chousukecan't deref nil
14:49fliebelchousuke: so, how do I do a proper test for an existing function?
14:49Chousukefliebel: check whether resolve returns nil
14:49_fogus_hiredman: If you want me to say you're right, then OK. You're right. ;)
14:50fliebelchousuke: I don't even know how to make an && in clojure :$
14:50Chousuke(doc and)
14:50clojurebot"([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true."
14:50jasappdefn: (doc-find "bit") ?
14:50defnjasapp: i found it, thanks :)
14:50jasappoops
14:51jasapp(find-doc ...
14:51defni just got Hacker's Delight so I'm gearing up for bit twiddling fun with clj
14:51fliebelthanks! once you learn to think the lisp way everything becomes so obvious.
14:51stuartsierradefn: be aware, bit twiddling in Clojure is slow compared to Java
14:51jasappreally, how come?
14:51defnstuartsierra: is that a permanent fact, or the temporary situation?
14:52Chousukedefn: hopefully temporary.
14:52defnwhat's the reasoning behind it?
14:52defnout of curiosity
14:53defnand by slower, how much?
14:53Chousukedefn: boxing probably.
14:54fliebelchousuke: This is how far I can get… (if (and (resolve (first func)) (fn? @(resolve (first func))))
14:54Chousukefliebel: that should do it.
14:55fliebelchousuke: Caused by: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Character
14:56Chousukefliebel: you have an error someplace else I guess.
14:56Chousukebecause that looks just fine to me.
14:56fliebelyou see what I mean by unhelpful error messages?
14:56Chousukefliebel: you can't map html btw
14:56Chousukeit's a mcro.
14:56Chousukemacro*
14:56fliebelah… :(
14:57defnso this is my first experience with bit twiddling: the following formula can be used to test if an unsigned integer is of the form 2^n - 1: x & (x + 1)
14:57defnhow would you implement this in clojure?
14:57stuartsierradefn: temporary, I hope
14:58fliebelchousuke: thanks for saving me again :P
14:58Chousuke(bit-and x (inc x))? /
14:59defnlol duh, i tried a couple tests and it didnt look like it was working, but it is
14:59defnthanks Chousuke
15:00fliebelIs there something like recursive macros?
15:00defn(recur) ?
15:00defnoh, macros, hmm, i dont know
15:01Chousukefliebel: yes.
15:01Chousuke~def ->
15:01fliebellike (macro (some-other-macro))
15:01defndid (->) come before (..) or was it vice versa?
15:01somnium`,(macroexpand (->> (range 5) (map inc) (map dec)))
15:01clojurebot(0 1 2 3 4)
15:01somnium`,(macroexpand '(->> (range 5) (map inc) (map dec)))
15:01clojurebot(map dec (clojure.core/->> (range 5) (map inc)))
15:05fliebelI try to make this recursive: http://pastebin.com/m2f9cba4b (so that "boe" can be another expression that is treaded just like func)
15:06fliebelBut I guess it's time to sleep *yawn*
15:06fliebelOh, one more thing: Because strings are immutable, does that mean string concatenation is slow?
15:10carkfliebel : yes, use a StringBuilder when you need speed
15:10fliebelcark: what is that?
15:11carkhttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html
15:11chouser(apply str ...) uses a StringBuilder internally
15:11carkor (apply str my-seq-of-strings)
15:12Chousukethere's usually no need to use stringbuilder explicitly.
15:12Chousukesince str uses it.
15:13fliebelok, thanks :) I'm off to my bed… Bye!
15:15polypusare namespaces on clojure anything like package names in java where there a.b.c maps to a directory hierarchy a/b/c?
15:16jasappis using StringBuilder really faster than concat?
15:16jasapphttp://pastebin.com/m50c24ade
15:16jasappor is my test case not big enough to see advantages?
15:17stuartsierrapolypus: yes
15:17stuartsierrajasapp: concat is for sequences, not strings
15:17stuartsierra,(concat "foo" "bar")
15:18clojurebot(\f \o \o \b \a \r)
15:18polypusstuart: ty. so why does lein set the top level ns to <project-name>.core? why isn't it just <project-name>
15:19shr3kst3r,(str "foo" "bar")
15:19clojurebot"foobar"
15:19stuartsierrapolypus: I guess lein assumes multiple namespaces in a project
15:19stuartsierradon't know about lein
15:19jasappahh
15:20the-kennypolypus: technomancy is the guy you want to talk with :)
15:22polypusi'm not a java hacker so i'm a bit confused about how i should be naming my namespaces. lwt's say i have a project foo. with directory structure foo, foo/src, foo/src/foo.clj, foo/src/foo/bar.clj. are there any conventions that i should be following with respect to namespace names in foo.clj & bar.clj?
15:23polypuss/lwt/let
15:23the-kennysrc/foo/bar.clj is (ns foo.bar)
15:23chouserpolypus: it's normal, if a bit inconvenient, to use a globally unique name for your namespace and/or java package name
15:24chouserso perhaps org.polypus.foo
15:24chouserthe definition for such a namespace foo should be in a file org/polypus/foo.clj
15:25chouseryou might stick that in a src dir, so perhaps foo/src/org/polypus/foo.clj
15:25chouserthen you can add foo/src to your classpath and (require 'org.polypus.foo) to load your namespace.
15:26polypuschouser: ty
15:27chousernp
15:28technomancypolypus: it uses foo.core since you can't AOT single-segment namespaces
15:29polypusso under this scheme my bar.clj file would be under foo/src/org/polypus/foo/bar.clj and have namespace org.polypus.foo.bar?
15:29polypustechnomancy: ty
15:30lisppaste8dakrone pasted "I thought multiple definitions were allowed?" at http://paste.lisp.org/display/91782
15:31dakroneare multiple arg# definitions not allowed (like what I pasted?)
15:31ska2342dakrone: I think you're missing an extra pair of parens
15:32defnim new to building packaged applications and such, im using leiningen right now, but basically i have src/dejure/ and src/dejure.clj, im working on a compojure project -- where would i put something like say...an images/ folder or a public/ folder?
15:32defndoes that stuff all go in the project root?
15:32dakroneska2342: do I need a paren-thize (?) both definitions, or each individually?
15:32technomancypolypus: there's no need in Clojure to use something like org.polypus
15:32polypusdakrone: (defn f ([...] ...) ([...] ...))
15:32technomancythat's a java convention you see carried over, but it's not helpful
15:33ska2342dakrone: take a look at the example on http://clojure.org/special_forms where fn is described
15:33technomancypolypus: and it can be very annoying if you try to hand off maintainership of a project
15:33dakronepolypus & ska2342 okay, that was my problem, thanks guys/girls
15:33technomancyoh hah; here I am directly contradicting chouser.
15:33_fogus_What?!? There are girls here?
15:33technomancyobviously there is no consensus about this
15:33the-kenny(something = the file, the module of the project)
15:33the-kennys/the/one/
15:34technomancybut I feel that the domain-name-as-namespace convention is an annoyance
15:34technomancyanyway, if your project name is not enough to make your namespace unique then you have bigger problems to deal with
15:34technomancylike finding a better project name
15:34chouserhm
15:34ska2342(count (filter is-girl people-in-hash-clojure))
15:34defntechnomancy: is there a good place to learn the basics of structuring lein projects past the initial configuration.. i ran lein new myprojname, im trying to figure out where to place things like a public directory, stylesheets, images, etc. for a compojure project
15:35defndoes that stuff go in src/, or in the proj. root?
15:35technomancydefn: put it in resources/
15:35the-kennydefn: Look at the readme :)
15:35technomancythat was added right before the 1.0 release
15:35defnoh cool, thanks
15:36lisppaste8dakrone pasted "why is abs randomly not available?" at http://paste.lisp.org/display/91783
15:36technomancypolypus: maybe since chouser is writing a book called "idiomatic Clojure" you should listen to him instead of me; dunno. =)
15:36polypus:)
15:37dakronecan anyone tell me why the call to Math/abs is resolving sometimes, but not others?
15:37the-kennydakrone: Could you show us the code?
15:37dakronethe-kenny: sure
15:37lisppaste8dakrone annotated #91783 "the whole code" at http://paste.lisp.org/display/91783#1
15:38polypustechnomancy: i'm still a bit confused. you have <proj>.core but the directory structure does not mirror this. why can you get away with this?
15:38the-kennydakrone: ah, got it. Add a type-annotation
15:38dakronethe-kenny: oh okay, so it's the duck-typing that's confusing it?
15:39the-kennyIt calls abs with reflection and it looks like the type of one argument on a call is changing and there isn't an abs for this type of args defined
15:39the-kennydakrone: I think so. Just try it
15:39the-kennyAnd (set! *warn-on-reflection true), so you'll get warnings if some java-call goes through reflection :)
15:39the-kennys/ion/ion*/
15:40dakronethe-kenny: I replaced the line with (/ (reduce + (map (fn [#^Double n] (Math/abs (- n average))) list-of-nums)), but I still get the same error
15:41defntechnomancy: just a suggestion, but for a `lein new project`, I keep having to reformat the project.clj from the single line to a more readable/editable version
15:41defnany plans to make that indented properly on init?
15:41the-kennydefn: hmhm... I have no idea then.. sorry
15:42cark,(doc double)
15:42clojurebot"([x]); Coerce to double"
15:43dakronecark: okay, wrapping the (- n average) in double did the trick
15:44hiredmanit seems like if you set java.system.class.loader to something like http://gist.github.com/251980 adding classes, jars, etc at runtime wouldn't be a problem
15:44dakronecark: thanks
15:45chousertechnomancy: it might be worth having a discussion about project name layouts
15:45chouserI certainly have no love for the extra directory level required by com/org
15:45the-kennyhiredman: It would be really cool if something like this would be in clojure itself :)
15:46ska2342dakrone: I think average is sometimes a ratio and Math/abs doesn't know how to deal with them. It should suffice to coerce average to double. Could you try?
15:46dakroneska2342: yep, cark suggested that and it fixed the problem
15:46hiredmanthe-kenny: I dunno if it actually solves whatever the problem is
15:46dakroneska2342: you're right, I totally forgot that average is sometimes a ration
15:46dakrone*ratio
15:46ska2342,(Math/abs 3/2)
15:46clojurebotjava.lang.IllegalArgumentException: No matching method found: abs
15:47hiredmanI'm throwing it out there and hopefully someone will say "yes it does"
15:47chousertechnomancy: but surely having people at org.clojure maintain a project whose name happens to be net.n01se.foo is less of a problem (is it really any problem at all) than for two groups who have no knowledge of each other to each build libs named, oh I don't know, "statistical"
15:47ska2342this gives reason to having clojure-built-in abs, no?
15:47chouserthe latter case causing really painful issues for anyone trying to have both in the same classpath.
15:48slyrushiredman: is that a prototype swank-class-loader?
15:48dakroneska2342: I agree, having a built-in would be nice
15:48hiredmanslyrus: I don't know, I barely have swank working
15:49hiredmanI do have the gist posting thing in emacs working, I guess
15:49slyrusworks for me... i even finally managed to get incanter working with slime
15:51technomancychouser: right, but why would you have two groups with no knowledge of each other?
15:51chouserbecause the world is a big place?
15:51technomancyseems like picking a project name is a task that deserves some thorough research
15:52hiredmanif this system classpath thing works, add-classpath could be rejiggered to check to see if the system classloader is clojure friendly and error out if it isn't
15:52technomancychouser: maybe for internal projects you could make that case
15:52technomancybut I don't see how it makes sense for open source
15:52hiredmanI mean, I have tried it, and it in my very limited testing it works
15:52technomancyGoogle's index makes the world a lot smaller than it used to be. =)
15:52chousertechnomancy: what about an internal project that goes open source later?
15:53chouserconversely, once a project is named org.something, why ever change it? I don't see a problem (other that the extra directory level)
15:53technomancysure, open-sourcing a project is probably not a good reason to rearrange the directory layout
15:54the-kennyIs there a slime-command to shutdown the in emacs running lisp-process? Always killing *inferior lisp* is annoying
15:54technomancybut really the collision would only exist if two similarly-named private projects both decided to open their codebases
15:54LauJensenthe-kenny: in the repl, hit ,q
15:54technomancyit's pretty edge-casey
15:54the-kenny,q?
15:54clojurebotjava.lang.Exception: Unable to resolve symbol: q? in this context
15:55technomancydefn: there's a TODO for prettyprinting project.clj; yeah
15:55defncool
15:55technomancybut the contrib prettyprinter doesn't really look all that great
15:55the-kennyLauJensen: ahhhh I totally forgot about this ,-thing. Thanks!
15:56LauJensennp :)
15:56ska2342the-kenny: the slime REPL buffer has a shortcut-key (,) which can be used to access a few functions. I seem to remember that it only works at the beginning of a new REPL line. BTW: ,s (sayoonara) does the same.
15:56ska2342try , TAB for a list
15:56clojurebotfor is not used enough
15:57the-kennyska2342: Yes, I used this with common lisp some time I ago. I just forgot it was there.
15:57polypuswhy is it alright to have proj-name.core at the top level of src. why does asking for this ns by way of :use or :require even work? from what chouser said i'd expect the directory structure to be proj-name/core.clj
15:57carkwhat's not to like about c.c.pprint ?
15:57carkbesides speed
15:57ska2342the-kenny: wouldn't it be nice to load a contrib-lib like you could with asdf-systems? :-)
15:57the-kennyska2342: Yes :)
15:58churibwow, didnt knew the ,-thing
15:58hiredmanpolypus: proj_name/core.clj actually
15:58technomancycark: I just meant that the output it produces in this particular case doesn't match what a human would do
15:58technomancypolypus: that's a bug
15:58technomancythe new task on leiningen was ... not well-tested for the 1.0 release
15:58technomancywe should have 1.0.1 out in a couple days
15:58the-kennyBut I mainly needs this if I've added a new lib to my project and don't want to restart my repl
15:59ska2342cool: , change-package seems to work
15:59technomancyska2342: see also C-c M-p from a clojure buffer to change the repl namespace
15:59polypushiredman: ahh so rewrite - as _? is this a java thing?
16:00polypustechnomancy: so the behaviour will change with 1.0.1?
16:00ska2342technomancy: he, never used that in my CL days, or else it dropped off the memory
16:00the-kennyBtw. should M-x slime-list-threads work with swank-clojure?
16:00the-kennyI think it would be a nice thing to have
16:01enoanyone has idea why I get this error trying to run lein generated jar (not uberjar)? http://paste.lisp.org/display/91786
16:01technomancythe-kenny: it would... just nobody's gotten around to porting it yet
16:01the-kennyeno: is clojure.jar in your classpath?
16:01technomancyeno: try lein deps first
16:01the-kennytechnomancy: hm okay. Maybe I will :)
16:02eno"lein deps" returns without anything
16:02enothe-kenny: I put clojure-....jar explicitly in java -cp
16:02patrkrisi've noticed that clojure-projects often build a project-source.jar file... what's that used for?
16:02the-kennyeno: and clojure.jar itself?
16:04enothe-kenny: tried java -cp ~/.clojure/clojure.jar:lib/clojure-1.1.0-alpha-20091126.000150-7.jar:lib/clojure-contrib-1.0-20091208.130239-27.jar
16:04enosame error
16:04rulliehi folks, i'm a noob
16:05enoOTOH, hello-standalone.jar runs fine
16:05technomancyeno: ah; -jar and -cp are mutually-exclusive
16:05technomancyjava -jar is only good for standalones; that's just how java works.
16:05enoah ok
16:06rullieis it safe to say you can use all existing java libs in cljure?
16:06polypusrullie: yes
16:06carki don't think so ... some need annotations
16:07rulliewhat about generics and such
16:07ska2342cark: oh, they cause a problem? Never thought about that. Do you have any reading material on this at hand?
16:08carkwith type erasure generics are no problem i think
16:08polypusdoes clojurebot have paste.lisp.org support?
16:08enoprobably should use "java -cp clojure.jar:helloworld.jar main.Class"
16:09the-kennyIs there a way to show the differences between the saved version of a file and the modified file in emacs?
16:10LauJensenFor those of you who use ClojureQL and have been annoyed with the lack of a persisted global connection, its now added :)
16:11the-kennyhah, got it. diff-buffer-with-file :)
16:13rulliedon't remember what you typed? :p
16:14rullieso how does clojure handle generics?
16:15the-kennyrullie: Yes, I was working on some files and couldn't remember that I've worked on that file.. but I could have made important changes to it
16:16carkrullie : it doesn't, there is no need as clojure is dynamically typed
16:16ska2342the-kenny: that reminds me that I wanted an ediff session for unsaved changes for ages. Never got across the prototype stage, though :-(
16:16rulliecark: what i meant is how does it work with libs that do have generics in it
16:16lpetitHello
16:16carknothing special about it, just use as usual
16:17the-kennyrullie: Iirc, generics are removed at compile-time.
16:17the-kennyThere are just type annotations to the compiler
16:17enorullie: type erasure
16:17rullieok, that's great
16:17carkwell no it sucks =) .net is better in that respect
16:17carkbut good for clojure yes =)
16:18rulliegreat as in no need to worry about them in clojure
16:18the-kennycark: C++ is better in that too :D
16:18the-kennyTemplates > Generics
16:18lpetitrhickey: would like to know what you have in mind concerning the future of the ad-hoc hierarchy mechanisms currently in place for multimethods. And also if you want (or is it already done ?) to bridge the 2 "types" concepts ?
16:20carki don't know c++ much, are generics and templates solving the same problems, or do they just have a slight overlap ?
16:21the-kennycark: templates are mostly used like generics, but the types aren't dropped at compile time.
16:22hiredmangrrr
16:22the-kennyhiredman: Did I say something wrong?
16:23hiredmanI somehow end up with missing parens, and paredit won't let me insert a paren
16:23polypusyeah that's annoying
16:23technomancyhiredman: C-q )
16:23technomancyC-q is "break the rules" mode
16:24the-kennywhoa, something's wrong here. swank-clojure-project just started a sbcl-session
16:25ska2342the-kenny: nothing wrong with sbcl .. oops, wrong channel ;-)
16:25ska2342the-kenny: maybe you have several slime-lisp-implementations?
16:26the-kennyska2342: Yes, but it worked until now. I just updated swank-clojure to the latest version.
16:26the-kennyBut it's a special case here.. I don't want to use elpa ;)
16:26ska2342the-kenny: I don't use elpa, too. The whole setup feels rather fragile.
16:27ska2342the-kenny: I'll take a quick look at latest commits
16:27the-kennyska2342: Yes, I feel the same
16:28ska2342the-kenny: when did you do your last update? The latest commit seems to be from 2009-10-18
16:28the-kennyska2342: Some weeks ago
16:28the-kenny3 or so
16:28the-kennyI'm a bit lazy at updating because it always breaks something on my setup :D
16:29ska2342the-kenny: what is the value of slime-lisp-implementations
16:30the-kennyska2342: the sbcl-part and another part for clojure. I have a custom function run-clojure which starts a clojure-instance, but requiring swank fails there
16:30ska2342the-kenny: I always look there first. I set up everything so that slime uses the same clojure-shell-script I can use (and test!) from the command line.
16:31hiredmanwith paredit can I yank an s-expr from where it is and put it somewhere else?
16:31the-kennyMaybe I'll drop my setup *again* and start from scratch
16:31the-kennyWorked fine the last ~2 times
16:31KirinDave_hiredman: Yes.
16:31ska2342the-kenny. Ah, requiring swank. That was a problem. I seem to remember to have run mvn package or something and then added the target/swank-clojure-1.0-SNAPSHOT.jar to the -cp
16:31hiredmanKirinDave_: please explaind how
16:31KirinDave_hiredman: Go to the start of the sexpr and hit ctl-k. Then you can yank it out. C-k only does one sexpr, not one line.
16:32slyrushiredman: ^K and ^Y
16:32hiredmanKirinDave_: C-k does the yanking or sets up for the yanking?
16:32KirinDave_hiredman: C-k does the killing.
16:32hiredmanC-k C-y ?
16:32KirinDave_hiredman: And then it's in your kill ring.
16:32KirinDave_And then you can C-y at any time to yank the most recent kill ring entry out.
16:32hiredmanI see
16:33hiredmankill-ring
16:33hiredmanhow superhero like
16:33technomancyhiredman: indeed. unfortunately M-x hide-body does *not* do what you might think.
16:33KirinDave_You might wanna do the basic emacs tutorials. Things like the kill ring are part of what makes emacs inordinately useful.
16:34polypushiredman: peepcode has a pretty good emacs video too
16:35the-kennyMaybe I'll give up and use elpa... technomancy wins! ;) (No offense)
16:35technomancythe-kenny: cool. =) if it persists please bring it up on the swank-clojure mailing list. I don't even have sbcl installed myself, so it's good to hear from folks who use both.
16:36the-kennytechnomancy: Okay.. I hope I don't have to change anything in my .emacs for sbcl if elpa installs slime for me..
16:40polypusi'm trying to make a test jar with lein jar and i'm getting Exception in thread "main" java.lang.ClassCastException: java.io.StringWriter (NO_SOURCE_FILE:0). any ideas?
16:44the-kennytechnomancy: Okay, swank-clojure is installed now.. I'll try to bring slime with sbcl working now.
16:49rulliethe heck there's a slime for clojure?
16:49rullieneat stuff
16:49the-kennyrullie: Sure
16:50the-kennyrullie: I'm sure it was one of the first "big" projects for clojure
16:50ska2342FTIW I just posted my setup to my site: http://www.skamphausen.de/cgi-bin/ska/My_Clojure_Setup works for me on Linux and OSX with current checkouts of swank-clojure, clojure-mode,current master of clojure, and a SLIME which is a few weeks behind.
16:51rullieska2342: cool, i have the same setup. gonna try it tonight
16:51the-kennytechnomancy: How can I bring slime-fuzzy to work with elpa?
16:56the-kennytechnomancy: Nevermind.. just add slime-fuzzy.el to my load-path and do (slime-setup '(slime-fuzzy))
16:56LauJensenthe-kenny: Whats fuzzy ?
16:57dakronetechnomancy: is there a way to specify which ssh key to use when doing a 'lein push'?, it looks like leinigen isn't respecting ~/.ssh/config's option
16:57the-kennyLauJensen: Fuzzy-Completion for the slime repl. w-oTAB extends to with-open
16:57LauJensenah ok
16:58the-kennyok.. it doesn't work :(
16:59LauJensenWonder how much it would speed things up anyway
17:00the-kennyLauJensen: I'm used to it
17:00ska2342LauJensen: fuzzy completion? It's a killer and your finger-brain will take even more control
17:02LauJensenOk
17:02ska2342LauJensen: while the-kenny was already sending his answer, I was still typing mine. And had the w-oTAB example, too. I think that is the only one that I consciously know of (I found out about fuzzy completion with with-open-file in CL), all the others are in my fingers. Don't know how they work :-)
17:02LauJensenCommon Lisp code, compared to Clojure is usally very verbose, so for SBCL its probably doing you some good, not sure how well it will fare in Clojure-land
17:09lpetitHello, I would like some suggestions for implementing something in ccw: when a REPL is launched, a "ConsolePageParticipant" object (instance of some predefined interface) 's init() method is called. In this method, I have the opportunity to get the TCP port at which my "IDE backdoor" will install itself. But, there is no possibility to coordinate the call from the framework to my "ConsolePageParti
17:09lpetitcipant"'s init() implementation, and the availability of the information of the TCP port (very frequently, init() will be called before the info is available). In my init() method, though, is the opportunity to initiate the code to get the TCP port info for future uses, *and also*, to, as soon as possible (when the TCP info is needed), use the "IDE backdoor" to display a View on the...
17:09lpetit...available namespaces symbols.
17:12lpetitSo my question is: is using a future a good solution ? The potential problem I can see is in the last sentence above : I would like to also initiate a use of my future, without blocking. I can see at least 2 possibilities :
17:12lpetitdo this in the future body : (future (let [tcp-port (try-hard-get-tcp-port-potentially-sleep-and-loop)] (initialise-namespace-browser! tcp-port) tcp-port))
17:13lpetitor restrain the future body to the task of gathering the tcp-port, and in the code that creates and stores the future, launch another action (maybe via an agent ?) to asynchronously use the future ??
17:14lpetitIf anybody more skilled than me in these problems can help ... you're very welcome, 'cause I'm circling, circling on it ...
17:15spuzlpetit: sounds like a pretty hacky way of doing it...
17:16spuzI guess there's no way to wait on a callback from the REPL when the TCP information is available?
17:16lpetitWell, I'm currently looking at the patch provided by Gorsal, and I'm indeed neither satisfied by the patch, neither satisfied by what i can think as an alternative ...
17:17lpetitCurrently no, and I don't want to make Eclipse hang because of that (and if there's an initialization problem, sometimes Eclipse could hang forever .. :-( )
17:18the-kennyHah, got slime-fuzzy working :)
17:18ska2342lpetit: "Eclipse could hang forever"? You're more a netbeans fan, then? :-)
17:19lpetitska2342: anybody writing a plugin badly may break the underlying platform, I guess. Just trying not to do that.
17:20ska2342lpetit: just kidding, couldn't withstand that punchline
17:20lpetit:)
17:20the-kennyI recommend slime-fuzzy to everyone :)
17:20spuzlpetit: do you have gorsal's patch on github?
17:21lpetitska2342: if you better would like to give me your ideas concerning how to do it :-)
17:22ska2342lpetit: sorry, me I'm no help with Eclipse and Java stuff. Just Emacs, nothing else.
17:23spuzlpetit: I found it: http://github.com/Eyaro/ccw/commit/06c00832f1c2e5c4a7c15d6de0f625ad6b0e8e7e#L7L1
17:23lpetitspuz: it's on his github clone ( git://github.com/Eyaro/ccw.git ). Beware there's a lot of noise inside it. But what it does is very simple : start a new thread, loop in the thread forever, with Thread.sleep pauses between 2 tries. Solves the problem. Exceptional issues not well covered, though.
17:24spuzlpetit: yeah, I see, you're suggesting replace the thread with a future but that doesn't really make it much more elegant :p
17:26lpetitspuz: a future can be cancelled (so we can call future-cancel on the dispose() method). But now that I think about it, I can also do a similar think by sharing the Thread reference
17:27spuztrue, but when would cancel the future?
17:27lpetitska2342: really, it's not an Eclipse problem. I gave the real context but I could have stated it more generally : In a thread A I want to start the computation of a value V. I also want some stuff S done as soon as possible as V is available. And I don't want to wait on thread A. What's the best way to code it ?
17:30lpetitspuz: on ConsolePageParticipant.dispose() call by the framework ( I guess this dispose() method corresponds to the end of the corresponding launched REPL
17:30spuzhmm ok
17:31lpetitFolks, I guess that by having written the word "Eclipse" I've frightened a lot of you, so let me point that this is not an Eclipse related problem, and restate it more generally:
17:31lpetitIn a thread A I want to start the computation of a value V. I also want some stuff S done as soon as possible as V is available. And I don't want to wait on thread A. How would you do this ?
17:41polypusabout to light my hair on fire. here are the exact steps i'm taking:
17:41polypuslein new foobar
17:41polypusedit foobar/project.clj to look like this:
17:41the-kennytechnomancy: Looks like sbcl works flawlessly with swank-clojure from elpa :)
17:42polypus(defproject foobar "1.0.0-SNAPSHOT"
17:42polypus :description "foobar"
17:42polypus :dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"]])
17:42polypusmv src/foobar.clj src/foobar/core.clj
17:42polypusedit core.clj to look like this:
17:42polypus(ns foobar.core)
17:42polypus
17:42polypus(defn barfoo [x] (str "foobar:" x))
17:43polypuslein repl works fine
17:43polypuslein compile seems to also
17:43polypusbut lein jar fails with:
17:43polypusException in thread "main" java.lang.ClassCastException: java.io.StringWriter (NO_SOURCE_FILE:0)
17:44polypusany ideas?
17:45gravitypolypus: Add a :main your_namespace section to project.clj
17:46technomancypolypus: on JDK 1.5? if so that was fixed yesterday in master.
17:46tcrayfordI made something roughly like ruby's autotest with lein and some ruby scripting
17:46tcrayfordhttp://www.tcrayford.net/2009/12/08/Lein-Autotest.html
17:47tcrayforduses watchr for changes to .clj files in /src or /test and then runs lein test, and colours the output for pass/fail
17:48polypusgravity, technomancy: ty i'll have a look in a minute
17:48the-kennyelpa is dumb...
17:49the-kennyDoesn't install any .lisp-files with slime
17:49the-kennySo the emacs-part of slime is working, but no backend for any lisp is installed
17:50the-kenny(they are normally bundleled with slime)
17:51technomancythe-kenny: yep; elpa is an elisp package manager. you should use a CL package manager for the CL bits, just like you use lein/mvn for swank-clojure.
17:51konrfor some reason, I messed up with the number of parentheses and now everything I try to enter on SLIME results in a "input not complete" error. Is there a way to "reset" things and get a real repl again?
17:52the-kennytechnomancy: mhm... I'm not sure if the backend for sbcl is in the package manager of CL
17:53technomancythe-kenny: what I mean is if it's not, that's a CL problem, not an elpa problem
17:53the-kennytechnomancy: I understand you. It's just new for me. I'm used to have everything in my slime-tarball.
17:56KirinDave1Hey, if I'm at the repl
17:56KirinDave1How would I figure out the current working directory?
17:59tcrayford(use 'clojure.contrib.duck-streams)
17:59tcrayford(pwd)
17:59KirinDave1Man this is bizareew
18:00KirinDave1So I know my pwd is correct
18:00KirinDave1It's /Users/kirindave/Projects/scorekeeper/
18:00KirinDave1I know that under scorekeeper is a templates directory
18:00KirinDave1and in that is home.html
18:01KirinDave1But (reader "templates/home.html") refuses to read.
18:03hiredmanhah!
18:03KirinDave1Oh
18:04KirinDave1In java, you can't change the current working directory?
18:04KirinDave1...
18:04KirinDave1What kind of insanity is that?
18:06Chousukehiredman: working on a compiler now? :P
18:06the-kennyKirinDave1: Blame sun
18:09tcrayfordKirinDave1: eval this (str (pwd) "templates/home.html")
18:10KirinDave1tcrayford: I was under the impression you could change the current working directory
18:12dnolenKirinDave1: nope, massive limitation of Java. I often create a var called *cwd* so that I can using binding on it to get around the annoyances.
18:12KirinDave1So when you're developing on the repl
18:12KirinDave1how the hell do you even get to files?
18:13dnolenyou could even make a function called cwd that either returns the standard current directory (whatever the JVM thinks) or the values of *cwd*
18:13slyrusKirinDave1: change the classpath and restart the JVM :P
18:13KirinDave1slyrus: For things like templates.
18:13dnolenvalues -> value
18:13KirinDave1slyrus: That seems pretty lame.
18:14slyrusI agree!
18:15KirinDave1argh and enlive stopped working for me again. Seriously, I quit.
18:16KirinDave1cgrand-r1c: I don't suppose you're still here?
18:18dnolenKirinDave1: what's the bug you're seeing? I messed around with Enlive quite a lot at one point.
18:18KirinDave1dnolen: All deftemplate ever says is "null pointer exception"
18:18KirinDave1So I have no idea.
18:18dnolenpaste your template, I'll take a look.
18:21KirinDave1dnolen: both template and invocation are here: https://gist.github.com/dd83a434403e29fdf09d
18:23dnolentry (str *templates-dir* "home.html") -> (file *templates-dir* "home.html"), use clojure.contrib.java-utils to get file, gotta head out but will tweak your gist when I get back.
18:24technomancythe-kenny: heh; thanks.
18:24technomancyKirinDave1: I'd recommend putting templates in the resources/ dir. if you use leiningen that will get put on your classpath, plus it'll be available transparently when you run from a jar if you open it via getResourceAsStream.
18:27KirinDave1technomancy: So like, resources/templates/home.html instead?
18:27technomancysure
18:28KirinDave1technomancy: But that doesn't change my opening problem, right?
18:29KirinDave1technomancy: And that is only available during the jar'd state, not during dev on the repl?
18:31technomancyKirinDave1: no, if resources/ is on the classpath, getResourceAsStream will find it.
18:33KirinDave1technomancy: I'll try it. Thanks.
18:36technomancywelcome to the wacky wonderful world of the jvm
18:36KirinDave1technomancy: … I loathe to ask this, but where do I call that method from, even
18:37technomancyoh right... it's a bit wordy: (.getResourceAsStream (.getContextClassLoader (Thread/currentThread)) "/templates/home.html")
18:37KirinDave1Well, there's hardly anything to it, now is there?
18:39konrHas anyone ever tried to change swing's look and feel? This code, removed from an example, simply yields a null pointer exception:
18:39konr(javax.swing.UIManager/setLookAndFeel (javax.swing.UIManager/getSystemLookAndFeelClassName)) 
18:41KirinDave1technomancy: I wish it worked, but it doesn't seem to.
18:52hiredmanhttp://gist.github.com/252110 yay macros!
18:57replaca_technomancy: I'm glad you guys got the resource stuff in - I was worrying about that re: autodoc (cause I want to stash the default styles and templates in there as resources)
18:57cp2_hiredman: watcha' making?
19:01hiredmancp2: my goal is to replace classloader.java with something generated using the asm package
19:02cp2interesting
19:03cp2what for?
19:03hiredmanuh, so I don't have to write it in java?
19:04cp2heh, would be a good reason =P
19:19dysingerKirinDave:
19:19dysingeruser> (System/getProperty "user.dir")
19:20dysinger"/Users/tim/src/sa-safe/amqp/src/main/clojure/sonian/archive"
19:20dysingeruser> (System/setProperty "user.dir" "temp")
19:20dysinger"/Users/tim/src/sa-safe/amqp/src/main/clojure/sonian/archive"
19:20dysingeruser> (System/getProperty "user.dir")
19:20dysinger"temp"
19:20dysingeruser>
19:20dysinger?
19:21dysingerchanges cwd
19:22dysingerworks with (pwd)
20:19polypustechnomancy: btw, that lein problem i had was cuz of jdk 1.5 like you said. not sure why being that a 64 bit 1.6 version was already installed, apple chose to make the default a 32 bit 1.5.
20:23konrHow can I round 3.14159 to 3.1416?
20:24rulliekonr: http://java.sun.com/docs/books/tutorial/java/data/numberformat.html
20:28konrlr be
20:29konr*or better yet: http://richhickey.github.com/clojure-contrib/pprint-api.html#clojure.contrib.pprint/cl-format
21:22konris there a macro that could replace [(function foo) (function bar) (function baz) ...] with (macro function foo bar baz ...)?
21:27kylesmith(vec (map function [foo bar baz]))
21:30kylesmithHas anyone gotten penumbra to work? I can't get the libraries to stop throwing exceptions.
21:31konroh, of course
21:31ambientyep, got it working a while ago
21:31ambientat least all the exmples
21:40JAS415kylesmith: yup, got it working
21:40JAS415what is the exception
21:43kylesmithone moment, let me try one more thing.
21:46kylesmithcom.sun.gluegen.runtime.CPU.getPointerSizeInBits
21:48JAS415hmm
21:48JAS415is it a particular example?
21:48kylesmiththe actual exception is an UnsatisfiedLinkError if that helps
21:48JAS415oh
21:49JAS415you might not have all the deps installed
21:50kylesmithit's for all examples. I have all the jars on my classpath, and all the *.so files are on my libpath.
21:52kylesmithwhat other dependencies are there?
21:53JAS415i had
21:53ambientclojure, clojure-contrib
21:53JAS415glugen.jar, jogl.jar
21:53ambientyou sure you have the right binaries?
21:53ambientthere are 32 and 64 bit versions iirc
21:53JAS415nativewindow
21:54ambientdepends on the JVM, which you will need
21:54kylesmithyes, I have the right binaries (that is a different error message).
21:54kylesmithI'm on 32bit ubuntu, btw.
21:55kylesmithJAS415: yes, I have all those.
21:56JAS415hum
21:56JAS415the only problem i had was getting the names of directories right
21:56JAS415i'm on ubuntu too :-(
21:58kylesmith32bit or 64bit?
21:58JAS415i think this is 64
22:00JAS415you pointed at the directory for the java.library.path and not the individual *.so files?
22:02kylesmithwell, actually I 'cheated' and just copied the individual files to a directory already on the libpath.
22:06KirinDave1Hey, does anyone here use leiningen and the resources/ directory? I'm having problem accessing resources.
22:07JAS415kyle: can you do a backtrace on the error?
22:07JAS415might give you a class or filename
22:08kylesmithI just got it to work on the 64bit machine. I didn't see the additional library paths in swank-clojure.el before.
22:09JAS415hmm
22:09kylesmithhence, I thought I could just copy the files, but apparently that doesn't work.
22:10JAS415i think there is an extra jar
22:10kylesmithI count 3 jars and 5 *.so files. ?
22:11JAS415opencl4 java
22:11JAS4155 jar 5 so
22:11JAS4154 jar*
22:13kylesmithI was looking at that, but A. I don't need opencl and B. it isn't mentioned anywhere in the installation instructions. Are you saying OpenCL4Java.jar is actually needed?
22:16JAS415hum
22:20kylesmithWhat kind of bothers me is that the installation instructions explicitly state that what I was attempting to do was acceptable.
22:21kylesmithanyhow, thanks for the help JAS415
22:22JAS415yeah i'm not sure what happened there
22:22JAS415glad you at least have it working on one machine :-)
22:23kylesmithno, it's working on both now :) Thanks again.
22:23JAS415oh
22:23JAS415good
22:23JAS415even better
22:45konrWhat should I use to generate an exe from a Lein uberjar?
23:24polypus,'just-testing
23:24clojurebotjust-testing
23:29hiredman~ping
23:29clojurebotPONG!
23:30hiredmanso, I can generate a classloader using clojure.asm.* and it has a loaders field which contains an arraylist and an add method that takes a ClassLoader and adds it to the list
23:31hiredmannow I just need to override findClass