#clojure log - Apr 30 2015

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

0:27 azri: Hi guys, anyone here familiar with titanium clojurewerkz?

0:28 can we query from the graph to get only a specific set of properties instead of getting the entire vertex?

3:28 seancorfield: Let's just suppose I'm setting up Emacs for the first time for Clojure. What is your recommended startup config?

3:29 I tried bbatsov/prelude and was surprised that it contained neither cider nor ido, both of which I would have considered essential.

3:29 Although it does include a lot of nice defaults

3:30 ane: well, including cider would be a bity silly for a standardized installation (most people will not use it for Clojure)

3:30 for clojure development, installing cider and clj-refactor is a good start

3:35 seancorfield: Perhaps Emacs-Live is a better starting point then?

3:37 I just figured that bbatsov as creator of cider would include it in prelude (since that seems to have other Clojure stuff?)

3:39 ane: it includes support for it, but it doesn't make you install it

3:39 it's easy anyway: M-x package-install <RET> cider

3:40 seancorfield: I know that. I was just looking for something more "turn key"

3:41 I've had an Emacs setup for Clojure dev for years. It's just gotten a bit stale so I'm looking for an easy way to start fresh.

3:42 ane: not much has changed, though it depends on "years"

3:42 most of the changes are in the quality of the addons, assuming you use cider (and not slime something clojure)

3:43 cider recently added a nice sexp-based debugger

3:44 seancorfield: I used Emacs back in the 17/18/19 days then took a 20 year break. Then came back to it in October 2011.

3:44 So I was using nrepl

3:45 ane: right

3:46 seancorfield: I switched to LightTable for a more "live" experience but development has stalled and my team seem to be moving back from LT to Emacs.

3:46 So I was hoping there was a reasonable "starter kit" so we could all move to something standardized.

3:46 magnars: seancorfield: you could take a look at https://github.com/clojure-emacs/example-config

3:47 J_Arcane: Is there a constructor function for maps, like vec or list?

3:47 magnars: seancorfield: or even more turn-key (but more opinionated too) is http://overtone.github.io/emacs-live/

3:47 J_Arcane: hash-map

3:48 J_Arcane: Thanks.

3:48 seancorfield: magnars: I saw that in google but wasn't sure whether it was a full config or just basic stuff

3:49 The example, that is. I think I'm leaning toward emacs-live at this point.

3:49 magnars: example-config is just a working example of setting up a lot of different clojure-related emacs packages, but does not include generally useful Emacs stuff. Overtone is a full config, and verily so.

3:50 seancorfield: I don't mind opinionated. Smart people curate well :)

4:28 H4ns: can anyone recommend a simple key/value store? i need to store a few million records and access them by a string key (~15-20 characters). i tried using files, but the file system that i'm using is too slow. i would like to avoid having to install server components. basically, i need a record system.

4:28 (record size is in the 2k-4k order)

4:33 stain: H4ns: so it's about 4 GB in total?

4:33 tsdh: Can I somehow apply type hints in (->> o .doThis .getThose .takeThat .doThis)?

4:34 H4ns: stain: yes - maybe a little more, but in that ballpark

4:34 stain: H4ns: what was slow in the file system.. you need to access many thousands at once?

4:35 H4ns: stain: i have to use xfs and it is just slow. i've split the names into a bunch of directory levels, but even with small directories, access is rather slow. i will need to rebuild the data a few times, and both writing and deleting take far too long.

4:35 stain: H4ns: so something like Couch DB or ElasticSearch would probably do it well.. but then you get yourself a server

4:36 H4ns: stain: slow read access to directories (not really that important), slow writing, slow deletion. also, system overall response time is bad when i write or delete data.

4:36 oddcully: ElasticSearch can be run like e.g. H2

4:36 stain: ElasticSearch is based on Apache Lucene which I think you can use programmatically without standing up a server

4:36 oddcully: e.g. you start it just up with your code as you need

4:36 H4ns: i was actually looking for something like berkeleydb.

4:37 stain: H4ns: for directories, try to keep the number of files per directories sane by using subfolders.. e.g. repo/7b/7bcb2b8f-98c9-46bc-a591-c82e33cb13a5 instead of repo/7bcb2b8f-98c9-46bc-a591-c82e33cb13a5

4:37 H4ns: stain: that is what i meant with "multiple levels"

4:37 stain: you can try to use Derby, it's not insanely fast, but quite lightweight to set up

4:37 H4ns: stain: i did that, but it did not help.

4:37 oddcully: is your value JSON?

4:37 H4ns: stain: derby, i'll look at that, thanks.

4:37 oddcully: nope, strings.

4:37 i've found mapdb, does anyone have experience with that?

4:38 oddcully: well ES is good at indexing your json. so maybe for this it's just overkill

4:39 stain: yeah, you didn't mention search.. but if you are going to do any kind of search or queries, do look at ElasticSearch again

4:39 H4ns: i need key->value lookup, nothing else

4:39 stain: ok, a bit overkill then

4:40 oddcully: what about ehcache

4:41 not sure, if it can be bent to "never evict"

4:46 mavbozo: H4ns, what about leveldb? I think factual already uses it in production https://github.com/Factual/clj-leveldb

4:47 H4ns: mavbozo: that looks like it, thanks!

5:05 kritzcreek: Hello newbie here. I've got a quick question. Why does ((identity '+) 1 2 3) error with an arity mismatch while (+ 1 2 3) is just fine?

