#clojure log - Mar 10 2010

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:05 nteon: is there a way to programmatically add type hints?

0:05 say, in macros?

0:05 psykotic: with-meta

0:06 ,(meta #^Integer 'foo)

0:06 clojurebot: nil

0:06 nteon: psykotic: sweet, thanks

0:07 psykotic: hmm

0:09 tomoj: hmm indeed

0:10 psykotic: thinking about it more, it must do something funky for type hints on arguments

0:11 it can't attach it to the symbol since that may be referenced outside of the original scope of definition, yet with no relationship

0:11 dnolen: hmm how do you get an agent add-watch fn to print to the REPL?

0:12 psykotic: nteon: http://74.125.153.132/search?q=cache:yz_-834aiLUJ:w01fe.com/blog/2009/07/dynamic-type-hints-in-clojure-macros/+clojure+type+hints+with-meta&cd=4&hl=en&ct=clnk&gl=th

0:12 (original page appears down)

0:15 nteon: psykotic: nice confirmation, thats what I was testing at the repl :)

0:31 slyphon: how do you generate javadoc-like docs for cloure?

0:31 clojure, even

0:34 tomoj: slyphon: seen http://tomfaulhaber.github.com/autodoc/ already?

0:35 slyphon: nope

0:35 * slyphon goes to look

0:35 slyphon: ah, bingo

0:35 tomoj: wasn't sure whether that is "javadoc-like" enough for you

0:35 dakrone: slyphon: or http://github.com/mmcgrana/clj-doc

0:35 slyphon: tomoj: anything like the core docs

0:36 i just want to generate some apidocs for compojure

0:36 tomoj: the core docs are generated with autodoc I believe

0:36 * slyphon nods

0:38 joshua-choi: Oh wow, I didn't know that autodoc existed

0:38 Excellent; Markdown support is a planned feature

0:38 * joshua-choi very happy

0:40 defn: How do I select a range of values from a lazy-seq

0:40 like the values nth to nth + 100

0:43 replaca_: ,(take 100 (drop 50 (map #(* % %) (range 10000))))

0:43 clojurebot: (2500 2601 2704 2809 2916 3025 3136 3249 3364 3481 3600 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 5041 5184 5329 5476 5625 5776 5929 6084 6241 6400 6561 6724 6889 7056 7225 7396 7569 7744 7921 8100 8281 8464 8649 8836 9025 9216 9409 9604 9801 10000 10201 10404 10609 10816 11025 11236 11449 11664 11881 12100 12321 12544 12769 12996 13225 13456 13689 13924 14161 14400 14641 14884 15129 15376 15625 15876 16129 16384 1

0:43 replaca_: defn: like that

0:43 defn: cool, thank you

0:44 replaca_: np

0:44 defn: im doing diffie-hellman in clojure :)

0:44 replaca_: wow, interesting

0:45 joshua-choi, slyphon: let me know if you have any Q's re: autodoc. I'm the author

0:45 slyphon: oh, thanks

0:46 yeah, i'm trying to figure out why it's having trouble finding classes for compojure

0:46 i'm pretty sure i'm just doing something wrong

0:48 joshua-choi: replaca_: Thanks. I do have a question: my one qualm with autodoc is that the web pages it produces use such tiny font sizes. Would it be feasible to tweak its stylesheet to use larger font sizes?

0:57 schizm: if I get contrib-clojure as per this link: http://riddell.us/tutorial/clojure/clojure.html

0:57 it doesn't have a build.xml file so 'ant' cannot execute on it

0:57 hiredman: clojure contrib in git has switched to using maven

0:58 * schizm sighs

0:58 hiredman: there should be build instructions in the readme, I guess

0:58 schizm: great

0:58 hiredman: why can't you just grab a jar?

0:58 slyphon: "Door is ajar. Door is ajar." "Why would they put a jar on a car?"

0:59 schizm: i don't know, I'm just folllowing the instructions on the first good looking google return to "Clojure on Ubuntu"

0:59 I tend to prefer compiling things from source

0:59 it's not usually this hard ;)

0:59 and of course...this maven thing isn't in ubuntu's repository

0:59 slyphon: isn't it just "mvn clean install"

0:59 schizm: why have two different compile systems for clojure and clojure-contrib...seriously

0:59 slyphon: schizm: java and linux have a hate hate relationship

1:00 schizm: ya, well so apparently do windows and clojure tools (vimclojure, etc) :P

1:00 slyphon: hah "windows"

1:01 psykotic: is there an easy way to install a custom printer (e.g. by rebinding) for slime, inferior-lisp, etc?

1:01 schizm: slyphon: hm?

1:01 psykotic: it'd be nice to have something that's smarter about infinite seqs

1:01 schizm: k maven is happily downloading stuff in clojure-contrib

1:02 psykotic: i.e. print as you go, with time-out. right now nothing is ever printed because it wants to convert the whole thing to a string first, which never happens, etc.

1:02 schizm: i still don't get the reasoning behind two diff compiler drivers for the two base packages

1:02 seems...poor?

1:03 * slyphon shrugs

1:03 hiredman: it doesn't matter, because you can just grab a jar

1:03 slyphon: i guess most people are just happy with the jars

1:03 hiredman: they aren't going to compile any different on your machine

1:03 java bytecode is java bytecode

1:03 slyphon: hiredman: what about --funroll-loops?!

1:03 schizm: 'the poor compiler driver choice doesn't matter because you can grab a jar' <-- surely you realize how that sounds?

1:03 but sure

1:03 hiredman: no

1:03 schizm: :)

1:03 slyphon: i'd take that a little more seriously if you didn't call it a "compiler driver"

1:04 schizm: build system

1:04 whatever you want to refer to it as

1:04 * schizm shrugs

1:04 hiredman: schizm: please don't put quotes around things I did not say

1:04 schizm: nant, ant, maven, make

1:04 hiredman: I didn't say it did not matter

1:04 schizm: <hiredman> it doesn't matter

1:05 anyhow, I'm cranky cause I've spent 3 hours fighting with vimclojure, windows, java, and clojure...I should go to bed :)

1:05 I'd just hoped it wasn't quite this painful I guess

1:05 hiredman: it isn't

1:05 if you just grab the jar

1:05 because the class files are exactly the same

1:06 schizm: I had the jars, vimclojure had issues with them on windows

1:06 etc

1:06 so i just fired up one of my ubuntu boxes and trying it there now

1:06 anyways, sleep for me, fresh start tomorrow

1:06 nite

1:06 hiredman: I would talk to the vimclojure guy then

1:15 replaca_: joshua, did you go?

2:02 konr: has anybody used twitter-clojure? I've registered an application on twitter, approved its request and got a number. Is it the verifier of which access-token-response needs?

2:08 LauJensen: konr, I think I've seen 2 Clojure-Twitter apps, try searching Github for Twidoop

2:09 konr: found it! Thanks

2:28 Raynes: The number you got is your API token. When the user authorizes your application, the user will supply the access token.

2:28 IIRC.

2:28 konr: The README for clj-oauth is sufficient on Github.

2:43 zmila: how works :test metadata key in defn? when this fn is invoked?

2:44 hiredman: ,(doc test)

2:44 clojurebot: "([v]); test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception"

2:45 tomoj: am I the only one that finds the clojure website difficult to navigate

2:45 zmila: i read the doc, but it's unclear when the fn is invoked. is it invoked automatically?

2:45 wbruce: Excuse the newbie question: if I have a deep data structure bound as a ref, what's the right way to (for instance), add a value to one of the internal data structures

2:45 zmila: tomoj - not you the only :)

2:46 wbruce: (ie, lets say I have a map with maps as values -- add a key/val to one of the internal maps)

2:46 tomoj: wbruce: you could use update-in

2:46 zmila: wbruce - assoc new value (new map) at prev key

2:47 yes! update-in works on several levels

2:47 wbruce: ahhh

2:47 chouser: zmila: (test (var foo)) will call the :test fn set in the metadata of foo

2:47 wbruce: thanks; I'll poke around with that!

2:48 tomoj: ,(let [m (ref {:foo {:bar 3}})] (dosync (alter m update-in [:foo :bar] inc)))

2:48 clojurebot: Execution Timed Out

2:48 tomoj: odd

2:48 ,(dosync (let [m (ref {:foo {:bar 3}})] (alter m update-in [:foo :bar] inc)))

2:48 clojurebot: Execution Timed Out

2:49 * tomoj shrugs

2:49 wbruce: I get the idea though

2:49 that makes sense

2:50 so, I could "conj {key val}" to a map, for instance

2:51 tomoj: huh, strange

2:51 I never new you could conj maps

2:51 does it just act like merge?

2:51 chouser: you can conj onto any persistent collection

2:52 wbruce: yeah, and will override the existing key

2:52 chouser: ,(conj {} [:a 1] [:b 2])

2:52 clojurebot: Execution Timed Out

2:52 tomoj: sweet

