#clojure log - Oct 24 2012

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

0:51 Sgeo: I should attempt to wrap my mind around derive

0:51 Is it something like inheritance, kind of sort of?

0:52 Except I get the impression that everyone shies away from multimethods for "performance" reasons :(

0:52 doomlord: is there an existing c-embeddedable (subset-of-?)clojure, perhaps forked from a scheme or ecl

0:56 Raynes: Sgeo: I don't think that is true.

0:56 Sgeo: If people shy away from multimethods, it's because protocols are a better fit. Protocols may be faster, but they also serve a completely different purpose.

0:56 technomancy: multimethods are the best*

0:57 * - for polymorphism, which you really never need

1:01 Sgeo: there are some locking issues with multimethods that have been fixed in 1.5, but most people who say "multimethods are too slow" haven't even measured the difference and just use protocols because whoa shiny

1:01 * Sgeo thinks multimethods are shinier

1:07 Raynes: technomancy: You so do need polymorphism. Go look at the giant case switch in the node IRC library that makes up 98% of the whole library and then go look at my multimethod implementation of the same thing in Irclj. I'm shell shocked in languages that don't have multimethods now.

1:11 perezd: I need to make a clojure regex for a values like foo.bar.8000.status, foo.bar.9001.status

1:11 that select anything foo.bar.*.status

1:12 not sure whats right here..

1:12 #"foo\.bar\.\{1.4}\.status"

1:12 is what I tried

1:15 Sgeo: Someone in #lisp complained that on http://himera.herokuapp.com/synonym.html the "Closure and counters in loops"

1:15 section

1:15 The issue of whether or not looping constructs make a new binding or modify the old one is orthogonal to the issues of lexical scope and closures.

1:17 unnali: perezd: {1,4} instead?

1:17 perezd: I actually had tha ti Think

1:18 just kidding

1:18 I didnt

1:21 amalloy: Sgeo: i think that's a fair criticism of the himera page

1:21 Sgeo: amalloy, yeah, once I understood what they were getting at

1:22 perezd: #"frontend\.http\.\d{1,4}\.status"

1:22 this is still wrong

1:25 unnali: perezd: can you give an example of how you're testing it?

1:26 perezd: one sec

1:26 unnali: 'cause it works for me

1:26 ,(re-find #"frontend\.http\.\d{1,4}\.status" "frontend.http.1234.status")

1:26 clojurebot: "frontend.http.1234.status"

1:26 perezd: werid..

1:27 Sgeo: ,(class #'resolve)

1:27 clojurebot: clojure.lang.Var

1:27 Sgeo: Hmm, so when symbols are evaluated, they don't just evaluate to their var, they evaluate to what their var points to?

1:30 unnali: Sgeo: I'm not 100% sure at what stage it happens, but approximately, yes.

1:30 if there isn't a lexical or something bound closer.

1:42 Sgeo: Is loop/recur lexical or dynamic

1:45 unnali: I'm not sure I understand your meaning correctly; functions introduce recur-targets, so there's no way that it would behave in a way that wouldn't be "lexical" or "dynamic", in a sense

1:46 Sgeo: I can't recur from outside tail-call position

1:46 Oh, I didn't mention that I wanted to fake CL's block/return-from

1:46 Scrap the loop/recur question

1:46 unnali: aha.

1:47 not sure you'll manage that..

2:17 Sgeo: Is macroexpand-all broken?

2:17 http://ideone.com/Eoyc6K

2:26 Bike: Sorry, sgeo. I don't actually know clojure, after all

2:27 ForSpareParts: If I want a Java method to receive a Clojure function as an argument, what class/interface should I specify? I see a *ton* of things that have some relation to Fn.

2:27 Sgeo: Bike, you may end up learning

2:27 ForSpareParts: AFn/IFn/Fn, etc.

2:27 Bike: Possibly.

2:27 Anyway, it seems as though the values of &env aren't intended for public use.

2:28 Sgeo: Yeah, pretty much

2:28 Oh, I finally remembered the name of a library I wanted to mention

2:29 serializable-fns uses &env, presumably to help capture closures.

2:30 Bike: Could I get a link?

2:31 Sgeo: https://github.com/technomancy/serializable-fn

2:31 Bike: Thanks.

2:31 amalloy: Sgeo: yes, macroexpand-all is broken by design

2:32 Bike: ?

2:33 Sgeo: amalloy, o.O :( how so? I mean, it looks like it's trying to map macroexpand onto each macro, which won't preserve lexical environment

2:33 Do you mean deliberately broken, or as in it makes no sense?

2:34 amalloy: meh. a question of degree. macroexpand-all is an attempt to use simple, crude tools to somehow achieve the subtlety of a compiler

2:34 clojure.tools.macro/mexpand-all is much better, although probably not perfect

2:34 Sgeo: IdeOne isn't likely to have clojure.tools.macro, is it?

2:35 amalloy: does ideone have any compelling features?

2:35 Sgeo: It's on the web, meaning that I can be lazy and not need to open emacs or any Clojure implementation on my computer

2:36 Nice for quick demonstrations

2:36 Bike: So, mexpand-all does what? Code walker?

2:36 amalloy: what i mean is, whether something will work in ideone has never entered my consideration at all

2:38 so i dunno if it has tools.macro

2:38 Sgeo: Bike, pretty much, I think

2:39 Yes

2:40 * Sgeo twitches at noticing that khinsen is the author

2:41 Bike: If I'm reading this right, macroexpand-all just walks code dumbly as a tree? How does that ever work?

2:43 Sgeo: ,(do (require 'clojure.walk) (clojure.walk/macroexpand-all '(quote (let [a 1] a))))

2:43 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk>

2:44 Sgeo: ,(do (require 'clojure.walk :as 'walk) (walk/macroexpand-all '(quote (let [a 1] a))))

2:44 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol>

2:44 Sgeo: ,(do (require ['clojure.walk :as 'walk]) (walk/macroexpand-all '(quote (let [a 1] a))))

2:44 clojurebot: (quote (let* [a 1] a))

2:44 Sgeo: It clearly doesn't.

2:44 Bike: Wow.

2:45 Sgeo: ,(quote (let [a 1] a))

2:45 clojurebot: (let [a 1] a)

2:45 Bike: I mean, does anybody actually try to use this, or... am I missing something

2:45 Sgeo: Would be nice if clojuredoc.org supported comments

2:45 Would be adding a comment to the effect of DON'T EVER USE THIS right now

2:46 Oh, hmm, it might

2:50 perezd: so , a regex that can match "frontend.http.8002.status" and "frontend.http.8001.status"

2:50 where the 8001/8002 is anything

2:50 any advice? banging my head against the wall..

2:50 seems super basic

2:50 but its late and I'm fucking somethin gup

2:50 any number that is

2:51 basically want frontend.http.*.status

2:51 Bike: frontend\.http\.\\d*\.status, probably?

2:51 perezd: trying..

2:52 nope :(

2:52 Sgeo: http://clojuredocs.org/clojure_core/clojure.walk/macroexpand-all

2:52 Hmm, perhaps a bit alarmist?

2:53 Bike: the !!! are a bit much, perhaps

2:54 perezd: Bike any other advice?

2:54 Sgeo: Removed

2:54 By "anything" do you mean a number?

2:54 Bike: perezd: try taking out one of the backslashes before the d, I always mess those up

2:54 perezd: yes

2:55 any 4 digit number

2:55 Sgeo: perezd, also, are you using the #" reader macro (probably not correct name, but that helps clue Bike in)

2:55 Bike: frontend\dhttp\.\d{4}\.status ?

2:56 perezd: yes using #" "

2:56 Bike: er. frontend\.http\.\d{4}\.status

2:56 Sgeo: that reminds me, I was going to ask if there was something like reader macros in clojure, because then you could make your own backslash to make porting from cl a bit easier.

2:57 AimHere: There's no actual reader macros

2:57 Sgeo: make my own backslash?

2:57 But ... it has something almost but not quite like reader macros, at least recently

2:57 Bike: A reader to more closely match CL's semantics, to save you some time, I mean.

2:57 AimHere: The newest clojure had an extensible reader syntax or something

2:57 perezd: Bike: still not workin :(

2:58 Sgeo: Bike, the details of what AimHere said will annoy you: It expects the code for it to be in one particular file

2:58 relative to the project's root

2:58 Bike: Weird.

2:58 Sgeo: That sort of thing is what annoys me about Clojure the most

2:59 If you want to add a library to your project, you tend to need to restart the REPL, although there's a library that works around that

2:59 The Clojure ecosystem is rather project oriented

3:01 Bike: ok, if I'm reading java docs right, perezd, it really ought to just be #"frontend\.http\.\\d{4}\.status". If it's not that it's something very much like that. "frontend.http." literal, then exactly four digits, then ".status" literal.

3:02 perezd: I read that too…trying again

3:02 fuckin doesn't work! ahasdhfjasjkdfh

3:02 Sgeo: Maybe it's the surrounding code that's wrong, rather than the regex itself?

3:02 ,(doc re-match)

3:02 perezd: its possible...

3:02 clojurebot: I don't understand.

3:03 perezd: Bike: http://aphyr.github.com/riemann/configuring.html

3:03 look at what they do for regex

3:03 thats what I am doing basically

3:04 Sgeo: Bike, um, that double \\

3:05 ,(re-matches #"frontend\.http\.\\d{4}\.status" "frontend.http.8001.status")

3:05 clojurebot: nil

3:05 Sgeo: ,(re-matches #"frontend\.http\.\d{4}\.status" "frontend.http.8001.status")

3:05 clojurebot: "frontend.http.8001.status"

3:05 Bike: really starting to think using backslashes as both the escape character and the "regex class starts now" character was a mistake

3:05 perezd: I wish I knew why this didn't work

3:05 maybe its a bug

3:05 Bike: I already suggested "frontend\.http\.\d{4}\.status" and perezd said it didn't work.

3:06 Sgeo: perezd, maybe you could paste a snippit of your code?

3:06 perezd: https://gist.github.com/1420f4e7495e6f4fa171

3:06 using riemann config API

3:07 service should accept a regex

3:07 according to: http://aphyr.github.com/riemann/configuring.html

3:08 Sgeo: where is definitely a function?

3:08 perezd: yes

3:09 its working for non-regexes

3:10 Sgeo: Where is service defined?

3:10 perezd: I think where is some sort of macro

3:10 that makes service become accessible

3:11 Bike: According do the documentation, «Replaces (metric x y z) with a test matching

3:11 (:metric event) to any of x, y, or z, either by = or re-find.»

3:11 er, and does the same with service instead of metric.

3:11 So it just matches it to the value of the event under the :server key. I think.

3:11 perezd: found where in riemann.streams

3:12 amalloy: the regex already given is exactly correct, so any issues you're having are with this weirdo service api, not with regexes

3:12 perezd: right but (streams (where (service #"^eth0.*") (by :host (rate 1 graph)))) works

3:12 Bike: Perhaps the name of the service isn't what you think it is?

3:13 perezd: considered that, but I've double checked…using the exact name works

3:13 Sgeo: perezd, as a string, or as the regex? If not the latter, try it as the latter, escaping .

3:14 (And try without escaping dot, it should match the service too, although it will match more)

3:17 * Sgeo has a feeling that Bike is not exactly seeing the best that Clojure has to offer

3:18 Sgeo: So, in an attempt to show something cool

3:18 ,(for [a (range 3) b (range 2) :when (> (+ a b) 1)] {:a a :b b})

3:18 clojurebot: ({:a 1, :b 1} {:a 2, :b 0} {:a 2, :b 1})

3:20 Bike: nondeterministic programming, huh.

3:20 I didn't realize I was being sold to, though.

3:21 doomlord: i'm a leyman when it comes to lisp,but i'm generally finding clojure elegant

3:22 Sgeo: doomlord, I think Common Lisp's environment is generally nicer than Clojure, although as a whole it's less elegent

3:23 doomlord: is that comment on the toolchain vs clojures' hacks into the jvm :)

3:23 a standalone clojure would be awesome. but then again the name wouldn't make sense

3:24 Bike: I'm sure a sufficiently determined programmer would be able to come up with a suitably ridiculous backronym.

3:24 doomlord: the idea that cloujre is a "modern" lisp seems to make sense - there's lots of little choices in the standard macros that are helpful.

3:25 Sgeo: doomlord, it's nice not needing to make a new leiningen project and edit project.clj just to try some library

3:25 Although I guess one-off might help with that?

3:25 Bike: Little choices like what?

3:26 Sgeo: Clojure has a major focus on immutability, which I like, although I suspect doomlord isn't referring to that

3:26 doomlord: let [ var0 expr0 var1 expr1 ...] versus let* (() () ()..)

3:26 * Sgeo wishes Clojure had letrec, I can think of uses beyond functions

3:26 doomlord: it could be i'm getting the "elegance" idea from the FP aswell, so perhaps thats unfair (fp comes with overhead)

3:26 (ie. losing mutability optimizations)

3:27 Bike: Sgeo: clojure has something like labels, I imagine, in which case you can bootstrap letrec

3:27 doomlord: i like funcallable objects too

3:27 Bike: [] is a vector, right? clojure's use of them does seem interesting.

3:28 Sgeo: doomlord, I think with closer-to-mop on CL you can do that on any CL that supports MOPish stuff, but it's ugly

3:28 Bike, yes

3:28 doomlord: and the threading macro! :) when i started tinkering with lisp i asked about making one of those... seemed natural but CL-ers claimed it would be an unusual style. I find the threadng macros help avoid excessive nesting depth

3:28 Bike: MOP has funcallable objects, yeah.

3:28 doomlord: its nice having it for the literal vectors IMO.

3:29 Sgeo: doomlord, I think I can grow to like it, but I was initially wanting something more functional

3:29 You can write something similar without macros

3:29 And arguably more flexibly

3:29 doomlord: F# has |> .. which makes sense to me and again haskellers say "ew" to that

3:29 Sgeo: (thrush somemap #(assoc % :foo 20))

3:29 What's |>, I don't know F#

3:30 Almost ashamed to say that there are languages that I know little about

3:30 doomlord: threading macro as infix :)

3:30 amalloy: Sgeo: it's `$`

3:30 doomlord: its $ backwards

3:30 Sgeo: Ah

3:30 doomlord: same deal. i asked on haskell, "is there.." and the answer was more or less "you're being stupid wanting to write code that way"

3:31 i find with ->> you write the code as you think about it

3:31 Sgeo: There's going to be let-> in the future

3:31 Which is awesome

3:31 Also, you can put ->> inside -> comfortably

3:32 doomlord: i guess lot of the little macros can be done in CL. i made a "let" workalike, and a threading macro (i called it pipe)

3:32 someone told me "reader macros" could actually implement vector /map literals, is that true?

3:32 Sgeo: doomlord, it should be possible to replicate most of the Clojure standard library in CL

3:33 doomlord, I believe so

3:33 doomlord: IMO the use of the other brackets doesn't go against the spirit of lisp: it is still trivial to parse

3:33 tomoj: but there is a reason clojure doesn't have reader macros

3:33 Bike: There are a few CL reader macro libraries for hashtables.

3:34 reader macros basically let you do whatever you want, which has its advantages, and its disadvantages...

3:34 doomlord: i haven't delved into CLOS or multimethods yet, those look interesting

3:34 Bike: such as parsing being uncomputable. not a good thing.

3:35 doomlord: i suppose destructuring functoin arguments is well within macros that could be retrofitted

3:35 (defn vec-cross[[ax ay az][bx by bz]]...

3:35 Sgeo: doomlord, let which has destructuring expands into let* which does not

3:35 doomlord: that sort of thing is awesome

3:36 Sgeo: Common Lisp has a sort of destructuring

3:36 Don't remember details though

3:36 doomlord: multiple-value-bind ? and i've seen some in the loop macro.

3:36 Bike: destructuring-bind, you mean?

3:36 tomoj: imagine trying to do codeq with people using reader macro libraries :/

3:36 Sgeo: codeq?

3:36 tomoj: interestingly without a default reader literal thingy, I imagine codeq has a similar problem

3:36 "reader literal" is a weird term

3:37 doomlord: perhaps the multiple-return values are more efficient in common lisp being a dedicated construct rather than vectors

3:37 Sgeo: Bike, what are some list manipulation functions that take keyword arguments?

3:37 I have a point I want to make

3:37 Bike: uh, like remove-if?

3:38 doomlord: the idea with multiple values is that the return values could be put in registers rather than a composite data structure, I think

3:38 Sgeo: Bike, sure

3:38 Why does it take :start and :end keys?

3:39 Efficiency purposes?

3:39 doomlord: i read it as stack but yeah.. 'vector' makes me think of more potentially going on re. allocation. I wonder if the implementations can just make it equivalent.

3:39 Bike: so that you can operate on subsequences without explicitly constructing new objects, is what I would think, yes.

3:39 Sgeo: Don't want to walk a list to drop a few things off the end then walk it again filtering?

3:39 Bike: yeah.

3:39 magnars: Please help me with naming :-) "does this collection have both elements that fulfill a certain predicate, and elements that do not?" (mixed integer? list) ? (mixture integer? list) ? (diverse integer? list) ? (mix-of integer? list) ? (varies integer? list) ? Something else?

3:39 Sgeo: Clojure's sequence operations are lazy, meaning if you do that, you'll only walk the list once.

3:40 Bike: doomlord: it'd have to be a pretty smart implementation, and you'd have to not rely on the function actualy returning a vector, etc

3:40 Sgeo: not sure I understand. example?

3:40 doomlord: all? and not-all? all-satisfy? and not-all-satisfy?

3:40 (all? integer? list) vs (not-all? integer? list)

3:41 (all? ) and (any? )

3:41 thats what i was calling them

3:42 Sgeo: ,(map inc (drop-last 2 [1 2 3 4 5 6 7 8 9 10]))

3:42 clojurebot: (2 3 4 5 6 ...)

3:42 doomlord: oh .. fails on empty list perhaps

3:42 Sgeo: ,(map inc (drop-last 2 [1 2 3 4]))

3:42 clojurebot: (2 3)

3:42 Sgeo: That is not as inefficient as it looks

3:42 Hmm, I should use a literal list

3:42 ,(map inc (drop-last 2 '(1 2 3 4())

3:42 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

3:42 Sgeo: ,(map inc (drop-last 2 '(1 2 3 4)))

3:42 clojurebot: (2 3)

3:43 Sgeo: The drop-last won't actually go ahead and walk the list as soon as you call it

3:43 Instead, it will return a lazy-seq

3:43 magnars: I'm looking for something that can replace (and (every? integer? list) (not-every? integer? list)) with a single call ... right now I think I prefer (mix-of? integer? list)

3:43 doomlord: magnars: does your function have to return 'true' or 'false' for an empty list

3:43 Sgeo: And the map also returns a lazy seq

3:43 Bike: Oh, I see now.

3:43 Sgeo: With the effect of walking the original list once.

3:43 tomoj: magnars: uhh

3:43 isn't that just false?

3:44 magnars: ah doh, I meant "some" not "every"

3:44 Bike: Yeah, that's probably a bit cleverer than passing a bunch of keys around.

3:44 (and (some? integer? list) (some (not integer?) list)), then?

3:45 tomoj: no

3:45 magnars: Bike: yes, that's what I want a name for

3:45 tomoj: some-but-not-all :(

3:45 doomlord: (and (not-all? integer list) list) ... but you dont want to pass list twice

3:46 Bike: Sgeo: map's still going to have to walk the whole list to figure out which two to drop, yes?

3:46 doomlord: ah its not the same at all

3:46 no where ner

3:46 Sgeo: Bike, Haskell is pervasive in this idea of not doing things until it's needed. That's not the case in Clojure, where it's just sequences that are like this, in a language that is fundamentally eager

3:46 Bike, yes

3:47 Bike, actually, lists store their length, come to think of it

3:47 Although lazy sequences don't

3:47 ,(counted? '())

3:47 clojurebot: true

3:47 Bike: presumably you can have infinite sequences as well.

3:47 Sgeo: ,(counted? (map identity '()))

3:47 clojurebot: false

3:47 Sgeo: Yes.

3:47 doomlord: (any-and-any-not? integer? srclist ) :)

3:47 Sgeo: ,(range)

3:47 clojurebot: (0 1 2 3 4 ...)

3:47 Bike: ,(length (range))

3:47 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: length in this context, compiling:(NO_SOURCE_PATH:0)>

3:47 Sgeo: ,(count (range))

3:48 Bike: Oops.

3:48 clojurebot: Execution Timed Out

3:48 Bike: so infinite sequences don't keep track of their infinitude.

3:48 but yes, lazy sequences are cool. I particularly liked that part of SICP.

3:49 * Sgeo should work through SICP at some point

3:49 doomlord: (not-all-or-none? integer? ls )

3:49 Bike: Where you could just define e as (lazy-cons 1 (integrate e))

3:49 er, derivative.

3:49 Sgeo: ,(doc lazy-seq)

3:49 clojurebot: "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. See also - realized?"

3:49 Sgeo: Hmm, not the same as lazy-cons

3:49 (doc lazy-cons)

3:49 clojurebot: Huh?

3:49 Sgeo: Darn

3:50 Bike: Well, yes, it seems like in Clojure lists are more like sequences, whereas in CL they're usually dumb conses.

3:50 tomoj: I believe lazy-cons is a historical artifact

3:50 Sgeo: Hmm.... I think (def e (lazy-seq (cons 1 (derivative e))))

3:50 Don't quote me on that though

3:50 tomoj: maybe it still could be rarely useful?

3:51 oh, wait, lazy-cons is gone

3:51 Sgeo: (comp lazy-seq cons)

3:51 What's wrong with lazy-cons?

3:51 Bike: Wait, there was actually a Clojure function called that? I was just quoting SICP.

3:51 It was just a macro for (cons a (delay b)) as far as I remember.

3:52 You could do the same thing in a more sequencey way, of course.

3:53 Mr_Bond: Hm, I really like Clojure as a language, but I think it's often hard to find my mistakes since the backtrace is from the java-generated code compiling.

3:53 How do you overcome this when coding Clojure?

3:53 doomlord: is there a plain interpreter or is it always compiled to jvm

3:54 Mr_Bond: AFAIK, it's jvm, .net or javascript.

3:54 Bike: "Clojure has no interpreter.", very straightforward, clojure.org

3:55 Sgeo: The stacktraces are the worst part of Clojure

3:56 tomoj: http://clojure.org/lazy has some notes about lazy-cons in clojure

3:56 Mr_Bond: I see there is something called clojure.contrib.trace, which could be useful in some situations.

3:56 Sgeo: tomoj, awesome

3:57 * Sgeo goes to read

3:57 muhoo: oh if you think java clojure stacktraces are bad, try clojurescript stacktraces

3:58 tomoj: I think @ and seq should be synonyms on seqs

3:58 Sgeo: what was your beef about names for promises something like "defer"?

3:59 amalloy: magnars: i dunno about your function's name, but isn't it just (apply not= (map pred coll))?

3:59 Sgeo: tomoj, I don't remember

4:00 Oh, I found something

4:01 * Sgeo persists in suggesting that Deferreds should be Deferrable

4:01 tomoj, oh, for your library

4:02 doomlord: whats (not= ) with zero args

4:02 Sgeo: You were making a sort of promise-like thing that was intended to be monadic

4:02 However, your code was not able to support the notion of a Deferred containing a Deferred

4:02 tomoj: right

4:02 Sgeo: And without that, it violates monad laws

4:02 tomoj: I still don't care yet

4:03 but I was stuck thinking about how promises in synchronous clojure require @

4:03 but seq code doesn't

4:03 but seq is just @ I think :)

4:03 doomlord: what should magnars function return with zero args... false i think

4:03 Sgeo: ,(not=)

4:03 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$not-EQ->

4:04 doomlord: (mix-of? integer? nil) -> false, not "error wrong number of args" ?

4:04 Sgeo: tomoj, ah, I see your point

4:05 doomlord: so apply not= would fail

4:05 Sgeo: tomoj, I would say that the sequence manipulation functions are all expecting a seq, including possibly a lazy seq, but stuff for which you're using promises isn't generally expecting promises, but concrete non-promise values

4:05 Could transform functions to expect promises

4:06 But then, what happens if you want to pass such a function a plain old value? Make a promise out of it. Now, what happens if you want to pass such a function a promise that it would somehow manipulate, but it's expecting a promise that the wrapped version will be waiting on

4:07 tomoj: yeah

4:07 Sgeo: Thus, you'll be passing the wrapped version of the function a promise in a promise

4:08 tomoj: I still don't think I care

4:08 there is only one thing a promise can do

4:08 so if I do it for you, I only saved you work

4:08 not sure though..

4:09 Sgeo: A promise is a promise to return a value ... vs ... a promise is a promise to return a value that is not itself a promise

4:09 tomoj: promises aren't values :(

4:09 Sgeo: They aren't?

4:09 ,(promise identity)

4:09 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$promise>

4:09 Sgeo: (doc promise)

4:09 clojurebot: "([]); Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block, unless the variant of deref with timeout is used. All subsequent derefs will return the same delivered value without blocking. See also - realized?."

4:09 tomoj: depends on how you define "value" of course

4:10 Sgeo: ,(promise)

4:10 clojurebot: #<core$promise$reify__3678@5e329ba8: :pending>

4:10 Sgeo: It's a thing that can be passed around and manipulated

4:10 Seems like a value to me, just as much as a function is a value.

4:12 It tends to be a bad idea to have abrupt exceptions to things, it confuses people and makes writing code harder, since people now have to check for the special case

4:15 tomoj: I would say it's a monadic value, but..

4:16 Sgeo: Are monadic values not values?

4:16 amalloy: Sgeo: that's a pretty broad definition of value. is a char* a value?

4:16 tomoj: sometimes "value" can mean something different, where e.g. atoms/refs/(clojure.core/)promises aren't values

4:16 doomlord: whats let-> that was mentioned above

4:16 tomoj: you have to deref to get the value

4:17 amalloy: you can pass them around, but they change all the time. treating them as casually as you'd treat actual immutable values leads to devastation

4:17 tomoj: or for defers (using "promise" is too confusing), you have to defer

4:18 Sgeo: hmm

4:18 Bike: char* as in a char pointer? of course that's a value, that what it's pointing to may change doesn't affect that...

4:19 amalloy: Bike: that's a possible and useful definition of value, but not one that's popular in clojure

4:20 Sgeo: I think I had Bike's definition in mind

4:20 But is there a Clojure term for the concept?

4:20 If an atom isn't a value, can we call it an entity?

4:20 Bike: sure. I thought you might have been speaking more broadly. If "value" means something more specific in the context of Clojure and/or promises, then that's that.

4:21 amalloy: Sgeo: call it an object, then. *anything* is an object, which is what you're calling values so far

4:21 tomoj: "entity" is taken by datomic :P

4:22 Sgeo: tomoj, do you intend for your defers to only take values, or any objects?

4:22 * Sgeo sees where this is going :/

4:23 tomoj: I can't stop you from putting a non-value in there, but if you do, you lose all the nice properties I'm trying to get

4:23 so I don't care too much about supporting that

4:23 ..and if you want to stick an atom in there for some reason, it'll work

4:23 just not a defer :/

4:25 but you're probably right

4:25 Sgeo: Does it need to be a monad, or could you make it an applicative instead and still have it be nice to use?

4:25 tomoj: if you have a cps transform that just converts deref -> defer, then I don't think it's a problem anyway

4:26 if you want to pass a defer to a function, you just don't deref (defer)

4:28 Sgeo: Hmm.

4:28 Suddenly I'm wondering if defers are arrows

4:28 * Sgeo wouldn't wish arrows on anyone

4:29 Sgeo: (As in, if it is an arrow, I guess I really can't object to making a fake monad)

4:33 tomoj: apparently the Monad instance for Future is equivalent to the Writer monad

4:35 applicative is not enough

4:37 Sgeo: In what sense?

4:38 Reason I ask is because if you find a use case for which applicative (or possibly arrow) is not enough, then I think it's quite likely that that use case will somehow involve nested defer

4:39 tomoj: hmm

4:40 the semantics are that the (eventual) value of (<*> future-f future-val) is (@future-f @future-val), occurring at the later of the times of future-f and future-val

4:41 (>>= defer f) is (f @defer), which is itself a defer (pardon my terminology flux)

4:42 (occurring at the later of the times of defer and (f @defer))

4:42 I'm not sure how >>= maps to my clojure ideas

4:47 one relevant example might be if you had a future seq (just like ISeq except rest returns a defer) of relative times, a future seq (or seq!?) of values, and a function that takes a relative time and a value and returns a defer that resolves to the value after the time

4:47 and map that function over the two (f)seqs

4:49 that seems overly confusing

4:53 Sgeo: So, in order to resolve the resulting defer, you need to wait on two defers

4:53 ?

4:53 Oh right, your problem was with not wanting to have a way to not join automatically

4:54 tomoj: well

4:54 the functor is broken

4:55 Sgeo: I'm sure there's something somewhere on why the monad laws should be obeyed

4:55 tomoj: (fmap (f :: a -> Future b) (a :: Future a)) :: Future b

4:55 I think

4:55 >>= means you don't have to @@ in the case above

4:56 (I think)

4:56 Sgeo: http://www.haskell.org/haskellwiki/Monad_Laws

4:56 shachaf: tomoj: That doesn't look like fmap.

4:56 I guess that's what you were saying.

4:57 What's Future?

4:57 tomoj: http://conal.net/papers/push-pull-frp/

5:00 "a value that can't be known yet"

5:02 shachaf: This seems to be a pretty specific meaning of the word "future".

5:03 tomoj: it's confusing, since I don't mean clojure.core/future

5:03 alex_baranosky: magnars: I'd call it `one-or-more`

5:04 tomoj: but-not-all? :(

5:06 amalloy: magnars: disparate?

5:15 AtKaaZ: is this the right way to test for unbound? (= clojure.lang.Var$Unbound (class conn))

5:15 or this? ##(bound? #'conn)

5:15 lazybot: java.lang.RuntimeException: Unable to resolve var: conn in this context

5:16 Sgeo: (doc bound?)

5:16 Raynes: Don't know why you'd use the former given the latter.

5:16 AtKaaZ: I just found that last one :/

5:16 clojurebot: "([& vars]); Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided."

5:16 AtKaaZ: thanks

5:16 Sgeo: ##(with-local-vars [boom] (bound? #'boom))

5:16 lazybot: java.lang.IllegalArgumentException: with-local-vars requires an even number of forms in binding vector in clojure.core:1

5:17 Sgeo: ##(with-local-vars [boom 5] (bound? #'boom))

5:17 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!

5:17 AtKaaZ: I think I have to use it like this: (bound? (var conn))

5:17 Sgeo: AtKaaZ, try attempting to resolve the symbol?

5:17 Raynes: Uh

5:17 The bound of bound? is that the var *exists*, but isn't bound to anything.

5:17 If the var might not even exist, you're going to want to use resolve or something to check that it exists at all.

5:18 Sgeo: Existent but unbound vars are created by declare

5:18 tgoossens: is there an easy way to execute shell commands (on linux) from clojure? (Perhaps by using a certain java lib?)

5:18 AtKaaZ: I see what you mean, but in my case the var would always exist hmm... but I wouldn't mind being extra safe

5:18 Sgeo: AtKaaZ, if it always exists, just use bound?

5:18 Raynes: Sgeo: (def x) is also valid.

5:19 tgoossens: https://github.com/Raynes/conch

5:19 tgoossens: thanks

5:19 Raynes: Or clojure.java.shell if you don't want external dependencies/what conch offers and c.j.s does what you need.

5:19 AtKaaZ: Sgeo, maybe I should add the resolve test too? since I like defensive programming :)

5:19 tgoossens: what i need is

5:19 execute a command

5:19 show result

5:20 a "repl" for shell

5:20 Sgeo: AtKaaZ, just be aware of namespacing issues

5:20 Raynes: That isn't defensive programming. That's bizarre programming.

5:21 Might as well check the type of all your integers *just to be sure*, and convert from strings and stuff *just in case*.

5:22 AtKaaZ: I see what you mean

5:34 clojurenewb: hi guys, I'm looking for a nice way to process some keys in a map depending on the key name… its the age old serialisation treating everything as strings problem… one example, I'd like to convert {:a "one" :b "2" :c "3"} to {:a "one" :b 2 :c 3}, so only process keys :b and :c

5:36 alex_baranosky: clojurenewb: if it is depending on key name… then just bond on the key names

5:36 or is it on the value type?

5:37 clojurenewb: alex_baranosky: its on the key name, and it will always be from string to long

5:37 tomoj: clojurenewb: I'm doing the same thing today

5:38 ejackson: clojurenewb: you could use select-key to extract the subset you want , convert them all, and then merge wit the original map to 'overwrite'

5:39 select-keys rather

5:39 alex_baranosky: (into {} (for [[k v] my-map] (cond (= :foo (class k)) (some-fn v) (= :bar (class k)) (other-fn v) :else ….))))))

5:39 clojurenewb: cool, I'll take a look thanks

5:39 alex_baranosky: You can only use select-keys if you know the keys

5:40 I need more details to narrow down your options

5:40 clojurenewb: yes, I will always know the keys

5:41 tomoj: I wrote this today https://www.refheap.com/paste/6096

5:41 clojurenewb: and it will always be a string to long conversion

5:41 tomoj: I think there is probably something better

5:41 clojurenewb: for those select keys

5:42 tomoj: (update-all map :a #(Long. %) :b #(Long. %))

5:42 it uses update-in so also (update-all map [:x :y] #(Long. %)) to handle {:x {:y "1"}}

5:43 clojurenewb: I'll give it a go

5:43 tgoossens: I'm using clojure.java.shell/sh to execute shell commands. But commands like: "ls | grep test" gives me Exception in thread "main" java.io.IOException: Cannot run program "ls | grep test": error=2, No such file or directory


5:44 mishok13: can anybody recommend HTTP user agent parsing library?

5:45 user-agent-utils is not in Maven central or Clojars

5:47 AtKaaZ: I'm getting an error and I notice it doesn't specify the exact line(*) in my source file which I loaded with Alt+Ctrl+L Load File in REPL (in eclipse+ccw): http://pastebin.com/9md7kNV2 is that(*) supposed to happen?

5:47 ejackson: clojurenewb: if f is a the function that converts "one" to 1, then this will sort you (reduce (fn [om k] (update-in om [k] f)) m keys)

5:48 tomoj: hmm

5:48 update-all seems silly, at least the implementation

5:49 ejackson: reduce might be better ?

5:52 tomoj: maybe it should be (update-all [m kss f & args])

5:52 clojurenewb: ejackson: I am pushing the limit of my understanding with your idea there.. can't figure out how to apply it

5:52 tomoj: (-> m (update-all [:a :b [:x :y]] #(Long. %)) (update-all [:date] parse-date))

5:52 ejackson: tomoj: yeah, if f is always the same.

5:53 tomoj: er, the last one is silly ofc :)

5:53 wei_: how do you pass data structures to clojurescript upon initial load of your page? (e.g. not with remotes)

5:54 tomoj: good question

5:54 if you are advanced compiling, it seems difficult?

5:54 ejackson: clojurenewb: https://www.refheap.com/paste/6097

5:55 clojurenewb: I see

5:55 thx!

5:56 AtKaaZ: regarding my previous error, that's what shows when I forget to add [] vector to the (defn x (println "some"))

5:56 tomoj: wei_: the reader appears to be implemented in cljs

5:57 so, one possibility is to render something like `var data = "{:foo 3}";` in separate js file you serve

5:57 then later in your cljs you could read it..

5:58 wei_: aha i see. thanks.

6:12 clgv: why are line breaks not matched by `re-find`? e.g. ##(re-find #"<bla>(.*)</>" "<bla>lala lulu\nlili</>")

6:12 lazybot: ⇒ nil

6:12 clgv: without linebreak it works (re-find #"<bla>(.*)</>" "<bla>lala lulu lili</>")

6:12 &(re-find #"<bla>(.*)</>" "<bla>lala lulu lili</>")

6:12 lazybot: ⇒ ["<bla>lala lulu lili</>" "lala lulu lili"]

6:14 _ulises: clgv: there's a switch in perl regexps to match across \n; not sure what the switch in java would be though; point is: you're probably missing that switch

6:14 clgv: in perl you'd do /regexp/g <- the g there tells the engine to match across lines

6:14 i.e. globally

6:20 AtKaaZ: Multiline mode can enabled via (?m). from here: http://nakkaya.com/2009/10/25/regular-expressions-in-clojure/

6:20 clgv: _ulises: ok. you are right. unluckily clojure re-pattern function has no support for options. thus I have to use Pattern class directly

6:20 AtKaaZ: but someone tell me where do I need to put that to work

6:21 magnars: Thanks for all the suggestions for naming the function (and (some pred list) (some (not pred) list)) ... right now the one I like best is (only-some pred list) - what do you think?

6:23 alex_baranosky: magnars: that name isn't obvious to me

6:23 magnars: what did you think of `at-least-one`

6:23 AtKaaZ: ,(re-find #"(?sm)<bla>(.*)</>" "<bla>lala lulu\nlili</>")

6:24 clojurebot: ["<bla>lala lulu\nlili</>" "lala lulu\nlili"]

6:24 magnars: at-least-one isn't correct, since it would be true for a collection where all match

6:24 alex_baranosky: ah… its at-least-one-but-not-all … and that name is no good :)

6:24 AtKaaZ: (?s) In dotall mode, the expression . matches any character, including a line terminator.

6:24 magnars: bit verbose maybe :)

6:25 AtKaaZ: ,(re-find #"(?s)<bla>(.*)</>" "<bla>lala lulu\nlili</>")

6:25 clojurebot: ["<bla>lala lulu\nlili</>" "lala lulu\nlili"]

6:25 alex_baranosky: `some-match-some-fail`

6:25 _ulises: magnars: how about one+-!all ;)

6:25 clgv: AtKaaZ: ah nice find :)

6:26 alex_baranosky: _ulises: fancy stuff

6:26 _ulises: alex_baranosky: if by fancy you mean unreadable, then yes :D

6:26 magnars: _ulises: hehe :-) the best names I've found so far are disparate, varies, mix-of and only-some

6:27 hyPiRion: Uh, that's not XML, is it?

6:27 (Just a question)

6:27 alex_baranosky: magnars: I personally wold go for more verbosity

6:28 magnars: alex_baranosky: that's a valid opinion for sure. I'll give it some more thought.

6:28 clgv: hyPiRion: not it's borrowed from xml notation to add parameter docs in a docstring

6:28 alex_baranosky: magnars: … because none of those names are understandable without reading the implementation… …. but that might be unavoidable

6:28 clgv: clgv: I just noticed that I do not support multiline docs for params

6:29 hyPiRion: clgv: Okay. It's kind of dangerous to parse this with regex though. might want to either find a lib or make a parser for it.

6:29 Talking from own experience ;)

6:29 clgv: hyPiRion: why? because of errors in the string?

6:30 hyPiRion: clgv: http://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not

6:30 mpan: btw guys, there was someone asking about clojure on hn but they seemed a little confused about what clojure is or isn't

6:30 so if someone wants to go and give them some pointers, http://news.ycombinator.com/item?id=4691615

6:30 clgv: hyPiRion: I do not want to parse html ;)

6:30 hyPiRion: It really depends on what implementation you have though.

6:31 clgv: I just want to extract parameter descriptions from a "well formed" doc string. if the user makes errors he will see them ;)

6:31 mpan: I'm a bit too confused by what they said to really know what to say to them

6:31 hyPiRion: clgv: ah, then it should be okay.

6:32 I suppose.

6:46 kaoD: hi

6:46 mpan: hi

6:49 unnali: hi

7:08 wingy: perhaps in an ideal scenario the functions will be immutable as well?

7:08 i mean saved throughout time

7:09 nvm .. wild fantasies

7:19 _ulises: wingy: saved through time?

7:19 wingy: in a database

7:20 AtKaaZ: you can already in datomic no?

7:20 wingy: many many years from now we will have a central bank with all data logging everything

7:20 _ulises: what do you mean by saving a function through time? it's body? or?

7:20 wingy: yeah we can .. it all started with Rich!

7:20 he is like John Conner

7:20 without realizing it

7:20 clgv: wingy: I hope not to live in such a 1984 world ^^

7:20 wingy: _ulises: saving a the function so you can look at its body and also use it in your program like anything saved in datomic

7:22 _ulises: ah, gotcha

7:22 saved the function not in a local file but in a remote location but still be able to execute it, etc.

7:22 sounds a lot like RPC

7:22 but not quite

7:23 wingy: no i mean you fetch it like any data from the db then you exectute it in memory as usual

7:24 mishok13: I can't get simplest Java import to work properly in Clojure -- could somebody take a look at this: https://gist.github.com/3945518 ?

7:24 wingy: btw regarding code is data .. would it be okay to save functions then in a db to do what i just said?

7:25 babilen: Hi all -- What is the fastest way to build a map from two sequences (key-seq and val-seq) ? val-seq is a reducer (from r/map mapped over key-seq) -- I essentially want a mapping key → f(key), but folding into a map is horribly slow, so I am looking for an alternative.

7:25 mishok13: I've never had any issues with Clojure packages downloaded from Maven/Clojar, but this one I had to install into local repo, that might be causing some issues

7:25 wingy: since code is data and data can be versionized using datomic .. a logical outcome would be that its okay to save functions if one needs it for some reason

7:25 tgoossens: wingy: mmyes why not

7:25 hyPiRion: babilen: Do you mean like ##(zipmap [:a :b :c] (range 3))

7:25 lazybot: ⇒ {:c 2, :b 1, :a 0}

7:26 wingy: tgoossens: just forgot one caveat .. you can't save a data structure as it is in datomic .. you have to break it down .. forgot that

7:28 _ulises: wingy: nothing stops you from saving them as mysql blobs

7:28 babilen: hyPiRion: Yeah, that would be an option, but also strikes me as slower than it could be (due to it not using transients) -- I tried something like (r/fold (r/monoid merge hash-map) ... but that is slow (and not very parallel unfortunately)

7:28 _ulises: wingy: or even couchdb documents

7:28 wingy: _ulises: or even strings

7:28 _ulises: wingy: precisely

7:29 babilen: hyPiRion: Right now I am tempted to use (assoc! (transient {}) (interleave key-seq val-seq))) but am not sure if this is the best approach.

7:29 err, (apply assoc! ... that is

7:30 hyPiRion: babilen: you can do a transient version of the current zipmap-implementation.

7:30 If you lookup the source.

7:31 Is the speed an issue in your case, btw?

7:32 babilen: hyPiRion: Unfortunately it is (i benchmarked it) ... I would, naturally, prefer to just use zipmap (et al.) but I was wondering if I could speed this up.

7:32 The main problem is that reducing into a map is slow (which comes up once in a while on the mailing list too), but using at least a transient version of zipmap would help. I don't quite understand though why zipmap is *not* transient by default.

7:34 hyPiRion: babilen: no transient! and persistent! in 1.0, and it worked fine, so why bother changing it?

7:34 AtKaaZ: mishok13, that works for me with this set prior to running mvn command: JAVA_HOME=c:\Program Files\Java\jdk1.7.0_06 on win7 64bit

7:34 babilen: hyPiRion: Well, perfomance comes to mind. ;)

7:34 AtKaaZ: mishok13, also using this mvn apache-maven-3.0.4

7:35 babilen: hyPiRion: I'll play a little

7:35 hyPiRion: babilen: Try it out with reducing over a synchronized HashMap

7:36 to check what the maximal performance with mutability is.

7:37 babilen: hyPiRion: I don't quite understand what you mean by that, could you elaborate a little?

7:38 hyPiRion: babilen: Screw the synchronized part: Check out the speed difference over (do (.put hm k v) hm) rather than (assoc! hm k v)

7:39 http://docs.oracle.com/javase/1.5.0/docs/api/java/util/HashMap.html

7:40 Kneferilis: anyone had experience with LiveCode?

7:40 babilen: hyPiRion: Ack, thanks!

7:43 wingy: where can i find a list of all keys i can have in a meta data for functions?

7:47 mpan: hm? I thought you could set whatever you wanted

7:47 if you mean which keys have special significance, I'd be interested in knowing that too

8:00 AtKaaZ: wingy: http://clojure.org/special_forms but they are not all, at least :column isn't there

8:01 ,(keys (meta (resolve '+)))

8:01 clojurebot: (:ns :name :file :line :arglists ...)

8:02 wingy: im searching for a :see or :see-also meta data key for redirecting to a external homepage

8:02 the worse part is that the reference doc is not complete .. if one cant get that info from clojure homepage, where can one get it

8:02 a full list of all meta data keys you can use would be great

8:02 AtKaaZ: it's in the :doc in the case of +

8:02 ,(:doc (meta (resolve '+)))

8:02 clojurebot: "Returns the sum of nums. (+) returns 0. Does not auto-promote\n longs, will throw on overflow. See also: +'"

8:03 AtKaaZ: nevermind :)

8:03 wingy: i recall there is a special key for it

8:03 ,(:doc (meta #'+))

8:03 clojurebot: "Returns the sum of nums. (+) returns 0. Does not auto-promote\n longs, will throw on overflow. See also: +'"

8:03 AtKaaZ: ,(meta (resolve 'cl-format))

8:03 clojurebot: nil

8:04 AtKaaZ: :see-also [["http://whatever" "Common Lisp the Language"]

8:06 wingy: http://pastebin.com/bkRjp72a

8:06 wingy: AtKaaZ: thx!

8:09 AtKaaZ: hmm it's the only use of :see-also in the entire clojure sourcecode ##(:see-also (meta (resolve 'clojure.pprint/cl-format)))

8:09 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

8:09 antares_: anyone in here going to the Conj?

8:10 clgv: wingy: define a function (defn f [x] ) in your file, eval it and use (-> #'f meta keys)

8:12 wingy: clgv: yeah .. i can get some of them that way

8:12 clgv: wingy: the othey keys are customly added in the definition form

8:12 *other

8:13 wingy: so :see-also is just a custom one?

8:13 AtKaaZ: wingy, probably, since nothing else in clojure code uses it, except cl-format

8:13 clgv: wingy: yeah. I dont know where you found that one. it's probably for some documentation generation tool

8:13 wingy: okay

8:14 i forgot that clojure is an interactive platform .. everything you wanna check you check in the running instance

8:14 AtKaaZ: ,(use 'clojure.pprint)

8:14 clojurebot: nil

8:14 AtKaaZ: ,(:see-also (meta (var clojure.pprint/cl-format)))

8:14 clojurebot: [["http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node200.html#SECTION002633000000000000000" "Common Lisp the Language"] ["http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm" "Common Lisp HyperSpec"]]

8:17 antares_: anyway, if someone in here is going to the Conj, consider hosting an unsession on documentation: https://github.com/relevance/clojure-conj/wiki/Clojure-conj-2012-Unsessions

8:17 unlike monads and codeq, any progress with documentation benefit the entire Clojure community

8:17 *benefits

8:17 but I won't be at the conj so I can't host it

9:54 samaaron: does anyone know how to set the java.library.path in CCW?

9:55 ejackson: samaaron: what ? oh wait... tomorrow :)

9:55 AtKaaZ: samaaron: with leiningen support?

9:56 samaaron: AtKaaZ: well, lein 2 should do this for you automagically, but it doesn't appear to in CCW

9:56 also, I tried adding a :native-path key to my project.clj but CCW seemed to ignore that too

9:57 pandeiro: i need to recurse through nested maps and do arbitrary modifications to some strings - which functions can help me?

9:57 AtKaaZ: but you still have to use lein to make .jars right?

9:57 samaaron: I'm just not sure if I want to introduce devs to *both* Emacs and Clojure in a workshop

9:58 AtKaaZ: to be honest, I have no idea how CCW interacts with lein

9:58 pandeiro: you might want to take a look at zippers

9:59 pandeiro: samaaron: i had an inkling zippers were relevant, thks

9:59 samaaron: pandeiro: np

10:00 AtKaaZ: samaaron, I didn't try much but I found that I had to use lein uberjar to create the jar, ccw wasn't enough, :native-path should've been it I think, wonder if it's obsolete now

10:00 samaaron: AtKaaZ: it doesn't appear to be obsolete in pure lein-land

10:00 I'm just guessing that CCW doesn't support everything lein supports

10:01 AtKaaZ: samaaron, you're right it's not obsolete, :native-path "target/native"

10:01 uvtc: samaaron: re. new users and Emacs vs. Eclipse; maybe have a peek at jEdit ... which recently got some Clojure indenting support. I made a note about it at http://clojure-doc.org/articles/ecosystem/development_tools.html#jedit

10:01 AtKaaZ: samaaron, maybe you can set it using :jvm-opts ["-Xmx512m"] ...?

10:02 samaaron: uvtc: how easy is it to get jEdit set up on a new machine - and does it support lein integration, docstring completion, partial compilation etc?

10:03 uvtc: samaaron: As far as I know, it's just syntax highlighting and now indentation support. But I'm not a regular jEdit user. Perhaps someone else would know if it supports what you're looking for.

10:03 AtKaaZ: samaaron: https://code.google.com/p/counterclockwise/issues/detail?id=343

10:03 samaaron: AtKaaZ: I'm not sure that would work - the java.library.path gets passed as the argument to -D to the java command

10:03 uvtc: samaaron: jEdit is written in Java, so, you just run its installer jar to install.

10:03 samaaron: uvtc: I'm really just looking for CCW with support for native deps

10:04 uvtc: samaaron: check

10:04 samaaron: but perhaps I'll have to look elsewhere

10:04 argh

10:12 lynaghk`: Is it possible to access a protected field of a Java class from a subclass made in Clojure via proxy?

10:12 The field is "printer", and I've tried (.printer this) within the method that I'm overriding but I'm not having any luck.

10:13 ejackson: lynaghk: I had this issue about 2 years ago, and at that time the answer was no.

10:14 lynaghk`: ejackson: how'd you end up getting around it? Subclassing yourself in Java?

10:14 ejackson: edited the java to make the field public :)

10:14 three cheers for open source

10:14 lynaghk`: wahhhhhh

10:15 AtKaaZ: samaaron, it's working for me with :native-path it extracted the .dll files found in the .jars in the folder that I specified

10:15 samaaron: oh really?

10:15 what did you put?

10:15 was it the full path?

10:15 ejackson: it may have gotten fixed since then. Actually, I mis-recall, I was not using proxy but gen-class. Close.

10:16 samaaron: I didn't try that

10:16 AtKaaZ: samaaron: i added this line to project.clj :native-path "native2"

10:17 lynaghk`: ejackson: I'm not an expert on Java keywords, but my understanding is that "protected" fields should be acessible by subclasses. So does proxy not make a "real" subclass?

10:17 samaaron: native2?

10:17 AtKaaZ: samaaron: and after save it made a native2 folder in project and all .dll are there from ie. in my case from jme3-lwjgl-natives...jar

10:17 samaaron: just a name for a folder "native2"

10:17 samaaron: oh ok - but can CCW see that?

10:17 ejackson: lynaghk: I got nothing, dude. Not java fluent.

10:17 samaaron: i.e. does CCW set the java.library.path to native2

10:17 AtKaaZ: let me check

10:18 lynaghk`: ejackson: okay, thanks dude. I'll just give it a crack in Java-world.

10:18 ejackson: lynaghk: is it static ? Have you tried this/printer

10:19 AtKaaZ: samaaron: i ran this in repl but it's nil ##(java.lang.System/getProperty "java.lang.library")

10:19 lazybot: java.security.AccessControlException: access denied (java.util.PropertyPermission java.lang.library read)

10:19 AtKaaZ: samaaron, oops, i corrected but native2 doesn't seem to be in the list

10:20 (java.lang.System/getProperty "java.library.path")

10:21 samaaron: AtKaaZ: yep, same here

10:25 lynaghk`: ejackson: this/printer throws "no such namespace: this"

10:30 AtKaaZ: samaaron, it's a bad hack but you can set it like so: :jvm-opts ["-Xmx512m" "-Djava.library.path=native2/"]

10:30 thing is, it overwrites the previous value

10:31 samaaron: oh, really...

10:31 awesome

10:31 AtKaaZ: oh wait, it only works in lein (retesting)

10:31 yep, only in command line lein :/ not in ccw

10:31 samaaron: argh

10:33 AtKaaZ: maybe you can do this: https://groups.google.com/d/msg/leiningen/2OZQPMi3cks/DPfsUVJ78hwJ

10:33 the extract is what :native-path already does

10:36 samaaron: AtKaaZ: oh, that might work...

10:36 AtKaaZ: I think :native-path is meant to only do extract, nothing about setting that var; :native-path "src/native" ; where to extract native dependencies

10:38 samaaron: AtKaaZ: ha - success, I just needed to (System/setProperty "java.library.path" "target/native/macosx/x86_64")

10:38 laurentpetit: howdy

10:38 I got overtone working by (System/setProperty "java.library.path" "target/native/macosx/x86_64")

10:44 ejackson: samaaron: I didn't know you could do that dynamically

10:44 samaaron: ejackson: seems that you can :-)

10:54 clgv: samaaron: ejackson: but might be safer to add that path instead of set it as only one

10:54 samaaron: clgv: oh, sure

11:22 arrdem: is there a clean way to accumulate values across several macros? say I wanted to define `mydef` such that it will expand into a def and add a key/val pair to some shared map

11:23 how would I acheive the side-effect of re-defining the map?

11:25 ynniv: so, is sharing code between clojure and clojurescript really this annoying?

11:26 llasram: arrdem: Check out the Clojure core implementation of protocols, specifically `extend`. It's not really a common idiom, but that's probably the closest

11:26 ejackson: lynaghk: sorry, I meant use the classname for whatever this is.

11:27 dnolen: ynniv: yes. are you using one of the various work arounds that people have built?

11:28 ynniv: I'm hoping not to, but it doesn't look like that's going to happen

11:28 what's the favorite so far?

11:29 dnolen: ynniv: lein-cljsbuild has some facilities. I don't know much about it though.

11:45 Baldanders: So, I've been having some real problems with Leiningen getting jars from the maven repos, and I'm wnodering if anyone else has seen this or knows what to do about it. It takes a tremendously long time- I have had to leave it running overnight. And in some cases it is just failing to get jars. I'm specifically trying to get the deps for noir right now, but the slowness was happening even when lein was trying to get its own d

11:45 (though it did eventually get all of them, after several hours of gringing away. Any ideas?

11:46 stankley: Baldanders: Hmmmm...

11:46 Baldanders: I'm on a windows 7 machine, btw, and my internet connection is otherwise fine.

11:46 stankley: Baldanders: When was this, specifically?

11:47 Baldanders: And are you still having problems?

11:47 Baldanders: I didd find this issue on the leiningen site: https://github.com/technomancy/leiningen/issues/534

11:47 I installed lein on Monda morning, I think. It has been consistent since then.

11:48 But that issue is marked closed, as I guess they got some miror support into Leiningen that fixed it.

11:49 It could just be a problem with the maven repos it is trying to use, but I would expect that if that were the case a lot of people would be seeing it.

11:50 stankley: Baldanders: Yeah, that sucks. I started doing all my Clojure development in Virtual Machines, I don't know what you're working on, but check out my repo for a Vagrant VM: https://github.com/burningion/emacs-clojure-vagrant

11:50 Emacs 24, Leinengen, Chef, and PostgreSQL

11:50 Makes everything easy in my experience, YMMV

11:51 Haven't had any slowness working in Linux

11:55 Baldanders: Hmm- well for the noir stuff I want to do I could do it in a VM, but there is some other stuff I want to do with Clojure that reaelly needs good performance, and the development really should be done under Windows.

11:55 But may check out the VM you posted for the noir stuff, which is my more immediate priority. Thanks.

11:56 It would be nice to figure this out though, as it makes using Leiningen basically imposiible for me, and I don't think I did anything wrong to cause it.

11:57 But if no one here has any idea, maybe I should post to the leiningen group.

11:57 Anyway, thanks again.

11:57 stankley: Baldanders: Feel you. Yeah, I would post to the group.

12:44 bdesham: I'm looking for a function that will do "map" on the values of a map

12:45 so (my-function #(* 2 5) {:a 3 :b :4 :c 5}) -> {:a 6 :b 8 :c 10}

12:45 oops, should be #(* 2 %)

12:48 dnolen: you know if the CLJS compiler would AOT it would probably be a lot faster ...

12:48 bdesham: ,(apply hash-map (flatten (for [[k v] {:a 3 :b :4 :c 5}] [k (* 2 v)])))

12:48 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>

12:48 bdesham: ,(apply hash-map (flatten (for [[k v] {:a 3 :b 4 :c 5}] [k (* 2 v)])))

12:48 clojurebot: {:a 6, :c 10, :b 8}

12:48 bdesham: I'd like something without flatten though

12:50 S11001001: bdesham: put your map in a real map instead and change map to mapcat

12:50 jkkramer: ,(into {} (for [[k v] {:a 3 :b 4 :c 5}] [k (* 2 v)])

12:50 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

12:50 S11001001: bdesham: you can also write this: (for [[k v] ... r [k ...]] r)

12:50 jkkramer: or use https://github.com/flatland/useful/blob/develop/src/useful/map.clj#L47

12:51 S11001001: jkkramer: that's much better, I didn't even read the whole expr :)

12:51 bdesham: ah, I know I've used (into {} ...) before but I forgot about it

12:51 thanks all!

12:53 Iceland_jack: ,(into {} (for [[k v] {:a 3 :b 4 :c 5}] [k (* 2 v)]))

12:53 clojurebot: {:a 6, :c 10, :b 8}

12:56 jkkramer: there must be a clojurebot quip for that

12:56 ~map-vals

12:56 clojurebot: Cool story bro.

13:08 jsabeaudry: what triggers the "Cool story bro." trolling?

13:08 TimMc: jsabeaudry: One of many "I don't have a factoid for that" responses.

13:08 gfredericks: I think it's just one of the things he says when he doesn't know what to say.

13:09 clojurebot: right?

13:09 clojurebot: to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks

13:09 jsabeaudry: hahahah love it

13:10 riddochc: Just did a brew install clojure; brew install leiningen at work. Wish me luck. ;)

13:16 antoineB: hello, i don't remmember well thread and java,

13:16 i want to build a backgroup thread that do some work, then sleeps in an infinite loop

13:17 need i just need Thread/sleep, or need i some extra instruction, to say to the scheduler that don't prorityze this thread?

13:17 riddochc: antoineB: look at futures.

13:18 antoineB: the thread run indefinitly, so its not a future case

13:18 riddochc: Er, sorry, not futures, I don't know what I'm talking about. ;)

13:18 AtKaaZ: antoineB: (.start (Thread. #(do (println 1) (Thread/sleep 1000))))

13:18 riddochc: I'm *fairly* sure clojure has what you're looking for built-in already.

13:19 nDuff: antoineB: there's a Timer/TimerTask in abstraction that Java has built in.

13:19 technomancy: nothing wrong with falling back to java for this

13:19 nDuff: antoineB: I have a little helper built around it -- if you're interested, I can find it.

13:19 AtKaaZ: nDuff, I'm interested

13:20 nDuff: https://gist.github.com/a7d911dc0df88c3c3c8f

13:21 antoineB: nDuff: super, thanks

13:22 nDuff: ...actually, I left some helpers out of that. Revising...

13:23 riddochc: technomancy: nothing wrong with it, agreed… it's also good to know what's in the clojure ecosystem anyway.

13:24 …To the degree that one finds practical. (I'm trying to learn from simple v. easy)

13:25 technomancy: riddochc: I just mean that Clojure explicitly doesn't bother implementing certain things when Java does an actually decent job of them

13:26 riddochc: Yeah. I just thought it's possible antoineB's could use something more specific.

13:26 nDuff: antoineB / AtKaaZ: Updated that with a helper for shutdown and an example.

13:26 riddochc: *shrug*

13:26 AtKaaZ: thanks nDuff, still trying to understand it xD

13:26 nDuff: AtKaaZ: Feel free to ask any questions.

13:28 AtKaaZ: nDuff: roger, for now I figured out I need to (import [java.util TimerTask Timer]) and define logger

13:29 nDuff: Ahh, right. Sorry 'bout that.

13:29 ohpauleez: lynaghk: ping

13:29 AtKaaZ: no need, I'm an abnormal (ie. newbie) clojure user :)

13:35 nDuff, that's pretty cool ! just tested it

13:36 jamii: This is confusing me - https://gist.github.com/3947508

13:36 Maybe something to do with classes being redefined?

13:37 AtKaaZ: if you do a (class ...) to each what's it say? I'd try it but I'm missing that lib

13:41 jamii: AtKaaZ: user> (class (pattern ?n))

13:41 strucjure.pattern.Bind

13:41 user> (class #strucjure.pattern.Bind{:symbol n})

13:41 strucjure.pattern.Bind

13:41 user> (= (class (pattern ?n)) (class #strucjure.pattern.Bind{:symbol n}))

13:41 false

13:41 Sorry, should have put that in the gist

13:43 dnolen: jamii: yeah if those aren't equal a problem w/ redef

13:44 jamii: dnolen: ok, I guess I'll just restart the repl

13:44 AtKaaZ: was there some *flag* that would make = also compare meta ?

13:51 could someone add an example here: http://clojuredocs.org/clojure_core/clojure.core/*print-meta*

13:52 I tried to create an example in my repl, but it won't work

13:52 S11001001: AtKaaZ: paste example here

13:53 AtKaaZ: S11001001, I tried several, pasting one ##(binding [*print-meta* true] print meta)

13:53 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

13:53 AtKaaZ: ,(meta (var meta))

13:53 clojurebot: {:ns #<Namespace clojure.core>, :name meta, :arglists ([obj]), :added "1.0", :static true, ...}

13:54 S11001001: ,(binding [*print-meta* true] (pr #'meta))

13:54 clojurebot: ^{:ns #<Namespace clojure.core>, :name meta, :arglists ^{:line 196} ([obj]), :added "1.0", :static true, ...} #'clojure.core/meta

13:54 AtKaaZ: on nice, only with pr i see

13:54 S11001001: ,(print "hi")

13:54 clojurebot: hi

13:55 S11001001: AtKaaZ: as you can see, print is utterly inappropriate for forms

13:55 AtKaaZ: thank you

13:55 S11001001: pr/print dichotomy is like write/display dichotomy in scheme, repr/str in python

13:55 rbxbx: Does Clojure provide any hooks/listeners/etc to trigger an action when a source file is loaded or reloaded ?

13:55 ToBeReplaced: technomancy: do you still develop and/or use radagast?

13:55 AtKaaZ: S11001001, I know none of those

13:56 rbxbx: Googling has failed me, but perhaps I've googled the wrong things.

13:57 S11001001: AtKaaZ: do you know any other languages with a generic print that prints strings in syntax suitable for string literals within that language?

13:58 AtKaaZ: S11001001, do you mean like prints "a" as "a" not a ?

13:59 nDuff: S11001001: bash has its printf %q

13:59 (though with the paucity of data types there, that hardly counts)

13:59 TimMc: ,(print "a\\b") ;; AtKaaZ

13:59 clojurebot: a\b

13:59 ohpauleez: dnolen: https://github.com/ohpauleez/core.logic/commit/1250ef7960540eae4d4c0412b1d157f172b3f61e

14:00 AtKaaZ: S11001001, are you referring to pr-like print functions?

14:00 ohpauleez: partial-map and easy unification ported

14:00 S11001001: AtKaaZ: yes

14:00 ohpauleez: Once I get it cleaned up, I'll give you the patch

14:00 dnolen: ohpauleez: that is awesome

14:00 AtKaaZ: S11001001, cause those were some big words for me haha, I don't think that I know any though

14:01 S11001001: Ok.

14:02 AtKaaZ: ,(pr "a")

14:02 clojurebot: "a"

14:03 dnolen: ohpauleez: thanks, will definitely love to get that in the next 0.8.0 beta

14:03 ohpauleez: dnolen: I also have a ported clojure.pprint which I'll have a ticket and patch for on CLJS dev

14:03 dnolen: ohpauleez: rad

14:03 ohpauleez: definitely, I think I can get it together for you for the next beta - should be all cleaned up by tomorrow the latest

14:05 AtKaaZ: I'm curious to know the answer to rbxbx's question though, that reminds me of *compile-files* and possibly the fact that you can put code to be executed on reload in the ns

14:05 uvtc: I'm trying to get a simple Compojure + Hiccup app running, one which has two source files: src/test_app/{handler,views}.clj. However,

14:06 I'm getting this exception: Parameter declaration hic-p/html5 should be a vector

14:06 * uvtc is making a gist ...

14:07 rbxbx: AtKaaZ just leave the code bare in the file and it would run open being loaded is what you're suggesting?

14:07 uvtc: Here's the code:

14:07 https://gist.github.com/3947728

14:07 AtKaaZ: rbxbx, something like that, I have a (println "loaded" *ns*) in my file

14:08 rbxbx: AtKaaZ hmm. That may work. Thanks :)

14:09 AtKaaZ: I was thinking about having the "listener" living outside that file, but maybe I'm just thinking about things wrong.

14:09 uvtc: Afaict, I'm passing hic-p/html5 just vectors...

14:10 AtKaaZ: rbxbx, i think you can do that too, but the trigger will happen by calling some code within the file that's being (re)loaded

14:10 nDuff, what is expected after the fn ? something like :key value on line 24

14:10 nDuff, I should say this: {:keys [exception-handler]}

14:10 rbxbx: ah

14:11 nDuff: AtKaaZ: That's an optional keyword argument, for if you want to provide your own exception handler rather than just sending it straight to log4j

14:12 AtKaaZ: log4j, that explains why I shouldn't have used java's Logger

14:12 jkkramer: uvtc: home-page is a defn without arguments. you want to add arguments or use plain def

14:13 uvtc: Oh my goodness.

14:13 patchwork: Anyone have any idea why suddenly my cheshire (latest, 4.0.3) can't find org.codehaus.jackson.smile.SmileFactory?

14:13 It worked yesterday!

14:14 jkkramer: uvtc: I make that mistake regularly

14:14 AtKaaZ: rbxbx: I was thinking like (send agent reloaded) but you'd have to put this line in every namespace(aka clj file) that you want to trigger, wonder if there's a way to include that code and be executed for each file, maybe a macro of the (ns ...)

14:14 emezeske: uvtc: Totally unrelated to your problem, but did you know you can write [:div#header ...] instead of [:div {:id "header"} ...] ?

14:14 uvtc: jkkramer: thanks. I was staring right at that one without seeing it. :)

14:14 rbxbx: AtKaaZ that might start to get into dark magic though ;)

14:14 AtKaaZ: nDuff, I would provide the ex handler as the value ? in :key1 value

14:15 uvtc: emezeske: Right. Thanks.

14:20 nDuff: AtKaaZ: :exception-handler your-handler-here, yes.

14:22 AtKaaZ: nDuff, I didn't know how that destructuring worked, thanks

14:32 wingy: im trying to make a fn that is passed an XML map and returns the XML string

14:33 https://github.com/clojure/data.xml uses a FileWriter, I guess I need to use the java.io.StringWriter though

14:34 but I don't know how it works .. tried this https://www.refheap.com/paste/6105 without success .. could someone help out

14:34 rbxbx: wingy: can you just call (str map) ?

14:35 S11001001: wingy: you need to actually get the stuff you wrote into the stringwriter

14:35 emezeske: wingy: Did you see clojure.data.xml/emit-str ?

14:35 wingy: https://github.com/clojure/data.xml/blob/master/src/main/clojure/clojure/data/xml.clj#L340

14:35 wingy: rbxbx: but that wont give me a xml string

14:36 rbxbx: ah yes, emezeske's advice looks much better

14:41 wingy: that one seems to work only if i have created the xml data structure with xml/element

14:41 hmm

14:41 but perhaps that's what i want

14:42 i thought clojure map -> xml string .. but perhaps what i need to do is to create the clojure xml with xml/element like in the examples

14:46 jonasen: If I recur from a multimethod, is the call going through the dispatch function or is the recur target the same method?

14:47 AimHere: You could always test that

14:47 wingy: jonasen: i bet on the same function

14:48 AimHere: I know I'm going to!

14:49 hiredman: jonasen: the same method

14:50 jonasen: hiredman: ok, thanks. That explains my infinite loop :)

14:51 AtKaaZ: how can I say (if undefined(symbol) then return {:undef nil} else {:defined symbol}) but the entire if block fails if the symbol is undefined because of the {:defined symbol} part

14:52 jonasen: https://gist.github.com/3948008

14:52 bdesham: AtKaaZ: are you getting an exception? you could use (try ...) if so

14:53 wingy: jonasen: you dont have a exit strategy?

14:53 so it will run forever

14:53 Sgeo: ,(special-symbol? 'loop*)

14:53 clojurebot: true

14:53 zerokarmaleft: z[ ] Transfer Higher One to BoA

14:53 AtKaaZ: bdesham, yes RuntimeException: Unable to resolve symbol, that might be a way indeed, I was hoping for another

14:53 Sgeo: ,(special-symbol? 'recur)

14:53 clojurebot: true

14:54 wingy: jonasen: https://gist.github.com/3948018

14:54 try and see if it will run forever

14:54 AtKaaZ: bdesham, if I use that I could make the macros be functions... worth thinking about it

14:54 bdesham: AtKaaZ, under what conditions would you have something that might be undefined? (I can understand that something might be nil, but undefined?)

14:55 Sgeo: AtKaaZ, use &env to look up the symbol in the lexical environment and use resolve to check if it's in the dynamic environment?

14:55 AtKaaZ: bdesham, say some exception happens and some defs weren't reached, I might test that in another ns

14:56 jonasen: hiredman: Do you know why it's that way? It's not what I expected

14:56 AtKaaZ: Sgeo, &env?

14:56 Sgeo: AtKaaZ, in a macro, &env is a map where the keys are lexically defined symbols and the values are... just ignore those

14:57 hiredman: jonasen: it falls out of the implementation of recur and multimethods

14:57 AtKaaZ: Sgeo, ok cool I'll check that more

14:57 Sgeo: http://ideone.com/z6MTLx

15:00 AtKaaZ: wow

15:02 jonasen: hiredman: Ok, no more recur+multimethods for me then

15:03 jlewis: is there an obvious builtin that gives you a list of all of the suffixes of a list? e.g. '(1 2 3) -> '((1 2 3) (2 3) (3))

15:04 antares_: dakrone: hey

15:05 Sgeo: ,(clojure.lang.Compiler/specials)

15:05 clojurebot: {deftype* #<DeftypeParser clojure.lang.Compiler$NewInstanceExpr$DeftypeParser@75d7d567>, new #<Parser clojure.lang.Compiler$NewExpr$Parser@3a2371c0>, quote #<Parser clojure.lang.Compiler$ConstantExpr$Parser@614951ff>, & nil, var #<Parser clojure.lang.Compiler$TheVarExpr$Parser@3a8ff4b0>, ...}

15:05 llasram: jlewis: ##(take-while seq (iterate rest '(1 2 3)))

15:05 lazybot: ⇒ ((1 2 3) (2 3) (3))

15:05 Sgeo: ,(-> (clojure.lang.Compiler/specials) keys)

15:05 clojurebot: (deftype* new quote & var ...)

15:06 Sgeo: ,clojure.lang.Compiler/specials

15:06 clojurebot: {deftype* #<DeftypeParser clojure.lang.Compiler$NewInstanceExpr$DeftypeParser@75d7d567>, new #<Parser clojure.lang.Compiler$NewExpr$Parser@3a2371c0>, quote #<Parser clojure.lang.Compiler$ConstantExpr$Parser@614951ff>, & nil, var #<Parser clojure.lang.Compiler$TheVarExpr$Parser@3a8ff4b0>, ...}

15:06 jlewis: thanks! just what i was trying to think of.

15:06 Sgeo: Hmm, why does parenthesizing not make it try to sue it as a function?

15:07 amalloy: ,(macroexpand-1 '(clojure.lang.Compiler/specials))

15:07 clojurebot: (. clojure.lang.Compiler specials)

15:07 AtKaaZ: Sgeo, worked but looks like those were the keys

15:09 Sgeo: AtKaaZ, hmm? The values of &env are internal stuff that I don't understand

15:10 ,clojure.lang.Compiler/SOURCE

15:10 clojurebot: #'clojure.core/*source-path*

15:10 Sgeo: ,clojure.lang.Compiler/LOADER

15:10 clojurebot: #<Var: --unnamed-->

15:11 Sgeo: ,clojure.lang.Compiler/NO_RECUR

15:11 clojurebot: #<Var: --unnamed-->

15:11 Sgeo: Hmm, I don't entirely understand the difference between Var.create() and Var.create(null(

15:11 * Var.create(null)

15:14 ,(resolve '.toString)

15:14 clojurebot: nil

15:14 Sgeo: ,(resolve 'to.String)

15:14 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.ClassNotFoundException: to.String>

15:15 Sgeo: ,(clojure.lang.Compiler/resolveSymbol 'resolve)

15:15 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: resolveSymbol, compiling:(NO_SOURCE_PATH:0)>

15:15 Sgeo: o.O

15:16 ,(. clojure.lang.Compiler (resolveSymbol 'resolve))

15:16 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: resolveSymbol, compiling:(NO_SOURCE_PATH:0)>

15:16 AtKaaZ: Sgeo, ah I meant about this: ,(-> (clojure.lang.Compiler/specials) keys)

15:17 can CompilerException be caught?

15:17 antares_: hm, what's the best way to check if a namespace is available?

15:17 amalloy: &(doc find-ns)

15:17 lazybot: ⇒ "([sym]); Returns the namespace named by the symbol or nil if it doesn't exist."

15:30 antares_: amalloy: thanks

15:32 amalloy: wow, apparently there is something called compile-if

15:32 &(doc compile-if)

15:32 lazybot: java.lang.RuntimeException: Unable to resolve var: compile-if in this context

15:36 antares_: ok, it is defined clojure.reducers: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L37

15:39 hiredman: antares_: I don't think it is intended for general use, it was added to fill a need in reducers

15:39 antares_: hiredman: I know. I need to extend a protocol only if a library (clojure.data.json is available)

15:39 https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33

15:39 hiredman: and actually isn't great

15:40 because it sets in stone at compile time (and reducers is aot compiled)

15:40 antares_: I think I replied to your ml thread

15:40 protocols create vars, you can check for the existence of the var

15:41 antares_: hiredman: what would the name of the var be for clojure.data.json/Write-JSON?

15:41 hiredman: antares_: open a repl and check?

15:43 ,(ns-publics clojure.core.protocols)

15:43 clojurebot: #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.core.protocols, compiling:(NO_SOURCE_PATH:0)>

15:43 hiredman: ,(ns-publics clojure.core.protocols)

15:43 clojurebot: #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.core.protocols, compiling:(NO_SOURCE_PATH:0)>

15:43 hiredman: ,(ns-publics 'clojure.core.protocols)

15:43 clojurebot: {emit-array-impls #'clojure.core.protocols/emit-array-impls, arr-impl #'clojure.core.protocols/arr-impl, InternalReduce #'clojure.core.protocols/InternalReduce, internal-reduce #'clojure.core.protocols/internal-reduce}

15:44 hiredman: ,(for [[k _] (ns-publics 'clojure.core.protocols) :when (map? (deref k))] k)

15:44 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IDeref>

15:44 hiredman: ,(for [[_ k] (ns-publics 'clojure.core.protocols) :when (map? (deref k))] k)

15:44 clojurebot: (#'clojure.core.protocols/InternalReduce)

15:44 hiredman: clojurebot: jerk

15:44 clojurebot: you cut me deep, man.

16:01 c-jay: hey :) is there anything like a language specification for clojure? or something similar?

16:03 wingy: is json or xml more popular for clojure apps?

16:03 dnolen: c-jay: there is not

16:04 c-jay: oh, realy? i was afraid of... i wasn't able to find anything...

16:04 damn! ^^

16:04 i would like to write a term paper about clojure. but i need a lang. spec. in order to get the language through the approval process

16:05 however, thank you

16:05 antares_: hiredman: thanks, figured it out without checking for interfaces

16:06 emezeske: wingy: If you're choosing between json and xml, have you considered using clojure forms as a data exchange format? E.g. pr-str and read-string ?

16:07 antares_: wingy: I don't know a single person who uses XML without some legacy system requiring that

16:07 wingy: if you go with JSON, please use Cheshire and not clojure.data.json

16:08 wingy: antares_: why is that?

16:08 im using clojure.data.json atm

16:08 since it has clojure.data.xml as well

16:08 supervised by clojure team

16:08 antares_: wingy: because 0.2.0 is not compatible with 0.1.x, the entire public API has changed

16:08 wingy: emezeske: yeah ill use it between my frontend and backend

16:09 emezeske: wingy: Oh, this is for a public API?

16:09 antares_: wingy: cheshire is not likely to go through any breaking changes at 4.0, definitely not changes like clojure.data.json

16:09 tomoj: what the heck? in some code I have (reset! debug [f v (map f v) (class v)]) (I know, I know :(). later, (last @debug) is PersistentVector, and (let [[f v mapped] @debug] (= (map f v) mapped)) is false

16:09 wingy: emezeske: yeah .. also i am using services, some support xml, some json .. and i was curious about which one i would actually prefer on clojure land

16:09 antares_: wingy: I don't understand the clojure.data.xml argument. clojure.data.xml is not similar to clojure.data.json in any way.

16:10 besides the name

16:10 emezeske: wingy: These days I think most people prefer json over xml.

16:10 wingy: antares_: at least its from the same team

16:10 antares_: wingy: not the same team at all

16:10 wingy: oh :)

16:10 antares_: wingy: each has a maintainer and they probably barely speak to each other

16:10 wingy: clojure.data.json 0.2 was a breaking release to a widely used library, without ANY ahead warnings

16:10 wingy: antares_: so its just about the API changes?

16:10 ok

16:11 antares_: wingy: it is about ridiculous maintainership practices

16:11 wingy: i did a comparison before on speed and cheshire was speedier

16:11 antares_: and the CA process and general "clojure/core does not have to explain anything, it just does things and community sucks it up" philosophy

16:11 performance-wise, I don't think JSON serialization will be a major bottleneck

16:12 way back when cheshire was not extensible for custom data types

16:12 now it is, see cheshire.custom

16:13 wingy: antares_: he he did xml as well! :)

16:13 tomoj: the only explanation I can think of is that my persistent vector isn't persistent, which is.. probably wrong

16:15 wingy: would it make sense to support yaml and clojure data on my public API?

16:16 antares_: wingy: anyway, that's just my advice. Monger will have to somehow support all 3, currently supporting 2 is more painful than any other Clojure code I maintain. If I could, I'd drop clojure.data.json support completely but it is too late.

16:16 wingy: clojure data for clojure apps .. that would be cool .. its not that it requires a lot of coding

16:17 amalloy: tomoj: (= f #(do % (rand-int 10))) is another example

16:17 wingy: antares_: i am working against an abstraction util/read-json / util/write-json so i can just switch the under the hood implementation

16:18 a book taught me to work against abstractions, not implementations

16:18 for better maintainability

16:18 antares_: wingy: that's what we have, too: https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj. Does that look pretty or easy to maintain to you?

16:19 wingy: antares_: why cant you drop clojure.data.json support?

16:19 ToBeReplaced: is (korma/sql-only (korma/select my-entity)) meant to return "SELECT \"my-entity\".* FROM \"my-entity\"?

16:19 antares_: wingy: because Monger has many users?

16:20 wingy: and I care about backwards compatibility?

16:20 ToBeReplaced: the docs make it look like it's supposed to return "SELECT * FROM my-entity" but that's not what i see when running the docs in the repl

16:20 wingy: antares_: is there something clojure.data.json is doing that cheshire can't do?

16:21 have i misunderstood .. you are using clojure.data.json under the hood in monger for parsing/stringifying json?

16:21 antares_: wingy: no. But it does not matter, people are not going to stop doing what they are doing and upgrade everything to Cheshire just because I removed it. They just won't upgrade Monger, ever.

16:21 wingy: no, just extending various JSON serializers to support mongodb types and Joda Time dates

16:22 Raynes: I'm not sure how I feel about the supporting multiple library thing.

16:22 I'm a little concerned about what monger would look like if there were 10 highly used libraries for everything it does.

16:23 tomoj: amalloy: yeah

16:23 but I replaced f with (constantly 42)

16:23 problem persists

16:23 antares_: Raynes: I am not going to support multiple libraries for anything but JSON

16:23 Raynes: antares_: I was mostly poking fun.

16:23 tomoj: OH

16:23 shift

16:23 er, shit.

16:23 Raynes: <3

16:23 amalloy: tomoj: in that case something is changing the atom other than that reset. i don't think the behavior you describe is possible otherwise

16:24 tomoj: I had "map" bound to a map

16:24 dnolen: optional warnings on shadowing might be nice ...

16:26 tomoj: I started out with some simple function that just did an assoc, and was like "well, assoc shadows map, so I will too", then forgot when I later needed map. don't think I'll ever do that again..

16:26 amalloy: dnolen: the trouble is, most of the time i want to be allowed to shadow names in peace, and when i start having crazy problems like tomoj i wouldn't think of turning those warnings on

16:36 CR7: hello everyone

16:36 Raynes: cemerick: Did you see that tweet where the guy listened to our mostlylazy episode and it made I'm like MVS less? Mind blown.

16:36 CR7: can anyone tell something descriptive about clojure

16:36 dnolen: amalloy: yeah, still would be a good feature for a linter - sanity check before going down the debugging rabbit hole

16:39 emezeske: amalloy: You want to shadow names in peace? http://i.qkme.me/3rhmtt.jpg

16:40 Clearly clippy is the answer.

16:42 amalloy: emezeske: i am so far disappointed by my search for "emacs clippy"

16:43 there are a surprising number of articles on some vim clippy thing, though

16:43 emezeske: Vim clippy?

16:43 amalloy: http://www.geekzone.co.nz/foobar/5656

16:43 * emezeske runs and hides and covers his ears.

16:43 emezeske: hahahahah

16:47 antares_: Raynes: https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj

16:48 Raynes: madness but it works after all

16:54 jweiss_: is there a clearer way to write (fn [& _] (foo)) (fn to ignore the arguments and call foo with no args). (constantly foo) doesn't quite work because that just returns foo, doesn't call it.

16:55 AtKaaZ: ,#(#_%& foo)

16:55 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0)>

16:55 jweiss_: that's clearer? :)

16:55 AtKaaZ: lol good point:D

16:56 jweiss_: shorter, yes :)

16:56 joegallo: jweiss_: i would do what you did

16:56 AtKaaZ: jweiss_: thing is that #_%& looks like a comment

16:56 jweiss_: AtKaaZ: i've never even seen that before

16:57 AtKaaZ: jweiss_, yeah the way your wrote that is clear enough imho

16:58 emezeske: jweiss_: If you're doing it a lot, you could always ##(defn ignore-args [f] (fn [& _] (f)))

16:58 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

16:58 emezeske: Well, lazybot's complaint notwithstanding, you get the picture

16:59 jweiss_: emezeske: yeah probably better as a macro (defmacro always-do [& body] `(fn [& _] ~@body))

17:00 emezeske: I'd keep it as a function, but that's just IMO

17:00 jweiss_: well, in general i might want to call foo with args, just not the ones passed into the outer fn

17:01 TimMc: (defn nary [f] (fn [& _] (f)))

17:01 (nary foo)

17:02 gfredericks: (defn nary [f & args] (fn [& _] (apply f args)))

17:03 emezeske: I assumed that nary meant nullary

17:03 TimMc: gfredericks: Good call.

17:03 AtKaaZ: (fn [& ignore-all-args ] (foo))

17:03 gfredericks: (defn somary [f & args] (fn [& _] (apply f args)))

17:03 emezeske: lol

17:03 otherary

17:03 gfredericks: ary

17:03 TimMc: arrr

17:03 gfredericks: varargical

17:03 emezeske: swapary has the advantage of being fun to say

17:05 AtKaaZ: lol gfredericks

17:05 antares_: If you are not happy about the clojure.data.json API changes, vote http://dev.clojure.org/jira/browse/DJSON-5 up

17:05 * gfredericks wants a json library that uses a lazy map

17:06 TimMc: "For libraries that rely on data.json the 0.2 release was a major unexpected breakage."

17:07 antares_: TimMc: you don't agree with that?

17:07 TimMc: Is there some reason I *shouldn't* find that amusing?

17:07 antares_: TimMc: I am not sure what is amusing. Maybe the grammar is, I don't give a shit, I am not a native English speaker.

17:08 TimMc: That's a pre-1.0 release. Of course it's going to break.

17:08 antares_: TimMc: but that's not how you maintain popular libraires

17:08 TimMc: that's too late to use lame excuses like that

17:08 technomancy: data.json is popular now? =)

17:08 antares_: the library has been around for what, a year?

17:08 TimMc: Well, the other things that's funny is that there was breakage on a minor version bump.

17:08 ivan: I grepped everything I use and found one instance of data.json in some tests

17:08 technomancy: aw hell, it's in the top 10 on clojuresphere

17:08 that's just wrong

17:08 antares_: ivan: I know plenty of people using it

17:09 technomancy: more importantly, most of the changes were not necessary, like renaming c.d.j./json-str to /write-json

17:09 technomancy: ◔_◔

17:09 lame

17:09 antares_: and not providing a compatibility function that is deprecated

17:09 technomancy: why would you do that?

17:09 nDuff: *shrug*. Part of the point of naming something 0.x is to indicate that one reserves the right to make major changes at will.

17:09 technomancy: aliases are so easy to add

17:09 nDuff: There's only a promise of stability post-1.0

17:10 relying on a pre-1.0 library is something one does at one's own risk.

17:10 antares_: nDuff: that's lame to say that for a 1 year old library that is supposed to be a contrib library

17:10 gfredericks: clojure breaks stuff all the time within 1.x

17:10 antares_: nDuff: the entire Clojure ecosystem beyond Lein and ClojureWerkz is 0.x or even 0.0.x

17:11 nDuff: it's just disrespectful to make breaking APi changes without any compatibility layer and not even ask on the mailing list

17:11 for a library that's in the top 10 on clojuresphere, at least

17:11 it's crazy that someone even has to explain this

17:11 TimMc: gfredericks: And that pisses me off. It should be Clojure v1, v2, v2.1, v3...

17:12 At least in that case it's a well-known violation of semver.

17:12 gfredericks: I want pinball-based numbers. If anything changes there is a minimum of version += 500

17:12 * technomancy voted for bumping to 2

17:12 nDuff: TimMc++ (re: semver being the Expected Thing)

17:13 emezeske: gfredericks: Is a major release like a pinball multiplier?

17:13 gfredericks: emezeske: sure!

17:13 emezeske: gfredericks: Forking is multiball.

17:13 technomancy: you can expect devs to track version numbers that don't make sense for the language itself, because you simply can't ignore clojure development

17:13 the exception that proves the rule

17:18 TimMc: antares_: I'll still vote up, I'm just kind of baffled by both the maintainers and the users.

17:19 Raynes: I don't usually release 1.0.0s because I'm never really convinced of the stability of my libraries. ;)

17:20 For example, conch.sh is super new and nobody has used it yet, but it *is* usable, I just don't know that it is stable enough for 1.0.0 and don't like doing beta alpha and RC releases for 100 years.

17:20 antares_: Raynes: there is life past 1.0, bro

17:21 it's called 2.0, 3.0, 4.0

17:21 TimMc: Raynes: It doesn't have to be stable, you're just making a statement about API changes.

17:21 Raynes: Yeah, but someone (you?) just pointed out that 1.0 is a promise of stability, antares_.

17:21 I don't have that promise yet.

17:21 nDuff, it looks like.

17:22 emezeske: Raynes: I think 1.0 means "stable API," e.g. function names won't be changing out from underneath you for a while

17:22 antares_: Raynes: it's a promise of things being reasonably complete and not breaking in any serious way before 2.0.

17:22 Raynes: but not forever

17:22 TimMc: "breaking" as in API, not as in bugs

17:22 antares_: right

17:22 emezeske: Raynes: I can't try to persuade you to go to 1.0, though -- lein-cljsbuild is still 0.2.x :P

17:22 brehaut: does lein still default to version 1.0.0 in new projects?

17:22 Raynes: Fair enough. I hate making those sorts of decisions.

17:23 brehaut: 'still'? It never did?

17:23 brehaut: it totally did. with a -SNAPSHOT

17:23 Raynes: Really?

17:23 brehaut: really

17:23 Raynes: Far out.

17:23 I doubt it.

17:23 I'm not that ridiculous.

17:25 antares_: new projects should go to 1.0 when they are (mostly) complete as far as the initial scope goes, in my opinion

17:25 small libraries should be released as 1.0

17:25 because otherwise they will be on 0.0.1 forever

17:25 people are not comfortable using 0.0.1 stuff and it generally does not give you any idea bout the state of the project

17:26 given that most clojure libs are also not documented at all, it gives a very creepy impression of the community to some people

17:26 brehaut: Raynes: https://github.com/technomancy/leiningen/blob/1.7.1/src/leiningen/new.clj#L24

17:26 TimMc: Yep, I should just go ahead and bump lein-otf to 1.0.

17:26 emezeske: You guys might have convinced me to bump lein-cljsbuild to 1.0

17:27 antares_: emezeske: do it. You can always go to 1.1 or 1.5 or 2.0 fairly quickly. Nothing wrong with that.

17:27 TimMc: technomancy: I am working on getting lein-otf to work on lein2... I'm adding in a profile and using it, but :main is being ignored.

17:27 Raynes: antares_: What people?

17:27 If that's true, then 90% of Clojure libraries must never see use.

17:27 emezeske: antares_: I think I will. I haven't had to make any big public-facing changes for a while.

17:27 antares_: Raynes: many folks I know from both Java and Ruby felt very uneasy about 0.0.1 libraries without docs

17:27 TimMc: technomancy: the result being that the lein_otf.loader isn't AOT'd and included in the jar. :-( But at least I'm working on it.

17:28 antares_: Lack of docs is a huge problem.

17:28 antares_: Raynes: even if those libraries were pretty good and stable in every sense of the word

17:28 Raynes: Sure you're not a statistician?

17:29 antares_: Raynes: I don't think joking about this is completely appropriate

17:29 Raynes: Do you know me?

17:30 emezeske: Joking is always appropriate! -- Me

17:30 Raynes: I don't think we've met, I'm Raynes.

17:30 antares_: sometimes I get the impression that the best and brightest in the Clojure community proactively want people to NOT use Clojure

17:30 doomlord: they want to keep it as a niche ?

17:30 brehaut: O_o

17:30 antares_: that's why they do stuff like clojure.data.json 0.2 or ignoring working on the docs

17:30 emezeske: antares_: Now that's just plain ridiculous

17:31 "Never attribute to malice that which is adequately explained by stupidity."

17:31 antares_: emezeske: yeah? then why esoteric bullshit like core.logic gets all kinds of attention and docs are neglected at massive scale?

17:31 Raynes: This is the second time in two weeks that you've summarized programming communities based on people you know during a conversation we've had, antares_. I just thought it was a little funny. I apologize if I offended you.

17:31 antares_: emezeske: or compatibility and ease of use are never a major topic of discussion?

17:31 emezeske: antares_: See above.

17:31 metellus: antares_: because writing docs is boring?

17:31 TimMc: antares_: People scratch their own itches.

17:31 brehaut: antares_: core.logic gets love because dnolen is super interested in logic programming and willing to pour his spare time into it

17:31 TimMc: Welcome to open source.

17:31 antares_: metellus: I disagree, writing docs is super fun

17:32 TimMc: Not for a lot of folks.

17:32 antares_: metellus: somehow in other ecosystems people end up having at least some docs

17:32 emezeske: antares_: Why would you attribute it to malice? You have no grounds for that at all. There are a thousand reasons that don't involve people trying to actively discourage new clojure users.

17:32 antares_: emezeske: I said "I get the impression"

17:32 not that it is necessary so

17:32 Raynes: no offense taken

17:33 TimMc: ok, then we know what this community values

17:33 and does not value

17:34 emezeske: antares_: I "get the impression" that you're making a lot of conjecture based on a relatively small sample set

17:34 antares_: and the picture (as far as clojure adoption and good experience for newcomers go) is pretty grim

17:34 scriptor: to be fair, you can't just say "welcome to open source" when other open source languages have pretty decent documentation, both for the core and for libs

17:34 Raynes: And here I thought Clojure was doing pretty well in the adoption area.

17:34 scriptor: is it?

17:34 pisketti_: antares_: I'm currently seeing a lot of Clojure adoption - at least here in Finland.

17:35 In commercial projects

17:35 antares_: emezeske: I've been around in this community for 1.5 years or so, maintain 20+ libraries, contribute almost all my spare time to clojure-doc.org and try to help with Lein. I think I kinda have seen enough to make such judgements.

17:35 brehaut: quick everyone, to the annecdote machine!

17:35 Raynes: We've got 400 more people in this channel than we did 2 years ago, tooling gets better every day, thought works moved Clojure to adopt in their thing people seem to care about...

17:35 antares_: pisketti_: yeah and those people are probably WTFing all day long for the first few weeks

17:35 pisketti_: not because of the language, just how much the docs are neglected and what development practices are used by some projects

17:35 pisketti_: I haven't been particlarly unhappy

17:36 Raynes: I've been here for… 3-4 years, maybe? And I disagree with everything you've said.

17:36 antares_: and at large, not many people care

17:36 because core.bullshit is so much more fun

17:36 pisketti_: antares_: Though things could be better but at least for me it hasn't been a huge issue

17:36 Raynes: You're not going to get far by insulting core.logic and dnolen.

17:36 :\

17:37 antares_: pisketti_: nice. But I know many people who don't have a great time.

17:37 Raynes: I am not talking about core.logic. There are also core.other-exotic-things

17:37 Raynes: Also, what 'development practices' are the majority of Clojurians using that you find less than savory?

17:37 emezeske: antares_: You're right, people should... work on things they're not as passionate about, for some "greater good?"

17:37 antares_: Good work gets done because people are having fun, or because of money

17:38 pisketti_: antares_: I hear you, but I agree with Raynes here in that it's no use blaming the brightest and most enthusiastic ppl.

17:39 scriptor: emezeske: for the good of the language you like, maybe?

17:39 antares_: emezeske: node.js (which I am not a fan of) author had made a decision to work on less fun stuff like a good HTTP client and a bunch of other protocol implementations very early on, in the standard package. All for it to be useful. It paid off as you can see.

17:39 pisketti_: antares_: If they wan't to use their free time to make libs and the whole community better, it's their right to choose what they contribute to

17:39 Raynes: Hey, all I can say is that I try pretty hard to write good libraries, contribute to existing ones, and even write some docs every now and again. It's the best I can do in the time I am allotted and if it isn't sufficient, I tried. And I don't have half the responsibilities of most of the people around here. I have plenty of respect for them because of that.

17:39 antares_: pisketti_: I am not blaming people, I am saying that the values of this community are aligned to almost prevent adoption

17:39 emezeske: antares_: "All for it to be useful." Is he some kind of monk? Or maybe he has fun being famous, or fun helping others, etc...?

17:39 dnolen: antares_: I wish core.logic got more love than it does! Including docs!

17:40 emezeske: scriptor: If you want the language to do good, and that's fun for you, great!

17:40 antares_: emezeske: he probably has fun being famous and seeing people use his projects. But also he wanted to make it all worthwhile.

17:40 scriptor: emezeske: it doesn't have to be fun, I meant that sometimes you might have to do something you're not passionate about so that the language you like to use might do better in the long run

17:41 antares_: emezeske: because if it does not get adopted, it means he has spent thousands of hours in vain, more or less

17:41 pisketti_: antares_: The thing with clojure libs is that you can usually take a quick look at the source and figure out what it does. That is not the case in many other languages

17:41 antares_: pisketti_: yeah? go tell that to a typical joe the programmer

17:42 scriptor: antares_: there's a difference between actively making it hard for clojure to spread and simply not helping it to spread in every way (ie. docs)

17:42 Raynes: brehaut wrote an XML-RPC library. He must have good values.

17:42 Real good ones, even.

17:42 antares_: pisketti_: I can read the source but I HATE to do that. That's why clojurewerkz.org stuff is documented.

17:42 brehaut: haha

17:42 Raynes: That's the boringest shit ever.

17:42 brehaut: maybe i have a brain disease

17:42 antares_: (hate to read the source to figure out what should have been documented)

17:43 scriptor: relying on reading the implementation of a lib isn't a very good idea

17:43 Raynes: antares_: Is conch well documented?

17:43 ToBeReplaced: scriptor: that's the exact thing that's bothering me with clojure so far

17:43 pisketti_: antares_: As I said, things could be better and you are right in that it is important to maintain and improve the docs

17:43 ToBeReplaced: every single library i end up needing to read the source for

17:43 antares_: and to finally demonstrate what I am talking about, see what Unsessions are there suggested: https://github.com/relevance/clojure-conj/wiki/Clojure-conj-2012-Unsessions

17:44 again, highly esoteric stuff, besides running user groups and dojos

17:44 TimMc: pisketti_: ZenRobotics?

17:44 Raynes: antares_: Why not start a boring shit unsession then?

17:44 antares_: but no unsession on the docs, broken contribution process, sane maintenance practices

17:44 technomancy: antares_: relevance sells training =)

17:44 ToBeReplaced: which is great for me to learn, but holy cow it's annoying when it takes me 30 minutes to figure out things like how to pass the database connection through to execute a query

17:45 antares_: technomancy: that's what also puzzles me, they kinda heard of that "grow your market" thing, no?

17:45 AtKaaZ: ToBeReplaced for what lib?

17:45 antares_: ToBeReplaced: exactly!

17:45 brehaut: wait, so type checking and testing are no longer sane development practises‽

17:45 pisketti_: TimMc: You mean if I work there?

17:45 brehaut: someone better alert the haskell community double quick

17:46 ToBeReplaced: AtKaaZ: korma, heh...

17:46 TimMc: pisketti_: They're that one Clojure-using company in Finland, yeah?

17:46 pisketti_: No they aren't the only one. :)

17:46 scriptor: brehaut: I agree regarding testing, but will type checked clojure really see much adoption anytime soon?

17:46 TimMc: Cool.

17:47 AtKaaZ: lol it says: Korma is a domain specific language for Clojure that takes the pain out of working with your favorite RDBMS

17:47 brehaut: scriptor: i totally want to be able to type check my clojure code

17:47 gfredericks: +1

17:47 antares_: AtKaaZ: «…if you are the author of Korma»

17:47 ToBeReplaced: AtKaaZ: it's pretty slick... it's just i only wanted it to generate SQL, not to handle my database connections etc. etc., and i coudln't figure out how to rip it apart for a while

17:47 Raynes: antares_: You know, there was a whole meeting by contributors at last year's conference, right? And it wasn't an unsession or a scheduled session.

17:47 * gfredericks wants to check the hell out of his types

17:47 pisketti_: TimMc: I was just in a clojure event a couple of weeks ago (http://clojutre.org/) where a guy from ZenRobotics presented their stuff. Pretty impressive. :)

17:47 antares_: Raynes: I don't know, I haven't been there

17:47 brehaut: (inc gfredericks)

17:47 lazybot: ⇒ 11

17:48 technomancy: Raynes: more or less a token effort; nothing changed

17:48 AtKaaZ: antares_: it's funny because it doesn't seem to do that according to ToBeReplaced's 30min spent...

17:48 Raynes: technomancy: And nothing would change because of an unsession either.

17:48 antares_: AtKaaZ: yup, it only takes the pain out of … if you are the author of that lib :)

17:48 Raynes: If people don't want to write docs, they wont.

17:48 AtKaaZ: antares_: oh I see what you mean haha

17:48 antares_: Raynes: somehow Python, PHP and JS communities pay attention to docs

17:49 and not highly esoteric programming languages topics

17:49 scriptor: and I doubt those who document projects in those languages do it because it's 'fun'

17:49 pisketti_: TimMc: I'm currently writing Clojure on my day job, but I'm pretty much the only one. I'm hoping to see it used more in the future.

17:49 antares_: anyway, I am growing convinced that long-term sustainability of a community depends on how many people are willing to do really boring work

17:49 TimMc: Living the dream.

17:50 Raynes: antares_: Highly esoteric things are a part of Clojure culture. You have to deal with that. People here enjoy those things. That isn't going to change.

17:50 scriptor: antares_: encouraging docs and working on esoteric programming topics are mutually exclusive, it's possible to encourage both

17:50 antares_: and not shit rainbows all the time

17:50 pisketti_: TimMc: How do you know ZenRobotics?

17:50 ToBeReplaced: antares_: that's a little unfair though b/c a lot of essential libs made their way into core in some way or another, at which point heavier documentation were required

17:50 TimMc: scriptor: +not

17:50 brehaut: scriptor: i think you mean orthoganal?

17:50 antares_: scriptor: they pretty much are, in practice. Values that a community has propagates.

17:50 TimMc: pisketti_: functionaljobs.com

17:50 scriptor: brehaut: can I work complect into it somewhere? :)

17:51 brehaut: scriptor: i hope so

17:51 antares_: Raynes: oh, sure. And that would be fine if practical things were not ignored. But they are.

17:51 Raynes: I didn't know things were in *that* bad a state of affairs.

17:52 brehaut: antares_: you know whats really going to encourage people to write boring code and docs? crapping on the efforts of those people who have already done so

17:52 dnolen: antares_: If we wanted to boring work we'd probably be writing in something else.

17:52 scriptor: clojurebot: bring up the badness state of clojure charts, please

17:52 clojurebot: clojure is making your sexp smile

17:52 Raynes: Yeah, I'm really offended by this whole debacle.

17:53 I'm pretty close with these people that are currently being shat on. I've never seen them 'shit rainbows', but I have seem them work hard.

17:54 scriptor: nobody is saying they're not working hard

17:54 Raynes: Sure, on useless esoteric shitting rainbows kinda stuff.

17:54 ToBeReplaced: are there particular libraries that are missing more extensive documentation? i might be willing to donate some time, since i'll probably need to learn the in and outs anyway

17:54 scriptor: working hard on esoteric stuff is still working hard

17:55 a todo list for various lib doc efforts would be kind of useful

17:55 antares_: I did not say that someone does or does not work hard

17:55 only that values of this community put esoteric stuff waaaay higher than documentation, backwards compatibility and ease of use for beginners

17:56 that's very problematic in my view, in the long run

17:56 you can't shit rainbows all the time. Sometimes you have to do boring, thankless work.

17:56 Raynes: Man.

17:56 antares_: otherwise beginners will never feel good when adopting your technology

17:57 no matter how many shiny toys there are

17:57 or great ideas

17:57 so the question is: do people in this community want it to grow?

17:57 Raynes: Let me know when you get your statue erected.

17:57 antares_: to repeat myself: I am sometimes convinced that they don't

17:57 dnolen: antares_: it will grow with or without. and it's nicer to just watch you do your thing and not hear you complain about it.

17:58 antares_: which isn't to say complaining is bad - but you're singing the same song over and over again.

17:58 antares_: dnolen: yeah, the question is, would it be a tiny community of mostly hobbyists/dreamers or a sustainable community of people building real things

17:59 *will

17:59 brehaut: who says hobbiest and dreamers cant have a sustainable community‽

17:59 dnolen: antares_: I'd say it's already sustainable and growing at a healthy pace. seems like people really appreciate your contributions. at least as much as all this esoteric shit you keep talking about.

17:59 Raynes: I don't know, I'm 18 and hack Clojure for a living. I think we're doing pretty good on the building real things part.

18:00 antares_: dnolen: note that not many people complain about the docs, about poorly maintained libs, etc. How will things ever improve without such criticism?

18:00 brehaut: antares_: by actually doing something about it? other than talking?

18:00 Raynes: Maybe people don't complain because there is less of a problem than you seem to think there is?

18:00 scriptor: growing doesn't have to be binary, you might still have otherwise very good programmer Joe or good company Acme going for Scala or whatever because it's easier to pick up

18:00 and at least *seems* more well-documented

18:00 antares_: Raynes: what % of Clojure/Conj attendies hack clojure for a living? compared to a Ruby, Python or Java conferences?

18:01 Raynes: I don't know, you seem to be pretty good at this stat thing.

18:01 ToBeReplaced: antares_: example libs that need better docs? i'll spend some time and bring the thunder

18:01 Raynes: You probably know more than I.

18:02 dnolen: antares_: comparing success against languages that are 15-20 years old ... seems unrealistic

18:02 scriptor: Raynes: to be fair, I don't think there might be many other 18 year olds working on clojure for a living

18:02 antares_: ToBeReplaced: Compojure, Noir and Ring are some very important projects that need better docs

18:02 scriptor: dnolen has a point, what were docs for python like in the mid 90s?

18:02 antares_: dnolen: of course, if you don't cut yourself some slack, who will

18:02 Raynes: He will likely mention node.js now.

18:03 pisketti_: antares_: Good job on clojure werkz. Hadn't heard about it before.

18:03 ToBeReplaced: Raynes: One notable point though is that even if you don't perceive a problem, the fact that someone thinks there is one suggests that there is... it means that there are at least some people who are turned off by documentation... whether or not that matters at this point in language development is another issue

18:03 amalloy: ring's documentation is a shining beacon of light

18:04 antares_: dnolen: I feel like the Clojure community at 5 years needs to stop making excuses like that

18:04 Raynes: I'm not arguing that there isn't a problem, of course, it's just that he dug his own hole with the last one so I hopped in.

18:05 * emezeske just got back from getting coffee and sees that the argument is still rolling.

18:05 antares_: just like it is a bit late to make excuses about "we are growing, our contrib process will change"

18:05 scriptor: emezeske: of course, until it is resolved entirely amicably with tangible progress, as all irc debates tend to

18:06 antares_: Raynes: if you don't like node.js, coffeescript or any other shiny young tech, take a look at Go. Way better docs than Clojure.

18:06 Raynes: ~3 years old

18:06 ToBeReplaced: antares_: i can't speak for Noir, and i'll agree that there are probably some areas where compojure could use some more detail, but I found ring pretty excellent; are there particular problem areas?

18:06 Raynes: emezeske: I don't think anyone besides antares_ is arguing. I'm mostly making fun of his arrogance.

18:06 scriptor: antares_: also corporate support

18:06 wingy: This line in my source code gives Invalid metho Code length error: https://www.refheap.com/paste/6112

18:06 Raynes: Which I should stop doing and go get real work done.

18:07 antares_: ToBeReplaced: Ring may be in good shape now, I haven't read its docs for a year or so. Compojure is what I hear questions about the most.

18:07 ToBeReplaced: antares_: i actually found that once i stopped looking at noir, it all made sense >> the extra level of abstraction was too complicated for me, and it all worked once i went from ground up with ring

18:07 wingy: related to https://groups.google.com/forum/?fromgroups#!topic/clojure/ZL_1t3Rm8I4 .. is there anything i can do to make clojure parse it?

18:07 emezeske: scriptor: :P

18:08 Raynes: I like a good argument, in the "discussing opposing views" sense of the word

18:08 ToBeReplaced: antares_: i remember having some trouble when first looking at compojure because googled answers were not helpful >> compojure went from being a web framework to just a routing DSL >> i'm not sure how to fix that though?

18:08 emezeske: Raynes: Somehow it's also come to mean "just yelling at one another" though

18:10 antares_: ToBeReplaced: it is trivial to get a basic example working, what is hard is finding an example of something less obvious, like accessing a rarely used piece of request info

18:10 brehaut: antares_: that seems like quite a contrived complaint?

18:10 antares_: ToBeReplaced: some examples are just not there, that's all I am saying

18:10 brehaut: what specifically?

18:11 brehaut: antares_: compojure is a thin layer on ring. its all just ring handlers, so its trivial to get any request data

18:11 and its always the same

18:11 antares_: brehaut: if you are about my Compojure docs comments, good docs cover all common and some uncommon use cases

18:11 brehaut: it does not matter, beginners need examples, period

18:11 brehaut: for experienced users, Compojure probably has just enough docs

18:12 but so is Clojure, if you are a long time user or programming languages aficionado

18:12 dnolen: antares_: what's I'm confused about it what isn't working for you. You made a docs site, people contribute, what's the problem?

18:12 antares_: the rest of the world does not find that sufficient or well presented (organized, explained, written in plain language)

18:13 dnolen: that problems such as docs or caring about backwards compatibility are such a low priority

18:13 dnolen: or rather, "not sexy", priority is the wrong word

18:13 dnolen: or maybe even "not respected"

18:13 Python community cares a great deal more about the docs

18:14 brehaut: and yet you keep refering to projects that respect backwards compat and have docs

18:14 antares_: and less about highly experimental things

18:14 ToBeReplaced: any thoughts on how to fix issues with outdated info? for example, at the end of the day in emacs, the only installations i needed were nrepl.el and clojure-mode... yet any google search and you'll find 50 things about swank-clojure, SLIME, etc... even on dev.clojure.org

18:14 antares_: brehaut: like Ring and Compojure?

18:14 brehaut: yes

18:14 antares_: brehaut: that's like 2 out of fucking 5000, dude

18:14 brehaut: you picked the examples, not me

18:14 antares_: brehaut: I did not, ToBeReplaced asked about some projects to look into

18:15 brehaut: if you think that overall Clojure projects care about docs and compatibility, go ask a Ruby developer with basic Clojure skills to glue together 4-5 randomly chosen libs from github

18:15 scriptor: ToBeReplaced: a big reason why technomancy is crusading against not writing another 'how to get started with clojure' blog post

18:16 antares_: it will be great luck if 3 of them even have installation instructions people can understand

18:16 nDuff: antares_: *snerk*. You suggest that a _Ruby_ developer should be the person to have sane expectations re: compatibility?

18:16 antares_: nDuff: I am talking about documentation right now

18:17 nDuff: for compatibility benchmark, Java is definitely a better community to compare against

18:17 ToBeReplaced: scriptor: yeah; blog posts are the wrong medium for a problem space that is rapidly evolving

18:17 * nDuff concurs.

18:17 antares_: nDuff: Clojure libraries documentation as seen by beginners (e.g. Ruby developers)

18:17 brehaut: in what planet is it a good idea for a new user to 'glue together' 'random' projects from git hub‽

18:18 antares_: brehaut: that will be just an experiment. Have you not seen people seriously confused by how to use a library because that library's README is useless?

18:18 gfredericks: brehaut: that's all programming is 98% of the time

18:18 scriptor: a beginner who wants to start a project that requires those libraries

18:18 antares_: like, completely useless, no even clear installation/dependency instructions?

18:18 wingy: running this line in the repl works fine: https://www.refheap.com/paste/6113 .. but in a file that is run it will give me error: Invalid method Code length 117308

18:18 ToBeReplaced: brehaut: uh oh... that's what i'm doing...

18:18 scriptor: by 'random' I think antares_ just meant any plain old clojure libs

18:18 wingy: if anyone knows what the problem is please shout

18:19 brehaut: ToBeReplaced: you chose libraries at random‽

18:19 ToBeReplaced: wingy: that's way too long of a line to make sense of :)

18:19 antares_: wingy: JVM methods have max lengh (in bytes)

18:19 ToBeReplaced: brehaut: maybe not random :)

18:19 wingy: ToBeReplaced: i'll have it formatted properly in my test

18:19 scriptor: brehaut: random in the "pick any library that a dev might need" not statistically random

18:19 antares_: wingy: literals are compiled down to sequential map updates, I guess

18:20 brehaut: dude you are way too focused on "random"

18:20 wingy: antares_: but i can run it on the repl

18:20 scriptor: antares_ is using the colloquial definition

18:20 wingy: guess the repl is not putting my code in a method

18:20 nDuff: Since when did Clojure libraries need installation instructions? Either it's in Clojars, or it's in Maven Central, or it isn't ready for use.

18:20 antares_: brehaut: go ask an experienced developer who is a Clojure n00b to use an average Clojure library

18:20 brehaut: that's very hard for them, there are usually no clear guidelines even for how to add a dependency

18:21 brehaut: wait

18:21 so every library now has to provide basics on how to use the languages infrastructure?

18:21 and the language?

18:21 antares_: brehaut: if you haven't seen that, I suggest that you hang out around here more.

18:21 brehaut: and all the dependancies?

18:21 antares_: brehaut: wow, you are more obtuse than I thought

18:21 brehaut: no im not

18:21 antares_: brehaut: not the language. Just how to get started with a damn thing.

18:21 brehaut: i dont expect every library to provide a whole cloth introduction to the language

18:22 antares_: brehaut: who said anything about introduction to the language?

18:22 ah, fuck it

18:22 brehaut: you are implying it

18:22 antares_: time to write some more clojure-doc.org

18:22 brehaut: I am not implying anything, maybe drink a coffee or two

18:22 brehaut: "no clear guidelines even for how to add a dependency"

18:23 wingy: antares_: http://www.coderanch.com/t/482213/java/java/fix-java-method-size-limit no way to fix this :(

18:23 brehaut: thats a language / infrastructure level concern

18:23 antares_: brehaut: yes, newbs sometimes need hand holding to even add a library as a dependency

18:23 brehaut: huh??

18:23 lazybot: antares_: What are you, crazy? Of course not!

18:23 wingy: but that is silly in clj .. how can i work with large maps then?

18:23 antares_: wingy: it's a JVM limitation

18:24 wingy: the issue is not a large map but a large map *literal*

18:24 wingy: antares_: but it gets read in the repl

18:24 antares_: wingy: or functions with a very large number of locals

18:24 wingy: antares_: what exactly is a literal?

18:24 antares_: wingy: {…}

18:24 it is surprising that it works in the REPL

18:26 wingy: antares_: is there a work around so i can read my map in?

18:26 antares_: I've only hit this limit with a test that had a crazy number of locals

18:26 I've split it into several tests

18:27 wingy: but my map is pretty big .. how can i read it in

18:27 antares_: map literals can be split and merged, too

18:28 wingy: you suggest me using (merge) ?

18:29 antares_: brehaut: re: hobbyists and dreamers can be a sustainable community only in theory

18:29 wingy: yes, try it

18:36 wingy: the weird thing is that the repl works

18:36 perhaps that is because its not putting anything in a method

18:41 murphy607: hi

19:12 duck1123: What are people using for producing simple graphs and stats about their apps? I'm thinking about using something like statsd, but I'm wondering if there is a better clojure option. Something + Incanter, perhaps?

19:14 SegFaultAX: duck1123: Riemann is a thing.

19:14 hiredman: incanter's wrapper around jfree chart is kind of "meh"

19:14 using jfreechart directly is not too bad

19:16 duck1123: I'm open to anything except for MicroStrategy (my day job / personal hell)

19:16 technomancy: dec on incanter's jfreechart wrapper

19:19 hiredman: https://gist.github.com/3949532 is what using jfreechart directly looks like for timeseries data

19:20 duck1123: That doesn't seem too bad. I currently don't have any real stats logging in this, but I decided I wanted a simple graph of posts per hour

19:20 I might play with Riemann

19:20 emezeske: duck1123: Is there something you don't like about statsd?

19:21 SegFaultAX: Or is it just that it isn't written in Clojure?

19:21 hiredman: riemann and jfreechart are different things, jfreechart is just about creating charts, riemann is metrics gathering and charting I believe

19:21 duck1123: emezeske: I've only played with it a little bit and I liked it, I was just wondering if there was a better option

19:21 hiredman: actually it looks like riemann doesn't do charting, it just forwards data to grpahite

19:22 emezeske: duck1123: statsd/graphite are really quite nice

19:22 duck1123: right, I need both pieces

19:22 SegFaultAX: duck1123: There are lots of different options. Statsd is pretty standard. fnordmetric is also interesting.

19:22 wingy: how can i compare where 2 strings differ?

19:23 SegFaultAX: wingy: Diff?

19:23 wingy: SegFaultAX: yeah

19:23 duck1123: ok, no reason not to use statsd. Is there a good clojure wrapper, or am I going to have to write it?

19:23 emezeske: duck1123: There's a statsd wrapper for every language ever :P

19:23 duck1123: I played with the java api for a second

19:23 emezeske: duck1123: https://github.com/pyr/clj-statsd

19:24 SegFaultAX: There's also an implementation of statsd itself in Clojure.

19:24 Dunno if it's any good.

19:24 * emezeske could never figure out why everybody and their brother had to reimplement statsd in their language of choice.

19:24 duck1123: excelent, then I'll just work on getting graphite up and running

19:25 SegFaultAX: emezeske: Js hate, if I had to guess.

19:25 hiredman: what is there not to hate

19:25 SegFaultAX: hiredman: About statsd or about javascript?

19:26 hiredman: javascript and node.js

19:26 emezeske: I'm not a JS or node.js fan, but I _am_ a fan of code that is already written/tested :)

19:26 SegFaultAX: hiredman: Nothing. In my opinion, javascript is a shitty language and a ridiculous choice for server-side development.

19:27 emezeske: Statsd isn't terribly complicated. Re-implementing it is not that difficult.

19:28 emezeske: SegFaultAX: My point is that the original version is already implemented, and tested by lots and lots of people

19:28 SegFaultAX: Any small amount of implementation is more than zero

19:28 duck1123: perhaps for a proof of concept

19:28 SegFaultAX: emezeske: A fair point. My second argument for why people re-implemented it is they don't want to introduce node.js in their stack.

19:28 hiredman: "this python service cannot handle all these connections, let's write a service in js to put in front of it"

19:28 SegFaultAX: emezeske: Which is completely reasonable.

19:29 emezeske: SegFaultAX: Yeah.

19:30 hiredman: Surprisingly, statsd performs like a champ. But yeah, why the hell didn't they just patch graphite?

19:30 SegFaultAX: Graphite isn't the only backend for statsd

19:30 Statsd is just an aggregator.

19:31 duck1123: I'll probably end up writing my own consumer for the statsd data

19:31 emezeske: SegFaultAX: Well, statsd originally scratched the graphite itch at etsy, right?

19:31 Aaaaanyway...

19:31 It's not worth discussing... We've already typed more lines of chat than statsd has lines of code :P

19:32 SegFaultAX: emezeske: It scratched the "make analytics easier to deploy" itch. Dunno if they wanted graphite specifically or if that was just the best option at the time and so became the default backend.

19:33 wingy: i really can't figure out why these 2 lines aren't identical https://www.refheap.com/paste/6117

19:35 AdmiralBumbleBee: us_name us_login….

19:35 compared to us_name,us_login...

19:35 it's a string

19:35 wingy: ah

19:35 SegFaultAX: AdmiralBumbleBee beat me to it.

19:38 wingy: AdmiralBumbleBee: how did you check?

19:38 AdmiralBumbleBee: I used my eyes

19:38 it was immediately obvious to me

19:38 * AdmiralBumbleBee shrug

19:38 wingy: seriously

19:39 AdmiralBumbleBee: you're talking to someone who spends half the day debugging handwritten assembly

19:39 emezeske: wingy: You could always paste into two files and use a diff tool

19:39 wingy: emezeske: i did i thought diff was checking line by line and those were single lines

19:40 SegFaultAX: Byte-wise diff is supported by many diff tools.

19:41 emezeske: wingy: vimdiff highlights differences on the same line in color, I assume other diff tools can do the same (tkdiff, meld, etc)

19:46 wingy: emezeske: vimdiff was a great tool .. now they are identical

19:46 are you using vim and not emacs?

19:47 emezeske: wingy: Yep.

20:16 thorbjornDX: can I use defmethod inside of a macro?

20:17 hiredman: I'm not going to stop you

20:17 thorbjornDX: hiredman: ok :)

20:18 hiredman: I'll rephrase. Are there any gotchas to using def/defmulti/defmethod within a macro? I haven't used them as of yet.

20:19 hiredman: it depends on what you mean by "using"

20:21 thorbjornDX: hiredman: I'd like to make a macro that takes a multimethod symbol, and some vector or map. The macro should create multimethods using the keys/vals I pass in. Let me whip up a paste

20:23 hiredman: thorbjornDX: by "create multimethods" you mean "return a datastructure that creates multimethods when evaluated" ?

20:24 thorbjornDX: hiredman: yes, I believe so. Here is the code that I'd like to generate in a macro: http://pastebin.com/2xwNwwWp

20:25 hiredman: go ahead

20:33 gfredericks: thorbjornDX: did you need any more help with that macro? there's no conceptual reason it can't be done.

20:40 frawr: Hi, is there an easy way to sum a list of lists? ((1 2 3) (5 7 9)) to (6 9 12)

20:40 gfredericks: map +

20:40 ,(map + [1 2 3] [5 7 9])

20:40 clojurebot: (6 9 12)

20:41 gfredericks: ,(apply map + [[1 2 3] [5 7 9]])

20:41 clojurebot: (6 9 12)

20:41 gfredericks: either way depending on if you have separate references to them or not

20:42 frawr: (apply map + (70 60 59 255) (69 55 54 255) (66 48 46 255) (70 56 56 255) (67 53 52 255) (65 47 45 255) (68 52 53 255) (66 50 50 255) (65 47 47 255))

20:42 erh

20:42 (apply map + (70 60 59 255) (69 55 54 255) (66 48 46 255) (70 56 56 255) (67 53 52 255) (65 47 45 255) (68 52 53 255) (66 50 50 255) (65 47 47 255))

20:42 thorbjornDX: gfredericks: I would appreciate some help. http://pastebin.com/9tn2GHjQ is what I have so far. macros + syntax quote + quote aren't quite second nature to me yet, hence the println

20:43 gfredericks: thorbjornDX: don't you want the name of the function as a parameter too?

20:44 thorbjornDX: are you looking for help with writing macros or just trying to get this done?

20:44 frawr: Ah, I need to convert them to vectors first

20:44 gfredericks: frawr: no you don't

20:44 thorbjornDX: gfredericks: I'd prefer a grasp of the basics first

20:44 gfredericks: frawr: you can enter vectors in the code to avoid quoting the lists, but you definitely don't need to convert to vectors at runtime

20:44 thorbjornDX: gfredericks: ah, yes. The function name should be a second arg (in my case it's just a keyword)

20:45 frawr: Ooh, I see the problem, I copied the dataset, and then used the list as functioncalls

20:45 gfredericks: thorbjornDX: you're saying it's the same as propname?

20:45 frawr: yep; common confusion

20:45 frawr: thnx

20:46 gfredericks: thorbjornDX: one handy macro tip is that you can play with backquote outside of a macro definition

20:46 thorbjornDX: gfredericks: oh, sorry. (defprop foo multifnaccessor mapofkvsfordefmethod)

20:46 gfredericks: ,(let [fn-name 'tompkins] `(do (defmulti ~fn-name [a b c] (+ 1 2 3))))

20:46 clojurebot: (do (clojure.core/defmulti tompkins [sandbox/a sandbox/b sandbox/c] (clojure.core/+ 1 2 3)))

20:47 gfredericks: so you can mess around with backquote until you can figure out how to generate the code you want, and then just stick that in the macro body

20:47 thorbjornDX: gfredericks: awesome, thanks for the tip

20:47 frawr: works, thnx!

20:50 gfredericks: thorbjornDX: you can also play with passing the output of backquote to eval to verify that it works

20:51 thorbjornDX: gfredericks: ok. Another question, do I have to quote symbols that I pass in to a macro? Or will the macro suppress evaluation

20:51 gfredericks: symbols such as your function name?

20:51 thorbjornDX: correct

20:52 gfredericks: ,(let [fn-name 'foo] `(def ~foo [] nil))

20:52 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

20:52 gfredericks: bag

20:52 &(let [fn-name 'foo] `(def ~foo [] nil))

20:52 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

20:52 gfredericks: geez

20:52 &(let [fn-name 'foo] `(don't-def ~foo [] nil))

20:52 lazybot: java.lang.RuntimeException: Unable to resolve symbol: foo in this context

20:52 gfredericks: oh right

20:52 &(let [fn-name 'foo] `(don't-def ~fn-name [] nil))

20:52 lazybot: ⇒ (clojure.core/don't-def foo [] nil)

20:52 gfredericks: phew

20:53 okay so I found it difficult to consider how to verbally eanswer you, so I hope the demo helped?

20:53 thorbjornDX: I believe so.

20:53 gfredericks: you have the symbol at macro-runtime, so it's a piece of data

20:54 you're just inserting it into the code-data-structure

20:54 thorbjornDX: ~ just puts in namespace qualification?

20:54 clojurebot: underscores in namespaces is a bad idea

20:54 gfredericks: no

20:54 ~ unquotes

20:54 clojurebot: Gabh mo leithscéal?

20:54 gfredericks: clojurebot: botsmack

20:54 clojurebot: botsmack is headdesk

20:54 thorbjornDX: ah, I see

20:54 gfredericks: thorbjornDX: notice that the foo symbol went through without qualification

20:54 everything else got qualified

20:54 ,`qualify-this

20:54 clojurebot: sandbox/qualify-this

20:55 unnali: ,`~'not-this-thanks

20:55 clojurebot: not-this-thanks

20:55 duck1123: thorbjornDX: I have a few macros here that define multimethods https://github.com/duck1123/ciste/blob/master/src/ciste/sections.clj

20:55 if that helps

20:55 thorbjornDX: duck1123: it will, thank you

20:56 duck1123: is the [name# name] thing a convention?

20:56 gfredericks: no

20:56 ,`foo#

20:56 clojurebot: foo__103__auto__

20:56 duck1123: also https://github.com/duck1123/ciste/blob/master/src/ciste/filters.clj

20:56 thorbjornDX: gfredericks: ah, okay.

20:56 duck1123: I did that only so I wouldn't eval it more than once

20:57 gfredericks: when you introduce locals inside a backquote, suffixing # will 1) prevent qualification and 2) add gensym bits so that you don't worry about shadowing other locals

20:57 it also makes sure that multiple references to foo# in the same backquote expand to the same thing

20:57 so you'll need that when you do function args for your multimethod

20:58 ,`(fn [a# b#] (+ a# (inc b#)))

20:58 clojurebot: (clojure.core/fn [a__130__auto__ b__131__auto__] (clojure.core/+ a__130__auto__ (clojure.core/inc b__131__auto__)))

20:58 thorbjornDX: okay. I can imagine some code where this could come up, but I don't think I'm quite up to writing it yet :)

20:59 amalloy: duck1123: the use of # at https://github.com/duck1123/ciste/blob/master/src/ciste/sections.clj#L65 is nonsense, don't encourage anyone to use it

20:59 thorbjornDX: gfredericks: duck1123: thanks for your help. I have to turn off my brain for the night.

21:00 gfredericks: thorbjornDX: oh sorry I didn't actually look at duck1123's code; amalloy is right

21:00 duck1123: I was wondering if that was overkill

21:00 gfredericks: I mean I stand by everything I said but what he's doing is different

21:00 amalloy: duck1123: it's not overkill, it's just pointless. name# has no special significance outside of a syntax-quote; you're just creating a new variable called name#

21:01 foo# outside a syntax-quote is almost always a mistake. (one that won't hurt anything except confuse readers)

21:01 duck1123: now that I'm looking at it, I see your point

21:01 I wrote this some time ago

21:02 Khaoz: i'm reading the Clojure Programmin book and through pages 72-75 it's presented more concepts about hof

21:02 but i cant get the point on returning functions from functions instead of defining functions and then using partial

21:03 gfredericks: Khaoz: you can't get the point like you don't know why it would ever be useful?

21:03 Khaoz: yep

21:03 at last in that example

21:03 gfredericks: it might be a bad example

21:04 not everything is easily done with partial

21:04 Khaoz: i dont think that is a bad example, just a simple one

21:04 * gfredericks doesn't have the book

21:04 akhudek: ring and enlive are both good examples of this

21:04 ring might be the easiest though

21:05 Khaoz: i will go forward some pages to get more into the clojure concepts

21:05 then i will take a look at the ring code

21:06 akhudek: look at the ring middleware in particular

21:06 * Khaoz take notes

21:18 hyPiRion: Khaoz: One interesting example would, for instance, be some sort of rule compiler.

21:19 You have a lot of rules, and send it to some sort of "compiler function". You get a function back, and can use that one for, well, rule stuff.

21:20 Khaoz: i will try to translate the examples on book to "normal" functions to see what kind of difficult i will have

22:19 john2x: hi. i'm getting something weird in my repl.. Integer/parseInt returns "Unable to find static field", but I can autocomplete it when hitting TAB. (using lein2)

22:19 not just parseInt, all static methods

22:19 Raynes: john2x: If you're not calling it, it is looking it up as a static field and not a method.

22:19 &Integer/parseInt

22:19 lazybot: java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer

22:19 Raynes: &(Integer/parseInt "1")

22:19 lazybot: ⇒ 1

22:20 Raynes: Java methods aren't first class.

22:20 john2x: ohh ok. thanks!

22:21 so I can't use them in map?

22:21 unnali: john2x: not directly, but you can use ##(map #(Integer/parseInt %) ["1" "2" "3"]) I guess?

22:21 lazybot: ⇒ (1 2 3)

22:22 john2x: ah yes, that'll do. thanks guys

22:23 Sgeo: ,(Integer/parseInt "not a number")

22:23 clojurebot: #<NumberFormatException java.lang.NumberFormatException: For input string: "not a number">

22:24 Raynes: &(Long. "1")

22:24 lazybot: ⇒ 1

22:24 Raynes: john2x: ^ Also works.

22:24 Just for kicks.

22:29 jcromartie: is there a good way to reload a namespace and change the dispatch fn of a multimethod?

22:29 looks like it "sticks"

22:35 cmajor7: what is the way to catch the "click/mousedown" event on TD in clojurescript?

22:35 *using jquery

22:35 unnali: on TD?

22:35 cmajor7: table cell

22:36 unnali: oh, <td>

22:36 cmajor7: yea

22:36 unnali: the same as for regular jQuery I'd imagine?

22:36 cmajor7: can't seem to get clojurescript syntax for it..

22:36 to work

22:36 unnali: what have you tried?

22:38 cmajor7: (jq/on (js/jQuery "X") :click (fn [e] ….), where tried for X: "td", "#table-id tr td", ".td-class", "#table-id>tr>td", etc...

22:38 *jq is js/jQuery

22:38 sorry: jq is "jayq.core"

22:39 unnali: uh...

22:39 lemme look up on jayq

22:40 cmajor7: well. I tried (.on …) from jquery itself as well

22:40 unnali: that looks like it should be okay.

22:40 so should that, since that's all jayq.core/on does!: https://github.com/ibdknox/jayq/blob/master/src/jayq/core.cljs#L221

22:40 have you tried inspecting the compiled JS?

22:40 cmajor7: no, good idea.. let me pull it up

22:42 unnali: all the examples I see online don't have any direct invocation of "on", not sure what's the deal

22:43 brehaut: most of the standard jquery event handler methods (click, mousedown etc) are just shortcuts for one of on("click"… ) or bind("click"…) etc

22:46 unnali: brehaut: I mean jayq.core/on, I should be clear.

22:47 brehaut: i have no idea about jayq

22:47 cmajor7: jayq.core.on.call(null,jQuery("#table-class tr td"),"\uFDD0'mousedown",(function (e){…}

22:48 if I put another element. e.g. some div instead of "#table-class tr td", it does work

22:48 the problem seems to be <td> itself..

22:48 unnali: that \uFDD0' is a bit odd…

22:48 cmajor7: *to get to it, so it reacts to click/mousedown

22:48 it is ":mousedown"

22:49 it does work for e.g. "<div>"

22:49 unnali: are you sure that's a normal :? anyway, I'm not sure why it wouldn't work, that's a jQuery/DOM thing then.

22:50 cmajor7: let's say it is, then how to get a particular <td> to "click"?

22:51 unnali: no idea, some jQ/DOM intricacy I guess as to why it wouldn't click in the first place.

22:51 I'd suggest messing around with jsfiddle or so

22:52 it works for me?

22:52 http://jsfiddle.net/A3thz/

22:52 13:41 < cmajor7> | jayq.core.on.call(null,jQuery("#table-class tr td"),"\uFDD0'mousedown",(function (e){…}

22:52 #table-class ?

22:52 shouldn't that be .table-class?

23:14 jcromartie: Playing with mutlimethod-based state machines with a simple "update" and "render" separation: https://gist.github.com/4ba56804cee48fc0e709

23:52 ambrosebs: I've just submitted my honours dissertation for marking "A Practical Optional Type System for Clojure" (corrections welcome) https://github.com/downloads/frenchy64/papers/paper.pdf

23:55 tomoj: how do you get a NullPointerException with an empty stack trace?

23:55 I should've googled first

Logging service provided by n01se.net