#clojure logs

2014-08-08

00:05TEttingerakhudek, how many imports?
00:06akhudekit’s not exactly clear, but not a whole lot
00:06akhudekadding in javax.imageio ImageIO was enough to cause it to hang
00:06akhudekthough I could import java.sql SQLException without issue
00:07akhudekplus another library org.imgscalr
00:07akhudekit’s not entirely clear what is going on, but adding in about 5 imports always causes it to hang
00:07TEttingerhmm
00:07TEttingercan you reproduce with no defs, just imports?
00:07akhudekyep
00:07TEttingermaybe one of the imports is bad?
00:08TEttingera version of a lib with some code executed as a def that never terminates?
00:08akhudekdoubt it, everything works fine when I run normally
00:08akhudekand if I kill the uberjar compile process when it hangs
00:08akhudekthe it does finish
00:08akhudekand the resulting jar works fine
00:08TEttingerwoah!
00:08akhudekchecked for rogue defs everywhere
00:08TEttingerthat sounds like a call technomancy alarm
00:08akhudekit’s definitlely not that
00:08akhudekand I’m seeing this across several projects too
00:09akhudekconfusing
00:09TEttingerwhat version of lein?
00:09akhudekboth 2.4.0 and 2.4.3
00:09akhudekit may still be something specific to our projects
00:09akhudekbut I am having a hard time finding it
00:10akhudekit’s clear taht adding in the imports breaks the camels back though
00:10TEttingersomething not aot-ing correctly?
00:10akhudekit only aot’s core
00:10akhudekerr main rather
00:10akhudekI’ve also tried both linux and mac
00:10TEttingertry with :aot :all and see what's different?
00:11akhudekhangs with that too
00:11akhudeksame way
00:11akhudekin fact, if I break the uberjar
00:11akhudekthen run it again without doing a clean
00:11akhudekit completes
00:11akhudekand the resultiing jar is fine
00:11TEttingerit's like it can't get a lock on something it needs to complete the uberjar
00:11akhudekyeah
00:11xeqiakhudek: does `lein compile` finish?
00:12TEttingergood idea, Xe
00:12TEttingerxeqi
00:12allenj12_hey if anyone is familar with overtone... (or i guess you dont have to be). can i get a code review for my quantize function? https://www.refheap.com/89034
00:14akhudekxeqi: doesn’t look like it
00:14akhudeksamping with visualvm shows that it’s blocked on a join
00:14akhudekcom.hypirion.io.Pipe.join
00:19raj91Any experience with Clojure on Java 8? Anything to look out for?
00:20TEttingerraj91, I have noticed no difference, but I haven't done any complicated interop
00:20TEttingerhttp://leiningen.org/reference.html akhudek, ctrl-f for (.join pump-out)
00:21raj91I'm reading about Java 8's DateTime, which is inspired by Joda.
00:22TEttingerright after that call to .join , akhudek, it calls .waitFor, which could be hanging?
00:22akhudekyeah, leiningen.core.eval$sh.doInvoke is right above the join call
00:22akhudekdefinitely from that function
00:22TEttingeroh, and join also waits
00:22TEttingerhttps://hypirion.github.io/com.hypirion.io/0.3.0/com/hypirion/io/Pipe.html#join()
00:23raj91TEttinger: thanks
00:23raj91I'm trying to read up and see if there are significant JVM changes -- or mostly Java the language changes
00:24TEttingerraj91, yeah, I kinda gave up on the "lambdas" in Java 8 because they're so much less powerful than scala or clojure functions
00:24TEttingernot true closures, just lambdas
00:25raj91TEttinger: well, yeah, I don't particularly care about the Java language part. But I hope the JVM is streadily improving -- or at least not being worse or more bloated. I'm also curious if other tools, like Lucene, Jetty, etc do better with Java 8
00:25raj91Java 7 had some significant library changes which I find useful over Java 6
00:25TEttingerright. I imagine the JVM is getting better as a language target too
00:26TEttingerda vinci machine project I think was added in 7
00:26raj91I am curious about what is happening with off-heap memory
00:26gwsallenj12_: maybe factor out (scale-field root field) into the outer let form?
00:26raj91And curious about Java-C interfacing
00:27raj91TEttinger: I'm checking out http://openjdk.java.net/projects/mlvm/
00:31Jaoodraj91: seems the jvm would just keep getting better - http://cr.openjdk.java.net/~jrose/pres/201407-JVMEvolution.pdf
00:31raj91"with Java 8, there is no PermGen anymore. Some parts of it, like the interned Strings, have been moved to regular heap already in Java 7. In 8 the remaining structures will be moved to a native memory region called "Metaspace", which will grow automatically by default and will be garbage collected." http://www.infoq.com/news/2013/03/java-8-permgen-metaspace
00:32raj91Jaood: thanks
00:34xeqiallenj12_: is scale-field a finite list?
00:35akhudekwhoa, no more permgen?
00:35akhudekcool
00:37akhudekah, interesting. So lein is probably just waiting for the clojure compiler to finish
00:37akhudekmeanwhile, it is hanging on a core.async channel in the actual compiler
00:37brehauti look forward to a world of JVM internals typoing meatspace
00:38akhudekbuuut that is just the timeout-daemon
00:38clojurebotAlles klar
00:38akhudekso who knows
00:43raj91akhudek: permgen didn't bite me, but yeah, I suppose some people are glad to see it go
00:44raj91nice write up here too: http://www.infoq.com/news/2013/03/java-8-permgen-metaspace
00:44raj91whoops, wrong link. I meant http://ttux.net/post/java-8-new-features-release-performance-code/
00:46akhudekraj91: thanks for the link
00:51raj91Sean Corfield (author of clj-time and more) wrote this: http://seancorfield.github.io/blog/2014/06/20/some-thoughts-on-java-8/
00:53raj91Pretty funny. Speaking of Java, the language: "No, I’m not switching from Clojure, but now I view Java as “palatable” rather than “hideous”."
00:58hellofunkddellacosta you around for an Om question?
00:58hellofunkah, guess not
00:59akhudekhellofunk: can I help?
00:59hellofunkAnyone using Om, since lazy seqs are not permitted in app-state how do you usually convert them after using map, filter, etc. Was discussing here yesterday. Arrived at using (into []..) as a simple idiom
00:59akhudekhellofunk: mapv or filterv
01:00akhudekor just wrap the result in vec
01:00hellofunkcool, good suggestions. just curious what the typical Om idiom was for that.
01:01akhudekI don’t think there is one
01:01akhudekbut those would all be idiomatic ways to get a vector instead of a lazy list
01:01hellofunkit's an easy problem to forget about
01:11akhudekwow, I must be missing something huge here
01:11akhudekI’ve now commented out the entire application except for a single import of javax.imageio ImageIO
01:12akhudekand still uberjar hangs forever
01:12Jaoodis that she said?
01:14akhudekwow
01:14akhudekconfirmed
01:14akhudekeven with a clean new project
01:14akhudekWAT
01:14akhudek:-(
01:16TEttingerakhudek: ... lein clean ?
01:16TEttingerwait clean new project
01:16akhudekyeah, I did lean new
01:16akhudekerr lein new
01:16akhudekjust an emtpy -main
01:17akhudekand import of javax.imageio
01:17akhudekand it won’t uberjar
01:17TEttingerI am completely at loss here. could there be some... firewall thing?
01:17TEttingertry a different import
01:17akhudeksome imports work
01:17akhudeklike java.sql SQLException
01:17akhudekcould it have to do with X11 or something strange?
01:19akhudekok, so it’s something to do with my local machine
01:19akhudekbecause this example compiles on another machine
01:19TEttingerphew
01:20TEttingerrestart, I guess
01:20akhudekyeah :-(
01:22justin_smithraj91: nice, yeah, I was pleasantly surprised with java 8's new features too
01:23justin_smithI bet he was working with a headless jvm
01:23justin_smithjava wisely does not provide image manipulation classes if you don't import windowing support
01:23TEttingerentirely possible? ask in a bit I guess
01:23justin_smith"wisely"
01:23justin_smith(I ran into these issues when I used imageio)
01:25TEttingerI've used it with clojure before, on command-line apps, but never headless jvms
01:27caternjava
01:27caternstill sucks
01:27catern(re: java 8, no image manipulation classes in headless jvms)
01:45gtuckerkelloggCIDER 0.7 looks great.
01:47gtuckerkelloggThe docs (https://github.com/clojure-emacs/cider) recommend installing from MELPA using package.el, as per usual
01:49gtuckerkelloggbut three days after 0.7 release, MELPA is already installing the 0.8.0snapshot, which introduces a warning because it doesn't correspond with the cider-nrepl 0.7.0 release (no longer snapshot)
01:50Jaoodthere's melpa-stable
01:56schmirwhat's missing is a way to pin packages. I've read that emacs 24.4 supports this.
01:57gtuckerkelloggwhen i list packages, i don't see a cider version in melpa-stable
01:58gtuckerkelloggbut at any rate, the cider REAME specifically recommends MELPA over MELPA-stable
01:58gtuckerkellogg"Keep in mind that MELPA packages are built automatically from the master branch, meaning bugs might creep in there from time to time. Never-the-less, installing from MELPA is the recommended way of obtaining CIDER, as the master branch is normally quite stable and "stable" (tagged) builds are released somewhat infrequently."
01:58gtuckerkellogghttps://github.com/clojure-emacs/cider#via-packageel
01:58gtuckerkelloggschmir, I hope that's the case!
02:00schmirgtuckerkellogg: see http://blog.jorgenschaefer.de/2014/06/the-sorry-state-of-emacs-lisp-package.html
02:00gtuckerkelloggexactly :(
02:04schmirgtuckerkellogg: I think I'm going to just use melpa and [cider/cider-nrepl "0.8.0-SNAPSHOT"]. I didn't run into any serious issues with 0.7.0-SNAPSHOT in the last few weeks
02:05gtuckerkelloggi'll do likewise and credit you for all success that follows
02:06schmir:)
02:14Jaoodschmir: that would fail
02:15schmirI see. looks like 0.8.0-SNAPSHOT isn't available
02:26sm0kehey guys, anyone using cascalog on yarn? need a little help
02:31amalloy~anyone
02:31clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
02:32sm0ke:P
02:38sm0keits just that the job runs but fails to find the job.jar
02:38sm0kei think something to do with permissions
02:39sm0kein the .staging folder inside /tmp
02:40sm0kei mean job submits*
02:45allenj12_anyone here familiar with overtone?
02:56sm0ke~anyone
02:56clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
03:10maxnomoonI know it's quite trivial, but I need a little code review for a newbie: https://www.refheap.com/89033
03:12TEttingermaxnomoon, oh boy. this gets interesting quickly
03:12amalloymaxnomoon: generate-man and generate-woman are really similar functions. there should just be one generate-person function which takes a couple parameters to customize it
03:13TEttingerWe recently programmed Bucket, the IRC chat bot in #xkcd, to allow people set their gender so he can use pronouns for them. This ended up taking hundreds of lines of code, three pages of documentation, and six different sets of pronouns and variables, just to cover all the basic ways people in the channel with different gender identifications wanted to be referred to...
03:13AeroNotixTEttinger: what a terrible idea
03:14TEttingerhttp://blog.xkcd.com/2010/05/06/sex-and-gender/
03:14AeroNotixmaxnomoon: make a function which takes the gender keyword then call that function generate-human
03:14amalloyAeroNotix: *shrug* not a very good feature, but useful anyway. if nothing else, it helps the programmers get acquainted with unfamiliar gender identities
03:15AeroNotixamalloy: it's just opening you up for internet warriors exclaiming that you triggered them because you didn't include "non-cis catkin panfapsual patriarch muh cissy trans"
03:16AeroNotixor some shit
03:16amalloywell yeah, that's what i said. gets the programmers introduced to whole new exciting gender identities
03:16amalloyby way of people shouting at you about them
03:16AeroNotixsigh
03:16AeroNotix"gender identities"
03:17H4nsAeroNotix: you don't have any issues with that kind of stuff, do you? lucky white boy.
03:17maxnomoonAeroNotix: gladly that's just a game structure generation. Hope tribe members won't kill me :)
03:17AeroNotixH4ns: nothing like that -- there's a time and a place for it. An XKCD bot on IRC is definitely not that place
03:18AeroNotixH4ns: I'm not a white boy, I'm a caucasian male-centric being
03:18AeroNotix:)
03:24SagiCZ1TIL my gender is boring
03:26TEttingerSagiCZ1, you could be a hijra, the most interesting gender so far https://en.wikipedia.org/wiki/Hijra_(South_Asia)
03:26TEttingerin india and bangladesh they are recognizd as a third gender by law
03:28SagiCZ1is there any tldr? isnt it just regular trans-gender?
03:30AeroNotixI wonder if there are more countries which codified it into law
03:30AeroNotixagain; that opens them up to problems when someone comes along who doesn't identify with that. It's better to just say "fuck it! Y'all have the same rights no matter what."
03:33SagiCZ1AeroNotix: well the thing about gender equality is that some people confuse "equal rights" with "equal opportunities"
03:33SagiCZ1i mean.. women sure have a right to be the next CEO in our company but do they have the opportunity?
03:34SagiCZ1and the more important question, should we make SURE they have the opportunity? or is giving them the right enough?
03:34AeroNotixSurely equal rights has to come before opportunity?
03:35AeroNotixI'm not decided on affirmative action. I don't know enough about its effects. Has it worked in the past?
03:35SagiCZ1mixed results I would think
03:35SagiCZ1gender studies are interesting research field
03:39TEttingerSagiCZ1, the whole hijra thing is very complicated because they've been around a long time and have an accepted cultural role traditionally that is being pushed out by different beliefs from other parts of the world
03:41TEttingerlike one thing I read for an anthropology class talked about how it's considered important to get the blessing of a hijra before a wedding, to ensure a happy/healthy marriage basically
03:41TEttingerand that's been that way for centuries
03:43AeroNotixwoah
03:43TEttingerit isn't one of the new cis-normative otherkin things
03:55SagiCZ1TEttinger: interesting
03:55TEttingerlearn something new in #clojure every day!
03:56SagiCZ1i know right ^^
03:56TEttingeryesterday transducers, today transgenders
04:08SagiCZ1TEttinger: Yeah i somehow missed the beginning of the tranducers topic and now I have no idea.
04:08TEttingerheh
04:10SagiCZ1but i will make sure, once my grandma asks what i do at work, to mention transducers..
04:11meingbg'print-str works in REPL, but not over cider. What's going on?
04:12hyPiRionoh what
04:12hyPiRionSomehow I thought it was Wednesday today.
04:14SagiCZ1hyPiRion: was it a pleasant surprise then? people usually digg fridays
04:15meingbgI don't get this. Anything involving (with-out-str) fails to evaluate over emacs/cider
04:15hyPiRionSagiCZ1: I'm just confused, but yeah, pleasantly surprised
04:16hyPiRionBut it also means I'm 2 days behind my schedule at work :p
04:23pyrtsaHmm, clojure.core/sequence seems a bit too greedy with transducers:
04:23pyrtsa,(defn trace [xs] (next (reductions (fn [_ x] (print (str "<<" x ">>")) (flush) x) nil xs)))
04:23clojurebot#'sandbox/trace
04:23pyrtsa,(take 2 (trace (range 10)))
04:23clojurebot<<0>>(<<1>>0 1)
04:23pyrtsa(sequence (take 2) (trace (range 10)))
04:23pyrtsa,(sequence (take 2) (trace (range 10)))
04:23clojurebot<<0>>(<<1>><<2>>0 <<3>>1)
04:23pyrtsa(Pulls out two extra elements from the input sequence.)
04:24pyrtsatransduce is fine:
04:24pyrtsa,(transduce (take 2) str (trace (range 10)))
04:24clojurebot<<0>><<1>>"01"
04:41SagiCZ1(doc transduce)
04:41clojurebot"([xform f coll] [xform f init coll]); reduce with a transformation of f (xf). If init is not supplied, (f) will be called to produce it. Returns the result of applying (the transformed) xf to init and the first item in coll, then applying xf to that result and the 2nd item, etc. If coll contains no items, returns init and f is not called. Note that certain transforms may inject or skip items."
04:44SagiCZ1who writes these docs.. i need ELI5
04:45pyrtsaRich does.
04:46SagiCZ1pyrtsa: he always sounds so reasonable when he talks..
04:47pyrtsaSagiCZ1: Basically, transducers represent composable transformations (that may involve e.g. mapping, generating, filtering elements), and you can use e.g. into/sequence/transduce to evaluate those for a sequence.
04:47BronsaSagiCZ1: docstring vs 40min talk
04:48pyrtsaThe transduce function call (transduce xform f init xs) can be read as (reduce f init (perform-transform xform xs)).
04:49pyrtsaIndeed, (transduce xform f init xs) == (reduce f init (sequence xform xs))
04:49pyrtsa(Except for the little greediness bug that I think I just found above.)
04:50Bronsapyrtsa: not exactly the same, sequence produces a lazy sequence, transduce never does
04:51pyrtsaBronsa: Please read again.
04:51pyrtsaI've got a reduce there on the rhs which forces away the laziness.
04:52Bronsapyrtsa: yes, I was just pointing out that the impl of transduce doesn't create an intermediate lazy sequence
04:53pyrtsaFair enough. So your point was probably closely related to my talking of greediness in the implementation details. :)
04:53clgvBronsa: "can be read as" covers that I think ;)
04:53hyPiRionpyrtsa: That's assuming xs is a collection of some sort though. xs can be a channel or something completely different
04:53pyrtsahyPiRion: transduce isn't defined for some other xs.
04:54pyrtsaAs soon as we start to talk about into/transduce/sequence, we're talking about plain old sequences. It's true that xforms can be used elsewhere too. ;)
04:55pyrtsaAnd that, of course, was the whole point in creating this new concept of transducers. :)
04:55Bronsapyrtsa: not true, transduce only requries coll to be reducible
04:55hyPiRionpyrtsa: oh, I thought it was more general and worked on foldables. Well, that's funny.
04:56pyrtsaBronsa: Ah, of course.
04:56pyrtsaA slight difference.
04:57Bronsapyrtsa: also I just joined, what is this greediness bug you were talking about?
04:57pyrtsaBronsa: (sequence (take n) xs) pulls out (+ n 2) elements from xs, not n.
04:58Bronsauh, weird
04:58pyrtsa,(defn trace [xs] (next (reductions (fn [_ x] (print (str "<<" x ">>")) (flush) x) nil xs)))
04:58clojurebot#'sandbox/trace
04:58pyrtsa,(take 2 (trace (range 10)))
04:58clojurebot<<0>>(<<1>>0 1)
04:58pyrtsa,(sequence (take 2) (trace (range 10)))
04:58clojurebot<<0>>(<<1>><<2>>0 <<3>>1)
04:58BronsaI see
04:58clgv,(sequence (take 10) (range))
04:58clojurebot(0 1 2 3 4 ...)
04:58clgv,(sequence (take 2) (range))
04:58clojurebot(0 1)
04:59clgv,(doc trace)
04:59clojurebot"([xs]); "
04:59hyPiRionclgv: it was defined by pyrtsa
04:59pyrtsaOf course it can be argued that there should be no side effects in sequences.
04:59clgvah lol
04:59pyrtsaBut it sounds like a minor bug regardless.
05:05sveriHi, I have a vector of vector of maps like this: [ [{:test "test"}] [{:test2 "test2"}]] and want to get it into one vector of maps like this: [{:test "test"} {:test2 "test2"}], how would I do that?
05:06pyrtsa(apply concat xs)
05:07hyPiRionpyrtsa: actually, it can be pretty devastating
05:07sverioh, that easy, thank you :-)
05:07hyPiRion,(defn a [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a (- m 1) 1) :else (a (- m 1) (a m (- n 1)))))
05:07clojurebot#'sandbox/a
05:07hyPiRion,(take 4 (map #(a % 1) (iterate inc 0)))
05:07clojurebot(2 3 5 13)
05:08hyPiRion,(sequence (take 4) (map #(a % 1) (iterate inc 0)))
05:08clojurebot#<StackOverflowError java.lang.StackOverflowError>
05:08pyrtsaHaha.
05:08pyrtsaYeah, I count that as those side effects.
05:08hyPiRionnot everyone computes ackermann, but eh :p
05:08pyrtsaAckermann approximates _|_ pretty well.
05:08hyPiRionheh
05:09clgvhyPiRion: you seem to be someone that didnt sleep in his TCS lectures ;)
05:10TEttinger,(take 10 (sequence (map #(a % 1) (iterate inc 0))))
05:10pyrtsasveri: I have asked that question several times and never seemed to remember it at first. Another, slightly slower and not at all shorter, choice is (mapcat identity xs).
05:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:10Bronsa,(def a (clojure.lang.RT/iter (map #(doto % print) (range 10))))
05:10clojurebot0123456789#'sandbox/a
05:10TEttinger,(defn a2 [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a (- m 1) 1) :else (a (- m 1) (a m (- n 1)))))
05:10clojurebot#'sandbox/a2
05:10TEttinger,(take 10 (sequence (map #(a2 % 1) (iterate inc 0))))
05:10clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.SeqIterator cannot be cast to clojure.lang.IFn>
05:10pyrtsaClojure really ought to have (def cat (partial apply concat)) in core.
05:10BronsaRT/iter forces the first chunk at creation time
05:11TEttinger,(sequence (map #(a2 % 1) (take 10 (iterate inc 0))))
05:11clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.SeqIterator cannot be cast to clojure.lang.IFn>
05:11Bronsa(.iterator (range))
05:12Bronsa,(.iterator (range))
05:12clojurebot#<SeqIterator clojure.lang.SeqIterator@bbe647>
05:12TEttinger,(sequence identity (map #(a2 % 1) (take 10 (iterate inc 0))))
05:12clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.SeqIterator cannot be cast to clojure.lang.IFn>
05:12Bronsa,(.iterator (map #(doto % println) (range)))
05:12clojurebot0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n#<SeqIterator clojure.lang.SeqIterator@1775dde>
05:13TEttingerhow does sequence work...
05:13pyrtsaBronsa: See my definition of trace. It intentionally avoided chunking by using reductions.
05:13TEttinger(doc sequence)
05:13clojurebot"([coll] [xform coll] [xform coll & colls]); Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the colls is exhausted. Any
05:13Bronsapyrtsa: sure, nothing changes though
05:13Bronsaiterator on a lazyseq is forcing the first element
05:13Bronsabe it just an element or a whole chunk, who cares
05:14TEttinger,(defn a2 [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a2 (- m 1) 1) :else (a2 (- m 1) (a2 m (- n 1)))))
05:14clojurebot#'sandbox/a2
05:14TEttinger,(sequence identity (map #(a2 % 1) (take 10 (iterate inc 0))))
05:14clojurebot#<StackOverflowError java.lang.StackOverflowError>
05:14TEttingerhow does that...
05:14hyPiRionclgv: theoretical useless CS is the best kind of CS :p
05:14clgvhyPiRion: :P
05:14TEttingerhyPiRion, I linked to swearjure to someone new here
05:15TEttingerit helped me understand his problem better
05:15TEttingerand then he solved it by me understanding swearjure
05:15clgvTEttinger: I didnt know about your bad character traits until just now ;) :P
05:15TEttingerheh
05:15TEttingerbut really it did help
05:16TEttingerhe needed to implement nth for 4clojure
05:16TEttingerand I saw swearjure had it
05:16hyPiRionTEttinger: Swearjure to the rescue? Woah
05:16cespareHow would I attach a byte[] type hint explicitly using vary-meta? (Say i didn't want to use ^bytes)
05:16TEttingerso I linked it to show it can be written in many ways
05:16cesparesomething about [B ?
05:16lpvb,(contains? (vals {:a 1 :b 2}) 2)
05:16clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.APersistentMap$ValSeq>
05:16TEttingercespare: ^"[B"
05:16cespareTEttinger: thanks
05:16lpvbI don't know a short way to do this
05:17pyrtsalpvb: Watch out with contains?. It works on the indices (or map keys).
05:17TEttingerbut then I read how nth works in swearjure, and I got it. he just needed to make it a vector, and use the number as an argument
05:18TEttingerso I showed him how it works outside of a general case ##([1 2 3] 2)
05:18lazybot⇒ 3
05:18pyrtsa,(not (empty? (filter #(= % 2) (vals {:a 1 :b 2}))))
05:18clojurebottrue
05:18TEttingerand told him if he can make that a fn, he's done
05:18pyrtsa,(not (empty? (filter #(= % 3) (vals {:a 1 :b 2}))))
05:18clojurebotfalse
05:18pyrtsa(I'm not sure if there's a short way to do the above.)
05:19Glenjamin(some? #{2} (vals {:a 1 :b 2}))
05:19Glenjamin,(some? #{2} (vals {:a 1 :b 2}))
05:19clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/some?>
05:19Glenjamin,(some? (map #{2} (vals {:a 1 :b 2})))
05:19clojurebottrue
05:19Glenjamin,(some? (map #{3} (vals {:a 1 :b 2})))
05:19clojurebottrue
05:19Glenjaminhrm
05:19Bronsapyrtsa: gah, I tried looking at LazyTransforer.java but I have no idea what's going on, could you open a ticket for that?
05:20Glenjamin,(some #{2} (vals {:a 1 :b 2}))
05:20clojurebot2
05:20Glenjamin,(some #{3} (vals {:a 1 :b 2}))
05:20clojurebotnil
05:20Glenjaminthere we go
05:20Glenjaminsome? is very different from some
05:20pyrtsaBronsa: Not today. I wasn't too pleased to read LazyTransformer.java myself either. Not the prettiest code.
05:20pyrtsa,(some #{false} (vals {:a 1 :b false}))
05:20clojurebotnil
05:21pyrtsaGlenjamin: Watch out with that. :) ^
05:21Bronsapyrtsa: do you want me to open the ticket instead? :)
05:21pyrtsaYes please. You can copy my code snippets from above if you like. (I also suggest using hyPiRion's nice a2 there.) :D
05:22hyPiRion(defn a [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a (- m 1) 1) :else (a (- m 1) (a m (- n 1))))) if it was lost
05:22TEttingerhyPiRion's is a
05:22TEttingerI mangled it
05:22pyrtsaRight.
05:23pyrtsaNow off to lunch & work. ->
05:27Bronsapyrtsa: http://dev.clojure.org/jira/browse/CLJ-1497 if you want to watch/vote
05:27puredangerI'll ping Rich with that later
05:27Bronsapuredanger: thanks
05:33pyrtsaBronsa: Thanks!
06:09nxtvsnhello, I need some help
06:09nxtvsnI write an app that handles POST requests using ring
06:09nxtvsnI can't understand why, but body is always empty
06:10nxtvsnall other things in the request are ok
06:10nxtvsnall except the body
06:10nxtvsnbody is a stream, as it should be, but if I sulrp it I get an empty string
06:11nxtvsnI think it is possible if I have some middleware layers that process the body
06:11nxtvsnand empty it
06:12nxtvsnbut I have no middleware layers at all (as far as I can understand)
06:14nxtvsnok... Now I understand (I think)
06:14nxtvsnIf I use the compojure handler I get some wrappers automatically
06:14nxtvsnand they remove my body
06:18nxtvsnthank you very much! now it works
06:19nxtvsnIt was really the case
06:21TEttingerI think I have someone on ignore by mistake
06:22TEttingernxtvsn, were you talking to someone just now?
06:22Glenjaminmy ignore list is empty, so i suspect that was just thinking out loud
06:23nxtvsnYes it was just thinking out loud, that it is correct :)
06:47SagiCZ1nxtvsn: lol and you even thanked yourself for it.. cudos
07:14michaelrwhy 'lein javac' silently ignores the java files which I want it to compile?
07:15michaelrI have :java-source-paths ["src/main/java"] in project.clj
07:16llasram`michaelr: refheap/gist your project.clj file?
07:17michaelrllasram: https://www.refheap.com/89045
07:19llasramThat should do it... You sure you don't already have class files under "target" which are newer than the Java source files in "src/main/java" ?
07:21michaelrlet me check
07:22michaelrnope, don't have a target at all :)
07:22michaelrI've lein clean'ed
07:22llasramNot the cause of this problem, but -- you may want to change :source-paths to cover just where you have Clojure source. At least in the past could cause some wackiness
07:23llasramHmm. If there are actually Java source files in the directory "src/java/main", then I have no idea what would cause `lein javac` to silently do nothing
07:24llasramer, src/main/java
07:25michaelrllasram: no java source files there, but they are in a deeper directory under that directory
07:26llasrammichaelr: Sure, that's what I actually had meant to say. Hierarchy for the Java package and such
07:26michaelryep
07:29michaelrllasram: i tries to build the clojure sources first.. and it makes sense if the java sources use clojure compiled classes but not in this case. here i actually have clojure code which uses the java classes
07:29michaelrit
07:30llasramOh, I thought you said it just silently did nothing
07:30michaelryeah, maybe what I said was a bit misleading
07:30michaelri said it silently wouldn't compile the java sources ;)
07:31llasramI don't see anything in your project.clj which would cause AOT compilation of Clojure though
07:33llasramCould you refheap a shell session starting with `lein clean` which shows what you're seeing?
07:34michaelrok
07:39michaelrllasram: you were right, sort of
07:39llasramOh?
07:39michaelrllasram: the problem is was with the source-paths in the dev profile. i would attempt to load the user.clj file which contains some code
07:40michaelrthis code was trying to load the java code which has not yet been compiled :)
07:40llasramInteresting
07:43llasramWell, at least now solved :-)
07:43michaelryeah, thanks for helping
07:43llasramnp!
08:16clgvdoes clojure.java.jdbc/update! use prepared queries automatically?
08:56matthavenerckrailo: should be
08:56matthaveneroops
10:03Bronsadnolen_: have you thought about doing this for cljs.analyzer? https://github.com/clojure/tools.analyzer.js/blob/master/src/main/clojure/clojure/tools/analyzer/js.clj#L524-L548
10:04dnolen_Bronsa: haven't looks useful though :)
10:09Bronsadnolen_: yeah, that cuts startup time by a huge amount for tools
10:11dnolen_Bronsa: hmm I was thinking about doing something more granular but now that I think about probably not necessary since we use the contents on disk to determine whether we need to re-analyze
10:11dnolen_Bronsa: would take a CLJS patch for this for sure
10:12dnolen_Bronsa: oh though I did run into some issues when I hacked a more granular version of this - OOM exceptions which I haven't had time to track
10:12Bronsadnolen_: ok, I'll open a ticket + patch later today
10:13dnolen_likely a cycle some where or something but I haven't been able to find it yet.
10:13Bronsadnolen_: note that I'm not caching the entire AST
10:13Bronsaonly the namespace map
10:13dnolen_Bronsa: yes the OOM occurred when dumping :namespaces
10:13dnolen_in CLJS, probably because of sloppiness somewhere
10:14dnolen_Bronsa: anyways great id, ticket + patch welcome and I can help debug it if the OOM crops up
10:14dnolen_s/id/idea
10:23michaelrhi
10:24michaelrin ClojureScript is there some special treatment I should give to namespaces?
10:25michaelrI get WARNING: No such namespace: barcodebrasil.custom-products.utils at line 1 src\cljs\custom_products\main.cljs
10:25michaelrwhile utils.cljs sits just beside main.cljs and has the ns as mentioned in the warning above
10:30nkozamichaelr: try using custom-producs.utils , without "barcodebrasil"
10:31nkozamichaelr: note you can also ask in #clojurescript
10:34justin_smithmichaelr: require won't work with namespaces that aren't in a path that reflects their ns declaration structure
10:35justin_smithsrc/barcodebrasil/custom_products/utils.cljs should work
10:35justin_smith(another possibility is if you have an error in that ns, it won't be found)
10:36michaelrthank guys I think you're on it :)
10:50michaelrIn Chrome's dev tool network tab I see the advanced compiled .js file is being requested twice from the server. Is this the usual behavior?
10:55teslanickIs one the sourcemap? Do you have the script tag in your document twice?
10:56michaelrteslanick: thanks. it was actually some problem with chrome. I've close the tab and openned the page from a new one and the problem was gone.
10:57nbeloglazovCan anyone explain difference between transducers and partially applied functions like (partial filter even?) ?
10:59lvhnbeloglazov: a transducer is a function that takes a reducing function and produces a new reducing function
11:00lvhnbeloglazov: (partial filter even?) is just a curried filter
11:00nbeloglazovlvh: and what is (filter even?) then? How are they different?
11:01lvhnbeloglazov: its (informal) signature is [a] -> [a]; the transducer's is (a -> b -> a) -> (a -> c -> a)
11:01lvhnbeloglazov: (partial filter even?) takes a collection and gives you a different collection
11:01lvhnbeloglazov: (filter even?) takes a function you can pass to reduce and gives you a different function you can pass to reduce
11:02lvhnbeloglazov: specifically, one that will only pass along even numbers
11:04lvhnbeloglazov: importantly, the reducer functions don't care about representation, or even collections
11:08lvhnbeloglazov: so, in that sense, they are easier to compose than reducer functions (they compose through regular function composition), they're easier to optimize, and they separate the "what" (which elements?) from the "how" (e.g. a list)
11:09nbeloglazovlvh: :( still don't get it. Need to think more
11:10rlbIs there a standard way to handle the encoding ( https://tools.ietf.org/html/rfc2231 ) of parameters like filename="foo" for something like (ring/header "Content-Disposition" ...)?
11:12dnolen_nbeloglazov: in anycase one important thing is - (filter even?) is not a partially applied function
11:13dnolen_nbeloglazov: if you understand types you may find this useful http://conscientiousprogrammer.com/blog/2014/08/07/understanding-cloure-transducers-through-types/
11:14rlbsounds like it's just a mess -- http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http
11:15lvhdnolen_: aaa! quassel just reloaded your message; I was about to tell him about that blog post :)
11:15lvhnbeloglazov: an important thing to grasp is that while filter is currently in charge of making a new collection, that is only incidental to what it *means*
11:16lvhnbeloglazov: filter is about "if this thing matches this predicate, keep it; otherwise, throw it away"
11:16tbaldrid_lvh: right, filter "complects" filtering with lazy-seq/cons
11:16lvhnbeloglazov: (filter even?), the transducer form, separates this meaning from the "make a list" part
11:17lvhI am pushing hard to get to use some clojure at $WORK; my main argument is that while cool features are talked about forever in $PROD_LANG, in clojure they just kinda happen
11:17lvh(partial typing, stm, logic programming integration...)
11:18lvhif anyoen has any sources on "tricking your coworkers into using clojure long enough until it's too late", it'd be much appreciated ;-)
11:18lvhI find myself running into a lot of small, subtle cases where the clojure is so much easier than the equivalent $OTHER_LANG, but it's hard to confer that happiness to someone who hasn't used it
11:18llasramIs there an existing idiom for iterating over only the realized portion of a lazy sequence?
11:23Bronsa(def a (iterate inc 0))
11:23Bronsa,(def a (iterate inc 0))
11:23clojurebot#'sandbox/a
11:23Bronsa,(take 2 a)
11:23clojurebot(0 1)
11:23Bronsa,(realized? (rest a))
11:23clojurebottrue
11:23Bronsa,(realized? (rest (rest a)))
11:23clojurebotfalse
11:23Bronsallasram: ^ might be useful
11:25llasramBronsa: Yep. I've got https://www.refheap.com/89055
11:25llasramJust wondering if there was an existing better way
11:25Bronsadon't think so
11:25clgvlvh: and to someone who only sees weird brackets and claims there are too many of them ;)
11:26clgv*parantheses
11:26lvhclgv: well, similarly paredit is hard to explain to someone who hasn't used it :)
11:26lvhclgv: "you know how we've been talking about editors that would actually semantically edit code instead of munging bytes?" "yes" "well, that exists"
11:27clgv:D
11:29puredangerBronsa: on that patch for 1497, I still see 3 elements get realized even after your change?
11:29Bronsapuredanger: yes, that fixes a different issue, one sec
11:29puredangerI mean I think you're in the right area for sure
11:30Bronsapuredanger: http://sprunge.us/WPBK
11:31puredangeryeah that's what I see too
11:32puredangerobviously would like not to see ~3
11:32Bronsayeah, I'm looking at LazyTransformer right now to see if I can figure it out
11:33puredangerit may be that the more() in SeqIterator needs to be deferred till hasNext() ?
11:39nbeloglazovlvh: thanks for the article, will read it. And yeah, I didn't understand the fact that filter function gets kinda another meaning in transducers. Thanks for explaining.
11:39Bronsapuredanger: this is interesting http://sprunge.us/iGZP?clj
11:40puredanger:)
11:54michaelrhi
11:56puredangerhello!
11:57michaelrtechnomancy: I have some code in a "user" ns which is loaded automatically when I start the repl. Also I have a .java file which I compile with `lein javac`. The class from that java file is required by one of the namespaces which are required from the "user" namespace. This results in that when I run `lein javac` it fails because lein can't find the java class it was going to compile.
11:58michaelrThe class is imported, not required.
11:59michaelrThe workaround was to exclude my user.clj from the source path until after I run `lein javac` and compile the java class.
11:59Bronsaah I think I get it puredanger
12:02Bronsapuredanger: take as a tranducer exits when the transducer fn returns a reduced, but that only happens when the "counter" is 0, that happens on the n+1th element
12:02michaelrtechnomancy: should I open an issue or I just should change my workflow somehow?
12:03technomancymichaelr: unfortunately user.clj is a clojure feature and not a leiningen one; I don't think there's anything I can do about it
12:06Bronsapuredanger: I don't see any way to solve this
12:09puredangerRich just pushed a fix :)
12:09tbaldridgehttps://github.com/clojure/clojure/commit/43cc1854508d655e58e377f84836ba128971f90c
12:10Bronsaheh, fine
12:14Bronsapuredanger: it still exhibits the previous behaviour on the edge case (take 0)
12:15Bronsathis time it happens on transduce aswell
12:19puredanger"(take 0) not possibly lazy with transducers - push model" - Rich
12:20TimMcAlways the problems with the base cases.
12:21Bronsaok, thanks puredanger (& Rich)
12:25technomancyso I totally used read-string on user data yesterday
12:25technomancyit was awesome
12:27technomancyhuh, I don't get it. why is no one yelling at me?
12:28djpowellrlb: were you asking about encoding of filenames in headers?
12:29lvhtechnomancy: sorry
12:29lvhtechnomancy: HOW DARE YOU
12:29lvhtechnomancy: don't you know about EDN
12:29TimMcguards, etc.
12:29technomancythat's more like it
12:29lvhbetter? :)
12:29technomancyI assume everyone was busy getting coffee
12:30technomancyhttps://github.com/Seajure/odo/blob/master/src/odo/handler.clj
12:30lvhseajure? :D
12:30technomancyyup yup
12:30technomancyseattle clojure group
12:30djpowellrlb: check out RFC6266 for a modern guide to it
12:30lvhooh
12:30technomancylvh: it's a universal server
12:31lvhman I wish I lived in the US already (working on it)
12:31lvhantwerp has no clojure groups :(
12:31lvhoh, wait, yes it does!!!
12:32rlbdjpowell: ok, thanks
12:55dnolen_Bronsa: puredanger: corresponding fix applied to CLJS
13:00andyftechnomancy: 3 weeks have been added to your time in Clojure purgatory. I'll see you there
13:06mirariNewbie here. Is clojure pure s-expressions or is there more to the syntax?
13:08nkozamirari: http://clojure.org/reader
13:09technomancymirari: CL people claim it's not because it has vectors and maps and stuff (vs only lists) but IMO that's not a worthwhile distinction
13:09mirariI see
13:17technomancyprobably the only exception is reader literals with their weird spacing between the tag and the actual data
13:19hyPiRiontechnomancy: and metadata perhaps?
13:19technomancyhyPiRion: a case could be made
13:20puredangertechnomancy: that space is optional
13:21technomancypuredanger: sure, but it's an unfortunate wart in an otherwise very regular syntax
13:21puredangerand #_
13:21puredangeretc
13:23tjdis it possible to (require) a library at runtime? my use case is that i would like to have a small main driver function for a module, yet this main function isn't the primary execution entry point, its just a driver for the module functionality. i'd like to do an import inside that main function, instead of at the module, so as to not unnecessarily add to the import graph in the 99% use case
13:24technomancytjd: totally
13:24technomancyyou just have to use resolve to get at its contents
13:26tjdaah... (require 'my.module) (resolve 'my.module/the-fn)
13:26technomancyyup yup
13:26tjdthanks technomancy!
13:26tjdworks
13:28technomancynp
13:42michaelrtechnomancy: then maybe I can move that code from user.clj to some other namespace and specify it with :init-ns in project.clj..
13:48vermahey technomancy, I posted this earlier as well, not sure if you replied, but "lein change :dependencies identity" doesn't restore quotes around dep versions.
13:49vermatechnomancy, I know it wouldn't restore formatting, but strings should come back out as strings right?
13:53technomancyverma: that is kinda weird. probably worth opening an issue over.
13:54vermatechnomancy, ok
13:59vermatechnomancy, opened: https://github.com/technomancy/leiningen/issues/1632
14:00lynaghkI'm trying to deploy a Ring application to Elastic Beanstalk, but I have a handler per subdomain. The previous setup uses Nginx to proxy_pass to the appropriate handler port
14:00lynaghkDoes anyone know if it's possible to do the same on Elastic Beanstalk? Either foo.example.com goes to port 8080, bar.example.com goes to port 8081, &c.
14:01lynaghkOr if I should combine all of my handlers into a single handler that redirects based on the ring request object (assuming the req will contain info about the requested host)
14:04justin_smithI am trying to remember the name of the function that tells you if a object o is of a class that extends class b - it may be I need to call (class a) - but I still don't remember the function name
14:10justin_smith,(instance? CharSequence "hello")
14:10clojurebottrue
14:10justin_smithgood enough for me
14:10pandeiroclojure.java.jdbc newb question: why does inserting a date create an instant from the previous date @ 3:00:00 ?
14:10justin_smithpandeiro: your TZ config is off
14:10pandeirothis is a timezone issue or something i'm imagining but i can't figure out how to resolve it
14:11pandeirojustin_smith: so I checked (.getTimeZone (Calendar/getInstance))
14:11pandeiroit has my local time zone
14:11justin_smithpandeiro: actually, could be a clock skew between the machine running clojure and the machine hosting the db
14:11pandeirojustin_smith: yeah thought of that, too
14:11pandeirobut this is happening with H2 (hosted locally in same process as nREPL)
14:11justin_smithahh
14:11pandeiroand also with postgresql (local host)
14:12justin_smithwait, is it always inserting a time from yesterday 3:00?
14:12pandeiroyes!
14:12justin_smithahh - but this is for a date field, right?
14:12pandeirojustin_smith: yes, date
14:12pandeirotimestamp works as expected
14:13justin_smithI bet it creates the earliest date in gmt that would be considered that data
14:13justin_smithwhich is 7 hours ahead of you
14:13pandeirooh god
14:13justin_smitherr.. 9 hours?
14:13pandeiroAmerica/Sao_Paulo
14:13justin_smithsorry, brain is failing today - but it must be something like that
14:13pandeiroyesterday at 3AM is even more
14:13pandeiroi had thought of that, as well
14:14pandeirobut i don't think we're 21 hours behind GMT
14:14pandeirobut now i'm at that point, many hours later, where i don't care about the why anymore
14:14pandeiroi just want a fix
14:14pandeiro:)
14:14pandeirosad but true
14:16justin_smithI work on a project that has h2 support, but we did the timestamp / date type conversion on the clojure side, because we support too many dbs, so it is easier to just do the lcd of behaviour and then convert in clojure
14:17pandeirojustin_smith: ah ok
14:17pandeirohow does that go, exactly?
14:17pandeiroyou convert to millis?
14:19justin_smithpandeiro: for time, we truncate everything bigger than hours, for date we truncate everything after days
14:19justin_smithsince every db has a datetime
14:20pandeirojustin_smith: what are the java types involved?
14:20pandeirojava.util.Date?
14:20clojurebotjava.util.Date is Michael Bolton
14:20pandeirolol
14:21pandeiroi fell right into that one i guess
14:21justin_smithpandeiro: yeah
14:21pandeiroi'm wondering if my issues aren't with clj-time.coerce/to-sql-date
14:21pandeirono, not it
14:22pandeiro(to-sql-date (from-string "2014-08-08")) ;=> #inst "2014-08-08T00:00:00.000000000-00:00"
14:24pandeirojustin_smith: just one more thing, on the SQL side the data type you use is timestamp?
14:26pandeirok so i'm not alone here http://stackoverflow.com/questions/9202857/timezones-in-sql-date-vs-java-sql-date
14:29justin_smithpandeiro: yeah, timestamp on the sql side
14:42dnolen_anybody else having trouble grabbing clojurescript 0.0-2307 from Maven Central?
14:44TimMcShould I be able to attach a Class reflection hint to an arglist?
14:45TimMcIf I do ^Foo on the defn's symbol, it attaches as a Class. If I attach it to the arglist, it attaches as a Symbol instead (and then causes a class-not-found compile error when the fn is called!)
14:46amalloyTimMc: hinting the arglist is for primitives
14:46TimMcAh, thanks.
14:46TimMc(and Trix is for kids)
14:46llasramTimMc: I like {:tag `Foo} as the metadata map
14:47amalloyllasram: whaaaaat, why?
14:47llasram(I think I stole that from amalloy)
14:47llasramOr maybe not :-)
14:47amalloyi would have done that in a macro, so that it expands right, but not by-hand in a defn, i would think
14:47hiredmanwin 20
14:48pjstadigi'm doing something yucky. I'm extending the clojure.java.jdbc/ISQLValue and clojure.java.jdbc/IResultSetReadColumn protocols to the Joda DateTime class. #confessions
14:48pjstadigis there a better way to do this?
14:49TimMcamalloy: http://clojure.org/java_interop disagrees
14:49TimMcjust following "the type hint can be placed before the arguments vector"
14:49Bronsadnolen_: yeah here too
14:51TimMcamalloy: I think you've got it backwards: You can only primitive-hint on arglists.
14:51llasramTimMc: Isn't that what he said...?
14:52Bronsayou can pit whatever hint you want on the arglists
14:52Bronsait just have to be fully qualified if it's a class
14:52losingkeyslall
14:52losingkeyswhoops this isn't mutt >.<
14:52Bronsayou can put*
14:52TimMcBronsa: Seems like a bug...
14:52Bronsathere's already a ticket for that
14:52TimMc:-(
14:52BronsaI think.
14:52Bronsalet me double check
14:53hiredmanseems like the result of someones illfated attempt to unify the primitive type hinting and the other kind
14:53BronsaTimMc: http://dev.clojure.org/jira/browse/CLJ-1232
14:54llasramamalloy: Got it -- the wacky evaluation rules for metadata mean that
14:55llasram(-> (defn ^Foo foo []) meta :tag class) => Class
14:55amalloyoh yeah, i remember that ticket, Bronsa
14:55llasram(-> (defn foo {:tag `Foo} []) meta :tag class) => Symbol
14:56pjstadigBronsa: i've been bit by that before
14:56llasramThe compiler correctly interprets the metadata in either case, but resolution to a concrete class in the former case can play havoc with dynamic reloading
14:56TimMcfriggin' Rich
14:57pjstadighttps://github.com/pjstadig/nio/commit/c2dfb3911906ff2a0de0b7fc3ee40bdcd1c30de1
14:57TimMcI hope he comes around on this.
14:57Bronsapjstadig: I'm not surprised. when testing eastwood me and Andy found out a huge amount of popular libraries had some instance of this problem
14:59amalloybut like...why would you fix it that way? just hint the function name. i find it a lot easier to keep straight "arglist for primitives, function name for anything else (ie, everything i actually do)" than "hint the arglist but you gotta remember to use fully-qualified class names"
14:59lambdahandsHi, all. Is there a reason the 0.0-23xx versions of ClojureScript aren't pulling down from Maven? I'm getting this error when I attempt to run `lein deps`: https://www.refheap.com/89059
14:59Bronsaamalloy: a lot of folks are putting the primitive type hint on the function name, so you get shit like :tag #<core$ints ..>
15:00TimMcamalloy: The behavior should be made regular either way.
15:00Bronsaamalloy: because people don't know that
15:00TimMcWhen you have irregular language and API features, you get PHP.
15:01Bronsayou just know that from experience, there's no good clear documentation on this
15:03dnolen_Bronsa: hmm
15:03lambdahandsWoops. The link didn't go through: https://www.refheap.com/89059
15:13tuftis there any way to get test.check to output some additional values when a test fails?
15:13Bronsadnolen_: I can get it from sonatype, maybe it hasn't hit maven central yet
15:13tuftjust seeing the generated values isn't quite enough to readily see why the test failed...
15:13dnolen_Bronsa: hrm ok
15:13reiddrapertuft: currently, no. Can you just apply the generated value to your function under test though?
15:14akurilinStupid Schema question: how do you enforce more than two predicates on a certain key? Right now I can use the both function, but that gives me at most two.
15:14tuftreiddraper: sure, that's pretty useful. however sometimes there are some let bindings my property test uses that take a few more steps to reconstruct.
15:14akurilinI could chain both, maybe?
15:15tuftreiddraper: one idea i had was to be able to mix generator and regular let bindings in the first argument to for-all
15:15reiddrapertuft: I should probably add this to the documentation, but in general you'll have a better experience if you simply call some function in your property body
15:16reiddrapertuft: because as you're running into, you otherwise can't 'get at' that code without running a test
15:17reiddrapertuft: more concretely, i would put your `let` stuff into a function with its own name
15:17tuftreiddraper: ah ok, so pass the generated values to a function that calls the function under test and returns a boolean
15:17reiddrapertuft: exactly
15:18reiddrapertuft: fwiw, what you're asking for is reasonable, and is in some other quickcheck implementations, but just not test.check yet
15:18reiddrapertuft: but this is an easy way around it
15:18tuftreiddraper: indeed, should work fine, thanks =)
15:18reiddrapernp
15:19tuftreiddraper: great lib btw. i'm really starting to get the hang of it, and found my first non-trivial bug recently
15:19reiddrapertuft: happy to hear!
15:26TimMcreiddraper: I found test.check really nice to work with, by the way.
15:30pandeiroanyone using liberator and clj-time together have a serialization strategy to recommend?
15:41reiddraperTimMc: thanks!
15:47PigDudewhat is the practical difference between a function returning a reified protocol, and a named implementation of the protocol?
15:47PigDudemainly, are they equally efficient?
15:50amalloythey're the same
15:50PigDudethanks, i find myself defining records that only get created by factory functions
16:11vermaI upgraded to lein 2.4.3, and now "lein new meis test-app" seems to throw an error like so: https://www.refheap.com/89066
16:12vermashould just basically purge my local repo?
16:12vermastill no go
16:12vermasame error
16:13vermatechnomancy, any ideas ^ ?
16:16PigDudewould the atoms contained in an atomic collection be updatleabe independently of the collection itself?
16:16PigDudewould seem to be the case
16:17TEttingerPigDude, yes
16:17PigDudethanks TEttinger
16:17TEttingeralso atoms contained in a non-atom collection IIRC
16:17TEttinger,(def stuff [(atom 0) (atom 10)])
16:17clojurebot#'sandbox/stuff
16:18amalloyPigDude: although a mutable container holding more mutable things is generally just asking for trouble: you lose a lot of the benefits of pure functions
16:18PigDudeamalloy: this is for a caching structure
16:18amalloylike, swap! works because you can freely abandon an update and retry
16:18PigDude(a collection of caches, so there is an expectation of mutability)
16:18TEttingerhm, nvm it does need to be mutable to store changes
16:19amalloybut if your swap! function might swap! other things, then retries are "dangerous"
16:19amalloyPigDude: so? you can just have one atom at the top, containing a number of caches, and swap! on it
16:19PigDudeamalloy: that is the idea, the structures would never beupdated together
16:28sdegutisWhen should you use Clojure for a web app rather than Rails?
16:28sdegutisIn this case, a really dead-simple web-store app.
16:29mgaareThat's kind of a personal question
16:43pandeirois it just me or is ac-cider still buggy compared to ac-nrepl? completion candidates are off, <Enter> "completes" words by deleting a portion of them, etc
16:43pandeiromaybe i should take this to #clojure-emacs
16:44vermahow come there's a #clojure-emacs and no #clojure-vim :(
16:44amalloyis there really a #clojure-emacs? i can't believe that needs to exist
16:44TimMc#clojure-ed
16:44TimMcmake it happen
16:44amalloy#clojure-grep
16:45pandeiroamalloy: now that there are clojure packages especially for emacs, maybe it does
16:45pandeiroi mean, nrepl middleware
16:45Glenjamini'm not entirely convinced #clojurescript even needs to exist
16:46amalloythere have been clojure packages for emacs for years. but so what? most clojure users are in #clojure, including the emacs users, and it's not like it's off-topic or spammy to ask about emacs in here
16:46Glenjaminsince there's probably as many cljs questions in here than there
16:46technomancyGlenjamin: I'd be down with fewer cljs questions in here
16:46Glenjaminthe channel exists, i guess it's a docs problem at that point
16:46hiredmanmaybe #clojure-emacs is for people who are offended by the near constant complaining about cider in #clojure
16:47hiredmanbtw, cider ugh
16:47clojurebotExcuse me?
16:47amalloyhiredman: wouldn't it be the opposite? like we'd make a #clojure-not-cider channel as a refuge
16:47S3thc0nHello, I was wondering if there are fine-grained parallel data structures available in Clojure. Specifically I have a map where every entry is independent from every other and would like to leverage this.
16:48hiredmanamalloy: check it out and see
16:48pandeirohiredman: do you not use cider?
16:48vermaS3thc0n, pmap
16:49GlenjaminS3thc0n: there's immutable-int-map, which can efficiently reducer-fold on maps
16:49S3thc0nOh sorry, I meant the data structure itself, not the function. ./
16:50amalloyi think hiredman uses nrepl
16:50vermaS3thc0n, a map of atoms then?
16:50vermaS3thc0n, what the use case like?
16:50vermas/what/whats
16:50Glenjaminthere are structures which can be operated on in parallel, and functions which can perform stuff in parallel, you may want one or both depending on your use-case
16:52S3thc0nI am collecting statistics on different items which are entirely independent, which need to be updated regularly. Of course I could do those sequentially, but I would like to change it in parallel.
16:54Glenjamincore.reducers' fold might be helpful in that case
16:59vermaS3thc0n, I haven't played much with reducers, but if I were to do it, I would use some combination of core.async's go, alts!!, which transact stuff into a (atom {}), I am not aware of any data-structures that do that
17:00Glenjaminit depends if you're doing them all at once, or random-access continuously
17:00Glenjaminthe if the latter, a core.async-backed queue with multiple consumers swap! ing an atom might be a reasonable approach
17:04sdegutisNot that I regularly visit here anymore, but fwiw I always look at Clojure and ClojureScript as two distinct languages, so #clojurescript would make tons of sense as a separate channel.
17:05Glenjaminit exists, it just doesn't get much traffic compared to cljs Qs in here
17:05mdeboardIs there a "Building web applications with om" book planned, anyone know?
17:06mdeboardI was just re-reading "Web Development with Clojure" which touches on CLJS admirably, but I would love a book that laid out some good patterns and whatnot for project structure, routing, etc., etc.
17:14jose_leetohello guys
17:14mdeboardhi
17:14jose_leetoI am a rails guy getting start with clojure
17:15jose_leetowhat kind of project you definitely start with clojure?
17:15mdeboardcool
17:15mdeboardjose_leeto: You could re-implement a smallish Rails app in Clojure
17:16jose_leetothat sounds good
17:16mdeboardjose_leeto: Are you familiar with functional programming at all? Any lisps etc?
17:16jose_leetobut clojure is good in what occasion?
17:16jose_leetono
17:17jose_leetoI choose clojure for start with function prog too
17:17jose_leetoI wish I had not a bad choice
17:18mdeboardClojure is a great general purpose programming language. I *really* recommend picking up a very good book called "Clojure Programming" http://shop.oreilly.com/product/0636920013754.do
17:18mdeboardThat book does a v good job of explaining Clojure in-depth.
17:19jose_leetowell I will check that book
17:19mdeboardjose_leeto: You might also consider the Elixir language. Its syntax is inspired by Ruby (and very Ruby-like) but it runs on the Erlang virtual machine
17:19mdeboardit's a functional programming language as well
17:19mdeboardit's not as mature or stable as Clojure, though.
17:20jose_leetoI hear about that josevalim project
17:20mdeboardYes!
17:20jose_leetothere is a reason to choose clojure over erlang?
17:21rweirjvm interoperability, lots of subjective factors, more varied concurrency models
17:21mdeboardnailed it
17:21jose_leetojvm is a good point
17:22technomancyerlang is not a general-purpose language
17:22hiredmansay you want a string instead of a list of integers
17:22mdeboardjose_leeto: clojure is very, very good language. It's worth investing time to learn it.
17:22technomancyit's really good at network servers and not much else
17:22mdeboardI only mention elixir because it might look more familiar to you at first (which is like the least important factor)
17:22mdeboardtechnomancy: That's my impression, I don't understand why you'd make web apps with it tbh
17:22jose_leetoI get your point
17:23jose_leetotbh?
17:23mdeboardjose_leeto: Grab that book and read it and work through exercises and what have you.
17:23technomancyI don't think syntactic similarity is all that helpful. learning a new runtime is several orders of magnitude more difficult than learning a new syntax.
17:23mdeboard"to be honest"
17:23jose_leeto:
17:23mdeboardtechnomancy: it's not, it's just less intimidating at first
17:23jose_leeto:)
17:23mdeboardtechnomancy: but that "benefit" loses value like an hour in to learning
17:24jose_leetoclojurescript excite me to learn clojure to
17:25mdeboardjose_leeto: i also bought a book called "Web Development With Clojure" http://pragprog.com/book/dswdcloj/web-development-with-clojure it's very good, and doesn't assume you know much about Clojure
17:25jose_leetohumm
17:25mdeboardi'd recommend those two
17:25jose_leetoI like the pragprog books
17:26mdeboardClojure Programming is really good, written by very smart people
17:26mdeboardIt's very "readable" . facil a leer cubre a cubre
17:27mdeboardso don't dismiss it just because it's oreilly :P
17:28jose_leetohahahaha ok
17:28rweiri quite liked those two books, too, as well as joy of clojure
17:54ambrosebs,(sequence (comp (map prn) (map inc)) [0 1 2])
17:54clojurebot#<NullPointerException java.lang.NullPointerException>
17:54ambrosebs,(doc sequence)
17:54clojurebot"([coll] [xform coll] [xform coll & colls]); Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the co...
17:56Bronsaambrosebs: transducers compose in reverse order
17:56ambrosebs,(sequence (comp (map (fn [a] (prn "left" a) a) (map (fn [a] (prn "left" a) a))) [0 1 2])
17:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
17:56Bronsa,(sequence (comp (map inc) (map prn)) [1 2 0])
17:56clojurebot(2\n3\nnil 1\nnil nil)
17:56ambrosebsBronsa: yes I was trying to convince myself of that
17:56DomKM,(contains? (transient {:k :v}) :k)
17:56clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentArrayMap$TransientArrayMap>
17:56ambrosebsBronsa: mind slightly blown
17:56Bronsaambrosebs: that's confusing for me too
17:56DomKMIs there a way to check if a key is in a transient coll?
17:57ambrosebsI didn't realise until Mark Engelberg's post on the clojure ml
17:57ambrosebsobviously comp works in the reverse order right? no :)
17:57ambrosebsgoes without saying
17:57hiredmanambrosebs: how do you convey that in a type signature :P
17:58Bronsaambrosebs: I never realized how used I got to read right to left within comp
17:58ambrosebshiredman: ..
18:01amalloyDomKM: yes, there's something in ITransientVector or ITransientMap
18:02Bronsaamalloy: check if a key is IN a transient coll? how'd you do that?
18:03DomKMamalloy: I just used get with a unique not-found val
18:03DomKMamalloy: looks like contains? been broken for years http://dev.clojure.org/jira/browse/CLJ-700
18:03Bronsaah, I read that backwards nevermind
18:03DomKMreported in jan 2011
18:03amalloyBronsa: ITransientSet/contains
18:04amalloyDomKM: yeah, you don't want to use the general-purpose contains?, just like you don't use the general-purpose conj: you use transient-specific functions
18:04amalloyit's a weird quirk that get works for both; most things don't
18:07DomKMamalloy: Do you know if it exists in cljs? I'm not seeing it
18:08amalloyit doesn't look like it does, DomKM
18:08ambrosebshiredman: core.typed can't express the general type for comp anyway.
18:08DomKMamalloy: oh well, thanks anyway
18:08amalloyoh, nm
18:08amalloyDomKM: in cljs it's just the usual ILookup protocol
18:09amalloywhich is what cljs.core/get uses
18:09DomKMamalloy: sweet, thanks
18:09amalloyso contains? should be just fine in cljs
18:10hiredmanambrosebs: yeah, I am just chuckleling over the general fervor over type signatures for transducers, while the thing that trips clojure programmers up isn't in any of the signatures
18:12ambrosebshiredman: hehe
18:14ambrosebsI'm certainly going to figure out how to type check transducers before I use them, cos that's how I roll
18:16ambrosebsthe type checker could catch the reverse comp stuff with < 5 args to comp (those are hardcoded)
18:16lpvbhow do I get a readable string of PersistentQueue
18:17lpvb,(.toString (conj clojure.lang.PersistentQueue/EMPTY 3))
18:17clojurebot"clojure.lang.PersistentQueue@22"
18:17ambrosebsbut agreed, the types by themselves don't reveal much
18:17amalloy,(pr-str (conj clojure.lang.PersistentQueue/EMPTY 0))
18:17clojurebot"#<PersistentQueue clojure.lang.PersistentQueue@1f>"
18:17amalloy,(pr-str (seq (conj clojure.lang.PersistentQueue/EMPTY 0)))
18:17clojurebot"(0)"
18:19ambrosebsquite amusing rich didn't highlight the comp semantics
18:20ambrosebsperhaps this is why it takes years to absorb his blog posts :)
18:20ambrosebsthey just keep on givin
18:21lpvb(inc ammaloy) ; thanks
18:21lazybot⇒ 1
18:21lpvbwow
18:21lpvb(inc amalloy) ; thanks
18:21lazybot⇒ 155
18:21amalloy(dec ammaloy) ; can't stand impostors
18:21lazybot⇒ 0
18:21Bronsa(inc amalloy) ; thanks)
18:21lazybot⇒ 1
18:21amalloy(dec amalloy )
18:21lazybot⇒ 4
18:22lpvb(inc lpvb) #_(dec lpvb)
18:22lazybot⇒ 1
18:22lpvb(dec lpvb)
18:22lazybotYou can't adjust your own karma.
18:22lpvbwhat
18:22amalloyyou inc'd the guy named lpvb) #_(dec lpvb
18:22Bronsa(dec lpvb) #_(dec lpvb)
18:22lpvb(inc lpvb)
18:22lazybot⇒ 0
18:22lazybotYou can't adjust your own karma.
18:22lpvb(inc lpvb) #_(dec lpvb)
18:22lazybotYou want me to leave karma the same? Fine, I will.
18:23lpvbamalloy: oh
18:28PigDudehow do i set a key in a map only if the key is unset?
18:28amalloy&(doc update-in)
18:28lazybot⇒ "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."
18:29PigDudei don't want to return a new map though if the existing one does not need change
18:29PigDudeah i guess clojure is smart about how it manages its memory in that regard
18:29amalloyPigDude: can you think of a good reason why you'd care?
18:29PigDudethanks amalloy, i was uneasy about using update-in
18:30PigDudewell it is an operation on an atom and i don't want to change the atom value unless i need to ... not sure how to go about tha
18:30PigDudein this case, only setting a key on a map (which is an atom) if it is usnet
18:30PigDudeusenet!
18:33PigDudei guess i didn't want there to be contention on the atom if the map doesn't need to change
18:34PigDude does that make sense at all?
18:35akhudekhmm, I’m having an odd problem with sablono. After modifying hiccup forms with clojure zip the forms no longer render. The only difference that I can see is that the PersistentVectors are not Subvecs
18:35akhudeknot sure why this would make a difference
19:48vermaman it sucks that string/split and string/join have different order for splitter/separator
19:49verma,(-> 10 inc)
19:49clojurebot11
19:49verma,(-> 10 #(inc %))
19:49clojurebot#<CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.ISeq, compiling:(NO_SOURCE_PATH:0:0)>
19:50verma,(type inc)
19:50clojurebotclojure.core$inc
19:50verma,(ifn? inc)
19:50clojurebottrue
19:50hiredman,#(inc %)
19:50clojurebot#<sandbox$eval123$fn__124 sandbox$eval123$fn__124@7dccc2>
19:50verma,(ifn? #(inc %))
19:50clojurebottrue
19:50hiredman,'#(inc %)
19:50clojurebot(fn* [p1__176#] (inc p1__176#))
19:51hiredman,(macroexpand '(-> 10 (fn* [p1__176#] (inc p1__176#))))
19:51clojurebot(fn* 10 [p1__176#] (inc p1__176#))
19:51hiredman^-
19:52vermadafuq
19:52verma:)
19:52vermathanks hiredman
19:57hyPiRionThat's the trick I use when I want to do multiarg swearjure.
19:59hyPiRion,((-> [! $] #(+ (*) (* ! $))) (+ (*) (*)) (#(* % % %) (+ (*) (*))))
19:59clojurebot17
20:02gfredericksthinking of writing a higher-order-generator for test.check that lets you provide extra ways to shrink things
20:03amalloythat's amazing, hyPiRion
20:03gfredericksI'm not sure it is easy though
20:14rberdeenwhy might leiningen include dependencies' classes when running `lein jar`?
20:16hiredmanaot compilation is transitive
20:20rberdeenhiredman: ah, that makes sense. i've definitely seen it *not* include the classes of dependencies under some circumstances, but i can't figure out when that would be.
20:20rberdeenit only seems to depend on the state of the target/ directly
20:20rberdeens/directly/directory/
20:23xeqiBronsa: is there a clojure that implements eval based on tools.reader ?
20:23xeqiBronsa: ack, tools.analyzer
20:24Bronsaxeqi: there's tools.emitter.jvm/eval
20:25xeqioooh, thans
20:25xeqithanks
20:58SeaKQuick question. Why does (count '()) == 0, but lst = () then (count '(lst)) == 1?
20:59SeaKAm I going crazy or missing something basic? If so, a link would be appreciated!
20:59rhg135_a lst is an item
21:02ToBeReplacedSeaK: you are counting a list containing the symbol lst, not lst
21:02SeaKmmm. I thought it count returned the number of items in the collection... So how would I test if there's one item in the list. This is what I had tried (= count '(lst) 1)
21:02ToBeReplaced,(let [lst '()] (count lst))
21:02clojurebot0
21:03SeaKI see. So really, I just needed count lst
21:04amalloySeaK: you are misunderstanding quoting, and how to create lists
21:04ToBeReplacedSeaK: when starting out, avoid using the quote symbol -- it's a feature you don't need to use for a bit... as an example, use (list) instead of '().
21:04amalloy,(let [lst '(1 2 3)] '(lst)) doesn't return ((1 2 3)), it returns (lst)
21:04clojurebot(lst)
21:07SeaKThanks a lot. Haven't learned 'let' yet. I understood the quote as not evaluating the list. Thanks ToBeReplaced + amalloy. The reason I was attempting to use the ' symbol, was to recursive make a "isSorted" function without using sort and didn't want to evaluate the list each time...
21:10amalloydon't worry about evaluation. you can pass objects around all you want, without re-evaluating them
21:11SeaKI see. Thank you very much. I've got it working for two test conditions, getting there. Completely new to this function paradigm, so it's pretty fun : )
21:14SeaK*al
21:20SeaKFinished it. Would any like to have a look at a beginners implementation and tell me where I could have done things that much better?
21:23gfredericksSeaK: I recommend you post some code and people can look for themselves before committing to commenting ;-)
21:25SeaKSure, gfredericks. Anyone can check it out here: http://pastebin.com/UdK8b77d I just thought it may be interesting for more mature programmers to see where the beginners go abstract, haha
21:25itruslove_How do I debug a lein plugin in the context of an existing project? I tried cloning the plugin into the project's checkouts and changing the plugin's version in its project.clj, but it wasn't found.
21:34gfredericksSeaK: (is-sorted? [1 1])
21:35SeaKYou got me!
21:38gfredericksSeaK: also your first two cases can be combined
21:39SeaKI see, by using 'or'.
21:40SeaKAppreciate the tips! I really should have thought of the numbers the same condition. I was practicing on range x, and I that's where it slipped through!
21:44gfredericksSeaK: not even `or`
21:44gfredericksI mean by checking that the length is <= 1
21:45SeaK'<' or '==' haha. But yes, you've improved it yet again! Looks like I have a long way to go. Many thanks, gfredericks
23:00mdeboardI am getting stymied by CIDER or something, anyone have any insight on why I'm getting this error https://gist.github.com/mattdeboard/e7520729acf056ff45ad
23:00mdeboardI clearly have cider-nrepl 0.8.0-SNAPSHOT installed, which is what it's directing me to install
23:00mdeboardidgi
23:02Jaoodmdeboard: how did you install cider-nrepl?
23:02mdeboardit's part of project.clj
23:03Jaoodmdeboard: and you are sure lein installed it?
23:04mdeboardNo, I assumed it did, but maybe it didn't
23:04mdeboardI mean the message in the REPL says it's there
23:04Jaoodmdeboard: it should had thrown some error
23:05mdeboardOh, there's no error, no
23:05mdeboardI mean when I just had 0.7.0, it said "cider-nrepl 0.8.0-SNAPSHOT not installed" on the top line
23:05mdeboardnow, it doesn't
23:05Jaooda cider-nrepl 0.8.0-SNAPSHOT package doesn't exist yet
23:06mdeboardI have one installed in ~/.m2/repository/cider/cider-nrepl
23:07Jaoodoh it does exist, is in clojars
23:07clojurebotIk begrijp
23:09justin_smith~oh it does exist,
23:09clojurebotoh it does exist, is in clojars
23:14Jaoodmdeboard: seems to work here: ; CIDER 0.8.0alpha (package: 20140808.646) (Java 1.7.0_65, Clojure 1.6.0, nREPL 0.2.3, cider-nrepl 0.8.0-snapshot)
23:17Jaoodmdeboard: resintall cider
23:18Jaoodlatest cider
23:23Jaoodclojars doesn't show the most recent version when searching https://clojars.org/search?q=cider-nrepl
23:24Jaoodthose search results are awful, are they suppose to be responsive?
23:30justin_smithJaood: how about lein search?
23:31justin_smithI heard there was some issue with the indexing on clojars, maybe it is still somewhat defunct?
23:34Jaoodjustin_smith: yeah, lein search is nice
23:38Jaoodjustin_smith: lein search downloads the whole index everytime is changed?
23:38technomancyJaood: no, it downloads incremental indices
23:41Jaoodtechnomancy: oh, apparently I never searched anything on maven, wondering why it was taking so long :)
23:49Jaoodtechnomancy: when you run lein deps for example, does lein has to check in which of both repositories the package is in?
23:54technomancyJaood: if you've never fetched it, it checks both, yeah.
23:57Jaoodtechnomancy: so both repos are paying a bandwidth tax, I guess is not much