2:52 that seems useful

2:52 wbruce: I think clojurebot is out of cycles ;-)

2:52 zmila: thanks, chouser! now I put meta in the right place and the :test is working

2:52 tomoj: don't have to step through maps to merge

2:52 oh, merge works anyway.. ???

2:53 (merge {:foo 3} [:bar 4])

3:11 hiredman: hmm

3:11 I wonder if the new de-fang code is at fault

3:20 wbruce: Is there something similar to update-in that, instead of updating a value, just returns it?

3:20 ie, get a value from a deep data structure

3:20 tomoj: (doc get-in)

3:20 clojurebot: "([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys"

3:20 wbruce: aha!

3:20 tomoj: thanks :-)

3:21 hiredman: ,(conj {} [:a 1] [:b 2])

3:21 clojurebot: {:b 2, :a 1}

3:22 hiredman: ,(let [m (ref {:foo {:bar 3}})] (dosync (alter m update-in [:foo :bar] inc)))

3:22 clojurebot: {:foo {:bar 4}}

3:23 hiredman: clojurebot: sleep?

3:23 clojurebot: Huh?

3:57 gko: Hello

3:57 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline gko

5:41 ttmrichter: Stupid question: how difficult/easy would it be to incorporate JLine into clojure to give command line editing ability under Linux?

5:45 Chousuke: I think if you use leiningen to start your repl you get that automatically.

6:13 ttmrichter: Chousuke: Leiningen being?

6:15 Chousuke: a clojure build system. it can start a repl for you

6:15 I often use it instead of a clj script :P

6:15 psykotic: the getting started page also has an invocation example of how to use jline

6:55 Licenser_: aloa

7:26 Hali_303: hi! how to do a for comprehension in a way that inside the body I've got both the collection item and its index available?

