#clojure log - Sep 07 2012

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

0:02 Frozenlock: Err.. how does one do this in cljs?: goog.i18n.DateTimeSymbols = goog.i18n.DateTimeSymbols_en_ISO;

0:03 I was thinking of bindings, but the variable isn't declared as dynamic

0:05 xeqi: (set! goog.i18n/DateTimeSymbols goog.i18n/DateTimeSymbols_en_ISO) ?

0:06 tomoj: djanatyn: thanks for what?

0:06 I was going to recommend (zero? x) instead of (= 0 x)

0:12 Frozenlock: xeqi: Thanks! (still untested). Is there the same function in clj? I don't remember ever using it! o_O

0:13 xeqi: Frozenlock: you can use set! to change public fields in java, but its rare to see them

0:14 that was a guess btw, but I imagine its something similar

0:15 I'm using it to play with three.js

0:16 Frozenlock: It does work, thank you very much :)

0:18 * Frozenlock checks three.js

0:20 Frozenlock: Oh wow, the demos are impressive!

0:44 dansalmo: Is there a way to bind a symbol during run time based on an evaluation besides using (load-string (str "(def "...

0:45 tomoj: why?

0:45 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

0:47 tomoj: wat?

0:47 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

0:47 tomoj: othx

0:53 dansalmo: Can list of symbols '(x y z) be defined at run time?

1:00 oyvindn: hmm, why is up to 5 arguments explicitly defined for "apply" with & args and not just args used (the first signature)?

1:04 antares_: dansalmo: (list (symbol "x") (symbol "y") (symbol "z"))

1:05 ,(list (symbol "x") (symbol "y") (symbol "z"))

1:05 clojurebot: (x y z)

1:39 dysinger: Is there an easier way to go from an EntrySet to a hash than this ? (reduce conj {} (.entrySet {:one 1 :two 2}))

1:39 ,(reduce conj {} (.entrySet {:one 1 :two 2}))

1:39 clojurebot: {:two 2, :one 1}

1:40 tomoj: reduce conj is into

1:40 dysinger: thanx

1:40 that's better

1:40 I'm uber rusty :)

1:41 tomoj: where'd you get an entryset?

1:41 dysinger: java interop

1:41 tomoj: ah

1:45 samrat: in noir, how do I set up routes so that calling a route with params sends a different respnse than without params

1:45 like /api would redirect to api-docs, but /api?url=.. would respond with json

1:46 can I do this without using if; something like function overloading?

1:47 tomoj: "without using if" is a strange requirement

1:48 samrat: tomoj: no, I just wanted to know if it was possible

1:51 amalloy: samrat: lambdas are turing complete; anything is possible

1:52 muhoo: ok, weird (for [i bar] (apply hash-map i)) works, but (map #(apply hash-map) bar) pukes

1:52 aren't they the same thing?

1:52 tomoj: #(apply hash-map) is nullary

1:53 muhoo: oh, duh %

1:53 * muhoo need sleep

1:53 muhoo: (map #(apply hash-map %) bar) works, sorry for noise

1:54 tomoj: is consensus that defpage is not evil?

2:01 dansalmo: antares_: I'm sorry, I meant is there a way to bind a value to each symbol in the list of symbols '(x y z)

2:02 antares_: ,(let [x y z] [1 2 3] y)

2:02 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:>

2:02 antares_: ,(let [[x y z] [1 2 3]] y)

2:02 clojurebot: 2

2:03 dysinger: argh I'm so rusty - what's the clojure equiv to haskell flip again ?

2:03 dansalmo: The symbols are in the list received as input, not avail during compile

2:04 the symbols in the list are not available until the program is running.

2:04 antares_: dysinger: (apply f (reverse args)) is the best I can think of

2:05 dansalmo: Can you show me a form that uses the list '(x y z)?

2:06 , (def (last '(x y z)))

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

2:06 antares_: dansalmo: I am afraid there is no such thing

2:07 dansalmo: ok, thanks

2:07 antares_: dansalmo: if you know the structure of your list of values, my example with let will still work

2:07 ,(let [xs '(1 2 3) [x y z] xs] y)

2:07 clojurebot: 2

2:08 dansalmo: my list is a list of undefined symbols, that I would like to define

2:11 antares_: dansalmo: but you know the structure of the list of values?

2:12 if you don't, I am not sure how you would use those locals later

2:12 dansalmo: consider using a map instead

2:12 it has exactly the key/value relationship you need

2:14 dansalmo: , (let [[x y z] [1 2 3]] (map eval '(x y z)))

2:14 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

2:15 dansalmo: this form picks up values from outside the form

2:15 amalloy: no it doesn't. it just breaks

2:16 dansalmo: actually, my list is nested, with repeated symbols, '(x z (y z))

2:16 you mean the form is not valid?

2:22 ' (let [[x y z] [1 2 3]] [(eval y)])

2:22 ,(let [[x y z] [1 2 3]] [(eval y)])

2:22 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

2:22 antares_: eval is disabled for clojurebot

2:23 dansalmo: this works, but I can not eval the list

2:23 antares_: dansalmo: instead of trying to do that just use maps

2:23 dansalmo: but I think what I am trying to do would have duplicate keys

2:24 antares_: dansalmo: use a proplist https://github.com/michaelklishin/chash/blob/master/src/clojure/clojurewerkz/chash/proplists.clj but what you are trying to do is crying for associative data structures

2:25 dansalmo: thanks, I will look at this

2:48 antares: nested list of maps ( {:x '()} {:z '()} ( {:y '()} {:z '()} ) ) and list of keys with new values '(:x '1 :y '2 :z '3) will work

2:48 I just need to figure out the most efficient way to apply the new values

2:49 antares_: nested list of maps ( {:x '()} {:z '()} ( {:y '()} {:z '()} ) ) and list of keys with new values '(:x '1 :y '2 :z '3) will work

2:50 can not map a func to a nested list

2:51 antares_: thanks for the help, I think it will work.

2:52 antares_: dansalmo: nice

3:24 kral: 'morning (here)

4:33 andersf_: g'morning (there)

4:38 ro_st: not for long!

4:38 anyone using datomic and can answer questions about how to go about writing maps of data to it?

4:44 AustinYun: ro_st: elaborate?

4:45 ro_st: so it allows you to make arbitrary entities and then pin attributed values to it

4:46 i'm wondering if anyone's gone through the process of taking a map of data and converted it into a series of datomic calls, and how that process went

4:48 eg, how to sanely and clearly marry keys in the map to attributes in the schema. simplest would be to use attribute idents in the map, but if, say you don't want to expose that information, due to the map coming in off the web, there'd need to be some lookups or whatever to link them together

4:48 this is more of an opinion-about-approach question than a how-do-i? question

4:55 AustinYun: so youre getting a map of kvps from the internet, and you want to update an entity in datomic? or add to the schema?

4:56 ro_st: add/update an entity in datomic

4:57 the use case is storing client-side user events. clicked this button, checked that box, visited this url, entered that text.

4:58 AustinYun: and why dont you want to use the datomic attributes in the map you get from clients?

4:59 ro_st: i'm not sure :-) some vague idea that it might be prudent not to

5:04 ok. i need to play more and pontificate less, obviously

5:05 AustinYun: well if you insist on basically translating the db keys to something else for the client, it seems the path of least resistance would be to write a translation fn that takes a client map, reduces through the keys and translates them, and then sends that off as a datomic transaction (also a map)

5:05 but i seriously must be missing something here and im well known as an idiot

5:06 ro_st: yes. my idiocy is that i haven't actually spent time in the repl with datomic yet. i'm sure that when i do, it'll all fall into place

5:07 AustinYun: i only started messing with it last week, so...

5:09 ro_st: what do you think, so far?

5:09 AustinYun: i'm testing it out because it seems like a natural fit for what i'm trying to do because of the way it deals with time

5:13 so far the whole immutable, simple data structures, which are also transactions, thing seems really cool

5:14 ro_st: yeah. i'm very enthusiastic

5:16 AustinYun: basically the fact that database transactions are just vectors of facts, is <3

5:16 ro_st: https://gist.github.com/2635666 was interesting to me

5:16 comes from http://pelle.github.com/Datomic/2012/07/09/transactions-as-entities/

5:19 ro_st: very cool

5:20 gotta go!

5:22 clgv: ,(doc dissoc-in)

5:22 clojurebot: No entiendo

5:22 clgv: :/

5:22 there is assoc-in but not dissoc-in?

5:25 jml: say I've got a vector of [x y] pairs and I want to filter on the 'x' bit, is there a more idiomatic way than (filter (fn [[x y]] (predicate? x)) x-y-pairs)

5:26 * jml checks to see whether that actually works

5:26 clgv: jml: (filter #(-> % first predicate?)) will work too with less pain

5:27 jml: clgv: ah, thanks.

5:27 I confess I still have a bit of trouble reading '->'

5:28 clearly I need to spend more time reading & writing clojure code :)

5:30 clgv: jml: it's semantically like piping ^^

5:30 AustinYun: so, on the tools side of things for writing clojure

5:30 clgv: with sequences it's ofter pretty handy to use ->>

5:31 AustinYun: i use vim normally but paredit is too nice to pass up -- anyone write keybindings for evil mode in emacs to rebind vim's movement keys to paredit ones?

5:31 jml: clgv: or like composition, but backwards!

5:31 clgv: looking up ->> now.

5:32 AustinYun: jml: ->> is basically ->, but puts stuff last instead of second

5:33 jml: AustinYun: thanks.

5:35 AustinYun: it's hard to google for operator names sometimes :p

5:36 jml: yeah. and the description in the API docs is rather technical.

5:39 AustinYun: jml: http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E#example_191

5:43 -> is ridiculously useful for accessing stuff from nested data structures, ->> more for chaining functions in my experience

5:45 (-> person :emplyer :address :city) is like person.employer.address.city in javascript or something

5:46 it literally never occurred to me to use -> to go through data structures until i read the docs, lol

5:46 jml: AustinYun: yeah, I've seen it mostly used for that in the stuff I've read.

5:46 AustinYun: i was like, "that's so clever! I'm an idiot for not thinking of that"

5:47 jml: I guess a lot falls out from keywords being functions.

5:47 AustinYun: the keyword <-> data structure function relationship is really useful

5:53 weavejester: Hm, the latest released versions of Lamina/Aleph seem to be incompatible in places.

5:55 Or maybe the class names are misleading. Perhaps the ResultChannel is actually a pipeline in 0.5.0

5:55 AustinYun: man if nobody's done a vim keybinding thing for emacs' paredit, i'm going to have to do it :\

5:56 i can't stand the emacs chords for moving around

5:56 weavejester: There's evil mode, which doesn't have bindings for paredit, but is quite customisable

5:56 However, Vim and paredit operate under two fundementally different philosophies

5:57 Vim is all about action + movement

5:57 While paredit treats the document as a tree

5:58 AustinYun: im actually using evil and paredit right now and the keyboard shortcuts kind of step on eachother, especially with xmonad

5:58 since M-( moves my friggin emacs window to workspace 9 lol

6:00 pyr: hey everyone, just to let you know that there is now a leiningen plugin in jenkins

6:02 AustinYun: i was thinking about for example, in evil normal mode, rebinding ( and ) to paredit-backwards and paredit-forwards

6:03 weavejester: AustinYun: That'll work so long as you don't treat them as proper movement keys

6:03 AustinYun: i.e. d) will probably not work

6:09 mpenet: weavejester: just curious, what is the issue with pipelines/result-channel ?

6:10 weavejester: mpenet: In 0.4.0 result-channel seemed to be a type of channel, but in 0.5.0 I think it's a pipeline

6:14 AustinYun: odd

6:14 mpenet: it is a separate type now, I dont think it's built on top of pipelines. But yes, 0.5.0 is almost a total rewrite in this respect I think

6:15 AustinYun: paredit-forward/backward outright do not work correctly in evil mode

6:15 but to the extent they DO work, they work properly as movement commands

6:16 weavejester: mpenet: It works like a pipeline anyway. merge-results works on the output of http-request

6:16 AustinYun: for some reason paredit-forward won't properly move from top level sexp to top level sexp, and paredit-backward basically just is move backwards by a word it seems

6:16 mpenet: yep, pipelines return a result-channel so that makes sense

6:18 weavejester: mpenet: Do you know if there's a function in aleph for reading netty ChannelBuffers?

6:18 mpenet: That's what's returned for the body of the http response

6:18 mpenet: weavejester: probably in aleph.formats, not sure though

6:18 weavejester: mpenet: Ah, thank you!

6:19 mpenet: there are a couple apparently

6:20 weavejester: you can also use :autotransform depending on what you are doing

6:20 weavejester: Like (http-request {:method :get :url url :autotransform true}) ?

6:21 mpenet: almost: :auto-transform true

6:22 but yes

6:22 weavejester: mpenet: Ah, perfect

6:23 mpenet: Well, except that I probably want to filter out content types, so I probably don't want them as strings right away

6:23 But channel-buffer->string works

6:23 mpenet: I think auto-transform checks for json and a couple of others

6:28 weavejester: mpenet: Do you know how you'd catch errors in an Aleph http-request ?

6:28 mpenet: weavejester: it seems it decodes the body for text json and xml content-types, and returns the raw body if unknown

6:28 weavejester: Ohh, wait, on-realized

6:29 mpenet: weavejester: it s just result channels, so you can use on-realize from lamina or run-pipeline

6:29 weavejester: mpenet: Can the callbacks on on-realized return a result, do you know?

6:29 mpenet: I almost always end up using run-pipeline

6:29 weavejester: mpenet: i.e. return the response on success, nil if not.

6:30 mpenet: weavejester: I wouldn't think so, you will need to check the status yourself

6:30 weavejester: mpenet: Ah, no, they do! :)

6:31 mpenet: oh, interesting

6:31 weavejester: mpenet: (on-realized response identity (constantly nil))

6:31 mpenet: weavejester: ah yes like this

6:31 weavejester: Now I just need to figure out how to apply that to merge-results

6:31 Oh, unless it already works...

6:31 mpenet: weavejester: but this wont work in practice

6:32 weavejester: mpenet: Hm? Why not?

6:32 mpenet: weavejester: 404 for instance wont emit an error

6:32 weavejester: the response completed successfully (no exceptions etc), you will have to check the status in the success handler or in a pipleline stage

6:33 weavejester: to be double checked, but I think that is how it works

6:33 Cheiron: Hi, would you please have a look at this macro http://pastie.org/4679152

6:33 weavejester: mpenet: But in on-realized you supply a success and failure callback, right?

6:33 mpenet: So if the success is identity, and the failure is (constantly nil) that should work?

6:34 mpenet: weavejester: yes, but result-channel failure and http response error code arent the same thing

6:34 weavejester: you wont get 500 errors 404 etc as an error

6:35 weavejester: Cheiron: You need to "~" the first request on line 2. Also, you could maybe use a function instead of a macro?

6:35 mpenet: Oh yeah

6:36 mpenet: I'll make sure anything with a status >= 400 is converted to nil

6:36 Cheiron: oh, true

6:37 mpenet: weavejester: yup, if you are in a pipeline you can throw an error to trigger the error handler, not sure that is what you want to do though

6:38 weavejester: mpenet: Hm, merge-results returns nil if there are any errors in its components. That makes sense, but...

6:38 I can use on-realized to realize a single result

6:39 But I really want to realized many at once

6:39 Cheiron: sorry but what is wrong this time? http://pastie.org/4679182

6:39 mpenet: weavejester: imo it might be better just to check that in a pipeline stage and return (complete nil) if the http code >= 400

6:40 weavejester: mpenet: Yeah, but I'm more thinking about how to handle exceptions like connection errors

6:40 mpenet: weavejester: what do you mean by realize many at once? parallelization of queries?

6:40 weavejester: mpenet: Well, many HTTP requests can be made in parallel with NIO

6:44 I wonder if I could do it by having...

6:44 (task (on-realized response indentity (constantly nil)))

6:44 mpenet: weavejester: yes, but this is handled by aleph under the hood, not sure what you mean. If you want some way to manage the responses (like handle then in the order they come back etc), you might want to use a channel or some sort of queue

6:45 weavejester: mpenet: I want to kick off N http-requests and discard the results of those that except.

6:45 mpenet: weavejester: you dont need task I think, http-request is non blocking by default, as long as you dont deref it straight away

6:46 weavejester: mpenet: Right, but how do I merge the results?

6:46 mpenet: If I do (merge-results good-resp bad-resp) then it will error for the whole

6:47 mpenet: "If any of the inputs are realized as an error, the async-result returned by merge-results will also be realized as that error."

6:49 mpenet: weavejester: you could use a channel where you enqueue the responses only if they are valid, and from there I think you can use fns (like reduce*) to do the merging

6:50 weavejester: mpenet: Hm, yes, that's a good idea...

6:51 I'm still getting used to thinking in terms of channels :)

6:51 mpenet: weavejester: there might be some higher level solution in Lamina to handle that, not sure

6:52 weavejester: mpenet: There's a join function that operates on channels, which I assume joins two channels into one. But… wait, I don't need that I don't think.

6:52 mpenet: I mean, I just need one channel for the results

6:53 mpenet: And the on-realized will enqueue on success and do nothing on error

6:53 mpenet: Then I just consume the channel

6:53 mpenet: weavejester: exactly

6:53 weavejester: that is how I would do it I think

6:54 weavejester: mpenet: I think you're right. I'm just too used to thinking functionally :)

6:56 mpenet: weavejester: there is some necessary evil in channels :)

7:05 Cheiron: sorry, network problems. what is wrong with this macro? http://pastie.org/4679301

7:08 mpenet: Cheiron: you need to quote what you want to expand

7:09 (macroexpand-1 '(resource-operations request :get get-fn))

7:09 Cheiron: also it seems the cond could be rewritten with case, avoiding some repetitions

7:10 Cheiron: why calling (resource-operations request :post get-fn) is giving: CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:14)

7:12 Apage43: grumble

7:12 mpenet: Cheiron: get-fn is nil as the Exception suggests

7:12 Apage43: trying to get at a java method that has both an int and a string overload

7:12 specifically, trying to get the int form

7:12 but it always winds up looking for a Long or long form, and not finding the right overload

7:13 Sgeo: Has anyone in here used JNAerator to make a Java wrapper for a C library and then used it from Clojure?

7:13 Apage43: even if I wrap it in (int)

7:13 Sgeo: Because I'm planning on doing something like that soonish

7:15 Apage43: .. fixed it

7:32 grayzone: hello to all : can anyone describe what is significate of[ #^Atrribute attr ]

8:13 Cheiron: for (defn resource-operations [request & {:keys [get post put delete head]}]) , is it possible to assign a name to the last named args map?

8:17 yes it is

8:17 :as

8:34 pepijndevos: What is the difference between the BitmapIndexedNode and the ArrayNode?

8:34 $mail

8:41 (in the implementation of PersistentHashMap)

8:53 bosie: i have a weird question as i am new to FP. how do i iterate through a list and keep information from previous entries at hand

8:53 in java i would simply use state to do it

8:54 hoeck1: bosie: depends on the kind of information you need

8:55 bosie: hoeck1: information i extract from previous entries

8:55 hoeck1: bosie: using reduce, you can keep and return single value

8:55 bosie: hoeck1: at the moment its up to 9 values

8:55 of a different type

8:55 cmiles74: bosie: well, you could build up a map or a vector or something.

8:55 hoeck1: with partition and partition-by in combination with map, you can access the n+1 or n-1 elements while mapping over a sequence

8:56 bosie: cmiles74: which i return plus the map i am already returning?

8:56 hoeck1: yes but i don't want to access elements. i want to access my distilled information, otherwise the algorithm would be n^2 instead of n

8:56 cmiles74: bosie: It's messy, but you could do that.

8:57 bosie: cmiles74: wouldn't that double the memory requirement?

8:57 cmiles74: since each iteration stores two instead of 1 map?

8:57 hoeck1: bosie: if its a tuned imperative algorithm, I personally wouldn't bother to convert it to FP style and just use (loop [] .. recur) to keep it fast

8:57 cmiles74: bosie: I don't wnat to argue too hard for this map in map thing. I was trying to say, you could build up your data structure through your use of reduce. I typed too slow, hoeck1 beat me to it.

8:58 bosie: cmiles74: oh no i just wanna know how i would code a similar usecase in clojure in the future

8:58 hoeck1: hmmm so there is no 'design pattern' for such use cases for FP?

8:59 Hodapp: I'm of the really pejorative opinion that design patterns are workarounds for weak languages...

8:59 bosie: Hodapp: well

8:59 hoeck1: bosie: there is, as cmiles74 suggested, using reduce and a map to store the loops state, but it may be inefficient and slower than the loop

8:59 bosie: Hodapp: so how do i solve my use case? ;)

9:00 Hodapp: there is no way clojure has no design patterns

9:00 hoeck1: bosie: maybe paste your code somewhere?

9:01 bosie: hoeck1: i have none as i don't know how to start….

9:01 hoeck1: i will try the reduce/map one

9:01 hoeck1: or the algorithms pseudocode? or the java version of it?

9:01 bosie: oh you don't wanna see the java version of it ;)

9:02 cmiles74: Myself, I use reduce to pull the bits I want out of a larger sequence (or map) and loop if I really am not reducing, for instance, when dealing with Java objects or something more complicated.

9:02 hoeck1: bosie: :), and what about simplified pseudocode?

9:02 bosie: ok lemme try

9:02 grayzone: Hello everyone, I'm new to clojure and I can not find the meaning of the characters # ^ Attributes, in the line: (startElement [uri local-name name-q # ^ Attributes atts] by xml.clj

9:03 cmiles74: grayzone: I believe that is hinting that the "atts" value is of the Java class Attributes.

9:05 grayzone: thanks cmiles74 ... at least now I have a track to follow

9:05 cmiles74: grayzone: Perhaps I read to fast, a hint is usually in the form (let [^Attribute atts] ...)...

9:06 Yes, that is a type hint. :) https://github.com/clojure/clojure/blob/master/src/clj/clojure/xml.clj#L35

9:07 grayzone: ok

9:07 nz-: how to get line numbers in emacs to start of every line? there is line-number-mode that puts number to bottom of each buffer

9:09 chronno: nz-: M-x global-linum-mode

9:11 nz-: chronno: thanks

9:11 chronno: nz-: np

9:17 nathanic: hello, i'm looking for clojure.tools.logging / log4j advice: how can i stop it from printing a line like "sun.reflect.GeneratedMethodAccessor3 invoke" before each log message?

9:20 uvtc: Hi grayzone. Clojure has syntactic sugar for a handful of things, and some of those use the hash mark as a prefix. Also, Clojure uses the caret for indicating metadata. #^foo is an older deprecated syntax for adding metadata.

9:23 grayzone: uvtc : thank's for clarification

9:25 uvtc: ..... xml.clj version (https://github.com/clojure/clojure/blob/master/src/clj/clojure/xml.clj#L35) has and only ^ and not #^ and did not understand why : case closed

9:25 nz-: nathanic: i have used logback-classic instead of log4j

9:26 nathanic: nz-: interesting, was that still via clojure.tools.logging?

9:26 nz-: yes

9:27 nathanic: you were getting the GeneratedMethodAccessor spam like me, and that inspired you to switch?

9:27 nz-: nathanic: https://github.com/jsyrjala/ruuvitracker_server/blob/master/resources/logback.xml and https://github.com/jsyrjala/ruuvitracker_server/blob/master/project.clj#L22

9:28 nathanic: nz-: thanks!

9:28 nz-: nathanic: no, I have started using logback with java stuff before I started playing with clojure

9:29 nathanic: in real life java work i use slf4j in front of log4j, but i must admit i've never delved very deeply into their guts

9:29 nz-: I believe that tools.logging is also using slf4j

9:29 dsabanin: hey guys

9:30 I'm having big issues with clojure in production :) some weird issue with threading

9:30 nz-: basically log4j development has stopped and the guy behind the log4j works now with the slf4j/logback instead

9:31 clgv: dsabanin: what exactly?

9:32 dsabanin: basically I have a clojure-resque client that is sending work to agents on each new job in the queue. It runs fine for a while and then it gets stuck, all agent threads become listed as "waiting on condition" and nothing is happening until I restart the process. When I restart things start working again for a while. Sometimes it lasts for days, sometimes hours, sometimes 10 minutes is enough for it to get stuck again

9:33 nathanic: nz-: interesting re: logback. also this ruuvitracker seems like it's going to be very cool

9:33 dsabanin: I connected to stuck process through jdb, but I can't seem to find anything useful

9:33 chouser: you can't see what the stuck threads are waiting on?

9:34 nz-: nathanic: we shall see, currently the problem is lack of firmware developers

9:34 dsabanin: I have a trace but tells me nothing -- all clojure-agent-send-pool threads are stuck in this trace: http://pastie.org/4679976

9:35 wmealing_: dejavu

9:35 dsabanin: which kernel ?

9:35 dsabanin: 2.6.32-5-amd64

9:35 wmealing_: ubuntu ?

9:35 dsabanin: Debian GNU/Linux 6.0

9:36 wmealing_: ok

9:36 i know there is a popen cow bug that may end up showing what you're saying happens

9:36 let me see if i can find the commit

9:38 dsabanin: wmealing_: thanks!

9:41 chouser: dsabanin: what version of java?

9:41 clojurebot: java.util.Date is the worst class in the entire JDK.

9:41 wmealing_: others can feel free to jump in and help..

9:42 it just sounds very familar to a problem i was solving

9:42 dsabanin: java version "1.7.0_04"

9:42 Java(TM) SE Runtime Environment (build 1.7.0_04-b20)

9:42 Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

9:42 wmealing_: https://bugzilla.redhat.com/show_bug.cgi?id=664931

9:43 * uvtc wonders why clojurebot brought that up out of the blue... or was it just something it had to get off its chest.

9:43 chouser: uvtc: fuzzy match between my use of "java" and "java.util.Date" would be my guess

9:43 uvtc: clojurebot: how was your date last night?

9:43 clojurebot: java.util.Date is the worst class in the entire JDK.

9:44 wmealing_: and he wonders why he can't keep a girl

9:44 chouser: dsabanin: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/util/concurrent/locks/AbstractQueuedSynchronizer.java#2043

9:44 Could it be that no more work is being sent to the agents?

9:45 dsabanin: chouser: hmmm, it could be

9:47 thanks for ideas and help guys

9:48 chouser: yeah, it looks to me like the agent threads are waiting for the next work item: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/util/concurrent/ThreadPoolExecutor.java?av=f#1043

9:53 dsabanin: good, so no bug in clojure at least :) probably a bug in resque-clojure lib

9:54 it probably doesn't handle well disconnects from redis server

9:55 wmealing_: dsabanin: -5 contains the patch.. they backported it

9:56 dsabanin: wmealing_: I asked our sysadmin guy, he says our kernel doesn't seem to be affected by that

9:56 wmealing_: ye

10:01 dfd: anyone here have experience with Chas Emerick's Friend library?

10:01 uvtc: ~anyone

10:01 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

10:01 wmealing_: cemerick may have.

10:02 but i do agree with clojurebot

10:02 clojurebot: botsnack

10:02 dfd: haha, cemerick most definitely would.

10:02 clojurebot: Thanks! Can I have chocolate next time

10:03 dfd: yeah, sorry to be vague. I'm trying to write a workflow for an OAuth2 flow (app.net in particular), and I'm having trouble figuring out what to return. I thought I was returning the right auth-map, but I keep going back to the callback--I'm getting a endless loop.

10:04 mpenet: dsabanin: resque-clojure doesnt seem to use testOnBorrow on the connection pool, maybe you have a bunch of dead/rotten connections there

10:04 uvtc: $mail samflores Thanks again for the tip using clostache. I ran with it and did this https://github.com/fhd/clostache/wiki/Using-Partials-as-Includes .

10:04 lazybot: Message saved.

10:04 dsabanin: mpenet: I checked with lsof, there were only 2 connections, but both at CLOSE_WAIT state when the issue is happening

10:10 kryft: Hmm.. https://github.com/kingtim/nrepl.el doesn't mention SLIME in the requirements; should I still install it separately?

10:10 xeqi: dfd: are you returning a value from friend.workflows/make-auth ?

10:11 kryft: no nrepl and slime are seperate

10:11 scriptor: kraft: nrepl.el should be all you need, it connects to the nrepl server on its own

10:12 essentially, it's a slime/swank replacement

10:12 kryft: Ah

10:12 dfd: xeqi: hi, yeah, I return the ring redirect response for the oauth redirect url when we don't have the code to get a token, and then after we get the token, I return an auth-map.

10:12 kryft: Apparently swank-clojure (which is recommended on clojure.org, but claims to be deprecated in favor of nrepl) was also a stand-alone slime replacement?

10:14 xeqi: it was a version of swank that supported clojure

10:14 * is

10:18 kryft: xeqi: Right, I'm just a bit confused because I've heard a lot of people talking about using SLIME and clojure, but apparently that's not strictly speaking true

10:18 dfd: xeqi: I know it's working up to a point, there's just some basic thing I'm not getting. This is a work in progress: https://gist.github.com/3666571

10:18 xeqi: kryft: nrepl.el just took over in the past couple weeks, its a transition point right now

10:19 swank-clojure still works, but no one is maintaining it

10:25 dfd: I think the :type needs to be ::friend/auth

10:26 dfd: assuming you requires [cemerick.friend :as friend]

10:26 dfd: xeqi: I don't think that's it; I've been dumping out data from the authenticate* function in friend.clj, and auth? evaluates to true

10:26 I feel really dumb, there's something I'm just not getting no matter how many times I've read through friend.clj

10:27 duck11231: Does friend only work with Ring apps, or can it be used for other types of request/response applications?

10:27 xeqi: &::auth

10:27 lazybot: ⇒ :clojure.core/auth

10:27 xeqi: &(= ::clojure.string/auth ::auth)

10:27 lazybot: ⇒ false

10:27 dfd: duck11231: as far as I know, it's just ring apps; it uses the ring response format pretty extensively to store session data and whatnot

10:28 xeqi: I actually had it as ::friend/auth before and it was failing there.

10:28 duck11231: That's annoying. I support a couple different request types (all similar to ring) and was hoping I could use friend to replace my custom auth flow

10:29 dfd: duck11231: well, you could fork it. ;-)

10:34 xeqi: dfd: are you using 0.1.0?

10:35 dfd: xeqi: yes, in fact I'm using a checked out version from github so I can do some dumping of variables directly in the friend code.

10:39 xeqi: dfd: after https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L186 whats new-auth?, (-> request :session ::friend/unauthorized-uri), and (-> request ::friend/auth-config :default-landing-uri) ?

10:41 dfd: xeqi: good question...I don't get past this line in friend.clj: (if (and workflow-result (not (auth? workflow-result)))

10:41 sorry, I'll give you a line number

10:41 xeqi: line 175, https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj

10:42 cemerick: dfd: right, this goes back to the :type ::friend/auth issue that xeqi mentioned

10:42 dfd: xeqi: so, right before my code is dying, I print out auth? and my workflow-result. The workflow-result is a legit (I think) auth-map, and auth? evaluates to true. But that conditional fails.

10:43 cemerick: according to `(not (auth? workflow-result))`, it's not ;-)

10:43 dfd: cemerick: doh, yeah, it must be as you say. Let me see what I'm doing wrong...

10:44 cemerick, xeqi: okay, yeah, now it's starting to come clear; if I make :type ::friend/auth, I get the endless redirecting I was talking about talking to cemerick privately

10:45 so, um, apparently I guess maybe my identity binding isn't working...

10:45 cemerick: dfd: redirecting to…which URI?

10:46 xeqi: checkinng the unauthorized-uri and default-landing-uri might help for the redirecting

10:46 cemerick: dfd: this would be easier if we could see the whole file, plus your application of the authenticate middleware.

10:46 dfd: yeah, sorry, one sec--

10:48 https://github.com/ddellacosta/friend-example/tree/master/src/friend_test

10:48 cemerick: the handler code was largely stolen from your example code, and the oauth2.clj file is (obviously) in progress.

10:49 forgive my goofy comments, I talk to myself in my "in progress" code...

10:51 kryft: xeqi: The swank-clojure page gives the impression that swank is a version of SLIME: "be sure you don't have any other versions of SLIME loaded"

10:52 djanatyn: hey, where's the zip function?

10:52 dfd: cemerick: I didn't answer your previous question: it goes through the whole flow, first hitting the redirect URL then again getting the access token. As far as the OAuth flow itself, that seems to be fine.

10:52 djanatyn: like, it takes two lists and a predicate that takes two arguments

10:53 (zip + [1 2 3] [1 2 3]) => (2 4 6)

10:53 cemerick: dfd: it's an infinite loop because the workflow handles all requests; it should limit its action to a defined workflow URI (or set of URIs, if you need to define a separate callback URI, etc). See: https://github.com/cemerick/friend/blob/master/src/cemerick/friend/openid.clj#L109

10:53 djanatyn: I can't find it on clojuredocs

10:53 kryft: Ugh, maybe I should just try to use swank-clojure for now. It's confusing enough learning emacs, evil and clojure without trying to deduce what to do with nrepl based on what people say about slime or swank-clojure. :)

10:54 scriptor: djanatyn: for that example you can actually use map

10:54 dfd: djanaytn: zipper? http://clojuredocs.org/clojure_core/clojure.zip/zipper

10:54 scriptor: ,(map + [1 2 3] [1 2 3])

10:54 clojurebot: (2 4 6)

10:54 djanatyn: oh! I remember that mapcar had that behavior too

10:54 scriptor: no, zipper is something else

10:54 djanatyn: I'm used to map :: (a -> b) -> [a] -> [b]

10:55 so, map can take an arbitrary number of arguments?

10:55 scriptor: djanatyn: yes, but map can take multiple collections

10:55 and it passes the next element of each collection to the function, so it can function like zip

10:55 djanatyn: cool! thanks.

10:55 dfd: cemerick: okay, the dense fog is slowing lifting...

10:55 djanatyn: you guys are very helpful.

10:56 ...I forgot why I wanted to use zip, though

10:56 dfd: cemerick: oh! how stupid of me, I think I get it--it's trying to process every request, but it should filter the url of the request...doh

10:58 * Hodapp smells Haskell

10:58 djanatyn: Hodapp: haskell's type system is sometimes the most concise way to explain what I mean :)

10:59 * Hodapp wants to learn Haskell.

11:00 hyPiRion: Is there a shorter way to write ##(map #(map inc %) [[1 2 3 4] [5 6 7 8]]) ?

11:00 lazybot: ⇒ ((2 3 4 5) (6 7 8 9))

11:00 casion: where can I see good examples of (lazily) parsing input-streams in clojure?

11:00 hyPiRion: Or, well, maybe more idiomatic.

11:01 zerokarmaleft: when i call gen-class, if i specify :extends/:implements does the runtime automatically import the parent classes into the current ns?

11:02 i suspect it does, but i'm needing a sanity check

11:03 jparishy: Does reify create a concrete class on the JVM? Because when I pass an object created by reify that implements an interface to .getClass, I definitely don't get what I expected

11:03 chouser: jparishy: yes

11:06 casion: hyPiRion: is it always 2d? to me a list comp would be more readable

11:08 hyPiRion: casion: so ##(for [x [[1 2 3 4] [5 6 7 8]]] (map inc x)) instead?

11:08 lazybot: ⇒ ((2 3 4 5) (6 7 8 9))

11:09 hyPiRion: I don't know what's mor idiomatic, but it's a bit more readable, I agree.

11:09 casion: hyPiRion: that seems more in line with what I've seen done in the clojure code I've browsed

11:10 TimMc: hyPiRion: (map (partial map inc) ...)

11:11 zerokarmaleft: hyPiRion: i think your first nested map is still readable

11:12 it follows the structure of the seq you're passing

11:13 hyPiRion: zerokarmaleft: it's more messier when you do something like this:

11:14 (map (fn [is] (map #(get-in b %) is)) ...)

11:14 and well, (map (partial (map (partial get-in b))) ...) isn't that beautiful either.

11:15 jparishy: chouser: so this would be expected? https://gist.github.com/3667031

11:16 zerokarmaleft: hyPiRion: i wonder if you could write a nested-map function that repeats those calls to an arbitrary depth

11:16 chouser: jparishy: yup, that's a classname believe it or not

11:17 zerokarmaleft: or at least depth 2, for the simple case

11:18 hyPiRion: Well, for me, it's all about readability, as long as one doesn't overengineer it.

11:19 jparishy: Heh, alright. thanks

11:26 casion: I am having a revelation… when you realize there isn't a library for something you think should be really simple, it's probably far from it.

11:44 Frozenlock: casion: Seems like a great thought

11:44 I'll be sure to remember it.

11:45 casion: Frozenlock: great for you maybe, for me it's borderline infuriating ;)

11:46 Frozenlock: I have my own rule of thumb: If it looks simple, it will take you 4x as much time as you think. If it looks complicated, don't even start.

11:46 casion: haha :)

11:47 every time I find a spec for a new format I want to support, I end up finding out that no one implements it correctly… and that's now my problem to support all the various bastardizations of it

11:48 uvtc: You guys, this is old hat stuff. The first one is well known as casion's conjecture, and the second is referred to as Frozenlock's formula.

11:49 Frozenlock: lol!

11:49 casion: woohoo, I'm e-famous!

11:49 Frozenlock: Yay, power to the pseudonym!

11:49 casion: when do the paychecks start rolling in?

12:03 Frozenlock: I can't believe the power cljs gives me over a webpage; I feel like a god!

12:03 casion: which one?

12:03 solussd: is there a way to provide a "transform", or something that happens when a auto generated constructor (e.g. ->Record or map->Record) is called?

12:04 Frozenlock: casion: Anubis, who else?

12:04 solussd: i'm guessing the answer is no, but it would be a nice feature- maybe something you specify when you declare the record

12:05 casion: Frozenlock: considering what cljs is, and how many gods ra absorbed… I'd think ra ;)

12:06 Frozenlock: But, but, Anubis almost destroyed earth! If it wasn't for SG1...

12:06 pepijndevos: Anyone familiar with clojure internals? I'm trying to understand https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java

12:07 It seems the only difference between ArrayNode and BitmapIndexedNode is that the formar only contains nodes, while the other possibly contains leafs?

12:08 Is that an optimization?

12:08 I read this: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/ but it seems super simplified.

12:08 on the other hand, the current implementation does not contain empty and single nodes.

12:15 chouser: pepijndevos: This stuff has changed quite a bit since I last looked at it, but it appears ArrayNode also don't bother with a bitmap mask -- it just always has a 32-node array.

12:17 pepijndevos: chouser: huh, so the bitmap mask is not a 32 element array?

12:17 That is what I understood from the deftwice article

12:17 chouser: bitmap is an int: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L571

12:18 pepijndevos: I need to study this. I'm beginning to see why my C implementation was slower than Clojure

12:19 chouser: but it seems to be used like an array of bits?

12:28 chouser: pepijndevos: where? I see places where it's bit-shifted with >>>, counted with bitCount, bit-or'ed with |

12:30 dnolen: pepijndevos: that's the whole idea being Bagwell's array mapped hash trie. rhickey changed the array into a integer in his implementations.

12:33 pepijndevos: actually I'm probably wrong about that - http://en.wikipedia.org/wiki/Hash_array_mapped_trie

12:33 pepijndevos: dnolen: so what is this integer used for? I thought that was like an index into the array[32] of nodes

12:33 oh

12:33 dnolen: pepijndevos: the path

12:34 pepijndevos: dnolen: right, in sections of 5 bits, which map to 32 elements per level

12:34 dnolen: pepijndevos: yes

12:35 pepijndevos: dnolen: so then both arraynode and bitmmapindexednodes have an array of 32 items, I think. Except, one is an array of nodes, and the other of object keys and values(acually 64 elements)

12:36 bobbywilson0: is there a way to do this?

12:36 ,(conj '(1) '(2))

12:36 clojurebot: ((2) 1)

12:36 bobbywilson0: and get ((2) (1))

12:37 pepijndevos: concat

12:37 no

12:37 seq?

12:37 clojurebot: seq is what

12:37 chouser: list

12:37 pepijndevos: ,(list '(1) '(2))

12:37 clojurebot: ((1) (2))

12:38 bobbywilson0: chouser: thanks!

12:38 * pepijndevos does to many programming languages at the same time

12:38 cark: hello all, I think i found a little bug in algo.monad is there a maintainer i could talk to ?

12:39 bobbywilson0: pepijndevos: thanks! as well

12:39 cark: also an efficiency issue, got solution for both of these

12:39 (simple solution)

12:40 uvtc: What database would you recommend using with a small/medium Clojure webapp? I don't expect a large amount of traffic. Was going to use something like SQLite as I'm already familiar with it... Have not yet tried CouchDB. Not sure exactly what to make of Datomic.

12:40 technomancy: uvtc: there are better embedded DBs on the JVM that SQLite

12:41 SQLite has to do some crazy C interop

12:41 uvtc: technomancy: Right.

12:41 technomancy: I've been pointed toward Derby and H2 and another one to use rather than SQLite.

12:42 Not sure about hosting. I've heard Heroku is pretty easy to use.

12:42 technomancy: it's true! =)

12:42 ibdknox: lol

12:42 uvtc: technomancy works for heroku ;)

12:42 technomancy: if you're on Heroku then Postgres is the way to go

12:43 dnolen: pepijndevos: looking the ClojureScript implementations it seems like ArrayNodes don't hold values.

12:43 ibdknox: uvtc: though I will happily attest to its simplicity and ease of use

12:43 cark: postgres is awesome, why go for the lesser solutyion when it is so readily available

12:44 technomancy: if you know you're never going to grow beyond a single process or need redundancy then an embedded DB is a lot simpler to get going with

12:44 uvtc: ibdknox: thanks. I'm not too sure what to make of it (what with the manifolds and dynoplexes and control surfaces :) ).

12:44 pepijndevos: dnolen: right. just to save space? seems to add a lot of complexity

12:44 uvtc: lingo

12:44 technomancy: haha

12:45 cark: technomancy: yes and no, that's learning a whole new model, how are transactions behaving and such

12:45 pepijndevos: (dnolen, link?)

12:45 ibdknox: uvtc: haha, yeah don't worry about their terms. The only thing you need to know is that you can git push and then scale the number of processes running that

12:45 uvtc: that's basically all there is to it

12:45 technomancy: one of these days I'm going to give BDB a shot

12:45 ibdknox: BDB?

12:45 uvtc: Can I use an embedded db (where the db is just a file in my project dir) with Heroku?

12:45 dnolen: pepijndevos: I'm assuming it was done for performance reasons, look at the CLJS source man :)

12:46 pepijndevos: relevant method is inode-lookup.

12:46 pepijndevos: both BitmapIndexedNode & ArrayNode implement it.

12:46 technomancy: uvtc: no, the filesystem is ephemeral on Heroku, same as EC2

12:46 ibdknox: berkeley DB

12:46 uvtc: cark: Thanks for the recommendation. I've used MySQL in the past, but not Postgres yet.

12:46 technomancy: embedded KV store

12:47 ibdknox: ah

12:47 pepijndevos: dnolen: ok, will try to navigate cljs

12:47 cark: uvtc: then go for mysql, unless you've got time to learn postgres. mysql is also available everywhere

12:48 technomancy: anyway, if you're not distributing the app to others who might have a low tolerance for complicated installation procedures then I'd go with postgres.

12:48 cark: uvtc: support is good for both in clojure and in the jvm

12:48 uvtc: technomancy: above you said, "if you know you're never going to grow beyond a single process or need redundancy then an embedded DB is a lot simpler to get going with", but just now you wrote that I can't use a little db file because the filesystem is ephemeral... (?)

12:48 technomancy: uvtc: right, because redundancy is built-in to the assumptions on heroku

12:49 chouser: uvtc: have you considered datomic? I'm itching for an excuse to use it, but haven't had one yet.

12:49 uvtc: Is "embedded db" == that little .sql file in my project dir?

12:49 technomancy: that is, you don't actually get redundancy on the free tier, but it forces you into patterns of application design that make redundancy easier

12:50 ibdknox: I wish they'd work on presenting datomic a bit better

12:50 cark: is it possible to have all of datomic in-process ?

12:50 madsy: Not far from NY and it's another state, lol

12:50 Sorry wrong channel

12:50 uvtc: chouser: Not sure what to make of datomic. That is to say, I'm not exactly sure what it is or how I'd use it. That's what I meant above by "not sure what to make of it".

12:50 Apage43: cark: there's an in-memory only way to use it, but I don't know that you get transactions?

12:51 technomancy: postgres unfortunately doesn't optimize for getting started at all

12:51 abalone: sorry if this question is dumb but is Light Table open for people to write plugins ? or is that for later?

12:52 ibdknox: abalone: the playground isn't yet

12:52 abalone: primarily because it makes big swings every couple of weeks and I will make absolutely no claim of stability

12:52 uvtc: technomancy: I'm looking at the postgres docs right now. Thanks for the tips.

12:52 solussd: mongodb + monger (clojure library) is the way to go for web apps, imo. Fast and better suited for storing data composed of arrays, maps, etc.

12:53 also, heroku has mongohq support via 'add-ons'.

12:53 technomancy: uvtc: I've been working on a simple postgres app on heroku if you want a sample to work from: https://github.com/heroku/buildkits

12:53 abalone: ibdknox: is there an old version that people can play with (in terms of practicing the mere act of writing a plugin) ?

12:53 technomancy: it also uses hstore, but the jdbc support for hstore is currently extremely sketchy, so I'd recommend waiting on that for now =(

12:54 ibdknox: abalone: no, though something along those lines might show up in not too long. Is there something specific you're wanting to do?

12:54 uvtc: technomancy: Thanks. Will read up on what "buildkits" and "buildpacks" are.

12:55 technomancy: uvtc: that's not really relevant to the topic at hand, but if you're interested ... =)

12:55 uvtc: in particular see the instructions for running postgres in user-space

12:55 when developing

12:55 abalone: ibdknox: i'd like to try paredit. i'm 100% sure that if paredit exists for light table in the future it will have been written by someone else much faster and in a better fashion but i'd like to try as an exercise

12:55 technomancy: typically postgres wants to run as a system daemon, which is appropriate for production but kinda crappy for dev.

12:55 ibdknox: abalone: so you can build paredit around codemirror directly. :)

12:56 abalone: ibdknox: oh ok :)

