2009-12-08
| 01:20 | konr | Does you swing code look like a giant block of code with minor functions? I think something is wrong with mine. |
| 01:22 | arbscht | konr: I can't imagine how to interpret that description. can you paste an example instead? |
| 01:38 | twbray | Profiler tells me I'm spending all my time in java.lang.reflect.Array.get ... hmm... |
| 01:39 | dnolen | twbray: sounds like a missing type hint, you dereferencing a multi-dim array by chance? |
| 01:39 | hiredman | have you seen cgrand's post on arrays? |
| 01:40 | twbray | I suspect (let [ ... [client _ _ _ _ _ uri bstring status _ ref] (. #" " split line) ] |
| 01:40 | twbray | hiredman: Nope, but I think google just found it for me |
| 01:40 | hiredman | http://clj-me.cgrand.net/2009/08/06/what-warn-on-reflection-doesnt-tell-you-about-arrays/ |
| 01:40 | hiredman | you google faster than me |
| 01:41 | twbray | I've also been getting good results with hints |
| 01:43 | hiredman | oh |
| 01:43 | hiredman | I see the destructuring let |
| 01:43 | twbray | #<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:44 | hiredman | set! |
| 01:44 | hiredman | ,(set! *warn-on-reflection* true) |
| 01:44 | clojurebot | java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set |
| 01:44 | hiredman | anyway, it will work at the repl |
| 01:44 | dnolen | twbray: 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:45 | hiredman | the repl is run inside a binding where bindings for a bunch of stuff are setup so you can set! them |
| 01:45 | hiredman | destructuring is actually a pretty complex macro |
| 01:45 | hiredman | it's neat, but I would not bet the farm on it |
| 01:46 | twbray | Previously 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:46 | hiredman | huh |
| 01:46 | twbray | 40% of all CPU going into java.lang.reflect.Array.get, snicker |
| 01:46 | hiredman | no effect is good I guess... |
| 01:47 | hiredman | I think you'd use aget + a type hint instead of get |
| 01:48 | hiredman | now you … half the … etc |
| 01:49 | twbray | OK, will wire in aget, brb |
| 01:52 | dnolen | twbray: http://gist.github.com/251463 |
| 01:53 | dnolen | on my machine destructure is considerably slower, ~250ms vs ~150ms for that microbenchmark |
| 01:53 | twbray | dnolen: thanks |
| 01:53 | dnolen | because that's a java method call to split the string you don't need to type hint |
| 01:55 | twbray | When you get reflection perf hogs, it's usually pretty obvious int he -Xprof output |
| 01:56 | twbray | Hah, switching to aget made java.lang.reflect.Array.get go away :) ... |
| 01:56 | hiredman | :D |
| 01:56 | hiredman | magic |
| 01:56 | twbray | ... but bought me a reflection problem, java.lang.Class.forName0 all over the -Xprof :( |
| 01:56 | twbray | Need to find the right type hing |
| 01:56 | twbray | hint |
| 01:56 | twbray | Shouldn't be too hard |
| 02:00 | _ato | IIRC you need to hint both the array and the index |
| 02:00 | _ato | like (aget #^objects my-array (int i)) |
| 02:01 | hiredman | magic |
| 02:01 | hiredman | er |
| 02:01 | hiredman | _ato: the array is in a local and is the result of a java call, so the array type will propagate |
| 02:02 | _ato | ah cool. |
| 02:08 | twbray | hiredman: not sure... I just decorated all those aget values with type-hints and it made a big difference |
| 02:08 | twbray | e.g. #^String uri (aget fields 6) |
| 02:14 | hiredman | twbray: ok |
| 02:17 | dnolen | twbray: hiredman: is mostly right, types do flow down let bindings, the issue is the boxing of values returned from functions. |
| 02:17 | dnolen | that 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:18 | twbray | dnolen: OK. Not pretending I understand why that needs to be the case. |
| 02:19 | dnolen | twbray: 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:20 | dnolen | thus you don't need to typehint the return value of (. #" " split ...), but you have to type hint aget |
| 02:20 | dnolen | the return value of aget. |
| 02:20 | twbray | dnolen: That's a little surprising since aget exists specifically to reach into Java arrays |
| 02:22 | _ato | but isn't aget inlined? |
| 02:22 | dnolen | twbray: 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:23 | hiredman | hmmm |
| 02:23 | _ato | you think it could at least typehint it's second argument as an int |
| 02:23 | _ato | :/ |
| 02:23 | twbray | Also btw *warn-on-reflection* didn't |
| 02:25 | dnolen | order of magnitude difference: http://gist.github.com/251483 |
| 02:25 | _ato | I 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:25 | hiredman | twbray: yes, as cgrand mentioned in his post, *warn-on-reflection* doesn't catch array reflection |
| 02:26 | twbray | btw, thanks for the cgrand pointer; hadn't noticed him previously |
| 02:26 | dnolen | cgrand == crazy clojure hacker |
| 02:26 | hiredman | pitty about the font |
| 02:27 | twbray | Emacs is good for lots of things but not my fave for reading Java |
| 02:28 | hiredman | this is the second time I've installed emacs |
| 02:28 | twbray | hiredman: you on a mac? Aquamacs ftw |
| 02:28 | hiredman | the first time I just sort of stared at the empty editor for a while and then went back to vim |
| 02:28 | hiredman | freebsd |
| 02:29 | hiredman | a few clicks on emacswiki seems to indicate changing the font to dejavu sans mono is going to be a big deal |
| 02:29 | slyrus | twbray: the nextstep build isn't bad either |
| 02:31 | twbray | A line of output from "top" on one of those Sun multicore boxes, when Clojure's running hot: |
| 02:31 | twbray | 26278 twbray 130 40 0 5195M 5164M cpu 380:40 2815% java |
| 02:32 | hiredman | :D |
| 02:32 | hiredman | man, I want one of those |
| 02:32 | twbray | well, 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 | _ato | hiredman: 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:41 | twbray | recent 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:42 | hiredman | _ato: .emacs.el or .emacs or ...? |
| 02:42 | twbray | hiredman: ~/.emacs |
| 02:42 | _ato | hiredman: .emacs if you're not using the emacs starter kit |
| 02:43 | hiredman | my pinky is already killing me |
| 02:43 | hiredman | what a rough life |
| 02:43 | _ato | yeah, most emacs users swap ctrl and caps-lock |
| 02:44 | JAS415 | really? |
| 02:44 | twbray | On the mac, you can set caps-lock=>ctrl globally for all apps. Very helpful. |
| 02:44 | polypus | yeah or just leave ctrl as ctrl and change caps |
| 02:45 | JAS415 | IN CASE YOU GET ANGRY :-) |
| 02:45 | hiredman | _ato: just did that |
| 02:45 | hiredman | I had capslock mapped to compose |
| 02:45 | JAS415 | or for writing really old lisp code |
| 02:45 | hiredman | so I could make accented i's |
| 02:46 | hiredman | clojurebot: emacs? |
| 02:46 | clojurebot | emacs is best configured for Clojure with instructions at http://technomancy.us/126 |
| 02:48 | hiredman | C-j is eval elisp? |
| 02:48 | _ato | only in *scratch*, I use C-x C-e as that works when editing .el files and such |
| 02:49 | _ato | and C-x C-e is eval clojure code in a .clj file as well |
| 02:50 | _ato | actually maybe not even in scratch |
| 02:50 | _ato | C-j is newline for me |
| 02:51 | _ato | ah.. looks like in a fresh install C-j is eval and insert the output into the buffer |
| 02:54 | polypus | you can also C-c v for eval buffer as elisp. i set slime C-c v to slime-eval-lisp as well |
| 02:54 | hiredman | hmmm |
| 02:55 | JAS415 | you can also bind it however you want |
| 02:55 | polypus | sure |
| 02:58 | _ato | I'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:02 | hiredman | ugh, paste inserts where the mouse is |
| 03:02 | hiredman | (middle button paste in X) |
| 03:04 | _ato | I usually use the keyboard to paste (C-y) |
| 03:04 | _ato | you might need: (setq x-select-enable-clipboard t) |
| 03:04 | _ato | to make it paste stuff that's been selected |
| 03:06 | _ato | hiredman: looks like (setq mouse-yank-at-point t) might do the trick |
| 03:06 | _ato | that makes the middle-mouse paste at the cursor location |
| 03:06 | _ato | instead of the mouse pointer location |
| 03:08 | hiredman | I see |
| 03:08 | hiredman | C-j seems to somehow be bound to both newline and eval elisp |
| 03:09 | hiredman | doesn't work out well |
| 03:09 | _ato | you can check what function a key press is bound to with: C-h k <keypress> |
| 03:10 | _ato | so like C-h k C-j |
| 03:11 | hiredman | M-: |
| 03:11 | hiredman | excellent |
| 03:12 | hiredman | says newline-and-indent, but in the scratch buffer it also does eval |
| 03:13 | hiredman | yay! color-theme |
| 03:32 | triyo | I 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:33 | triyo | so should be nutrifact-0.1.0-SNAPSHOT.jar |
| 03:34 | hiredman | hmmm |
| 03:34 | hiredman | is there rainbow parens for emacs? |
| 03:37 | _ato | not built-in as far as I know. There's this: http://nschum.de/src/emacs/highlight-parentheses/ |
| 03:38 | eevar2 | do you get rainbow parens for anything but emacs? |
| 03:41 | hiredman | vimclojure |
| 03:41 | _ato | triyo: you can do "lein jar whatever-you-like.jar" to call the jar something different if you want |
| 03:42 | _ato | by default lein just calls it project-name.jar |
| 03:42 | _ato | ls |
| 03:42 | hiredman | _ato: close |
| 03:42 | hiredman | I guess that is close enough :/ |
| 03:43 | triyo | _ato: do you run the stable ver of leiningen or latest from master repo? |
| 03:45 | _ato | triyo: I run with master because I code on leiningen a fair bit |
| 03:46 | hamza | guys, is there a repeat like function that will execute a function repeatedly? |
| 03:47 | _ato | ,(take 10 (repeatedly rand)) |
| 03:47 | clojurebot | (0.8813602039501953 0.3653268991300669 0.6732810028855468 0.3679588982322579 0.6001436027276109 0.6081804356412707 0.7722853209560046 0.6811660555016636 0.18603216492432617 0.7955644218452835) |
| 03:48 | hamza | lol, so the answer was in my question, :) thanks... |
| 05:21 | adityo | ,'(nil 1 2 nil) |
| 05:21 | clojurebot | (nil 1 2 nil) |
| 05:21 | adityo | how do i remove the nils from this list |
| 05:22 | _ato | ,(remove nil? '(nil 1 2 nil)) |
| 05:22 | clojurebot | (1 2) |
| 05:23 | adityo | damn, how did i miss nil? |
| 05:23 | adityo | thanks _ato |
| 05:51 | scellus | adityo: you missed it because it was removed? :) |
| 05:54 | adityo | :) |
| 06:10 | LauJensen | Anybody here running Mac OSX who can spend 25 secs with me in priv? :) |
| 06:16 | AWizzArd | github down? |
| 06:17 | _ato | github's up for me |
| 06:17 | defn | How do I add compojure's jar and deps/*.jar to my classpath in my REPL? |
| 06:18 | AWizzArd | defn: you want to add it while the jvm is already running? |
| 06:19 | AWizzArd | _ato: thx for checking |
| 06:21 | _ato | I'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:21 | defn | i have a swank-clojure-import |
| 06:21 | _ato | ah, you must have a pre 1.0 version of swank-clojure then |
| 06:22 | _ato | if you're using java 6 then adding ".../compojure.jar" and "deps/*" to swank-clojure-extra-classpaths should work |
| 06:22 | defn | do you run jochu's? |
| 06:23 | defn | i had trouble with technomancy's vers. with my current config so i switched back to jochu's |
| 06:23 | _ato | I run technomancy's with no config |
| 06:24 | defn | but that forces you to run it on projects right? |
| 06:24 | defn | do you have it via elpa? |
| 06:24 | hoeck1 | defn: have you restarted emacs? |
| 06:24 | defn | hoeck1: no, i opened a new REPL, d'oh, one sec |
| 06:25 | hoeck1 | jochu's swank-clojure only builds the classpath on an emacs restart |
| 06:25 | _ato | it doesn't force you to run it on projects, you can use M-x slime as well |
| 06:25 | defn | hoeck1: that fixed it thanks |
| 06:25 | defn | _ato: did you get it via elpa? |
| 06:26 | _ato | I think so |
| 06:26 | _ato | I've tried both ways |
| 06:26 | _ato | I think I'm currently with ELPA |
| 06:38 | defn | bah wtf |
| 06:38 | defn | i removed the init.el entry for my clojure.el stuff -- installed swank-clojure, clojure-mode, etc. via ELPA |
| 06:39 | defn | and now it complains when i start emacs that it cannot load swank-clojure, cant find it |
| 06:39 | defn | Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "lisp") |
| 06:39 | LauJensen | defn, sounds like you need (setq swank-clojure-binary "/some/shell/script.sh") ? |
| 06:41 | defn | LauJensen: i dont even get that far |
| 06:41 | defn | it wont load swank |
| 06:43 | _ato | stupid ELPA |
| 06:43 | _ato | make sure you have nothing to do with swank-clojure in your init.el (no requires or anything) |
| 06:44 | defn | yeah im pretty sure i dont, maybe this is cached from loaddefs.el or something? |
| 06:44 | LauJensen | defn, I posted a 'get started with clojure' link on my blog once, want me to dig it up ? |
| 06:44 | _ato | :/ |
| 06:45 | defn | heh this is embarrassing |
| 06:45 | LauJensen | oh, youre not a noob? :) Sorry |
| 06:45 | defn | i think i fixed it |
| 06:45 | _ato | I guess have a poke in ~/.emacs.d/elpa/swank-clojure-1.0 and make sure the files are there |
| 06:45 | _ato | ah, cool |
| 06:45 | defn | i think i just needed slime-repl from ELPA |
| 06:45 | defn | i figured that'd be a dependency or something |
| 06:45 | _ato | yeah it should have been |
| 06:45 | _ato | strange |
| 06:46 | defn | swank-clojure-project still seems broken |
| 06:47 | _ato | what does it do? |
| 06:47 | defn | just keeps polling on the project dir |
| 06:47 | defn | until i have to abort with slime-abort-connection |
| 06:48 | _ato | you copied in clojure.jar clojure-contrib.jar and swank-clojure.jar right? |
| 06:48 | defn | i thought it copied those automatically for you |
| 06:48 | _ato | nah |
| 06:48 | _ato | causes you might want to use different versions |
| 06:49 | defn | right, just thought if it couldnt find them that it'd give you something to work with |
| 06:49 | _ato | if you want to use the versions it downloaded they're in ~/.swank-clojure |
| 06:49 | defn | but ok |
| 06:49 | defn | thanks :) |
| 06:50 | _ato | that worked? |
| 06:50 | _ato | yeah 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:52 | LauJensen | I 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:52 | adityo | LauJensen: whats the link for your blog |
| 06:52 | LauJensen | http://www.bestinclass.dk |
| 06:52 | LauJensen | Link the right-most pane named 'blog' |
| 06:53 | LauJensen | In this context, link means click :) |
| 06:54 | _ato | I think clojure-mode-install is now deprecated in favor of ELPA |
| 06:54 | somnium | I 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:55 | somnium | _ato: is it possible to use clojure-new as a dep with lein/clojars? |
| 06:55 | adityo | yes i can confirm from technomancy's blog post that clojure-install is deprecated |
| 06:56 | LauJensen | Ah ok |
| 06:56 | LauJensen | Wonder why, I've seen it work quite well on both Linux and *sigh* Windows :) |
| 06:56 | adityo | http://technomancy.us/126 |
| 07:02 | defn | that's awesome (leiningen) |
| 07:02 | _ato | he's just using the compojure jar I uploaded, that's why it's org.clojars.ato/compojure |
| 07:02 | defn | omg so glad i went through the minor headache of switching to technomancy's version |
| 07:02 | _ato | and yes leiningen is pretty nice |
| 07:02 | defn | actually being able to tab complete clojure.contrib.* stuff |
| 07:03 | _ato | :) |
| 07:03 | micampe | oh gosh. every time I come here I learn a new tool I should learn. |
| 07:05 | micampe | so, since I always hated ant and maven, I think I'm going to look at leiningen now |
| 07:05 | defn | no need to copy all of the stuff i need by hand, I can just setup package.clj and hit `lein deps` |
| 07:10 | Chousuke | hm, the font at clojars.org is huge |
| 07:10 | Chousuke | maybe my resolution is a bit too small :P |
| 07:10 | Chousuke | But it's a refreshing change. Usually I get to complain about the font being too small. |
| 07:10 | _ato | yeah I made it huge on purpose |
| 07:11 | _ato | though maybe it's too huge, probably some of the longer package names will go off the edge of the page |
| 07:14 | Chousuke | _ato: at 80% zoom the font size looks fine to me. Hmm. |
| 07:23 | interferon | anyone know of good clojure blogs? |
| 07:25 | liebke | interferon: a good place to start is http://disclojure.org/ and then check its blogroll |
| 07:32 | interferon | thanks |
| 08:40 | fliebel | How can I find out if the function supplied to a macro is really a function? |
| 08:40 | fliebel | ,(fn? (first '(print "hi"))) |
| 08:40 | clojurebot | false |
| 08:40 | _fogus_ | ,(fn? (first `(print "hi"))) |
| 08:40 | clojurebot | false |
| 08:41 | _fogus_ | hmm |
| 08:41 | fliebel | I tried symbol, but that returns true, even for jerhlaf, or skdjbl. |
| 08:42 | fliebel | Are there by chance Clojure functions named like that? :D |
| 08:44 | arbscht | ,(fn? (var-get (resolve (first '(print "hi"))))) |
| 08:44 | clojurebot | true |
| 08:44 | _fogus_ | D'oh!! Of course. |
| 08:44 | Chousuke | fliebel: unless it's a function defined with def though, you can't. |
| 08:44 | Chousuke | also, var-get = deref = @ :) |
| 08:45 | fliebel | thanks |
| 08:45 | fliebel | and resolve? |
| 08:45 | Chousuke | resolve resolves a symbol to a var |
| 08:45 | arbscht | ,(doc resolve) |
| 08:45 | clojurebot | "([sym]); same as (ns-resolve *ns* symbol)" |
| 08:45 | arbscht | ... |
| 08:46 | arbscht | ,(doc ns-resolve) |
| 08:46 | clojurebot | "([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:47 | fliebel | so what you are doing is tracing down and following all the references until you find the actual fn. |
| 08:47 | fliebel | What if the user supplied a #function? |
| 08:47 | Chousuke | then it won't work |
| 08:47 | Chousuke | macros have no access to runtime data. |
| 08:48 | fliebel | ah, ok |
| 08:49 | fliebel | How suitable it a Scheme mode in my editor for editing Clojure? It does not support CL or Clojure. |
| 08:49 | Chousuke | which editor? |
| 08:49 | arbscht | Chousuke: macros? |
| 08:49 | fliebel | I tried Netbeans, but that did not work for me, I'm using Komodo Edit. |
| 08:50 | Chousuke | arbscht: yes? |
| 08:50 | arbscht | Chousuke: I don't see any macros |
| 08:50 | _fogus_ | http://home.pipeline.com/~hbaker1/ |
| 08:51 | Chousuke | arbscht: the original question was how to tell if a macro was passed a function |
| 08:51 | arbscht | oh! |
| 08:51 | arbscht | :-) |
| 08:51 | Chousuke | which is not possible in the general case because macros operate with symbols and lists, not functions :/ |
| 08:53 | arbscht | fliebel: I would not expect it to be suitable. it won't know conventional indentation rules, for example |
| 08:57 | cp2 | mornin' |
| 08:57 | cp2 | clojurebot: good morning ^_^ |
| 08:57 | clojurebot | Gabh mo leithscéal? |
| 09:00 | fliebel | Are there other Mac editors suitable for editing Clojure except emacs and Netbeans? |
| 09:01 | cp2 | vim :D |
| 09:01 | cp2 | eclipse has an alright clojure plugin, intellij has a nicer clojure plugin and there is a free/open source version now |
| 09:02 | cp2 | although 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:03 | cp2 | my advice is stick with vim or emacs, and get really good at using them |
| 09:05 | cp2 | er, them being the one you choose of course |
| 09:05 | cemerick | man, two editor discussions in two days :-/ |
| 09:05 | cp2 | cemerick: heh, im being careful to not say 'x is better than y' |
| 09:05 | chouser | people keep asking. *shrug* |
| 09:06 | chouser | I guess there could be a page we could just point to. |
| 09:06 | rhickey | how are people making out with latest new branch? (fine-grained locals clearing) |
| 09:06 | chouser | hey look, there is: http://stackoverflow.com/questions/257333/clojure-editor-ide-recommendations-on-os-x |
| 09:06 | cemerick | The best answer is almost always going to be "whatever you're using now for everything else"; besides that, it's all personal preference. |
| 09:07 | cemerick | I've found SO to be a ghetto for the most part. |
| 09:11 | chouser | rhickey: have been using the latest 'new' branch for misc. light clojure activity -- nothing to report. |
| 09:11 | rhickey | chouser: no news is good news :) |
| 09:12 | chouser | exactly |
| 09:12 | chouser | I don't have much code sitting around that used to blow the heap to try out now. |
| 09:13 | cp2 | rhickey: but what if they shot the messenger? |
| 09:13 | rhickey | chouser: yeah, I have to go back through and find some old problem reports in the group |
| 09:13 | chouser | hm. thrilling. |
| 09:14 | rhickey | there was some destructuring thing |
| 09:15 | chouser | I think I have it |
| 09:16 | chouser | (defn loop-test [] (loop [[head & tail] (repeat 1)] (recur tail))) |
| 09:16 | rhickey | might have been something jdk 6 could figure out that 5 couldn't |
| 09:16 | chouser | yes, that's this one |
| 09:17 | somnium | is (:field my-type) still equivalent to (.field my-type)? |
| 09:20 | chouser | somnium: 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:20 | somnium | have type with field 'then', (.then type) returns the value, (:then type) returns #<Type$__lookup__then ...> |
| 09:20 | chouser | I think. :-) |
| 09:20 | somnium | yeah, ^^ this odd behavior just now |
| 09:20 | chouser | somnium: are you sure you've got the latest 'new'? |
| 09:21 | somnium | a few days old I think |
| 09:21 | chouser | yeah, better upgrade. the edge bleeds, gotta keep moving. |
| 09:22 | somnium | I saw it seemed to break swank yesterday so Ive been holding off |
| 09:22 | somnium | can anyone confirm? |
| 09:22 | chouser | ah. I think that's been fixed now. |
| 09:22 | AWizzArd | is there a new behaviour in deftype? I upgraded today. Now I do: (deftype foo [a b]) and then (:b (foo 10 20)) ==> nil |
| 09:22 | chouser | somnium: hang on -- booting the computer that has 'new'... |
| 09:23 | somnium | AWizzArd: does (.b foo) work? |
| 09:23 | AWizzArd | yes |
| 09:24 | chouser | hmm |
| 09:24 | chouser | I'm seeing AWizzArd's bug. |
| 09:24 | AWizzArd | Now (.b (foo 10 20)) ==> 20, but I am very sure that (:b (foo 10 20)) ==> 20 also before |
| 09:25 | chouser | but not somnium's -- nil returns, not lookup methods. |
| 09:26 | chouser | somnium: you probably want version a3e95cf |
| 09:26 | somnium | at least once (:a foo) worked here, then suddenly seemed to break |
| 09:26 | chouser | somnium: yes, that was a bug that was fixed |
| 09:26 | rhickey | somnium: that's fixed, move on |
| 09:26 | somnium | thanks |
| 09:27 | AWizzArd | So, 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:27 | chouser | AWizzArd: "official"? Is 1.0 :-) |
| 09:27 | AWizzArd | official for alpha I mean :-) |
| 09:27 | rhickey | AWizzArd: don't use (.b, I'm looking at your problem |
| 09:28 | AWizzArd | I want to use the New branch, because it is a) very helpful and b) I want to help by alpha testing it. |
| 09:32 | pjstadig | emacs question |
| 09:32 | pjstadig | M-x swank-clojure-project |
| 09:32 | pjstadig | the class path is missing clojure and swank-clojure |
| 09:33 | pjstadig | is this intended? or a bug? |
| 09:35 | AWizzArd | You should put swank on your classpath. |
| 09:35 | AWizzArd | Some months ago this was not needed. |
| 09:37 | AWizzArd | And the slime version that you use should not be too new. |
| 09:37 | pjstadig | i installed with elpa |
| 09:37 | clojurebot | elpa is a package manager for Emacs: http://tromey.com/elpa |
| 09:37 | pjstadig | thank you clojurebot, i knew that |
| 09:37 | pjstadig | :) |
| 09:38 | hipertracker | (+ (/ 1 3) (/ 1 2)) -> 5/6 zajebiste |
| 09:38 | pjstadig | everything works fine |
| 09:38 | AWizzArd | Currently 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:38 | AWizzArd | And now there is the discussion who should care about that: slime or the clojure side ;) |
| 09:38 | AWizzArd | (in swank-clojure) |
| 09:39 | pjstadig | i 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:39 | pjstadig | then you can control what version of clojure, etc. you use by putting them in lib |
| 09:39 | AWizzArd | It 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:40 | devlinsf | hipertracker: Let clojurebot do the work for you |
| 09:41 | devlinsf | ,(+ (/ 1 3) (/ 1 2)) |
| 09:41 | clojurebot | 5/6 |
| 09:41 | hipertracker | devlinsf: sorry, wrong window. |
| 09:41 | devlinsf | hipertracker: n/p |
| 09:42 | AWizzArd | ,(+ 1/3 1/2) |
| 09:42 | clojurebot | 5/6 |
| 09:43 | chouser | ,1/3+1/2 |
| 09:43 | clojurebot | Invalid number: 1/3+1/2 |
| 09:45 | AWizzArd | i think symbol names must not start with digits |
| 09:52 | devlinsf | Hey, 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:52 | devlinsf | nm - just answer my own question at the REPL |
| 09:52 | devlinsf | ,(/ 1.0 3) |
| 09:52 | clojurebot | 0.3333333333333333 |
| 09:54 | AWizzArd | ,(let [a 2, b 3] [(class a) (class b) (/ a b)]) |
| 09:54 | clojurebot | [java.lang.Integer java.lang.Integer 2/3] |
| 09:54 | AWizzArd | if it is a function parameter you should convert it at one point to a double or BigDecimal |
| 09:54 | fliebel | Why does Clojure not support 1+1 etc, but does support 3/2? |
| 09:55 | AWizzArd | because 3/2 is not a function call |
| 09:55 | AWizzArd | it is the notation for rational numbers |
| 09:55 | cemerick | fliebel: because the former is an operation, the latter is a value |
| 09:55 | chouser | fliebel: 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:56 | AWizzArd | ,12E+2 |
| 09:56 | clojurebot | 1200.0 |
| 09:56 | fliebel | strange thing to make a "devision" a literal, although it might save some headaches. |
| 09:57 | AWizzArd | it is not a division |
| 09:57 | cemerick | it's not division |
| 09:57 | AWizzArd | it is the notation for a number |
| 09:57 | pjstadig | for an exact number |
| 09:57 | pjstadig | floating points aren't exact |
| 09:57 | cemerick | ,1/3 |
| 09:57 | clojurebot | 1/3 |
| 09:57 | cemerick | ,(float 1/3) |
| 09:57 | clojurebot | 0.33333334 |
| 09:57 | AWizzArd | helpfull for us poor humans who can't work successfully with sequences of 0s and 1s |
| 09:58 | cemerick | the latter is division |
| 09:58 | devlinsf | Right, they're only good for a relative error of 1E-16 |
| 09:58 | cemerick | or, it makes the division represented by the ratio concrete |
| 09:58 | fliebel | ,(* 22/7 2) |
| 09:58 | clojurebot | 44/7 |
| 09:58 | devlinsf | ,pi |
| 09:58 | clojurebot | java.lang.Exception: Unable to resolve symbol: pi in this context |
| 09:58 | AWizzArd | ,Math/PI |
| 09:58 | clojurebot | 3.141592653589793 |
| 09:59 | devlinsf | Ah |
| 09:59 | cemerick | which is defined as a double, I think. |
| 09:59 | devlinsf | ,(class Math/PI) |
| 09:59 | clojurebot | java.lang.Double |
| 09:59 | fliebel | Would be cool to have PI as a… something |
| 09:59 | devlinsf | A what? |
| 09:59 | cemerick | 22/7 is always just 22/7, unless you explicitly force it into a float or double |
| 10:00 | esj | 22/7 is not pi |
| 10:00 | AWizzArd | ,(rationalize Math/PI) |
| 10:00 | clojurebot | 3141592653589793/1000000000000000 |
| 10:00 | fliebel | Well, something that is more precise... |
| 10:00 | esj | mathematical impossibility |
| 10:00 | cemerick | yeah, closer than Math/PI |
| 10:00 | devlinsf | Thank you esj |
| 10:01 | devlinsf | Please, Math/PI is great as a double |
| 10:01 | fliebel | I won't launch a rocket with double persoanly, but I guess it's okay in 99.9999% of the time. |
| 10:02 | AWizzArd | and ifs someone cares then he/she can have pi as a rational number, which will not be less exact |
| 10:02 | esj | i suppose using the series representation as a lazy sequence is possible |
| 10:02 | devlinsf | fliebel: Ever here of Apollo? |
| 10:03 | fliebel | devlinsf: Yea, I know they launched that with less computer power than in my iPod…. |
| 10:03 | devlinsf | fliebel: study analog & digital controls sometime. You'll realize that the limits of double are nothing compared to the limits of the algorithms |
| 10:03 | AWizzArd | Just (def π 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067M) |
| 10:03 | devlinsf | Perfect! |
| 10:03 | AWizzArd | that's the first 100 digits, as a BigDecimal |
| 10:04 | devlinsf | Totally useless in production, buyt perfect |
| 10:04 | AWizzArd | ;-) |
| 10:04 | rhickey | AWizzArd: fixed |
| 10:04 | AWizzArd | wow rhickey, this is very nice thanks *handshaking* |
| 10:05 | rhickey | was actually a problem mwith case |
| 10:06 | shr3kst3r | tests are a fine idea |
| 10:07 | _fogus_ | fliebel: What does this mean? "compared to the limits of the algorithms" |
| 10:07 | devlinsf | _fogus_: right here |
| 10:07 | Licenser_ | 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:08 | Licenser_ | any ideas cause I am not entirely sure what to make from this |
| 10:08 | fliebel | _fogus_: no idea… |
| 10:08 | _fogus_ | devlinsf: Sorry, clicked wrong name |
| 10:08 | devlinsf | *WARNING - MATH CONTENT* |
| 10:08 | _fogus_ | devlinsf: Bring it on ;) |
| 10:10 | devlinsf | _fogus_: Forgive the following question. You've studied calculus before, right? |
| 10:11 | _fogus_ | devlinsf: Once upon a time |
| 10:12 | devlinsf | devlinsf: Perfect. That will be enough. I will be using the process of integration as an example |
| 10:12 | devlinsf | _focus_: Sorry, wrong name :) |
| 10:12 | devlinsf | _fogus_ :Ah! |
| 10:12 | Licenser_ | I knid of have tom think of fungus o.O |
| 10:12 | devlinsf | Okay, forget it |
| 10:13 | devlinsf | You have certain integrals that don't have a solution |
| 10:13 | devlinsf | but as an engineer one needs to solve them all the time |
| 10:14 | devlinsf | For example, consider the Gaussian function, (fn[x] (Math/exp (* -1 x x))) |
| 10:14 | angerman | how do I add custom jar's to leiningen? |
| 10:14 | devlinsf | def that as gauss |
| 10:15 | _fogus_ | ,(def gauss (fn[x] (Math/exp (* -1 x x)))) |
| 10:15 | clojurebot | DENIED |
| 10:15 | _fogus_ | :( |
| 10:15 | AWizzArd | use let |
| 10:15 | devlinsf | ,(gauss -7) |
| 10:15 | clojurebot | java.lang.Exception: Unable to resolve symbol: gauss in this context |
| 10:16 | devlinsf | Have a REPL open? |
| 10:16 | devlinsf | You'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:16 | clojurebot | 5.242885663363464E-22 |
| 10:16 | devlinsf | As is (guass 7) |
| 10:17 | _fogus_ | sure |
| 10:17 | esj | to 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:18 | devlinsf | esj: Agreed - But I want to attack the problem mathematically, not as an engineer |
| 10:18 | devlinsf | esj: I'm an engineer myself, so I agree with you 110% |
| 10:18 | esj | devlinsf: sorry, just glanced over and wanted to comment, will sit back now :) |
| 10:19 | devlinsf | esj : :) |
| 10:19 | fliebel | devlinsf: why do you include −1 of both 7 and −1 return the same result? |
| 10:20 | devlinsf | Umm?? |
| 10:20 | fliebel | of = if and the last 1 = 7 |
| 10:20 | devlinsf | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -1)) |
| 10:20 | clojurebot | 0.36787944117144233 |
| 10:20 | devlinsf | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -7)) |
| 10:20 | clojurebot | 5.242885663363464E-22 |
| 10:20 | devlinsf | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss -1)) |
| 10:20 | clojurebot | 0.36787944117144233 |
| 10:20 | devlinsf | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (gauss 7)) |
| 10:20 | clojurebot | 5.242885663363464E-22 |
| 10:20 | devlinsf | Sorry to spam |
| 10:21 | devlinsf | fliebel: could you clarify? |
| 10:21 | fliebel | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (= (gauss 7) (gauss −7))) |
| 10:21 | clojurebot | java.lang.Exception: Unable to resolve symbol: −7 in this context |
| 10:21 | fliebel | well, both the result of 7 and −7 are 5.242885663363464E-22 |
| 10:21 | devlinsf | Right |
| 10:21 | _fogus_ | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (= (gauss 7) (gauss -7))) |
| 10:21 | clojurebot | true |
| 10:22 | devlinsf | They should, it's an even fn |
| 10:23 | fliebel | so why do you include −1 in the function, this would only make −7 -> 7 and 7 -> −7 right? |
| 10:23 | devlinsf | because that's the definition of the gaussion |
| 10:23 | devlinsf | e^-(x^2) |
| 10:23 | devlinsf | *gaussian |
| 10:24 | fliebel | devlinfsL ok, fine, i never did so much math... |
| 10:24 | fliebel | i'll sit back and listen |
| 10:24 | devlinsf | That's okay, questions are good |
| 10:25 | devlinsf | http://www.codersource.net/published/view/279/guassian_smoothing_in_csharp.aspx |
| 10:25 | devlinsf | There's a good graph of the function |
| 10:26 | devlinsf | Often, you need to find the area under the curve, starting at -infinity, to some value of x |
| 10:27 | devlinsf | Now, as we demonstrated, -7 is close to zero, so I'm gonna assume that the area to the left of 7 is zero |
| 10:27 | devlinsf | Or really reall really close |
| 10:28 | devlinsf | The first attempt to approximate the area is to create a lot of rectangles. |
| 10:28 | devlinsf | Let's start with a base width of 1 |
| 10:29 | devlinsf | (let [gauss (fn[x] (Math/exp (* -1 x x)))] (map gauss (range -7 7)) |
| 10:29 | devlinsf | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (map gauss (range -7 7)) |
| 10:29 | clojurebot | EOF while reading |
| 10:29 | Licenser_ | 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:29 | devlinsf | ,(let [gauss (fn[x] (Math/exp (* -1 x x)))] (map gauss (range -7 7))) |
| 10:29 | clojurebot | (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:29 | devlinsf | There |
| 10:29 | devlinsf | So, we know the height of the rectangle, and we know that it has a width of 1. |
| 10:30 | devlinsf | We can simply add up these values and get an approimation at each point. |
| 10:31 | devlinsf | Works for integers, but falls appart if we want to find the value everything less than say -.25 |
| 10:31 | devlinsf | So, the obvious thing to due here is to use smaller rectangles |
| 10:32 | devlinsf | It turns out, that if you make your rectangles twice as small you get twice as good a result, etc. |
| 10:32 | devlinsf | But now we have to do twice as much work. |
| 10:32 | devlinsf | Boo :( |
| 10:32 | fliebel | you are trying to find the point where the gauss is 0? |
| 10:32 | devlinsf | Now, you trying to find the area under the curve to the left of a point x |
| 10:32 | devlinsf | I.E, and integral |
| 10:33 | devlinsf | *No |
| 10:33 | fliebel | oh, sorry… I should redo my math... |
| 10:33 | devlinsf | It's cool stuff, really. |
| 10:33 | devlinsf | Haskell will make more sense as you do... but i digress |
| 10:34 | devlinsf | So, as I change the width of my rectange (w), the error improves by (w) |
| 10:34 | devlinsf | Kinda sucks |
| 10:34 | devlinsf | There's a well know algoritm called Runge-Kutta |
| 10:35 | devlinsf | http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods |
| 10:35 | fliebel | devlinfs: 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:35 | devlinsf | fliebel: sin & cos a great |
| 10:35 | devlinsf | *are |
| 10:36 | devlinsf | RK has an interesting property |
| 10:37 | devlinsf | As 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:37 | devlinsf | So a 2x smaller rectangle is 16 times more accurate |
| 10:37 | fliebel | devlinsf: 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:38 | devlinsf | fliebel: If you like physics, it'll be easier to understand |
| 10:39 | devlinsf | What 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:41 | devlinsf | Questions so far? |
| 10:42 | _fogus_ | not yet |
| 10:42 | devlinsf | Okay, cool |
| 10:43 | fliebel | If I knew integrals, I'm sure I'd understand :D |
| 10:44 | devlinsf | So, the guass function is fairly straightforward |
| 10:44 | devlinsf | gauss |
| 10:44 | devlinsf | The real problem arrises when you move from simple integration to differential equations |
| 10:45 | esj | fliebel: 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:45 | fliebel | I 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:46 | devlinsf | Okay |
| 10:47 | _fogus_ | devlinsf: But by all means continue |
| 10:47 | devlinsf | There is this concept of stability with differential equations |
| 10:47 | cp2 | is there a 'conventional' way of storing a seq (specifically a vector) in a db (via c.c.sql) ? |
| 10:47 | fliebel | I think even I do… You'd need incredible small squares to need more than a float. |
| 10:47 | esj | fliebel: yes, but it gets worse, watch ! |
| 10:47 | devlinsf | What stability means is that "If I ask the same questions, do I get the same anser" |
| 10:48 | devlinsf | A stable equation behaves like you expect. If I use smaller rectangles, my answer gets better |
| 10:48 | fliebel | devlinfs: are there cases in math where you can get different answers without treads or random numbers? |
| 10:49 | devlinsf | An unstable equation is painful. The more rectangles you throw at it, the worse it gets |
| 10:49 | fliebel | show us :) |
| 10:49 | notallama | a 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:50 | devlinsf | boss |
| 10:51 | esj | i think I know where devlinsf may be going, so i'll have a go at continuing |
| 10:51 | esj | if you want to land your rocket on the moon you need to solve some differential equations |
| 10:52 | esj | which you do through the same technique of successively small rectangles |
| 10:52 | esj | but if your recantangles are too big, your answer is inaccurate, as with the integral example |
| 10:53 | esj | the problem now is, that if you make your recangles small, to get higher accuracy, your numerics blows up |
| 10:53 | esj | its not just that it takes forever to get the answer, but you actually stop moving and cant. |
| 10:53 | devlinsf | Thanks esj |
| 10:53 | devlinsf | Gotta go, you got it |
| 10:54 | esj | devlinsf: np |
| 10:54 | fliebel | thanks! :) |
| 10:54 | _fogus_ | devlinsf: Thanks for the run-down |
| 10:54 | esj | a lot of stuff that you want to calculate is like this |
| 10:55 | esj | so having \pi greater than double is usually not useful |
| 10:56 | fliebel | calculating pi to be greater than float is fun though... |
| 10:56 | esj | you can calculate it as accurately as you like |
| 10:56 | angerman | does anyone know how to add a classpath element to the leiningen project.clj? |
| 10:56 | angerman | I want to add a .jar file that is not on clojars |
| 10:56 | notallama | you could keep a lazy seq of the digits of pi : p |
| 10:57 | esj | you 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:57 | fliebel | I must confess I rather like PI, and can name more than 10 decimals, without wikipedia :) |
| 11:04 | fliebel | How 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:07 | fliebel | clj test.clj |
| 11:07 | _fogus_ | What is clj? |
| 11:08 | somnium | fliebel: clj is a bash script? |
| 11:08 | somnium | fliebel: may need to make sure it accepts arguments |
| 11:09 | micampe | fliebel: have you seen Darren Aronofsky movie Pi? |
| 11:09 | somnium | micampe: thats a great movie |
| 11:09 | micampe | indeed |
| 11:10 | micampe | I love the BW treatment |
| 11:10 | somnium | they even play go! |
| 11:10 | somnium | someone should write a go engine in clojure |
| 11:10 | esj | speaking of intractable algorithms... :P |
| 11:11 | somnium | :P |
| 11:11 | angerman | is anyone using lein-swank + emacs? |
| 11:11 | karmazilla | speaking 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:11 | somnium | theyve gotten better than anyone thought they would already |
| 11:12 | angerman | when ever I hit C-c C-c it tries to fontify something and runs regexps pretty long |
| 11:13 | micampe | eh. I have enough problems wrapping my head around sockets in clojure, go would be a bit far a away at the moment. |
| 11:14 | somnium | micampe: I think its the only game left where humans still can regularly beat engines. |
| 11:15 | fliebel | somnium: I just thought about that yesterday, after trying to learn go. |
| 11:15 | fliebel | micampe: I have not seen the movie I think. |
| 11:15 | micampe | fliebel: you should. |
| 11:16 | fliebel | domnium: I'll have a look at clj, it's just what macports istalled. |
| 11:16 | fliebel | micampe: youtube? |
| 11:16 | somnium | Ive been struggling with nio but more due to lack of java familiarity than clojure |
| 11:16 | esj | its 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:17 | micampe | fliebel: there are probably pieces of it on youtube. I have it on dvd. |
| 11:18 | esj | of 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:18 | fliebel | esj: this kind of problem always make me think in force fields.... |
| 11:19 | esj | fliebel: that is excellent intuition, and the guesses that are made are based exactly on that sort of idea. |
| 11:20 | fliebel | esj: I guess it's easier to write robocode bots :D |
| 11:20 | somnium | esj: I think table-bases only go to 6-pieces currently |
| 11:20 | fliebel | somnium: clj is a bash script full of nonsens.... |
| 11:20 | somnium | I wonder how many terabytes it would take for all 20 |
| 11:21 | esj | somnium: wow, that's pretty crazy. |
| 11:21 | somnium | er, 16 rather |
| 11:22 | somnium | 32, ok I cant count |
| 11:22 | esj | :) |
| 11:22 | fliebel | somnium: (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:27 | somnium | fliebel: in some ways its unfortunate, I suspect the world champion probably has a negative score against his cell phone these days (chess) |
| 11:27 | polypus | esj: they are making great strides now with statistical methods in go |
| 11:27 | cp2 | is there a 'conventional' way of storing a seq (specifically a vector) in a db (via c.c.sql) ? |
| 11:28 | polypus | i 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:28 | somnium | ,(str [1 2]) |
| 11:28 | clojurebot | "[1 2]" |
| 11:28 | somnium | ,(read-string "[1 2]") |
| 11:28 | clojurebot | [1 2] |
| 11:28 | polypus | i don't get how this is namespace qualified? |
| 11:29 | cp2 | ah |
| 11:29 | esj | polypus: thanks. |
| 11:29 | cp2 | somnium: i didnt think of that, thanks |
| 11:29 | _fogus_ | ,::foo |
| 11:29 | clojurebot | :sandbox/foo |
| 11:30 | _fogus_ | sandbox is the ns |
| 11:31 | fliebel | what 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:32 | somnium | http://clojure.org/repl_and_main |
| 11:33 | pjstadig | is there a maven repo that contains clojure-contrib-1.0-compat.jar? |
| 11:33 | fliebel | somnium: and how about compiling to java? |
| 11:33 | somnium | fliebel: ^^ this is the bare minimum a clj script should need to do |
| 11:34 | somnium | hmm, probably leiningen is easiest |
| 11:34 | pjstadig | how 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:35 | polypus | _fogus_: ty |
| 11:41 | fliebel | Am I really supposed to compile Clojure code to Java by running compile form the repl? |
| 11:42 | _fogus_ | ,(doc compile) |
| 11:42 | clojurebot | "([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:43 | somnium | fliebel: the ant versions Ive seen just invoke clojure.main and pass "(compile ...)" |
| 11:44 | fliebel | thanks… kind of odd though. |
| 11:49 | lisppaste8 | fogus pasted "Minimal Ant Clojure compile" at http://paste.lisp.org/display/91773 |
| 11:49 | fliebel | does Clojure have these templates python has, like: "I eat $s apples every $s" % [2 "day"] |
| 11:49 | somnium | ,(doc format) |
| 11:49 | clojurebot | "([fmt & args]); Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax" |
| 11:49 | stuartsierra | fliebel: there's a clojure.lang.Compile class that does that |
| 11:50 | fliebel | thanks |
| 11:50 | _fogus_ | fliebel: L@@k my link above |
| 11:51 | fliebel | I 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:55 | clojurebot | "I eat 2 apples every day" |
| 11:59 | DeusExPikachu | when 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:01 | esj | DeusExPikachu: I don't think clojure directly supports distributed processing, for that you'd want Erlang |
| 12:02 | chouser | or one of the many Java libs that helps support distributed processing |
| 12:14 | DeusExPikachu | so basically I need to find a cluster JVM that automatically distributes threads among nodes? |
| 12:14 | DeusExPikachu | if I want to not have to make any code changes |
| 12:16 | esj | DeusExPikachu: 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:18 | tolstoy | When I 'require clojure.contrib.logging, I get: java.lang.Exception: Unable to find static field: TRACE in class org.apache.log4j.Level |
| 12:18 | tolstoy | Surely that can't be right. |
| 12:22 | angerman | technomancy: what's the advantage of starting lein with -client? |
| 12:23 | angerman | DeusExPikachu: 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:23 | tolstoy | Ah. Trace is in 1.2.12, and I've 1.2.7. |
| 12:24 | DeusExPikachu | yeah I've been reading the site as soon as I asked you guys, was hoping for some firsthand experience, thanks though |
| 13:15 | tcrayford | is there an easy way to test if two hash maps are equal? |
| 13:15 | tcrayford | (ie have exactly the same keys and vals) |
| 13:16 | tcrayford | = doesn't work |
| 13:16 | tcrayford | ,(= {:a 1 :b 2} {:a 1 :b 2 :c 3}) |
| 13:16 | clojurebot | false |
| 13:16 | the-kenny | ,(== {:a 1 :b 2} {:a 1 :b 2 :c 3}) |
| 13:16 | clojurebot | false |
| 13:16 | tcrayford | ooh |
| 13:16 | tcrayford | weird |
| 13:17 | the-kenny | Uhm, they aren't equal. There is one key more in the second |
| 13:17 | tcrayford | I want that to return false |
| 13:17 | tcrayford | need to go and rephrase my question methinks |
| 13:18 | tcrayford | I have a test which passes: (deftest test-new-message |
| 13:18 | tcrayford | (is (= (new-message "Tom" "foo")) (struct message "Toom" "foo" (long-now)))) |
| 13:18 | tcrayford | where new-message is (defn new-message [user text] |
| 13:18 | tcrayford | (struct message user text (long-now))) |
| 13:19 | chouser | where the values are equal for the keys they have in common? |
| 13:19 | tcrayford | except I am calling "Toom" and "Tom" |
| 13:19 | tcrayford | and the test still passes |
| 13:20 | chouser | I don't get it. Does the test ever fail? |
| 13:20 | tcrayford | I don't think so |
| 13:20 | tcrayford | and it should |
| 13:20 | tcrayford | with different values |
| 13:20 | chouser | oh, you want it to fail in the example you gave? |
| 13:20 | tcrayford | c |
| 13:20 | tcrayford | I altered the example from the proper test |
| 13:21 | tcrayford | cheers for the help |
| 13:22 | tcrayford | weird, as |
| 13:22 | chouser | ,(let [m1 {:a 1, :b 2}, m2 {:a 1, :b 2, :c 3}] (= m1 (select-keys m2 (keys m1)))) |
| 13:22 | clojurebot | true |
| 13:22 | tcrayford | ,(= {:a "Tom" :b 2} {:a "Toom" :b 3}) |
| 13:22 | clojurebot | false |
| 13:23 | hiredman | … |
| 13:23 | hiredman | tcrayford: that (is ...) you pasted is not checking for equality |
| 13:24 | hiredman | check the parens on = |
| 13:24 | tcrayford | hah |
| 13:25 | tcrayford | yeah confirm I was being dumb with parens |
| 13:26 | tcrayford | cheers hiredman |
| 13:43 | fliebel | What are the advantages of using an unstable version of Clojure? |
| 13:44 | slashus2 | You get the try out new ideas? |
| 13:44 | konr | new (and not proved to be stable) features? |
| 13:44 | fliebel | How unstable is unstable? |
| 13:46 | konr | well, I'm always using them, and I've never had any problem with any development-version software, but perhaps I'm just lucky |
| 13:48 | fliebel | Hmmm, 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:48 | stuartsierra | fliebel: 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:49 | fliebel | How old is 20091128? Wait… that looks to much like a date to me... |
| 13:49 | hiredman | jeez |
| 13:49 | hiredman | ancient history :P |
| 13:49 | devlinsf | rhickey: 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:50 | Chousuke | (doc juxt) |
| 13:50 | clojurebot | "([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:51 | devlinsf | *clojure-version* |
| 13:51 | devlinsf | ,*clojure-version* |
| 13:51 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"} |
| 13:53 | rhickey | devlinsf: I don't know - I expected more complaints about juxt |
| 13:54 | devlinsf | rhickey: Any problem keeping the name? |
| 13:55 | fliebel | What is the difference between next and rest? From the doc it seems the only difference is the one possibly returns nil. |
| 13:55 | polypus | is there any emacs support for lein? |
| 13:55 | Chousuke | fliebel: next is less lazy :) |
| 13:56 | polypus | emacs integration is really what i mean |
| 13:56 | fliebel | chousuke: let's go for rest then, as long as I don't have to test it's content. |
| 14:03 | defn | bah no wonder s halloway's clojure talk at rubyconf 2009 isnt online yet |
| 14:03 | defn | confreaks just told me they had a bunch of syncing issues |
| 14:04 | defn | whoa holy shit |
| 14:04 | defn | intel is buying invidia |
| 14:04 | defn | nvidia |
| 14:05 | fliebel | So, finally Intel boards without GMA? |
| 14:05 | defn | it makes good sense |
| 14:08 | KirinDave_ | I also imagine intel wants some of that go-juice for their new designs. |
| 14:08 | KirinDave_ | Micro-graphics-card as a parallel arithmetic assist. An altivec for the new millennium. :) |
| 14:08 | DeusExPikachu | link? |
| 14:09 | devlinsf | rhickey: 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:09 | devlinsf | rhickey: Conversely, if it is mature enough to be in 1.1, people must be used to the name |
| 14:09 | hiredman | defn: actually, or just cringley's speculation? |
| 14:10 | defn | speculation still i guess, but it wouldn't be a shock if it were true |
| 14:11 | fliebel | woa! Clojure got stuck… |
| 14:12 | fliebel | ,(let (def t '(str "joi" "bla")) (keyword (name (first t))) |
| 14:12 | clojurebot | EOF while reading |
| 14:12 | fliebel | sorry :$ |
| 14:13 | bjorkintosh | Xach> bjorkintosh: #clojure can give you a case for clojure. |
| 14:13 | bjorkintosh | is clojure anything like sbcl? |
| 14:13 | bjorkintosh | ... or such? |
| 14:13 | defn | it's a lisp... |
| 14:13 | the-kenny | bjorkintosh: Clojure is another lisp dialect. Like Common Lisp is one. |
| 14:13 | ohpauleez | that is particularly good at concurrent things |
| 14:13 | the-kenny | SBCL is an implementation of the common lisp spec. |
| 14:13 | defn | and uses the JVM |
| 14:14 | the-kenny | ...and runs in the jvm |
| 14:14 | bjorkintosh | ah ... |
| 14:14 | defn | :) |
| 14:14 | bjorkintosh | so clojure is more like erlang then? |
| 14:14 | hiredman | ~rationale |
| 14:14 | clojurebot | rationale is http://clojure.org/rationale |
| 14:14 | defn | no not really |
| 14:14 | polypus | not really like erlang |
| 14:14 | defn | there are hints of erlang in clojrue |
| 14:14 | defn | clojure* |
| 14:14 | polypus | in process concurrency |
| 14:14 | bjorkintosh | hmm. |
| 14:14 | ohpauleez | it feels lightweight, it has a "hack as I think" feeling like python for me personally |
| 14:14 | polypus | but even w/o the concurrency stuff io it's the nicest lisp i've seen |
| 14:15 | polypus | s/io/imo |
| 14:15 | defn | it's my first lisp and im enjoying it |
| 14:15 | the-kenny | polypus: Yes, I think so too |
| 14:15 | bjorkintosh | so it isn't possible to harness all the computers at a lab to run a clojure program concurrently? |
| 14:15 | defn | learning some elisp in tandem and its been a good experienc |
| 14:15 | defn | bjorkintosh: sure |
| 14:15 | bjorkintosh | it is?! cool! |
| 14:15 | ohpauleez | I was a die hard CL lover, and did most of my work and enjoyment project in Python |
| 14:15 | ohpauleez | and Clojure is easily becoming my favorite language |
| 14:15 | bjorkintosh | that's what i meant by the erlang comparison. |
| 14:16 | gravity | bjorkintosh: You'd need to use something like hadoop to do it |
| 14:16 | the-kenny | bjorkintosh: Clojure isn't designed around this "My program can run on then tousand machines at once" like erlang is. But it's possible. |
| 14:16 | defn | bjorkintosh: clojure has agent-based concurrency |
| 14:16 | the-kenny | s/then// |
| 14:16 | pjstadig | I'm blowing stack and I don't know why |
| 14:16 | bjorkintosh | but how does the concurrent bit work? |
| 14:16 | bjorkintosh | is there something to read on that? |
| 14:16 | defn | better to read about it than have us explain it |
| 14:16 | slashus2 | It 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:16 | defn | http://clojure.org/concurrency |
| 14:16 | pjstadig | i have a collection of 7393 collections that i'm trying to concatenate together |
| 14:16 | defn | oops bad link |
| 14:16 | konr | Is there a way to make SLIME automatically add /foo/lib/*jar to the classpath, when editing some file from /foo/src/? |
| 14:17 | defn | http://clojure.org/refs, http://clojure.org/agents, http://clojure.org/agents |
| 14:17 | bjorkintosh | hmm. hadoop... |
| 14:17 | pjstadig | ,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393)) |
| 14:17 | clojurebot | EOF while reading |
| 14:17 | bjorkintosh | okay. |
| 14:17 | pjstadig | ,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393))) |
| 14:17 | clojurebot | Eval-in-box threw an exception:java.lang.StackOverflowError |
| 14:17 | the-kenny | konr: Use leiningen or swank-clojure-project |
| 14:17 | DeusExPikachu | bjorkintosh: a big part of clojure over CL is first class datastructures besides the list |
| 14:17 | ohpauleez | pjstadig: is there a reason for not doing it lazily? Are calculating these things? |
| 14:17 | defn | konr: yeah listen to the-kenny, leiningen + clojars + swank-clojure = pure win |
| 14:17 | bjorkintosh | do hadoop and clojure play nicely together? |
| 14:18 | the-kenny | defn: Yes, exactly :) |
| 14:18 | defn | i believe someone wrote something to do hadoop stuff with clj |
| 14:18 | pjstadig | ,(reduce lazy-cat (map (constantly (vector 1 2 3)) (range 0 7393))) |
| 14:18 | clojurebot | java.lang.Exception: Can't take value of a macro: #'clojure.core/lazy-cat |
| 14:18 | slashus2 | Clojure allows for wrapper free access to java libraries. |
| 14:18 | defn | bjorkintosh: http://github.com/stuartsierra/clojure-hadoop |
| 14:18 | pjstadig | ,(reduce #(lazy-cat %1 %2) (map (constantly (vector 1 2 3)) (range 0 7393))) |
| 14:18 | clojurebot | Eval-in-box threw an exception:java.lang.StackOverflowError |
| 14:19 | bjorkintosh | okay. |
| 14:19 | DeusExPikachu | its got great standardized reader macros too, makes code concise |
| 14:19 | pjstadig | i guess i would be fine with a lazy sequence if I could figure out how to get it to work |
| 14:19 | defn | lazy-seq |
| 14:19 | pjstadig | besides it shouldn't blow stack doing a reduce should it? |
| 14:19 | DeusExPikachu | especially for coding macros |
| 14:19 | pjstadig | i would expect to maybe run out of memory |
| 14:20 | bjorkintosh | so are clojure and commonlisp close enough that the examples from the books i have on common lisp can be implemented in it? |
| 14:20 | the-kenny | bjorkintosh: Yes, except for reader macros |
| 14:20 | stuartsierra | bjorkintosh: no |
| 14:20 | bjorkintosh | reader macros. okay. |
| 14:20 | stuartsierra | I mean, you can implement all the same things, but the syntax and names will be different. |
| 14:21 | DeusExPikachu | bjorkintosh: I'd say so, coming from Pratical Common Lisp |
| 14:21 | pjstadig | defn: how would i use lazy-seq? |
| 14:21 | bjorkintosh | cool. |
| 14:21 | DeusExPikachu | if you need a reference, someone went ahead and ported the PCL code to clojure, just google it up |
| 14:22 | bjorkintosh | i'm apt-get-ing clojure right now. |
| 14:22 | the-kenny | bjorkintosh: 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:22 | bjorkintosh | is there a nice IDE for it? |
| 14:22 | the-kenny | emacs + slime |
| 14:22 | the-kenny | (+ leiningen) |
| 14:22 | DeusExPikachu | I use slime, clojure-mode |
| 14:22 | bjorkintosh | oh. nothing vim-ey like? |
| 14:22 | bjorkintosh | (emacs makes me cry) |
| 14:23 | defn | and yet you use parentheses to explain your disgust |
| 14:23 | the-kenny | my experience is, that hacking lisp in vim is very painful |
| 14:23 | bjorkintosh | hehehe |
| 14:23 | gbt | there is vim-clojure, but I've not tried it |
| 14:23 | defn | i 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:24 | DeusExPikachu | I can't live without paredit mode |
| 14:24 | bjorkintosh | i'm an agnostic, but i prefer to think the world was created in vi. (hides) |
| 14:24 | defn | paredit is very nice as well |
| 14:24 | defn | bjorkintosh: tools are tools |
| 14:24 | fliebel | What does it mean when I get a java.lang.NullPointerException in Clojure? |
| 14:24 | defn | pick what you want and go for it, but personally emacs was made for lisp hacking |
| 14:24 | the-kenny | I've learned Emacs just for Common Lisp and now I use it for everything from LaTeX to ToDo-Management (org-mode ftw!) |
| 14:24 | defn | org-mode > * |
| 14:24 | bjorkintosh | *sigH* |
| 14:24 | defn | and yeah, latex is so nice |
| 14:24 | the-kenny | defn: Exactly :) |
| 14:25 | bjorkintosh | you poor things. tools are tools, as defn said. |
| 14:25 | defn | mobileorg is quite cool also :) |
| 14:25 | the-kenny | defn: I'm thinking about writing a parser for org-mode in clojure |
| 14:25 | defn | have you seen babel? |
| 14:25 | chouser | why is the frequency of editor conversations going up!? |
| 14:25 | bjorkintosh | okay. |
| 14:25 | the-kenny | defn: babel? |
| 14:25 | defn | it's in org-mode's contrib |
| 14:25 | fliebel | chouser: partly because of me.... |
| 14:25 | bjorkintosh | so how does clojure talk to the jvm? i'm at the prompt... is that it? |
| 14:26 | chouser | bjorkintosh: depends on what you want to tell the JVM. |
| 14:26 | gravity | bjorkintosh: clojure is compiled to jvm bytecode |
| 14:26 | bjorkintosh | ah okay. |
| 14:26 | defn | the-kenny: http://orgmode.org/worg/org-contrib/babel/org-babel.php |
| 14:26 | defn | there is support for clojure now :) |
| 14:26 | the-kenny | defn: Woah, cool :) |
| 14:26 | bjorkintosh | i think i'll use it for a while to see how it wears. |
| 14:26 | the-kenny | defn: But I was thinking about an external parser, written in clojure |
| 14:26 | fliebel | bjorkintosh: you can also do aot compiling and run scripts of course. |
| 14:26 | DeusExPikachu | the blip.tv talks are good too |
| 14:27 | defn | the-kenny: sure, different story, but i just thought id pass that along since it seemed sort of related |
| 14:27 | the-kenny | defn: Yeah, maybe it's helpful :) |
| 14:27 | the-kenny | Thanks |
| 14:27 | defn | the-kenny: i was thinking something like a little blogging platform similar to jekyll that runs on clojure and org-mode |
| 14:27 | pjstadig | ,*clojure-version* |
| 14:28 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"} |
| 14:28 | fliebel | defn: Woa, I wanted to do just that… not sure about the org-mode though. But at least something liek Jekyll |
| 14:28 | defn | fliebel: got a repo? |
| 14:28 | pjstadig | am I wrong in thinking that reduce shouldn't blow stack? |
| 14:29 | fliebel | defn: nope, I'm trying to learn Clojure first. |
| 14:29 | defn | im thinking compojure + lein |
| 14:29 | the-kenny | hm.. I'm just learning Markdown for blog-posts and such things |
| 14:29 | defn | fliebel: cool well, buzz me if you're working on anything |
| 14:29 | defn | and ill do the same |
| 14:29 | fliebel | sure :) |
| 14:29 | defn | i started a repo last night to do some compojure stuff, my first experience with lein + clojars |
| 14:29 | defn | pretty awesome |
| 14:30 | somnium` | ! google chrome for linux released |
| 14:30 | defn | pjstadig: i dont think you're wrong, but that code doesn't seem "right" to me for some reason |
| 14:30 | fliebel | defn: 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:30 | fliebel | somnium: now for the mac version... |
| 14:30 | defn | fliebel: the html templating stuff? |
| 14:31 | defn | like (html-tree [:h1 "hello"]) ? |
| 14:31 | fliebel | defn: yea, that one... |
| 14:31 | defn | yeah thats what im playing with |
| 14:32 | fliebel | defn: I made something like that in Python a while back. |
| 14:32 | fliebel | http://metapep.wordpress.com/2009/10/04/pymlpython-markup-language-template-engine/ |
| 14:33 | fliebel | Then I decided to learn Clojure and make my CMS with that instead. |
| 14:33 | defn | It'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:33 | defn | someting like that |
| 14:34 | defn | and then you can (html (default-layout "home" [:h1 "Home"])) |
| 14:34 | defn | or somesuch |
| 14:34 | fliebel | Is that instantly converted to a string, or more in the lazy and editable way? |
| 14:34 | chouser | pjstadig: generally, reduce should not blow the stack, at least not by itself. |
| 14:34 | defn | fliebel: i believe it's converted to a string right away, but i dont really know that much about it yet tbh |
| 14:34 | defn | ,(html-tree [:h1 "abc") |
| 14:35 | clojurebot | Unmatched delimiter: ) |
| 14:35 | defn | oops |
| 14:35 | defn | ,(html-tree [:h1 "abc]) |
| 14:35 | clojurebot | EOF while reading string |
| 14:35 | defn | bahhh! |
| 14:35 | defn | ,(html-tree [:h1 "abc"]) |
| 14:35 | clojurebot | java.lang.Exception: Unable to resolve symbol: html-tree in this context |
| 14:35 | pjstadig | chouser: so i think this is a general case, does this mean its a bug? |
| 14:35 | defn | i give up on life |
| 14:35 | fliebel | defn: That is one of the key points for me. make a template, fiddle with it and then print it. |
| 14:35 | defn | ,(use 'compojure) |
| 14:35 | clojurebot | java.io.FileNotFoundException: Could not locate compojure__init.class or compojure.clj on classpath: |
| 14:36 | defn | fliebel: yeah it's easy enough, pretty easy to template with |
| 14:36 | chouser | pjstadig: you have a small test case we can look at? |
| 14:36 | fliebel | defn: I even had basic xpath in my Python lib. |
| 14:36 | defn | cool |
| 14:36 | pjstadig | ,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393)) |
| 14:36 | clojurebot | EOF while reading |
| 14:36 | pjstadig | ,(reduce concat (map (constantly (vector 1 2 3)) (range 0 7393))) |
| 14:36 | clojurebot | Eval-in-box threw an exception:java.lang.StackOverflowError |
| 14:37 | defn | i get an awfully weird stack trace when i run that code pjstadig |
| 14:37 | pjstadig | may depend on the JVM config, but you can bump the range down to 1900 |
| 14:37 | chouser | ,(let [x (reduce concat (map (constantly (vector 1 2 3)) (range 0 7393)))]) |
| 14:37 | clojurebot | nil |
| 14:37 | pjstadig | ,(reduce concat (map (constantly (vector 1 2 3)) (range 0 1900))) |
| 14:37 | clojurebot | Eval-in-box threw an exception:java.lang.StackOverflowError |
| 14:38 | chouser | pjstadig: reduce is not blowing the stack. |
| 14:38 | pjstadig | ,(let [x (reduce concat (map (constantly (vector 1 2 3)) (range 0 1900)))]) |
| 14:38 | clojurebot | nil |
| 14:38 | pjstadig | ,(let [x (reduce concat (map (constantly (vector 1 2 3)) (range 0 1900)))] x) |
| 14:38 | clojurebot | Eval-in-box threw an exception:java.lang.StackOverflowError |
| 14:38 | konr | the-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:38 | fliebel | defn: 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:38 | konr | *project/lib/myjar.jar |
| 14:38 | pjstadig | it's blowing stack when it tries to print i guess |
| 14:38 | Chousuke | I suspect it's the concats |
| 14:38 | Chousuke | since concat is lazy. |
| 14:38 | chouser | pjstadig: the lazy structure being produced by concat blows the stack when you try to get the first element. |
| 14:39 | Chousuke | you're generating a whole lot of chunks. |
| 14:39 | Chousuke | er. |
| 14:39 | Chousuke | thunks |
| 14:39 | hiredman | concat is :( |
| 14:39 | chouser | ,(reduce concat (map #(list %) (range 1e4))) |
| 14:39 | clojurebot | Eval-in-box threw an exception:java.lang.StackOverflowError |
| 14:39 | pjstadig | so it blows stack trying to realize the lazy seq |
| 14:40 | chouser | try (apply concat ...) instead |
| 14:40 | pjstadig | ,(apply concat (map (constantly (vector 1 2 3)) (range 0 1900))) |
| 14:40 | clojurebot | (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:40 | pjstadig | k |
| 14:41 | the-kenny | konr: hm... should work. Maybe ask the author of swank-clojure-project? |
| 14:41 | defn | (def fooseq (lazy-seq (repeat (vector 1 2 3))) |
| 14:41 | defn | does that work at all? |
| 14:41 | the-kenny | s/-project// |
| 14:41 | defn | or are we stuck with the same problem |
| 14:41 | Chousuke | defn: the lazy-seq there is redundant |
| 14:41 | chouser | defn: doesn't produce the same output. |
| 14:42 | fliebel | What does it mean in Clojure if I get a java.lang.NullPointerException? |
| 14:42 | hiredman | ,(.foo nil) |
| 14:42 | the-kenny | konr: You can also check the contents of (get (System/getProperties) "java.class.path") |
| 14:42 | clojurebot | java.lang.NullPointerException |
| 14:42 | the-kenny | (That'll get you the classpath of the running clojure instance) |
| 14:42 | Chousuke | fliebel: exactly what it means in java :) |
| 14:43 | Chousuke | fliebel: nil is java null |
| 14:43 | fliebel | chousuke: So I did a function call somewhere without a proper argument? |
| 14:43 | Chousuke | fliebel: yeah. or a method call. |
| 14:43 | hiredman | always a method a call |
| 14:44 | fliebel | what si the difference between function and method? |
| 14:44 | hiredman | at the bottom an NPE means you called a method on null |
| 14:44 | konr | the-kenny: It's strange... perhaps my swank is not configured right. Thanks! |
| 14:44 | Chousuke | fliebel: functions mean clojure functions, methods are java methods (interop) |
| 14:44 | _fogus_ | ,(+ 1 nil) |
| 14:44 | clojurebot | java.lang.NullPointerException |
| 14:44 | defn | chouser: that does produce the same output |
| 14:44 | the-kenny | konr: Where do you get the not-in-classpath-thing in clojure? |
| 14:45 | _fogus_ | nil could also be an argument |
| 14:45 | Chousuke | fliebel: behind the scenes though a function call is also a method call but that's an implemetation detail :) |
| 14:45 | defn | (= (apply concat (map (constantly (vector 1 2 3)) (range 0 1900))) (reduce concat (take 1900 fooseq))) |
| 14:45 | defn | =>true |
| 14:45 | fliebel | chousuke: http://pastebin.com/m7ee2fd0 |
| 14:46 | chouser | ,(first (lazy-seq (repeat (vector 1 2 3))) |
| 14:46 | fliebel | I think it's line 11 |
| 14:46 | clojurebot | EOF while reading |
| 14:46 | chouser | ,(first (lazy-seq (repeat (vector 1 2 3)))) |
| 14:46 | clojurebot | [1 2 3] |
| 14:46 | hiredman | _fogus_: I think if you follow + down the call chain you will find a method being called on nil |
| 14:46 | Chousuke | fliebel: resolve is returning nil |
| 14:46 | chouser | defn: the lazy-seq/repeat example returns a list of vectors. The apply and reduce concat examples return a list of numbers. |
| 14:47 | konr | the-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:47 | Chousuke | fliebel: you don't have an "a" fucntion |
| 14:47 | defn | chouser: ah, ok, thanks |
| 14:47 | fliebel | chousuke: that is supposed to tigger the else case... |
| 14:47 | defn | what are all the bit twiddling forms in clojure? |
| 14:48 | Chousuke | ,(fn? nil[D[D[D[C[C[C[C[C[C[C[C[C [A[B[A [A[B[A[A ) |
| 14:48 | clojurebot | Unmatched delimiter: ) |
| 14:48 | Chousuke | eh |
| 14:48 | _fogus_ | hiredman: I think in that case the nil is an argument to an Integer ctor |
| 14:48 | Chousuke | ,(fn? nil) |
| 14:48 | clojurebot | false |
| 14:48 | Chousuke | ,(fn? @nil) |
| 14:48 | clojurebot | java.lang.NullPointerException |
| 14:48 | Chousuke | there |
| 14:49 | hiredman | _fogus_: basically a method call :P |
| 14:49 | Chousuke | can't deref nil |
| 14:49 | fliebel | chousuke: so, how do I do a proper test for an existing function? |
| 14:49 | Chousuke | fliebel: check whether resolve returns nil |
| 14:49 | _fogus_ | hiredman: If you want me to say you're right, then OK. You're right. ;) |
| 14:50 | fliebel | chousuke: I don't even know how to make an && in clojure :$ |
| 14:50 | Chousuke | (doc and) |
| 14:50 | clojurebot | "([] [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:50 | jasapp | defn: (doc-find "bit") ? |
| 14:50 | defn | jasapp: i found it, thanks :) |
| 14:50 | jasapp | oops |
| 14:51 | jasapp | (find-doc ... |
| 14:51 | defn | i just got Hacker's Delight so I'm gearing up for bit twiddling fun with clj |
| 14:51 | fliebel | thanks! once you learn to think the lisp way everything becomes so obvious. |
| 14:51 | stuartsierra | defn: be aware, bit twiddling in Clojure is slow compared to Java |
| 14:51 | jasapp | really, how come? |
| 14:51 | defn | stuartsierra: is that a permanent fact, or the temporary situation? |
| 14:52 | Chousuke | defn: hopefully temporary. |
| 14:52 | defn | what's the reasoning behind it? |
| 14:52 | defn | out of curiosity |
| 14:53 | defn | and by slower, how much? |
| 14:53 | Chousuke | defn: boxing probably. |
| 14:54 | fliebel | chousuke: This is how far I can get… (if (and (resolve (first func)) (fn? @(resolve (first func)))) |
| 14:54 | Chousuke | fliebel: that should do it. |
| 14:55 | fliebel | chousuke: Caused by: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Character |
| 14:56 | Chousuke | fliebel: you have an error someplace else I guess. |
| 14:56 | Chousuke | because that looks just fine to me. |
| 14:56 | fliebel | you see what I mean by unhelpful error messages? |
| 14:56 | Chousuke | fliebel: you can't map html btw |
| 14:56 | Chousuke | it's a mcro. |
| 14:56 | Chousuke | macro* |
| 14:56 | fliebel | ah… :( |
| 14:57 | defn | so 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:57 | defn | how would you implement this in clojure? |
| 14:57 | stuartsierra | defn: temporary, I hope |
| 14:58 | fliebel | chousuke: thanks for saving me again :P |
| 14:58 | Chousuke | (bit-and x (inc x))? / |
| 14:59 | defn | lol duh, i tried a couple tests and it didnt look like it was working, but it is |
| 14:59 | defn | thanks Chousuke |
| 15:00 | fliebel | Is there something like recursive macros? |
| 15:00 | defn | (recur) ? |
| 15:00 | defn | oh, macros, hmm, i dont know |
| 15:01 | Chousuke | fliebel: yes. |
| 15:01 | Chousuke | ~def -> |
| 15:01 | fliebel | like (macro (some-other-macro)) |
| 15:01 | defn | did (->) come before (..) or was it vice versa? |
| 15:01 | somnium` | ,(macroexpand (->> (range 5) (map inc) (map dec))) |
| 15:01 | clojurebot | (0 1 2 3 4) |
| 15:01 | somnium` | ,(macroexpand '(->> (range 5) (map inc) (map dec))) |
| 15:01 | clojurebot | (map dec (clojure.core/->> (range 5) (map inc))) |
| 15:05 | fliebel | I try to make this recursive: http://pastebin.com/m2f9cba4b (so that "boe" can be another expression that is treaded just like func) |
| 15:06 | fliebel | But I guess it's time to sleep *yawn* |
| 15:06 | fliebel | Oh, one more thing: Because strings are immutable, does that mean string concatenation is slow? |
| 15:10 | cark | fliebel : yes, use a StringBuilder when you need speed |
| 15:10 | fliebel | cark: what is that? |
| 15:11 | cark | http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html |
| 15:11 | chouser | (apply str ...) uses a StringBuilder internally |
| 15:11 | cark | or (apply str my-seq-of-strings) |
| 15:12 | Chousuke | there's usually no need to use stringbuilder explicitly. |
| 15:12 | Chousuke | since str uses it. |
| 15:13 | fliebel | ok, thanks :) I'm off to my bed… Bye! |
| 15:15 | polypus | are namespaces on clojure anything like package names in java where there a.b.c maps to a directory hierarchy a/b/c? |
| 15:16 | jasapp | is using StringBuilder really faster than concat? |
| 15:16 | jasapp | http://pastebin.com/m50c24ade |
| 15:16 | jasapp | or is my test case not big enough to see advantages? |
| 15:17 | stuartsierra | polypus: yes |
| 15:17 | stuartsierra | jasapp: concat is for sequences, not strings |
| 15:17 | stuartsierra | ,(concat "foo" "bar") |
| 15:18 | clojurebot | (\f \o \o \b \a \r) |
| 15:18 | polypus | stuart: ty. so why does lein set the top level ns to <project-name>.core? why isn't it just <project-name> |
| 15:19 | shr3kst3r | ,(str "foo" "bar") |
| 15:19 | clojurebot | "foobar" |
| 15:19 | stuartsierra | polypus: I guess lein assumes multiple namespaces in a project |
| 15:19 | stuartsierra | don't know about lein |
| 15:19 | jasapp | ahh |
| 15:20 | the-kenny | polypus: technomancy is the guy you want to talk with :) |
| 15:22 | polypus | i'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:23 | polypus | s/lwt/let |
| 15:23 | the-kenny | src/foo/bar.clj is (ns foo.bar) |
| 15:23 | chouser | polypus: it's normal, if a bit inconvenient, to use a globally unique name for your namespace and/or java package name |
| 15:24 | chouser | so perhaps org.polypus.foo |
| 15:24 | chouser | the definition for such a namespace foo should be in a file org/polypus/foo.clj |
| 15:25 | chouser | you might stick that in a src dir, so perhaps foo/src/org/polypus/foo.clj |
| 15:25 | chouser | then you can add foo/src to your classpath and (require 'org.polypus.foo) to load your namespace. |
| 15:26 | polypus | chouser: ty |
| 15:27 | chouser | np |
| 15:28 | technomancy | polypus: it uses foo.core since you can't AOT single-segment namespaces |
| 15:29 | polypus | so 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:29 | polypus | technomancy: ty |
| 15:30 | lisppaste8 | dakrone pasted "I thought multiple definitions were allowed?" at http://paste.lisp.org/display/91782 |
| 15:31 | dakrone | are multiple arg# definitions not allowed (like what I pasted?) |
| 15:31 | ska2342 | dakrone: I think you're missing an extra pair of parens |
| 15:32 | defn | im 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:32 | defn | does that stuff all go in the project root? |
| 15:32 | dakrone | ska2342: do I need a paren-thize (?) both definitions, or each individually? |
| 15:32 | technomancy | polypus: there's no need in Clojure to use something like org.polypus |
| 15:32 | polypus | dakrone: (defn f ([...] ...) ([...] ...)) |
| 15:32 | technomancy | that's a java convention you see carried over, but it's not helpful |
| 15:33 | ska2342 | dakrone: take a look at the example on http://clojure.org/special_forms where fn is described |
| 15:33 | technomancy | polypus: and it can be very annoying if you try to hand off maintainership of a project |
| 15:33 | dakrone | polypus & ska2342 okay, that was my problem, thanks guys/girls |
| 15:33 | technomancy | oh hah; here I am directly contradicting chouser. |
| 15:33 | _fogus_ | What?!? There are girls here? |
| 15:33 | technomancy | obviously there is no consensus about this |
| 15:33 | the-kenny | (something = the file, the module of the project) |
| 15:33 | the-kenny | s/the/one/ |
| 15:34 | technomancy | but I feel that the domain-name-as-namespace convention is an annoyance |
| 15:34 | technomancy | anyway, if your project name is not enough to make your namespace unique then you have bigger problems to deal with |
| 15:34 | technomancy | like finding a better project name |
| 15:34 | chouser | hm |
| 15:34 | ska2342 | (count (filter is-girl people-in-hash-clojure)) |
| 15:34 | defn | technomancy: 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:35 | defn | does that stuff go in src/, or in the proj. root? |
| 15:35 | technomancy | defn: put it in resources/ |
| 15:35 | the-kenny | defn: Look at the readme :) |
| 15:35 | technomancy | that was added right before the 1.0 release |
| 15:35 | defn | oh cool, thanks |
| 15:36 | lisppaste8 | dakrone pasted "why is abs randomly not available?" at http://paste.lisp.org/display/91783 |
| 15:36 | technomancy | polypus: maybe since chouser is writing a book called "idiomatic Clojure" you should listen to him instead of me; dunno. =) |
| 15:36 | polypus | :) |
| 15:37 | dakrone | can anyone tell me why the call to Math/abs is resolving sometimes, but not others? |
| 15:37 | the-kenny | dakrone: Could you show us the code? |
| 15:37 | dakrone | the-kenny: sure |
| 15:37 | lisppaste8 | dakrone annotated #91783 "the whole code" at http://paste.lisp.org/display/91783#1 |
| 15:38 | polypus | technomancy: 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:38 | the-kenny | dakrone: ah, got it. Add a type-annotation |
| 15:38 | dakrone | the-kenny: oh okay, so it's the duck-typing that's confusing it? |
| 15:39 | the-kenny | It 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:39 | the-kenny | dakrone: I think so. Just try it |
| 15:39 | the-kenny | And (set! *warn-on-reflection true), so you'll get warnings if some java-call goes through reflection :) |
| 15:39 | the-kenny | s/ion/ion*/ |
| 15:40 | dakrone | the-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:41 | defn | technomancy: 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:41 | defn | any plans to make that indented properly on init? |
| 15:41 | the-kenny | defn: hmhm... I have no idea then.. sorry |
| 15:42 | cark | ,(doc double) |
| 15:42 | clojurebot | "([x]); Coerce to double" |
| 15:43 | dakrone | cark: okay, wrapping the (- n average) in double did the trick |
| 15:44 | hiredman | it 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:44 | dakrone | cark: thanks |
| 15:45 | chouser | technomancy: it might be worth having a discussion about project name layouts |
| 15:45 | chouser | I certainly have no love for the extra directory level required by com/org |
| 15:45 | the-kenny | hiredman: It would be really cool if something like this would be in clojure itself :) |
| 15:46 | ska2342 | dakrone: 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:46 | dakrone | ska2342: yep, cark suggested that and it fixed the problem |
| 15:46 | hiredman | the-kenny: I dunno if it actually solves whatever the problem is |
| 15:46 | dakrone | ska2342: you're right, I totally forgot that average is sometimes a ration |
| 15:46 | dakrone | *ratio |
| 15:46 | ska2342 | ,(Math/abs 3/2) |
| 15:46 | clojurebot | java.lang.IllegalArgumentException: No matching method found: abs |
| 15:47 | hiredman | I'm throwing it out there and hopefully someone will say "yes it does" |
| 15:47 | chouser | technomancy: 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:47 | ska2342 | this gives reason to having clojure-built-in abs, no? |
| 15:47 | chouser | the latter case causing really painful issues for anyone trying to have both in the same classpath. |
| 15:48 | slyrus | hiredman: is that a prototype swank-class-loader? |
| 15:48 | dakrone | ska2342: I agree, having a built-in would be nice |
| 15:48 | hiredman | slyrus: I don't know, I barely have swank working |
| 15:49 | hiredman | I do have the gist posting thing in emacs working, I guess |
| 15:49 | slyrus | works for me... i even finally managed to get incanter working with slime |
| 15:51 | technomancy | chouser: right, but why would you have two groups with no knowledge of each other? |
| 15:51 | chouser | because the world is a big place? |
| 15:51 | technomancy | seems like picking a project name is a task that deserves some thorough research |
| 15:52 | hiredman | if 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:52 | technomancy | chouser: maybe for internal projects you could make that case |
| 15:52 | technomancy | but I don't see how it makes sense for open source |
| 15:52 | hiredman | I mean, I have tried it, and it in my very limited testing it works |
| 15:52 | technomancy | Google's index makes the world a lot smaller than it used to be. =) |
| 15:52 | chouser | technomancy: what about an internal project that goes open source later? |
| 15:53 | chouser | conversely, once a project is named org.something, why ever change it? I don't see a problem (other that the extra directory level) |
| 15:53 | technomancy | sure, open-sourcing a project is probably not a good reason to rearrange the directory layout |
| 15:54 | the-kenny | Is there a slime-command to shutdown the in emacs running lisp-process? Always killing *inferior lisp* is annoying |
| 15:54 | technomancy | but really the collision would only exist if two similarly-named private projects both decided to open their codebases |
| 15:54 | LauJensen | the-kenny: in the repl, hit ,q |
| 15:54 | technomancy | it's pretty edge-casey |
| 15:54 | the-kenny | ,q? |
| 15:54 | clojurebot | java.lang.Exception: Unable to resolve symbol: q? in this context |
| 15:55 | technomancy | defn: there's a TODO for prettyprinting project.clj; yeah |
| 15:55 | defn | cool |
| 15:55 | technomancy | but the contrib prettyprinter doesn't really look all that great |
| 15:55 | the-kenny | LauJensen: ahhhh I totally forgot about this ,-thing. Thanks! |
| 15:56 | LauJensen | np :) |
| 15:56 | ska2342 | the-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:56 | ska2342 | try , TAB for a list |
| 15:56 | clojurebot | for is not used enough |
| 15:57 | the-kenny | ska2342: Yes, I used this with common lisp some time I ago. I just forgot it was there. |
| 15:57 | polypus | why 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:57 | cark | what's not to like about c.c.pprint ? |
| 15:57 | cark | besides speed |
| 15:57 | ska2342 | the-kenny: wouldn't it be nice to load a contrib-lib like you could with asdf-systems? :-) |
| 15:57 | the-kenny | ska2342: Yes :) |
| 15:58 | churib | wow, didnt knew the ,-thing |
| 15:58 | hiredman | polypus: proj_name/core.clj actually |
| 15:58 | technomancy | cark: I just meant that the output it produces in this particular case doesn't match what a human would do |
| 15:58 | technomancy | polypus: that's a bug |
| 15:58 | technomancy | the new task on leiningen was ... not well-tested for the 1.0 release |
| 15:58 | technomancy | we should have 1.0.1 out in a couple days |
| 15:58 | the-kenny | But I mainly needs this if I've added a new lib to my project and don't want to restart my repl |
| 15:59 | ska2342 | cool: , change-package seems to work |
| 15:59 | technomancy | ska2342: see also C-c M-p from a clojure buffer to change the repl namespace |
| 15:59 | polypus | hiredman: ahh so rewrite - as _? is this a java thing? |
| 16:00 | polypus | technomancy: so the behaviour will change with 1.0.1? |
| 16:00 | ska2342 | technomancy: he, never used that in my CL days, or else it dropped off the memory |
| 16:00 | the-kenny | Btw. should M-x slime-list-threads work with swank-clojure? |
| 16:00 | the-kenny | I think it would be a nice thing to have |
| 16:01 | eno | anyone has idea why I get this error trying to run lein generated jar (not uberjar)? http://paste.lisp.org/display/91786 |
| 16:01 | technomancy | the-kenny: it would... just nobody's gotten around to porting it yet |
| 16:01 | the-kenny | eno: is clojure.jar in your classpath? |
| 16:01 | technomancy | eno: try lein deps first |
| 16:01 | the-kenny | technomancy: hm okay. Maybe I will :) |
| 16:02 | eno | "lein deps" returns without anything |
| 16:02 | eno | the-kenny: I put clojure-....jar explicitly in java -cp |
| 16:02 | patrkris | i've noticed that clojure-projects often build a project-source.jar file... what's that used for? |
| 16:02 | the-kenny | eno: and clojure.jar itself? |
| 16:04 | eno | the-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:04 | eno | same error |
| 16:04 | rullie | hi folks, i'm a noob |
| 16:05 | eno | OTOH, hello-standalone.jar runs fine |
| 16:05 | technomancy | eno: ah; -jar and -cp are mutually-exclusive |
| 16:05 | technomancy | java -jar is only good for standalones; that's just how java works. |
| 16:05 | eno | ah ok |
| 16:06 | rullie | is it safe to say you can use all existing java libs in cljure? |
| 16:06 | polypus | rullie: yes |
| 16:06 | cark | i don't think so ... some need annotations |
| 16:07 | rullie | what about generics and such |
| 16:07 | ska2342 | cark: oh, they cause a problem? Never thought about that. Do you have any reading material on this at hand? |
| 16:08 | cark | with type erasure generics are no problem i think |
| 16:08 | polypus | does clojurebot have paste.lisp.org support? |
| 16:08 | eno | probably should use "java -cp clojure.jar:helloworld.jar main.Class" |
| 16:09 | the-kenny | Is there a way to show the differences between the saved version of a file and the modified file in emacs? |
| 16:10 | LauJensen | For those of you who use ClojureQL and have been annoyed with the lack of a persisted global connection, its now added :) |
| 16:11 | the-kenny | hah, got it. diff-buffer-with-file :) |
| 16:13 | rullie | don't remember what you typed? :p |
| 16:14 | rullie | so how does clojure handle generics? |
| 16:15 | the-kenny | rullie: 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:16 | cark | rullie : it doesn't, there is no need as clojure is dynamically typed |
| 16:16 | ska2342 | the-kenny: that reminds me that I wanted an ediff session for unsaved changes for ages. Never got across the prototype stage, though :-( |
| 16:16 | rullie | cark: what i meant is how does it work with libs that do have generics in it |
| 16:16 | lpetit | Hello |
| 16:16 | cark | nothing special about it, just use as usual |
| 16:17 | the-kenny | rullie: Iirc, generics are removed at compile-time. |
| 16:17 | the-kenny | There are just type annotations to the compiler |
| 16:17 | eno | rullie: type erasure |
| 16:17 | rullie | ok, that's great |
| 16:17 | cark | well no it sucks =) .net is better in that respect |
| 16:17 | cark | but good for clojure yes =) |
| 16:18 | rullie | great as in no need to worry about them in clojure |
| 16:18 | the-kenny | cark: C++ is better in that too :D |
| 16:18 | the-kenny | Templates > Generics |
| 16:18 | lpetit | rhickey: 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:20 | cark | i don't know c++ much, are generics and templates solving the same problems, or do they just have a slight overlap ? |
| 16:21 | the-kenny | cark: templates are mostly used like generics, but the types aren't dropped at compile time. |
| 16:22 | hiredman | grrr |
| 16:22 | the-kenny | hiredman: Did I say something wrong? |
| 16:23 | hiredman | I somehow end up with missing parens, and paredit won't let me insert a paren |
| 16:23 | polypus | yeah that's annoying |
| 16:23 | technomancy | hiredman: C-q ) |
| 16:23 | technomancy | C-q is "break the rules" mode |
| 16:24 | the-kenny | whoa, something's wrong here. swank-clojure-project just started a sbcl-session |
| 16:25 | ska2342 | the-kenny: nothing wrong with sbcl .. oops, wrong channel ;-) |
| 16:25 | ska2342 | the-kenny: maybe you have several slime-lisp-implementations? |
| 16:26 | the-kenny | ska2342: Yes, but it worked until now. I just updated swank-clojure to the latest version. |
| 16:26 | the-kenny | But it's a special case here.. I don't want to use elpa ;) |
| 16:26 | ska2342 | the-kenny: I don't use elpa, too. The whole setup feels rather fragile. |
| 16:27 | ska2342 | the-kenny: I'll take a quick look at latest commits |
| 16:27 | the-kenny | ska2342: Yes, I feel the same |
| 16:28 | ska2342 | the-kenny: when did you do your last update? The latest commit seems to be from 2009-10-18 |
| 16:28 | the-kenny | ska2342: Some weeks ago |
| 16:28 | the-kenny | 3 or so |
| 16:28 | the-kenny | I'm a bit lazy at updating because it always breaks something on my setup :D |
| 16:29 | ska2342 | the-kenny: what is the value of slime-lisp-implementations |
| 16:30 | the-kenny | ska2342: 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:30 | ska2342 | the-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:31 | hiredman | with paredit can I yank an s-expr from where it is and put it somewhere else? |
| 16:31 | the-kenny | Maybe I'll drop my setup *again* and start from scratch |
| 16:31 | the-kenny | Worked fine the last ~2 times |
| 16:31 | KirinDave_ | hiredman: Yes. |
| 16:31 | ska2342 | the-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:31 | hiredman | KirinDave_: please explaind how |
| 16:31 | KirinDave_ | 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:32 | slyrus | hiredman: ^K and ^Y |
| 16:32 | hiredman | KirinDave_: C-k does the yanking or sets up for the yanking? |
| 16:32 | KirinDave_ | hiredman: C-k does the killing. |
| 16:32 | hiredman | C-k C-y ? |
| 16:32 | KirinDave_ | hiredman: And then it's in your kill ring. |
| 16:32 | KirinDave_ | And then you can C-y at any time to yank the most recent kill ring entry out. |
| 16:32 | hiredman | I see |
| 16:33 | hiredman | kill-ring |
| 16:33 | hiredman | how superhero like |
| 16:33 | technomancy | hiredman: indeed. unfortunately M-x hide-body does *not* do what you might think. |
| 16:33 | KirinDave_ | You might wanna do the basic emacs tutorials. Things like the kill ring are part of what makes emacs inordinately useful. |
| 16:34 | polypus | hiredman: peepcode has a pretty good emacs video too |
| 16:35 | the-kenny | Maybe I'll give up and use elpa... technomancy wins! ;) (No offense) |
| 16:35 | technomancy | the-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:36 | the-kenny | technomancy: Okay.. I hope I don't have to change anything in my .emacs for sbcl if elpa installs slime for me.. |
| 16:40 | polypus | i'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:44 | the-kenny | technomancy: Okay, swank-clojure is installed now.. I'll try to bring slime with sbcl working now. |
| 16:49 | rullie | the heck there's a slime for clojure? |
| 16:49 | rullie | neat stuff |
| 16:49 | the-kenny | rullie: Sure |
| 16:50 | the-kenny | rullie: I'm sure it was one of the first "big" projects for clojure |
| 16:50 | ska2342 | FTIW 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:51 | rullie | ska2342: cool, i have the same setup. gonna try it tonight |
| 16:51 | the-kenny | technomancy: How can I bring slime-fuzzy to work with elpa? |
| 16:56 | the-kenny | technomancy: Nevermind.. just add slime-fuzzy.el to my load-path and do (slime-setup '(slime-fuzzy)) |
| 16:56 | LauJensen | the-kenny: Whats fuzzy ? |
| 16:57 | dakrone | technomancy: 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:57 | the-kenny | LauJensen: Fuzzy-Completion for the slime repl. w-oTAB extends to with-open |
| 16:57 | LauJensen | ah ok |
| 16:58 | the-kenny | ok.. it doesn't work :( |
| 16:59 | LauJensen | Wonder how much it would speed things up anyway |
| 17:00 | the-kenny | LauJensen: I'm used to it |
| 17:00 | ska2342 | LauJensen: fuzzy completion? It's a killer and your finger-brain will take even more control |
| 17:02 | LauJensen | Ok |
| 17:02 | ska2342 | LauJensen: 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:02 | LauJensen | Common 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:09 | lpetit | Hello, 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:09 | lpetit | cipant"'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:09 | lpetit | ...available namespaces symbols. |
| 17:12 | lpetit | So 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:12 | lpetit | do 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:13 | lpetit | or 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:14 | lpetit | If anybody more skilled than me in these problems can help ... you're very welcome, 'cause I'm circling, circling on it ... |
| 17:15 | spuz | lpetit: sounds like a pretty hacky way of doing it... |
| 17:16 | spuz | I guess there's no way to wait on a callback from the REPL when the TCP information is available? |
| 17:16 | lpetit | Well, 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:17 | lpetit | Currently 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:18 | the-kenny | Hah, got slime-fuzzy working :) |
| 17:18 | ska2342 | lpetit: "Eclipse could hang forever"? You're more a netbeans fan, then? :-) |
| 17:19 | lpetit | ska2342: anybody writing a plugin badly may break the underlying platform, I guess. Just trying not to do that. |
| 17:20 | ska2342 | lpetit: just kidding, couldn't withstand that punchline |
| 17:20 | lpetit | :) |
| 17:20 | the-kenny | I recommend slime-fuzzy to everyone :) |
| 17:20 | spuz | lpetit: do you have gorsal's patch on github? |
| 17:21 | lpetit | ska2342: if you better would like to give me your ideas concerning how to do it :-) |
| 17:22 | ska2342 | lpetit: sorry, me I'm no help with Eclipse and Java stuff. Just Emacs, nothing else. |
| 17:23 | spuz | lpetit: I found it: http://github.com/Eyaro/ccw/commit/06c00832f1c2e5c4a7c15d6de0f625ad6b0e8e7e#L7L1 |
| 17:23 | lpetit | spuz: 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:24 | spuz | lpetit: yeah, I see, you're suggesting replace the thread with a future but that doesn't really make it much more elegant :p |
| 17:26 | lpetit | spuz: 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:27 | spuz | true, but when would cancel the future? |
| 17:27 | lpetit | ska2342: 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:30 | lpetit | spuz: on ConsolePageParticipant.dispose() call by the framework ( I guess this dispose() method corresponds to the end of the corresponding launched REPL |
| 17:30 | spuz | hmm ok |
| 17:31 | lpetit | Folks, 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:31 | lpetit | 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. How would you do this ? |
| 17:41 | polypus | about to light my hair on fire. here are the exact steps i'm taking: |
| 17:41 | polypus | lein new foobar |
| 17:41 | polypus | edit foobar/project.clj to look like this: |
| 17:41 | the-kenny | technomancy: Looks like sbcl works flawlessly with swank-clojure from elpa :) |
| 17:42 | polypus | (defproject foobar "1.0.0-SNAPSHOT" |
| 17:42 | polypus | :description "foobar" |
| 17:42 | polypus | :dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"]]) |
| 17:42 | polypus | mv src/foobar.clj src/foobar/core.clj |
| 17:42 | polypus | edit core.clj to look like this: |
| 17:42 | polypus | (ns foobar.core) |
| 17:42 | polypus | |
| 17:42 | polypus | (defn barfoo [x] (str "foobar:" x)) |
| 17:43 | polypus | lein repl works fine |
| 17:43 | polypus | lein compile seems to also |
| 17:43 | polypus | but lein jar fails with: |
| 17:43 | polypus | Exception in thread "main" java.lang.ClassCastException: java.io.StringWriter (NO_SOURCE_FILE:0) |
| 17:44 | polypus | any ideas? |
| 17:45 | gravity | polypus: Add a :main your_namespace section to project.clj |
| 17:46 | technomancy | polypus: on JDK 1.5? if so that was fixed yesterday in master. |
| 17:46 | tcrayford | I made something roughly like ruby's autotest with lein and some ruby scripting |
| 17:46 | tcrayford | http://www.tcrayford.net/2009/12/08/Lein-Autotest.html |
| 17:47 | tcrayford | uses watchr for changes to .clj files in /src or /test and then runs lein test, and colours the output for pass/fail |
| 17:48 | polypus | gravity, technomancy: ty i'll have a look in a minute |
| 17:48 | the-kenny | elpa is dumb... |
| 17:49 | the-kenny | Doesn't install any .lisp-files with slime |
| 17:49 | the-kenny | So the emacs-part of slime is working, but no backend for any lisp is installed |
| 17:50 | the-kenny | (they are normally bundleled with slime) |
| 17:51 | technomancy | the-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:51 | konr | for 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:52 | the-kenny | technomancy: mhm... I'm not sure if the backend for sbcl is in the package manager of CL |
| 17:53 | technomancy | the-kenny: what I mean is if it's not, that's a CL problem, not an elpa problem |
| 17:53 | the-kenny | technomancy: I understand you. It's just new for me. I'm used to have everything in my slime-tarball. |
| 17:56 | KirinDave1 | Hey, if I'm at the repl |
| 17:56 | KirinDave1 | How would I figure out the current working directory? |
| 17:59 | tcrayford | (use 'clojure.contrib.duck-streams) |
| 17:59 | tcrayford | (pwd) |
| 17:59 | KirinDave1 | Man this is bizareew |
| 18:00 | KirinDave1 | So I know my pwd is correct |
| 18:00 | KirinDave1 | It's /Users/kirindave/Projects/scorekeeper/ |
| 18:00 | KirinDave1 | I know that under scorekeeper is a templates directory |
| 18:00 | KirinDave1 | and in that is home.html |
| 18:01 | KirinDave1 | But (reader "templates/home.html") refuses to read. |
| 18:03 | hiredman | hah! |
| 18:03 | KirinDave1 | Oh |
| 18:04 | KirinDave1 | In java, you can't change the current working directory? |
| 18:04 | KirinDave1 | ... |
| 18:04 | KirinDave1 | What kind of insanity is that? |
| 18:06 | Chousuke | hiredman: working on a compiler now? :P |
| 18:06 | the-kenny | KirinDave1: Blame sun |
| 18:09 | tcrayford | KirinDave1: eval this (str (pwd) "templates/home.html") |
| 18:10 | KirinDave1 | tcrayford: I was under the impression you could change the current working directory |
| 18:12 | dnolen | KirinDave1: 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:12 | KirinDave1 | So when you're developing on the repl |
| 18:12 | KirinDave1 | how the hell do you even get to files? |
| 18:13 | dnolen | you could even make a function called cwd that either returns the standard current directory (whatever the JVM thinks) or the values of *cwd* |
| 18:13 | slyrus | KirinDave1: change the classpath and restart the JVM :P |
| 18:13 | KirinDave1 | slyrus: For things like templates. |
| 18:13 | dnolen | values -> value |
| 18:13 | KirinDave1 | slyrus: That seems pretty lame. |
| 18:14 | slyrus | I agree! |
| 18:15 | KirinDave1 | argh and enlive stopped working for me again. Seriously, I quit. |
| 18:16 | KirinDave1 | cgrand-r1c: I don't suppose you're still here? |
| 18:18 | dnolen | KirinDave1: what's the bug you're seeing? I messed around with Enlive quite a lot at one point. |
| 18:18 | KirinDave1 | dnolen: All deftemplate ever says is "null pointer exception" |
| 18:18 | KirinDave1 | So I have no idea. |
| 18:18 | dnolen | paste your template, I'll take a look. |
| 18:21 | KirinDave1 | dnolen: both template and invocation are here: https://gist.github.com/dd83a434403e29fdf09d |
| 18:23 | dnolen | try (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:24 | technomancy | the-kenny: heh; thanks. |
| 18:24 | technomancy | KirinDave1: 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:27 | KirinDave1 | technomancy: So like, resources/templates/home.html instead? |
| 18:27 | technomancy | sure |
| 18:28 | KirinDave1 | technomancy: But that doesn't change my opening problem, right? |
| 18:29 | KirinDave1 | technomancy: And that is only available during the jar'd state, not during dev on the repl? |
| 18:31 | technomancy | KirinDave1: no, if resources/ is on the classpath, getResourceAsStream will find it. |
| 18:33 | KirinDave1 | technomancy: I'll try it. Thanks. |
| 18:36 | technomancy | welcome to the wacky wonderful world of the jvm |
| 18:36 | KirinDave1 | technomancy: … I loathe to ask this, but where do I call that method from, even |
| 18:37 | technomancy | oh right... it's a bit wordy: (.getResourceAsStream (.getContextClassLoader (Thread/currentThread)) "/templates/home.html") |
| 18:37 | KirinDave1 | Well, there's hardly anything to it, now is there? |
| 18:39 | konr | Has anyone ever tried to change swing's look and feel? This code, removed from an example, simply yields a null pointer exception: |
| 18:39 | konr | (javax.swing.UIManager/setLookAndFeel (javax.swing.UIManager/getSystemLookAndFeelClassName)) |
| 18:41 | KirinDave1 | technomancy: I wish it worked, but it doesn't seem to. |
| 18:52 | hiredman | http://gist.github.com/252110 yay macros! |
| 18:57 | replaca_ | 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:57 | cp2_ | hiredman: watcha' making? |
| 19:01 | hiredman | cp2: my goal is to replace classloader.java with something generated using the asm package |
| 19:02 | cp2 | interesting |
| 19:03 | cp2 | what for? |
| 19:03 | hiredman | uh, so I don't have to write it in java? |
| 19:04 | cp2 | heh, would be a good reason =P |
| 19:19 | dysinger | KirinDave: |
| 19:19 | dysinger | user> (System/getProperty "user.dir") |
| 19:20 | dysinger | "/Users/tim/src/sa-safe/amqp/src/main/clojure/sonian/archive" |
| 19:20 | dysinger | user> (System/setProperty "user.dir" "temp") |
| 19:20 | dysinger | "/Users/tim/src/sa-safe/amqp/src/main/clojure/sonian/archive" |
| 19:20 | dysinger | user> (System/getProperty "user.dir") |
| 19:20 | dysinger | "temp" |
| 19:20 | dysinger | user> |
| 19:20 | dysinger | ? |
| 19:21 | dysinger | changes cwd |
| 19:22 | dysinger | works with (pwd) |
| 20:19 | polypus | technomancy: 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:23 | konr | How can I round 3.14159 to 3.1416? |
| 20:24 | rullie | konr: http://java.sun.com/docs/books/tutorial/java/data/numberformat.html |
| 20:28 | konr | lr be |
| 20:29 | konr | *or better yet: http://richhickey.github.com/clojure-contrib/pprint-api.html#clojure.contrib.pprint/cl-format |
| 21:22 | konr | is there a macro that could replace [(function foo) (function bar) (function baz) ...] with (macro function foo bar baz ...)? |
| 21:27 | kylesmith | (vec (map function [foo bar baz])) |
| 21:30 | kylesmith | Has anyone gotten penumbra to work? I can't get the libraries to stop throwing exceptions. |
| 21:31 | konr | oh, of course |
| 21:31 | ambient | yep, got it working a while ago |
| 21:31 | ambient | at least all the exmples |
| 21:40 | JAS415 | kylesmith: yup, got it working |
| 21:40 | JAS415 | what is the exception |
| 21:43 | kylesmith | one moment, let me try one more thing. |
| 21:46 | kylesmith | com.sun.gluegen.runtime.CPU.getPointerSizeInBits |
| 21:48 | JAS415 | hmm |
| 21:48 | JAS415 | is it a particular example? |
| 21:48 | kylesmith | the actual exception is an UnsatisfiedLinkError if that helps |
| 21:48 | JAS415 | oh |
| 21:49 | JAS415 | you might not have all the deps installed |
| 21:50 | kylesmith | it's for all examples. I have all the jars on my classpath, and all the *.so files are on my libpath. |
| 21:52 | kylesmith | what other dependencies are there? |
| 21:53 | JAS415 | i had |
| 21:53 | ambient | clojure, clojure-contrib |
| 21:53 | JAS415 | glugen.jar, jogl.jar |
| 21:53 | ambient | you sure you have the right binaries? |
| 21:53 | ambient | there are 32 and 64 bit versions iirc |
| 21:53 | JAS415 | nativewindow |
| 21:54 | ambient | depends on the JVM, which you will need |
| 21:54 | kylesmith | yes, I have the right binaries (that is a different error message). |
| 21:54 | kylesmith | I'm on 32bit ubuntu, btw. |
| 21:55 | kylesmith | JAS415: yes, I have all those. |
| 21:56 | JAS415 | hum |
| 21:56 | JAS415 | the only problem i had was getting the names of directories right |
| 21:56 | JAS415 | i'm on ubuntu too :-( |
| 21:58 | kylesmith | 32bit or 64bit? |
| 21:58 | JAS415 | i think this is 64 |
| 22:00 | JAS415 | you pointed at the directory for the java.library.path and not the individual *.so files? |
| 22:02 | kylesmith | well, actually I 'cheated' and just copied the individual files to a directory already on the libpath. |
| 22:06 | KirinDave1 | Hey, does anyone here use leiningen and the resources/ directory? I'm having problem accessing resources. |
| 22:07 | JAS415 | kyle: can you do a backtrace on the error? |
| 22:07 | JAS415 | might give you a class or filename |
| 22:08 | kylesmith | I just got it to work on the 64bit machine. I didn't see the additional library paths in swank-clojure.el before. |
| 22:09 | JAS415 | hmm |
| 22:09 | kylesmith | hence, I thought I could just copy the files, but apparently that doesn't work. |
| 22:10 | JAS415 | i think there is an extra jar |
| 22:10 | kylesmith | I count 3 jars and 5 *.so files. ? |
| 22:11 | JAS415 | opencl4 java |
| 22:11 | JAS415 | 5 jar 5 so |
| 22:11 | JAS415 | 4 jar* |
| 22:13 | kylesmith | I 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:16 | JAS415 | hum |
| 22:20 | kylesmith | What kind of bothers me is that the installation instructions explicitly state that what I was attempting to do was acceptable. |
| 22:21 | kylesmith | anyhow, thanks for the help JAS415 |
| 22:22 | JAS415 | yeah i'm not sure what happened there |
| 22:22 | JAS415 | glad you at least have it working on one machine :-) |
| 22:23 | kylesmith | no, it's working on both now :) Thanks again. |
| 22:23 | JAS415 | oh |
| 22:23 | JAS415 | good |
| 22:23 | JAS415 | even better |
| 22:45 | konr | What should I use to generate an exe from a Lein uberjar? |
| 23:24 | polypus | ,'just-testing |
| 23:24 | clojurebot | just-testing |
| 23:29 | hiredman | ~ping |
| 23:29 | clojurebot | PONG! |
| 23:30 | hiredman | so, 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:31 | hiredman | now I just need to override findClass |