#clojure logs

2010-03-10

00:05nteonis there a way to programmatically add type hints?
00:05nteonsay, in macros?
00:05psykoticwith-meta
00:06psykotic,(meta #^Integer 'foo)
00:06clojurebotnil
00:06nteonpsykotic: sweet, thanks
00:07psykotichmm
00:09tomojhmm indeed
00:10psykoticthinking about it more, it must do something funky for type hints on arguments
00:11psykoticit can't attach it to the symbol since that may be referenced outside of the original scope of definition, yet with no relationship
00:11dnolenhmm how do you get an agent add-watch fn to print to the REPL?
00:12psykoticnteon: 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
00:12psykotic(original page appears down)
00:15nteonpsykotic: nice confirmation, thats what I was testing at the repl :)
00:31slyphonhow do you generate javadoc-like docs for cloure?
00:31slyphonclojure, even
00:34tomojslyphon: seen http://tomfaulhaber.github.com/autodoc/ already?
00:35slyphonnope
00:35slyphonah, bingo
00:35tomojwasn't sure whether that is "javadoc-like" enough for you
00:35dakroneslyphon: or http://github.com/mmcgrana/clj-doc
00:35slyphontomoj: anything like the core docs
00:36slyphoni just want to generate some apidocs for compojure
00:36tomojthe core docs are generated with autodoc I believe
00:38joshua-choiOh wow, I didn't know that autodoc existed
00:38joshua-choiExcellent; Markdown support is a planned feature
00:40defnHow do I select a range of values from a lazy-seq
00:40defnlike the values nth to nth + 100
00:43replaca_,(take 100 (drop 50 (map #(* % %) (range 10000))))
00:43clojurebot(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
00:43replaca_defn: like that
00:43defncool, thank you
00:44replaca_np
00:44defnim doing diffie-hellman in clojure :)
00:44replaca_wow, interesting
00:45replaca_joshua-choi, slyphon: let me know if you have any Q's re: autodoc. I'm the author
00:45slyphonoh, thanks
00:46slyphonyeah, i'm trying to figure out why it's having trouble finding classes for compojure
00:46slyphoni'm pretty sure i'm just doing something wrong
00:48joshua-choireplaca_: 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?
00:57schizmif I get contrib-clojure as per this link: http://riddell.us/tutorial/clojure/clojure.html
00:57schizmit doesn't have a build.xml file so 'ant' cannot execute on it
00:57hiredmanclojure contrib in git has switched to using maven
00:58hiredmanthere should be build instructions in the readme, I guess
00:58schizmgreat
00:58hiredmanwhy can't you just grab a jar?
00:58slyphon"Door is ajar. Door is ajar." "Why would they put a jar on a car?"
00:59schizmi don't know, I'm just folllowing the instructions on the first good looking google return to "Clojure on Ubuntu"
00:59schizmI tend to prefer compiling things from source
00:59schizmit's not usually this hard ;)
00:59schizmand of course...this maven thing isn't in ubuntu's repository
00:59slyphonisn't it just "mvn clean install"
00:59schizmwhy have two different compile systems for clojure and clojure-contrib...seriously
00:59slyphonschizm: java and linux have a hate hate relationship
01:00schizmya, well so apparently do windows and clojure tools (vimclojure, etc) :P
01:00slyphonhah "windows"
01:01psykoticis there an easy way to install a custom printer (e.g. by rebinding) for slime, inferior-lisp, etc?
01:01schizmslyphon: hm?
01:01psykoticit'd be nice to have something that's smarter about infinite seqs
01:01schizmk maven is happily downloading stuff in clojure-contrib
01:02psykotici.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.
01:02schizmi still don't get the reasoning behind two diff compiler drivers for the two base packages
01:02schizmseems...poor?
01:03hiredmanit doesn't matter, because you can just grab a jar
01:03slyphoni guess most people are just happy with the jars
01:03hiredmanthey aren't going to compile any different on your machine
01:03hiredmanjava bytecode is java bytecode
01:03slyphonhiredman: what about --funroll-loops?!
01:03schizm'the poor compiler driver choice doesn't matter because you can grab a jar' <-- surely you realize how that sounds?
01:03schizmbut sure
01:03hiredmanno
01:03schizm:)
01:03slyphoni'd take that a little more seriously if you didn't call it a "compiler driver"
01:04schizmbuild system
01:04schizmwhatever you want to refer to it as
01:04hiredmanschizm: please don't put quotes around things I did not say
01:04schizmnant, ant, maven, make
01:04hiredmanI didn't say it did not matter
01:04schizm<hiredman> it doesn't matter
01:05schizmanyhow, I'm cranky cause I've spent 3 hours fighting with vimclojure, windows, java, and clojure...I should go to bed :)
01:05schizmI'd just hoped it wasn't quite this painful I guess
01:05hiredmanit isn't
01:05hiredmanif you just grab the jar
01:05hiredmanbecause the class files are exactly the same
01:06schizmI had the jars, vimclojure had issues with them on windows
01:06schizmetc
01:06schizmso i just fired up one of my ubuntu boxes and trying it there now
01:06schizmanyways, sleep for me, fresh start tomorrow
01:06schizmnite
01:06hiredmanI would talk to the vimclojure guy then
01:15replaca_joshua, did you go?
02:02konrhas 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?
02:08LauJensenkonr, I think I've seen 2 Clojure-Twitter apps, try searching Github for Twidoop
02:09konrfound it! Thanks
02:28RaynesThe number you got is your API token. When the user authorizes your application, the user will supply the access token.
02:28RaynesIIRC.
02:28Rayneskonr: The README for clj-oauth is sufficient on Github.
02:43zmilahow works :test metadata key in defn? when this fn is invoked?
02:44hiredman,(doc test)
02:44clojurebot"([v]); test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception"
02:45tomojam I the only one that finds the clojure website difficult to navigate
02:45zmilai read the doc, but it's unclear when the fn is invoked. is it invoked automatically?
02:45wbruceExcuse 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
02:45zmilatomoj - not you the only :)
02:46wbruce(ie, lets say I have a map with maps as values -- add a key/val to one of the internal maps)
02:46tomojwbruce: you could use update-in
02:46zmilawbruce - assoc new value (new map) at prev key
02:47zmilayes! update-in works on several levels
02:47wbruceahhh
02:47chouserzmila: (test (var foo)) will call the :test fn set in the metadata of foo
02:47wbrucethanks; I'll poke around with that!
02:48tomoj,(let [m (ref {:foo {:bar 3}})] (dosync (alter m update-in [:foo :bar] inc)))
02:48clojurebotExecution Timed Out
02:48tomojodd
02:48tomoj,(dosync (let [m (ref {:foo {:bar 3}})] (alter m update-in [:foo :bar] inc)))
02:48clojurebotExecution Timed Out
02:49wbruceI get the idea though
02:49wbrucethat makes sense
02:50wbruceso, I could "conj {key val}" to a map, for instance
02:51tomojhuh, strange
02:51tomojI never new you could conj maps
02:51tomojdoes it just act like merge?
02:51chouseryou can conj onto any persistent collection
02:52wbruceyeah, and will override the existing key
02:52chouser,(conj {} [:a 1] [:b 2])
02:52clojurebotExecution Timed Out
02:52tomojsweet
02:52tomojthat seems useful
02:52wbruceI think clojurebot is out of cycles ;-)
02:52zmilathanks, chouser! now I put meta in the right place and the :test is working
02:52tomojdon't have to step through maps to merge
02:52tomojoh, merge works anyway.. ???
02:53tomoj(merge {:foo 3} [:bar 4])
03:11hiredmanhmm
03:11hiredmanI wonder if the new de-fang code is at fault
03:20wbruceIs there something similar to update-in that, instead of updating a value, just returns it?
03:20wbruceie, get a value from a deep data structure
03:20tomoj(doc get-in)
03:20clojurebot"([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys"
03:20wbruceaha!
03:20wbrucetomoj: thanks :-)
03:21hiredman,(conj {} [:a 1] [:b 2])
03:21clojurebot{:b 2, :a 1}
03:22hiredman,(let [m (ref {:foo {:bar 3}})] (dosync (alter m update-in [:foo :bar] inc)))
03:22clojurebot{:foo {:bar 4}}
03:23hiredmanclojurebot: sleep?
03:23clojurebotHuh?
03:57gkoHello
03:57clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline gko
05:41ttmrichterStupid question: how difficult/easy would it be to incorporate JLine into clojure to give command line editing ability under Linux?
05:45ChousukeI think if you use leiningen to start your repl you get that automatically.
06:13ttmrichterChousuke: Leiningen being?
06:15Chousukea clojure build system. it can start a repl for you
06:15ChousukeI often use it instead of a clj script :P
06:15psykoticthe getting started page also has an invocation example of how to use jline
06:55Licenser_aloa
07:26Hali_303hi! how to do a for comprehension in a way that inside the body I've got both the collection item and its index available?
07:31vy,(partition 2 (interleave (iterate inc 0) '(a b c)))
07:31clojurebot((0 a) (1 b) (2 c))
07:32vy,(zipmap (iterate inc 0) '(a b c))
07:32clojurebot{2 c, 1 b, 0 a}
07:49AWizzArdHali_303: you can also use indexed from clojure.contrib.seq
07:49AWizzArd,(indexed [10 20 30 40])
07:49clojurebotjava.lang.Exception: Unable to resolve symbol: indexed in this context
07:49AWizzArd,(clojure.contrib.indexed [10 20 30 40])
07:49clojurebotjava.lang.ClassNotFoundException: clojure.contrib.indexed
07:50Hali_303AWizzArd: thanks!
07:50AWizzArd,(clojure.contrib.seq/indexed [10 20 30 40])
07:50clojurebotjava.lang.ClassNotFoundException: clojure.contrib.seq
07:50AWizzArdokay, the bot did not require it
07:50AWizzArdAnyway (seq/indexed [10 20 30 40]) ==> ([0 10] [1 20] [2 30] [3 40])
07:50AWizzArdafter a (require '[clojure.contrib.seq :as seq])
08:27dsopI'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))
08:27dsops,by,but,
08:27dsopso that I can generate sum-x for some x somewhere in the code
08:28chouser(partial sum 2) will return a new function
08:28dsopthanks
08:28dsopshould have searched better, the name of the funciton is quite obviouse
08:34chousernot a problem
08:35fliebelWow, it's been a while since I did Clojure. How is Clojure doing?
08:36chouserif people only asked questions that weren't documented, this would be a quiet lonely place.
08:37dnolenfliebel: hullo, pretty good I'd say :)
08:38chouserfliebel: 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!
08:39fliebelOh 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...
08:40fliebelhttp://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns Yay, Clojure rocks!
08:46fliebelHas anyone seen defn lately?
08:48chouser~seen defn
08:48clojurebotdefn was last seen in #clojure, 483 minutes ago saying: im doing diffie-hellman in clojure :)
08:48foguschouser: You might change your mind about Clojure being as cute as a button after seeing this: http://tinyurl.com/ylxdz77
08:51fliebelYou 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?
08:52chouserfogus: ooh, cool!
08:52cemerickcgrand: ping?
08:52foguschouser: About half way through I talk smack about the co-author though... oh wait
08:53cemerickfliebel: yes, people have done it, though jokingly of course.
08:54cgrandcemerick: pong!
08:56cemerickcgrand: nevermind, almost. :-) &nbsp;'s seem to get swallowed, but &#160;'s come through ok (as &nbsp;'s, oddly enough)
08:57dnolenquestion, so if send/await is considered bad form, what's the best approach to consume the work done by by an agent?
08:58vyWith the work/job, pass a closure that will submit the result to your specific working queue when it is done?
08:59dnolenvy: so do people tend to use the Java concurrent queues for this? (I'm a concurrency noob)
08:59AWizzArddnolen: you can use a java.util.concurrent.ArrayBlockingQueue
09:00vydnolen: No, that's what I tend to use.
09:01AWizzArddnolen: 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.
09:01dnolenAWizzard: but that will block the main thread right?
09:03chouserdnolen: yes, if you want a work queue, use a work queue not agents
09:03chouseragents are best for identities that have different values over time
09:06dnolenchouser: thx, that was my mental block. just don't use agents for what I'm describing.
09:06cgrandcemerick: I guess it's a pb with xml-resource (are you using it?)
09:06AWizzArddnolen: 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.
09:06cgrandbut I'm surprised by &nbsp; being output. Are you using a custom emit*?
09:07cemerickcgrand: yeah, we're using xml-resource. No, whatever defaults defsnippet is using.
09:07cemerickI 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
09:09chouserfogus: nice interview. well done!
09:10foguschouser: Thank you
09:54arohnerwhat'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
09:55tjgWhere's fogus's interview? I haven't seen it on disclojure.org or my other usual haunts...
09:56chouserhttp://rubylearning.com/blog/
09:57tjgchouser: Thanks!
09:58arohnerapparently for contrib it's [org.clojure/clojure-contrib "1.2-SNAPSHOT"], but for clojure it's [org.clojure/clojure "1.2-master-SNAPSHOT"]
10:06sh10151A Java API I am using expects a PrintStream, but *err* is a PrintWriter.
10:07sh10151It 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:08sh10151like (proxy [PrintStream] [writer] (delegate writer)) or something, where that creates a bunch of methods (print [x] (.print writer x)) and whatnot?
10:08chouserhm. I assume it's actually using System/out ?
10:08sh10151the default uses System.err but I don't want System.err, but *err*
10:08chouserer, System/err
10:09sh10151yeah
10:09chouserso ... you're changing the value of System/err?
10:09sh10151no, I'm setting the errorOutput of an object
10:09sh10151System/err can be the same
10:09sh10151but this class defaults to System/err while allowing people to set other outputs
10:09chouserah
10:10chouserand you're trying to pass in *err*, but that's the wrong type
10:10sh10151precisely
10:11sh10151I think in this particular aspect I can cheat and only define println
10:11sh10151but it seems like shortcutting a proxy with compatible method names but incompatible types might be useful
10:12sh10151maybe not though, since this is just a Sun screwup anyway :)
10:12chouserI'm a bit surprised there isn't already a class to adapt those together.
10:13sh10151commons-io might have one, but I don't want to use it
10:14sh10151actually it doesn't look as though it does
10:16neotykHi *
10:17neotykhow would one provide clojure map backed by java map?
10:18chouserneotyk: clojure maps *are* java maps
10:19chouser,(instance? java.util.Map {:a 1})
10:19clojurebottrue
10:19neotykvery nice
10:20The-Kennyneotyk: 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:21neotykThe-Kenny: it is really great
10:23savanniMorning, 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:24stuartsierraneotyk: but Clojure maps don't implement the mutable methods of java.util.Map
10:24neotykmy usage is not mutable
10:24stuartsierrathen you're good
10:25neotykonce headers are read they don't change
10:25neotykjust want to expose them to users with nice clojure map
10:25neotyk:)
10:25savanniThe 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:26chousersavanni: you generally have to work pretty hard to get work sent to another proces
10:26chouserotherwise, 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:27astoddardAre 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:27savanniIt 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:28chouserastoddard: they already are. 'into' for example uses transients
10:30miltondsilvaHow can I bench individual fns
10:30miltondsilva?
10:31miltondsilvaI tried time but with lazyseqs it's hard to understand where that time is actually spent
10:31sh10151this feels a little wrong: (proxy [PrintStream] [System/err]
10:31sh10151 (println [x] (binding [*out* *err*] (println x))))
10:47mattreplsh10151: is that from something related to a repl in Emacs or such?
10:54defnmiltondsilva: maybe use time in the body of your lazy-seq?
10:57astoddardchouser: Could you give me a link to the source where into uses transients, I'm failing to see it.
10:58Licenser_huzza the sandbox is sandboxing!
10:58defnastoddard: are you using emacs?
10:59astoddarddefn: yes
10:59defn1.1.0?
10:59defnslime?
10:59clojurebotslime-installer is http://github.com/technomancy/clojure-mode/blob/0f28b61de90ce8a09d75bf1668ef3f1c200f9c52/clojure-mode.el#L560
10:59defnif so -- type into into your repl and then hit M-.
10:59defnit'll take you to the into definition which contains transients and persistents and all that good stuff
11:00defnto get back just hit M-,
11:00defn,source into
11:00clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
11:00defn,help
11:00clojurebotjava.lang.Exception: Unable to resolve symbol: help in this context
11:00defnerr
11:01defnclojurebot: source into
11:02chouserI 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:02defnerr that link takes you to the wrong point in that source file, and doesn't...
11:02defnwhat chouser said
11:03defnthere are two definitions of into
11:04astoddard:Thanks defn: My confusion came from the double definition. Thanks for the pointers on slime and clojurebot functionality too.
11:06astoddardSo if transients are in use, wouldn't it make sense to use them in zipmap?
11:07astoddardOr is it only performant for big data?
11:08chouserthere 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:08chouseras in, nobody has gotten around to writing the patches.
11:08chouserof 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:09defnwait wha? chunked seqs going away?? they just got here!
11:09chouser:-)
11:09defni dont know nearly enough about how they work
11:09defnbut why are they potentially leaving us?
11:09Chousukedefn: apparently Rich has a better idea for "virtual seqs" using cells
11:10Chousukeor something like that anyway
11:10defnahh yes, all that cell discussion that one day
11:10defnwith the sentries and such?
11:10Chousukeyes
11:10AWizzArdBtw, would the new seqs work one-by-one when using map, that is: not in chunks of 32 elements?
11:10ChousukeAWizzArd: yes.
11:11rhickeydefn: cells can definitely remove the overhead of laziness as well as, or better than, chunks can
11:11defnrhickey: interesting. im excited to see it
11:11rhickeythat leaves the remaining appeal of chunks the as-yet-unrealized potential of mapping to chunked ops
11:12astoddardchouser: Even if the transient api changes it is probably worth making the patches to highlight where transient can apply.
11:12rhickeyi.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:13defni really wish i didn't work nights so I could have some sort of meaningful discussion at this hour...
11:13somniumcurious: why are unquote and unquote-splicing declared at the top of core but never defined?
11:13chouserrhickey: cells could potentially apply functions that could perform on primitive values, right? chunking + could still beat that performance?
11:14Chousukesomnium: ~ and ~@ expand to them when outside `
11:15rhickeychouser: 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:15somniumChousuke: I'm aware, but that functionality is kind of encapsulated in the reader, no?
11:15defnAre transients going to be applied across all of core (where it makes sense) for 1.2.0?
11:16rhickeydefn: that's not a priority at this point
11:17Chousukesomnium: some time in the future they might get proper definitions
11:17Chousukesomnium: right now, they're just placeholders there and you can in theory use them in your own macros
11:17astoddardrhickey: would patches to apply transients be welcome or a nuisance?
11:17chousersomnium: you can take advantage of ~ and ~@ in your own DSLs
11:18astoddard(I feel like an unwashed heathen even contemplating submitting a patch to core...)
11:19ChousukeI tried to implement syntax-quote as a macro once but it failed quite miserably :(
11:19rhickeyastoddard: 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:19ChousukeIt's a lot easier as a reader trick. :P
11:19somniumrats, was hoping to see a clojuresque implementation
11:20ChousukeI do still have it as part of my now somewhat outdated reader
11:20Licenser_hmm will clojures performance be impoacted if you have may namespaces?
11:21astoddardrhickey: 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:21Chousukehm, my clojure clone has way too many branches
11:22Chousukethat is, 20
11:24dullardHi 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:27chousermini.clj is yours?
11:27chouserer, midi.clj?
11:28defnim guessing midi
11:28defnlol nevermind, sorry
11:28defndullard: i have overtone in my src/ let me check that out
11:28dnolendullard: seems weird since that is a standard Java class. Which JDK are you running? OpenJDK?
11:28dullardsun java6
11:29dullardthe source kinda looks good as far as I can tell
11:29defnim on that mailing list and havent seen anything
11:29defnall i can imagine is it's a karmic thing
11:29sattvikHmm.. I think the midi.clj is missing an import of java.util.concurrent.ScheduledThreadPoolExecutor
11:30defni cant even find midi.clj in my source, maybe im out of date
11:32sattvikJust browsing overtone's source on github, it seems like it links to midi.clj from the lib directory.
11:34defnam i out of my mind? i dont see it
11:34defni see midi-clj but that dir is empty
11:35defnoh duh
11:35defnmissing some git steps :X
11:38defndullard: sorry im having some build trouble on OSX
11:38dullardthat's ok
11:38defnit is complaining about invalid POMs for nailgun
11:40sattvikWell, 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:40dullardI tried that!
11:41dullardmaybe I don't get this lein business
11:43sattvikIf you're using lein, I am guessing it is probably downloading a JAR file that has a buggy midi.clj.
11:45Licenser_hmmm is there a way to def a symbol in another namespace?
11:45dullardI 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:46dullardhmmm... maybe not!
11:47dullarddifferent error tho: java.lang.Exception: Unable to resolve symbol: NUM-PLAYER-THREADS in this context (midi.clj:18)
11:47dnolendullard: lein always copies .jars into your project lib folder (when you run "lein deps")
11:48dullardso the ~/.m2 dir is a cache of dependencies?
11:49dullardwhen I run "lein deps" it says it's downloading midi-clj
11:51defndullard: you can edit the japroject.clj
11:51defnproject.clj
11:52defnand change the [midi-clj "x.x.x"] line to another version
11:52defnsee: http://www.clojars.org/repo
11:52defnor http://clojars.org/search?q=midi
11:52defnalthough judging by the version number that looks pretty old
11:52fliebelHey defn, how are you doing?
11:53defnit's going well! how are you?
11:53dullardI think that's the only version
11:53fliebel*remembered utterson when seeing defn in irc* ;)
11:53defnhaha
11:54dullardI need to convince lein to use my local version instead of downloading it
11:54sattvikdullard: 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:54defndullard: you can just manually replace the jar with your version and dont run lein deps
11:54dullardok, nice one
11:55defnfliebel: i was looking over your code -- did you write lisp before clojure
11:55fliebeldefn: No...
11:55defni thought your code looked good
11:56fliebelThanks :)
11:57defnwhere 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:57defnthere has always been something left to be desired imo when it comes to static site gens
11:58fliebelWhat 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:59defnhaha, yes, my ~/git/ dir just keeps filling up with these silly little names like "djirk" some irc bot meets nlp processor lol
11:59defner nat. lang. processing
12:00fliebelI 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:00defnfliebel: im actually about to do a rewrite of my blog in clojure
12:00defnit would be nice to build my own tools in clojure
12:01defnin combination with enlive, maybe
12:01fliebelSo you still intend to finish Utterson someday? What is enlive?
12:01defngive some cool templating capabilities with a macro or two maybe
12:01defnit's an html parser/generator
12:02defn(written in clojure)
12:02defnhttp://github.com/cgrand/enlive
12:02fliebelah, that one :)
12:02fliebelYea, sounds sweet
12:03defnthe clojure ecosystem has grown quite a bit it seems in the last few months
12:03defnso it could be neat to use some of the new up and comers
12:04dullardooh, progress - had to add (java.util.concurrent TimeUnit) too
12:04defnfliebel: ive always imagined a static site generator working like: /intelligently/ generate a layout based on user params
12:05defnfliebel: ive always been somewhat upset that site generators just fill every inch of your directory structure with fils already filled out for you
12:05fliebelThat sounds interesting.
12:05defni think it makes more sense to give some initial design choices in the generation of the initial template
12:06defnlike hex colors, background colors, some css stuff you could do up front
12:06fliebelI don't follow you...
12:07ChousukeI started with history where I wrote my syntax-quote implementation before I started the reader itself.
12:07Chousukenow I have history where that sequence of events is reversed.
12:07dullardfantastic thanks sattvik, defn I've got it working. That was most informative and instructive
12:10defnfliebel: something like script.sh/create-layout.clj application --background #000000 --sidebar #000000 --text #123456 --rss --github --layout two-column
12:10defnetc. etc. etc.
12:10fliebelah...
12:10defnim getting so ahead of myself but
12:11defnit'd be really cool to have a "design your blog" webpage where you could actually preview what your page would look like
12:11defnand then it would generate your configuration options for you
12:11fliebelI've some other things to do now, but send me a message when you want to do something with this stuff, okay?
12:12defnyeah i definitely will -- i had another project going on, but this is on my priority list :)
12:13fliebelOk, see you
12:13defnbye pepijn
12:15duncanm(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:15duncanmor should i be using :while?
12:15ulfster:when is correct
12:16ulfster:while would stop with the first zero pixel
12:16defnwhat's up with the binding? range x (range width) ?
12:16defnwouldn't that bind x to range, and (range width) to y?
12:17duncanmoh
12:17duncanmi meant (for [x (range width) y (range height) ...])
12:17defnah
12:19defnduncanm: i think that looks right
12:29duncanmdefn: somehow it's stuck and doesn't return anything
12:29duncanmi dunno how to debug a for expression
12:32duncanmi guess get-pixel is slow... sigh
12:39technomancyany chance we could get http://www.assembla.com/spaces/clojure/tickets/246 applied?
12:40technomancyrich 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:45duncanmis there a parallel for?
12:45duncanmdefn: i'm just gathering points, right? the whole thing can be done in parallel, there are no side-effects
12:47technomancy(doc pmap)
12:47clojurebot"([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:47dakronehuh? clojurebot doesn't require ^, anymore?
12:58hiredmandakrone: notfor doc lookup
12:58dakroneoh okay
12:58dakroneneat
12:59hiredmanoh, and math
12:59hiredman(+ 5 5)
12:59clojurebot*suffusion of yellow*
12:59nteonhah
12:59dakronewow, did not know 10 == suffusion of yellow
12:59dakronenow I do
12:59dakrone:)
13:00rsynnottdakrone: http://www.urbandictionary.com/define.php?term=A%20Suffusion%20of%20Yellow
13:01dakronehah, that's awesome
13:01sh10151(- 4 1)
13:01clojurebot3
13:01sh10151(- 4 0)
13:01clojurebot4
13:01sh10151(- 5 0)
13:01clojurebot*suffusion of yellow*
13:01rsynnott(tan 74)
13:02rsynnott(- 4.0 0.25)
13:02rsynnottOoh, it's actually wrong
13:02rsynnottThe offending calculator says 'suffusion of yellow' for any number >= 4
13:02hiredmanI don't think the math regex recognizes decimal points
13:03somniumah, so its really more of an iching emulator
13:03rsynnottwell, yes, but it answered '4' to sh10151
13:04hiredmanI would hardly call urbandictionary a reliable source
13:05dakroneI just cannot figure out an algorithm for this sequence yet, maybe someone has a suggestion:
13:05somniumshould add a starship titanic plugin to the bot
13:06chouserhttp://www.thateden.co.uk/dirk/
13:06dakroneI 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:07The-Kenny(split-with b? ...) ?
13:07drewrsomeone wrote a template function for something similar
13:08sh10151hmm, clojure.contrib/io has the reader method, but no predicate method to say whether reader will succeed
13:09sh10151I should say whether the type of the argument is something that reader knows what to do with
13:09dakroneThe-Kenny: split with doesn't include 'I' in the seq
13:10The-Kennydakrone: ah, I always forget how split-with works..
13:10dakrone,(split-with #(.startsWith % "B") ["B" "I" "B" "B" "I"])
13:10clojurebot[("B") ("I" "B" "B" "I")]
13:10chouserdakrone: maybe start with partition-by in seq-utils
13:10The-Kennydakrone: there's a function to split with a predicate somewhere
13:10dakronechouser: okay, I'll give that a shot, thanks
13:10The-Kennyah, partition-by
13:15duncanmif the top of my profile is invokeMatchingMethod, then I should do some hinting, right?
13:16chouserduncanm: sounds right
13:16fliebelWhat 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:17The-Kennyfliebel: There's a macro for this in contrib.def
13:17The-Kennydefkfn
13:17The-Kenny,(use 'clojure.contrib.def)
13:17clojurebotnil
13:17fliebelThanks
13:17The-Kenny,(doc defkfn)
13:17clojurebotI don't understand.
13:17hiredman(or just use a map)
13:17The-Kenny,(doc defnk)
13:17clojurebot"([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:20fliebelSounds good
13:24wbruceWhat's the easiest way to determine is one set is a complete subset of another?
13:24wbruce*if
13:25The-Kennywbruce: clojure.contrib.set/subset? ?
13:25wbruceah, thanks
13:25duncanmin Java, if i have a List<Double []> how to convert that to a double[][]?
13:27fliebelThis is so frustrating… I forgot everything. What is wrong? (ns test (:use clojure.contrib def))
13:28hiredmanduncanm: loop over the list, loop over the array, insert into array
13:29drewrfliebel: (ns test (:use [clojure.contrib.def :only [defnk ...]]))
13:30fliebelthanks
13:30duncanmhiredman: sigh, yeah, i was hoping the toArray method would help
13:30chouserduncanm: (into-array foo) ...oh wait, in Java?
13:30hiredmanif it was a List<double[]> you could do a row at a time instead of an element at a time
13:34duncanmyeah, that's what i did
13:51dakronewhat'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:52S11001001dakrone: map, re-split, split-at
13:52hiredman,(re-seq #"\w+" "blah blah blah blah blah blah")
13:52clojurebot("blah" "blah" "blah" "blah" "blah" "blah")
13:54hiredman,((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:54clojurebot[("blah" "blah" "blah") ("blah") ("blah" "blah")]
13:55dakroneack, that works but I'm not sure I understand it all
13:57chouser(defn split-at* [[v & vs] s] (if-not v (list s) (cons (take v s) (split-at* vs (drop v s)))))
13:57hiredmanwell you woudn't want it together like that
13:57dakroneahh crap, I described it wrong
13:57dakroneI have [3 1 2] and ["blah" "blah" "blah" "blah" "blah" "blah"]
13:57hiredman((make-pull-aparter [3 1 2]) ["blah" "blah" "blah" "blah" "blah" "blah"])
13:58dakroneand need the sequence split into the numbers in the first sequence
13:58chouser(split-at* [2 1 3] (range 10)) ;=> ((0 1) (2) (3 4 5) (6 7 8 9))
13:59dakronechouser: that works great, thanks!
14:29fliebelI 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:31fliebelLike… I need to match {:foo "bar"} with {:foo string?} but not with {:bar string?} or {:foo number?}
14:35chouser,(reify clojure.lang.IMeta (meta [] {:a 1}))
14:35clojurebotjava.lang.Exception: Unable to resolve symbol: reify in this context
14:35chouseroh. my.
15:23crowbar7so, with clojurebot do his factoids go through a http server?
15:24hiredmanno
15:25hiredmanbut there is a sort of rough start of an interface for looking up stuff in clojurebot's database using http and json
15:30wbruceWhat'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:31chouserwbruce: what you've got is best if you want a linear scan of coll
15:31chouserif you want a fast lookup, use an appropriate type of coll and 'contains?'
15:32wbruceJust as a predicate, stuff like (if (seq (some foo bar)) true-body false-body) seems like far too much
15:32chouser,(contains? :b {:a 1, :b 2, :c 3})
15:32clojurebotfalse
15:32wbruceah, k; think that's what I was looking for
15:32radswhat's the best way to serialize dates in java/clojure?
15:33chouser,(contains? {:a 1, :b 2, :c 3} :b)
15:33clojurebottrue
15:33chouserah, that's better.
15:33chouserwbruce: you're looking up keys in a map?
15:33wbrucethat and elements in sets and vectors
15:33wbruceso this works
15:34chouserwon't work for elements in vectors
15:34wbrucethe only time it wouldn't, looks like, is values in a map
15:34wbruce,(contains? [1 2] 1)
15:34clojurebottrue
15:34chouser,(contains? [:a :b] :a)
15:34clojurebotfalse
15:34rads.setTimeInMillis?
15:35wbrucehmm
15:35wbrucehow does that work?
15:35chouserwbruce: 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:35chouser(doc contains?)
15:35clojurebot"([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:41wbruceah, ok
15:42wbrucethe indexed collection part was the bit that tripped me up thinking it worked for vectors
15:42wbrucethanks
15:42hiredmanit does
15:42hiredman,(contains? [10 11 12] 0)
15:42clojurebottrue
15:43wbruceright, if I'm checking for an index
15:43wbrucebut not a value
15:43wbruces/worked/worked as I expected/
15:43chouser,(keys [:a :b :c])
15:43clojurebotclojure.lang.Keyword cannot be cast to java.util.Map$Entry
15:43chouserawww
15:44crowbar7hiredman: ohh ok, thats neat
15:44wbruceso, 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:44arohneris there a place to browse the clojure-contrib API docs, like the clojure API docs?
15:45chouserwbruce: not sure why you keep wrapping seq around some
15:45arohnerI found this, but github won't serve me html http://github.com/richhickey/clojure-contrib/blob/gh-pages/index.html
15:45chouserwbruce: but otherwise, yes that's the general idea. You can use .contains if you must.
15:46chouserarohner: http://richhickey.github.com/clojure-contrib/
15:46chouser,(.contains [:a :b] :b)
15:46clojurebottrue
15:46arohnerchouser: thanks
15:50wbrucechouser: I think it was b/c (seq coll) is nil if the coll is empty
15:50wbruceI'm probably looking for something akin to empty? for collections (for use with 'some')
15:51hiredmanuh
15:51hiredmanand what about empty?
15:51wbruceum, yeah. that would be helpful
15:52wbrucebecuase, hiredman, I like to make things more difficult for myself and waste your time ;-)
15:53wbruceok, I'm going to go spend some quality time with the docs and leave you guys alone for a bit.
16:04chouserdoes anyone know if there's a way to serve cached or static content from appengine without hitting the startup delay?
16:14nedchouser: take a look at nailgun maybe?
16:16hiredmanned: for appengine?
16:27chousernevermind. not worth it for now.
16:41arohnerchouser: 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:45chouserperhaps (let [anode (xml-> mydoc big-path-expr), myattr (xml-> anode (attr foo))] (xml-> anode ...)) ?
16:45arohnerthat sounds like I'm doing it wrong. I thought I couldn't restart a xml-> from the output of a previous call
16:46chouserdepends on how you end the xml-> chain -- you can have it return whatever you want.
16:47chouseractually, xml-> pretty much always returns a seq I think
16:47jcromartieanybody using Lighttpd to proxy a compojure app?
16:47chouserbut the items in it can be whatever.
16:48_atojcromartie: yep
16:48jcromartie_ato: has it been easy to set up/maintain
16:48jcromartie?
16:48jcromartieI like lighttpd's config system
16:48chouserarohner: 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:49arohnerah, 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_atojcromartie: yeah lighttpd's config is nice and simple
16:50chouserarohner: could be. (first (xml-> ...)) is common enough I provided xml1->
16:50_atoI just have something like this to do the proxying: proxy.server = ("" => (("host" => "127.0.0.1", "port" => 8000)))
16:50_atoinside the appropriate conditionals
16:52arohnerchouser: that works great. thanks
17:00hiredmanhttp://www.thelastcitadel.com/images/syntax.png <-- hah, I didn't know I still had this image
17:07Licenserhiredman: I used some more code from clojurebot for the clj-sandbox project, marked it as yours, I hope that is OK?
17:08hiredmansure
17:08Licenser:) cool, just don't want to steal stuff ^^
17:08hiredmanthere was actually a problem with the de-fang code I gist'ed
17:08hiredmansteal away
17:09hiredmanI'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:09Licenser:P hiredman nah it's only stealing if I don't ask ;)
17:15Licenserso the sandbox is starting to work well :)
17:18cad_austintest
17:19powr-tocnil punning is always bad now, right?
17:20stuartsierrapowr-toc: no, why?
17:22stacktraceris there a way to define a public static field (not method) using gen-class?
17:22cad_austinHello, 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:23powr-tocstuartsierra: did the lazy branch not get merged a while back? Was the trade-off for extra laziness not nil punning?
17:24hiredmanpowr-toc: you can still nil pun, but empty seqeunces are no longer nil
17:24powr-tochiredman: ok... so if the sequence returns nil explicitly then you can pun, otherwise wrap it in seq?
17:24hiredmanright
17:25powr-tochiredman: hmm... might have to review some code tomorrow at work
17:25Licenserhmm I found a very odd behavior of in-ns
17:25hiredmanI don't know that you would even call that puning
17:25powr-tochiredman: true
17:26Knekk,(* 200 100 40 20 4 2)
17:26clojurebot128000000
17:26Licenser(let [ns (ns-name *ns)) (in-ns 'test) (println (ns-name *ns*)) (in-ns ns)) -> does not return to ns
17:28hiredmanLicenser: it does here
17:28Licenserhmm odd
17:29Licenserodd now it does for me too
17:29licoressehow can I run a closure when I have captured it in a var ?
17:29hiredmanuh
17:29licoressewouldn't it be enough to (closure-capture-var) =
17:29licoresse?
17:29Licenserhmm I must have had a typo
17:30hiredmanlicoresse: what are you doing?
17:30licoresse,lisppaste
17:30clojurebotjava.lang.Exception: Unable to resolve symbol: lisppaste in this context
17:30Licenserso 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:30hiredmanwhat do you mean by "captured it in a var"
17:31licoresseok. let me show
17:31hiredmanLicenser: def is a special form and the namespace it uses is captured at compile time, not run time
17:31licoresse(something button (fn [] (. text setText "JAADA")))
17:31Licenserhrm fork :(
17:31licoressecapturing the text
17:32licoresseand sending it to the something function
17:32licoressefor an actionPerformed on ...
17:32hiredmanso you mean closing over the name x
17:32hiredmanso you have a function
17:32licoressehiredman: I think so
17:32hiredmanare you asking how to call functions?
17:33LicenserYou could do something like (let [t "JAADA"] (something button (fn []  (.text setText t)))
17:33licoresseclojurebot: lisppaste
17:33clojurebotlisppaste8: url
17:34LicenserI hink clojure bot is upset because I stole code from him :(
17:34licoresselistpaste8: url
17:34licoresselisppaste8: url
17:34hiredmanlisppaste8 doesn't work because freenode requires you to register your nick before sending to the channel
17:34licoressemy nick is reg.
17:35hiredmanyes, but lisppaste8 is not
17:35licoresseI need my rcirc
17:35Licenserit requires you to register to this channel too
17:35hiredmanLicenser: no
17:35Licenserahh okay
17:35Licensersure?
17:35LicenserI think it did
17:35hiredmanlisppaste8 is just not a registered nick, so the bot is unable to send to the channel
17:35hiredmanif there was an op in here they could voice it
17:36licoresse(defn something [control closure]
17:36licoresse (.addActionListener control
17:36licoresse (proxy [ActionListener] []
17:36licoresse (actionPerformed [e] closure))))
17:36hiredmanwoa
17:36hiredmanthere are plenty of other pastebins in the world
17:37hiredmanlicoresse: closure is a function
17:37licoresseI guess this is not quite right
17:37hiredmanand you want to call the function?
17:37licoresse,(doc closure)
17:37clojurebotIt's greek to me.
17:37Licenserhmm is there any way to def a something within a sepecific namespace?
17:37hiredmanit's a function
17:37licoresseI want to eval it
17:38hiredmanLicenser: http://clojure.org/namespaces
17:38hiredmanlicoresse: why would you want to eval it?
17:38Licenserah cool thank you I'll read that
17:38hiredmanthe fn special form has already created a function
17:38licoressehiredman: because: (something button (fn [] (. text setText "JAADA")))
17:38rhickeylicoresse: to call a function value, just put it in parens with its arguments
17:39licoresseah
17:39licoresserhickey: thanks!
17:39licoresseworks great now
17:39rhickeylicoresse: that's not eval'ing, but applying. eval means evaluating a form (data structure)
17:40licoresserhickey: ok
17:40licoresseI get it
17:41licoresseso if I pass something like '(something in here)
17:41licoresseI need to eval this in order to have something to execute
17:41hiredmanno
17:41licoresseok?
17:41hiredmanevaling will execute it
17:41clojurebotamespaces 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:41cad_austinNever mind, got it.
17:42licoresse,(doc apply)
17:42clojurebot"([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."
17:45rhickeylicoresse: 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:46licoresserhickey: ok, and thanks for all the fun!!
17:48rhickey,(let [f (fn [a b c] [c b a])] [(f 1 2 3) (apply f 1 [2 3])])
17:48clojurebot[[3 2 1] [3 2 1]]
17:48licoressethat makes sense...
18:15licoresselooking for a good example of implementing mouseevent-listeners
18:24licoressefound http://www.solussd.com/2009/11/a-clojure-highlife/
18:26Licensernice :D
18:26Licenser(def sc-add (sc "(+ a b)" 'a 'b)) (sc-add 1 2) ;=> 3
18:26dakronecan someone tell me why I'm getting this exception for a test: http://pastebin.com/TL9KshQQ
18:27dakronerunning the (is ...) without (deftest ...) works fine
18:28hiredmanuh
18:28hiredmanthe test name is a symbol, not a string
18:28hiredman(deftest sentence-splitter …
18:29dakronehiredman: okay, thanks
18:30hiredmanthe casting error about IObj must be some kind of metadata thing
18:40powr-tocwhy oh why do I seem to spend most of my time fighting to install slime/swank/clojure?
18:41powr-tocI have it going at work, but I can't figure out why it's not working at home
18:48technomancypowr-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:48technomancythose cover 90% of swank-related problems
18:48technomancynot that swank doesn't have issues, but installation shouldn't be one of them
18:49powr-toctechnomancy: hey :-) ... 1) Ubuntu 2) Just clojure 3) most likely :-)
18:49powr-toctechnomancy: I always seem to struggle with swank installation
18:50technomancypowr-toc: using package.el?
18:51powr-tocand, 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:51technomancyI'd be more interested in hearing about those since I'm also maintaining package.el
18:52powr-toctechnomancy: 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:53powr-toctechnomancy: Are you about for a bit?
18:53technomancynot a lot of bandwidth, but I'll be online for a while
18:55powr-toctechnomancy: 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:56technomancypowr-toc: cool
18:56technomancypowr-toc: package.el is about to get merged for Emacs 24, so that would be beneficial in the Big Picture
18:57powr-toctechnomancy: Yeah, I'd heard... when is Emacs 24 due out btw?
18:57technomancyit's probably at least a year out
18:57technomancyif you wait for release
18:57technomancybut releases are for wimps. =)
18:57technomancypowr-toc: I'm aware of one bug that affects swank-clojure install actually; it's been fixed in my repo but not pushed
18:57technomancyso if you're bug-hunting, try http://github.com/technomancy/package.el
18:57powr-toctechnomancy: ok, well if you push it to a branch I can try it for you
18:58technomancyerr... I should say it's pushed but not to tromey.com yet.
18:58powr-toctechnomancy: cool
18:59powr-toctechnomancy: oh, btw... I issued a github pull request for you, regarding a gensym issue in swank-clojure
18:59technomancyyeah, it's on my list...
18:59technomancyI am not very up-to-speed on incoming patches =(
19:00powr-toctechnomancy: 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:01technomancynot at all... as long as the end result is better code.
19:01LicenserI really love this passing around functions stuff oyu know that?
19:02powr-tocwell, so long as you feel appreciated! :-)
19:02Licenserhey powr-toc EPIC is my project :P
19:02powr-tocLicenser: which project would that be?
19:02LicenserEPIC :P
19:02Licenserit's called like that ;)
19:05powr-tocLicenser: what's it do?
19:05powr-toctechnomancy: presumably I just throw this onto the load-path then?
19:05Licenserit's an Epic Processor for Intergalactic Combat (hence the name)
19:06technomancypowr-toc: yups
19:07remleduffHi there, is anyone here familiar with getting vimclojure up and running? :)
19:07nDuffremleduff, I've managed to get it going, though "familiar" might be a stretch.
19:08Licensernope sorry not me
19:08nDuffremleduff, ...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:08remleduffWhen 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:09powr-toctechnomancy: ok it's running... what next for swank-clojure etc? M-x package-list-packages?
19:09technomancypowr-toc: yup, then mark swank-clojure and install
19:10nDuffremleduff, that doesn't seem particularly familiar on its face -- but could you paste the actual message, ie. including the filename?
19:10remleduffI'm trying, but vim won't let me copy the error msg :)
19:10powr-toctechnomancy: btw the '?' key binding is bust
19:11nDuffremleduff, try holding down shift while selecting it
19:12technomancypowr-toc: works here; could you turn on toggle-debug-on-error and paste a stacktrace?
19:12remleduffhttp://gist.github.com/328628
19:12powr-tocor rather package-menu-view-commentary returns "Wrong type argument: arrayp, nil"
19:12powr-tocsure hold on...
19:13technomancypowr-toc: actually could you open an issue on package.el in that github project?
19:13powr-tochttp://pastie.org/864238
19:13nDuffremleduff, 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:13powr-toctechnomancy: no probs
19:14technomancythanks
19:14remleduffI 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:14remleduffAnd "why doesn't gradle seem to work"
19:15technomancyremleduff: he's on euro-time IIRC
19:15powr-toctechnomancy: done
19:15powr-toc(the issue that is)
19:16powr-toctechnomancy: what key do you use to mark a package?
19:16technomancypowr-toc: "i"
19:16technomancythen "x" to execute
19:17powr-tocok... lots of warnings etc...
19:17technomancyyeah, those are for the (optional) byte-compilation; don't affect functionality
19:17nDuffremleduff, I _did_ do the contortions to get gradle working for me, and may actually be able to remember them if lucky. :)
19:17powr-toccool... it looks like it's done
19:18technomancypowr-toc: could you also paste the results of C-h v package-archive-contents ?
19:19powr-toctechnomancy: wait up, I rebooted Emacs and it's complaining... probably because of something unrelated (I was evaluating config snippets again)
19:19remleduffOK, 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:19nDuff(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:20nDuffremleduff, right, you need to install the clojuresque plugin to gradle
19:20remleduffAha, missed that, definitely. The readme still only talks about using ant :\
19:21powr-toctechnomancy: any idea what "End of file during parsing" means?
19:22chouserpowr-toc: open-parens that aren't closed
19:22powr-tocchouser: that's what I thought, but I can't see any
19:23powr-tocthere must be one somewhere
19:25remleduffSo is the idea that I clone clojuresque and then "gradle install"?
19:31nDuffremleduff, 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:32powr-tocahh, finally found the guy!
19:33powr-toctechnomancy: where do you want that stuff pasted, alongside the package.el bug or elsewhere?
19:33technomancypowr-toc: with the bug would be fine
19:34powr-toctechnomancy: just the value ok?
19:34technomancysuer
19:34remleduffnDuff: Alright, trying that at the moment, seem to have found a relevent blog post, thanks for the help! :)
19:34powr-tocugh... the formattings screwed up
19:37powr-toctechnomancy: I'll pastie it, and link to it from the bug
19:38Licenserhmm 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:38powr-toctechnomancy: Ok, so if I do M-x slime it wants to download clojure... what if I have it already installed?
19:39powr-tocok downloading clojure
19:40powr-tocwow, who'da thunk it... it worked!!! :-)
19:40technomancypowr-toc: check the readme for the various ways to launch/configure slime
19:40remleduffnDuff: If you have more time, does the classpath for nailgun have to be the project classpath?
19:40technomancyif you don't have it configured to do otherwise, it will download the jars since it would be useless otherwise
19:40powr-toctechnomancy: which README?
19:41technomancypowr-toc: swank-clojure's
19:41remleduffAt the moment, I'm using "lein nailgun"
19:41powr-toctechnomancy: where did emacs put clojure etc?
19:41technomancypowr-toc: ~/.swank-clojure
19:41technomancypowr-toc: but you don't use that normally
19:42technomancyyou'd normally use M-x swank-clojure-project or lein swank
19:42powr-toctechnomancy: what about the sources etc?
19:42technomancywhich sources?
19:42powr-toctechnomancy: for clojure and contrib
19:43technomancypowr-toc: I think the swank readme covers that
19:44powr-toctechnomancy: and where is that? I can't see it in .emacs.d/elpa/swank.../
19:46technomancypowr-toc: that'd be on github
19:47technomancyit's the closest thing to the "swank-clojure website" there is
19:49powr-toctechnomancy: sorry, what I meant about "sources" was just having easy access to the installed versions sources for clojure and clojure-contrib
19:50powr-tochaving this setup scares me a little as the source code could easily be different to what I'm actually running.
19:50technomancypowr-toc: you can set swank-clojure-classpath, but probably what you want is to use M-x swank-clojure-project instead
19:50technomancywhat's the context?
19:51powr-toctechnomancy: I like to read through clojures source code, jump to it from within swank
19:52technomancypowr-toc: for that it'd be easiest to just symlink the jars into ~/.swank-clojure if you want to be particular about versions
19:53technomancymight need to reset swank-clojure-classpath to nil to have it recalculate from the contents of ~/.swank-clojure
19:53technomancythen M-x slime
19:53powr-toctechnomancy: does it handle version numbers on those jars?
19:54powr-tocsilly question sorry
19:54powr-tocI'm guessing it just puts that whole directory on the classpath
19:54technomancyyeah
19:54technomancyhaving 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:55remleduffOK, 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:55powr-tochow does this tie in with leiningen? it seems lien will use a different version of clojure, no?
19:55powr-tocI mean a different install
19:56technomancypowr-toc: leiningen just uses jars in lib/
19:56technomancyso whatever your project is declared to depend on
19:56miltondsilvaI'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:56JonSmithremleduff: for crypto and stuff you could probably use a java library fairly easily
19:57powr-toctechnomancy: of course... which is why you like to use swank-clojure-project
19:57slyphontechnomancy: hey, you're an emacs guy, no?
19:57technomancyslyphon: you could say that
19:57slyphontechnomancy: :)
19:58slyphontechnomancy: well, i don't want to unfairly malign you...
19:58slyphonanyway, what code completion setup do you use?
19:58slyphoni'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:58powr-tocslyphon: I just use paredit with hippie-expand
19:58technomancyslyphon: yeah, hippie-expand here
19:59slyphondo you guys customize hippie-expand at all?
19:59slyphonlike to do slime-fuzzy-complete-* or anything?
19:59powr-tocnope
19:59powr-tocoh wait, yeah I have that one set
19:59hiredmanI use something called autocomplete
19:59slyphonhiredman: that's the one that pops up a little window?
19:59slyphonoverlay, rather
20:00hiredmanyeah
20:00slyphonhiredman: would you mind sharing your .emacs setup code for it?
20:00technomancyslime 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:00hiredmanslyphon: just a second
20:00slyphontechnomancy: *nod*
20:00slyphonhiredman: thanks
20:01remleduffJonSmith: 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:02JonSmithyeah, i think it is sort of a hole that needs to be filled
20:02powr-tocmiltondsilva: that should work
20:02JonSmiththere 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:02miltondsilvaI'll post it in pastebin
20:03miltondsilvamaybe I'm missing something obvious
20:03hiredmanslyphon: http://gist.github.com/328680
20:03slyphonhiredman: thanks!
20:03hiredmanI guess I have hippieexpand too? *shrug*
20:03miltondsilvahttp://pastebin.com/6RZz5s9k
20:04slyphonhiredman: that seems common
20:04miltondsilvapowr-toc: http://pastebin.com/6RZz5s9k
20:04JonSmiththe other thing i wonder about is injection stuff (html/javascript/css)
20:05powr-tocmiltondsilva: which bit am I looking at?
20:05JonSmithsql
20:05miltondsilvaline 8 and 9
20:05JonSmithcss = xss
20:05JonSmithi wonder if you can inject into css
20:06JonSmithgoogle seems to say yes
20:07powr-tocmiltondsilva: your *'s are different
20:08powr-tocoh no wait... that's just my editor
20:08lancepantzif i do something like (def foo {:a (+ 1 1) :b (+ 2 (+ 1 1))}) does the first (+ 1 1) get memoized?
20:10JonSmithit gets evaluated i think
20:10JonSmithalthough it is a kind of roundabout way of saying 2
20:10powr-tocmiltondsilva: hard to see without a minimal example and a definition of const-path
20:11lancepantzofcourse, using it as an example of a more expensive function
20:12miltondsilvapowr-toc: shouldn't that just work? I mean it's pretty standart use of map right?
20:12JonSmithif you did (defn foo [] {:a (+ 1 1) :b (+ 1 1)}) JIT might figure it out.
20:12JonSmithwell it gets evaluated if you are using def
20:12clojurebotdefmulti doc is ugly
20:13powr-tocmiltondsilva: are you intending to rebind maze?
20:13JonSmithso it evaluates the map and its components once
20:13sattvikremleduff: 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:14miltondsilvapowr-toc: no, line 9 is there only for demo
20:18powr-tocmiltondsilva: that should be allowed... I've pasted a smaller example.. are you sure the error is what you think?
20:19miltondsilvapowr-toc: forget it... the prob is the both return diferente mazes (one with more nests)
20:19miltondsilvapowr-toc: forget it... the prob is that both return diferent mazes (one with more nests)
20:19powr-tocmiltondsilva: yeah... clojure stacktraces are hard to interpret
20:23powr-toctechnomancy: 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:24powr-toctechnomancy: actually scratch that if you want to support java 1.5
20:29remleduffnDuff: 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:30remleduffOr anyone who has a working vimclojure, could type that and tell me if they wanted to. ;)
20:30technomancyremleduff: if you're using leiningen to launch the ng server you can't trust (System/getProperty "java.class.path")
20:30technomancythat will give you the leiningen classpath, not the project one. you want the user/*classpath* var
20:31remleduffHmm, ok
20:32remleduffDo you know offhand how to connect to the ng server and ask for that var? ;)
20:32technomancymaybe "ng clojure.main" to get the repl?
20:32technomancyI haven't actually used the ng lein plugin, I've only used it standalone
20:33remleduffThat sounds great if it works, I'm still trying various things, but they seem to be hanging instead of doing things :)
20:36powr-toctechnomancy: I've symlinked clojure 1.2.0 jars into ~/.swank-clojure but it M-x slime now says clojure is not installed
20:38powr-tocahh it's ok, running (setq swank-clojure-classpath (swank-clojure-default-classpath)) seems to fix it
20:38remleduffOh, wow, "ng clojure.main" actually works, but the repl ends up on the standard output of the nailgun process
20:42remledufftechnomancy: If the *classpath* var doesn't exist, what does that mean?
20:44remleduffMaybe the repl itself is running in lein's classpath rather than the project's?
20:49demolithionhmm does paredit break the F keys for anyone else or is it just me?
20:55sethsI'm still afraid of paredit (shame on me)
21:04progskiIs 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:05hiredmanmost liekly your contrib and clojure are out of sync
21:05progskiIt's pulling both from maven
21:06progskiclojure-1.2.0-master-20100301.140114-13.jar
21:06progskiclojure-contrib-1.2.0-SNAPSHOT.jar
21:07hiredman*shrug*
22:38remleduffAre the instructions for creating a new leiningen task from http://nakkaya.com/2010/02/ supposed to work still?
23:08tomojhmm
23:08tomojthe latest developments in swank+clojure, do they mean that we could now possibly call emacs functions from clojure?
23:08tomojso you could for example set up an emacs-server, then manipulate it with clojure
23:25mabesis it possible to override the constructors generated automatically with deftype?
23:28tomojI don't think so, but you could define your own :(
23:28tomojmaybe there is a way I don't know about
23:28tomojin the days of structs, I adopted hiredman's suggestion of <foo> for a constructor
23:29tomojor maybe it was <foo> for the struct name, I dunno
23:29tomojanyway, that could be used for deftypes, but it's not pretty
23:30mabesYeah.. 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:31mabesI may do that
23:32tomojhmm
23:33tomojwe can't do that with a macro, can we
23:33tomojguess it doesn't matter much
23:37mabesyou could probably use compjure's decorate function
23:41tomojcan you decorate a macro?
23:42psykoticyet another expression threader:
23:42psykotichttp://gist.github.com/328830
23:44tomojpsykotic: wacky!
23:53remleduffI think rhickey is going to use >> and << for cells, isn't he?
23:59radsis there a preferred line length for doc strings?