#clojure log - Jul 26 2012

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

0:06 amalloy: gert: no. deftype just defines a java type, which has no slot to store docs on

0:07 gert: thanks amalloy. I wanted to use it to document the particulars of my implementation of a ring SessionStore, but I guess namespace docs and good old comments will do.

0:08 amalloy: out of curiosity, gert, what kind of seesionstore are you implementing?

0:10 gert: one that looks at the session id from the cookie, and checks to see if it looks valid. Also, one that regenerates the session id after (for example) n number of requests, after a certain time, etc.

0:10 to mitigate attacks that tamper with the session id, and to prevent session fixation for example

0:11 and we're storing our session map in a database

3:24 wingy: (Item/query) and (.query Item) is the same in cljs?

3:35 amalloy: no

3:35 xumingmingv: ,(defn testit [asym] (var asym))

3:35 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

3:36 xumingmingv: what's wrong with this function definition?

3:36 repl tells me that asym cannt be resolved

3:37 kral: namaste

3:41 emezeske_: xumingmingv: There's nothing wrong with your function definition; you're calling it with an argument that is not a var

3:42 xumingmingv: the function defimition can not pass compilation

3:43 emezeske_: Oh! var is a special form apparently

3:43 xumingmingv: yeah, var is a special form

3:43 then?

3:43 emezeske_: Well anyway, asym is not a var

3:43 xumingmingv: so i can not write a function like this?

3:44 emezeske_: What are you trying to do?

4:04 meenal: Hi

4:07 I would like to know if clojure-contrib is a right choice for handling exceptions in clojure.contrib.condition

4:07 AWizzArd: Clojure Contrib is no more.

4:08 meenal: ok. for exception handling, clojure provides a condition library

4:09 should i go for it or just create class that extends java's Exception

4:10 AWizzArd: As you wish, but I personally would typically try to avoid subclassing, if there is an easier way to do it in Clojure.

4:11 meenal: If I use this clojure library and produce a jar of my project, will it cause concerns for java interop (when i have to include this small jar module in other java projects)?

4:11 amalloy: $google clojure slingshot exception

4:11 lazybot: [scgilardi/slingshot · GitHub] https://github.com/scgilardi/slingshot

4:12 amalloy: ^ lets you throw maps and catch exceptions based on data contained in the map

4:14 AWizzArd: amalloy: yes good, that was the thing I wanted to name

4:14 meenal: ok. thank u. I will have a look at slingshot

5:06 tzar: How would I write in a functional manner a function which checks several conditions, and for each condition, if that condition is true a value/transformation is added to a list which is returned at the end?

5:07 I'm thinking, list of functions which return transformation or nil, map over that list, then remove nils

5:17 got to run, will go with that approach for now

5:18 clgv: tzar: use keep isntead of map

5:32 xumingmingv: anyone have a look at this: http://stackoverflow.com/questions/11666364/clojure-compile-issue

5:36 cemerick: xumingmingv: answered

5:38 xumingmingv: actually what i want to return IS (var asym)

5:38 what i really want to do is get the type hint of a function's param dynamically

5:39 so here asym will be a function

5:39 if i want to get the metadata of a function

5:39 i need to use: (meta (var asym))

5:40 cemerick: oh, I see, asym is a symbol that names a var?

5:41 If so, use `resolve`: ##(meta (resolve '+))

5:41 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

5:41 cemerick: meh

