#clojure logs

2015-04-30

00:27azriHi guys, anyone here familiar with titanium clojurewerkz?
00:28azrican we query from the graph to get only a specific set of properties instead of getting the entire vertex?
03:28seancorfieldLet's just suppose I'm setting up Emacs for the first time for Clojure. What is your recommended startup config?
03:29seancorfieldI tried bbatsov/prelude and was surprised that it contained neither cider nor ido, both of which I would have considered essential.
03:29seancorfieldAlthough it does include a lot of nice defaults
03:30anewell, including cider would be a bity silly for a standardized installation (most people will not use it for Clojure)
03:30anefor clojure development, installing cider and clj-refactor is a good start
03:35seancorfieldPerhaps Emacs-Live is a better starting point then?
03:37seancorfieldI just figured that bbatsov as creator of cider would include it in prelude (since that seems to have other Clojure stuff?)
03:39aneit includes support for it, but it doesn't make you install it
03:39aneit's easy anyway: M-x package-install <RET> cider
03:40seancorfieldI know that. I was just looking for something more "turn key"
03:41seancorfieldI'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.
03:42anenot much has changed, though it depends on "years"
03:42anemost of the changes are in the quality of the addons, assuming you use cider (and not slime something clojure)
03:43anecider recently added a nice sexp-based debugger
03:44seancorfieldI used Emacs back in the 17/18/19 days then took a 20 year break. Then came back to it in October 2011.
03:44seancorfieldSo I was using nrepl
03:45aneright
03:46seancorfieldI switched to LightTable for a more "live" experience but development has stalled and my team seem to be moving back from LT to Emacs.
03:46seancorfieldSo I was hoping there was a reasonable "starter kit" so we could all move to something standardized.
03:46magnarsseancorfield: you could take a look at https://github.com/clojure-emacs/example-config
03:47J_ArcaneIs there a constructor function for maps, like vec or list?
03:47magnarsseancorfield: or even more turn-key (but more opinionated too) is http://overtone.github.io/emacs-live/
03:47magnarsJ_Arcane: hash-map
03:48J_ArcaneThanks.
03:48seancorfieldmagnars: I saw that in google but wasn't sure whether it was a full config or just basic stuff
03:49seancorfieldThe example, that is. I think I'm leaning toward emacs-live at this point.
03:49magnarsexample-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.
03:50seancorfieldI don't mind opinionated. Smart people curate well :)
04:28H4nscan 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.
04:28H4ns(record size is in the 2k-4k order)
04:33stainH4ns: so it's about 4 GB in total?
04:33tsdhCan I somehow apply type hints in (->> o .doThis .getThose .takeThat .doThis)?
04:34H4nsstain: yes - maybe a little more, but in that ballpark
04:34stainH4ns: what was slow in the file system.. you need to access many thousands at once?
04:35H4nsstain: 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.
04:35stainH4ns: so something like Couch DB or ElasticSearch would probably do it well.. but then you get yourself a server
04:36H4nsstain: 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.
04:36oddcullyElasticSearch can be run like e.g. H2
04:36stainElasticSearch is based on Apache Lucene which I think you can use programmatically without standing up a server
04:36oddcullye.g. you start it just up with your code as you need
04:36H4nsi was actually looking for something like berkeleydb.
04:37stainH4ns: 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
04:37H4nsstain: that is what i meant with "multiple levels"
04:37stainyou can try to use Derby, it's not insanely fast, but quite lightweight to set up
04:37H4nsstain: i did that, but it did not help.
04:37oddcullyis your value JSON?
04:37H4nsstain: derby, i'll look at that, thanks.
04:37H4nsoddcully: nope, strings.
04:37H4nsi've found mapdb, does anyone have experience with that?
04:38oddcullywell ES is good at indexing your json. so maybe for this it's just overkill
04:39stainyeah, you didn't mention search.. but if you are going to do any kind of search or queries, do look at ElasticSearch again
04:39H4nsi need key->value lookup, nothing else
04:39stainok, a bit overkill then
04:40oddcullywhat about ehcache
04:41oddcullynot sure, if it can be bent to "never evict"
04:46mavbozoH4ns, what about leveldb? I think factual already uses it in production https://github.com/Factual/clj-leveldb
04:47H4nsmavbozo: that looks like it, thanks!
05:05kritzcreekHello 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?
05:06hyPiRionkritzcreek: because (identity '+) just '+ => ('+ 1 2 3), not (+ 1 2 3).
05:06hyPiRionis just*
05:07H4nskritzcreek: try ((identity +) 1 2 3)
05:07dstockton,(type (identity '+))
05:07clojurebotclojure.lang.Symbol
05:07hyPiRionSymbols 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
05:07hyPiRion,('foo {'foo 'bar})
05:07clojurebotbar
05:07hyPiRion,('foo {'foz 'bar} 'baz)
05:07clojurebotbaz
05:08hyPiRion,('foo {'foz 'bar} 'baz 3)
05:08clojurebot#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...
05:08kritzcreekOh i see... When I tested ('+ 1 2) I thought it had done addition whereas it returned 2
05:08kritzcreekthx a bunch anyway :D
05:13TEttingeridentity pretty much returns exactly what is passed to it. usually. the only exception is that it boxes primitives
05:14TEttingerthat matters exceedingly rarely for correctness, though it can matter more often for performance
05:19TEttingerhyPiRion, can you think of another case where (identity x) and x are different?
05:19TEttinger,(let [na (/ 0.0 0.0) nana (identity na)] [(= (/ 0.0 0.0) (/ 0.0 0.0)) (= na na) (= nana nana)])
05:19clojurebot[false false true]
05:19hyPiRionTEttinger: NaN
05:20hyPiRionwell yeah
05:20TEttingerbut with == it works correctly I think
05:20TEttinger,(let [na (/ 0.0 0.0) nana (identity na)] [(== (/ 0.0 0.0) (/ 0.0 0.0)) (== na na) (== nana nana)])
05:20clojurebot[false false false]
05:20hyPiRionmore like
05:21hyPiRion,{Double/NaN 1, Double/NaN 2}
05:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: Double/NaN>
05:21hyPiRion,{(identity Double/NaN) 1, Double/NaN 2}
05:21clojurebot{NaN 1, NaN 2}
05:21TEttingerwaaaaaat
05:21TMA,(type :keyword)
05:21clojurebotclojure.lang.Keyword
05:21TMA,(ancestors (type :keyword))
05:21clojurebot#{clojure.lang.Named java.lang.Runnable clojure.lang.IHashEq java.io.Serializable java.lang.Comparable ...}
05:22TEttinger,{(identity Double/NaN) 1, Double/NaN 2, (symbol 'NaN) 3}
05:22clojurebot{NaN 1, NaN 2, NaN 3}
05:23TMA,(ancestors (type :keyword))
05:23clojurebot#{clojure.lang.Named java.lang.Runnable clojure.lang.IHashEq java.io.Serializable java.lang.Comparable ...}
05:23hyPiRionTEttinger: I think hash map does form equality checks instead of value equality
05:23hyPiRionthe literals, that is
05:23TMA,(ancestors (type 'keyword))
05:23clojurebot#{clojure.lang.AFn clojure.lang.Named java.lang.Runnable clojure.lang.IHashEq clojure.lang.IMeta ...}
05:23TEttingerTMA: try lazybot
05:23TMA##(ancestors (type 'keyword))
05:23lazybot⇒ #{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}
05:23TEttinger&(ancestors (type 'keyword))
05:23lazybot⇒ #{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}
05:23TEttingerheh
05:24TMAoh, & works too
05:24TMATEttinger: thanks
05:24TEttingernp, it's nice having multiple bots sometimes!
05:24TMA##(ancestors (type :keyword))
05:24lazybot⇒ #{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}
05:25TEttingeralso, type gets the type of its argument, not a type by the name of the arg
05:25TEttingernot sure what you're trying to do
05:25TEttinger&(ancestors (type 'wheeee))
05:25lazybot⇒ #{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}
05:27TMAit 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)
05:27otwieraczCommon Lisp?!
05:27otwieracz<3
05:28acron^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
05:28TMA##(let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(difference a b) (intersection a b)])
05:28lazybotjava.lang.RuntimeException: Unable to resolve symbol: difference in this context
05:29TEttingerTMA: set functions are in clojure.set IIRC
05:29TEttinger,(use 'clojure.set)
05:29clojurebotnil
05:29TEttinger,(let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(difference a b) (intersection a b)])
05:29clojurebot#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...
05:29acron^example: [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}]
05:29TEttingerdamn
05:33TMA&(do (use 'clojure.set) (let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(clojure.set/difference a b) (clojure.set/intersection a b)]))
05:33lazybot⇒ [#{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}]
05:34TMAOk, they are siblings which are mostly the same
05:34TMA(inc TEttinger)
05:34lazybot⇒ 51
05:34TEttingerthanks!
05:35TEttingeracron^, I'm not sure what you want from that
05:35TEttinger[:a 1 :a 2 :a 3 4 5 :a 6] seems really awful
05:36TEttingeryou may want apply concat
05:36acron^[{:a 1} {:a 2} {:a [3 4 5]} {:a 6}] => [{:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6}]
05:36TEttingeroh that isn't flattening at all...
05:36acron^Well, this is why I am asking about patterns
05:36acron^Right now my map routine returns either a value or a collection
05:36acron^which feels wrong
05:37TMAotwieracz: Indeed. Czy pan z Polski?
05:37acron^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}]
05:38otwieraczTMA: Tak.
05:39TMA&(map (fn [x] {:a x}) (flatten [1 2 [3 4 5] 6]))
05:39lazybot⇒ ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6})
05:39TMAacron^: then convert to array if desirable
05:40TMAIs there a way to write (fn [x] {:a x}) with # and %? I gather that #{:a %} would produce a set.
05:40TEttingeryou 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)
05:41acron^TMA TEttinger : I think my example is perhaps too crude
05:41TEttinger,(map #(hash-map :a %) (flatten [1 2 [3 4 5] 6]))
05:41clojurebot({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...)
05:42TMA(doc identity)
05:42clojurebot"([x]); Returns its argument."
05:43TMA(map #(identity {:a %}) (flatten [1 2 [3 4 5] 6]))
05:43TMA,(map #(identity {:a %}) (flatten [1 2 [3 4 5] 6]))
05:43clojurebot({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...)
05:44TEttingerI feel like we're missing something...
05:44TEttingerah!
05:44TEttinger,(map hash-map (flatten [1 2 [3 4 5] 6]) (repeat :a))
05:44clojurebot({1 :a} {2 :a} {3 :a} {4 :a} {5 :a} ...)
05:44TEttinger,(map hash-map (repeat :a) (flatten [1 2 [3 4 5] 6]))
05:44clojurebot({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...)
05:44TEttingermulti-collection map!
05:45TMAwith the inner function a mapping one, cool!
05:45acron^Yeah, flatten doesn't work
05:46acron^because I don't have [1 2 [3 4 5] 6], I have [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}]
05:46acron^I thought my example would scale but it doesnt
05:46TMAit might be somewhat revolting thought for those not LISP infected though
05:47TMA&(map hash-map (repeat :a) (flatten (map :a [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}]))
05:47lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
05:47acron^,(mapv #(hash-map :a %) (flatten (mapv #(->> % vals first) [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}])))
05:47clojurebot[{:a 1} {:a 2} {:a 3} {:a 4} {:a 5} ...]
05:48acron^that's my best offering
05:48acron^looks crappy though
05:48TMA&(map hash-map (repeat :a) (flatten (map :a [{:a 1} {:a 2} {:a [3 4 5]} {:a 6}])))
05:48lazybot⇒ ({:a 1} {:a 2} {:a 3} {:a 4} {:a 5} {:a 6})
05:48acron^I prefer yours, thanks TMA
05:49stainIs 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?
05:49stainIllegalArgumentException Don't know how to create ISeq from: org.apache.commons.rdf.simple.GraphImpl clojure.lang.RT.seqFrom (RT.java:505)
05:49stainsomething with protocols perhaps..?
05:51TMA&(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)}))
05:51lazybot⇒ {: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}}
06:04TEttingeracron^: version that respects the key each value or collection came with:
06:04TEttinger&(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)))
06:04lazybot⇒ ({:a 1} {:b 2} {:c 3} {:c 4} {:c 5} {:a 6})
06:05acron^whoa
06:05acron^nice one TEttinger
06:05TEttingerthis is fun!
06:05acron^:)
06:48acron^Ahh TEttinger
06:48acron^it broke when I added new keys
06:49acron^&(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)))
06:49lazybotjava.lang.IllegalArgumentException: Duplicate key: :b
06:49TMA(doc cycle)
06:49clojurebot"([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll."
06:49acron^&(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)))
06:49lazybot⇒ ({:b true} {:a 1} {:c false} {:b 2} {:c 3} {:b 4} {:c 5} {:b true} {:b false} {:a 6})
06:54acron^but so does all of them
06:54TMA(doc hash-map)
06:54clojurebot"([] [& 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."
06:55TMA,(hashmap :a 1 :b 2 :a 4)
06:55clojurebot#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...
06:56TMA,(hash-map :a 1 :b 2 :a 4)
06:56clojurebot{:b 2, :a 4}
06:57acron^https://www.refheap.com/7aee368366517306486bff86c real data
06:57TMAnote to self: hash-map is like perl's list->hash conversion
06:59acron^in clojure, which forms take x inputs and return y values where x > y ?
06:59acron^like, the opposite of reduce?
06:59justin_smithacron^: reduce can return more values than you supply
07:00TMAis there an inverse of hash-map?
07:00TEttingeracron^: you had ##{:b 2 :b false}
07:00justin_smith,(reduce (fn [v n] (into v (range n))) [] (range 10))
07:00clojurebot[0 0 1 0 1 ...]
07:00TEttinger,{:b 2 :b false}
07:00clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :b>
07:00TEttingerthat error will always exist for duplicate keys
07:00acron^TEttinger: yeah I know, I realised and ammended the example
07:00justin_smith,{Double/NaN 1 Double/NaN 2}
07:00clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: Double/NaN>
07:01TEttinger,{Double/NaN 1 (identity Double/NaN) 2}
07:01clojurebot{NaN 1, NaN 2}
07:01justin_smith,(hash-map Double/NaN 1 Double/NaN 2 Double/NaN 3)
07:01clojurebot{NaN 1, NaN 2, NaN 3}
07:01drguildo,(flatten (seq {:foo "bar" :a 1}))
07:01clojurebot(:foo "bar" :a 1)
07:01justin_smith,(flatten {:foo "bar" :a 1})
07:01clojurebot()
07:02justin_smith~flatten
07:02clojurebotflatten 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.
07:02drguildo,(list {:foo "bar" :a 1})
07:02clojurebot({:foo "bar", :a 1})
07:03acron^flatten is rarely the right answer :(
07:04justin_smith,(apply concat {:a 0 :b 1})
07:04clojurebot(:a 0 :b 1)
07:04justin_smiththat's the right way to do it
07:06acron^i clearly don't understand reduce...
07:07justin_smithacron^: 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
07:07justin_smithbut, see also mapcat of course
07:08justin_smithmapcat similarly can return more, or fewer, elements than the input list
07:20noncom|2acron^: reduce is just a transformer which takes a sequence elements 1 by 1 and creates something new out of them
07:20acron^:)
07:20acron^i've used reduce
07:20acron^it works
07:20acron^thanks all
07:20noncom|2but what's the question then? :)
07:21acron^read upward :p
07:22noncom|2ah, ok, sorry :)
07:22justin_smithtechnically, like every clojure function, reduce can only return 1 value :)
07:23acron^of course ;)
07:24TMA&((fn [data] (mapcat #(apply concat %) data)) [{:a 1 :b true} {:b 2 :c false} {:c [3 4 5] :b true} {:a 6 :b false}])
07:24lazybot⇒ (:b true :a 1 :c false :b 2 :c [3 4 5] :b true :b false :a 6)
07:25TMA(doc zip)
07:25clojurebotHuh?
07:25TMA(doc zipl)
07:26clojurebotI don't understand.
07:26justin_smithTMA: maybe you want zipmap?
07:26TMA(doc zipmap)
07:26clojurebot"([keys vals]); Returns a map with the keys mapped to the corresponding vals."
07:26hyPiRionor interleave
07:27hyPiRion,(interleave (range) (map - (range)))
07:27clojurebot(0 0 1 -1 2 ...)
07:28TMA(doc interleave)
07:28clojurebot"([] [c1] [c1 c2] [c1 c2 & colls]); Returns a lazy seq of the first item in each coll, then the second etc."
07:31TMA(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}]))
07:31TMA&(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}]))
07:31lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
07:31TMAsorry
07:32justin_smithTMA: oh you want partition
07:34justin_smith,(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}]))))
07:34clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: clojure.lang.LazySeq@51727cb9>
07:34justin_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}]))))
07:34clojurebot({:a 1} {:b true} {:b 2} {:c false} {:c [3 4 5]} ...)
07:34TMA(doc partition)
07:34clojurebot"([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."
07:35justin_smithTMA: is that what you wanted? what should the output there actually look like?
07:36TMAI am trying to wrap my head around acron^'s problem. It is complex enough to be interesting yet simple enough to be approachable.
07:37acron^:D
07:37acron^TMA: did you see that real data link? that's a real sample from what i'm working with
07:39TMAacron^: I must have missed it in the first place. I'have found it noe.
07:43acron^bbiab
07:45TMA&(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}])))
07:45lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean
07:46TMAthe only missing piece is listify, apparently
07:48TMA,[(seq? 1) (seq? '(1)) (seq? [1])]
07:48clojurebot[false true false]
07:49justin_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}])))
07:49clojurebot({:a 1} {:b true} {:b 2} {:c false} {:c 5} ...)
07:49justin_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}])))
07:49lazybot⇒ ({:b true} {:a 1} {:c false} {:b 2} {:c 5} {:b true} {:b false} {:a 6})
07:49justin_smithoh, repeating the key is silly :)
07:49justin_smithdid you mean to repeat the key?
07:51TMA{:c [3 4 5]} should have been transformed to ({:c 3} {:c 4} {:c 5})
07:51justin_smithoh, that's not zipmap at all
07:52justin_smith&(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}])))
07:52lazybot⇒ (({:b true}) ({:a 1}) ({:c false}) ({:b 2}) ({:c 3} {:c 4} {:c 5}) ({:b true}) ({:b false}) ({:a 6}))
07:52TMA(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}])))
07:52justin_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}])))
07:52lazybot⇒ ({:b true} {:a 1} {:c false} {:b 2} {:c 3} {:c 4} {:c 5} {:b true} {:b false} {:a 6})
07:53TMAjustin_smith: that's the one!
07:53TMAsomehow, even being wrong feels good in lisp-family programming
07:55TMA(inc justin_smith)
07:55lazybot⇒ 250
07:58TMAI know that #(... % ...) works for one argument. Is there a two (or N) argument version?
07:59justin_smith,(#(list %& %3 %2 %) (range 10))
07:59clojurebot#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...
07:59justin_smithoops
07:59justin_smith,(apply #(list %& %3 %2 %) (range 5))
07:59clojurebot((3 4) 2 1 0)
07:59engblom(#(+ %1 &2) 1 1)
07:59engblom,(#(+ %1 &2) 1 1)
07:59clojurebot#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...
07:59engblom,(#(+ %1 %2) 1 1)
07:59clojurebot2
08:00justin_smith,(apply #(list %& %3 %2 %) (range 7))
08:00clojurebot((3 4 5 6) 2 1 0)
08:00TMAoh %number and %& for rest argument
08:00TMAthank you
08:02TMA,(#(list %1 % %2) 1 2 3)
08:02clojurebot#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...
08:02TMA,(#(list %1 % %2 %&) 1 2 3)
08:02clojurebot(1 1 2 (3))
08:02TMAand %1 === % even when used in the same fn.
08:03oddcullyit is "polite" to use %1, if you also use %n
08:05TMAis there a way to nest them? (something like adding/doubling #'s and %'s with each level?)
08:06justin_smithno, there is no nesting
08:06justin_smithit's just a convenience
08:06justin_smith,'#(+ %1 %2)
08:06clojurebot(fn* [p1__225# p2__226#] (+ p1__225# p2__226#))
08:06justin_smithyou can use fn
08:38sveri1Hi, 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
08:40justin_smithsveri1: (partition 2 1 coll) will give you each thing plus the thing after it (but not the last thing...)
08:41sveri1justin_smith: ah, you mean I should build some temp list containing x and x+1 vec
08:42justin_smithright, then each step can see both
08:42justin_smithbut you may want to tack a nil or whatever on the end
08:42justin_smithbecause one of them has no next, of course
08:42sveri1justin_smith: yea, that makes sense, I will try that, thank you
08:43justin_smiththere is also loop of course
08:57noncom|2does anyone use cusive?
08:58noncom|2*cursive
09:00pbxnoncom|2, i've certainly seen people talking about it here. dive right in with your question
09:03noncom|2in 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
09:03noncom|24) 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 []
09:03noncom|2i tried setting a kb scheme, there are two available: emacs and cursive, but not one of them works
09:05noncom|25) a hotkey to re-eval the form the cursor is in, or, at least, sync the repl and files
09:07noncom|2did anyone have success in making hotkeys work in cursive?
09:07noncom|2if yes, then how
09:08dnolennoncom|2: in the preferences there is a key mapping menu
09:09noncom|2dnolen: 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
09:09dnolenyou 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)
09:09dnolennoncom|2: it allows you to edit mappings
09:10dnolennoncom|2: you probably need to copy the Emacs mappings first so you can edit it
09:16noncom|2dnolen: http://joxi.ru/xAeGLKYiq6wKmy
09:16noncom|2nothing is editale there
09:17dnolennoncom|2: sorry, Keymap the second menu is the one you need to be looking at
09:17irctc_how can i transform this expression ((partial map inc) (range 10)) into (-> (range 10) (partial map inc))
09:18irctc_i would like to be albe to read it from left to right
09:18irctc_but it does not work
09:19noncom|2irctc_: (->> (range 10) ((partial map inc))) ?
09:19noncom|2,(->> (range 10) ((partial map inc)))
09:19clojurebot(1 2 3 4 5 ...)
09:19irctc_tahnk you
09:19irctc_what is the single arrow
09:19noncom|2but that's a rather strange thing to do, imo
09:20noncom|2irctc_: single arrow puts the form on the second place. double arrow - on the last place
09:20irctc_k, thanks, that was just a toy example
09:21noncom|2dnolen: do, right, in keymap i did find additional settings for cursive!
09:21noncom|2but the amount of possible conflicts is depressing..
09:21noncom|2did you work out a good scheme for you?
09:22dnolennoncom|2: I don't care about conflicts since most of the things I want to replace I'll never use.
09:22dnolennoncom|2: I would learn how to open the action menu, it's like M-x in Emacs
09:22dnolennoncom|2: for less frequest commands this is what I use
09:23noncom|2dnolen: yeah, M-x is great in emacs! btw do you prefer cursive or emacs?
09:24dnolennoncom|2: I only do Clojure/ClojureScript work in Cursive now
09:24dnolennoncom|2: I've found it easy to bend Cursive to my Emacs will
09:25noncom|2i see :)
09:25dnolenvery few things are missing that I care as far as Clojure work. I still use Emacs for org-mode, erc, etc.
09:26noncom|2dnolen: 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..
09:26noncom|2i think you did not encounter this, but i'd ask anyway..
09:26dnolennoncom|2: I haven't needed to use anything native so I can't help there
09:31irctc_this example again (-> (range 10) ((partial map inc))) why do you need double (()) around partial. Is not that evaluating the partial function?
09:32noncom|2irctc_: because it inserts the form at the second place: ((partial map inc) _ )
09:32noncom|2i have marked it with _
09:32noncom|2*last place, sorry
09:32oddcullynoncom|2: i have used intellij with libgdx, which pulls native stuff (used gradle). that worked well
09:33noncom|2if you have single parenthesis, you get (partial map inc _)
09:34noncom|2irctc_: btw, i might be messed things up a little :) if you use ->>, you do not need (()), the () will suffice
09:34noncom|2but for -> you need (()), coz the second place will be (() _ )
09:35noncom|2oddcully: hmm, thats definitely strange since the same very project worked ok in eclipse, but not in cursive :/
09:36dysfunanyone have a recommendation for image resizing libs?
09:38irctc_i took me a while but i got it now
09:39irctc_thanks
09:39dnolendysfun: not aware of any specific lib, but looks simple to do with javafx
09:40dysfuni had bad experiences with javafx :)
09:40dysfuni've seen some stuff for AWT that looks trivial enough though
09:40dstocktonhttps://github.com/josephwilk/image-resizer ?
09:40dysfuni'm currently looking at that
09:40dysfunalso https://github.com/mikera/imagez
09:42oddcullyi have used imgscalr for thumbnails in an admin backend. the quality is rather meh
09:42dysfunthe quality of the library or the thumbs?
09:42oddcullythe image quality
09:43dysfunso i can see a section in the image-resizer docs (Which says it's based on imgscalr) showing how to tune quality-vs-speed
09:43dysfun(resize-fn 100 100 ultra-quality) ;best quality
09:44oddcullyi used the best setting then and it was meh
09:44dysfunoh :/
09:44oddcullymy comparsion was doing it with convert
09:44oddcullyymmv
09:45oddcullystill ok in my case, since it is only needed to give the admin there the impression of whats on the image
09:45dysfuni'm resizing to create responsive images :
09:45dysfun:/
09:46oddcullygive it a try. that is my experience from some time ago (year or so)
09:46justin_smithdysfun: that's what lichen is for (it even has a standalone server)
09:46oddcullymy impression was, that the underlying java libs for the task are not up to it
09:47justin_smithoddcully: 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)
09:47irctc_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 (())
09:48dysfunjustin_smith: and i shouldn't read too much into it that you haven't touched it since last january? ;)
09:48justin_smithdysfun: I got laid off from the company that was funding development of that lib
09:48justin_smithbut it is still used in production
09:48justin_smiththe outstanding issue is iirc YUV format jpg
09:48dysfunah
09:49justin_smithit'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)
09:50justin_smithnot 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
09:51justin_smithcaching to disk
09:51justin_smith(s3's disk that is)
09:51dysfunthese will be rendered at upload time because of the small numbers of sizes involved
09:54srrubyI'm using clojure.test. How do I test functions marked private?
09:54justin_smithsrruby: you can refer to the var, or do black-box testing
09:55justin_smith#'some.ns/private-fn
09:55srrubythanks.
09:55justin_smith,(#'+ 1 2 3)
09:55clojurebot6
10:11noncom|2irctc_: ah, right! sorry, just digressing to much ..
10:49noncom|2how do i make cursive to do 2-space tabs instead of this? http://joxi.ru/1A5b5BZF71ywrE
11:05seancorfieldI 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:05seancorfieldLet's just suppose I'm setting up Emacs for the first time for Clojure. What is your recommended startup config?
11:06seancorfield 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:07seancorfieldAre folks using emacs-live? Or some other curated config?0
11:10dnolennoncom|2: there's a code formatting preference for Clojure, you can set indent only
11:12dnolenseancorfield: I just stick to clojure-mode + paredit + cider or inf-clojure
11:13noncom|2dnolen: 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:14seancorfielddnolen: no ido or projectile or fancy stuff?
11:14noncom|2such a pain, such a pain.. what i was taking for granted, had just slipped away..
11:14noncom|2seancorfield: why not
11:15dnolenseancorfield: 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:15noncom|2the "wrong" formatting is marked red here: http://joxi.ru/DrlavXzIjZX5mP idk, i cannot tune it..
11:16dnolenseancorfield: 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:16crimeministerseancorfield: happy emacs-live user here
11:17seancorfieldOk, interesting. Thanks dnolen
11:17seancorfieldcrimeminister: did you tweak it much? Or is it pretty comprehensive out of the box?
11:17noncom|2i used emacs-live out-of the box
11:18noncom|2but later i went with prelude + cider + paredit + autocomplete and some more stuff..
11:18noncom|2emacs live seems pretty ok for the start
11:18noncom|2easy start
11:18seancorfieldnoncom|2: good to know. I'll see how emacs-live looks once I've had a coffee :)
11:19noncom|2seancorfield: 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:22crimeministerseancorfield: I left the out of box experience alone, and isolated my changes in a personal "pack"
11:22crimeministerseancorfield: that way updating live doesn't give me any merge conflicts, it's as easy as a git pull
11:27sobelmilestone: first commercial clojure jarred/deployed to the local Nexus repo/cache
11:29sobelnow i have to find motivation to go back to the dark side and integrate it with eclipse
12:05justin_smithsobel: congrats
12:07justin_smithI'm thinking we might eventually want to upgrade from wagon-s3-private to nexus
12:14sobeldoesn't wagon use WebDAV?
12:14sobeli like the local resource cache concept in general for repeatable builds.
12:24gfredericksdoes anybody know why `lein ring server-headless` brings down more deps that weren't fetched with `lein deps`?
12:26justin_smithgfredericks: maybe the plugin deps are not visible if you aren't invoking the plugin? That's odd isn't it.
12:26justin_smithgfredericks: I imagine perhaps one of the thing the plugins does is add deps.
12:26gfredericksI'm looking around for that, haven't found evidence of it yet
12:26justin_smiththe plural on thats is some wrongs
12:27oddcullyis it stuff, that looks like things to make gfx/fonts/... work?
12:28justin_smithgfredericks: if nothing else it should be injecting the jetty dep
12:28gfredericksoh hmm
12:28gfredericksI forgot there's both app deps and plugin deps
12:28gfredericksI guess it's probably just app deps that are late
12:38gfredericksah yep https://github.com/weavejester/lein-ring/blob/d16661f7ee45fbb6706930ac3c34c5f30936a98a/src/leiningen/ring/server.clj#L33
12:39gfrederickswish I could figure out a clean way to force that without starting a blocking process
12:53TimMcgfredericks: For offline development?
12:55gfredericksfor docker
12:55gfredericksit'd be dumb if your docker image fetched a bunch of deps every time you started it
12:56gfredericksI'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:56TimMcyay
13:01hiredmanugh, are you using lein run to run a ring server inside docker?
13:03hiredmaneither 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:07gfredericksuhm
13:08gfredericksyou mean keep lein&whatnot outside of docker?
13:09hiredmansure
13:09gfredericksthat seems unideal; reproducibility is important for builds.
13:10hiredmanor use a bulky docker container for making builds and deploy the builds to a slim one
13:10hiredmangfredericks: and lein is not for running production code
13:11gfredericksyeah this isn't for production
13:11gfredericksit's a multi-repo CI setup thinger
13:11hiredman(or don't use docker at all, it kind of sucks)
13:11gfredericksthere's a lot of variables dockerwise, so it'll probably take me a while to sort out the options
13:11gfredericksnot using lein-ring at all would be one way to sidestep this particular problem
13:11gfrederickswhat kind of sucks about docker?
13:12hiredmanit is unstable and tends to eat various kinds of resources and not free them
13:12gfredericks'unstable' in the 'fast-changing API' sense?
13:13hiredmanno
13:14hiredmanwe 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:15hiredmaneverything else has been a huge pain and a time sink
13:16gfredericksI'm testing something that involves five different components
13:16hiredmanmaybe it'll be fine for you
13:16gfredericksbeing able to wire it up with docker-compose seems a lot more robust than doing it by hand
13:20TimMcgfredericks: I think he means that it is possible to unst it.
13:24TimMchiredman: What's the least worst deployment option in your experience?
13:25hiredmantarball
13:26hiredmanI mean, for my personal stuff I tend to use uberwars or uberjars, but for work, our biggest oldest service uses lein-tar
13:26hiredmanworks great
13:26tbaldridge+1 for uberjar if it works for you
13:27hiredman(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:39wasamasawat: http://hackaday.com/2015/04/27/making-music-with-clojure-and-bananas/
13:52stianwasamasa: haha, that's mine :p
13:52wasamasastian: congrats for making me wat
13:52stianwasamasa: thank you, enjoy the wat :p
13:53wasamasareminds me of my demo where I remote-controlled overtone with key presses in emacs
13:55wasamasaso, I had a shabby midi controller essentially
13:58stianwasamasa: there's a key press in that video as well, enter in the repl, was one banana short :)
14:01oddcullyand afterwards, put the bananas into the blender, add some milk and honey and play yourself some grindcore
14:01wasamasareminds me of one noisia interview
14:02wasamasa"How do you make these insane bass lines?" - "We sample blenders, vacuum cleaners, ..."
14:07TimMcI've been thinking about borrowing a mic recording some samples of our baby for techno purposes.
14:07TimMcbabystep
14:07wasamasababymetal is already a thing
14:07wasamasaso, why not?
14:08wasamasafor science!
14:08TimMcscreeee eh eh eh-ehe-heh waarruugghh
14:10TimMchttp://www.discogs.com/Aube-Luminous/release/185719 Sound source: fluorescent & glow lamps.
14:10TimMcIf that works, why not babies?
14:24gfredericksTimMc: "it's possible to unst it"?
14:25TimMcgfredericks: Yeah. It's unst-able.
14:25TimMcI'm truly sorry.
14:25gfredericksoh it was a jok
14:25gfredericksyeah he never explained "unstable" did he
14:26TimMcEver 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:26wasamasajust accept it
14:26TimMcnoooo
14:27wasamasanot like it's hurting anyone, is it :P
14:30gfredericksit's a deep biological evolutionary thing
15:10edbondcore.memoize has no memory limit?
15:11edbondttl with high threshold
15:13irctcIs 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:14irctcthus 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:15ToxicFrogirctc: (if foo (x 1 2) (x 1)) ?
15:16uris77irctc: wouldn't a multimethod be useful in this case? Just curious. I'm a noob.
15:16mihailphi
15:16mihailp4clojure tasks in PicoLisp
15:16mihailphttp://goo.gl/6P2n4e
15:18TimMcI'm finding it very difficult to generate javadocs with lein.
15:18TimMcDoes anyone have a working example? I either end up with no HTML files or it includes tools.jar...
15:18irctcToxicFrog: I was trying not to do this.
15:19oddcullyirctc: is it one of yours? then defn with both arities and call the other arity with nil
15:19irctcoddcully: you mean have the 2 arity form handle nil?
15:20irctcoddcully: ... for the second param.
15:20oddcully,(defn f ([x] (f x nil)) ([x y] (println x y)))
15:24oddcullyirctc: you have to test for yourself since clojurebot takes a nap
15:25irctcoddcully: Yeah, I know whatcha mean.
15:35cflemingnoncom|2: Did you get the keybindings sorted out for Cursive?
15:38cflemingnoncom|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:45amalloycfleming: also there's lazybot's $mail
15:48cflemingamalloy: Yeah, although I thought that was more for when people were no longer connected to the room
15:50amalloyeh. 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:56cflemingInteresting - I'll give it a go. I'd assumed it would send a message when someone reconnected.
15:57justin_smith$mail cfleming it looks for activity
15:57lazybotMessage saved.
15:57cfleming$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:57lazybotMessage saved.
15:57cflemingbeep
15:57cflemingboop
15:57cflemingbop
15:57cflemingNo mail for me
15:57justin_smithhmm, did it not trigger?
15:57cflemingNope
15:57justin_smithnever mind then
15:59amalloy$mail amalloy test
15:59lazybotMessage saved.
15:59amalloyfdsfas
16:00cfleming$mail amalloy Another test
16:00lazybotMessage saved.
16:00amalloycfleming: it triggers just fine, but i suspect your client is misconfigured to hide IRC "notice" events
16:00amalloyit sends you a notice in PM
16:01cflemingI can't see anything about notice events in the doc
16:01amalloy~def +
16:01cflemingI'm using Textual, which is generally well thought of - I'd be surprised if it didn't implement them correctly
16:02amalloywhoa, where's clojurebot
16:02amalloyi was gonna use him to test, since he sends a notice for source lookups
16:03oddcullydead as the dodo
16:03oddcully$mail oddcully get rid of clojurebots body
16:03lazybotMessage saved.
16:03cfleming:/notice cfleming test
16:04cflemingbeep
16:04cflemingboop
16:04cflemingbop
16:05oddcullywoah! the colors!
16:05TimMccfleming: ^ Did you see this notice I just sent?
16:05cflemingTimMc: Yeah, I did
16:05amalloy$login
16:05lazybotYou've been logged in.
16:06amalloy$say cfleming do you get PMs from lazybot at all?
16:06cflemingYep
16:06cflemingGot that
16:06amalloypuzzling
16:06amalloy$unmail justin_smith cfleming
16:06lazybotDeleted unread messages from justin_smith to cfleming
16:06oddcullyalert time default of 5min?
16:06amalloyyeah
16:06amalloy$logout
16:06lazybotYou've been logged out.
16:11oddcullylazybot: time's over! msg me!
16:11oddcullyworks for me
16:12oddcullygot notices on status window at xx:05 and xx:11
16:27justin_smith$mail justin_smith mail justin_smith
16:27lazybotMessage saved.
16:27justin_smithOK, now what
16:27justin_smithyeah,that worked
17:19aaelonyI seem to always forget how to do a named field vector in a juxt command...
17:19aaelony, (map (juxt :a :b) [{:a 1 :b 2 :c 3}])
17:19aaelonyversus
17:19aaelony, (let [v [:a :b] ] (map (juxt v) [{:a 1 :b 2 :c 3}]))
17:20oddcullyclojurebot was called into an important meeting
17:20aaelonylol
17:20aaelony(inc oddcully)
17:20lazybot⇒ 6
17:21j-pb,(map (juxt :a :b) [{:a 1 :b 2 :c 3}])
17:21j-pbso eval's broken but inc isnt?
17:21j-pbweird
17:21aaelonyanyways, the let version above fails
17:22oddcullyinc is the expertise of lazybot
17:22j-pbaaelony: do (apply juxt v)
17:22aaelonyI don't think lazybot and clojurebot are the same
17:22aaelonyj-pb: apply, aha! yes, thanks
17:22j-pbaaelony: why do you forget that though?
17:22j-pbit's not something you have to remember
17:23j-pbyou can deduce it
17:23aaelony, (let [v [:a :b] ] (map (apply juxt v) [{:a 1 :b 2 :c 3}])) ;; this works
17:23j-pbjuxt takes functions and applies them to its arguments returning a vector with all the results
17:23j-pbas done above
17:23j-pbin your first example
17:23aaelonyfor some reason, I disremember apply because it reminds me of all the R flavors (tapply, sapply, etc... )
17:24j-pbso (juxt [:a :b]) is a type error
17:24j-pbah
17:24aaelonydysremember actually
17:24aaelonycool. thanks
17:24j-pbif you come from R you might get cought in the pitfall that everything looks like syntax
17:25aaelonyyes, I originally came from R, but I have no excuse since that was years ago...
17:26j-pbapply just takes a function and a vector and calls the function as if its arguments were the contents of that vector
17:26j-pbaaelony: everytime I touch r, I get blisters ;_
17:27aaelonyClojure is much nicer. But sometimes it's nice to verify Clojure with R
17:27aaelony(as awful as that sounds)
17:28amalloyj-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:28j-pbaaelony: if you're not new to clojure, sorry for going into "welcome to the world of lisp" mode ;)
17:28amalloyspecifically, ##(map (juxt [:a :b]) (range 2))
17:28lazybot⇒ ([:a] [:b])
17:28aaelonyis ## the magic now. ok cool
17:29justin_smithdifferent bots for different strokes
17:29j-pbamalloy: yeah, but it's a pretty nonsensical one, since its equivalent to (comp vector [:a :b])
17:29amalloyyes
17:31seancorfieldcider 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:31seancorfield [exec] Box _ = new Box(null);
17:31seancorfield [exec] ^
17:31seancorfield [exec] (use of '_' as an identifier might not be supported in releases after Java SE 8)
17:32seancorfieldis there something I should exclude on the cider-nrepl dependency to suppress whatever it is doing behind the scenes?
17:33amalloyseancorfield: are you intentionally recompiling clojure? it seems weird to me that nrepl would do that
17:33seancorfieldno, this seems to be something in cider-nrepl that has triggered this
17:35seancorfieldI'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:36seancorfieldbut it does seem to be attempting to compile all the Java source code in Clojure...
17:37seancorfieldHmm, 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:37TimMcMaybe should be a resource.
17:41seancorfieldYeah, looks like it. I don't even remember why I added it now.
17:41TimMcTo git log!
17:48seancorfieldSo it dates back three years to when we were using CDT (and slime/swank).
17:50seancorfield(inc amalloy)
17:50lazybot⇒ 265
17:50seancorfieldthat's for pointing me in the direction of clojure source :)
17:51amalloyseancorfield: the three-year swank timebomb finally went off, huh?
17:51seancorfieldheh... I _think_ that was the last artifact of it still in our code!
17:53oddcullythanks to TimMc my brain now i caught up in a batman (1966) theme loop
17:55brehauthttp://36.media.tumblr.com/d84bbc221c57a13659654fa8d22a862f/tumblr_nkcnzu7eXE1sz8987o1_500.jpg
17:58TimMcOK, that's enough beating my head against gpg-agent and maven for the day. Possibly for the week, or maybe even the month.
18:12gfredericks,(println ["foo" "bar"])
18:12gfredericks&(println ["foo" "bar"])
18:12lazybot⇒ [foo bar] nil
18:12gfredericks^ I feel like this behavior has no use case, but I'm not sure if that means it ought to do something different
18:12gfredericksone idea would be if the function only accepted strings; but that seems like it would aggravate people
18:13gfredericks(not a serious suggestion about changing clojure obviously, just pondering APIs)
18:15amalloygfredericks: yeah, whenever you call println on a clojure data structure it's usually a mistake
18:20gfredericksbut calling it on other scalars might be okay
18:20gfredericksI dunno
18:20gfredericksseems 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:20gfredericksI hadn't thought about it that way till just now though
18:21gfredericksI was mucking with the new exception printing code is what made me think about it
18:21amalloygfredericks: i mostly use printf and pr-str
18:22gfredericksI bet println is the goto function for anybody who has ever used java
18:23drbobbeatygfredericks: I'm an ex-Java guy, and I can't remember using println once :)
18:23gfredericksdammit
18:23drbobbeatyI use the logging functions - exclusively.
18:24amalloygfredericks: i've used java for a decade :P
18:25gfredericksthis claim has been a disaster
18:25gfredericksI will never make it again.
18:26drbobbeatygfredericks: Hey... how are those Hershey's holding out?
18:26gfredericksoh they are long gone
18:26drbobbeaty:)
18:26drbobbeatyglad to hear it.
18:26vagmiI have a long running nrepl, how do I find the port on which it is running?
18:26gfrederickspeople started asking for them so the decay rate picked up
18:28vagmii 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:28gfredericksuhrms
18:30oddcully##(slurp ".lein/repl-port") ^_^
18:30lazybotjava.security.AccessControlException: access denied ("java.io.FilePermission" ".lein/repl-port" "read")
18:32gfredericksI thought there might be some nrepl hackery to recover it but can't figure anything out
18:32gfredericksclojure.tools.nrepl.middleware.interruptible-eval/*msg* is a fun var to look at though
18:32gfredericksat the repl in particular
18:39weiwhat’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:43weisimpler question: how do you connect to a repl via shell script?
18:43gfredericksan existing instance meaning a process that has an nrepl server running?
18:43weigfredericks: yep
18:43gfredericksI think you'd probably want to use the code in the clojure.tools.nrepl namespace
18:44gfrederickshow you get into clojure from a shell script is left to taste
18:46weiboot perhaps? anyways, looks like tools.nrepl is the right direction, thanks
18:47wei(inc gfredericks)
18:47lazybot⇒ 136
22:45cflemingDo characters in Clojure (like \a or \b) read as char or as java.lang.Character?
22:46cflemingI'm not sure how I would test that at a REPL - using (class ...) will always box, I guess.
22:46cfleming,(type \a)
22:47brehauttype is just a wrapper around class i believe
22:47brehaut(it just also checks meta)
22:47cflemingbrehaut: Ugh, you're right
22:48brehautcfleming: i suspect your best bet is to check the reader java code
22:48cflemingbrehaut: I was hoping to avoid that, but I think you're right
22:48brehautim sure you know this already, but the compiler / reader is pretty clean
22:49hiredmancfleming: I don't think that question makes sense
22:50brehautcfleming: fwiw line 1749 of RT.java returns a Character
22:50brehautoh, that might be premature
22:51hiredmanwhat does "read as" mean?
22:51brehautcfleming: 985 of LispReader.java sorry
22:52hiredmangenerally the reader constructs data structures from what it reads, so those data structures generally never hold primitives
22:52brehautbut really, its probably more important what the compuler does with that
22:52hiredmanread itself can only return IFn's
22:53hiredmanbut "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:54hiredmaner
22:54hiredmanread itself can only return Objects
22:57cflemingThe context is I'm looking to implement type inference in Cursive. I'm wondering which type makes more sense to assign to literals.
22:58cflemingI believe this might be context sensitive, since if you do (loop [x \a] (recur \b)) I believe a primitive is used.
22:58cflemingWhether the reader boxes and the compiler then optimises, I don't know.
23:00cflemingWhich since read only returns Objects, probably makes sense.
23:01gfredericksyeah I think the primitivization thing has got to be strictly in the compiler
23:01gfredericks(and not the reader)
23:01cflemingbrehaut: Thanks - that makes sense
23:02cfleminggfredericks: Right, I think so. I guess the question is - what makes sense to use for type inference then? Tricky.
23:04gfredericksquite.
23:04gfrederickssome kind of abstract combination of Character and char perhaps
23:05gfrederickscfleming: would it not be adequate to ignore the primitives optimization for your purposes?
23:05cfleminggfredericks: 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:06cfleminggfredericks: I'm actually not sure it ever matters, now that I think about it
23:06cflemingBoxed it is - thanks everyone
23:06gfrederickshmm, I wouldn't have guessed the primitives determine what methods get selected
23:07gfredericksbut I haven't experimented with java methods that are identical except for boxed v. unboxed
23:07gfrederickswho on earth would write those anyhow
23:07cflemingNo, 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:08cflemingRight, I'm actually not even sure if that's legal in Java or not.
23:09gfrederickswell I'm gonna try that right now just so we can all be sure.
23:09cflemingLooks like it's legal, but it's definitely grounds for a horsewhipping.
23:09cfleming(just tried it)
23:10gfredericksglad I found out about the horsewhipping before I tried it myself
23:10cflemingThat doesn't apply if it's in the interests of science
23:11gfredericksoh phew; I'm relieved for your sake as well
23:11cflemingAnyway, 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:12gfredericksif they complain about it you can direct them to the horsewhipping
23:12gfredericks...so that's convenient
23:12cflemingI should do that for all my bug reports, actually
23:12gfredericks#lifehack
23:12cflemingThere you go
23:13gfredericksokay leaving for real this time
23:13cflemingByeeeee
23:13gfredericksbyeeeee
23:24cddrHow would you quote this command so it can be run by clojure.shell? psql pfsc_connector_development -c "\d"
23:33brehautcfleming: surely its too late on a friday to be thinking about stuff this complex?
23:34cflemingbrehaut: I've spent most of the week wrangling regular expressions. It's time for something that actually makes sense.
23:34brehautoh, well this is nice and light then.
23:34brehautas you were
23:35cflemingI'm not so sure about light, but it's definitely more interesting
23:40cflemingWow: http://curry-on.org/
23:40cflemingThat's what I call a speaker lineup.
23:41brehautztellman is speaking at the same time as cliff click. no pressure!
23:41ztellmanhaha, literally no pressure, there won't be anyone in the audience
23:41cflemingFortunately I already know a few things that macros do.
23:41cfleming:)
23:41brehautlol
23:42cflemingztellman: Congrats on the talk being accepted though, that looks like a great conference
23:42ztellmanI am hilariously underqualified
23:42ztellmanbut yeah, looking forward to it
23:43cflemingMeh - you've implemented an automata library, you're basically done.
23:43ztellmanyeah, that basically describes the work of Wadler, Stroustrup, etc
23:43cflemingWith a little embellishment around the edges, right
23:43brehautjust need to drop some pithy one liners and grow an epic beard?
23:44TimMcgfredericks: Check out .delete on List
23:45TimMcSorry, .remove actually. Takes int or Object. Terrible.
23:45brehautpeople need to have these epic conferencse closer to new zealand
23:46brehautwhere by closer i mean in
23:46cfleming(inc brehaut)
23:46lazybot⇒ 25
23:46TimMcsame thing
23:46cflemingAlthough I'm actually in Europe for curry-on, not sure I can justify 600 euros though
23:48cflemingbrehaut: Yow! Lambda Jam is as good as it gets over here, I guess
23:48brehautso ive heard
23:48brehautor teched
23:49brehautmaybe conference organisers dont know that we have good beer in NZ
23:51ztellmanI wouldn't say Prague has good beer
23:51ztellmancheap beer, sure
23:52brehautmaybe thats the problem
23:52brehautwe definately dont have cheap beer
23:53TimMc&(let [l (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 4)), x 1] [(.remove l x) l])
23:53lazybot⇒ [2 [1 4]]
23:53TimMc&(let [l (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 4)), x (identity 1)] [(.remove l x) l])
23:53lazybot⇒ [true [2 4]]
23:57justin_smithbrehaut: new zealand sounds awesome, except for the serial teeth extracting scofflaws and such
23:58cflemingjustin_smith: And the total absence of tech conferences
23:58brehautjustin_smith: wait what O_o
23:58justin_smithhttp://www.smh.com.au/world/man-surprised-women-by-pulling-out-their-teeth-with-pliers-court-is-told-20150430-1mwxy9.html
23:58brehauti not sure i want to google this
23:59justin_smithbasically dude got his kicks by involuntarilly pulling womens teeth out during sex...
23:59cflemingHoly crap
23:59brehautO_O_O_O
23:59cfleming"When she told Hansen he shouldn't have done that, he tried to reassure her."
23:59TimMcI'm guessing that didn't last long.