12:56 has someone already tried?

12:56 ibdknox: abalone: and that would be a *very* welcome project!

12:56 abalone: not that I know of

12:56 uvtc: technomancy: I can't think of any reason why it'd be a hassle to have postgres running locally for dev.

12:56 ibdknox: though I haven't done a ton of digging

12:57 pepijndevos: dnolen: okay, makes sense now. But… take a look at inode-assoc. ouch. Who implemented this? I'm curious to know the speed improvement.

12:57 dnolen: pepijndevos: speed improvement over what?

12:57 abalone: i'll look into it but i really must emphasize that i hope this doesn't cause The Right Person to skip doing it just because i said i'll make feeble efforts

12:58 ohpauleez: abalone: what's the project? (late to the party)

12:58 ibdknox: abalone: maybe "the right person" ends up being you, or helping with your impl

12:58 pepijndevos: dnolen: over just using one type of bitmap node that has nodes and leaves in a big array.

12:58 abalone: ohpauleez: paredit for codemirror

12:58 i just can't code without it, so i really want it for light table

12:58 ohpauleez: ahhh - that would indeed be absolutely great

12:58 dnolen: pepijndevos: because rhickey probably knows he's doing and we don't. We just ported the Java.

12:59 abalone: coding lisp without paredit feels like coding with a pen and paper

