#clojure logs

2014-10-02

01:05zhaowcan any one help to explain why this does not work?
01:05zhaow(reduce #((if (even? %2) (* %1 2) (inc %1))) 1 (range 0 3))
01:06zhaowbut this works: (reduce (fn [number, index] (if (even? index) (* number 2) (inc number))) 1 (range 0 3))
01:08joshuafcole_parens
01:08mdeboardzhaow: You have extra parens
01:08joshuafcole_look off there
01:08dbasch&(reduce #(if (even? %2) (* %1 2) (inc %1)) 1 (range 0 3))
01:08lazybot⇒ 6
01:09zhaowI see
01:09zhaowThank you all :)
01:09joshuafcole_glad to help
01:09joshuafcole_go team
01:09mdeboardlol
01:10mdeboardTo answer your question, yes, someone can help to explain why it doesn't work
01:10joshuafcole_(inc mdeboard)
01:10lazybot⇒ 8
01:10zhaow(thumbsup) :D
02:22m00nlightHow can I run an exernal C program within clojure program? It seems the clojure.java.shell will cause an IOException error=2, No such file or directory
02:23m00nlightanyone can help?
02:27dbaschm00nlight: are you giving it an absolute path?
02:27m00nlightYes
02:28iamcyberbirdanyone worked all the way through SICP?
02:28m00nlightI find the reason, (shell/sh "ls -aux") will cause the errro, and (shell/sh "ls" "-aux") is fine, so I must seperate the program and the argument ?
02:29luxbockm00nlight: yes
02:30m00nlightdbasch: luxbock: Thanks solved
02:30luxbockm00nlight: if you need to lot of shell-calls you could check out https://github.com/Raynes/conch
02:53weipossibly a noob question, but what’s the difference between >!! and put!
03:02dbaschwei: >!! is blocking put
03:02weiso why does >! need to be in a go block but put! doesn't
03:03weiif they’re both async
03:08dbaschhttp://stackoverflow.com/questions/19538919/a-possible-solution-to-avoid-limitation-in-go-macro-must-be-called-inside-a-go
04:02borkdude so, how do you guys feel about racket as a sysadmin scripting language?
04:08clgvborkdude: probably depends on how well it interfaces with the tools available from os
04:37m1dnightI have created a class "counter" in my leiningen project. The class has package "demo". The path is /src/projectname/demo
04:37m1dnight(the core.clj file of the lein project is thus located at /src/projectname/
04:38m1dnightIf I want to import the java class in my core.clj I should thus write (:require [demo counter]), right?
04:38m1dnightI can't seem to import it, nor in the core.clj or in the repl
04:38m1dnightam I doing something wrong? I have compiled the .class file in the .demo folder as well
04:39m1dnightI keep getting ClassNotFound error
04:40m1dnight(btw, i'm talking about a java clas)
04:41borkdudem1dnight I think you need to configure java compilation in the leiningen project
04:42borkdude:java-source-paths
04:42m1dnightoh
04:44daniel___borkdude: still here?
04:44daniel___u work too hard
04:45m1dnightborkdude: Great :) That worked like a charm!
04:45m1dnight(inc borkdude)
04:45lazybot⇒ 4
04:45m1dnight\o/
04:50clgvseesaw question: can I do a (select widget [:.some-class]) such that only direct children are selected?
04:52clgvsince that is based on "enlive" . is that possible in enlive's selection mechanism?
04:54borkdudedaniel___ what do you mean? :)
04:55mercwithamouthdid the compojure-app template change as of recent?
04:55mercwithamouthi could have sworn it used to create routes/models/views folders?
05:06daniel___borkdude: u helped me with some multimethods before i went to bed
05:06daniel___over 12 hours ago
05:06borkdudedaniel___ I also went to bed after that I think
05:06daniel___ah ok :)
05:07daniel___uk?
05:07borkdudeNetherlands
05:07daniel___u have a job that lets you write clojure?
05:07joelkuiperSay I have a function (fn [a b] ...) is it possible to get the arguments bindings as a map within that function? Such that {:a a :b b} ?
05:08joelkuiperwithout doing it manually that is?
05:08borkdudejoelkuiper {:keys [a b]} ?
05:08borkdudejoelkuiper ah wait, you want to create a map
05:09borkdudedaniel___ yes
05:09joelkuiperborkdude: yes, I'm getting some arguments, but I need to pass them along as a key-worded map.
05:09daniel___borkdude: interesting, good to hear
05:10joelkuiperborkdude: the equivalent of (fn x [a b] (y {:a a :b b})) but then automatically :p
05:10borkdudejoelkuiper I dont think there is something baked in for that, you could however write a macro for it
05:10borkdudejoelkuiper if you have only two keys I wouldn't bother though
05:11borkdudedaniel___ not full time though, it depends
05:12joelkuiperborkdude: it was the example ;-) I'm using a library which api changed from (x a b c ...) to (x {:a a :b b :c c ...}), and I was hoping to avoid manual labour ;-)
05:13borkdude(defmacro to-map [& symbols] .... you'll figure it out)
05:13joelkuiperborkdude: yep ... I'll get to it ;-) thanks!
05:33lvhI'm writing a fake clock to test core.async/timeout. Someone must've written this before...
05:35m1dnightDo i have to add something specific in my core.clj when I import a class that has a lot of imports? I have copy pasted the code of LinkedBlockingQueue in my own file and compiled it by hand and that works but clj can't find it
05:36m1dnighthowever, it can find the class I tried before..
05:37lvhm1dnight: uh? you should just be able to import it directly
05:37lvhm1dnight: (:import (java.java.util.concurrent LinkedBlockingQueue))
05:38m1dnightlvh: Yeah, But i want to change it a bit to suit my own needs. So I wanted to start with the vanilla version first to make sure it worked
05:38m1dnightFirst i've tested a simple class counter.java, and I can import and use that one
05:38lvhm1dnight: Okay, then I don't understand your question.
05:39m1dnightSo i added the source of LinkedBlockingQueue to that exact folder, so I could import that one
05:39m1dnightbut I can import counter, but not LinkedBlockingQueue
05:40m1dnightI can compile both manually, which works fine. So in my clojure part I import the counter which works. But importing LinkedBlockingQueue class (my own) does not work
05:40m1dnightAnd I'm guessing it has something to do with the fact that it inherits and implements?
05:40m1dnightNot sure..
05:40lvhm1dnight: Could you pastebin the error message? "Doesn't work" isn't very specific.
05:40m1dnightsure, hold on
05:40lvhm1dnight: That shouldn't affect anything.
05:42m1dnightoh, I see now. For completeness' sake I wanted to add the tree of my directories and I notice that there is no LinkedBlockingQueue.class in my target folder
05:45m1dnightOh dear
05:45m1dnightit seems to work fine when I put some testcode in my core.clj, and "lein run", but in emacs it can't find it
05:46m1dnightlet me find the error in emacs
05:46m1dnightaaaand restarting emacs worked
05:46m1dnightPerhaps emacs didn't notice the new compiled files in the target directory or something?
05:50schmirm1dnight: lein repl (or clojure-jack-in) will compile the java files when it starts..
05:53m1dnightaah, that figures :) then the file was not compiled yet
05:53m1dnightSorry, i'm all new to the entire ecosystem :)
05:53m1dnightthanks for the input guys
05:56lvhm1dnight: M-x cider-restart
05:57lvhm1dnight: (assuming you already have a cider)
05:57lvhm1dnight: you have to do that every time there's some stuff you're not compiling manually and throwing into the repl
05:57lvhm1dnight: e.g. deps or java code
06:00m1dnightaha :)
06:01m1dnightthanks a lot! :)
06:26ucbis there any way I can redef (ala with-redefs) Java static methods?
06:26ucbe.g. Thread/sleep
06:34lvhucb: I'm assuming you've tried the obvious and it doesn't work?
06:34ucbyeah
06:35ucbwait, the obvious being (with-redefs [Thread/sleep identity] (Thread/sleep 10)) right?
06:35lvhyeah
06:36ucbyeah, that doesn't work because with-redefs is for vars
06:36lvhucb: I guess maybe you could store it in a var? although that's tricky because e.g. Arrays/copyOfRange won't work because there's a ton of different signatures for it
06:36ucbthe problem is that a third party lib I'm using calls Thread/sleep
06:37ucband I want to avoid that in my tests ^_^
06:37lvhucb: ah, right
06:38mercwithamouthso i'm using cider and the repl that comes with it. i se in ciders documentation they discuss including the cider-nrepl plugin. is that not already active?
06:38lvhucb: I'd say https://github.com/technomancy/robert-hooke, but I don't know if that does anything for java methods
06:38mercwithamouthis there added functionality?
06:40ucblvh: thanks, but that doesn't deal with java static methods
06:41ucbI'm not sure there's a clear way or even if it's doable unfortunately :(
06:41lvhucb: Yeah :(
06:41lvhucb: Sorry :/ maybe try the ml?
06:41ucbno worries :)
06:41ucbyeah will do
07:04gfredericksucb: release a clojure library called thread-slash-sleep and make a pull request
07:05ucbheh
07:17clgvlvh: ucb: robert-hooke works explicitely on clojure variables
07:18ucbyuppe, saw that :)
07:18clgvucb: you'd need something like Java AOP
07:18clgvucb: AspectJ I mean
07:20clgvusb: that stuff is essentially either rewriting bytecode or intercepting the compiler to add/modify bytecode
07:20ucbI feared as much
07:21clgvucb: you can not mock out the third party lib?
07:22ucbnot really. It's not really a lib either, it's more of an app which I'm using as a lib (bits of it). This is a long running thread that sleeps and does a thing in a loop. So I'm trying to get rid of that sleep in my tests.
07:22ucb(if that makes any sense)
07:22clgvucb: open source license?
07:22ucbyuppe
07:22clgvfork+fix ;)
07:23gfredericksthis kind of makes me want to create a lib called foo-slash-bar that jush has a huge collection of dynamic vars that call static jdk methods
07:23ucbbut no worries, I'm initting that timeout to something bearable like 1s for the time being.
07:23ucbgfredericks: at some point there was a static-fn thing going on?
07:23clgvgfredericks: awesome would be a lib based on ASM to modify and redefine classes ;)
07:23ucb(it did exactly that)
07:24gfredericks#'foo-slash-bar.java.lang.Thread/sleep
07:24clgvucb: why not 1ms?
07:24ucbclgv: I think the lib takes the timeout in seconds
07:24ucblet me check
07:25clgvdamn ;)
07:25clgvdoes it fail on 0?
07:25ucbyuppe, it's in seconds
07:25ucbI've not tried 0
07:25ucbI guess that it'd be fine for a test (even if it hammers the cpu while it runs)
07:25clgvseems to work overhere ;)
07:26ucbah, coole!
07:26clgvit's active polling without signals?
07:26clgvD'oh!
07:28augustlucb: if you can control the code, rewriting code so you can pass in an executor or something would be much more pleasant
07:28augustli.e. make the Thread/sleep pluggable
07:28ucbaugustl: yes, indeed, but I don't control the code sadly
07:28ucband in any case, I'm abusing this thing
07:28ucbso I guess I'm just asking for trouble
08:27gfredericksdo nrepl clients typically only allow constant prompt text?
08:28gfredericksI'm thinking of making an nrepl middleware that saves each repl result, and it would be nice if the prompt showed the name of the var that the result would be bound to
08:29gfredericks(erlang is a good example of this feature -- the prompt is simply "%d>")
08:29gfredericksI can't remember how to access the history in the erlang repl but I know there's a way
08:29gfredericksfor clojure I was thinking of naming them $1 $2 $3 etc., but configurable
08:30gfredericksnot sure if I should make them vars or locals
08:32clgv,*1
08:32clojurebot#<Unbound Unbound: #'clojure.core/*1>
08:32clgv;1
08:32clgv,1
08:32clojurebot1
08:32clgv;*1
08:32zeebrahis cider the only game in town for clojure on emacs?
08:32clgv,*1
08:32clojurebot#<Unbound Unbound: #'clojure.core/*1>
08:32clgvok no repl env ;)
08:33clgvzeebrah: there are its ancestors ...
08:35zeebrahclgv: slime? maybe its time to try out the IDEs. i'm deeply unsatisfied with how unreliable cider is to setup and keep working
08:38clgvzeebrah: non-emacs options are eclipse+counterclockwise, intellij/cursive, lighttable, vim+fireplace (and I probably forgot some)
08:39zeebrahclgv: cool. i'll have to try some of them out
08:42michaelr524heyyo
08:44lvhI'm getting icecap.handlers.delay_test$fake_timeout$timeout__22272 cannot be cast to clojure.lang.IFn$LO ; what the heck is a clojure.lang.IFn$LO
09:01michaelr524trying emacs-prelude - seems like a really nice thing
09:02michaelr524only it's pausing for a few good seconds every time I start typing something
09:02michaelr524on windows 7\
09:02michaelr524is anyone familiar with this issue?
09:09vijaykiranmichaelr524: didn't use prelude but perhaps check what modes are on and try disabling them
09:09michaelr524vijaykiran: yes, good idea :)
09:09vijaykiranmichaelr524: key-chord if enabled, might be one of the causes
09:09michaelr524oh right, I saw something about it in the docs
09:09michaelr524I'll try to disable it first
09:09vijaykiranmichaelr524: again - never used prelude, so ymmv and all the
09:10michaelr524vijaykiran: tghanks
09:12gfrederickslvh: it's a special IFn class for doing primitives
09:12lvhgfredericks: Heh, I literally just figured that out.
09:12gfredericks,(class (fn [^long x] (inc x)))
09:12clojurebotsandbox$eval25$fn__26
09:12lvhgfredericks: that was trickier than I had hoped it to be :/
09:12gfredericks,(parents (class (fn [^long x] (inc x))))
09:12clojurebot#{clojure.lang.AFunction clojure.lang.IFn$LO}
09:13lvhgfredericks: Why can't IFn be cast to that?
09:13lvhI thought that was a type hint, a performance optimization.
09:14lvh(I'm okay with it being three orders of magnitude slower; I would also have taken a less inscrutable error message)
09:14gfredericksI've actually never seen that error message
09:14gfredericksso I'm not sure what conditions bring it about
09:14lvhgfredericks: (with-redefs) (or with-redefs-fn); in my case I was trying to with-redefs core.async/timeout
09:15Bronsa,(defn x ^long [a] 1)
09:15clojurebot#'sandbox/x
09:15Bronsa,(defn y [] (x))
09:15clojurebot#'sandbox/y
09:15dumptruckmanany idea how to turn off the restrictions on writing and deleting parenthesis with cursive?
09:15Bronsa,(with-redefs [x (fn [a] 2)] (y))
09:15clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval123/fn--124>
09:16Bronsa,(defn y [] (x 1))
09:16clojurebot#'sandbox/y
09:16Bronsa,(with-redefs [x (fn [a] 2)] (y))
09:16clojurebot#<ClassCastException java.lang.ClassCastException: sandbox$eval174$fn__175 cannot be cast to clojure.lang.IFn$OL>
09:16Bronsalvh: ^
09:16lvhBronsa: Yes, that is hte error I got.
09:17gfredericksBronsa: okay so the error here comes from inside of y
09:17gfredericksbecause it was compiled to expect x to be a IFn$OL and the redef changed that
09:17Bronsalvh: if the var you're trying to redef has a primitive signature, the fn you redef it with has to have the same primitive signature
09:17Bronsagfredericks: yep
09:17Bronsa,(with-redefs [x (fn ^long [a] 2)] (y))
09:17clojurebot2
09:17Bronsathis works for example
09:17lvhBronsa: I was hoping that the two signatures would be compatible, but I guess not. Any idea what this is called?
09:17lvhi.e where do I find this in the documentation
09:18BronsaI don't think there's any documentation on this
09:18johnwalkeris anyone familiar with whats going wrong here? https://gist.github.com/johnwalker/b43315af11bb9dc4a197
09:19gfrederickslvh: I think the only way to make them compatible like you want without giving up the speed of primitives is to have every function define an extra hundred or so methods just in case they ever get called with primitives
09:20Fender,(clojure.walk/walk #(if (string? %)
09:20Fender (keyword %)
09:20Fender %) identity [["a" 1 "b"]])
09:20clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:20Fender,(clojure.walk/walk #(if (string? %) (keyword %) %) identity [["a" 1 "b"]])
09:20clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>
09:21Fender,(require '[clojure.walk])
09:21clojurebotnil
09:21Fender,(clojure.walk/walk #(if (string? %) (keyword %) %) identity [["a" 1 "b"]])
09:21clojurebot[["a" 1 "b"]]
09:21Bronsagfredericks: either that or compiling to (if (instance? f PimClass) (.invokePrim f ..) (.invoke f ..)) rather than directly to (.invokePrim f ..)
09:21Fender,(clojure.walk/walk #(if (string? %) (keyword %) %) identity ["a" 1 "b"])
09:21clojurebot[:a 1 :b]
09:21BronsaFender: you can query clojurebot
09:21gfredericksBronsa: which gives up a bit of speed for that check
09:21Fenderwhy the difference? when I hear walk, I think traverse
09:22FenderI know, just wanted to establish the case :)
09:22gfredericksFender: try postwalk & prewalk; I think walk might be more general
09:23Fenderbut shouldnt it traverse the tree?
09:23gfredericks,(doc clojure.walk/walk)
09:23Bronsagfredericks: yeah, I think that's something that could (and should) be done when we get build profiles though -- direct .invokePrim for production builds & w/ check for dev builds
09:23clojurebotExcuse me?
09:23gfredericks&(doc clojure.walk/walk)
09:23lazybot⇒ "([inner outer form]); Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures. Consumes seqs as with doall."
09:23BronsaFender: it doesn't say that it recursively traverses the data structure
09:23michaelr524vijaykiran: well.. looks like cider is causing the problem somehow
09:23Fenderoh
09:24gfredericksFender: yeah looks like postwalk and prewalk specifically instrument the recursion
09:24Bronsayep
09:24michaelr524vijaykiran: once i cider-connect to the lein session the problem begins
09:24BronsaI find it a little counterintuitive at times too, but the documentation is clear on that
09:24Fenderhehe
09:24Fenderyou're right
09:25Fender&(doc clojure.walk/prewalk)
09:25lazybot⇒ "([f form]); Like postwalk, but does pre-order traversal."
09:25Fender&(doc clojure.walk/postwalk)
09:25lazybot⇒ "([f form]); Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall."
09:25Fenderok, right
09:25FenderDF
09:25gfredericksman I wish those docstrings were mutually recursive
09:25Fenderwell, its not exactly documented
09:25Fenderwell it is
09:25hyPiRiongfredericks: ahoy, to the JIRA
09:26Fenderthanx guys!
09:26gfredericksinc: like dec but the other way around
09:26Bronsalol
09:27gfredericksSystem/exit: like `java ...` but for the end of your program instead of the beginning
09:27hyPiRion*: The inverse of /
09:27justin_smithmichaelr524: completion can cause pauses
09:28justin_smithmichaelr524: do you have any kind of completion mode on?
09:28hyPiRion&(doc mapv)
09:28lazybot⇒ "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remai... https://www.refheap.com/91048
09:28michaelr524justin_smith: I disabled all prelude modules except the clojure one. maybe it's the cider-nrepl middleware for completion?
09:29justin_smithI think the prelude module for clojure would include completion (though I have no idea what a "module" is in emacs, and I have been using emacs for about 20 years0
09:30hyPiRion&(doc clojure.core/assert-valid-fdecl)
09:30lazybot⇒ "([fdecl]); A good fdecl looks like (([a] ...) ([a b] ...)) near the end of defn."
09:30hyPiRiongfredericks: we should have more of those ^
09:30michaelr524justin_smith: heh ok
09:31justin_smithmichaelr524: "module" is either something the prelude folks made up, or you are using the wrong term - it's not an emacs thing
09:31michaelr524justin_smith: it's just some emacs lisp code the prelude folks made to preload functionality
09:32michaelr524justin_smith: in the clojure module they preload clojure mode and cider
09:33justin_smithso it's a small elisp library that just loads other libraries
09:37michaelr524justin_smith: yup..
09:37michaelr524justin_smith: it's interesting.. i disabled the small elisp library that just loads other libraries
09:38michaelr524justin_smith: now i load a clojure file and connect to cider and everything seems to work fine\
09:38michaelr524justin_smith: clojure mode and cider are loaded automatically anyway when I open the clj file it seems.,.
09:56ubolontonAnyone knows why core.async channels must be buffered when used with transducer?
09:58clgvubolonton: where is that information from?
09:59ubolontonFrom the doc string of chan
10:00ubolontonIt says "If a transducer is supplied a buffer must be specified"
10:02clgvubolonton: ok from the point of the arity you must provide something in the buffer position, and this is stating that is must not be nil
10:02cflemingdumptruckman: https://cursiveclojure.com/userguide/paredit.html
10:03ubolontonYes, that's why I'm asking
10:03ubolontonWhy can't unbuffered channels use transducer?
10:05clgvubolonton: the impl/channel ns is pretty much for a quickscan. so maybe you find the answer when you dig in there
10:06clgvubolonton: or you wait for tbaldrige to show up here and ask him...
10:06borkdudeslides for workshop that we will give saturday https://rawgit.com/borkdude/immutable-webapp/master/sheets/presentation.html#slide1
10:06ubolontonWhen does he usually show up?
10:07clgv$seen tbaldrige
10:07lazybottbaldrige was last seen quitting 49 weeks ago.
10:07ubolontonUgh
10:07clgvno that cant be right
10:07mdrogalisIt's like beatle juice. Gotta say his name 3 names.
10:09clgvfunctions spanning 90 lines :O
10:09justin_smith$seen tbaldridge
10:09lazybottbaldridge was last seen quitting 16 hours and 41 minutes ago.
10:09clgvaha, spelling error ;)
10:09justin_smithbridge over troubled bald
10:09ubolontonCool :D
10:11clgvClojure is self-documenting and needs no docs, eh? https://github.com/clojure/core.async/blob/53bf7866f195e6ba247ff7122b99784e66e9f1bb/src/main/clojure/clojure/core/async/impl/channels.clj#L67
10:11clgv:P
10:11clgvoop comments I meant
10:11mdrogalisclgv: The ecosystem is self-documenting.
10:12clgvmdrogalis: what do you mean?
10:12mdrogalisclgv: I'm being sarcastic, sorry. :P
10:13clgvmdrogalis: too few words to reliably detect that ;)
10:14mdrogalisclgv: Don't mind me. I'll just be over here in the corner making snarky noises. :D
10:17samfloresI'm trying to learn ClojureScript, but when I try to load the compiled script in the browser I'm getting an "property undefined" error in the Google library
10:17samfloreshttps://gist.github.com/samflores/8a47622cec489c63514a
10:18samfloresanyone knows why?
10:21mdeboard,(+ 1 1)
10:21clojurebot2
10:21mdeboardsamflores: Apparently goog.string is not available in the window
10:22daniel___samflores: you're not targeting node are you?
10:22samfloresnope
10:22daniel___sorry, you said browser
10:23daniel___samflores, presumably its a compilation :whitespace issue?
10:23daniel___:advanced and :simple works?
10:23samflores:advanced works. I didn't try simple yet
10:23samfloreswait a sec
10:25samfloresyeah, it works with simple too
10:34daniel___samflores: i've seen some similar open issues on jira, dont know what the problem is tbh
10:40lavokad:sp
11:01otaku_coderI'm trying to get oauth2 working in my app, against the spotify web api but can't seem to find a working oauth2 lib. Have tried oauthenticate and oauth2-clj. Has anyone actually got these working?
11:03justin_smithhttps://clojars.org/clj-oauth I have had success with this one - forget off the top of my head if it supports oauth2 though
11:06otaku_coderjustin_smith: sadly doesn't look like it supports oauth2
11:13samfloresdaniel__, thanks. I'll use :simple for now
11:33favetelinguiswhy does this execution causing an never ending expresion (count (combo/permutations deck)) comb is the math.combinatorics and deck is a 52 elements long vector of vectors [[A C] [A H]...]
11:35llasramfavetelinguis: The combo/permutations implementation just generates a lazy sequence of the permutations, not any sort of "smart" special-purpose representation of the set of permutations
11:35llasramfavetelinguis: That means you'd end up generating and walking over all 52! permutations in order to `count` them
11:35justin_smithbut that expression should still only be (* 52 52) - it shouldn't run indefinitely
11:36justin_smithwait, it's pairs of two, that's not 52!
11:36llasramjustin_smith: It's a 52-element vector of pairs
11:36justin_smithahh, so it's not taking all the pairs, the 52 elements are pairs, got it
11:37jeremyheilerjustin_smith: also 52! is much larger than 52^2
11:37justin_smithright, I know that part :P
11:38favetelinguisyes it is a big number but the comuter must be able to handle that?
11:38justin_smitheventually
11:38llasramI was actually recently playing around with some some smarter ways of working with combinatorial objects: https://gist.github.com/llasram/025e98d459ad48d71178
11:39llasramNot directly usable, but has some ideas
11:39llasramfavetelinguis: You might want to think a bit about exactly how large 52! is :-)
11:39justin_smith,(reduce *' (range 1 53)) ; the number of elements it has to calculate
11:39clojurebot80658175170943878571660636856403766975289505440883277824000000000000N
11:39justin_smithit takes a while to generate that many elements
11:40justin_smithnotice also that this requires *' rather than *, because that's too large for a 64 bit number
11:40favetelinguis:) ok thanks was unsure if i was missing something, have not fully understand when lazy list can cause troblle
11:41favetelinguiswas thingk maby count did not actually generate the list
11:41justin_smithfavetelinguis: if this was not a lazy list, instead of taking a very long time, it would make your computer run out of memory
11:41jeremyheilerfavetelinguis: if it didn't, what would coult return? it has to be eager to give a real answer
11:41jeremyheilercount*
11:41favetelinguiswell this code realizez the lazy list right so the comuter shuld still run out for memory?
11:42justin_smithfavetelinguis: only if you hold onto the head of the list
11:42justin_smithbut instead, clojure is smart enough to know you are acting on each element but not binding the result, so it is silently discarded after counting
11:42ToxicFrogfavetelinguis: count counts and discards each element rather than holding the entire list in memory at once.
11:42favetelinguisaa ok so count just generates the next element and inc some counter and then throws it away?
11:43justin_smithwell, count simply fails to hold any reference to the previous element, and the jvm knows that the element can be discarded, because nobody holds a reference
11:45hiredman /win 19
11:54Farecan anyone explain how leim quail completion works?
11:54borkdudejust discovered that when a compojure route returns nil, apparently the next route is tried
11:54borkdudeat least this is what seems to happen
11:54Faree.g. in if I C-h I TeX (describe-input-method), it shows that \~i can be two characters — but how do I select the second?
11:55Fareoops, wrong channel
11:57borkdudecfleming when comment a line in a let like this (let [;
11:58borkdudecfleming after pressing ; it indents weirdly, it shouldn't change the indentation imho
11:59cflemingborkdude: can you send a refheap of what you're seeing?
12:00borkdudehttps://www.refheap.com/91053
12:04borkdudecfleming emacs does this too sometimes
12:04borkdudereduce into '() is not my code btw ;)
12:05cflemingNo problem, we're all friends here :-)
12:06cflemingSo a few people asked for this, see https://stackoverflow.com/questions/6365334/lisp-commenting-convention
12:06cflemingBasically line comments at the end of a line are lined up at 60 chars
12:07cflemingIt looks weird in your case because the first part of your line is incomplete
12:08borkdudecfleming I see, it's a feature?
12:08borkdudecfleming I never understood this feature I guess
12:09cflemingborkdude: Yup, you can disable it by setting your comment alignment column to 0
12:09borkdudecfleming k cool thanks
12:10bbloomanother trick is #_#_
12:10bbloom,(let [x 1 #_#_x (+ x 2) x (+ x 4)] x)
12:10clojurebot5
12:11justin_smithoh, #_ stacks? cool
12:13bbloomyeah, the inner #_ goes first b/c #_ recursively calls read
12:13borkdude,(#_#_ foo bar 1)
12:13borkdude,(#_#_ foo bar + 1)
12:13borkdudebbloom cool thanks, I didn't know you could stack #_
12:13clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
12:13clojurebot1
12:13gfredericksbbloom: oh snap good trick
12:13gfredericks(inc bbloom)
12:13justin_smith,(#_#_#_#_#_ :a wtf (Throw (Exception. "UMM")) "hello" world reduce #_#_#_ :a :b (assert false) *' (#_ #_ 77 fnil range #_#_#_#_ 33 #_ 4 + 22 repl 1 52))
12:13lazybot⇒ 44
12:13clojurebot1551118753287382280224243016469303211063259720016986112000000000000N
12:13borkdude(inc bbloom)
12:13lazybot⇒ 45
12:15Farebbloom: btw, have you read Jochen Lietdke's "A persistent system in real use—experiences of the first 13 years"?
12:16borkdude,#_ funny
12:16clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:16bbloomFare: no, but just dloaded it now
12:17Farebbloom: does your persistent clojure system use a JVM? your own compiler?
12:17Fare(did I show you my first-class implementation diagrams?)
12:17bbloomFare: i'm not ready to talk about the clojure pieces of what i'm doing here in this channel :-P
12:18Fareoh, sorry
12:18bbloomFare: you didn't show me any diagrams
12:18Farebbloom: I may or may not have told you that orthogonal persistence was a big requirement for TUNES.
12:26dbaschThe phrase “may or may not” is interesting. From a logical perspective it should contain no information, yet the fact that the sentence was uttered at all gives much more likelyhood to “may” than to “may not.”
12:26dbaschlikelihood
12:29dkinzerdbasch: depending on the context, I would say the opposite.
12:30joegallowell, it may or may not give much more likelihood to the "may" than to the "may not". imho.
12:37gfredericksit rules out the speaker wanting to communicate certainty in either direction
12:40nickikin clojurescript how do I get the type of something?
12:40ToxicFrognickik: type?
12:40ToxicFrog,(type "")
12:40clojurebotjava.lang.String
12:41ToxicFrogI haven't used cljs but I'd expect it to work there too
12:41BobSchack1type works the same way in clojurescript
12:41nickikbut when I do this
12:41nickik(type (get heap (:val slot)))
12:42nickiknothing shows up in the html
12:43nickikwhen I do
12:43nickik(str (type (get heap (:val slot)))
12:43nickikI get 'function String() { [native code] }' for string
12:48BobSchack1You're printing out the String constructor function
13:04edwI'm getting hangs in CIDER as the symbol lookup times out while typing things like (for [x [0 1 ...]] ...) after I type 'x'. Anyone else see this (new) behavior recently?
13:14justin_smithedw: using the alpha version?
13:14edwMELPA. Yep.
13:15justin_smithyeah, following the head of unstable cider is gonna hurt on a regular basis
13:15edwOh I know, this is just way more painful than the usual.
13:18justin_smithedw: that stuff would be so much simpler if elisp had any sort of concurrency support
13:18justin_smithI wonder if go.el would be possible...
13:19technomancythere's async concurrency
13:20technomancyit's not general-purpose; it only works with network connections and subprocesses
13:20technomancy(which is fine for this, but not enough to port core.async)
13:20justin_smithinteresting
13:21justin_smithtechnomancy: which means the problem isn't just emacs blocking on the communication with the repl, it's an error in the elisp code causing emacs to lock up unneccissarily
13:22justin_smithoh, duh, yeah I've used that callback based async process stuff in elisp (ages ago)
13:22technomancyjustin_smith: well, arguably the problem is async code is a lot harder to do correctly =)
13:23justin_smithsure :) thus go.el!
13:26technomancyin the words of fsbot, "elisp needs some theology and geometry, some taste and decency. I suspect that we are teetering on the edge of the abyss."
13:27justin_smithmy valve!
13:35llasramtechnomancy: What is that...?
13:36{blake}OK, so, I've made my dependency on clj-time implicit, set it to the latest version "0.8.0". In Cursive, if I Ctrl-Click on clj-time/core it goes to the right file. But in Cursive or a plain lein repl, I can tell it's still using 3.7. (Later versions added functions that aren't there.)
13:36llasramOh, quote from /Confederacy of Dunces/
13:36technomancyllasram: apparently from "A Confederacy of Dunces"
13:37{blake}"ack"ing shows clj-time 3.7 in the .idea directories, so I guess that explains the Cursive ish...but that shouldn't affect the command-line REPL, I don't think.
13:37llasramI initially searched assuming "elisp" and found several other (IRC logs?) of people saying the same thing :-)
13:37justin_smithtechnomancy: llasram: confederacy of dunces, which is also what I was referencing with "my valve" which I guess looked like a bizarre non-sequitor if you don't know the book
13:38llasramIt's been several years
13:38technomancyjustin_smith: just added it to http://technomancy.us/books =)
13:38technomancyso I'll totally get your reference in a few years
13:38justin_smithheh
13:38justin_smithit's totally a book from the '60s about a modern internet aspie nerd
13:39llasramI wish I could take a few years off to just read full time and catch up...
13:39justin_smithoh wait, it's from 1980, never mind that '60s part
13:39technomancyjustin_smith: published in the 80s, written in the 60s?
13:39xeqi{blake}: 1. did you restart your repls? 2. does `lein deps :tree` tell you if something else is pulling it in?
13:39justin_smithoh, but the authoer killed himself in 1969 :P
13:39justin_smithtechnomancy: yup
13:40justin_smithI mean I knew it was from the '60s just by reading it, never checked authored / published data
13:40justin_smith*date
13:40{blake}CoD was published posthumously.
13:40{blake}IIRC
13:40justin_smithyeah, 11 years later
13:40{blake}xeqi: REPLs are restarted, lein deps :tree reports 0.8.0
13:41justin_smiththe title is from Johnathan Swift: "When a true genius appears in the world, you may know him by this sign, that the dunces are all in confederacy against him."
13:41{blake}Hated that book. Everyone tells me how great it is, though, so maybe I should re-read.
13:42justin_smith{blake}: it's one of those books that can be enjoyed only if you resign yourself to hating everyone in it
13:43{blake}justin_smith, That...is doubtless true.
13:47llasramI don't actually remember "hating" any of the characters... It was all just too comic. I want to meet any of them IRL, but none of them were plausible IRL
13:48llasrams,want,wouldn't want,
13:48llasramOTOH, I remember hardly any concrete details, so I probably need to re-read it too :-)
13:49TimMcwant, wouldn't want, same thing
13:49llasramheh
13:50TimMcwan't?
13:50TimMca new, confusing shorthand for "wouldn't want"
13:51joshuafcoleI agree. Let's make this happen
13:51{blake}If we can agree to stop trying to make "fetch" happen.
13:52joshuafcoleugh
13:52joshuafcoleI'd be shocked if anyone in this room were on that boat
13:53aphyroh my god, that is SO fetch
13:53justin_smith{blake}: stop trying to make "stop trying to make "fetch happen"" happen, it's not going to happen
13:53joshuafcole(dec aphyr)
13:53lazybot⇒ 1
13:53joshuafcole:P
13:53joshuafcole(inc aphyr)
13:53lazybot⇒ 2
13:53{blake}Wait, it's not going to happen, or it's not NOT going to happen?
13:53{blake}I mean, I would want that.
13:54{blake}Or wouldn't I?
13:54justin_smithwe're programmers, we are good with stacked booleans
13:55justin_smitherr, that was garbled
14:00TimMcYeah, just count on your finger. (0, 1, 0, 1, 0...)
14:02IllusioneerI have a clojure project compiled into a jar file. The jar is a webapp that can run from JAVA -JAR APP.JAR but I was told a better way to go is to use http-kit
14:08clj-learnerhi, im trying intellij with cursive, but the code style seems bad, are there other's i can download?
14:08clj-learnerthe scheme
14:10justin_smithIllusioneer: assuming it is a ring app, to use http-kit you would need to change the server definition so it uses the http-kit ring adaptor rather than the one it uses currently
14:11justin_smithclj-learner: what's wrong with the style? do you mean the color scheme?
14:12clj-learnerit doesnt align map elements for example
14:12justin_smithoh, the indentation?
14:12clj-learneryes
14:12justin_smiththat's surprising
14:12clj-learnerlight table was fine
14:14{blake}It doesn't align map elements? It seems to when I type them in. (Or maybe I misunderstand.)
14:15Illusioneerjustin_smith: I don't think it is a ring app, from what I can tell the dev made this stand alone, all his tests were executed from a java command line
14:15justin_smithIllusioneer: ring is just a lib
14:16justin_smithI mean, maybe it isn't a ring app, in which case switching from one http server to another in that project is even harder
14:16mi6x3mclojure, is there something like try-let
14:16mi6x3mor let-try ?
14:17borkdude,
14:17justin_smithIllusioneer: lein-ring is a lein plugin for using ring based webapps, but you can use ring without lein-ring, and I deploy apps to production with an embedded ring servers without using lein-ring
14:17clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:17borkdude:)
14:17sqdhi! i'm reading a ProcessBuilder InputStream, wrapped with clojure.java.io/reader and then line-seq (which gets transformed by a couple of filters and maps). it seems that the line-seq keeps everything in memory. can i just let it put every new line on a channel and then get rid of it?
14:18justin_smithIllusioneer: those apps run from the command line "java -jar ..." and use ring
14:18dbaschsqd: line-seq is lazy, it won’t keep everything in memory if you don’t hold on to the head
14:19Illusioneerthanks justin!
14:19sqddbasch: ok thanks, then the memory usage comes from something else probably
14:21TimMcmi6x3m: I don't think so, but sounds like an easy macro to write.
14:22justin_smithsqd: the jdk comes with a profiler, jvisualvm, which can help see what is using all the memory
14:22justin_smith~why
14:22dbaschmi6x3m: here’s one https://gist.github.com/ataggart/377278
14:22clojurebotbecause that's not how macros work
14:22sqdjustin_smith: nice, will check it out
14:23mi6x3mdbasch: thanks!
14:24sqdi'm using core.async.lab/spool to put a lazy-seq on a chan. does it matter much whether i apply transducers before or after?
14:26dnolen_sqd: transducers are provided when constructing a channel so I'm not sure what you are saying
14:29sqddnolen_: a reformulation: does it matter whether i (spool (sequence xform myseq)) or (spool myseq (chan 1 xform))?
14:30dnolen_sqd: I don't it matters much - at least not w/o more context
14:31sqddnolen_: ok thanks, then i think i understand things a bit :)
14:32doctormnode has a standard environment value for switching app modes, NODE_ENV=production, is there such a standard for clojure or does each app just choose it’s own?
14:33clj-learnernow intellij doesnt open: "Internal error.java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.util.indexing.FileBasedIndex' , etc" :( how do i solve this
14:33llasramdoctorm: Clojure does not have any such as standard, and IMHO such an approach can be actively harmful
14:33borkdudeclj-learner ask cfleming :)
14:33technomancydoctorm: it's more common to control that via the classpath
14:34llasramdoctorm: In Clojure you tend to bring up long-running JVMs, in which you'll want to (at least) do both "dev" and "test" things
14:34doctormllasram: Thanks, I don’t think it’s an official standard, I don’t really have an opinion on it, was just curious
14:34technomancydoctorm: that is, don't check for production vs dev, check for specifically the value you care about
14:35technomancyand yeah, the dev/test split is widely regarded to be more trouble than it's worth
14:35doctormtechnomancy: I don’t quite understand that, for example let’s say I want to implement a certain error handler only in dev, do you mean instead of saying “production” or “dev” you would use something like “use-foo-handler”?
14:36llasramdoctorm: https://github.com/stuartsierra/component is one example of something that gets you near the same kind of result, and (as a specific library) has gotten a certain amount of traction in the community
14:36technomancydoctorm: more or less, yeah
14:37doctormllasram: I did watch his talk and played with component a bit, I thought it might be overkill after implementing a toy project with it, but I’ll give it another look with regards to dev/production management
14:44doctormI think maybe it’s the reloaded workflow I don’t understand completely, is it expected to use that and component together?
14:46llasramdoctorm: They definitely complement each other. I find stuartsierra's auto-reloading tooling overkill myself, but I don't make such extensive use of records and protocols as he apparently does
14:47llasram(Which is one way I agree component feels "overkill" -- I'd much prefer a tool which just used plain maps and functions, albeit not enough to write yet-another-DI-library)
14:47technomancyllasram: that's why we're such good buddies
14:48llasramtechnomancy: And here I was considering auditioning to be your nemesis!
14:48technomancyhaha, oh yeah
14:48doctormI think part of it is I feel cognitevely overloaded trying to grok new (to me) libraries at the same time I try and fit them into the component pattern (although the component pattern itself seems clear enough when Stuart explains it)
14:48mdrogalisGot that covered.
14:48technomancyllasram: I think tpope was volunteered; he fits all the qualifications
14:50llasramOh well...
14:51technomancyI'll keep you on the list for possible future superhero team-ups though.
14:51llasramOoh -- maybe in a parallel timeline
14:52xeqitechnomancy: there are qualifications?
14:53hiredmanuses vim
14:53technomancyxeqi: not sure I got beyond "uses vim" and "good at puns (for bantering duels)"
14:55xeqiI was wondering what would complement your gif powers
14:56llasramjpeg powers
14:57SegFaultAXtpope is a double whammy... uses vim *and* wrote a package manager.
14:58doctormSo broadly, when you’re in dev mode with component, you use the nrepl to switch out which components are being in the system? Or do you define two separate systems and conditionally start one?
14:58xeqillasram: pop culture song refs?
14:58doctormbeing used* in the system
14:59llasramxeqi: quotations from works of literary and historical significance?
15:00xeqimaybe, that scifi stuff is garbage
15:00llasramAlthough that one would come full circle in a few thousand years, as famous GIFs and image macros of the early 21-st century become part of the Western literary canon
15:01justin_smithlolmarginalia http://www.pinterest.com/caseyweed/weird-medieval-images-and-marginalia/
15:02justin_smithbook margins were definitely the reddit of their time
15:02llasramthe bunny with the ax -- ha! / slightly skeptical
15:02justin_smithllasram: that was actually a common theme
15:03xeqidoctorm: I'd lean towards two systems. No need to start a CDN component for dev for example
15:03justin_smithllasram: GIS "marginalia rabbit" and be delighted
15:03justin_smithjust found one with a rabbit apperently sexually molesting a monk
15:04doctormxeqi: Ok thanks, I’ll try to make a small system with dev and production versions, and see how it goes.
15:05llasramjustin_smith: that is just great
15:05justin_smithxeqi: using the CDN in dev is actually convenient if you aren't working waterfall and you are collaborating with designers :)
15:06xeqidoctorm: my recent explorations seem to lean towards lifecycle components that start/shutdown "sub-components". In unit tests just use the sub-components, ignoring lifecycles/(the system) where possible.
15:06justin_smithllasram: someone should really photoshop a bunch of those into "Ye Olde Reddite"
15:08doctormxeqi: So with sub-components, the main component acts as it’s own mini-system? Stuart did mention that a system is pretty much just a component. Can you give me a quick example of what a component with sub-components would look like, for say, a database.
15:10mdeboardwhat kind of components are you guys talking about, out of curiosity
15:10mdeboarddoctorm xeqi
15:11doctormmdeboard: Stuart Sierra’s component pattern - https://github.com/stuartsierra/component
15:11mdeboardInteresting
15:11doctormI recommend watching the talk, otherwise it may be a bit hard to parse
15:11mdeboardUnfortunately I really don't understand the phrase dependency injection
15:12justin_smithhttp://www.kevinwilliampang.com/2009/11/07/dependency-injection-for-dummies/
15:12TimMcmdeboard: Choosing, at runtime, the behavior of internal components of a system.
15:14xeqidoctorm: not really sub-components... just a way to seperated lifecycle vs actual working thing
15:15xeqifor example, with a db: the lifecycle could be creating a connection, and shutting it down
15:16xeqithen if you have a database record, it could just take that connection on creation, and query using it
15:16justin_smithxeqi: doctorm: or even swap out a connection for a connection pool
15:16xeqijustin_smith, doctorm: sure, simplified example
15:17justin_smithpoint being, that is also part of the component design, the modularity
15:17l3dxis friend the most commonly used auth lib?
15:19doctormxeqi: justinsmith: Ok, to make sure I’m understanding, you create two records in that case, one for the connection and one for the database itself, and they both have lifecycles, so if you want to swap out either one, you can (instead of tying them both together where you would have to swap out both just to change the connection)
15:20xeqidoctorm: does the database record need to do something on startup/shutdown?
15:22doctormxeqi: Not necessarily, I was thinking hypothetically.
15:23doctormxeqi: I mean, it needs to wait for a connection to be available at least, does that count as doing something?
15:38iameduHello! I have a pretty dumb doubt.. regarding quoting.. why can't I do this? (do (def a 3) (println ~'a))
15:39Bronsaiamedu: what are you trying to do?
15:39iamedujust playing with clojure.. i'd like to get a 3 printed out
15:39ztellmaniamedu, ~ can only be used in the context of a syntax-quote: `
15:40ztellman`~a
15:40ztellmanis what you're looking for
15:40mdeboard(do (let [a 3]) (println `~a))
15:40mdeboard,(do (let [a 3]) (println `~a))
15:40clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:40mdeboardderp, I suck
15:40mdeboardwhat's a computer
15:40mdeboard(do (let [a 3] (println `~a)))
15:40mdeboardok you get the point, no more
15:41justin_smithdon't really need a do there :)
15:42justin_smithiamedu: def inside another form is almost always wrong, especially if you are new to the language. It is only for creating globals with.
15:42mdeboardi know, i was just trying to maintain high fidentliy
15:42mdeboardWow. Fidelity.
15:43justin_smithan ironic word to mis-spell :)
15:43mdeboardseriously
15:43mdeboard
15:47dbaschllasram: I’m trying to run the simplest hadoop job with Parkour (basically word count), and it works fine on my local machine. On a cluster I get this exception https://www.refheap.com/91067
15:47mdeboardI wonder if stuart was inspired by react with this component pattern talk, or vice versa
15:48mdeboardOr rather, if react inspired the development of the concepts presented in the talk or vice versa
15:48ChrisOeiSo I'm writing a Clojure app that uses some new Java 8 stuff. Is there a way of specifying the minimum version of Java in the project.clj somewhere?
15:49alejandro1ChrisOei: I didn't find one, so I wrote a plugin to do it https://github.com/ciniglio/min-java-version
15:49vijaykiranChrisOei: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L248
15:49technomancyChrisOei: (when-not (> (System/getProperty "java.somethingsomething.version") 7) (println "Warning; need Java 8")) after defproject in project.clj
15:49mdeboardwow
15:49mdeboardThat was a lot of answers
15:49vijaykiran:) in this technomancy's voids every other's
15:50mdeboardtechnomancy is the alpha and the omega
15:50mdeboardthe source of all truth
15:50ChrisOeiThanks folks :)
15:50technomancywelllll it's not perfect since you can run a different java version for lein vs the project
15:50mdeboardCursive (IntelliJ plugin) handles all that for you anyway
15:50borkdudeversion.startsWith is also great, it forces vendors to change their versioning at some point I heard
15:51mdeboardborkdude: lol
15:51technomancyhah!
15:51mdeboardWindows 7 ate 9 :(
15:51justin_smithChrisOei: maybe use :jvm-opts https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L261 with the -version flag
15:51justin_smith-version along prints a version, -version:value forces that version
15:52technomancyjustin_smith: oh cool; I didn't know that
15:52mdeboardlol
15:52mdeboardleiningen is officially enterprise software
15:53justin_smith-version"1.8.0+" or some such :)
15:53justin_smithmdeboard: that's a java option, not a lein option :) lein just passes along whatever is in there
15:53vijaykiranmdeboard: If my memory is good ... it was called leining - and enterprise edition was leiningEN
15:55mdeboardwell
15:55mdeboardvijaykiran: common misconception and a bit of folklore/urban legend there
15:55mdeboardThe original plan was to have heavy internationalization support for Leining, so since the first version was English only, it's LeiningEN
15:56technomancyoh man, maybe Leiningen will finally get a wikipedia Talk page
15:56technomancyone of my lifelong ambitions
15:56mdeboardGerman was next, obviously, but technomancy lost interest halfway through LeiningDE
15:56vijaykiranmdeboard: well, if you repeat often enough ...
15:56mdeboardIt's true
15:56technomancywell, actually the technical name is "leiningEN_US" or "leiningEN_GB"
15:57mdeboardYeah, important distinction
15:57mdeboardFunnily enough Canada has adopted leiningEN_GB
15:58technomancyexcept Quebec
15:58mdeboardwell, naturally
15:59sqdshould (derive ::tag ::parent) cause (async/sub pub ::parent ch) to receive messages on ::tag?
15:59hiredmanunlikely
16:00hiredmanit only would if isa? was used in the implementation of the pubsub stuff, which I really doubt
16:00sqdok, i'll find a less ambiguous way to structure my channels then :)
16:01sqdthanks
16:07hiredmanbut that actually might be an interesting enhancement to the pubsub stuff
16:07sqd(checked, there's no isa? indeed in the source code)
16:14matthiasnHey everyone, I am working on a blog post about transducers and the component library. Is anyone interested in reading the draft and providing some feedback before I publish it?
16:48ennHello ... recently (today) cider-jump-to-var stopped working. Any idea what I could look at to diagnose? (Every var says "Symbol foo not resolved".)
16:49hiredmanenn: is the code defining whatever you are trying to jump to loaded?
16:49ennyes
16:49hiredmanare you sure?
16:49ennyes, I can run it from the command line
16:49enner, repl
16:49hiredmando you mean the repl?
16:49hiredmanin you repl what does the metadata for the var say?
16:50ennHow can I view the metadata?
16:51amalloy(meta #'foo)
16:53enn{:arglists ([channel]), :ns #<Namespace guest-channels.channel>, :name event-types-for-conversions, :column 1, :doc "Return all qualifying and converting event types for a given\n channel. The union of these two types are required to calcuate\n conversions.", :line 127, :file "guest_channels/channel.clj"}
16:53hiredmanyeah, I dunno, it looks like all the metadata you'd require is there
16:53hiredmanmaybe cider just sucks
16:54ennfwiw, the minibuffer arg list display has also stopped working
16:54hiredmanare you running the same version of the cider stuff today?
16:55ennyes, to the best of my knowledge
17:06m1dnightCan I pass a clojure fn to java and apply it there? (on clojure objects, that is)
17:09arrdemm1dnight: sure. clojure.lang.IFn is the interface for interacting with functions.
17:09arrdemm1dnight: just take an IFn instance, and .invoke it with the appropriate number of Objects
17:10m1dnightaha
17:10m1dnightthat would be sweet
17:10m1dnightI was going to adapt the LinkedBlockingQueue a bit to suit my needs but now I have to do more and more in it
17:11m1dnightI'm thinking about making my "actors" work like "if the mssage string equals, this message is delivered, regardless of # of args in the message"
17:11m1dnightso ["messagename" arg arg arg] would be the same as ["messagename" arg arg arg arg arg arg]
17:12{blake}hiredman: Did you not say, yesterday, that you couldn't use different versions of a library in the same project?
17:12m1dnightbtw, is Rich Hickey on this channel? Just wondering..
17:12amalloy$seen rhickey
17:12lazybotrhickey was last seen quitting 67 weeks and 2 days ago.
17:13arrdemis there a jira ticket for the fact that the optional metadata map isn't mentioned in defn's docstring?
17:13arrdemit's obvious if you read the declared arglist or the parser, but the docstring is strictly wrong.
17:14amalloyarrdem: well it says "attrs"
17:14Bronsaarrdem: there's no documentation about docstring/metadata map for ns either but I think the arglist is the spec in this case
17:14amalloyi imagine rich thinks that's enough to compel you to look at the arglist
17:17hiredman{blake}: yes, not without doing crazy things with classloaders
17:18{blake}hiredman: OK. I deleted clj-time from my .m2 (because I'm still getting clj-time 3.7 in my REPLs). Then I did a "lein deps".
17:19mikerodDoes anyone have insight on what this destructuring is supposed to accomplish? (defn testf [& [xs]] xs)
17:19{blake}hiredman, And it pulled in four clj-time.pom files (3.7, 5.0, 6.0 and 8.0) and two clj-time.jars (6.0 and 8.0).
17:19{blake}hiredman: So I'm trying to reconcile that.
17:20mikerodI get things like: (testf 1) ;= 1 - (testf [1]) ;= [1] - (testf {:a 1}) := {:a 1}
17:20mikerod and (testf) ;= nil
17:20amalloymikerod: it's a crappy way to make xs optional
17:20amalloydon't use it
17:20mikerodamalloy: oh
17:20mikerodI just realized it allows varargs
17:20Bronsamikerod: it's a way to do (fn f ([x] (f x nil)) ([x y] ..))
17:20mikerodbut would just ignore the rest
17:21hiredman{blake}: there are a lot of reasons the library could get downloaded, but if you run `lein classpath` you should only see one clj-time on the classpath
17:21mikerodweird, I ran across it and was initially confused
17:21hiredman{blake}: lein deps :tree will show all the depdencies and transitive depdencies so you can figure out what is pull in clj-time
17:21mikerodbut I think I get it now. And yes, I don't think I'd be planning to use that structure anytime soon. :P
17:22{blake}hiredman: OK, yeah, that makes sense.
17:22hiredman{blake}: if you do seen multiple clj-time entries it is likely someone released a fork or something using a different group-id, which means to lein and maven it is a completely different library, even if it has the same clojure code in it, which can cause all kinds of problems
17:22{blake}And since my classpath only shows 8.0, my problem must be something else, even though it looks like 3.7.
17:23{blake}hiredman: Well, only one in the classpath. So I got that going for me. Which is nice.
17:23hiredman{blake}: are any of the libraries you depend on, or transitivelt depend on aot compiled?
17:23hiredmanthat can do screwy things
17:24{blake}hiredman, Possibly. I got 30 libraries.
17:24hiredmanwrite a little shell script that takes the output of lein classpath and checks every jar file to see if it contains files clj_time or clj-time related
17:25{blake}hiredman, 'k.
17:25hiredman{blake}: aot compiling reusable library code is ill advised
17:25amalloy{blake}, hiredman: lein classpath | tr ':' $'\n' |grep clj[-_time]
17:25{blake}hiredman: This is a project I've inherited, but none of these libraries are ours.
17:25amalloyoops
17:25amalloyclj[-_]time
17:26hiredmanamalloy: do you need zgrep or something?
17:26amalloyhiredman: no, why?
17:26amalloyoh, you wanted to check the jars
17:26amalloyi was just checking their names
17:26hiredmanI dunno, I've only done this dance once a long time ago
17:26hiredmanyeah, in the jars
17:27amalloyif they contain clj-time inside them but not in the name that's probably justifiable homicide
17:27{blake}Yeah, that script just turns up clj-time... :P
17:27hiredmanamalloy: sure
17:27hiredman{blake}: have you run lein clean lately?
17:27{blake}hiredman, No...I thought about that but it seemed sorta cheesy.
17:28hiredmanlikely there are stale clj-time related class files from before you fiddled your project.clj
17:29{blake}hiredman: Yeah, I see how that could be now. It's compiling.
17:33{blake}hiredman, That was it, thanks. *repeats to self: "I will not superstitiously clean...I will not superstitiously clean...."*
17:34amalloy{blake}: alias leinplus='lein do clean,'
17:35{blake}amalloy: Thanks. I think.
17:36amalloy{blake}: don't actually do that. technomancy couldn't sleep at night if you did
17:37{blake}amalloy: OK. Unless...is he sleeping too soundly? Should he be tossing and turning with the weight of his sins?
17:37{blake}amalloy: Because then I'll totes do it.
17:38technomancythe weight of the carbon footprint of my mistakes
17:38{blake}technomancy: Whoa. Great idea for a folk song: "How Much Does Your Footprint Weigh?"
17:43ed-gHello, I'm creating a web service using Clojure and it seems like both Bishop and Rook are good alternatives. When might I prefer one to the other? I have some experience with Compojure.
17:47marcuscreohowdy
18:10mercwithamouthping
18:10m1dnightOfftopic, but hillarious: https://github.com/thoughtbot/liftoff/pull/178#issuecomment-57688590
18:14mdeboardcomponent lib is pretty cool
18:14mdeboardunless i'm missing something not a thing you'd use for e.g. a web app
18:14mdeboardwrt serving requests
18:16mdeboardI think, anyway. But I am bad at this
18:16ed-gmdeboard: are you replying to my question? I intend to keep track of the state using a database. Most of the data will be read-only in any case.
18:22m1dnighthmm, appearantly (map .getClass <col>) does not work.. but (map #(.getClass %) <col>) does, why is that?
18:22m1dnightIs it because it is a static function from java?
18:23m1dnight,(map .getClass '(1 2 3))
18:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .getClass in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:23m1dnight,(map #(.getClass %) '(1 2 3))
18:23clojurebot(java.lang.Long java.lang.Long java.lang.Long)
18:23amalloymethods aren't functions. map takes a function
18:23m1dnightoh, okay :) That makes sense, thanks for the response
18:24ed-gHas anyone here created a REST api using Clojure? What tools did you like/ not like?
18:26SegFaultAXed-g: Check out luminus.
18:26SegFaultAXAs for like/don't like, I don't like friend, but it's the main solution for that sort of thing right now.
18:27mercwithamouthwhy not compojure?
18:27mercwithamouthcomopojure-rest
18:28bridgethillyeraka liberator
18:54seangrovednolen_: Is there a straight-forward way to get the render time of each component using instrumentation?
18:54seangroveSorry, that's of course referring to Om
18:54dnolen_seangrove: I think the only way is to measure the time elapsed between will-update & did-update
18:55seangrovednolen_: Thought that might be the case, since renders are batched
18:55seangroveThanks!
18:56freudsfeudclojure noob here, can anyone suggest a good ide to start learning clojure (currently running Ubuntu)
18:56mercwithamouthemacs! =P
18:56technomancydon't trust anything installed via apt
18:56freudsfeudol
18:56technomancyany clojure thing
18:56freudsfeudok
18:56technomancythat trips up a lot of people
18:56freudsfeudthe version in apt is 1.4
18:57cfleming{blake}: are you stil having problems with versions in the Cursive REPL?
18:57freudsfeudcurrent is 1.7 right?
18:57freudsfeudI took that as a warning.
18:57amalloy1.6 is latest stable
18:57freudsfeud1.6 right
18:57amalloy1.7 is alpha or something
18:57amalloybut yeah, apt is no good for clojure
18:58dbaschfreudsfeud: for learning, lighttable might be a good place to start if you’re not familiar with emacs
18:58amalloyto get stuff going on your machine, download and install leiningen; use whatever text editor you're already used to
18:58freudsfeudi am currently using vim for everything
18:58amalloyvim has fine clojure support
18:58freudsfeudok
18:58amalloyto learn more about clojure without needing to set up your machine, you can also try sites like 4clojure.com
18:58freudsfeudI really haven't looked into it enough before I posted, sorry
18:59freudsfeudI have started that
18:59mercwithamouthand SICP. i'm reading that alongside my clojure play
18:59freudsfeudand the practices, the little tests. good stuff
18:59mercwithamouthscheme and clojure are a little different but it puts you in the lisp world...especially if you're a person just tinkering and you have time.
19:00freudsfeudI learned Python when I first started programming. some similarities there that make it easier
19:10mercwithamouthwhat i found interesting....the strong similarities to javascript and lisp. you can really tell how they borrowed heavily from it
19:13{blake}cfleming: lein clean fixed my REPL version problems.
19:20ed-gSegFaultAX, mercwithamouth, bridgethrillyer: thanks!
19:23freudsfeudjust installed leiningen and vim support, thanks!
19:36BShepwhen should i learn clojure
19:36dbaschBShep: how about now?
19:37BShepwell im doing math right now... i had a look at trycloj.. im not sure about it
19:38TimMcI'm not sure what kind of answer you're hoping for.
19:38BShepya ur right
19:40technomancywell, if you don't learn it now, your other options are later and never
19:41technomancyI'm sure you could go on to lead a long and fulfilling life no matter which you choose
19:41celwellha... on another topic: I was wondering: How can I unpack a seq and drop it into a vector? I have this:
19:41celwell[:table (map #(into [] [(:label (val %)) (:value (val %))]) (:form_response r))]
19:41celwellsorry for formatting
19:41freudsfeudi think he/she is gone
19:42technomancycelwell: you're putting a vector into a vector in that example
19:42celwelltechnomancy: yes, but inner vector needs to be spliced out
19:42justin_smithcelwell: #(do [... ])
19:42technomancycelwell: I mean the `into' call there does nothing
19:43justin_smithor use fn instead of #()
19:43Raynes#(do ..) is icky
19:43amalloycelwell: are you looking for something like (into [:table] (mapcat (comp (juxt :label :value) val) (:form_response r)))?
19:43technomancyoh man I was just about to say juxt
19:43amalloyRaynes: wrong, it is the grossest thing in the world
19:43technomancytoo slow
19:43celwellthe format that I'm going for can be seen here: https://github.com/yogthos/clj-pdf#a-complete-example
19:44celwellif you look at the example it has for :table
19:44amalloyokay, so s/mapcat/map in my guess probably
19:44amalloydoes he know that "halvetica" is not a font family?
19:45justin_smithdo the vectors inside :table strictly need to be vectors, or can they be lazy-seqs?
19:45justin_smithif they need to be vectors, use mapv
19:45celwellamalloy: but I want to have it laid out all at once rather than added to the :table vector later
19:46amalloycelwell: what you are saying doesn't make any sense. you need to produce a vector of a certain shape; what does "all at once" even mean?
19:46justin_smithcelwell: that seems like a nonsequitor
19:48celwelllike [:table ["a" "b" "c"] ["1" "2" "3"] ["A" "B" "C"]] rather than starting with just [:table] and using 'into'
19:50celwellI mean, I want to be able to just declare the structure with all the vectors rather than building it up with into's and such
19:51amalloyyou can't do that. your call to map is a function call, and can only possibly return one value. there's no way to "include" that in a vector starting with :table, except to start with [:table] and then add things to it
19:52amalloybut it's also like...not a problem. whatever is making you think it's bad to put things in a vector is probably an assumption you should re-evaluate
19:52celwellamalloy: can I make some sort of macro to splice it? (sorry if I use the wrong terms)
19:53justin_smithwhy? why do you think you need to do this?
19:53amalloyno. you can write other stuff like `[:table ~@(map ...)], but it's just sugar for doing the same thing
19:57celwellOk, yeah I guess that's fine; I just maybe there's a simpler way to do it. Thanks, I ended up with:
19:57celwell(into [:table] (map (comp (juxt :label :value) val)
19:57celwell (:form_response r)))
19:57justin_smithcelwell: so it's ok to have a lazy seq instead of vector inside?
19:58amalloyjustin_smith: there aren't any lazy-seqs in that value
19:58justin_smithoh, right
19:58justin_smithsorry
19:58amalloycelwell: actually, i know that's what i wrote, but i think it's kinda prettier if you write (into [:table] (map (juxt :label :value) (vals (:form_response r))))
20:01celwellamalloy: yeah I liek that better too
20:09amalloyan amusing hobby: arrowing forms until they're totally unrecognizable. eg, instead of (while (< 10000 (count (first @(:buffers (meta foo))))) (Thread/sleep 5000)), it's clearly more readable to write (-> foo (meta) (:buffers) (deref) (first) (count) (->> (< 10000)) (while (Thread/sleep 5000))). then you show that to people who say that the purpose of -> is to "reduce nesting"
20:10bbloomamalloy: c'mon man, drop all those unecessary parens
20:10amalloybbloom: you can pry them from my cold, dead hands
20:10dbaschamalloy: are they your father’s parentheses?
20:10amalloybut, just for you, a version which is obviously more readable: (-> foo meta :buffers deref first count (->> (< 10000)) (while (Thread/sleep 5000)))
20:13bbloomamalloy: there must be a rewrite rule for ->> and <
20:13amalloybbloom: a rewrite rule?
20:13bbloom(->> ?x (< ?y) => (-> ?x (>= ?y))
20:14bbloom (-> foo meta :buffers deref first count (>= 10000) (while (Thread/sleep 5000))) ; right?
20:15amalloybbloom: oh, sure, that's a possible rewrite. but i wouldn't want it done automatically
20:15bbloomamalloy: who said anything about automatically? you wanted to reduce nesting levels :-P
20:15amalloythere are scenarios where "x is less than 10000" makes more sense to say than "10000 is at least as large as x"
20:16amalloyor whatever the equivalences are there
20:16amalloybut you actually meant >, not >=
20:16bbloomoh duh
20:16bbloomof course
20:17bbloom"are the following monotonically increasing? x 10000"
20:17dbasch>=, worldwide sponsor of null pointer exceptions
20:17amalloyi actually think the comparison operators are one of the great use-cases for ->, because then you can write "x" followed by "less than 10000", and mean "x is less than 10000"
20:18amalloyie, (-> x (< 10000))
20:18amalloyinstead of having to do mental translations to this monotonically-increasing stuff
20:18bbloomracket as an infix notation thing
20:18bbloomscala too
20:18bbloom(x . < . 10000)
20:19amalloyyeah, using . notation for that seems weird to me, but whatever gets them infix that they like
20:19bbloomyeah
20:19bbloombut i'm a big fan of variadic comparison operators
20:19amalloysure, those are obviously great
20:20dbaschgreater than non-variadic ones
20:22dbaschcomparing comparison operators is better than doing actual work
21:01cfleming{blake}: Oh, ok - cool.
22:01ennHello, I'm getting the following backtrace in my Cider REPL after upgrading to the latest snapshot in Melpa: http://hastebin.com/juyuburewa.avrasm
22:01ennI'm not sure exactly what causes it, it seems to just pop up eventually if I spend long enough in a Clojure buffer while jacked in
22:08justin_smithenn: does the latest melpa cider need a new version of the cider nrepl middleware?
22:10ennjustin_smith: maybe. in my profiles.clj I have [[cider/cider-nrepl "0.8.0-SNAPSHOT"]], which is correct, but I'm not sure how to tell it how to grab a newer 0.8.0-SNAPSHOT.
22:12justin_smiththere is a configuration to force getting a newer version of a snapshot, otherwise lein checks once ever 24 hours iirc
22:13ennI'll try that
22:14ennhuh. Well, lein -U deps did grab a newer version of cider-nrepl. But I still get the same backtrace (after restarting emacs and cider).
22:19ennah, I guess I'm seeing this: https://github.com/clojure-emacs/cider/issues/844
23:11bbloomhyPiRion: did you come across any literature in/around linear types with anything approximating clojure's transients?
23:12bbloomi don't see any obvious citations connecting the ideas to your bibliography :-)
23:26ubolonton$seen tbaldridge
23:26lazybottbaldridge was last seen quitting 1 day and 5 hours ago.
23:36mdeboardHow would I go about porting over an annotation to clojure?
23:39justin_smithmdeboard: example from rich hickey https://gist.github.com/richhickey/377213
23:40mdeboardyeah I saw that
23:40mdeboardlanguage has changed alot, didn't know if htings had changed since
23:40justin_smithdid you try it?
23:41mdeboardno I'm out of gas, been trying to write a minecraft plugin in clojure for awhile, I'm collapsing
23:41justin_smithI've heard minecraft is a pain to extend
23:42mdeboardwell there are these specialized servers that I think abstract most of that stuff away?
23:42mdeboardI bought this book for learning to program java by writing minecraft plugins, for my daughter and I to go through together
23:42mdeboardit's actually pretty straightforward
23:42mdeboardbelieve it or not
23:43justin_smithinteresting, I had no idea
23:43mdeboardI *think* the thing that makes it notoriously hard is the fact the java source is obfuscated
23:44mdeboardso you have to de-obfuscate, code against that, then obfuscate... or some such
23:44mdeboardso then CanaryMod & Bukkit are two servers that I *think* abstract that problem away
23:44TEttingerthanks, Microsoft! now I don't need to blame Notch's bad code when I can blame a huge mega-corporation!
23:44mdeboardit's so much more fashionable
23:45justin_smithTEttinger: have you followed the news about the reason for Windows 10 not being Windows 9?
23:45TEttingerno
23:45mdeboardIT'S BECAUSE WINDOWS 7 ATE 9
23:45TEttingergroooooaaaan
23:45mercwithamouthlol
23:45justin_smithturns out a bunch of software, including java, was checking if the version string started with "Windows 9" to check for versions 95 or 98
23:46mdeboarddude I was so proud of myself for making that joke this morning https://twitter.com/matt_deboard/status/517746095196504066
23:46mdeboardthen coworker pointed out it was the subtitle on the /. submission
23:46justin_smithso naming a version windows 9 broke a whole bunch of shit - so they renamed it 10 to fix other peoples crap
23:46arrdemmdeboard: that used to be the case, then they added a "developer" license that removes the obfuscate/deobfuscate transform if you sign... also there are a bunch of simplifying frameworks that have come out.
23:47mdeboardarrdem: Is that what CanaryMod is?
23:47arrdemjustin_smith: that would seem to be the rumor at least...
23:47arrdemmdeboard: not sure, I don't think so.
23:47mdeboardNo it's because Windows 7 ate 9 :|
23:47justin_smitharrdem: the source I saw showed a bunch of open source code (includking java) checking for that substring
23:48handojinhi all
23:48arrdemjustin_smith: yeah it's been floating around reddit and other sources for a few days now unclear whether it's a joke or authoritative AFAIK, but sadly I can believe it.
23:48handojinany clue why my nrepl won't start?
23:48handojinbut says
23:48justin_smitharrdem: this was link to actual codebases, so that's pretty believable to me
23:48mdeboardhandojin: Are you using a computer
23:48handojinerror in process sentinel: Could not start nREPL server: Error loading cider.nrepl.middleware.trace: java.lang.RuntimeException: No such var: trace/traced?, compiling:(cider/nrepl/middleware/trace.clj:12:11)
23:49handojini'm afraid so
23:49mdeboardI think that may have something to do with it
23:49arrdemmdeboard: lol
23:50arrdemhandojin: it would seem that you'
23:50arrdemre trying to load an old version of tools.trace
23:50justin_smithhandojin: does your cider nrepl plugin version match your cider version?
23:50arrdemhandojin: or that would be my guess
23:50handojinhmmm
23:50justin_smithhandojin: and also, cider has been breaking a lot lately if you are using the alpha on melpa
23:50mdeboardsmh @ melpa
23:51handojinnot that adventurous
23:51arrdemit's really not that bad TBH
23:51arrdemI do daily updates and track each update in git..
23:51arrdemjust roll back if shit don't work
23:51justin_smithhandojin: what versions are you using?
23:51handojinCIDER 0.7.0alpha (package: 20140619.914)
23:52handojinsays M-x cider version
23:52justin_smithwhat cider nrepl middleware plugin version?
23:52arrdemhandojin: that's not the latest.
23:52justin_smithalso I think there is a 0.7.0 (non alpha)
23:52arrdemjustin_smith is correct, 0.7.0 is released. 0.8.0-alpha is where it's at atm.
23:53handojinit's what came with prelude
23:53justin_smithif you want to be bleeding edge use 0.8.0-alpha, for stable use 0.7.0 - there is no reason to use 0.7.0-alpha, worst of both worlds
23:53handojinhow would i check middleware version?
23:53arrdemhandojin: trace is I believe a baked in middleware
23:54justin_smithhandojin: it should be in your ~/.lein/profiles.clj or in your project.clj
23:54handojinoh, ok
23:54justin_smithcider has two halves, the part that runs in emacs, and the part that runs in clojure, and if the versions go out of sync weird things can happen
23:55mercwithamouthfor cider 0.7 do we have to pull from github? it's not pulling from elpa
23:55arrdemmercwithamouth: yeah doing a manual local install is probably the only way to be sure
23:55mercwithamouthgotcha
23:57handojin.lein/profiles.clj sayeth cider/cider-nrepl "0.7.0-SNAPSHOT"
23:58handojinapparently i need to restart emacs (M-x prelude-update-packages)
23:58arrdemyeah ditch that snapshot and do a local install of CIDER 0.7.0 for emacs from git
23:58arrdemjust to be sure
23:58handojinweird thing is that everything worked fine until i hit an error
23:58arrdemwell... that's kinda tautological isn't it?
23:58justin_smithhandojin: I know what you mean, but lol :)
23:59handojinwell this happen yesterday too - then i just restarted emacs and all was well