5:06 hyPiRion: kritzcreek: because (identity '+) just '+ => ('+ 1 2 3), not (+ 1 2 3).

5:06 is just*

5:07 H4ns: kritzcreek: try ((identity +) 1 2 3)

5:07 dstockton: ,(type (identity '+))

5:07 clojurebot: clojure.lang.Symbol

5:07 hyPiRion: Symbols acts like keywords (somewhat unfortunately, because it's a tad confusing), so if you have a symbol in a map you can look it up by its name only

5:07 ,('foo {'foo 'bar})

5:07 clojurebot: bar

5:07 hyPiRion: ,('foo {'foz 'bar} 'baz)

5:07 clojurebot: baz

5:08 hyPiRion: ,('foo {'foz 'bar} 'baz 3)

5:08 clojurebot: #error{:cause "Wrong number of args (3) passed to: Symbol", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (3) passed to: Symbol", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 40] [sandbox$eval97 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.java" 6792] [cloj...

5:08 kritzcreek: Oh i see... When I tested ('+ 1 2) I thought it had done addition whereas it returned 2

5:08 thx a bunch anyway :D

5:13 TEttinger: identity pretty much returns exactly what is passed to it. usually. the only exception is that it boxes primitives

5:14 that matters exceedingly rarely for correctness, though it can matter more often for performance

5:19 hyPiRion, can you think of another case where (identity x) and x are different?

5:19 ,(let [na (/ 0.0 0.0) nana (identity na)] [(= (/ 0.0 0.0) (/ 0.0 0.0)) (= na na) (= nana nana)])

5:19 clojurebot: [false false true]

5:19 hyPiRion: TEttinger: NaN

5:20 well yeah

5:20 TEttinger: but with == it works correctly I think

5:20 ,(let [na (/ 0.0 0.0) nana (identity na)] [(== (/ 0.0 0.0) (/ 0.0 0.0)) (== na na) (== nana nana)])

5:20 clojurebot: [false false false]

5:20 hyPiRion: more like

5:21 ,{Double/NaN 1, Double/NaN 2}

5:21 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: Double/NaN>

5:21 hyPiRion: ,{(identity Double/NaN) 1, Double/NaN 2}

5:21 clojurebot: {NaN 1, NaN 2}

5:21 TEttinger: waaaaaat

5:21 TMA: ,(type :keyword)

5:21 clojurebot: clojure.lang.Keyword

5:21 TMA: ,(ancestors (type :keyword))

5:21 clojurebot: #{clojure.lang.Named java.lang.Runnable clojure.lang.IHashEq java.io.Serializable java.lang.Comparable ...}

5:22 TEttinger: ,{(identity Double/NaN) 1, Double/NaN 2, (symbol 'NaN) 3}

5:22 clojurebot: {NaN 1, NaN 2, NaN 3}

5:23 TMA: ,(ancestors (type :keyword))

5:23 clojurebot: #{clojure.lang.Named java.lang.Runnable clojure.lang.IHashEq java.io.Serializable java.lang.Comparable ...}

5:23 hyPiRion: TEttinger: I think hash map does form equality checks instead of value equality

5:23 the literals, that is

5:23 TMA: ,(ancestors (type 'keyword))

5:23 clojurebot: #{clojure.lang.AFn clojure.lang.Named java.lang.Runnable clojure.lang.IHashEq clojure.lang.IMeta ...}

5:23 TEttinger: TMA: try lazybot

5:23 TMA: ##(ancestors (type 'keyword))

5:23 lazybot: ⇒ #{java.io.Serializable java.lang.Comparable clojure.lang.IMeta java.lang.Runnable clojure.lang.IHashEq clojure.lang.AFn clojure.lang.Named java.lang.Object clojure.lang.IObj java.util.concurrent.Callable clojure.lang.IFn}

5:23 TEttinger: &(ancestors (type 'keyword))

5:23 lazybot: ⇒ #{java.io.Serializable java.lang.Comparable clojure.lang.IMeta java.lang.Runnable clojure.lang.IHashEq clojure.lang.AFn clojure.lang.Named java.lang.Object clojure.lang.IObj java.util.concurrent.Callable clojure.lang.IFn}

5:23 TEttinger: heh

5:24 TMA: oh, & works too

5:24 TEttinger: thanks

5:24 TEttinger: np, it's nice having multiple bots sometimes!

5:24 TMA: ##(ancestors (type :keyword))

5:24 lazybot: ⇒ #{java.io.Serializable java.lang.Comparable java.lang.Runnable clojure.lang.IHashEq clojure.lang.Named java.lang.Object java.util.concurrent.Callable clojure.lang.IFn}

5:25 TEttinger: also, type gets the type of its argument, not a type by the name of the arg

5:25 not sure what you're trying to do

5:25 &(ancestors (type 'wheeee))

5:25 lazybot: ⇒ #{java.io.Serializable java.lang.Comparable clojure.lang.IMeta java.lang.Runnable clojure.lang.IHashEq clojure.lang.AFn clojure.lang.Named java.lang.Object clojure.lang.IObj java.util.concurrent.Callable clojure.lang.IFn}

5:27 TMA: it is similar to the common-lisp:type-of function in this respect, it is OK with me. I am trying to understand what is the difference betwixt symbols (clojure.lang.Symbol) and keywords (clojure.lang.Keyword)

5:27 otwieracz: Common Lisp?!

5:27 <3

5:28 acron^: hi all, is there a pattern or form I should use when I expect a map to return either values or collections where in the case of a collection I would flatten it? I was recently told that flatten alludes to bad design

5:28 TMA: ##(let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(difference a b) (intersection a b)])

5:28 lazybot: java.lang.RuntimeException: Unable to resolve symbol: difference in this context

5:29 TEttinger: TMA: set functions are in clojure.set IIRC

5:29 ,(use 'clojure.set)

5:29 clojurebot: nil

5:29 TEttinger: ,(let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(difference a b) (intersection a b)])

5:29 clojurebot: #error{:cause "Unable to resolve symbol: difference in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: difference in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: difference in this con...

5:29 acron^: example: [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}]

5:29 TEttinger: damn

5:33 TMA: &(do (use 'clojure.set) (let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(clojure.set/difference a b) (clojure.set/intersection a b)]))

5:33 lazybot: ⇒ [#{clojure.lang.IMeta clojure.lang.AFn clojure.lang.IObj} #{java.io.Serializable java.lang.Comparable java.lang.Runnable clojure.lang.IHashEq clojure.lang.Named java.lang.Object java.util.concurrent.Callable clojure.lang.IFn}]

5:34 TMA: Ok, they are siblings which are mostly the same

5:34 (inc TEttinger)

5:34 lazybot: ⇒ 51

5:34 TEttinger: thanks!

5:35 acron^, I'm not sure what you want from that

5:35 [:a 1 :a 2 :a 3 4 5 :a 6] seems really awful

5:36 you may want apply concat

5:36 acron^: [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}] => [{:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6}]

5:36 TEttinger: oh that isn't flattening at all...

5:36 acron^: Well, this is why I am asking about patterns

5:36 Right now my map routine returns either a value or a collection

5:36 which feels wrong

5:37 TMA: otwieracz: Indeed. Czy pan z Polski?

5:37 acron^: lets imagine my input is [1 2 [3 4 5] 6], how do I get [{:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6}]

5:38 otwieracz: TMA: Tak.

5:39 TMA: &(map (fn [x] {:a x}) (flatten [1 2 [3 4 5] 6]))

5:39 lazybot: ⇒ ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6})

5:39 TMA: acron^: then convert to array if desirable

5:40 Is there a way to write (fn [x] {:a x}) with # and %? I gather that #{:a %} would produce a set.

5:40 TEttinger: you probably shouldn't use flatten internally though. it's entirely possible the user has a value that must stay a collection (like an x,y point, you don't usually want to split that)

5:41 acron^: TMA TEttinger : I think my example is perhaps too crude

5:41 TEttinger: ,(map #(hash-map :a %) (flatten [1 2 [3 4 5] 6]))

5:41 clojurebot: ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...)

5:42 TMA: (doc identity)

5:42 clojurebot: "([x]); Returns its argument."

5:43 TMA: (map #(identity {:a %}) (flatten [1 2 [3 4 5] 6]))

5:43 ,(map #(identity {:a %}) (flatten [1 2 [3 4 5] 6]))

5:43 clojurebot: ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...)

5:44 TEttinger: I feel like we're missing something...

5:44 ah!

5:44 ,(map hash-map (flatten [1 2 [3 4 5] 6]) (repeat :a))

5:44 clojurebot: ({1 :a} {2 :a} {3 :a} {4 :a} {5 :a} ...)

5:44 TEttinger: ,(map hash-map (repeat :a) (flatten [1 2 [3 4 5] 6]))

5:44 clojurebot: ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...)

5:44 TEttinger: multi-collection map!

5:45 TMA: with the inner function a mapping one, cool!

5:45 acron^: Yeah, flatten doesn't work

5:46 because I don't have [1 2 [3 4 5] 6], I have [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}]

5:46 I thought my example would scale but it doesnt

5:46 TMA: it might be somewhat revolting thought for those not LISP infected though

5:47 &(map hash-map (repeat :a) (flatten (map :a [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}]))

5:47 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

5:47 acron^: ,(mapv #(hash-map :a %) (flatten (mapv #(->> % vals first) [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}])))

5:47 clojurebot: [{:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...]

5:48 acron^: that's my best offering

5:48 looks crappy though

5:48 TMA: &(map hash-map (repeat :a) (flatten (map :a [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}])))

5:48 lazybot: ⇒ ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6})

5:48 acron^: I prefer yours, thanks TMA

5:49 stain: Is it possible to after the fact make a Java class/interface pretend to be an ISeq and work with the usual map() and filter() etc?

5:49 IllegalArgumentException Don't know how to create ISeq from: org.apache.commons.rdf.simple.GraphImpl clojure.lang.RT.seqFrom (RT.java:505)

5:49 something with protocols perhaps..?

5:51 TMA: &(do (use 'clojure.set) (let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] {:a-b (clojure.set/difference a b) :b-a (clojure.set/difference b a) :a*b (clojure.set/intersection a b)}))

5:51 lazybot: ⇒ {:a-b #{clojure.lang.IMeta clojure.lang.AFn clojure.lang.IObj}, :b-a #{}, :a*b #{java.io.Serializable java.lang.Comparable java.lang.Runnable clojure.lang.IHashEq clojure.lang.Named java.lang.Object java.util.concurrent.Callable clojure.lang.IFn}}

6:04 TEttinger: acron^: version that respects the key each value or collection came with:

6:04 &(let [data [{:a 1} {:b 2} {:c [3 4 5]} {:a 6}] ] (mapcat #(map hash-map (cycle %1) %2) (map keys data) (map (comp flatten vals) data)))

6:04 lazybot: ⇒ ({:a 1} {:b 2} {:c 3} {:c 4} {:c 5} {:a 6})

6:05 acron^: whoa

6:05 nice one TEttinger

6:05 TEttinger: this is fun!

6:05 acron^: :)

6:48 Ahh TEttinger

6:48 it broke when I added new keys

6:49 &(let [data [{:a 1 :b true} {:b 2 :b false} {:c [3 4 5] :b true} {:a 6 :b false}] ] (mapcat #(map hash-map (cycle %1) %2) (map keys data) (map (comp flatten vals) data)))

6:49 lazybot: java.lang.IllegalArgumentException: Duplicate key: :b

6:49 TMA: (doc cycle)

6:49 clojurebot: "([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll."

6:49 acron^: &(let [data [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}] ] (mapcat #(map hash-map (cycle %1) %2) (map keys data) (map (comp flatten vals) data)))

6:49 lazybot: ⇒ ({:b true} {:a 1} {:c false} {:b 2} {:c 3} {:b 4} {:c 5} {:b true} {:b false} {:a 6})

6:54 acron^: but so does all of them

6:54 TMA: (doc hash-map)

6:54 clojurebot: "([] [& keyvals]); keyval => key val Returns a new hash map with supplied mappings. If any keys are equal, they are handled as if by repeated uses of assoc."

6:55 TMA: ,(hashmap :a 1 :b 2 :a 4)

6:55 clojurebot: #error{:cause "Unable to resolve symbol: hashmap in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: hashmap in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: hashmap in this context", :a...

6:56 TMA: ,(hash-map :a 1 :b 2 :a 4)

6:56 clojurebot: {:b 2, :a 4}

6:57 acron^: https://www.refheap.com/7aee368366517306486bff86c real data

6:57 TMA: note to self: hash-map is like perl's list->hash conversion

6:59 acron^: in clojure, which forms take x inputs and return y values where x > y ?

6:59 like, the opposite of reduce?

6:59 justin_smith: acron^: reduce can return more values than you supply

7:00 TMA: is there an inverse of hash-map?

7:00 TEttinger: acron^: you had ##{:b 2 :b false}

7:00 justin_smith: ,(reduce (fn [v n] (into v (range n))) [] (range 10))

7:00 clojurebot: [0 0 1 0 1 ...]

7:00 TEttinger: ,{:b 2 :b false}

7:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :b>

7:00 TEttinger: that error will always exist for duplicate keys

7:00 acron^: TEttinger: yeah I know, I realised and ammended the example

7:00 justin_smith: ,{Double/NaN 1 Double/NaN 2}

7:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: Double/NaN>

7:01 TEttinger: ,{Double/NaN 1 (identity Double/NaN) 2}

7:01 clojurebot: {NaN 1, NaN 2}

7:01 justin_smith: ,(hash-map Double/NaN 1 Double/NaN 2 Double/NaN 3)

7:01 clojurebot: {NaN 1, NaN 2, NaN 3}

7:01 drguildo: ,(flatten (seq {:foo "bar" :a 1}))

7:01 clojurebot: (:foo "bar" :a 1)

7:01 justin_smith: ,(flatten {:foo "bar" :a 1})

7:01 clojurebot: ()

7:02 justin_smith: ~flatten

7:02 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

7:02 drguildo: ,(list {:foo "bar" :a 1})

7:02 clojurebot: ({:foo "bar", :a 1})

7:03 acron^: flatten is rarely the right answer :(

7:04 justin_smith: ,(apply concat {:a 0 :b 1})

7:04 clojurebot: (:a 0 :b 1)

7:04 justin_smith: that's the right way to do it

7:06 acron^: i clearly don't understand reduce...

7:07 justin_smith: acron^: often, if the input is a seq, and the output needs to be anything other than a seq of exactly the same number of elements, reduce is the answer

7:07 but, see also mapcat of course

7:08 mapcat similarly can return more, or fewer, elements than the input list

7:20 noncom|2: acron^: reduce is just a transformer which takes a sequence elements 1 by 1 and creates something new out of them

7:20 acron^: :)

7:20 i've used reduce

7:20 it works

7:20 thanks all

7:20 noncom|2: but what's the question then? :)

7:21 acron^: read upward :p

7:22 noncom|2: ah, ok, sorry :)

7:22 justin_smith: technically, like every clojure function, reduce can only return 1 value :)

7:23 acron^: of course ;)

7:24 TMA: &((fn [data] (mapcat #(apply concat %) data)) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])

7:24 lazybot: ⇒ (:b true :a 1 :c false :b 2 :c [3 4 5] :b true :b false :a 6)

7:25 TMA: (doc zip)

7:25 clojurebot: Huh?

7:25 TMA: (doc zipl)

7:26 clojurebot: I don't understand.

7:26 justin_smith: TMA: maybe you want zipmap?

7:26 TMA: (doc zipmap)

7:26 clojurebot: "([keys vals]); Returns a map with the keys mapped to the corresponding vals."

7:26 hyPiRion: or interleave

7:27 ,(interleave (range) (map - (range)))

7:27 clojurebot: (0 0 1 -1 2 ...)

7:28 TMA: (doc interleave)

7:28 clojurebot: "([] [c1] [c1 c2] [c1 c2 & colls]); Returns a lazy seq of the first item in each coll, then the second etc."

7:31 TMA: (let [zip (fn [f s] (cons (f (first s) (second s)) (zip f (rest (rest s)))))] (zip hash-map (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}]))

7:31 &(let [zip (fn [f s] (cons (f (first s) (second s)) (zip f (rest (rest s)))))] (zip hash-map (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}]))

7:31 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

7:31 TMA: sorry

7:32 justin_smith: TMA: oh you want partition

7:34 ,(map hash-map (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}]))))

7:34 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: clojure.lang.LazySeq@51727cb9>

7:34 justin_smith: ,(map (partial apply hash-map) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}]))))

7:34 clojurebot: ({:a 1} {:b true} {:b 2} {:c false} {:c [3 4 5]} ...)

7:34 TMA: (doc partition)

7:34 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

7:35 justin_smith: TMA: is that what you wanted? what should the output there actually look like?

7:36 TMA: I am trying to wrap my head around acron^'s problem. It is complex enough to be interesting yet simple enough to be approachable.

7:37 acron^: :D

7:37 TMA: did you see that real data link? that's a real sample from what i'm working with

7:39 TMA: acron^: I must have missed it in the first place. I'have found it noe.

7:43 acron^: bbiab

7:45 TMA: &(map (partial apply (fn [k v] (zipmap (repeat k) v))) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])))

7:45 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean

7:46 TMA: the only missing piece is listify, apparently

7:48 ,[(seq? 1) (seq? '(1)) (seq? [1])]

7:48 clojurebot: [false true false]

7:49 justin_smith: ,(map (fn [[k v]] (zipmap (repeat k) (if (coll? v) v [v]))) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])))

7:49 clojurebot: ({:a 1} {:b true} {:b 2} {:c false} {:c 5} ...)

7:49 justin_smith: &(map (fn [[k v]] (zipmap (repeat k) (if (coll? v) v [v]))) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])))

7:49 lazybot: ⇒ ({:b true} {:a 1} {:c false} {:b 2} {:c 5} {:b true} {:b false} {:a 6})

7:49 justin_smith: oh, repeating the key is silly :)

7:49 did you mean to repeat the key?

7:51 TMA: {:c [3 4 5]} should have been transformed to ({:c 3} {:c 4} {:c 5})

7:51 justin_smith: oh, that's not zipmap at all

7:52 &(map (fn [[k v]] (map hash-map (repeat k) (if (coll? v) v [v]))) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])))