13:00 pepijndevos: dnolen: okay. to bad rhickey isn't on irc much lately. (read: since 1.2 or so)

13:00 kang: question: is there any corresponding function of the R's which.max function in clojure/incanter?

13:00 dnolen: pepijndevos: even if he was he probably say read the code like 10 more times ;)

13:01 pepijndevos: I'm sure if you think about it some more you'll some kind of complexity advantage.

13:01 see some

13:03 pepijndevos: dnolen: hah, probably.

13:03 dnolen: maybe I can just strip the cljs from the arraynode and see what happens

13:04 dnolen: pepijndevos: getting that code to work under Clojure should require trivial changes ;)

13:05 pepijndevos: dnolen: dinner time. I'll ping you if I have any significant revelations.

13:08 serpent213: hi

13:09 i have a function call (clj-http.client/get) which works fine on the repl but does not return in production. how can i debug this...?

13:10 could it be a threading issue? i use futures here and there...

13:11 aperiodic: usually when someone runs into a difference between the repl and anywhere else, it's something to do with laziness

13:11 the REPL forces evaluation of lazy sequences

13:13 serpent213: the only argument is the URL, which looks good in the log directly before the "get"

13:14 the logging call afterwards does not get evaluated

13:20 jkkramer: serpent213: could the call be throwing an exception? clj-http throws on 404 etc by default

