#clojure logs

2011-10-05

00:03popiniggaHello
00:04popiniggaI'm new to Clojure and I've written some code in a file helloworld.clj on my desktop.
00:04popiniggaHow do I run the code?
00:14sean_corfieldI see #(some-fn % arg1 arg2 ..) quite often and wondered if there was some variant of something like partial that could remove the #(.. % ..) noise?
00:34amalloy(defn kinda-like-partial [f & args] #(apply f % args))?
00:34amalloythat is: i'm not aware of one, but of course you can write your own
00:37amalloysean_corfield: ^
00:38ibdknoxyeah, it's a good personal utility one
00:39ibdknoxthough, I think a good case could be made for it to be a function in core
00:39ibdknoxI want such a thing all the time
00:39amalloyibdknox: core is full to overflowing. if i were a meme-generator kinda guy, i'd be pasting you a link to an image full of something looking ready to explode
00:39ibdknoxlol
00:40ibdknoxyeah
00:40ibdknoxI said a good case could be made, didn't say it should make it ;)
00:40ibdknoxI mean we couldn't risk crowding things like with-bindings :p
00:40ibdknoxthat one still gets me
00:41amalloyibdknox: with-bindings exposes functionality you can't get with plain-old binding
00:41ibdknoxlike?
00:41amalloyyou don't always have var symbols; sometimes you only have var objects
00:42amalloyibdknox: for example, https://github.com/cognitivedissonance/clojail/blob/master/src/clojail/core.clj#L172 - without with-bindings, this whole function would have to be a macro
00:42ibdknoxis there a reason that binding couldn't also allow that?
00:43ibdknoxah
00:43ibdknoxI misunderstood
00:43ibdknoxfair enough
00:43amalloyhow could it? you can't tell, at macro time, whether the symbol 'foo refers to the var #'foo, or the var referenced by the local foo
00:44ibdknoxyeah, I misunderstood what you were saying
00:45amalloymkay
00:45ibdknoxthat makes sense
00:46ibdknoxI almost would've expected that to be like binding*
00:46ibdknoxmaybe that need arises much more than I think though
00:47amalloyibdknox: no, i think it's a fairly uncommon need
00:52brehautamalloy: that kinda-like-partial is called 'dispatch' in moustache
00:54brehautsorry i lied
00:54brehautdelegate
00:54brehauthttps://github.com/cgrand/moustache/blob/master/src/net/cgrand/moustache.clj#L172-176
00:56michaelr525is there a web browser built-in in emacs?
00:56brehauttheres a browser for emacs called W3 but i don't know if its built in
00:58michaelr525it's not in package-list-packages
01:04no_mindI have couple of files in a directory,. I want all these files to be part of a single namespace, identified by the directory path. For example, if the directory path is xyz/applications/accounts then all files in this directory should belong to namespace xyz.applications.account . How do I do this ?
01:11michaelr525no_mind: why do you want to do it like that?
01:12no_mindease of managing packages
01:14brehautno_mind: http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
01:33no_mindbrehaut: that doesnt work. I get an error saying "Could not locate xyz//applications/accounts__init.class or xyz/applications/accounts.clj on classpath" the directory xyz/applications/accounts is in the classpath
01:34brehautno_mind: i have no idea sorry. i just remembered the link and thought it might be relevant
01:44symboleno_mind: I'm not too sure, but you might have to run compile on the class you're generating.
03:11sivajagHey All
03:54ejacksonmorning folks
04:22Blktgood morning everyone
04:29amalloyanyone (like seancorfield) know if there's a way in congomongo to say "give me a document except for keys X and Y?" i know you can ask for *only* keys X and Y, but i don't see the opposite
04:30pyri wanted to tryout msgpack rpc but it seems as though it relies on annotations
04:31pyris there a way to provide annotations in clojure ?
04:31amalloymongodb allows it with db.coll.find(query, {X: false, Y: false})
08:40Fossihmmm
08:41Fossibattlenet? i'm intrigued
08:42winkI wouldn't b :P http://github.com/winks/battlenet
08:43ejacksonaaaah, a black hole.
08:44Fossiwink: :)
08:44Fossialready found that
08:45Fossilook too WoWy for me ;)
08:46winkI'm just now wondering what slows a page request down to only 3req/s.
08:46winkprobably not jetty, so maybe h2
08:46winka bit of html generated by noir loads at 123 req/s
08:51eirikbHello. I'm trying to clojure:test with the maven plugin, it finds my test but no deftest
08:51edwIs it possible to make a List<String> in clj? I'm working on a thrift server right now.
08:52eirikbI understand it will (run-tests) on the test
08:53nappingedw: You should be able to make a List and fill it with Strings
08:53edwWill that 'satisfy' the interface's signature?
08:54nappinggenerics are erased, so it should
08:55edwOK. Thank you.
08:57nappingIs it not easy to test?
09:16eirikbAnyone know about any example projects with the maven plugin and some tests with larger namespaces (not just src/main/clojure/main.clj)
09:26eirikbI'm guessing I have messed up ns, but it still finds the file. Although it should (run-tests 'some.ns)
09:38ejacksoneirikb: hmm.... I have made this work in the past. Lets see.
09:38ejacksonHave you got the main and test directories properly set up ?
09:38eirikbejackson: https://github.com/eirikb/comicparser/tree/clojure
09:39eirikbDon't mind the java-parts and the resources
09:39ejacksonI'll poke around for you a bit...
09:39eirikbThanks a lot
09:39mcoffbyonehi, could anyone recommend me some clojure library which does a lot of file/directories/regex/parse related stuff?
09:40mcoffbyone(need to learn how to do it elegantly not to use it)
09:40ejacksoneirikb: ah, you're not using the clojure-maven-plugin
09:41eirikbejackson: Using the first hit on google
09:41eirikbtalios/clojure-maven-plugin
09:41ejacksonthat's the one
09:41ejacksonabout halfway down it talks about testing
09:42eirikbI took the pom setup from here: https://github.com/talios/clojure-maven-plugin
09:45ejacksoneirikb: your pom doesn't have the plugin listed https://gist.github.com/1264459
09:45ejacksonthat gives gives you clojure testing in the test goal
09:46eirikbI do have the goal now though, and it find the file. It just does not run any deftest.
09:46eirikbI updated my pom, let me try
09:48ejacksonyou also need to put your tests into a test namespace
09:50ejacksonso to test the namespace no.eirikb.comicparser.comicparser you need your tests to live in the namespace no.eirikb.comicparser.test.comicparser
09:51ejacksonor at least that was the arrangement back when I was using maven
09:57ejacksoneirikb: there's something up with your fork as well, if I try to fork off of it I only get the java :)
10:04duck1123ejackson: I believe they can live in any namespace in the test directory. The plugin shoul pick up all of them
10:11ejacksonduck1123: OK, cool. I was just looking at a working project of mine and spewing forth.
10:12duck1123Personally, I prefer to name my test namespaces a.b.c-test
10:12duck1123in part because it makes it easier to tell the buffers apart in emacs
10:14ejacksonfact !
10:24gfredericksusing clojure-maven for the first time, repl is primitive. Anybody know what a man gots to do to get rlwrap or whatever hooked up?
10:28ejacksongfredericks: id suggest using swank and getting at the repl via emacs
10:28gfredericksejackson: what about the persecuted minority of vim users? :)
10:29algernonrun vim from emacs, and get the best of both worlds
10:29ejacksonthere's a nailgun plugin too
10:29ejackson(what exactly that means I don't know, but vim folk seem to like it)
10:29gfredericksalgernon: vim from emacs works with swank and all that?
10:29eirikbejackson: Did you clone the correct branch?
10:30Guest66735I started using vsclojure in vs2010 and I'm having a problem with my solution suddenly not compiling any more. if i check out the project again to a different location, it compiles, but eventually will fail repeastedly (BootstrapCompile has stopped working). Is this a known problem - file corruption or something?
10:30eirikbduck1123: But why are the tests not run?
10:30ejacksoneirikb: must be the issue... you having any luck ?
10:30ejacksoneirikb: have you explicitly tried mvn clojure:test
10:30eirikbejackson: Nope
10:30eirikbYes
10:31Guest66735btw, the exact same code compiles fine from command line or ccw in eclipse
10:34eirikbejackson: It says: Testing no.eirikb.comicparser.comicparser \n\n Ran 0 tests containing 0 assertions.
10:35ejacksonyeah, I'm having a look now
10:35eirikbHave to go for a short bit, be back in an hour
10:36duck1123eirikb: your test files are in src/test/clojure/ right?
10:36duck1123the clojure-maven-plugin creates a test runnier in /tmp might whant to check out what namespaces it picked up
10:36eirikbduck1123: Yes, https://github.com/eirikb/comicparser/tree/clojure
10:37eirikbduck1123: yeah, I can see it uses require
10:37duck1123you need to configure the plugin for tests
10:38duck1123let me see if I can find my old poms
10:39eirikbduck1123: Namespace configuration under https://github.com/talios/clojure-maven-plugin ?
10:39eirikbSeems to only be for limiting
10:40eirikbAnd additional sources should not be needed either, as it finds my file
10:40duck1123Here's one of the files I was using https://github.com/duck1123/jiksnu/blob/5a124e864e2a98089d14ae56a798fc851277ebcc/pom.xml
10:40duck1123so what happens when you do mvn clojure:test
10:41eirikbduck1123: https://gist.github.com/1264580 (the ns is probably wrong, but same with no.eirikb.comicparser)
10:42eirikbI see you have <execution>, same as ejackson had. It did not seem to help me
10:43ejacksoneirikb: if I move your test into a test dir it finds it
10:43eirikbejackson: src/test/clojure/test ?
10:43ejacksoni sec and I'll commit it back up for you
10:43eirikbcool
10:44eirikbAh, no.eirikb.comicparser.test.comicparser ?
10:45eirikbThat seems to do the trick at least
10:45ejacksoneirikb: yes that's the one
10:46eirikbejackson: Thanks a bunch! you even mentioned this earlier but I didn't test it out, sorry :(
10:46ejacksonno worries, enjoy.
10:47vinibaggiohello, I'm still beginning Clojure and I am having a hard time to grasp some concepts, such as doseq. Do anyone know (besides clojure's own doc) any resource that could help me with that?
10:47eirikbWhat version of the maven plugin is the one I should use? On the github page it was 1.3.4, while I see 1.3.8 is in the repo and duck1123 had 1.3.7
10:47ejacksoneirikb: no idea I'm afraid.
10:48ejacksonvinibaggio: I'd really suggest you get a book :)
10:48eirikbejackson: ok =)
10:48eirikbejackson: Tried updating to 1.3.8 to see if I still had to put it under a test-folder, and that I did
10:49ejacksonyeah, maven is persnickity.
10:49eirikbhehe. Well it works perfectly now
10:50vinibaggioejackson: I am trying to follow The Joy of Clojure, but it's being difficult to me, I have to admit. It assumes I've understood what it does
10:51vinibaggioejackson: do you recommend any other?
10:52ejacksonvinibaggio: yeah, JoC is not the point of departure, more the goal :)
10:53ejacksonI really like Programming Clojure, by Halloway
10:53vinibaggioejackson: cool to know. I've been enjoying the read, it's amazingly well written, but quite hardcore for a beginner hehe
10:53ejacksonbut the others are all good too
10:54vinibaggioejackson: okay, I will start with that. Thanks!
10:54ejacksonenjoy.
10:54vinibaggio:)
10:54ejacksonbe aware that its a bit out of date though
10:56vinibaggiohmm I think it may serve as a good start nevertheless. It doesn't cover Clojure 1.3, right?
10:57vinibaggioi think the problems I have are not very version-aware, but getting the whole LISP state of mind in my mind
10:57duck1123Programming Clojure covers 1.0, but I think there's a second edition in the works
10:58rbransonjust keep trying on JoC
10:58rbransonit's dense, but very rewarding
11:03gfredericksduck1123: I was just looking at a pdf of the second edition, coincidentially
11:04vinibaggiohmm ok, I think I will fallback a little bit on Programming Clojure and try to follow JoC after I have a better grasp on the language. Thanks guys
11:04gfredericksone of the beta versions I guess
11:05rbransonI have no previous LISP experience and found JoC to be a fantastic introduction
11:06duck1123so, it you bought the first edition, you have to pay for the second ed?
11:07vinibaggiorbranson: yeah, I am enjoying it, but i am having trouble to have a complete understanding of it. sometimes i feel i am leaving something out
11:08rbransonvinibaggio: it's a relatively challenging book
11:08vinibaggiorbranson: that's awesome :)
11:09rbransonvinibaggio: I found that it helped to stop and actually start hacking through some 4clojure to get my "watermark" up so that I really understood the previous material
11:09vinibaggiorbranson: ah yes, i am trying to do that. I am solving some project euler problems, and also spoj.pl
11:09rbransonno pain, no gain :)
11:10ejacksonyou guys are on the right track, as the rapper laureate himself said, "Lisping aint easy"
11:10rbransoni have been pleasantly surprised by the challenge, usually the challenge in learning a new language is learning the tools/environment
11:10vinibaggiorbranson: what was troublesome to me is that i am trying to read input from STDIN, and the example I've found used doseq, and I didnt understand what it does, and I, as a total beginner, am not understanding how to work with it
11:11vinibaggiorbranson: exactly! that's how i feel about JoC, and that's why i am loving reading it
11:11rbransonvinibaggio: i don't really fully grasp the lazy-seq / doseq stuff yet either
11:12dnolenvinibaggio: doseq is simply a way to write imperative code on sequences.
11:12gtrakfor me, the challenge is it feels like I'm doing less work, since it's less keypresses, and you can maybe express a few java classes worth of code in a couple of lines of clojure, but the trick is to know the best way to express it
11:13rbransongtrak: yeah, clearly there's the "silly unwashed clown" way of solving problems :)
11:13dnolenvinibaggio: (doseq [x ...] (draw-to-screen x)) as opposed to (map inc xs) which returns a new sequence
11:14gfredericksdnolen: and importantly map is lazy so it won't necessarily do anything
11:14rbransonI don't feel like doseq is super duper important at the beginning stage, most of the time you can build on-top of the library
11:14dnolengfredericks: that too.
11:14rbransonrecur feels really important though
11:14gfredericksnot so important is the rarely-used do-not-seq
11:15rbransondonut-seq?
11:15vinibaggiodnolen: hmm, okay, I will try to play with it here, thanks
11:15gfredericksdoughnut-seq
11:15gfredericksrbranson: my experience in #clojure is that beginners often use recur a lot more than they need to
11:15rbransongfredericks: i agree
11:15gfrederickswhen map or reduce would do what they need
11:15rbransongfredericks: ignorance of the core library
11:16gfrederickscoming from another language you're used to having to do algorithms by hand
11:16gfredericksso loop/recur seems like the best way to do nearly anything
11:16rbransonrecur is a special form though, so i feel it's worth knowing
11:17Chousukerecur is fine, but loop tends to be a code smell
11:17gfredericksrbranson: just like monitor-enter? :)
11:17rbransongfredericks: :)
11:17gfredericksChousuke: you mean in contrast to recuring to a fn?
11:17Chousukeyes
11:18Chousukelots of newbies using loop just think they want a looping construct
11:18Chousukeso they end up using loop
11:19gtrakmaybe we should change the name of loop to something less recognizeable
11:19rbransonI think people make the same mistake in learning python/ruby
11:19gfredericksI was about to say it sounds like Chousuke just doesn't like the name
11:19Chousukenah, that's just obfuscation
11:19rbransonso it's not clojure's fault ;)
11:19Arafangionrbranson: Python, no, ruby, yes.
11:19gfredericksChousuke: what kind of refactoring do you do when you see a loop?
11:19Chousukegfredericks: the name is irrelevant. it's just what the newbie will find when they search for loops :P
11:19zerokarmaleftvinibaggio: restricting yourself to working inside the REPL will help you get used to thinking about functional composition
11:19gtrakmaybe people could say... i want to loop, but there's no loop keyword, how the f do I loop?
11:19Arafangionrbranson: The right way to loop /is/ to do a loop in python.
11:19gtrakah... maybe map does what I need
11:20Chousukegfredericks: I'm not saying all loops are bad but you can get away without an explicit one in most cases
11:20rbransonArafangion: list comprehensions replace a good number of cases though
11:20gtrakmaybe instead of loop, call it label
11:20rbransonArafangion: I see what you're saying though, list comprehensions are kind of a special case
11:20Arafangionrbranson: Indeed.
11:21Chousukegfredericks: that's why it's always somewhat suspicious if you see lots of looping
11:21Arafangionrbranson: Also, note that recursion is Bad in python.
11:21gtraklabel-recur makes people think of gotos, and makes them feel worse about it
11:21rbransonhaha
11:21vinibaggioChousuke: I felt this way, I build a fibonacci totally with loops, and almost every implementations I've seen on clojure does not use loops nor recursions (at least in a clear manner). Maybe it would be nice for beginners to have some sort of comparison, and how to achieve that?
11:21dnolenChousuke: gfredericks: unless of course it's a tight inner loop ;)
11:22Chousukevinibaggio: maybe
11:22rbransonvinibaggio: I feel like some of those become "golfing"
11:22rbransonthere's definitely a threshold where code clarity takes a backseat to compactness
11:23Chousukevinibaggio: the main issue is learning to use laziness
11:23vinibaggioChousuke: i think so
11:23gfredericksand parentheses
11:23arohnerI'm seeing an issue where noir is listening on ipv6 8080, but not ipv4 8080. Any ideas?
11:23Chousukepeople with no functional background think in loops so using lazy sequences is something they can't even consider
11:24Chousukeuntil they encounter it somewhere
11:24rbransonare lazy seqs pretty much the norm?
11:24zerokarmaleftrbranson: coming from ruby, i find code clarity in lisps have a different paradigm...the shape of the code matters more than names of symbols
11:24ejacksonI want to create a macro that does does some defs. I want to use that macro in various other namespaces. Clojure says "can't def in another namespace" Is there a workaround?
11:24clojurebotmacro are just a game with symbols
11:25ejacksonthanks clojurebot
11:25Chousukerbranson: Clojure provides you with a whole library of dealing with sequences, so if you use sequences, you get lots of useful tools for free.
11:25rbransonChousuke: right, but i'm talking about idiomatic code
11:25arohnerejackson: with-ns, in contrib
11:25Chousukewhereas looping always requires manual work.
11:25ejacksonarohner: thanks, i'll check it out
11:25Chousukesometimes you need a loop for performance reasons but yeah lazy seqs are almost always more idiomatic
11:26gtraklaziness should be invisible unless you're dealing with side-effects
11:26raekejackson: maybe you are using syntax-quote for the def name.
11:26clojurebotdefmulti doc is (defmulti #^{:doc "docs for foo"} foo class)
11:27raek, `(def foo)
11:27clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
11:27ejacksonraek: yeah, I am... ha ! let me try do it raw. thanks.
11:27gfredericksejackson: I've done what you described and had no trouble. I think I was using regular backquote: `(defn ~thing-name ...)
11:27raekejackson: you don't want the name you pass to be qualified with the namespace that the macro was defined in
11:28raek*the name you pass to 'def'
11:29vinibaggiothis was a pretty nice discussion guys, thanks, learned a ton :)
11:29raekyou can use `(def ~'my-name ...) to circumvent syntax-quote
11:29ejacksonraek, yeah, gfredericks, I think I understand you guys. Lemme play a bit, thanks.
11:29gfredericksejackson: when in doubt, sprinkle punctuation liberally
11:30ejackson:D
11:30gfredericks`~'~~('def ``~'puddle-ducks @@~'`&args)
11:30gfredericks^ expands to whatever you need your code to do
11:31ejacksonraek: Winner, winner, chicken dinner.
11:31TimMcthrow in some # just to make sure
11:32ejacksongfredericks: you're a perl exile i see.
11:32gfredericksejackson: only in jest
11:33zerokarmaleftgfredericks: Q(`_')-o
11:33zerokarmaleftrecognize!
11:33gfredericksthat's just an emoticon, right?
11:33gfredericksmaybe for something obscene?
11:34zerokarmaleftfairly certain it's not valid perl, but i don't think it's obscene
11:34zerokarmalefts/but/and/
11:34lazybot<zerokarmaleft> fairly certain it's not valid perl, and i don't think it's obscene
11:35ArafangionIf it were perl, then it would be obscene.
11:36gfredericksfun fact: Every obscenity is a valid perl expression, and vice versa.
12:11bsod1I want to create an NxN grid with vectors, what is the idiomatic way to do this in clojure?
12:17ebloodi don't know the idiomatic way, but a quick way to create a seq of seq: (repeat n (repeat n 0))
12:23zerokarmaleftbsod1: (for [x (range n) y (range n)] [x y])
12:28zerokarmalefteh, that should be (for [y (range n) x (range n)] [x y]) if you want them ordered by row
12:29TimMczerokarmaleft: I don't think that's correct.
12:29TimMcThat gives a seq of coordinates, not a 2D array (matrix).
12:30zerokarmaleftah, i read his question as a NxN grid with a vector at each (N, N)
12:31TimMc,(for [y (range 2) x (range 3)] [x y])
12:31clojurebot([0 0] [1 0] [2 0] [0 1] [1 1] ...)
12:31TimMc(repeat 2 (repeat 3 0))
12:31TimMc,(repeat 2 (repeat 3 0))
12:31clojurebot((0 0 0) (0 0 0))
12:34raek,(for [y (range 2)] (for [x (range 3)] [x y]))
12:34clojurebot(([0 0] [1 0] [2 0]) ([0 1] [1 1] [2 1]))
12:35zerokarmaleftTimMc: how would you access the value at x,y for that matrix?
12:36PPPaulwhat is the proper way to execute some side-effect code on a list? i'm doing (doall (map))
12:36raek,(vec (for [y (range 1 4)] (vec (for [x (range 1 4)] (+ (* y 10) x)))))
12:36clojurebot[[11 12 13] [21 22 23] [31 32 33]]
12:36raek,(let [matrix (vec (for [y (range 1 4)] (vec (for [x (range 1 4)] (+ (* y 10) x)))))] (get-in matrix [1 1]))
12:36clojurebot22
12:37raekPPPaul: if you don't care about the return value of the function with side-effects, you should use dorun
12:37raek(dorun (map println ["foo" "bar"]))
12:37PPPaulok
12:37raekdoseq is also very useful
12:38PPPaulusing map, instead of some other construct, is still considered ok?
12:38raek(doseq [x coll] ...) = (dorun (for [x coll] (do ...)))
12:38raeksure
12:38PPPaulfor... i still don't understand for >_<
12:39raekit's like map, but with swapped arguments and an implicit anonymous function...
12:39PPPaulhmm
12:39raek(map (fn [x] (+ (inc x) (dec x))) [1 2 3 4])
12:39PPPauli've seen for do magic
12:40raek(for [x [1 2 3 4]] (+ (inc x) (dec x)))
12:40PPPaulooooooooh
12:40raekI usually pick for when I find myself writing (fn ...) in a map
12:40PPPauli'm beginning to understand it
12:40seancorfieldamalloy_: just saw your Q about congomongo... no idea so i'll go take a look
12:40raekit looks much prettier for bigger fns
12:41raekdoseq has the same syntax as for
12:42raekbut also allows multiple expression in the body (as if there was an enclosing 'do')
12:42crazyFoxhi. i am dealing with a group of entities that all have the same kinds of properties. first approach: using a record data type. downsides: every access of some property requires repetitive code to get to the atomic values; slower. second approach: have a separate vector for each kind of property. downside: the different properties of an entity are only linked via their positions in the...
12:42crazyFox...vectors. Any thoughts about the matter?
12:44TimMczerokarmaleft: get-in
12:44duck1123crazyFox: proper use of destructuring should take care of a lot of the repetitive field access for maps / records
12:44TimMcBut we haven't heard back from bsod1 about the specific requirements.
12:44seancorfieldamalloy_: nope, it forces { fieldname: true } but it would be a nice enhancement to let it take a map of fields instead of just an array and then you could set true / false for selecting / omitting fields
12:44seancorfieldi'll open an issue for that
12:45zerokarmaleftraek: is your matrix snippet still lazy?
12:46crazyFoxduck1123: right now it looks sth like this: (let [xs (map :key entities) ...] ...)
12:46raekzerokarmaleft: the 'vec' calls forces the sequences returned by for
12:46zerokarmaleftthat's what i suspected
12:46TimMcPPPaul: `for` can also do filtering and other fancy stuff.
12:46raekbut if you leave out the 'vec' calls you have a lazy sequence of lazy sequences
12:47PPPaul!
12:47gilescbhi all, in core.logic is there something equivalent to prolog's retract?
12:48duck1123crazyFox: ok, if you're trying to key the :key field from every entry, that's probably the best you're going to get. But you'll probably need map no matter what
12:49raek(for [x (range 10), :let [y (* x x)], :when (even? y)] ...)
12:49duck1123if you're parsing them one record at a time, you can use destructuring to populate the variables for that record
12:50crazyFoxduck1123: the thing is, i often need one property from all the entities at once
13:52jjido,(char 33)
13:52clojurebot\!
13:58gfredericks,(int \!)
13:58clojurebot33
14:00jjidothanks g. I wanted the next char after space and couldn't find the syntax in lua
14:00jjidoor python
14:01jjido(on my iPhone)
14:02gfredericksyou mean they let people program without having memorized ASCII?
14:02jjidolol
14:09gfredericksI'm not letting my kid go to any school that doesn't teach ASCII alongside the alphabet.
14:10tordmorand at least superficial knowledge of the more important unicode areas
14:11gfredericksif I pick any unicode character, he ought to have at least _seen_ it by third grade.
14:11scgilardibmp: it's not just for bitmaps any more.
14:11gfredericksscgilardi: what's it for?
14:11jjidolol again
14:12scgilardigfredericks: the basic multilingual plane
14:12gfredericksscgilardi: ah yes.
14:13gfredericksI just read on the relevant wikipedia article: "Plane 3, the Tertiary Ideographic Plane (TIP), is reserved for Oracle Bone script, Bronze Script, ..."
14:14gfredericksand clicked on the "Oracle Bone" link wondering what weird oracle project it was
14:14gfredericksand why some dumb piece of proprietary technology got its own swath of characters
14:15jjidoyou should know 'ideographic'
14:19cb`Hi, hope you can help. I'm trying to setup Clojure on Emacs and am following the instructions on http://dev.clojure.org/display/doc/Getting+Started+with+Emacs. I'm on Windows 7
14:21cb`Kind of like Joshua Wood's comment at the bottom of that page I get an error when trying to run M-x clojure-jack-in which says: "sh: line 1: lein jack-in 63783: command not found". However lein is on the PATH. I can run lein from a running eshell without issue. Any ideas?
14:21technomancycb`: running clojure-mode from git or marmalade?
14:22hiredmancb`: on osx by any chance?
14:22cb`technomancy: marmalade
14:22cb`hiredman: Windows 7
14:23hiredmanah, well, interesting choice there
14:23technomancycb`: I just made some commits in git that should at least make it more clear what the problem is; maybe try that?
14:23technomancyif it works on windows I'll push the release to marmalade
14:24cb`technomancy: Alright, thanks. Will give it a shot and report back here.
14:24cb`technomancy: Best to remove using package.el first or it'll pick up the latest version of clojure-mode regardless?
14:25technomancycb`: yeah, try that
14:25technomancyand restart emacs since it involves a defvar change
14:28bsod1I can't import clojure.contrib in my counterclockwise project, anyone know why? => clojure.contrib/priority-map #<CompilerException java.lang.ClassNotFoundException: clojure.contrib (NO_SOURCE_FILE:0)>
14:29gfredericksbsod1: I didn't think clojure.contrib was ever a namespace...
14:29amalloyit ain't
14:30bsod1so how can I use clojure.contrib.priority-queue? sorry I'm new at clojure
14:30gfredericks(use 'clojure.contrib.priority-queue)
14:30gfredericksor (require '[clojure.contrib.priority-queue :as pq])
14:30bsod1gfredericks: #<CompilerException java.io.FileNotFoundException: Could not locate clojure/contrib/priority_queue__init.class or clojure/contrib/priority_queue.clj on classpath: (NO_SOURCE_FILE:0)>
14:31amalloyseancorfield: what's the canonical congomongo repo? i'll have a look at permitting maps
14:32gfredericksbsod1: I don't see docs for priority-queue in clojure-contrib -- where are you seeing it?
14:32amalloy(i'm just going to assume it's aboekhoff's github repo)
14:32cb`technomancy: Now *swank* buffer looks alot better. There are lot of lines in there and last one is: ";;; proceed to jack in"
14:33technomancycb`: but no repl?
14:33cb`technomancy: However, *Messages* has: "error in process filter: eval-buffer: Symbol's function definition is void: define-slime-contrib" and yes, no repl
14:33technomancycb`: you've got some slime configuration that only works with CL slime
14:34bsod1gfredericks: yeah I was looking wrong place, I think right one is this. https://github.com/clojure/data.priority-map
14:34bsod1still I don't understand how can I use this
14:35gfredericksbsod1: it'd be (require '[clojure.data.priority-map :as pm])
14:35gfrederickswhere 'pm' is whatever prefix you'd like to use
14:35bsod1gfredericks: same error: #<CompilerException java.io.FileNotFoundException: Could not locate clojure/data/priority_map__init.class or clojure/data/priority_map.clj on classpath: (NO_SOURCE_FILE:0)>
14:35gfredericksbsod1: It has to be included in your project as a dependency
14:36gfrederickshow you do that with CCW, I don't know. Maybe build the jar and include it on the classpath somehow? Someone else may be able to comment better.
14:36gfredericksif you're using leiningen too, it shouldn't be hard
14:36gfredericksno idea if leiningen and CCW go together
14:36cb`technomancy: a hah.. OK, I commented out any previous slime related stuff from init.el and fired up another Emacs instance and I get a REPL with M-x clojure-jack-in!
14:37technomancycb`: great! is the config you removed important?
14:37cb`technomancy: Do you know if it's possible to shield the CL slime config from Clojure? It looked to me like clojure-jack-in used its own copy of Slime anyway?
14:38technomancycb`: I'm not sure; I don't use common lisp
14:38amalloyanyone know if type-hinting helps the compiler with protocol lookup? like, (extend-protocol SomeProto MyType (impl [this args] ...)) ... (impl ^MyType foo "test")
14:38cb`technomancy: It's quicklisp's version of Slime. I'd have to investigate to figure out what part is causing it to brek. So far it "just worked"
14:38technomancythis comes up periodically, but none of the CL users have gotten back to me about a reasonable fix
14:38technomancycb`: what's the offending config look like?
14:38amalloyit seems to me like it shouldn't help, but i don't know everything about what's going on in protocols
14:39cb`technomancy: I'll probably join that list of offending users as I'm not a CL expert either. Just dabbling in CL, Scheme and Clojure for now. But I will try and determine what subset of this config is causing the problem.
14:42cb`technomancy: It appears to be (slime-setup '(slime-fancy))
14:43cb`technomancy: That's a configuration for slime that tells it to use several of the common contrib packages. Perhaps cojure-mode just needs to grab slime contrib as well as slime when it's running clojure-jack-in?
14:45technomancythat's one way to do it
14:45bsod1argh, I can't use clojure.data.priority-map in la clojure too... it shouldn't be that hard.. I've already have clojure-contrib.jar imported in my project
14:46technomancyslime-setup-contribs could also just go inside an ignore-errors
14:47cb`A related question is, is it possible to get clojure-mode to save its copy of Slime somewhere? It seems to be downloading it each time and in that case downloading the contrib directory would obviously take a bit longer. I wouldn't really mind an extra bit of download time if it was a one off
14:47technomancycb`: sure, swank-clojure 1.3.3 does that
14:47technomancy(it's not downloading it from the 'net, just unpacking it out of the jar though)
14:48cb`oh, cool. I didn't realize it was coming from the jar. That's actually not so bad. I was concerned about trying to kick it off when not connected to the net. A few seconds of loading doesn't bother me too much
14:49technomancyyeah, but it's ugly
14:49cb`is 1.3.3 good to use or should I stick to 1.3.2 for other reasons?
14:49technomancy1.3.3 is better
14:51cb`I don't notice a lein upgrade option. If I just ran "lein install swank-clojure 1.3.3" would that take of it?
14:51technomancyI think so
14:51technomancyyou may need to uninstall the old one; I'm a bit fuzzy on how that works
14:52cb`is adding slime-setup-contribs inside ignore-errors a quick fix? I'd be happy to try it out and confirm if it works here
14:53technomancyshould be; can you give it a try?
14:53technomancyif that works I'll add it to the swank readme
14:54bsod1can anyone help me? I created a lein project, added clojure 1.3 and clojure.contrib 1.2 to deps, run lein deps, run lein repl, and still can't use clojure.data.priority-map
14:57ibdknoxbsod1: contrib won't work with 1.3, and I don't think there's an official release of clojure.data yet
14:57technomancybsod1: priority map is not part of contrib 1.2; it's a separate project
14:57technomancyclojurebot: what happened to contrib?
14:57clojurebotexcusez-moi
14:57technomancyclojurebot: where did contrib go?
14:57clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
14:58cb`For what it's worth the list of things in slime-fancy is: slime-repl, slime-autodoc, slime-c-p-c, slime-editing-commands, slime-fancy-inspector, slime-fuzzy, slime-presentations, slime-scratch, slime-references, slime-package-fu and slime-fontifying-fu. I think at least some of those are used/working in clojure-mode.
14:59technomancycb`: yeah, that could possibly be added to the bootstrapped elisp in the jar
14:59technomancybut right now it loads everything; there's no way to configure which you want
14:59bsod1ibdknox: so how can I use this priority-map?
14:59technomancymaybe a separate swank-clojure-fancy jar could be used for that
15:00ibdknoxbsod1: [org.clojure/data.priority-map "0.0.1"] it appears
15:03sritchiecemerick, have you had any trouble getting the clojure view server started (with clutch) in 0.2.5-SNAPSHOT?
15:03cemericksritchie: no; though, 0.2.5 was released last week IIRC
15:03cemerickI saw your message; you probably have a classpath issue in your view server config.
15:04sritchiecemerick got it, I'll keep playing. The server command works fine when I copy it into the command line, it just fails when couchdb tries to run it
15:04cemerickah, that's interesting
15:05cemerickWell, try 0.2.5 release. If you're still having issues, ping me (though probably not 'til next week? :-)
15:06sritchiecool, this is the homebrew couchdb, maybe I'll try couchbase or something
15:06sritchie1.1.0. thanks for taking a look, I'll ping you next week
15:13cemericksritchie: I do all my testing with CouchDBX or couchbase single, FWIW.
15:14cemerickI'm seeing some very odd behaviour out of clojurescript macros.
15:14cemerickWhich probably means I'm not using them properly. :-P
15:14cemericka simple macro: (defmacro emit [k v] `(- k v))
15:15cemerickwhen used, it produces javascript like: com.K.N.M.O - com.K.N.M.P
15:15cemerickneither of which exist at runtime
15:16chousercemerick: are you pulling it it with use-macros or require-macros?
15:16cemerickrequire-macros
15:16chouserhm. dunno why that wouldn't work.
15:17cemerickI'm just baffled by where those names are coming from.
15:17cemerickor, not 'just', perhaps 'additionally'
15:17chouseryou're using gclosjure advanced?
15:17cemerickyup, {:optimizations :advanced :pretty-print true}
15:17cb`technomancy: I'd not tried to use ignore-errors before. I tried wrapping (slime-setup '(slime-fancy)) in my config with (ignore-errors ...) but it didn't seem to help. I guess because the error doesn't happen when emacs starts up anyway, it's later when clojure-jack-in runs. I could be using it wrong though
15:18cemerickwhat a fool
15:18cemerickchouser: I didn't put tildes in the macro body
15:19cemerickgood grief, Charlie Brown.
15:20amalloychouser: any idea what's up with data.xml? it looks like the indentation test you wrote is failing on jira, but it works when i run tets locally so i'm not sure how i can get it building
15:21cemerickhey all: I'm speaking on (experimentally!) using ClojureScript to build CouchDB views, tomorrow night at the Bay Area Clojure Meetup: http://bit.ly/pFjdVK
15:21cemerickseancorfield: you asked about my topic :-) ^^
15:21amalloyer, on hudson. or jenkins or whatever the dang build server is
15:22chouseramalloy: sorry, I still haven't given data.xml the love it needs.
15:23amalloyif it will help i can get out a pitchfork or other threatening-looking device
15:25chouserthe xml emit stuff relies a lot on whatever xml processing classes are loaded into the jvm instance.
15:25chouserthat might be related to whatever's causing it to fail.
15:25chouserwhat's the jenkins url?
15:27amalloychouser: http://build.clojure.org/job/data.xml/ is in the general area
15:28amalloychouser: and http://build.clojure.org/job/data.xml/lastUnsuccessfulBuild/console has the test output
15:28chouseryeah, it's clearly not indenting it
15:28chouserisn't it.
15:29amalloyindeed. but when i run the test myself, it passes
15:30seancorfieldamalloy: thanx for the patch for congomongo - merged and i'll post an updated snapshot build in a few
15:30amalloyperhaps jenkins and i have a different instance of (javax.xml.transform.TransformerFactory/newInstance)
15:30chouseramalloy: yeah, probably. ugh.
15:34chouserI don't know if that can be forced for hudson, or at least reported on the console?
15:34PPPaulin slime what can i press to kill the current operation?
15:35amalloychouser: http://stackoverflow.com/questions/1264849/pretty-printing-output-from-javax-xml-transform-transformer-with-only-standard-ja seems to be suggesting you can also try setting an attribute on the factory
15:36amalloybut it's equally implementation-dependent what properties the factory supports
15:37amalloyas for reporting on the console, you can print out the class of the transformer you get back, right?
15:41chouseramalloy: yeah, I'd think so.
15:53kencauseyWhy for lein deps (in this case for cascalog) do I see messages indicating that each jar is downloaded 3 times, once each for conjars, clojars, central?
15:55kencauseyShould I assume no actual download occurs for each message unless I see a comparable Transferring message?
15:55hiredmankencausey: I believe those messages are for each attempt to download, it looks for jars from each repo
15:55kencauseyI see, so it should really be a 'Looking for ... in ...'
15:56kencauseythanks
16:28cb`technomancy: I'd not tried to use ignore-errors before. I tried wrapping (slime-setup '(slime-fancy)) in my config with (ignore-errors ...) but it didn't seem to help. I guess because the error doesn't happen when emacs starts up anyway, it's later when clojure-jack-in runs. I could be using it wrong though
16:29technomancycb`: hm... I guess what you really want is to defer that execution until you're connecting and you know it's a CL instance
16:29cb`I did however add (setq slime-setup-contribs nil) to the top of clojure-jack-in's definition and that worked (though of course with the side effect of wiping out part of your slime config if you do run it later)
16:29technomancywell, you can't go from jack-in to a CL slime session without restarting emacs anyway, so that shouldn't be a problem
16:30cb`How come it uses its own version of slime? Is it just to reduce the amount of things a user has to install?
16:31technomancycb`: CL makes you install slime from CVS
16:31technomancytwo reasons this is infeasible for clojure:
16:31technomancy0) my conscience won't allow me to suggest users install CVS and 1) slime from CVS is always breaking, and I don't have the time or inclination to fix it.
16:32cb`it's on ELPA now, or marmalade (I'm not sure how to get Package Menu to show the source of a particular package)
16:33technomancythe marmalade version is not compatible with CL
16:33cb`with some particular CL? It seems a bit redudant to have it there if it doesn't work
16:34technomancyit's there for Clojure
16:34technomancybundling it via jack-in is a pretty recent development
16:34technomancyhowever, you can use swank-clojure with marmalade's slime, it's just more manual and error-prone
16:34technomancyuseful if you're connecting to a swank server in production or something though
16:35cb`ok
16:35cb`well, the git version of clojure-mode worked better for me on Windows 7 than the one on marmalade currently.
16:36technomancythey're now the same version
16:36technomancyM-x package-refresh-contents to get your source list updated
16:36cb`I have a work around for the 'slime-fancy thing but do wonder if it might make sense to allow that to work automatically (and/or even support some of those things anyway).
16:38technomancyopen to improvements there
16:39cb`Are there instructions anywhere for using swank-clojure with another copy of slime? Like the one that comes with marmalade. I'd quite to try using it with my quicklisp copy of Slime and current slime config and see if it "just works" when it has access to the contrib directory and all the .el files in there
16:40sridis there a websocket example using clojurescript?
16:40technomancycb`: sure; the "Alternate Usage" section of the readme shows how to use it with M-x slime-connect and lein swank
16:41duck1123srid: I don't know if the Closure library has been updated since Clojurescript first came out, but the Websocket lib wasn't in the release
16:41ibdknoxsrid: the first result on google for clojurescript websocket is useful
16:42sridduck1123: https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/browser/net.cljs uses websocket; just wondering if there is any code that uses clojure.browser.net
16:43sridibdknox: http://lab01.kungfoo.pl:8108/ ? it doesn't work for me. hitting ENTER doesn't do anything (doesn't send the message)
16:43ibdknoxhttps://github.com/neotyk/ws-cljs/blob/master/src/cljs/websocket.cljs
16:43ibdknoxsrid: there's a link to the source at the bottom, but that link above is what you want
16:43srid... doesn't work only in chrome
16:44sridibdknox: hmm ok. that source doesn't use clojure.browser.net though. but i'll copy paste it in my project
16:44ibdknoxsrid: clojure.browser.net didn't exist in master until about two weeks ago
16:45ibdknoxso I suspect you won't find much that uses it quite yet
16:49crazyFoxfastest (execution) way to make / return a double value? (/ a (double b))? (i know for numbers it would be (/ 2 3.0) but im dealing with vars, so...
16:52sridlooks like I can't import goog.net.WebSocket at all -- ERROR - required "goog.net.WebSocket" namespace never provided
16:52hiredman,(/ 1.0 2 3)
16:52clojurebot0.16666666666666666
16:53hiredman,(/ 2 3 1.0)
16:53clojurebot0.6666666666666667
16:53zippy314has anybody successfully used cookies in clojurescript with goog.net.cookies? I keep getting this error: 'this.isValidName' [undefined] is not a function when I try to set a cookie via goog.cookies.set.
16:55cb`technomancy: it didn't quite work. Probably incompatible versions of slime and swank (I wasn't using marmalade slime I was using the one that quicklisp installs). M-x slime-connect worked but then I got exceptions from the "lein swank" process when I tried to execute anything. One thing I did notice though was that at least some of the slime-fancy things must have worked. One of them puts a title bar at the top of the REPL very similar
16:55cb`to the top of an ERC buffer and that appeared to work fine.
16:55ibdknoxsrid: ./script/bootstrap --closure-library-head
16:56technomancycb`: yeah, people have reported problems with that before
16:56ibdknoxah actually
16:56ibdknoxthat wasn't added
16:58ibdknoxI think the goog-jar.jar that I packaged for Pinot has websockets in it
16:58TimMc,((juxt identity double) (/ 2 3))
16:58clojurebot[2/3 0.6666666666666667]
16:58sridibdknox: yes, it didn't help https://gist.github.com/1265695
16:58TimMcIs (double) definitely slower than including a 1.0?
16:58crazyFoxok, (/ (double a) b) is actually about 5 percent faster than (/ a (double b)). marginal but - just in case somebody wondered...
16:59ibdknoxsrid: right, the patch that would make that work isn't in master.
17:01sridibdknox: bootstrap is using the latest release of clojure-library. is there a newer snapshot uploaded somewhere that I can use?
17:01sridits funny there are clojurescript websocket examples without clojurescript having a working websocket support
17:01crazyFoxTimMc: (/ (double a) b) is about 27 faster than (/ a b 1.0). if u meant that case
17:02TimMcnice!
17:02crazyFox*27 times
17:02crazyFoxy
17:02TimMcHow big a test run did you do?
17:04gfredericksI once saw a video where a guy did some clojure performance tests, but when I looked at the code it turned out he was just testing the time it took to create lazy seqs, as they were never realized
17:04crazyFoxTimMc: just a little microbenchmark. 100 000 iterations for the inner loop
17:04zerokarmaleftbet they were fast
17:04gfrederickszerokarmaleft: they were rather fast
17:04zerokarmaleftheh
17:05gfredericksI also remember another perfomance test that the jvm must have somehow optimized away, as the results indicated something like petaflop-equivalent performance
17:05cb`technomancy: Thanks for your help, this is working well enough :) I have got clojure-mode from marmalade again. Will keep an eye out for new versions.
17:06technomancysure
17:06technomancyhopefully some CLer can get things sorted out with the quicklisp versions too
17:06TimMccrazyFox: Did some of my own (100K, repeated until times settled out) -- got a 20x improvement by using (double)
17:08TimMcMoral of the story: FLOPs are *expensive*.
17:08cb`I'm not sure what the steps would be to try lein-swank with the quicklisp version of slime but it would be nice yes
17:08crazyFoxTimMc: u mean: ration op are expensive...?
17:08crazyFox*ratio
17:08crazyFoxops
17:08technomancycb`: well that might be a bit much; it would involve changing swank and breaking everyone on the stable version of slime
17:09technomancybut getting the stable version and the cvs version to coexist would be nice
17:09gfredericksfloating operations per second are expensive?
17:09TimMcHmm, good point -- it doesn't actually do two FLOPs.
17:09TimMcgfredericks: FLOPs, not FLOPS. :-)
17:09gfredericksTimMc: :P
17:09TimMcFLoat OPs
17:09gfredericksacronyms are expensive
17:09zerokarmaleftthere's a stable version of slime?
17:09TimMcAAE
17:09gfredericks\o
17:10technomancyzerokarmaleft: sure. I mean, I just picked a working version arbitrarily and called it "version 20100404"
17:11TimMccrazyFox: Hrm, you're right! It is definitely the rational ops.
17:11technomancybut in practice it has proven to be very stable
17:11gfredericksFLOPs are cheap, but they never give you the correct answer. no matter what math you're doing, the result is always wrong by 0.00000079
17:11crazyFoxTimMc: y, THEY are the real expesive ones ^^
17:11crazyFoxTimMc: good that ur result is about the same than mine - confirms my trust in this microbenchmark thingy im using
17:11TimMc(/ (double 2) 3 1.0) is only 3x slower than (/ (double 2) 3)
17:12zerokarmalefttechnomancy: ah i thought you were referring to a stable release out of the CL devs
17:13technomancyzerokarmaleft: oh... wouldn't that be nice. =(
17:13TimMcI also tried hinting with (int) in case that was the problem, but it didn't make a difference.
17:14crazyFoxcould be even slower, since long is the default...
17:14gfredericksI'm using clojure-maven for a clojure/java project, and am not sure how to handle the clojure depending on the java and vice-versa
17:15gfredericksboth the "compile" and the "clojure:compile" tasks fail for the other not having been run
17:15gfredericksI normally use leiningen, so I'm sure I'm just missing something obvious
17:16brehautgfredericks: did you remember to slaughter the goat at the appropriate hour?
17:16gfredericksbrehaut: CRAP
17:16gfrederickswell there goes another 24 hours of productivity
17:16technomancyI bet you're missing the SCSI terminator at the end of your chain.
17:16brehautgfredericks: its the first rule of new build systems
17:17arkhwould the correct way to 'serialize' the value of a symbol be with pr, pr-str, etc. ? And if so, how does one deserialize the data back into a symbol?
17:17gfredericksI tried setting <packaging>war</packaging> to <packaging>clojure</packaging> as suggested in the clojure-maven readme, but that caused my tests to fail, so I set it back to war
17:17TimMccrazyFox: I'm on 1.2. You?
17:17gfredericksarkh: read-string
17:18gfredericksand yes
17:18gfredericks,(read-string ":foo")
17:18clojurebot:foo
17:19arkhgfredericks: thank you
17:19TimMcarkh: Standard warning: Understand the implications of *read-eval* if you use read-string on user-provided data.
17:19gfredericks,(-> 'famished pr-str read-string type)
17:19clojurebotclojure.lang.Symbol
17:19hugodgfredericks: I don't think the dependencies between java and clojure can be resolved automatically, so you will need to add an execution for whichever bits need to be built first
17:19crazyFoxTimMc: 1.3.
17:19arkhTimMc: right! I planned on using it only on my stuff
17:20gfrederickshugod: as I've never done anything in maven that required creativity, could you suggest some terms to google to get me started with that?
17:20zippy314hoping for some love on my cljs cookie question: has anybody successfully used cookies in clojurescript with goog.net.cookies? I keep getting this error: 'this.isValidName' [undefined] is not a function" (Safari) or "Uncaught TypeError: Object [object DOMWindow] has no method 'isValidName'" (Chrome) when I try to set a cookie via goog.cookies.set.
17:21zippy314s/goog.cookies.set/goog.net.cookies.set/
17:21lazybot<zippy314> hoping for some love on my cljs cookie question: has anybody successfully used cookies in clojurescript with goog.net.cookies? I keep getting this error: 'this.isValidName' [undefined] is not a function" (Safari) or "Uncaught TypeError: Object [object DOMWindow] has no method 'isValidName'" (Chrome) when I try to set a cookie via goog.net.cookies.set.
17:21TimMcgfredericks: psilocybin
17:21hugodgfredericks: maybe http://maven.apache.org/guides/mini/guide-default-execution-ids.html
17:22gfrederickshugod: thanks
17:22TimMcIt should help witht he creativity, although perhaps not with maven specifically.
17:22hugodgfredericks: never tried it it with clojure-maven-plugin…
17:23dnolen_zippy314: seems like some context is not being properly bound. ClojureScript is pretty new territory, might want to ask on the ML as well.
17:23zippy314yah.
17:23gfrederickshugod: do you use the clojure-maven plugin? if not, maybe it has a way to do this automatically...
17:23zippy314Ok. thanks.
17:23gfredericksI'd think it be pretty common in clojure-java projects
17:24duck1123I think in cases like that, you might want to split your project into multiple modules
17:24hugodgfredericks: I've used it - I mainly use zi now. Bi-directional dependencies aren't that common, I think
17:25gfrederickshugod: really? E.g., I need to provide an implementation of an interface. The java code needs to call my factory method, and the clojure code needs the definition of the interface. Is this simpler than I think it is?
17:26hugodas duck1123 said, separate modules may be easiest
17:26gfredericksoh hmm.
17:26technomancygfredericks: you could use resolve to get the factory at runtime maybe?
17:27technomancybut yes, it's very uncommon to need bidirectionality
17:27gfrederickstechnomancy: if you wanted to implement an interface to supply to the java code, what would you do? break the project into modules? use resolve?
17:27technomancyI'd use resolve if the Java only needs a handful of clojure defns
17:28technomancybut I've never written any Java, so what do I know
17:28gfredericksha.
17:28technomancyI have seen this problem in Mirah though
17:28technomancysolved imperatively in ant
17:29gfredericksI guess I'll break out a bit of java and create a ClojureBridge class
17:29technomancyso by comparison, runtime resolution is much less hideous
17:29technomancyis definterface out of the question?
17:30gfrederickstechnomancy: to duplicate the definition of the interface? The java code is not mine, so I'm trying to avoid disturbing it
17:30technomancyoh, I figured you owned the java
17:30gfredericksIt's mine in the sense that I can do what I want, but I didn't write it
17:30gfredericksit's sorta forked off another project
17:30gfredericksso e.g., when they create another release, I'd like to be able to merge in their changes painlessly
17:30gfredericksif I rewrite half of the code...
17:32gfrederickstechnomancy: hugod: duck1123: thanks for the help
17:32gfredericks(doseq [handle [technomancy hugod duck1123]] (inc handle))
17:33gfrederickslazybot: your karma evaluator is worthless???
17:33lazybotgfredericks: How could that be wrong?
17:33lazybotkarma: It's 'you're', you fucking illiterate bastard.
17:34gfrederickslazybot: what kind of word has three apostrophes in it?
17:34lazybotIt's AWWWW RIGHT!
17:35cgraydoes (empty? (filter foo bar)) short-circuit?
17:36gfrederickscgray: yes, since filter is lazy
17:36gfredericks,(empty? (range))
17:36clojurebotfalse
17:37cgraygfredericks: cool example :)
17:37gfredericksI guess that was kind of an irrelevant example
17:37gfredericks,(empty? (filter even? (range)))
17:37clojurebotfalse
17:37gfredericksthere we go
17:38cgrayyeah, that makes sense
17:38gfrederickscgray: the term "short-circuit" sounds a bit funny. It's normally just phrased as laziness.
17:39cgraygfredericks: yeah, I was thinking of it more like the way `and' short-circuits...
17:39ibdknoxgfredericks: that is a commonly accepted term for stopping as soon as a value is known
17:40gfredericksibdknox: I know, I've just never heard it used when laziness is a sufficient description
17:40ipostelnikgfredericks, I don't think empty? is lazy
17:40gfredericksipostelnik: in what sense?
17:41ipostelnikactually, it probably is lazy, in a sense that computation is not performed until the result is needed by something
17:41gfredericksipostelnik: I think the computation is performed in that it calls first on the input
17:42ibdknoxit's actually (not (seq x))
17:42gfredericks,(let [dont-care (empty? (map #(println "foo") (range 2)))] "constant")
17:42clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval79$fn>
17:42gfredericksaugh
17:43gfredericksibdknox: would seq not call first?
17:44gfredericks,(let [dont-care (empty? (map (fn [_] (println "foo")) [1 2]))] "constant")
17:44clojurebotfoo
17:44clojurebotfoo
17:44clojurebot"constant"
17:45ibdknoxnot lazy :)
17:45gfredericksI suppose chunked seqs could mess up expectations
17:45ibdknoxit escapes into java pretty quickly and I'm too lazy to look what it does :p
17:46gfredericksI didn't mean that empty? itself is "lazy", I meant that filter is lazy and empty? only checks the front of the list
17:46gfredericksso as demonstrated earlier, you can pass an infinite seq to filter and check if it's empty and get a return
17:46ibdknoxyep yep
17:47gfredericksbut chunking can screw that up
17:47arohnerwhat are the advantages of deploying a ring/noir app to say.. tomcat as opposed to nginx or apache?
17:47arohneror is there any reason to not just use jetty in production?
17:48ibdknoxarohner: anecdotally I've had no troubles with Jetty, but presumably someone has a real answer to that question :)
17:50ipostelnikempty? seems to force the first chunk of the lazy seq
17:50gfredericksipostelnik: right
17:51ipostelnikso it's not lazy in same way as map is
17:51gfredericks(let [dont-care (empty? (map (fn [_] (println "foo")) '(1 2)))] "constant")
17:51gfredericksdangit I always mess up codez
17:51ipostelnik,I think it reduces the weight of the small rare tz
17:52clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: I in this context, compiling:(NO_SOURCE_PATH:0)>
17:52gfredericksipostelnik: I think that's the chunked seq's fault though. empty? only cares about the first element
17:52ipostelnik,(let [x (map prn (range 2))] "foo")
17:52clojurebot"foo"
17:52arohneripostelnik: if you want to see whether there is a first item, you always have to force it. map doesn't force, because it doesn't care whether there is a first node (until map's consumer forces)
17:52ipostelniksorry
17:52ipostelnik,(let [x (empty? (map prn (range 2000)))] "foo")
17:52clojurebot0
17:52clojurebot1
17:52clojurebot2
17:52clojurebot3
17:52clojurebot4
17:52clojurebot5
17:52clojurebot6
17:52clojurebot7
17:52clojurebot8
17:52ibdknoxlol
17:52clojurebot9
17:52rbransonuh oh
17:52clojurebot10
17:52TimMc>_<
17:52clojurebot11
17:52ipostelnikwoops
17:52clojurebot12
17:52clojurebot13
17:53clojurebot14
17:53clojurebot15
17:53ipostelnikit only goes to 31
17:53clojurebot16
17:53clojurebot17
17:53clojurebot18
17:53TimMctimeout, plz
17:53clojurebot19
17:53clojurebot20
17:53clojurebot21
17:53clojurebot22
17:53clojurebot23
17:53clojurebot24
17:53clojurebot25
17:53clojurebot26
17:53clojurebot27
17:53clojurebot28
17:53clojurebot29
17:53clojurebot30
17:53clojurebot31
17:53clojurebot"foo"
17:53gfredericksthis is the worst disaster #clojure has seen since the great infinite seq of 2007
17:53TimMchaha
17:53ibdknoxhaha
17:53rbransonhah
17:53ipostelniksorry about that
17:53dnolen_chunked seqs strike again.
17:54ipostelnikanyway, if empty? were lazy you wouldn't see any numbers printed here
17:54gfrederickswhy didn't rich chunk them to a more IRC-appropriate size?
17:54TimMcipostelnik: Was that "sorry" at __:50 in advance? :-P
17:54ipostelniknoidi, that one was a copy-and-paste error with ,
17:54gfredericksipostelnik: I never meant lazy in that sense. That sort of lazy wouldn't be possible without using a delay object and having to deref the result
17:54ipostelnikI'm not using x anywhere
17:55TimMc&(let [x (map prn (range 2000))] "foo") But this is safe.
17:55lazybot⇒ "foo"
17:55ipostelnikbecause map is lazy
17:55TimMcFully.
17:55ipostelnikempty? computes the value right away
17:55gfredericksno, because seqs can be lazy but atomic values can't be
17:56TimMc&(let [x (first (map prn (range 2000)))] "foo")
17:56lazybot⇒ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 "foo"
17:56TimMclazybot: botsnack
17:56lazybotTimMc: Thanks! Om nom nom!!
17:56ipostelniklazybot is better at long output :)
17:56ibdknoxis there some significance for it being 32 elements in a chunk?
17:57gfrederickssomething about 5 bits I'm sure
17:57amalloyibdknox: probably because vectors have a branching factor of 32
17:57ibdknoxamalloy: ah
17:57TimMcand 32 is 2 to the whatever
17:57ipostelnikamalloy, what is branching factor?
17:58TimMcThere was just a good link about this.
17:58TimMcipostelnik: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
17:58ipostelnikTimMc, thanks
17:59TimMcLong story short, the vectors are implemented as trees.
18:20cgraywhat's the timeout for solutions to the 4clojure.com exercises?
18:21amalloycgray: 10s for each testcase
18:22cgrayamalloy: interesting, i wonder why i'm timing out... i have a solution that's running in 6s on my (not very powerful) machine
18:22amalloycgray: sandboxing takes extra time. more time than we can really understand, tbh
18:22devnTimMc: That is a fantastic post. I'm building a list of stuff for people of my Clojure users' group to read, and that is definitely now on the list.
18:23cgrayamalloy: ok, good to know... i'll just have to do more optimization i guess :)
18:25amalloycgray: solving levenshtein distance? not many of the other problems have performance issues
18:25cgrayamalloy: no, balanced primes
18:26cgrayamalloy: my first solutions have were atrocious, but i should be getting close now
18:26amalloycgray: hm. i didn't make any special effort to optimize, and my testcases run in 1-2s total
18:29amalloycgray: mind if i take a look?
18:29cgrayamalloy: no, should i paste it somewhere?
18:29amalloyi guess that makes it sound like i can look at it without you gisting it or something, which i can't
18:30amalloyyeah, please
18:30cgrayhttp://pastebin.com/twX4B7A5
18:33amalloycgray: well, you're recomputing the list of primes a zillion times, it seems to me
18:34cgrayamalloy: i'm trying not to
18:34amalloyeg, (is-prime n) has to compute all the primes up to n, and then if it returns true you immediately call next-primes again
18:34cgrayright, that's two computations :)
18:34amalloymy solution was to let a lazy seq of all the primes outside the function itself, and then just use that for reference without recomputing it
18:35amalloy(letfn [(primes [] (...compute primes...))] (let [all-primes (primes)] (fn [n] (...solve actual problem...))))
18:35cgrayok, makes sense
18:36amalloywhich is especially useful for the last test case where your function gets called once on every number up to 1103
18:36cgrayyeah, that's the one that's killing me
18:37cgraycool, thanks for the hint
18:43sridclosure doesn't have a prependChild? what a shame.
18:44patchworkhey all, is there a quick way to get the path of the project root in a lein project?
18:44patchworkso I have a project in "/Users/xxxxx/projects/lein-project"
18:45patchworkand I want that as a string
18:45sridwhat would this be if your app is run as a jar?
18:45patchworkto do various programmatic things
18:45patchworksrid: sure?
18:45patchworkalthough that is a good question, I still have access to the filesystem from a jar right?
18:46patchworkor is it some kind of encapsulated system?
18:46sridcompojure uses resources/ directory for css, img, js and things. they get wrapped in a jar. so maybe you can look at compojure's route/resources implementation
18:46patchworkas you can tell, I have much ignorance towards the practical side of jars and java deployment
18:46patchworksrid: Aha
18:47patchworkI have users uploading images
18:47patchworkso I want to write those images somewhere in the project dir
18:47patchworkshould those go in resources too?
18:47patchworkI thought resources were more for application resources, not user generated content
18:47ArafangionGenerally yes.
18:47sridprobably not. why not $HOME/.project-uploads
18:48ArafangionAs in, Generally "yes, you're correct".
18:48patchworkSo, do I have access to $HOME from inside clojure?
18:48srid&(System/getenv "HOME")
18:48lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.HOME)
18:48patchworkall of these practical issues I haven't had to deal with yet from clojure
18:48patchworknice
18:48amalloyyes, though you shouldn't get at it that way
18:49patchworkamalloy: so where should I put all of these images? : )
18:49patchworkI guess that is a better question
18:49amalloy(System/getProperty "user.home")
18:49amalloymore portable than getenv of "HOME"
18:49sridright, windows has no HOME by default
18:50sridthat's the first thing I do on every windows install
18:50patchworkamalloy: Aha, that is helpful
18:50srid$g gridfs filesystem
18:50srid$google gridfs filesystem
18:50lazybot[mongodb - Is GridFS fast and reliable enough for production ...] http://stackoverflow.com/questions/3413115/is-gridfs-fast-and-reliable-enough-for-production
18:50patchworkstill though, is there a best practice for where to store user files in a lein project?
18:50amalloypatchwork: just store them in .
18:51amalloyor ./users/images, whatever
18:51amalloyyou can still construct java.io.File objects, and the cwd is whatever the cwd was when you started the jvm
18:51patchworkSo if I reference '.' from a file, it gives me the root of the project?
18:51patchworkokay, that is good
18:51patchworkthat is what I was wondering
18:52amalloy&(-> (java.io.File. "test") .getAbsoluteFile)
18:52lazybotjava.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
18:52amalloyfeh
18:58sritchiehey guys, is there some equivalent to defalias in clojure 1.3?
19:56ibdknoxSteve Jobs died :(
19:57duck1123we all knew it was coming. Didn't think it would be this soon
19:57duck1123Of course, it makes sense that he would wait to step down til the last moment
20:03sridaleph + clojurescript + websocket awsomeness.
20:04duck1123srid: you got it working?
20:04sridduck1123: yup, in a company project. so I'm considering doing it again in a minimal example app and writing a blog about it.
20:05jayunit100aleph?
20:05duck1123look forward to seeing that
20:05srid$google aleph lamina
20:05lazybot[ztellman/aleph - GitHub] https://github.com/ztellman/aleph
20:05jayunit100srid what is this stack that you put together>
20:07sridjayunit100: see above. lamina is also ztellman's project. i may write about it in the weekend.
20:07sridi was afraid of using clojurescript, for I didn't how easy it would be to debug cljs. in practice, it seemed as if i was able to develop client side code /faster/ in cljs than js.
20:08jayunit100oh ok.
20:09jayunit100so your application is a bunch of web clients talking to each other ?
20:12jayunit100leiningan guy !
20:13technomancyIRC user with a number in his nick!
20:13ibdknoxlol
20:14jayunit100yuppppp
20:24cemerickibdknox: FYI, I've not yet hit any big snags using ClojureScript as a long-lived (very relatively speaking at this point) library.
20:25ibdknoxcemerick: awesome :)
20:25ibdknoxcemerick: what tools have you been using?
20:25cemericktools?
20:25clojureboteg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging
20:25ibdknoxlol
20:25ibdknoxcemerick: browser repl, cljs-watch, repl compiler?
20:26cemerickno, no, and no
20:26cemerickJust regular REPL, compiling cljs forms down to js strings, stuffing that into couchdb
20:26cemerickOutside of my flailing around with cljs, it's worked without a hitch.
20:27cemerick(maybe that's what you meant by 'repl compiler')
20:27jayunit100what does <== do
20:27ibdknoxyep :)
20:28cemerickI guess I didn't categorize that as a tool. :-)
20:28cemerick'tool' implies artifice to me. Code is…just code.
20:28sritchiecemerick, just wanted to let you know that Couchbase Single worked great
20:29sritchiethanks for the help
20:29ibdknoxyeah, I guess so. I didn't think about the fact that you were outputting to place it into couchdb
20:29ibdknoxthat makes most of those not useful lol
20:29cemericksritchie: That's interesting! I'd be curious if the stock CouchDBX for 1.0.2 or whatever would work for you too.
20:29cemericke.g. maybe it's the homebrew build getting in the way
20:30sritchiecemerick: I'll go ahead and test out couchdbx as well; I'll also take a look at that homebrew build and see if I can track down what it's sending to clojure, to start up the jvm
20:30cemerickibdknox: just different use cases. I'm not a web guy, so it's properly stereotypical of me to totally ignore all the nifty things going on in those spaces.
20:31duck1123does anyone know of a good way to keep firefox from popping up and stealing focus when doing tests with clj-webdriver?
20:31ibdknoxcemerick: yep yep. Good to go for tomorrow then? :)
20:31duck1123it makes it impossible to get anything done when I'm running features
20:32cemerickibdknox: yup, it'll be nifty. Some definite TODOs, but it'll be a nice demonstration, and another good cljs use case.
22:00glob157is it idiomatic to do (class? Seq) to test before calling cons or distinct or other seq funcs ?
22:00brehautglob157: seq? would be more idiomatic
22:01glob157oh ok. would mine work ?
22:01gfredericksno
22:01glob157&(class? Seq [2 1])
22:01lazybotjava.lang.Exception: Unable to resolve symbol: Seq in this context
22:01gfredericksglob157: you're probably wanting instance?
22:01brehautglob157: depending on what you are doing (seq thing) is more idiomatic still
22:02glob157why instance?
22:02dnolenglob157: why do you need to test before calling seq functions?
22:02brehautglob157: class? tells you if something is a class
22:02glob157well , clojure is loosely typed. so seems like you would want to test such things
22:02khaliGhe probably means just plain class
22:02brehaut,(map class? [(list 1 2) java.util.Date 1 :a])
22:02clojurebot(false true false false)
22:03dnolenglob157: it is not idiomatic to include such tests
22:03glob157a list isnt a class ?
22:03glob157nor is :a ? thats odd.
22:03glob157how do they work in the jvm then
22:03brehautglob157: no, only classes are classes.
22:03gfredericksglob157: they're objects, not classes
22:03brehautglob157: they are objects, aka instances, of classes
22:03glob157duh oops
22:04gfredericks,(class? Class)
22:04clojurebottrue
22:04gfredericksI'm not sure why I did that, that was probably just confusing.
22:04glob157(class? (java.util.Date new))
22:04gfredericks,(class? (new java.util.Date 2840824))
22:04clojurebotfalse
22:04brehautglob157: also, clojure is not loosely typed, it is dynamically typed.
22:04glob157&(class? (java.util.Date new))
22:04lazybotjava.lang.Exception: Unable to resolve symbol: new in this context
22:05glob157&(class? (new java.util.Date))
22:05lazybot⇒ false
22:05gfredericks&(instance? java.util.Date (new java.util.Date))
22:05lazybot⇒ true
22:05khaliGglob157, i think you meant (class (new java.util.Date))
22:06glob157yup
22:06brehautglob157: loosely typed implies that the data can be reinterpreted, such as in C where you can cast things about, or in some interpreted languages where coercion happens all over the place and is implicit
22:06dnolenglob157: if you want to guarantee invariants, use pre-post conditions. those at least can be turned on / off
22:08hugoddnolen: did you manage to get warn-on-reflection into your pom?
22:09glob157yeah, pre/post is nice. whats the point of the @symbol
22:09gfredericksglob157: it's short for deref
22:09gfredericks,(deref (atom 8))
22:09clojurebot8
22:09gfredericks,(let [a (atom 8)] @a)
22:09clojurebot8
22:09brehaut,(read-string "@(atom 8)")
22:09clojurebot(clojure.core/deref (atom 8))
22:10gfredericksslick.
22:10dnolenhugod: no, but thanks for the tip, will use that in the future.
22:11amalloy&'@(atom 8) ;; brehaut - no need for read-string
22:11lazybot⇒ (clojure.core/deref (atom 8))
22:11brehautamalloy: i know three no need, but read string makes it clearer that it occurs in the reader
22:13gfredericksamalloy: that had as many punctuation marks as it did alphanumerics.
22:13amalloygfredericks: welcome to perl
22:13gfredericksaw I hate these dreams
22:14brehautamalloy: not quite, perl is more punctuation than alphanumeric
22:14amalloybrehaut: i carefully did *not* do it inline with ##'@(atom 8), see
22:14lazybot⇒ (clojure.core/deref (atom 8))
22:15brehautwait, am i in #perl? when did that happen‽
22:15gfredericksbrehaut: anything can happen when you're dreaming
22:48dnolenmatch 0.2.0-alpha4 out. Mostly involved deleting code, YAY
22:54toxmeisterhiya… could someone pls tell me briefly what the correct pattern is for when using primitive type hints ^double or boxed ones ^Double (w/ 1.3)? am encountering all sorts of weird compiler errors like: "Unable to resolve classname: clojure.core$double@1f3a34af"
22:55sridwhat is it with CL/scheme kids looking down upon people learning clojure? http://news.ycombinator.com/item?id=592502
22:56brehautsrid: the narcissism of minor differences
22:56sridthe only argument I can accept is the utility of works like SICP.
22:57sridthey tell me to study every dialect of lisp, their specs, libraries, etc.
22:57sridwhich is crazy
22:57srid"play around with all the dialects and implementations it supports"
22:58brehautsrid: racket's environment is a good argument for learning racket / scheme over another lisp
22:58brehautsrid: you realize that thread is two and a half years old right?
22:59sridyes. someone I know forwarded it, along with his arguments to learn CL over clojure, to me recently.
22:59sridfwiw, i did study most of sicp (and that affected the way i programmed / thought-about-programs in other languages).
23:01dnolensrid: mahmud doesn't know anything about Clojure (as far as I know) so informed opinion that is not.
23:02dnolensrid: but the gist of what he says is true. While it's not necessary, surveying the various languages from Rich Hickey's Amazon book shelf will enrichen your understanding of Clojure.
23:03sridI agree. I have some of them in my wishlist, just need to find time and energy to get to them.
23:03brehautdnolen: his biggest mistake is probably in that thinking only one language could possibly have influenced the design of clojure
23:04srid... though how exactly would 'enriching' my understanding of Clojure help (if I'm not going to design a new programming language)?
23:04ibdknoxto command a thing you have to know it inside and out
23:05ibdknoxenriching your understanding of Clojure gives you greater control over it
23:05sridfor example?
23:06ibdknoxperformance is a great example
23:07dnolensrid: have you done much work w/ code that might callback at anytime creating subtle race conditions? (even in JavaScript)
23:07sjlif anyone feels like tearing apart my first Noir webapp and telling me how to make it better, I'd love advice: https://github.com/sjl/newseasons
23:08dnolensjl: you're on a Clojure roll.
23:08sriddnolen: not much - in the distant past i did a bit of python twisted deferred programming, don't remember having to debug race conditions.
23:08sjldnolen: hah, not really. I've paused Clojurecraft until Notch stops breaking the damn wire protocol all the time :)
23:08amalloytoxmeister: should be ^double afaik
23:09sridis callback-based programming related to enriching clojure understanding through studying various works based on lisp?
23:09brehautsjl: not strictly clojure, but your email regex is invalid
23:09sjlbrehaut: I used the one here: http://www.regular-expressions.info/email.html
23:10ibdknoxsjl: there's one in noir
23:10sjlbrehaut: I mostly agree with the Trade-Offs section on that page
23:10sjlibdknox: yeah, but I needed it for the route, and the only one I saw in noir is a function, not a raw regex
23:10ibdknoxsjl: ah, yep :)
23:11dnolensrid: Mozart/Oz has a pretty amazing declarative programming model that makes programming under concurrency trivial - it eliminates the problems around ordering entirely.
23:11ibdknoxsjl: fwiw you don't need to explicitly state a route is [:get], it's that by default
23:11brehautsjl: http://commons.apache.org/validator/api-1.3.1/org/apache/commons/validator/EmailValidator.html
23:11toxmeisteramalloy: thx, that's what i thought, but here's the deal:
23:11sjlibdknox: yeah, I did that to make it easier to change as I worked with the pages, but I could go ahead and remove them now
23:11toxmeisterthis doesn't work: (def ^double PI 3.14) (defn rad ^double [^double x] (/ (* PI x) 180.0))
23:12dnolensrid: if you understand that, promise/deliver makes a lot more sense.
23:12toxmeisterbut this one (boxed) does work: (def ^Double PI 3.14) (defn rad ^double [^double x] (/ (* PI x) 180.0))
23:12ibdknoxsjl: is there a reason you use (form-to) sometimes and not others?
23:12amalloytoxmeister: that's not how typehints on defs work
23:12dnolentoxmeister: if you're on 1.3.0 you don't want vars for things like PI, you want constants anyhow.
23:12sjlbrehaut: I need the regex as an actual Clojure regex for the Noir URL, not just a function/validator
23:13brehautfair enough
23:13amalloyif you hint a def's name, you're marking it as "a function which returns this when called"
23:13amalloyor some such
23:13sriddnolen: I see. that's specific enough, for me. :-) i wish there was "matrix" of programming languages where the cells represent the benefit of learning Y in understanding some features of X.
23:13sjlibdknox: nope, I think I learned about form-to halfway through, hah
23:14ibdknoxsjl: having an email in the url is a bit weird to me, but I guess there's nothing technically wrong with it
23:14ibdknoxsjl: look up pre-route :) You shouldn't need to put your (login-required) wrapper all over the place
23:15brehautibdknox: not being an expert with clout / webnoir, does the url rules allow you to specify any callable as a validator?
23:15toxmeisteri see, didn't know that def's can't be dealt with the same way (sorry if this has been a case of RTFM, but i went in circles an thought I've read everything i could find about that topic)
23:15sjlibdknox: yeah, I didn't want to have usernames and I don't trust myself to slugify URLs perfectly. It's a bit weird though, you're right.
23:15sjlibdknox: I saw pre-route but couldn't figure out how to make it work with the email url
23:15sjlibdknox: pre-route seems to only take a string, not a regex
23:16ibdknoxsjl: same routing mechanism as defpage
23:16ibdknoxsjl: the only difference is that the thing you destructure isn't params, it's the entire request
23:16ibdknoxsjl: so you should be able to do anything you could with defpage
23:16alandiperttoxmeister: (def ^:const PI 3.14) (defn rad [x] (/ (* PI x) 180)) ; PI a constant, rad won't box
23:17ibdknoxbrehaut: compojure only allows regexs I believe
23:17sjlibdknox: hmm, okay, I'll take a closer look at that
23:17brehautibdknox: ok. I'm used to mustache allowing fns
23:17ibdknoxbrehaut: though, it's trivial to do that check in the body
23:18brehautof course
23:18ibdknoxsjl: wait, why does the email route make a difference? From what I can tell everything other than / requires a login
23:19ibdknoxsjl: so you could just do (pre-route "/*" [] (when-not authed ...
23:21sjlibdknox: just tried that, it first on / too
23:21sjls/first/fires/
23:21lazybot<sjl> ibdknox: just tried that, it fires on / too
23:21sjlibdknox: so going to / when not logged in goes into an infinite redirect loop
23:23ibdknoxah
23:24ibdknoxhm, I'm not sure if there's some trickery we could do there or not
23:24glob157how would i make a future write to a queue with a "listener" on it .... like for an a synchronous web request/process
23:24ibdknoxmost of the time restricted urls are under their own path
23:25sjlibdknox: yeah, on a bigger site I would have done that
23:26ibdknoxsjl: lol since all your urls are only one segment, you can do [:get ["/:something" :something #".+"]]
23:26ibdknoxlol
23:26sjlibdknox: so I tried this, and it doesn't work: (pre-route [:get ["/:anything" :anything #".+"]] {:keys [anything]} ...)
23:26ibdknoxthat would work
23:26sjlibdknox: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentVector
23:26ibdknoxhm
23:26ibdknoxsjl: sounds like I have a bug to look into, can you add an issue in github
23:26sjlibdknox: sure
23:28glob157just found "full disclojure" ... very high quality videos.
23:31ibdknoxsjl: looks pretty solid :)
23:32sjlibdknox: cool, thanks. now I need to figure out how to add tests, hah
23:32ibdknox:)
23:32ibdknoxsjl: what's this about? https://github.com/sjl/newseasons/blob/master/src/newseasons/loops/refresh.clj#L11
23:32sjlibdknox: I'll have to consolidate the redis stuff in one place and use a separate db for testing I guess
23:33sjlurl 1
23:33sjlderp
23:34sjl,(sort < ["b" "a"])
23:34clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
23:34sjlibdknox: ^ that
23:34ibdknox(sort ["b" "a"])
23:34ibdknox,(sort ["b" "a"])
23:34clojurebot("a" "b")
23:34sjlwtf
23:34ibdknoxlol
23:35sjlibdknox: actually I don't need to sort, I actually need to compare two
23:35ibdknox(> "a" "b")
23:35sjlibdknox: https://github.com/sjl/newseasons/blob/master/src/newseasons/loops/refresh.clj#L36
23:36ibdknox,(> "a" "b")
23:36clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
23:36ibdknoxah
23:36sjlibdknox: I could just inline the compare call, but I think pulling it out makes it easier to read
23:37ibdknoxhm, I've got to believe there's something that does that correctly
23:37sjlibdknox: if there is, let me know :)
23:39trptcolinjava interop noob question: i have a thread that i'd like to raise an exception on from a different thread. (.interrupt thread) doesn't appear to be sufficient - any hints?
23:41trptcolini can verify that the thread gets isInterrupted set, but can't seem to trigger an exception. i'm also very open to a more clojure-y solution if there is one as i suspect
23:42alandiperttrptcolin: in the target thread, are you in a loop of some kind?
23:42duck1123trptcolin: My guess is you're going to need to have that thread monitor some shared state and then throw
23:42amalloytrptcolin: threads can only throw InterruptedExceptions at particular blocking-points, such as while waiting on a socket
23:42trptcolinalandipert: yup
23:43trptcolinamalloy: ahh, that explains that
23:43alandiperttrptcolin: are you blocked on a queue in your loop? or socket/io
23:44sjlibdknox: Oh, another thing, when I'm working in the auto-reload mode and make an error, I get the traceback the first time I visit the page,
23:45trptcolinio - i'm still digging into the internals of jline here to see where the blocking is
23:45sjlibdknox: but if I refresh it seems like it goes back and uses the old version of the code
23:45sjlibdknox: until I make another change, and then it reloads again
23:45trptcolinof course: InputStream read
23:45ibdknoxsjl: that's because it was a compile error and wasn't actually able to load the file
23:46alandiperttrptcolin: i cooked up https://gist.github.com/1214282 to deal recently with a similar problem, approach may or may not be useful to you
23:46sjlibdknox: Hmm, I don't suppose there's a way to make it not do that? When I'm developing I always want to see the result of the current state of the code
23:46ibdknoxsjl: not that I can think of :/
23:46ibdknoxsjl: I look into it thoug
23:48sjlibdknox: cool, thanks
23:48alandiperttrptcolin: fill-queue (used to be in seq-utils, dunno where is now) is another way, may be applicable as well. beats explicit loop/block, anyhow
23:49trptcolinyeah, unfortunately the loop itself is in code i'd prefer not to control
23:50alandiperttrptcolin: maybe you can feed it a dummy val to unblock, then interrupt
23:51alandiperthack city though :-\
23:51trptcolininteresting.
23:51trptcolinit's already hack city
23:51alandipertthen let's paint the city purple
23:51trptcolini'm essentially trying to trap SIGINT to have a REPL that doesn't quit on ctrl-c, but just skips to the next prompt
23:52trptcolintotally hotspot-specific, i know, but it's a dream
23:53alandiperttrptcolin: running from cli? maybe you can wrap with shim that traps and doesn't propagate
23:55trptcolinright. so here's the other thing: i'd like to be able to, say, kill running infinite loops as well
23:56trptcolinbasically what irb does
23:56trptcolini can "stty intr undef" and skip all ctrl-c's, but that makes the other stuff impossible
23:57duck1123trptcolin: that's also what swank does. (in emacs, at least)
23:59trptcolinhmm, i don't know much about swank - wonder if it's in clojure or elisp
23:59trptcolin*clones*