5:41 ,(meta (resolve '+))

5:41 clojurebot: {:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 920, :arglists ([] [x] [x y] [x y & more]), ...}

5:41 cemerick: xumingmingv: ^^

5:42 xumingmingv: haha...resolve is bad...

5:42 lazybot is more tough than clojurebot? :)

5:43 cemerick: yeah, just different sandbox rules.

6:01 iDesperadO: I have a cross-out fn like (defn (cross-out [p coll] (filter #(not (zero? (rem % p))) coll)), and I want to cross out from a vector every number starting at 2. that's, I got a vector of numbers, say V = (range 1 1000), and I have a number p = 2 and I want to cross out every number that's composite with p. then let p = 3, repeat the previous step...

6:02 how can i do that?

6:05 zoldar: iDesperadO: so that's basically Eratosthenes Sieve?

6:05 iDesperadO: zoldar: yes

6:05 zoldar: I'm implementing it

6:06 zoldar: find I'm kinda lost in loop/recur

6:07 zoldar: iDesperadO: I would try to work something out with iterate given fn and (range 1 n). I suppose there's no need to go down to loop/recur

6:08 iDesperadO: zoldar: what i think is I have to filter the V many times...

6:08 zoldar: iDesperadO: that's what iterate is suitable for

6:08 ,(doc iterate)

6:08 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

6:09 iDesperadO: ha...exactly

6:10 let me try it

6:11 seaword: I'm playing round in the repl and can access the value of an item in a hash by either: (:key hash) or (hash :key). Is one way preferred over the other?

6:13 iDesperadO: seaword: I'm afraid the first one is prefered, since a hash's key is itself a function...:)

6:14 clgv: seaword: for keywords use (:key m) for data use (m data). explicitely using get is possible as well (get m data)

6:14 zoldar: iDesperadO: that's rather because keyword implements IFn

6:15 seaword: Ok great, thanks guys. That clarifys it very nicely.

6:20 iDesperadO: zoldar: I'm afraid I still have to use loop/recur

6:21 (iterate (partial cross-out p) V) ... I have to change p every iteration

6:21 clgv: iDesperadO: maybe you can use reduce then

6:22 iDesperadO: ok, let me see

6:22 clgv: but that only makes sense if you got some input.

6:22 doess crossout change p?

6:23 iDesperadO: clgv: reduce is an accumulator

6:23 clgv: yeah, you could reduce over the p-collection

6:23 but only if it is changed outside

6:24 iDesperadO: (defn cross-out [p coll] (filter (= 0 #(rem % p) coll)))

6:24 clgv: ah prime-sieve?

6:24 iDesperadO: yeah

6:24 I just want to filter V with my cross-out fn

6:25 but here I have to change p every time

6:25 clgv: do you want to do it on your own? otherwise there are already some clojure examples how to do that

6:26 iDesperadO: I want to do it my own

6:26 now I just want to know how to change p every time when I apply filter cross-out on some Vector(e.g. (range 2 n))

6:27 clgv: iDesperadO: I would indeed use recursion instead of iterate there

6:28 iDesperadO: so...just go back to the first...I said I'm lost in loop/recur

6:28 :)

6:29 clgv: because lazy is no advantage for that task and you now exactly when you are finished (recursion base case)

6:30 iDesperadO: I just don't know how to use recursion(loop/recur) here

6:31 clgv: I don't know how to stop

6:32 (loop [p 2 coll (range 2 1000)] (if ...?

6:32 clgv: iDesperadO: you can call cross-out recursively. (defn cross-out [p, numbers, primes] ...)

6:33 you filter through numbers. the first element in numbers is your next prime. if numbers is empty you are done

6:33 you have to add the next prime to primes.

6:34 davidykay: hey folks, noob question here: I'm writing a web app and dealing with a funny situation where my params map can either have keys of keywords or strings (:_id vs "_id"). is there an easy fix? I can't query the map consistently because of the discrepancy. thanks!

6:34 zoldar: That's my failed attempt: (loop [[f & r] (range 2 1000)] (let [sieved (remove #(zero? (mod % f)) r)] (if (= sieved r) sieved (recur r))))

6:35 ahhh

6:35 davidykay: oh ho, "keyword" function. I'll try that

6:36 clgv: iDesperadO: got it? detailed explanation would be the fn implementation ;)

6:36 ro_st: anyone using airbrake?

6:38 iDesperadO: clgv: ....sorry no

6:39 clgv: still don't get it

6:39 clgv: iDesperadO: you have to separate identified primes and numbers that remain to be filtered. if no numbers remain to be filtered you are done

6:41 iDesperadO: so in your (cross-out numbers primes) for numbers it's (range 2 n), and primes is primes identified and added to it?

6:41 and when numbers is empty, we got primes as the result?

6:43 This is just an expression of the algorithm. I just don't know how to filter numbers repeatedly with different parameter

6:44 zoldar: so... you got it?

6:45 zoldar: ,(loop [primes [] [f & r] ((comp rest rest) (range))] (let [sieved (remove #(zero? (mod % f)) r)] (if (= (count primes) 10) primes (recur (conj primes f) sieved))))

6:45 clojurebot: [2 3 5 7 11 ...]

6:45 zoldar: really clunky

6:46 clgv: iDesperadO: you can simply call (recur (first filtered-numbers), filtered-numbers, (conj primes (first filtered-numbers)))

6:47 iDesperadO: zoldar: can't understand your solution

6:48 clgv: let me try with loop/recur

6:48 clgv: iDesperadO: you dont need loop necessarily.

6:48 iDesperadO: clgv: ah

6:49 clgv: you can also call the function tail recursively

6:49 iDesperadO: clgv: I'm afraid recur is most mysterious function for me

6:50 clgv: iDesperadO: (defn f [p, primes, numbers] (if ... ... (recur p*, primes*, numbers*)) -> recur just calls f recursively in a non stack consuming way

6:50 it is a special form - no function

7:41 iDesperadO: zoldar: clgv (defn prime-factors [n] (loop [p 2 coll (range 2 (+ 1 n))] (if (>= p n) coll (recur (inc p) (cross-out p coll))))) given the definition of cross-out as (defn cross-out [p coll] (filter #(not (zero? (rem % p))) coll))...why this prime-factors is not right???

7:41 lazybot: iDesperadO: How could that be wrong?

7:42 iDesperadO: anybody here?

7:44 clgv: iDesperadO: what error do you encounter?

7:45 iDesperadO: ah lol. (rem x x) => 0

7:45 iDesperadO: that's why I told you to split into a numbers coll and a primes coll

7:45 iDesperadO: ClassCastException clojure.lang.PersistentVector cannot be cast to java.lang.Number clojure.lang.Numbers.add (Numbers.java:126

7:46 clgv: didnt see that one

7:48 &(map #(rem % %) (range 2 10))

7:48 lazybot: ⇒ (0 0 0 0 0 0 0 0)

7:50 iDesperadO: clgv: I didn't do #(rem % %) I do (rem % p)...

7:51 clgv: iDesperadO: yes but p is in coll. hence you will remove all numbers from coll: primes and non-primes

7:52 iDesperadO: so you always return an empty coll

7:55 iDesperadO: ....

7:55 clgv: iDesperadO: and because of your (inc p) you are not really preforming the prime sieve. you should only use primes to filter and not every natural number

7:57 iDesperadO: clgv: since I don't know how to get the prime

7:58 clgv: clgv: you filter coll with the prime 2. the first number in the resulting coll is prime - in this case 3

8:05 xumingmingv: a silly question, what is a symbol(clojure.lang.Symbol), when do we have to touch directly?

8:05 clgv: xumingmingv: can you be more specific?

8:05 antares_: xumingmingv: when you need to pass a function by name, for example: (map my-fn v)

8:05 also when you are writing a macro

8:06 or when you want to extend a protocol for symbols (like serialization), you will extend it for clojure.lang.Symbol (although clojure.lang.Named should be sufficient, too)

8:06 clgv: implicitly: every time you name anything - the reader stores those names as symbols

8:06 xumingmingv: ,(defn x [] 1) (symbol? x)

8:06 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

8:07 xumingmingv: hit the 'SANBOX DENIED" again...

8:07 clgv: &(symbol? 'x)

8:07 lazybot: ⇒ true

8:07 xumingmingv: I tried in my laptop

8:07 clgv: &(symbol? 'bla.blubb/x)

8:07 lazybot: ⇒ true

8:07 xumingmingv: &(defn x [] 1) (symbol? x)

8:07 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

8:07 clgv: I quoted the names since otherwise the reader would try to resolve them

8:08 xumingmingv: x will be resolved to that function in this case

8:08 xumingmingv: you can check that: (defn x [] 1) (fn? x)

8:09 xumingmingv: ah, I understand

8:10 so (symbol? 'x) is right command to try

8:10 (symbol? x) returns false, what is the 'x' here?

8:12 oh, it is a clojure.lang.Fn

8:13 thanks clgv, antares_ !

8:13 antares_: xumingmingv: that's because x is evaluated

8:13 xumingmingv: (symbol? 'x)

8:13 ,(symbol? 'x)

8:13 clojurebot: true

8:13 clgv: xumingmingv: (symbol? x) the x here is a symbol. but the reader tries to resolve it on read. that means smybol is called with wathever x is resolved to

8:14 oh no. reading is fine - evaling is the point ^^

8:15 xumingmingv: much clear, thanks

8:24 clgv, antares_, what is a function param? is it a symbol, or var? or something else?

8:24 I mean y in (defn x [y] y)

8:26 clgv: xumingmingv: a local binding

8:26 similar to the ones defined in let

8:26 xumingmingv: a local binding is a totally different thing from symbol or var?

8:27 antares_: xumingmingv: y is a symbol but it evaluates to a local (or local binding)

8:27 xumingmingv: what is it class? like clojure.lang.Symbol for symbol

8:27 antares_: xumingmingv: symbol is just a name

8:27 clgv: xumingmingv: on compilation it is a symbol. at runtime it is the name for a value

8:27 antares_: what it evaluates to can be anything

8:35 harja: iDesperadO: how about https://gist.github.com/3181751 at least the first 1000 are correct :)

8:36 that was without loop...recur

8:41 xumingmingv: antares_: then function param(a symbol) can be resolved to a var, right? then how do we explain this? http://stackoverflow.com/questions/11666364/clojure-compile-issue

8:41 antares_: xumingmingv: to a local

8:41 vars are namespace-global

8:41 locals are local to the function

8:42 if a local and a var happen to have the same name, local takes precedence

8:42 that is called "shadowing" and it generally should be avoided

8:43 it is not different from a lot of other languages

8:44 xumingmingv: but in other language like java, if a method can accept anything no matter it is a local variable or a global variable

8:44 but the special form only accept var, and not local

8:44 but the special form 'var' only accept var, not local

8:45 iDesperadO: harja: it's so slow

8:45 harja: well that's kind of a given thing since there is no optimizations goin on there

8:48 you can get it a bit faster if you can assume an ordering for the sequence it takes (no need to seek for the maximal element)

8:50 I thought that the original question was that is that sieve doable without loop...recur

8:50 iDesperadO: ok

8:51 harja: I'm kinda still trying to understand your solution

8:52 harja: is it reduce supposed to return only a value? now it seems it return a sequence

8:54 harja: Yes, every step returns a value. The value we return is a sequence.

8:55 and that returned value gets fed up to the next function call with the next value from the sequence we are reducing

8:55 so, we are not feeding the actual values as the source sequence, but the filtering values instead

8:55 and the value we return from reduce is the list that was filtered with the given value

8:56 iDesperadO: (reduce f val coll) first consume val and (first coll) applying f to get a result and then apply f with result and (first (rest coll) ...finally returns a value

8:56 harja: yes

8:57 but sequence is a value, it's just something we get as a parameter to our next reduce step

8:57 cemerick: FYI: the 2012 State of Clojure survey closes in 30 minutes. Get your 2¢ in while you still can: http://cemerick.com/2012/07/19/2012-state-of-clojure-survey/

8:57 clgv: cemerick: when will you publish the results?

8:57 cemerick: clgv: sometime next week

8:58 harja: So, every time the reduce calls our function, the function gets as parameters the filtered list and the next number to filter the list on, which gets passed to the next function call

8:59 Btw, I got the execution time to less than half if we assume an ordering in the incoming sequence

8:59 just replace apply max value as (first value) or (last value) depending on the order you assume to get the stuff in

9:00 ro_st: any of you guys use Airbrake?

9:03 antares_: by the way, anybody going to http://amsclj.nl/october.htm? I'm thinking of submitting a talk

9:10 harja: iDesperadO: Check out the gist again. I added three different versions with different assumptions on the data and the timing information on them

9:10 so, there are some differences :)

9:15 iDesperadO: harja: (not-multiples-or-1 [1 2 3 4 5 6 7 8 9 10 11 12] 2) returns (2 3 5 7 9 11) containing 2 itself

9:16 (defn cross-out [p coll] (filter #(and (> % p) (not (zero? (rem % p)))) coll))

9:16 harja: iDesperadO: Yes, it assumes that a number is not a multiple of itselt

9:16 it's just a matter of definition :)

9:16 iDesperadO: (cross-out 2 [1 2 3 4 5 6 7 8 9 10 11 12]) returns (3 5 7 9 11)

9:17 harja: yes, but the way the filtering is done that was easier to do

9:17 and basically it just boils down to how is "n is a multiple of m" defined

9:18 I bent the rules a bit there to make it more convenient to implement

9:19 iDesperadO: harja: i'm thinking about why my cross-out function returns the result not containing 2...

9:19 clgv: iDesperadO: thats because of ##(rem 2 2)

9:19 lazybot: ⇒ 0

9:19 craigbro: wow

9:19 ro_st: such a pity you can't wrap enfocus transformation groups with let forms

9:19 craigbro: think I found bug in clojure.string/replace

9:20 iDesperadO: :(

9:20 craigbro: ,(clojure.string/replace "/paths/%5c44WINDOW" #"(?:%[0-9A-Fa-f]{2})+" "\\")

9:20 clojurebot: #<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 1>

9:20 iDesperadO: clgv: I've already specified that (> % p) % have to be greater than p

9:22 clgv: thats what excludes 2

9:23 both in fact^^

9:24 locojay1: hi , how can i use twitter bootstrap function with jayq. (.toolip $( :#myid) (clj->js {:placement :left})) does not work

9:26 clgv: iDesperadO: change it to (or (= % p) (-> % (rem p) zero? not)) to keep p in there

9:28 iDesperadO: harja: I still don't know why (primes-XXX) functions return a sequence

9:28 clgv: ok

9:30 harja: well, it returns whatever reduce returns?

9:30 and since we build a sequence in the reduce phase, it's what comes out

9:30 clgv: iDesperadO: reduce returns anything you build. if you build a sequence via conj from [] it will return the vector, if you just sum up via + it will return a number

9:31 iDesperadO: ah...

9:32 harja: Playing around in the REPL is the easiest way to go with these things. Just put in stuff and see what comes out :)

9:33 But, got to go away now. Bye!

9:33 iDesperadO: harja: thanks

9:33 I'm eval all the way to repl...

9:33 only to find it errs back

9:34 eduard: how to see Locals in backtrace? Emacs, swank-clojure 1.4.4, clojure-jack-in

9:35 clgv: iDesperadO: try to develop small functions step by step testing them in repl while developing

9:36 iDesperadO: ok

9:37 ro_st: eduard: you only see em when you breakpoint. put (swank.core/break) somewhere and run your code

9:37 all the locals at that point will appear

9:37 eduard: ro_st, Thanks, will try

9:38 ro_st: when debugging, i usually bind everything into a let and put just the break and the return in the body

9:38 iDesperadO: clgv: thanks a lot

9:40 clgv: sometimes I find after I read the doc of a function/special form, I don't get better understanding with it

9:40 like reduce

9:40 you said I can build anything with reduce

9:40 eduard: ro_st, Is there another way? I don't need breakpoint, I want to find out what arguments function was called with.

9:41 iDesperadO: so I tried (reduce cons (range 1 5))

9:41 ro_st: eduard: then drop a swank.core/break in at the top of the fn body

9:41 as the args are locals in that lexical scope, they'll show up at that breakpoint

9:41 clgv: iDesperadO: did you read any introductory book on clojure?

9:41 ro_st: you don't need to let-bind them

9:42 clgv: &(reduce cons '() (range 1 5))

9:42 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long

9:42 clgv: &(reduce conj [] (range 1 5))

9:42 lazybot: ⇒ [1 2 3 4]

9:43 iDesperadO: which book you recommend?

9:43 clojure programming?

9:43 clgv: cons has a different argument order than reduce expect. so you would need to write the reduce like ##(reduce #(cons %2 %1) '() (range 1 5))

9:43 lazybot: ⇒ (4 3 2 1)

9:44 clgv: iDesperadO: I can't recommend what I didnt read. It's the most recent book, though

9:44 iDesperadO: so just recommend what you've read, maybe?

9:44 :)

9:45 clgv: how do i know the argument order that reduce expects?

9:45 clgv: iDesperadO: "Programming Clojure" 1st edition. there is a 2nd edition out now. and "Joy of Clojure"

9:46 iDesperadO: clgv: sadly I've read all of them...though very quickly

9:46 seems I didn't get anything out of those books

9:46 craigbro: hmm

9:46 actually, I think it's a bug in clout

9:46 clgv: iDesperadO: humm thats sad but happens

9:46 craigbro: as in, clout needs to quote the decoded value

9:47 cshell: Clojure Programming is the best, in my opinion

9:47 iDesperadO: I guess I just need to write more

9:48 to be specific, how can i find the arguments order that reduce expect?

9:48 why cons is not suitable while conj is

9:48 clgv: ,(doc reduce)

9:48 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

9:49 iDesperadO: (conj coll x) (cons x coll)

9:49 clgv: exactly

9:49 iDesperadO: this is the different..I've doced them to choose cons for reduce

9:50 clgv: the first param is the previous result or initial value and the second param is the current value from the collection

9:50 iDesperadO: and (reduce f coll)

9:50 or (reduce f val coll)

9:50 substitute f with cons...

9:51 i get (reduce cons val coll) which I seems fit with cons,not conj

9:51 so ?

9:51 clgv: iDesperadO: it is (reduce (fn [coll, val] (conj coll val)) [] (range 10))

9:52 iDesperadO: clgv: still here?

9:53 clgv: yeah

9:54 iDesperadO: ...

9:56 clgv: not receiving my message?

9:56 cshell: he was responding to you

9:56 <clgv> iDesperadO: it is (reduce (fn [coll, val] (conj coll val)) [] (range 10))

9:57 iDesperadO: ah...I've missed all his messages

9:58 but the doc said clojure.core/reduce ([f coll] [f val coll])

9:59 val comes before the coll

9:59 clgv: iDesperadO: thats the signature of reduce. the signature of the function f is described in the text

10:00 babilen: Does anybody know if/when clojuredocs.org will be upgraded to 1.4?

10:01 iDesperadO: If val is supplied, returns the

10:01 result of applying f to val and the first item in coll, then

10:01 applying f to that result and the 2nd item, etc. If coll contains no

10:01 items, returns val and f is not called.

10:02 clgv: I can't see what's described in the doc that's said the parameters order of f

10:03 (source reduce) shows ...(clojure.core.protocols/coll-reduce coll f val)))

10:04 joly: ,(reduce - 0 '(1 2 3 4))

10:04 clojurebot: -10

10:05 clgv: iDesperadO: the text translated means first call: (f val (first coll)) oder (f (first coll) (second coll)). after that the result is always the first param and the next element is the second

10:07 iDesperadO: clgv: so with f being cons/conj?

10:08 joly: ,(reduce #(conj %1 (+ (last %1) %2)) '(1 2 3 4))

10:08 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

10:08 joly: ,(reduce #(conj %1 (+ (last %1) %2)) [] '(1 2 3 4))

10:08 clojurebot: #<NullPointerException java.lang.NullPointerException>

10:08 joly: ...

10:09 iDesperadO: ,(reduce conj [] (range 1 5))

10:09 clojurebot: [1 2 3 4]

10:09 joly: ,(reduce #(conj %1 (+ (last %1) %2)) [1] '(2 3 4))

10:09 clojurebot: [1 3 6 10]

10:09 iDesperadO: ,(reduce cons 1 (range 2 5))

10:09 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

10:12 clgv: &(reduce #(cons %2 %1) '() (range 1 5))

10:12 lazybot: ⇒ (4 3 2 1)

10:12 iDespera1O: clgv: I lost my connection

10:12 ....:(

10:12 twice

10:12 clgv: &(reduce #(cons %2 %1) '() (range 1 5))

10:12 lazybot: ⇒ (4 3 2 1)

10:13 iDespera1O: ,(reduce cons 1 (range 2 5)

10:13 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

10:13 iDespera1O: ,(reduce conj [] (range 1 5))

10:13 clojurebot: [1 2 3 4]

10:14 iDespera1O: (reduce cons 1 (range 2 5) not supposed to produce [1 2 3 4]?

10:14 joly: with just conj or cons, I keep having to remember which argument is the collection. I was hoping with my example, it was clearer which order they were provided to the function

10:14 xumingmingv: what does reify create? in bytecode level. a class?

10:15 iDespera1O: joly: (cons x seq)

10:15 the second is the collection

10:15 clgv: xumingmingv: an anonymous class from your perspective and an instance of it

10:15 iDespera1O: and I didn't see your example

10:15 joly: iDespera1O: yes, I mean in this reduce case

10:15 iDespera1O: can you show me again?

10:16 I lost my connection twice

10:16 joly: ,(reduce #(conj %1 (+ (last %1) %2)) [1] '(2 3 4))

10:16 clojurebot: [1 3 6 10]

10:16 joly: in retrospect, I'm not sure it's very clear

10:17 iDesperadO: clgv: &(reduce #(cons %2 %1) '() (range 1 5))

10:18 this just show I have to change the parameters order, but why? it's not clear

10:18 &(reduce #(cons %2 %1) '() (range 1 5))

10:18 lazybot: ⇒ (4 3 2 1)

10:18 clgv: iDesperadO: because of ##(doc cons)

10:18 lazybot: ⇒ "([x seq]); Returns a new seq where x is the first element and seq is the rest."

10:19 joly: conj has the arguments in the opposite order (collection, then element)

10:19 iDesperadO: ....sigh

10:21 I know that (conj collection element) while (cons element collection). when I apply cons/conj to reduce...I doced ##(doc reduce) only to find cons to suit reduce more naturally, but it's not. why?

10:21 lazybot: ⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as... https://www.refheap.com/paste/3808

10:22 dnolen: iDesperadO: cons is actually an exception. conj follows the standard library pattern - collection fns take the cllection as the first arg.

10:22 * clgv sighs

10:22 cshell: I don't use cons in Clojure

10:23 use conj

10:23 iDesperadO: dnolen: ah...this explaination sounds acceptable

10:23 cshell: cons is expensive and takes a lot of time

10:23 dnolen: iDesperadO: usage of cons outside of lazy-seqs is not very idiomatic.

10:23 cshell: ? that's not true.

10:24 cshell: Well, the way I used it did - I ran it through a profiler and it was 80% of my cpu - removing it made my program a lot faster - now that doesn't mean that I was using cons correctly ;)

10:24 iDesperadO: cshell: why cons is expensive?

10:24 dnolen: iDesperadO: it is not.

10:24 iDesperadO: cshell said cons is expensive

10:24 dnolen: iDesperadO: which doesn't make it true :)

10:25 gtrak: cons is a single object allocation and a couple of call stack frames if memory serves me right

10:25 iDesperadO: cons (fn* ^:static cons [x seq] (. clojure.lang.RT (cons x seq))))

10:25 cshell: in my experience, it was, but I might have been doing something wrong with the underlying sequence

10:25 iDesperadO: (defn cons (fn* ^:static cons [x seq] (. clojure.lang.RT (cons x seq))))

10:26 clgv: (inc dnolen)

10:26 lazybot: ⇒ 6

10:26 clgv: $karma dnolen

10:26 lazybot: dnolen has karma 6.

10:26 clgv: $karma cshell

10:26 lazybot: cshell has karma 0.

10:26 gtrak: hah

10:26 clgv: ;)

10:27 gtrak: iDesperadO: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L532

10:27 cshell: I wonder if it was because I was using a vector

10:28 gtrak: it looks like it seqs a vector

10:28 is that slow?

10:28 dnolen: cshell: probably.

10:29 cshell: lists get added to in the front, and vectors in the back - if I did a cons on a vector I wonder if it has to iterate the vector for some reaso

10:29 n

10:29 gtrak: don't believe that's the case, but it does have to add a cons cell in the front

10:29 iDesperadO: list is quick to do the action on the lfe, while vector is quick on the right

10:30 dnolen: cshell: it will call seq on the vector and cons onto that.

10:30 ,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))

10:30 clojurebot: "Elapsed time: 440.266025 msecs"

10:30 dnolen: ,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))

10:30 clojurebot: "Elapsed time: 964.152597 msecs"

10:30 dnolen: ,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))

10:30 clojurebot: "Elapsed time: 986.073162 msecs"

10:30 gtrak: umm

10:30 dnolen: not sure if GC is an issue with clojurebot, but that takes ~100ms on my machine.

10:30 gtrak: why is it twice as slow the second/third time?

10:31 dnolen: gtrak: GC

10:31 gtrak: then it should at least be irregular

10:31 dnolen: ,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))

10:31 clojurebot: "Elapsed time: 545.066794 msecs"

10:31 dnolen: gtrak: there you go.

10:32 gtrak: &(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))

10:32 lazybot: ⇒ "Elapsed time: 1269.220924 msecs" nil

10:32 gtrak: &(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))

10:32 lazybot: ⇒ "Elapsed time: 1195.433891 msecs" nil

10:32 iDesperadO: ...cons just some new functions called...so I think cons won't be expensive...

10:33 .......tired, time to go home

10:33 cshell: If I cons a vector, and then try to get the nth element of the resulting sequence, would the time complexity be O(n), vs O(1) for a vector?

10:33 gtrak: does seqing a vector change its lookup characteristics?

10:34 iDesperadO: thank you very much clgv, dnolen cshell and other guys:)

10:34 cshell: I just added confusion ;)

10:34 iDesperadO: it helps:)

10:35 cshell: if I cons a vector, a list comes back '(1 3 2)' - my experience with cons was when I was first starting with clojure - and I was doing large collections of things

10:36 gtrak: ,(class (seq [1 2 3 4 5]))

10:36 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

10:36 cshell: so I wonder if that's why my performance was really bad - not on the cons itself but on the subsequent random access

10:36 gtrak: cshell: at any rate there's a better solution, stick with vectors the whole way through

10:37 cshell: that's what i ended up doing, but using conj to add to the end

10:37 ,(class (cons 1 [2 3]))

10:37 clojurebot: clojure.lang.Cons

10:37 gtrak: looks like PersistentVector.ChunkedSeq doesn't have a shortcut for nth?

10:37 cshell: ,(class (conj [1 2] 3))

10:37 clojurebot: clojure.lang.PersistentVector

10:38 gtrak: ,(class (rest (cons 1 [2 3]) 2))

10:38 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$rest>

10:38 gtrak: ,(class (rest (cons 1 [2 3])))

10:38 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

10:40 gtrak: it probably could but it probably just makes more sense to stick to vectors

10:41 cshell: Yeah, so i should refine my previous statement with usage of cons is relatively expensive (O(n) vs O(1)) if you expect to perform random access on the resulting struturee?

10:41 er, structure even

10:41 gtrak: random access on a linkedlist is never a good thing

10:42 I don't think that's very surprising

10:42 cshell: ah okay, next time I'll be more explicit :)

10:45 gtrak: does persistentvector have similar cache-locality as arraylist?

10:50 vijaykiran: seanm:

11:01 Cheiron: Hi, lately when coding in Clojure i noted this new behavior. when creating functions, i'm finding myself defining closure functions inside let form. this allowing for really neat and concise defn body

11:02 is it an idiomatic functional technique?

11:06 llasram: Cheiron: If I'm understanding you properly, then 100% :-)

11:07 Cheiron: There's even `letfn` for making defining local functions more concise, for when all you need the `let` form for is functions

11:08 Cheiron: llasram: so I'm on the road of true Clojure? :)

11:08 stain: are these functions you call multiple places?

11:09 llasram: We are all on the road of true Clojure, together evolving the idioms and conventions which will guide us to the Ultimate Elegance. So say we all.

11:10 Aaaaanyway, it's a common technique in any language with real lambdas.

11:10 duck1123`: def lines in places other than top level bug me, but it's not really "wrong"

11:12 Cheiron: stain: no

11:13 stain: are they long?

11:13 llasram: duck1123`: I end up having them w/in a top-level `let` sometimes, but even that feel subtly off sometimes

11:13 Cheiron: stain: no, two or three lines

11:13 stain: I would just use anonymous functions if it's use-once-short, unless they look genuinely useful, then I move them to defn. But I'm a beginner to Clojure!

11:20 S11001001: stain: use what looks pretty; hard and fast rules will lead you astray

11:20 the code should be pretty

11:20 stain: that's a good guide!

11:22 so no, don't use defn for every internal function, dont use letfn for every use-once function, and don't use anonymous for every one either. Common sense, make it look nice and readable.

11:36 S11001001: I like pretty; I guess readable is okay. I like making little shapes with my lisp code, though they usually turn out looking like vietnam

11:39 stain: hehehehhe

11:57 holo: hi

12:00 in java.jdbc page - http://dev.clojure.org/pages/viewpreviousversions.action?pageId=2424859 - i can't find the API versions. where can i get this information? like in my project i have [org.clojure/java.jdbc "0.2.3"], but i want a more recent version

12:02 seancorfield: it's listed here https://github.com/clojure/java.jdbc/

12:02 also, this page http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go provides links to the latest versions (in maven) for all contrib libraries

12:02 solussd: Anyone have any ideas why compiling this ns declaration results in "Parameter declaration set should be a vector"? https://www.refheap.com/paste/9c66f4664ba2c7cf28a494fa7

12:03 duck11231: For things in central, mvnrepository is good. http://mvnrepository.com/artifact/org.clojure/java.jdbc for others, check clojars

12:03 seancorfield: 0.2.3 is the more recent release of java.jdbc btw holo

12:03 holo: seancorfield, the connection-uri is really not in 0.2.3 version right?

12:04 wmealing: seancorfield, going to take a stab at it

12:04 but..

12:04 holo: duck11231, nice tip. thanks

12:04 wmealing: i think that the second line in requires.

12:04 should be using a vector, not a list

12:04 [ not (

12:04 sorry, not list.

12:04 seancorfield: holo: sure it is - that was committed on jun 13th - 0.2.3 was released on jun 18th

12:04 look at the commit history in github

12:05 solussd: that second line in the :require is a ( ) but should be [ ]

12:05 wmealing: sorry, wrong person

12:05 what sean said.

12:05 seancorfield: :)

12:05 wmealing: its late here..

12:06 seancorfield: it's early here

12:06 solussd: seancorfield: actually, that works fine- turns out it was a bad 'defn' in one of the namespaces I was requiring.

12:06 * seancorfield has not yet had coffee :(

12:06 solussd: thanks

12:06 seancorfield: ah, good to know solussd

12:07 i guess if you'd pastebin'd the stack trace, we'd have spotted that :)

12:07 wmealing: didnt know you could put it like that. today i learned.

12:08 seancorfield: i've been tidying up my ns declarations recently to have only one :require and one :import (if needed)

12:08 but i still can't break the habit of :require stuff in [ ] and :import in ( ) because that's how i always saw it in examples!

12:09 and i like being able to just :refer certain vars instead of just setting up an :as alias

12:09 duck11231: I've been through every combination of () and [] in ns forms. Now I'm strictly []

12:09 technomancy: that's not right

12:09 import should use ()

12:09 hiredman: imports should be in (), everything else in []

12:10 seancorfield: the confusion is because the compiler allows ( ) and [ ] interchangeably - bug!

12:11 technomancy: the compiler also allows you to indent with seven spaces instead of two

12:11 heck, it even allows the use of tabs in indentation!

12:13 burt: I have a list of vectors and I want to append an increasing number to the front of every vector. I have '([:a :b] [:c :d]) and I want '([0 :a :b] [1 :c :d])

12:13 How do I do that?

12:14 S11001001: burt: map with 3 args and (range)

12:15 burt: S11001001: I don't follow

12:15 duck11231: ,(doc map-indexed)

12:15 clojurebot: "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."

12:15 S11001001: oh yeah, forgot about that duck11231

12:17 duck11231: ,(map-indexed (fn [i v] (conj v i)) '([:a :b] [:c :d] [:e :f]))

12:17 clojurebot: ([:a :b 0] [:c :d 1] [:e :f 2])

12:17 burt: duck11231: thanks

12:17 duck11231: well, that didn't work, but you get the idea

12:20 seancorfield: ,(map-indexed (fn [i v] (into [i] v)) '([:a :b] [:c :d] [:e :f]))

12:20 clojurebot: ([0 :a :b] [1 :c :d] [2 :e :f])

12:20 seancorfield: not sure how (in)efficient that is tho'...

12:20 adding to the front of vectors isn't terribly efficient, right?

12:21 burt: seancorfield: im cons'ing onto the front of them

12:22 holo: seancorfield, oh ok. when i checked with (doc clojure.java.jdbc/with-connection) it shown no connection-uri. so it's just a forgotten documentation?

12:22 burt: i know it's not as efficient, but it needs to be the front -- im manipulating CSV

12:27 S11001001: burt: do they have to be vectors?

12:35 seancorfield: holo: you missed :connection-uri - it's there

12:36 http://clojure.github.com/java.jdbc/#clojure.java.jdbc/with-connection

12:37 you can see it here http://grab.by/eZUA

12:38 burt: cons'ing on the front of lists is efficient (and (cons i some-vec) will turn it into a list)

12:41 holo: seancorfield, i know it's there, but i can't find it with "doc" function. can you take a look? - https://gist.github.com/3183120

12:41 seancorfield: my screenshot shows i used doc to display that

12:42 scriptor: holo: (clojure.repl/doc …) to be more specific

12:42 seancorfield: are you sure you don't have a much older version of java.jdbc loaded?

12:44 the docstring you see was current in 0.2.2 or possibly early 0.2.3-SNAPSHOT builds

12:49 mdeboard: &(doc send-off)

12:49 ,(doc send-off)

12:50 clojurebot: "([a f & args]); Dispatch a potentially blocking action to an agent. Returns the agent immediately. Subsequently, in a separate thread, the state of the agent will be set to the value of: (apply action-fn state-of-agent args)"

12:50 mdeboard: Does `state-of-agent' mean a reference to the agent at a particular point in time?

12:53 joly: mdeboard: state-of-agent is what is returned when you deref the agent

12:53 ,@(agent "test")

12:53 clojurebot: "test"

12:53 mdeboard: I gotcha

12:53 just wanted to be sure

12:59 lpetit: Any CCW user right there ?

12:59 Hello, btw :)

12:59 clgv: lpetit: here ^^

12:59 lpetit: clgv: hi :)

12:59 clgv: hi

12:59 lpetit: clgv: are you currently using the beta software update site channel?

13:00 clgv: lpetit: no, not at work

13:00 lpetit: clgv: and at home?

13:00 clgv: I have a beta installation

13:00 do you have 0.10.0 - beta out?

13:00 lpetit: I'll release in a few minutes a new beta, with hippie completion.

13:01 clgv: "hippie completion"?

13:01 lpetit: clgv: Oh, there has been several beta released, with increasingly good (IMHO ;) ) code completion support

13:01 clgv: "hippie completion" = "code completion"?

13:01 lpetit: clgv: there was what I'm calling "repl-completion", which is based on dynamic introspection. This has been increased in the past few weeks

13:02 Horofox: what's the clojure's equivalent of ruby's irb?

13:02 lpetit: clgv: and now I've added "hippie completion": https://t.co/NgU3rq34

13:02 technomancy: lpetit: in emacs hippie completion means it gets completion from a variety of sources; is yours the same?

13:02 lpetit: in a nutshell: uses symbols/keywords found in current file

13:03 technomancy: in Eclipse, the meaning is "all word tokens found in all open editors". Right now my meaning is "all symbols and keywords found in same editor".

13:03 technomancy: huh, you had to implement that yourself?

13:03 clgv: good. so we are getting closer to completion for everything required/used?

13:03 lpetit: technomancy, clgv: it's just a first version, before going on holidays. Suggestions welcome

13:04 clgv: completion for everything required/used is there since ~ 2 weeks in beta, and it's dynamic (needs a running REPL)

13:04 zerokarmaleft: Horofox: you can get a basic repl with `lein repl`

13:04 lpetit: clgv: hippie is more static, with some goodies: it completes keywords, and it completes symbols with same symbols in file, and also symbols suggestions derived from keyword names in same file (@cgrand suggestion)

13:04 metellus: assuming you're using lein (you should be using lein)

13:05 clgv: lpetit: do you plan to remove the need for a repl for code completion in the future? the plugin could have a background thread analyzing projects and dependencies...

13:05 lpetit: clgv: someday ...

13:06 mdeboard: What's the Java equiv of C#'s "MemoryStream" class?

13:06 technomancy: mdeboard: a stream coming from in-memory bytes?

13:06 would be a ByteArrayInputStream

13:06 mdeboard: or, alternatively, i ther'es a clojure abstraction

13:06 technomancy: or OutputStream

13:07 lpetit: clgv: I'm focusing right now on improving as far as possible, but without breaking everything, what we currently have. Meaning I'm working hard on improving what is on the editor. Plugging in a background REPL for removing the need for having a live REPL is probably out of the scope of this iteration.

13:07 mdeboard: I see

13:07 semperos: dnolen: where does this 'verify' get defined? https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L148

13:07 clgv: lpetit: yeah thats good. I just wanted to know if it is wanted at all ;)

13:08 lpetit: clgv: needs more hammock time :

13:08 :)

13:08 mdeboard: technomancy: I see

13:09 clgv: lpetit: ah right - hammock-driven development ^^

13:09 meenal: Hi, When I search on slingshot, I see people mention that they are able to avoid custom exceptions with slingshot. Can someone pls point me to how it can be achieved?

13:09 lpetit: Man, I don't know how to say it differently: Eclipse 4 's new default theme is terrible. No, it's unbearable. No, it's … well, you get the point.

13:09 jkkramer: lpetit: congrats on ccw, it's really great. I tried out 0.9 and am actually tempted to switch from emacs

13:10 semperos: nm, I see it now, parameter to the Substitutions ctor...

13:11 seancorfield: holo: did you resolve your java.jdbc issue?

13:11 lpetit: jkkramer: Thanks. I'd be interested on your positive and negative feedback. Would be real interesting to know, from the point of view of an emacs user, a revised pros/cons.

13:11 meenal: Basically, I want to write a custom exception class, just like the one written in java and would like to know how to achieve this with slingshot

13:12 lpetit: jkkramer: and if you want the test to be more complete, I invite you to try out from the beta channel : http://ccw.cgrand.net/updatesite-betas , because it is already stable, but still polishing, and has much more improved code completion. So by all means please try it if you don't already have.

13:12 technomancy: meenal: look at ex-info in clojure 1.4

13:12 it's a subset of what slingshot offers

13:12 of course you don't get an actual custom class, because that's not really useful; you get an exception to which you can attach arbitrary data

13:13 jkkramer: lpetit: sure. i'll try switching for a few days soon and will take notes as I encounter issues

13:13 technomancy: meenal: slingshot offers a much nicer way to catch exceptions

13:13 but you don't need it to throw

13:13 lpetit: jkkramer: thanks. I for sure know there are big missing holes, but I'm not quite sure what the most annoying ones are.

13:14 jkkramer: lpetit: my main blockers in the past were rainbow parens (yuck) and leiningen integration. since you solved those, going to give it an earnest try

13:14 lpetit: jkkramer: I'll be on holidays, but you can usually find cemerick on the clojure or ccw IRC channels

13:14 jkkramer: ok

13:14 mdeboard: This is probably a questoin without enough information, but if a Java class constructor signature takes an OutputStream instance as one of its args, would it suffice to pass `(partial output-stream)' when constructing that class in Clojure?

13:14 lpetit: jkkramer: ok

13:15 jkkramer: I want a report on my laptop by the end of my holidays ! :-D

13:15 jkkramer: lpetit: i'll see what i can do ;)

13:15 lpetit: just kidding

13:17 dnolen: semperos: that's how disequality constraints work in master - that will be changing soon.

13:17 semperos: are you just curious about the implementation details?

13:17 lpetit: clgv: wrt starting a repl in the background, I have contemplated a middle road … if a REPL is needed but none is started, try to start a REPL for the project the editor lives in … not sure if it would bring more goodness than edge cases, though

13:17 semperos: I'm working on the custom unification for my record, following the whole flow to learn how everything works together

13:18 mdeboard: guess I'll just call new against java.io.OutputStream and use htat

13:19 clgv: lpetit: I cant tell either ;)

13:21 meenal: thank u, technomancy. I will take a look at ex-info and seek ur advice if i have any questions

13:23 XPherior: So.. About Sandbar. It uses sessions to keep track of who's logged in. Isn't it bad practice to use sessions for that?

13:24 technomancy: is sandbar still maintained?

13:24 XPherior: technomancy: Now that I glance at it, not really. What're people using for a login systems nowadays?

13:24 dnolen: semperos: yeah verify is not related to unification really. it's just identity fn until you actually use a != goal. in the next version of core.logic there's a more robust solution.

13:25 technomancy: XPherior: friend looks promising

13:25 dnolen: semperos: actually it's not true that it's not related to unification, but again it's a implementation detail that's changing.

13:25 XPherior: technomancy: Thanks. I'll have a peek. :)

13:25 semperos: gotcha; was looking at how unify-terms dispatches on lvar, and chained my way back up to it

13:26 dnolen: semperos: yeah assume it's the identity fn in your reading.

13:26 semperos: dnolen: makes sense

13:27 mdeboard: Java interop question. A class constructor (http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfCopy.html) takes an OutputStream instance as one of its args. Can anyone point me in the right direction on constructing this class in Clojure?

13:28 dakrone: mdeboard: http://clojuredocs.org/clojure_core/clojure.java.io/output-stream

13:28 mdeboard: dakrone: Yeah, but I am not sure what arg I should be passing to that fn

13:28 and `(partial output-stream)' throws an exception

13:28 dakrone: "Default implementations are defined for OutputStream, File, URI, URL, Socket, and String arguments."

13:29 so any of those

13:30 mdeboard: literally `(output-stream java.io.OutputStream)'? I tried that, as well as `(output-stream (new java.io.OutputStream))', I think I'm confused.

13:31 (I'm new to the java interop part of clojure)

13:31 llasram: mdeboard: Try `(output-stream "my-delightful-output-file-name")`

13:33 mdeboard: This actually hides the interop side. It returns an instance OutputStream, which happens to be a particular Java class, but with exactly the same implications as e.g. strings being instances of java.lang.String.

13:34 mdeboard: I see. I think I accidentally didn't listen to technomancy when he said I want a ByteArrayInputStream

13:34 llasram: Oh, geez -- always listen to technomancy

13:35 Aynway :-), if you need a ByteArrayInputStream or ByteArrayOutputStream, then you do need to construct it yourself w/ interop

13:36 $(java.io.ByteArrayOutputStream.)

13:36 .r

13:36 Man, home row

13:36 &(java.io.ByteArrayOutputStream.)

13:36 Oh, lazybot dead?

13:36 ,(java.io.ByteArrayOutputStream.)

13:37 clojurebot: #<ByteArrayOutputStream >

13:37 llasram: Anyway, you get the gist

13:37 mdeboard: Actually, wrong, I do need OutputStream since that's what this Java method's signature requires

13:37 llasram: ByteArrayOutputStream is a subclass of OutputStream, so you can use it anywhere where the type signature requires the superclass

13:38 Inheritance-based polymorphism may be rife with peril, but it's what you get in Java interop

13:39 mdeboard: I see. Thanks for your help, I'm rewriting a C# library that uses a 3rd party lib in Clojure by referencing the javadocs for the Java version of the same lib.

13:39 that is, I'm rewriting in Clojure, it doesn't use a 3rd party lib written in Clojure

13:39 llasram: Gotcha :-)

13:40 mdeboard: aha look at that, ByteArrayOutputStream works

13:49 holo: seancorfield, i didn't. i'm a bit laggy over here ^^ my doc is also clojure.repl/doc . so strange this issue. for sure i'm using an older version, what else can it be? but my project specifies version 0.2.3

14:37 mdeboard: How do you ensure that you're calling a class method if the class has a method and an attribute with the same name? wrt Java interop & classes. There's a class I'm using that has a 'close' attrib and a 'close' method.

14:37 which is terrible

14:40 llasram: mdeboard: I'm failing to recall how you do it w/ earlier versions, but starting w/ 1.4 there's a separate syntax for field access: (.close x) is the method call, (.-close x) is the field access

14:40 mdeboard: oic

14:40 thankfully I"m on 1.4

14:40 edw: Any having problems using CLOJURE-JACK-IN in the lastest Emacs from the git repo? I'm getting a "Symbol's function definition is void" cl-set-getf" error.

14:40 Using lein-swank 1.4.4.

14:41 technomancy: edw: maybe (require 'cl)?

14:41 edw: alternatively: https://github.com/kingtim/nrepl.el

14:41 hiredman: in clojure (.close x) is no-arg method or field, the compiler an figure out which reflectively

14:41 edw: nrepl? Instead of Emacs?!

14:41 hiredman: in clojurescript it cannot, so a distinctive syntax as introduced (.-close x) for field, (.close x) for method

14:41 technomancy: edw: no?

14:41 mdeboard: hiredman: how? foo.close returns a boolean, foo.close() actually closes the thing

14:41 edw: Oh, I see. Sorry.

14:42 technomancy: heh

14:42 hiredman: clojure has support for (.-close x) field access, but there is little reason to use it

14:42 llasram: hiredman: Unless you have a field and a method w/ the same name, right?

14:42 hiredman: llasram: sure

14:42 llasram: hiredman: Ok, which is the case we're talking about :-)

14:44 edw: (require 'cl) didn't work, btw.

14:45 mdeboard: llasram: Thanks, I was pretty confused for a second

14:48 patrkris: hi folks. I'm looking for a CalDAV client library for Clojure or Java. Can anyone recommend one, or perhaps recommend an HTTP library which is relatively easy to extend?

14:52 edw: technomancy: Not to be a PITA, but nrepl doesn't seem to be in Marmalde's repo.

14:52 technomancy: edw: it should be there

14:52 http://marmalade-repo.org/packages/nrepl

14:53 wingy: is there a way to run cljs files in the browser directly?

14:53 for development

14:54 edw: package-archive ==> (("marmalade" . "http://marmalade-repo.org/packages/&quot;) ("gnu" . "http://elpa.gnu.org/packages/&quot;))

14:54 M-x package-install [RET] nrepl [RET] ==> "no match"

14:54 technomancy: M-x package-refresh-contents

14:55 edw: Much better.

14:56 Wikked fast.

14:57 technomancy: it's still missing a few things

14:57 but getting better fast

14:58 duck11231: is the packaged nrepl usually pretty up to date?

14:58 technomancy: duck11231: there is no "usual" for a project this new =)

15:07 wingy: i guess not since its depending on google closure compiler

15:17 mdeboard: I'm trying to make sense of the with-open macro, but don't understand the `(let)' statement on this line https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L3389 ... specifically what "~(subvec bindings 0 2)" expands to... if bindings is [x 1], it looks like it would expand to "(let [subvec [x 1] 0 2])" which is invalid syntax... what happenin' here

15:17 I don't understand the "0 2" at the end of that expression is what I'm saying

15:18 mattmoss: ,(subvec [1 2 3 4 5 6] 0 2)

15:18 clojurebot: [1 2]

15:18 mdeboard: oh

15:18 subvec is a fn :P whoops.

15:19 stain: so basically it unpacks the first binding

15:19 then recurses with the rest of the bindings

15:20 mdeboard: gotcha

15:20 that makes a lot more sense then.

15:20 stain: for each recursion there is a finally-block that closes the one that that iteration unpacked

15:20 s/iteration/call/g

15:20 if you can say macro is called..

15:21 mattmoss: expanded

15:21 well, hmm.

15:21 stain: sounds right

15:25 Horofox: how do I run a .clj file with the command line?

15:26 _ulises: evening

15:27 Horofox: evening

15:27 llasram: Horofox: Use `lein run`

15:27 _ulises: this is for emacs + slime users: which tools do you use to refactor your code? e.g. rename symbols, extract fns, etc.? I just came across https://github.com/joodie/clojure-refactoring but it hasn't received much love in about 8 months

15:28 llasram: Horofox: Er, in the context of a lein project. There are tools floating around for running Clojure files as "scripts," but none have really become standard

15:28 Horofox: llasram: and not in the context of a leon project?

15:28 llasram: I'm doing the clojure koans and want to test a .clj script i made

15:29 llasram: Horofox: I'd suggest just creating a scratch lein project and including the file. It's the de facato standard way of doing things.

15:30 de facto, even

15:30 Horofox: llasram: not so easy to enter the clojure world, huh.

15:30 hiredman: Horofox: java -jar clojure.jar some-file.clj

15:31 I would suggest if you are starting out you just play with the repl and not even bother with files

15:31 http://clojure.org/getting_started

15:31 llasram: I'd disagree -- it's just a question of getting people to use the right tools. Instead of downloading and installing "clojure" you download and install lein. And then unlike other languages, there's nothing else to ever install -- lein resolves all dependencies dynamically per-project

15:31 hiredman: llasram: I didn't ask you

15:31 Horofox: hiredman: "Exception in thread "main" java.lang.IllegalArgumentException: Only these options are valid: :default, :hierarchy" I get this

15:32 what could it be?

15:32 llasram: hiredman: I

15:32 hiredman: I'd meant to direct that at Horofox

15:32 hiredman: Horofox: fix your mistake

15:32 Horofox: this is part of the reason why interacting with the repl for newbies is better

15:32 Horofox: hiredman: it's not telling shit about "my mistake"

15:32 hiredman: it is

15:33 but if you interact with the repl directly you can see exactly which expression causes what

15:33 the exception there includes lots of line number information etc

15:33 but most people ignore exceptions, or complain about them being too verbose (no idea why)

15:33 Horofox: but they are, aren't they?

15:34 hiredman: no

15:34 they contain lots of useful information

15:34 sjl: hiredman: a garbage dump likely contains lots of useful stuff too

15:35 the problem is that it's buried in irrelevant crap

15:35 llasram: Mmmm. Yeah. I love Clojure, but I think the compiler error reporting could be significantly improved . Most of the time I do not want a stack trace which includes both my code and compiler internals

15:35 hiredman: you should know and care about the internals

15:36 llasram: Oh, it's incredibly helpful. I've read most of core.clj and have gotten familiar with much of the Java compiler implementation. But that's not relevant for most of the errors I make, and thus neither is 90% of the stack trace

15:37 hiredman: "it's incredibly helpful, but I don't want it"

15:38 llasram: I agree that one learns to zero in on the relevant parts pretty quickly, and figure out the error messages generated by the most common errors, but that doesn't mean the mapping is straightforward

15:38 hiredman: Horofox: your error is you copied and pasted some code from somewhere that defines multimethods in way that doesn't work anymore

15:38 Horofox: hiredman: does it say what you told me?

15:38 hiredman: but thanks

15:39 hiredman: how did you learn clojure?

15:39 dnolen: llasram: 1.3 includes better stacktraces - would be better if someone submitted a patch that provided this is a data structure for external tools.

15:39 Lots of complaining ... no patches.

15:39 hiredman: Horofox: just like I recommended it to you

15:39 Horofox: hiredman: use REPL?

15:39 hiredman: yep

15:39 llasram: dnolen: I've got a CA printed out and sitting on my desk. I'm just waiting for my boss to get back from a conference to send it in :-)

15:39 hiredman: from a repl I went to manually c&p from a file to repl

15:39 Horofox: hiredman: I want to learn so I need a direction, not only typing random stuff in REPL

15:40 hiredman: Horofox: you can futz around with various code exercises, but the best way is to find a project and write it

15:41 dnolen: llasram: sweet, look forward to someone actually attempting to fix the issue!

15:41 hiredman: it's like literacy in anything else, spend time reading and writing

15:41 Horofox: hiredman: what's a good thing to write in clojure? I don't want to get into webdev(I already develop with rails)

15:42 hiredman: whatever your next toy project is

15:44 I've got a doozy of a project for you: implement some audio codec in clojure

15:45 lynaghk: cemerick: ping

15:48 Horofox: hiredman: i have no idea of how audio codecs work

15:49 hiredman: there are a lot of tools for dealing with clojure projects, but what is more important, understanding clojure or the tools ecosystem? clojure is certainly usable outside of the tools

15:49 Horofox: you will have some idea by the time you are done

15:49 Hodapp: code exercises, however, can be a good way to introduce a construct that you might not find if you were more focusing more on a project or problem

15:50 dnolen: Horofox: to get to your earlier point, Clojure is not so great for writing simple scripts. JVM startup time makes this mode of development tedious. Most folks figure out a decent REPL setup for their favorite environment.

15:50 Horofox: VIM, Emacs, and Eclipse have the most developed environments. Light Table promises to provide something more friendly one day.

15:50 hiredman: I have no idea either, I started trying to port an mp3 codec from haskell, but got as far as trying to figure out what a "psychoacoustic model" is

15:51 Horofox: hiredman: that's a good idea

15:51 sjl: Horofox: "Games" it a broad topic that can be fun, and you can start with tiny text-based "guess my number" and tackler more and more interesting ones as you learn

15:52 hiredman: "I want to learn Java" "go install maven and eclipse"

15:52 "I want to learn Ruby" "install textmate, rvm, and rails"

15:53 llasram: I view "I want to learn Clojure" -> "install lein" as the equiv of "I want to learn Ruby" -> "install ruby"

15:53 hiredman: clojurebot: lein |is not| clojure

15:53 clojurebot: Alles klar

15:54 llasram: I'm fully aware that you can just download the Clojure JAR, but it doesn't get you any of the amenities most people expect from installing a language package

15:54 gtrak: ~lein

15:54 clojurebot: lein is not the bestest programming language available.

15:54 amalloy: haha. damn you for your inferences, clojurebot!

15:55 gtrak: clojurebot: lein |is not| 'clojure

15:55 clojurebot: In Ordnung

15:55 gtrak: ~lein

15:55 clojurebot: lein is not clojure

15:55 gtrak: ha, that actually worked?

15:55 amalloy: ~clojure

15:55 clojurebot: clojure > scheme

15:55 emezeske: ~scheme

15:55 clojurebot: scheme is Scheme is like a ball of snow. You can add any amount of snow to it and it still looks like snow. Moreover, snow is cleaner than mud.

15:55 gtrak: is that a coincidence?

15:56 llasram: I've had had multiple friends turned off from trying out Clojure because they'd download the JAR or install a package and end up with something which didn't provide anything like the tooling they expected

15:57 sjl: It may not be usable but at least it's not complected amirite

15:57 llasram: heh

15:58 dnolen: llasram: what were they used to?

15:58 llasram: Ruby mostly

15:58 hiredman: llasram: my contention is starting with the repl is the best way

15:58 dnolen: llasram: case closed ;)

15:58 sjl: readline support?

15:58 gtrak: sjl: I want to program... me: here's an integer

15:58 hiredman: llasram: not the easiest

15:58 amalloy: hiredman: rlwrap java -jar clojure.jar? or something else?

15:59 hiredman: rlwrap is a flourish

15:59 ToxicFrog: llasram: not having used ruby, what were they expecting other than "a REPL"?

15:59 dnolen: llasram: I find lein far more pleasant than the rvm + bundler stuff I have to deal with. Tho to be fair that Rails-ish stuff.

16:00 stain: have any of you a good idea on how to do framebuffer (as in /dev/fb0 on Linux) fun from Clojure? I'm thinking for a Raspberry Pi project

16:00 hiredman: I am not saying that the tools, the extras, etc are bad, jsut that hey are that, extras

16:00 stain: perhaps some JNI stuff? File operations on the device might not be enough, I guess

16:01 llasram: dnolen: Oh, totally. Hmm. I'm saying things poorly, and I don't think anyone here disagrees with me except maybe hiredman. If you know that clojure.jar is a library implementing the language, and that's what you need, then great. But I haven't tried any other language that distributes itself that way

16:01 ToxicFrog: llasram: I mean, generally, when I install a language runtime, I expect to get the docs, the runtime libraries, the interpreter or compiler, and hopefully a REPL and that's basically it.

16:01 dnolen: llasram: yes the story is usually far more frightening :)

16:01 llasram: dnolen: Ruby, Python, Scala, Haskell -- I install a package, and get a set of tooling which integrates a readline-supporting REPL, docs, command-line compiler/interpreter etc

16:01 hiredman: if all you know is how to do is work with clojure tools, what happens when the tools fail or are inadequate

16:02 the clojure repl has all of that except for readline support

16:02 dnolen: llasram: yes, global installs have destroyed countless hours of productivity the world over.

16:02 ToxicFrog: ...doesn't clojure.jar include a command-line compiler and interpreter in the form of clojure.main?

16:02 hiredman: clojure jar

16:03 docs access from the repl is also an extra in my mind

16:03 ToxicFrog: Horofox: on the subject of fun projects for clojure - currently I'm working on a project to edit and merge a (text-based) save game format for a game I play. So, a parser, generator, various analysis and editing tools, etc. Don't know if that inspires you at all.

16:03 hiredman: clojure.org is comprehensive

16:03 llasram: ToxicFrog: A REPL with readline support and commad-line completion, a way of running code in files which doesn't involve knowing how to invoke the JVM on the library implementing the language you're trying to use

16:04 Horofox: ToxicFrog: cool

16:04 ToxicFrog: llasram: ok, yes, readline support is notably missing

16:04 llasram: I'm not saying theses are bad properties in and of themselves -- just that they aren't what most of the people I've tried to expose to Clojure expect, and from that sample just pointing people to lein is a better match of what they're looking for

16:04 hiredman: "symbiotic with an established Platform" -- http://clojure.org/rationale

16:04 ToxicFrog: I have a working 'clojure' command that handles all of the JVM invokation for me, but that may have been added by the packager?

16:05 dnolen: llasram: http://dev.clojure.org/display/design/CLJ+Launcher

16:05 hiredman: people should not expect to use clojure without understanding at least something about the jvm

16:05 sjl: ToxicFrog: Some packagers do that -- brew installs clj for you

16:05 dnolen: llasram: what you want is desirable - but yet again something the community needs to step up to the plate.

16:05 llasram: hiredman: Agreed. But if you check out e.g. Jython, JRuby they have many more amenities

16:05 hiredman: just as I would say people should not expect to use clojurescript without some understanding of javascript

16:06 ToxicFrog: hiredman: he does have a point that even other JVM libraries generally come with at least a few wrapper scripts to launch the jars properly :)

16:06 hiredman: llasram: I have to argument against amenities, and there use, I just don't think they are a good way to learn

16:06 llasram: dnolen: I think the community already has in the form of lein :-)

16:06 hiredman: when teaching children to do addition, do you just hand them a calculator and say "press these buttons" ?

16:06 ToxicFrog: Speaking of launching jars smoothly, anyone here have experience using jsmooth or something like it on a lein uberjar?

16:07 I am looking for a way to make deploying on windows not an endless pit of misery and suffering.

16:07 sjl: hiredman: nah first we take the calculator apart and I explain the circuit board so they understand how it runs

16:07 dnolen: llasram: of course! but there are some good ideas not yet in lein on that page as well.

16:07 ToxicFrog: hiredman: no, but neither do I start with category theory so that they can truly understand addition :P

16:07 gtrak: people have this same argument on ##java against IDEs

16:08 i think it generally resolves to don't expect us to help you with eclipse

16:08 ToxicFrog: More generally, if you're teaching someone to program it helps to be able to teach programming without constantly getting hung up on the tools and the language being used to teach it, and similarly, if you're teaching a specific language it's nice not to spend a lot of overhead on the OS or architecture that the language targets.

16:09 gtrak: when you don't know the basics of java

16:09 ToxicFrog: Those are things that should be learned, but they are also different things.

16:10 sjl: ToxicFrog: Yep. Allow this abstraction to just be abstract for now. Later you can dive in and see how it works but trying to bootstrap from first principles will take forever.

16:11 mdeboard: Why was clojure.core.assert-args made private? Is there a way to use private fns ?

16:11 gtrak: #'

16:11 headius: you can argue against "amenities" of language impls like JRuby that try to hide the JVM's ugliness, but you'd be deluding yourself

16:11 the JVM is not very user friendly, and saying "you just need to learn the JVM" ignores the many obvious warts

16:11 mdeboard: gtrak: Righto

16:12 headius: that said I'm entering this conversation halfway through, so I don't know what amenities we're talking about :)

16:12 ahh…a nice command-line tool

16:12 yeah, that's a silly one to argue against

16:12 gtrak: headius: clojure.org site recommends getting the jar instead of lein

16:12 hiredman: I am not saying it should exist

16:12 headius: the heinousity of the java command line is legendary

16:13 even the original Java guys acknowledge it

16:13 hiredman: I am saying several things 1. lein is not clojure 2. telling people to learn lein to learn clojure is silly 3. booting the jar gives just clojure, no other distractions

16:13 headius: I don't mean you should go as far as we have in JRuby and provide a native executable, but every bit you can do to make CLI easier is like gold

16:13 sjl: I wonder if Pygments has "java command line invocation" as a lexer

16:14 llasram: hiredman: Directly linking libpython.so gives you Python w/o any distractions, but that's still an awkward way to work with the language

16:14 headius: the "jruby" command actually books libjvm and starts up the JVM through JNI…giving us full control over the structure and interpretation of the command line

16:14 books=boots

16:15 llasram: I think headius's summary is right on -- we're really just talking about having a convenient command-line tool for interacting with the language

16:15 sjl: hiredman: how would one use a library in that setup? wget the jar?

16:15 library like, say, quil

16:15 dnolen: gtrak: it shows the simplest thing. and then links to more detailed setups.

16:15 sjl: or overtone

16:16 llasram: headius: Wow, I didn't realize you'd gone that far. That's pretty hardcore :-)

16:16 dnolen: sjl: quite few people still look at lein w/ suspicion and have custom build scripts for their projects.

16:16 hiredman: headius: I think the clojure situation is a little different from jruby's, not being a port of a c runtime people expect to be installed globally

16:16 headius: llasram: we used to have a bash script, but you can't use a bash script in the shebang line of another script

16:16 we eventually just had to suck it up and provide a real native executable

16:16 gtrak: dnolen: yea... It's not against it persay, but you have to click-through some things and it's probably not obvious what you want if you're a newbie

16:16 llasram: headius: On OS X? You can on Linux these days, although you definitely couldn't in the past

16:16 headius: it's not consistent

16:16 llasram: Ah

16:17 headius: in any case, there's many other benefits to having a real native executable, like avoiding two process launches, being able to interrogate the JVM before initializing it, and so on

16:17 technomancy: yeah, with a bash script you basically end up pissing all over your ps output

16:17 headius: right

16:17 sjl: dnolen: do they... do they build classpaths and fetch all dependencies manually?

16:18 dnolen: sjl: yes, or they use Eclipse and they don't care about all this command-line goofiness at all.

16:18 sjl: dear lord, that's horrifying

16:18 dnolen: sjl: it's pretty tiresome for people to come Clojure with their myopic world views

16:19 sjl: not the Eclipse part, that's another fine direction

16:19 dnolen: sjl: Eclispe manages everything, add jars to your project done.

16:19 sjl: Yeah, if you don't need the command line that's a nice way to get started

16:20 dnolen: sjl: my point is there are legitimate multiple ways to get started. clojure.org wisely makes no assumptions.

16:20 headius: oh, another nice thing about having your own executable…if startup time is a concern, forcing users to type java -Xbooclasspath/a:clojure.jar org.clojure.Whatever is pretty mean :)

16:20 technomancy: dnolen: "I want my arrow keys to work" is a pretty reasonable assumption

16:21 sjl: technomancy: nah dude some people don't like backspace to work don't assume things

16:21 dnolen: technomancy: if you care about the command line. I don't imagine CCW uses care whether the command line REPL supports arrows or not.

16:21 technomancy: RUBOUT

16:21 headius: Ctrl-H, man

16:22 llasram: headius: heh, I almost said that -- I don't even have a key mapped to Backspace!

16:22 dnolen: technomancy: fortunately there's line to satisfy a different crowd.

16:22 er lein

16:22 hiredman: headius: sure, and every serious project has it's own launcher script anyway

16:22 technomancy: yeah, it's just embarrassing to have to tell my friends about how great clojure is and then follow it up with "as long as you don't try to learn it from clojure.org"

16:22 ToxicFrog: 'lein repl', for some reason, has absolutely horrifying memory requirements for me

16:23 headius: opinionated software sucks when the opinion is wrong

16:23 ToxicFrog: It looks like it starts up 2 JVMs and each one wants at least 1GB of memory, which on a 3GB laptop is way too much

16:23 hiredman: but what is simpler than to run `java -jar clojure.jar` and get a repl?

16:23 ToxicFrog: hiredman: as noted, you can't use command history or line editing in that, in contrast to basically every other REPL ever

16:23 And it's really annoying.

16:23 sjl: hiredman: running "clojure" and getting a repl with readline?

16:24 hiredman: what is the difference between this hypothetical clojure launcher "clj" and "java -jar clojure.jar"? the first doesn't have spaces in it?

16:24 technomancy: read. line.

16:24 ivan: -jar nukes your CLASSPATH

16:24 hiredman: I don't care about readline

16:24 sjl: you have to be in the same dir as clojure.jar

16:25 ToxicFrog: You can with jline, but now you need to download a specific older version of jline (because 1.x goes insane when hosting clojure for some reason) and use java -cp jline-asdfasdf.jar:clojure-asdfsadf.jar:$CLASSPATH jline.ConsoleRunner clojure.main

16:25 Which is miserable and a pain to type to every time you want a clojure REPL

16:25 emezeske: hiredman: You don't use readline, or something like it?

16:25 ToxicFrog: hiredman: congratulations, you get everything right on the first try and never need to re-enter older lines. The rest of us aren't as perfect.

16:25 hiredman: emezeske: sure I use it, but I can take it or leave it, it is not central to writing clojure code

16:26 emezeske: hiredman: That's like saying that an eraser is not central to writing prose with a pencil

16:26 technomancy: hiredman: that works for you, but assuming that there are more than a handful of other people who are able to function that way is crazy

16:26 emezeske: hiredman: Perfectly possible, but...

16:27 hiredman: emezeske: it works just fine

16:27 ToxicFrog: hiredman: believe it or not, most people aren't you and a great many of them appreciate the ability to backspace, line-edit, and recall previous commands easily.

16:27 hiredman: emezeske: and my personal experience backs up that it works fine (and I think so does the fact that many people besides me learned clojure before tools like lein existed)

16:28 pjstadig: self initializing clojure command-line script https://github.com/pjstadig/dotfiles/blob/master/bin/clojure

16:28 llasram: hiredman: Yes, but how many *more* would have learned it if there had been convenient tools from the start?

16:28 ToxicFrog: Do you need to use the REPL at all to write Clojure code? No. If you are using the REPL, is it still usable without readline support? Yes.

16:28 pjstadig: with readline

16:28 ToxicFrog: But have the REPL available with readline support makes it easier.

16:29 technomancy: hiredman: speaking from personal experience, it's because I had an extremely high tolerance for bullshit and yak shaving

16:29 ToxicFrog: If you're going to go the "well, it's not necessary, you can program fine without it" route, why are you using clojure at all rather than rocking out with machine code?

16:29 llasram: technomancy: Which tolerance on your part I for one am incredibly grateful :-)

16:29 hiredman: llasram: who cares?

16:30 clojure is not a religious world view I want to foist on to as many people has possible

16:30 grim_radical: lolwut

16:30 llasram: hiredman: No, but it's a useful tool I'd like more people to use, so there's a more vibrant ecosystem, with more useful libraries, better documentation, and all the rest

16:30 sjl: I don't have enough wat.gifs for how this conversation has unfolded. I'm out.

16:30 ToxicFrog: pjstadig: requires rlwrap which is not reliably installed, if you're using maven anyways wouldn't it be easier to download jline 0.9.x as well and use that?

16:31 zerokarmaleft: hiredman: generalizing expectations for all people that decide to learn clojure is going to be mismatched against the experiences of clojure early-adopters (which is a small, inclusive subset)

16:31 technomancy: exhibit A: https://github.com/technomancy/clojure-mode/blob/47caba15ff31f339e74378fd3c05bcffa7091550/clojure-mode.el#L627

16:31 pjstadig: ToxicFrog: my computer is just a series of scripts, some that setup rlwrap for me (reliably) and others that use it

16:31 ToxicFrog: hiredman: if you care so little, why are you arguing so vehemently that this is something clojure should not have?

16:32 pjstadig: it's nice to be able to just type clojure and open a REPL whenever i want to answer some simple question

16:32 ToxicFrog: pjstadig: yeah, I'm just saying that a jline-based approach is probably more portable :)

16:32 hiredman: I expect (and hope) that additions to clojure (runtime, compiler, extras) are evaluated on "is this useful to people who know clojure" rather than "is this useful for people who don't know clojure"

16:33 ToxicFrog: hiredman: so, what, your argument is that once people know a language, they stop caring whether its REPL has readline support?

16:33 rlb: pjstadig: also, fwiw, the debs set up /usr/bin/clojure (and handle 1.2 vs 1.3 vs 1.4 via update-alternatives) by default.

16:33 ToxicFrog: I had no idea. Guess I might as well recompile lua, python and bash without readline enabled now.

16:34 technomancy: ToxicFrog: or you could write unrlwrap

16:34 ToxicFrog: true

16:34 That probably already exists, even

16:34 amalloy: technomancy: rcwrap

16:34 technomancy: for all non-ascii keystrokes, it just inserts HERP/DERP

16:35 zerokarmaleft: then rlwrap it again...inceptionwrap

16:35 llasram: amalloy: rc == read... console?

16:35 amalloy: character

16:35 llasram: ah!

16:35 pjstadig: rlb: i've been using clojure since before there were debian packages :)

16:35 mdeboard: hipster

16:35 hiredman: calling readline support a deal breaker, when it obviously isn't is just silly, like complaining about parens

16:35 gtrak: I think clojure.org could probably go along with the consensus and endorse leiningen at least, maybe not emacs

16:36 rlb: pjstadig: me too -- just mentioned them for anyone intereseted.

16:36 s//intereseted/interested/

16:36 technomancy: it's not an "impossible to get things done" deal breaker, it's a "I can tell that no thought has gone into the out-of-the-box experience, therefore I don't have time for this" deal breaker

16:37 ToxicFrog: hiredman: no-one is calling it that, though?

16:37 pjstadig: sidenote: i think it's probably better to have the clojure versions in stalled separately, instead of with update-alternatives, since there are incompatibilities

16:37 rlb: llasram: oh, and wrt the emacs 24 debs, we may or may not get them in to wheezy, but they'll still be in unstable. The release team hasn't told me what they want to do about it yet.

16:38 technomancy: rlb: is there still time for bribes?

16:38 * technomancy heads to kickstarter.org

16:38 gtrak: (inc technomancy)

16:38 ~(inc technomancy)

16:38 clojurebot: technomancy codes while wearing gravity boots to increase the blood flow to the face transplant he got after discovering the world does not treat build tool creators kindly

16:38 emezeske: hiredman: I think your argument is fair if we're talking about introducing people who have *never* programmed before to the language, maybe young kids or something. But anyone with some programming experience under their belt, that does not happen to be an ascetic monk, is going to balk at a REPL without readline. They'll also balk at having to go around and download dependencies, and transitive dependencies, thinking the whole time, "Why they hell am

16:38 rlb: hah -- I asked them a few days ago, but I wanted to give them time to get back to me. I'm sure they're swamped/crazy atm.

16:38 technomancy: sure

16:39 emezeske: hiredman: In other words, if you introduced me, an experienced programmer, to clojure without mentioning leiningen, I would smack you when I found out about it.

16:39 hiredman: emezeske: that is obviously not true

16:39 llasram: I'm glad wheezy is going to be out soon, but I'm not glad that the clock will start ticking on all the squeeze systems my company has in production :-)

16:39 hiredman: emezeske: there were people using clojure professionally before lien existed

16:39 ToxicFrog: emezeske: your first one cut off at "why the hell am"

16:39 gtrak: $lazybot are you dead?

16:39 emezeske: ToxicFrog: le sigh

16:39 * llasram pours one out for lazybot

16:40 gtrak: Raynes: lazybot is dead!

16:40 rlb: llasram: and for some people the gnome 3 transition is likely to be "jarring".

16:40 Raynes: Long live lazybot!

16:40 technomancy: man... I'm still having a hard time believing I actually wrote M-x clojure-install

16:40 Raynes: technomancy: We were all young once.

16:40 Some of us still are.

16:40 ToxicFrog: Anyways, I'm sick of arguing with a brick wall, time to get some groceries and write some code. Laters.

16:40 emezeske: hiredman: Well, they filed their "balk" away in the "I hope someone does that, and soon" cabinet, and kept working. Or in technomancy's case, they didn't file it away, and fixed the problem.

16:40 Raynes: amalloy: I just tried to ssh lazybot.

16:40 emezeske: hiredman: Or, they were ascetic monks.

16:41 hiredman: emezeske: and some (crazy) people are using maven for clojure projects

16:41 scriptor: early adopters tend to be more tolerant of these kinds of things

16:41 technomancy: emezeske: OTOH, if we keep self-selecting for people with extremely high yak-shaving tolerance it might be easier to get more pull requests on tooling =)

16:41 emezeske: hiredman: *shudder*

16:42 llasram: technomancy, hiredman: Re: "no time for this", exactly. And for specific harm, that made it much harder to generate sufficient interest for adoption at my company

16:42 emezeske: technomancy: True enough!

16:43 hiredman: I, like you, feel no need to evangelize the language. I guess all I'm arguing for is that if an experienced programmer walks in the door, we mention leiningen. No need to force it, but there's a good chance they'll like to know from day one.

16:45 rlb: technomancy: I haven't used lein much yet (just for some testing with noir) -- and I wondered if lein was compatable with, or had anything like, maven repository managers for cases where you wanted more control over the incoming items (i.e. to allow vetting, support reproducibility, offline builds, etc.).

16:46 technomancy: rlb: sure, you can use lein with nexus and co.

16:46 just add :omit-default-repos true and add them to :repositories

16:46 rlb: ok, thanks -- are the main ones these days nexus and artifactory?

16:46 technomancy: and archiva

16:46 gtrak: there are smart lisp programmers out there that hate the jvm already, and beginners that need a better experience. The 'clojure is a better java' crowd is less sensitive to this sort of thing.

16:47 technomancy: I'm pretty sure I wouldn't have bothered with Clojure if swank hadn't existed

16:50 emezeske: technomancy: No way I'd have bothered with clojure if leiningen didn't exist. I have better things to do than to track down JARs by hand, or deal with maven directly.

16:53 gtrak: lazybot: hi!

16:58 gfredericks: (dec lazybot)

16:58 lazybot: ⇒ 6

16:58 gtrak: (inc technomancy)

16:58 lazybot: ⇒ 33

16:58 gtrak: there

17:00 gfredericks: (inc me)

17:00 lazybot: ⇒ 1

17:06 cemerick: emezeske: More than any other thing, I think you can attribute the growth of Clojure to the maturation of Leiningen.

17:07 technomancy shouldn't have to ever buy another drink ever again at any Clojure gathering. :-)

17:07 zerokarmaleft: cheers, thanks for all the yak-shaving

17:07 technomancy: aw shucks you guys...

17:10 llasram: The morning of Nov 16th, technomancy lies dead from alcohol poisoning. Fortunately he is restored from backup by that evening

17:11 Raynes: cemerick: Not going to tell you how many times it took me reading that sentence to realize that you said 'maturation' and not something else very similar but much less appropriate.

17:12 cemerick: llasram: heroku should have a follower ready, yeah?

17:12 Raynes: Twisted basterd.

17:12 :-)

17:13 rickmode: code master__tion is more of a Java thing

17:13 * llasram learns about Heroku followers

17:13 llasram: Cool feature!

17:13 tmciver: Raynes is a master debater.

17:14 Hodapp: rickmode: bah?

17:14 gtrak: we once had that broadcast on the high school intercom

17:14 * gfredericks is going to start using the word "maturate" in place of the verb "mature"

17:17 cemerick: gfredericks: they each have their place

17:17 people mature, wine maturates :-)

17:17 </pedantry>

17:17 gfredericks: :)

17:17 emezeske: cemerick: I wouldn't find that at all surprising

17:18 gfredericks: wait it must be an actual work musn't it

17:18 word*

17:18 * gfredericks quickly doesn't bother to look it up

17:20 cemerick: gfredericks: what, "maturate"?

17:21 * cemerick hardly ever makes up words

17:21 rickmode: maturegery

17:23 craigbro: that sounds dirty

17:28 gfredericks: cemerick: I rarely maken't up words

17:29 cemerick: gfredericks: makenut is *totally* a word!

18:27 aphyr: What's the minimal amount of code required to extend-protocol IPersistentMap?

18:27 Do I need to define all the methods of Seqable, IPersistentCollection, Associative, etc?

18:29 hiredman: aphyr: your question makes no sense, IPersistentMap is not a protocol, and none of Seqable, IPersistentCollection, and Associative are either

18:30 aphyr: Yeah. but IPersistentMap extends those interfaces

18:30 hiredman: so?

18:31 aphyr: Well IPersistentMap iteself only consists of assoc, assocEx, and without

18:31 hiredman: none of those things are protocols, so "how can I do protocol things with things that are not protocols" is your question?

18:31 aphyr: Er, wow, yeah, you're right.

18:31 hiredman: java interfaces are not protocols

18:31 aphyr: Sorry, having a brain fart.

18:32 Guessing I need to use proxy then

18:32 Which... aw fuck it, might as well just extract the whole fucking thing into a hashmap

18:32 hiredman: reify, defrecord, and deftype all can extend interfaces or have protocols extended to them

18:32 technomancy: usually a safe bet

18:33 aphyr: Yeah, I am knee-deep in a salesforce library right now

18:33 trying to make it slightly less absurdly javaesque

18:33 * technomancy glances around nervously

18:33 aphyr: https://github.com/teamlazerbeez/sf-api-connector/blob/master/sf-api-core/src/main/java/com/teamlazerbeez/crm/sf/core/SObject.java

18:33 brehaut: aphyr: my condolences

18:33 aphyr: Long story, don't ask

18:33 want to shoot myself

18:34 Would like, ideally, to use these suckers as maps

18:34 (but also support their metadata operations)

18:34 hiredman: https://github.com/arohner/clj-wallhack

18:35 aphyr: .... awesome

18:35 hiredman: you can create objects that present a map like view over another object pretty easily, I don't mean you should use the reflection stuff in clj-wallhack, but it has some examples

18:35 aphyr: Yeah, torn between constructing maps and putting some stuff into metadata

18:35 hiredman: you can also use reflection to generate a function that turns an object in to a map (like bean)

18:36 don't put stuff in metadata unless it is metadata

18:36 aphyr: or wrapping sobjects in a defrecord which gives them map semantics

18:36 hiredman: a good rule of thumb for metadata is "is this ancillary data about this other data, that should change equality relationships"

18:37 er

18:37 should not

18:37 aphyr: Ugh, honestly, I don't understand the SFDC api well enough yet to say

18:37 Just trying to get some human-readable structures out of this fucker

18:38 hiredman: aphyr: language in #clojure is generally around pg to pg-13

18:38 aphyr: "

18:39 technomancy: http://wondermark.com/136/

18:39 aphyr: abominable self-consuming WSDL human centipede

18:44 technomancy: we could use some more intense sequences of violent action in here though

18:44 hiredman: ~GUARDS

18:44 clojurebot: SEIZE HIM!

18:45 brehaut: ,(repeatedly launch-the-missiles)

18:45 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: launch-the-missiles in this context, compiling:(NO_SOURCE_PATH:0)>

18:45 brehaut: damn

18:48 amalloy: (dorun (repeatedly launch-the-missiles)), or you'll just lazily do nothing

18:51 * technomancy flees through the streets of Hong Kong, pausing occasionally to unleash kung-fu on the guards

18:53 emezeske: technomancy: Your nick, plus that violent action sequence, makes me think you've played shadowrun

18:53 technomancy: every single youtube clip of the bike sequence from Project A is only offered in non-html5 format =(

18:54 emezeske: no, I was thinking of http://www.youtube.com/watch?v=ecsGvqvskXw

18:54 at least I think that's it

18:55 aphyr: sf_commute.mp4

18:55 technomancy: oops, it's a dubbed version; my bad

18:55 emezeske: Oh, jackie

19:09 pepijndevos: Using zippers, how can I insert a child a the root, and not lose my current position?

19:13 Because if I do (z/insert-child (z/root loc) :foo), I have no idea where loc was.

19:23 llasram: I think paredit-mode needs a command for "oops, I accidentally typed M-( when really I just needed (". So (foo (bar| (baz))) -> (foo (bar) baz)

19:23 Er, (foo (bar| (baz))) -> (foo (bar) (baz))

19:25 amalloy: llasram: isn't that just forward-barf?

19:25 llasram: Ask and ye shall receive! Also, no idea how I didn't make that connection

19:26 (inc amalloy)

19:26 lazybot: ⇒ 25

19:27 augustl: how does with-redefs work for namespaced stuff? I have a bunch of vars in myapp.env/some-var, and want to redefine them for some testing. I typically refer to them as env/some-var via an :as in the require.

19:28 llasram: augustl: Works as you'd expect/hope. The namespace aliases effect all resolution within the namespace defining the alias

19:29 augustl: ah, so it's not a purely symbolic thing

19:29 for some reason I thought it was

19:29 llasram: s,effect,affect, <- spelling!

19:30 Yep! It took me a bit to get my head around, but once you have the right mental model, it's entirely consistent

19:31 augustl: was useful to see that it just ends up calling .bindRoot on the internal clojure.lang.Var object

19:32 llasram: Heh. I was going to mention that reading the Java implementation helps, but didn't want to risk scaring off :-)

19:33 mdeboard: So I'm working with this Java 'Document' class from the iText library. In order to perform operations with it you have to manually call its `.open' method. I wrote this modified "with-open" macro to handle cleanup for me: https://gist.github.com/f057008587243ea585ad ... However when I try to call it like such I get an error indicating that it's closed: https://gist.github.com/f9cbff8c6cd9eba9aae5

19:33 Am I missing something important about the nature of these context manager macros or

19:34 llasram: mdeboard: Probably not? What's with-pdf look like?

19:34 mdeboard: llasram: it's in the first link

19:35 llasram: Man, I'm 0 for n on following the right link today

19:35 mdeboard: hehe

19:36 the PdfCopy class needs a Document instance in its constructor, but it can't already be an opened instance, so it's really quite annoying.

19:37 llasram: Random side-note FYI: I see you've followed clojure.core/with-open as a template. (a) It's written way more defensively than I've found useful in my own macros (but, hey in the stdlib that's probably good), and (b) as amalloy clued me in too, you can get much nicer-reading recursive macros by just using `reduce` to build-up the recursive structure. (with-open may not do that because all the stdlib isn't defined yet)

19:37 mdeboard: but the Document instance you call .open against has to be the SAME document that you pass PdfCopy :P

19:38 dat stateful programming

19:38 llasram: noted

19:38 hiredman: you can also just define a recursive macro

19:39 (defmacro f [& xs] (if (seq xs) `(f ~@(rest xs)) 1))

19:42 which is what with-open does anyway, I'm not sure why you would advocate reduce over that

19:42 amalloy: mdeboard: you're double-evaluating the value part of the let-binding

19:43 seeing ~(bindings 1) twice is a huge red flag

19:43 mdeboard: I see

19:43 llasram: That's a bug, but I don't think what's causing the behavior mdeboard is seeing though...

19:44 amalloy: for sure it is

19:44 mdeboard: hell it might actually

19:44 yeah if it's calling .open on a different Document instance

19:44 damn I hate OOP so much sometimes.

19:45 so, should I do the conditional check inside the let binding then amalloy

19:45 amalloy: it's not at all clear why you even have the if-check there

19:45 mdeboard: defensive programming

19:45 sjl: Has someone shaved the "append trailing slashes and redirect" yak in Noir yet?

19:45 amalloy: those are words, not a reason

19:45 just try to call .open on it, and if it doesn't support .open that'll break

19:45 mdeboard: because I wanted to return a useful exception if someone tried to bind a symbol to an invalid piece ofdata

19:45 llasram: I must be missing something. The dup'd call is applying `pdf?` to the value and binding the let to the value, right? But the binding is what calls `.open`, so...

19:46 amalloy: yes, and ClassCastException is useful, whereas IllegalArgumentException is of questionable value

19:47 llasram: good point, it looks sorta like it should work

19:48 augustl: how do I pass a var pointing to a vector to a macro that takes a vector? Normally it's (with-redefs [foo bar] ...), I need (with-redefs my-vec ...), but it's erroring with "Don't know how to create ISeq from: clojure.lang.Symbol"

19:48 amalloy: but with such a serious problem as double-evaluating the value i wouldn't make any firm statements about it

19:49 * mdeboard is working on it

19:50 mdeboard: this is my first macro so it's kind of a brain bender

19:51 llasram: augustl: You can only get that kind of behavior in a macro. `with-redefs` is itself a macro, and requires a vector argument at macro-expansion time

19:51 mdeboard: s/so/and/

19:51 augustl: llasram: seems like a ~ solved it

19:52 llasram: augustl: Oh, so you were already writing a macro then :-)

19:52 augustl: and passing symbols too of course, so the vec is defined as ['foo bar] instead of [foo bar]

19:52 no I wasn't, I'm just calling it

19:52 so I'm kind of surprised :)

19:53 heh it also didn't actually work :)

19:54 llasram: I don't even -- what?:

19:54 augustl: so there's no way to pass a reference to a vector to a macro that expects an inline vector?

19:54 llasram: &(let [foo ['foo 1]] (with-redefs ~foo foo))

19:54 lazybot: ⇒ [foo 1]

19:54 llasram: wtf is that even doing?

19:54 augustl: :S

19:55 llasram: augustl: You can-ish, but only from another macro with is generating code which expands to with-redefs. When with-redefs gets expanded, its argument needs to be a literal vector

19:55 augustl: that's weird, because it's not working for me, I was just reading it wrong

19:55 llasram: s,with,which,

19:55 augustl: ah, I see

19:57 makes sense, I need to inject stuff macro expansion time, not runtime

19:57 amalloy: &'~foo

19:57 lazybot: ⇒ (clojure.core/unquote foo)

19:57 llasram: Exactly

19:57 amalloy: &(let [foo ['foo 1]] (with-redefs ~foo clojure.core/unquote))

19:57 lazybot: ⇒ [foo 1]

19:57 llasram: amalloy: I just figured that out :-) Fun times

19:58 amalloy: see also with-redefs-fn

20:00 augustl: is "?form" from https://github.com/marick/Midje/wiki/Setup%2C-Teardown%2C-and-State a special thing? The question mark, I mean. Or is it just a name?

20:01 technomancy: augustl: it's just a name, albeit a weird one

20:01 maybe a convention for logic variables?

20:02 llasram: The Midje documentation uses it in a few places to just indicate arbitrary user-provided values/forms

20:02 augustl: I see

20:03 llasram: Wait, I lied

20:04 augustl: the fact that midje tests are in macros is a pita some times..

20:04 llasram: It's a literal symbol which Midje considers special. But Midje is the thing considering the specific symbol `?form` special, not Clojure etc

20:04 augustl: that is, you need to know your way around macros, so if you don't (like me), midje tests can be a pita :)

20:05 llasram: Yeah, I've so far only used Midje with cascalog-midje, because the extra helpers are very nice. But I tried using it for regular code an quickly went back to just clojure.test

20:06 mdeboard: oh man I love cascalog-midje

20:06 amazing

20:06 augustl: yay, made it work using with-redefs-fn

21:15 gert: who should I contact if I suspect I found a vulnerability in Ring? weavejester?

21:15 weavejester: gert: Yep

21:15 gert: I made a simple lein project to illustrate something that may be a problem.

21:16 what's the best way of getting it to you?

21:16 weavejester: gert: A zip in an email, maybe?

21:17 gert: I've got the zip (well, tgz if that's ok). not your email though. Can I find that on github?

21:17 weavejester: gert: Yep, or you can have it here: jreeves@weavejester.com

21:17 gert: cheers! I'll get in touch.

21:25 atoi: Anyone in here use Riemann?

21:25 I know aphyr does, but I don't think he's about. :)

21:26 aphyr: I'm here

21:26 atoi: Oh! Nevermind!

21:26 It finally showed up.

21:26 gert: weavejester: you've got mail :)

21:26 atoi: I think rate works different than I thought.

21:26 aphyr: Take this to #riemann?

21:27 atoi: yes.

21:30 benedikt: Emacs + Clojure is really confusing.

21:30 gert: Emacs + anything is really confusing :)

21:31 benedikt: Clojure is the most confuisng adventure so far.

21:31 gert: what confuses you?

21:31 benedikt: I have two clojure interpreters

21:31 lein and clojure (ubuntu package)

21:32 i need a "project" to use clojure-jack-in, and i need lein to create a project to use with emacs

21:32 but then emacs proceeds to use the *other* clojure interpreter.

21:32 and it also seems to leave a tcp port open for the world

21:32 gert: you mean you need a project.clj for clojure-jack-in right?

21:33 benedikt: yes

21:33 gert: which is, clojure-jack-in relies on leiningen, which needs the project.clj

21:33 benedikt: right

21:33 but why doesnt it use the lein repl?

21:33 gert: it does - through slime/swank

21:34 benedikt: that, and the world readable port, is what confuses me

21:34 well no

21:34 gert: can you start a repl from outside of emacs?

21:34 benedikt: yes. as a matter of fact, two different ones

21:34 lein has 1.4 and the ubuntu package provided 1.3

21:34 and (clojure-version) inside emacs with slime/swank is 1.3

21:35 gert: in your project.clj, is there a dependency on clojure? does that say [org.clojure/clojure "1.4.0"] or 1.3.0?

21:35 benedikt: yup

21:35 so lein provides both 1.3 and 1.4?

21:35 gert: which one? :)

21:35 benedikt: 1.3 is in project.clj

21:36 which explains that part

21:36 gert: ah, that's why your clojure version is 1.3

21:36 benedikt: but i'm still not sure what binary is being used

21:36 gert: because you're asking for it :)

21:36 benedikt: sounds like it should be the lein one

21:36 gert: if you're on the commandline, you can type `lein classpath`

21:36 benedikt: its created with "lein new"

21:36 gert: that will show you what jars (including the clojure jar) leiningen is using

21:36 clojurebot: Roger.

21:37 benedikt: its downloded with maven, sure smells like clojure

21:37 gert: lein and slime/swank will happily use what you specify in your project.clj - your other (ubuntu provided) clojure has nothing to do with it

21:37 benedikt: hurr, lein.

21:37 so what about this word readable port

21:37 gert: yeah good point.

21:37 not sure

21:37 benedikt: can't i bind it to my localhost interface?

21:37 i'm not behind a NAT

21:38 so i feel sort of... naked.

21:38 gert: yeah i get that

21:38 amalloy: i think it does bind to localhost, doesn't it?

21:38 benedikt: nope

21:40 gert: looks like you're right benedikt. if I do 'lsof | grep IPv4 | grep java'

21:40 benedikt: yup

21:40 gert: I see TCP *:61521 (LISTEN)

21:41 benedikt: but this should be an issue with swank/slime, right?

21:41 i'm figuring out how this all is connected

21:41 now i can google

21:41 i'll report back with results

21:41 gert: I have results

21:41 Iceland_jack: good luck benedikt

21:41 gert: I just asked my workmate to telnet into my machine on that port

21:41 with great success

21:41 that's kinda bad eh :)

21:43 amalloy: is that supposed to happen?

21:43 amalloy: *shrug*

21:43 benedikt: gert: http://stackoverflow.com/questions/3747291/clojure-swank-server-opens-public-port

21:43 see the answer from Arthur Ulfeldt. I have only telneted to be port, not tried to connect with swank.

21:43 but since it's still there listening..

21:43 gert: yup

21:44 I'm connected. and it's still listening.

21:44 benedikt: sama here

21:44 same*

21:45 gert: and I can happily establish a telnet connection

21:45 benedikt: yeah same here. and according to the SO post, connecting with slime works too

21:46 gert: hm. that worries me.

21:47 Michal Marczyks comment on that SO post looks helpful

21:48 benedikt: mark Derricutt

21:48 Mark Derricutt posts about how to it with mavne

21:50 duck1123: hopefully, that port is blocked by your firewall anyway, but you can tell it the ip to listen on

21:51 gert: clojure-mode.el calls 'lein jack-in', and lein jack-in only accepts a port number, not an interface

21:51 s/interface/ip address/

21:51 benedikt: where is clojure-mode.el supposed to live?

21:51 weavejester_: gert: I got your mail. I don't think there's any way of exploiting it except via an XSS attack (which screws you anyway), but it's behavior that should be changed.

21:52 duck1123: you don't have to use jack-in, you can run swank other was

21:53 gert: cheers weavejester_. I'm creating my own SessionStore that won't allow it

21:53 duck1123: that's actually a bit surpising that jack-in defaults to 0.0.0.0, I can understand why swank would, but I'd think that jack in would limit that more

21:54 weavejester_: gert: I'm planning on fixing it tomorrow. I'm going to release Ring 1.1.2 then anyway.

21:54 gert: awesome!

21:57 duck1123: https://github.com/technomancy/swank-clojure/blob/master/lein-swank/src/leiningen/jack_in.clj says it's connecting to localhost.. hm.

21:57 cljr: does anyone know the policy on submitting posts to the mailing lists? I posted (or tried) to post a message today about my experiences using Clojure to develop a crowdfunding site for open source projects, but it seems to have been rejected. is plugging a site not allowed?

21:59 duck1123: cljr: if this was your first post, it may be in moderation, or did it say it was rejected?

22:00 That doesn't sound too spammy, people announce their stuff all the time

22:00 cljr: duck1123: yeah, most of the content was comparing languages

22:00 duck1123: never got a message that said it was rejected

22:00 duck1123: so it's probably just in the moderation queue

22:01 cljr: okay, that okay. i saw other posts had since gotten through to the list, didnt realize it was just first time users that had to go through approval

22:01 thats* okay rather

22:03 duck1123: I just recently got back from a user's group for a talk on clojure+android, but the speaker didn't know clojure very well. It was an interesting experience

22:03 cljr: ouch

22:03 duck1123: It's a shame there are so few clojure users in this area

22:03 cljr: what area is that?

22:03 duck1123: Detroit, MI

22:04 cljr: are there other large language communities there?

22:05 Frozenlock: Ok I know this is more a MongoDB than a clojure question, but hopefully some congomongo user will have an answer to this... Is there a way to make a "variable-capped-collection"? By that I mean that I want a maximum size for a given collection (say 1go), but I don't want to occupy a whole Go on my hard disk if I'm really only using 10k.

22:06 duck1123: there are plenty, it's just the detroit-clojure group never got going

22:06 eggsby: Frozenlock: usually I just use the mongo shell to set constraints on the collections

22:06 congomongo doesn't really provide much in terms of a configuration interface

22:06 Frozenlock: Oh, so I is possible to set an upper limit?

22:06 *it

22:07 eggsby: Frozenlock: http://www.mongodb.org/display/DOCS/Capped+Collections

22:07 duck1123: pre-allocated

22:08 Frozenlock: eggsby: Well yes, but I don't want to lock down unused space

22:08 Btw, you don't need to use the shell if you want to create a capped collection :)

22:08 (create-collection! "asdf" :capped true :size 10000....)

22:09 * Frozenlock just locked up 10go on his hard drive because he is a dumbass

22:10 duck1123: I wonder if you could build something that would auto-rotate to larger collections as space filled

22:10 probably more work than it's worth

22:12 Frozenlock: Smells really hacky. Could work, but could fail sooooo badly :P

22:14 duck1123: I guess it would really depend on if you already need the ability to manipulate collections. Are you creating a lot of these collections?

22:15 Frozenlock: I intend to create hundreds...

22:15 gfredericks: any guesses why my definition of permuto diverges? https://gist.github.com/3185823

22:15 Frozenlock: I was going to cap them at 1go, but I stopped immediatly when I saw it was eating my harddrive live.

22:15 *on nom nom nom*

22:18 dnolen: gfredericks: it's almost always the same, you program allows unground variables to grow.

22:19 gfredericks: appendo suffers from this problem as well.

22:19 gfredericks: dnolen: I was looking for that but couldn't see where :/

22:20 dnolen: gfredericks: I would compare your version against the one in core.logic

22:20 gfredericks: ha; I didn't know there was one :) thanks

22:22 dnolen: gfredericks: it's new :) it's in master

22:22 gfredericks: thank amalloy

22:22 * gfredericks checks master

22:23 * dnolen is getting really, really close to adding many new toys to core.logic

22:28 dnolen: gfredericks: I've got some ideas about how to deal with that, but that's probably slated for the next bigrelease - so time away.

22:28 not anytime soon I mean.

22:29 gfredericks: huh; so he deals with one element at a time while I tried two; but when I try to switch mine to work like his I get repeat results :)

22:30 amalloy: direct bug reports to dnolen: i implemented permuteo in a way he thought was ugly, so his version is the one in master; i just provided the idea

22:30 gfredericks: I haven't checked if the core.logic version also repeats

22:30 dnolen: amalloy: haha, no I didn't look at your version closely.

22:30 gfredericks: so it might just be a bug in my mimickery

22:30 dnolen: amalloy: I nearly always defer to existing Prolog versions so I can save my brain power for other things.

22:40 georgek: hi, I started doing 4Clojure and on 'count a sequence' my answer returned 'you tripped the alarm! count is bad!' even though I'm not using count, does anyone know what this means?

22:42 eggsby: georgek: the idea is to be able to solve it without using count

22:42 georgek: without counting at all that is, not just the 'count' fn?

22:42 eggsby: no, without using the count function

22:43 georgek: yes, I'm not using count, but my answer triggers the error still

22:43 eggsby: :O

22:43 georgek: am I missing something

22:43 eggsby: perhaps you are using something that uses count internally?

22:44 georgek: this was my (probably incorrect) answer, https://www.refheap.com/paste/3824

22:49 eggsby: georgek: for uses 'count' internall

22:50 georgek: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4088

22:51 you should be able to do it only using 'fn' and 'recur' fwiw

22:51 well, maybe some others, inc or + or w/e

22:51 georgek: thanks eggsby

22:51 I'm working on a different answer with looping now

22:52 eggsby: is this your first functional lang georgek ?

22:52 georgek: pretty much

22:53 eggsby: it's a heck of a shift, I came from python where everything was for .. in .. if .. else ..

22:53 georgek: ha

22:53 yes most of my experience is Python

22:54 eggsby: the early stuff in 4clojure, it's mostly solved by recursion until you can use the lang builtins, but getting a hang of stuff like reduce takes most people a while

22:54 amalloy: well, for is still great in clojure (better imo, but i'm not much of a python enthusiast)

22:55 eggsby: amalloy: yah, python has list comprehension as well, but I think clojure's is nicer (since you can have full power inside your comprehensions)

22:55 brehaut: for in clj is closer to a generator comprehension in python

22:56 dnolen: brehaut: really closer to Haskell list comprehensions given how fancy they are.

22:57 brehaut: dnolen: however not entirely relevant when making a comparison to something in python ;)

22:57 gfredericks: oh man there is a clojure coffee mug

22:58 eggsby: where do I get it gfredericks

22:58 gfredericks: http://www.zazzle.com/clojure_mug_i_get_more_done_when_im_lazy_v2-168060469711592507

22:58 I'm having a hard time not getting it

22:59 tmciver: gfredericks: cool! The text in the picture looks like crap though.

22:59 eggsby: ya, not sure what's up with that font

22:59 gfredericks: it is hipster

23:00 eggsby: dnolen: I enjoyed your core.logic talk posted on vimeo recently, if only I could find an excuse to use it at work...

23:00 technomancy: benedikt: swank hasn't defaulted to 0.0.0.0 in a really long time

23:00 but if you're confused I recommend starting at https://github.com/technomancy/clojure-mode/blob/master/doc/index.md and ignoring all OS-level clojure packages

23:01 gfredericks: dnolen: looks like clojure.core.logic/permuteo diverges as well (which is odd given the last thing I said about it); should I make a ticket in jira?

23:02 dnolen: huzzah!

23:02 288 commits later http://github.com/clojure/core.logic/compare/89fac76158...e6d5d2286e

23:02 cKanren extensions in master

23:02 gfredericks: oh snaps

23:02 dnolen: gfredericks: I'd rather you confirm that it's not issue in Prolog first.

23:03 gfredericks: divergence is a real problem, not easily solved.

23:03 gfredericks: in the nature of the system.

23:03 * gfredericks check

23:06 * gfredericks enlists brehaut

23:06 brehaut: what‽

23:07 gfredericks: kiwis: because they just have more energy at this time of the tomorrow.

23:08 * gfredericks gets ejected from the olympics

23:08 brehaut: haha

23:09 i have forgotten way too much prolog

23:09 gfredericks: brehaut says it halts in prolog

23:10 amalloy: gfredericks: can you test my impl of permuteo at http://stackoverflow.com/questions/11256242/solving-dinesmans-multiple-dwelling-example-using-clojures-core-logic-core-mat/11280559#11280559 ? i don't know what you're doing to check divergence

23:10 gfredericks: amalloy: (run 3 [q] (permuteo q [1 2]))

23:10 amalloy: but do it for me cause i'm too lame to do it myself?

23:11 gfredericks: :)

23:11 dnolen: gfredericks: I doubt that works in Prolog.

23:11 gfredericks: brehaut just tried http://www.dreamincode.net/code/snippet3411.htm

23:11 brehaut: dnolen: gfredericks have me a snippet of code he told me was equivalent, and i ran it for him

23:11 gfredericks: which looks equivalent to the core.logic code

23:12 dnolen: gfredericks: I think I used this, http://colin.barker.pagesperso-orange.fr/sands.htm

23:15 gfredericks: if you're going to open a ticket it should include the equivalent Prolog and better solution if actually exists.

23:16 gfredericks: chances are you can write the solution slightly differently only for it diverge with a different set of ground unground terms.

23:18 gfredericks: I just noticed the prolog versions don't seem to have the != constraint

23:18 hard to imagine that would make a difference

23:18 or at least this kind of difference

23:19 amalloy: fwiw gfredericks, my version doesn't diverge

23:19 (run 3 [q] (permuteo q [1 2])) ;; ((1 2) (2 1))

23:21 gfredericks: amalloy: and your rembero doesn't have the != either

23:21 dnolen: gfredericks: don't think != matters much here.

23:21 checking now

23:21 amalloy: well, mine is to remove *any one* x, not specifically the first x

23:21 gfredericks: right

23:21 amalloy: but it's slower

23:22 gfredericks: and the difference shouldn't matter when you're permuting a list of distinct things

23:22 dnolen: amalloy: does yours diverge for run 3 (permuteo [1 2] q)?

23:23 amalloy: dnolen: yes

23:23 dnolen: amalloy: as I suspected

23:23 anyways, I have some ideas to solve this issue - but it ain't happening anytime soon.

23:24 gfredericks: oh prolog diverges too when you reverse the args :D

23:25 man logic programming is hard

23:26 brehaut: lets go shopping

23:26 gfredericks: I want a new conso action figure

23:26 dnolen: thanks for the clarification

23:27 what is the X in CLP(X)?

23:27 integers up to 10? :)

23:55 Frozenlock: Seems I will not have other choices than to make my own maximum-size-collection function. Is there a way to obtain the size of a collection from congomongo?

Logging service provided by n01se.net