13:21 serpent213: jkkramer: no, the call does not return, no log output

13:22 the same code did already work in another callchain... i'm really puzzled :(

13:24 jkkramer: serpent213: what does "not return" mean if not an exception? it times out, returns nil, …?

13:27 casion: ,(time (= (seq (byte-array (map byte (range 100)))) (seq (byte-array (map byte (range 100))))))

13:27 clojurebot: "Elapsed time: 11.256664 msecs"

13:27 true

13:27 casion: ,(time (java.util.Arrays/equals (byte-array (map byte (range 100))) (byte-array (map byte (range 100)))))

13:27 clojurebot: "Elapsed time: 9.752234 msecs"

13:27 true

13:28 serpent213: jkkramer: good point. the following statement is never executed, so i assume it just hangs somewhere in the clj-http code forever...

13:28 casion: hum, seq is always faster here by a factor of 2

13:29 jkkramer: serpent213: if it's on another thread, it might be throwing an exception you're not seeing

13:33 ,((fn [] (future (println "foo") (throw (Exception.)) (println "bar")) :done))

13:33 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

13:44 nz-: I am getting this error with clojurescript: Uncaught Error: No protocol method IWatchable.-notify-watches defined for type object: {}

13:45 I have an atom that holds {}, and I am using swap! to update it

