2009-10-17
| 00:22 | jaiganesh | hi |
| 00:23 | durka42 | hi jaiganesh |
| 00:23 | jaiganesh | how can i split a string of this format "\"DARELL\",\"BRODERICK\",\"ALONSO\"" |
| 00:23 | jaiganesh | into a list |
| 00:24 | durka42 | ,(seq (.split "\"DARELL\",\"BRODERICK\",\"ALONSO\"" ",")) |
| 00:24 | durka42 | oops, we are botless |
| 00:24 | durka42 | that gives you ("\"DARELL\"" "\"BRODERICK\"" "\"ALONSO\"") |
| 00:25 | jaiganesh | n how to remove \ |
| 00:25 | arbscht | and there is (split s re) in c.c.str-utils2 |
| 00:26 | durka42 | user=> (map #(.substring % 1 (dec (.length %))) *1) |
| 00:26 | durka42 | ("DARELL" "BRODERICK" "ALONSO") |
| 00:29 | jaiganesh | durka42:interesting, what is *1 |
| 00:29 | durka42 | (require '[clojure.contrib.str-utils2 :as s]) (remove empty? (s/split "\"DARELL\",\"BRODERICK\",\"ALONSO\"" #"[\",]")) |
| 00:30 | durka42 | *1 is the previous value from the REPL |
| 00:30 | jaiganesh | k |
| 00:30 | durka42 | ^ using the function arbscht pointedo ut |
| 00:31 | jaiganesh | THANKS |
| 00:31 | arbscht | (map #(-> % (ss/drop 1) (ss/butlast 1)) ...) |
| 00:34 | arbscht | or (map #(-> % (ss/drop 1) (ss/chop)) ...) |
| 00:35 | arbscht | I wonder why the trim functions don't take an optional character or character-class argument |
| 00:36 | durka42 | agreed |
| 00:37 | arbscht | (map #(ss/replace % #"(^\"|\"$)" "") ...) |
| 00:37 | durka42 | > (s/replace "\"blah\"" #"^\"+(.*)\"+$" "$1") |
| 00:37 | durka42 | "blah" |
| 00:38 | arbscht | (map #(ss/replace % #"(^\"+|\"+$)" "") ...) |
| 00:39 | arbscht | bah, no clojurebot to remind us of the evil of regex :) |
| 00:39 | jaiganesh | :) |
| 00:41 | durka42 | (defn strip [st chars] (ss/replace st (re-pattern (str "^[" pat "]*(.*)[" pat "]*$")) "$1")) |
| 00:42 | durka42 | oops, (defn strip [st chars] (s/replace st (re-pattern (str "^[" chars "]*(.*?)[" chars "]*$")) "$1")) |
| 00:49 | solussd | I have emacs configured with 'clojure-install'. How do I add a path to my classpath? |
| 01:03 | tomoj | solussd: there's swank-clojure-classpath |
| 01:03 | tomoj | I prefer using swank-clojure-project |
| 01:04 | tomoj | just stick all the jars you need in a lib/ dir, with a src/ dir for the clj sources, then M-x swank-clojure-project, pick your project dir, and it sets up the classpath for you |
| 01:04 | tomoj | though you need to stick copies of clojure.jar and clojure-contrib.jar in there too |
| 01:05 | tomoj | and with that method you have to restart the repl (or do something funky I don't know about) if you add a jar |
| 01:05 | solussd | awesome- thanks |
| 01:06 | tomoj | you could probably use the source for swank-clojure-project as inspiration for something funky you wanted to do, too, if it doesn't do exactly what you want |
| 01:12 | somnium | you can just put the path to your clojure and contrib jars in the clojure-project source |
| 01:13 | somnium | I modified it to grab some extra jars for app engine stuff |
| 01:22 | hiredman | well, clojurebot includes a mini webserver now :( |
| 01:26 | tomoj | where is it? |
| 01:28 | hiredman | http://gist.github.com/212251 |
| 01:28 | hiredman | for querying factoids via json |
| 01:29 | hiredman | still a few debug prn statements |
| 02:17 | hiredman | http://www.thelastcitadel.com/lab/clojurebot.html <-- javascript pulling factiods from clojurebot |
| 02:49 | tomoj | has anyone gotten a remote slime repl to work with tramp? |
| 02:50 | tomoj | it seems to me that swank-clojure is not providing enough information about the connection for slime-tramp.el to work |
| 06:31 | LauJensen | Morning gents |
| 06:50 | ambient | morning |
| 06:53 | sfuentes | Goodnight over here :) |
| 07:13 | LauJensen | Well it's noon + 1 here actually, but it feel strangely like morning, just seconds before the coffee kicks in :) |
| 10:00 | solussd | If I try running m-x swank-clojure-project from emacs and I type in a path and hit enter, I simply get another line, it doesn't _do_ anything. any ideas? |
| 10:00 | tomoj | "another line"? |
| 10:00 | tomoj | it's supposed to start a repl |
| 10:01 | Chousuke | as in, instead of sending the command you get a newline? |
| 10:01 | Chousuke | weird |
| 10:01 | solussd | Yes. |
| 10:02 | Dawgmatix | are there any plans to add swank-clojure to upstream slime ? |
| 10:02 | Chousuke | it's probably easier to develop as a separate project :P |
| 10:02 | solussd | I installed everything using m-x clojure-install |
| 10:03 | Chousuke | the slime people use CVS :( |
| 10:05 | konr | Is there a function to find out if an element is NOT a sequence, like (not (list? "foo"))? |
| 10:06 | konr | or (not (seq? "foo")) |
| 10:09 | solussd | All I want to do is add a .clj to my classpath so I can access it via (require 'path.to.lib) Nothing I've stumbled upon on google seems to work. |
| 10:17 | tomoj | solussd: you mean a newline appears in the minibuffer? |
| 10:17 | solussd | yes |
| 10:17 | tomoj | that's very odd |
| 10:17 | solussd | I thought so. :) |
| 10:18 | solussd | trying to make my way through the clojure book.. stuck until I can define my lib path |
| 10:20 | tomoj | are you using the emacs-starter-kit? |
| 10:21 | solussd | no, just emacs/aquamacs. I installed all the clojure stuff using M-x clojure-install |
| 10:22 | solussd | *aquaemacs |
| 10:22 | solussd | *aquamacs emacs? :) |
| 10:23 | tomoj | hmm |
| 10:24 | tomoj | I've always had ido-mode when using swank-clojure-project |
| 10:24 | tomoj | I would think it should work without it, though.. |
| 10:25 | ericthorsen_ | er |
| 10:25 | namor | "Many programming languages mix pure functions and side effects in completely ad hoc fashion. Not Clojure. In Clojure, side effects are explicit and unusual" (p48 Programming Clojure) -- What exactly does that mean? Isn't it just as simple to have side effects in Clojure as in Java? Just write print in a function body for instance.. |
| 10:26 | tomoj | I think they're specifically talking about mutating some data |
| 10:26 | arbscht | namor: that may be better worded as "In Clojure, mutation is explicit and unusual" |
| 10:26 | namor | Yes, that makes more sense. |
| 10:29 | tomoj | hmm, does emacs come with ido by default? |
| 10:29 | ambient | not mine at least |
| 10:29 | ambient | installed separately |
| 10:29 | ambient | i find it very hard to do side effects in idiomatic clojure :P |
| 10:30 | tomoj | solussd: do C-h f ido-read-directory-name |
| 10:32 | solussd | i get a seperate buffer with this: do-read-directory-name is an autoloaded Lisp function in `ido'. |
| 10:32 | solussd | (ido-read-directory-name prompt &optional dir default-dirname |
| 10:32 | solussd | mustmatch initial) |
| 10:33 | tomoj | guess you have it then |
| 10:34 | tomoj | well.. if all else fails you can just manually set swank-clojure-classpath, I guess |
| 10:35 | tomoj | dunno what would cause the interactive arg not to work |
| 10:40 | solussd | How do I 'append' to swank-clojure-classpath ? |
| 10:40 | solussd | I've tried a few ways, but none seem to work |
| 10:47 | konr | what is the clojure equivalent of CL's (atom foo)? |
| 10:51 | tomoj | maybe (not (sequential? foo)) ? |
| 10:51 | rhickey | konr: 'atom' isn't really a first-class abstraction, and was not carried forward into Clojure |
| 10:52 | rhickey | it might have made sense when you only had one composite data structure, but not now |
| 10:59 | ambient | does emacs/clojure-mode/slime automatically use java -server? |
| 11:13 | neotyk | rhickey: if contribution to clojure-contrib is small do I still have to sign CA? |
| 11:13 | rhickey | neotyk: small like what? |
| 11:13 | neotyk | like http://github.com/neotyk/clojure-contrib/commit/b70d0c0fd16f6ea6b963fceb39b6d60f1ca55e95 |
| 11:15 | rhickey | yeah, can't takethat as a patch, but the change is small you might be able to get a contribber to add it just by making a support request |
| 11:16 | neotyk | support ticket in assembla? |
| 11:16 | rhickey | neotyk: yes |
| 11:16 | neotyk | rhickey: thanks! |
| 11:16 | rhickey | https://www.assembla.com/spaces/clojure-contrib/support/tickets |
| 11:22 | neotyk | created https://www.assembla.com/spaces/clojure-contrib/support/tickets/37-Include-math-lcm-for-more-than-2-args |
| 11:22 | arbscht | rhickey: btw, I mailed out a CA ~2 weeks ago - have you received it? |
| 11:23 | rhickey | arbscht: I was away in Denmark and haven't checked the PO Box since then. |
| 11:23 | arbscht | ah |
| 11:23 | rhickey | will soon |
| 11:23 | arbscht | great, thanks |
| 11:34 | ambient | (time (doseq [i (range 88000)] (aset abuf i (byte (rem i 127))))) |
| 11:34 | ambient | "call to aset can't be resolved" |
| 11:34 | ambient | when abuf is Byte/TYPE |
| 11:37 | ambient | that whole thing takes 4 seconds :/ |
| 11:40 | Chousuke | you need to typehint abuf |
| 11:40 | Chousuke | #^bytes should work I think |
| 11:40 | ambient | tried (aset #^bytes abut ... made no difference |
| 11:41 | Chousuke | hmmh |
| 11:41 | ambient | aaa (aset #^bytes abuf (int i) ,,,) :) |
| 11:42 | ambient | hah, from 4328 msec to 65 msec :D |
| 11:42 | Chousuke | heh |
| 12:02 | solussd | specifically, how to I add a path to my environment in emacs that will show up in (.. System getProperties (get "java.class.path")) ? |
| 12:02 | solussd | |
| 12:03 | ambient | (setq swank-clojure-extra-classpaths (list "c:/stuff/here" ... )) |
| 12:04 | tomoj | solussd: when you're in the minibuffer swank-clojure-project gives you, what does C-h k RET say? |
| 12:05 | tomoj | (if you do this you will need to C-x o back into the minibuffer to C-g it) |
| 12:05 | tomoj | it should be ido-exit-minibuffer |
| 12:05 | solussd | RET runs the command newline |
| 12:05 | solussd | which is an interactive compiled Lisp function in `simple.el'. |
| 12:05 | solussd | It is bound to RET. |
| 12:06 | tomoj | sounds like your ido is broken |
| 12:06 | tomoj | maybe try installing it for real? |
| 12:07 | solussd | Oh boy.. C-g does not kill my minibuffer. :( |
| 12:07 | tomoj | you have to C-x o into it |
| 12:07 | solussd | I did. |
| 12:07 | tomoj | if even that doesn't work.. how'd you get out of the minibuffer before? |
| 12:07 | solussd | i killed emacs. :) |
| 12:07 | tomoj | damn |
| 12:07 | tomoj | something is seriously wrong |
| 12:07 | solussd | i ust nuked everything and reinstalled... |
| 12:08 | solussd | *just |
| 12:08 | solussd | well... everything being clojure stuff. not emacs |
| 12:08 | solussd | I'm running in osx |
| 12:08 | tomoj | I recommend the emacs-starter-kit |
| 12:08 | solussd | What all comes in this starter kit? |
| 12:09 | tomoj | lots of stuff |
| 12:09 | tomoj | I had clojure/slime working fine in aquamacs with the starter kit |
| 12:09 | Dawgmatix | is there an equivalent to room in lisp ? |
| 12:10 | tomoj | didn't try it without the starter kit, though, so I dunno if it will solve your problem |
| 12:10 | Dawgmatix | (ie a function to monitor current memory usage) |
| 12:13 | tomoj | Dawgmatix: there's jconsole.. |
| 12:14 | tomoj | you can get info about memory usage in general from some java class, but not broken down by objects |
| 12:33 | djpowell | cool. got my live-repl thing working. It uses the Java Attach API to connect to any running Java process and gives you a clojure repl into it. |
| 12:33 | djpowell | i'll stick it on github once i've figured git out. in the meantime: http://djpowell.net/tmp/liverepl.zip |
| 12:34 | djpowell | quite fun to use it to repl into a repl, so you've got two repls on the same vm. good for testing out concurrency stuff. |
| 12:41 | AWizzArd | Slime users: is it possible to autocomplete names of jvm methods? |
| 12:42 | ambient | C-c I lists all class methods |
| 13:07 | triyo | Saw this article popup on HNews http://www.cio.com.au/article/314348/introduction_clojure and is it me or are the code snippets bad examples of what clojure code should look like. Code clojure code doesn't look like that :) |
| 13:08 | triyo | Ending parens on separate lines. Error handling by throwing java.lang.Exception in functions... |
| 13:11 | solussd | Wtomoj: I installed emacs-starter-kit, installed clojure via package-list-packages and then ran clojure-install and everything worked! ... until I restarted emacs. When I added "(clojure-slime-config)" to my .emacs.el it errors out on it. any ideas? |
| 13:12 | solussd | *tomoj |
| 13:18 | triyo | ,*clojure-version* |
| 13:18 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"} |
| 13:20 | jlilly | solussd: an error would help, fwiw. |
| 13:22 | solussd | jlilly: An error has occurred while loading `/Users/solussd/.emacs.el': |
| 13:22 | solussd | Symbol's function definition is void: clojure-slime-config |
| 13:24 | jlilly | looks like you are missing clojure + slime or w/e provides that function. |
| 13:25 | jlilly | solussd: have you done something akin to (require 'clojure-mode) or w/e? |
| 13:51 | solussd | jlilly: slime works for me after installing clojure+slime+swank using 'M-x clojure-install'. after the install it tells me to put (clojure-slime-config) in my .emacs file, but when I restart emacs I get that error |
| 14:47 | solussd | fyi: If you configure clojure from the emacs-starter-kit (install clojure-mode with package-install -> install clojure with clojure-install, etc) the command (clojure-slime-config "~/src/") needs to be in ~/emacs.d/<username>.el where ~/src is your clojure installation path. I had to explicitly provide the path, despite it being the default. |
| 14:50 | solussd | "hacks and glory await!" -says the repl. :) |
| 14:54 | ankou | hi, how can I pass a clojurefunction with paramters to java? |
| 14:54 | Lau_Jensen | (-> #(foo 1 23 3) Thread. .start) for instance |
| 14:55 | ankou | this wasn't an answer to my question, was it? |
| 14:55 | Lau_Jensen | foo is the clojure function, numbers are param |
| 14:55 | Lau_Jensen | I thought I answered it anyway :) |
| 14:57 | ankou | you missunderstood me. As far as I know all clojurefunctionvalues implement runnable/callable, right? But what if I want to write a javafunction that takes a clojure-function as a parameter but then needs to call it with arguments |
| 14:58 | Lau_Jensen | right.. then that's more of a java question, so I have to hide |
| 15:00 | hiredman | ankou: IFn.java |
| 15:00 | hiredman | that defines the interface for clojure functions |
| 15:01 | ankou | is there a documentation or do I really have to look at the source? |
| 15:01 | Chousuke | no javadoc, unfortunately :( |
| 15:02 | Chousuke | it's an open ticket. |
| 15:02 | ankou | but it's not likely to change so soon as an implementation detail, is it? |
| 15:02 | Chousuke | You'll need to ask rhickey about that. |
| 15:03 | hiredman | if you use 1.0 it won't |
| 15:03 | spuz | Hey, would someone like to code review my first program? :) http://github.com/alexspurling/clojure-projects/blob/master/Mandelbrot/src/mandelbrot.clj |
| 15:05 | spuz | It's a fractal renderer. LauJensen, some inspiration taken from your blog posts ;) |
| 15:05 | LauJensen | uuuh I must see :) |
| 15:05 | LauJensen | spuz, it's funny I was actually thinking of doing a blogpost on 2 - 3 fractals |
| 15:06 | spuz | LauJensen: Heh, cool. That would be good to see. I'm sure my implementation could be improved. It's several orders magnitude slower than a pure java implementation |
| 15:07 | LauJensen | oh |
| 15:07 | serp_ | I just get a black JFrame |
| 15:07 | serp_ | oh there we go |
| 15:07 | serp_ | pretty <3 |
| 15:07 | LauJensen | Ah yes I see that |
| 15:07 | LauJensen | spuz, you should check out my post "Brians Transient Brain" and optimize accordingly |
| 15:07 | Chousuke | serp_: that looks pretty good. |
| 15:07 | spuz | Yeah I was planning to look at that |
| 15:07 | LauJensen | You'll get 400% performance |
| 15:07 | spuz | hmm ok |
| 15:07 | serp_ | Chousuke: *points at spuz* |
| 15:08 | Chousuke | oh, heh. |
| 15:08 | Chousuke | it's probably not very fast but at least it's functional |
| 15:08 | DapperDan | LauJensen: I loved you Brian's Brain posts. Great work. |
| 15:09 | DapperDan | s/you/your/ |
| 15:09 | LauJensen | DapperDan, thanks a lot :) |
| 15:09 | serp_ | Chousuke: *points at spuz* |
| 15:09 | LauJensen | spuz, I think the code looks really good, you factor out more stuff than I do, but that's not necessarily a bad thing :D |
| 15:09 | serp_ | oops wrong window |
| 15:10 | spuz | I'm not sure the best way to get it to display rendering progress, one way is to set up a TimerTask to call the repaint method every 50 ms |
| 15:10 | Chousuke | spuz: you should maybe name the global defs using the *foo* convention, so that the reader can differentiate them from local variables easier |
| 15:10 | spuz | but it's a bit ugly, an alternative is to repaint the window within the function that also renders the fractal |
| 15:11 | spuz | Chousuke: you mean surround them with *s? |
| 15:11 | Chousuke | yeah. |
| 15:11 | spuz | ok |
| 15:11 | LauJensen | spuz, you really should check out that follow up post :) |
| 15:12 | spuz | I was wondering whether it is better practice to put most of those global values such as window sizes, number of iterations as function parameters |
| 15:12 | spuz | I guess that would be more 'pure' |
| 15:13 | spuz | LauJensen: I've already taken a look at it, just wondering how to incorporate those ideas into this kind of program. Like you I wanted to start with something that was 'functional' and then figure out the optimisations |
| 15:13 | steiger | hello guys. |
| 15:13 | LauJensen | spuz, the transient version is still functional, but I really wanted you to see the doublebuffering type-hinted graphics optimizations |
| 15:14 | LauJensen | those will get you a long ways in a few lines |
| 15:14 | spuz | LauJensen: but how does double buffering help with a static rendered image? |
| 15:14 | spuz | there's no animation here |
| 15:14 | LauJensen | read it, you'll see |
| 15:16 | spuz | ok :) |
| 15:17 | serp_ | I want four numbers... 0 1 2 3. please help :) (take 4 (???)) |
| 15:17 | DapperDan | serp_: range |
| 15:17 | serp_ | ah great |
| 15:17 | serp_ | thanks |
| 15:17 | DapperDan | i think, i'm at similar level of clojure to you |
| 15:17 | serp_ | range worked |
| 15:17 | serp_ | ,(range 4) |
| 15:17 | clojurebot | (0 1 2 3) |
| 15:18 | DapperDan | ,(take (range 4)) |
| 15:18 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$take |
| 15:18 | LauJensen | ,(take 4 (iterate inc 1)) |
| 15:18 | clojurebot | (1 2 3 4) |
| 15:18 | LauJensen | DapperDan, yours is missing an argument |
| 15:18 | DapperDan | ,(take 4 (range 4)) |
| 15:18 | clojurebot | (0 1 2 3) |
| 15:18 | DapperDan | the clojurebot is nice |
| 15:19 | serp_ | indeed |
| 15:19 | DapperDan | it would be nice to write a clojurebot for google wave |
| 15:20 | serp_ | let's say I want (0 0.25 0.5 0.75) instead... is there a smarter way than (apply #(/ %1 4) (range 4)) ? |
| 15:20 | serp_ | ,(apply #(/ %1 4) (range 4)) |
| 15:20 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--3591$fn |
| 15:20 | serp_ | :( |
| 15:20 | LauJensen | (take 4 (iterate #(+ 0.25 %) 0)) |
| 15:21 | serp_ | hm ofc |
| 15:21 | DapperDan | (take 4 (iterate #(+ 0.25 %) 0)) |
| 15:21 | DapperDan | ,(take 4 (iterate #(+ 0.25 %) 0)) |
| 15:21 | clojurebot | (0 0.25 0.5 0.75) |
| 15:22 | serp_ | I guess it takes some time to adjust to the correct way of thinking |
| 15:22 | DapperDan | where is the code for the clojurebot? |
| 15:22 | LauJensen | clojurebot: where are you ? |
| 15:22 | clojurebot | http://github.com/hiredman/clojurebot/tree/master |
| 15:26 | serp_ | ok last newb question for a while... I would like to generate ((0 0) (0 0.25) (0 0.5) (0 0.75) (0.25 0) (0.25 0.25) (0.25 0.5) (0.25 0.75) ...etc...) |
| 15:27 | DapperDan | ,(def nums take 4 (iterate #(+ 0.25 %) 0))) |
| 15:27 | clojurebot | DENIED |
| 15:28 | triyo | clojurebot doesn't allow "def" |
| 15:29 | triyo | to state the obvious :) |
| 15:29 | DapperDan | i thought it would be worth a try, but too good to be true. :) |
| 15:30 | DapperDan | waiting for macports to build so i can write clojure. |
| 15:43 | moah | <F8>/part |
| 15:45 | LauJensen | DapperDan, pop in a Jaunty CD, it'll be faster :) |
| 15:50 | snowwhite | pinh |
| 15:50 | snowwhite | *ping |
| 15:51 | snowwhite | Have any body tried JSWAT with clojure? |
| 15:53 | serp_ | ,(length [1 2]) |
| 15:53 | clojurebot | java.lang.Exception: Unable to resolve symbol: length in this context |
| 15:54 | serp_ | ,(size [1 2]) |
| 15:54 | clojurebot | java.lang.Exception: Unable to resolve symbol: size in this context |
| 15:54 | serp_ | ,(count [1 2]) |
| 15:54 | clojurebot | 2 |
| 15:54 | serp_ | aight |
| 15:56 | LauJensen | snowwhite, yea, quite some time ago |
| 15:56 | snowwhite | LauJensen, is it useful? |
| 15:57 | LauJensen | Well, I felt it was useful, I profiled an app which turned out to be spending way too much time in transactions, so I knew where to rework the logic |
| 15:57 | LauJensen | jvisualvm is easier though and that'll tell you the same thing |
| 15:58 | snowwhite | LauJensen, nice |
| 16:03 | snowwhite | LauJensen, Any other debugger you want to suggest? |
| 16:04 | LauJensen | nope, but note though if you are in Linux you already have jvisualvm, it's just not on your path |
| 16:06 | snowwhite | LauJensen, amazing. How can i set and use that with my clojure project? |
| 16:07 | LauJensen | well you fire up your program, and when it's running you'll see "Clojure.main" pop up on the main window of jvisualvm, double click that, and you're profiling :) |
| 16:10 | serp_ | .raw join #code.se |
| 16:10 | snowwhite | LauJensen, hmm |
| 16:12 | spuz | snowwhite: VisualVM is a good profiler, the eclipse plugin for clojure can be used for debugging |
| 16:12 | snowwhite | spuz, I use emacs. |
| 16:12 | snowwhite | LauJensen, It seems i don't have jvisualvm? |
| 16:13 | snowwhite | LauJensen, I fired from my terminal but didn't work? |
| 16:14 | LauJensen | didn't work = ? |
| 16:15 | LauJensen | what does 'locate jvisualvm' give you ? |
| 16:15 | snowwhite | LauJensen, Nothing |
| 16:17 | LauJensen | OS ? |
| 16:17 | snowwhite | Gnu/Linux (Ubuntu 8.04) |
| 16:20 | LauJensen | try 'aptitude search jdk' |
| 16:21 | LauJensen | is sun's installed? (ie does the line start with an 'i') |
| 16:22 | snowwhite | LauJensen, i have JDK |
| 16:23 | LauJensen | weird |
| 16:23 | snowwhite | LauJensen, It seems i have to install visualvm? |
| 16:23 | LauJensen | sudo updatedb && locate jvisualvm |
| 16:23 | snowwhite | LauJensen, I am doing that now |
| 16:23 | LauJensen | snowwhite, no, it should be part of the package |
| 16:23 | snowwhite | LauJensen, hmm |
| 16:23 | LauJensen | /usr/lib/jvm/java-6-sun-1.6.0.16/bin/jvisualvm |
| 16:25 | snowwhite | LauJensen, checked /usr/lib/jvm/java-6-sun-1.6.0.10/bin/ Doesn't have jvisualvm inside bin |
| 16:26 | Chousuke | you need a newer java |
| 16:26 | LauJensen | Did you cleverly partition your drive having / separate from /home/ ? |
| 16:26 | snowwhite | LauJensen, of course i did |
| 16:26 | snowwhite | LauJensen, It seems i have a bit older version of JAVA |
| 16:26 | LauJensen | snowwhite, so you could quite quickly install Jaunty or Karmic beta?? *hint* *hint* |
| 16:27 | LauJensen | Like Chousuke says you want 1.6.0.16 |
| 16:27 | snowwhite | LauJensen, yes |
| 16:29 | Chousuke | your version of ubuntu is rather old :P |
| 16:30 | snowwhite | Chousuke, Yes, right. I planned to directly move to 9.10 |
| 16:30 | Chousuke | upgrading more than one version at once might not be safe though :/ |
| 16:30 | LauJensen | That's 12 days out :) |
| 16:31 | snowwhite | Sorry, i have 8.10 |
| 16:32 | snowwhite | ChanServ, Right, i will install it fresh on my machine. |
| 16:32 | snowwhite | Chousuke, , Right, i will install it fresh on my machine. |
| 16:32 | snowwhite | Chousuke, LauJensen Meanwhile, any other solution :) |
| 16:32 | konr | How does On Lisp compare to Let Over Lambda? |
| 16:33 | snowwhite | Konr ? |
| 16:33 | konr | snowwhite: two books |
| 16:33 | LauJensen | snowwhite, JSwat |
| 16:34 | konr | snowwhite: oh, let me check your question |
| 16:34 | snowwhite | konr, I have read On lisp. that's a good book. |
| 16:35 | snowwhite | konr, sorry, No idea about let over lambda |
| 16:36 | snowwhite | LauJensen, ok. Thank you very much for your helpful suggestions. :) |
| 16:37 | LauJensen | np |
| 16:51 | somnium | let-over-lambda looks interesting, but I suspect the chapter on reader macros won't have much application in clojure |
| 17:01 | lisppaste8 | maacl pasted "alter and let" at http://paste.lisp.org/display/88809 |
| 17:02 | maacl | Why does http://paste.lisp.org/display/88809 return an unaltered version of v? |
| 17:02 | Chousuke | map is lazy |
| 17:03 | Chousuke | but to be honest, that seems very wrong |
| 17:04 | tomoj | good |
| 17:04 | tomoj | I'm glad it's not just me thinking that's wrong |
| 17:04 | maacl | Chousuke: I know, it is just an example I am using to figure it out |
| 17:06 | maacl | Instead of dumping on my example could someone explain what it is I am missing. |
| 17:06 | Chousuke | map is lazy :) |
| 17:06 | Chousuke | you never actually call the flip function |
| 17:06 | hiredman | because the result of the map is never forced |
| 17:07 | Chousuke | but why is it like that anyway? are you trying to ensure that no-one changed the ref in between the derefs? :/ |
| 17:08 | maacl | It is an example I wrote to understand why the change wasn't taking place. |
| 17:09 | Chousuke | well, hopefully you understand now :P |
| 17:18 | LauJensen | Chousuke, he has a good point though - We tend to 'dump on examples' when we actually mean 'that doesn't look idiomatic' or something similar. |
| 17:19 | mccraig | what's a good way to evaluate a list of functions returning boolean results using 'and' logic... i.e. stop after the first false result ? |
| 17:20 | LauJensen | take-while ? |
| 17:21 | Chousuke | hmm |
| 17:21 | Chousuke | ,(map apply [+ *]) |
| 17:21 | technomancy | mccraig: (reduce #(and %1 (%2)) [fn1 fn2 fn3]) |
| 17:21 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply |
| 17:21 | technomancy | reduce is my hammer. =) |
| 17:21 | Chousuke | heh |
| 17:22 | Chousuke | reduce doesn't stop at the first false though |
| 17:22 | Chousuke | it won't call the functions but it'll still go through the whole list. :P |
| 17:22 | technomancy | yeah, it's wasteful |
| 17:23 | mccraig | and will get called, but the remaining args will not be evaluated... |
| 17:23 | technomancy | depending on how long the fn1 etc functions take you might not care |
| 17:24 | Chousuke | (every? (map (fn [f] (f)) fns)) will be completely lazy |
| 17:24 | Chousuke | hm |
| 17:24 | Chousuke | needs identity I guess |
| 17:25 | mccraig | yeah, it's a short list, and reducing with "and" makes the intent clear |
| 17:27 | ordnungswidrig | hi, slime is eating the "caused by"s of an exception. Is there any way to have slime show them? |
| 17:29 | technomancy | ordnungswidrig: eating or just not showing them right off the bat? |
| 17:30 | ordnungswidrig | technomancy: the are not shown in the slime sldb backtrace. especially the cause of a ExceptionInInitializerError which I suppose is in my casue due to a missing dependency |
| 17:31 | technomancy | ordnungswidrig: and it doesn't give you an option to press 1 to show them? |
| 17:32 | ordnungswidrig | technomancy: do you now the sound, when one bangs one's head against the table? |
| 17:32 | ordnungswidrig | technomancy: it's the perfect moment to imagine |
| 17:33 | technomancy | ordnungswidrig: heh... yeah. I'm not super-happy with the way the backtraces work |
| 17:34 | technomancy | better than they used to be though |
| 17:34 | ordnungswidrig | technomancy: aha, the second time a NoClassDef is thrown and no cause given |
| 17:34 | ordnungswidrig | technomancy: but its a slime related issue, I suppose |
| 17:35 | neotyk | how do you guys work with clojure code? vim/emacs/ide? |
| 17:35 | ordnungswidrig | emacs with vi emulation |
| 17:36 | technomancy | ordnungswidrig: you shouldn't expect a cause on a No Class Def |
| 17:37 | ordnungswidrig | ordnungswidrig: yes, the first time a ExceptionInitializerError is thrown caused by a ClassNotFoundException. |
| 17:38 | ordnungswidrig | when I try to load the same package again, a NoClassDef is thrown |
| 17:38 | ordnungswidrig | I think this is because of the classloader caching the first trial's result |
| 17:40 | ordnungswidrig | /whois technomancy |
| 17:41 | ordnungswidrig | hmmm... |
| 17:55 | somnium | is there a way to list every available class on the classpath? |
| 18:03 | hiredman | nope |
| 18:03 | somnium | bummer |
| 18:03 | neotyk | why would you care? |
| 18:03 | hiredman | "is there a way to list every available shared library?" |
| 18:04 | neotyk | you get 295 classes loaded just to boot jvm |
| 18:05 | somnium | just kicking around some ideas based on inspecting the environment |
| 18:06 | hiredman | holy crap |
| 18:06 | somnium | ? |
| 18:06 | hiredman | someone opened an issue on one of my github repos |
| 18:06 | neotyk | somnium: start sould be http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#getPackages() |
| 18:07 | neotyk | somnium: or not :P |
| 18:12 | somnium | how to get the repl's class loader? |
| 18:13 | hiredman | clojure keeps it's classloader in RT somewhere |
| 18:14 | somnium | RT? |
| 18:14 | LauJensen | Is there anything in core that will let me slurp a website? |
| 18:15 | hiredman | ~def c.l.RT |
| 18:15 | hiredman | ,(doc slupr) |
| 18:15 | clojurebot | It's greek to me. |
| 18:15 | hiredman | ,(doc slrpr) |
| 18:15 | clojurebot | I don't understand. |
| 18:15 | hiredman | bah |
| 18:15 | hiredman | ,(doc slurp) |
| 18:15 | somnium | ,(.getClassLoader clojure.main) |
| 18:15 | clojurebot | "([f] [f enc]); Reads the file named by f using the encoding enc into a string and returns it." |
| 18:15 | clojurebot | java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader) |
| 18:16 | hiredman | ~def slurp |
| 18:19 | hiredman | ,(RT/baseLoader) |
| 18:19 | clojurebot | java.lang.Exception: No such namespace: RT |
| 18:19 | hiredman | bah |
| 18:19 | hiredman | ,(import '(clojure.lang RT)) |
| 18:19 | clojurebot | clojure.lang.RT |
| 18:19 | hiredman | ,(RT/baseLoader) |
| 18:19 | clojurebot | #<DynamicClassLoader clojure.lang.DynamicClassLoader@178986b> |
| 18:21 | hiredman | LauJensen: clojure.xmp/parse can take a url, but it has to be proper xml |
| 18:22 | LauJensen | It's not though, just text |
| 18:23 | licoresse | Can I see the sourcecode of a function at the repl, in the same way that I can fetch meta-data? |
| 18:24 | hiredman | http://github.com/hiredman/clojurebot/blob/d92e697abdf9ef2b6dc015665f597442c2cf0f3c/hiredman/utilities.clj has a get-url function |
| 18:24 | hiredman | licoresse: no |
| 18:25 | licoresse | ok |
| 18:25 | hiredman | there is a source function somewhere in contrib, but that relies on the source for the function being accessable on the filesystem |
| 18:26 | licoresse | hiredman: yes, I'll look at it, thx |
| 18:26 | hiredman | actually, I think there is a better get-url pastebin'ed somewhere |
| 18:26 | somnium | get-source in repl-utils |
| 18:26 | licoresse | somnium: spot on! |
| 18:27 | somnium | ah, actually source is better, it prints it for you, get-source returns a string |
| 18:27 | somnium | licoresse: happened to be using it right now |
| 18:27 | licoresse | heh |
| 18:29 | ankou | does anybody know how to use AOT compilation with enclojure? |
| 18:32 | licoresse | when in the repl in emacs, can I go (in history) to a command that matches partially the one I have right now? |
| 18:33 | technomancy | licoresse: M-p should do that |
| 18:34 | licoresse | technomancy: it does, but when in paredit-mode, it won't |
| 18:34 | licoresse | (if you see my point) |
| 18:34 | technomancy | licoresse: because the closing paren prevents it from being a partial match |
| 18:34 | licoresse | yes |
| 18:34 | technomancy | you can kill the close paren with M-w; I don't know a better way around it. |
| 18:35 | licoresse | not when in paredit |
| 18:35 | licoresse | at least not here :/ |
| 18:36 | somnium | licoresse: you can turn off paredit in the repl-buffer |
| 18:36 | licoresse | somnium: I know |
| 18:37 | licoresse | (and I don't know how to live without :-) |
| 18:37 | somnium | set up some new bindings in .emacs then? |
| 18:37 | licoresse | just did |
| 18:38 | licoresse | a f-key toggles the mode |
| 18:38 | somnium | nice |
| 18:38 | licoresse | s/a/an |
| 18:38 | licoresse | yes, nice |
| 18:39 | licoresse | anyone with clozure experience? |
| 18:39 | licoresse | I was thinking about testing it for real mac os apps |
| 19:24 | technomancy | licoresse: you can use M-w to kill parens even if paredit is enabled |
| 19:24 | technomancy | it's like a way to break out of paredit's rules |
| 19:25 | licoresse | technomancy: then I need to investigate why it won't here. Probably something that needs an update somewhere :-/ |
| 19:27 | hiredman | huh |
| 19:27 | hiredman | youtube is pure python, go figure |
| 19:35 | tomoj | even the video processing? |
| 19:36 | hiredman | dunno, the google guy giving the unladen swallow presentation at the llvm conf said "pure ruby" |
| 19:37 | hiredman | er |
| 19:37 | hiredman | pardon |
| 19:37 | hiredman | pure python |
| 20:53 | gilbertleung | hi |
| 20:54 | gilbertleung | suppose i have 3 functions i don't mind users seeing, but each of them share a helper function that I don't want users to see.... is there anyway i could "hide" that helper function? |
| 20:55 | gilbertleung | that is... limit the helper function to this one file only |
| 20:59 | licoresse | defn- perhaps? |
| 20:59 | licoresse | gilbertleung: ... |
| 21:00 | gilbertleung | licoresse: nice, thanks |
| 23:47 | jlilly | how do you update the value of a variable? |
| 23:47 | hiredman | you don't |
| 23:48 | durka42 | unless it's a reference type |
| 23:48 | hiredman | durka42: shhh |
| 23:48 | hiredman | tell people that and they will use atoms everywhere |
| 23:48 | hiredman | best just tell them it's not possible |
| 23:50 | jlilly | heh. |
| 23:50 | jlilly | right. so I'm making a guess by number game. |
| 23:51 | jlilly | I need to update the guess so I can check to see if its right. |
| 23:51 | hiredman | user iterate |
| 23:51 | hiredman | use |
| 23:52 | durka42 | or loop/recur |
| 23:53 | hiredman | (fn [x] (if (= x guessed_number) :win (get_guess))) |
| 23:54 | hiredman | (take-while (partial not= :win) (itreate that-fn (get-guess))) |
| 23:56 | durka42 | ,(doc iterate) |
| 23:56 | clojurebot | "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 23:57 | hiredman | hmmm |
| 23:57 | hiredman | ~def iterate |
| 23:58 | hiredman | that is unfortunate |