2015-06-11
| 00:00 | gko | cfleming: CSV integration? |
| 00:01 | cfleming | gko: Right. If you're using CLJS I'm hoping to integrate more tightly with all that stuff, but right now I don't. So it would just be the support for the things you mention. Essentially the standalone Cursive will be like the Community edition with the plugin installed and some stuff stripped out, and a much nicer getting started experience (no faffing with keymaps etc). |
| 00:04 | gko | cfleming: OK, not doing CLJS anyway... what will be the licence fee? like rubymine/pycharm? |
| 00:04 | cfleming | gko: Not 100% determined but I think so, yes. |
| 00:05 | gko | cfleming: OK... so companies/organizations + individual developers, then... |
| 00:05 | cfleming | gko: Right. |
| 00:08 | gko | cfleming: OK. Nice work, as it really helped doing some project when cider was somewhat unreliable on my side for a while. |
| 00:08 | cfleming | gko: Thanks, I'm glad it's working well for you! |
| 00:14 | cfleming | gko: There's lots of nice functionality in yesterday's release if you're using Java interop, too. |
| 00:26 | gko | cfleming: haven't been using it in a while, but will soon be :) |
| 01:50 | mercwithamouth | does anyone actually use 'complement'? |
| 02:01 | TEttinger | mercwithamouth, yeah it's a bit verbose for what it does. |
| 02:01 | TEttinger | I can see it being useful |
| 02:02 | Kneiva | mercwithamouth: https://github.com/search?utf8=%E2%9C%93&q=complement+extension%3Aclj&type=Code&ref=advsearch&l= There are uses of it. |
| 02:04 | mercwithamouth | TEttinger: hmmm |
| 02:04 | mercwithamouth | Kneiva: touche... |
| 02:05 | TEttinger | ,(def anti complement) |
| 02:05 | clojurebot | #'sandbox/anti |
| 02:05 | Kneiva | ,(anti nil? nil) |
| 02:05 | clojurebot | #error {\n :cause "Wrong number of args (2) passed to: core/complement"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (2) passed to: core/complement"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 36]\n [sandbox$eval47 invoke "NO_SOURCE_FILE" 0]\n [clojure.lan... |
| 02:06 | Kneiva | ,((anti nil?) nil) |
| 02:06 | clojurebot | false |
| 02:06 | TEttinger | ,(map (anti nil?) (repeatedly 5 #(rand-nth [:a 1 nil]))) |
| 02:06 | clojurebot | (true true false false true) |
| 02:07 | TEttinger | the problem is, we already have both filter and remove |
| 02:08 | TEttinger | ,(filter (anti nil?) [1 2 3 nil 5 6 7 nil 8]) |
| 02:08 | clojurebot | (1 2 3 5 6 ...) |
| 02:08 | TEttinger | ,(remove nil? [1 2 3 nil 5 6 7 nil 8]) |
| 02:08 | clojurebot | (1 2 3 5 6 ...) |
| 02:08 | TEttinger | so primarily you want complement for stuff like partial and comp |
| 02:09 | TEttinger | passing a complex fn to filter or remove, that sorta thing |
| 02:23 | TEttinger | ,'''a |
| 02:23 | clojurebot | (quote (quote a)) |
| 02:24 | TEttinger | ,'a |
| 02:24 | clojurebot | a |
| 02:24 | TEttinger | hm |
| 02:30 | WickedShell | As a general theory question for someone who's really new to clojure how worried about chasing down all instances of reflection (ie adding type hints). I've just spend the last half hour fixing various reflection warnings, but outside of a warm fuzzy (and one that I think paid off for performance) is it worth usually running with the warnings and fixing as they happen? |
| 02:46 | TEttinger | WickedShell: mostly you only need to care about reflection in code that is called very frequently |
| 02:47 | TEttinger | $google ztellman primitive-math |
| 02:47 | lazybot | [ztellman/primitive-math · GitHub] https://github.com/ztellman/primitive-math |
| 02:47 | TEttinger | excellent lib that will make you cry :) |
| 02:49 | WickedShell | Yeah, my only real worry is that I have a GUI that needs to do a fair amount of redrawing on a limited processor... |
| 02:49 | WickedShell | That primitive math... Does it just repleace all the standard math functions with optimized ones? |
| 03:47 | kap | hello guys...a newbie question... |
| 03:48 | kap | I have a (defmulti fetch :kind) that troubles me |
| 03:48 | kap | IllegalArgumentException Wrong number of args passed to keyword: :kind clojure.lang.Keyword.throwArity (Keyword.java:97) |
| 03:48 | kap | What does it mean? |
| 03:48 | kap | I call it like so: |
| 03:49 | kap | (fetch {:kind :mine} ) |
| 04:00 | amalloy | kap: restart your repl. there's a stale defmulti from earlier |
| 04:01 | kap | I did it, but it still doesn't take it... |
| 04:03 | kap | I am testing with midje and autotest, maybe that can be the problem? |
| 04:03 | kap | (defmethod fetch ::network [url-or-path options] ...) |
| 04:03 | kap | looks ok to me... |
| 04:04 | amalloy | kap: okay so you apparently do not call it like (fetch {:kind :mine}) like you said |
| 04:05 | amalloy | you call it like (fetch {:kind :mine} some other junk) |
| 04:05 | kap | yep sorry is (fetcher/fetch {:kind :mine} "" {}) |
| 04:05 | amalloy | so, to dispatch, it is calling (:kind {:kind :mine} "" {}) |
| 04:05 | amalloy | which is clearly a problem |
| 04:05 | kap | it dispathes on the first param no? |
| 04:06 | amalloy | no |
| 04:06 | kap | lol that's the newbie problem then |
| 04:06 | kap | :D |
| 04:07 | kap | therefore I need to change my dispatch fn and accept three params? |
| 04:07 | amalloy | kap: generally when you have a problem you don't understand, it's great to provide a minimal reproducible example. but that only works if it's actually reproducible: if you edit your code to something simpler that you *think* would cause the same problem, you should test it first to see if that still has the problem you're asking about |
| 04:08 | amalloy | anyway, yes, you should do that |
| 04:08 | kap | agree and I apologise.. |
| 04:08 | kap | ok thanks for your help...I was banging my head on the floor |
| 04:09 | kungi | Is there some kind of print friendly datomic documentation out there? There does not seem to be any on docs.datomic.com |
| 04:14 | ionthas_ | Is there any function like repeatedly but taking functions with side effects? |
| 04:16 | TEttinger | ,(dorun (repeatedly 5 #(print "hi! "))) |
| 04:16 | clojurebot | hi! hi! hi! hi! hi! |
| 04:17 | mercwithamouth | has anyone gotten flycheck to work with clojure? |
| 04:19 | mercwithamouth | i'm looking at squiggly-clojure but haven't tested it out yet... |
| 04:37 | ionthas_ | thanks Tettinger! |
| 04:37 | TEttinger | no prob! |
| 06:06 | jonathanj | is there an alternate spelling of (not (nil? x))? |
| 06:06 | lumafi | (some? x), introduced in clojure 1.6 |
| 06:08 | jonathanj | thanks :) |
| 06:10 | l3dx | why would you use (when (some? x) ..) vs (when x ..) ? |
| 06:12 | lumafi | the first one checks if x is not nil, the second one checks if x is not nil nor false |
| 06:20 | ionthas_ | I have a function that outputs a number based on a provability. I want to do "something" that takes that function and calculates the provability of the function repeating that function a certain number of times. Do I need a macro or a function? (I'm starting with macros) |
| 06:21 | ionthas_ | and I'm a little confused |
| 06:23 | ionthas_ | I implemented a macro and it seems to work. I will stick to the macro for the moment. :P |
| 06:23 | l3dx | lumafi: I usually use the second approach when I expect sequences, and i don't see a case where I could get either nil, false or a sequence? but I'm a clojure beginner, so what do I know :) |
| 06:28 | kwladyka | (println (str "AAAAAAAAAAA" (get-in req [:params :terms]) "BBBBBBBBBBBBBB")) return AAAAAAAAAAABBBBBBBBBBBBBB in case when :terms doesnt exist, shouldnt be AAAAAAAAAAAnilBBBBBBBBBBBBBB? |
| 06:29 | TEttinger | kwladyka: do you want the empty string as a default? |
| 06:29 | TEttinger | ,(println (str "AAAAAAAAAAA" (get-in {:params []} [:params :terms] "") "BBBBBBBBBBBBBB")) |
| 06:29 | clojurebot | AAAAAAAAAAABBBBBBBBBBBBBB\n |
| 06:30 | TEttinger | get-in takes an optional argument as its last arg, so does get |
| 06:30 | lumafi | ,(str nil) |
| 06:30 | clojurebot | "" |
| 06:30 | TEttinger | this is the default return if it can't find what you ask for |
| 06:30 | TEttinger | hm! |
| 06:30 | lumafi | str of nil isn't "nil", it's the empty string |
| 06:30 | TEttinger | ,(str nil nil) |
| 06:30 | clojurebot | "" |
| 06:30 | TEttinger | ,(println (str "AAAAAAAAAAA" (get-in {:params []} [:params :terms] "nil") "BBBBBBBBBBBBBB")) |
| 06:30 | clojurebot | AAAAAAAAAAAnilBBBBBBBBBBBBBB\n |
| 06:30 | clgv | ,(pr-str nil) |
| 06:30 | clojurebot | "nil" |
| 06:30 | TEttinger | there you go :) |
| 06:31 | clgv | (format "%s" nil) |
| 06:31 | clgv | ,(format "%s" nil) |
| 06:31 | clojurebot | "null" |
| 06:31 | clgv | back to Java ;) |
| 06:31 | TEttinger | interesting |
| 06:32 | escherize | yeah you can do these two exercises to see it in action: http://clojurescriptkoans.com/#maps/5 |
| 06:39 | clgv | I guess aleph + gloss is the best method to do tcp in Clojure, isn't it? Do you know of serious alternatives? |
| 06:53 | kwladyka | TEttinger, oh thx! |
| 06:55 | TEttinger | and clgv, who has a better solution! |
| 06:55 | TEttinger | ,(pr-str "AAAAAAAAAAA" (get-in {:params []} [:params :terms]) "BBBBBBBBBBBBBB")) |
| 06:55 | clojurebot | "\"AAAAAAAAAAA\" nil \"BBBBBBBBBBBBBB\"" |
| 06:55 | TEttinger | hm |
| 06:56 | TEttinger | ,(pr "AAAAAAAAAAA" (get-in {:params []} [:params :terms]) "BBBBBBBBBBBBBB")) |
| 06:56 | clojurebot | "AAAAAAAAAAA" nil "BBBBBBBBBBBBBB" |
| 06:57 | kwladyka | this AAAA and BBB was to help me see the value.... ironic :) |
| 06:57 | kwladyka | i watned see it is nil or empty string :) |
| 06:58 | TEttinger | oh ok |
| 06:58 | TEttinger | ,(pr nil) |
| 06:58 | clojurebot | nil |
| 06:58 | TEttinger | ,(print nil) |
| 06:58 | clojurebot | nil |
| 06:58 | TEttinger | ,(str nil) |
| 06:58 | clojurebot | "" |
| 06:58 | TEttinger | ,(pr-str nil) |
| 06:58 | clojurebot | "nil" |
| 06:59 | TEttinger | ,(print nil nil "hey!") |
| 06:59 | clojurebot | nil nil hey! |
| 06:59 | TEttinger | hm. |
| 06:59 | TEttinger | print and str act differently |
| 07:10 | TMA | ,(str 't) |
| 07:10 | clojurebot | "t" |
| 07:11 | TMA | nil is a special case apparently :-L |
| 07:11 | TEttinger | ,(str ()) |
| 07:11 | clojurebot | "clojure.lang.PersistentList$EmptyList@1" |
| 07:11 | TEttinger | wow |
| 07:11 | TEttinger | ,(str (1)) |
| 07:11 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval73 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval73 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" 6792]\n [clojure.lang.Compiler eval "Compiler.java" 6755]\n [c... |
| 07:11 | TEttinger | ,(str []) |
| 07:11 | clojurebot | "[]" |
| 07:12 | TEttinger | ,(str (())) |
| 07:12 | clojurebot | #error {\n :cause "clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval121 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval121 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" 6792]\n [clojur... |
| 07:12 | TEttinger | ,(str '(())) |
| 07:12 | clojurebot | "(())" |
| 07:12 | TEttinger | weird |
| 07:13 | TMA | ,(str :keyword) |
| 07:13 | clojurebot | ":keyword" |
| 07:24 | justin_smith | TEttinger: ##() has always been valid |
| 07:24 | lazybot | ⇒ () |
| 07:25 | TEttinger | i know |
| 07:25 | TEttinger | but ##(str ()) |
| 07:25 | lazybot | ⇒ "clojure.lang.PersistentList$EmptyList@1" |
| 07:25 | TEttinger | is a weird string |
| 07:25 | justin_smith | ahh |
| 07:25 | TEttinger | ,clojure.lang.PersistentList$EmptyList@1 |
| 07:25 | clojurebot | clojure.lang.PersistentList$EmptyList |
| 07:26 | TEttinger | ,clojure.lang.PersistentList$EmptyList@2 |
| 07:26 | clojurebot | clojure.lang.PersistentList$EmptyList |
| 07:26 | TEttinger | ,clojure.lang.PersistentList$EmptyList@0 |
| 07:26 | clojurebot | clojure.lang.PersistentList$EmptyList |
| 07:26 | TEttinger | what is the @1 then? |
| 07:26 | mearnsh | having some trouble with this function here https://www.refheap.com/102426 : as you can see i'm shelling out to a program (csvmidi) but it's returning an error that suggests the file written in the preceeding line is incomplete. if i print tmp-path and manually invoke csvmidi afterwards, it completes successfully, so i guess sh is called before write-csv completes. any clues on what to do? |
| 07:26 | justin_smith | TEttinger: it's the specific instance of EmptyList I think? |
| 07:26 | clgv | TEttinger: identifiying the instance |
| 07:26 | TEttinger | ah |
| 07:26 | TEttinger | mearnsh, I haven't looked yet, sounds like it could be a laziness thing |
| 07:27 | justin_smith | TEttinger: not unless write-csv is lazy |
| 07:28 | clgv | or it uses a future or similar |
| 07:28 | justin_smith | looks like neither https://github.com/clojure/data.csv/blob/master/src/main/clojure/clojure/data/csv.clj#L123 |
| 07:29 | clgv | ah might be cashing since the writer is not closed |
| 07:29 | clgv | *caching |
| 07:29 | mearnsh | that sounds about right |
| 07:30 | clgv | mearnsh: wrap the with-open only around write-csv |
| 07:30 | justin_smith | oh yeah, the file is not guaranteed to exist on disk until you exit that with-open block I think |
| 07:30 | clgv | justin_smith: yeah, you'd need to call "flush" or similar on it |
| 07:30 | mearnsh | clgv: of course, that works. thanks all! |
| 07:30 | clgv | or just close it, since it is not used anymore |
| 07:30 | justin_smith | (inc clgv) |
| 07:30 | lazybot | ⇒ 43 |
| 07:31 | clgv | damn. now the 42 is gone. I guess I have to insult someone to get back to it ;) |
| 07:36 | TEttinger | (inc clgv) |
| 07:36 | lazybot | ⇒ 44 |
| 07:36 | TEttinger | we'll get you to some other number soon enough |
| 07:36 | clgv | :P |
| 07:42 | gfredericks | 45 is a triangular number |
| 07:42 | justin_smith | see, that's something to aspire to |
| 07:44 | clgv | hmm is there an english word that combines the meaning of "computable" and "predictable"? |
| 07:45 | clgv | I'd have needed that for an answer ;) |
| 07:45 | TEttinger | ,(reductions #(+ % (* 6 %2)) 1 (range 10)) |
| 07:45 | clojurebot | (1 1 7 19 37 ...) |
| 07:45 | TEttinger | &(reductions #(+ % (* 6 %2)) 1 (range 2 10)) |
| 07:45 | lazybot | ⇒ (1 13 31 55 85 121 163 211 265) |
| 07:45 | TEttinger | ah, 55 is a hexagonal number |
| 07:45 | TEttinger | or something? |
| 07:45 | TEttinger | is it? |
| 07:46 | TEttinger | &(reductions #(+ % (* 6 (Math/pow 2 %2))) 1 (range 1 10)) |
| 07:46 | lazybot | ⇒ (1 13.0 37.0 85.0 181.0 373.0 757.0 1525.0 3061.0 6133.0) |
| 07:46 | TEttinger | maybe not |
| 07:46 | TEttinger | that... hm |
| 07:46 | clgv | triangular refers to side length relation of a rectangular triangle ;) |
| 07:46 | TEttinger | &(reductions #(+ % (* 6 (Math/pow 2 %2))) 1 (range 0 10)) |
| 07:47 | lazybot | ⇒ (1 7.0 19.0 43.0 91.0 187.0 379.0 763.0 1531.0 3067.0 6139.0) |
| 07:47 | TEttinger | referring here to the series of hexagonal tilings where you add concentric hexagons |
| 07:47 | TEttinger | 1 hex, add a hex to all adjacent open cells, get 7 hexes |
| 07:48 | TEttinger | add a hex to all open, +12 |
| 07:48 | TEttinger | the next set I think is +24 |
| 07:48 | clgv | ah well or maybe not, http://en.wikipedia.org/wiki/Triangular_number - tricked by translation :P |
| 07:52 | gfredericks | clgv: "deterministic" might be related |
| 07:52 | TEttinger | &(map #(inc (* (dec %) (/ (* 6 %) 2))) (range 1 20)) |
| 07:52 | lazybot | ⇒ (1 7 19 37 61 91 127 169 217 271 331 397 469 547 631 721 817 919 1027) |
| 07:53 | TEttinger | so next centered hexagonal number is 61 |
| 07:53 | TEttinger | http://en.wikipedia.org/wiki/Centered_polygonal_number |
| 07:54 | clgv | gfredericks: I wanted to write a play of words ;) |
| 07:55 | TEttinger | (identity clgv) |
| 07:55 | lazybot | clgv has karma 44. |
| 07:55 | TimMc | &(take 10 (reductions + (range))) |
| 07:55 | lazybot | ⇒ (0 1 3 6 10 15 21 28 36 45) |
| 07:55 | TEttinger | one off of an interesting sequence! http://oeis.org/A144974 |
| 07:57 | TEttinger | wow, some odd factoids Calculating Ramanujan's tau function on a centered octagonal number yields an odd number, whereas for any other number the function yields an even number.[2] |
| 07:57 | justin_smith | factoids? |
| 07:57 | justin_smith | Calculating Ramanujan's tau function on a centered octagonal number |yields| an odd number, whereas for any other number the function yields an even number. |
| 07:58 | justin_smith | ~Calculating Ramanujan's tau function on a centered octagonal number |yields| an odd number, whereas for any other number the function yields an even number. |
| 07:58 | clojurebot | 'Sea, mhuise. |
| 07:58 | justin_smith | |
| 07:58 | justin_smith | ~Calculating Ramanujan's tau functon on a centered octagonal number |
| 07:58 | clojurebot | I don't understand. |
| 07:58 | justin_smith | :P |
| 08:11 | clgv | Calculating Ramanujan's tau functon on a centered octagonal number? |
| 08:11 | clgv | damn I thought it reacts to that |
| 08:11 | clgv | clojurebot: Calculating Ramanujan's tau function on a centered octagonal number |yields| an odd number, whereas for any other number the function yields an even number. |
| 08:11 | clojurebot | A nod, you know, is as good as a wink to a blind horse. |
| 08:12 | clgv | Calculating Ramanujan's tau functon on a centered octagonal number? |
| 08:15 | TEttinger | awww |
| 08:16 | TEttinger | ~Calculating Ramanujan's tau functon on a centered octagonal number |
| 08:16 | clojurebot | Cool story bro. |
| 08:16 | TEttinger | :| |
| 08:16 | TEttinger | ~Calculating Ramanujan's tau functon on a centered octagonal number? |
| 08:16 | clojurebot | Titim gan éirí ort. |
| 08:16 | clgv | factoids |are| broken. |
| 08:16 | clgv | clojurebot: factoids |are| broken. |
| 08:16 | clojurebot | 'Sea, mhuise. |
| 08:16 | clgv | ~factoids |
| 08:16 | clojurebot | factoids are broken. |
| 08:16 | TEttinger | heh |
| 08:16 | clgv | :/ |
| 08:17 | clgv | clojurebot: factoids |are not| broken. |
| 08:17 | clojurebot | Ok. |
| 08:17 | clgv | ~factoids |
| 08:17 | clojurebot | factoids are broken. |
| 08:17 | clgv | clojurebot: forget factoids |are| broken. |
| 08:17 | clojurebot | I forgot that factoids are broken. |
| 08:23 | wasamasa | is there a way for me to quote a comma? |
| 08:23 | wasamasa | '\, gives me a string ._. |
| 08:23 | justin_smith | wasamasa: commas are whitespace |
| 08:23 | justin_smith | ,'\, |
| 08:23 | clojurebot | \, |
| 08:23 | justin_smith | that's a character |
| 08:24 | justin_smith | ,',foo |
| 08:24 | clojurebot | foo |
| 08:24 | justin_smith | ,',,,,,,foo |
| 08:24 | clojurebot | foo |
| 08:24 | wasamasa | right, a character |
| 08:24 | wasamasa | so I can't have , as symbol? |
| 08:24 | clojurebot | Cool story bro. |
| 08:24 | justin_smith | ,(symbol ",") |
| 08:24 | clojurebot | , |
| 08:24 | justin_smith | but don't do that |
| 08:24 | justin_smith | it's weird |
| 08:24 | justin_smith | ,(symbol " ") |
| 08:24 | clojurebot | |
| 08:24 | wasamasa | I'll tell |
| 08:25 | justin_smith | haha |
| 08:28 | clgv | ,(intern *ns* (symbol ",") 42) |
| 08:28 | clojurebot | #'sandbox/, |
| 08:28 | clgv | good luck using that symbol ;) |
| 08:28 | justin_smith | ,@(resolve (symbol ",")) |
| 08:28 | clojurebot | 42 |
| 08:28 | clgv | pssst! that was a puzzle ;) |
| 08:30 | justin_smith | ,(intern *ns* (symbol " ") '☃) |
| 08:30 | clojurebot | #'sandbox/ |
| 08:32 | clgv | ,(def ☃ 42) |
| 08:32 | clojurebot | #'sandbox/☃ |
| 08:32 | clgv | ,(+ ☃ ☃) |
| 08:32 | clojurebot | 84 |
| 08:33 | clgv | justin_smith: http://www.emojilisp.com/prog/MzgPNAScXec81CsB |
| 08:33 | justin_smith | hah, I had forgotten that one |
| 08:34 | justin_smith | ,@(resolve (symbol " ")) |
| 08:34 | clojurebot | #error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.core$deref_future invoke "core.clj" 2184]}]\n :trace\n [[clojure.core$deref_future invoke "core.clj" 2184]\n [clojure.core$deref invoke "core.clj" 2205]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" 6792]\n [clojure.lang.Compiler eval "Compiler.ja... |
| 08:38 | m1dnight_ | https://gist.github.com/spacemanaki/1093917 This is the ant problem of Rich Hickey. Can anyone think of a reason why he doest not put the entire ant struct in the agent and just the location? |
| 08:38 | m1dnight_ | I cant see any reason why not to do it. |
| 08:38 | justin_smith | ,(ns-publics 'user) |
| 08:38 | clojurebot | {} |
| 08:39 | m1dnight_ | Oh, perhaps to make drawing them easier! |
| 09:00 | clgv | justin_smith: the "session" expired - you have to intern it again ;) |
| 09:01 | clgv | m1dnight_: I think that one qualifies as quick hack - it violates several clojure best practices starting with all the awful global defs |
| 09:12 | bluebird | hi - i'm playing around with learning macros - can anyone help me with this short macro? https://www.refheap.com/102430 |
| 09:13 | clgv | bluebird: you have to build lists then |
| 09:13 | clgv | bluebird: (map #(list 'inc %) coll) |
| 09:14 | clgv | bluebird: or usually a better idea: (map #(list `inc %) coll) |
| 09:14 | wasamasa | bluebird: you're placing the symbol coll in there, not the collection |
| 09:14 | clgv | ,(defmacro m [coll] `(or ~@(map #(list `inc %) coll))) |
| 09:14 | clojurebot | #'sandbox/m |
| 09:15 | clgv | ,(macroexpand-1 '(m [1 2 3])) |
| 09:15 | clojurebot | (clojure.core/or (clojure.core/inc 1) (clojure.core/inc 2) (clojure.core/inc 3)) |
| 09:15 | bluebird | clgv: ahh ya perfect |
| 09:15 | bluebird | clgv: thanks! |
| 09:40 | justin_smith | bluebird: the weird part is that you will always either get an NPE or the first number |
| 09:40 | justin_smith | bluebird: unless that was just an example of course |
| 09:40 | justin_smith | ,(or 0 1) |
| 09:40 | clojurebot | 0 |
| 09:41 | bluebird | justin_smith: ya it was just an example |
| 09:41 | justin_smith | some people expect 0 to be falsey |
| 09:45 | pingw | Hello |
| 09:46 | pingw | I have a question about using clojure with mongodb asynchronously |
| 09:47 | j-pb | pingw: good for you ;), it' generally easier to just ask it |
| 09:48 | pingw | j-pb: im trying to think how to phrase this |
| 09:48 | j-pb | ah ok :) |
| 09:48 | pingw | I cant find anything when I google something like 'clojure monger async' |
| 09:48 | pingw | does this mean that monger is synchronous? |
| 09:49 | pingw | so if I make some kind of database query, the application will block until the database server responds? |
| 09:50 | justin_smith | mongo has multiple synchronization rules, the default for monger should be the same as for mongo |
| 09:50 | justin_smith | which is "proceed as if insertion succeeded" |
| 09:51 | pingw | justin_smith, what if you query the database |
| 09:51 | pingw | will the clojure application block until it responds? |
| 09:51 | justin_smith | in all my usage, yes |
| 09:51 | justin_smith | it's easy to put your read in a future of course |
| 09:52 | pingw | Oh, thats what I was looking for |
| 09:52 | justin_smith | (doc future) |
| 09:52 | pingw | so async is achieved using futures? |
| 09:52 | pingw | ok |
| 09:52 | clojurebot | "([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block, unless the variant of deref with timeout is used. See also - realized?." |
| 09:52 | justin_smith | pingw: that's one kind of async |
| 09:52 | justin_smith | there is also core.async |
| 09:52 | justin_smith | and agents |
| 10:55 | bluebird | I don't think I'm understanding something about how macros work: https://www.refheap.com/102433 anyone know which piece of the puzzle i'm missing? just a toy example |
| 10:59 | clgv | bluebird: marcos are executed at compile time and they get unevaluated arguments - hence you can't get access to the numbers bound in the `let` |
| 11:00 | clgv | bluebird: that example of yours is getting weirder anyway. what are you trying to accomplish? |
| 11:00 | bluebird | clgv: nothing, just playing around. so you can't use macros inside of let bindings? |
| 11:01 | clgv | bluebird: you can. but you can't expect the macro to see the values bound to the symbol |
| 11:02 | clgv | bluebird: you could construct code using that symbol such that the computation using those values is performed at runtime |
| 11:02 | bluebird | clgv: what are you referring to with `symbol`? |
| 11:02 | clgv | bluebird: your example has the problem, that it seems to be a task that does not need a macro ;) |
| 11:03 | clgv | bluebird: "nums" |
| 11:03 | bluebird | clgv: ya, I'm just messing around trying to learn macros because normally I never use them. |
| 11:03 | clgv | bluebird: ok, you pass more than the symbol, the form `(rest nums)` - but the reason remains the same |
| 11:04 | clgv | bluebird: then try to build control flow macros |
| 11:04 | clgv | bluebird: thats a valid use case and you can pick simple control flows |
| 11:05 | bluebird | clgv: ya I guess the idea I'm playing around with is trying to see if i can do code generation. in this case a silly example of an or call followed by generated expressions |
| 11:07 | clgv | bluebird: best read about the evaluation semantics and the time at which macros are executed - this seems to be your difficulty in the example |
| 11:11 | bluebird | clgv: alright |
| 11:25 | noncom | don't these two exceptions look not too mutual? |
| 11:25 | noncom | ,(apply + [1 2 3] 40) |
| 11:25 | clojurebot | #error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 528]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 528]\n [clojure.lang.RT seq "RT.java" 509]\n [clojure.lang.RT cons "RT.java" 648]\n [clojure.core$cons__4100 in... |
| 11:25 | noncom | ,(apply + [1 2 3] [40]) |
| 11:25 | clojurebot | #error {\n :cause "clojure.lang.PersistentVector cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentVector cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers add "Numbers.java" 128]}]\n :trace\n [[clojure.lang.Numbers add "Numbers.java" 128]\n [clojure.core$_PLUS_ invoke "core.clj" 955]\n [clojure.lang.AFn applyTo... |
| 11:26 | justin_smith | haha |
| 11:26 | justin_smith | I like the symmetry - you go from having a number where there should have been a seqable, to having a vector where there should have been a number |
| 11:26 | noncom | yeah :) |
| 11:31 | justin_smith | ,(apply map (juxt #(into %1 %2) #(into %2 %1)) (repeatedly 2 #(shuffle [nil () [] {} #{}]))) |
| 11:31 | clojurebot | ([() []] [nil nil] [{} #{}] [#{} ()] [[] {}]) |
| 11:40 | threadwaste | /n |
| 11:44 | clgv | justin_smith: generating swearjure expressions? |
| 11:45 | justin_smith | ,(map (comp symbol str) (repeatedly #(rand-nth ":;8|")) (repeatedly #(rand-nth "-7 ")) (repeatedly #(rand-nth "()[]}{/\\"))) |
| 11:45 | clojurebot | (|-\ : { 8-\ |-( ;7] ...) |
| 11:45 | justin_smith | clgv: just fiddling around |
| 11:46 | oddcully | i like the sceptical laforge |
| 11:47 | justin_smith | (inc oddcully) |
| 11:47 | lazybot | ⇒ 10 |
| 11:47 | justin_smith | perfect name for that |
| 11:47 | oddcully | could be used for engineering problems |
| 11:47 | justin_smith | ~mongodb |is| |-\ |
| 11:47 | clojurebot | A nod, you know, is as good as a wink to a blind horse. |
| 11:47 | oddcully | not sure if this heisenbergcompensator can hold the throughput |-/ |
| 11:48 | clgv | mongodb? |
| 11:48 | clojurebot | mongodb is |-\ |
| 11:48 | clgv | hehe |
| 11:50 | zerokarmaleft | haha |
| 12:06 | clgv | $karma zerokarmaleft |
| 12:06 | lazybot | zerokarmaleft has karma 1. |
| 12:06 | clgv | lying again, eh? :P |
| 12:47 | binjured | so i'm trying out cljx and the lein plugin is working fine, but automated cljsbuild (via figwheel) is warning about `map->RecordType` methods being replaced and won't use the new file. |
| 12:51 | oddcully | binjured: i had the same problem with prismatic/schema - there is a flag to enable reloading with warnings in figwheel, but this isn't such a great solution |
| 12:52 | binjured | oddcully: did you ever resolve it more satisfactorily? |
| 12:54 | oddcully | binjured: i was in the great position to delay use of schema and i am waiting for the ticket (could already been done) |
| 12:55 | oddcully | binjured: short answer: no. could be gone already |
| 12:56 | binjured | oddcully: i see. appears to still be an issue, unfortunately. i can't find an actual issue about it, just a reference in another issue, so i'm gonna create one now. |
| 12:57 | alexyakushev | Any midje users here? Is it possible to defer the test execution with it, the way clojure.test/deftest does? |
| 12:57 | jonathanj | i have a question but i don't actually know how to explain it, bear with me: |
| 12:58 | jonathanj | i have a tree-like structure (nested maps with :left and :right keys), i want to convert it into something i can easily render (to a console) so i'm traversing it using (loop) |
| 12:59 | jonathanj | the problem is if i travel down some path and hit a leaf node, i'm not sure how to backtrack and continue (such that my render doesn't end early) |
| 12:59 | justin_smith | jonathanj: loop on a tree will be a bit tricky, given that it does only tail recursion and that's awkward for trees (regular, unoptimized recursion is more natural) |
| 12:59 | jonathanj | yes |
| 13:00 | jonathanj | i was going to say that if i were doing normal recursion this would kind of solve itself |
| 13:00 | TEttinger | clojure.zip ? |
| 13:00 | justin_smith | perhaps you want a function that just calls itself |
| 13:00 | justin_smith | that's simple enough (up to a certain size of input, of course) |
| 13:00 | justin_smith | see also clojure.walk/postwalk |
| 13:00 | justin_smith | (doc clojure.walk/postwalk) |
| 13:01 | clojurebot | Huh? |
| 13:01 | justin_smith | ,(require 'clojure.walk) |
| 13:01 | clojurebot | nil |
| 13:01 | justin_smith | (doc clojure.walk/postwalk) |
| 13:01 | clojurebot | "([f form]); Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall." |
| 13:01 | jonathanj | i read that but i honestly don't really understand how to use it |
| 13:01 | jonathanj | maybe there's an example on clojuredocs |
| 13:02 | justin_smith | I think you could probably do your transform elegantly with postwalk (just remember to return the input unmodified in all default cases)_ |
| 13:02 | justin_smith | jonathanj: you give it a function, for every recursive input in your nested structure, it is replaced with the return value of that function |
| 13:03 | justin_smith | ,(clojure.walk/postwalk (fn [x] (if (string? x) (keyword x) x)) {"a" ["b" #{"c" 2 3 4}]}) |
| 13:03 | jonathanj | okay, so one thing here, i'm keeping track of depth in my current function |
| 13:03 | clojurebot | {:a [:b #{4 :c 3 2}]} |
| 13:03 | jonathanj | the output is [(depth node-value) ...] |
| 13:03 | justin_smith | jonathanj: postwalk should make that unneeded |
| 13:03 | jonathanj | well, i need it for the purpose of rendering |
| 13:03 | justin_smith | ahh, got it |
| 13:04 | justin_smith | jonathanj: one option would be walk (as opposed to postwalk), passing in depths on the way in, returning variously indented strings on the way out |
| 13:06 | jonathanj | what is the fundamental difference between postwalk and walk? |
| 13:06 | justin_smith | (doc clojure.walk/walk) |
| 13:06 | clojurebot | "([inner outer form]); Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures. Consumes seqs as with doall." |
| 13:06 | jonathanj | i did read that, but i'm a bit lost |
| 13:06 | justin_smith | it takes two functions, one to call to transform while walking down, another to call on the way back up |
| 13:06 | justin_smith | jonathanj: the wikipedia page on tree walking algorithms may help |
| 13:07 | jonathanj | justin_smith: yes, it probably will help, let me go read that over while i process this |
| 13:07 | jonathanj | justin_smith: thanks for the help |
| 13:08 | justin_smith | jonathanj: note in particular the description of pre-order and post-order - walk synthesizes the two http://en.wikipedia.org/wiki/Tree_traversal |
| 13:18 | jonathanj | hrm, if my tree looks like: [{:value x :left nil :right {:value y ...}}] i'm not sure how to use (walk) |
| 13:19 | jonathanj | my inner function is called once with [:value x] then with [:left nil] etc. |
| 13:19 | jonathanj | sorry, my tree is not in a vec |
| 13:26 | justin_smith | jonathanj: it will get every branch as args, which is why I mentioned that in most cases you return the input unmodified |
| 13:26 | justin_smith | jonathanj: I'll repeat my previous example |
| 13:26 | justin_smith | ,(require 'clojure.walk) |
| 13:26 | clojurebot | nil |
| 13:26 | justin_smith | ,(clojure.walk/postwalk (fn [x] (if (string? x) (keyword x) x)) {"a" ["b" #{"c" 2 3 4}]}) |
| 13:26 | clojurebot | {:a [:b #{4 :c 3 2}]} |
| 13:28 | justin_smith | jonathanj: I'd imagine you could put each data structure in the nested map into a tuple with its depth on the way down, and combine with an accumulator on the way up (both of these requiring an atom or some other mutable data) |
| 13:28 | justin_smith | but maybe there is a simpler way to do this |
| 13:28 | justin_smith | you could look at how clojure.pprint deals with it |
| 13:35 | voidnoid | I am following the leinengen tutorial, and when I try to run (require ‘[clj-http :as http]) I get the following error |
| 13:35 | voidnoid | FileNotFoundException Could not locate clj_http__init.class or clj_http.clj on classpath |
| 13:35 | voidnoid | I have clj-http listed in my project.clj under dependencies |
| 13:36 | justin_smith | voidnoid: have you restarted your repl since modifying the project.clj? |
| 13:36 | voidnoid | and when I ran lein repl it obviously downloaded all the related deps for clj-http from clojars (as well as central) |
| 13:36 | voidnoid | justin_smith: yep I have |
| 13:36 | justin_smith | voidnoid: does clj-http define a namespace called clj-http? I would be surprised if it did. |
| 13:37 | justin_smith | likely it's something like clj-http.core |
| 13:37 | justin_smith | or clj-http.client iirc |
| 13:37 | voidnoid | hmm, well I’m just following the lein tutorial right now |
| 13:37 | voidnoid | so I just ran the command as they list it |
| 13:38 | voidnoid | justin_smith: I have done everything up to this point https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#running-code |
| 13:38 | jonathanj | justin_smith: i don't quite understand how walk descends, maybe i'm being stupid |
| 13:38 | voidnoid | the repl seems to work fine, the hello world part works fine |
| 13:38 | jonathanj | justin_smith: this is what it looks like: https://pb.codehash.net/262aed6d71324ce89ee569815af7b552 |
| 13:38 | voidnoid | oh wait… lol |
| 13:38 | voidnoid | haha, I wasn’t running it liek they have it :) |
| 13:38 | justin_smith | voidnoid: I just looked at the tutorial, they require 'clj-http.client |
| 13:38 | voidnoid | nm, ignore me |
| 13:39 | oddcully | voidnoid: also your ' there is some odd char (maybe just from pasting with some ubersmart client) |
| 13:39 | justin_smith | jonathanj: the easiest way to see how walk descends is to add print statements to the pre and post functions |
| 13:39 | jonathanj | if i do something like this (to try understand walk) it doesn't like it is descending: https://pb.codehash.net/bca189c015ec48e5b6e6a54b1866ea4f |
| 13:39 | voidnoid | oddcully: yeah I think that’s an OSX artifact |
| 13:39 | voidnoid | it’s a regular/proper character in terminal |
| 13:40 | jonathanj | actually i guess there's no descending to do |
| 13:40 | justin_smith | jonathanj: yeah, not much depth to that structure |
| 13:40 | jonathanj | but if i have a more complex tree there's no descending |
| 13:41 | jonathanj | ie i get output like ["inner" {... :right {...}}] and that :right value is never called by the inner function |
| 13:42 | justin_smith | jonathanj: odd - is the datatype coming in a normal map? |
| 13:42 | andyf_ | jonathanj: It might be more straightforward to write your own recursive function, rather than using one of the walk functions. |
| 13:42 | jonathanj | andyf_: why do you say that? |
| 13:43 | andyf_ | something like (defn print-tree [t depth] (when (:left t) (print-tree (:left t) (inc depth)) (print-tree (:right t) (inc depth)))) |
| 13:43 | jonathanj | justin_smith: uh, i think the answer is yes but i don't quite understand |
| 13:43 | andyf_ | except with printing, or whatever else you want to do, somewhere in there. |
| 13:44 | jonathanj | andyf_: i have basically that except using (loop) (and it fails for the obvious reason i mentioned up front) |
| 13:44 | andyf_ | no loop in my example, just normal recursion on left and right subtrees. |
| 13:44 | justin_smith | jonathanj: when I run walk on your data, I see a lot more output than you just shared |
| 13:44 | jonathanj | i was hoping (walk) or something could help me |
| 13:44 | andyf_ | I am not saying you have to use walk, or you should definitely avoid it. Just a suggestion. |
| 13:45 | jonathanj | justin_smith: can you paste it somewhere? (with the function call and input) |
| 13:45 | jonathanj | andyf_: sure, i'm mostly curious at this stage |
| 13:46 | jonathanj | i would like to try implement this with (walk) for my own education |
| 13:46 | andyf_ | jonathanj: If you figure out a simple example of using one of the walk function that is clearer to you than the ones on ClojureDocs.org, I'd recommend adding yours there. |
| 13:48 | justin_smith | jonathanj: weird, now that I look closer, I got the same result you did, and there are definitely things missing (bug?) |
| 13:59 | jonathanj | justin_smith: the documentation for walk doesn't say anything about depth first, and indeed there's no depth firsting going on |
| 14:00 | hellofunk | dumb q. from non java guy. Can the JVM take full advantage of all of a machine's resources? or is the VM always going to be limited compared to a "native" app |
| 14:00 | jonathanj | justin_smith: perhaps the trick is to call (walk) within itself? |
| 14:01 | code-ape | hellofunk: it really depends on what you're doing, the JVM does optimization that can make up for the extra weight of the VM for some things, other times it can't. |
| 14:02 | hellofunk | code-ape: interesting, thanks |
| 14:02 | code-ape | hellofunk: anytime :) |
| 14:25 | Intensity | Hi. I'm wondering if anyone has used the buddy crypto library. When I try the example encrypt code, the resultant encrypted bytes does not get bigger when I increase the input plaintext size. |
| 14:33 | hiredman | I dunno anything about buddy, but concerning crypto that is a property ciphers can easily have |
| 14:34 | hiredman | if a cipher operates on blocks of a certain size, and your input is smaller, your input will be padded to match the blocksize |
| 14:34 | hiredman | like I said, I dunno anything about buddy |
| 14:34 | justin_smith | Intensity: a common thing is that you have a fixed block size, whether you use all of it or not - your data is encoded into N blocks, which will be a certain block size * N rounded up |
| 14:34 | Intensity | hiredman: Thanks for the feedback. I understand what you're saying about that case. But if I give 32 bytes as input I don't see how I could get 16 bytes as output. |
| 14:35 | justin_smith | Intensity: the encryption includes a compression stage? |
| 14:35 | hiredman | are you sure you are using cipher functions and not hashing functions? does it decipher? |
| 14:36 | Intensity | justin_smith: No, I don't think it does. When I do an encrypt followed by decrypt, I get a result truncated to 16 bytes. I don't get my original data back. I may not be using it correctly. Maybe it's only intended to operate on 16 bytes at a time total, but the documentation doesn't suggest this limitation. |
| 14:36 | Intensity | hiredman: Yes, it does decipher; it's just that it deciphers to a subset. |
| 14:44 | jjttjj | if one were to develop a mordern charting library (like ggplot) what are some java libs it might build upon? |
| 14:49 | jonathanj | how do i do something like Python's `"x" * 4`? |
| 14:49 | jonathanj | "x" * 4 # => "xxxx" |
| 14:49 | mgaare | I'm getting this exception when trying to startup with lein run or lein repl, and I'm baffled. Caused by: java.lang.NoClassDefFoundError: com/stuartsierra/component/Lifecycle |
| 14:52 | mgaare | I can only assume this is related to aot somehow |
| 14:52 | amalloy | no, probably not |
| 14:52 | binjured | ,(clojure.string/join (take 4 (repeat "x"))) |
| 14:52 | clojurebot | "xxxx" |
| 14:52 | amalloy | or, well, maybe so |
| 14:53 | binjured | jonathanj: ^ |
| 14:53 | amalloy | (repeat 4 "x") |
| 14:53 | binjured | oh right, forgot repeat took a count |
| 14:53 | justin_smith | In transit, if I want some data to get encoded as if it were a string, what would I return for the tag method? I am trying to interpolate from looking at the output of write, but I am baffled |
| 14:55 | justin_smith | maybe I am doing this wrong - my channel is objecting to certain object types being encoded, so I am trying to make encoders that will just output a string (which is good enough for the client) in order to avoid having to walk the nested structure twice |
| 14:56 | justin_smith | (to be more accurate, the objects are encoding fine, it's the decoder that's complaining) |
| 14:59 | voidnoid | what leinengen command do I invoke to “run” this https://gist.github.com/weavejester/585915 |
| 14:59 | voidnoid | I’m guessing that lein run isn’t it? |
| 15:09 | justin_smith | I don't know if voidnoid changed nicks or something, but you can run all that code in a repl, or you can put it in a namespace so that lein run can find the namespace |
| 15:10 | justin_smith | the repl being lein repl of course |
| 15:15 | sdegutis | Quick poll: How many of you came from Ruby or Python? |
| 15:15 | gfredericks | phrasing it in a yes/no fashion might be more effective |
| 15:16 | gfredericks | if you're aiming at a percentage |
| 15:16 | sdegutis | Good point. |
| 15:17 | code-ape | sdegutis: I'm still a bit new to IRC, should we all just start answering or is there a better way to do this? |
| 15:17 | amalloy | gfredericks: about 15% of me game from ruby or python |
| 15:17 | amalloy | code-ape: the usual thing would be most people don't answer, because if everyone hit reply-all the room would be swamped |
| 15:18 | sdegutis | code-ape: I don't know I'm new to IRC too relatively. |
| 15:18 | justin_smith | code-ape: we should all send him /msg with our percentages |
| 15:18 | sdegutis | No no no that's inefficient. |
| 15:18 | amalloy | only people who feel very strongly will answer out loud, which means sdegutis will get a very biased answer |
| 15:18 | sdegutis | Just, one of you PM me with the number of how many of you have. |
| 15:18 | sdegutis | So, for example, if 37 of you came from Ruby or Python, one of you would PM me with "37". |
| 15:19 | amalloy | we can do this with recursion! i'll answer sdegutis's queestion by asking who here, besides sdegutis and me, came fmor python or ruby |
| 15:19 | amalloy | i'll add some amount to the answer i get, and send that to sdegutis |
| 15:19 | sdegutis | amalloy: it's already wayyyy more biased by being answerable only by people who are ever here, meaning you, justin_smith, gfredericks, and one other guy I can't remember his name |
| 15:19 | code-ape | can we use to bot for this? Does is keep persistent data? |
| 15:19 | oddcully | (inc python) |
| 15:19 | lazybot | ⇒ 3 |
| 15:19 | oddcully | darn |
| 15:19 | amalloy | you're suggesting we use lazybot as a census-taker?? |
| 15:19 | lazybot | amalloy: Uh, no. Why would you even ask? |
| 15:19 | sdegutis | amalloy: that plan has a race condition |
| 15:19 | oddcully | opend it was around 0 |
| 15:20 | oddcully | (inc sdegutis-poll-python) |
| 15:20 | lazybot | ⇒ 1 |
| 15:20 | gfredericks | yeah definitely namespace it |
| 15:20 | justin_smith | (dec python or ruby) |
| 15:20 | lazybot | ⇒ -1 |
| 15:20 | oddcully | (dec python) |
| 15:20 | lazybot | ⇒ 2 |
| 15:20 | sdegutis | (inc gfredericks) for that one |
| 15:20 | oddcully | that fixed me |
| 15:20 | amalloy | like if i switch to ruby while someone else is answering the question there'll be a race on my answer? |
| 15:20 | sdegutis | lazybot is broken |
| 15:21 | sdegutis | amalloy: no, meaning if two people say "who besides me and amalloy and sdegutis ..." |
| 15:21 | sdegutis | simultaneously. |
| 15:22 | code-ape | I feel like using a set may make things easier (?) |
| 15:23 | sdegutis | oh yeah totally |
| 15:23 | sdegutis | (def ruby-or-python (atom (set))) |
| 15:23 | sdegutis | ,(def ruby-or-python (atom (set))) |
| 15:23 | clojurebot | #error {\n :cause "Wrong number of args (0) passed to: core/set"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "clojure.lang.ArityException: Wrong number of args (0) passed to: core/set, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3628]}\n {:type clojure.lang.ArityException\n :message "Wrong number of args (0) passed to:... |
| 15:23 | sdegutis | wat |
| 15:24 | justin_smith | sdegutis: hash-set |
| 15:24 | sdegutis | oooh |
| 15:24 | justin_smith | set takes a coll |
| 15:24 | sdegutis | silly arbitrary naming scheme |
| 15:24 | oddcully | doesn't that get GCed after a few minutes? |
| 15:24 | sdegutis | you'd think (set) with no args would just be (hash-set) |
| 15:24 | justin_smith | the idiomatic thing would have been #{} a set literal |
| 15:24 | justin_smith | ,(set nil) |
| 15:24 | clojurebot | #{} |
| 15:24 | sdegutis | oh right haha |
| 15:25 | justin_smith | ,(hash-set nil) |
| 15:25 | clojurebot | #{nil} |
| 15:25 | sdegutis | ,(do (def ruby (atom #{})) (def python (atom #{}))) |
| 15:25 | clojurebot | #'sandbox/python |
| 15:25 | justin_smith | sdegutis: consistently: |
| 15:25 | justin_smith | ,(vec nil) |
| 15:25 | clojurebot | [] |
| 15:25 | justin_smith | ,(vector nil) |
| 15:25 | clojurebot | [nil] |
| 15:25 | sdegutis | How do you add to a set? |
| 15:25 | sdegutis | Does conj or cons work? |
| 15:25 | justin_smith | sdegutis: conj |
| 15:26 | sdegutis | ,(swap! ruby conj :sdegutis) |
| 15:26 | clojurebot | #{:sdegutis} |
| 15:26 | sdegutis | ,@ruby |
| 15:26 | clojurebot | #{:sdegutis} |
| 15:26 | sdegutis | ok there just conj away |
| 15:26 | justin_smith | ,(swap! ruby conj 'not-justin_smith) |
| 15:26 | clojurebot | #{:sdegutis not-justin_smith} |
| 15:26 | sdegutis | justin_smith: wait what??? |
| 15:26 | lazybot | sdegutis: Yes, 100% for sure. |
| 15:26 | justin_smith | sdegutis: just being a dumbass |
| 15:26 | sdegutis | but now the data is cluttered |
| 15:26 | sdegutis | how do we fix! |
| 15:26 | justin_smith | ,(swap! ruby disj 'not-justin_smith) |
| 15:26 | sdegutis | dissoc? |
| 15:26 | clojurebot | #{:sdegutis} |
| 15:27 | sdegutis | oh ok |
| 15:27 | code-ape | ,(swap! python conj :code-ape) |
| 15:27 | clojurebot | #{:code-ape} |
| 15:27 | gfredericks | I've started working on my active-record-envy-thing |
| 15:27 | justin_smith | fascinating |
| 15:28 | gfredericks | I kind of want to call it static-record |
| 15:28 | justin_smith | sedentary-record |
| 15:30 | hiredman | maps-or-something-i-dunno |
| 15:32 | gfredericks | can't yet tell if it's useful or not |
| 15:33 | hiredman | but is it functional? |
| 15:33 | gfredericks | hell maybe! |
| 15:40 | sdegutis | ,(defmacro from! [whence who] `(swap! ~whence ~who)) |
| 15:40 | clojurebot | #'sandbox/from! |
| 15:40 | sdegutis | ,(from! ruby sdegutis) |
| 15:40 | clojurebot | #error {\n :cause "Unable to resolve symbol: ruby in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: ruby in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: ruby in this co... |
| 15:40 | sdegutis | hahahaha get out of town clojurebot |
| 15:40 | sdegutis | you amnesiac you |
| 15:49 | voidnoid | so I’ve been googling for like an hour now, and there still doesn’t seem to be an obvious answer to this yet that I can find… how do I add a jar to my classpath manually with leinengen? |
| 15:49 | voidnoid | all the SO posts basically say I should use clojars, but the postgresql jdbc 9.4 driver isn’t in clojars |
| 15:50 | sdegutis | voidnoid: Leiningen takes from both clojars and maven |
| 15:50 | sdegutis | voidnoid: just mention it in your Leiningen file's dependencies. |
| 15:51 | voidnoid | ah ok thanks |
| 15:53 | voidnoid | sdegutis: yep that does it, thanks |
| 15:53 | sdegutis | So glad to be of service. |
| 15:53 | sdegutis | That'll be 30,000 reddit karma, please. |
| 15:54 | shem | only when you tell us what you will do with that karma. |
| 15:55 | sdegutis | Alternatively I'd say inc me with lazybot, to help my $karma catch up to amalloy's. But I don't want to catch up to justin_smith. So instead you can just dec amalloy. |
| 15:56 | sdegutis | shem: trade it in for real money of course |
| 15:59 | shem | sdegutis: nono. the final outcome is what we are interested in. idle luxury or botnets hatching wicked AI |
| 16:37 | arohner_ | is there a library that sets up generic file watching on a directory? |
| 16:37 | arohner_ | I want tools.namespace.dir style watching, but not tied to clj files |
| 16:38 | arohner_ | also, I want it to use the NIO file-watching stuff, so my clojure fn gets called when the file is saved |
| 16:38 | arohner_ | https://github.com/juxt/dirwatch looks interesting |
| 16:48 | binjured | is anyone aware of a way to use http-kit channel responses with compojure-api? |
| 16:48 | dagda1_ | why is (seq? [2 [3 [4 false nil] nil] nil]) false |
| 16:48 | amalloy | dagda1_: try simplifying your question. what does (seq? []) say? |
| 16:49 | dagda1_ | amalloy why is seq? false for a vector? |
| 16:49 | oddcully | arohner_: there is also org.apache.commons.io.monitor if you prefer to fiddle with java. it only needs a proxy basically |
| 16:50 | amalloy | &(doc seq?) |
| 16:50 | lazybot | ⇒ "([x]); Return true if x implements ISeq" |
| 16:53 | binjured | ,(instance? clojure.lang.ISeq []) |
| 16:53 | clojurebot | false |
| 16:53 | binjured | ,(instance? clojure.lang.ISeq ()) |
| 16:53 | clojurebot | true |
| 16:53 | dagda1_ | so I use coll? |
| 16:53 | mindbender1 | arohner: https://github.com/derekchiang/Clojure-Watch |
| 16:54 | amalloy | depends what you want to know |
| 16:55 | binjured | dagda1_: ideally you just know the argument is always a collection if it's important enough to check. you could use empty? or nil? to make a decision based on it. |
| 16:57 | mindbender1 | ,(nil? []) |
| 16:57 | clojurebot | false |
| 17:00 | binjured | nil? tells you if someone passed nil as an argument. if it's not nil, you can assume it's a collection (via hint, schema, core.typed, etc.) |
| 18:45 | N8Dawgr | Hi All, have an issue using try/catch inside a core.async go block |
| 18:46 | N8Dawgr | quite easy to reproduce in my environment |
| 18:46 | N8Dawgr | https://gist.github.com/71c3c8c343926062ab95.git |
| 19:54 | whomp | is mapcat the same as (reduce concat (map ...)) |
| 19:54 | whomp | ? |
| 19:56 | hiredman | apply |
| 19:56 | hiredman | reduce with concat is really bad |
| 19:56 | hiredman | (infact I am sure the doc string for mapcat says it is the same as apply concat) |
| 19:59 | whomp | hiredman, why is reduce so bad? i've often seen solutions on 4clojure that are different in that they either use reduce or apply |
| 20:07 | hiredman | reduce is not bad, reduce with concat is bad |
| 20:08 | whomp | why? just wondering |
| 20:11 | amalloy | $google clojure reduce concat stackoverflow |
| 20:11 | lazybot | [recursion - Why does reduce give a StackOverflowError in Clojure ...] http://stackoverflow.com/questions/24958907/why-does-reduce-give-a-stackoverflowerror-in-clojure |
| 20:16 | whomp | amalloy hiredman, thx :) |
| 21:20 | whomp | how come i have to use (map #(Character/getNumericValue %) ...) rather than (map Character/getNumericValue ...)? |
| 21:21 | amalloy | whomp: what is the type of Character/getNumericValue, when stored in a variable? |
| 21:22 | whomp | (def a Character/getNumericValue) gives me, CompilerException java.lang.RuntimeException: Unable to find static field: getNumericValue in class java.lang.Character, compiling:(NO_SOURCE_PATH:1:1) |
| 21:22 | justin_smith | whomp: on the jvm methods are not first class, so they can't be arguments or values |
| 21:22 | amalloy | so, what does that tell you? does it shed any light on your original questino? |
| 21:23 | whomp | ohh ok, thanks guys got it :) |
| 22:11 | WickedShell | Does core.async allow multiple publishers to a single subscriber? I've been unable to find any discussion of this use |
| 23:15 | justin_smith | WickedShell: as far as i know you can subscribe one channel to multiple publishers with the sub function |