2009-12-27
| 00:04 | Anniepoo | I'm not seeing documentation of #= in the list of reader macros |
| 00:04 | Anniepoo | ,(doc *read-eval*) |
| 00:04 | clojurebot | "; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true" |
| 00:06 | Anniepoo | so what's this do? |
| 00:11 | Anniepoo | ,(binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) |
| 00:11 | clojurebot | Unsupported character: \"#= |
| 00:11 | Anniepoo | I take it the eval reader evaporated somewhere? |
| 01:00 | mikehinchey | Anniepoo: it's the \ in your code that gives that error |
| 01:28 | Anniepoo | thanks Mike, that's a copy/paste from the *read-eval* docs |
| 01:29 | Anniepoo | ,(binding [*read-eval* false] (read-string "#=(eval (def x 3))")) |
| 01:29 | clojurebot | java.lang.RuntimeException: java.lang.Exception: EvalReader not allowed when *read-eval* is false. |
| 01:29 | mikehinchey | which is what you set in the binding |
| 01:29 | Anniepoo | yes, I understand |
| 01:30 | Anniepoo | so where the heck's the docs for #= |
| 01:30 | Anniepoo | there's no #= in the reader macros |
| 01:30 | Anniepoo | 8c/ I'm trying to work my way thru all the api docs |
| 01:32 | mikehinchey | are the others doc'ed other than clojure.org/reader? |
| 01:32 | Anniepoo | that's all I know of |
| 01:32 | Anniepoo | http://clojure.org/reader |
| 01:32 | Anniepoo | #= doesn't appear on the reader page |
| 01:33 | mikehinchey | right, I think it was mostly internal, and doesn't work 100%. Not sure if it's a public api or not. |
| 01:34 | Anniepoo | ok |
| 01:34 | mikehinchey | it's quite useful when you need it, so I hope it gets full support |
| 01:36 | Anniepoo | I'm making this injected agent server, it's a security hole, since it allows arbitrary eval |
| 01:37 | Anniepoo | how's it supposed to work? |
| 01:38 | Anniepoo | ,(read-string "#=(eval (def x 3))") |
| 01:38 | clojurebot | java.lang.RuntimeException: java.lang.Exception: EvalReader not allowed when *read-eval* is false. |
| 01:40 | Anniepoo | ,(binding [*read-eval* true] (read-string "#=(eval (def x 3))")) |
| 01:40 | clojurebot | #'sandbox/x |
| 01:42 | mikehinchey | that does seem to be a hole, at least in clojurebot |
| 01:43 | mikehinchey | ,x |
| 01:43 | clojurebot | 3 |
| 01:43 | Anniepoo | yes |
| 01:43 | Anniepoo | clojurebot's real security is simply that killing it isn't important |
| 01:44 | Anniepoo | so what's the semantics supposed to be? |
| 01:44 | mikehinchey | or maybe read-string needs to disallow binging *read-eval* |
| 01:45 | Anniepoo | the form following #= is to be evaled and the value inserted? |
| 01:45 | mikehinchey | yes |
| 01:45 | Anniepoo | ok |
| 01:46 | Anniepoo | maybe it's the hour, but that wasn't clear |
| 01:47 | Anniepoo | appreciate the help |
| 01:53 | Anniepoo | 8c9 writing this thing is an adventure |
| 01:56 | Anniepoo | the auto doc generator doesn't put the right URL in the Source href apparently |
| 01:56 | Anniepoo | ,(doc *print-readably*) |
| 01:56 | clojurebot | "; When set to logical false, strings and characters will be printed with non-alphanumeric characters converted to the appropriate escape sequences. Defaults to true" |
| 06:26 | vy | How long have clojars.org been down? |
| 06:34 | unfo- | helloh. Should I be able to create sockets from the REPL? I am trying to figure out whether that is my error or if I just fscked up the code :) |
| 06:40 | LauJensen | unfo-: which REPL? |
| 07:04 | unfo- | LauJensen, I used IDEA's clojure plugin and started a new clojure REPL... :-) |
| 07:04 | LauJensen | unfo-: I'm an emacs-guy myself, but I can't imagine a restriction on the REPL which would prevent you from spawning sockets |
| 07:05 | unfo- | LauJensen, ok. well that's good enough for me :) |
| 07:06 | unfo- | http://github.com/unfo/stutter/blob/master/src/bot.clj this is what I am working with |
| 07:07 | unfo- | and when I do (start-bot "mybot" "irc.freenode.net" 6667 "") I get java.net.SocketException: Unrecognized Windows Sockets error: 10106: create (NO_SOURCE_FILE:0) |
| 07:13 | LauJensen | '...Windows...error...' |
| 07:14 | unfo- | yep. I knoez |
| 07:14 | LauJensen | I can't tell you more than your call to create is failing, so you have to figure out how to call it correctly |
| 07:14 | LauJensen | Actually I think you should be able to check out http://technomancy.us/swank-clojure and see how he works with sockets |
| 07:15 | unfo- | thanks! |
| 07:25 | vy | unfo-: What does (java.net.Socket. "www.google.com" 80) return? |
| 07:26 | unfo- | vy, same error |
| 07:27 | vy | unfo-: JVM? |
| 07:27 | unfo- | java version "1.7.0-ea" |
| 07:27 | unfo- | Java(TM) SE Runtime Environment (build 1.7.0-ea-b66) |
| 07:27 | unfo- | Java HotSpot(TM) 64-Bit Server VM (build 16.0-b06, mixed mode) |
| 07:28 | unfo- | I was able to create sockets in IDEA on my Scala project whose codebase I am trying to port to Clojure now |
| 07:30 | unfo- | A HA! |
| 07:30 | unfo- | vy, when I started the REPL with java -jar clojure.jar clojure.main |
| 07:30 | unfo- | I was able to create a socket to Google! |
| 07:30 | LauJensen | "I forgot to plug in the internet" |
| 07:30 | unfo- | but from IDEA's plugin I am not |
| 07:31 | vy | unfo-: I think, it has something to do with environment variables. |
| 07:31 | unfo- | IDEA and/or its Clojure plugin is the culprit :) |
| 07:31 | vy | See http://forums.sun.com/thread.jspa?threadID=329241&start=0 |
| 07:31 | LauJensen | unfo-: time to try out Emacs perhaps? |
| 07:32 | vy | LauJensen: Can you use SLIME of clojure with CLs (SBCL, CCL, etc.)? |
| 07:33 | unfo- | LauJensen, nah, if anything I'll go with vim ^^ |
| 07:33 | LauJensen | unfo-: You mean M-x viper ? |
| 07:33 | LauJensen | vy: Yes |
| 07:33 | vy | IMHO, since Clojure is not that interactive as CL and has no interpreter (but just a compiler), it should prefer using a simple interface (aka haskell-mode) instead of trying to stand in the shoulders of a giant like SLIME. |
| 07:33 | unfo- | LauJensen, but I'll just prolly keep a separate cmd prompt in conj with IDEA for now :-) |
| 07:33 | unfo- | LauJensen, what is this viper? |
| 07:34 | LauJensen | Did you guys catch my screencast showing you how easy it is to set up ? |
| 07:34 | vy | LauJensen: SLIME version? |
| 07:34 | unfo- | LauJensen, I just joined. Please gimme url :-) |
| 07:34 | LauJensen | http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/ |
| 07:34 | LauJensen | Lets see if that cant change your mind :) |
| 07:35 | unfo- | ^^ |
| 07:36 | unfo- | if that is as easy as you make it sound, I shall boot to my ubuntu and try it ^^ |
| 07:36 | LauJensen | Its a 12 minute screencast and I'm going real slow, so if you just follow the instructions you can get set up in about 5 minutes |
| 07:37 | unfo- | LauJensen, but what is viper? vi-mode in emacs? |
| 07:38 | LauJensen | unfo-: I'm told that Viper-mode makes Emacs act exactly like Vim for editing - though I don't see why that would be attractive, but usually when people say that Vim is better, I tell them that Vim is M-x viper, because then you get all the integration goodness of Emacs |
| 07:38 | vy | LauJensen: FYI, vimeo is dead slow! |
| 07:38 | LauJensen | vy: Really? Not from here |
| 07:39 | unfo- | LauJensen, I am not saying vim is better, I am saying, I am used to vim (edit/insert mode) + its keybindings :) |
| 07:39 | unfo- | LauJensen, but. time to boot to ubuntu and follow your screencast! :) |
| 07:39 | LauJensen | Cool :) |
| 07:39 | vy | LauJensen: Mid. East and Asia colocations of vimeo is crawling. |
| 07:45 | LauJensen | Ok, which alternatives work for you guys ? |
| 07:46 | vy | LauJensen: youtube is generally the best -- excluding regional alternatives. |
| 07:49 | LauJensen | k |
| 08:58 | unfo- | yeah! got my ircbot to connect and play PING PONG with server ^^. Thanks vy for helping :-) |
| 09:21 | LauJensen | unfo- congrats, did you get it to work from within IDEA ? |
| 11:49 | fliebel | What is the most simple way to parse some command line options? Some list magic? Java lib? Clojure-crontrib? |
| 12:03 | the-kenny | fliebel: I'm sure there are some java classes for this |
| 12:04 | the-kenny | fliebel: Oh, there's also something in contrib |
| 12:04 | the-kenny | http://github.com/richhickey/clojure-contrib/blob/ddd7bc2226927634dc0216554194877fa6f170e1/src/clojure/contrib/command_line.clj#L91a |
| 12:18 | quizme | can you make new hierarchies during runtime? |
| 12:49 | chouser | seems like it might be interesting to use this to install and update clojure and/or lien: http://code.google.com/p/omaha/ |
| 12:50 | chouser | oh, it's Windows only |
| 12:53 | ohpauleez | qed: You around? |
| 12:57 | chouser | quizme: yes |
| 12:59 | quizme | chouser thnx |
| 13:08 | arj_ | I'm wondering. Is set! only for java or can it be used on refs as well? |
| 13:38 | quizme | anybody here know of a good P2P library to build a P2P game on? |
| 13:40 | ohpauleez | Depends on what you're going for, but take a look at JXTA |
| 13:40 | ohpauleez | I built a P2P usenet-like system with it for a pet project, pretty powerful |
| 13:41 | KirinDave | Hey folks |
| 13:41 | KirinDave | If I'm looking at a clojure profile trace |
| 13:41 | KirinDave | what's clojure.lang.RestFn.invoke |
| 13:42 | ohpauleez | You could also use rendezvous quizme if that seems more appropriate for your game. It really depends the type of data communication your game needs |
| 13:42 | KirinDave | I'm curious why the code given in http://jng.imagine27.com/articles/2009-12-25-174540_palindromes_clojure.html is very slow compared to SBCL. |
| 13:43 | quizme | ohpauleez thanks i'll look at those. |
| 13:44 | ohpauleez | KirinDave: That is weird, let me look at it. I mean, SBCL is super fast, but it seems odd to be 20x faster |
| 13:45 | KirinDave | ohpauleez: Well it's not 20x faster. |
| 13:45 | KirinDave | He only runs it once. |
| 13:45 | KirinDave | So derp, yeah, pre-JIT it's going to be slower. |
| 13:45 | ohpauleez | right, there's no priming |
| 13:45 | KirinDave | But |
| 13:46 | KirinDave | It's still a factor of 5 or so. |
| 13:46 | KirinDave | 25ms compared to 120ms. |
| 13:46 | KirinDave | I thought maybe the use of vectors there was the problem |
| 13:47 | KirinDave | But I remembered that clojure vectors are not the O(N) beasts everyone seems to expect. So I profiled |
| 13:47 | KirinDave | http://gist.github.com/264367 |
| 13:47 | KirinDave | It looks to me like there is no clear bottleneck. |
| 13:50 | quizme | ohpauleez Rendezvous is called Bonjour now ? |
| 13:51 | ohpauleez | technically it's zeroconf |
| 13:51 | ohpauleez | http://en.wikipedia.org/wiki/Bonjour_%28software%29 |
| 13:51 | KirinDave | quizme: Apple got into a legal battle over the name. |
| 13:51 | ohpauleez | it's just a way to do machine discovery and messaging |
| 13:52 | KirinDave | So it seems to me that the algorithm in question just doesn't perform well in clojure, at least by comparison to what SBCL is doing. |
| 13:52 | KirinDave | Of course, SBCL is notoriously fast. |
| 13:52 | KirinDave | With crap like churning through data and recursing big data structures. |
| 13:53 | KirinDave | Ask it to build a string and it'll fall over and die, ask it to compute factorial 1000 and it'll be done in 4 cpu cycles. |
| 13:53 | quizme | which is easier to use? jxta or zeroconf ? |
| 13:55 | ohpauleez | KirinDave: totally, I think it just comes down to that |
| 13:56 | ohpauleez | quizme: it really depends on the type of game you're making and the type of communication you're going to need |
| 13:56 | KirinDave | Huh, I ran it again with more runs |
| 13:56 | ohpauleez | KirinDave: ie: priming the JVM to jit it? |
| 13:56 | quizme | ohpauleez: pong |
| 13:56 | KirinDave | ohpauleez: well I just ran it like 10 times :D |
| 13:57 | KirinDave | ohpauleez: http://gist.github.com/264369 |
| 13:57 | KirinDave | Actually i am slowly seeing more vector stuff rise to the to |
| 13:57 | ohpauleez | quizme: it's a nice simple project to learn the basics of JXTA (discovery, etc) |
| 13:58 | quizme | ohpauleez: yeah. i just want to teach myself p2p programming using clojure |
| 13:58 | ohpauleez | JXTA is a great set of protocols and utilities |
| 13:58 | ohpauleez | and the guy who heads the project is an awesome dude |
| 13:59 | quizme | ohpauleez: k. i'll try JXTA out. is the o'reilly book the best one ? |
| 13:59 | ohpauleez | quizme: for pong, you can probably get away with just tutorials and information online |
| 14:00 | ohpauleez | KirinDave: is the optimized version really that optimized for clojure? |
| 14:01 | ohpauleez | when I optimize clojure I do things like primitive types where I can, transient when building via auxiliary functions, pmap when it makes sense, and use agents to disect the problem space |
| 14:02 | ohpauleez | it's optimized in runtime complexity, but not really optimized to play to clojure's strengths |
| 14:02 | KirinDave | ohpauleez: It's "optimized" in that it's complexities are better. |
| 14:02 | KirinDave | Well |
| 14:02 | KirinDave | Sir |
| 14:02 | KirinDave | May I recommend that you tackle the optimization. :D |
| 14:03 | KirinDave | As I'd love to see how an experienced clojure-ite would deal with this |
| 14:03 | KirinDave | There's no smoking gun in the profiling. |
| 14:03 | ohpauleez | haha, i did just finish up with qed's optimization, I'll take a stab at it |
| 14:03 | KirinDave | Okay. |
| 14:03 | ohpauleez | nah, I just looked at the new link you dropped in, nothing super obvious |
| 14:07 | KirinDave | And of course the news.ycomb folks are having a field day. :\ |
| 14:10 | ohpauleez | link? |
| 14:13 | KirinDave | ohpauleez: http://news.ycombinator.com/item?id=1016566 |
| 14:13 | ohpauleez | KirinDave: thanks |
| 14:13 | KirinDave | Sorry on the delay |
| 14:13 | KirinDave | gotta be heading out soon, so I gotta make mah latte. |
| 14:24 | LauJensen | Evening gents |
| 14:25 | ohpauleez | evening lau |
| 14:26 | ohpauleez | I haven't watched your web dev video yet, but it's on my TODO list for today |
| 14:29 | replaca | Q: when using "mvn clojure:swank", does anyone know how to up the java vm size? I tried MAVEN_OPTS, but that only influenced the maven's VM, not the swank VM. |
| 14:36 | arj_ | I'm wondering. Is set! only for java or can it be used on refs as well? |
| 14:38 | ohpauleez | set! and be used on vars arj_ |
| 14:38 | ohpauleez | http://clojure.org/Vars#toc1 |
| 14:39 | arj_ | yeah that's the part I read and I didn't understand it properly |
| 14:39 | arj_ | so you say it can, do I need a dosync outside, like ref-set? |
| 14:40 | ohpauleez | ref-sets must be in dosyncs. You can use an atom and use swap!s and reset!s |
| 14:41 | ohpauleez | all operations to mutate a ref have to be in a dosync though, that's really their power, being done with an STM |
| 14:41 | ohpauleez | but you can set! a var |
| 14:42 | Chousuke | only if it's been thread-locally bound though. |
| 14:42 | ohpauleez | here's a good resource: http://java.ociweb.com/mark/clojure/article.html#ReferenceTypes |
| 14:42 | arj_ | Chousuke: so only if I use like binding or let? |
| 14:42 | ohpauleez | arj_: yeah a binding form |
| 14:43 | Chousuke | arj_: binding only |
| 14:43 | Chousuke | arj_: let creates locals, which are not vars at all |
| 14:44 | arj_ | ok, the link that ohpauleez sent explains it pretty well |
| 14:44 | arj_ | thanks :) |
| 14:44 | ordnungswidrig | hi all. |
| 14:44 | ohpauleez | totally welcome |
| 14:44 | ordnungswidrig | what's the current state of the art unit test framework? |
| 14:45 | ordnungswidrig | I remember something moved either into contrib or from contrib into core |
| 14:47 | replaca | ordnungswidrig: as of the 1.1 branch (master and the 1.1 release candidates), testing is in clojure.test |
| 14:48 | ordnungswidrig | replaca: ah, thanks. are the docs uptodate on clojure.org or do they refer to 1.0? |
| 14:48 | replaca | clojure.org api docs refer to the master branch |
| 14:49 | replaca | you should see clojure.test in the left column when you jump into the API |
| 14:50 | ordnungswidrig | replaca: oh, yes. |
| 14:55 | ordnungswidrig | hmm, I dislike the selection of fixed-with font at the clojure api page. I'd prefer that my selection in the browser would be used |
| 14:55 | ohpauleez | LauJensen: in the compojure video... |
| 14:55 | ohpauleez | you used a for, but doesn't it make more sense to use a doseq? |
| 14:56 | ohpauleez | since you don't need evaluation results |
| 14:57 | ohpauleez | or is the point moot? |
| 15:02 | ordnungswidrig | Can I determine the version of clojure quickly from a REPL? |
| 15:03 | ohpauleez | ordnungswidrig: when you start the repl, it'll be the first line printed |
| 15:03 | ohpauleez | from the command line |
| 15:03 | ordnungswidrig | ohpauleez: I swank-connect to a repl started long time ago :-) |
| 15:04 | ohpauleez | ahhh gotcha |
| 15:06 | ordnungswidrig | clojars down? |
| 15:19 | LauJensen | Its answering pings |
| 15:19 | LauJensen | But other than that yea, its toast |
| 15:21 | _mst | I sent _ato an email last night but haven't heard back unfortunately |
| 15:22 | _mst | his site at meshy.org runs off the same box and seems to be up, so not sure what's going on there... |
| 15:22 | ordnungswidrig | _mst: I guess an update took place :-) |
| 15:22 | LauJensen | Would be nice to see the backtrace |
| 15:23 | _mst | the new version sure is minimal :) |
| 15:39 | replaca | ordnungswidrig: re: fixed width in docs: unfortunately variable width fonts muck up the formatting of lots of doc strings (which include code, indenting, etc.) |
| 15:40 | replaca | ordnungswidrig: so even though regular fonts would be preferable, fixed width seems to end up working better |
| 15:40 | ordnungswidrig | replaca: yes, but the container is a pre, IIRC. And a pre must be rendered with a fixed with font. |
| 15:41 | replaca | ordnungswidrig: I'm not getting your point... |
| 15:42 | ordnungswidrig | replaca: the documentation text is formatted as <pre> which I consider ok following you argument above. but I dislike that the font is specified for the pre by the css stylesheet (in wiki.css) as I, personally, prefer Menlo over Monaco as fixed width font. |
| 15:43 | ordnungswidrig | the pre is ok, but omit the font declaration in the css. pre is rendered with a fixed width font by default. |
| 15:43 | replaca | ordnungswidrig: ahh, ok. That makes sense. I think the problem there was different browsers made radically different choices that messed things up |
| 15:44 | replaca | ordnungswidrig: but let me play around with it and see if I can drop the css and have it work right |
| 15:45 | ordnungswidrig | replaca: I see. IIRC there was a browser which interpreted pre in a way to value the line breaks but to use a proportional font. setting "monospace" as font shall give a reasonable default on many systems. |
| 15:45 | ordnungswidrig | replaca: or consider a <pre><tt></tt></pre> |
| 15:47 | replaca | ordnungswidrig: yeah, I think you're right (re: proportional default). I'll play with some of the other choices you suggest cause I'm not very happy with the current setup either |
| 15:48 | ordnungswidrig | I have a lein dep on clojure-master-1.1.0-SNAPSHOT |
| 15:49 | ordnungswidrig | which reports in the repl as 1.1.0-alpha-SNAPSHOT and comes from clojure-1.1.0-master-20091223.150146-8.jar |
| 15:50 | replaca | ordnungswidrig: so you should have clojure.test there |
| 15:50 | ordnungswidrig | replaca: (use :clojure.test) (is (= 1 1)) -> java.lang.Exception: Unable to resolve symbol: is in this context (NO_SOURCE_FILE:2) |
| 15:51 | replaca | (use 'clojure.test)? |
| 15:51 | ordnungswidrig | replaca: *doh* |
| 15:51 | replaca | I don't think keyword works for the namespace (unless something's changed) |
| 15:52 | replaca | gotta go! |
| 15:53 | ordnungswidrig | replaca: cu! |
| 16:28 | mebaran151_ | if I put a seq on an iterator, will the seq immediately consume the iterator or does it keep it pseudo lazy? |
| 17:03 | ordnungswidrig | does anybody have a pointer on howto use leining with 1.1-master? I keep having 1.1.0-alpha in bootclassapth |
| 17:06 | technomancy | ordnungswidrig: that shouldn't be a problem; stuff on the boot classpath should be shadowed by stuff in the project classpath |
| 17:06 | technomancy | all the project stuff is run in a subclassloader |
| 17:08 | ordnungswidrig | hm, I just did a lein self-install and will see if it updated itself. Maybe thats the issue |
| 17:09 | technomancy | self-install is just for pulling in the jar file when all you have is the bin script. haven't got any code to pull in a new version. |
| 17:10 | ordnungswidrig | hmm. the repl reports a 1.1-alpha in project.clj I have 1.1.0-master-SNAPSHOT |
| 17:11 | ordnungswidrig | clojure.test exists in the repl. Now I'll try swank |
| 17:11 | technomancy | oh... that's a known issue; the repl task is the one place where a subclassloader is not used |
| 17:11 | technomancy | swank should be better |
| 17:13 | ordnungswidrig | hmm, I have (ns foo (:require clojure.test)) (is (= 1 1)) |
| 17:13 | ordnungswidrig | -> Unable to resolve symbol: is in this context |
| 17:15 | ordnungswidrig | when C-c C-l'ed in emacs |
| 17:18 | technomancy | ordnungswidrig: yup |
| 17:18 | technomancy | require is not use |
| 17:18 | ordnungswidrig | technomancy: *doh* you actually might be correct. I copy-pasted it from the clojure.test docs |
| 17:20 | technomancy | ordnungswidrig: yikes; if it really says that you should report it as a bug |
| 17:20 | ordnungswidrig | technomancy: see yourself http://richhickey.github.com/clojure/clojure.test-api.html |
| 17:21 | Chousuke | the docs are correct, but misleading. |
| 17:22 | ordnungswidrig | Oh man, I doubt I get around use and require... |
| 17:22 | Chousuke | you should use :require, but the overview obviously assumes you have used :use :) |
| 17:22 | ordnungswidrig | Chousuke: |
| 17:23 | ordnungswidrig | Chousuke: is there some overview on require and use and import and ns when loading, gen-classing and in the repl? |
| 17:23 | technomancy | ordnungswidrig: that's really weird; I don't see why the HTML docs say that |
| 17:23 | technomancy | it's not in the source the docs are generated from |
| 17:23 | technomancy | replaca: ^ any idea about that? |
| 17:24 | Chousuke | well, import is for java stuff, require is for importing the namespace without importing its names into your current namespace (ie. you need foo/bar to access them) and use just imports the names to your namespace (can access them as just bar) |
| 17:24 | Chousuke | you shouldn't really use use :) |
| 17:25 | Chousuke | require supports aliasing the namespace, so it doesn't lead to much more typing either. |
| 17:25 | ordnungswidrig | Chousuke: I'll print this one. Thanks. |
| 17:25 | Chousuke | there has been talk about redoing the ns macro to something less confusing |
| 17:25 | Chousuke | but I don't think anyone has yet implemented anything |
| 17:26 | ordnungswidrig | Chousuke: I'm currently fighting many loose ends. Clojure is still new for me, back to emacs since a long time. Now on OSX since two weeks (different key in emacs) and so on. Thanks for your help. |
| 17:26 | ordnungswidrig | and good night |
| 17:28 | technomancy | it'd be helpful not to use the word "import" for bringing an ns's vars into another |
| 17:41 | patrkris | the way to emit from an xml-zip is by using clojure.xml/emit? |
| 17:41 | patrkris | *emit xml |
| 17:42 | LauJensen | Think so |
| 17:45 | patrkris | thanks LauJensen (fellow dane :)) |
| 17:45 | LauJensen | uuh :) |
| 17:45 | patrkris | gode webcasts i øvrigt |
| 17:46 | patrkris | (i'll quit the Danish now :)) |
| 17:46 | LauJensen | Thanks a lot! |
| 17:52 | replaca | technomancy, ordnungswidrig: The docs say require because "use" is considered bad form (and may cause problems if there's a conflict). But if you use require, you need to spec the namespace on the funcs. But that's just an example, of course you can use any variation, as appropriate. |
| 17:52 | replaca | that having been said, probably I should just drop the usages altogether from the clojure namespaces |
| 17:53 | replaca | that was more for contrib, where the pages aren't named the same as the namespace |
| 17:53 | technomancy | replaca: yeah, if the docs for each namespace don't agree about require vs use then it could just be confusing. |
| 17:56 | replaca | technomancy: well, everything says require now, I think |
| 17:56 | replaca | It used to say use way back in the google wiki days |
| 17:58 | technomancy | let's just deprecate them both and move on. =) |
| 18:02 | replaca | sounds about right :-) |
| 18:21 | chouser | mebaran151: it'll stay lazy |
| 18:21 | mebaran151 | thanks chouser |
| 18:42 | ieure | How do I cast a numeric string to an int? e.g. (int "5") just throws: java.lang.String cannot be cast to java.lang.Character. |
| 18:43 | pdk | same way as in java, (Integer/valueOf "5") |
| 18:43 | pdk | gotta remember all the java classes and crap are still accessible through clojure |
| 18:43 | ieure | pdk, I don’t know Java at all. Thanks. |
| 18:43 | ieure | I know they’re accessible. I just don’t know Java. |
| 18:43 | pdk | hm ok |
| 18:44 | ieure | Is that preferable to (Integer. "5")? |
| 18:44 | pdk | i dont see much reason to do one over the other |
| 18:44 | ieure | Okay. Thanks. |
| 18:44 | pdk | though people are probably used to using valueof |
| 18:47 | ieure | I googled, but I think I used the wrong terms. |
| 18:48 | ieure | I really can’t stand Java, but Clojure is interesting to me. |
| 18:48 | ieure | It makes the Java bits mostly tolerable. I just don’t know the library well. |
| 18:59 | _mst | looks like clojars is back up |
| 19:17 | mebaran151 | how do you install lein plugins: I'd like to push my bdb library to clojars |
| 19:18 | mebaran151 | it's the best one I've seen on the internet (I sort of compulsively wrapped everything, and then wrote some nice seq code over it over again) |
| 19:20 | mebaran151 | I actually thought parseInt was the more Java-y way to do it |
| 19:35 | webuserid | hi folks, |
| 19:36 | webuserid | I'm new to clojure and java. I've got emacs set up with slime and clojure. I now have a REPL. I was trying to get clojure-processing running. I need to know how I can add libraries to clojure. |
| 19:36 | pdk | you can load additional jar/class files from the command line with the -cp option |
| 19:37 | pdk | e.g. javac -cp misc-classes.jar myprogram.java; java -cp misc-classes.jar myprogram |
| 19:37 | webuserid | I got emacs set up following i |
| 19:38 | webuserid | this guide. http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/ |
| 19:38 | webuserid | I don't start clojure manually, emacs does it for me. So how may I go about my way in this case? |
| 19:40 | webuserid | pdk: ^^ |
| 19:40 | technomancy | webuserid: if you start a new project with leiningen, (putting all the deps in lib/) you can do M-x swank-clojure-project to set up the classpath for you |
| 19:40 | technomancy | you don't have to use leiningen, but it's the easiest way to get your dependency jars handled |
| 19:40 | technomancy | (you don't want to do that by hand; it's a huge pain0 |
| 19:41 | technomancy | ) |
| 19:41 | webuserid | can i use the "java.library.path" paths? |
| 19:45 | webuserid | technomancy: I'm a newbie, what's my best bet to get the darn thing working? :) |
| 19:47 | technomancy | webuserid: for sure the easiest way is to create a project directory if you haven't already and just toss the jars in lib/ inside that. then use M-x swank-clojure-project to launch slime. |
| 19:47 | webuserid | cool. |
| 19:48 | technomancy | see the README under usage |
| 19:48 | patrkris | is clojure.contrib.zip-filter.xml/xml-> unable to filter on tags that have namespace prefixes? |
| 19:48 | technomancy | the swank-clojure readme, that is |
| 19:48 | webuserid | was about to ask. |
| 19:48 | webuserid | thanks. |
| 19:51 | technomancy | webuserid: if you use leiningen, you can have it download processing as a dependency by adding [org.clojars.fyuryu/rosado.processing "1.0.7"] to the :deps section of project.clj |
| 19:54 | webuserid | technomancy: cool.. I will look into that. |
| 20:00 | mebaran151 | yay I pushed my first clojar |
| 20:01 | mebaran151 | who would have thought maven could be so .... useful (and not hire fire inspiring in the least) |
| 20:01 | mebaran151 | *hair |
| 20:01 | webuserid | technomancy: sorry to sound dumb, but how do i get leiningen to set up the project for me. |
| 20:03 | webuserid | Do I have to be root to install using lein? |
| 20:03 | webuserid | technomancy: ^^ |
| 20:10 | the-kenny | webuserid: What should do leiningen when it "sets up the project"? |
| 20:12 | webuserid | resolve the dependancies? |
| 20:13 | webuserid | He said I could add clojure-processing as a dependency. I was trying to figure out how and how to get it to play along with emacs and slime. |
| 20:14 | webuserid | the-kenny: ^^ |
| 20:15 | the-kenny | webuserid: If you have all dependencies etc. in your project.clj, just run "lein deps" |
| 20:15 | webuserid | from the project directory? |
| 20:15 | the-kenny | After that, you can just start a repl in emacs with M-x swank-clojure-project |
| 20:15 | the-kenny | yes |
| 20:15 | the-kenny | it will pull all deps for you and put them in lib/ |
| 20:16 | webuserid | cool.. |
| 20:16 | webuserid | You're a star. |
| 20:18 | the-kenny | You're welcome ;) |
| 20:29 | webuserid | the-kenny: I get an exception with lein. http://pastebin.com/m7b6c75ae |
| 20:30 | the-kenny | webuserid: Check you sources. Looks like you try to redefine "test" |
| 20:31 | webuserid | the-kenny: The directory is named test. Perhaps that's why. |
| 20:35 | webuserid | the-kenny: It's not the directory name. I get the exception again. What do you mean check my sources? I haven't written anything yet to redefine anything. |
| 20:37 | the-kenny | webuserid: hm.. sounds strange |
| 20:58 | KirinDave | Is there a summary of the performance characteristics of the various clojure data structures? |
| 20:59 | mitchellh | KirinDave: If I recall, the data structures section (or primitives) of the clojure.org website mentions it. |
| 20:59 | KirinDave | http://clojure.org/data_structures does not mention. |
| 21:00 | mitchellh | KirinDave: I know Lists = O(1) insert, O(n) lookup (singly linked lists, inserts at head) |
| 21:01 | the-kenny | Uhm.. anyone has problems with emacs 23 and (require)? |
| 21:01 | mitchellh | KirinDave: Vectors = O(1) lookup, and I think its average O(logn) insert (or nlogn, I can't remember how they're implemented tbh) |
| 21:01 | the-kenny | I get weird errors, but it works in *inferior lisp* |
| 21:01 | mitchellh | KirinDave: I saw these in a talk, I think its channel 9's interview with Rich Hickey |
| 21:02 | KirinDave | mitchellh: There is no asymmetry in vectors for prepend or append tho, right? |
| 21:02 | KirinDave | They're like giant tries. |
| 21:02 | mitchellh | KirinDave: Correct |
| 21:02 | mitchellh | KirinDave: KirinDave: |
| 21:02 | mitchellh | errr |
| 21:02 | mitchellh | KirinDave: http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/ |
| 21:02 | mitchellh | He goes over imlementation details of the primitives at some point there, just seek until you see a trie drawn, then seek backwards a bit |
| 21:03 | replaca | technomancy: is there anyway to increase the heap size for swank-clojure through "mvn clojure:swank", lein, or some other mechanism? |
| 21:03 | KirinDave | Fucking silverlight. |
| 21:03 | KirinDave | I'm not going to install it. I need that shit at work already, and I hate it. |
| 21:03 | replaca | my read of the code says "no" |
| 21:03 | the-kenny | replaca: Maybe with the "extra-jvm-args" in swank-clojure.el |
| 21:05 | replaca | the-kenny: yeah, I think that works when you start inside emacs. I've been starting externally from maven (to run incanter) |
| 21:05 | replaca | maybe I'll have to switch |
| 21:06 | KirinDave | So let me guess |
| 21:07 | KirinDave | For problem #1, you made a lazy sequence of multiples of 3 and 5, zipped them, then kept iterating over it while below 1000. :) |
| 21:08 | KirinDave | Don't even need to zip, I guess. |
| 21:08 | the-kenny | woho, new design for github |
| 21:14 | replaca | the-kenny: what's different? |
| 21:14 | replaca | oh, I see - on the project pages |
| 21:15 | the-kenny | replaca: Yes, the project page. |
| 22:00 | tolstoy | Hm. So, clojure.main doesn't handle -D params automatically? |
| 22:01 | tolstoy | You have to java -cp ... -Dthis=that clojure.main? |
| 22:01 | chouser | put them before clojure.main on the ... right |
| 22:01 | tolstoy | That means my shell script invoker needs to be smart. |
| 22:01 | chouser | the stuff after clojure.main gets passed into your code via *command-line-args* |
| 22:02 | tolstoy | Yep, that makes sense, of course. |
| 22:03 | chouser | yeah, the launch script I use picks out -D, -X, -cp ... |
| 22:05 | tolstoy | Workable enough. Eventually I figure I'll go the leiningen uberjar route for this little app, which solves that prob. |
| 22:06 | technomancy | KirinDave: actually I think append and prepend are asymmetric for vectors |
| 22:06 | technomancy | vectors grow cheaply only at the tail |
| 22:06 | technomancy | replaca: it might respect JAVA_OPTS, but I haven't confirmed it myself |
| 22:25 | KirinDave | technomancy: Hum |
| 22:26 | KirinDave | technomancy: We were earlier looking at that news.ycomb example of palindromes. |
| 22:26 | KirinDave | So that's why it came up. |
| 22:54 | _mst | KirinDavE: I wrote to the author of that palindromes article to point out that running repeated test runs gets a lot faster |
| 22:55 | _mst | from 500ms to around 60-70ms on my machine here |
| 22:55 | KirinDave | It never gets to 60-70 on mine. |
| 22:55 | KirinDave | Perhaps you have a more powerful machine. |
| 22:56 | KirinDave | I never get below the range of 150ms, which is still a bit more than a halving of the total time. |
| 22:59 | _mst | KirinDave: I might've run with -XX:UseAggressiveOpts and -server when I was testing, not sure if that makes a difference |
| 22:59 | _mst | I gave it a quick run with hprof and nothing jumped out as being terribly slow, but I didn't really pick it apart to see how the code worked |
| 23:00 | KirinDave | Yeah |
| 23:00 | KirinDave | I posted some profile runs earlier |
| 23:00 | KirinDave | The vector opts all together do stand out, but only in the 5% of the top 10% range |
| 23:01 | replaca | technomancy: ok, thanks, I'll give it a try |
| 23:01 | KirinDave | _mst: Unrecognized VM option 'UseAggressiveOpts' |
| 23:02 | _mst | ah sorry, -XX:+AggressiveOpts |
| 23:02 | KirinDave | Oh wow |
| 23:02 | KirinDave | I got some runs down by 90ms. |
| 23:03 | KirinDave | That's a heck of a magical invocation there |
| 23:03 | _mst | heheh excellent |
| 23:39 | replaca | no luck on JAVA_OPTS via maven. Looks like folks have hacked on some "clojureOptions" stuff, but I don't see how to set it |
| 23:39 | technomancy | replaca: oh, I meant for leiningen |
| 23:45 | ozarusan | How do I get from [1 2 3 4] to [1 [2 [3 [4]]]]? |
| 23:47 | technomancy | ozarusan: (reduce (fn [acc x] (conj acc (vec x))) [] [1 2 3 4]) |
| 23:48 | ozarusan | ,(reduce (fn [acc x] (conj acc (vec x))) [] [1 2 3 4]) |
| 23:48 | clojurebot | java.lang.Exception: Unable to convert: class java.lang.Integer to Object[] |
| 23:52 | tolstoy | ,(reduce (fn [acc x] (conj acc (vector x))) [] [1 2 3 4]) |
| 23:52 | clojurebot | [[1] [2] [3] [4]] |
| 23:58 | technomancy | uh... yeah that's not right |