7:52 lazybot: ⇒ (({:b true}) ({:a 1}) ({:c false}) ({:b 2}) ({:c 3} {:c 4} {:c 5}) ({:b true}) ({:b false}) ({:a 6}))

7:52 TMA: (map (fn [[k v]] (map hash-map (repeat k) (if (coll? v) v [v]))) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])))

7:52 justin_smith: &(mapcat (fn [[k v]] (map hash-map (repeat k) (if (coll? v) v [v]))) (partition 2 (mapcat #(apply concat %) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])))

7:52 lazybot: ⇒ ({:b true} {:a 1} {:c false} {:b 2} {:c 3} {:c 4} {:c 5} {:b true} {:b false} {:a 6})

7:53 TMA: justin_smith: that's the one!

7:53 somehow, even being wrong feels good in lisp-family programming

7:55 (inc justin_smith)

7:55 lazybot: ⇒ 250

7:56 * TMA has learned something new today. \o/

7:58 TMA: I know that #(... % ...) works for one argument. Is there a two (or N) argument version?

7:59 justin_smith: ,(#(list %& %3 %2 %) (range 10))

7:59 clojurebot: #error{:cause "Wrong number of args (1) passed to: sandbox/eval29/fn--30", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (1) passed to: sandbox/eval29/fn--30", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.RestFn invoke "RestFn.java" 412] [sandbox$eval29 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Comp...

7:59 justin_smith: oops

7:59 ,(apply #(list %& %3 %2 %) (range 5))

7:59 clojurebot: ((3 4) 2 1 0)

7:59 engblom: (#(+ %1 &2) 1 1)

7:59 ,(#(+ %1 &2) 1 1)

7:59 clojurebot: #error{:cause "Unable to resolve symbol: &2 in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: &2 in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: &2 in this context", :at [clojure.lang...

7:59 engblom: ,(#(+ %1 %2) 1 1)

7:59 clojurebot: 2

8:00 justin_smith: ,(apply #(list %& %3 %2 %) (range 7))

8:00 clojurebot: ((3 4 5 6) 2 1 0)

8:00 TMA: oh %number and %& for rest argument

8:00 thank you

8:02 ,(#(list %1 % %2) 1 2 3)

8:02 clojurebot: #error{:cause "Wrong number of args (3) passed to: sandbox/eval170/fn--171", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (3) passed to: sandbox/eval170/fn--171", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 40] [sandbox$eval170 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compil...

8:02 TMA: ,(#(list %1 % %2 %&) 1 2 3)

8:02 clojurebot: (1 1 2 (3))

8:02 TMA: and %1 === % even when used in the same fn.

8:03 oddcully: it is "polite" to use %1, if you also use %n

8:05 TMA: is there a way to nest them? (something like adding/doubling #'s and %'s with each level?)

8:06 justin_smith: no, there is no nesting

8:06 it's just a convenience

8:06 ,'#(+ %1 %2)

8:06 clojurebot: (fn* [p1__225# p2__226#] (+ p1__225# p2__226#))

8:06 justin_smith: you can use fn

8:38 sveri1: Hi, I have a vec of vecs like this: [[0 0 0] [1 1 1] [0 0 1]] and want to do a transformation, I want every vec fufilling a predicate (not containing "0"( to be replaced by the next vec and then fill the surroding vec with [0 0 0], so that my vec [[0 0 0] [1 1 1] [0 0 1]] becomes this: [[0 0 0] [0 0 1] [0 0 0]]. I tried with reduce, but don't know how to access the "next" part of the surrounding vec

8:40 justin_smith: sveri1: (partition 2 1 coll) will give you each thing plus the thing after it (but not the last thing...)

8:41 sveri1: justin_smith: ah, you mean I should build some temp list containing x and x+1 vec

8:42 justin_smith: right, then each step can see both

8:42 but you may want to tack a nil or whatever on the end

8:42 because one of them has no next, of course

8:42 sveri1: justin_smith: yea, that makes sense, I will try that, thank you

8:43 justin_smith: there is also loop of course

8:57 noncom|2: does anyone use cusive?

8:58 *cursive

9:00 pbx: noncom|2, i've certainly seen people talking about it here. dive right in with your question

9:03 noncom|2: in cursive i am trying to setup a keyboard hotkeys scheme, but have no success. things that bother me: 1) hotkey to start a repl & load the current file into it & switch the repl ns into it, 2) a hotkey to load the file in the running repl, 3) a hotkey to switch the running repl to the current ns opened in the editor

9:03 4) when i have a form or several forms selected, i want that pressing ( or [ would enclose the selection into parenthesis or brackets instead of replacing it with () or []

9:03 i tried setting a kb scheme, there are two available: emacs and cursive, but not one of them works

9:05 5) a hotkey to re-eval the form the cursor is in, or, at least, sync the repl and files

9:07 did anyone have success in making hotkeys work in cursive?

9:07 if yes, then how

9:08 dnolen: noncom|2: in the preferences there is a key mapping menu

9:09 noncom|2: dnolen: i've been there - it wont allow me to apply either emacs or cursive kb schemes. it also does not allow me to modify any of the mappings

9:09 dnolen: you can set your keybindings there, generally bindings can only run logical command. If you want to compose commands you probably need to define a IntelliJ macro and bind that macro to something (I haven't tried the macro feature)

9:09 noncom|2: it allows you to edit mappings

9:10 noncom|2: you probably need to copy the Emacs mappings first so you can edit it

9:16 noncom|2: dnolen: http://joxi.ru/xAeGLKYiq6wKmy

9:16 nothing is editale there

9:17 dnolen: noncom|2: sorry, Keymap the second menu is the one you need to be looking at

9:17 irctc_: how can i transform this expression ((partial map inc) (range 10)) into (-> (range 10) (partial map inc))

9:18 i would like to be albe to read it from left to right

9:18 but it does not work

9:19 noncom|2: irctc_: (->> (range 10) ((partial map inc))) ?

9:19 ,(->> (range 10) ((partial map inc)))

9:19 clojurebot: (1 2 3 4 5 ...)

9:19 irctc_: tahnk you

9:19 what is the single arrow

9:19 noncom|2: but that's a rather strange thing to do, imo

9:20 irctc_: single arrow puts the form on the second place. double arrow - on the last place

9:20 irctc_: k, thanks, that was just a toy example

9:21 noncom|2: dnolen: do, right, in keymap i did find additional settings for cursive!

9:21 but the amount of possible conflicts is depressing..

9:21 did you work out a good scheme for you?

9:22 dnolen: noncom|2: I don't care about conflicts since most of the things I want to replace I'll never use.

9:22 noncom|2: I would learn how to open the action menu, it's like M-x in Emacs

9:22 noncom|2: for less frequest commands this is what I use

9:23 noncom|2: dnolen: yeah, M-x is great in emacs! btw do you prefer cursive or emacs?

9:24 dnolen: noncom|2: I only do Clojure/ClojureScript work in Cursive now

9:24 noncom|2: I've found it easy to bend Cursive to my Emacs will

9:25 noncom|2: i see :)

9:25 dnolen: very few things are missing that I care as far as Clojure work. I still use Emacs for org-mode, erc, etc.

9:26 noncom|2: dnolen: did you ever encounter problems with cursive classloader? i cannot run a javacv project in cursive since it does not load the native library :( but eclipse does fine..

9:26 i think you did not encounter this, but i'd ask anyway..

9:26 dnolen: noncom|2: I haven't needed to use anything native so I can't help there

9:31 irctc_: this example again (-> (range 10) ((partial map inc))) why do you need double (()) around partial. Is not that evaluating the partial function?

9:32 noncom|2: irctc_: because it inserts the form at the second place: ((partial map inc) _ )

9:32 i have marked it with _

9:32 *last place, sorry

9:32 oddcully: noncom|2: i have used intellij with libgdx, which pulls native stuff (used gradle). that worked well

9:33 noncom|2: if you have single parenthesis, you get (partial map inc _)

9:34 irctc_: btw, i might be messed things up a little :) if you use ->>, you do not need (()), the () will suffice

9:34 but for -> you need (()), coz the second place will be (() _ )

9:35 oddcully: hmm, thats definitely strange since the same very project worked ok in eclipse, but not in cursive :/

9:36 dysfun: anyone have a recommendation for image resizing libs?

9:38 irctc_: i took me a while but i got it now

9:39 thanks

9:39 dnolen: dysfun: not aware of any specific lib, but looks simple to do with javafx

9:40 dysfun: i had bad experiences with javafx :)

9:40 i've seen some stuff for AWT that looks trivial enough though

9:40 dstockton: https://github.com/josephwilk/image-resizer ?

9:40 dysfun: i'm currently looking at that

9:40 also https://github.com/mikera/imagez

9:42 oddcully: i have used imgscalr for thumbnails in an admin backend. the quality is rather meh

9:42 dysfun: the quality of the library or the thumbs?

9:42 oddcully: the image quality

9:43 dysfun: so i can see a section in the image-resizer docs (Which says it's based on imgscalr) showing how to tune quality-vs-speed

9:43 (resize-fn 100 100 ultra-quality) ;best quality

9:44 oddcully: i used the best setting then and it was meh

9:44 dysfun: oh :/

9:44 oddcully: my comparsion was doing it with convert

9:44 ymmv

9:45 still ok in my case, since it is only needed to give the admin there the impression of whats on the image

9:45 dysfun: i'm resizing to create responsive images :

9:45 :/

9:46 oddcully: give it a try. that is my experience from some time ago (year or so)

9:46 justin_smith: dysfun: that's what lichen is for (it even has a standalone server)

9:46 oddcully: my impression was, that the underlying java libs for the task are not up to it

9:47 justin_smith: oddcully: if we didn't get crappy or weird image formats as input, we found lichen resizing was good (the art directors / designers didn't object)

9:47 irctc_: noncom|2: you have said that ->> should need only one pair of (), but that expands to (partial map inc (range 10)) which does not evaluate but returns a fn. -> on the on the other hand evaluates it ((partial map inc) (range 10)). Is this correct and ->> should too need double (())

9:48 dysfun: justin_smith: and i shouldn't read too much into it that you haven't touched it since last january? ;)

9:48 justin_smith: dysfun: I got laid off from the company that was funding development of that lib

9:48 but it is still used in production

9:48 the outstanding issue is iirc YUV format jpg

9:48 dysfun: ah

9:49 justin_smith: it's a caching resizer, we set it up to work with media queries (ensuring that every size that ended up in a rendered template was rendered and saved onto s3)

9:50 not at all optimized for speed, just the convenience of frontend being able to get any size just by specifying in the template the dims they wanted

9:51 caching to disk

9:51 (s3's disk that is)

9:51 dysfun: these will be rendered at upload time because of the small numbers of sizes involved

9:54 srruby: I'm using clojure.test. How do I test functions marked private?

9:54 justin_smith: srruby: you can refer to the var, or do black-box testing

9:55 #'some.ns/private-fn

9:55 srruby: thanks.

9:55 justin_smith: ,(#'+ 1 2 3)

9:55 clojurebot: 6

10:11 noncom|2: irctc_: ah, right! sorry, just digressing to much ..

10:49 how do i make cursive to do 2-space tabs instead of this? http://joxi.ru/1A5b5BZF71ywrE

11:05 seancorfield: I asked this late last night and got a few pointers but figured there are a lot more people awake now so I'll ask again...

11:05 Let's just suppose I'm setting up Emacs for the first time for Clojure. What is your recommended startup config?

11:06 I tried bbatsov/prelude but it doesn't seem very turn key for Clojure ( although it has a lot of good stuff in it )

11:07 Are folks using emacs-live? Or some other curated config?0

11:10 dnolen: noncom|2: there's a code formatting preference for Clojure, you can set indent only

11:12 seancorfield: I just stick to clojure-mode + paredit + cider or inf-clojure

11:13 noncom|2: dnolen: can't make it tab the right way.. tab always moves the line furhter to the right... i think i have to enforce emacs tab on TAB key

11:14 seancorfield: dnolen: no ido or projectile or fancy stuff?

11:14 noncom|2: such a pain, such a pain.. what i was taking for granted, had just slipped away..

11:14 seancorfield: why not

11:15 dnolen: seancorfield: right I have a bunch of other things set up for general Emacs usage, of those ido, magit are the only ones that seems relevant for Clojure work

11:15 noncom|2: the "wrong" formatting is marked red here: http://joxi.ru/DrlavXzIjZX5mP idk, i cannot tune it..

11:16 dnolen: seancorfield: having seen various Emacs Clojure things come and go, I prefer the simplest setup possible now, if I want fancy stuff I just use Cursive so I don't have to think / configure.

11:16 crimeminister: seancorfield: happy emacs-live user here

11:17 seancorfield: Ok, interesting. Thanks dnolen

11:17 crimeminister: did you tweak it much? Or is it pretty comprehensive out of the box?

11:17 noncom|2: i used emacs-live out-of the box

11:18 but later i went with prelude + cider + paredit + autocomplete and some more stuff..

11:18 emacs live seems pretty ok for the start

11:18 easy start

11:18 seancorfield: noncom|2: good to know. I'll see how emacs-live looks once I've had a coffee :)

11:19 noncom|2: seancorfield: one good things about emacs-live is that you have all the key shortcuts there on the website, so it is a matter of half an hour to master them all

11:22 crimeminister: seancorfield: I left the out of box experience alone, and isolated my changes in a personal "pack"

11:22 seancorfield: that way updating live doesn't give me any merge conflicts, it's as easy as a git pull

11:27 sobel: milestone: first commercial clojure jarred/deployed to the local Nexus repo/cache

11:29 now i have to find motivation to go back to the dark side and integrate it with eclipse

12:05 justin_smith: sobel: congrats

12:07 I'm thinking we might eventually want to upgrade from wagon-s3-private to nexus

12:14 sobel: doesn't wagon use WebDAV?

12:14 i like the local resource cache concept in general for repeatable builds.

12:24 gfredericks: does anybody know why `lein ring server-headless` brings down more deps that weren't fetched with `lein deps`?

12:26 justin_smith: gfredericks: maybe the plugin deps are not visible if you aren't invoking the plugin? That's odd isn't it.

12:26 gfredericks: I imagine perhaps one of the thing the plugins does is add deps.

12:26 gfredericks: I'm looking around for that, haven't found evidence of it yet

12:26 justin_smith: the plural on thats is some wrongs

12:27 oddcully: is it stuff, that looks like things to make gfx/fonts/... work?

12:28 justin_smith: gfredericks: if nothing else it should be injecting the jetty dep

12:28 gfredericks: oh hmm

12:28 I forgot there's both app deps and plugin deps

12:28 I guess it's probably just app deps that are late

12:38 ah yep https://github.com/weavejester/lein-ring/blob/d16661f7ee45fbb6706930ac3c34c5f30936a98a/src/leiningen/ring/server.clj#L33

12:39 wish I could figure out a clean way to force that without starting a blocking process

12:53 TimMc: gfredericks: For offline development?

12:55 gfredericks: for docker

12:55 it'd be dumb if your docker image fetched a bunch of deps every time you started it

12:56 I'm resorting to using `lein update-in` to create a trivial server based on clojure.core/identity and running that and killing it once I can tell it's running; hoo ray!

12:56 TimMc: yay

13:01 hiredman: ugh, are you using lein run to run a ring server inside docker?

13:03 either start jetty or whatever from clojure yourself and build an uberjar and run that directly, or build an uberwar and use jetty-runner or some other servlet whatever to run it

13:07 gfredericks: uhm

13:08 you mean keep lein&whatnot outside of docker?

13:09 hiredman: sure

13:09 gfredericks: that seems unideal; reproducibility is important for builds.

13:10 hiredman: or use a bulky docker container for making builds and deploy the builds to a slim one

13:10 gfredericks: and lein is not for running production code

13:11 gfredericks: yeah this isn't for production

13:11 it's a multi-repo CI setup thinger

13:11 hiredman: (or don't use docker at all, it kind of sucks)

13:11 gfredericks: there's a lot of variables dockerwise, so it'll probably take me a while to sort out the options

13:11 not using lein-ring at all would be one way to sidestep this particular problem

13:11 what kind of sucks about docker?

13:12 hiredman: it is unstable and tends to eat various kinds of resources and not free them

13:12 gfredericks: 'unstable' in the 'fast-changing API' sense?

13:13 hiredman: no

13:14 we decided to use docker for builds and deployments for our latest project at work, the only redeeming feature has been it finally means we have the ruby guys deploying an artifact (a docker container) instead of checking their rails app out from git on every machine

13:15 everything else has been a huge pain and a time sink

13:16 gfredericks: I'm testing something that involves five different components

13:16 hiredman: maybe it'll be fine for you

13:16 gfredericks: being able to wire it up with docker-compose seems a lot more robust than doing it by hand

13:20 TimMc: gfredericks: I think he means that it is possible to unst it.

13:24 hiredman: What's the least worst deployment option in your experience?

13:25 hiredman: tarball

13:26 I mean, for my personal stuff I tend to use uberwars or uberjars, but for work, our biggest oldest service uses lein-tar

13:26 works great

13:26 tbaldridge: +1 for uberjar if it works for you

13:27 hiredman: (historical note: that is the project technomancy was working on when he started lein, so it predates lein and was a big maven multi module build for a while)

13:39 wasamasa: wat: http://hackaday.com/2015/04/27/making-music-with-clojure-and-bananas/

13:52 stian: wasamasa: haha, that's mine :p

13:52 wasamasa: stian: congrats for making me wat

13:52 stian: wasamasa: thank you, enjoy the wat :p

13:53 wasamasa: reminds me of my demo where I remote-controlled overtone with key presses in emacs

13:55 so, I had a shabby midi controller essentially

13:58 stian: wasamasa: there's a key press in that video as well, enter in the repl, was one banana short :)

14:01 oddcully: and afterwards, put the bananas into the blender, add some milk and honey and play yourself some grindcore

14:01 wasamasa: reminds me of one noisia interview

14:02 "How do you make these insane bass lines?" - "We sample blenders, vacuum cleaners, ..."

14:07 TimMc: I've been thinking about borrowing a mic recording some samples of our baby for techno purposes.

14:07 babystep

14:07 wasamasa: babymetal is already a thing

14:07 so, why not?

14:08 for science!

14:08 TimMc: screeee eh eh eh-ehe-heh waarruugghh

14:10 http://www.discogs.com/Aube-Luminous/release/185719 Sound source: fluorescent & glow lamps.

14:10 If that works, why not babies?

14:24 gfredericks: TimMc: "it's possible to unst it"?

14:25 TimMc: gfredericks: Yeah. It's unst-able.

14:25 I'm truly sorry.

14:25 gfredericks: oh it was a jok

14:25 yeah he never explained "unstable" did he

14:26 TimMc: Ever since I knew I was going to be a dad I've started feeling the urge to tell puns and I do not like this about myself.

14:26 wasamasa: just accept it

14:26 TimMc: noooo

14:27 wasamasa: not like it's hurting anyone, is it :P

14:30 gfredericks: it's a deep biological evolutionary thing

15:10 edbond: core.memoize has no memory limit?

15:11 ttl with high threshold

15:13 irctc: Is there a way to conditionally pass an arg to a multi-arity function, say with 'if' and not have it pass a nil when the condition is false?

15:14 thus when the nested conditional is false the single arity form is called, instead of the 2 arity form with nil as the second parameter.

15:15 ToxicFrog: irctc: (if foo (x 1 2) (x 1)) ?

15:16 uris77: irctc: wouldn't a multimethod be useful in this case? Just curious. I'm a noob.

15:16 mihailp: hi

15:16 4clojure tasks in PicoLisp

15:16 http://goo.gl/6P2n4e

15:18 TimMc: I'm finding it very difficult to generate javadocs with lein.

15:18 Does anyone have a working example? I either end up with no HTML files or it includes tools.jar...

15:18 irctc: ToxicFrog: I was trying not to do this.

15:19 oddcully: irctc: is it one of yours? then defn with both arities and call the other arity with nil

15:19 irctc: oddcully: you mean have the 2 arity form handle nil?

15:20 oddcully: ... for the second param.

15:20 oddcully: ,(defn f ([x] (f x nil)) ([x y] (println x y)))

15:24 irctc: you have to test for yourself since clojurebot takes a nap

15:25 irctc: oddcully: Yeah, I know whatcha mean.

15:35 cfleming: noncom|2: Did you get the keybindings sorted out for Cursive?

15:38 noncom|2: Since you have a lot of questions and our timezones don't seem to coincide the best option is to send me an email

15:45 amalloy: cfleming: also there's lazybot's $mail

15:48 cfleming: amalloy: Yeah, although I thought that was more for when people were no longer connected to the room

15:50 amalloy: eh. i use it when people are still in the room but not "around", because you never know how big their scrollback log, or bouncer log-buffer or whatever, is

15:56 cfleming: Interesting - I'll give it a go. I'd assumed it would send a message when someone reconnected.

15:57 justin_smith: $mail cfleming it looks for activity

15:57 lazybot: Message saved.

15:57 cfleming: $mail noncom|2 Since you have a lot of questions and our timezones don't seem to coincide the best option is to send me an email

15:57 lazybot: Message saved.

15:57 cfleming: beep

15:57 boop

15:57 bop

15:57 No mail for me

15:57 justin_smith: hmm, did it not trigger?

15:57 cfleming: Nope

15:57 justin_smith: never mind then

15:59 amalloy: $mail amalloy test

15:59 lazybot: Message saved.

15:59 amalloy: fdsfas

16:00 cfleming: $mail amalloy Another test

16:00 lazybot: Message saved.

16:00 amalloy: cfleming: it triggers just fine, but i suspect your client is misconfigured to hide IRC "notice" events

16:00 it sends you a notice in PM

16:01 cfleming: I can't see anything about notice events in the doc

16:01 amalloy: ~def +

16:01 cfleming: I'm using Textual, which is generally well thought of - I'd be surprised if it didn't implement them correctly

16:02 amalloy: whoa, where's clojurebot

16:02 i was gonna use him to test, since he sends a notice for source lookups

16:03 oddcully: dead as the dodo

16:03 $mail oddcully get rid of clojurebots body

16:03 lazybot: Message saved.

16:03 cfleming: :/notice cfleming test

16:04 beep

16:04 boop

16:04 bop

16:05 oddcully: woah! the colors!

16:05 TimMc: cfleming: ^ Did you see this notice I just sent?

16:05 cfleming: TimMc: Yeah, I did

16:05 amalloy: $login

16:05 lazybot: You've been logged in.

16:06 amalloy: $say cfleming do you get PMs from lazybot at all?

16:06 cfleming: Yep

16:06 Got that

16:06 amalloy: puzzling

16:06 $unmail justin_smith cfleming

16:06 lazybot: Deleted unread messages from justin_smith to cfleming

16:06 oddcully: alert time default of 5min?

16:06 amalloy: yeah

16:06 $logout

16:06 lazybot: You've been logged out.

16:11 oddcully: lazybot: time's over! msg me!

16:11 works for me

16:12 got notices on status window at xx:05 and xx:11

16:27 justin_smith: $mail justin_smith mail justin_smith

16:27 lazybot: Message saved.

16:27 justin_smith: OK, now what

16:27 yeah,that worked

17:19 aaelony: I seem to always forget how to do a named field vector in a juxt command...

17:19 , (map (juxt :a :b) [{:a 1 :b 2 :c 3}])

17:19 versus

17:19 , (let [v [:a :b] ] (map (juxt v) [{:a 1 :b 2 :c 3}]))

17:20 oddcully: clojurebot was called into an important meeting

17:20 aaelony: lol

17:20 (inc oddcully)

17:20 lazybot: ⇒ 6

17:21 j-pb: ,(map (juxt :a :b) [{:a 1 :b 2 :c 3}])

17:21 so eval's broken but inc isnt?

17:21 weird

17:21 aaelony: anyways, the let version above fails

17:22 oddcully: inc is the expertise of lazybot

17:22 j-pb: aaelony: do (apply juxt v)

17:22 aaelony: I don't think lazybot and clojurebot are the same

17:22 j-pb: apply, aha! yes, thanks

17:22 j-pb: aaelony: why do you forget that though?

17:22 it's not something you have to remember

17:23 you can deduce it

17:23 aaelony: , (let [v [:a :b] ] (map (apply juxt v) [{:a 1 :b 2 :c 3}])) ;; this works

17:23 j-pb: juxt takes functions and applies them to its arguments returning a vector with all the results

17:23 as done above

17:23 in your first example

17:23 aaelony: for some reason, I disremember apply because it reminds me of all the R flavors (tapply, sapply, etc... )

17:24 j-pb: so (juxt [:a :b]) is a type error

17:24 ah

17:24 aaelony: dysremember actually

17:24 cool. thanks

17:24 j-pb: if you come from R you might get cought in the pitfall that everything looks like syntax

17:25 aaelony: yes, I originally came from R, but I have no excuse since that was years ago...

17:26 j-pb: apply just takes a function and a vector and calls the function as if its arguments were the contents of that vector

17:26 aaelony: everytime I touch r, I get blisters ;_

17:27 aaelony: Clojure is much nicer. But sometimes it's nice to verify Clojure with R

17:27 (as awful as that sounds)

17:28 amalloy: j-pb: (juxt [:a :b]) isn't a type error. it's certainly not what you want ever, but it's a valid function that you can apply to certain values and get an answer back

17:28 j-pb: aaelony: if you're not new to clojure, sorry for going into "welcome to the world of lisp" mode ;)

17:28 amalloy: specifically, ##(map (juxt [:a :b]) (range 2))

17:28 lazybot: ⇒ ([:a] [:b])

17:28 aaelony: is ## the magic now. ok cool

17:29 justin_smith: different bots for different strokes

17:29 j-pb: amalloy: yeah, but it's a pretty nonsensical one, since its equivalent to (comp vector [:a :b])

17:29 amalloy: yes

17:31 seancorfield: cider question... I rebuilt my emacs env to use cider and it wants cider-nrepl as a dependency in my project (since we start our own embedded repl server)... now I've added that, I'm starting to see all sorts of warnings and errors printed to console, like this: [exec] clojure/lang/PersistentHashMap.java:980: warning: '_' used as an identifier

17:31 [exec] Box _ = new Box(null);

17:31 [exec] ^

17:31 [exec] (use of '_' as an identifier might not be supported in releases after Java SE 8)

17:32 is there something I should exclude on the cider-nrepl dependency to suppress whatever it is doing behind the scenes?

17:33 amalloy: seancorfield: are you intentionally recompiling clojure? it seems weird to me that nrepl would do that

17:33 seancorfield: no, this seems to be something in cider-nrepl that has triggered this

17:35 I'm seeing it in pure Clojure command line apps so it doesn't appear to be due to the way i'm loading Clojure into our main web app (which was my first thought)

17:36 but it does seem to be attempting to compile all the Java source code in Clojure...

17:37 Hmm, I have a dev dependency on clojure-source (which was originally for showing source code in the repl I think)... maybe I'll remove that and see if the "problem" goes away :)

17:37 TimMc: Maybe should be a resource.

17:41 seancorfield: Yeah, looks like it. I don't even remember why I added it now.

17:41 TimMc: To git log!

17:42 * TimMc dons cape

17:48 seancorfield: So it dates back three years to when we were using CDT (and slime/swank).

17:50 (inc amalloy)

17:50 lazybot: ⇒ 265

17:50 seancorfield: that's for pointing me in the direction of clojure source :)

17:51 amalloy: seancorfield: the three-year swank timebomb finally went off, huh?

17:51 seancorfield: heh... I _think_ that was the last artifact of it still in our code!

17:53 oddcully: thanks to TimMc my brain now i caught up in a batman (1966) theme loop

17:55 brehaut: http://36.media.tumblr.com/d84bbc221c57a13659654fa8d22a862f/tumblr_nkcnzu7eXE1sz8987o1_500.jpg

17:58 TimMc: OK, that's enough beating my head against gpg-agent and maven for the day. Possibly for the week, or maybe even the month.

18:12 gfredericks: ,(println ["foo" "bar"])

18:12 &(println ["foo" "bar"])

18:12 lazybot: ⇒ [foo bar] nil

18:12 gfredericks: ^ I feel like this behavior has no use case, but I'm not sure if that means it ought to do something different

18:12 one idea would be if the function only accepted strings; but that seems like it would aggravate people

18:13 (not a serious suggestion about changing clojure obviously, just pondering APIs)

18:15 amalloy: gfredericks: yeah, whenever you call println on a clojure data structure it's usually a mistake

18:20 gfredericks: but calling it on other scalars might be okay

18:20 I dunno

18:20 seems like the readable print functions ought to be the goto ones and you use the special raw-string functions only when you know you want that

18:20 I hadn't thought about it that way till just now though

18:21 I was mucking with the new exception printing code is what made me think about it

18:21 amalloy: gfredericks: i mostly use printf and pr-str

18:22 gfredericks: I bet println is the goto function for anybody who has ever used java

18:23 drbobbeaty: gfredericks: I'm an ex-Java guy, and I can't remember using println once :)

18:23 gfredericks: dammit

18:23 drbobbeaty: I use the logging functions - exclusively.

18:24 amalloy: gfredericks: i've used java for a decade :P

18:25 gfredericks: this claim has been a disaster

18:25 I will never make it again.

18:26 drbobbeaty: gfredericks: Hey... how are those Hershey's holding out?

18:26 gfredericks: oh they are long gone

18:26 drbobbeaty: :)

18:26 glad to hear it.

18:26 vagmi: I have a long running nrepl, how do I find the port on which it is running?

18:26 gfredericks: people started asking for them so the decay rate picked up

18:28 vagmi: i know that there is a .nrepl-port file but there are a couple of repls open and I would like to find the port of the current repl from within the repl

18:28 gfredericks: uhrms

18:30 oddcully: ##(slurp ".lein/repl-port") ^_^

18:30 lazybot: java.security.AccessControlException: access denied ("java.io.FilePermission" ".lein/repl-port" "read")

18:32 gfredericks: I thought there might be some nrepl hackery to recover it but can't figure anything out

18:32 clojure.tools.nrepl.middleware.interruptible-eval/*msg* is a fun var to look at though

18:32 at the repl in particular

18:39 wei: what’s a good way to write a shell script that runs an nrepl command against an existing instance of my app, and saves the results to a file?

18:43 simpler question: how do you connect to a repl via shell script?

18:43 gfredericks: an existing instance meaning a process that has an nrepl server running?

18:43 wei: gfredericks: yep

18:43 gfredericks: I think you'd probably want to use the code in the clojure.tools.nrepl namespace

18:44 how you get into clojure from a shell script is left to taste

18:46 wei: boot perhaps? anyways, looks like tools.nrepl is the right direction, thanks

18:47 (inc gfredericks)

18:47 lazybot: ⇒ 136

22:45 cfleming: Do characters in Clojure (like \a or \b) read as char or as java.lang.Character?

22:46 I'm not sure how I would test that at a REPL - using (class ...) will always box, I guess.

22:46 ,(type \a)

22:47 brehaut: type is just a wrapper around class i believe

22:47 (it just also checks meta)

22:47 cfleming: brehaut: Ugh, you're right

22:48 brehaut: cfleming: i suspect your best bet is to check the reader java code

22:48 cfleming: brehaut: I was hoping to avoid that, but I think you're right

22:48 brehaut: im sure you know this already, but the compiler / reader is pretty clean

22:49 hiredman: cfleming: I don't think that question makes sense

22:50 brehaut: cfleming: fwiw line 1749 of RT.java returns a Character

22:50 oh, that might be premature

22:51 hiredman: what does "read as" mean?

22:51 brehaut: cfleming: 985 of LispReader.java sorry

22:52 hiredman: generally the reader constructs data structures from what it reads, so those data structures generally never hold primitives

22:52 brehaut: but really, its probably more important what the compuler does with that

22:52 hiredman: read itself can only return IFn's

22:53 but "read as" just doesn't make sense, and if try to make it more precise like "does the read function return primitive characters" the answer is immediately obvious

22:54 er

22:54 read itself can only return Objects

22:57 cfleming: The context is I'm looking to implement type inference in Cursive. I'm wondering which type makes more sense to assign to literals.

22:58 I believe this might be context sensitive, since if you do (loop [x \a] (recur \b)) I believe a primitive is used.

22:58 Whether the reader boxes and the compiler then optimises, I don't know.

23:00 Which since read only returns Objects, probably makes sense.

23:01 gfredericks: yeah I think the primitivization thing has got to be strictly in the compiler

23:01 (and not the reader)

23:01 cfleming: brehaut: Thanks - that makes sense

23:02 gfredericks: Right, I think so. I guess the question is - what makes sense to use for type inference then? Tricky.

23:04 gfredericks: quite.

23:04 some kind of abstract combination of Character and char perhaps

23:05 cfleming: would it not be adequate to ignore the primitives optimization for your purposes?

23:05 cfleming: gfredericks: Yeah, I think I'll just assign boxed types to everything right now, and then figure out later if I need primitives for disambiguating method invocations

23:06 gfredericks: I'm actually not sure it ever matters, now that I think about it

23:06 Boxed it is - thanks everyone

23:06 gfredericks: hmm, I wouldn't have guessed the primitives determine what methods get selected

23:07 but I haven't experimented with java methods that are identical except for boxed v. unboxed

23:07 who on earth would write those anyhow

23:07 cfleming: No, I don't think they do. I guess the only case would be if I wanted to warn when someone is trying to primitive hint a method but they're doing it in an invalid way - I think I'll leave that to the compiler.

23:08 Right, I'm actually not even sure if that's legal in Java or not.

23:09 gfredericks: well I'm gonna try that right now just so we can all be sure.

23:09 cfleming: Looks like it's legal, but it's definitely grounds for a horsewhipping.

23:09 (just tried it)

23:10 gfredericks: glad I found out about the horsewhipping before I tried it myself

23:10 cfleming: That doesn't apply if it's in the interests of science

23:11 gfredericks: oh phew; I'm relieved for your sake as well

23:11 * gfredericks off he goes

23:11 cfleming: Anyway, I think I can safely write that off as an edge case I don't have to worry about until someone complains about it

23:12 gfredericks: if they complain about it you can direct them to the horsewhipping

23:12 ...so that's convenient

23:12 cfleming: I should do that for all my bug reports, actually

23:12 gfredericks: #lifehack

23:12 cfleming: There you go

23:13 gfredericks: okay leaving for real this time

23:13 cfleming: Byeeeee

23:13 gfredericks: byeeeee

23:24 cddr: How would you quote this command so it can be run by clojure.shell? psql pfsc_connector_development -c "\d"

23:33 brehaut: cfleming: surely its too late on a friday to be thinking about stuff this complex?

23:34 cfleming: brehaut: I've spent most of the week wrangling regular expressions. It's time for something that actually makes sense.

23:34 brehaut: oh, well this is nice and light then.

23:34 as you were

23:35 cfleming: I'm not so sure about light, but it's definitely more interesting

23:40 Wow: http://curry-on.org/

23:40 That's what I call a speaker lineup.

23:41 brehaut: ztellman is speaking at the same time as cliff click. no pressure!

23:41 ztellman: haha, literally no pressure, there won't be anyone in the audience

23:41 cfleming: Fortunately I already know a few things that macros do.

23:41 :)

23:41 brehaut: lol

23:42 cfleming: ztellman: Congrats on the talk being accepted though, that looks like a great conference

23:42 ztellman: I am hilariously underqualified

23:42 but yeah, looking forward to it

23:43 cfleming: Meh - you've implemented an automata library, you're basically done.

23:43 ztellman: yeah, that basically describes the work of Wadler, Stroustrup, etc

23:43 cfleming: With a little embellishment around the edges, right

23:43 brehaut: just need to drop some pithy one liners and grow an epic beard?

23:44 TimMc: gfredericks: Check out .delete on List

23:45 Sorry, .remove actually. Takes int or Object. Terrible.

23:45 brehaut: people need to have these epic conferencse closer to new zealand

23:46 where by closer i mean in

23:46 cfleming: (inc brehaut)

23:46 lazybot: ⇒ 25

23:46 TimMc: same thing

23:46 cfleming: Although I'm actually in Europe for curry-on, not sure I can justify 600 euros though

23:48 brehaut: Yow! Lambda Jam is as good as it gets over here, I guess

23:48 brehaut: so ive heard

23:48 or teched

23:48 * brehaut snigges

23:49 brehaut: maybe conference organisers dont know that we have good beer in NZ

23:51 ztellman: I wouldn't say Prague has good beer

23:51 cheap beer, sure

23:52 brehaut: maybe thats the problem

23:52 we definately dont have cheap beer

23:53 TimMc: &(let [l (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 4)), x 1] [(.remove l x) l])

23:53 lazybot: ⇒ [2 [1 4]]

23:53 TimMc: &(let [l (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 4)), x (identity 1)] [(.remove l x) l])

23:53 lazybot: ⇒ [true [2 4]]

23:57 justin_smith: brehaut: new zealand sounds awesome, except for the serial teeth extracting scofflaws and such

23:58 cfleming: justin_smith: And the total absence of tech conferences

23:58 brehaut: justin_smith: wait what O_o

23:58 justin_smith: http://www.smh.com.au/world/man-surprised-women-by-pulling-out-their-teeth-with-pliers-court-is-told-20150430-1mwxy9.html

23:58 brehaut: i not sure i want to google this

23:59 justin_smith: basically dude got his kicks by involuntarilly pulling womens teeth out during sex...

23:59 cfleming: Holy crap

23:59 brehaut: O_O_O_O

23:59 cfleming: "When she told Hansen he shouldn't have done that, he tried to reassure her."

23:59 TimMc: I'm guessing that didn't last long.

Logging service provided by n01se.net