13:46 what I am doing wrong?

13:47 serpent213: jkkramer: where do these exceptions end up...? how can i catch them?

13:47 nz-: I dont have any watches

13:50 seems that the value gets updated

13:52 fenton: can anyone comment on my inability to read a resource file defined in a clojure library from java? https://github.com/ftravers/PublicDocumentation/blob/master/clojure/resource-file.md

13:53 simple example at above url

13:54 jkkramer: serpent213: you catch them on the thread they're thrown on

14:00 pepijndevos: does vimclojure work with nrepl already? I see there is a branch.

14:01 tanzoniteblack: pepijndevos: somebody was asking about that yesterday, and the best response I heard was "um...maybe?". apparently it's still in progress, but can't hurt to go ahead and try it out if you see the branch so you can report what's broken

14:02 pepijndevos: tanzoniteblack: The problem is setting it up. Maybe I need to say wantnrepl = "paht/tonrepl/client"

14:02 serpent213: jkkramer: (log/info) does work in the thread, so i assumed exceptions would be printed out as well...

14:03 jkkramer: i'll dig deeper in that direction, thanks a lot! :)

14:04 pepijndevos: tanzoniteblack: from what I can tell, the client is there, but the plugin itself is not.

14:05 aperiodic: serpent213: the exceptions will bubble up when the future is deref'd

14:07 tanzoniteblack: pepijndevos: I'd say that nrepl isn't up and working with vim yet then, which is a much more definitive answer then was given yesterday, so thanks for exploring that. Of course...by the next time someone asks that in #clojure the answer will probably have changed....but oh well

14:07 pepijndevos: tanzoniteblack: https://twitter.com/kotarak/status/240069366224416768

14:07 serpent213: aperiodic: i never deref some of them -- does clojure deal with this? or is it bad style?

14:08 pepijndevos: https://bitbucket.org/kotarak/vimclojure/issue/82/use-nrepl

14:12 nz-_: well, my problem was that I was trying to swap! a map, and not an atom

14:19 aperiodic: serpent213: this is mostly speculation, but i think those computations would just terminate, and the thread pool would move on to other things. should have no ill effects

14:22 dnolen: ninjudd: is drip supposed to work w/ lein 2 only?

14:28 serpent213: aperiodic: good to hear, thx :)

14:32 jkkramer: connection refused -- you are my hero! :* ,)

14:33 jkkramer: serpent213: glad I could help

15:19 wting: Running `lein new foobar` gives me "Could not transfer artifact [...] from/to central [...] connection to http:// refused."

15:19 I'm not sure what to do to get leiningen working

15:20 xeqi: wting: what version?

15:21 wting: xeqi: 20120722-1 from github.com/technomancy/leiningen

15:25 The above was from Arch's package repo. I've downloaded and installed directly from the repo now with the same issue.

15:25 from the GitHub repo*

15:26 xeqi: k, does it just say "http://&quot; or does it have a full url?

15:26 wting: just http

15:26 Well.. "Could not transfer artifact lein-newnew:lein-newnew:pom:0.3.5 from/to central (http://repo1.maven.org/maven2): Connection to http:// refused"

15:27 and "Could not transfer artifact lein-newnew:lein-newnew:pom:0.3.5 from/to clojars (https://clojars.org/repo/): Connection to http:// refused"

15:28 xeqi: hmm, what does `lein version` give you?

15:28 chouser: How does one build clojure these days? Just typing "ant" failed on a test generative dep

15:28 wting: Same errors, here's the full error message: http://pastebin.com/yLciNDBV

15:29 xeqi: k, how are you installing it from the repo?

15:30 wting: Following the instructions from the repo: https://github.com/technomancy/leiningen#installation Basically downloading, chmod+x lein, ./lein repl

15:31 Bronsa: chouser: maven install?

15:32 xeqi: k, then you should have preview10

15:32 can you browse to https://clojars.org/ ?

15:33 wting: yup, what's preview10?

15:33 xeqi: the version

15:33 chouser: Hm, skipping the tests works for now

15:33 serpent213: aperiodic: guess you were right: http://grokbase.com/t/gg/clojure/119wytxaph/are-futures-garbage-collected

15:36 xeqi: wting: do you have a ~/.lein/profiles.clj

15:38 wting: nope, only have ~/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar

15:39 dnolen: chouser: 'mvn package' works for me.

15:39 chouser: ah, ok. Didn't realize ant wasn't fully supported anymore.

15:39 wting: I just removed ~/.m2 and ~/.lein and tried running lein again, same result.

15:40 nbeloglazov: Is there a reason why map-indexed takes only 1 collection?

15:41 S11001001: nbeloglazov: 'cause if you're using more than one there's no real benefit, just pass (range) as one of them

15:41 nbeloglazov: S11001001: ah, cool. Thanks

15:42 Didn't think about range :\

15:42 S11001001: as it is map-indexed is kind of trading clarity for efficiency (quick, does the number come first or second?)

15:43 as a fun challenge, implement map on two-or-three seqs with full chunking support :)

15:44 xeqi: wting: it sounds like its setup right. the refused connections are weird, almost like theres a proxy or something in the way messing it up

15:45 wting: xeqi: I don't know, I just logged into my Debian VPS, went through the same steps and got the same result.

15:45 * wting is trying it on my Ubuntu server

15:48 wting: Same problems with Ubuntu. These 3 boxes (Arch, Debian, and Ubuntu) are in 3 separate states...

15:49 xeqi: hmm

15:49 now I really don't want to delete my ~/.m2 and try it

15:49 wting: lol

15:49 you can always just back up ~/.m2 and ~/.lein

15:49 or create a new test user

15:50 but thanks for your help anyway

15:50 xeqi: yeah, realized that after a moment

15:50 wting: I gotta run, I'll probably report it to GitHub issues tonight

15:52 xeqi: wting: https://www.refheap.com/paste/4927 works :/

15:53 wting: wth

15:53 lemme ssh into a university CS machine and try it

15:54 http://pastebin.com/20g0MaXg

15:54 Same result. :-/

15:55 Sgeo: Why does awtbot provide a with-robot macro?

15:55 It doesn't seem to be significantly different from doto?

15:58 scriptor: Sgeo: readability, maybe?

15:58 xeqi: it is doto

15:58 Sgeo: I just played a bit with type-text

15:58 It seems to be a bit slow

15:59 xeqi: wting: try `lein self-install` before `lein new ..`

16:26 nz-_: is there a function for removing duplicates from a list? like unix command uniq?

16:26 Raynes: &(distinct [1 1 2 2 3 2 4 5 6])

16:26 lazybot: ⇒ (1 2 3 4 5 6)

16:26 nz-: (doc distinct)

16:26 clojurebot: "([coll]); Returns a lazy sequence of the elements of coll with duplicates removed"

16:27 nz-: ok, how about one where I can provide function that decides what is "equal"?

16:28 Raynes: Can't help ya there.

16:28 Cheiron_: Hi, what is the recommended clojure lib to work with Kafka?

16:29 nz-: [{:a 1 :b 2} {:a 1 :c 3} {:a 2 :d 4}] here entries that have same value for :a would be identical and duplicates need to be dropped (doesn't matter which one gets dropped)

16:29 ohpauleez: nz-: I think at that point you're into filter territory

16:30 and this question just came up a few months ago

16:30 maybe a few weeks aog

16:30 in here

16:30 I din't recall the answer

16:30 aperiodic: maybe something with group-by :a?

16:31 nz-: ok, group-by :a, loop over list and take first item from each list

16:32 aperiodic: (for [[v dups] (group-by :a coll)] (first dups))

16:32 yeah

16:33 metellus: ,(group-by :a [{:a 1 :b 2} {:a 1 :c 3} {:a 2 :d 4}])

16:33 clojurebot: {1 [{:a 1, :b 2} {:a 1, :c 3}], 2 [{:a 2, :d 4}]}

16:33 metellus: ,(map first (vals (group-by :a [{:a 1 :b 2} {:a 1 :c 3} {:a 2 :d 4}])))

16:33 clojurebot: ({:a 1, :b 2} {:a 2, :d 4})

16:34 nz-: thanks

16:35 metellus: or use partition-by

16:35 and you can get first of the (vals ...)

16:35 nz-: (doc parititon-by)

16:35 clojurebot: Pardon?

16:36 metellus: and you can get rid of the (vals ...)

16:36 nz-: (doc partition-by)

16:36 clojurebot: "([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions."

16:36 metellus: ,(partition-by :a [{:a 1 :b 2} {:a 1 :c 3} {:a 2 :d 4}])

16:36 clojurebot: (({:a 1, :b 2} {:a 1, :c 3}) ({:a 2, :d 4}))

16:37 nz-: by the way, is there a faq or a cookbook like thing for these kinds of questions?

16:38 devn: clojurebot: the cheat sheet coupled with clojuredocs.org and a repl

16:38 clojurebot: clojure.repl in swank is not useful for two reasons: 0) everything it provides has an enhanced version in slime and 1) having to re-refer it every time you changed namespaces would be annoying

16:38 tmciver: metellus: partition-by only works for consecutive duplicates, yes?

16:38 devn: err nz- ^

16:39 metellus: oh, right. group-by it is, then

16:39 uvtc: nz- : There's this http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Cookbook

16:39 devn: be careful!

16:39 it's badly out of date

16:40 unless someone has been giving it some time and energy

16:40 uvtc: Yeah, not sure who maintains that wiki. Changes seem to take a while to be approved.

16:41 Sgeo: ,(doc assoc!)

16:41 clojurebot: "([coll key val] [coll key val & kvs]); Alpha - subject to change. When applied to a transient map, adds mapping of key(s) to val(s). When applied to a transient vector, sets the val at index. Note - index must be <= (count vector). Returns coll."

16:41 uvtc: There's http://rosettacode.org/wiki/Category:Clojure , but it's not quite a cookbook.

16:45 mefesto: is clojure.xml/emit meant to be used? it's public in the source but listed in the api docs

16:54 Raynes: $findfn [1 2 1 2 3 3] [1 2 3]

16:54 lazybot: [clojure.core/distinct]

16:54 Raynes: xeqi: Fixed findfn.

16:55 nz-: Raynes: findfn tries every function until it find match?

16:55 Raynes: Pretty much.

16:55 typeclassy: very cool

16:56 nz-: is there some doc that tell what tricks the bots can do?

16:56 Raynes: Not really.

16:56 You can browse his plugins on irc

16:56 $whatis source

16:56 lazybot: source is http://github.com/flatland/lazybot

16:56 Raynes: src/lazybot/plugins

16:56 He can even tell you the weather.

16:56 $conditions 35554

16:57 lazybot: Last Updated on September 7, 3:12 PM CDT; Partly Cloudy; Dewpoint: 74 F (23 C); Precipitation today: 0.00 in (0 mm); Temperature: 89 F (31.7 C); Windchill: NA; Wind speed: 2mph; Wind gust: 5.0mph; URL: http://www.wunderground.com/US/AL/Eldridge.html.

16:57 hyPiRion: Hot.

16:57 uvtc: lazybot: fortune

16:57 lazybot: Never Graduate

16:58 Raynes: hrm. I thought I deleted that plugin.

16:58 nz-: $source partition-by

16:58 lazybot: partition-by is http://is.gd/rB7Az4

16:58 Raynes: That one needs fixed too.

16:58 It is pointing at the wrong tag and stuff.

16:58 uvtc: lazybot: leet this message

16:58 $leet this message

16:58 muhoo: $40

16:59 Raynes: lazybot: elite this message

16:59 lazybot: 7h!5 m355493

16:59 uvtc: Ooof.

16:59 tanzoniteblack: lazybot: elite Raynes: this plugin seems terribly unnecessary

16:59 lazybot: r4yn35: 7h!5 p1u9!n 533m5 73rr!81y unn3c3554ry

16:59 Raynes: Indeed, that was on my deletion list as well. :p

16:59 aperiodic: is there an inverse?

17:00 Raynes: Don't think so.

17:00 uvtc: lazybot: help

17:00 lazybot: You're going to need to tell me what you want help with.

17:00 ivaraasen: Raynes: I reckon the weather forecast only works for US zip codes?

17:00 Raynes: $help elite

17:00 lazybot: Raynes: Takes words and replaces them with their leetspeak alternatives.

17:00 muhoo: lazybot: leet 1337

17:00 Raynes: ivaraasen: You can give it names too. wunderground seems to have information for other countries.

17:01 $conditions Melbourne, Australia

