2015-12-29
| 01:28 | felixn_ | https://gist.github.com/munro/88c578c7eb0551daacf9 <-- hey any feedback for this function that conditionally zips against a second sequence? I'm thinking I could make it a transducer by passing in a 3rd argument as the reduced amount. only problem is the entire operation should fail if it's not complete |
| 01:29 | felixn_ | actually, that last condition can just be checked at the end, and not have anything to do with this function |
| 01:32 | felixn_ | http://ignaciothayer.com/post/Transducers-Are-Fundamental/ <-- also, I was reading this article about transducer. when would the signature "[result input & inputs]" for a map transducer ever apply? |
| 04:03 | Trioxin | I would love to see an example of convoluted artificial neural networks in clojure |
| 04:04 | Trioxin | convolutional* |
| 04:05 | Trioxin | something that isn't ages old |
| 04:05 | Trioxin | because state of the art changes there every so often |
| 04:05 | Trioxin | there's synaptic modified 8 months ago. not so bad I suppose |
| 04:06 | Trioxin | looks like the last thing they fixed was convolution |
| 04:16 | Trioxin | I'm surprised because I've brought things like this up here before and it seems like a lot more clojure devs would be working in machine learning. |
| 04:17 | Trioxin | given the nature of the language |
| 04:17 | Trioxin | why should c++ have all the fun? |
| 04:18 | Trioxin | oh sweet. I see there's a matlab interface for clojure |
| 04:50 | underplank | Hi all. Any idea why when running tests using ring-mock the :body of the PUT request is an InputStream whereas when running the service using jetty its just a string? |
| 06:55 | engblom | Does clojure have anything ready allowing you to have a circular double linked list? |
| 06:57 | engblom | I have ([1,0,0,1], [1,0,0,0], [1,1,0,0], [0,1,0,0], [0,1,1,0], [0,0,1,0], [0,0,1,1], [0,0,0,1]) where the last element should connect with the first, so that when I am at the last element and take 'next' I get the first, in the same way when I am at the first element and asks for 'previous' I get the last from the list |
| 07:04 | justin_smith | engblom: cycle |
| 07:04 | justin_smith | engblom: and there is no "previous" in clojure really |
| 07:04 | engblom | justin_smith: I already used cycle for forward... but the backward was the thing I was more wondering about |
| 07:05 | justin_smith | engblom: you need mutable data for the whole next/previous based on a single element thing |
| 07:05 | justin_smith | though I guess there are zippers... |
| 07:16 | justin_smith | engblom: actually, there is a way to do it with promises I think... one moment |
| 07:22 | engblom | justin_smith: I realized I could quite easily do it by using 'mod'. Then I need to just pass around the last position and going forward or backward is just a modulo to get the position in the initial vector |
| 07:22 | justin_smith | oh, there is that |
| 07:23 | justin_smith | engblom: I made something actually circularly linked - it works but printing it is a very bad idea :) |
| 07:23 | justin_smith | ,(defn make-node [v] {:prev (promise) :v v :next (promise)}) |
| 07:23 | clojurebot | #'sandbox/make-node |
| 07:23 | justin_smith | ,(defn link-nodes [& nodes] (deliver (:next (last nodes)) (first nodes)) (deliver (:prev (first nodes)) (last nodes)) (reduce (fn [a b] (deliver (:next a) b) (deliver (:prev b) a) b) nodes) nil) |
| 07:23 | clojurebot | #'sandbox/link-nodes |
| 07:24 | justin_smith | ,(def foo (let [f (make-node :foo) b (make-node :bar) q (make-node :quux)] (link-nodes f b q) f)) |
| 07:24 | clojurebot | #'sandbox/foo |
| 07:24 | justin_smith | ,(-> foo :v) |
| 07:24 | clojurebot | :foo |
| 07:24 | justin_smith | ,(-> foo :next deref :v) |
| 07:24 | clojurebot | :bar |
| 07:24 | justin_smith | ,(-> foo :next deref :next deref :v) |
| 07:24 | clojurebot | :quux |
| 07:24 | justin_smith | ,(-> foo :next deref :next deref :next deref :v) |
| 07:24 | clojurebot | :foo |
| 07:24 | justin_smith | ,(-> foo :next deref :next deref :next deref :next deref :v) |
| 07:24 | clojurebot | :bar |
| 07:25 | justin_smith | ,(-> foo :next deref :next deref :next deref :next deref :next :deref :v) |
| 07:25 | clojurebot | nil |
| 07:25 | justin_smith | ,(-> foo :next deref :next deref :next deref :next deref :next deref :v) |
| 07:25 | clojurebot | :quux |
| 07:25 | justin_smith | ,(-> foo :next deref :next deref :next deref :next deref :next deref :prev deref :v) |
| 07:25 | clojurebot | :bar |
| 07:25 | justin_smith | ,(-> foo :next deref :next deref :next deref :next deref :next deref :prev deref :prev deref :v) |
| 07:25 | clojurebot | :foo |
| 07:25 | justin_smith | etc. |
| 07:25 | engblom | Thanks! |
| 07:26 | justin_smith | engblom: that "works" but is very clumsy, and can't be edited - you pretty much have to make a whole new set of nodes from scratch and re-link |
| 07:28 | engblom | justin_smith: In my case, a simple 'if' or 'mod' will be easier. The sequence I gave first was for driving a stepper motor. If that one would be circular, it would be easy to take one step forward or one step backward. |
| 07:29 | justin_smith | engblom: yeah, that is definitely simpler |
| 07:29 | lokien | Hey, is there a way of preventing my stupidness? Like declaring a function with too much params - (defn wrong [x y] (identity x y)) |
| 07:30 | justin_smith | lokien: the eastwood plugin for lein will catch that |
| 07:30 | lokien | I mean, this function happily doesn't throw an error, I'd like it to throw one |
| 07:30 | lokien | justin_smith: sweet name |
| 07:30 | justin_smith | lokien: because it's a linter |
| 07:30 | justin_smith | lint eastwood, lol |
| 07:31 | lokien | why people are so funny in functional programming, I don't know |
| 07:31 | lokien | imperative dudes are all like "we're engineers" |
| 07:31 | lokien | but our entire environment is puns and jokes |
| 07:32 | justin_smith | and fp guys are like "hell yeah, thomas the tank engine, *toot* *toot*" |
| 07:32 | justin_smith | lokien: it's true |
| 07:32 | lokien | that's why I love you |
| 08:10 | TimMc | justin_smith: I'm using that. :-P |
| 08:23 | jink167 | Anybody know why grimoire at conj.io has been down for days? |
| 08:25 | justin_smith | jink167: at first arrdem wasn't aware it was down - but supposedly he's watching it now so... dunno |
| 08:26 | jink167 | thx |
| 08:48 | ksaua | Hi. Is there a function which given a seq [1 2 3 4] returns [[1 2] [2 3] [3 4]] ? |
| 08:48 | j-pb | partition |
| 08:49 | ksaua | ty |
| 08:50 | BRODUS | ,(partition 2 (butfirst (butlast (interleave [1 2 3 4] [1 2 3 4])))) |
| 08:51 | clojurebot | #error {\n :cause "Unable to resolve symbol: butfirst in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: butfirst in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: butfirs... |
| 08:51 | BRODUS | ,(partition 2 (rest (butlast (interleave [1 2 3 4] [1 2 3 4])))) |
| 08:51 | clojurebot | ((1 2) (2 3) (3 4)) |
| 08:52 | j-pb | BRODUS: works but is ugly |
| 08:52 | j-pb | ,(partition 2 1 [1 2 3 4]) |
| 08:52 | clojurebot | ((1 2) (2 3) (3 4)) |
| 08:52 | BRODUS | aaa i didn't know partition could do that |
| 09:08 | TimMc | (def rest butfirst) :-P |
| 09:10 | BRODUS | TimMc: i need to go to bed :) |
| 09:12 | TimMc | BRODUS: partition has even more tricks than that |
| 09:13 | TimMc | ,(partition 5 3 "hi" (range 8)) |
| 09:13 | clojurebot | ((0 1 2 3 4) (3 4 5 6 7) (6 7 \h \i)) |
| 09:23 | justin_smith | new thing added to my list of evil - ansi escape sequences inside files so that git diff breaks in the terminal |
| 09:24 | justin_smith | breaks / shows misleading output |
| 10:08 | anti-freeze | Hi everyone, so I'm using clojurescript with boot and everything was working just dandy until about 2 hours ago, then figwheel shat itself. Has anyone seen this error before? https://www.refheap.com/113206 |
| 10:12 | TimMc | justin_smith: font-lock-fontify-buffer doesn't do it. :-/ |
| 11:26 | justin_smith | TimMc: odd... |
| 11:26 | justin_smith | anti-freeze left, but when that happens you need to clean your cljs and rebuild |
| 11:34 | justin_smith | ,(partition 5 4 (cycle "hi") (range 9)) |
| 11:34 | clojurebot | ((0 1 2 3 4) (4 5 6 7 8) (8 \h \i \h \i)) |
| 11:34 | justin_smith | fancy |
| 11:46 | justin_smith | ,(partition 4 3 (cycle "lo") [4 2 0 6 6 6 69]) |
| 11:46 | clojurebot | ((4 2 0 6) (6 6 6 69) (69 \l \o \l)) |
| 11:58 | devth | sadness = the inconsistency between def* forms and whether they allow docstrings |
| 11:59 | justin_smith | devth: would the fact that defonce rhymes with beyonce cheer you up? |
| 11:59 | devth | nice try! |
| 12:00 | devth | i want to hear someone say it like that IRL |
| 12:00 | justin_smith | I nominate gfredericks |
| 12:01 | devth | justin_smith: btw, i switched from bindings to passing state around explicitly. only took about 15 min per ns and my sanity is restored! good call. |
| 12:01 | justin_smith | glad to hear it |
| 12:08 | gfredericks | devth: justin_smith: http://tmp.gfredericks.com/defonce.m4a |
| 12:09 | devth | http://www.reactiongifs.us/wp-content/uploads/2013/08/picard_clapping.gif |
| 12:09 | justin_smith | gfredericks: you're the best |
| 12:10 | justin_smith | gfredericks: mind if I tweet that link? I guess it has tmp in it so it isn't meant to be a long term thing |
| 12:11 | gfredericks | SEMANTIC SUBDOMAINS! |
| 12:12 | gfredericks | um here I'll put it elsewheres |
| 12:12 | gfredericks | http://upload.gfredericks.com/defonce.m4a |
| 12:12 | justin_smith | OK, tweeting that now |
| 12:14 | TimMc | leenucks |
| 12:15 | justin_smith | yeah, it would be cool to get "this is Rich Hickey and I pronounce defonce as defonce" - with the gfredericks approved pronunciation of course |
| 12:15 | justin_smith | TimMc: actually hearing that recording, after fighting with kernel configs and drivers and such, was a moment of pure bliss in an otherwise bleak existence. |
| 12:17 | TimMc | :-) |
| 12:18 | TimMc | $findfn nil () |
| 12:19 | TimMc | Oh right, no lazybot. :-( |
| 12:23 | TimMc | ,(doseq [v (remove (comp :macro meta) (vals (ns-publics 'clojure.core)))] (try (when (= (v nil) ()) (println v)) (catch Throwable t nil))) |
| 12:23 | clojurebot | TimMc: Gabh mo leithscéal? |
| 12:23 | justin_smith | TimMc: concat |
| 12:23 | devth | what happened to lazybot? |
| 12:23 | TimMc | rest, reverse, sort, interleave, cycle, seque, vec, concat, drop-last, distinct, flatten, sequence |
| 12:23 | justin_smith | entropy |
| 12:23 | justin_smith | TimMc: oh yeah, those would do it too |
| 12:24 | justin_smith | I'd venture that (distinct nil) is the classiest way to get an empty list from nil |
| 12:28 | TimMc | What if I don't want to modify the list when it's not empty? |
| 12:28 | justin_smith | concat |
| 12:28 | justin_smith | that's the only one that will act like identity if a single list is arg I think |
| 12:28 | justin_smith | ? |
| 12:28 | justin_smith | oh, or sequence |
| 12:29 | TimMc | or vec |
| 12:29 | justin_smith | right |
| 12:29 | TimMc | wtf is sequence |
| 12:29 | TimMc | flatten ;-) |
| 12:29 | justin_smith | TimMc: a transducer that doesn't reverse the input like (into () ...) does |
| 12:29 | justin_smith | very useful |
| 12:29 | TimMc | ooh, that's actually maybe what I want |
| 12:30 | TimMc | ,(-> sequence var meta :added) |
| 12:30 | clojurebot | "1.0" |
| 12:30 | TimMc | Fascinating. |
| 12:30 | justin_smith | oh! |
| 12:30 | justin_smith | well, it became more useful when it became a transducer, to be sure |
| 12:30 | TimMc | No, concat is right, but this is useful to know I guess. |
| 12:31 | TimMc | I have a fn that yields a sequence of stuff, and it is currently implemented entirely by another fn that yields either a vector or nil, and I don't want the test to distinguish between nil and []. |
| 12:32 | TimMc | I could also just wrap the "actual" side of the test in a seq |
| 12:32 | TimMc | Oh right this is a midje (provided ...) block so I need the actual arg. |
| 12:32 | justin_smith | if it's a vector or nil, what about vec? |
| 12:33 | justin_smith | ,(vec nil) |
| 12:33 | clojurebot | [] |
| 12:33 | TimMc | concat it is, since that conveys that there could, in the future, be more data sources. |
| 12:34 | TimMc | ,(->> 'clojure.core ns-publics vals (filter #(and (not (:macro (meta %))) (try (= (% nil) ()) (catch Throwable t nil)))) (map #(.sym %))) |
| 12:34 | clojurebot | TimMc: No entiendo |
| 12:34 | TimMc | I wonder what its beef is. |
| 12:34 | justin_smith | catch |
| 12:35 | TimMc | fine |
| 12:35 | justin_smith | or more specifically I think it is try that is forbidden |
| 12:40 | TimMc | ,(eval '(+ 1 2)) |
| 12:40 | clojurebot | 3 |
| 12:42 | TimMc | ,(->> 'clojure.core ns-publics (filter #(and (not (:macro (meta (val %)))) (eval `(~(symbol (str "t" "ry")) (= ((identity ~(key %)) nil) ()) (~(symbol (str "cat" "ch")) Throwable ~'t nil)))))) |
| 12:42 | clojurebot | ([eduction #'clojure.core/eduction] nil[dedupe #'clojure.core/dedupe] [rest #'clojure.core/rest] [reverse #'clojure.core/reverse] [sort #'clojure.core/sort] ...) |
| 12:42 | justin_smith | TimMc: SNEAKY |
| 12:42 | TimMc | WAS THAT SO HARD? |
| 12:42 | TimMc | that bot, seriously |
| 12:48 | TimMc | ,(->> 'clojure.core ns-publics (filter #(and (not (:macro (meta (val %)))) (eval `(try (= ((identity ~(key %)) nil) ()) (~(symbol (str "cat" "ch")) Throwable ~'t nil))))) keys) |
| 12:48 | clojurebot | (eduction nildedupe rest reverse sort ...) |
| 12:48 | TimMc | bah |
| 12:48 | TimMc | ,(+ 1 2) |
| 12:48 | clojurebot | 3 |
| 12:48 | TimMc | Interesting, my REPL bombs out after I run that. |
| 12:50 | TimMc | "SocketException The transport's socket appears to have lost its connection to the nREPL server" |
| 12:55 | justin_smith | TimMc: yeah, weird... |
| 12:58 | TimMc | Using binary search to find it... |
| 12:59 | TimMc | set-agent-send-off-executor! |
| 12:59 | TimMc | Well, that would do it. |
| 12:59 | justin_smith | oh, hahaha |
| 13:00 | justin_smith | yeah, I was just gonna say, it breaks a java -jar repl too |
| 13:01 | justin_smith | yeah, I think it would be safe for findfn to simply blacklist that |
| 13:01 | justin_smith | actually, it could blacklist anything where #(= (last (str %)) \!) safely |
| 13:01 | Bronsa | justin_smith: it doesn't for me |
| 13:02 | justin_smith | Bronsa: oh, weird - did you try running it a second time? |
| 13:02 | justin_smith | it looks OK after the first time |
| 13:02 | Bronsa | nope let's try |
| 13:02 | justin_smith | but it's secretly broken (here at least) |
| 13:02 | justin_smith | running it the second time exposes that brokenness |
| 13:02 | Bronsa | oh wow |
| 13:02 | Bronsa | I can't even understand what that code does |
| 13:03 | justin_smith | tries to run every funciton with nil as an arg and returns the ones that returned () |
| 13:03 | TimMc | Running *anything* after it exposes the breakage. Just try entering 7. |
| 13:03 | Bronsa | ah I see |
| 13:03 | Bronsa | I guess it's hitting some non terminating function |
| 13:03 | TimMc | It's hitting set-agent-send-off-executor! |
| 13:03 | Bronsa | or filling up a threadpool or something |
| 13:03 | Bronsa | ah |
| 13:03 | Bronsa | nice |
| 13:04 | justin_smith | Bronsa: well, if it called (set-agent-send-off-executor! nil) - after that things get dicey right? |
| 13:04 | Bronsa | yeah |
| 13:04 | TimMc | ,(set-agent-send-off-executor! nil) |
| 13:04 | Bronsa | :( |
| 13:04 | TimMc | ,7 |
| 13:04 | clojurebot | nil |
| 13:04 | clojurebot | 7 |
| 13:04 | TimMc | ^ I wonder why clojurebot is immune. |
| 13:04 | justin_smith | I think the sandboxing will help you there, yeah |
| 13:05 | Bronsa | TimMc: that works on my repl |
| 13:06 | Bronsa | (a java -jar repl) |
| 13:08 | Bronsa | TIL there's a private filter-key function in clojure.core |
| 13:08 | TimMc | There's also the private fn >1? -- what else is THE MAN keeping secret? |
| 13:09 | justin_smith | TimMc: I smell some prs for the 71 lib |
| 13:09 | justin_smith | >71? =71? <71? etc. |
| 13:10 | TimMc | ooh |
| 13:10 | Bronsa | 71->str |
| 13:10 | TimMc | but they should be private too, to stay idiomatic |
| 13:10 | justin_smith | I mean, given that precedent they should be private of course |
| 13:10 | justin_smith | yes |
| 13:10 | justin_smith | map->71 |
| 13:11 | justin_smith | Bronsa: sadly I don't think the reader will accept that one |
| 13:11 | Bronsa | yeah you're right :( |
| 13:11 | ridcully_ | set-agent-send-off-executor-to-71 |
| 13:11 | Bronsa | ridcully_: missing the bang! |
| 13:11 | ridcully_ | dang |
| 13:11 | TimMc | ,(->> clojure.core quote ns-interns (filter (comp :private meta val)) (map key)) |
| 13:11 | clojurebot | (prependss is-runtime-annotation? imap-cons add-annotation load-data-reader-file ...) |
| 13:11 | TimMc | ,(->> clojure.core quote ns-interns (filter (comp :private meta val)) count) |
| 13:11 | clojurebot | 104 |
| 13:12 | TimMc | (>71? *1) => true |
| 13:12 | justin_smith | oh, and let's not forget compare-to-71 |
| 13:13 | TimMc | win 12 |
| 13:13 | TimMc | ugh |
| 13:13 | justin_smith | TimMc: ITYM win 71 |
| 13:13 | TimMc | I do |
| 13:13 | TimMc | ,(>71? 104) |
| 13:13 | clojurebot | true |
| 13:13 | TimMc | much better |
| 14:32 | felixn_ | is there a way I can use a clojurescript repl? I'm using cursive ide, so any integration with that would also be nice |
| 14:34 | justin_smith | felixn_: yes, there is austin, and also figwheel which wraps up the repl with live code reload etc. |
| 14:35 | justin_smith | felixn_: https://github.com/cemerick/austin https://github.com/bhauman/lein-figwheel |
| 14:37 | domgetter | felixn_: It's definitely worth watching that 45 minutes talk on Figwheel https://www.youtube.com/watch?v=j-kj2qwJa_E |
| 14:37 | domgetter | or at least the first 15 minutes |
| 14:45 | felixn_ | justin_smith domgetter: awesome, thanks! dinking around with austin. I think it's not working because not all my code works with clojurescript, is there a way I can just play around with it and ignore my project files? |
| 14:45 | musteresel | Hi, about java interop: If I have a (defrecord Foo [bar baz]), how can I access the members of a Foo from java? In general: Are there comprehensive examples for interfacing clojure code from java code? |
| 14:47 | felixn_ | ahh, I'll just keep dinking with it until it works! |
| 14:58 | domgetter | musteresel: is it not yournamespace.core.Foo ? |
| 15:05 | lokien | is there a way of configuring vim to align my code as I hit tab? I'm becoming bored manually deleting these unnecessary spaces |
| 15:06 | ridcully_ | `=-` with the cljfmt plugin, `==` with regular bindings |
| 15:07 | lokien | ridcully_: after all this time |
| 15:07 | lokien | now I can happily sudo apt-get purge intellij* |
| 15:08 | musteresel | domgetter: Is this working? Assuming type hints then namespace.core.Foo foo = some_source(); Double d = foo.bar; should work? I currently cannot test this, thus I'm asking ;) |
| 15:09 | ridcully_ | cljfmt also formats on write (with a repl connection iirc), if that's your thing |
| 15:09 | ridcully_ | otherwise look into the options vim itself has. e.g. all the `=` stuff |
| 15:09 | domgetter | musteresel: I don't know. The docs on it might be of some help? http://clojure.org/datatypes |
| 15:11 | lokien | ridcully_: do you use vim-cljfmt? I don't know if it's necessary as == just works |
| 15:12 | ridcully_ | i use it, as it's a tad more nicer. it also fixes linebreaks etc |
| 15:13 | lokien | ridcully_ thanks, I'll use it too |
| 15:13 | ridcully_ | if you don't like the "auto-format" aspect, i bet it's just a config var away to be turned off and `=-` can still be used (fmt me the current form) |
| 15:14 | lokien | any more useful vim plugins? besides fireplace and sexp? |
| 15:14 | ridcully_ | cljfmt plugin and paredit are the "i insert stuff for you" of the bizarro universe, if you are used to intellij and openoffice "helping" |
| 15:14 | devth_ | lokien: guns/vim-clojure-highlight |
| 15:14 | devth_ | moderately useful |
| 15:14 | lokien | I had used vim for a long time, now, in anger installed intellij |
| 15:15 | ridcully_ | the sexp-for-regular-ppl or something like that. that puts some of the sexp shortcuts on "vimy" places |
| 15:15 | lokien | I'm purging it right now |
| 15:15 | lokien | devth_: I have it already |
| 15:15 | ridcully_ | and paredit of course |
| 15:15 | lokien | sexp + paredit? |
| 15:16 | lokien | isn't it sexp or paredit? |
| 15:16 | ridcully_ | yes, i have disabled some part of sexp |
| 15:16 | ridcully_ | maybe the bit for the paredit ;) |
| 15:16 | lokien | can I have your dotfiles, please? |
| 15:17 | ridcully_ | i have this set: let g:sexp_enable_insert_mode_mappings = 0 |
| 15:18 | ridcully_ | well that's the bit, that supposedly makes it happy with paredit |
| 15:19 | ridcully_ | then i only have three other lines. one to map :Figwheel to do some piggiebacking, and map c-c,c-c to eval, since that is what i use also in tslime (i hear some *ugh* from the emacs ranks) |
| 15:21 | lokien | I've installed it, and it hadn't crashed, so I think it's okay |
| 15:21 | lokien | what features of paredit do you use? and what things from sexp are better? |
| 15:22 | ridcully_ | i have used paredit before i used sexp and i stayed with them |
| 15:22 | lokien | which*, damn |
| 15:22 | lokien | o-kay, will skim through manuals |
| 15:22 | ridcully_ | paredit just ballances everything automagically. i just do my leader-i, leader-w most of the time |
| 15:24 | ridcully_ | i never tried sexp alone and i _guess_ that i have some interference. leader-i is iirc from sexp. maybe paredit is no longer used at all. idk,idc |
| 15:26 | lokien | I love you ridcully_ |
| 15:28 | ridcully_ | all the "wrap me this" magic is leader-w-<with what> or leader-i for just () |
| 15:29 | sdegutis | Hello. |
| 15:29 | sdegutis | Who is having a great time today? |
| 15:29 | ridcully_ | depending on your keyboard layout (and even then) mapping the leader to e.g. space makes your life easier |
| 15:29 | sdegutis | I bet it's TimMc and TEttinger2. |
| 15:30 | lokien | sdegutis: I am! |
| 15:30 | sdegutis | Alright! High five lokien! |
| 15:31 | lokien | ridcully_: I was going through vim primer from daniel messer, I think I should finally add his bindings (he recommends space as leader too) |
| 15:32 | lokien | high five, sdegutis! what's up with TimMc and TEttinger2? |
| 15:33 | justin_smith | felixn_: usually you have .cljc files for things that work in clojurescript or clojure, cljs for clojurescript files, and clj for clojure files |
| 15:36 | sdegutis | lokien: I dunno I just thought maybe they're having a nice day, they're usually so polite and kind in here so they usually seem to be having good days. |
| 15:37 | lokien | sdegutis: what about justin_smith? |
| 15:42 | justin_smith | I'm always having a terrible day. |
| 15:42 | felixn_ | justin_smith: played with cljc a bit, it's works really well! I don't need UI for the clojurescript repl, so I ended up finding just piggieback with rhino works. from looking at the austin example, it look like I also had to setup a webserver to script the file, so not sure that's what I wanted for just a cljs repl |
| 15:42 | lokien | justin_smith: oh, why? :( |
| 15:43 | justin_smith | lokien: just being silly, I should remember that doesn't always translate to IRC |
| 15:44 | J_Arcane | so how long until we have cljs running on node so we can write front and back in clojurescript and avoid enormous jvms entirely? ;) |
| 15:44 | felixn_ | https://github.com/clojure/core.logic/blob/1c4020f63a5b792f08a90434ab6e8be6aa467a82/src/main/clojure/cljs/core/logic.cljs#L210 <-- is there a way I can extract the name from this type? (:name (LVar. "hey" nil)) doesn't work like it does in clojure. also the clojurescript API is slightly different, so I will submit a PR! |
| 15:44 | lokien | justin_smith: knew that! you're our wizard here, your days are meant to be awesome |
| 15:45 | mgaare | am I wrong in thinking that this should work? (case (class 42) java.lang.Long "yep!" "nope :(") |
| 15:46 | sdegutis | lokien: he's always having the best day it would seem |
| 15:46 | sdegutis | lokien: on account of how he's always the most helpful even when I'm the most idiotic or rude (sorry about those days justin_smith and everyone else!) |
| 15:47 | sdegutis | lokien: and I do believe you're correct, I think justin_smith may have some wizard-blood running through his veins |
| 15:47 | amalloy | mgaare: yes, sorry |
| 15:47 | sdegutis | Other wise how elsewise would thus he have been able so well and often to contrive such immaculate solutions in pure Clojure for us? |
| 15:47 | amalloy | case doesn't evaluate its test clauses, and java.lang.Long is a symbol which *evaluates to* a class, not a class |
| 15:47 | mgaare | amalloy: ok, is there a "right" way to do that? |
| 15:48 | sdegutis | amalloy: they have to be constants right? |
| 15:48 | sdegutis | mgaare: just use cond when you can't use case |
| 15:48 | mgaare | righto |
| 15:48 | amalloy | or look (class x) up in a map |
| 15:48 | sdegutis | mgaare: or possibly condp when the time is right |
| 15:48 | sdegutis | but I've never found a time when condp actually makes my code cleaner than like amalloy said just using a map |
| 15:48 | sdegutis | Not sure when I'm sposta use condp |
| 15:48 | justin_smith | or nested if clauses if you hate people |
| 15:49 | sdegutis | I find that lately my route-handling code has a lot of (cond) in it. |
| 15:49 | justin_smith | sdegutis: condp is for when your input and the condition are actually two args to a function |
| 15:49 | lokien | sdegutis: this clojure family is so great, I was on #haskell for some time and it's nothing like that |
| 15:49 | sdegutis | I'm not sure how I like it so far, but it's cleaner than it used to be, so there's that. |
| 15:49 | sdegutis | lokien: Oh yeah this channel is great people. Some of the best I've ever met. Not even sarcasm! |
| 15:49 | felixn_ | ooo, is there a reason (.-name value) works in clojure & clojurescript, but (:name value) only works in clojurescript? |
| 15:49 | justin_smith | ,(condp :x = :x "OK" :y "huh?") ; sdegutis - simpler than calling = in every clause |
| 15:50 | clojurebot | "OK" |
| 15:50 | felixn_ | s/only works in clojurescript/only works in clojure/ |
| 15:50 | sdegutis | lokien: Although you have to mind amalloy he is extremely helpful and knowledgeable but has NO time for putting up with crap, you've gotta be completely serious with him 24/7 but he makes up for it by being excessively helpful and knowledgeable |
| 15:50 | sdegutis | justin_smith: but I've rarely had a time when I'm calling = and not just using case |
| 15:50 | sdegutis | justin_smith: possibly never actually |
| 15:51 | justin_smith | sdegutis: we just discussed a reason to do that just now |
| 15:51 | ridcully_ | felixn_: (:name somemap) also works ins clojurescript |
| 15:51 | mgaare | amalloy: thanks |
| 15:51 | lokien | sdegutis: thanks, I'll remember that! can we officially become friends now? |
| 15:51 | justin_smith | sdegutis: and sometimes it's not =, what about > for example |
| 15:53 | justin_smith | ,(condp > 10 1 "sad" 10 "ho-hum" 100 "just fine") ; sdegutis |
| 15:53 | clojurebot | "just fine" |
| 15:53 | amalloy | the main person i am not interested in putting up with is sdegutis |
| 15:53 | TEttinger | that's sweet |
| 15:53 | amalloy | which i would not really bring up except he has just cast me as an unfriendly sort |
| 15:53 | justin_smith | TEttinger: useful for scoring and gamey stuff I think |
| 15:54 | sdegutis | lokien: sure, in Clojure that's super easy: (swap! *friends* conj 'username) |
| 15:54 | felixn_ | ,(do (deftype Meow [name]) (let [v (Meow. "foo")] [(:name v) (.-name v)])) ; ridcully_: so weird, this returns ["foo" "foo"] in clojure |
| 15:54 | clojurebot | [nil "foo"] |
| 15:54 | TEttinger | I do think you don't put up with crap amalloy. that is different from being unfriendly |
| 15:54 | amalloy | well, that's fair |
| 15:54 | justin_smith | felixn_: deftype does not define keyword access, but defrecord does |
| 15:55 | TEttinger | I think I put up with crap too much sometimes. I have a hard time telling people they should learn it themselves |
| 15:55 | sdegutis | amalloy: you're certainly *friendly*, no doubt about that! just, got no time for games or jokes. |
| 15:55 | justin_smith | felixn_: do you mean "foo" "foo" in cljs? |
| 15:55 | felixn_ | justin_smith: oohhh, nvm, that doesn't work in clojure. I bet if I check clojure.core.logic it's defrecord XD |
| 15:55 | ridcully_ | deftype ain't mapish |
| 15:55 | sdegutis | amalloy: and that's respectable; anyone who has no time for games or jokes certainly knows the value of his own time |
| 15:55 | ridcully_ | defrecord is |
| 15:55 | lokien | sdegutis: :D |
| 15:56 | sdegutis | amalloy: I admire that and it inspires me to waste less time |
| 15:56 | amalloy | haha |
| 15:56 | sdegutis | So with that.. I'm off to continue working on my /very first legit programming language ever/! |
| 15:56 | ridcully_ | oO |
| 15:56 | sdegutis | :D:D:D |
| 15:56 | ridcully_ | i said something wrong |
| 15:57 | felixn_ | justin_smith & ridcully_: disregard, clojure.core.logic sets up a clojure.lang.ILookup for :name on the type, I was just getting really confused |
| 15:59 | sdegutis | I was trying to use core.match to help make my route handling functions a little cleaner, but I'm not sure it really helped. What's the intended use-case or best use-case for this lib? |
| 16:00 | justin_smith | felixn_: yeah, that's an interface |
| 16:05 | felixn_ | with the new reader conditionals, will we see more core libs use that instead of duplicating code for clj & cljs? |
| 16:05 | justin_smith | one would hope |
| 16:06 | dnolen | felixn_: sure if people submit the non-trivial patches needed to push that forward |
| 16:11 | lokien | where to add :repl-options in my profiles.clj? I can't find an example |
| 16:11 | justin_smith | lokien: either at the top level or inside a specific profile where you want them applied |
| 16:12 | TimMc | amalloy is srs bsns |
| 16:13 | lokien | justin_smith: http://lpaste.net/148059 |
| 16:13 | amalloy | TimMc banned for ten hours for poking fun at amalloy |
| 16:13 | TimMc | /nick TimMac |
| 16:13 | lokien | McTim would be better |
| 16:13 | TimMc | MC Tim |
| 16:14 | sdegutis | :D |
| 16:14 | amalloy | ten more hours for ban evasion. u in real trouble now, mister |
| 16:14 | justin_smith | lokien: looks good https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L335 |
| 16:14 | sdegutis | wow amalloy apparently I had you pegged wrong all along! |
| 16:14 | lokien | put him in a monad, amalloy, it always works |
| 16:15 | amalloy | lokien: is that why it's called bind? |
| 16:15 | TimMc | bonding over bans |
| 16:15 | felixn_ | https://github.com/clojure/core.logic/blob/master/src/test/cljs/cljs/core/logic/tests.cljs#L7 <-- does a definition starting with a hyphen mean anything? experimental? wondering why the clojurescript version has hyphens in front of some definitions |
| 16:15 | lokien | justin_smith: doesn't work though. "vim-cljfmt: Could not locate cljfmt/core__init.class or cljfmt/core.clj on classpath." |
| 16:16 | lokien | amalloy: I suppose |
| 16:16 | justin_smith | lokien: umm - how would you get that error unless your code ran? |
| 16:16 | lokien | amalloy: I don't know if it's a serious-enough-topic for you though |
| 16:16 | BRODUS | felixn_: i just think thats signalling that they're private |
| 16:16 | lokien | :D |
| 16:17 | lokien | justin_smith: I just do :Cljfmt and this pops out, it was supposed to work |
| 16:17 | justin_smith | lokien: a classpath error doesn't mean you have to call require, it means that your deps are wrong |
| 16:17 | clojurebot | excusez-moi |
| 16:17 | justin_smith | lokien: a require will raise that error if you don't have the right deps for the thing you are requiring |
| 16:18 | justin_smith | ,(require 'this-does-not.exist) |
| 16:18 | lokien | justin_smith: so, my deps are wrong? |
| 16:18 | clojurebot | #error {\n :cause "Could not locate this_does_not/exist__init.class or this_does_not/exist.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."\n :via\n [{:type java.io.FileNotFoundException\n :message "Could not locate this_does_not/exist__init.class or this_does_not/exist.clj on classpath. Please check that namespaces with dashes use underscores... |
| 16:18 | justin_smith | lokien: yeah, what project would provide the cljfmt.core namespace? |
| 16:19 | lokien | justin_smith: my project! /silently adds deps to his project.clj |
| 16:19 | justin_smith | lokien: I'm sure it's something easy to find, and it needs to be in your deps or plugins somewhere |
| 16:19 | justin_smith | :) |
| 16:20 | lokien | I forgot to add it, sorry for making a trivial problem |
| 16:20 | ridcully_ | lokien: you just need to add cljfmt to the dependencies in your ~/.lein/profiles.clj |
| 16:21 | ridcully_ | this and the addon should be enough to make it work with a nrepl connection |
| 16:21 | lokien | ridcully_: yeah, I wanted to do that, but I switched tabs and you were talking about funny stuff and I forgot :( |
| 16:21 | ridcully_ | i certainly was not talking funny stuff ;P |
| 16:22 | lokien | "you" was plural here |
| 16:23 | lokien | ridcully_: by the way, when I type :Console, my fireplace should connect to this repl straight away, yeah? |
| 16:23 | ridcully_ | if you have salve installed |
| 16:24 | lokien | I have it, but it doesn't make a connection |
| 16:24 | ridcully_ | otherwise either start with a running nrepl in that directory (.nrepl-port file existing) or do a :Connect <theurl> |
| 16:24 | lokien | aand I can't remap leader to space, vim is so great |
| 16:25 | lokien | vim-salve installed, doesn't work. :( |
| 16:25 | domgetter | lokien: http://stackoverflow.com/questions/446269/can-i-use-space-as-mapleader-in-vim |
| 16:25 | domgetter | ? |
| 16:26 | lokien | domgetter: doesn't work |
| 16:26 | lokien | <\Space> doesn't work too |
| 16:26 | domgetter | lokien: "As spacemanaki comments in the question above nnoremap <SPACE> <Nop> was needed to get this working. " |
| 16:26 | domgetter | Even after that? |
| 16:28 | ridcully_ | lokien: this is what i have: https://www.refheap.com/205b710b37a6b703cd3d18efb |
| 16:28 | lokien | even after that |
| 16:28 | ridcully_ | lokien: the url there seems rather unrelated - ignore it |
| 16:28 | ridcully_ | this is on linux + xterm. ymmv |
| 16:29 | ridcully_ | if \ is _not_ the default leader in vim, then i used that before and kept that around |
| 16:29 | lokien | ridcully_: it works! you wonderful santa incarnate |
| 16:31 | ridcully_ | satan incarnate? thanks! |
| 16:33 | lokien | ridcully_ still no live REPL connection, so, yeah, I guess |
| 16:35 | ridcully_ | :Console needs some setup - things like. iirc i setup tmux to be used. otherwise it starts a new xterm. there should be some "result" from :Console |
| 16:35 | ridcully_ | s/like/& where to start/ |
| 16:35 | lokien | :Console fires up another terminal and a repl in it. it's ran from a weird place though, it doesn't even see my namespace |
| 16:36 | ridcully_ | first step: start your `lein repl` by hand, get the url there and do :Connect <url> |
| 16:36 | lokien | (use 'something.core) doesn't work |
| 16:36 | lokien | works |
| 16:36 | lokien | I mean, :Connect works |
| 16:37 | ridcully_ | are starting your vim from the directory the project.clj is in? |
| 16:37 | lokien | yeah |
| 16:37 | justin_smith | you can double check with (System/getenv "PWD") |
| 16:37 | lokien | vim src/something/core.clj |
| 16:38 | lokien | "/home/lokien/cl/something" |
| 16:40 | ridcully_ | tried that. works for me. even if there is no tmux a new xterm is opened then. :Console opens a lein repl; then a `cpp` in that opens file works |
| 16:40 | lokien | it works, justin_smith is a wizard, confirmed |
| 16:40 | ridcully_ | s/opens/opened/ |
| 16:40 | lokien | I don't know, I just typed the same commands, and it wonderfully worked |
| 16:40 | lokien | thank you all |
| 16:41 | lokien | now it doesn't work! |
| 16:42 | lokien | I type :Console, new terminal is opened with a repl in it. in that repl, I can't use my project's namespace |
| 16:42 | pilne | hrm, apply is kinda like fold (but is it foldr, or foldl?) |
| 16:42 | ridcully_ | it is just a helper to fire up lein repl. there should be no "on-off-behaviour" |
| 16:43 | justin_smith | lokien: did you try requiring that namespace? |
| 16:43 | lokien | justin_smith: where? |
| 16:43 | justin_smith | in the repl |
| 16:43 | justin_smith | (require 'my.ns :reload) - you should either be able to access your ns, or get an error message |
| 16:43 | ridcully_ | and are you typing in the repl or are you sending commands over from vim? |
| 16:43 | lokien | FileNotFoundException Could not locate |
| 16:44 | justin_smith | :reload is in case there was a prior error loading it that was hidden |
| 16:44 | lokien | (System/getenv "PWD") gives me my home directory, strangely |
| 16:44 | lokien | "/home/lokien" |
| 16:44 | justin_smith | that would be your problem right there |
| 16:45 | justin_smith | it got launched from the wrong place |
| 16:45 | lokien | from dir where I have my project.clj |
| 16:45 | justin_smith | it should depend on either what dir you were in when you started vim, or what file you are editing? |
| 16:45 | justin_smith | what file were you visiting when you started the repl? |
| 16:45 | ridcully_ | cd into the dir, where your project.clj is, then just `vim` and :Console |
| 16:46 | ridcully_ | :Console does not even autocomplete, outside of a project |
| 16:46 | lokien | vim src/something/core.clj, yeah? |
| 16:46 | ridcully_ | try just `vim` first |
| 16:47 | ridcully_ | i tried with a relative file, and it worked for me |
| 16:47 | lokien | Not an editor command: Console |
| 16:47 | lokien | :( |
| 16:47 | kopasetik | Is there an evalbot on this channel? |
| 16:48 | justin_smith | ,'yes |
| 16:48 | lokien | ,(println "here i am") |
| 16:48 | clojurebot | yes |
| 16:48 | clojurebot | here i am\n |
| 16:48 | ridcully_ | are you doing a :cd in vim? |
| 16:48 | lokien | ridcully: no |
| 16:48 | lokien | ridcully_ * |
| 16:49 | LauJensen | Gents, datomic question. I have some :days/* which stores stats on a given day, and each day references 24 :day/hours where information specific to each hour. The ID for each day is :day/date (instant). How do I best extract every :hour/whatever value for dates in a given range? |
| 16:51 | lokien | ridcully_: vim project.clj and :Console from there doesn't work also. I'll reinstall salve |
| 16:52 | ridcully_ | lokien: i am out of ideas then. i installed salve for the other commands and console is just a tad convinience for me. starting the repl first and then just starting vim in that dir should work relyable. i also usually have it running in tmux - don't know, if there are differences with the newly spawned xterm |
| 16:52 | justin_smith | ,,,,,',,,,,',,,,,',,,,',,,,',,,,'"" |
| 16:52 | clojurebot | (quote (quote (quote (quote (quote ""))))) |
| 16:52 | lokien | ridcully_: it had worked for me, but now it's broken, dunno why. thanks for help :) |
| 16:53 | ridcully_ | lokien: this is the git commitid of salve i run, if it helps: a0dc869 |
| 16:55 | lokien | ridcully_: I.. I think it's fish |
| 16:56 | ridcully_ | the protocol or the sea creature? |
| 16:56 | lokien | it's not fish, fake info. friendly interactive shell |
| 16:58 | lokien | going to sleep now, I'll look at that tomorrow. thanks again ridcully_ |
| 16:58 | ridcully_ | yw |
| 17:01 | kopasetik | justin_smith and lokien: thanks! |
| 17:10 | devth | mistakenly assumed mapcat == (comp flatten map) but flatten goes crazy and flattens everything |
| 17:11 | devth | found when trying to switch to pmap |
| 17:11 | justin_smith | ~flatten |
| 17:11 | devth | since pmapcat doesn't exist |
| 17:11 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 17:11 | justin_smith | devth: flatten is kind of wacky |
| 17:11 | devth | oh right |
| 17:11 | devth | the cat is for concat |
| 17:11 | sdegutis | Yeah I never use flatten. |
| 17:11 | justin_smith | ,(flatten {:a 0 :b 1 :c [1 2 3]}) ; user error, but really... |
| 17:12 | clojurebot | () |
| 17:12 | sdegutis | I always just do mapcat or for with two pairs. |
| 17:12 | sdegutis | That's great enough. |
| 17:12 | devth | so: mapcat == (comp concat map) right? |
| 17:12 | justin_smith | (source mapcat) |
| 17:12 | justin_smith | ,(source mapcat) |
| 17:12 | clojurebot | Source not found\n |
| 17:13 | devth | yep |
| 17:13 | devth | ran it in my repl |
| 17:13 | sdegutis | (src mapcat) |
| 17:13 | sdegutis | ,(src mapcat) |
| 17:13 | clojurebot | #error {\n :cause "Unable to resolve symbol: src in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: src in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: src in this conte... |
| 17:13 | sdegutis | clojurebot: come on man why you gotta be that way |
| 17:13 | clojurebot | It's greek to me. |
| 17:13 | justin_smith | sdegutis: src is not a thing |
| 17:14 | devth | (apply concat (apply map f colls)) |
| 17:14 | ptrx | hello, i am new to clojure and just discovered libGDX. From what i understand i have ideally one clojure codebase and can target libGDX over the RoboVM with it and deploy my app to all kind a platforms. Is this correct? I am interested in gui apps, which arent games. Would i still want to use this combination or are there other tools? Thanks in advance! =) |
| 17:16 | justin_smith | ptrx: cljs with one of the react libs (om, reagent, etc.) is good for webapps if that's an option. Otherwise there is seesaw (swing bindings) or javafx - I think there's some clojure binding to javafx out there |
| 17:16 | justin_smith | pilne: I'm gonna make a tutorial that assumes one is using ed |
| 17:16 | pilne | bwahahahahahaha |
| 17:17 | pilne | line-only-editing ftw |
| 17:17 | justin_smith | I mean it's the most universally installed editor in existence, right? |
| 17:17 | ptrx | justin_smith, thank you =) |
| 17:17 | sdegutis | What is? vi? |
| 17:17 | sdegutis | Oh wait no ed. |
| 17:17 | sdegutis | Is sed just like a super ed? |
| 17:18 | pilne | i mean.... don't get me wrong.... i have zero hate for emacs... but... when i'm looking for a decent sized project tutorial to grok clojure a bit better... (i learn better that way), i don't want to *have* to use it |
| 17:18 | sdegutis | Like, ed++? |
| 17:18 | pilne | sed and ed are... really different in use |
| 17:18 | justin_smith | ptrx: of all the options I think seesaw is probably easiest to jump into in a clojure way, react webapp is likely the most powerful option right now, and javafx will look and act more like a regular desktop app compared to the other options |
| 17:18 | sdegutis | pilne: sure that's fine, no loss.. I can't really use anything except emacs when s-expressions are involved on account of paredit |
| 17:18 | WorldsEndless | I tried to index a collection of page objects using zipmap with range, and the order came back shuffled. Should I be using a different function, or should I sort? |
| 17:18 | justin_smith | sdegutis: sam is super ed |
| 17:19 | sdegutis | justin_smith: I'm still waiting a few years for the react/etc ecosystem to settle down and finally land on something sane before I jump into that + Electron |
| 17:19 | pilne | eh, atom, light table, and vim all support paredit from what i've found (and i prefer all three of those (in vim mode for 2 of them) to emacs just for muscle memory.... something tells me i chose the wrong pil years ago |
| 17:19 | WorldsEndless | That is, they are assigned the right number, but they come back "1, 7, 13, 3" or some such order |
| 17:19 | sdegutis | justin_smith: cuz as it is right now its quite a bit ridiculous to get started with or even use, although reagent looks cool for simple things |
| 17:19 | justin_smith | WorldsEndless: hash-maps are not ordered, if you want an ordered map user sorted-map |
| 17:20 | sdegutis | justin_smith: wow you're just full of useful Clojure tips/tricks/did-you-know-about |
| 17:20 | ridcully_ | they appear ordered for some smaller amount of elements. 32? |
| 17:21 | pilne | i guess i could just hack and chop my way through some things on rosetta code instead, project euler is fun, but it is all number crunching >.< |
| 17:21 | WorldsEndless | ridcully_: I have fewer than 32 and it's bonkers... |
| 17:21 | sdegutis | my goal in #clojure is to be helpful often, increasing the chance that someone will compliment me on being helpful, at which point i can reply "Shut up baby I know it B)" |
| 17:21 | justin_smith | ridcully_: I think it's 8 |
| 17:21 | justin_smith | ,(zipmap (range 7) (range)) |
| 17:21 | clojurebot | {0 0, 1 1, 2 2, 3 3, 4 4, ...} |
| 17:21 | justin_smith | ,(zipmap (range 8) (range)) |
| 17:21 | clojurebot | {0 0, 1 1, 2 2, 3 3, 4 4, ...} |
| 17:21 | justin_smith | ,(zipmap (range 12) (range)) |
| 17:21 | clojurebot | {0 0, 7 7, 1 1, 4 4, 6 6, ...} |
| 17:22 | WorldsEndless | Yup, that's my problem.... |
| 17:22 | WorldsEndless | So, (sorted-map (zipmap...)) |
| 17:22 | terom | ,(map-indexed vector (range 10)) |
| 17:22 | clojurebot | ([0 0] [1 1] [2 2] [3 3] [4 4] ...) |
| 17:22 | pilne | hrm... since haskell, lisp, scheme, and clojure all play extraordinarily well with emacs, maybe i should just take the plunge |
| 17:22 | justin_smith | ,(into (sorted-map) (map vector (range 8) (range))) |
| 17:22 | clojurebot | {0 0, 1 1, 2 2, 3 3, 4 4, ...} |
| 17:22 | pilne | (my *favorite* languages) |
| 17:22 | justin_smith | ,(into (sorted-map) (zipmap (range 8) (range))) |
| 17:22 | clojurebot | {0 0, 1 1, 2 2, 3 3, 4 4, ...} |
| 17:23 | ridcully_ | yeah it's 8 |
| 17:23 | WorldsEndless | Ah, into sorted-map did the trick. |
| 17:23 | WorldsEndless | Thanks! |
| 17:24 | pilne | now to find the best "default clojure" setup for emacs.... |
| 17:26 | sdegutis | pilne: just install clojure-mode and paredit |
| 17:26 | sdegutis | pilne: also cider |
| 17:26 | sdegutis | then bam you're done |
| 17:40 | LauJensen | Gents, datomic question. I have some :days/* which stores stats on a given day, and each day references 24 :day/hours where information specific to each hour. The ID for each day is :day/date (instant). How do I best extract every :hour/whatever value for dates in a given range? |
| 17:44 | pilne | AAARRGGHHHHHHH!!!! unity's default bindings make using the meta key in frickin emacs impossibru >.< |
| 17:45 | justin_smith | option a: delete emacs, option b: change the default binding key? |
| 17:45 | pilne | sadly it isn't just one binding.... |
| 17:45 | justin_smith | pilne: you can change the meta key it uses |
| 17:45 | pilne | (onyxia style) |
| 17:45 | pilne | or i can take this as my hint to gtfo from unity |
| 17:46 | justin_smith | pilne: in either emacs or unity, there are configs that change which key means "meta", one of them can have the windows/apple key |
| 17:46 | justin_smith | that works too |
| 17:46 | pilne | does gnome 3 do stupid stuff with the meta key by default that anyone knows of? |
| 17:53 | justin_smith | is there a browser plugin that makes js code run slower? |
| 17:53 | justin_smith | like - intentionally, I want to run this like at 1/1000 speed |
| 17:55 | pilne | hrm... maybe i'll just go with mate... i don't remember having these issues with rogue meta key shennanigans back in the gnome2 days >.< |
| 17:55 | amalloy | justin_smith: would the js stepping debugger do? |
| 17:55 | ridcully_ | justin_smith: use IE *ducks and runs* |
| 17:56 | Glenjamin | you could use a transpiler to add a while loop between every statement |
| 17:56 | justin_smith | amalloy: the problem is that my bug causes the script to redirect before I can intervene - I want to see the steps before that happens |
| 17:57 | justin_smith | amalloy: I can't even get at the UI to enable a breakpoint - maybe if I turn js off, enable the breakpoint, then turn it on? |
| 17:57 | Glenjamin | at that point i rely on console logging with console persistence-on-page-change |
| 17:57 | justin_smith | pilne: http://askubuntu.com/questions/122209/how-do-i-modify-or-disable-the-huds-use-of-the-alt-key |
| 17:58 | justin_smith | Glenjamin: how does persistence-on-page-change happen? |
| 17:58 | Glenjamin | erm, there's usually a toggle in the browser |
| 17:59 | justin_smith | oh... that's what "preserve log" means... I thought it would be like a save-as prompt or something |
| 17:59 | Glenjamin | you in chrome? |
| 17:59 | Glenjamin | ah, yeah - that |
| 17:59 | justin_smith | Glenjamin: that will do it, thanks so much |
| 18:00 | pilne | ok, before i do anything drastic, emacs default "meta" is alt and not the "super" key yes? |
| 18:01 | justin_smith | pilne: yes - but you can pick |
| 18:01 | justin_smith | it can use either one |
| 18:01 | justin_smith | or both! |
| 18:04 | pilne | ok, i can live with this |
| 18:04 | pilne | justin_smith, saving raging sleep-deprived clojurians one google at a time |
| 18:06 | justin_smith | pilne: it's something I've handled myself, back when I tried unity |
| 18:07 | pilne | sometimes i hate how much i like it in general.... |
| 18:07 | pilne | i feel like i'm betryaing the FOSS mentality a bit by sticking with ubuntu/unity, but... life does not allow for me to jump ship and get comfy somewhere else right now (too many pressing deadlines overall) |
| 18:07 | justin_smith | it's not bad, except the terrible amazon tyin stuff |
| 18:08 | pilne | which i nuked |
| 18:08 | justin_smith | right, problem solved |
| 18:08 | pilne | well, at least disabled, because nuking it makes a lot of stuff... quirky |
| 18:08 | pilne | although i do use amazon a lot, i'd like to "choose" what they know about me >.< |
| 18:08 | pilne | otherwise the prime account i share with the gf might have a lot of programming books as reccomendations, instead of things she would actually be interested in lol |
| 18:09 | pilne | .... which might save some money now that i think of it lol |
| 18:11 | Glenjamin | you can have separate accounts and share prime |
| 18:12 | pilne | meh, that's true, i have an old account that i rarely use these days that i could tie to unity, but... nah |
| 18:12 | ben_vulpes | should i be surprised that function calls in a let don't throw exceptions? |
| 18:13 | justin_smith | ben_vulpes: depends, are they lazy? |
| 18:13 | pilne | i'm honestly still trying to transition myself to gnome3 or mate, and possibly fedora down the line, but... since the long-term goal is game dev... and steam seems a "decent" way to go... i feel a bit tied to ubuntu/steam (in hopes of minimizing headaches when i get to that point) |
| 18:13 | ben_vulpes | justin_smith: might be. the one in question is a my own function call wrapped around a datomic insertion. |
| 18:14 | justin_smith | ben_vulpes: datomic stuff is often lazy in my fuzzy recollection |
| 18:14 | ben_vulpes | yup. |
| 18:14 | ben_vulpes | looks like datomic transactions return a future |
| 18:17 | ben_vulpes | soooo i should probably deref all datomic-produced futures, neh? |
| 18:17 | justin_smith | ben_vulpes: well, if you wanna know how they did, sure |
| 19:19 | pilne | need moar monitors >.< |
| 19:29 | pilne | and about them electric fences... ren and stimpy taught me that it is a bad idea to piss on them |
| 19:53 | Shayanjm | grats on the new gig arrdem :) |
| 20:05 | pilne | hmmm, so by this definition "or returns either the first truthy value or the last value. and returns the first falsey value or, if no values are falsey, the last truthy value." 'and' and 'or' do *not* "short circut"? |
| 20:11 | pilne | nevermind... i confused myself |
| 20:49 | justin_smith | ,(and :pilne false (/ 1 0)) |
| 20:49 | clojurebot | false |
| 20:51 | pilne | yeah... took a bit of re-reading and futzing with the REPL but i got it (: |
| 20:51 | pilne | and... other than getting used to the keybinds... emacs is rocking my socks |
| 20:52 | pilne | years ago i went with vim because vi is on every single unix box by default, logically i should have learned enough to just do what i needed to do.. and then learned emacs too |
| 20:52 | pilne | hindsight is 20/20 |
| 21:05 | TimMc | pilne: Have you used vim extensively before? |
| 21:08 | princeso | how do we avoid in a function getting the args in double parenthesis ((...)) when invoquing like (a-func (cons a b)) |
| 21:08 | TimMc | I know that plenty of people use vim for Clojure quite happily. |
| 21:08 | justin_smith | princeso: this is what the -> and ->> macros are for |
| 21:09 | justin_smith | princeso: though usually we use those when there are more than 3 or 4 nestings |
| 21:09 | TimMc | Is it? I was having trouble understanding the question. |
| 21:09 | justin_smith | (-> (cons a b) a-func) |
| 21:09 | justin_smith | TimMc: I figured princeso was talking about argument nesting in parens |
| 21:09 | princeso | akey man. let me try :) |
| 21:13 | pilne | i've used vim, but the solutions it gives for "pseudo buffers" always didn't feel "right" for some reason |
| 21:13 | pilne | i'm *probably* going to give spacemacs a shot here after a little while tbh |
| 21:16 | TimMc | heh |
| 21:23 | princeso | justin_smith it is a macro. A macro that call itself this is the part `(a-macro ~(cons case- (next (next body)))) . Works good exept it get the args in doubles ((args)) |
| 21:24 | justin_smith | princeso: maybe you want arg splicing? |
| 21:24 | justin_smith | `(a ~@[b c d]) |
| 21:24 | justin_smith | ,`(a ~@[b c d]) |
| 21:24 | clojurebot | #error {\n :cause "Unable to resolve symbol: b in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: b in this context"\n ... |
| 21:24 | justin_smith | ,`(a ~@'[b c d]) |
| 21:24 | clojurebot | (sandbox/a b c d) |
| 21:25 | princeso | justin_smith thank a lot, let me try |
| 21:38 | devth | tfw lein clean takes more than 10 minutes |
| 21:38 | devth | i don't get it. isn't it just rm'ing some stuff? |
| 21:39 | justin_smith | that's all it should be doing, yeah |
| 21:39 | justin_smith | hanging prep task? |
| 21:40 | devth | not sure. i don't have any custom tasks on this project |
| 21:40 | justin_smith | devth: you can run jstack to see what all the threads in a jvm are doing, if you share a paste link we can probably figure out why it is stuck |
| 21:40 | justin_smith | jstack comes with the jdk, it's a command line program 'jstack PID' |
| 21:40 | devth | k let me figure out my lein pid |
| 21:40 | devth | i have quite a few ... |
| 21:42 | devth | hey that kinda looks like a kill -3 on a java process |
| 21:42 | devth | https://gist.github.com/devth/13b0731fd7fa2b75d36b |
| 21:42 | devth | not totally sure that's the right one |
| 21:43 | devth | hm a killall java didn't kill lein |
| 21:44 | justin_smith | devth: that was a dump of drip - drip is a tool that keeps jvms ready to deploy to speed up startup |
| 21:44 | devth | k |
| 21:44 | devth | killing off all my various repls.. |
| 21:44 | devth | so i can hone in on the correct one |
| 21:45 | TimMc | Where's that site that tells you relative usage of different clojure libraries? |
| 21:45 | justin_smith | devth: if you use ps ax you can see the command line args |
| 21:45 | justin_smith | the one running clean should be distinctive |
| 21:45 | devth | that's what i'm using |
| 21:45 | devth | they're all huge |
| 21:45 | devth | and some are on related projects |
| 21:45 | justin_smith | TimMc: crossclj.info |
| 21:46 | justin_smith | devth: but they shouldn't all have "clean" as part of their command line |
| 21:46 | devth | justin_smith: after i killed off all my repls `lein clean` ran in ~2s |
| 21:46 | devth | oh i should have looked for that before i killed it |
| 21:46 | devth | ok next time... |
| 21:46 | devth | for some reason having a bunch of other `lein repl`s caused lein clean to hang |
| 21:47 | TimMc | justin_smith: I'm trying to figure out if there's a more or less canonical fork of clj-aws-s3 that is up to date. |
| 21:47 | justin_smith | devth: if you plan to run multiple repls in one project, here's a neat trick: 'lein cp > classpath'; rlwrap java -cp $(cat classpath) clojure.main |
| 21:47 | TimMc | There are a bunch of forks. |
| 21:48 | justin_smith | devth: after the first time you run cp, you don't need to run it again until you change project.clj |
| 21:48 | devth | justin_smith: i usually run 1 per project but that's a cool trick to know |
| 21:48 | devth | im gonna put it in my zshrc :D |
| 21:49 | justin_smith | TimMc: oh yeah - looks like crossclj.info only tracks one of them |
| 21:49 | justin_smith | devth: well it's two parts - you only need to run the lein cp once, then you can run the java -cp part multiple times - starts much faster than lein repl |
| 21:49 | devth | nice |
| 21:50 | devth | i've been restarting my repl a ton due to poor reloadability |
| 21:50 | devth | justin_smith: do you use component or whatever? |
| 21:50 | justin_smith | why aren't you coding reloadably? |
| 21:50 | justin_smith | devth: yeah, I use stuartsierra's component lib |
| 21:50 | devth | legacy code |
| 21:50 | devth | on the todo list :) |
| 21:52 | devth | that was just due to a huge refactoring though. normally i just reload namespaces. |
| 21:54 | devth | time to `lein release` 🎉 |
| 21:56 | princeso | justin_smith thak you man. yuo are a life saver :) Yes it worked with splicing ~@(cons .... |
| 22:32 | princeso | justin_smith This was the macro, if yuo have a break. http://pastebin.com/yD9PPXA6 |
| 22:40 | ben_vulpes | aaaa datomic pull api is teh dopeness |
| 23:06 | ben_vulpes | does anyone have a hot tip for enforcing that *.cljs files get cider-load-file'd into the CLJS repl and that *.clj files get idem'd into the clojure-proper repl? |