7:31 vy: ,(partition 2 (interleave (iterate inc 0) '(a b c)))

7:31 clojurebot: ((0 a) (1 b) (2 c))

7:32 vy: ,(zipmap (iterate inc 0) '(a b c))

7:32 clojurebot: {2 c, 1 b, 0 a}

7:49 AWizzArd: Hali_303: you can also use indexed from clojure.contrib.seq

7:49 ,(indexed [10 20 30 40])

7:49 clojurebot: java.lang.Exception: Unable to resolve symbol: indexed in this context

7:49 AWizzArd: ,(clojure.contrib.indexed [10 20 30 40])

7:49 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.indexed

7:50 Hali_303: AWizzArd: thanks!

7:50 AWizzArd: ,(clojure.contrib.seq/indexed [10 20 30 40])

7:50 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.seq

7:50 AWizzArd: okay, the bot did not require it

7:50 Anyway (seq/indexed [10 20 30 40]) ==> ([0 10] [1 20] [2 30] [3 40])

7:50 after a (require '[clojure.contrib.seq :as seq])

8:27 dsop: I'm new to lisp and clojure and I wonder if there a way to generate a partial applied function, so for example I have (def sum [x y] (+ x y)) and now I want to generate a new sum function on demand that has x set to a value by not y. so something like (def sum-2 [y] (sum 2 y))

8:27 s,by,but,

8:27 so that I can generate sum-x for some x somewhere in the code

8:28 chouser: (partial sum 2) will return a new function

8:28 dsop: thanks

8:28 should have searched better, the name of the funciton is quite obviouse

8:34 chouser: not a problem

8:35 fliebel: Wow, it's been a while since I did Clojure. How is Clojure doing?

8:36 chouser: if people only asked questions that weren't documented, this would be a quiet lonely place.

8:37 dnolen: fliebel: hullo, pretty good I'd say :)

8:38 chouser: fliebel: Clojure's on the move! It's making waves! It's kicking OOPS and taking names! It's the cat's meow! It's the best thing since sliced bread! It's on the cover of Linux Journal! It's cute as a button and twice as fast!

8:39 fliebel: Oh my god… I can't even remember how to define a namespace at the top of my script… (ns testapp :use "Clojure/contrib") Is that anywhere near correct? Wait… I think I still know where to find the API...

8:40 http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns Yay, Clojure rocks!

8:46 Has anyone seen defn lately?

8:48 chouser: ~seen defn

8:48 clojurebot: defn was last seen in #clojure, 483 minutes ago saying: im doing diffie-hellman in clojure :)

8:48 fogus: chouser: You might change your mind about Clojure being as cute as a button after seeing this: http://tinyurl.com/ylxdz77

8:51 fliebel: You know… Did the thought occur to anyone that you could make nice smilies in Clojure? I mean like… (-B "some function") Would that be legal?

8:52 chouser: fogus: ooh, cool!

8:52 cemerick: cgrand: ping?

8:52 fogus: chouser: About half way through I talk smack about the co-author though... oh wait

8:53 cemerick: fliebel: yes, people have done it, though jokingly of course.

8:54 cgrand: cemerick: pong!

8:56 cemerick: cgrand: nevermind, almost. :-) &nbsp;'s seem to get swallowed, but &#160;'s come through ok (as &nbsp;'s, oddly enough)

8:57 dnolen: question, so if send/await is considered bad form, what's the best approach to consume the work done by by an agent?

8:58 vy: With the work/job, pass a closure that will submit the result to your specific working queue when it is done?

8:59 dnolen: vy: so do people tend to use the Java concurrent queues for this? (I'm a concurrency noob)

8:59 AWizzArd: dnolen: you can use a java.util.concurrent.ArrayBlockingQueue

9:00 vy: dnolen: No, that's what I tend to use.

9:01 AWizzArd: dnolen: though there is an easy hack. You can create a promise in your thread and pass it in to your agent. Inside the agent you (deliver it). Instead of awaiting the agent you can deref the promise.

9:01 dnolen: AWizzard: but that will block the main thread right?

9:03 chouser: dnolen: yes, if you want a work queue, use a work queue not agents

9:03 agents are best for identities that have different values over time

9:06 dnolen: chouser: thx, that was my mental block. just don't use agents for what I'm describing.

9:06 cgrand: cemerick: I guess it's a pb with xml-resource (are you using it?)

9:06 AWizzArd: dnolen: It will block the thread in which you try to deref the promise. It seemed to me that this is what you wanted to do, as you mentioned await. But anyway, a j.u.c Queue can probably give you what you want.

9:06 cgrand: but I'm surprised by &nbsp; being output. Are you using a custom emit*?

9:07 cemerick: cgrand: yeah, we're using xml-resource. No, whatever defaults defsnippet is using.

9:07 I looked at str-xml, and it seems that there's only three entities that are being handled specially, and of course none of them are nbsp or #160

9:09 chouser: fogus: nice interview. well done!

9:10 fogus: chouser: Thank you

9:54 arohner: what's the proper lein declaration for clojure-contrib HEAD? I have [org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"], but that's pulling a snapshot from before duckstreams was renamed

9:55 tjg: Where's fogus's interview? I haven't seen it on disclojure.org or my other usual haunts...

9:56 chouser: http://rubylearning.com/blog/

9:57 tjg: chouser: Thanks!

9:58 arohner: apparently for contrib it's [org.clojure/clojure-contrib "1.2-SNAPSHOT"], but for clojure it's [org.clojure/clojure "1.2-master-SNAPSHOT"]

10:06 sh10151: A Java API I am using expects a PrintStream, but *err* is a PrintWriter.

10:07 It seems to me that I should be able to create a proxy that delegates the print methods to *err*, but is there already way to set that up without writing each method in the proxy?

10:08 like (proxy [PrintStream] [writer] (delegate writer)) or something, where that creates a bunch of methods (print [x] (.print writer x)) and whatnot?

10:08 chouser: hm. I assume it's actually using System/out ?

10:08 sh10151: the default uses System.err but I don't want System.err, but *err*

10:08 chouser: er, System/err

10:09 sh10151: yeah

10:09 chouser: so ... you're changing the value of System/err?

10:09 sh10151: no, I'm setting the errorOutput of an object

10:09 System/err can be the same

10:09 but this class defaults to System/err while allowing people to set other outputs

10:09 chouser: ah

10:10 and you're trying to pass in *err*, but that's the wrong type

10:10 sh10151: precisely

10:11 I think in this particular aspect I can cheat and only define println

10:11 but it seems like shortcutting a proxy with compatible method names but incompatible types might be useful

10:12 maybe not though, since this is just a Sun screwup anyway :)

10:12 chouser: I'm a bit surprised there isn't already a class to adapt those together.

10:13 sh10151: commons-io might have one, but I don't want to use it

10:14 actually it doesn't look as though it does

10:16 neotyk: Hi *

10:17 how would one provide clojure map backed by java map?

10:18 chouser: neotyk: clojure maps *are* java maps

10:19 ,(instance? java.util.Map {:a 1})

10:19 clojurebot: true

10:19 neotyk: very nice

10:19 * neotyk loves this simplicity

10:20 The-Kenny: neotyk: I said the same when I wanted to execute some functions in a threadpool and found out that clojure-fns are Callable and Runnable :)

10:21 neotyk: The-Kenny: it is really great

10:23 savanni: Morning, all. I'm curious about something that came up in a recent project I was doing. How can I tell when clojure is going to take a function or some such and kick it into a separate thread or even a separate processor?

10:24 stuartsierra: neotyk: but Clojure maps don't implement the mutable methods of java.util.Map

10:24 neotyk: my usage is not mutable

10:24 stuartsierra: then you're good

10:25 neotyk: once headers are read they don't change

10:25 just want to expose them to users with nice clojure map

10:25 :)

10:25 savanni: The context of it was an application in which I had a java timer, a gstreamer mainloop, and a gtk mainloop, and the only thing that stayed synchronous was gtk. And I worried quite a lot about how to get the others to run asynchronously, and then it just happened on its own.

10:26 chouser: savanni: you generally have to work pretty hard to get work sent to another proces

10:26 otherwise, you just need to understand the behavior of the various classes you're working with -- hopefully their documentation is sufficient for you to know what to expect.

10:27 astoddard: Are there any plans to use transients in clojure core? I am doing some big data munging and I notice a substantial speed up if I use a "transientized" zipmap for example.

10:27 savanni: It might have been sufficient if I'd been more familiar with the environment. I'm still coming into Java. And pretty much every technology I used on that project.

10:28 chouser: astoddard: they already are. 'into' for example uses transients

10:30 miltondsilva: How can I bench individual fns

10:30 ?

10:31 I tried time but with lazyseqs it's hard to understand where that time is actually spent

10:31 sh10151: this feels a little wrong: (proxy [PrintStream] [System/err]

10:31 (println [x] (binding [*out* *err*] (println x))))

10:47 mattrepl: sh10151: is that from something related to a repl in Emacs or such?

10:54 defn: miltondsilva: maybe use time in the body of your lazy-seq?

10:57 astoddard: chouser: Could you give me a link to the source where into uses transients, I'm failing to see it.

10:58 Licenser_: huzza the sandbox is sandboxing!

10:58 defn: astoddard: are you using emacs?

10:59 astoddard: defn: yes

10:59 defn: 1.1.0?

10:59 slime?

10:59 clojurebot: slime-installer is http://github.com/technomancy/clojure-mode/blob/0f28b61de90ce8a09d75bf1668ef3f1c200f9c52/clojure-mode.el#L560

10:59 defn: if so -- type into into your repl and then hit M-.

10:59 it'll take you to the into definition which contains transients and persistents and all that good stuff

11:00 to get back just hit M-,

11:00 ,source into

11:00 clojurebot: java.lang.Exception: Unable to resolve symbol: source in this context

11:00 defn: ,help

11:00 clojurebot: java.lang.Exception: Unable to resolve symbol: help in this context

11:00 defn: err

11:01 clojurebot: source into

11:02 chouser: I don't know where it's getting the line number for that link, but if you just scroll to the bottom of that page you'll see the final definition of into

11:02 defn: err that link takes you to the wrong point in that source file, and doesn't...

11:02 what chouser said

11:03 there are two definitions of into

11:04 astoddard: :Thanks defn: My confusion came from the double definition. Thanks for the pointers on slime and clojurebot functionality too.

11:06 So if transients are in use, wouldn't it make sense to use them in zipmap?

11:07 Or is it only performant for big data?

11:08 chouser: there are almost certainly places where transients and/or chunked seqs would make sense in core's code where they just haven't been used yet.

11:08 as in, nobody has gotten around to writing the patches.

11:08 of course since chunked seqs may be going away and the api for transients may get adjusted, now might not be the best time to start doing such work.

11:09 defn: wait wha? chunked seqs going away?? they just got here!

11:09 chouser: :-)

11:09 defn: i dont know nearly enough about how they work

11:09 but why are they potentially leaving us?

11:09 Chousuke: defn: apparently Rich has a better idea for "virtual seqs" using cells

11:10 or something like that anyway

11:10 defn: ahh yes, all that cell discussion that one day

11:10 with the sentries and such?

11:10 Chousuke: yes

11:10 AWizzArd: Btw, would the new seqs work one-by-one when using map, that is: not in chunks of 32 elements?

11:10 Chousuke: AWizzArd: yes.

11:11 rhickey: defn: cells can definitely remove the overhead of laziness as well as, or better than, chunks can

11:11 defn: rhickey: interesting. im excited to see it

11:11 rhickey: that leaves the remaining appeal of chunks the as-yet-unrealized potential of mapping to chunked ops

11:12 astoddard: chouser: Even if the transient api changes it is probably worth making the patches to highlight where transient can apply.

11:12 rhickey: i.e. if you could say (reduce + ...) and + could communicate to reduce that it had a definition that could work a chunk-at-a-time

11:13 defn: i really wish i didn't work nights so I could have some sort of meaningful discussion at this hour...

11:13 somnium: curious: why are unquote and unquote-splicing declared at the top of core but never defined?

11:13 chouser: rhickey: cells could potentially apply functions that could perform on primitive values, right? chunking + could still beat that performance?

11:14 Chousuke: somnium: ~ and ~@ expand to them when outside `

11:15 rhickey: chouser: that's the whole thing - with ordinary functions on objects you could write a version of chunked op, with primitives in fns, you could reduce with a primitive arg/return fn

11:15 somnium: Chousuke: I'm aware, but that functionality is kind of encapsulated in the reader, no?

11:15 defn: Are transients going to be applied across all of core (where it makes sense) for 1.2.0?

11:16 rhickey: defn: that's not a priority at this point

11:17 Chousuke: somnium: some time in the future they might get proper definitions

11:17 somnium: right now, they're just placeholders there and you can in theory use them in your own macros

11:17 astoddard: rhickey: would patches to apply transients be welcome or a nuisance?

11:17 chouser: somnium: you can take advantage of ~ and ~@ in your own DSLs

11:18 astoddard: (I feel like an unwashed heathen even contemplating submitting a patch to core...)

11:19 Chousuke: I tried to implement syntax-quote as a macro once but it failed quite miserably :(

11:19 rhickey: astoddard: not ready for that yet. priority is seeing whether the cells idea is an improvement over current transients, and if so, switching to that asap. Making things transient/cell enabled is trivial in the end, and purely optimization

11:19 Chousuke: It's a lot easier as a reader trick. :P

11:19 somnium: rats, was hoping to see a clojuresque implementation

11:20 Chousuke: I do still have it as part of my now somewhat outdated reader

11:20 Licenser_: hmm will clojures performance be impoacted if you have may namespaces?

11:21 astoddard: rhickey: Fair enough. (The fact it is trivial is why I could contemplate doing it (-: ). I hit a case where it was worth optimizing for me.

11:21 Chousuke: hm, my clojure clone has way too many branches

11:22 that is, 20

11:22 * Chousuke likes branches

11:24 dullard: Hi guys, I'm new to Java and clojure and having trouble tracking down the reason for an error when trying out a project - overtone... On trying to start it up in the REPL, I'm gettingjava.lang.IllegalArgumentException: Unable to resolve classname: ScheduledThreadPoolExecutor (midi.clj:18) ... in midi.clj, java.concurrent FutureTask is referenced in the ns function... I'm using ubuntu karmic. Any idea of where to look to fix this?

11:27 chouser: mini.clj is yours?

11:27 er, midi.clj?

11:28 defn: im guessing midi

11:28 lol nevermind, sorry

11:28 dullard: i have overtone in my src/ let me check that out

11:28 dnolen: dullard: seems weird since that is a standard Java class. Which JDK are you running? OpenJDK?

11:28 dullard: sun java6

11:29 the source kinda looks good as far as I can tell

11:29 defn: im on that mailing list and havent seen anything

11:29 all i can imagine is it's a karmic thing

11:29 sattvik: Hmm.. I think the midi.clj is missing an import of java.util.concurrent.ScheduledThreadPoolExecutor

11:30 defn: i cant even find midi.clj in my source, maybe im out of date

11:32 sattvik: Just browsing overtone's source on github, it seems like it links to midi.clj from the lib directory.

11:34 defn: am i out of my mind? i dont see it

11:34 i see midi-clj but that dir is empty

11:35 oh duh

11:35 missing some git steps :X

11:38 dullard: sorry im having some build trouble on OSX

11:38 dullard: that's ok

11:38 defn: it is complaining about invalid POMs for nailgun

11:40 sattvik: Well, just browsing the source on-line, it seems that modifying midi.clj's line 15 from (java.util.concurrent FutureTask)) to (java.util.concurrent FutureTask ScheduledThreadPoolExecutor)) should resolve the problem. However, this is just from inspecting the code; I haven't downloaded or tried to run it.

11:40 dullard: I tried that!

11:41 maybe I don't get this lein business

11:43 sattvik: If you're using lein, I am guessing it is probably downloading a JAR file that has a buggy midi.clj.

11:45 Licenser_: hmmm is there a way to def a symbol in another namespace?

11:45 dullard: I think I need to manually put the correct jar into the lib dir in overtone... I thought it was looking in ~/.m2 for it's jars

11:46 hmmm... maybe not!

11:47 different error tho: java.lang.Exception: Unable to resolve symbol: NUM-PLAYER-THREADS in this context (midi.clj:18)

11:47 dnolen: dullard: lein always copies .jars into your project lib folder (when you run "lein deps")

11:48 dullard: so the ~/.m2 dir is a cache of dependencies?

11:49 when I run "lein deps" it says it's downloading midi-clj

11:51 defn: dullard: you can edit the japroject.clj

11:51 project.clj

11:52 and change the [midi-clj "x.x.x"] line to another version

11:52 see: http://www.clojars.org/repo

11:52 or http://clojars.org/search?q=midi

11:52 although judging by the version number that looks pretty old

11:52 fliebel: Hey defn, how are you doing?

11:53 * defn looks embaressingly at fliebel and remembers utterson

11:53 defn: it's going well! how are you?

11:53 dullard: I think that's the only version

11:53 fliebel: *remembered utterson when seeing defn in irc* ;)

11:53 defn: haha

11:54 dullard: I need to convince lein to use my local version instead of downloading it

11:54 sattvik: dullard: Looking at the source again.. it doesn't seem to declare NUM-PLAYER-THREADS, so you are making progress. Try replacing the text with a number such as 4. Or, you could add a line before that like '(def NUM-PLAYER-THREADS 4)'.

11:54 defn: dullard: you can just manually replace the jar with your version and dont run lein deps

11:54 dullard: ok, nice one

11:55 defn: fliebel: i was looking over your code -- did you write lisp before clojure

11:55 fliebel: defn: No...

11:55 defn: i thought your code looked good

11:56 fliebel: Thanks :)

11:57 defn: where did we leave off on utterson btw? no offense to any of the other site generators and such out there, but i think there is room for improvement

11:57 there has always been something left to be desired imo when it comes to static site gens

11:58 fliebel: What do you think we should do with the project? For me… It'd be nice to finish it, but as always, I think of more projects than I can code…

11:59 defn: haha, yes, my ~/git/ dir just keeps filling up with these silly little names like "djirk" some irc bot meets nlp processor lol

11:59 er nat. lang. processing

12:00 fliebel: I paused for a while to work on another website and see if you'd come up with any improvements, and never started again, my blog now just runs wordpress for the time being.

12:00 defn: fliebel: im actually about to do a rewrite of my blog in clojure

12:00 it would be nice to build my own tools in clojure

12:01 in combination with enlive, maybe

12:01 fliebel: So you still intend to finish Utterson someday? What is enlive?

12:01 defn: give some cool templating capabilities with a macro or two maybe

12:01 it's an html parser/generator

12:02 (written in clojure)

12:02 http://github.com/cgrand/enlive

12:02 fliebel: ah, that one :)

12:02 Yea, sounds sweet

12:03 defn: the clojure ecosystem has grown quite a bit it seems in the last few months

12:03 so it could be neat to use some of the new up and comers

12:04 dullard: ooh, progress - had to add (java.util.concurrent TimeUnit) too

12:04 defn: fliebel: ive always imagined a static site generator working like: /intelligently/ generate a layout based on user params

12:05 fliebel: ive always been somewhat upset that site generators just fill every inch of your directory structure with fils already filled out for you

12:05 fliebel: That sounds interesting.

12:05 defn: i think it makes more sense to give some initial design choices in the generation of the initial template

12:06 like hex colors, background colors, some css stuff you could do up front

12:06 fliebel: I don't follow you...

12:06 * Chousuke played around with git a bit

12:07 Chousuke: I started with history where I wrote my syntax-quote implementation before I started the reader itself.

12:07 now I have history where that sequence of events is reversed.

12:07 dullard: fantastic thanks sattvik, defn I've got it working. That was most informative and instructive

12:10 defn: fliebel: something like script.sh/create-layout.clj application --background #000000 --sidebar #000000 --text #123456 --rss --github --layout two-column

12:10 etc. etc. etc.

12:10 fliebel: ah...

12:10 defn: im getting so ahead of myself but

12:11 it'd be really cool to have a "design your blog" webpage where you could actually preview what your page would look like

12:11 and then it would generate your configuration options for you

12:11 fliebel: I've some other things to do now, but send me a message when you want to do something with this stuff, okay?

12:12 defn: yeah i definitely will -- i had another project going on, but this is on my priority list :)

12:13 fliebel: Ok, see you

12:13 defn: bye pepijn

12:15 duncanm: (for [range x (range width) y (range height) :when (not (zero? (pixel-value x y)))] [x y]) - this should give me a list of coordinates where the pixel-value is not zero, right?

12:15 or should i be using :while?

12:15 ulfster: :when is correct

12:16 :while would stop with the first zero pixel

12:16 defn: what's up with the binding? range x (range width) ?

12:16 wouldn't that bind x to range, and (range width) to y?

12:17 duncanm: oh

12:17 i meant (for [x (range width) y (range height) ...])

12:17 defn: ah

12:19 duncanm: i think that looks right

12:29 duncanm: defn: somehow it's stuck and doesn't return anything

12:29 i dunno how to debug a for expression

12:32 i guess get-pixel is slow... sigh

12:39 technomancy: any chance we could get http://www.assembla.com/spaces/clojure/tickets/246 applied?

12:40 rich indicated in IRC that he's in favor of this as a workaround, but I don't know if he's explicitly approved this (one-line) patch

12:45 duncanm: is there a parallel for?

12:45 defn: i'm just gathering points, right? the whole thing can be done in parallel, there are no side-effects

12:47 technomancy: (doc pmap)

12:47 clojurebot: "([f coll] [f coll & colls]); Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless required. Only useful for computationally intensive functions where the time of f dominates the coordination overhead."

12:47 dakrone: huh? clojurebot doesn't require ^, anymore?

12:58 hiredman: dakrone: notfor doc lookup

12:58 dakrone: oh okay

12:58 neat

12:59 hiredman: oh, and math

12:59 (+ 5 5)

12:59 clojurebot: *suffusion of yellow*

12:59 nteon: hah

12:59 dakrone: wow, did not know 10 == suffusion of yellow

12:59 now I do

12:59 :)

13:00 rsynnott: dakrone: http://www.urbandictionary.com/define.php?term=A%20Suffusion%20of%20Yellow

13:01 dakrone: hah, that's awesome

13:01 sh10151: (- 4 1)

13:01 clojurebot: 3

13:01 sh10151: (- 4 0)

13:01 clojurebot: 4

13:01 sh10151: (- 5 0)

13:01 clojurebot: *suffusion of yellow*

13:01 rsynnott: (tan 74)

13:02 (- 4.0 0.25)

13:02 Ooh, it's actually wrong

13:02 The offending calculator says 'suffusion of yellow' for any number >= 4

13:02 hiredman: I don't think the math regex recognizes decimal points

13:03 somnium: ah, so its really more of an iching emulator

13:03 rsynnott: well, yes, but it answered '4' to sh10151

13:04 hiredman: I would hardly call urbandictionary a reliable source

13:05 dakrone: I just cannot figure out an algorithm for this sequence yet, maybe someone has a suggestion:

13:05 somnium: should add a starship titanic plugin to the bot

13:06 chouser: http://www.thateden.co.uk/dirk/

13:06 dakrone: I have a sequence like this: [B,I,I,B,I,I,I,B,I,B,B,B,I,O], and I need [B,I,I],[B,I,I,I],[B,I],[B],[B],[B,I] from it

13:07 The-Kenny: (split-with b? ...) ?

13:07 drewr: someone wrote a template function for something similar

13:08 sh10151: hmm, clojure.contrib/io has the reader method, but no predicate method to say whether reader will succeed

13:09 I should say whether the type of the argument is something that reader knows what to do with

13:09 dakrone: The-Kenny: split with doesn't include 'I' in the seq

13:10 The-Kenny: dakrone: ah, I always forget how split-with works..

13:10 dakrone: ,(split-with #(.startsWith % "B") ["B" "I" "B" "B" "I"])

13:10 clojurebot: [("B") ("I" "B" "B" "I")]

13:10 chouser: dakrone: maybe start with partition-by in seq-utils

13:10 The-Kenny: dakrone: there's a function to split with a predicate somewhere

13:10 dakrone: chouser: okay, I'll give that a shot, thanks

13:10 The-Kenny: ah, partition-by

13:15 duncanm: if the top of my profile is invokeMatchingMethod, then I should do some hinting, right?

13:16 chouser: duncanm: sounds right

13:16 fliebel: What is the preferred way to do keyword arguments in Clojure? If I remember correctly they are not built in the core, but there was some nice trickery to turn :symbol "value" pairs into one, wasn't there?

13:17 The-Kenny: fliebel: There's a macro for this in contrib.def

13:17 defkfn

13:17 ,(use 'clojure.contrib.def)

13:17 clojurebot: nil

13:17 fliebel: Thanks

13:17 The-Kenny: ,(doc defkfn)

13:17 clojurebot: I don't understand.

13:17 hiredman: (or just use a map)

13:17 The-Kenny: ,(doc defnk)

13:17 clojurebot: "([fn-name & fn-tail]); Define a function accepting keyword arguments. Symbols up to the first keyword in the parameter list are taken as positional arguments. Then an alternating sequence of keywords and defaults values is expected. The values of the keyword arguments are available in the function body by virtue of the symbol corresponding to the keyword (cf. :keys destructuring). defnk accepts an optional docstring as we

13:20 fliebel: Sounds good

13:24 wbruce: What's the easiest way to determine is one set is a complete subset of another?

13:24 *if

13:25 The-Kenny: wbruce: clojure.contrib.set/subset? ?

13:25 wbruce: ah, thanks

13:25 duncanm: in Java, if i have a List<Double []> how to convert that to a double[][]?

13:27 fliebel: This is so frustrating… I forgot everything. What is wrong? (ns test (:use clojure.contrib def))

13:28 hiredman: duncanm: loop over the list, loop over the array, insert into array

13:29 drewr: fliebel: (ns test (:use [clojure.contrib.def :only [defnk ...]]))

13:30 fliebel: thanks

13:30 duncanm: hiredman: sigh, yeah, i was hoping the toArray method would help

13:30 chouser: duncanm: (into-array foo) ...oh wait, in Java?

13:30 hiredman: if it was a List<double[]> you could do a row at a time instead of an element at a time

13:34 duncanm: yeah, that's what i did

13:51 dakrone: what's a good way to approach this problem: I have [3 1 2] and a string "blah blah blah blah blah blah" and I need to split the string using the numbers in the vector => ["blah" "blah" "blah"] ["blah"] ["blah "blah"]

13:52 S11001001: dakrone: map, re-split, split-at

13:52 hiredman: ,(re-seq #"\w+" "blah blah blah blah blah blah")

13:52 clojurebot: ("blah" "blah" "blah" "blah" "blah" "blah")

13:54 hiredman: ,((juxt (partial take 3) (comp (partial take 1) (partial drop 3)) (comp (partial take 2) (partial drop 4))) (re-seq #"\w+" "blah blah blah blah blah blah"))

13:54 clojurebot: [("blah" "blah" "blah") ("blah") ("blah" "blah")]

13:55 dakrone: ack, that works but I'm not sure I understand it all

13:57 chouser: (defn split-at* [[v & vs] s] (if-not v (list s) (cons (take v s) (split-at* vs (drop v s)))))

13:57 hiredman: well you woudn't want it together like that

13:57 dakrone: ahh crap, I described it wrong

13:57 I have [3 1 2] and ["blah" "blah" "blah" "blah" "blah" "blah"]

13:57 hiredman: ((make-pull-aparter [3 1 2]) ["blah" "blah" "blah" "blah" "blah" "blah"])

13:58 dakrone: and need the sequence split into the numbers in the first sequence

13:58 chouser: (split-at* [2 1 3] (range 10)) ;=> ((0 1) (2) (3 4 5) (6 7 8 9))

13:59 dakrone: chouser: that works great, thanks!

14:29 fliebel: I have a quite complicated structure of nested lists, maps and things to check, how would I do that? I need to check if any item in the list being a set of key test pairs matches a give key value pair.

14:31 Like… I need to match {:foo "bar"} with {:foo string?} but not with {:bar string?} or {:foo number?}

14:35 chouser: ,(reify clojure.lang.IMeta (meta [] {:a 1}))

14:35 clojurebot: java.lang.Exception: Unable to resolve symbol: reify in this context

14:35 chouser: oh. my.

15:23 crowbar7: so, with clojurebot do his factoids go through a http server?

15:24 hiredman: no

15:25 but there is a sort of rough start of an interface for looking up stuff in clojurebot's database using http and json

15:30 wbruce: What's the easiest way to check for membership in a collection? I'm using (some #{m} coll), but it seems overkill; looking for something more along the lines of (member? m coll)

15:31 chouser: wbruce: what you've got is best if you want a linear scan of coll

15:31 if you want a fast lookup, use an appropriate type of coll and 'contains?'

15:32 wbruce: Just as a predicate, stuff like (if (seq (some foo bar)) true-body false-body) seems like far too much

15:32 chouser: ,(contains? :b {:a 1, :b 2, :c 3})

15:32 clojurebot: false

15:32 wbruce: ah, k; think that's what I was looking for

15:32 rads: what's the best way to serialize dates in java/clojure?

15:33 chouser: ,(contains? {:a 1, :b 2, :c 3} :b)

15:33 clojurebot: true

15:33 chouser: ah, that's better.

15:33 wbruce: you're looking up keys in a map?

15:33 wbruce: that and elements in sets and vectors

15:33 so this works

15:34 chouser: won't work for elements in vectors

15:34 wbruce: the only time it wouldn't, looks like, is values in a map

15:34 ,(contains? [1 2] 1)

15:34 clojurebot: true

15:34 chouser: ,(contains? [:a :b] :a)

15:34 clojurebot: false

15:34 rads: .setTimeInMillis?

15:35 wbruce: hmm

15:35 how does that work?

15:35 chouser: wbruce: unless you need to support nil or false values in your sets and maps, it's idiomatic to just do the lookup directly: (if (:a mymap) ...)

15:35 (doc contains?)

15:35 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

15:41 wbruce: ah, ok

15:42 the indexed collection part was the bit that tripped me up thinking it worked for vectors

15:42 thanks

15:42 hiredman: it does

15:42 ,(contains? [10 11 12] 0)

15:42 clojurebot: true

15:43 wbruce: right, if I'm checking for an index

15:43 but not a value

15:43 s/worked/worked as I expected/

15:43 chouser: ,(keys [:a :b :c])

15:43 clojurebot: clojure.lang.Keyword cannot be cast to java.util.Map$Entry

15:43 chouser: awww

15:44 crowbar7: hiredman: ohh ok, thats neat

15:44 wbruce: so, if I'm checking for membership in a vector, I need to either convert it to a set and use contains? or use (seq (some ...))

15:44 arohner: is there a place to browse the clojure-contrib API docs, like the clojure API docs?

15:45 chouser: wbruce: not sure why you keep wrapping seq around some

15:45 arohner: I found this, but github won't serve me html http://github.com/richhickey/clojure-contrib/blob/gh-pages/index.html

15:45 chouser: wbruce: but otherwise, yes that's the general idea. You can use .contains if you must.

15:46 arohner: http://richhickey.github.com/clojure-contrib/

15:46 ,(.contains [:a :b] :b)

15:46 clojurebot: true

15:46 arohner: chouser: thanks

15:50 wbruce: chouser: I think it was b/c (seq coll) is nil if the coll is empty

15:50 I'm probably looking for something akin to empty? for collections (for use with 'some')

15:51 hiredman: uh

15:51 and what about empty?

15:51 * wbruce laughs

15:51 wbruce: um, yeah. that would be helpful

15:52 becuase, hiredman, I like to make things more difficult for myself and waste your time ;-)

15:53 ok, I'm going to go spend some quality time with the docs and leave you guys alone for a bit.

16:04 chouser: does anyone know if there's a way to serve cached or static content from appengine without hitting the startup delay?

16:14 ned: chouser: take a look at nailgun maybe?

16:16 hiredman: ned: for appengine?

16:27 chouser: nevermind. not worth it for now.

16:41 arohner: chouser: I'm playing with zip-filter for the first time. I have a path to an element, then I want to grab some attributes off the element, and then grab all of the sibling nodes with the same attribute. I can do something like (let [attr-val (xml-> big-path-expr (attr foo)) elements (xml-> big-path-expr-using-attr-val)]), but it seems inefficient to restart the xml->. Is there a better way to do this, or am I doing it wrong?

16:45 chouser: perhaps (let [anode (xml-> mydoc big-path-expr), myattr (xml-> anode (attr foo))] (xml-> anode ...)) ?

16:45 arohner: that sounds like I'm doing it wrong. I thought I couldn't restart a xml-> from the output of a previous call

16:46 chouser: depends on how you end the xml-> chain -- you can have it return whatever you want.

16:47 actually, xml-> pretty much always returns a seq I think

16:47 jcromartie: anybody using Lighttpd to proxy a compojure app?

16:47 chouser: but the items in it can be whatever.

16:48 _ato: jcromartie: yep

16:48 jcromartie: _ato: has it been easy to set up/maintain

16:48 ?

16:48 I like lighttpd's config system

16:48 chouser: arohner: if you just end with a keyword, you'll get a seq of zip nodes, any of which can be used to start another xml->

16:49 arohner: ah, maybe that was my problem. I was trying to start another xml-> with the seq, rather than the first item in the seq

16:49 _ato: jcromartie: yeah lighttpd's config is nice and simple

16:50 chouser: arohner: could be. (first (xml-> ...)) is common enough I provided xml1->

16:50 _ato: I just have something like this to do the proxying: proxy.server = ("" => (("host" => "127.0.0.1", "port" => 8000)))

16:50 inside the appropriate conditionals

16:52 arohner: chouser: that works great. thanks

17:00 hiredman: http://www.thelastcitadel.com/images/syntax.png <-- hah, I didn't know I still had this image

17:07 Licenser: hiredman: I used some more code from clojurebot for the clj-sandbox project, marked it as yours, I hope that is OK?

17:08 hiredman: sure

17:08 Licenser: :) cool, just don't want to steal stuff ^^

17:08 hiredman: there was actually a problem with the de-fang code I gist'ed

17:08 steal away

17:09 I'm not even sure what the bug was, when I got tired of the stupid and nested in an or and rewrote it as an if statement it went away

17:09 Licenser: :P hiredman nah it's only stealing if I don't ask ;)

17:15 so the sandbox is starting to work well :)

17:18 cad_austin: test

17:19 powr-toc: nil punning is always bad now, right?

17:20 stuartsierra: powr-toc: no, why?

17:22 stacktracer: is there a way to define a public static field (not method) using gen-class?

17:22 cad_austin: Hello, I'm trying out Lau Jensen's compojure/emacs tutorial ( http://vimeo.com/8356990 ) and am getting an error with (use 'compojure 'clojureql 'clojureql.backend.mysql). The error reads: Could not initialize class clojureql.backend.mysql__init [Thrown class java.lang.NoClassDefFoundError]. Is this a mysql driver type deal?

17:23 powr-toc: stuartsierra: did the lazy branch not get merged a while back? Was the trade-off for extra laziness not nil punning?

17:24 hiredman: powr-toc: you can still nil pun, but empty seqeunces are no longer nil

17:24 powr-toc: hiredman: ok... so if the sequence returns nil explicitly then you can pun, otherwise wrap it in seq?

17:24 hiredman: right

17:25 powr-toc: hiredman: hmm... might have to review some code tomorrow at work

17:25 Licenser: hmm I found a very odd behavior of in-ns

17:25 hiredman: I don't know that you would even call that puning

17:25 powr-toc: hiredman: true

17:26 Knekk: ,(* 200 100 40 20 4 2)

17:26 clojurebot: 128000000

17:26 Licenser: (let [ns (ns-name *ns)) (in-ns 'test) (println (ns-name *ns*)) (in-ns ns)) -> does not return to ns

17:28 hiredman: Licenser: it does here

17:28 Licenser: hmm odd

17:29 odd now it does for me too

17:29 licoresse: how can I run a closure when I have captured it in a var ?

17:29 hiredman: uh

17:29 licoresse: wouldn't it be enough to (closure-capture-var) =

17:29 ?

17:29 Licenser: hmm I must have had a typo

17:30 hiredman: licoresse: what are you doing?

17:30 licoresse: ,lisppaste

17:30 clojurebot: java.lang.Exception: Unable to resolve symbol: lisppaste in this context

17:30 Licenser: so another one why does (let [ns (ns-name *ns*)] (in-ns 'test) (def x 42) (in-ns ns)) define x in user not in test?

17:30 hiredman: what do you mean by "captured it in a var"

17:31 licoresse: ok. let me show

17:31 hiredman: Licenser: def is a special form and the namespace it uses is captured at compile time, not run time

17:31 licoresse: (something button (fn [] (. text setText "JAADA")))

17:31 Licenser: hrm fork :(

17:31 licoresse: capturing the text

17:32 and sending it to the something function

17:32 for an actionPerformed on ...

17:32 hiredman: so you mean closing over the name x

17:32 so you have a function

17:32 licoresse: hiredman: I think so

17:32 hiredman: are you asking how to call functions?

17:33 Licenser: You could do something like (let [t "JAADA"] (something button (fn []  (.text setText t)))

17:33 licoresse: clojurebot: lisppaste

17:33 clojurebot: lisppaste8: url

17:34 Licenser: I hink clojure bot is upset because I stole code from him :(

17:34 licoresse: listpaste8: url

17:34 lisppaste8: url

17:34 hiredman: lisppaste8 doesn't work because freenode requires you to register your nick before sending to the channel

17:34 licoresse: my nick is reg.

17:35 hiredman: yes, but lisppaste8 is not

17:35 licoresse: I need my rcirc

17:35 Licenser: it requires you to register to this channel too

17:35 hiredman: Licenser: no

17:35 Licenser: ahh okay

17:35 sure?

17:35 I think it did

17:35 hiredman: lisppaste8 is just not a registered nick, so the bot is unable to send to the channel

17:35 if there was an op in here they could voice it

17:36 licoresse: (defn something [control closure]

17:36 (.addActionListener control

17:36 (proxy [ActionListener] []

17:36 (actionPerformed [e] closure))))

17:36 hiredman: woa

17:36 there are plenty of other pastebins in the world

17:37 licoresse: closure is a function

17:37 licoresse: I guess this is not quite right

17:37 hiredman: and you want to call the function?

17:37 licoresse: ,(doc closure)

17:37 clojurebot: It's greek to me.

17:37 Licenser: hmm is there any way to def a something within a sepecific namespace?

17:37 hiredman: it's a function

17:37 licoresse: I want to eval it

17:38 hiredman: Licenser: http://clojure.org/namespaces

17:38 licoresse: why would you want to eval it?

17:38 Licenser: ah cool thank you I'll read that

17:38 hiredman: the fn special form has already created a function

17:38 licoresse: hiredman: because: (something button (fn [] (. text setText "JAADA")))

17:38 rhickey: licoresse: to call a function value, just put it in parens with its arguments

17:39 licoresse: ah

17:39 rhickey: thanks!

17:39 works great now

17:39 rhickey: licoresse: that's not eval'ing, but applying. eval means evaluating a form (data structure)

17:40 licoresse: rhickey: ok

17:40 I get it

17:41 so if I pass something like '(something in here)

17:41 I need to eval this in order to have something to execute

17:41 hiredman: no

17:41 licoresse: ok?

17:41 hiredman: evaling will execute it

17:41 clojurebot: amespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

17:41 cad_austin: Never mind, got it.

17:42 licoresse: ,(doc apply)

17:42 clojurebot: "([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."

17:45 rhickey: licoresse: you should rarely need to eval, especially before you are solid on fns in general. Just use fn to make a callable thing, and call it by putting it first in parens. apply is only for when you are given the args as a collection from somewhere else

17:46 licoresse: rhickey: ok, and thanks for all the fun!!

17:48 rhickey: ,(let [f (fn [a b c] [c b a])] [(f 1 2 3) (apply f 1 [2 3])])

17:48 clojurebot: [[3 2 1] [3 2 1]]

17:48 licoresse: that makes sense...

18:15 looking for a good example of implementing mouseevent-listeners

18:24 found http://www.solussd.com/2009/11/a-clojure-highlife/

18:26 Licenser: nice :D

18:26 (def sc-add (sc "(+ a b)" 'a 'b)) (sc-add 1 2) ;=> 3

18:26 dakrone: can someone tell me why I'm getting this exception for a test: http://pastebin.com/TL9KshQQ

18:27 running the (is ...) without (deftest ...) works fine

18:28 hiredman: uh

18:28 the test name is a symbol, not a string

18:28 (deftest sentence-splitter …

18:29 dakrone: hiredman: okay, thanks

18:30 hiredman: the casting error about IObj must be some kind of metadata thing

18:40 powr-toc: why oh why do I seem to spend most of my time fighting to install slime/swank/clojure?

18:41 I have it going at work, but I can't figure out why it's not working at home

18:48 technomancy: powr-toc: three guesses: you're using windows, you're using CL and Clojure at the same time, or you haven't up-to-date documentation

18:48 those cover 90% of swank-related problems

18:48 not that swank doesn't have issues, but installation shouldn't be one of them

18:49 powr-toc: technomancy: hey :-) ... 1) Ubuntu 2) Just clojure 3) most likely :-)

18:49 technomancy: I always seem to struggle with swank installation

18:50 technomancy: powr-toc: using package.el?

18:51 powr-toc: and, I know you keep telling me and others to use ELPA, but whenever I've used ELPA I've run into even bigger problems

18:51 technomancy: I'd be more interested in hearing about those since I'm also maintaining package.el

18:52 powr-toc: technomancy: I'd be happy to tell you about them, if I could remember... it was a bit of a yak shaving exercise if I recall...

18:53 technomancy: Are you about for a bit?

18:53 technomancy: not a lot of bandwidth, but I'll be online for a while

18:55 powr-toc: technomancy: Ok... well I'm happy to try ELPA again and report back to you for advice and let you know what I'm struggling with

18:56 technomancy: powr-toc: cool

18:56 powr-toc: package.el is about to get merged for Emacs 24, so that would be beneficial in the Big Picture

18:57 powr-toc: technomancy: Yeah, I'd heard... when is Emacs 24 due out btw?

18:57 technomancy: it's probably at least a year out

18:57 if you wait for release

18:57 but releases are for wimps. =)

18:57 powr-toc: I'm aware of one bug that affects swank-clojure install actually; it's been fixed in my repo but not pushed

18:57 so if you're bug-hunting, try http://github.com/technomancy/package.el

18:57 powr-toc: technomancy: ok, well if you push it to a branch I can try it for you

18:58 technomancy: err... I should say it's pushed but not to tromey.com yet.

18:58 powr-toc: technomancy: cool

18:59 technomancy: oh, btw... I issued a github pull request for you, regarding a gensym issue in swank-clojure

18:59 technomancy: yeah, it's on my list...

18:59 I am not very up-to-speed on incoming patches =(

19:00 powr-toc: technomancy: no worries, you're pretty epic in your clojure projects :-) so I'm sorry to be such a pain in the butt hassling you

19:01 technomancy: not at all... as long as the end result is better code.

19:01 Licenser: I really love this passing around functions stuff oyu know that?

19:02 powr-toc: well, so long as you feel appreciated! :-)

19:02 Licenser: hey powr-toc EPIC is my project :P

19:02 powr-toc: Licenser: which project would that be?

19:02 Licenser: EPIC :P

19:02 it's called like that ;)

19:03 * Licenser is just playing with word jokes don't mind him

19:05 powr-toc: Licenser: what's it do?

19:05 technomancy: presumably I just throw this onto the load-path then?

19:05 Licenser: it's an Epic Processor for Intergalactic Combat (hence the name)

19:06 technomancy: powr-toc: yups

19:07 remleduff: Hi there, is anyone here familiar with getting vimclojure up and running? :)

19:07 nDuff: remleduff, I've managed to get it going, though "familiar" might be a stretch.

19:08 Licenser: nope sorry not me

19:08 nDuff: remleduff, ...if you'd ask your question first rather than looking for volunteers, that would mean that those of us who may or may not be able to help can jump in if appropriate, rather than being asked to volunteer up-front at the risk of falling on our faces.

19:08 remleduff: When I startup vim, I'm getting a message that says it's having problems and the gist seems to be that it can't open a file in temp

19:09 powr-toc: technomancy: ok it's running... what next for swank-clojure etc? M-x package-list-packages?

19:09 technomancy: powr-toc: yup, then mark swank-clojure and install

19:10 nDuff: remleduff, that doesn't seem particularly familiar on its face -- but could you paste the actual message, ie. including the filename?

19:10 remleduff: I'm trying, but vim won't let me copy the error msg :)

19:10 powr-toc: technomancy: btw the '?' key binding is bust

19:11 nDuff: remleduff, try holding down shift while selecting it

19:12 technomancy: powr-toc: works here; could you turn on toggle-debug-on-error and paste a stacktrace?

19:12 remleduff: http://gist.github.com/328628

19:12 powr-toc: or rather package-menu-view-commentary returns "Wrong type argument: arrayp, nil"

19:12 sure hold on...

19:13 technomancy: powr-toc: actually could you open an issue on package.el in that github project?

19:13 powr-toc: http://pastie.org/864238

19:13 nDuff: remleduff, you're on win32? erk. I gave up trying to get vimclojure to work on Windows, and have been sticking to more Unixy development platforms.

19:13 powr-toc: technomancy: no probs

19:14 technomancy: thanks

19:14 remleduff: I was hoping the vimclojure guy would be here, I had a couple of other questions for him too, including "what happened to build.xml"? ;)

19:14 And "why doesn't gradle seem to work"

19:15 technomancy: remleduff: he's on euro-time IIRC

19:15 powr-toc: technomancy: done

19:15 (the issue that is)

19:16 technomancy: what key do you use to mark a package?

19:16 technomancy: powr-toc: "i"

19:16 then "x" to execute

19:17 powr-toc: ok... lots of warnings etc...

19:17 technomancy: yeah, those are for the (optional) byte-compilation; don't affect functionality

19:17 nDuff: remleduff, I _did_ do the contortions to get gradle working for me, and may actually be able to remember them if lucky. :)

19:17 powr-toc: cool... it looks like it's done

19:18 technomancy: powr-toc: could you also paste the results of C-h v package-archive-contents ?

19:19 powr-toc: technomancy: wait up, I rebooted Emacs and it's complaining... probably because of something unrelated (I was evaluating config snippets again)

19:19 remleduff: OK, I manually figured out what "gradle viminstall" was supposed to do, and copied the files manually. But whenever I try to use gradle, it says something like "Unknown plugin, clojure'

19:19 nDuff: (on a semi-related note, I'm disturbed by how the shell script used to invoke gradle explicitly requires bash, but then invokes all manner of ugly hackery to avoid needing to use bash features, ie. arrays)

19:20 remleduff, right, you need to install the clojuresque plugin to gradle

19:20 remleduff: Aha, missed that, definitely. The readme still only talks about using ant :\

19:21 powr-toc: technomancy: any idea what "End of file during parsing" means?

19:22 chouser: powr-toc: open-parens that aren't closed

19:22 powr-toc: chouser: that's what I thought, but I can't see any

19:23 there must be one somewhere

19:25 remleduff: So is the idea that I clone clojuresque and then "gradle install"?

19:31 nDuff: remleduff, there's a file that needs to be updated to point the "clojure" name at the clojuresque plugin -- it's covered in the gradle docs somewhere

19:32 powr-toc: ahh, finally found the guy!

19:33 technomancy: where do you want that stuff pasted, alongside the package.el bug or elsewhere?

19:33 technomancy: powr-toc: with the bug would be fine

19:34 powr-toc: technomancy: just the value ok?

19:34 technomancy: suer

19:34 remleduff: nDuff: Alright, trying that at the moment, seem to have found a relevent blog post, thanks for the help! :)

19:34 powr-toc: ugh... the formattings screwed up

19:37 technomancy: I'll pastie it, and link to it from the bug

19:38 Licenser: hmm I'm starting to be happyish with this sandboxing thing, anyone can think of stuff could be needed. I got a quite usable white-blacklist system for filtering for 'bad' forms and I think some nice functions to compile code.

19:38 powr-toc: technomancy: Ok, so if I do M-x slime it wants to download clojure... what if I have it already installed?

19:39 ok downloading clojure

19:40 wow, who'da thunk it... it worked!!! :-)

19:40 technomancy: powr-toc: check the readme for the various ways to launch/configure slime

19:40 remleduff: nDuff: If you have more time, does the classpath for nailgun have to be the project classpath?

19:40 technomancy: if you don't have it configured to do otherwise, it will download the jars since it would be useless otherwise

19:40 powr-toc: technomancy: which README?

19:41 technomancy: powr-toc: swank-clojure's

19:41 remleduff: At the moment, I'm using "lein nailgun"

19:41 powr-toc: technomancy: where did emacs put clojure etc?

19:41 technomancy: powr-toc: ~/.swank-clojure

19:41 powr-toc: but you don't use that normally

19:42 you'd normally use M-x swank-clojure-project or lein swank

19:42 powr-toc: technomancy: what about the sources etc?

19:42 technomancy: which sources?

19:42 powr-toc: technomancy: for clojure and contrib

19:43 technomancy: powr-toc: I think the swank readme covers that

19:44 powr-toc: technomancy: and where is that? I can't see it in .emacs.d/elpa/swank.../

19:46 technomancy: powr-toc: that'd be on github

19:47 it's the closest thing to the "swank-clojure website" there is

19:49 powr-toc: technomancy: sorry, what I meant about "sources" was just having easy access to the installed versions sources for clojure and clojure-contrib

19:50 having this setup scares me a little as the source code could easily be different to what I'm actually running.

19:50 technomancy: powr-toc: you can set swank-clojure-classpath, but probably what you want is to use M-x swank-clojure-project instead

19:50 what's the context?

19:51 powr-toc: technomancy: I like to read through clojures source code, jump to it from within swank

19:52 technomancy: powr-toc: for that it'd be easiest to just symlink the jars into ~/.swank-clojure if you want to be particular about versions

19:53 might need to reset swank-clojure-classpath to nil to have it recalculate from the contents of ~/.swank-clojure

19:53 then M-x slime

19:53 powr-toc: technomancy: does it handle version numbers on those jars?

19:54 silly question sorry

19:54 I'm guessing it just puts that whole directory on the classpath

19:54 technomancy: yeah

19:54 having to reset the var to nil is a bug; using a bare M-x slime is pretty uncommon, so it's not as smooth as it could be

19:55 remleduff: OK, this is a very newb question, but I'm going to ask it because I'm not having luck googling it. I've never done any web development before, and I'm curious, what are the best practices for doing stuff like user account management. Using the correct crypto and salt, not saving passwords in plaintext, verifying email. Is there a hole in all the clojure web frameworks here that isn't being filled? I was expecting it to be turnk

19:55 powr-toc: how does this tie in with leiningen? it seems lien will use a different version of clojure, no?

19:55 I mean a different install

19:56 technomancy: powr-toc: leiningen just uses jars in lib/

19:56 so whatever your project is declared to depend on

19:56 miltondsilva: I'm having some problems with map... when I do this (f arg arg2 agr 3) it works fine if I do (map #(f arg % arg3) [arg2 arg4])) it says java.lang.ClassCastException

19:56 JonSmith: remleduff: for crypto and stuff you could probably use a java library fairly easily

19:57 powr-toc: technomancy: of course... which is why you like to use swank-clojure-project

19:57 slyphon: technomancy: hey, you're an emacs guy, no?

19:57 technomancy: slyphon: you could say that

19:57 slyphon: technomancy: :)

19:58 technomancy: well, i don't want to unfairly malign you...

19:58 anyway, what code completion setup do you use?

19:58 i'm having a hell of a time finding a decent reference as to how to set it up, apart from the various library authors on emacswiki having pissing contests about which one is better

19:58 powr-toc: slyphon: I just use paredit with hippie-expand

19:58 technomancy: slyphon: yeah, hippie-expand here

19:59 slyphon: do you guys customize hippie-expand at all?

19:59 like to do slime-fuzzy-complete-* or anything?

19:59 powr-toc: nope

19:59 oh wait, yeah I have that one set

19:59 hiredman: I use something called autocomplete

19:59 slyphon: hiredman: that's the one that pops up a little window?

19:59 overlay, rather

20:00 hiredman: yeah

20:00 slyphon: hiredman: would you mind sharing your .emacs setup code for it?

20:00 technomancy: slime has some smarts for completion, but the "complete from all tokens in all buffers" is good enough that I haven't bothered figuring it out.

20:00 hiredman: slyphon: just a second

20:00 slyphon: technomancy: *nod*

20:00 hiredman: thanks

20:01 remleduff: JonSmith: Yeah, I guess so. To me that just seemed like something I was expecting one of the frameworks to at least do some kind of recommendation for ;)

20:02 JonSmith: yeah, i think it is sort of a hole that needs to be filled

20:02 powr-toc: miltondsilva: that should work

20:02 JonSmith: there isn't really a framework that will take care of user logins and proper security stuff that you can just kind of import and use to my knowledge

20:02 miltondsilva: I'll post it in pastebin

20:03 maybe I'm missing something obvious

20:03 hiredman: slyphon: http://gist.github.com/328680

20:03 slyphon: hiredman: thanks!

20:03 hiredman: I guess I have hippieexpand too? *shrug*

20:03 miltondsilva: http://pastebin.com/6RZz5s9k

20:04 slyphon: hiredman: that seems common

20:04 miltondsilva: powr-toc: http://pastebin.com/6RZz5s9k

20:04 JonSmith: the other thing i wonder about is injection stuff (html/javascript/css)

20:05 powr-toc: miltondsilva: which bit am I looking at?

20:05 JonSmith: sql

20:05 miltondsilva: line 8 and 9

20:05 JonSmith: css = xss

20:05 i wonder if you can inject into css

20:06 google seems to say yes

20:07 powr-toc: miltondsilva: your *'s are different

20:08 oh no wait... that's just my editor

20:08 lancepantz: if i do something like (def foo {:a (+ 1 1) :b (+ 2 (+ 1 1))}) does the first (+ 1 1) get memoized?

20:10 JonSmith: it gets evaluated i think

20:10 although it is a kind of roundabout way of saying 2

20:10 powr-toc: miltondsilva: hard to see without a minimal example and a definition of const-path

20:11 lancepantz: ofcourse, using it as an example of a more expensive function

20:12 miltondsilva: powr-toc: shouldn't that just work? I mean it's pretty standart use of map right?

20:12 JonSmith: if you did (defn foo [] {:a (+ 1 1) :b (+ 1 1)}) JIT might figure it out.

20:12 well it gets evaluated if you are using def

20:12 clojurebot: defmulti doc is ugly

20:13 powr-toc: miltondsilva: are you intending to rebind maze?

20:13 JonSmith: so it evaluates the map and its components once

20:13 sattvik: remleduff: I imagine your best bet is to use something like compojure to create a Java web app, and then you can use the declarative security provided by Java EE to enforce the security you want to set up. How the actual user database is stored depends on what servlet container you use, i.e. Jetty, Tomcat, Glassfish, etc.

20:14 miltondsilva: powr-toc: no, line 9 is there only for demo

20:18 powr-toc: miltondsilva: that should be allowed... I've pasted a smaller example.. are you sure the error is what you think?

20:19 miltondsilva: powr-toc: forget it... the prob is the both return diferente mazes (one with more nests)

20:19 powr-toc: forget it... the prob is that both return diferent mazes (one with more nests)

20:19 powr-toc: miltondsilva: yeah... clojure stacktraces are hard to interpret

20:23 technomancy: rather than setting swank-clojure-classpath to a list of strings for each jar in ~/.swank-clojure would you not be better using a classpath wildcard of \"~/.swank-clojure/*\" ?

20:24 technomancy: actually scratch that if you want to support java 1.5

20:29 remleduff: nDuff: Are you still around? Could you please do "ng ng-cp" for me and tell me if the source root for your project is in nailgun's classpath?

20:30 Or anyone who has a working vimclojure, could type that and tell me if they wanted to. ;)

20:30 technomancy: remleduff: if you're using leiningen to launch the ng server you can't trust (System/getProperty "java.class.path")

20:30 that will give you the leiningen classpath, not the project one. you want the user/*classpath* var

20:31 remleduff: Hmm, ok

20:32 Do you know offhand how to connect to the ng server and ask for that var? ;)

20:32 technomancy: maybe "ng clojure.main" to get the repl?

20:32 I haven't actually used the ng lein plugin, I've only used it standalone

20:33 remleduff: That sounds great if it works, I'm still trying various things, but they seem to be hanging instead of doing things :)

20:36 powr-toc: technomancy: I've symlinked clojure 1.2.0 jars into ~/.swank-clojure but it M-x slime now says clojure is not installed

20:38 ahh it's ok, running (setq swank-clojure-classpath (swank-clojure-default-classpath)) seems to fix it

20:38 remleduff: Oh, wow, "ng clojure.main" actually works, but the repl ends up on the standard output of the nailgun process

20:42 technomancy: If the *classpath* var doesn't exist, what does that mean?

20:44 Maybe the repl itself is running in lein's classpath rather than the project's?

20:49 demolithion: hmm does paredit break the F keys for anyone else or is it just me?

20:55 seths: I'm still afraid of paredit (shame on me)

21:04 progski: Is anyone else having trouble running the dev lein (1.2.0-SNAPSHOT)? I'm getting java.lang.VerifyError: class clojure.contrib.with_ns$loading__4759__auto____4765 overrides final method meta.()Lclojure/lang/IPersistentMap

21:05 hiredman: most liekly your contrib and clojure are out of sync

21:05 progski: It's pulling both from maven

21:06 clojure-1.2.0-master-20100301.140114-13.jar

21:06 clojure-contrib-1.2.0-SNAPSHOT.jar

21:07 hiredman: *shrug*

22:38 remleduff: Are the instructions for creating a new leiningen task from http://nakkaya.com/2010/02/ supposed to work still?

23:08 tomoj: hmm

23:08 the latest developments in swank+clojure, do they mean that we could now possibly call emacs functions from clojure?

23:08 so you could for example set up an emacs-server, then manipulate it with clojure

23:25 mabes: is it possible to override the constructors generated automatically with deftype?

23:28 tomoj: I don't think so, but you could define your own :(

23:28 maybe there is a way I don't know about

23:28 in the days of structs, I adopted hiredman's suggestion of <foo> for a constructor

23:29 or maybe it was <foo> for the struct name, I dunno

23:29 anyway, that could be used for deftypes, but it's not pretty

23:30 mabes: Yeah.. I ran across this post where he wrapped the deftype method in a factory function: http://blogs.foognostic.net/2010/01/wrapping-deftype-factory-methods/

23:31 I may do that

23:32 tomoj: hmm

23:33 we can't do that with a macro, can we

23:33 guess it doesn't matter much

23:37 mabes: you could probably use compjure's decorate function

23:41 tomoj: can you decorate a macro?

23:42 psykotic: yet another expression threader:

23:42 http://gist.github.com/328830

23:44 tomoj: psykotic: wacky!

23:53 remleduff: I think rhickey is going to use >> and << for cells, isn't he?

23:59 rads: is there a preferred line length for doc strings?

Logging service provided by n01se.net