17:01 lazybot: Last Updated on September 8, 6:58 AM EST; Mostly Cloudy; Dewpoint: NA; Precipitation today: 0.00 in (0 mm); Temperature: 51.3 F (10.7 C); Windchill: NA; Wind speed: 7.6mph; Wind gust: 12.6mph; URL: http://www.wunderground.com/global/stations/94868.html.

17:01 uvtc: $timer 0:0:5 surprise!

17:01 lazybot: Timer added.

17:01 surprise!

17:02 uvtc: tehehe

17:02 Raynes: That plugin needs rewritten so bad.

17:02 tanzoniteblack: $("$conditions Palo Alta, CA")

17:02 cemerick: Raynes: lazybot needs a timezone plugin.

17:02 tanzoniteblack: ,("$conditions Palo Alta, CA")

17:02 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>

17:02 Raynes: cemerick: That would do?

17:03 uvtc: $pwd

17:03 cemerick: lazybot: time in Hong Kong

17:03 lazybot: cemerick: The time is now 2012-09-07T20:59:58Z

17:03 ivaraasen: $conditions Hell, Norway

17:03 lazybot: Last Updated on September 7, 4:55 PM EDT; Scattered Clouds; Dewpoint: 61 F (16 C); Precipitation today: 0.00 in (0 mm); Temperature: 80.3 F (26.8 C); Windchill: NA; Wind speed: 0.0mph; Wind gust: 5.0mph; URL: http://www.wunderground.com/US/MI/Hell.html.

17:03 cemerick: oh, there we go :-P

17:03 Raynes: cemerick: That didn't do what you thought it did.

17:03 hyPiRion: What, that can't be true

