#clojure logs

2016-01-08

00:00BRODUSkovrik: not quite. i just dont expect there to be a difference in behavior if I evaluate code directly or indirectly
00:01tolstoyfingertoe: Convert the values to numbers? Or is that the prob?
00:04BRODUSprints fine im in the buffer and use "cider-eval-last-sexp", but if i call an elisp function that uses "cider-nrepl-sync-request:eval" on the same code then nothing prints
00:05tolstoy,(apply + (map #(* -1 (read-string (subs % 1 (dec (count %))))) ["(12.50)" "(7.49)" "(8.12)"
00:05tolstoy "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"]))
00:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
00:05fingertoeThe ( ) notation of negative needs stripped, then the converted to a - number. I have been able to get one at a time.. but not the whole thing..
00:05tolstoy,(apply + (map #(* -1 (read-string (subs % 1 (dec (count %))))) ["(12.50)" "(7.49)" "(8.12)" "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"]))
00:05clojurebot-122.60999999999999
00:06tolstoyfingertoe: I don't know if that example is clear, but, you can use the "subs" function to get a substring.
00:07tolstoyfingertoe: Then use read-string to convert it to a number. Then multiply by -1. Then add it up (apply + [bunch of numbers]).
00:07rhg135Technically (1) is valid
00:08TEttinger,(reduce #(- %1 (first (read-string %2))) 0 ["(12.50)" "(7.49)" "(8.12)" "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"])
00:08clojurebot-122.60999999999999
00:08rhg135It is a list of a number, just get the first and flip it
00:08TEttingerthat's what I did too, rhg135!
00:09rhg135Ah, cool
00:09tolstoyAh, yeah.
00:09tolstoyI suppose a string/replace would be fun, too.
00:10rhg135It would
00:12fingertoeThanks! that should get me on my way. I am importing a spreadsheet from expensify, and summing stuff by category - I didn't have too much trouble with the positive amounts but the negative notation was too much to learn in one bite. ;-0
00:12TEttinger,(apply - 0 (read-string (clojure.string/replace (apply str ["(12.50)" "(7.49)" "(8.12)" "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"]) #"\)\(" " ")))
00:12clojurebot-122.60999999999999
00:13tolstoy,(read-string (with-out-str (print ["(12.50)" "(7.49)" "(8.12)" "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"])))
00:13clojurebot[(12.5) (7.49) (8.12) (9.99) (4.72) ...]
00:14TEttingerI wonder...
00:14tolstoy,(reduce #(- %1 (first %2)) 0 (read-string (with-out-str (print ["(12.50)" "(7.49)" "(8.12)" "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"]))))
00:14clojurebot#error {\n :cause "Don't know how to create ISeq from: clojure.lang.Symbol"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: clojure.lang.Symbol"\n :at [clojure.lang.RT seqFrom "RT.java" 542]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 542]\n [clojure.lang.RT seq "RT.java" 523]\n [clojure.lang.RT first "RT.java" 668]\n [clojure.core$fi...
00:14tolstoyHuh. Worked in my repl.
00:15tolstoyAnyway, convert the whole list into a string in one pass. ;)
00:18TEttinger,(apply + (map (comp - first read-string) ["(12.50)" "(7.49)" "(8.12)" "(9.99)" "(4.72)" "(5.98)" "(9.45)" "(25.79)" "(6.70)" "(22.43)" "(4.75)" "(4.69)"]))
00:18clojurebot-122.60999999999999
00:20TEttingerfingertoe: (comp - first read-string) is a way to construct a fn from those component parts, it turns "(12.50)" into -12.5 . you could use it on negative numbers with the parenthesized weird notation that expensify uses, but I'm not sure yet how to best switch around between reading positive and negative numbers
00:22TEttinger(comp #(if (seq %) (- (first %)) %) read-string)
00:23TEttinger,(apply + (map (comp #(if (seq %) (- (first %)) %) read-string) ["(12.50)" "7.49" "8.12" "(9.99)" "(4.72)" "5.98" "0.45)" "125.79" "6.70" "(22.43)" "(4.75)" "(4.69)"]))
00:23clojurebot#error {\n :cause "Don't know how to create ISeq from: java.lang.Double"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Double"\n :at [clojure.lang.RT seqFrom "RT.java" 542]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 542]\n [clojure.lang.RT seq "RT.java" 523]\n [clojure.core$seq__4351 invokeStatic "core.clj" 137]\n [clojur...
00:23TEttinger,(apply + (map (comp #(if (seq? %) (- (first %)) %) read-string) ["(12.50)" "7.49" "8.12" "(9.99)" "(4.72)" "5.98" "0.45)" "125.79" "6.70" "(22.43)" "(4.75)" "(4.69)"]))
00:23clojurebot95.45000000000002
00:24fingertoeI have been doing (def totperdium (reduce + (map bigdec (mapv :Amount mealcharged)))) on to get the totals on all of the positive catagories. Probably not the tidiest but it worked.
00:24fingertoeThe string thing is probably better?
00:24TEttingernot sure
00:24TEttingerthere have been some good suggestions and some sorta "let's see how else we can do this" ones
00:25TEttingerlike my string replacement one is not practical
00:26fingertoeIts all quite helpful to see -- I think that is the last crux -- Now that I can calculate that I can go back and look at better ways to do all my other catagories.
00:26TEttinger(comp bigdec #(if (seq? %) (- (first %)) %) read-string) ; this one should convert their negative and positive entries to the correct bigdec
00:27TEttinger,(apply + (map (comp bigdec #(if (seq? %) (- (first %)) %) read-string) ["(12.50)" "7.49" "8.12" "(9.99)" "(4.72)" "5.98" "0.45)" "125.79" "6.70" "(22.43)" "(4.75)" "(4.69)"]))
00:27clojurebot95.45M
00:27TEttingerclojure is absolutely awesome for data handling in my book.
00:27TEttingerI have used it to generate really complex text formatting things
00:28TEttingeranalyze large spreadsheets of just tons of data
00:28TEttingerlarge spreadsheets for me are not large for other people, I know finance industry types live by excel
00:29tolstoySeems like Excel is the modern Lisp Machine / Smalltalk Env. ;)
00:30fingertoeI hate expense reports. If I can write a little code to make them magically appear, that will make my life easier -- I will probably export my calcs back to an excel template - but the job will be pretty well done.
00:31fingertoeWe do a lot of porportional billing over multiple clients so none of expensify's reporting stuff was adequate -- But Expensify is Darn nice for capturing everything..
00:31tolstoyCan you just type the line items into a file of EDN statements, then slurp them in to produce a report, and a csv file?
00:31tolstoyOh, I see.
00:31fingertoePlus learning Clojure is a big bonus. My REPL is begining to replace my calculator..
00:32rplacafingertoe: if you want to create excel files from clojure, you can check out my excel-templates library
00:33rplacabasically injects data into an excel spreadsheet so you can do the formatting in excel and the data manip in Clojure
00:34fingertoeI saw this talk before I started -- https://www.youtube.com/watch?v=qnJs79W0BDo is that the one?
00:34rplacayup
00:34rplacathat's me! :)
00:34fingertoeGood deal --- I plan on it!
00:35fingertoeNice to meet you!
00:35rplacalikewise
00:36fingertoeMy first warm up project was a chess960 position generator.. I like that project for a quick "getting your toes wet"
00:38fingertoe(Randomly place the chess pieces in the row with bishops on opposite colors and the King always between the rooks)
00:44TEttingerfingertoe, yeah I spend a fair amount of time privmsging the clojure eval bot I run to generate calculations when I don't feel like starting up a local repl
00:45TEttingerhttp://i.imgur.com/Bw3JtHT.png
00:46BRODUSwhat is that font?
00:46TEttingerunifont
00:47TEttingerit supports all of unicode, which is the main reason I use it
00:47TEttingerwell, BMP
00:47TEttingerif I am choosing a font for "nice looking monospace", I usually use envy code r or inconsolata lgc (a custom variant)
00:48fingertoeI installed the REPL on my iPhone just to annoy my friends and co-workers.. It is handy though.
01:46amandabbwhats a good way to edit multiple indicies of a 2d array at once?
01:46amandabbsomething like this but that works: (assoc-in array2d [0 0] "a" [0 1] "b")
01:48justin_smith,(reduce (fn [a [e coords]] (assoc-in a coords e)) [[][][]] [[[0 0] "a"] [[0 1] "b"]])
01:49clojurebot#error {\n :cause "Key must be integer"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Key must be integer"\n :at [clojure.lang.APersistentVector assoc "APersistentVector.java" 345]}]\n :trace\n [[clojure.lang.APersistentVector assoc "APersistentVector.java" 345]\n [clojure.lang.APersistentVector assoc "APersistentVector.java" 18]\n [clojure.lang.RT assoc "RT.java" 792]\n [...
01:49justin_smitherp
01:49justin_smith,(reduce (fn [a [coords e]] (assoc-in a coords e)) [[][][]] [[[0 0] "a"] [[0 1] "b"]])
01:49clojurebot[["a" "b"] [] []]
01:50justin_smith,(reduce (partial apply assoc-in) [[][][]] [[[0 0] "a"] [[0 1] "b"]])
01:50clojurebot[["a" "b"] [] []]
01:50justin_smithyaya
01:52opqdonutI thought there was a function called "assocs-in" that does that
01:52opqdonutbut turns out it was just in our codebase :P
01:52justin_smithopqdonut: nice!
01:52amandabbstaring at it trying to understand.. almost got it i think
01:53justin_smith,(defn assocs-in [m & args] (reduce (partial apply assoc-in) m (partition 2 args)))
01:53clojurebot#'sandbox/assocs-in
01:54justin_smith,(assocs-in [[][][]] [0 0] 'a [2 0] 'b)
01:54clojurebot[[a] [] [b]]
01:54justin_smithsweet!
01:54justin_smithamandabb: maybe the assocs-in def helps the former one make sense?
01:54amandabbyeah it does thanks
01:55justin_smithopqdonut: that's great, I have so many -> chained assoc-in calls in my codebase that I can change into assocs-in
01:56opqdonutheh, good for you
01:57justin_smithopqdonut: for some reason I never thought of defining that function- makes so much sense
02:06amalloyjustin_smith: it's kinda impossible to write efficiently, though, if you have multiple updates that share a prefix
02:07amalloyinstead useful has something called adjoin, which is more general but for two maps specializes to deep-merge, and that *can* be efficient
02:08caternargh
02:08caterni'm back
02:08caternor not
02:08justin_smithamalloy: cool
02:09amalloyincidentally, if you care about efficiency and have update paths that are known at compile time you can rewrite those chained assoc-in things to use update-in at each place where two paths diverge
02:10amalloy(-> m (assoc :x 1) (update-in [:y :z] assoc :a 1 :b 2))
02:11amalloyinstead of (assocs-in m [:x] 1 [:y :z :a] 1 [:y :z :b] 2)
02:11justin_smithyeah
02:11justin_smiththen we get the "easy to read vs. easy to know exactly what's happening" thing
02:12amalloyaren't those exactly the same in this case? mine is clearly harder to read and also not so easy to understand what's happening, but it runs faster
02:12amalloyi'm not proposing you have a macro do that rewrite for you, which i agree would be spooky magic
02:13justin_smithamalloy: with idiomatic indenting the second one is a lot clearer. Not a code clarity deal breaker of course, if the efficiency is an issue there.
02:14amalloyright
02:38augustlhmm, mori.hash(0) => 0, mori.hash(null) => 0
02:39augustlthat can't be right :)
02:39augustlmori is the JS wrapper for the cljs data structures, btw
02:53justin_smithaugustl: why can't it be right?
02:53augustl0 and null isn't the same
02:54justin_smithaugustl: all hashes have collisions
02:55justin_smithI mean, it might be a bad idea to have 0 and null collide for some reason? but collisions are inevitable
02:59augustlI expect that the value "0" comes from some predicates before running the actual hashing :)
03:00augustlI should probably use mori.equals instead of mori.hash(a) === mori.hash(b) though :)
03:00augustlmori.equals(0, null) returns false
03:17amandabbdoes filter guarantee order if done on a vector?
03:17amandabbi need to remove some elements but everything else has to stay where it is
03:19augustlamandabb: yes
03:19amandabbhooray
03:19amandabbthanks
03:19augustlamandabb: but you might not get a vector back
03:19amandabbok ill call vec on it if i need to
03:19BRODUSor use filterv
03:19amandabboh yeah i was going to ask about that
03:20amandabbwhy are there v versions for a lot of functions?
03:20BRODUSbecause sometimes you need a vector
03:20amandabbseems messy
03:20amandabbcouldnt there be a v version for like.. most.. higher order functions?
03:20amandabbi thought transducers or something were supposed to fix that but im not sure
03:55engblomsouterrain: I saw someone has been downloading the gpio library from clojars.org. I am guessing it was you as you planned to do it. I am curious how it worked for you
05:44domgetterjustin_smith: I went ahead and generalized the problem we were working on about conditional partitioning: https://gist.github.com/domgetter/3833a98997b58a2597f8
06:11ridcully_domgetter: you could use destructuring instead of the book/books arguments. [book & books] coll, later just pass books instead of (first books) (rest books)
06:13domgetterridcully_: on line 5 or on line 6?
06:14domgetteroh I think I understand
06:16domgetterridcully_: There, I changed it. Like that?
06:16ridcully_domgetter: yes
06:17domgetterawesome, thanks for the tip
06:18TEttingerridcully_: I'm glad we have another helpful person here to advise on cleaning up code! thanks for being a substitute justin
06:24winkmhm, invalid ssl cert for clojure.org
06:24winkbut apparently nobody uses the https version
06:29poweredwhy use https for static websites?
06:29poweredfor man in the middle attacks or something?
06:31mpenetyep
06:32mpenetit's not just a static website, it has links to binaries: http://clojure.org/downloads
06:32mpenetcould have malware injected in the page itself etc etc
06:35augustlthe download link should be to https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0/clojure-1.7.0.zip instead of http://repo1.maven.org/maven2/org/clojure/clojure/1.7.0/clojure-1.7.0.zip
06:35augustlseems like clojure.org itself doesn't provide any downloads
06:35mpenet yes that too
06:35mpenetthe link is there, a mim you inject a link to whatever
06:35mpenetcould*
06:35augustlgood point
06:36mpenetand mim attacks are more common than you think (hello "free wifi" acces in airports)
06:37mpenetbut yeah, targetting clojure.org for such things would be odd, but there are tons of vectors. in short https is good
06:38ridcully_TEttinger: that's like saying, paste is a substitute for butter ;)
06:38winkwell, feel free to fire off a mail to any mailing list, I won't subscribe just for that :)
07:11neurostormHi.
07:11neurostormI'm typing to update inside a tree-structure like this:
07:11neurostorm{:key nil,
07:11neurostorm :root
07:11neurostorm {:data {:key "123"},
07:11neurostorm :children
07:11neurostorm [{:data {:key "234"}, :children []}
07:11neurostorm {:data {:key "345", :x 12},
07:11neurostorm :children [{:data {:key "456"}, :children []}]}]}}
07:11neurostormI can find the value i want to change, but loose ability to return the full modified tree. How can i change a value and return the full tree?
07:12neurostorm,{:key nil, :root {:children [{:children [], :data {:key "234"}} {:children [{:children [], :data {:key "456"}}], :data {:key "345", :x 12}}],:data {:key "123"}}}
07:13clojurebot{:key nil, :root {:children [{:children [], :data {:key "234"}} {:children [{:children [], :data {:key "456"}}], :data {:key "345", :x 12}}], :data {:key "123"}}}
07:16domgetter,(def neurosmap {:key nil, :root {:children [{:children [], :data {:key "234"}} {:children [{:children [], :data {:key "456"}}], :data {:key "345", :x 12}}],:data {:key "123"}}})
07:16clojurebot#'sandbox/neurosmap
07:16domgetter,(update-in neurosmap [:root :children 0] conj 17)
07:16clojurebot#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" 542]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 542]\n [clojure.lang.RT seq "RT.java" 523]\n [clojure.lang.APersistentMap cons "APersistentMap.java" 40]\n [clo...
07:17domgetter,(update-in neurosmap [:root :children 0 :children] conj 17)
07:17clojurebot{:key nil, :root {:children [{:children [17], :data {:key "234"}} {:children [{:children [], :data {:key "456"}}], :data {:key "345", :x 12}}], :data {:key "123"}}}
07:18neurostormThats it. Thanks.
07:21neurostormNow i just need to write a find-path-to-key function :-)
07:55domgetterneurostorm is gone, but I think this is what they needed: https://gist.github.com/domgetter/138b14ac558b4aa52d18
07:57justin_smithdomgetter: (fn [i e] [i e]) is vector
07:58justin_smithwell, it's the version of vector that only takes two args I guess
07:58domgetterI needed the index of the child so I could build the path
07:58justin_smithdomgetter: right
07:59justin_smithbut you can replace "(fn [i e] [i e])" in that code with "vector"
07:59justin_smithor "list"
07:59domgetterah I see what you mean
07:59domgetteras if I did (fn [a] a) instead of identity
07:59justin_smithright
08:00domgetteris (map-indexed vector ...) a common idiom?
08:00justin_smithyes, but I usually use (map-indexed list ...) if all I am doing is destructuring it immediately and I don't need it to be a vector
08:01justin_smithdomgetter: and it's exactly for this case, where you want to know the index of each item in a for
08:01domgettersweet, I updated the gist
08:03domgetteris the for loop preventing the recursive call from being in the tail position?
08:03domgettersince the original function needs to work on the other children?
08:05justin_smithyou could use keep rather than (filter identity (for ...)) ... (first (keep (fn [index child] (find-with-key ...)) (range) (:children ds)))
08:05justin_smithI don't know if that's an improvement or not
08:06justin_smithwait, is keep var-args...
08:06justin_smith,(doc keep)
08:06clojurebot"([f] [f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects. Returns a transducer when no collection is provided."
08:06justin_smithnever mind, keep is not var-args, so leave as is
08:08domgetter(defn convert-to-var-args [f] (partial apply f))
08:09justin_smithstill wouldn't do the right thing - this one needs (comp (partial keep f) (partial apply map list)) I think
08:10justin_smith(partial apply map list) is a hell of a function btw
08:10justin_smith,((partial apply map list) [[1 2] [3 4] [5 6]])
08:10clojurebot((1 3 5) (2 4 6))
08:10domgetterI'm trying to understand what it would be. I'll go play with it
08:11justin_smithit's matrix-rotate or something
08:11ridcully_transpose?
08:11clojurebot(def transpose (partial apply map vector))
08:11domgetternth-of-each ?
08:11justin_smithridcully_: that's the word!
08:12justin_smithclojurebot: vector/list potato/potato
08:12clojurebotCool story bro.
08:13domgetterwhy does vector have 5 arities?
08:14domgetterperformance?
08:14clojurebotperformance is http://meshy.org/2009/12/13/widefinder-2-with-clojure.html
08:14justin_smithdomgetter: yes, performance
08:14justin_smithclojurebot: you are super helpful this morning
08:14clojurebotHuh?
08:39jsabeaudryA little core.async puzzle: why is :done printed only if line 7 is commented out? https://www.refheap.com/113449
08:41MJB47im going to guess its something to do with buffering
08:41MJB47can you define ch to be (chan 2)
08:41MJB47?
08:42jsabeaudryMJB47, yes but it defeats the purpose
08:43domgetterMJB47: that doesnt seem like it would matter. the second go block takes from the channel and then takes from a timeout. closing the channel results in the print if there's no timeout
08:44MJB47then i have no idea :(
08:47domgetterIs that how you take from a timeout?
08:47justin_smithMJB47: puts to closed channels returns immediatly
08:48justin_smithMJB47: or, I mean >! to closed channels returns immediately
08:48jsabeaudrydomgetter, yes
08:49domgetterjustin_smith: so if the timeout amount was sufficiently small, we'd see the same behavior?
08:50justin_smithdomgetter: I'm experimenting now, but I believe so
08:50jsabeaudrydomgetter, timeout of 1 yields the same result
08:53justin_smithdomgetter: yes, with a short enough timeout I don't see :done
08:54justin_smitherr, even with a short timeout of 1
08:54justin_smithwhen I make it a (chan 2), I see :done
08:57justin_smithactually, even (chan 1) is enough to make :done still come up with the timeout
08:58MJB47oh the arg is the size of the buffer
08:58MJB47not "how many things can the channel hold at a time"
08:59jsabeaudryMJB47, those two things are the same?
08:59justin_smithright, (chan) is (chan 0)
08:59MJB47^
08:59justin_smithjsabeaudry: (chan 0) can hold one item - no buffer though
08:59justin_smiththat's the difference
08:59MJB47the chan holds a value, and with (chan 1) it can hold ANOTHER value in the buffer
09:01jsabeaudryjustin_smith, no, (chan) holds 0, you can test it with (let [ch (chan)] (go (>! ch 1) (println "never prints")))
09:01justin_smithjsabeaudry: oh, right
09:06jsabeaudryready for a hint?
09:07justin_smithjsabeaudry: here's a version that makes it easier to experiment with https://gist.github.com/noisesmith/d2b488f3f99dfb6ec524
09:07justin_smithjsabeaudry: sure
09:09jsabeaudryjustin_smith, hint: add a (println (<! ch)) after the close! call
09:09jsabeaudryjustin_smith, what exactly is "buffer" ?
09:09justin_smithjsabeaudry: oh, I fucked that up, one moment, fixing
09:09jsabeaudryand why does it matter?
09:09jsabeaudryoh ok
09:10justin_smithclassic refactor mistake with magic numbers :)
09:10justin_smithjsabeaudry: updated https://gist.github.com/noisesmith/d2b488f3f99dfb6ec524
09:11mpenetjsabeaudry: it does matter depending on your usage of chan, especially with regards to the rate of puts/takes and what to do if/when it's full
09:12mpenetex how to handle backpressure
09:12mpenetalso internally you can only have 1024 pending puts per channel
09:13mpenetby pending I mean "puts in the wait queue until there's room in the buffer"
09:21lokienridcully_: I've done it, it turned out to be pretty easy. thanks for help
09:23jsabeaudryjustin_smith, here is an updated version keeping the spirit of the puzzle: https://gist.github.com/jsab/ff8f4689d48192ab8a6f
09:25jsabeaudrybasically showing that the buffer size is not relevant to the puzzle
09:31justin_smithjsabeaudry: I wasn't rewriting the puzzle, I was writing a function that would show behaviors of things similar to the puzzle, as a way of seeing what was actually happening
09:32justin_smithclassic experimentation - you change a parameter and see how the behavior is changed
09:33jonathanjwhat is the most readable way of writing "if X then (foo X) else X"?
09:33justin_smith(and X (foo X)) perhaps?
09:33MJB47(if x (foo x) x)
09:34justin_smith(some-> x foo)
09:34justin_smithif nil is what you are checking for, that is
09:34MJB47actually
09:34jonathanjactually, i guess my case is slightly different, it's actually: x = ...; if pred then (foo x) else x
09:34MJB47(or (foo x) x) ?
09:34MJB47no that doesnt work
09:34justin_smithMJB47: that runs (foo x) even if x is nil
09:35justin_smithwhich by the original is not right
09:35MJB47yer i realised after
09:35jonathanjhrm, i did (cond-> x (pred) (foo x)) but maybe some-> is actually shorter for this particular case
09:35jonathanjactually, no i do need the test to be something other than just checking nil
09:36jonathanjit's just kind of weird to write a cond with a single condition
09:36justin_smithOK, so it's not just if X, it's if (pred? X)
09:36jonathanjjustin_smith: sorry, i'm doing a horrible job of explaining myself
09:36justin_smith(and (pred? x) (foo x))
09:36jonathanjthe predicate doesn't actually need X
09:36justin_smithoh, never mind then
09:37justin_smith(when cond (foo x))
09:37jonathanjwhat i'm doing is (cond-> (create-image ...) (pred-something) (process-image))
09:37jonathanjunfortunately when returns nil when not cond
09:37jonathanji want the original value
09:37justin_smithso we are back to (if pred (foo x) x)
09:38jonathanjyeah, pretty much, except using x twice like that means assigning it
09:38jonathanji guess i can just define it further up the let
09:38justin_smith((if pred foo identity) x)
09:38jonathanji think the if is clearer than cond->
09:38justin_smithhaha
09:38jsabeaudryhahahhaha
09:38jonathanjhaha
09:39jsabeaudrythe lenght we go to avoid letting a variable
10:45princesohow to "inject" definitions into a namespace? this doesnt work (let [x 1](in-ns 'an-ns)(def y x)) <- it defines into actual ns.
11:36jsabeaudryprinceso, look-up the `intern` function
11:38gf3Raynes: holla
11:41schmirprinceso: https://github.com/zcaudate/vinyasa
11:42schmirprinceso: you want inject: https://github.com/zcaudate/vinyasa#inject
11:59jarjar_prime<o/
12:00sdegutis+1
12:00chawlsdoes anyone know of a library offering an implementation of min/max heaps? I've found a few blogs explaining how one would write one in Clojure, but I'd rather use an existing implementation rather than rolling my own
12:26phaseNiHello, is there a way to put metadata on the symbol that defun creates directly, rather than wrapping it in with-meta?
12:27justin_smithphaseNi: (defn ^{:foo "some value"} bar [])
12:28justin_smithphaseNi: also, (defn ^:foo bar []) which is a shorthand for (defn ^{:foo true} bar [])
12:28phaseNiuser=> (defn ^{:foo "some value"} bar [])
12:28phaseNi#'user/bar
12:28phaseNiuser=> (meta bar)
12:28phaseNinil
12:28lumayou need (meta #'bar)
12:28justin_smithphaseNi: (meta #'bar)
12:28phaseNihmmm
12:29justin_smithphaseNi: bar returns the function, the function does not get metadata, #'bar returns the var, the var does get metadata
12:30phaseNiyeah, thats not what I need
12:30phaseNi(def baz (with-meta bar {:baz 1}))
12:30phaseNiI'm trying to avoid that...
12:30justin_smithphaseNi: OK, so you want metadata on the value and not the var
12:31phaseNiyes
12:32phaseNiis it possible, without a defun like macro?
12:32sdegutisBidi or Silk? YOU decide!
12:34sdegutisBut seriously. Which one y'all prefer?
12:35phaseNihttps://carouselapps.com/2015/09/21/bidi-vs-silk/
12:35phaseNiyou've seen that?
12:36winkyuck
12:37winkthat sounds horribl
12:37momerath42I've read the java interop page, and maybe it's just my lack of java knowledge, but I can't figure out how to: call a method that a java object I have in hand is supposed to have inherited from a parent class
12:37winkI mean.. disencouraging that is all fine, but outright disable that feature...
12:38winkmomerath42: I'd be surprised if it didn't work just like calling a method defined in that child class...
12:38momerath42i get an IllegalArgumentException "no matching field found"
12:39momerath42i'm guessing it's a namespace issue, but haven't figured out how to import the methods of the parent class (AbstractHistogram which Histogram inherits from; this is in the HdrHistogram lib)
12:40wink(.toString (java.sql.Time. 1234)) "01:00:01"
12:40winkI think your problem must be a different one
12:41winkif class B extends A (in java) then you should not need to import anything besides B
12:42momerath42(.getTotalCount (Histogram. 1000 0))
12:42momerath420 (.getHistogramData (Histogram. 1000 0))
12:42momerath42IllegalArgumentException No matching field found: getHistogramData for class org.HdrHistogram.Histogram
12:42momerath42getTotalCount is defined in the child class, whereas getHistogramData is in AbstractHistogram
12:43winkit's not
12:43winkhttps://github.com/HdrHistogram/HdrHistogram/blob/master/src/main/java/org/HdrHistogram/AbstractHistogram.java
12:43winkyour docs must be wrong
12:43winkit's also not in AbstractHistograms's parent. unless I fail at searching
12:44momerath42hrmm- yeah, i was looking at some web-based class browser; I guess it's old, but then so are the quickstart docs on the official github page
12:44winkor jumped to the c# part in the readme. https://github.com/HdrHistogram/HdrHistogram/search?utf8=%E2%9C%93&amp;q=getHistogramData
12:45winkjava interop is not pretty, but it works for cases such as this ;)
12:45wink(it is *awesome* - just not pretty, imho)
12:47momerath42the github readme doesn't say what language the example code is in, that I can see, but it looks like java to me; is it actually c#?
12:51momerath42looks like the api changed significantly, but not the readme; just going by the test code now, and have what I need. thanks!
12:55winkgood luck :)
12:55winkI think there's both languages in the repo
12:57sdegutisdoes github.com/juxt go by another nick in here?
12:59winkit's an org.
13:01sdegutisOh.
13:02sdegutisWhy is it generally better to call a method via (method r) on a record, rather than (.method r) ?
13:07jsabeaudryCan a closure close on itself?
13:07sdegutisjsabeaudry: technically no
13:07sdegutisjsabeaudry: however, fn can be named
13:07sdegutisjsabeaudry: watch this
13:07sdegutis,((fn x [] (x) ))
13:07clojurebot#error {\n :cause nil\n :via\n [{:type java.lang.StackOverflowError\n :message nil\n :at [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" -1]\n [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval25$x__26 invoke "NO_S...
13:07sdegutisjsabeaudry: so technically yes
13:08sdegutis...kinda
13:08jsabeaudrysdegutis, sweet! I think its going to work! I need it to remove itself from an atom when it is done
13:09sdegutisjsabeaudry: ah clever
13:09sdegutisjsabeaudry: perhaps too clever? :D
13:09jsabeaudrysdegutis, perhaps ;)
13:10sdegutisjsabeaudry: however, it may leak.. I have no idea, that's too meta for my tiny brain
13:14jsabeaudrysdegutis, bah it's just a reference loop, a very small one
13:14sdegutis+1
13:19jsabeaudrysdegutis, wow, it works, thanks a lot that really made my day!
13:19sdegutisjsabeaudry: hoorah!
13:44dnolenhttps://twitter.com/swannodette/status/685532192605343744
13:44dnolenClojureScript 1.7.228 released
14:15sdegutisdnolen: oh nice, parallel builds
14:19justin_smithsdegutis: https://gist.github.com/noisesmith/735429288e69c6126f9a
14:20sdegutisjustin_smith: bwahahahahoho
14:22sdegutisthat reminds me of how you can .write to *out* to enforce parallel logging
14:25justin_smithsdegutis: right, but unlike apply println it won't consider each character a separate printing task to interleave with all others
14:25justin_smithso it is much less amusing
14:25sdegutisthats what i mean tho
14:26sdegutis(defn safe-println [s] (.write *out* (str s "\n")))
14:28justin_smithsdegutis: updated https://gist.github.com/noisesmith/735429288e69c6126f9a
14:29justin_smithdef safe-printer (comp println #(clojure.string/join \space %&)))
14:29justin_smithactually has the same behavior as println (except for the interleaving annoyance)
14:29sdegutismazing-tastic
14:30justin_smithsdegutis: with your version it's now one arg, and you need to do the space joining by hand
14:58TimMcToday's sadness: -XX:-OmitStackTraceInFastThrow and it not always being in effect
14:59TimMcIf you fail to set that, HotSpot will sometimes decide to not fill in the stack trace for certain exceptions.
14:59BronsaTimMc: yup :( bit me way too many times
15:04novak`I'm playing around with Luminus and have an question about it's project organization (though I doubt it's maybe related to Leiningen). How thinks around <app-name>.config works? I see there is <app-name>/env/prod/config.clj and <app-name>/env/dev/config.clj and I understand what it doues but question is how? Is it related to Leiningen?
15:05justin_smithTimMc: had a case recently with a rare heisenbug and we had that turned on, but aviso/pretty still hid the actual details that would let us track the trace down... worst part was we never decided to use aviso, it was present transitively
15:24sdegutisI thought Luminus was deprecated?
15:24sdegutisOr was that something else?
15:32loopholehi
15:36loopholegiven this function: (defn x [& {:keys [a] :or {a 1} :as xmap}] (print xmap)). what's the reason the default values given in :or are not represented in xmap?
15:37sdegutisloophole: the default values are only for the destructured symbols themselves; the :as form gives you the map itself as it was received
15:38sdegutisThe end.
15:38loopholesdegutis: ok. I wrote a macro for my needs. was just curious :)
15:39sdegutisok
15:56novak`sdegutis: No, Luminus is actively developed (since it is just a lein template utilizes standard set of Clojure web libraries related to web)
15:56novak`sdegutis: You maybe talk about Noir?
15:59novak`sdegutis: "...web libraries related to web..." :D brilliant construction of mine...
16:00sdegutisnovak`: oh ok thx
16:37devnHow do I check whether a symbol is bound locally?
16:38devn,(let [x 1] (bound? x))
16:38clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.Var"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.Var"\n :at [clojure.core$bound_QMARK_$fn__5490 invoke "core.clj" 5306]}]\n :trace\n [[clojure.core$bound_QMARK_$fn__5490 invoke "core.clj" 5306]\n [clojure.core$every_QMARK_ invokeStatic "core.clj" 2571]\n [clojure.core$...
16:38devnThinking of something like this...
16:38devth,(resolve (symbol "nope"))
16:38clojurebotnil
16:38devth,(resolve (symbol "into"))
16:38clojurebot#'clojure.core/into
16:38devthare you talking about dynamic vars?
16:38justin_smithdevth: did the form compile? if so the symbol is bound
16:39justin_smitherr, sorry, devn ^
16:39devth:-)
16:39devnjustin_smith: heh, so pretend you want it to compile either way :D
16:39justin_smithdevn: ruby's over there ... ->
16:39justin_smith:)
16:40devnhahahahahahahahaha
16:40devn<3
16:43justin_smithdevn: there's some implementation details you can hack at if you really want to know if something is in scope, but it's messy and no compatibility is guaranteed between clojure versions iirc
16:43justin_smithdevn: the whole premise is something clojure's design tries to push you away from
16:45kwladykaWhat is important for employers to hire Clojure developer? In most of cases people reject me because of not enough experienced even without talking with me. I attached example of my code https://github.com/kwladyka/chess-challenge and what i know from others my code is very good. I don't have standard carrier, because before i cofounded 2 companies and i have a lot of business experience also. What should i do to be good in eyes of
16:45kwladyka employers? What is your experience about that?
16:46kwladykaHow to became an expert Clojure which employers want to hire. But i am not talking about skills... i am talking about what employers want to see what is not the same.
16:48devthkwladyka: build stuff and show it to them
16:48kwladykadevth this example of code is not enough? What kind of stuff is enough?
16:49devthit looks good but one example doesn't show much depth
16:49devthi like to see that people love to build stuff (in any lang/tech, really)
16:50devthopen source projects are a plus
16:50kwladykadevth and this is not easy... for example now in work i do some things but.... i can't talk about that, show nothing, even tell name of companies, because of huge penalty.
16:50devthyeah that's hard
16:50devthmost people do open source on the side because they love it
16:51kwladykadevth i don't have enough time to really care about some open source project :( I can create something to show my potential but what?
16:52devthok but you'll need to figure out some way to communicate your abilities & what motivates you. showing your work is easiest and carries the most weight.
16:52devthno one really has enough time...
16:52kwladykai am working in 2 companies now, i really don't have enough time to do something more now
16:52kwladykaok, maybe in this way:
16:52kwladykain your opinion open source is necessary or it can just project to show skills?
16:53devthi'd say it's more a nice to have. not necessary
16:53kwladykammm but for sure i don't have enough time to create something what people will really use
16:53devthok. so if you don't have open source you'll need to be able to talk about some projects you have worked on.
16:53kwladykaor i don't see some opportunity ?
16:54devthtech you used. challenges you faced and how you solved them. etc
16:54ystaelkwladyka: what is the most important property of the positions you are looking for? that you be programming in Clojure?
16:54kwladykadevth yeah but employers reject me without even talking with me :)
16:54kwladykadevth not every-time but too often
16:55ystaelbecause, for example, my company would like to hire a developer for a job where a substantial amount of the code will be in Clojure. but "Clojure" is very far from the most important qualification we're looking for.
16:56kwladykaystael i love solve business problems, optimise, creating solutions etc. especially when i can use my business experience during coding.
16:57devthkwladyka: if possible ask why you were rejected then address that problem. also meticulously go over everything you're presenting to them. consistency, no typos. well-designed, well-written resume.
16:57ystaelkwladyka: Are you finding that the fact you've been working primarily in Clojure is actually a problem?
16:58devthkwladyka: your chess readme looks good, as does the code. might want to add a license.
16:59kwladykaystael Clojure is problem because in my country is a few companies working in Clojure. So only companies outside my country have sense.
16:59ystaelkwladyka: Does that mean you're looking largely outside your country, or considering non-Clojure jobs, or both?
16:59kwladykaPurpose for my question now is what should i do to became Clojure expert in for example 1 year. But still not about skills... about employers.
17:00devthi don't really know what it means to be an expert :)
17:00ridcully_be an expert first, then sneek in clojure ;)
17:00kwladykaystael Clojure outside my country, Relocation ore remotely.
17:01devthkwladyka: try applying to lots of jobs
17:01kwladykadevth i don't know too, but for employers it has to mean something good :)
17:01devthi don't think employers are the keepers of the definition
17:01devththeir definitions probably vary quite a bit
17:02devthlots of jobs don't require you to be an expert though
17:02kwladykadevth just became a man who you want to hire :)
17:02kwladykai am afraid the problem can be i co-founded 2 companies.
17:02kwladykaI mean.... employers can afraid that
17:02kwladykai am not pure coder
17:03kwladykamaybe they afraid i will quit
17:03ridcully_if an employer would look up those companies, what would it find out about them?
17:03devthi saw your linkedin page - might want to emphasize your code skills there. say software engineer or developer (as long as that's accurate). "IT" itself doesn't mean much.
17:04kwladykaridcully_ one was sold many years ago and the second what is e-store and this company is a leader in my country, now trying get into UK
17:05kwladykakrainaherbaty.pl and hotcup.co
17:08kwladykadevth yes now i have description for manager in head. Before i had Clojure Developer description :)
17:15jonathanjis there a function in the core library for determining whethe two values are within some delta of one another?
17:18justin_smithjonathanj: not that I know of, but there is ulp
17:18justin_smith,(Math/ulp 2.0)
17:18clojurebot4.440892098500626E-16
17:18justin_smith,(Math/ulp 0.2)
17:18clojurebot2.7755575615628914E-17
17:18justin_smithetc.
17:19sdegutisWelp.
17:19princesojsabeaudry schmir Thank you. I was looking for something more basic. like this (defmacro at-ns-do [nms body](let [actual-ns *ns*] `(binding [*ns* (create-ns ~nms)]~body)))
17:20justin_smithsdegutis: whelps http://www.petproductnews.com/puppies.jpeg
17:21justin_smithprinceso: that's not more basic than (intern (create-ns nms) s val)
17:21jonathanjjustin_smith: i also found this: https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/math_functions.clj#L208
17:21justin_smithprinceso: it doesn't even need to be a macro
17:22sdegutisjustin_smith: haha oh you
17:23justin_smith,(intern (create-ns 'foobarbaz) 'hello "world") ; princeso
17:23clojurebot#'foobarbaz/hello
17:23justin_smith,foobarbaz/hello
17:23clojurebot"world"
17:23justin_smithprinceso: that's what you want right?
17:25princesojustin_smith. i want to execute data like this (defn ^{:...} fun [x] (if (= 1 x) ...))
17:27justin_smith(intern (create-ns target) '^{:...} fun (fn [x] (if (= 1 x) ...))
17:28princesojustin_smith let me try that :)
17:32justin_smithprinceso: in my own repl that puts the expected meta on
17:3218WABQT5Gjustin_smith is a clojure deity
17:3218WABQT5G:D
17:33slesterwhoops.
17:33princesojustin_smith. ah thanks i actually tried that way. But I depend on yet written definitions "(defn ...)". So maybe im obligated to macro (defmacro at-ns-do [nms & body]`(binding [*ns* (create-ns ~nms)] ~@body))
17:35justin_smithprinceso: (fn ...) can do everything (defn ...) can
17:36sdegutisand then some!
17:42princesojustin_smith thanks man. What im doing is altering definitions from .clj files, for debugging purposes. Transforming (in this case) from (defn ..) to (fn ...) would be a useles task. Thanks friend for taking the time.
17:43justin_smithprinceso: oh, in that case just use robert.hooke
17:43justin_smiththat's what it is for
17:43justin_smithor alter-var-root
17:43justin_smithrobert.hooke is basically a more fancy way of replacing a function via alter-var-root
17:44princesolet me see that of robert :D you are a book man
17:44justin_smithalso, if it's just for debugging, you could just use with-redefs
17:47princesoi dont know if implementing a lot of tools would be good when learning. Any way thanks for the recommendations
17:47princesojustin_smith
17:47justin_smithprinceso: if you are just learning, you shouldn't be doing things by altering namespaces from the outside
17:48justin_smithprinceso: but also, with-redefs is part of clojure.core, and very simple to use
17:49princesojustin_smithl let me put an eye on it.
17:50rhg135,(doc with-redefs)
17:51clojurebot"([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...
17:52rhg135justin_smith: except in ruby, where it's encouraged
17:58rhg135my first assingment for a rails course had me monkeypatch the String class 0.o
17:58turbofailgross
17:59rhg135part of me died that day
17:59justin_smithprinceso: in fact, it's also simple to do (load-file "my-copy.of-some-other-ns.clj") to load your alternat defs for exploration / debugging
17:59justin_smithand that might just be the easiest thing for your goal
18:08amandabbwhat's a good way of pausing a game or ending a game with core-async?
18:08amandabblike, i have a lot of (go while true's) that sends commands to the game channel
18:08amandabbshould i make an atom boolean for like "is-game-running", use close! on core-async, or something else?
18:09princesojustin_smith yes im taking the namespace, say some.ns and transforming it into something like some.ns-2a5regi1845. The thing im doing is wrapping objects into an observer.. say you have (an-func ...) then you get (eye (an-func ...))
18:09justin_smithamandabb: you could have a pub/sub "tick" channel, and always wait for a tick before the next "round" of operations
18:10justin_smithprinceso: yeah, I'd just use load-file to make clojure load the edited file
18:11amandabbyeah but then how would i stop the tick channel
18:11jonathanjdon't publish to it, i guess?
18:11princesojustin_smith: i dont know , im loading every definition whit clojure.repl/source-fn, from that i walk the structure.
18:12justin_smithprinceso: every jar contains the cljs files
18:12justin_smithprinceso: a jar is a zip file
18:12justin_smithunzip it, edit the file, then use load-file to load the new definition
18:12justin_smithin fact, an editor like emacs or cursive will even do all that for you with a few keystrokes
18:13justin_smiththe jars get downloaded by leiningen into your ~/.m2/repository directory
18:15princesothat sounds interesting. The way im doing it is metaing the things i want to watch like this (defn ^{:log {:dev {:eval ['call1 'call2 ...]}}}..
19:41amandabbis it possible to do a non-blocking take from a core async channel?
19:42amandabbi want to have a go-loop that runs and does a bunch of putting and taking from channels but if a value ever comes in from a certain channel i want to stop the loop
19:44amandabbsomething like this: (go-loop [running? true] ...wait... ...put on chan1... if chan2 has a value in it, exit loop, otherwise, recur)
19:45amalloyuse alts with a timeout channel
19:45amandabbshould the timeout just be like 1 millisecond?
19:47celwellWhy does Hickey's Java code use weird indentation?: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L37
19:48amandabbcelwell: looks like it's mixing tabs and spaces
19:50amalloywhatever timeout you want, amandabb
19:50celwelloh, i c. weird that's there's no space betwen ){ in function declaration either though.
19:50amalloycelwell: rich is a madman
19:50amandabbdoes rich still work on the language?
19:50amandabbor has that mostly been passed on to others
19:51TEttingerI think he mostly works on datomic
19:51TEttingerbut I'm guessing there
19:51TEttingerhe makes occasional contributions on github
19:53TEttingerhttps://github.com/clojure/clojure/commits?author=richhickey
20:04celwellTrying to convert map with maps and/or lists as some values to more Java friendly objects. HashMap conversion works, but can't seem to get lists to convert to java.util.List.
20:04celwell(postwalk #(cond
20:04celwell (map? %) (java.util.HashMap. %)
20:04celwell (seq? %) (java.util.List. %)
20:04celwell :else %)
20:04celwell m)
20:05ridcully_List is an interface?
20:05ridcully_LinkedList maybe?
20:05celwelloh, i have to ArrayList or something?
20:06celwellthat did it, thanks! (my java foo is not up to par)
20:22slesterwhy is t (clojure.string/split s re) but (clojure.string/join separator s)
20:22slestertrying to explain to a friend why clojure is awesome and he points to things like that
20:22slesterhaha
20:28amalloyi always get the order of split wrong too
20:29puredangerI think the idea is that string ops are like collection ops and take the data first
20:29puredangerI think join is not like that because it's handy to partial
20:31ridcully_amalloy: ... in every language
20:32retrogradeorbiti think of the split order as similar to an operation on an object
20:32retrogradeorbityou wouldnt write ",".split("a,b,c")
20:32retrogradeorbitstring.split basically
20:33retrogradeorbitand rewrite the join as
20:33retrogradeorbit(clojure.string/join s coll)
20:33retrogradeorbitand you have the same order
20:35retrogradeorbitslester: Learning clojure at times Ive found myself first going... no no, this is wrong
20:35retrogradeorbitand then thinking deeply about it and going, hang on a minute, no the way I've always done this is wrong
20:35retrogradeorbitlike contains? on a vector
20:36retrogradeorbitat first you're like WTF? and then you're like OMG!
20:37slesterwell, it may be handy to partial, but when threading it's a bit rough
20:37slester(-> "somestring" (clojure.string/split #"") (clojure.string/join "")) doesn't work :(
20:37slesterwhich kind of seems odd to me I guess
20:39retrogradeorbitI would say then thread-first is not for that situation. You could write a function or use #() to reverse the arg order. not pretty but works
20:39amalloyretrogradeorbit: no, just add a ->>
20:39BRODUScould derefing an atom ever return an error?
20:39amalloy(-> s (split re) (->> join sep))
20:39amalloyer
20:39amalloy(-> s (split re) (->> (join sep)))
20:39retrogradeorbit,(-> "somestring" (clojure.string/split #"") #(clojure.string/join "" %))
20:39clojurebot#error {\n :cause "clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6875]}\n {:type java.lang.ClassCastException\n ...
20:40celwellif you stick with core and just (interpose) and (apply str), that should work too
20:40retrogradeorbit,(-> "somesting" (split #"") (->> (join "")))
20:40clojurebot#error {\n :cause "Unable to resolve symbol: join in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: join in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: join in this co...
20:41retrogradeorbit,(-> "somesting" (clojure.string/split #"") (->> (slojure.string/join "")))
20:41clojurebot#error {\n :cause "slojure.string"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "slojure.string"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.n...
20:41retrogradeorbit,(-> "somesting" (clojure.string/split #"") (->> (clojure.string/join "")))
20:41clojurebot"somesting"
20:41retrogradeorbithhah. thats awesome
20:41retrogradeorbitamalloy: pro tip! thanks.
20:41slesterthat's possibly worse than (clojure.string/join "" (clojure.string/split #"" "something"))
20:42amalloydepends on what you want to emphasize
20:42slestererr
20:42retrogradeorbityeah
20:42slester"something" #"" -_-
20:42retrogradeorbitmaybe not in that string case, but the idea of switching to threadlast is sound
20:43celwelli believe the (-> x (->> ...)) only works one way, fti. not: (->> x (-> ...))
20:44retrogradeorbityeah I guess so. ->> in the first example gets the input arg tfrom the threaded first val of ->
20:45slesterinteresting, though. maybe I don't mind the parens anymore, but it's an eyesore to him
20:45slesterhard to get someone over that perhaps! not sure how I did?
20:46amalloypractice
20:46amalloyeverything in life is just practice
20:46amalloythings are unfamiliar until they're not
20:46retrogradeorbitIve found some devs are very stubborn
20:47celwellwith rainbow-parens it's a really helpful experience
20:47retrogradeorbitas in, I know someone who when they _get it_ then pretends they havent got it so they can just reject it so the prove your wrong
20:47retrogradeorbityeah and paredit
20:47retrogradeorbitwithout paredit I wouldnt do it
20:48ridcully_slester: use paredit. once something just fixes everything you no longer care.
20:48retrogradeorbitthats a good point actually, is your friend using an editor with good paredit support?
20:48slesterI use paredit :P
20:48slesterand rainbow-parens
20:48slesternot sure what he's using actually, but probably just an unsetup text editor
20:48retrogradeorbityep
20:48slesterlike an IntelliJ without Cursive
20:49slesteror reading my code on hastebin
20:49slester:P
20:49retrogradeorbitas you know, you have to experience it. then it clicks
20:49ridcully_some showmatch equivalent is really the minimum. but paredit made my stop caring
20:49BRODUS,(println (atom "foo"))
20:49clojurebot#object[clojure.lang.Atom 0x10f80328 {:status :ready, :val foo}]\n
20:49slesterI want to get parinfer up & running
20:49BRODUSWill status ever be non ready for an atom?
20:49slesteralso I've tried emacs so many times (spacemacs too) and I just can't leave vim
20:50retrogradeorbitI found that of core.async too. All the talks by hickey went woosh over my head, until I just tried it and worked with it a bit. Then it clicked.
20:50retrogradeorbitthe brackets/paredit are the same
20:50slesteryeah
20:50slesterparinfer seems so nice, though. the vim port is slow and annoying though
20:51retrogradeorbitthe state of editors and paredit is pretty bleak
20:51retrogradeorbitits hard to tell someone 'just use emacs'
20:52slesterI really hate non-evil emacs haha
20:52slesterand I can't figure out how to configure spacemacs to be like my vim so I kind of gave up
20:52retrogradeorbitI've seen a guy trying to learn clojure on sublime. And the paredit seems to be clunky. He had heaps of problems.
20:53retrogradeorbithe tried lighttable. But didn't like its limitations. and he didnt want to use it for the other languages hes working on at the same time
20:53slesterwith mine, it randomly gets confused and won't let me add parens unless I scomment them out
20:53retrogradeorbitthen he tried emacs. He gave it a good shot. as in weeks. Eventually he thre it in. Says he just didn't like all the wierd keycombos he had to learn.
20:54retrogradeorbitnow hes on vim. And he seems happy with it.
20:54slesteryay!
20:54slesterI like vim's functionality but it seems like a pain to write plugins for it
20:54BRODUSlearning emacs is always a nonstarter if you have work to do and an editor you already know
20:54slesterplus I feel like I should use emacs because Richard Stallman gets mad at me if I don't. Also it's written in Lisp.
20:55ridcully_yeah. tried to fix some figwheel stuff that anoyed me. boy that viml is not my kind of language...
20:56retrogradeorbitI was lucky. I had adopted emacs before I even discovered clojure
20:56retrogradeorbita senior dev I used to work with pushed me to use it. it was good advice
20:58slesterwell, I had a professor push us to use vim
20:58slesterhaha
20:58slesterso I invested my time learning and configuring a vimrc
20:59slesterseems to be a huge waste of time to go to emacs
20:59slesteryet I've still tried spacemacs :(
20:59MirryIs there any advantage to use emacs over vim ? (clojure wise)
21:00MirryI've been a hardcore vim user since forever, so I don't think I'd be able to switch but hey who knows if it improves my workflow
21:00slestercider is easier
21:00celwellIt took me two months of frustration before I was matching the proficiency I had in Netbeans in Emacs. I still feel like I am only at 5% speed of what I could be in Emacs, but definitely faster than Netbeans flow. Though, it takes time to customize and learn an editor too; probably outweighing perceived speed improvements.
21:48tolstoyEmacs. Come for the cider, stay for the org-mode, or erc, or magit....
22:22neoncontrailsA clojure ibrary with java dependencies won't work in clojurescript, correct?
22:23tolstoyRight.
22:23tolstoyclj-time vs cljs-time, etc.
22:24neoncontrailsMakes sense. Thanks :-)