#clojure logs

2012-07-26

00:06amalloygert: no. deftype just defines a java type, which has no slot to store docs on
00:07gertthanks 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.
00:08amalloyout of curiosity, gert, what kind of seesionstore are you implementing?
00:10gertone 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.
00:10gertto mitigate attacks that tamper with the session id, and to prevent session fixation for example
00:11gertand we're storing our session map in a database
03:24wingy(Item/query) and (.query Item) is the same in cljs?
03:35amalloyno
03:35xumingmingv,(defn testit [asym] (var asym))
03:35clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
03:36xumingmingvwhat's wrong with this function definition?
03:36xumingmingvrepl tells me that asym cannt be resolved
03:37kralnamaste
03:41emezeske_xumingmingv: There's nothing wrong with your function definition; you're calling it with an argument that is not a var
03:42xumingmingvthe function defimition can not pass compilation
03:43emezeske_Oh! var is a special form apparently
03:43xumingmingvyeah, var is a special form
03:43xumingmingvthen?
03:43emezeske_Well anyway, asym is not a var
03:43xumingmingvso i can not write a function like this?
03:44emezeske_What are you trying to do?
04:04meenalHi
04:07meenalI would like to know if clojure-contrib is a right choice for handling exceptions in clojure.contrib.condition
04:07AWizzArdClojure Contrib is no more.
04:08meenalok. for exception handling, clojure provides a condition library
04:09meenalshould i go for it or just create class that extends java's Exception
04:10AWizzArdAs you wish, but I personally would typically try to avoid subclassing, if there is an easier way to do it in Clojure.
04:11meenalIf 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)?
04:11amalloy$google clojure slingshot exception
04:11lazybot[scgilardi/slingshot · GitHub] https://github.com/scgilardi/slingshot
04:12amalloy^ lets you throw maps and catch exceptions based on data contained in the map
04:14AWizzArdamalloy: yes good, that was the thing I wanted to name
04:14meenalok. thank u. I will have a look at slingshot
05:06tzarHow 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?
05:07tzarI'm thinking, list of functions which return transformation or nil, map over that list, then remove nils
05:17tzargot to run, will go with that approach for now
05:18clgv tzar: use keep isntead of map
05:32xumingmingvanyone have a look at this: http://stackoverflow.com/questions/11666364/clojure-compile-issue
05:36cemerickxumingmingv: answered
05:38xumingmingvactually what i want to return IS (var asym)
05:38xumingmingvwhat i really want to do is get the type hint of a function's param dynamically
05:39xumingmingvso here asym will be a function
05:39xumingmingvif i want to get the metadata of a function
05:39xumingmingvi need to use: (meta (var asym))
05:40cemerickoh, I see, asym is a symbol that names a var?
05:41cemerickIf so, use `resolve`: ##(meta (resolve '+))
05:41lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
05:41cemerickmeh
05:41cemerick,(meta (resolve '+))
05:41clojurebot{:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 920, :arglists ([] [x] [x y] [x y & more]), ...}
05:41cemerickxumingmingv: ^^
05:42xumingmingvhaha...resolve is bad...
05:42xumingmingvlazybot is more tough than clojurebot? :)
05:43cemerickyeah, just different sandbox rules.
06:01iDesperadOI 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...
06:02iDesperadOhow can i do that?
06:05zoldariDesperadO: so that's basically Eratosthenes Sieve?
06:05iDesperadOzoldar: yes
06:05iDesperadOzoldar: I'm implementing it
06:06iDesperadOzoldar: find I'm kinda lost in loop/recur
06:07zoldariDesperadO: 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
06:08iDesperadOzoldar: what i think is I have to filter the V many times...
06:08zoldariDesperadO: that's what iterate is suitable for
06:08zoldar,(doc iterate)
06:08clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
06:09iDesperadOha...exactly
06:10iDesperadOlet me try it
06:11seawordI'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?
06:13iDesperadOseaword: I'm afraid the first one is prefered, since a hash's key is itself a function...:)
06:14clgvseaword: for keywords use (:key m) for data use (m data). explicitely using get is possible as well (get m data)
06:14zoldariDesperadO: that's rather because keyword implements IFn
06:15seawordOk great, thanks guys. That clarifys it very nicely.
06:20iDesperadOzoldar: I'm afraid I still have to use loop/recur
06:21iDesperadO(iterate (partial cross-out p) V) ... I have to change p every iteration
06:21clgv iDesperadO: maybe you can use reduce then
06:22iDesperadOok, let me see
06:22clgvbut that only makes sense if you got some input.
06:22clgvdoess crossout change p?
06:23iDesperadOclgv: reduce is an accumulator
06:23clgvyeah, you could reduce over the p-collection
06:23clgvbut only if it is changed outside
06:24iDesperadO(defn cross-out [p coll] (filter (= 0 #(rem % p) coll)))
06:24clgvah prime-sieve?
06:24iDesperadOyeah
06:24iDesperadOI just want to filter V with my cross-out fn
06:25iDesperadObut here I have to change p every time
06:25clgvdo you want to do it on your own? otherwise there are already some clojure examples how to do that
06:26iDesperadOI want to do it my own
06:26iDesperadOnow 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))
06:27clgviDesperadO: I would indeed use recursion instead of iterate there
06:28iDesperadOso...just go back to the first...I said I'm lost in loop/recur
06:28iDesperadO:)
06:29clgvbecause lazy is no advantage for that task and you now exactly when you are finished (recursion base case)
06:30iDesperadOI just don't know how to use recursion(loop/recur) here
06:31iDesperadOclgv: I don't know how to stop
06:32iDesperadO(loop [p 2 coll (range 2 1000)] (if ...?
06:32clgviDesperadO: you can call cross-out recursively. (defn cross-out [p, numbers, primes] ...)
06:33clgvyou filter through numbers. the first element in numbers is your next prime. if numbers is empty you are done
06:33clgvyou have to add the next prime to primes.
06:34davidykayhey 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!
06:34zoldarThat's my failed attempt: (loop [[f & r] (range 2 1000)] (let [sieved (remove #(zero? (mod % f)) r)] (if (= sieved r) sieved (recur r))))
06:35zoldarahhh
06:35davidykayoh ho, "keyword" function. I'll try that
06:36clgviDesperadO: got it? detailed explanation would be the fn implementation ;)
06:36ro_stanyone using airbrake?
06:38iDesperadOclgv: ....sorry no
06:39iDesperadOclgv: still don't get it
06:39clgviDesperadO: you have to separate identified primes and numbers that remain to be filtered. if no numbers remain to be filtered you are done
06:41iDesperadOso in your (cross-out numbers primes) for numbers it's (range 2 n), and primes is primes identified and added to it?
06:41iDesperadOand when numbers is empty, we got primes as the result?
06:43iDesperadOThis is just an expression of the algorithm. I just don't know how to filter numbers repeatedly with different parameter
06:44iDesperadOzoldar: so... you got it?
06:45zoldar,(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))))
06:45clojurebot[2 3 5 7 11 ...]
06:45zoldarreally clunky
06:46clgviDesperadO: you can simply call (recur (first filtered-numbers), filtered-numbers, (conj primes (first filtered-numbers)))
06:47iDesperadOzoldar: can't understand your solution
06:48iDesperadOclgv: let me try with loop/recur
06:48clgviDesperadO: you dont need loop necessarily.
06:48iDesperadOclgv: ah
06:49clgvyou can also call the function tail recursively
06:49iDesperadOclgv: I'm afraid recur is most mysterious function for me
06:50clgviDesperadO: (defn f [p, primes, numbers] (if ... ... (recur p*, primes*, numbers*)) -> recur just calls f recursively in a non stack consuming way
06:50clgvit is a special form - no function
07:41iDesperadOzoldar: 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???
07:41lazybotiDesperadO: How could that be wrong?
07:42iDesperadOanybody here?
07:44clgviDesperadO: what error do you encounter?
07:45clgviDesperadO: ah lol. (rem x x) => 0
07:45clgviDesperadO: that's why I told you to split into a numbers coll and a primes coll
07:45iDesperadOClassCastException clojure.lang.PersistentVector cannot be cast to java.lang.Number clojure.lang.Numbers.add (Numbers.java:126
07:46clgvdidnt see that one
07:48clgv&(map #(rem % %) (range 2 10))
07:48lazybot⇒ (0 0 0 0 0 0 0 0)
07:50iDesperadOclgv: I didn't do #(rem % %) I do (rem % p)...
07:51clgviDesperadO: yes but p is in coll. hence you will remove all numbers from coll: primes and non-primes
07:52clgviDesperadO: so you always return an empty coll
07:55iDesperadO....
07:55clgviDesperadO: 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
07:57iDesperadOclgv: since I don't know how to get the prime
07:58clgvclgv: you filter coll with the prime 2. the first number in the resulting coll is prime - in this case 3
08:05xumingmingva silly question, what is a symbol(clojure.lang.Symbol), when do we have to touch directly?
08:05clgvxumingmingv: can you be more specific?
08:05antares_xumingmingv: when you need to pass a function by name, for example: (map my-fn v)
08:05antares_also when you are writing a macro
08:06antares_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)
08:06clgvimplicitly: every time you name anything - the reader stores those names as symbols
08:06xumingmingv,(defn x [] 1) (symbol? x)
08:06clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
08:07xumingmingvhit the 'SANBOX DENIED" again...
08:07clgv&(symbol? 'x)
08:07lazybot⇒ true
08:07xumingmingvI tried in my laptop
08:07clgv&(symbol? 'bla.blubb/x)
08:07lazybot⇒ true
08:07xumingmingv&(defn x [] 1) (symbol? x)
08:07lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
08:07clgvI quoted the names since otherwise the reader would try to resolve them
08:08clgvxumingmingv: x will be resolved to that function in this case
08:08clgvxumingmingv: you can check that: (defn x [] 1) (fn? x)
08:09xumingmingvah, I understand
08:10xumingmingvso (symbol? 'x) is right command to try
08:10xumingmingv(symbol? x) returns false, what is the 'x' here?
08:12xumingmingvoh, it is a clojure.lang.Fn
08:13xumingmingvthanks clgv, antares_ !
08:13antares_xumingmingv: that's because x is evaluated
08:13antares_xumingmingv: (symbol? 'x)
08:13antares_,(symbol? 'x)
08:13clojurebottrue
08:13clgvxumingmingv: (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
08:14clgvoh no. reading is fine - evaling is the point ^^
08:15xumingmingvmuch clear, thanks
08:24xumingmingvclgv, antares_, what is a function param? is it a symbol, or var? or something else?
08:24xumingmingvI mean y in (defn x [y] y)
08:26clgvxumingmingv: a local binding
08:26clgvsimilar to the ones defined in let
08:26xumingmingva local binding is a totally different thing from symbol or var?
08:27antares_xumingmingv: y is a symbol but it evaluates to a local (or local binding)
08:27xumingmingvwhat is it class? like clojure.lang.Symbol for symbol
08:27antares_xumingmingv: symbol is just a name
08:27clgvxumingmingv: on compilation it is a symbol. at runtime it is the name for a value
08:27antares_what it evaluates to can be anything
08:35harjaiDesperadO: how about https://gist.github.com/3181751 at least the first 1000 are correct :)
08:36harjathat was without loop...recur
08:41xumingmingvantares_: 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
08:41antares_xumingmingv: to a local
08:41antares_vars are namespace-global
08:41antares_locals are local to the function
08:42antares_if a local and a var happen to have the same name, local takes precedence
08:42antares_that is called "shadowing" and it generally should be avoided
08:43antares_it is not different from a lot of other languages
08:44xumingmingvbut in other language like java, if a method can accept anything no matter it is a local variable or a global variable
08:44xumingmingvbut the special form only accept var, and not local
08:44xumingmingvbut the special form 'var' only accept var, not local
08:45iDesperadOharja: it's so slow
08:45harjawell that's kind of a given thing since there is no optimizations goin on there
08:48harjayou 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)
08:50harjaI thought that the original question was that is that sieve doable without loop...recur
08:50iDesperadOok
08:51iDesperadOharja: I'm kinda still trying to understand your solution
08:52iDesperadOharja: is it reduce supposed to return only a value? now it seems it return a sequence
08:54harjaYes, every step returns a value. The value we return is a sequence.
08:55harjaand that returned value gets fed up to the next function call with the next value from the sequence we are reducing
08:55harjaso, we are not feeding the actual values as the source sequence, but the filtering values instead
08:55harjaand the value we return from reduce is the list that was filtered with the given value
08:56iDesperadO(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
08:56harjayes
08:57harjabut sequence is a value, it's just something we get as a parameter to our next reduce step
08:57cemerickFYI: 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/
08:57clgvcemerick: when will you publish the results?
08:57cemerickclgv: sometime next week
08:58harjaSo, 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
08:59harjaBtw, I got the execution time to less than half if we assume an ordering in the incoming sequence
08:59harjajust replace apply max value as (first value) or (last value) depending on the order you assume to get the stuff in
09:00ro_stany of you guys use Airbrake?
09:03antares_by the way, anybody going to http://amsclj.nl/october.htm? I'm thinking of submitting a talk
09:10harjaiDesperadO: Check out the gist again. I added three different versions with different assumptions on the data and the timing information on them
09:10harjaso, there are some differences :)
09:15iDesperadOharja: (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
09:16iDesperadO (defn cross-out [p coll] (filter #(and (> % p) (not (zero? (rem % p)))) coll))
09:16harjaiDesperadO: Yes, it assumes that a number is not a multiple of itselt
09:16harjait's just a matter of definition :)
09:16iDesperadO(cross-out 2 [1 2 3 4 5 6 7 8 9 10 11 12]) returns (3 5 7 9 11)
09:17harjayes, but the way the filtering is done that was easier to do
09:17harjaand basically it just boils down to how is "n is a multiple of m" defined
09:18harjaI bent the rules a bit there to make it more convenient to implement
09:19iDesperadOharja: i'm thinking about why my cross-out function returns the result not containing 2...
09:19clgviDesperadO: thats because of ##(rem 2 2)
09:19lazybot⇒ 0
09:19craigbrowow
09:19ro_stsuch a pity you can't wrap enfocus transformation groups with let forms
09:19craigbrothink I found bug in clojure.string/replace
09:20iDesperadO:(
09:20craigbro,(clojure.string/replace "/paths/%5c44WINDOW" #"(?:%[0-9A-Fa-f]{2})+" "\\")
09:20clojurebot#<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 1>
09:20iDesperadOclgv: I've already specified that (> % p) % have to be greater than p
09:22clgvthats what excludes 2
09:23clgvboth in fact^^
09:24locojay1hi , how can i use twitter bootstrap function with jayq. (.toolip $( :#myid) (clj->js {:placement :left})) does not work
09:26clgviDesperadO: change it to (or (= % p) (-> % (rem p) zero? not)) to keep p in there
09:28iDesperadOharja: I still don't know why (primes-XXX) functions return a sequence
09:28iDesperadOclgv: ok
09:30harjawell, it returns whatever reduce returns?
09:30harjaand since we build a sequence in the reduce phase, it's what comes out
09:30clgviDesperadO: 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
09:31iDesperadOah...
09:32harjaPlaying around in the REPL is the easiest way to go with these things. Just put in stuff and see what comes out :)
09:33harjaBut, got to go away now. Bye!
09:33iDesperadOharja: thanks
09:33iDesperadOI'm eval all the way to repl...
09:33iDesperadOonly to find it errs back
09:34eduardhow to see Locals in backtrace? Emacs, swank-clojure 1.4.4, clojure-jack-in
09:35clgviDesperadO: try to develop small functions step by step testing them in repl while developing
09:36iDesperadOok
09:37ro_steduard: you only see em when you breakpoint. put (swank.core/break) somewhere and run your code
09:37ro_stall the locals at that point will appear
09:37eduardro_st, Thanks, will try
09:38ro_stwhen debugging, i usually bind everything into a let and put just the break and the return in the body
09:38iDesperadOclgv: thanks a lot
09:40iDesperadOclgv: sometimes I find after I read the doc of a function/special form, I don't get better understanding with it
09:40iDesperadOlike reduce
09:40iDesperadOyou said I can build anything with reduce
09:40eduardro_st, Is there another way? I don't need breakpoint, I want to find out what arguments function was called with.
09:41iDesperadOso I tried (reduce cons (range 1 5))
09:41ro_steduard: then drop a swank.core/break in at the top of the fn body
09:41ro_stas the args are locals in that lexical scope, they'll show up at that breakpoint
09:41clgviDesperadO: did you read any introductory book on clojure?
09:41ro_styou don't need to let-bind them
09:42clgv&(reduce cons '() (range 1 5))
09:42lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
09:42clgv&(reduce conj [] (range 1 5))
09:42lazybot⇒ [1 2 3 4]
09:43iDesperadOwhich book you recommend?
09:43iDesperadOclojure programming?
09:43clgvcons has a different argument order than reduce expect. so you would need to write the reduce like ##(reduce #(cons %2 %1) '() (range 1 5))
09:43lazybot⇒ (4 3 2 1)
09:44clgviDesperadO: I can't recommend what I didnt read. It's the most recent book, though
09:44iDesperadOso just recommend what you've read, maybe?
09:44iDesperadO:)
09:45iDesperadOclgv: how do i know the argument order that reduce expects?
09:45clgviDesperadO: "Programming Clojure" 1st edition. there is a 2nd edition out now. and "Joy of Clojure"
09:46iDesperadOclgv: sadly I've read all of them...though very quickly
09:46iDesperadOseems I didn't get anything out of those books
09:46craigbrohmm
09:46craigbroactually, I think it's a bug in clout
09:46clgviDesperadO: humm thats sad but happens
09:46craigbroas in, clout needs to quote the decoded value
09:47cshellClojure Programming is the best, in my opinion
09:47iDesperadOI guess I just need to write more
09:48iDesperadOto be specific, how can i find the arguments order that reduce expect?
09:48iDesperadOwhy cons is not suitable while conj is
09:48clgv,(doc reduce)
09:48clojurebot"([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...
09:49iDesperadO(conj coll x) (cons x coll)
09:49clgvexactly
09:49iDesperadOthis is the different..I've doced them to choose cons for reduce
09:50clgvthe first param is the previous result or initial value and the second param is the current value from the collection
09:50iDesperadOand (reduce f coll)
09:50iDesperadOor (reduce f val coll)
09:50iDesperadOsubstitute f with cons...
09:51iDesperadOi get (reduce cons val coll) which I seems fit with cons,not conj
09:51iDesperadOso ?
09:51clgviDesperadO: it is (reduce (fn [coll, val] (conj coll val)) [] (range 10))
09:52iDesperadOclgv: still here?
09:53clgvyeah
09:54iDesperadO...
09:56iDesperadOclgv: not receiving my message?
09:56cshellhe was responding to you
09:56cshell<clgv> iDesperadO: it is (reduce (fn [coll, val] (conj coll val)) [] (range 10))
09:57iDesperadOah...I've missed all his messages
09:58iDesperadObut the doc said clojure.core/reduce ([f coll] [f val coll])
09:59iDesperadOval comes before the coll
09:59clgviDesperadO: thats the signature of reduce. the signature of the function f is described in the text
10:00babilenDoes anybody know if/when clojuredocs.org will be upgraded to 1.4?
10:01iDesperadO If val is supplied, returns the
10:01iDesperadO result of applying f to val and the first item in coll, then
10:01iDesperadO applying f to that result and the 2nd item, etc. If coll contains no
10:01iDesperadO items, returns val and f is not called.
10:02iDesperadOclgv: I can't see what's described in the doc that's said the parameters order of f
10:03iDesperadO(source reduce) shows ...(clojure.core.protocols/coll-reduce coll f val)))
10:04joly,(reduce - 0 '(1 2 3 4))
10:04clojurebot-10
10:05clgviDesperadO: 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:07iDesperadOclgv: so with f being cons/conj?
10:08joly,(reduce #(conj %1 (+ (last %1) %2)) '(1 2 3 4))
10:08clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
10:08joly,(reduce #(conj %1 (+ (last %1) %2)) [] '(1 2 3 4))
10:08clojurebot#<NullPointerException java.lang.NullPointerException>
10:08joly...
10:09iDesperadO,(reduce conj [] (range 1 5))
10:09clojurebot[1 2 3 4]
10:09joly,(reduce #(conj %1 (+ (last %1) %2)) [1] '(2 3 4))
10:09clojurebot[1 3 6 10]
10:09iDesperadO,(reduce cons 1 (range 2 5))
10:09clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
10:12clgv&(reduce #(cons %2 %1) '() (range 1 5))
10:12lazybot⇒ (4 3 2 1)
10:12iDespera1Oclgv: I lost my connection
10:12iDespera1O....:(
10:12iDespera1Otwice
10:12clgv&(reduce #(cons %2 %1) '() (range 1 5))
10:12lazybot⇒ (4 3 2 1)
10:13iDespera1O,(reduce cons 1 (range 2 5)
10:13clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
10:13iDespera1O,(reduce conj [] (range 1 5))
10:13clojurebot[1 2 3 4]
10:14iDespera1O(reduce cons 1 (range 2 5) not supposed to produce [1 2 3 4]?
10:14jolywith 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:14xumingmingvwhat does reify create? in bytecode level. a class?
10:15iDespera1Ojoly: (cons x seq)
10:15iDespera1Othe second is the collection
10:15clgvxumingmingv: an anonymous class from your perspective and an instance of it
10:15iDespera1Oand I didn't see your example
10:15jolyiDespera1O: yes, I mean in this reduce case
10:15iDespera1Ocan you show me again?
10:16iDespera1OI lost my connection twice
10:16joly,(reduce #(conj %1 (+ (last %1) %2)) [1] '(2 3 4))
10:16clojurebot[1 3 6 10]
10:16jolyin retrospect, I'm not sure it's very clear
10:17iDesperadOclgv: &(reduce #(cons %2 %1) '() (range 1 5))
10:18iDesperadOthis just show I have to change the parameters order, but why? it's not clear
10:18iDesperadO&(reduce #(cons %2 %1) '() (range 1 5))
10:18lazybot⇒ (4 3 2 1)
10:18clgviDesperadO: because of ##(doc cons)
10:18lazybot⇒ "([x seq]); Returns a new seq where x is the first element and seq is the rest."
10:19jolyconj has the arguments in the opposite order (collection, then element)
10:19iDesperadO....sigh
10:21iDesperadOI 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:21lazybot⇒ "([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:22dnoleniDesperadO: cons is actually an exception. conj follows the standard library pattern - collection fns take the cllection as the first arg.
10:22cshellI don't use cons in Clojure
10:23cshelluse conj
10:23iDesperadOdnolen: ah...this explaination sounds acceptable
10:23cshellcons is expensive and takes a lot of time
10:23dnoleniDesperadO: usage of cons outside of lazy-seqs is not very idiomatic.
10:23dnolencshell: ? that's not true.
10:24cshellWell, 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:24iDesperadOcshell: why cons is expensive?
10:24dnoleniDesperadO: it is not.
10:24iDesperadOcshell said cons is expensive
10:24dnoleniDesperadO: which doesn't make it true :)
10:25gtrakcons is a single object allocation and a couple of call stack frames if memory serves me right
10:25iDesperadOcons (fn* ^:static cons [x seq] (. clojure.lang.RT (cons x seq))))
10:25cshellin my experience, it was, but I might have been doing something wrong with the underlying sequence
10:25iDesperadO(defn cons (fn* ^:static cons [x seq] (. clojure.lang.RT (cons x seq))))
10:26clgv(inc dnolen)
10:26lazybot⇒ 6
10:26clgv$karma dnolen
10:26lazybotdnolen has karma 6.
10:26clgv$karma cshell
10:26lazybotcshell has karma 0.
10:26gtrakhah
10:26clgv;)
10:27gtrakiDesperadO: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L532
10:27cshellI wonder if it was because I was using a vector
10:28gtrakit looks like it seqs a vector
10:28gtrakis that slow?
10:28dnolencshell: probably.
10:29cshelllists 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:29cshelln
10:29gtrakdon't believe that's the case, but it does have to add a cons cell in the front
10:29iDesperadOlist is quick to do the action on the lfe, while vector is quick on the right
10:30dnolencshell: it will call seq on the vector and cons onto that.
10:30dnolen,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))
10:30clojurebot"Elapsed time: 440.266025 msecs"
10:30dnolen,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))
10:30clojurebot"Elapsed time: 964.152597 msecs"
10:30dnolen,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))
10:30clojurebot"Elapsed time: 986.073162 msecs"
10:30gtrakumm
10:30dnolennot sure if GC is an issue with clojurebot, but that takes ~100ms on my machine.
10:30gtrakwhy is it twice as slow the second/third time?
10:31dnolengtrak: GC
10:31gtrakthen it should at least be irregular
10:31dnolen,(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))
10:31clojurebot"Elapsed time: 545.066794 msecs"
10:31dnolengtrak: there you go.
10:32gtrak&(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))
10:32lazybot⇒ "Elapsed time: 1269.220924 msecs" nil
10:32gtrak&(time (dotimes [_ 1] (reduce #(cons %2 %1) () (range 1000000))))
10:32lazybot⇒ "Elapsed time: 1195.433891 msecs" nil
10:32iDesperadO...cons just some new functions called...so I think cons won't be expensive...
10:33iDesperadO.......tired, time to go home
10:33cshellIf 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:33gtrakdoes seqing a vector change its lookup characteristics?
10:34iDesperadOthank you very much clgv, dnolen cshell and other guys:)
10:34cshellI just added confusion ;)
10:34iDesperadOit helps:)
10:35cshellif 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:36gtrak,(class (seq [1 2 3 4 5]))
10:36clojurebotclojure.lang.PersistentVector$ChunkedSeq
10:36cshellso I wonder if that's why my performance was really bad - not on the cons itself but on the subsequent random access
10:36gtrakcshell: at any rate there's a better solution, stick with vectors the whole way through
10:37cshellthat's what i ended up doing, but using conj to add to the end
10:37cshell,(class (cons 1 [2 3]))
10:37clojurebotclojure.lang.Cons
10:37gtraklooks like PersistentVector.ChunkedSeq doesn't have a shortcut for nth?
10:37cshell,(class (conj [1 2] 3))
10:37clojurebotclojure.lang.PersistentVector
10:38gtrak,(class (rest (cons 1 [2 3]) 2))
10:38clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$rest>
10:38gtrak,(class (rest (cons 1 [2 3])))
10:38clojurebotclojure.lang.PersistentVector$ChunkedSeq
10:40gtrakit probably could but it probably just makes more sense to stick to vectors
10:41cshellYeah, 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:41csheller, structure even
10:41gtrakrandom access on a linkedlist is never a good thing
10:42gtrakI don't think that's very surprising
10:42cshellah okay, next time I'll be more explicit :)
10:45gtrakdoes persistentvector have similar cache-locality as arraylist?
10:50vijaykiranseanm:
11:01CheironHi, 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:02Cheironis it an idiomatic functional technique?
11:06llasramCheiron: If I'm understanding you properly, then 100% :-)
11:07llasramCheiron: There's even `letfn` for making defining local functions more concise, for when all you need the `let` form for is functions
11:08Cheironllasram: so I'm on the road of true Clojure? :)
11:08stainare these functions you call multiple places?
11:09llasramWe 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:10llasramAaaaanyway, it's a common technique in any language with real lambdas.
11:10duck1123`def lines in places other than top level bug me, but it's not really "wrong"
11:12Cheironstain: no
11:13stainare they long?
11:13llasramduck1123`: I end up having them w/in a top-level `let` sometimes, but even that feel subtly off sometimes
11:13Cheironstain: no, two or three lines
11:13stainI 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:20S11001001stain: use what looks pretty; hard and fast rules will lead you astray
11:20S11001001the code should be pretty
11:20stainthat's a good guide!
11:22stainso 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:36S11001001I 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:39stainhehehehhe
11:57holohi
12:00holoin 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:02seancorfieldit's listed here https://github.com/clojure/java.jdbc/
12:02seancorfieldalso, 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:02solussdAnyone have any ideas why compiling this ns declaration results in "Parameter declaration set should be a vector"? https://www.refheap.com/paste/9c66f4664ba2c7cf28a494fa7
12:03duck11231 For things in central, mvnrepository is good. http://mvnrepository.com/artifact/org.clojure/java.jdbc for others, check clojars
12:03seancorfield0.2.3 is the more recent release of java.jdbc btw holo
12:03holoseancorfield, the connection-uri is really not in 0.2.3 version right?
12:04wmealingseancorfield, going to take a stab at it
12:04wmealingbut..
12:04holoduck11231, nice tip. thanks
12:04wmealingi think that the second line in requires.
12:04wmealingshould be using a vector, not a list
12:04wmealing[ not (
12:04wmealingsorry, not list.
12:04seancorfieldholo: sure it is - that was committed on jun 13th - 0.2.3 was released on jun 18th
12:04seancorfieldlook at the commit history in github
12:05seancorfieldsolussd: that second line in the :require is a ( ) but should be [ ]
12:05wmealingsorry, wrong person
12:05wmealingwhat sean said.
12:05seancorfield:)
12:05wmealingits late here..
12:06seancorfieldit's early here
12:06solussdseancorfield: actually, that works fine- turns out it was a bad 'defn' in one of the namespaces I was requiring.
12:06solussdthanks
12:06seancorfieldah, good to know solussd
12:07seancorfieldi guess if you'd pastebin'd the stack trace, we'd have spotted that :)
12:07wmealingdidnt know you could put it like that. today i learned.
12:08seancorfieldi've been tidying up my ns declarations recently to have only one :require and one :import (if needed)
12:08seancorfieldbut 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:09seancorfieldand i like being able to just :refer certain vars instead of just setting up an :as alias
12:09duck11231I've been through every combination of () and [] in ns forms. Now I'm strictly []
12:09technomancythat's not right
12:09technomancyimport should use ()
12:09hiredmanimports should be in (), everything else in []
12:10seancorfieldthe confusion is because the compiler allows ( ) and [ ] interchangeably - bug!
12:11technomancythe compiler also allows you to indent with seven spaces instead of two
12:11technomancyheck, it even allows the use of tabs in indentation!
12:13burtI 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:13burtHow do I do that?
12:14S11001001burt: map with 3 args and (range)
12:15burtS11001001: I don't follow
12:15duck11231,(doc map-indexed)
12:15clojurebot"([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:15S11001001oh yeah, forgot about that duck11231
12:17duck11231,(map-indexed (fn [i v] (conj v i)) '([:a :b] [:c :d] [:e :f]))
12:17clojurebot([:a :b 0] [:c :d 1] [:e :f 2])
12:17burtduck11231: thanks
12:17duck11231well, that didn't work, but you get the idea
12:20seancorfield,(map-indexed (fn [i v] (into [i] v)) '([:a :b] [:c :d] [:e :f]))
12:20clojurebot([0 :a :b] [1 :c :d] [2 :e :f])
12:20seancorfieldnot sure how (in)efficient that is tho'...
12:20seancorfieldadding to the front of vectors isn't terribly efficient, right?
12:21burtseancorfield: im cons'ing onto the front of them
12:22holoseancorfield, 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:22burti know it's not as efficient, but it needs to be the front -- im manipulating CSV
12:27S11001001burt: do they have to be vectors?
12:35seancorfieldholo: you missed :connection-uri - it's there
12:36seancorfieldhttp://clojure.github.com/java.jdbc/#clojure.java.jdbc/with-connection
12:37seancorfieldyou can see it here http://grab.by/eZUA
12:38seancorfieldburt: cons'ing on the front of lists is efficient (and (cons i some-vec) will turn it into a list)
12:41holoseancorfield, 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:41seancorfieldmy screenshot shows i used doc to display that
12:42scriptorholo: (clojure.repl/doc …) to be more specific
12:42seancorfieldare you sure you don't have a much older version of java.jdbc loaded?
12:44seancorfieldthe docstring you see was current in 0.2.2 or possibly early 0.2.3-SNAPSHOT builds
12:49mdeboard&(doc send-off)
12:49mdeboard,(doc send-off)
12:50clojurebot"([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:50mdeboardDoes `state-of-agent' mean a reference to the agent at a particular point in time?
12:53jolymdeboard: state-of-agent is what is returned when you deref the agent
12:53joly,@(agent "test")
12:53clojurebot"test"
12:53mdeboardI gotcha
12:53mdeboardjust wanted to be sure
12:59lpetitAny CCW user right there ?
12:59lpetitHello, btw :)
12:59clgvlpetit: here ^^
12:59lpetitclgv: hi :)
12:59clgvhi
12:59lpetitclgv: are you currently using the beta software update site channel?
13:00clgvlpetit: no, not at work
13:00lpetitclgv: and at home?
13:00clgvI have a beta installation
13:00clgvdo you have 0.10.0 - beta out?
13:00lpetitI'll release in a few minutes a new beta, with hippie completion.
13:01clgv"hippie completion"?
13:01lpetitclgv: Oh, there has been several beta released, with increasingly good (IMHO ;) ) code completion support
13:01clgv"hippie completion" = "code completion"?
13:01lpetitclgv: there was what I'm calling "repl-completion", which is based on dynamic introspection. This has been increased in the past few weeks
13:02Horofoxwhat's the clojure's equivalent of ruby's irb?
13:02lpetitclgv: and now I've added "hippie completion": https://t.co/NgU3rq34
13:02technomancylpetit: in emacs hippie completion means it gets completion from a variety of sources; is yours the same?
13:02lpetitin a nutshell: uses symbols/keywords found in current file
13:03lpetittechnomancy: 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:03technomancyhuh, you had to implement that yourself?
13:03clgvgood. so we are getting closer to completion for everything required/used?
13:03lpetittechnomancy, clgv: it's just a first version, before going on holidays. Suggestions welcome
13:04lpetitclgv: completion for everything required/used is there since ~ 2 weeks in beta, and it's dynamic (needs a running REPL)
13:04zerokarmaleftHorofox: you can get a basic repl with `lein repl`
13:04lpetitclgv: 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:04metellusassuming you're using lein (you should be using lein)
13:05clgvlpetit: 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:05lpetitclgv: someday ...
13:06mdeboardWhat's the Java equiv of C#'s "MemoryStream" class?
13:06technomancymdeboard: a stream coming from in-memory bytes?
13:06technomancywould be a ByteArrayInputStream
13:06mdeboardor, alternatively, i ther'es a clojure abstraction
13:06technomancyor OutputStream
13:07lpetitclgv: 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:07mdeboardI see
13:07semperosdnolen: where does this 'verify' get defined? https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L148
13:07clgvlpetit: yeah thats good. I just wanted to know if it is wanted at all ;)
13:08lpetitclgv: needs more hammock time :
13:08lpetit:)
13:08mdeboardtechnomancy: I see
13:09clgvlpetit: ah right - hammock-driven development ^^
13:09meenalHi, 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:09lpetitMan, 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:09jkkramerlpetit: congrats on ccw, it's really great. I tried out 0.9 and am actually tempted to switch from emacs
13:10semperosnm, I see it now, parameter to the Substitutions ctor...
13:11seancorfieldholo: did you resolve your java.jdbc issue?
13:11lpetitjkkramer: 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:11meenalBasically, 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:12lpetitjkkramer: 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:12technomancymeenal: look at ex-info in clojure 1.4
13:12technomancyit's a subset of what slingshot offers
13:12technomancyof 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:13jkkramerlpetit: sure. i'll try switching for a few days soon and will take notes as I encounter issues
13:13technomancymeenal: slingshot offers a much nicer way to catch exceptions
13:13technomancybut you don't need it to throw
13:13lpetitjkkramer: thanks. I for sure know there are big missing holes, but I'm not quite sure what the most annoying ones are.
13:14jkkramerlpetit: 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:14lpetitjkkramer: I'll be on holidays, but you can usually find cemerick on the clojure or ccw IRC channels
13:14jkkramerok
13:14mdeboardThis 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:14lpetitjkkramer: ok
13:15lpetitjkkramer: I want a report on my laptop by the end of my holidays ! :-D
13:15jkkramerlpetit: i'll see what i can do ;)
13:15lpetitjust kidding
13:17dnolensemperos: that's how disequality constraints work in master - that will be changing soon.
13:17dnolensemperos: are you just curious about the implementation details?
13:17lpetitclgv: 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:17semperosI'm working on the custom unification for my record, following the whole flow to learn how everything works together
13:18mdeboardguess I'll just call new against java.io.OutputStream and use htat
13:19clgvlpetit: I cant tell either ;)
13:21meenalthank u, technomancy. I will take a look at ex-info and seek ur advice if i have any questions
13:23XPheriorSo.. About Sandbar. It uses sessions to keep track of who's logged in. Isn't it bad practice to use sessions for that?
13:24technomancyis sandbar still maintained?
13:24XPheriortechnomancy: Now that I glance at it, not really. What're people using for a login systems nowadays?
13:24dnolensemperos: 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:25technomancyXPherior: friend looks promising
13:25dnolensemperos: actually it's not true that it's not related to unification, but again it's a implementation detail that's changing.
13:25XPheriortechnomancy: Thanks. I'll have a peek. :)
13:25semperosgotcha; was looking at how unify-terms dispatches on lvar, and chained my way back up to it
13:26dnolensemperos: yeah assume it's the identity fn in your reading.
13:26semperosdnolen: makes sense
13:27mdeboardJava 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:28dakronemdeboard: http://clojuredocs.org/clojure_core/clojure.java.io/output-stream
13:28mdeboarddakrone: Yeah, but I am not sure what arg I should be passing to that fn
13:28mdeboardand `(partial output-stream)' throws an exception
13:28dakrone"Default implementations are defined for OutputStream, File, URI, URL, Socket, and String arguments."
13:29dakroneso any of those
13:30mdeboardliterally `(output-stream java.io.OutputStream)'? I tried that, as well as `(output-stream (new java.io.OutputStream))', I think I'm confused.
13:31mdeboard(I'm new to the java interop part of clojure)
13:31llasrammdeboard: Try `(output-stream "my-delightful-output-file-name")`
13:33llasrammdeboard: 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:34mdeboardI see. I think I accidentally didn't listen to technomancy when he said I want a ByteArrayInputStream
13:34llasramOh, geez -- always listen to technomancy
13:35llasramAynway :-), if you need a ByteArrayInputStream or ByteArrayOutputStream, then you do need to construct it yourself w/ interop
13:36llasram$(java.io.ByteArrayOutputStream.)
13:36llasram.r
13:36llasramMan, home row
13:36llasram&(java.io.ByteArrayOutputStream.)
13:36llasramOh, lazybot dead?
13:36llasram,(java.io.ByteArrayOutputStream.)
13:37clojurebot#<ByteArrayOutputStream >
13:37llasramAnyway, you get the gist
13:37mdeboardActually, wrong, I do need OutputStream since that's what this Java method's signature requires
13:37llasramByteArrayOutputStream is a subclass of OutputStream, so you can use it anywhere where the type signature requires the superclass
13:38llasramInheritance-based polymorphism may be rife with peril, but it's what you get in Java interop
13:39mdeboardI 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:39mdeboardthat is, I'm rewriting in Clojure, it doesn't use a 3rd party lib written in Clojure
13:39llasramGotcha :-)
13:40mdeboardaha look at that, ByteArrayOutputStream works
13:49holoseancorfield, 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:37mdeboardHow 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:37mdeboardwhich is terrible
14:40llasrammdeboard: 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:40mdeboardoic
14:40mdeboardthankfully I"m on 1.4
14:40edwAny 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:40edwUsing lein-swank 1.4.4.
14:41technomancyedw: maybe (require 'cl)?
14:41technomancyedw: alternatively: https://github.com/kingtim/nrepl.el
14:41hiredmanin clojure (.close x) is no-arg method or field, the compiler an figure out which reflectively
14:41edwnrepl? Instead of Emacs?!
14:41hiredmanin clojurescript it cannot, so a distinctive syntax as introduced (.-close x) for field, (.close x) for method
14:41technomancyedw: no?
14:41mdeboardhiredman: how? foo.close returns a boolean, foo.close() actually closes the thing
14:41edwOh, I see. Sorry.
14:42technomancyheh
14:42hiredmanclojure has support for (.-close x) field access, but there is little reason to use it
14:42llasramhiredman: Unless you have a field and a method w/ the same name, right?
14:42hiredmanllasram: sure
14:42llasramhiredman: Ok, which is the case we're talking about :-)
14:44edw(require 'cl) didn't work, btw.
14:45mdeboardllasram: Thanks, I was pretty confused for a second
14:48patrkrishi 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:52edwtechnomancy: Not to be a PITA, but nrepl doesn't seem to be in Marmalde's repo.
14:52technomancyedw: it should be there
14:52technomancyhttp://marmalade-repo.org/packages/nrepl
14:53wingyis there a way to run cljs files in the browser directly?
14:53wingyfor development
14:54edwpackage-archive ==> (("marmalade" . "http://marmalade-repo.org/packages/&quot;) ("gnu" . "http://elpa.gnu.org/packages/&quot;))
14:54edwM-x package-install [RET] nrepl [RET] ==> "no match"
14:54technomancyM-x package-refresh-contents
14:55edwMuch better.
14:56edwWikked fast.
14:57technomancyit's still missing a few things
14:57technomancybut getting better fast
14:58duck11231is the packaged nrepl usually pretty up to date?
14:58technomancyduck11231: there is no "usual" for a project this new =)
15:07wingyi guess not since its depending on google closure compiler
15:17mdeboardI'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:17mdeboardI don't understand the "0 2" at the end of that expression is what I'm saying
15:18mattmoss,(subvec [1 2 3 4 5 6] 0 2)
15:18clojurebot[1 2]
15:18mdeboardoh
15:18mdeboardsubvec is a fn :P whoops.
15:19stainso basically it unpacks the first binding
15:19stainthen recurses with the rest of the bindings
15:20mdeboardgotcha
15:20mdeboardthat makes a lot more sense then.
15:20stainfor each recursion there is a finally-block that closes the one that that iteration unpacked
15:20stains/iteration/call/g
15:20stainif you can say macro is called..
15:21mattmossexpanded
15:21mattmosswell, hmm.
15:21stainsounds right
15:25Horofoxhow do I run a .clj file with the command line?
15:26_ulisesevening
15:27Horofoxevening
15:27llasramHorofox: Use `lein run`
15:27_ulisesthis 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:28llasramHorofox: 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:28Horofoxllasram: and not in the context of a leon project?
15:28Horofoxllasram: I'm doing the clojure koans and want to test a .clj script i made
15:29llasramHorofox: I'd suggest just creating a scratch lein project and including the file. It's the de facato standard way of doing things.
15:30llasramde facto, even
15:30Horofoxllasram: not so easy to enter the clojure world, huh.
15:30hiredmanHorofox: java -jar clojure.jar some-file.clj
15:31hiredmanI would suggest if you are starting out you just play with the repl and not even bother with files
15:31hiredmanhttp://clojure.org/getting_started
15:31llasramI'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:31hiredmanllasram: I didn't ask you
15:31Horofoxhiredman: "Exception in thread "main" java.lang.IllegalArgumentException: Only these options are valid: :default, :hierarchy" I get this
15:32Horofoxwhat could it be?
15:32llasramhiredman: I
15:32llasramhiredman: I'd meant to direct that at Horofox
15:32hiredmanHorofox: fix your mistake
15:32hiredmanHorofox: this is part of the reason why interacting with the repl for newbies is better
15:32Horofoxhiredman: it's not telling shit about "my mistake"
15:32hiredmanit is
15:33hiredmanbut if you interact with the repl directly you can see exactly which expression causes what
15:33hiredmanthe exception there includes lots of line number information etc
15:33hiredmanbut most people ignore exceptions, or complain about them being too verbose (no idea why)
15:33Horofoxbut they are, aren't they?
15:34hiredmanno
15:34hiredmanthey contain lots of useful information
15:34sjlhiredman: a garbage dump likely contains lots of useful stuff too
15:35sjlthe problem is that it's buried in irrelevant crap
15:35llasramMmmm. 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:35hiredmanyou should know and care about the internals
15:36llasramOh, 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:37hiredman"it's incredibly helpful, but I don't want it"
15:38llasramI 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:38hiredmanHorofox: your error is you copied and pasted some code from somewhere that defines multimethods in way that doesn't work anymore
15:38Horofoxhiredman: does it say what you told me?
15:38Horofoxhiredman: but thanks
15:39Horofoxhiredman: how did you learn clojure?
15:39dnolenllasram: 1.3 includes better stacktraces - would be better if someone submitted a patch that provided this is a data structure for external tools.
15:39dnolenLots of complaining ... no patches.
15:39hiredmanHorofox: just like I recommended it to you
15:39Horofoxhiredman: use REPL?
15:39hiredmanyep
15:39llasramdnolen: 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:39hiredmanfrom a repl I went to manually c&p from a file to repl
15:39Horofoxhiredman: I want to learn so I need a direction, not only typing random stuff in REPL
15:40hiredmanHorofox: you can futz around with various code exercises, but the best way is to find a project and write it
15:41dnolenllasram: sweet, look forward to someone actually attempting to fix the issue!
15:41hiredmanit's like literacy in anything else, spend time reading and writing
15:41Horofoxhiredman: what's a good thing to write in clojure? I don't want to get into webdev(I already develop with rails)
15:42hiredmanwhatever your next toy project is
15:44hiredmanI've got a doozy of a project for you: implement some audio codec in clojure
15:45lynaghkcemerick: ping
15:48Horofoxhiredman: i have no idea of how audio codecs work
15:49hiredmanthere 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:49hiredmanHorofox: you will have some idea by the time you are done
15:49Hodappcode 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:50dnolenHorofox: 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:50dnolenHorofox: VIM, Emacs, and Eclipse have the most developed environments. Light Table promises to provide something more friendly one day.
15:50hiredmanI 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:51Horofoxhiredman: that's a good idea
15:51sjlHorofox: "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:52hiredman"I want to learn Java" "go install maven and eclipse"
15:52hiredman"I want to learn Ruby" "install textmate, rvm, and rails"
15:53llasramI view "I want to learn Clojure" -> "install lein" as the equiv of "I want to learn Ruby" -> "install ruby"
15:53hiredmanclojurebot: lein |is not| clojure
15:53clojurebotAlles klar
15:54llasramI'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:54gtrak~lein
15:54clojurebotlein is not the bestest programming language available.
15:54amalloyhaha. damn you for your inferences, clojurebot!
15:55gtrakclojurebot: lein |is not| 'clojure
15:55clojurebotIn Ordnung
15:55gtrak~lein
15:55clojurebotlein is not clojure
15:55gtrakha, that actually worked?
15:55amalloy~clojure
15:55clojurebotclojure > scheme
15:55emezeske~scheme
15:55clojurebotscheme 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:55gtrakis that a coincidence?
15:56llasramI'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:57sjlIt may not be usable but at least it's not complected amirite
15:57llasramheh
15:58dnolenllasram: what were they used to?
15:58llasramRuby mostly
15:58hiredmanllasram: my contention is starting with the repl is the best way
15:58dnolenllasram: case closed ;)
15:58sjlreadline support?
15:58gtraksjl: I want to program... me: here's an integer
15:58hiredmanllasram: not the easiest
15:58amalloyhiredman: rlwrap java -jar clojure.jar? or something else?
15:59hiredmanrlwrap is a flourish
15:59ToxicFrogllasram: not having used ruby, what were they expecting other than "a REPL"?
15:59dnolenllasram: 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:00stainhave 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:00hiredmanI am not saying that the tools, the extras, etc are bad, jsut that hey are that, extras
16:00stainperhaps some JNI stuff? File operations on the device might not be enough, I guess
16:01llasramdnolen: 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:01ToxicFrogllasram: 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:01dnolenllasram: yes the story is usually far more frightening :)
16:01llasramdnolen: 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:01hiredmanif all you know is how to do is work with clojure tools, what happens when the tools fail or are inadequate
16:02hiredmanthe clojure repl has all of that except for readline support
16:02dnolenllasram: yes, global installs have destroyed countless hours of productivity the world over.
16:02ToxicFrog...doesn't clojure.jar include a command-line compiler and interpreter in the form of clojure.main?
16:02hiredmanclojure jar
16:03hiredmandocs access from the repl is also an extra in my mind
16:03ToxicFrogHorofox: 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:03hiredmanclojure.org is comprehensive
16:03llasramToxicFrog: 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:04HorofoxToxicFrog: cool
16:04ToxicFrogllasram: ok, yes, readline support is notably missing
16:04llasramI'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:04hiredman"symbiotic with an established Platform" -- http://clojure.org/rationale
16:04ToxicFrogI have a working 'clojure' command that handles all of the JVM invokation for me, but that may have been added by the packager?
16:05dnolenllasram: http://dev.clojure.org/display/design/CLJ+Launcher
16:05hiredmanpeople should not expect to use clojure without understanding at least something about the jvm
16:05sjlToxicFrog: Some packagers do that -- brew installs clj for you
16:05dnolenllasram: what you want is desirable - but yet again something the community needs to step up to the plate.
16:05llasramhiredman: Agreed. But if you check out e.g. Jython, JRuby they have many more amenities
16:05hiredmanjust as I would say people should not expect to use clojurescript without some understanding of javascript
16:06ToxicFroghiredman: 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:06hiredmanllasram: I have to argument against amenities, and there use, I just don't think they are a good way to learn
16:06llasramdnolen: I think the community already has in the form of lein :-)
16:06hiredmanwhen teaching children to do addition, do you just hand them a calculator and say "press these buttons" ?
16:06ToxicFrogSpeaking of launching jars smoothly, anyone here have experience using jsmooth or something like it on a lein uberjar?
16:07ToxicFrogI am looking for a way to make deploying on windows not an endless pit of misery and suffering.
16:07sjlhiredman: nah first we take the calculator apart and I explain the circuit board so they understand how it runs
16:07dnolenllasram: of course! but there are some good ideas not yet in lein on that page as well.
16:07ToxicFroghiredman: no, but neither do I start with category theory so that they can truly understand addition :P
16:07gtrakpeople have this same argument on ##java against IDEs
16:08gtraki think it generally resolves to don't expect us to help you with eclipse
16:08ToxicFrogMore 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:09gtrakwhen you don't know the basics of java
16:09ToxicFrogThose are things that should be learned, but they are also different things.
16:10sjlToxicFrog: 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:11mdeboardWhy was clojure.core.assert-args made private? Is there a way to use private fns ?
16:11gtrak#'
16:11headiusyou can argue against "amenities" of language impls like JRuby that try to hide the JVM's ugliness, but you'd be deluding yourself
16:11headiusthe JVM is not very user friendly, and saying "you just need to learn the JVM" ignores the many obvious warts
16:11mdeboardgtrak: Righto
16:12headiusthat said I'm entering this conversation halfway through, so I don't know what amenities we're talking about :)
16:12headiusahh…a nice command-line tool
16:12headiusyeah, that's a silly one to argue against
16:12gtrakheadius: clojure.org site recommends getting the jar instead of lein
16:12hiredmanI am not saying it should exist
16:12headiusthe heinousity of the java command line is legendary
16:13headiuseven the original Java guys acknowledge it
16:13hiredmanI 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:13headiusI 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:13sjlI wonder if Pygments has "java command line invocation" as a lexer
16:14llasramhiredman: Directly linking libpython.so gives you Python w/o any distractions, but that's still an awkward way to work with the language
16:14headiusthe "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:14headiusbooks=boots
16:15llasramI 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:15sjlhiredman: how would one use a library in that setup? wget the jar?
16:15sjllibrary like, say, quil
16:15dnolengtrak: it shows the simplest thing. and then links to more detailed setups.
16:15sjlor overtone
16:16llasramheadius: Wow, I didn't realize you'd gone that far. That's pretty hardcore :-)
16:16dnolensjl: quite few people still look at lein w/ suspicion and have custom build scripts for their projects.
16:16hiredmanheadius: 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:16headiusllasram: we used to have a bash script, but you can't use a bash script in the shebang line of another script
16:16headiuswe eventually just had to suck it up and provide a real native executable
16:16gtrakdnolen: 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:16llasramheadius: On OS X? You can on Linux these days, although you definitely couldn't in the past
16:16headiusit's not consistent
16:16llasramAh
16:17headiusin 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:17technomancyyeah, with a bash script you basically end up pissing all over your ps output
16:17headiusright
16:17sjldnolen: do they... do they build classpaths and fetch all dependencies manually?
16:18dnolensjl: yes, or they use Eclipse and they don't care about all this command-line goofiness at all.
16:18sjldear lord, that's horrifying
16:18dnolensjl: it's pretty tiresome for people to come Clojure with their myopic world views
16:19sjlnot the Eclipse part, that's another fine direction
16:19dnolensjl: Eclispe manages everything, add jars to your project done.
16:19sjlYeah, if you don't need the command line that's a nice way to get started
16:20dnolensjl: my point is there are legitimate multiple ways to get started. clojure.org wisely makes no assumptions.
16:20headiusoh, 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:20technomancydnolen: "I want my arrow keys to work" is a pretty reasonable assumption
16:21sjltechnomancy: nah dude some people don't like backspace to work don't assume things
16:21dnolentechnomancy: if you care about the command line. I don't imagine CCW uses care whether the command line REPL supports arrows or not.
16:21technomancyRUBOUT
16:21headiusCtrl-H, man
16:22llasramheadius: heh, I almost said that -- I don't even have a key mapped to Backspace!
16:22dnolentechnomancy: fortunately there's line to satisfy a different crowd.
16:22dnolener lein
16:22hiredmanheadius: sure, and every serious project has it's own launcher script anyway
16:22technomancyyeah, 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:22ToxicFrog'lein repl', for some reason, has absolutely horrifying memory requirements for me
16:23headiusopinionated software sucks when the opinion is wrong
16:23ToxicFrogIt 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:23hiredmanbut what is simpler than to run `java -jar clojure.jar` and get a repl?
16:23ToxicFroghiredman: as noted, you can't use command history or line editing in that, in contrast to basically every other REPL ever
16:23ToxicFrogAnd it's really annoying.
16:23sjlhiredman: running "clojure" and getting a repl with readline?
16:24hiredmanwhat is the difference between this hypothetical clojure launcher "clj" and "java -jar clojure.jar"? the first doesn't have spaces in it?
16:24technomancyread. line.
16:24ivan-jar nukes your CLASSPATH
16:24hiredmanI don't care about readline
16:24sjlyou have to be in the same dir as clojure.jar
16:25ToxicFrogYou 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:25ToxicFrogWhich is miserable and a pain to type to every time you want a clojure REPL
16:25emezeskehiredman: You don't use readline, or something like it?
16:25ToxicFroghiredman: 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:25hiredmanemezeske: sure I use it, but I can take it or leave it, it is not central to writing clojure code
16:26emezeskehiredman: That's like saying that an eraser is not central to writing prose with a pencil
16:26technomancyhiredman: 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:26emezeskehiredman: Perfectly possible, but...
16:27hiredmanemezeske: it works just fine
16:27ToxicFroghiredman: 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:27hiredmanemezeske: 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:28pjstadigself initializing clojure command-line script https://github.com/pjstadig/dotfiles/blob/master/bin/clojure
16:28llasramhiredman: Yes, but how many *more* would have learned it if there had been convenient tools from the start?
16:28ToxicFrogDo 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:28pjstadigwith readline
16:28ToxicFrogBut have the REPL available with readline support makes it easier.
16:29technomancyhiredman: speaking from personal experience, it's because I had an extremely high tolerance for bullshit and yak shaving
16:29ToxicFrogIf 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:29llasramtechnomancy: Which tolerance on your part I for one am incredibly grateful :-)
16:29hiredmanllasram: who cares?
16:30hiredmanclojure is not a religious world view I want to foist on to as many people has possible
16:30grim_radicallolwut
16:30llasramhiredman: 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:30sjlI don't have enough wat.gifs for how this conversation has unfolded. I'm out.
16:30ToxicFrogpjstadig: 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:31zerokarmalefthiredman: 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:31technomancyexhibit A: https://github.com/technomancy/clojure-mode/blob/47caba15ff31f339e74378fd3c05bcffa7091550/clojure-mode.el#L627
16:31pjstadigToxicFrog: my computer is just a series of scripts, some that setup rlwrap for me (reliably) and others that use it
16:31ToxicFroghiredman: if you care so little, why are you arguing so vehemently that this is something clojure should not have?
16:32pjstadigit's nice to be able to just type clojure and open a REPL whenever i want to answer some simple question
16:32ToxicFrogpjstadig: yeah, I'm just saying that a jline-based approach is probably more portable :)
16:32hiredmanI 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:33ToxicFroghiredman: so, what, your argument is that once people know a language, they stop caring whether its REPL has readline support?
16:33rlbpjstadig: 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:33ToxicFrogI had no idea. Guess I might as well recompile lua, python and bash without readline enabled now.
16:34technomancyToxicFrog: or you could write unrlwrap
16:34ToxicFrogtrue
16:34ToxicFrogThat probably already exists, even
16:34amalloytechnomancy: rcwrap
16:34technomancyfor all non-ascii keystrokes, it just inserts HERP/DERP
16:35zerokarmaleftthen rlwrap it again...inceptionwrap
16:35llasramamalloy: rc == read... console?
16:35amalloycharacter
16:35llasramah!
16:35pjstadigrlb: i've been using clojure since before there were debian packages :)
16:35mdeboardhipster
16:35hiredmancalling readline support a deal breaker, when it obviously isn't is just silly, like complaining about parens
16:35gtrakI think clojure.org could probably go along with the consensus and endorse leiningen at least, maybe not emacs
16:36rlbpjstadig: me too -- just mentioned them for anyone intereseted.
16:36rlbs//intereseted/interested/
16:36technomancyit'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:37ToxicFroghiredman: no-one is calling it that, though?
16:37pjstadigsidenote: i think it's probably better to have the clojure versions in stalled separately, instead of with update-alternatives, since there are incompatibilities
16:37rlbllasram: 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:38technomancyrlb: is there still time for bribes?
16:38gtrak(inc technomancy)
16:38gtrak~(inc technomancy)
16:38clojurebottechnomancy 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:38emezeskehiredman: 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:38rlbhah -- 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:38technomancysure
16:39emezeskehiredman: 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:39hiredmanemezeske: that is obviously not true
16:39llasramI'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:39hiredmanemezeske: there were people using clojure professionally before lien existed
16:39ToxicFrogemezeske: your first one cut off at "why the hell am"
16:39gtrak$lazybot are you dead?
16:39emezeskeToxicFrog: le sigh
16:40gtrakRaynes: lazybot is dead!
16:40rlbllasram: and for some people the gnome 3 transition is likely to be "jarring".
16:40RaynesLong live lazybot!
16:40technomancyman... I'm still having a hard time believing I actually wrote M-x clojure-install
16:40Raynestechnomancy: We were all young once.
16:40RaynesSome of us still are.
16:40ToxicFrogAnyways, I'm sick of arguing with a brick wall, time to get some groceries and write some code. Laters.
16:40emezeskehiredman: 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:40Raynesamalloy: I just tried to ssh lazybot.
16:40emezeskehiredman: Or, they were ascetic monks.
16:41hiredmanemezeske: and some (crazy) people are using maven for clojure projects
16:41scriptorearly adopters tend to be more tolerant of these kinds of things
16:41technomancyemezeske: 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:41emezeskehiredman: *shudder*
16:42llasramtechnomancy, 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:42emezesketechnomancy: True enough!
16:43emezeskehiredman: 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:45rlbtechnomancy: 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:46technomancyrlb: sure, you can use lein with nexus and co.
16:46technomancyjust add :omit-default-repos true and add them to :repositories
16:46rlbok, thanks -- are the main ones these days nexus and artifactory?
16:46technomancyand archiva
16:46gtrakthere 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:47technomancyI'm pretty sure I wouldn't have bothered with Clojure if swank hadn't existed
16:50emezesketechnomancy: 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:53gtraklazybot: hi!
16:58gfredericks(dec lazybot)
16:58lazybot⇒ 6
16:58gtrak(inc technomancy)
16:58lazybot⇒ 33
16:58gtrakthere
17:00gfredericks(inc me)
17:00lazybot⇒ 1
17:06cemerickemezeske: More than any other thing, I think you can attribute the growth of Clojure to the maturation of Leiningen.
17:07cemericktechnomancy shouldn't have to ever buy another drink ever again at any Clojure gathering. :-)
17:07zerokarmaleftcheers, thanks for all the yak-shaving
17:07technomancyaw shucks you guys...
17:10llasramThe morning of Nov 16th, technomancy lies dead from alcohol poisoning. Fortunately he is restored from backup by that evening
17:11Raynescemerick: 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:12cemerickllasram: heroku should have a follower ready, yeah?
17:12cemerickRaynes: Twisted basterd.
17:12cemerick:-)
17:13rickmodecode master__tion is more of a Java thing
17:13llasramCool feature!
17:13tmciverRaynes is a master debater.
17:14Hodapprickmode: bah?
17:14gtrakwe once had that broadcast on the high school intercom
17:17cemerickgfredericks: they each have their place
17:17cemerickpeople mature, wine maturates :-)
17:17cemerick</pedantry>
17:17gfredericks:)
17:17emezeskecemerick: I wouldn't find that at all surprising
17:18gfrederickswait it must be an actual work musn't it
17:18gfredericksword*
17:20cemerickgfredericks: what, "maturate"?
17:21rickmodematuregery
17:23craigbrothat sounds dirty
17:28gfrederickscemerick: I rarely maken't up words
17:29cemerickgfredericks: makenut is *totally* a word!
18:27aphyrWhat's the minimal amount of code required to extend-protocol IPersistentMap?
18:27aphyrDo I need to define all the methods of Seqable, IPersistentCollection, Associative, etc?
18:29hiredmanaphyr: your question makes no sense, IPersistentMap is not a protocol, and none of Seqable, IPersistentCollection, and Associative are either
18:30aphyrYeah. but IPersistentMap extends those interfaces
18:30hiredmanso?
18:31aphyrWell IPersistentMap iteself only consists of assoc, assocEx, and without
18:31hiredmannone of those things are protocols, so "how can I do protocol things with things that are not protocols" is your question?
18:31aphyrEr, wow, yeah, you're right.
18:31hiredmanjava interfaces are not protocols
18:31aphyrSorry, having a brain fart.
18:32aphyrGuessing I need to use proxy then
18:32aphyrWhich... aw fuck it, might as well just extract the whole fucking thing into a hashmap
18:32hiredmanreify, defrecord, and deftype all can extend interfaces or have protocols extended to them
18:32technomancyusually a safe bet
18:33aphyrYeah, I am knee-deep in a salesforce library right now
18:33aphyrtrying to make it slightly less absurdly javaesque
18:33aphyrhttps://github.com/teamlazerbeez/sf-api-connector/blob/master/sf-api-core/src/main/java/com/teamlazerbeez/crm/sf/core/SObject.java
18:33brehautaphyr: my condolences
18:33aphyrLong story, don't ask
18:33aphyrwant to shoot myself
18:34aphyrWould like, ideally, to use these suckers as maps
18:34aphyr(but also support their metadata operations)
18:34hiredmanhttps://github.com/arohner/clj-wallhack
18:35aphyr.... awesome
18:35hiredmanyou 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:35aphyrYeah, torn between constructing maps and putting some stuff into metadata
18:35hiredmanyou can also use reflection to generate a function that turns an object in to a map (like bean)
18:36hiredmandon't put stuff in metadata unless it is metadata
18:36aphyror wrapping sobjects in a defrecord which gives them map semantics
18:36hiredmana good rule of thumb for metadata is "is this ancillary data about this other data, that should change equality relationships"
18:37hiredmaner
18:37hiredmanshould not
18:37aphyrUgh, honestly, I don't understand the SFDC api well enough yet to say
18:37aphyrJust trying to get some human-readable structures out of this fucker
18:38hiredmanaphyr: language in #clojure is generally around pg to pg-13
18:38aphyr"
18:39technomancyhttp://wondermark.com/136/
18:39aphyrabominable self-consuming WSDL human centipede
18:44technomancywe could use some more intense sequences of violent action in here though
18:44hiredman~GUARDS
18:44clojurebotSEIZE HIM!
18:45brehaut,(repeatedly launch-the-missiles)
18:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: launch-the-missiles in this context, compiling:(NO_SOURCE_PATH:0)>
18:45brehautdamn
18:48amalloy(dorun (repeatedly launch-the-missiles)), or you'll just lazily do nothing
18:53emezesketechnomancy: Your nick, plus that violent action sequence, makes me think you've played shadowrun
18:53technomancyevery single youtube clip of the bike sequence from Project A is only offered in non-html5 format =(
18:54technomancyemezeske: no, I was thinking of http://www.youtube.com/watch?v=ecsGvqvskXw
18:54technomancyat least I think that's it
18:55aphyrsf_commute.mp4
18:55technomancyoops, it's a dubbed version; my bad
18:55emezeskeOh, jackie
19:09pepijndevosUsing zippers, how can I insert a child a the root, and not lose my current position?
19:13pepijndevosBecause if I do (z/insert-child (z/root loc) :foo), I have no idea where loc was.
19:23llasramI 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:23llasramEr, (foo (bar| (baz))) -> (foo (bar) (baz))
19:25amalloyllasram: isn't that just forward-barf?
19:25llasramAsk and ye shall receive! Also, no idea how I didn't make that connection
19:26llasram(inc amalloy)
19:26lazybot⇒ 25
19:27augustlhow 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:28llasramaugustl: Works as you'd expect/hope. The namespace aliases effect all resolution within the namespace defining the alias
19:29augustlah, so it's not a purely symbolic thing
19:29augustlfor some reason I thought it was
19:29llasrams,effect,affect, <- spelling!
19:30llasramYep! It took me a bit to get my head around, but once you have the right mental model, it's entirely consistent
19:31augustlwas useful to see that it just ends up calling .bindRoot on the internal clojure.lang.Var object
19:32llasramHeh. I was going to mention that reading the Java implementation helps, but didn't want to risk scaring off :-)
19:33mdeboardSo 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:33mdeboardAm I missing something important about the nature of these context manager macros or
19:34llasrammdeboard: Probably not? What's with-pdf look like?
19:34mdeboardllasram: it's in the first link
19:35llasramMan, I'm 0 for n on following the right link today
19:35mdeboardhehe
19:36mdeboardthe 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:37llasramRandom 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:37mdeboardbut the Document instance you call .open against has to be the SAME document that you pass PdfCopy :P
19:38mdeboarddat stateful programming
19:38mdeboardllasram: noted
19:38hiredmanyou can also just define a recursive macro
19:39hiredman(defmacro f [& xs] (if (seq xs) `(f ~@(rest xs)) 1))
19:42hiredmanwhich is what with-open does anyway, I'm not sure why you would advocate reduce over that
19:42amalloymdeboard: you're double-evaluating the value part of the let-binding
19:43amalloyseeing ~(bindings 1) twice is a huge red flag
19:43mdeboardI see
19:43llasramThat's a bug, but I don't think what's causing the behavior mdeboard is seeing though...
19:44amalloyfor sure it is
19:44mdeboardhell it might actually
19:44mdeboardyeah if it's calling .open on a different Document instance
19:44mdeboarddamn I hate OOP so much sometimes.
19:45mdeboardso, should I do the conditional check inside the let binding then amalloy
19:45amalloyit's not at all clear why you even have the if-check there
19:45mdeboarddefensive programming
19:45sjlHas someone shaved the "append trailing slashes and redirect" yak in Noir yet?
19:45amalloythose are words, not a reason
19:45amalloyjust try to call .open on it, and if it doesn't support .open that'll break
19:45mdeboardbecause I wanted to return a useful exception if someone tried to bind a symbol to an invalid piece ofdata
19:45llasramI 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:46amalloyyes, and ClassCastException is useful, whereas IllegalArgumentException is of questionable value
19:47amalloyllasram: good point, it looks sorta like it should work
19:48augustlhow 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:48amalloybut with such a serious problem as double-evaluating the value i wouldn't make any firm statements about it
19:50mdeboardthis is my first macro so it's kind of a brain bender
19:51llasramaugustl: 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:51mdeboards/so/and/
19:51augustlllasram: seems like a ~ solved it
19:52llasramaugustl: Oh, so you were already writing a macro then :-)
19:52augustland passing symbols too of course, so the vec is defined as ['foo bar] instead of [foo bar]
19:52augustlno I wasn't, I'm just calling it
19:52augustlso I'm kind of surprised :)
19:53augustlheh it also didn't actually work :)
19:54llasramI don't even -- what?:
19:54augustlso there's no way to pass a reference to a vector to a macro that expects an inline vector?
19:54llasram&(let [foo ['foo 1]] (with-redefs ~foo foo))
19:54lazybot⇒ [foo 1]
19:54llasramwtf is that even doing?
19:54augustl:S
19:55llasramaugustl: 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:55augustlthat's weird, because it's not working for me, I was just reading it wrong
19:55llasrams,with,which,
19:55augustlah, I see
19:57augustlmakes sense, I need to inject stuff macro expansion time, not runtime
19:57amalloy&'~foo
19:57lazybot⇒ (clojure.core/unquote foo)
19:57llasramExactly
19:57amalloy&(let [foo ['foo 1]] (with-redefs ~foo clojure.core/unquote))
19:57lazybot⇒ [foo 1]
19:57llasramamalloy: I just figured that out :-) Fun times
19:58amalloysee also with-redefs-fn
20:00augustlis "?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:01technomancyaugustl: it's just a name, albeit a weird one
20:01technomancymaybe a convention for logic variables?
20:02llasramThe Midje documentation uses it in a few places to just indicate arbitrary user-provided values/forms
20:02augustlI see
20:03llasramWait, I lied
20:04augustlthe fact that midje tests are in macros is a pita some times..
20:04llasramIt's a literal symbol which Midje considers special. But Midje is the thing considering the specific symbol `?form` special, not Clojure etc
20:04augustlthat is, you need to know your way around macros, so if you don't (like me), midje tests can be a pita :)
20:05llasramYeah, 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:06mdeboardoh man I love cascalog-midje
20:06mdeboardamazing
20:06augustlyay, made it work using with-redefs-fn
21:15gertwho should I contact if I suspect I found a vulnerability in Ring? weavejester?
21:15weavejestergert: Yep
21:15gertI made a simple lein project to illustrate something that may be a problem.
21:16gertwhat's the best way of getting it to you?
21:16weavejestergert: A zip in an email, maybe?
21:17gertI've got the zip (well, tgz if that's ok). not your email though. Can I find that on github?
21:17weavejestergert: Yep, or you can have it here: jreeves@weavejester.com
21:17gertcheers! I'll get in touch.
21:25atoiAnyone in here use Riemann?
21:25atoiI know aphyr does, but I don't think he's about. :)
21:26aphyrI'm here
21:26atoiOh! Nevermind!
21:26atoiIt finally showed up.
21:26gertweavejester: you've got mail :)
21:26atoiI think rate works different than I thought.
21:26aphyrTake this to #riemann?
21:27atoiyes.
21:30benediktEmacs + Clojure is really confusing.
21:30gertEmacs + anything is really confusing :)
21:31benediktClojure is the most confuisng adventure so far.
21:31gertwhat confuses you?
21:31benediktI have two clojure interpreters
21:31benediktlein and clojure (ubuntu package)
21:32benedikti need a "project" to use clojure-jack-in, and i need lein to create a project to use with emacs
21:32benediktbut then emacs proceeds to use the *other* clojure interpreter.
21:32benediktand it also seems to leave a tcp port open for the world
21:32gertyou mean you need a project.clj for clojure-jack-in right?
21:33benediktyes
21:33gertwhich is, clojure-jack-in relies on leiningen, which needs the project.clj
21:33benediktright
21:33benediktbut why doesnt it use the lein repl?
21:33gertit does - through slime/swank
21:34benediktthat, and the world readable port, is what confuses me
21:34benediktwell no
21:34gertcan you start a repl from outside of emacs?
21:34benediktyes. as a matter of fact, two different ones
21:34benediktlein has 1.4 and the ubuntu package provided 1.3
21:34benediktand (clojure-version) inside emacs with slime/swank is 1.3
21:35gertin your project.clj, is there a dependency on clojure? does that say [org.clojure/clojure "1.4.0"] or 1.3.0?
21:35benediktyup
21:35benediktso lein provides both 1.3 and 1.4?
21:35gertwhich one? :)
21:35benedikt1.3 is in project.clj
21:36benediktwhich explains that part
21:36gertah, that's why your clojure version is 1.3
21:36benediktbut i'm still not sure what binary is being used
21:36gertbecause you're asking for it :)
21:36benediktsounds like it should be the lein one
21:36gertif you're on the commandline, you can type `lein classpath`
21:36benediktits created with "lein new"
21:36gertthat will show you what jars (including the clojure jar) leiningen is using
21:36clojurebotRoger.
21:37benediktits downloded with maven, sure smells like clojure
21:37gertlein 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:37benedikthurr, lein.
21:37benediktso what about this word readable port
21:37gertyeah good point.
21:37gertnot sure
21:37benediktcan't i bind it to my localhost interface?
21:37benedikti'm not behind a NAT
21:38benediktso i feel sort of... naked.
21:38gertyeah i get that
21:38amalloyi think it does bind to localhost, doesn't it?
21:38benediktnope
21:40gertlooks like you're right benedikt. if I do 'lsof | grep IPv4 | grep java'
21:40benediktyup
21:40gertI see TCP *:61521 (LISTEN)
21:41benediktbut this should be an issue with swank/slime, right?
21:41benedikti'm figuring out how this all is connected
21:41benediktnow i can google
21:41benedikti'll report back with results
21:41gertI have results
21:41Iceland_jackgood luck benedikt
21:41gertI just asked my workmate to telnet into my machine on that port
21:41gertwith great success
21:41gertthat's kinda bad eh :)
21:43gertamalloy: is that supposed to happen?
21:43amalloy*shrug*
21:43benediktgert: http://stackoverflow.com/questions/3747291/clojure-swank-server-opens-public-port
21:43benediktsee the answer from Arthur Ulfeldt. I have only telneted to be port, not tried to connect with swank.
21:43benediktbut since it's still there listening..
21:43gertyup
21:44gertI'm connected. and it's still listening.
21:44benediktsama here
21:44benediktsame*
21:45gertand I can happily establish a telnet connection
21:45benediktyeah same here. and according to the SO post, connecting with slime works too
21:46gerthm. that worries me.
21:47gertMichal Marczyks comment on that SO post looks helpful
21:48benediktmark Derricutt
21:48benediktMark Derricutt posts about how to it with mavne
21:50duck1123hopefully, that port is blocked by your firewall anyway, but you can tell it the ip to listen on
21:51gertclojure-mode.el calls 'lein jack-in', and lein jack-in only accepts a port number, not an interface
21:51gerts/interface/ip address/
21:51benediktwhere is clojure-mode.el supposed to live?
21:51weavejester_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:52duck1123you don't have to use jack-in, you can run swank other was
21:53gertcheers weavejester_. I'm creating my own SessionStore that won't allow it
21:53duck1123that'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:54weavejester_gert: I'm planning on fixing it tomorrow. I'm going to release Ring 1.1.2 then anyway.
21:54gertawesome!
21:57gertduck1123: https://github.com/technomancy/swank-clojure/blob/master/lein-swank/src/leiningen/jack_in.clj says it's connecting to localhost.. hm.
21:57cljrdoes 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:59duck1123cljr: if this was your first post, it may be in moderation, or did it say it was rejected?
22:00duck1123That doesn't sound too spammy, people announce their stuff all the time
22:00cljrduck1123: yeah, most of the content was comparing languages
22:00cljrduck1123: never got a message that said it was rejected
22:00duck1123so it's probably just in the moderation queue
22:01cljrokay, 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:01cljrthats* okay rather
22:03duck1123I 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:03cljrouch
22:03duck1123It's a shame there are so few clojure users in this area
22:03cljrwhat area is that?
22:03duck1123Detroit, MI
22:04cljrare there other large language communities there?
22:05FrozenlockOk 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:06duck1123there are plenty, it's just the detroit-clojure group never got going
22:06eggsbyFrozenlock: usually I just use the mongo shell to set constraints on the collections
22:06eggsbycongomongo doesn't really provide much in terms of a configuration interface
22:06FrozenlockOh, so I is possible to set an upper limit?
22:06Frozenlock*it
22:07eggsbyFrozenlock: http://www.mongodb.org/display/DOCS/Capped+Collections
22:07duck1123pre-allocated
22:08Frozenlockeggsby: Well yes, but I don't want to lock down unused space
22:08FrozenlockBtw, you don't need to use the shell if you want to create a capped collection :)
22:08Frozenlock(create-collection! "asdf" :capped true :size 10000....)
22:10duck1123I wonder if you could build something that would auto-rotate to larger collections as space filled
22:10duck1123probably more work than it's worth
22:12FrozenlockSmells really hacky. Could work, but could fail sooooo badly :P
22:14duck1123I guess it would really depend on if you already need the ability to manipulate collections. Are you creating a lot of these collections?
22:15FrozenlockI intend to create hundreds...
22:15gfredericksany guesses why my definition of permuto diverges? https://gist.github.com/3185823
22:15FrozenlockI was going to cap them at 1go, but I stopped immediatly when I saw it was eating my harddrive live.
22:15Frozenlock*on nom nom nom*
22:18dnolengfredericks: it's almost always the same, you program allows unground variables to grow.
22:19dnolengfredericks: appendo suffers from this problem as well.
22:19gfredericksdnolen: I was looking for that but couldn't see where :/
22:20dnolengfredericks: I would compare your version against the one in core.logic
22:20gfredericksha; I didn't know there was one :) thanks
22:22dnolengfredericks: it's new :) it's in master
22:22dnolengfredericks: thank amalloy
22:28dnolengfredericks: I've got some ideas about how to deal with that, but that's probably slated for the next bigrelease - so time away.
22:28dnolennot anytime soon I mean.
22:29gfrederickshuh; 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:30amalloydirect 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:30gfredericksI haven't checked if the core.logic version also repeats
22:30dnolenamalloy: haha, no I didn't look at your version closely.
22:30gfredericksso it might just be a bug in my mimickery
22:30dnolenamalloy: I nearly always defer to existing Prolog versions so I can save my brain power for other things.
22:40georgekhi, 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:42eggsbygeorgek: the idea is to be able to solve it without using count
22:42georgekwithout counting at all that is, not just the 'count' fn?
22:42eggsbyno, without using the count function
22:43georgekyes, I'm not using count, but my answer triggers the error still
22:43eggsby:O
22:43georgekam I missing something
22:43eggsbyperhaps you are using something that uses count internally?
22:44georgekthis was my (probably incorrect) answer, https://www.refheap.com/paste/3824
22:49eggsbygeorgek: for uses 'count' internall
22:50eggsbygeorgek: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4088
22:51eggsbyyou should be able to do it only using 'fn' and 'recur' fwiw
22:51eggsbywell, maybe some others, inc or + or w/e
22:51georgekthanks eggsby
22:51georgekI'm working on a different answer with looping now
22:52eggsbyis this your first functional lang georgek ?
22:52georgekpretty much
22:53eggsbyit's a heck of a shift, I came from python where everything was for .. in .. if .. else ..
22:53georgekha
22:53georgekyes most of my experience is Python
22:54eggsbythe 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:54amalloywell, for is still great in clojure (better imo, but i'm not much of a python enthusiast)
22:55eggsbyamalloy: yah, python has list comprehension as well, but I think clojure's is nicer (since you can have full power inside your comprehensions)
22:55brehautfor in clj is closer to a generator comprehension in python
22:56dnolenbrehaut: really closer to Haskell list comprehensions given how fancy they are.
22:57brehautdnolen: however not entirely relevant when making a comparison to something in python ;)
22:57gfredericksoh man there is a clojure coffee mug
22:58eggsbywhere do I get it gfredericks
22:58gfrederickshttp://www.zazzle.com/clojure_mug_i_get_more_done_when_im_lazy_v2-168060469711592507
22:58gfredericksI'm having a hard time not getting it
22:59tmcivergfredericks: cool! The text in the picture looks like crap though.
22:59eggsbyya, not sure what's up with that font
22:59gfredericksit is hipster
23:00eggsbydnolen: I enjoyed your core.logic talk posted on vimeo recently, if only I could find an excuse to use it at work...
23:00technomancybenedikt: swank hasn't defaulted to 0.0.0.0 in a really long time
23:00technomancybut 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:01gfredericksdnolen: 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:02dnolenhuzzah!
23:02dnolen288 commits later http://github.com/clojure/core.logic/compare/89fac76158...e6d5d2286e
23:02dnolencKanren extensions in master
23:02gfredericksoh snaps
23:02dnolengfredericks: I'd rather you confirm that it's not issue in Prolog first.
23:03dnolengfredericks: divergence is a real problem, not easily solved.
23:03dnolengfredericks: in the nature of the system.
23:06brehautwhat‽
23:07gfrederickskiwis: because they just have more energy at this time of the tomorrow.
23:08brehauthaha
23:09brehauti have forgotten way too much prolog
23:09gfredericksbrehaut says it halts in prolog
23:10amalloygfredericks: 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:10gfredericksamalloy: (run 3 [q] (permuteo q [1 2]))
23:10amalloybut do it for me cause i'm too lame to do it myself?
23:11gfredericks:)
23:11dnolengfredericks: I doubt that works in Prolog.
23:11gfredericksbrehaut just tried http://www.dreamincode.net/code/snippet3411.htm
23:11brehautdnolen: gfredericks have me a snippet of code he told me was equivalent, and i ran it for him
23:11gfrederickswhich looks equivalent to the core.logic code
23:12dnolengfredericks: I think I used this, http://colin.barker.pagesperso-orange.fr/sands.htm
23:15dnolengfredericks: if you're going to open a ticket it should include the equivalent Prolog and better solution if actually exists.
23:16dnolengfredericks: chances are you can write the solution slightly differently only for it diverge with a different set of ground unground terms.
23:18gfredericksI just noticed the prolog versions don't seem to have the != constraint
23:18gfrederickshard to imagine that would make a difference
23:18gfredericksor at least this kind of difference
23:19amalloyfwiw gfredericks, my version doesn't diverge
23:19amalloy(run 3 [q] (permuteo q [1 2])) ;; ((1 2) (2 1))
23:21gfredericksamalloy: and your rembero doesn't have the != either
23:21dnolengfredericks: don't think != matters much here.
23:21dnolenchecking now
23:21amalloywell, mine is to remove *any one* x, not specifically the first x
23:21gfredericksright
23:21amalloybut it's slower
23:22gfredericksand the difference shouldn't matter when you're permuting a list of distinct things
23:22dnolenamalloy: does yours diverge for run 3 (permuteo [1 2] q)?
23:23amalloydnolen: yes
23:23dnolenamalloy: as I suspected
23:23dnolenanyways, I have some ideas to solve this issue - but it ain't happening anytime soon.
23:24gfredericksoh prolog diverges too when you reverse the args :D
23:25gfredericksman logic programming is hard
23:26brehautlets go shopping
23:26gfredericksI want a new conso action figure
23:26gfredericksdnolen: thanks for the clarification
23:27gfrederickswhat is the X in CLP(X)?
23:27gfredericksintegers up to 10? :)
23:55FrozenlockSeems 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?