17:03 ivaraasen: wrong Hell :(

17:03 hyPiRion: ivaraasen: yeah, I wondered.

17:03 $conditions Trondheim

17:03 lazybot: Last Updated on September 7, 10:50 PM CEST; Mostly Cloudy; Dewpoint: 41 F (5 C); Precipitation today: 0.00 in (0.0 mm); Temperature: 46 F (8 C); Windchill: 41 F (5 C); Wind speed: 12mph; Wind gust: 0mph; URL: http://www.wunderground.com/global/stations/01271.html.

17:04 tanzoniteblack: ,(println "$conditions Palo Alto, CA")

17:04 clojurebot: $conditions Palo Alto, CA

17:04 lazybot: Location not found.

17:04 cemerick: Raynes: bummer.

17:04 Raynes: I don't think I ever fixed space handling in the weather plugtin

17:04 It is probably looking for Alto, CA

17:04 tanzoniteblack: Raynes: that would explain why there's no Palo Alto, though I was really just curious if I could feed things from one bot to the other

17:05 ivaraasen: hyPiRion: pretty bad weather in Trondheim lately, but at least it's quite warm

17:05 Raynes: You can, but you can't really get them in a loop.

17:06 tanzoniteblack: ,(println "$(println \",(println $conditions 94303)\")")

17:06 clojurebot: $(println ",(println $conditions 94303)")

17:06 tanzoniteblack: this is probably a good thing

17:07 Raynes: That didn't work because you used $ rather than &

17:07 tanzoniteblack: ,(println "&(println \",(println $conditions 94303)\")")

17:07 clojurebot: &(println ",(println $conditions 94303)")

17:07 lazybot: ⇒ ,(println $conditions 94303) nil

17:08 Raynes: That's as far as you can get.

17:08 hyPiRion: ivaraasen: yeah, it's still hot enough to not be horrible

17:11 duck11232: We just need a new bot that parses ⇒ as it's input character

17:11 tanzoniteblack: duck11232: I can only see that ending badly

17:12 shadowh511: yo, i'm having trouble with this basic clojure IRC bot

17:12 i found this sample: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/

17:12 and I am wondering how to make it wait for and respond to commands

17:14 arohner: ,((fn [] (println ",(println \"foo\")")))

17:14 clojurebot: ,(println "foo")

17:15 arohner: ,((fn [] (println "&(println \"foo\")")))

17:15 clojurebot: &(println "foo")

17:15 lazybot: ⇒ foo nil

17:15 arohner: sounds like you can get them to loop, using fns

17:15 ah, no, because of the =>

17:15 muhoo: bot torture!

17:16 antares_: shadowh511: you can see more or less that happening in conn-handler, now generalize it (extracting a function for command identification and another one for each command is a good idea, too)

17:17 aperiodic: darn lazybot replacing newlines with whitespace

17:18 shadowh511: antares_: oh, I get it, it's in the let binding

17:18 tanzoniteblack: &(println (str \newline ",(println "gotcha")))

17:18 lazybot: java.lang.RuntimeException: EOF while reading string

17:19 tanzoniteblack: &(println (str \newline ",(println \"gotcha\")"))

17:19 lazybot: ⇒ ,(println "gotcha") nil

17:19 aperiodic: tanzoniteblack: it probably does a `with-out-str` and does the newline replacement in that, which seems foolproof to me

17:20 tanzoniteblack: &(doc with-out-str)

17:20 lazybot: ⇒ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."

17:25 aperiodic: and now people would probably figure out what i'm up to if i tried to add inline evaluation to clojurebot :(

17:35 shadowh511: aperiodic: do you have the source code publically available?

17:35 Sgeo: ##(+ 1 1)

17:35 lazybot: ⇒ 2

17:36 Sgeo: &(println (str \backspace))

17:36 lazybot: ⇒  nil

17:36 Sgeo: &(println (str \backspace \backspace \backspace \backspace))

17:36 lazybot: ⇒  nil

17:36 dnolen: heh

17:36 CLJS reveals a funny bug in CLJ

17:36 ,(case 'quote 'a :foo :bar)

17:36 clojurebot: :foo

17:36 metellus: &(println (str "abcde" \backspace \backspace \backspace \backspace))

17:36 lazybot: ⇒ abcde nil

17:37 jkdufair: how would i access both the entire request and route params from a compojure route definition?

17:37 Sgeo: ,(println (str "abcde" \backspace \backspace \backspace \backspace))

17:37 clojurebot: abcde

17:38 dnolen: actually I guess not given the description of case, since the tests are literals.

17:38 Sgeo: (Not helpful just I'm curious

17:40 Oh now I know what periodic meant by inline evaluation: The ## thing

17:41 aperiodic: $google clojurebot source code

17:41 lazybot: [hiredman/clojurebot · GitHub] https://github.com/hiredman/clojurebot

17:41 aperiodic: shadowh511: ^

17:44 xeqi_: jkdufair: (GET "/" request ...) would bind the entire request to request https://github.com/weavejester/compojure/wiki/Destructuring-Syntax

17:44 aperiodic: lol, apparently clojurebot is hardcoded to not eval messages from certain nicks

17:45 tanzoniteblack: itistoday: where do you see that?

17:45 itistoday: ,(println "clojurebot, y u no listen to me??")

17:45 clojurebot: itistoday: Pardon?

17:47 Sgeo: ,(println "clojurebot, y u listen to me??")

17:47 clojurebot: clojurebot, y u listen to me??

17:47 lazybot: clojurebot: Uh, no. Why would you even ask?

17:47 clojurebot: excusez-moi

17:47 Sgeo: Woah

17:47 aperiodic: tanzoniteblack: bottom of src/hiredman/clojurebot/sb.clj

17:48 antares_: can someone point me to that Simplicity/Freedom to focus/Empowerment diagram? I need it for a talk I am giving

17:49 tanzoniteblack: aperiodic: thanks

17:54 jkdufair: xeqi: that's what i'm doing now to get the entire request. what i'd also like is, i.e. (GET "/foo/:bar" ...) and bind somehow to get bar and request. perhaps it would be {foo :foo :as request} ?

17:57 xeqi: jkdufair: (GET "/" {{:keys [bar]} :params :as request} ...) maybe

17:58 jkdufair: i'll try. thx.

17:58 dslsd: I have a collection: [["foo" "bar"] ["foo" "baz"] ["bar" "qux"]] and I want {:foo ["bar" "baz"], :bar "qux"}

17:59 jkdufair: xeqi: that did it. thank you!

17:59 dslsd: ive been in imperative land for too long and im struggling to think of how to accomplish the above functionally

18:04 Sgeo: Related question: Does loop/recur count as functionally?

18:04 Although I do see a functional way to do it, I ... think

18:05 dslsd: im going to say no to loop/recur

18:05 Sgeo: dslsd, please note that I'm not a Clojure expert, so am trying to solve your problem with that limitation in mind

18:05 dslsd: just to spite you

18:05 jkdufair: dslsd: you should be able to use reduce i think

18:05 Chousuke: dslsd: sounds like you need something like group-by but not quite

18:05 dslsd: Chousuke: exactly

18:05 Sgeo: ,(reduce {} (fn [acc vec] (assoc acc (first vec) (nth vec 1)))

18:05 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

18:05 Sgeo: ,(reduce {} (fn [acc vec] (assoc acc (first vec) (nth vec 1))))

18:05 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox$eval51$fn__52>

18:06 Sgeo: ,(doc reduce)

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

18:07 Sgeo: ,(reduce (fn [acc vec] (assoc acc (first vec) (nth vec 1))) {} [["foo" "bar"] ["foo" "baz"] ["bar" "qux"]])

18:07 clojurebot: {"bar" "qux", "foo" "baz"}

18:07 nz-: ,(group-by first [["foo" "bar"] ["foo" "baz"] ["bar" "qux"]])

18:08 clojurebot: {"foo" [["foo" "bar"] ["foo" "baz"]], "bar" [["bar" "qux"]]}

18:09 Sgeo: Is it generally considered acceptable to write out an fn like that that's tailored for use with reduce?

18:11 dansalmo: joy, I figured out my first regex

18:11 , (clojure.string/split "--(--)4*234/-/1-/1" #"(?<=[^-()])-" 2)

18:11 clojurebot: ["--(--)4*234/" "/1-/1"]

18:11 Sgeo: On a related note, is there a nice parser combinator library for Clojure?

18:11 dansalmo: but I would like not to swallow the -

18:13 Chousuke: (reduce (fn [m [a b]] (let [item (m a [])] (assoc m a (conj item b)))) {} '[[foo bar] [foo zonk] [bar foo]])

18:13 ,(reduce (fn [m [a b]] (let [item (m a [])] (assoc m a (conj item b)))) {} '[[foo bar] [foo zonk] [bar foo]])

18:13 clojurebot: {bar [foo], foo [bar zonk]}

18:15 Sgeo: Hmm http://brehaut.net/blog/2011/fnparse_introduction

18:15 It doesn't particularly look maintained though

18:15 Chousuke: dslsd: See above. It's way easier to write if you don't treat the one-item case specially

18:15 special cases are icky :P

18:16 dslsd: thanks Chousuke

18:16 (reduce (fn [m [a b]] (let [item (m a [])] │ altivec

18:16 | (assoc m a (conj item b)))) {} '[[foo bar] [foo │ amalloy_

18:16 oops, sorry

18:17 Sgeo: Not only is the function to do the transform easier to implement without a one-item case, it means code that uses the result doesn't need to think about it

18:17 xeqi: Raynes: I think its broke again

18:17 $findfn 3 4 7

18:17 lazybot: java.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn

18:17 Chousuke: yeah. special cases leak out :P

18:17 Sgeo: I think maybe Haskell would be good for hammering this into people's heads

18:17 Chousuke: if you have a special case somewhere down the stack it will spread everywhere

18:18 dansalmo: Is there a way to get ["----/" "-/"] from (clojure.string/split "----/-/" #"(?<=[^-])-" 2)? without having to add the "-" back the second result?

18:18 , (clojure.string/split "----/-/" #"(?<=[^-])-" 2)

18:18 clojurebot: ["----/" "/"]

18:20 xeqi: Raynes: looks like eval too ##(+ 1 2)

18:20 lazybot: java.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn

18:21 xeqi: ,(clojure.string/split "---/-/" #"/")

18:21 clojurebot: ["---" "-"]

18:21 xeqi: ah, right

18:22 pbostrom: ,(reduce (fn [m [k v]] (update-in m [(keyword k)] conj v)) {} [["foo" "bar"] ["foo" "baz"] ["bar" "qux"]])

18:22 clojurebot: {:bar ("qux"), :foo ("baz" "bar")}

18:23 pbostrom: dslsd: ^ lists, but not vectors

18:25 dslsd: Chousuke: that's really cool -- that ({} :key []) thingamajig

18:25 i didn't know you could get a sort of not-found by doing that

18:25 pbostrom: cool thanks

18:26 Chousuke: dslsd: it's a kind of a hidden-in-plain-sight feature :P

18:26 xeqi: dansalmo: do you want to split after "/"s ?

18:27 Chousuke: ,(:foo 'bar 1)

18:27 clojurebot: 1

18:27 dslsd: Chousuke: thanks that's interesting

18:27 Chousuke: works that way too, even if your input is not actually associative.

18:27 Sgeo: Chousuke, hmm, I don't see what dslsd is looking at

18:27 Oh

18:27 dslsd: Chousuke: where the hell is that documented?

18:27 Chousuke: I have no idea.

18:28 probably on the clojure website

18:28 dslsd: Chousuke: are there any other magical "oh btw this thing is also a function" things?

18:28 Chousuke: maps, sets, vectors, symbols and keywords are all functions

18:29 dslsd: ,({} '() [])

18:29 clojurebot: []

18:30 Chousuke: ,('[a b c] 2)

18:30 clojurebot: c

18:31 dslsd: ,(let [rocket-to-the-sun (->(*))] rocket-to-the-sun)

18:31 clojurebot: 1

18:31 Chousuke: the other way around unfortunately can't work :P

18:31 Sgeo: ,(macroexpand-1 '(->(*)))

18:31 clojurebot: (*)

18:32 cemerick: weavejester: I wonder if you'd be open to splitting up the predicates in valip so that some subset would be cljs-safe?

18:32 Chousuke: while we're on the topic of non-obvious features...

18:32 cemerick: Or, just keeping the cljs-safe ones in a separate namespace, and immigrating them into valip.predicates, I suppose.

18:32 Chousuke: ,(meta '^:bar [a b c])

18:32 clojurebot: {:bar true}

18:33 weavejester: weavejester: I haven't worked on valip for a while, though I may be looking at it again soon.

18:33 But I'm not sure about sharing namespaces between cljs and clj

18:33 Chousuke: ,(meta ^:bar [a b c])

18:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0)>

18:33 Chousuke: ,(meta ^:bar '[a b c])

18:33 clojurebot: nil

18:33 Chousuke: can you tell why that is? :P

18:33 (pop quiz!)

18:33 cemerick: weavejester: I've actually had some good luck doing so so far. *shrug*

18:34 I'll fork for now and you can see if you like what comes out of the other end when you get around to it :-)

18:34 thorbjornDX: can anyone recommend "Functional Programming for the Object-Oriented Programmer"?

18:34 weavejester: cemerick: Sure thing :)

18:40 Sgeo: I should try to implement that search across an infinite space thing I saw once

18:42 aperiodic: Chousuke: does it attach the metadata to the (quote [a b c]) form, which gets evaluated before it's passed to meta?

18:42 Chousuke: aperiodic: yeah.

18:43 aperiodic: Chousuke: what's going on with '^:bar [a b c]?

18:43 Chousuke: aperiodic: the metadata goes on the list in the quote form, whereas in the former example it goes on the vector, and the vector is what exists when meta is called.

18:44 aperiodic: it's just (quote ^:bar [a b c])

18:44 since ^ is a read time operation it needs to be that way around.

18:45 aperiodic: ah, right, because ^:bar isn't a form

18:45 Chousuke: right. it's just reader magic :P

18:46 Sgeo: If reader magic is acceptable here is reader magic unacceptable for a features mechanism?

18:47 Chousuke: what sort of features mechanism?

18:47 if you're looking for a way to make code portable between different clojure implementations, then you should know that that is an explicit non-goal :P

18:47 Sgeo: Chousuke, as in, a way to choose a form to read in based on which implementation of Clojure

18:47 Oh :(

18:48 Why?

18:48 clojurebot: http://clojure.org/rationale

18:48 Chousuke: I guess you can sort of do it with read-time evaluation? maybe

18:48 technomancy: Chousuke: an explicit non-goal for application code

18:49 there's a thread about adding a features mechanism; it's not out of the question

18:49 Chousuke: I suppose it's not a bad idea for libraries

18:49 Sgeo: Common Lisp the language has no standard way to do threads or networking. Yet, various implementations have implementation specific threading and networking. There exist libraries that smooth over these to provide cross-implementation threading and networking

18:57 cemerick: Chousuke: portability is turning out to be less of a headache than I expected.

18:57 Within reason, of course; interop-heavy stuff doesn't work well.

18:57 s/work well/port easily

18:59 casion: can you lazily read from an input-stream using (with-open)?

19:05 hyPiRion: casion: if you use read, you can

19:05 (repeatedly 3 read) - for instance.

19:07 casion: hyPiRion: ahhh. I keep getting java.io and clojure.java.io mixed up. I tried with .read and it wasn't working

19:08 I guess (memfn read) would have worked (and been silly) though

19:12 hyPiRion: (read) only works with PushBackReaders, I'm using input-stream

19:13 or java.io.InputStream as it is

19:14 Hodapp: blugh, I hate trying to get vim to do anything with plugins

19:15 hyPiRion: casion: (repeatedly #(read-function-here stream)) should work fine

19:15 Hodapp: :he vimclojure just does nothing

19:15 hyPiRion: though lazy reading is kind of scary if you have multiple readers.

19:16 casion: hyPiRion: I get 'IOException Stream closed' when I try that

19:16 I suspect because with-open closes the stream?

19:16 hyPiRion: casion: yeah - you have to force the reads within a with-open, otherwise you're out of luck

19:17 babilen: Hodapp: Just use a reasonable plugin manager such as vim-addon-manager, vundle or (meh) pathogen

19:17 casion: alright then, guess I have to rework how I'm thinking about this

19:17 thanks

19:17 Hodapp: babilen: I'm trying to use pathogen. Things are silently failing.

19:18 hyPiRion: casion: Do you have to lazily read though? Can't you just eagerly read?

19:18 babilen: Hodapp: pathogen would be my third choice, but this is rather a dicussion for #vim than #clojure I guess.

19:18 Sgeo: casion, try to avoid lazy streams of IO requiring stuff

19:18 casion: hyPiRion: files can be, and are often, very large

19:19 Hodapp: babilen: I'm just following instructions for lein-tarsier...

19:19 casion: avg 4gb, often exceeding 10gb

19:19 Sgeo: casion, the Haskell community has come to view such things with distrust. The function in Haskell that enables it is called unsafeInterleaveIO, and it's called unsafe for a reason.

19:19 hyPiRion: casion: https://github.com/richhickey/clojure-contrib/blob/061f3d5b45657a89faa335ffa2bb80819f2e6918/src/main/clojure/clojure/contrib/duck_streams.clj#L235

19:19 Hodapp: okay, :ClojureRepl is working but :he vimclojure does nothing, that is annoying

19:19 casion: Is there another way to 'safely' handle large files then?

19:20 hyPiRion: I need a stream, not a reader

19:20 technomancy: casion: you just have to find the right place for with-open

19:20 casion: unless I want to split the chars myself I guess

19:22 babilen: Hodapp: It's probably due to the fact that pathogen "forgets" to generate the helptags (or you forget it) -- IIRC it is :Helptags from pathogen. I would still strongly recommend to take a look at the other two though.

19:22 casion: actually, if I set encoding to UTF-8, I can read bytes with a reader then right?

19:22 Sgeo: I guess see if there's an Iteratee-like thing for Clojure?

19:22 Or Conduit-like

19:23 Hodapp: babilen: any recommendations between vim-addon-manager and vundle?

19:23 technomancy: babilen: do you know of any existing convention for a declarative alternative to Debian's update-java-alternatives?

19:23 Hodapp: most ofthese tools I only want to learn far enough that they get out of the way and let me do WTF I was going to do in the first place

19:23 babilen: Hodapp: I happily use v-a-m, but both are good.

19:23 technomancy: something appropriate for a config file that's included with an application

19:25 babilen: technomancy: Not really -- But you could just call whatever binary you want to call directly, can't you? I mean the paths are known and the alternatives system just manages symlinks to them.

19:25 casion: hah! that worked great. (reader "" :encoding "UTF-8") with line-seq to read a byte-stream

19:26 technomancy: babilen: no, it needs to be declarative since it's just read by the build process out of an application's source repo

19:26 babilen: we will probably end up inventing our own convention, which I hate to do =(

19:26 but we couldn't find any prior art

19:28 Hodapp: gah, finding vim-addon-manager installation to be... confusing

19:32 thorbjornDX: Hodapp: do you know about pathogen.vim?

19:33 Hodapp: https://github.com/tpope/vim-pathogen

19:33 babilen: (full circle)

19:33 Hodapp: ugh.

19:34 thorbjornDX: Hodapp: ah, sorry. Just saw the latest question

19:35 Hodapp: without knowing much about vim, I can hardly make heads or tails of the v-a-m installation instructions

19:39 Urthwhyte: Don't se pathogen

19:39 Vundle is much nicer

19:40 thorbjornDX: Urthwhyte: what don't you like about pathogen?

19:40 Hodapp: uggggggggh

19:40 XPherior: Evening, people.

19:41 Urthwhyte: Makes it wicked hard to just sync dtfiles across machines

19:41 thorbjornDX: Urthwhyte: how about pathogen + git + git submodules?

19:42 Hodapp: vim-addon-manager is making it wicked hard to comprehend WTF their installation documentation means.

19:42 Urthwhyte: Please excuse the typos, wifi latency is in the many seconds right now :(

19:42 thorbjornDX: Urthwhyte: No problem.

19:43 Urthwhyte: Because why complicate what could just be a single file sync?

19:44 thorbjornDX: Urthwhyte: I tend to hack on both my vimrc and the code in the submodules, so I like to have them source controlled

19:46 Urthwhyte: I avoid vimscript as much as possible

19:46 but I also have a very minimal vimrc

19:47 PRetty much just the bare minimum for working with whatever language I'm currently big into

19:47 Hodapp: that's all I'm trying to set up

19:49 Urthwhyte: I haven't actually worked out how to get the standard clojure stuff into vim, since all I've ben doing is 4clojure problems

19:52 Frozenlock: Friday evening on #clojure, let's party!

19:53 Sgeo: I'm having too much fun with awtbot

19:53 shaungilchrist: been partying hard since 3am last night. couldn't sleep so started working on edn parser for node.. you know because of because.

19:55 duck1123: I haven't gotten around to reading the spec just yet, keywords are still supported, right? Namespaced keywords?

19:55 shaungilchrist: totally

19:55 duck1123: I'm wondering if I can specify that Ciste's config format is just edn

19:56 technomancy: it's just an attempt to trick non-clojure-users into using the reader

19:57 duck1123: well, if it's going to be used as a data format anyway. Why not specify it apart from clojure

20:00 Frozenlock: Cmon guys, no need, we have json

20:00 thorbjornDX: Frozenlock: can't forget XML

20:01 duck1123: json puts colons in the wrong place and it's too picky about commas

20:01 Frozenlock: Oh right, we have xml!

20:02 S11001001: json in yaml in xml in s-exps

20:02 duck1123: csv?

20:02 Frozenlock: tsv, csv is for noob

20:03 S11001001: s-exps aren't that bad

20:04 technomancy: whatever; I'm still using application/clojure as my mime type

20:04 shaungilchrist: I am going the other way and writing my code in csv and marshalling that to edn and then passing it to clojure

20:05 that way I can use excel macros to truly unleash the power

20:05 Frozenlock: https://sites.google.com/site/steveyegge2/the-emacs-problem

20:05 shaungilchrist: You've won with the excel macros.

20:05 duck1123: has anyone ever tried encoding clojure code as xml? Second question: have they been shot?

20:06 shaungilchrist: I am sure adobe is working on that for flex4

20:07 thorbjornDX: I write my clojure code in powerpoint

20:07 shaungilchrist: every time I see thier </mediocrity> tag I almost lose my mind and drive off the road

20:09 duck1123: Years ago, I spent some time using a XForms/XSLT/XQuery/XPL system. It was XML all the way down. I'm sure everyone has things from their youth that they regret

20:09 Hodapp: shaungilchrist: </mediocrity>?

20:10 shaungilchrist: Hodapp: they really have a billboard w/ just a </mediocrity> tag as in "end your mediocre career and come work here slinging mad markups rockstar"

20:11 Hodapp: sigh.

20:11 technomancy: duck1123: https://code.google.com/p/xsharp/

20:12 shaungilchrist: if I were young again I'd totally deface it with an s-expression. that would show them.

20:14 duck1123: I'd probably add the open tag, just for symmetry.

20:16 xeqi: wonder if nrepl should change to using edn underneath

20:17 thorbjornDX: I just installed emacs, am I in for a good time? (vim-user)

20:17 xeqi: a world of pain, followed by acceptance, followed by a good time

20:17 much like any new tool

20:17 Frozenlock: xeqi: Wasn't edn the description of clojure seqs?

20:18 thorbjornDX: I don't mind the non-modality of it so long as I'm just in the repl, but I can't bring myself to use the arrow keys when traversing my src

20:19 and C-n/p/b/f or w/e seem marginally worse than jkhl

20:19 aperiodic: you could always try evil-mode

20:19 thorbjornDX: </nitpicking>

20:19 duck1123: I can't remember the name, but there's a package that'll yell at yuou if you're arrowing around too much

20:19 thorbjornDX: aperiodic: this sounds like a whirlwind of pain, but I'll give it a shot

20:20 Frozenlock: no-easy-key

20:20 thorbjornDX: <M-x> package-install <CR> evil <CR>

20:22 technomancy: jkhl is awful in dvorak

20:23 thorbjornDX: technomancy: true, I tried prog dvorak a while back and couldn't make the switch because of vim

20:23 technomancy: if I was a nano slinger I would have been perfectly fine :(

20:23 hoover_damm: thorbjornDX, doubt it

20:24 thorbjornDX, i've paired with nano coders... it's they feel awkward as heck in emacs

20:24 thorbjornDX, when they cry out for vim is when you know they've had it.

20:24 aperiodic: i didn't have much trouble switching to programmer dvorak as a vim user

20:25 j and k are still right next to each other, in the same orientation

20:25 h and l i very rarely use

20:25 duck1123: I overheard some people talking about OSX's movement commands and was like, I know this! Emacs!

20:25 hoover_damm: aperiodic, I've been dealing with *Unix* since 1990 and started with vi

20:25 aperiodic, I don't understand why people care so much

20:25 emacs, vi, nano, ed

20:25 it all works

20:25 cgag: vim just works best

20:25 hoover_damm: use what works best

20:26 often that is personal so you shouldn't try and share that feeling with someone else

20:26 cgag: I'm trying to get korma to work with mysql, does anyone know if i'm doing anything obviously wrong here? https://www.refheap.com/paste/4932

20:26 thorbjornDX: I don't think I can force myself to use evil mode, I have a bit too much invested in my vimrc. I guess I can just use it as in interface to nrepl

20:27 shaungilchrist: I think thats enough for a day, I can now load datomic schemas/dtm files in node

20:28 I know the "easy" route would have been to go clojure script but I wanted something stand alone w/o the jvm deps

20:28 https://github.com/shaunxcode/jsedn if anyone wants to break it that would be cool

20:31 duck1123: shaungilchrist: add a bin that'll allow me to get-in among other things and that'll be cool

20:32 shaungilchrist: just like a simple repl that reads and prints edn forms?

20:33 duck1123: yeah, basically, That way if you want to extract a value from a edn file in a bash script or something, it'd be easy

20:35 $ echo "{:foo 7}" | jsedn -s :foo => 7

20:35 not sure what args it would actually take

20:35 Sgeo: WTF

20:35 http://www.nsa.be/index.php/eng/Blog/Using-Jwt-yes-it-s-a-J-with-Clojure

20:36 The first create-listener macro defined on that page shouldn't work because the autogensym is outside of any quasiquote form

20:37 Oh "Update

20:37 With the Clojure bug mentioned above gone, and removing the unecessary gensym as it is outside the escaped code, the macro can be written:"

21:34 seancorfield: cgag: sorry, guess there's no korma users here at the moment...

21:37 cgag: seancorfield, i figured it out, it was putting quotes in places it shouldn't have, i just had to pass a :delimiters option somewhere to fix it

21:43 dansalmo: how to i get numeric value of char /0 as 0? not (int /0)?

21:43 , (int \0)

21:43 clojurebot: 48

21:45 dansalmo: I hope it is not (read-string (str \0))

21:45 , (read-string (str \0))

21:45 clojurebot: 0

21:46 dansalmo: is there a simpler way?

21:46 ,(int (read-string (str \0)))

21:46 clojurebot: 0

21:46 dansalmo: , (int (read-string (str \0)))

21:46 clojurebot: 0

21:47 tmciver: dansalmo: do you want the character numbers to evaluate to their value? ##(- (int \1) (int \0))

21:47 lazybot: java.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn

21:48 tmciver: ,(- (int \1) (int \0))

21:48 clojurebot: 1

21:48 dansalmo: yes

21:48 tmciver: dansalmo: just subtract 48 then.

21:48 ,(- (int \5) (int \0))

21:48 clojurebot: 5

21:49 tmciver: ,(map #(- (int %) (int \0)) "123456789")

21:49 clojurebot: (1 2 3 4 5 ...)

21:50 dansalmo: I want just one int like (int \0)

21:51 . ([ 1 2 3 4] (int \1))

21:51 , ([ 1 2 3 4] (int \1))

21:51 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

21:51 mthvedt: woah what?

21:52 ,([ 1 2 3 4] (int \1))

21:52 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

21:52 tmciver: ,(int \1)

21:52 clojurebot: 49

21:53 tmciver: ,({49 1 50 2} [(int \1) (int \2)])

21:53 clojurebot: nil

21:53 dansalmo: clojer gives easily the stuff you have to work for in other langs and make you work for the easy stuff

21:53 tmciver: ,({49 1 50 2} (int \1))

21:53 clojurebot: 1

21:53 mthvedt: how do vectors implement ifn

21:54 tmciver: mthvedt: they return the value at the index given as an arg.

21:54 ,([1 2 3 4] 1)

21:54 cgag: it's basically the same as nth isn't it?

21:54 clojurebot: 2

21:55 mthvedt: so...

21:55 ,([1 2 3 4] 1)

21:55 clojurebot: 2

21:55 mthvedt: ,([1 2 3 4] (int \1))

21:55 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

21:55 mthvedt: ,(int \1)

21:55 clojurebot: 49

21:55 mthvedt: oh

21:55 that's boring

21:55 =/

21:56 i was hoping it would yield some interesting insights on the clojure language

22:01 dansalmo: it will for me :)

22:01 cgag: where does that actually get implemented in the clojure source? I think it kind of does

22:02 the way datastructures can implement the function protocol is an interesting insight imo

22:03 Sgeo: Does Eclipse have a thing for making Swing GUIs visually? Is that comfortable to use with Counterclockwise and Clojure?

22:03 dansalmo: , ([1 2 3 4] (read-string (str \1)))

22:03 clojurebot: 2

22:04 dansalmo: is there no more direct way for char?

22:04 , ([1 2 3 4] \1)

22:04 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>

22:04 Sgeo: So, doseq is a non-lazy for

22:04 tmciver: cgag: here's how vector implements IFn: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L593

22:04 Sgeo: I don't know how to remember the difference between doall and dorun

22:05 doall is sequence and dorun is sequence_

22:06 tmciver: dansalmo: I would just subtract (int \0) from the chars you're interested in. Otherwise, you have to hard-code your 'vector of values'.

22:06 dansalmo: , ([1 2 3 4] (- (int \1) 48))

22:06 clojurebot: 2

22:06 tmciver: dansalmo: actually, that's not *terrible*: ##([0 1 2 3 4 5 6 7 8 9] \3)

22:06 lazybot: java.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn

22:07 tmciver: err

22:07 ,([0 1 2 3 4 5 6 7 8 9] \3)

22:07 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>

22:07 tmciver: oh yeah, that won't work.

22:07 dansalmo: seems like there should be something better, but then when I run into these things, it means I am trying to do something the hard way.

22:09 cgag: Sgeo, doseq returns nil

22:09 Sgeo: Maybe doseq should be called dofor

22:10 cgag: dofor would be like calling (doall (for ....))

22:10 i've seen that macro in storm's source

22:18 dansalmo: , (Integer. (str \0))

22:18 clojurebot: 0

22:18 dansalmo: , (Integer. \0)

22:18 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer>

22:19 tmciver: dansalmo: works but that's terribly inefficient.

22:19 dansalmo: and more code than (- (int n) 48) :)

22:20 tmciver: and not very idiomatic either.

22:22 dansalmo: I am just astonished that there is not something simpler that is findable in docs

22:24 tmciver: dansalmo: I think it is rather succinct. If you want something simpler, just create a function to do that for you.

22:25 dansalmo: , (let [int-c (fn [x] (- (int x) 48))] (int-c \0))

22:25 clojurebot: 0

22:26 dansalmo: that'l do

22:27 Sgeo: ,(let [int-c (comp (partial + -48) int)] (int-c \0))

22:27 clojurebot: 0

22:29 Sgeo: ,(letfn [(int-c [x] (- (int x) 48))] (int-c \0))

22:29 clojurebot: 0

22:29 dansalmo: :tmciver, thanks for your help, I was able to clean it up without the fn.

22:29 tmciver: dansalmo: np

22:30 Sgeo: Is my pointless version a bit too... err, pointless?

22:31 dansalmo: I right clojure code at about 1 line per hour. Re-writes go a little faster though.

22:32 tmciver: Sgeo: it's never pointless when you get to use comp and partial together. :)

22:32 dansalmo: I spell bad to.

22:33 tmciver: dansalmo: you mean 'too'. ;)

22:33 dansalmo: If I were going to use the fn, I would use yours for sure. ;)

22:33 Took too much effort to fix speel.

22:33 none left over for grammer

22:38 Sgeo: Clojure doesn't have a built-in flip, does it?

22:39 tmciver: Sgeo: what's flip? Swap?

22:40 Sgeo: Definable as (defn flip [f] (fn [arg1 arg2 & args] (apply f arg2 arg1 args)))

22:40 ,(doc swap)

22:40 clojurebot: I don't understand.

22:41 tmciver: what does that do? It just looks like apply.

22:41 Oh I see.

22:41 duck1123: reverses the 1st 2 args

22:41 Sgeo: tmciver, (flip f) returns a function that acts like f except with the first two arguments reversed

22:44 duck1123: I think the idea is, if all the libs are designed right, you should rarely need something like that, and when you do, #(f %2 %1)

22:44 dysinger: is there a shortcut to install a (missing) jar in the local repo like 'mvn install-file' ?

22:44 Sgeo: Instead of writing (partial + -48), with flip I could write (partial (flip -) 48)

22:44 dysinger: (for leiningen)

22:45 yankov: is there analogue of .indexOf for sorted-map/

22:45 duck1123: dysinger: I think install:install-file is it

23:08 riley526: Can anyone recommend their preferred Markdown library for Clojure?

23:09 dslsd: riley526: https://github.com/yogthos/markdown-clj

23:10 riley526: dslsd: Cool, thanks. I'll check it out.

23:11 dslsd: It's under active development which is the more important part in my opinion.

23:25 cemerick: Anyone know why ClojureScript requires a vector for e.g. :refer in require forms? Seems like a silly point on which to be strict on, and just one more stumbling block for clj/cljs portability…

23:26 hiredman: cemerick: a vector is clearly the correct choice

23:26 cemerick: hiredman: I'll just assume that's sarcasm. :-P

23:27 hiredman: look, the things you refering are all peers, so if you newline them each they should indent as a column one on top of each other

23:28 where, because lists are typically function calls, lists usually indent differently

23:28 sarcasm?

23:28 me?

23:30 cemerick: never, I know

23:30 parens in that position seem to be far more common, for the good reason that they stand out among the always-vectored libspecs

23:30 Besides, editor peculiarities should stay out of language issues.

23:31 Anyway, it's a gratuitous difference.

23:31 Sgeo: I think it's a popular opinion of the meaning of a literal vector in syntax vs a literal list

23:31 hiredman: I have a 34888 lines of clojure code here where it is always vectors

23:31 Sgeo: Rather than an editor concept

23:32 cemerick: Ah-ha, see, I've over 50K lines where it's always lists.

23:32 Sgeo: Lists look like function calls, so the first item should be important in some way

23:32 hiredman: ~guards

23:32 clojurebot: SEIZE HIM!

23:32 Sgeo: If all the items are roughly the same importance-wise, a vector makes sense

23:34 cemerick: Sgeo: sorry, lists within libspecs have a long history, e.g. http://clojure.org/libs

23:34 Probably from the repeated use of "list" in `refer`. http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/refer

23:36 Sgeo: cemerick, in the line (require '(clojure.contrib def except sql))

23:36 ?

23:37 In that case, the first item is significant, because it signifies the namespace those other things are found in

23:37 cemerick: Sgeo: No, talking about :only on the lib page

23:37 Sgeo: hmm

23:39 cemerick: Function position is "significant". When used to just denote a list (i.e. not a function calls or special forms), parens don't indicate anything about the first element.

23:39 '(see — like this)

23:40 Sgeo: Yes, at a language level, but at a level of common conventions is what I'm referring to

23:41 cemerick: The language level is the only one where the first element of a list denotes anything significant.

23:41 Beyond that, it's just people fuzzing because they see parens. :-)

23:52 duck1123: ahh, got a big chunk of my unpushed code all pushed to github and clojars

23:54 I just ran "rm -rf ~/.m2/repository; lein midje" now we wait

23:55 and it fails on bouncycastle. *grumble*

Logging service provided by n01se.net