2015-08-04
| 02:04 | lxsameer | folks, is the any good clojure podcast aroudn? |
| 02:18 | lambda-smith | Hmmm... so you can use bigint to "cast" a string to a number. |
| 02:18 | lambda-smith | Any reasons why I wouldn't want to use bigint? |
| 02:40 | oddcully | lambda-smith: if you don't want a BigInteger maybe? |
| 03:06 | arrdem | As of 1.8 Clojure supports ^int? is ^float also supported? |
| 03:15 | amalloy | what do you mean, supports ^int? |
| 03:19 | arrdem | nevermind |
| 03:19 | arrdem | someone on the mailing list seems to have been silly |
| 03:57 | tgoossens | Anyone experience with Clojure+gradle (clojuresque). It seems to be unmaintained? |
| 05:24 | gko | Question regarding defmulti/method vs CLOS eql dispatch: how do I define a defmulti that has 4 parameters and create methods for combinations of 1, 2, 3 or even 4 parameters, without blowing up defmulti dispatch-fn? For example, I could have a call (my-method v1 v2 v3 v4) and have an actual method for v1 = :x and v3 = :y and the values of v2 and v4 would be irrelevant, and another actual method for v1 = :z and v2, v3 and v4 |
| 05:24 | gko | irrelevant. All other combinations would call the default. |
| 05:40 | quoB1phe | gko: well, you can implement any logic you want in the dispatch function. It's all up to you. |
| 06:50 | Olajyd | Anyone using clojure with apache spark |
| 06:51 | tslocke | Can someone explain why this is nil? — (meta ^:a 'a) |
| 07:03 | hyPiRion | tslocke: 'a is expanded to (quote a). What would (meta ^:a (quote a)) return? |
| 07:04 | tslocke | hyPiRion: OK got that, what about (meta (first '[^:a a])) |
| 07:08 | hyPiRion | Mm. That's like (meta '^:a a), which is equivalent to (meta (quote ^:a a)) |
| 07:09 | hyPiRion | The metadata is attached to the symbol, and since it's not resolved/evaluated, it's kept on the symbol itself. |
| 07:09 | hyPiRion | compare this to (let [a {}] (meta ^:a a)), which will return nil because a is evaluated |
| 07:16 | michel_slm | is clojurescript.net broken at the moment? |
| 07:16 | tslocke | The best example is (quote ^:a a) — I don’t understand why the returned symbol has no metadata on it |
| 07:17 | quoB1phe | michel_slm: looks like it is |
| 07:24 | hyPiRion | tslocke: but it does |
| 07:24 | hyPiRion | ,(meta (quote ^:a a)) |
| 07:24 | clojurebot | {:a true} |
| 07:26 | tslocke | hyPiRion: looks like a clojurescript issue - evals to nil in clojurescript |
| 07:27 | tslocke | although I’m not on 1.7 so could well be fixed |
| 07:29 | hyPiRion | oh |
| 07:44 | blackbird_ | if I need to generate a string key for clojure data structures, is the best way (str (hash coll))? |
| 07:47 | Jickelsen | What would be a good approach to scrape javascript-based sites? Could i.e. Enfocus handle this or would I need to use something like PhantomJS? |
| 08:00 | ebzzry | Why is it that after a spit to *out* I can no longer print to *out*? |
| 08:02 | Bronsa | ebzzry: maybe you need to flush the stream? |
| 08:03 | ebzzry | Bronsa: (flush) doesn't work though. |
| 08:07 | Bronsa | ebzzry: what error are you getting? |
| 08:08 | ebzzry | Bronsa: I don't get any errors. I just can't get print to *out* anymore: (spit *out* "") (print "foo") |
| 08:10 | Bronsa | ebzzry: ah, spit closes the out stream |
| 08:10 | ebzzry | Bronsa: ok |
| 10:03 | justin_smith | gko: about your defmulti question - you can have a dispatch function with multiple arities, or varargs (or even a mixture of the two) |
| 10:03 | IceD^ | got strange issue |
| 10:04 | IceD^ | let's say I got function foo/migrate. When I run it from repl - it executes instantly. When I run it with lein run -m foo/migrate - it still executes instantly (plus lein start time) and hangs for like 20-30 seconds afterwards (lein still running, nothing else happens) |
| 10:05 | justin_smith | IceD^: does migrate use futures or agents? |
| 10:05 | IceD^ | no idea. it's drift this time |
| 10:05 | justin_smith | IceD^: if so, you may need to call shutdown-agents |
| 10:05 | IceD^ | let me try |
| 10:06 | justin_smith | IceD^: if futures or agents are used, clojure won't exit immediately unless you explicitly shut down the thread pool |
| 10:06 | IceD^ | yeah, that's it |
| 10:07 | justin_smith | of course be sure all the other threads are done... :) |
| 10:07 | IceD^ | and it's probably nomad |
| 10:07 | IceD^ | you are helping me 3rd time now and giving right answers immideatly :) |
| 10:08 | justin_smith | glad I could help |
| 10:08 | oddcully | (inc justin_smith) |
| 10:08 | lazybot | ⇒ 283 |
| 10:08 | justin_smith | (identity amalloy) |
| 10:08 | lazybot | amalloy has karma 288. |
| 10:09 | clojurebot | It's greek to me. |
| 10:09 | justin_smith | catching up... |
| 10:10 | IceD^ | just in case - fighting to replace legacy erlang projects (which will be rewritten in any case) with clojure ;] |
| 10:10 | justin_smith | interesting |
| 10:11 | IceD^ | have had more than enough of erlang for quite few lifetimes |
| 10:11 | justin_smith | clojure has a few different concurrency models to choose from, but none of them are quite like erlang |
| 10:11 | IceD^ | at least clojure got strings ;) |
| 10:11 | justin_smith | heh |
| 10:15 | IceD^ | and tooling (thanks to technomancy) |
| 10:35 | dstockton | is there a semantic difference in defining protocol methods and implementations begining with - |
| 10:37 | justin_smith | dstockton: - is the default prefix used by gen-class, protocol methods are special even without gen-class |
| 10:37 | dstockton | aha, so thats why i can't seem to access this method outside the namespace it's in? |
| 10:37 | dstockton | i get method not implemented |
| 10:37 | dstockton | 'no implementation of method' |
| 10:39 | justin_smith | dstockton: how are you invoking it, and what is the definition? |
| 10:41 | dstockton | (defprotocol Search (search [coll pattern])) and (defrecord Obj [] Search (search [coll pattern] ... in a db namespace |
| 10:41 | justin_smith | common mistakes include not requiring the namespace that defines the protocol, and trying to use the protocol function without first ensuring it is in scope (protocol function scope is like regular scope), and forgetting that the first argument is always "this" |
| 10:41 | dstockton | and then (db/search (Obj.) pattern) in another |
| 10:41 | justin_smith | hmm |
| 10:42 | dstockton | justin_smith: i lied, its not (Obj.) |
| 10:42 | dstockton | and i think what im using there is not an instance of the record |
| 10:42 | justin_smith | dstockton: well that would do it :) |
| 10:42 | dstockton | yeah, i think i can sort it out, was just checking i wasn't missing something basic |
| 10:42 | justin_smith | dstockton: perhaps you wanted (search Obj coll pattern) |
| 10:43 | justin_smith | just a wild guess |
| 10:43 | dstockton | regarding the - prefix, this is something i'd want if i needed java interop? |
| 10:43 | justin_smith | exactly, it's for making methods that are directly callable from java |
| 10:43 | dstockton | ok, got it |
| 10:43 | dstockton | thanks! |
| 10:43 | justin_smith | eg. to implement the methods jsvc looks for in a jar |
| 10:44 | justin_smith | which reminds me, why must jsvc log handling be so garbage :( |
| 10:48 | sdegutis | What are some testing library options like Specl? |
| 10:48 | sdegutis | Better yet, what are the best testing libraries for Clojure? |
| 10:49 | sdegutis | Speclj has become unusable for me due to https://github.com/slagyr/speclj/issues/109 which was closed by the author as Can't Reproduce. |
| 10:51 | blkcat | good morning #clojure |
| 10:55 | justin_smith | good morning, blkcat |
| 11:14 | sdegutis | I'm back. |
| 11:14 | sdegutis | What are the best Clojure testing libraries of 2015? |
| 11:17 | zerokarmaleft | I'm partial to expectations, but ymmv |
| 11:33 | sdegutis | zerokarmaleft: thanks |
| 11:59 | sdegutis | These days I'm seeing less and less advantage of Clojure over just ES6 + Immutable.js on Io.js |
| 12:00 | tcrayford____ | integers |
| 12:00 | sdegutis | Overrated. |
| 12:16 | sdegutis | I can't think of a single thing I would miss. |
| 12:16 | sdegutis | I was going to say ->> but that's already naturally present in JS using the dot operator. |
| 12:20 | zerokarmaleft | the JS community has co-opted a lot of good ideas from Clojure, and that's good for everyone |
| 12:27 | sdegutis | I have to agree with zerokarmaleft here. |
| 12:27 | sdegutis | tcrayford____: seriously though, the nature of JS's floating point doesn't affect the vast majority of numbers that we actually encounter in real life code. |
| 12:28 | tcrayford____ | sorry I responded earlier. Not interested in this discussion, and especially not in this place. |
| 12:28 | sdegutis | :) |
| 12:28 | tcrayford____ | s/not interested/not taking part/ |
| 12:31 | sdegutis | :D |
| 12:39 | talvdav | i use ccw with eclipse, and i can't use AltGr+Q to type an @ |
| 12:40 | talvdav | anyone knows about this? |
| 12:40 | talvdav | checked keybindings |
| 12:40 | talvdav | there is nothing bind to Altgr+q and there was only one binding to ctrl+alt+q |
| 12:40 | talvdav | wich i unbound |
| 12:40 | talvdav | but nothing |
| 12:44 | talvdav | without plugin everything works |
| 13:00 | schaueho | I'm looking into core.async pipelines currently and have a seemingly simple question. |
| 13:00 | schaueho | when would you use pipeline-blocking vs. pipeline-async? |
| 13:01 | schaueho | My current use case would be fetching html -- I can go either way, but it's not clear to me why I would chose the one or the other |
| 13:08 | puredanger | pipeline-async is for when you expect to be called back from another system |
| 13:08 | puredanger | another piece of code that is |
| 13:09 | puredanger | so the case where you're sending a callback off to someone else |
| 13:09 | puredanger | otherwise, if you know when your operation has been completed, use -blocking |
| 13:13 | schaueho | I'm using clj-http currently to fetch HTML, so no callbacks involved. |
| 13:13 | schaueho | sounds like -blocking would be the way to go. |
| 13:14 | schaueho | I guess using http-kit/get would be a use-case for -async then (haven't looked at it in detail). |
| 13:15 | schaueho | @puredanger thx for the explanation |
| 13:17 | puredanger | with -async, the function you give pipeline should never put onto the queue - that can cause a deadlock, particularly in an expanding transducer case like mapcat |
| 13:22 | kwladyka_ | how often do you have trace missing? I have almost all the time when i am writing something... it doesnt help :/ |
| 13:23 | expez | kwladyka_: you can turn that off by setting some jvm setting. Leiningen sets this option by default for most users, though... |
| 13:24 | {blake} | kwladyka: Well, more than I'd like. |
| 13:24 | kwladyka | expez, but i want better error message then trace missing, it doesnt help |
| 13:24 | kwladyka | {blake}, oh i thought maybe it is only my problem... |
| 13:25 | expez | kwladyka: you can turn off the optimization option which optimizes away the information necessary for the stacktrace to remain, is what I meant |
| 13:25 | {blake} | kwladyka: No, I'll get it a couple of times a week. Down from several times daily when I started. |
| 13:26 | afairy | (defmacro [f & args] (apply ~f (concat args "foo")) <- what is the way to make args appear as quoted list in the macro expansion (so that concat works) |
| 13:27 | {blake} | It usually means (at least when I get it) that I've got a nil I'm trying to do something with. |
| 13:28 | afairy | I suppose (quote ~args) works. |
| 13:35 | amalloy | afairy: that should either be (defmacro foo [f & args] (~f ~@(concat args ["foo"]))) or, more likely, (defn foo [f & args] (apply f (concat args ["foo"]))) |
| 13:39 | afairy | amalloy, the real macro has core.async <! in it, here it is: https://www.refheap.com/107541 |
| 13:39 | afairy | the ugly thing is the captures, but it has to work for clojurescript... |
| 13:40 | afairy | <? is <! with a check for Error/Throwable. |
| 13:56 | ripvanwinkle | Quick question: Need to store many items with tags for fast recall & search, but tag each item & then call all that match a tag. Is map the right choice here - i.e. def x { :data "This is a sentence" :speaker "John Howard" :index 27234 } ? |
| 14:00 | hiredman | clojure.set/index |
| 14:00 | hiredman | amalloy_: bruncol needs the boot |
| 14:03 | ripvanwinkle | @hiredman - thanks |
| 15:00 | gfredericks | how do I make a tuple schema (w/ prismatic)? I could've swore it was [Foo Bar] |
| 15:00 | gfredericks | I won't swear it anymore though because apparently it doesn't work |
| 15:02 | gfredericks | oh I see it has pair, which can work, but seems odd it only has that o_O |
| 15:02 | gfredericks | maybe they think large tuples are smelly |
| 15:13 | amalloy | gfredericks: obviously (reduce pair [int int int int]) |
| 15:14 | gfredericks | it's what john mccarthy would have wanted |
| 15:33 | scpike | Is deploying a clojure web service as a linux service that just runs `java -jar uberjar.jar` a normal thing to do? (I come from ruby-land where it's much more involved) |
| 15:35 | stuartsierra | scpike: yes, that is common. |
| 15:36 | amalloy | scpike: it's not the most sophisticated way to do things, but it's fine for most purposes |
| 15:36 | stuartsierra | Depending on your requirements, you may want additional tools to handle failure, restart, monitoring, etc. |
| 15:36 | wasamasa | out of interest, what would be the most sophisticated way? |
| 15:37 | amalloy | i dunno, there are a lot of features you can add on top of that depending what you want. you can put multiple services into the same container, for example |
| 15:38 | amalloy | that is the least sophisticated way |
| 15:39 | scpike | awesome, thanks |
| 15:40 | wasamasa | I disagree |
| 15:40 | wasamasa | here's the least sophisticated way: http://briancarper.net/blog/510/deploying-clojure-websites |
| 15:40 | wasamasa | "Summary: Emacs + SLIME + Clojure running in GNU Screen; all requests are handled by Apache and mod_proxy sends them to the appropriate Jetty instance / servlet." |
| 15:51 | justin_smith | hahaha |
| 15:52 | wasamasa | at least I'm using systemd to manage it |
| 15:52 | wasamasa | so I'm pretty much done with the deployment, just wondering what would be better ways to run the app |
| 15:52 | wasamasa | let me guess, an uberjar/war? |
| 15:53 | wasamasa | or is there anything objectively better? |
| 15:53 | sdegutis | ,:∑ |
| 15:53 | clojurebot | :∑ |
| 15:53 | sdegutis | favorite new clojure keyword / emoticon |
| 15:56 | sdegutis | ,(keyword "") |
| 15:56 | clojurebot | : |
| 15:56 | sdegutis | Actually that one may be. |
| 16:06 | sdegutis | Pop quiz: What's the coolest thing you can do with Clojure maps? The winner gets 10 points. Second place gets 5 points. |
| 16:16 | wink | Apparently I am boring, because into and :keyword is cool enough for me :P |
| 16:19 | gfredericks | ,(defmethod print-method :sdegutis [o pw] (.write pw "I am sdegutis")) |
| 16:19 | clojurebot | #object[clojure.lang.MultiFn 0x60103242 "clojure.lang.MultiFn@60103242"] |
| 16:19 | gfredericks | ,(-> {:this :is :my :map} (vary-meta assoc :type :sdegutis)) |
| 16:19 | clojurebot | I am sdegutis |
| 16:19 | sdegutis | Nice! |
| 16:19 | sdegutis | gfredericks takes the lead! |
| 16:22 | TimMc | ,{:sdegutis "This."} |
| 16:22 | clojurebot | {:sdegutis "This."} |
| 16:22 | TimMc | because map literals are the shit |
| 16:24 | sdegutis | So true. |
| 16:29 | gfredericks | ~map literals |are| the shit |
| 16:29 | clojurebot | c'est bon! |
| 16:30 | sdegutis | I'm not eligible to win because I'm the facilitator, but here's my shot at it anyway: |
| 16:30 | sdegutis | ,(-> (->> get (repeat 2) (apply hash-map)) (get get)) |
| 16:31 | clojurebot | #object[clojure.core$get 0x46e18aac "clojure.core$get@46e18aac"] |
| 16:31 | sdegutis | Wait what?? Is this ClojureScript!? |
| 16:31 | sdegutis | Oh I bet Clojure 1.7 changed the pretty-printing of objects. |
| 16:33 | ebzzry | How can I make function x refer to a latter defined function y? |
| 16:34 | oddcully | ,(doc declare) |
| 16:34 | clojurebot | "([& names]); defs the supplied var names with no bindings, useful for making forward declarations." |
| 16:34 | ebzzry | oddcully: thanks |
| 16:35 | sdegutis | Alright, get your entries in if you haven't. 30 minutes left. |
| 16:37 | chouser | ,(reduce #(%2 % '(sdegutis is)) '{(sdegutis is) (awesome) (sdegutis is-not) (lame)} [get conj]) |
| 16:37 | clojurebot | ((sdegutis is) awesome) |
| 16:38 | sdegutis | Whoa! |
| 16:38 | chouser | ...because Clojure maps support complex keys. And parens are awesome. |
| 16:38 | blkcat | i think chouser has it on lock |
| 16:38 | sdegutis | gfredericks has some pretty tough competition by the late chouser! |
| 16:41 | sdegutis | But we've yet to see amalloy's and Bronsa's entries. It's not over yet! |
| 16:46 | sdegutis | Also, using juxt as an alternative to select-keys in a way that's compatible with ->>: ##(->> {:a 10, :b 20, :c 30} ((juxt :a :b :c :d)) (sort)) |
| 16:46 | lazybot | ⇒ (nil 10 20 30) |
| 16:49 | sdegutis | But that only works with keys that act as their own functions on maps. |
| 17:23 | sdegutis | Time's running out! |
| 17:27 | sdegutis | What an exciting competition. Any number of candidates have yet to submit their entries! Will we see what creative answers puredanger or TEttinger2 come up with? Stay tuned to find out! |
| 17:32 | justin_smith | ,(into {} ['([:a :b] 42)]) ; sdegutis - I like this misleading error message |
| 17:32 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to java.util.Map$Entry"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to java.util.Map$Entry"\n :at [clojure.lang.ATransientMap conj "ATransientMap.java" 44]}]\n :trace\n [[clojure.lang.ATransientMap conj "ATransientMap.java" 44]\n [clojure.lang.ATransientMap conj "ATransientMap.java" 17]\n [clojure.co... |
| 17:32 | justin_smith | err |
| 17:32 | justin_smith | not that one |
| 17:32 | {blake} | Yeah, that one's great. |
| 17:33 | sdegutis | Haha. |
| 17:33 | justin_smith | ,(into {} ['([:a :b] 42)]) ; sdegutis - I like this misleading error message |
| 17:33 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to java.util.Map$Entry"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to java.util.Map$Entry"\n :at [clojure.lang.ATransientMap conj "ATransientMap.java" 44]}]\n :trace\n [[clojure.lang.ATransientMap conj "ATransientMap.java" 44]\n [clojure.lang.ATransientMap conj "ATransientMap.java" 17]\n [clojure.co... |
| 17:33 | sdegutis | I think justin_smith may have to be disqualified due to intoxication. |
| 17:33 | justin_smith | oh wait, that is still wrong, but different from the kind of wrong I get locally |
| 17:33 | justin_smith | lol |
| 17:34 | justin_smith | sorry for the double up |
| 17:34 | justin_smith | sdegutis: locally I get "ClassCastException clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry clojure.lang.ATransientMap.conj" |
| 17:34 | Bronsa | justin_smith: i think that might change in 1.8 |
| 17:34 | justin_smith | Bronsa: oh, cool |
| 17:35 | Bronsa | lol |
| 17:35 | justin_smith | ,*clojure-version* |
| 17:35 | clojurebot | {:major 1, :minor 8, :incremental 0, :qualifier "alpha2"} |
| 17:35 | Bronsa | clojurebot is at 1.8 yeah |
| 17:35 | justin_smith | Bronsa: it's still wrong, but it picks the val instead of the key now |
| 17:35 | Bronsa | yeah |
| 17:35 | Bronsa | wait |
| 17:35 | Bronsa | , (into {} ['([:a :b])]) |
| 17:35 | clojurebot | {:a :b} |
| 17:35 | {blake} | Ever have days where you just can't recurse? |
| 17:36 | justin_smith | ,(into {} ['(:key [:a :b])]) |
| 17:36 | clojurebot | #error {\n :cause "clojure.lang.Keyword cannot be cast to java.util.Map$Entry"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.Keyword cannot be cast to java.util.Map$Entry"\n :at [clojure.lang.ATransientMap conj "ATransientMap.java" 44]}]\n :trace\n [[clojure.lang.ATransientMap conj "ATransientMap.java" 44]\n [clojure.lang.ATransientMap conj "ATransientMap.java" 17]\n ... |
| 17:36 | Bronsa | &(into {} ['([:a :b])]) |
| 17:36 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry |
| 17:36 | Bronsa | ,(into {} ['([:a :b])]) |
| 17:36 | clojurebot | {:a :b} |
| 17:36 | justin_smith | oh I was doing it wrong |
| 17:36 | Bronsa | a nice enhancement |
| 17:36 | sdegutis | Hint: We've yet to see any entries that invert a map. |
| 17:37 | justin_smith | ,(into {} (map (comp vec reverse) {:a 0 :b 1 :c 2})) |
| 17:37 | clojurebot | {0 :a, 1 :b, 2 :c} |
| 17:39 | chouser | That's a cool thing you can do in spite of a map. |
| 17:39 | justin_smith | heh |
| 17:40 | hiredman | ,*clojure-version* |
| 17:40 | justin_smith | ,(into {} (map (comp vec rseq) {:a 0 :b 1 :c 2})) ; shaved off a few characters |
| 17:40 | clojurebot | {:major 1, :minor 8, :incremental 0, :qualifier "alpha3"} |
| 17:40 | clojurebot | {0 :a, 1 :b, 2 :c} |
| 17:40 | hiredman | microservices man, the future |
| 17:41 | sdegutis | If you haven't submitted an entry, time's running out! |
| 17:41 | sdegutis | Just a reminder for those joining us: "What's the coolest thing you can do with Clojure maps? The winner gets 10 points. Second place gets 5 points." |
| 17:44 | TimMc | For those not joining us, you can also talk about other things. |
| 17:44 | sdegutis | Now hold on a second, that's just not true. |
| 17:53 | puredanger | I put all my cool stuff into the 1.7 release |
| 17:54 | puredanger | Anyone notice the new IMapIterable interface? Direct iteration of only keys or vals without making entries. |
| 17:54 | puredanger | Used under keys or vals or for iterating sets |
| 17:54 | Bronsa | w00t |
| 17:55 | Bronsa | is that 1.7 or 1.8? totally missed that |
| 17:55 | puredanger | 1.7 |
| 17:55 | Bronsa | cool |
| 17:56 | oddcully | ,{nil nil} |
| 17:56 | clojurebot | {nil nil} |
| 17:57 | Bronsa | ,(let [a (array-map Double/NaN 1)] (assoc a (key (first a)) "foo")) |
| 17:57 | clojurebot | {NaN 1, NaN "foo"} |
| 17:57 | Bronsa | ,(let [a (hash-map Double/NaN 1)] (assoc a (key (first a)) "foo")) |
| 17:57 | clojurebot | {NaN "foo"} |
| 17:57 | Bronsa | this one was fun the other night |
| 17:57 | oddcully | ,({nil nil} nil ::default) |
| 17:57 | amalloy | oh, that's nice, puredanger |
| 17:57 | clojurebot | nil |
| 17:58 | Bronsa | puredanger: ^ does that deserve a fix? I have one |
| 17:58 | puredanger | Which? |
| 17:58 | Bronsa | puredanger: difference between array-map and hash-map wrt NaN handling |
| 17:58 | Bronsa | as key |
| 17:58 | Bronsa | the edgiest of edge cases :) |
| 17:59 | puredanger | I can't say that's at the top of my list |
| 18:00 | Bronsa | ,(let [a (array-map (reify Object (equals [_ _] false)) 1)] (assoc a (key (first a)) "foo")) |
| 18:00 | clojurebot | {#object[sandbox$eval121$reify__122 0x210788a3 "sandbox$eval121$reify__122@210788a3"] 1, #object[sandbox$eval121$reify__122 0x210788a3 "sandbox$eval121$reify__122@210788a3"] "foo"} |
| 18:00 | Bronsa | ,(let [a (hash-map (reify Object (equals [_ _] false)) 1)] (assoc a (key (first a)) "foo")) |
| 18:00 | clojurebot | {#object[sandbox$eval147$reify__148 0x42848dfb "sandbox$eval147$reify__148@42848dfb"] "foo"} |
| 18:00 | Bronsa | actually not only for NaN |
| 18:00 | Bronsa | all objects that compare identical? but not equal |
| 18:03 | yojoe | is it possible to load a lein plugin as a dependency? Would like to use some functions from a lein plugin in clojure code (not from command line) |
| 18:04 | yojoe | Whenever I try to regularly add it as a dependency, i get errors like "Could not locate leiningen/help__init.class" |
| 18:04 | justin_smith | yojoe: sure, you can put it in your :dependencies rather than :plugins |
| 18:04 | justin_smith | I think you need to manually add leiningen.core |
| 18:04 | justin_smith | plugins shouldn't depend on their host :) |
| 18:05 | yojoe | justin_smith: awesome. thank you for the quick reply. i really appreciate it. will try now :) |
| 18:05 | TEttinger | Bronsa: didn't justin_smith discover that here on IRC? |
| 18:05 | Bronsa | yup |
| 18:06 | TEttinger | ,#{Double/NaN Double/NaN Double/NaN} |
| 18:06 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: Double/NaN> |
| 18:06 | TEttinger | ,(hash-set Double/NaN Double/NaN Double/NaN) |
| 18:06 | clojurebot | #{NaN NaN NaN} |
| 18:06 | TEttinger | batman! |
| 18:06 | sdegutis | oddcully, Bronsa: excellent entries! |
| 18:07 | sdegutis | Anyway TEttinger2's NaN-set wins. |
| 18:08 | TEttinger | it's justin_smith |
| 18:08 | TEttinger | I thieved it from justin_smith's IRC shenanigans |
| 18:09 | sdegutis | Hold on just a second. Are you telling me TEttinger2 is justin_smith and not TEttinger? |
| 18:09 | TEttinger | ,{Double/NaN 1 Double/NaN 2} |
| 18:09 | sdegutis | If only we had some stable concept of identity in #clojure! |
| 18:09 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: Double/NaN> |
| 18:09 | sdegutis | *bu dum tshhhh* |
| 18:09 | TEttinger | ,(hash-map Double/NaN 1 Double/NaN 2) |
| 18:09 | clojurebot | {NaN 1, NaN 2} |
| 18:10 | TEttinger | ,(get (hash-map Double/NaN 1 Double/NaN 2) Double/NaN) |
| 18:10 | clojurebot | nil |
| 18:10 | sdegutis | AMAZING |
| 18:10 | TEttinger | that's a good one. |
| 18:10 | sdegutis | That definitely wins. |
| 18:10 | justin_smith | and also mine |
| 18:10 | sdegutis | Which was yours? |
| 18:10 | TEttinger | I don't think it's actually un-gettable... justin_smith, yep it's all been yours |
| 18:10 | justin_smith | I'm gonna move to china and be the NaN-king |
| 18:11 | justin_smith | sdegutis: all the nan ones |
| 18:11 | sdegutis | justin_smith: oh |
| 18:11 | sdegutis | What's your twitter so I can announce it? |
| 18:11 | TEttinger | ,(hash Double/NaN) |
| 18:11 | sdegutis | TEttinger: also whats yours |
| 18:11 | clojurebot | 2146959360 |
| 18:11 | TEttinger | I don't know what this is |
| 18:12 | sdegutis | twitter? |
| 18:12 | clojurebot | http://haicolon.wordpress.com/tweetility/ |
| 18:12 | justin_smith | sdegutis: mine? |
| 18:12 | sdegutis | Yes both. |
| 18:12 | justin_smith | @noisesmith |
| 18:13 | sdegutis | TEttinger: whats urs |
| 18:15 | TEttinger | I don't actively twitter-ize |
| 18:16 | sdegutis | Fine, whatever. The results are in! https://twitter.com/_sdegutis/status/628690897845243904 |
| 18:17 | oddcully | ,(Long/toBinaryString 2146959360) |
| 18:17 | clojurebot | "1111111111110000000000000000000" |
| 18:27 | kwladyka | is any function to create new empty data from old data, but with all metadata from old data? just something like (new-with-meta (with-meta #{1 2 3 4} {:super-meta 1})) and return #{} with :super-meta 1? |
| 18:27 | kwladyka | i know how to do that only using with-meta and meta |
| 18:28 | kwladyka | anyway it is maybe enough good |
| 18:30 | Bronsa | ,(meta (empty (with-meta {1 2} {3 4}))) |
| 18:30 | clojurebot | {3 4} |
| 18:31 | Bronsa | although the docs don't mention it |
| 18:32 | justin_smith | oh, nice trick |
| 18:36 | kwladyka | (with-meta #{} (meta boards)) <- i am doing this like that now, but i thought maybe it something shorter |
| 18:38 | Bronsa | kwladyka: use `empty` |
| 18:42 | yojoe | justin_smith: after i added leiningen and the leiningen core as dependencies, now i get new error. "No such var: b/doc-from-ns-form, compiling:(leiningen/help.clj:12:21)". any ideas? |
| 18:42 | justin_smith | b * weird |
| 18:43 | kwladyka | would it consume less memory with empty? |
| 18:44 | kwladyka | but trick with empty is nice, thx |
| 18:45 | justin_smith | kwladyka: empty is going to do less irrelevant work, because what you want is exactly what empty is designed for |
| 18:57 | herrwolfe | in cider, is there a way to interrupt a set of tests that is running without closing the nrepl session? |
| 19:00 | kwladyka | i am asking because i am looking all possible ways to reduce memory consumption :) |
| 19:00 | {blake} | ,(read-string "08") |
| 19:00 | clojurebot | #error {\n :cause "Invalid number: 08"\n :via\n [{:type java.lang.NumberFormatException\n :message "Invalid number: 08"\n :at [clojure.lang.LispReader readNumber "LispReader.java" 330]}]\n :trace\n [[clojure.lang.LispReader readNumber "LispReader.java" 330]\n [clojure.lang.LispReader read "LispReader.java" 256]\n [clojure.lang.LispReader read "LispReader.java" 196]\n [clojure.lang.LispReade... |
| 19:00 | {blake} | huh |
| 19:01 | Bronsa | {blake}: 8 is not a valid octal value |
| 19:01 | Bronsa | ,012 |
| 19:01 | clojurebot | 10 |
| 19:01 | {blake} | Bronsa, leading zero means octal. I had forgotten that. I was read-string-ing to convert string to numbers. |
| 19:02 | Bronsa | {blake}: use Long/parseLong |
| 19:03 | {blake} | Bronsa: Is that the mode? I've never found a canonical approach described. |
| 19:04 | Bronsa | {blake}: if all yoou have to parse is integer numbers sure |
| 19:05 | kwladyka | it is time to sleep, goodnight and see you tomorrow :) |
| 19:05 | {blake} | Bronsa: Yeah. It's parsing out a month, day, year. |
| 19:05 | Bronsa | if you want to parse stuff like XeY though it won't work |
| 19:20 | {blake} | Bronsa: Newp. That's fine. |
| 19:21 | {blake} | (inc Bronsa) |
| 19:21 | lazybot | ⇒ 117 |
| 21:46 | sdegutis | I've noticed my Clojure code is looking very foreign. I just wrote this: (def templates (comp (partial sort-by template-id) :templates)) |
| 21:47 | akkad | no args? |
| 21:47 | sdegutis | Whereas previously it was like this: (defn templates [m] (->> m :templates (sort-by template-id))) |
| 21:47 | akkad | oh nvm |
| 21:48 | sdegutis | And then it hit me: my code is turning into just Haskell with s-expressions. |
| 21:49 | sdegutis | Pretty sure the transliterated Haskell (with pseudo-stdlib) equivalent of the exact same function is: templates = sortBy templateId . getField "templates" |
| 21:50 | sdegutis | Where . is Haskelleze for (comp). |
| 21:54 | sdegutis | Which is super surprising because I thought I was starting to like JavaScript more, not Haskell. |
| 22:26 | justin_smith | point-free is fun |
| 23:37 | rhaywood | I'm using Circe version 1.6-d1f9740 with GNU Emacs 24.4.1 (of 2014-10-20) |