2014-08-08
| 00:05 | TEttinger | akhudek, how many imports? |
| 00:06 | akhudek | it’s not exactly clear, but not a whole lot |
| 00:06 | akhudek | adding in javax.imageio ImageIO was enough to cause it to hang |
| 00:06 | akhudek | though I could import java.sql SQLException without issue |
| 00:07 | akhudek | plus another library org.imgscalr |
| 00:07 | akhudek | it’s not entirely clear what is going on, but adding in about 5 imports always causes it to hang |
| 00:07 | TEttinger | hmm |
| 00:07 | TEttinger | can you reproduce with no defs, just imports? |
| 00:07 | akhudek | yep |
| 00:07 | TEttinger | maybe one of the imports is bad? |
| 00:08 | TEttinger | a version of a lib with some code executed as a def that never terminates? |
| 00:08 | akhudek | doubt it, everything works fine when I run normally |
| 00:08 | akhudek | and if I kill the uberjar compile process when it hangs |
| 00:08 | akhudek | the it does finish |
| 00:08 | akhudek | and the resulting jar works fine |
| 00:08 | TEttinger | woah! |
| 00:08 | akhudek | checked for rogue defs everywhere |
| 00:08 | TEttinger | that sounds like a call technomancy alarm |
| 00:08 | akhudek | it’s definitlely not that |
| 00:08 | akhudek | and I’m seeing this across several projects too |
| 00:09 | akhudek | confusing |
| 00:09 | TEttinger | what version of lein? |
| 00:09 | akhudek | both 2.4.0 and 2.4.3 |
| 00:09 | akhudek | it may still be something specific to our projects |
| 00:09 | akhudek | but I am having a hard time finding it |
| 00:10 | akhudek | it’s clear taht adding in the imports breaks the camels back though |
| 00:10 | TEttinger | something not aot-ing correctly? |
| 00:10 | akhudek | it only aot’s core |
| 00:10 | akhudek | err main rather |
| 00:10 | akhudek | I’ve also tried both linux and mac |
| 00:10 | TEttinger | try with :aot :all and see what's different? |
| 00:11 | akhudek | hangs with that too |
| 00:11 | akhudek | same way |
| 00:11 | akhudek | in fact, if I break the uberjar |
| 00:11 | akhudek | then run it again without doing a clean |
| 00:11 | akhudek | it completes |
| 00:11 | akhudek | and the resultiing jar is fine |
| 00:11 | TEttinger | it's like it can't get a lock on something it needs to complete the uberjar |
| 00:11 | akhudek | yeah |
| 00:11 | xeqi | akhudek: does `lein compile` finish? |
| 00:12 | TEttinger | good idea, Xe |
| 00:12 | TEttinger | xeqi |
| 00:12 | allenj12_ | 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:14 | akhudek | xeqi: doesn’t look like it |
| 00:14 | akhudek | samping with visualvm shows that it’s blocked on a join |
| 00:14 | akhudek | com.hypirion.io.Pipe.join |
| 00:19 | raj91 | Any experience with Clojure on Java 8? Anything to look out for? |
| 00:20 | TEttinger | raj91, I have noticed no difference, but I haven't done any complicated interop |
| 00:20 | TEttinger | http://leiningen.org/reference.html akhudek, ctrl-f for (.join pump-out) |
| 00:21 | raj91 | I'm reading about Java 8's DateTime, which is inspired by Joda. |
| 00:22 | TEttinger | right after that call to .join , akhudek, it calls .waitFor, which could be hanging? |
| 00:22 | akhudek | yeah, leiningen.core.eval$sh.doInvoke is right above the join call |
| 00:22 | akhudek | definitely from that function |
| 00:22 | TEttinger | oh, and join also waits |
| 00:22 | TEttinger | https://hypirion.github.io/com.hypirion.io/0.3.0/com/hypirion/io/Pipe.html#join() |
| 00:23 | raj91 | TEttinger: thanks |
| 00:23 | raj91 | I'm trying to read up and see if there are significant JVM changes -- or mostly Java the language changes |
| 00:24 | TEttinger | raj91, yeah, I kinda gave up on the "lambdas" in Java 8 because they're so much less powerful than scala or clojure functions |
| 00:24 | TEttinger | not true closures, just lambdas |
| 00:25 | raj91 | TEttinger: 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:25 | raj91 | Java 7 had some significant library changes which I find useful over Java 6 |
| 00:25 | TEttinger | right. I imagine the JVM is getting better as a language target too |
| 00:26 | TEttinger | da vinci machine project I think was added in 7 |
| 00:26 | raj91 | I am curious about what is happening with off-heap memory |
| 00:26 | gws | allenj12_: maybe factor out (scale-field root field) into the outer let form? |
| 00:26 | raj91 | And curious about Java-C interfacing |
| 00:27 | raj91 | TEttinger: I'm checking out http://openjdk.java.net/projects/mlvm/ |
| 00:31 | Jaood | raj91: seems the jvm would just keep getting better - http://cr.openjdk.java.net/~jrose/pres/201407-JVMEvolution.pdf |
| 00:31 | raj91 | "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:32 | raj91 | Jaood: thanks |
| 00:34 | xeqi | allenj12_: is scale-field a finite list? |
| 00:35 | akhudek | whoa, no more permgen? |
| 00:35 | akhudek | cool |
| 00:37 | akhudek | ah, interesting. So lein is probably just waiting for the clojure compiler to finish |
| 00:37 | akhudek | meanwhile, it is hanging on a core.async channel in the actual compiler |
| 00:37 | brehaut | i look forward to a world of JVM internals typoing meatspace |
| 00:38 | akhudek | buuut that is just the timeout-daemon |
| 00:38 | clojurebot | Alles klar |
| 00:38 | akhudek | so who knows |
| 00:43 | raj91 | akhudek: permgen didn't bite me, but yeah, I suppose some people are glad to see it go |
| 00:44 | raj91 | nice write up here too: http://www.infoq.com/news/2013/03/java-8-permgen-metaspace |
| 00:44 | raj91 | whoops, wrong link. I meant http://ttux.net/post/java-8-new-features-release-performance-code/ |
| 00:46 | akhudek | raj91: thanks for the link |
| 00:51 | raj91 | Sean Corfield (author of clj-time and more) wrote this: http://seancorfield.github.io/blog/2014/06/20/some-thoughts-on-java-8/ |
| 00:53 | raj91 | Pretty funny. Speaking of Java, the language: "No, I’m not switching from Clojure, but now I view Java as “palatable” rather than “hideous”." |
| 00:58 | hellofunk | ddellacosta you around for an Om question? |
| 00:58 | hellofunk | ah, guess not |
| 00:59 | akhudek | hellofunk: can I help? |
| 00:59 | hellofunk | Anyone 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:59 | akhudek | hellofunk: mapv or filterv |
| 01:00 | akhudek | or just wrap the result in vec |
| 01:00 | hellofunk | cool, good suggestions. just curious what the typical Om idiom was for that. |
| 01:01 | akhudek | I don’t think there is one |
| 01:01 | akhudek | but those would all be idiomatic ways to get a vector instead of a lazy list |
| 01:01 | hellofunk | it's an easy problem to forget about |
| 01:11 | akhudek | wow, I must be missing something huge here |
| 01:11 | akhudek | I’ve now commented out the entire application except for a single import of javax.imageio ImageIO |
| 01:12 | akhudek | and still uberjar hangs forever |
| 01:12 | Jaood | is that she said? |
| 01:14 | akhudek | wow |
| 01:14 | akhudek | confirmed |
| 01:14 | akhudek | even with a clean new project |
| 01:14 | akhudek | WAT |
| 01:14 | akhudek | :-( |
| 01:16 | TEttinger | akhudek: ... lein clean ? |
| 01:16 | TEttinger | wait clean new project |
| 01:16 | akhudek | yeah, I did lean new |
| 01:16 | akhudek | err lein new |
| 01:16 | akhudek | just an emtpy -main |
| 01:17 | akhudek | and import of javax.imageio |
| 01:17 | akhudek | and it won’t uberjar |
| 01:17 | TEttinger | I am completely at loss here. could there be some... firewall thing? |
| 01:17 | TEttinger | try a different import |
| 01:17 | akhudek | some imports work |
| 01:17 | akhudek | like java.sql SQLException |
| 01:17 | akhudek | could it have to do with X11 or something strange? |
| 01:19 | akhudek | ok, so it’s something to do with my local machine |
| 01:19 | akhudek | because this example compiles on another machine |
| 01:19 | TEttinger | phew |
| 01:20 | TEttinger | restart, I guess |
| 01:20 | akhudek | yeah :-( |
| 01:22 | justin_smith | raj91: nice, yeah, I was pleasantly surprised with java 8's new features too |
| 01:23 | justin_smith | I bet he was working with a headless jvm |
| 01:23 | justin_smith | java wisely does not provide image manipulation classes if you don't import windowing support |
| 01:23 | TEttinger | entirely possible? ask in a bit I guess |
| 01:23 | justin_smith | "wisely" |
| 01:23 | justin_smith | (I ran into these issues when I used imageio) |
| 01:25 | TEttinger | I've used it with clojure before, on command-line apps, but never headless jvms |
| 01:27 | catern | java |
| 01:27 | catern | still sucks |
| 01:27 | catern | (re: java 8, no image manipulation classes in headless jvms) |
| 01:45 | gtuckerkellogg | CIDER 0.7 looks great. |
| 01:47 | gtuckerkellogg | The docs (https://github.com/clojure-emacs/cider) recommend installing from MELPA using package.el, as per usual |
| 01:49 | gtuckerkellogg | but 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:50 | Jaood | there's melpa-stable |
| 01:56 | schmir | what's missing is a way to pin packages. I've read that emacs 24.4 supports this. |
| 01:57 | gtuckerkellogg | when i list packages, i don't see a cider version in melpa-stable |
| 01:58 | gtuckerkellogg | but at any rate, the cider REAME specifically recommends MELPA over MELPA-stable |
| 01:58 | gtuckerkellogg | "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:58 | gtuckerkellogg | https://github.com/clojure-emacs/cider#via-packageel |
| 01:58 | gtuckerkellogg | schmir, I hope that's the case! |
| 02:00 | schmir | gtuckerkellogg: see http://blog.jorgenschaefer.de/2014/06/the-sorry-state-of-emacs-lisp-package.html |
| 02:00 | gtuckerkellogg | exactly :( |
| 02:04 | schmir | gtuckerkellogg: 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:05 | gtuckerkellogg | i'll do likewise and credit you for all success that follows |
| 02:06 | schmir | :) |
| 02:14 | Jaood | schmir: that would fail |
| 02:15 | schmir | I see. looks like 0.8.0-SNAPSHOT isn't available |
| 02:26 | sm0ke | hey guys, anyone using cascalog on yarn? need a little help |
| 02:31 | amalloy | ~anyone |
| 02:31 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 02:32 | sm0ke | :P |
| 02:38 | sm0ke | its just that the job runs but fails to find the job.jar |
| 02:38 | sm0ke | i think something to do with permissions |
| 02:39 | sm0ke | in the .staging folder inside /tmp |
| 02:40 | sm0ke | i mean job submits* |
| 02:45 | allenj12_ | anyone here familiar with overtone? |
| 02:56 | sm0ke | ~anyone |
| 02:56 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 03:10 | maxnomoon | I know it's quite trivial, but I need a little code review for a newbie: https://www.refheap.com/89033 |
| 03:12 | TEttinger | maxnomoon, oh boy. this gets interesting quickly |
| 03:12 | amalloy | maxnomoon: 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:13 | TEttinger | We 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:13 | AeroNotix | TEttinger: what a terrible idea |
| 03:14 | TEttinger | http://blog.xkcd.com/2010/05/06/sex-and-gender/ |
| 03:14 | AeroNotix | maxnomoon: make a function which takes the gender keyword then call that function generate-human |
| 03:14 | amalloy | AeroNotix: *shrug* not a very good feature, but useful anyway. if nothing else, it helps the programmers get acquainted with unfamiliar gender identities |
| 03:15 | AeroNotix | amalloy: 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:16 | AeroNotix | or some shit |
| 03:16 | amalloy | well yeah, that's what i said. gets the programmers introduced to whole new exciting gender identities |
| 03:16 | amalloy | by way of people shouting at you about them |
| 03:16 | AeroNotix | sigh |
| 03:16 | AeroNotix | "gender identities" |
| 03:17 | H4ns | AeroNotix: you don't have any issues with that kind of stuff, do you? lucky white boy. |
| 03:17 | maxnomoon | AeroNotix: gladly that's just a game structure generation. Hope tribe members won't kill me :) |
| 03:17 | AeroNotix | H4ns: nothing like that -- there's a time and a place for it. An XKCD bot on IRC is definitely not that place |
| 03:18 | AeroNotix | H4ns: I'm not a white boy, I'm a caucasian male-centric being |
| 03:18 | AeroNotix | :) |
| 03:24 | SagiCZ1 | TIL my gender is boring |
| 03:26 | TEttinger | SagiCZ1, you could be a hijra, the most interesting gender so far https://en.wikipedia.org/wiki/Hijra_(South_Asia) |
| 03:26 | TEttinger | in india and bangladesh they are recognizd as a third gender by law |
| 03:28 | SagiCZ1 | is there any tldr? isnt it just regular trans-gender? |
| 03:30 | AeroNotix | I wonder if there are more countries which codified it into law |
| 03:30 | AeroNotix | again; 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:33 | SagiCZ1 | AeroNotix: well the thing about gender equality is that some people confuse "equal rights" with "equal opportunities" |
| 03:33 | SagiCZ1 | i mean.. women sure have a right to be the next CEO in our company but do they have the opportunity? |
| 03:34 | SagiCZ1 | and the more important question, should we make SURE they have the opportunity? or is giving them the right enough? |
| 03:34 | AeroNotix | Surely equal rights has to come before opportunity? |
| 03:35 | AeroNotix | I'm not decided on affirmative action. I don't know enough about its effects. Has it worked in the past? |
| 03:35 | SagiCZ1 | mixed results I would think |
| 03:35 | SagiCZ1 | gender studies are interesting research field |
| 03:39 | TEttinger | SagiCZ1, 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:41 | TEttinger | like 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:41 | TEttinger | and that's been that way for centuries |
| 03:43 | AeroNotix | woah |
| 03:43 | TEttinger | it isn't one of the new cis-normative otherkin things |
| 03:55 | SagiCZ1 | TEttinger: interesting |
| 03:55 | TEttinger | learn something new in #clojure every day! |
| 03:56 | SagiCZ1 | i know right ^^ |
| 03:56 | TEttinger | yesterday transducers, today transgenders |
| 04:08 | SagiCZ1 | TEttinger: Yeah i somehow missed the beginning of the tranducers topic and now I have no idea. |
| 04:08 | TEttinger | heh |
| 04:10 | SagiCZ1 | but i will make sure, once my grandma asks what i do at work, to mention transducers.. |
| 04:11 | meingbg | 'print-str works in REPL, but not over cider. What's going on? |
| 04:12 | hyPiRion | oh what |
| 04:12 | hyPiRion | Somehow I thought it was Wednesday today. |
| 04:14 | SagiCZ1 | hyPiRion: was it a pleasant surprise then? people usually digg fridays |
| 04:15 | meingbg | I don't get this. Anything involving (with-out-str) fails to evaluate over emacs/cider |
| 04:15 | hyPiRion | SagiCZ1: I'm just confused, but yeah, pleasantly surprised |
| 04:16 | hyPiRion | But it also means I'm 2 days behind my schedule at work :p |
| 04:23 | pyrtsa | Hmm, clojure.core/sequence seems a bit too greedy with transducers: |
| 04:23 | pyrtsa | ,(defn trace [xs] (next (reductions (fn [_ x] (print (str "<<" x ">>")) (flush) x) nil xs))) |
| 04:23 | clojurebot | #'sandbox/trace |
| 04:23 | pyrtsa | ,(take 2 (trace (range 10))) |
| 04:23 | clojurebot | <<0>>(<<1>>0 1) |
| 04:23 | pyrtsa | (sequence (take 2) (trace (range 10))) |
| 04:23 | pyrtsa | ,(sequence (take 2) (trace (range 10))) |
| 04:23 | clojurebot | <<0>>(<<1>><<2>>0 <<3>>1) |
| 04:23 | pyrtsa | (Pulls out two extra elements from the input sequence.) |
| 04:24 | pyrtsa | transduce is fine: |
| 04:24 | pyrtsa | ,(transduce (take 2) str (trace (range 10))) |
| 04:24 | clojurebot | <<0>><<1>>"01" |
| 04:41 | SagiCZ1 | (doc transduce) |
| 04:41 | clojurebot | "([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:44 | SagiCZ1 | who writes these docs.. i need ELI5 |
| 04:45 | pyrtsa | Rich does. |
| 04:46 | SagiCZ1 | pyrtsa: he always sounds so reasonable when he talks.. |
| 04:47 | pyrtsa | SagiCZ1: 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:47 | Bronsa | SagiCZ1: docstring vs 40min talk |
| 04:48 | pyrtsa | The transduce function call (transduce xform f init xs) can be read as (reduce f init (perform-transform xform xs)). |
| 04:49 | pyrtsa | Indeed, (transduce xform f init xs) == (reduce f init (sequence xform xs)) |
| 04:49 | pyrtsa | (Except for the little greediness bug that I think I just found above.) |
| 04:50 | Bronsa | pyrtsa: not exactly the same, sequence produces a lazy sequence, transduce never does |
| 04:51 | pyrtsa | Bronsa: Please read again. |
| 04:51 | pyrtsa | I've got a reduce there on the rhs which forces away the laziness. |
| 04:52 | Bronsa | pyrtsa: yes, I was just pointing out that the impl of transduce doesn't create an intermediate lazy sequence |
| 04:53 | pyrtsa | Fair enough. So your point was probably closely related to my talking of greediness in the implementation details. :) |
| 04:53 | clgv | Bronsa: "can be read as" covers that I think ;) |
| 04:53 | hyPiRion | pyrtsa: That's assuming xs is a collection of some sort though. xs can be a channel or something completely different |
| 04:53 | pyrtsa | hyPiRion: transduce isn't defined for some other xs. |
| 04:54 | pyrtsa | As 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:55 | pyrtsa | And that, of course, was the whole point in creating this new concept of transducers. :) |
| 04:55 | Bronsa | pyrtsa: not true, transduce only requries coll to be reducible |
| 04:55 | hyPiRion | pyrtsa: oh, I thought it was more general and worked on foldables. Well, that's funny. |
| 04:56 | pyrtsa | Bronsa: Ah, of course. |
| 04:56 | pyrtsa | A slight difference. |
| 04:57 | Bronsa | pyrtsa: also I just joined, what is this greediness bug you were talking about? |
| 04:57 | pyrtsa | Bronsa: (sequence (take n) xs) pulls out (+ n 2) elements from xs, not n. |
| 04:58 | Bronsa | uh, weird |
| 04:58 | pyrtsa | ,(defn trace [xs] (next (reductions (fn [_ x] (print (str "<<" x ">>")) (flush) x) nil xs))) |
| 04:58 | clojurebot | #'sandbox/trace |
| 04:58 | pyrtsa | ,(take 2 (trace (range 10))) |
| 04:58 | clojurebot | <<0>>(<<1>>0 1) |
| 04:58 | pyrtsa | ,(sequence (take 2) (trace (range 10))) |
| 04:58 | clojurebot | <<0>>(<<1>><<2>>0 <<3>>1) |
| 04:58 | Bronsa | I see |
| 04:58 | clgv | ,(sequence (take 10) (range)) |
| 04:58 | clojurebot | (0 1 2 3 4 ...) |
| 04:58 | clgv | ,(sequence (take 2) (range)) |
| 04:58 | clojurebot | (0 1) |
| 04:59 | clgv | ,(doc trace) |
| 04:59 | clojurebot | "([xs]); " |
| 04:59 | hyPiRion | clgv: it was defined by pyrtsa |
| 04:59 | pyrtsa | Of course it can be argued that there should be no side effects in sequences. |
| 04:59 | clgv | ah lol |
| 04:59 | pyrtsa | But it sounds like a minor bug regardless. |
| 05:05 | sveri | Hi, 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:06 | pyrtsa | (apply concat xs) |
| 05:07 | hyPiRion | pyrtsa: actually, it can be pretty devastating |
| 05:07 | sveri | oh, that easy, thank you :-) |
| 05:07 | hyPiRion | ,(defn a [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a (- m 1) 1) :else (a (- m 1) (a m (- n 1))))) |
| 05:07 | clojurebot | #'sandbox/a |
| 05:07 | hyPiRion | ,(take 4 (map #(a % 1) (iterate inc 0))) |
| 05:07 | clojurebot | (2 3 5 13) |
| 05:08 | hyPiRion | ,(sequence (take 4) (map #(a % 1) (iterate inc 0))) |
| 05:08 | clojurebot | #<StackOverflowError java.lang.StackOverflowError> |
| 05:08 | pyrtsa | Haha. |
| 05:08 | pyrtsa | Yeah, I count that as those side effects. |
| 05:08 | hyPiRion | not everyone computes ackermann, but eh :p |
| 05:08 | pyrtsa | Ackermann approximates _|_ pretty well. |
| 05:08 | hyPiRion | heh |
| 05:09 | clgv | hyPiRion: you seem to be someone that didnt sleep in his TCS lectures ;) |
| 05:10 | TEttinger | ,(take 10 (sequence (map #(a % 1) (iterate inc 0)))) |
| 05:10 | pyrtsa | sveri: 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:10 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 05:10 | Bronsa | ,(def a (clojure.lang.RT/iter (map #(doto % print) (range 10)))) |
| 05:10 | clojurebot | 0123456789#'sandbox/a |
| 05:10 | TEttinger | ,(defn a2 [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a (- m 1) 1) :else (a (- m 1) (a m (- n 1))))) |
| 05:10 | clojurebot | #'sandbox/a2 |
| 05:10 | TEttinger | ,(take 10 (sequence (map #(a2 % 1) (iterate inc 0)))) |
| 05:10 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.SeqIterator cannot be cast to clojure.lang.IFn> |
| 05:10 | pyrtsa | Clojure really ought to have (def cat (partial apply concat)) in core. |
| 05:10 | Bronsa | RT/iter forces the first chunk at creation time |
| 05:11 | TEttinger | ,(sequence (map #(a2 % 1) (take 10 (iterate inc 0)))) |
| 05:11 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.SeqIterator cannot be cast to clojure.lang.IFn> |
| 05:11 | Bronsa | (.iterator (range)) |
| 05:12 | Bronsa | ,(.iterator (range)) |
| 05:12 | clojurebot | #<SeqIterator clojure.lang.SeqIterator@bbe647> |
| 05:12 | TEttinger | ,(sequence identity (map #(a2 % 1) (take 10 (iterate inc 0)))) |
| 05:12 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.SeqIterator cannot be cast to clojure.lang.IFn> |
| 05:12 | Bronsa | ,(.iterator (map #(doto % println) (range))) |
| 05:12 | clojurebot | 0\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:13 | TEttinger | how does sequence work... |
| 05:13 | pyrtsa | Bronsa: See my definition of trace. It intentionally avoided chunking by using reductions. |
| 05:13 | TEttinger | (doc sequence) |
| 05:13 | clojurebot | "([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:13 | Bronsa | pyrtsa: sure, nothing changes though |
| 05:13 | Bronsa | iterator on a lazyseq is forcing the first element |
| 05:13 | Bronsa | be it just an element or a whole chunk, who cares |
| 05:14 | TEttinger | ,(defn a2 [m n] (cond (= 0 m) (+ n 1) (= 0 n) (a2 (- m 1) 1) :else (a2 (- m 1) (a2 m (- n 1))))) |
| 05:14 | clojurebot | #'sandbox/a2 |
| 05:14 | TEttinger | ,(sequence identity (map #(a2 % 1) (take 10 (iterate inc 0)))) |
| 05:14 | clojurebot | #<StackOverflowError java.lang.StackOverflowError> |
| 05:14 | TEttinger | how does that... |
| 05:14 | hyPiRion | clgv: theoretical useless CS is the best kind of CS :p |
| 05:14 | clgv | hyPiRion: :P |
| 05:14 | TEttinger | hyPiRion, I linked to swearjure to someone new here |
| 05:15 | TEttinger | it helped me understand his problem better |
| 05:15 | TEttinger | and then he solved it by me understanding swearjure |
| 05:15 | clgv | TEttinger: I didnt know about your bad character traits until just now ;) :P |
| 05:15 | TEttinger | heh |
| 05:15 | TEttinger | but really it did help |
| 05:16 | TEttinger | he needed to implement nth for 4clojure |
| 05:16 | TEttinger | and I saw swearjure had it |
| 05:16 | hyPiRion | TEttinger: Swearjure to the rescue? Woah |
| 05:16 | cespare | How would I attach a byte[] type hint explicitly using vary-meta? (Say i didn't want to use ^bytes) |
| 05:16 | TEttinger | so I linked it to show it can be written in many ways |
| 05:16 | cespare | something about [B ? |
| 05:16 | lpvb | ,(contains? (vals {:a 1 :b 2}) 2) |
| 05:16 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.APersistentMap$ValSeq> |
| 05:16 | TEttinger | cespare: ^"[B" |
| 05:16 | cespare | TEttinger: thanks |
| 05:16 | lpvb | I don't know a short way to do this |
| 05:17 | pyrtsa | lpvb: Watch out with contains?. It works on the indices (or map keys). |
| 05:17 | TEttinger | but 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:18 | TEttinger | so I showed him how it works outside of a general case ##([1 2 3] 2) |
| 05:18 | lazybot | ⇒ 3 |
| 05:18 | pyrtsa | ,(not (empty? (filter #(= % 2) (vals {:a 1 :b 2})))) |
| 05:18 | clojurebot | true |
| 05:18 | TEttinger | and told him if he can make that a fn, he's done |
| 05:18 | pyrtsa | ,(not (empty? (filter #(= % 3) (vals {:a 1 :b 2})))) |
| 05:18 | clojurebot | false |
| 05:18 | pyrtsa | (I'm not sure if there's a short way to do the above.) |
| 05:19 | Glenjamin | (some? #{2} (vals {:a 1 :b 2})) |
| 05:19 | Glenjamin | ,(some? #{2} (vals {:a 1 :b 2})) |
| 05:19 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/some?> |
| 05:19 | Glenjamin | ,(some? (map #{2} (vals {:a 1 :b 2}))) |
| 05:19 | clojurebot | true |
| 05:19 | Glenjamin | ,(some? (map #{3} (vals {:a 1 :b 2}))) |
| 05:19 | clojurebot | true |
| 05:19 | Glenjamin | hrm |
| 05:19 | Bronsa | pyrtsa: gah, I tried looking at LazyTransforer.java but I have no idea what's going on, could you open a ticket for that? |
| 05:20 | Glenjamin | ,(some #{2} (vals {:a 1 :b 2})) |
| 05:20 | clojurebot | 2 |
| 05:20 | Glenjamin | ,(some #{3} (vals {:a 1 :b 2})) |
| 05:20 | clojurebot | nil |
| 05:20 | Glenjamin | there we go |
| 05:20 | Glenjamin | some? is very different from some |
| 05:20 | pyrtsa | Bronsa: Not today. I wasn't too pleased to read LazyTransformer.java myself either. Not the prettiest code. |
| 05:20 | pyrtsa | ,(some #{false} (vals {:a 1 :b false})) |
| 05:20 | clojurebot | nil |
| 05:21 | pyrtsa | Glenjamin: Watch out with that. :) ^ |
| 05:21 | Bronsa | pyrtsa: do you want me to open the ticket instead? :) |
| 05:21 | pyrtsa | Yes please. You can copy my code snippets from above if you like. (I also suggest using hyPiRion's nice a2 there.) :D |
| 05:22 | hyPiRion | (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:22 | TEttinger | hyPiRion's is a |
| 05:22 | TEttinger | I mangled it |
| 05:22 | pyrtsa | Right. |
| 05:23 | pyrtsa | Now off to lunch & work. -> |
| 05:27 | Bronsa | pyrtsa: http://dev.clojure.org/jira/browse/CLJ-1497 if you want to watch/vote |
| 05:27 | puredanger | I'll ping Rich with that later |
| 05:27 | Bronsa | puredanger: thanks |
| 05:33 | pyrtsa | Bronsa: Thanks! |
| 06:09 | nxtvsn | hello, I need some help |
| 06:09 | nxtvsn | I write an app that handles POST requests using ring |
| 06:09 | nxtvsn | I can't understand why, but body is always empty |
| 06:10 | nxtvsn | all other things in the request are ok |
| 06:10 | nxtvsn | all except the body |
| 06:10 | nxtvsn | body is a stream, as it should be, but if I sulrp it I get an empty string |
| 06:11 | nxtvsn | I think it is possible if I have some middleware layers that process the body |
| 06:11 | nxtvsn | and empty it |
| 06:12 | nxtvsn | but I have no middleware layers at all (as far as I can understand) |
| 06:14 | nxtvsn | ok... Now I understand (I think) |
| 06:14 | nxtvsn | If I use the compojure handler I get some wrappers automatically |
| 06:14 | nxtvsn | and they remove my body |
| 06:18 | nxtvsn | thank you very much! now it works |
| 06:19 | nxtvsn | It was really the case |
| 06:21 | TEttinger | I think I have someone on ignore by mistake |
| 06:22 | TEttinger | nxtvsn, were you talking to someone just now? |
| 06:22 | Glenjamin | my ignore list is empty, so i suspect that was just thinking out loud |
| 06:23 | nxtvsn | Yes it was just thinking out loud, that it is correct :) |
| 06:47 | SagiCZ1 | nxtvsn: lol and you even thanked yourself for it.. cudos |
| 07:14 | michaelr | why 'lein javac' silently ignores the java files which I want it to compile? |
| 07:15 | michaelr | I have :java-source-paths ["src/main/java"] in project.clj |
| 07:16 | llasram` | michaelr: refheap/gist your project.clj file? |
| 07:17 | michaelr | llasram: https://www.refheap.com/89045 |
| 07:19 | llasram | That 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:21 | michaelr | let me check |
| 07:22 | michaelr | nope, don't have a target at all :) |
| 07:22 | michaelr | I've lein clean'ed |
| 07:22 | llasram | Not 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:23 | llasram | Hmm. 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:24 | llasram | er, src/main/java |
| 07:25 | michaelr | llasram: no java source files there, but they are in a deeper directory under that directory |
| 07:26 | llasram | michaelr: Sure, that's what I actually had meant to say. Hierarchy for the Java package and such |
| 07:26 | michaelr | yep |
| 07:29 | michaelr | llasram: 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:29 | michaelr | it |
| 07:30 | llasram | Oh, I thought you said it just silently did nothing |
| 07:30 | michaelr | yeah, maybe what I said was a bit misleading |
| 07:30 | michaelr | i said it silently wouldn't compile the java sources ;) |
| 07:31 | llasram | I don't see anything in your project.clj which would cause AOT compilation of Clojure though |
| 07:33 | llasram | Could you refheap a shell session starting with `lein clean` which shows what you're seeing? |
| 07:34 | michaelr | ok |
| 07:39 | michaelr | llasram: you were right, sort of |
| 07:39 | llasram | Oh? |
| 07:39 | michaelr | llasram: 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:40 | michaelr | this code was trying to load the java code which has not yet been compiled :) |
| 07:40 | llasram | Interesting |
| 07:43 | llasram | Well, at least now solved :-) |
| 07:43 | michaelr | yeah, thanks for helping |
| 07:43 | llasram | np! |
| 08:16 | clgv | does clojure.java.jdbc/update! use prepared queries automatically? |
| 08:56 | matthavener | ckrailo: should be |
| 08:56 | matthavener | oops |
| 10:03 | Bronsa | dnolen_: 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:04 | dnolen_ | Bronsa: haven't looks useful though :) |
| 10:09 | Bronsa | dnolen_: yeah, that cuts startup time by a huge amount for tools |
| 10:11 | dnolen_ | 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:11 | dnolen_ | Bronsa: would take a CLJS patch for this for sure |
| 10:12 | dnolen_ | 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:12 | Bronsa | dnolen_: ok, I'll open a ticket + patch later today |
| 10:13 | dnolen_ | likely a cycle some where or something but I haven't been able to find it yet. |
| 10:13 | Bronsa | dnolen_: note that I'm not caching the entire AST |
| 10:13 | Bronsa | only the namespace map |
| 10:13 | dnolen_ | Bronsa: yes the OOM occurred when dumping :namespaces |
| 10:13 | dnolen_ | in CLJS, probably because of sloppiness somewhere |
| 10:14 | dnolen_ | Bronsa: anyways great id, ticket + patch welcome and I can help debug it if the OOM crops up |
| 10:14 | dnolen_ | s/id/idea |
| 10:23 | michaelr | hi |
| 10:24 | michaelr | in ClojureScript is there some special treatment I should give to namespaces? |
| 10:25 | michaelr | I get WARNING: No such namespace: barcodebrasil.custom-products.utils at line 1 src\cljs\custom_products\main.cljs |
| 10:25 | michaelr | while utils.cljs sits just beside main.cljs and has the ns as mentioned in the warning above |
| 10:30 | nkoza | michaelr: try using custom-producs.utils , without "barcodebrasil" |
| 10:31 | nkoza | michaelr: note you can also ask in #clojurescript |
| 10:34 | justin_smith | michaelr: require won't work with namespaces that aren't in a path that reflects their ns declaration structure |
| 10:35 | justin_smith | src/barcodebrasil/custom_products/utils.cljs should work |
| 10:35 | justin_smith | (another possibility is if you have an error in that ns, it won't be found) |
| 10:36 | michaelr | thank guys I think you're on it :) |
| 10:50 | michaelr | In 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:55 | teslanick | Is one the sourcemap? Do you have the script tag in your document twice? |
| 10:56 | michaelr | teslanick: 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:57 | nbeloglazov | Can anyone explain difference between transducers and partially applied functions like (partial filter even?) ? |
| 10:59 | lvh | nbeloglazov: a transducer is a function that takes a reducing function and produces a new reducing function |
| 11:00 | lvh | nbeloglazov: (partial filter even?) is just a curried filter |
| 11:00 | nbeloglazov | lvh: and what is (filter even?) then? How are they different? |
| 11:01 | lvh | nbeloglazov: its (informal) signature is [a] -> [a]; the transducer's is (a -> b -> a) -> (a -> c -> a) |
| 11:01 | lvh | nbeloglazov: (partial filter even?) takes a collection and gives you a different collection |
| 11:01 | lvh | nbeloglazov: (filter even?) takes a function you can pass to reduce and gives you a different function you can pass to reduce |
| 11:02 | lvh | nbeloglazov: specifically, one that will only pass along even numbers |
| 11:04 | lvh | nbeloglazov: importantly, the reducer functions don't care about representation, or even collections |
| 11:08 | lvh | nbeloglazov: 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:09 | nbeloglazov | lvh: :( still don't get it. Need to think more |
| 11:10 | rlb | Is 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:12 | dnolen_ | nbeloglazov: in anycase one important thing is - (filter even?) is not a partially applied function |
| 11:13 | dnolen_ | nbeloglazov: if you understand types you may find this useful http://conscientiousprogrammer.com/blog/2014/08/07/understanding-cloure-transducers-through-types/ |
| 11:14 | rlb | sounds like it's just a mess -- http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http |
| 11:15 | lvh | dnolen_: aaa! quassel just reloaded your message; I was about to tell him about that blog post :) |
| 11:15 | lvh | nbeloglazov: 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:16 | lvh | nbeloglazov: filter is about "if this thing matches this predicate, keep it; otherwise, throw it away" |
| 11:16 | tbaldrid_ | lvh: right, filter "complects" filtering with lazy-seq/cons |
| 11:16 | lvh | nbeloglazov: (filter even?), the transducer form, separates this meaning from the "make a list" part |
| 11:17 | lvh | I 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:17 | lvh | (partial typing, stm, logic programming integration...) |
| 11:18 | lvh | if anyoen has any sources on "tricking your coworkers into using clojure long enough until it's too late", it'd be much appreciated ;-) |
| 11:18 | lvh | I 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:18 | llasram | Is there an existing idiom for iterating over only the realized portion of a lazy sequence? |
| 11:23 | Bronsa | (def a (iterate inc 0)) |
| 11:23 | Bronsa | ,(def a (iterate inc 0)) |
| 11:23 | clojurebot | #'sandbox/a |
| 11:23 | Bronsa | ,(take 2 a) |
| 11:23 | clojurebot | (0 1) |
| 11:23 | Bronsa | ,(realized? (rest a)) |
| 11:23 | clojurebot | true |
| 11:23 | Bronsa | ,(realized? (rest (rest a))) |
| 11:23 | clojurebot | false |
| 11:23 | Bronsa | llasram: ^ might be useful |
| 11:25 | llasram | Bronsa: Yep. I've got https://www.refheap.com/89055 |
| 11:25 | llasram | Just wondering if there was an existing better way |
| 11:25 | Bronsa | don't think so |
| 11:25 | clgv | lvh: and to someone who only sees weird brackets and claims there are too many of them ;) |
| 11:26 | clgv | *parantheses |
| 11:26 | lvh | clgv: well, similarly paredit is hard to explain to someone who hasn't used it :) |
| 11:26 | lvh | clgv: "you know how we've been talking about editors that would actually semantically edit code instead of munging bytes?" "yes" "well, that exists" |
| 11:27 | clgv | :D |
| 11:29 | puredanger | Bronsa: on that patch for 1497, I still see 3 elements get realized even after your change? |
| 11:29 | Bronsa | puredanger: yes, that fixes a different issue, one sec |
| 11:29 | puredanger | I mean I think you're in the right area for sure |
| 11:30 | Bronsa | puredanger: http://sprunge.us/WPBK |
| 11:31 | puredanger | yeah that's what I see too |
| 11:32 | puredanger | obviously would like not to see ~3 |
| 11:32 | Bronsa | yeah, I'm looking at LazyTransformer right now to see if I can figure it out |
| 11:33 | puredanger | it may be that the more() in SeqIterator needs to be deferred till hasNext() ? |
| 11:39 | nbeloglazov | lvh: 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:39 | Bronsa | puredanger: this is interesting http://sprunge.us/iGZP?clj |
| 11:40 | puredanger | :) |
| 11:54 | michaelr | hi |
| 11:56 | puredanger | hello! |
| 11:57 | michaelr | technomancy: 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:58 | michaelr | The class is imported, not required. |
| 11:59 | michaelr | The workaround was to exclude my user.clj from the source path until after I run `lein javac` and compile the java class. |
| 11:59 | Bronsa | ah I think I get it puredanger |
| 12:02 | Bronsa | puredanger: 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:02 | michaelr | technomancy: should I open an issue or I just should change my workflow somehow? |
| 12:03 | technomancy | michaelr: 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:06 | Bronsa | puredanger: I don't see any way to solve this |
| 12:09 | puredanger | Rich just pushed a fix :) |
| 12:09 | tbaldridge | https://github.com/clojure/clojure/commit/43cc1854508d655e58e377f84836ba128971f90c |
| 12:10 | Bronsa | heh, fine |
| 12:14 | Bronsa | puredanger: it still exhibits the previous behaviour on the edge case (take 0) |
| 12:15 | Bronsa | this time it happens on transduce aswell |
| 12:19 | puredanger | "(take 0) not possibly lazy with transducers - push model" - Rich |
| 12:20 | TimMc | Always the problems with the base cases. |
| 12:21 | Bronsa | ok, thanks puredanger (& Rich) |
| 12:25 | technomancy | so I totally used read-string on user data yesterday |
| 12:25 | technomancy | it was awesome |
| 12:27 | technomancy | huh, I don't get it. why is no one yelling at me? |
| 12:28 | djpowell | rlb: were you asking about encoding of filenames in headers? |
| 12:29 | lvh | technomancy: sorry |
| 12:29 | lvh | technomancy: HOW DARE YOU |
| 12:29 | lvh | technomancy: don't you know about EDN |
| 12:29 | TimMc | guards, etc. |
| 12:29 | technomancy | that's more like it |
| 12:29 | lvh | better? :) |
| 12:29 | technomancy | I assume everyone was busy getting coffee |
| 12:30 | technomancy | https://github.com/Seajure/odo/blob/master/src/odo/handler.clj |
| 12:30 | lvh | seajure? :D |
| 12:30 | technomancy | yup yup |
| 12:30 | technomancy | seattle clojure group |
| 12:30 | djpowell | rlb: check out RFC6266 for a modern guide to it |
| 12:30 | lvh | ooh |
| 12:30 | technomancy | lvh: it's a universal server |
| 12:31 | lvh | man I wish I lived in the US already (working on it) |
| 12:31 | lvh | antwerp has no clojure groups :( |
| 12:31 | lvh | oh, wait, yes it does!!! |
| 12:32 | rlb | djpowell: ok, thanks |
| 12:55 | dnolen_ | Bronsa: puredanger: corresponding fix applied to CLJS |
| 13:00 | andyf | technomancy: 3 weeks have been added to your time in Clojure purgatory. I'll see you there |
| 13:06 | mirari | Newbie here. Is clojure pure s-expressions or is there more to the syntax? |
| 13:08 | nkoza | mirari: http://clojure.org/reader |
| 13:09 | technomancy | mirari: 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:09 | mirari | I see |
| 13:17 | technomancy | probably the only exception is reader literals with their weird spacing between the tag and the actual data |
| 13:19 | hyPiRion | technomancy: and metadata perhaps? |
| 13:19 | technomancy | hyPiRion: a case could be made |
| 13:20 | puredanger | technomancy: that space is optional |
| 13:21 | technomancy | puredanger: sure, but it's an unfortunate wart in an otherwise very regular syntax |
| 13:21 | puredanger | and #_ |
| 13:21 | puredanger | etc |
| 13:23 | tjd | is 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:24 | technomancy | tjd: totally |
| 13:24 | technomancy | you just have to use resolve to get at its contents |
| 13:26 | tjd | aah... (require 'my.module) (resolve 'my.module/the-fn) |
| 13:26 | technomancy | yup yup |
| 13:26 | tjd | thanks technomancy! |
| 13:26 | tjd | works |
| 13:28 | technomancy | np |
| 13:42 | michaelr | technomancy: then maybe I can move that code from user.clj to some other namespace and specify it with :init-ns in project.clj.. |
| 13:48 | verma | hey 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:49 | verma | technomancy, I know it wouldn't restore formatting, but strings should come back out as strings right? |
| 13:53 | technomancy | verma: that is kinda weird. probably worth opening an issue over. |
| 13:54 | verma | technomancy, ok |
| 13:59 | verma | technomancy, opened: https://github.com/technomancy/leiningen/issues/1632 |
| 14:00 | lynaghk | I'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:00 | lynaghk | Does 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:01 | lynaghk | Or 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:04 | justin_smith | I 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:10 | justin_smith | ,(instance? CharSequence "hello") |
| 14:10 | clojurebot | true |
| 14:10 | justin_smith | good enough for me |
| 14:10 | pandeiro | clojure.java.jdbc newb question: why does inserting a date create an instant from the previous date @ 3:00:00 ? |
| 14:10 | justin_smith | pandeiro: your TZ config is off |
| 14:10 | pandeiro | this is a timezone issue or something i'm imagining but i can't figure out how to resolve it |
| 14:11 | pandeiro | justin_smith: so I checked (.getTimeZone (Calendar/getInstance)) |
| 14:11 | pandeiro | it has my local time zone |
| 14:11 | justin_smith | pandeiro: actually, could be a clock skew between the machine running clojure and the machine hosting the db |
| 14:11 | pandeiro | justin_smith: yeah thought of that, too |
| 14:11 | pandeiro | but this is happening with H2 (hosted locally in same process as nREPL) |
| 14:11 | justin_smith | ahh |
| 14:11 | pandeiro | and also with postgresql (local host) |
| 14:12 | justin_smith | wait, is it always inserting a time from yesterday 3:00? |
| 14:12 | pandeiro | yes! |
| 14:12 | justin_smith | ahh - but this is for a date field, right? |
| 14:12 | pandeiro | justin_smith: yes, date |
| 14:12 | pandeiro | timestamp works as expected |
| 14:13 | justin_smith | I bet it creates the earliest date in gmt that would be considered that data |
| 14:13 | justin_smith | which is 7 hours ahead of you |
| 14:13 | pandeiro | oh god |
| 14:13 | justin_smith | err.. 9 hours? |
| 14:13 | pandeiro | America/Sao_Paulo |
| 14:13 | justin_smith | sorry, brain is failing today - but it must be something like that |
| 14:13 | pandeiro | yesterday at 3AM is even more |
| 14:13 | pandeiro | i had thought of that, as well |
| 14:14 | pandeiro | but i don't think we're 21 hours behind GMT |
| 14:14 | pandeiro | but now i'm at that point, many hours later, where i don't care about the why anymore |
| 14:14 | pandeiro | i just want a fix |
| 14:14 | pandeiro | :) |
| 14:14 | pandeiro | sad but true |
| 14:16 | justin_smith | I 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:17 | pandeiro | justin_smith: ah ok |
| 14:17 | pandeiro | how does that go, exactly? |
| 14:17 | pandeiro | you convert to millis? |
| 14:19 | justin_smith | pandeiro: for time, we truncate everything bigger than hours, for date we truncate everything after days |
| 14:19 | justin_smith | since every db has a datetime |
| 14:20 | pandeiro | justin_smith: what are the java types involved? |
| 14:20 | pandeiro | java.util.Date? |
| 14:20 | clojurebot | java.util.Date is Michael Bolton |
| 14:20 | pandeiro | lol |
| 14:21 | pandeiro | i fell right into that one i guess |
| 14:21 | justin_smith | pandeiro: yeah |
| 14:21 | pandeiro | i'm wondering if my issues aren't with clj-time.coerce/to-sql-date |
| 14:21 | pandeiro | no, not it |
| 14:22 | pandeiro | (to-sql-date (from-string "2014-08-08")) ;=> #inst "2014-08-08T00:00:00.000000000-00:00" |
| 14:24 | pandeiro | justin_smith: just one more thing, on the SQL side the data type you use is timestamp? |
| 14:26 | pandeiro | k so i'm not alone here http://stackoverflow.com/questions/9202857/timezones-in-sql-date-vs-java-sql-date |
| 14:29 | justin_smith | pandeiro: yeah, timestamp on the sql side |
| 14:42 | dnolen_ | anybody else having trouble grabbing clojurescript 0.0-2307 from Maven Central? |
| 14:44 | TimMc | Should I be able to attach a Class reflection hint to an arglist? |
| 14:45 | TimMc | If 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:46 | amalloy | TimMc: hinting the arglist is for primitives |
| 14:46 | TimMc | Ah, thanks. |
| 14:46 | TimMc | (and Trix is for kids) |
| 14:46 | llasram | TimMc: I like {:tag `Foo} as the metadata map |
| 14:47 | amalloy | llasram: whaaaaat, why? |
| 14:47 | llasram | (I think I stole that from amalloy) |
| 14:47 | llasram | Or maybe not :-) |
| 14:47 | amalloy | i would have done that in a macro, so that it expands right, but not by-hand in a defn, i would think |
| 14:47 | hiredman | win 20 |
| 14:48 | pjstadig | i'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:48 | pjstadig | is there a better way to do this? |
| 14:49 | TimMc | amalloy: http://clojure.org/java_interop disagrees |
| 14:49 | TimMc | just following "the type hint can be placed before the arguments vector" |
| 14:49 | Bronsa | dnolen_: yeah here too |
| 14:51 | TimMc | amalloy: I think you've got it backwards: You can only primitive-hint on arglists. |
| 14:51 | llasram | TimMc: Isn't that what he said...? |
| 14:52 | Bronsa | you can pit whatever hint you want on the arglists |
| 14:52 | Bronsa | it just have to be fully qualified if it's a class |
| 14:52 | losingkeys | lall |
| 14:52 | losingkeys | whoops this isn't mutt >.< |
| 14:52 | Bronsa | you can put* |
| 14:52 | TimMc | Bronsa: Seems like a bug... |
| 14:52 | Bronsa | there's already a ticket for that |
| 14:52 | TimMc | :-( |
| 14:52 | Bronsa | I think. |
| 14:52 | Bronsa | let me double check |
| 14:53 | hiredman | seems like the result of someones illfated attempt to unify the primitive type hinting and the other kind |
| 14:53 | Bronsa | TimMc: http://dev.clojure.org/jira/browse/CLJ-1232 |
| 14:54 | llasram | amalloy: Got it -- the wacky evaluation rules for metadata mean that |
| 14:55 | llasram | (-> (defn ^Foo foo []) meta :tag class) => Class |
| 14:55 | amalloy | oh yeah, i remember that ticket, Bronsa |
| 14:55 | llasram | (-> (defn foo {:tag `Foo} []) meta :tag class) => Symbol |
| 14:56 | pjstadig | Bronsa: i've been bit by that before |
| 14:56 | llasram | The 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:56 | TimMc | friggin' Rich |
| 14:57 | pjstadig | https://github.com/pjstadig/nio/commit/c2dfb3911906ff2a0de0b7fc3ee40bdcd1c30de1 |
| 14:57 | TimMc | I hope he comes around on this. |
| 14:57 | Bronsa | pjstadig: 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:59 | amalloy | but 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:59 | lambdahands | Hi, 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:59 | Bronsa | amalloy: a lot of folks are putting the primitive type hint on the function name, so you get shit like :tag #<core$ints ..> |
| 15:00 | TimMc | amalloy: The behavior should be made regular either way. |
| 15:00 | Bronsa | amalloy: because people don't know that |
| 15:00 | TimMc | When you have irregular language and API features, you get PHP. |
| 15:01 | Bronsa | you just know that from experience, there's no good clear documentation on this |
| 15:03 | dnolen_ | Bronsa: hmm |
| 15:03 | lambdahands | Woops. The link didn't go through: https://www.refheap.com/89059 |
| 15:13 | tuft | is there any way to get test.check to output some additional values when a test fails? |
| 15:13 | Bronsa | dnolen_: I can get it from sonatype, maybe it hasn't hit maven central yet |
| 15:13 | tuft | just seeing the generated values isn't quite enough to readily see why the test failed... |
| 15:13 | dnolen_ | Bronsa: hrm ok |
| 15:13 | reiddraper | tuft: currently, no. Can you just apply the generated value to your function under test though? |
| 15:14 | akurilin | Stupid 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:14 | tuft | reiddraper: 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:14 | akurilin | I could chain both, maybe? |
| 15:15 | tuft | reiddraper: one idea i had was to be able to mix generator and regular let bindings in the first argument to for-all |
| 15:15 | reiddraper | tuft: 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:16 | reiddraper | tuft: because as you're running into, you otherwise can't 'get at' that code without running a test |
| 15:17 | reiddraper | tuft: more concretely, i would put your `let` stuff into a function with its own name |
| 15:17 | tuft | reiddraper: ah ok, so pass the generated values to a function that calls the function under test and returns a boolean |
| 15:17 | reiddraper | tuft: exactly |
| 15:18 | reiddraper | tuft: fwiw, what you're asking for is reasonable, and is in some other quickcheck implementations, but just not test.check yet |
| 15:18 | reiddraper | tuft: but this is an easy way around it |
| 15:18 | tuft | reiddraper: indeed, should work fine, thanks =) |
| 15:18 | reiddraper | np |
| 15:19 | tuft | reiddraper: great lib btw. i'm really starting to get the hang of it, and found my first non-trivial bug recently |
| 15:19 | reiddraper | tuft: happy to hear! |
| 15:26 | TimMc | reiddraper: I found test.check really nice to work with, by the way. |
| 15:30 | pandeiro | anyone using liberator and clj-time together have a serialization strategy to recommend? |
| 15:41 | reiddraper | TimMc: thanks! |
| 15:47 | PigDude | what is the practical difference between a function returning a reified protocol, and a named implementation of the protocol? |
| 15:47 | PigDude | mainly, are they equally efficient? |
| 15:50 | amalloy | they're the same |
| 15:50 | PigDude | thanks, i find myself defining records that only get created by factory functions |
| 16:11 | verma | I 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:12 | verma | should just basically purge my local repo? |
| 16:12 | verma | still no go |
| 16:12 | verma | same error |
| 16:13 | verma | technomancy, any ideas ^ ? |
| 16:16 | PigDude | would the atoms contained in an atomic collection be updatleabe independently of the collection itself? |
| 16:16 | PigDude | would seem to be the case |
| 16:17 | TEttinger | PigDude, yes |
| 16:17 | PigDude | thanks TEttinger |
| 16:17 | TEttinger | also atoms contained in a non-atom collection IIRC |
| 16:17 | TEttinger | ,(def stuff [(atom 0) (atom 10)]) |
| 16:17 | clojurebot | #'sandbox/stuff |
| 16:18 | amalloy | PigDude: 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:18 | PigDude | amalloy: this is for a caching structure |
| 16:18 | amalloy | like, swap! works because you can freely abandon an update and retry |
| 16:18 | PigDude | (a collection of caches, so there is an expectation of mutability) |
| 16:18 | TEttinger | hm, nvm it does need to be mutable to store changes |
| 16:19 | amalloy | but if your swap! function might swap! other things, then retries are "dangerous" |
| 16:19 | amalloy | PigDude: so? you can just have one atom at the top, containing a number of caches, and swap! on it |
| 16:19 | PigDude | amalloy: that is the idea, the structures would never beupdated together |
| 16:28 | sdegutis | When should you use Clojure for a web app rather than Rails? |
| 16:28 | sdegutis | In this case, a really dead-simple web-store app. |
| 16:29 | mgaare | That's kind of a personal question |
| 16:43 | pandeiro | is 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:43 | pandeiro | maybe i should take this to #clojure-emacs |
| 16:44 | verma | how come there's a #clojure-emacs and no #clojure-vim :( |
| 16:44 | amalloy | is there really a #clojure-emacs? i can't believe that needs to exist |
| 16:44 | TimMc | #clojure-ed |
| 16:44 | TimMc | make it happen |
| 16:44 | amalloy | #clojure-grep |
| 16:45 | pandeiro | amalloy: now that there are clojure packages especially for emacs, maybe it does |
| 16:45 | pandeiro | i mean, nrepl middleware |
| 16:45 | Glenjamin | i'm not entirely convinced #clojurescript even needs to exist |
| 16:46 | amalloy | there 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:46 | Glenjamin | since there's probably as many cljs questions in here than there |
| 16:46 | technomancy | Glenjamin: I'd be down with fewer cljs questions in here |
| 16:46 | Glenjamin | the channel exists, i guess it's a docs problem at that point |
| 16:46 | hiredman | maybe #clojure-emacs is for people who are offended by the near constant complaining about cider in #clojure |
| 16:47 | hiredman | btw, cider ugh |
| 16:47 | clojurebot | Excuse me? |
| 16:47 | amalloy | hiredman: wouldn't it be the opposite? like we'd make a #clojure-not-cider channel as a refuge |
| 16:47 | S3thc0n | Hello, 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:48 | hiredman | amalloy: check it out and see |
| 16:48 | pandeiro | hiredman: do you not use cider? |
| 16:48 | verma | S3thc0n, pmap |
| 16:49 | Glenjamin | S3thc0n: there's immutable-int-map, which can efficiently reducer-fold on maps |
| 16:49 | S3thc0n | Oh sorry, I meant the data structure itself, not the function. ./ |
| 16:50 | amalloy | i think hiredman uses nrepl |
| 16:50 | verma | S3thc0n, a map of atoms then? |
| 16:50 | verma | S3thc0n, what the use case like? |
| 16:50 | verma | s/what/whats |
| 16:50 | Glenjamin | there 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:52 | S3thc0n | I 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:54 | Glenjamin | core.reducers' fold might be helpful in that case |
| 16:59 | verma | S3thc0n, 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:00 | Glenjamin | it depends if you're doing them all at once, or random-access continuously |
| 17:00 | Glenjamin | the if the latter, a core.async-backed queue with multiple consumers swap! ing an atom might be a reasonable approach |
| 17:04 | sdegutis | Not 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:05 | Glenjamin | it exists, it just doesn't get much traffic compared to cljs Qs in here |
| 17:05 | mdeboard | Is there a "Building web applications with om" book planned, anyone know? |
| 17:06 | mdeboard | I 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:14 | jose_leeto | hello guys |
| 17:14 | mdeboard | hi |
| 17:14 | jose_leeto | I am a rails guy getting start with clojure |
| 17:15 | jose_leeto | what kind of project you definitely start with clojure? |
| 17:15 | mdeboard | cool |
| 17:15 | mdeboard | jose_leeto: You could re-implement a smallish Rails app in Clojure |
| 17:16 | jose_leeto | that sounds good |
| 17:16 | mdeboard | jose_leeto: Are you familiar with functional programming at all? Any lisps etc? |
| 17:16 | jose_leeto | but clojure is good in what occasion? |
| 17:16 | jose_leeto | no |
| 17:17 | jose_leeto | I choose clojure for start with function prog too |
| 17:17 | jose_leeto | I wish I had not a bad choice |
| 17:18 | mdeboard | Clojure 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:18 | mdeboard | That book does a v good job of explaining Clojure in-depth. |
| 17:19 | jose_leeto | well I will check that book |
| 17:19 | mdeboard | jose_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:19 | mdeboard | it's a functional programming language as well |
| 17:19 | mdeboard | it's not as mature or stable as Clojure, though. |
| 17:20 | jose_leeto | I hear about that josevalim project |
| 17:20 | mdeboard | Yes! |
| 17:20 | jose_leeto | there is a reason to choose clojure over erlang? |
| 17:21 | rweir | jvm interoperability, lots of subjective factors, more varied concurrency models |
| 17:21 | mdeboard | nailed it |
| 17:21 | jose_leeto | jvm is a good point |
| 17:22 | technomancy | erlang is not a general-purpose language |
| 17:22 | hiredman | say you want a string instead of a list of integers |
| 17:22 | mdeboard | jose_leeto: clojure is very, very good language. It's worth investing time to learn it. |
| 17:22 | technomancy | it's really good at network servers and not much else |
| 17:22 | mdeboard | I only mention elixir because it might look more familiar to you at first (which is like the least important factor) |
| 17:22 | mdeboard | technomancy: That's my impression, I don't understand why you'd make web apps with it tbh |
| 17:22 | jose_leeto | I get your point |
| 17:23 | jose_leeto | tbh? |
| 17:23 | mdeboard | jose_leeto: Grab that book and read it and work through exercises and what have you. |
| 17:23 | technomancy | I 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:23 | mdeboard | "to be honest" |
| 17:23 | jose_leeto | : |
| 17:23 | mdeboard | technomancy: it's not, it's just less intimidating at first |
| 17:23 | jose_leeto | :) |
| 17:23 | mdeboard | technomancy: but that "benefit" loses value like an hour in to learning |
| 17:24 | jose_leeto | clojurescript excite me to learn clojure to |
| 17:25 | mdeboard | jose_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:25 | jose_leeto | humm |
| 17:25 | mdeboard | i'd recommend those two |
| 17:25 | jose_leeto | I like the pragprog books |
| 17:26 | mdeboard | Clojure Programming is really good, written by very smart people |
| 17:26 | mdeboard | It's very "readable" . facil a leer cubre a cubre |
| 17:27 | mdeboard | so don't dismiss it just because it's oreilly :P |
| 17:28 | jose_leeto | hahahaha ok |
| 17:28 | rweir | i quite liked those two books, too, as well as joy of clojure |
| 17:54 | ambrosebs | ,(sequence (comp (map prn) (map inc)) [0 1 2]) |
| 17:54 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 17:54 | ambrosebs | ,(doc sequence) |
| 17:54 | clojurebot | "([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:56 | Bronsa | ambrosebs: transducers compose in reverse order |
| 17:56 | ambrosebs | ,(sequence (comp (map (fn [a] (prn "left" a) a) (map (fn [a] (prn "left" a) a))) [0 1 2]) |
| 17:56 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 17:56 | Bronsa | ,(sequence (comp (map inc) (map prn)) [1 2 0]) |
| 17:56 | clojurebot | (2\n3\nnil 1\nnil nil) |
| 17:56 | ambrosebs | Bronsa: yes I was trying to convince myself of that |
| 17:56 | DomKM | ,(contains? (transient {:k :v}) :k) |
| 17:56 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentArrayMap$TransientArrayMap> |
| 17:56 | ambrosebs | Bronsa: mind slightly blown |
| 17:56 | Bronsa | ambrosebs: that's confusing for me too |
| 17:56 | DomKM | Is there a way to check if a key is in a transient coll? |
| 17:57 | ambrosebs | I didn't realise until Mark Engelberg's post on the clojure ml |
| 17:57 | ambrosebs | obviously comp works in the reverse order right? no :) |
| 17:57 | ambrosebs | goes without saying |
| 17:57 | hiredman | ambrosebs: how do you convey that in a type signature :P |
| 17:58 | Bronsa | ambrosebs: I never realized how used I got to read right to left within comp |
| 17:58 | ambrosebs | hiredman: .. |
| 18:01 | amalloy | DomKM: yes, there's something in ITransientVector or ITransientMap |
| 18:02 | Bronsa | amalloy: check if a key is IN a transient coll? how'd you do that? |
| 18:03 | DomKM | amalloy: I just used get with a unique not-found val |
| 18:03 | DomKM | amalloy: looks like contains? been broken for years http://dev.clojure.org/jira/browse/CLJ-700 |
| 18:03 | Bronsa | ah, I read that backwards nevermind |
| 18:03 | DomKM | reported in jan 2011 |
| 18:03 | amalloy | Bronsa: ITransientSet/contains |
| 18:04 | amalloy | DomKM: 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:04 | amalloy | it's a weird quirk that get works for both; most things don't |
| 18:07 | DomKM | amalloy: Do you know if it exists in cljs? I'm not seeing it |
| 18:08 | amalloy | it doesn't look like it does, DomKM |
| 18:08 | ambrosebs | hiredman: core.typed can't express the general type for comp anyway. |
| 18:08 | DomKM | amalloy: oh well, thanks anyway |
| 18:08 | amalloy | oh, nm |
| 18:08 | amalloy | DomKM: in cljs it's just the usual ILookup protocol |
| 18:09 | amalloy | which is what cljs.core/get uses |
| 18:09 | DomKM | amalloy: sweet, thanks |
| 18:09 | amalloy | so contains? should be just fine in cljs |
| 18:10 | hiredman | ambrosebs: 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:12 | ambrosebs | hiredman: hehe |
| 18:14 | ambrosebs | I'm certainly going to figure out how to type check transducers before I use them, cos that's how I roll |
| 18:16 | ambrosebs | the type checker could catch the reverse comp stuff with < 5 args to comp (those are hardcoded) |
| 18:16 | lpvb | how do I get a readable string of PersistentQueue |
| 18:17 | lpvb | ,(.toString (conj clojure.lang.PersistentQueue/EMPTY 3)) |
| 18:17 | clojurebot | "clojure.lang.PersistentQueue@22" |
| 18:17 | ambrosebs | but agreed, the types by themselves don't reveal much |
| 18:17 | amalloy | ,(pr-str (conj clojure.lang.PersistentQueue/EMPTY 0)) |
| 18:17 | clojurebot | "#<PersistentQueue clojure.lang.PersistentQueue@1f>" |
| 18:17 | amalloy | ,(pr-str (seq (conj clojure.lang.PersistentQueue/EMPTY 0))) |
| 18:17 | clojurebot | "(0)" |
| 18:19 | ambrosebs | quite amusing rich didn't highlight the comp semantics |
| 18:20 | ambrosebs | perhaps this is why it takes years to absorb his blog posts :) |
| 18:20 | ambrosebs | they just keep on givin |
| 18:21 | lpvb | (inc ammaloy) ; thanks |
| 18:21 | lazybot | ⇒ 1 |
| 18:21 | lpvb | wow |
| 18:21 | lpvb | (inc amalloy) ; thanks |
| 18:21 | lazybot | ⇒ 155 |
| 18:21 | amalloy | (dec ammaloy) ; can't stand impostors |
| 18:21 | lazybot | ⇒ 0 |
| 18:21 | Bronsa | (inc amalloy) ; thanks) |
| 18:21 | lazybot | ⇒ 1 |
| 18:21 | amalloy | (dec amalloy ) |
| 18:21 | lazybot | ⇒ 4 |
| 18:22 | lpvb | (inc lpvb) #_(dec lpvb) |
| 18:22 | lazybot | ⇒ 1 |
| 18:22 | lpvb | (dec lpvb) |
| 18:22 | lazybot | You can't adjust your own karma. |
| 18:22 | lpvb | what |
| 18:22 | amalloy | you inc'd the guy named lpvb) #_(dec lpvb |
| 18:22 | Bronsa | (dec lpvb) #_(dec lpvb) |
| 18:22 | lpvb | (inc lpvb) |
| 18:22 | lazybot | ⇒ 0 |
| 18:22 | lazybot | You can't adjust your own karma. |
| 18:22 | lpvb | (inc lpvb) #_(dec lpvb) |
| 18:22 | lazybot | You want me to leave karma the same? Fine, I will. |
| 18:23 | lpvb | amalloy: oh |
| 18:28 | PigDude | how do i set a key in a map only if the key is unset? |
| 18:28 | amalloy | &(doc update-in) |
| 18:28 | lazybot | ⇒ "([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:29 | PigDude | i don't want to return a new map though if the existing one does not need change |
| 18:29 | PigDude | ah i guess clojure is smart about how it manages its memory in that regard |
| 18:29 | amalloy | PigDude: can you think of a good reason why you'd care? |
| 18:29 | PigDude | thanks amalloy, i was uneasy about using update-in |
| 18:30 | PigDude | well 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:30 | PigDude | in this case, only setting a key on a map (which is an atom) if it is usnet |
| 18:30 | PigDude | usenet! |
| 18:33 | PigDude | i guess i didn't want there to be contention on the atom if the map doesn't need to change |
| 18:34 | PigDude | does that make sense at all? |
| 18:35 | akhudek | hmm, 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:35 | akhudek | not sure why this would make a difference |
| 19:48 | verma | man it sucks that string/split and string/join have different order for splitter/separator |
| 19:49 | verma | ,(-> 10 inc) |
| 19:49 | clojurebot | 11 |
| 19:49 | verma | ,(-> 10 #(inc %)) |
| 19:49 | clojurebot | #<CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.ISeq, compiling:(NO_SOURCE_PATH:0:0)> |
| 19:50 | verma | ,(type inc) |
| 19:50 | clojurebot | clojure.core$inc |
| 19:50 | verma | ,(ifn? inc) |
| 19:50 | clojurebot | true |
| 19:50 | hiredman | ,#(inc %) |
| 19:50 | clojurebot | #<sandbox$eval123$fn__124 sandbox$eval123$fn__124@7dccc2> |
| 19:50 | verma | ,(ifn? #(inc %)) |
| 19:50 | clojurebot | true |
| 19:50 | hiredman | ,'#(inc %) |
| 19:50 | clojurebot | (fn* [p1__176#] (inc p1__176#)) |
| 19:51 | hiredman | ,(macroexpand '(-> 10 (fn* [p1__176#] (inc p1__176#)))) |
| 19:51 | clojurebot | (fn* 10 [p1__176#] (inc p1__176#)) |
| 19:51 | hiredman | ^- |
| 19:52 | verma | dafuq |
| 19:52 | verma | :) |
| 19:52 | verma | thanks hiredman |
| 19:57 | hyPiRion | That's the trick I use when I want to do multiarg swearjure. |
| 19:59 | hyPiRion | ,((-> [! $] #(+ (*) (* ! $))) (+ (*) (*)) (#(* % % %) (+ (*) (*)))) |
| 19:59 | clojurebot | 17 |
| 20:02 | gfredericks | thinking of writing a higher-order-generator for test.check that lets you provide extra ways to shrink things |
| 20:03 | amalloy | that's amazing, hyPiRion |
| 20:03 | gfredericks | I'm not sure it is easy though |
| 20:14 | rberdeen | why might leiningen include dependencies' classes when running `lein jar`? |
| 20:16 | hiredman | aot compilation is transitive |
| 20:20 | rberdeen | hiredman: 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:20 | rberdeen | it only seems to depend on the state of the target/ directly |
| 20:20 | rberdeen | s/directly/directory/ |
| 20:23 | xeqi | Bronsa: is there a clojure that implements eval based on tools.reader ? |
| 20:23 | xeqi | Bronsa: ack, tools.analyzer |
| 20:24 | Bronsa | xeqi: there's tools.emitter.jvm/eval |
| 20:25 | xeqi | oooh, thans |
| 20:25 | xeqi | thanks |
| 20:58 | SeaK | Quick question. Why does (count '()) == 0, but lst = () then (count '(lst)) == 1? |
| 20:59 | SeaK | Am I going crazy or missing something basic? If so, a link would be appreciated! |
| 20:59 | rhg135_ | a lst is an item |
| 21:02 | ToBeReplaced | SeaK: you are counting a list containing the symbol lst, not lst |
| 21:02 | SeaK | mmm. 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:02 | ToBeReplaced | ,(let [lst '()] (count lst)) |
| 21:02 | clojurebot | 0 |
| 21:03 | SeaK | I see. So really, I just needed count lst |
| 21:04 | amalloy | SeaK: you are misunderstanding quoting, and how to create lists |
| 21:04 | ToBeReplaced | SeaK: 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:04 | amalloy | ,(let [lst '(1 2 3)] '(lst)) doesn't return ((1 2 3)), it returns (lst) |
| 21:04 | clojurebot | (lst) |
| 21:07 | SeaK | Thanks 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:10 | amalloy | don't worry about evaluation. you can pass objects around all you want, without re-evaluating them |
| 21:11 | SeaK | I 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:14 | SeaK | *al |
| 21:20 | SeaK | Finished 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:23 | gfredericks | SeaK: I recommend you post some code and people can look for themselves before committing to commenting ;-) |
| 21:25 | SeaK | Sure, 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:25 | itruslove_ | 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:34 | gfredericks | SeaK: (is-sorted? [1 1]) |
| 21:35 | SeaK | You got me! |
| 21:38 | gfredericks | SeaK: also your first two cases can be combined |
| 21:39 | SeaK | I see, by using 'or'. |
| 21:40 | SeaK | Appreciate 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:44 | gfredericks | SeaK: not even `or` |
| 21:44 | gfredericks | I mean by checking that the length is <= 1 |
| 21:45 | SeaK | '<' or '==' haha. But yes, you've improved it yet again! Looks like I have a long way to go. Many thanks, gfredericks |
| 23:00 | mdeboard | I 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:00 | mdeboard | I clearly have cider-nrepl 0.8.0-SNAPSHOT installed, which is what it's directing me to install |
| 23:00 | mdeboard | idgi |
| 23:02 | Jaood | mdeboard: how did you install cider-nrepl? |
| 23:02 | mdeboard | it's part of project.clj |
| 23:03 | Jaood | mdeboard: and you are sure lein installed it? |
| 23:04 | mdeboard | No, I assumed it did, but maybe it didn't |
| 23:04 | mdeboard | I mean the message in the REPL says it's there |
| 23:04 | Jaood | mdeboard: it should had thrown some error |
| 23:05 | mdeboard | Oh, there's no error, no |
| 23:05 | mdeboard | I mean when I just had 0.7.0, it said "cider-nrepl 0.8.0-SNAPSHOT not installed" on the top line |
| 23:05 | mdeboard | now, it doesn't |
| 23:05 | Jaood | a cider-nrepl 0.8.0-SNAPSHOT package doesn't exist yet |
| 23:06 | mdeboard | I have one installed in ~/.m2/repository/cider/cider-nrepl |
| 23:07 | Jaood | oh it does exist, is in clojars |
| 23:07 | clojurebot | Ik begrijp |
| 23:09 | justin_smith | ~oh it does exist, |
| 23:09 | clojurebot | oh it does exist, is in clojars |
| 23:14 | Jaood | mdeboard: 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:17 | Jaood | mdeboard: resintall cider |
| 23:18 | Jaood | latest cider |
| 23:23 | Jaood | clojars doesn't show the most recent version when searching https://clojars.org/search?q=cider-nrepl |
| 23:24 | Jaood | those search results are awful, are they suppose to be responsive? |
| 23:30 | justin_smith | Jaood: how about lein search? |
| 23:31 | justin_smith | I heard there was some issue with the indexing on clojars, maybe it is still somewhat defunct? |
| 23:34 | Jaood | justin_smith: yeah, lein search is nice |
| 23:38 | Jaood | justin_smith: lein search downloads the whole index everytime is changed? |
| 23:38 | technomancy | Jaood: no, it downloads incremental indices |
| 23:41 | Jaood | technomancy: oh, apparently I never searched anything on maven, wondering why it was taking so long :) |
| 23:49 | Jaood | technomancy: when you run lein deps for example, does lein has to check in which of both repositories the package is in? |
| 23:54 | technomancy | Jaood: if you've never fetched it, it checks both, yeah. |
| 23:57 | Jaood | technomancy: so both repos are paying a bandwidth tax, I guess is not much |