#clojure logs

2014-11-23

00:00rritochI'm looking for a way to develop and modify classes at runtime, would this be possible if I were to create macros to generate deftypes with a given name to provide specific default functionality, and then use defprotocol + extend-type to add class specific functionality?
00:01rritochBasically I'm trying to get around the fact that deftype doesn't seem to provide a way to extend a class.
00:02rritochI know reify does, but these need to be named classes so I can have multiple instances floating around
00:13technomancyhttps://twitter.com/apontious/status/536355219622211584
00:14sdegutisCompojure's destructuring syntax conveniently allows for params to be either keywords or strings, literally expanding to (get-in [req :params] :foo (get-in [req :params] "foo"))
00:15sdegutisI was not aware of this.
00:20kenrestivorritoch: when i found myself in such straits, i ended up using gen-class
00:21kenrestivothen i went AAAAH!! why am i trying to write java in clojure! and ended up dropping the project.
00:25rritochkenrestivo: Yeah, I'm trying to get away from gen-class because I want something that can be modified at runtime
00:25rritochRight now I'm just toying with all of the possiblities
00:25rritochI think I may have finally come up with a viable solution though
00:25kenrestivorritoch: http://github.com/llasram/shady
00:26kenrestivotho i think that is compile-time not runtime
00:26rritochThe core of my problem is simply that clojure doesn't provide namespace inheritance
00:27rritochBut I just had the idea that maybe I can get around that issue by providing the "parent" functions which take the namespace as the first argument
00:27rritochSo instead of -parentMethod ... I'd just call a regular function (foo (find-ns 'some-ns) ....)
00:27kenrestivoi don't know what problem you are trying to solve, but there might be a way to rethink it to be more functional and idiomatically clojure-y.
00:28rritochkenrestivo: I'm trying to take a gen-class based MVC library and change it so it can be modified at runtime
00:29rritochex. https://github.com/rritoch/clj-grid-mvc/blob/master/src/com/vnetpublishing/clj/grid/lib/mvc/base/module.clj
00:29rritochThere's a lot of complexity in there that I'd like to keep out of sight
00:30rritochBut I'm thinking now that I can probaly get around this mess, intead of using inheritance, just make functions that take a namespace as the first argument, to apply whatever functionality is needed to the provided namespace.
00:31kenrestivoa kind of a shot in the dark, but this might help: https://github.com/ztellman/scrawl/tree/master/src/scrawl
00:31kenrestivoas an example of how to take something very OOP'ish and java-ish and make it more functional and idiomatic, in three steps.
00:55brainproxyin the sample.project.clj for the cljx library, org.clojure/clojurescript is listed under :dev :plugins
00:56brainproxyis that right?
01:10yguanGet a question on vector: get a value vector like [a1 a2 ... a3] and index [ 3 9 .. 876], how can I get a new vector filled with value correponding to those indexes? like keep-index?
01:13rritoch,(mapv (partial get ["A" "B" "C"]) [2 0 1])
01:13clojurebot["C" "A" "B"]
01:13rritochyguan: Like that?
01:15yguanrritoch: nice! never notice there is mapv... thanks
01:30amalloyrritoch: (partial get [x y z]) is just the same as [x y z]: vectors are functions
01:31rritoch,(mapv ["A" "B" "C"] [2 0 1])
01:31clojurebot["C" "A" "B"]
01:31rritochamalloy: Cool, didn't know that
02:47kenrestivonice, neat alternative to having a kill-chan: use pub/sub
03:24afdelHello I am new to clojure and I am use emacs with cider. Does anybody know if it is possible to jump to the error source line/function from compilation/runtime error buffers?
03:25jack_rabbitafdel, I do that sometimes. I'm actually not sure what plugin it is that allows this, though. :/
03:26afdelAh alright, I couldn't find a keybinding for it on the cider page, but it would be very helpful, especially since I am making a lot of errors right now :)
03:26amalloyafdel: in swank/slime it was v, from the stacktrace buffer. dunno about cider
03:27jack_rabbitafdel, IIRC, I could just scroll over the error in the buffer and hit 'return' to go to the offending file/line.
03:27amalloyand if the compilation buffer is a standard one, M-n or M-p should work?
03:29amalloythose are the keybindings that work in swank, anyway
03:31afdelI am looking for jump to error line. M-n just jumps to the next error in the *cider-error* buffer. It looks like I need a stack trace with the error line included to jump to that line by pressing enter. So if I get a runtime exception, then I can move the point to the stack trace line with my function and press enter to get there. So that solves the runtime part, but the error line does not...
03:31afdel...show up in a stack trace during compilation.
03:31jack_rabbitcider is a little different, as I recall, but should have something comparable.
03:32afdelI do get a red line under the error line in my source buffer though... hmm.
03:35afdelThanks for your help.
03:58honzawhen you start a `lein repl`, how much memory does it consume on average (just having it on)?
04:00svteoiclojure or haskell ?
04:06rurumate_honza: you can set the maximum heap in the project.clj like this: :jvm-opts ["-Xmx1g"]
04:07rurumatenow you can start halving that unit you can't start the repl anymore
04:08rurumate*until
04:09honzarurumate: cool, i'll try that
04:12rurumatehonza: try connecting to the running repl and running this, to see if it really has all the memory you're trying to give it:
04:12rurumate,(int (/ (.maxMemory (Runtime/getRuntime)) 1024 1024))
04:12clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
04:12rurumatesorry clojurebot
06:06mi6x3mhey Clojure, what is the way to run a leiningen task every time lein run is executed?
06:06mi6x3mI found :release-tasks for lein release
06:09mi6x3mprep-tasks?
06:17sqdhi! in Om, i can use (get-node owner “myref”) on a (dom/input #js {:ref “myref”}). now i’ve replaced the dom/input with a custom component, that i build with (build my-comp app). is there still a nice way to get the value set in the custom component?
06:19sqdor should i work with callbacks here?
06:19mi6x3mtechnomancy: any way in leiningen to get the dependency key's contents to pass to a plugin task?
06:24justin_smithmi6x3m: a plugin can see (and even modify) the project map
06:29aravindhhi is there way to load libraries directly in clojure repl from github and work with it?
06:31sqd(worked around my issue by using global state instead of component state)
06:31sqdaravindh: lein-try
06:31justin_smitharavindh: inside a repl that is already running can be done with pallet/alembic
06:32justin_smithbut lein-try is good if you want a fresh repl
06:32aravindhlein-try seems to be the one i was looking for. awesome. thank u
06:33justin_smitharavindh: neither one actually loads anything from github
06:33justin_smithbtw
06:33aravindhit loads from clojars rights?
06:33justin_smithor maven / sonatype yeah
06:33aravindhcool. that should be enough
06:34justin_smithif something is only found on github, there is also lein install (followed by using lein-try or pallet/alembic)
06:47daGrevishey! can i somehow unpack inline? something like this (let [x [1 2]] [[a b] x])
06:49justin_smithdaGrevis: ##(let [x [1 2] [a b] x] {:x x :a a :b b}) ; like this?
06:49lazybot⇒ {:x [1 2], :a 1, :b 2}
06:51daGrevisjustin_smith, just without let because i dont have it there. i have something like this (conj pairs [(second people-left) (first people-left)]) and I want to get rid of second and first calls
06:51justin_smithdaGrevis: destructuring exists as a feature of let, fn, and loop
06:51daGrevisgot it
06:51justin_smithyou can write your own macro calling destructure if you like though
06:52justin_smith(destructure being the function that implements destructuring within those macros)
06:53justin_smith,(conj [] ((juxt second first) [:a :b :c])) ; daGrevis
06:53clojurebot[[:b :a]]
06:53daGreviscool!
06:53justin_smithjuxt is pretty nifty
06:55justin_smith(inc juxt)
06:55lazybot⇒ 17
07:05rurumateWhat are unquote and unquote-splicing doing in core.clj?
07:05rurumate,(bound? (var unquote))
07:05clojurebotfalse
07:06justin_smith,(resolve 'clojure.core/unquote)
07:06clojurebot#'clojure.core/unquote
07:06justin_smith,(meta (resolve 'clojure.core/unquote))
07:06clojurebot{:ns #<Namespace clojure.core>, :name unquote, :file "clojure/core.clj", :column 1, :line 13}
07:08justin_smithrurumate: do you mean, as in "why are they in that namespace?"
07:09rurumateyup, is there any known reason
07:09justin_smithrurumate: clojure, especially the core impl, doesn't really give a shit about information hiding
07:11rurumateI see it's used in LispReader.java
07:14rurumate,`(unquote unquote)
07:14clojurebot(clojure.core/unquote clojure.core/unquote)
07:14rurumateso unquote is just a verbose way to write a tilde inside a syntax quote
07:15rurumateis there also a verbose way to write the backtick that starts the syntax quote?
07:15justin_smith,`(a (unquote +))
07:15clojurebot(sandbox/a (clojure.core/unquote clojure.core/+))
07:15justin_smithnot quite...
07:15justin_smiththat didn't actually unquote
07:15justin_smith`(a ~+)
07:16justin_smith,`(a ~+)
07:16clojurebot(sandbox/a #<core$_PLUS_ clojure.core$_PLUS_@1b1603b>)
07:16justin_smiththat's different
07:16rurumateright.. so what is it doing then
07:16justin_smithit's the function used to implement the reader-macro, I believe
07:16mi6x3mrurumate: when you write 'unquote' inside a syntax quote, it's just another symbol
07:17mi6x3mwhere as ~ is a reader macro and clojure will process it
07:17justin_smithand in processing it, it then uses unquote
07:17rurumateyep, I was just wondering what the reader will do when it encounters unquote..
07:18justin_smithnothing special, because unquote is not a reader macro
07:18mi6x3mif it encounters the symbol 'unquote it will do absolutely nothing
07:18mi6x3mbecause that's a symbol
07:18mi6x3mthe semantic for symbols inside a syntax quote is to get a namespace prepended, but otherwise to remain unchanged
07:19rurumateapparently it has some meaning for the reader: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L44
07:19mi6x3mbut if it encounters ~ it will unqoute the expression using the "unquote"
07:21justin_smithrurumate: that is used in implementing what the reader macro does, but has nothing to do with what triggers it
07:21mi6x3mrurumate: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L898
07:21justin_smithor what mi6x3m said
07:21mi6x3mand as you can see https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L89
07:22mi6x3monly ~ triggers the UnquoteReader
07:22rurumateoh right, it's not registered in the macros[] array
07:24rurumatebut now it's even more mysterious, unquote shows up in core.clj AND LispReader.java
07:25rurumatesyntax-quote was there too, but got commented out
07:33mi6x3mI need some help
07:33mi6x3mI need to be able to access the contents of the :dependencies leiningen project key
07:33mi6x3min the leiningen project file
07:33mi6x3min order to pass them to a template
07:33mi6x3mis it doable?
07:33justin_smithmi6x3m: lein will pass the project data to your plugin
07:34mi6x3mjustin_smith: I use an existing plugin which sadly takes only strings
07:35justin_smithI don't think I understand what you are doing
07:35justin_smiththere is an existing plugin...
07:36mi6x3mjustin_smith: well, I use the filegen plugin
07:36mi6x3mwhich generates files
07:36mi6x3mhttps://github.com/ThoughtWorksInc/lein-filegen
07:37mi6x3mwhat I want to do is to pass the dependencies vector to the plugin
07:37justin_smithand you want to access the rest of the project data, inside the :filegen key?
07:38mi6x3mwell, yes
07:38mi6x3mit's what it amounts to
07:38justin_smithmi6x3m: maybe there is a way to do it with ~() - but I don't know what the variable is you would want to refer to
07:38mi6x3mjustin_smith: the vector associated with :dependencies
07:39justin_smithmi6x3m: I know that. I mean inside ~() what is the name of the var to use
07:39justin_smithbecause it may or may not be bound, and I am not even sure of the name it would be bound to
07:40mi6x3mah, ok I see, when will ~() get expanded?
07:40mi6x3min the plugin?
07:40justin_smithwhen lein loads project.clj actually
07:40justin_smithso that may not be useful...
07:40mi6x3manother idea is to submit a short patch to the plugin's authors
07:42justin_smithwacky idea: specify deps in a separate file. use ~(read thatfile) to insert it into project.clj, and ~(slurp thatfile) again inside the :filegen key to also have it available in that context
07:42justin_smiththat's weird for anyone trying to read your project.clj though
07:42justin_smiths/slurp/read above, I think
07:42justin_smithactually, probably ~(read-string (slurp "your-deps.edn")) in both places
07:43mi6x3mehm yeah, that goes beyond sane :)
07:43justin_smithit does what you want though, but yeah, it's super weird
07:44justin_smithit's a classic circular data dependency problem
07:44justin_smith(unless the plugin is changed such that it can help you access the surrounding context, of course)
07:44mi6x3mjustin_smith: well actually my end goal is to generate Leiningen projects dynamically from GUI samples I manage in my app
07:44mi6x3mso I need to generate a project.clj file for them
07:44mi6x3mand I want to use 1 such project.clj using the example viewer's dependencies
07:45mi6x3mso for each sample the user can press "Export Lein project", the app collects the dependencies vars, gets their sources, exports a source file and then I include this project.clj
07:46mi6x3mof course it's bloated with dependencies but it's dynamically generated!
07:46justin_smithif I were doing that, I would be tempted to do a dumb template, looping over the dependency coordinates as provided
07:47mi6x3mfor what purpose?
07:48justin_smithto simplify the generation of the project file
07:48mi6x3mjustin_smith: well the idea is that the project.clj will be pre-generated when lein run is run
07:49justin_smithsee, that's the weird part to me, bundling the generation and running in one step seems to be adding unneeded complexity
07:49justin_smithbrb, just updated OS, rebooting for sanity
08:14robhollandwhat is returned when I do this in a repl: 'foo
08:14robholland?
08:14robhollandIt prints: foo
08:14robhollandBut I don't really know what that is
08:15robhollandor how to find out
08:15TEttinger'foo is quoted
08:15TEttinger,(class 'foo)
08:15clojurebotclojure.lang.Symbol
08:15robhollandah
08:15robholland(class ) is exactly what I was after :)
08:15robhollandthanks
08:15TEttingerso it's a quoted symbol, and won't get evaluated when it's entered because of the quote
08:16TEttingerthere's also type, not sure the difference
08:16TEttinger,(type 'foo)
08:16clojurebotclojure.lang.Symbol
08:16TEttinger(doc type)
08:16clojurebot"([x]); Returns the :type metadata of x, or its Class if none"
08:16TEttinger(doc class)
08:16clojurebot"([x]); Returns the Class of x"
08:19justin_smithwell, that was "fun"
08:19justin_smithhaha
08:23robhollanddunno about fun, useful ;)
08:24TEttingerrobholland: that was referencing [04:49;48] <justin_smith> brb, just updated OS, rebooting for sanity
08:25robhollandah
08:25robholland:)
08:40robholland(defn hello
08:40robholland ([a & more] (str "Hello to this group: "
08:40robholland (apply str
08:40robholland (interpose ", " (concat (list a) more)))
08:40robholland "!")))
08:40robhollandHere the apply is required to compensate for the fact that interpose returns a lazy seq?
08:41robholland(apply f only-one-arg) seems a bit odd
08:43justin_smithrobholland: ##(apply + (range 1000))
08:43lazybot⇒ 499500
08:43justin_smith(range 1000) is only one arg
08:44justin_smithbetter version: (defn hello [a & more] (str "Hello to: " (clojure.string/join ", " (cons a more)) "!"))
08:45justin_smiththough without more context, splitting a off at all is silly
08:45robhollandthe original is polymorphic
08:45justin_smithwat
08:45robhollandI edited to ask a more concise question
08:45justin_smithOK
08:46robholland(defn hello
08:46robholland ([] "Hello World!")
08:46robholland ([a] (str "Hello, you silly " a "."))
08:46robholland ([a & more] (str "Hello to this group: "
08:46robholland (apply str
08:46robholland (interpose ", " (concat (list a) more)))
08:46robholland "!")))
08:46justin_smithplease use a paste bin if it doesn't fit on one line
08:46robhollandI think the & more is required to differentiate?
08:46robhollandok, sorry
08:46justin_smiththe last one can still just be [& all]
08:46justin_smithit wil lwork
08:46robhollandok
08:47justin_smithanyway, cons is simpler than concat, and should be used in a case like that (except in this case you don't even need cons)
08:47justin_smithand string/join is preferable to making a string out of interpose
08:48robhollandIt might be demonstrating some use for later exersizes I suppose
08:48justin_smithright
08:48robhollandbut useful to know, thanks
08:48justin_smithnp
08:48robhollanddid feel a bit weird
08:49justin_smithfor that matter, they could be demonstrating [a & more] for pedagogical reasons, despite the fact it makes no sense there
08:49justin_smith,((fn ([a] a) ([& more] (reverse more))) (range 10))
08:49clojurebot#<CompilerException java.lang.RuntimeException: Can't have fixed arity function with more params than variadic function, compiling:(NO_SOURCE_PATH:0:0)>
08:49justin_smitherr
08:49robhollandI would have thought it would be better to use a case where having a and more split was useful though
08:49justin_smith,((fn ([a] a) ([a & more] (reverse more))) (range 10))
08:49clojurebot(0 1 2 3 4 ...)
08:49justin_smithOK, I was wrong
08:50justin_smith,(apply (fn ([a] a) ([a & more] (reverse more))) (range 10))
08:50clojurebot(9 8 7 6 5 ...)
08:50justin_smithsorry about that
08:50robhollandstill not understanding apply
08:50justin_smithrobholland: apply treats every element of a collection as if it were an individual item
08:50justin_smith*individual argument
08:51robhollandok, so like *args in ruby
08:51justin_smith,(apply (fn [a b c d e & more] c) (range))
08:51clojurebot2
08:51justin_smithrobholland: I think so
08:51robhollandIt 'unpacks' the collection into arguments
08:52justin_smithyou may have thought apply was for applying a function to arguments, but we don't need any such function, as functions are fully first class
08:52robhollandyeah, it felt that way, was trying to relate it to map
09:26kzarIs cemerick/austin still the best way to set up a browser repl with emacs?
09:28kzarAlso does anyone find that with austin if they evaluate expressions inline with `cider-eval-last-sexp` it always returns nil? (At the nRepl expressions return the expected result)
09:31jaaqoYes kzar, Mine at least does. I thinks there's an issue raised related to this.
09:32kzarjaaqo: Do you also find that when you first start the repl you sometimes have to refresh the page quit ea
09:32kzarquite a few times in the browser before the repl connects and stuff is sent through to it?
09:33jaaqoOh, can't say, haven't really noticed such behavior
09:35kzarhmm OK
09:35kzarjaaqo: Know of any way around the nil return value thing?
09:52jonhmooo
10:02jaaqokzar, https://github.com/clojure-emacs/cider/issues/830 might give answers
10:04jaaqoAFAIK they waiting for @cemerik for a piggieback fix
10:29kzarjaaqo: OK, thanks
10:33gfredericksllasram: ping
10:51robhollandI've confused as to why this works:
10:51robhollandhttp://pastebin.com/UB4AQv98
10:51robhollandIt feels like it should give me back the collection in the same order, but it does indeed reverse it
10:51robhollandWhat's the best way to figure that kind of thing out? Adding prn statements?
10:52robhollandSorry, wrong paste
10:52robhollandhttp://pastebin.com/uyvc6gFh
10:53justin_smithrobholland: cons turns [] into ()
10:54justin_smithand it inserts to the front of the collection
10:55justin_smithso it's effectively a stack operation: you keep taking things off the input stack, and putting them on the output stack
10:55TEttingeris conj what we're after here?
10:55robhollandThe version I wrote blind, so to speak, is my first paste
10:55justin_smithI think he just wanted to know why it worked
10:55robhollandThe second one looks to me to do the opposite of my one
10:55robhollandbut they both work
10:55justin_smithand just like in real life, if you restack that way, the items end up in opposite order
10:56justin_smithyou can try it with a stack of real objects, it's pretty simple when you see it happen - you take off the top of one, put on the top of the other...
10:56justin_smithwhen you are done with all the items, the order is reversed
10:57robhollandI think I don't understand the order in which things happen
10:57justin_smith? it's the order they are in the code
10:58robhollandlet me try it with real things :)
11:04kzarcemerick: Just the person :)
11:10mavbozoi watched rich hickey's conj talk on transducers. there's an interesting part for me, where he said that people use channel as a mean for asynchronous function to return result to its caller.
11:10mavbozoi don't understand what it means. So, I looked up for examples. Is this one kind of that examples?
11:11mavbozohttps://github.com/halgari/clojure-conj-2013-core.async-examples/blob/c728e6a8bab8ca9c9cc58c8f4077bd3b0388626e/src/clojure_conj_talk/core.clj#L293-L300
11:13mavbozoi also find another potential example. https://gist.github.com/martintrojer/5943467#file-nonblocking-kit-clj
11:14kzarmavbozo: So the http-get function returns a channel that gets the response pushed onto it when it arrives
11:27rurumatemavbozo: have you tried the walkthrough? also there's a good intro by tim baldridge
11:27rurumatesee https://www.youtube.com/watch?v=enwIIGzhahw and https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj
11:37mavbozorurumate: yes. but, is the link i gave a good example of using channel to do async rpc call?
11:40mavbozoi still think channel is used like conveyor belt where you just put something in it or just wait something from it. not where you put your request on a conveyor belt and wait the response on another conveyor belt.
11:45justin_smithmavbozo: consider the fact that a go block returns a channel
11:45justin_smiththat channel is used to get the result
12:15mi6x3mjustin_smith: is it then possible to use the project itself as a plugin by including a :eval-in-leiningen in the project.clj?
12:16leandrohi, having an object like {:ip "192.37.144.188"} how do i println the ip value?
12:17justin_smithleandro: ##(println (:ip {:ip "192.37.144.188"}))
12:17lazybot⇒ 192.37.144.188 nil
12:18justin_smithother options include ##(println ({:ip "192.37.144.188"} :ip))
12:18lazybot⇒ 192.37.144.188 nil
12:19leandrohmm
12:19leandroi go to try it
12:19justin_smith o
12:19justin_smitherr...
12:21leandrojustin_smith++ :)
12:21mi6x3mleandro: use (inc XYZ)
12:21justin_smithalso ##(println (get {:ip "192.37.144.188"} :ip))
12:21lazybot⇒ 192.37.144.188 nil
12:21justin_smithwe have many ways to say "get"
12:21leandro(inc justin_smith)
12:21lazybot⇒ 145
12:22leandroi was doing (println :ip {:ip "192.37.144.188"})
12:23justin_smithahh - just missing some parens then
12:23leandroyes, seems that () is mandatory always before println
12:23leandro*after
12:23justin_smithleandro: no #(println "hello" "world")
12:23justin_smitherr
12:24justin_smith##(println "hello" "world")
12:24lazybot⇒ hello world nil
12:24leandroyes, i guess 'cause clojure doesn't need to evaluate "hello"
12:24justin_smithit's just that () is mandatory for evaluation of functions, so to use :ip as a function, you need to wrap it and its arg
12:24justin_smithit doesn't need to evaluate :ip either - it's just that you wanted it to :)
12:24leandrounderstood :) i'm very new to this
12:25justin_smith&(println :ip {:ip "localhost"}) is valid, just maybe not expected
12:25lazybot⇒ :ip {:ip localhost} nil
12:25leandroyeah, that was what i got
12:26justin_smithluckily, the rules for clojure evaluation are extremely simple
12:26justin_smithmaybe weird, but simple
12:26justin_smithso there are a few surprises in the beginning, but then things are very straightforward
12:26justin_smithuntil you hit things like #_ at least...
12:28TEttinger#_ is simple enough, it's like ; but for a form not a line
12:28justin_smith,(#_#_ + * println #_#_ "hmm" "OK" "sure")
12:28clojurebotsure\n
12:29justin_smithit's the stacking that is weird
12:29TEttingeroh yeah that
12:29justin_smithit's counterintuitive, and nothing else in clojure behaves that way
12:29TEttingerbut if you use #_ just normally to comment out one form without returning nil like (comment), it's fine
12:30justin_smithright
12:30mi6x3mjustin_smith: remember my dependency issue from earlirer today? what were you suggesting about looping over the dependencies?
12:31justin_smithmi6x3m: I was suggesting that if project.clj top level and your plugin local map should see the dep graph, then you could load it from another source in both places via ~ in both places in project.clj
12:32mi6x3mhm
12:32annelieshindley-milner?
12:33mi6x3mjustin_smith: what about using https://github.com/davidsantiago/configleaf
12:33mi6x3mit seems it allows you to see the leiningen settings at runtime
12:41justin_smithmi6x3m: oh, I thought you were doing all this in a plugin, so during lein runtime
12:41mi6x3mjustin_smith: no, I actually only needed the dependencies in my project, _somehow_ :D
12:41mi6x3mso I was checking out all the plugins
12:42justin_smithmi6x3m: which is why I also suggested generating the project.clj via a simple template
12:42justin_smithwhich is not nearly as fancy, but may be a bit more reliable
12:43mi6x3mjustin_smith: but I still didnt get how you get the dependencies?
12:45justin_smithmi6x3m: I thought you were generating them...
12:45mi6x3mjustin_smith: I extract the dependencies among the _vars_ dynamically in the code
12:46mi6x3mthis is to generate the source code
12:46mi6x3mI am trying to generate the project.clj with the dependency projects :)
12:46mi6x3mlet me show you how I generate the source code now
12:47justin_smithright, so why can't you use a template to generate the project.clj - perhaps even starting with your existing project.clj loaded via slurp / read-string
12:47justin_smithright, so why can't you use a template to generate the project.clj - perhaps even starting with your existing project.clj loaded via slurp / read-string
12:48justin_smitherr, sorry
12:49mi6x3mjustin_smith: this is how I output the source http://pastebin.com/YNeDcFZ9 I use example-deps to collect the dependency vars across all namespaces
12:50justin_smithright, so can't you construct project.clj via a similar method?
12:50justin_smithgiven a basic skeleton of the project file
12:51mi6x3mwell the plan now is to use configleaf which writes the project map to a namespace so it's available during runtime
12:51mi6x3mthen I will generate the project.clj using a similar method :)
12:52justin_smithaha!
13:03kenrestivois there an alts! equivalent which works outside of a go?
13:03kenrestivoi'm trying to wait for an event, with a timeout, outside of a go block.
13:09mi6x3mjustin_smith: configleaf worked nicely :)
13:09mjzkenrestivo: the go block returns a channel, can't you block on that?
13:09kenrestivothat'd work, thanks.
13:11mjzThere's also alts!!
13:26drorbemetHi, how do I find the right host when starting a repl session using "lein midje :autotest" and then in emacs cider-connect?
13:30kenrestivoalts!! is what i wanted, actually. i was using crossclj and am still feeling my way around its doc browser
13:37justin_smithdrorbemet: does lein midje :autotest open an nrepl server?
13:38justin_smithalso, the right host should be "localhost"
13:38justin_smiththe port is the trickier part
13:39drorbemetjustin_smith: I think so , but I am to inexperienced to check for myself
13:46pellis_hello
13:46pellis_im trying to get into data wrangling and data sciece recently, from what it seems python dominates that. however since I would like access to the JVM i'm now considering clojure
13:46pellis_how mature is the data science libraries of clojure?
13:47pellis_in comparison to python (scikit, pandas, numpy)
13:47drorbemetjustin_smith: yes right it's the port that does not autocomplete using cider-connect on a lein midje autotest instance started in a gnome-terminal
13:49luxbockpellis_: check out: https://github.com/clojure-numerics
13:49pellis_thanks
13:49kenrestivoum, ok, async/filter< etc is deprecated, supposed to use transformers, but no transformers available yet?
13:49luxbockI can't really comment on how mature all of this is compared to the Python data stack though
13:49drorbemetI am still not sure if I should always run two instances of my project. One with midje autotest and the second as a repl in emacs using cider-jack-in?
13:50luxbockbut core.matrix is cool in that you can swap your matrix implementation with practically one line of code
13:50justin_smithdrorbemet: "lein repl" records its port when started, such that M-x cider automatically finds the port as a default if you run it while looking at anything in the project dir
13:51luxbockthere's also Incanter, which I think is waiting to finish its upgrade to 2.0.0 that would integrate core.matrix with its existing functionality
13:51drorbemetShould I try to always run autotesting and interactive development in only one repl instance or should I use multiple at the same time.
13:51drorbemetjustin_smith: yes, but why not the lein midje repl?
13:51justin_smithif "lein midge :autotest" opens a repl server, it would be nice if it did the same
13:52justin_smithif not, that's a feature request for lein midje I guess
13:53drorbemetjustin_smith: right, this way I can't use it if I have to save some memory by using only one instance. What is the current workflow using leiningen, midje and emacs cider?
13:54justin_smithdrorbemet: I have no idea, frankly. maybe someone in #clojure-emacs knows. I don't use midje.
13:55leandrois possible do with clojure windowed applications? like gtk3 or qt?
13:56rpauloit's funny how "disassembled code" means something completely different when one is talking about clojure...
13:57rpaulohow is this generated: https://gist.github.com/gerritjvv/257f8713622b7ddac9ef ?
13:57drorbemetjustin_smith: #clojure-emacs, ah, thanks
13:57drorbemetjustin_smith: have a nice day, or evening.
13:59rpauloah: https://github.com/gtrak/no.disassemble
14:01pellis_is incanter as good as R?
14:01kenrestivodefine good
14:03sooheonkimincanter doesn't have ggplot2, that's for sure
14:06pellis_kenrestivo: any company uses it in production to do data science that makes money. that's my definition of good i guess.
14:07kenrestivopeople make money off of php in production, does that mean it's good? :-P
14:07kenrestivoseriously, i've used incanter and it seems very powerful. how it compares to R, i dunno, maybe someone's done a post on that somewhere.
14:11winkkenrestivo: now compare number of $ earned per month with php vs haskell and boom, we have a winner
14:11kenrestivoyep. in 25 years, i've found the relation between good and $-making is inverse
14:12winkhm, that's a bit simplistic
14:12kenrestivothere are outlyers :-)
14:13winktake number of clojure programmers and number of php programmers. then distribute over working force.
14:13kenrestivoplot it in incanter and we can see
14:13winkyour chance for a working product is probably magnitudes higher in php
14:14kenrestivoi'm feeling silly, sorry. really loving core.async at the moment though.
14:14TEttinger2php, that true == false language?
14:16kenrestivoincanter does make some cool charts tho. e.g. http://spazradio.bamfic.com/buffer/buffer.pdf
14:16winkthat's what === is for. :P
14:17sooheonkimkenrestivo: is that your work?
14:17kenrestivoyes
14:18sooheonkimNice. so that's with incanter itself, not a package?
14:18kenrestivowhere "work" means 27 lines of clojure, using incanter.
14:19kenrestivosauce: https://www.refheap.com/93830
14:20sooheonfirst time i
14:20sooheonsorry. First time i've seen the reference heap
14:20kenrestivothanks. incanter is easy, i can't take credit for how good it looks
14:23TEttingersooheon, there's some cool features with refheap regarding lazybot
14:24TEttinger&(repeatedly 1000 #(rand-int 1000))
14:24lazybot⇒ (29 25 966 51 351 723 156 809 442 821 995 374 116 10 705 103 888 20 904 105 991 190 58 289 842 751 841 988 184 5 882 246 921 938 872 523 180 195 824 909 441 746 335 697 692 42 82 539 412 915 413 249 879 985 810 729 697 902 225 428 693 296 763 199 312 918 946 414 430 ... https://www.refheap.com/93832
14:24TEttingerit links to the full output if it's too long
14:24sooheonniiice
14:27sooheoneven like the syntax highlighting colors
14:27sooheonshould take a look at the github
14:47justin_smithwow, if this is for real it is kind of amazing http://cs.stanford.edu/people/karpathy/deepimagesent/ -- automatically generates captions for images
14:53leandrohow can i check if the last character of a sentence is an exclamation mark? (clojure.string/split "hi!" #"!") :/
14:55luxbock##(= (last "hi!") \!)
14:55lazybot⇒ true
14:55luxbockleandro: ^
14:56leandro:O
14:56rhg331be in awe to clojure's seq abstraction
15:09TEttingeralternatively, ##(re-find #"!$" "hi!")
15:09lazybot⇒ "!"
15:09TEttingeralternatively, ##(re-find #"!$" "hi! how are you?")
15:09lazybot⇒ nil
15:11TEttingerif you want to find if a string ends in ?! or !?, ##(re-find #"(!?)|(?!)$" "what?!?!")
15:11lazybot⇒ ["" ""]
15:11TEttingeroh right
15:12TEttingerif you want to find if a string ends in ?! or !?, ##(re-find #"(!\?)|(\?!)$" "what?!?!")
15:12lazybot⇒ ["!?" "!?" nil]
15:12danielcompton(let [str "Wokka wokka!"] (= \! (.charAt str (count str))))
15:12danielcompton,(let [str "Wokka wokka!"] (= \! (.charAt str (count str))))
15:12clojurebot#<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 12>
15:12rurumate,(.endsWith "abc?!" "?!")
15:12clojurebottrue
15:12danielcompton,(let [str "Wokka wokka!"] (= \! (.charAt str (dec (count str)))))
15:12clojurebottrue
15:12TEttingerthat too, heh
15:12danielcomptonuse charAt for the masochistic
15:13black_13masochist?
15:13rurumateno thanks
15:13TEttingerfor getting the last char, last is easier than charAt, is the point, black_13
15:14black_13ah
15:14black_13i am new like a few days new to clojure
15:14TEttingerah ok
15:14TEttingerit's a fun language
15:14black_13how lisp is it
15:14black_13do you have cdr car
15:14rurumateabout 50% is lisp, the rest is java
15:15black_13jisp
15:15black_13or lava
15:15black_13i have been trying to install the counterclockwise plugin for eclipse
15:16TEttingerblack_13: car and cdr are called first and rest
15:16TEttingerthere's a differences from other lisps page on the main site
15:17black_13would clojure be able to do interop with a c library
15:17black_13just curious
15:17TEttingerhttp://clojure.org/lisps
15:17rurumateblack_13: in general, you can do all things jvm
15:17black_13i would like to call the the VISA (National Instruments)
15:17TEttingerit can, but would require JNI or JNA most likely.
15:17black_13java rmi
15:18TEttingerthings that really need C and don't already have a java binding aren't easy
15:18TEttingerif they do have a java binding, it's very easy
15:19black_13i think there is one
15:20black_13would this the be appropiate place to ask about using the eclipse plugin
15:20black_13i am getting the error http://codepad.org/UbwzKhbk
15:21black_13every time i try to install counterclockswise
15:25TEttingerlooks like your internet connection, or CCW's server, is failing when it tries to download CCW
15:26black_13this make sense i have a crappy connection at sbucks
15:26black_13is there a way to download all the plugin binaries and then install them
15:29danielcomptonblack_13: you could try installing the standalone version?
15:32black_13sbucks network connect is terrible
15:32black_13i am visiting relatives who do have internet
15:32black_13sorry DONT have internet i mean
15:36black_13it was the network connection
15:37black_13hello clojure script?
15:41TEttingerblack_13, what about clojurescript?
15:45black_13TEttinger: i got eclipse to work!
15:45TEttingeryay
15:45TEttingernow I sleep
15:45black_13some people left sbucks and the bandwidth went up
15:45black_13is there an example of a hello world i can use to test eclipse with
15:53black_13can you set break points ? using the eclipse/clojure
15:54csd_How can I convert a str from LazySeq to non-lazy? pr-str isn't working for my purposes, and doall doesn't work with strings period AFAIK.
15:54gfrederickscsd_: strings aren't lazy
15:54SagiCZ1black_13: im sorry about that eclipse thing
15:54csd_gfredericks: I'm trying to map format
15:55gfrederickscsd_: I'm not sure what that means
15:55csd_e.g. (map #(format "%s" %) coll)
15:55black_13i was able to make a hello world that does run but no break points
15:55SagiCZ1csd_: what is in coll?
15:55gfrederickscsd_: okay; and (doall (map #(format "%s" %) coll)) doesn't do what you want?
15:56SagiCZ1black_13: if i were you, i would throw eclipse out of the window, seriously (also ran over it with train, just to be sure)
15:57black_13be a manly man and do everything thing from the command line or something else?
15:57SagiCZ1black_13: try intellij with cursive
15:57csd_gfredericks: https://www.refheap.com/93840
15:57black_13ok
15:57black_13i will try anything once
15:57SagiCZ1black_13: https://cursiveclojure.com/
15:58gfrederickscsd_: and what does it do wrong?
15:58danielcomptonleandro: .endsWith take 5 ns vs 420 ns using last
15:58danielcompton,(criterium.core/quick-bench (= \! (last "Wokka wokka!")))
15:58clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: criterium.core>
15:58csd_gfredericks: it writes to disk, but says LazySeq instead of the string
15:58danielcompton(require '[criterium.core])
15:58danielcompton,(require '[criterium.core])
15:58clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate criterium/core__init.class or criterium/core.clj on classpath.>
15:59gfredericks,(clojure.string/join (doall (map identity ["hey" "now"])))
15:59clojurebot"heynow"
15:59SagiCZ1gfredericks: thats why it matters whats in the coll
16:00black_13SagiCZ1: i didn't see a download link
16:00csd_,(clojure.string/join (doall (map #(format "%s" %) '(foo bar))))
16:00clojurebot"foobar"
16:00csd_hrm
16:00gfredericks,(println-str (doall (map identity ["hey" "now"])))
16:00clojurebot"(hey now)\n"
16:00SagiCZ1black_13: https://cursiveclojure.com/userguide/index.html
16:00gfredericks,(println-str (doall (map identity '("hey" "now"))))
16:00clojurebot"(hey now)\n"
16:00gfredericks,(clojure.string/join (doall (map identity '("hey" "now"))))
16:00clojurebot"heynow"
16:00gfredericksokay I give up
16:01csd_its probably compliated by the for statement, because that plays poorly with side effects too
16:01gfredericksyeah I think you just want to try minimizing your example
16:02gfredericksyou'll probably end up figuring the whole thing out in the process
16:02black_13SagiCZ1: downloading
16:02csd_ok
16:09teslanickI have two go-loops pulling from different channels that I want to stop at the same time.
16:09teslanickIs there a simple way to do that?
16:10gfrederickshave them both watch a control channel that closes to signal they should quit?
16:10teslanickThat's sorta what I was thinking. Is a mult the way to do that?
16:10gfredericksI think a single channel and alts works fine
16:10gfredericksyou don't actually need any messages
16:11teslanickOh. Duh.
16:11teslanickI totally forgot that everybody gets nil when a channel closes
16:15leandrohow to check if a string is uppercase?
16:18teslanickA regex?
16:19SagiCZ1,(let [string "HELLO"] (= (.toUpperCase string) string))
16:19clojurebottrue
16:19danielcomptondoes doall block until the lazy sequence is realised?
16:20SagiCZ1danielcompton: yes
16:20justin_smith,(map #(= (.toUpperCase %) %) ["hello" "World" "OK" "nope" "GOOD"])
16:20clojurebot(false false true false true)
16:20justin_smithahh, SagiCZ1 beat me to the punch
16:20SagiCZ1justin_smith: im glad i came up with similar solution
16:20justin_smithheh
16:29_alejandroAny pedestal users around? I'm trying to stream back a lazy sequence in a response, but it always waits until the entire sequence is realized
16:34black_13how do i run clojure from the command line
16:34gfredericksblack_13: with leiningen
16:34black_13is there an equivalent of ipython?
16:34SagiCZ1black_13: cursive didnt work?
16:34black_13still downloading
16:35black_13starbucks' bandwidth is really terrible
16:35SagiCZ1i see
16:35black_13about 5 minutes more
16:35SagiCZ1they also have terrible coffee
16:36black_13i am a tea drinker
16:36gfredericksblack_13: what do you have? just the clojure jar?
16:36black_13i did insteall leiningen
16:36black_13install
16:36gfredericks`lein repl` to get a repl, `lein new hello-world` to generate a project
16:36gfredericks`lein help` to see other things it does
16:37black_13i installed the windows install
16:37SagiCZ1black_13: dont forget to add lein to path if you are on windows
16:40csd_,(mapcat #(format "%s" %) '(foo bar))))
16:40clojurebot(\f \o \o \b \a ...)
16:41gfredericks,(clojure.string/join (map #(format "%s" %) '(foo bar)))
16:41clojurebot"foobar"
16:43justin_smith,(apply str (map #(format "%s" %) '(foo bar)))
16:43clojurebot"foobar"
16:43gfredericks,'''''''''''''''(foo bar)
16:43clojurebot(quote (quote (quote (quote (quote (quote (quote (quote (quote (quote #))))))))))
16:43csd_My problem was being casued by mapcat apparently
16:43gfredericksinteresting
16:44csd_not particularly sure why
16:44gfredericks,(print-str (mapcat identity ["foo" "bar"]))
16:44clojurebot"(f o o b a ...)"
16:45csd_shrug
16:45Bronsacsd_: mapcat is calling concat on "foo" "bar"
16:45Bronsa,(concat "foo" "bar")
16:45clojurebot(\f \o \o \b \a ...)
16:45Bronsa,(mapcat #(list (format "%s" %)) '(foo bar))
16:45clojurebot("foo" "bar")
16:45gfredericks,(apply concat (repeat "ha"))
16:45clojurebot(\h \a \h \a \h ...)
16:46Bronsacsd_: concat always returns a seq so you get a seq of chars
16:46csd_,(mapcat (fn [x] (format "%s, %s" (first x) (second x))) '(foo bar))
16:46clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
16:47Bronsanot sure why you'd expect that to work
16:47csd_what's wrong with it
16:47Bronsayou're invoking first on 'foo
16:48csd_,(mapcat (fn [x] (format "%s, %s" (first x) (second x))) '((foo bar)))
16:48clojurebot(\f \o \o \, \space ...)
16:48Bronsacsd_: mapcat is like map, would you expect (map first '(foo bar)) to work?
16:48Bronsacsd_: you can't produce a string out of mapcat.
16:49Bronsamap/filter/mapcat & friends return a seq.
16:50csd_I'm just trying to get it to return a lazyseq, I don't much care at the moment whether it's a str or a sequence of characters
16:50Bronsacsd_: if you want to get a string back either wrap the seq of chars with (apply str ..) or use reduce
16:50csd_I was trying to reproduce this bug that was confusing me for the past hour
16:51gfredericks,(str (range))
16:51csd_Bronsa: Would you do (map (format ..)) or something else?
16:51clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
16:51gfredericks&(print-str (range))
16:51lazybotExecution Timed Out!
16:51Bronsa,(str (range 10))
16:51clojurebot"clojure.lang.LazySeq@9ebadac6"
16:51drojasHi guys, how do you run tests defined as metadata?
16:51Bronsacsd_: you want to get '(0 1 2 3 4 ..) out of that?
16:51gfredericksBronsa: I remember this issue confusing me before
16:52gfredericksBronsa: oh that's right -- it realizes the lazy seq and then gives you the worthless print
16:52Bronsa,(pr-str (range 10))
16:52clojurebot"(0 1 2 3 4 ...)"
16:52Bronsagfredericks: yeah :|
16:52gfredericksI assume there's a patch somewhere
16:52Bronsagfredericks: there should be a ticket in jira proposing to either change the toString or avoiding the full realization
16:52Bronsathere's no reason for the current behaviour
16:53gfredericks,(str (Object.))
16:53clojurebot"java.lang.Object@63acc"
16:53gfredericksyeah
16:53gfredericks,(str (Object.))
16:53clojurebot"java.lang.Object@eb2686"
16:53gfrederickshm
16:53gfredericks,(let [o (Object.)] [(str o) (.hashCode o)])
16:53clojurebot["java.lang.Object@db3de8" 14368232]
16:54Bronsagfredericks: it'd be reasonable if the current toString was that way to avoid realizing the seq but given that it realizes it it has no advantages
16:54danielcomptonIs there a way to catch an exception, and rethrow it with exception info?
16:54Bronsadanielcompton: (cath Exception e (throw (ex-info (.getMessage e) {} e)))
16:55gfredericks~cath is clojure's least known special form
16:55clojurebotYou don't have to tell me twice.
16:55csd_Bronsa: https://www.refheap.com/93843
16:55danielcomptonBronsa: nice! I was looking at the docs but it wasn't clear what cause needed to be
16:55csd_The bug was being caused in `polygon` by using mapcat instead of what's there now
16:56rurumate,(partition 2)
16:56clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/partition>
16:56danielcomptonrurumate: clojurebot isn't running 1.7
16:56black_13SagiCZ1: finally downloaded
16:56Bronsadanielcompton: it is
16:56Bronsathere's no partition transducer though
16:56rurumate,(map inc)
16:56clojurebot#<core$map$fn__4507 clojure.core$map$fn__4507@7cd052>
16:57Glenjamin,*clojure-version*
16:57clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
16:57rurumatewhy is there no partition transducer?
16:57Glenjaminmaster is pretty vague, is there a way to get a build date / git-ref out of it?
16:57danielcomptonoh, my bad. I thought a 1 arg call to partition would return a partition transducer
16:58Bronsagfredericks: uhm, I can't find a ticket for lazyseq's toString
16:58black_13SagiCZ1: so what do I install after doing intellij?
16:58gfredericksBronsa: I remember discussing this before; maybe it was merely on clojure-dev
16:59drojasHi guys, how do you run tests defined as metadata?
17:00gfredericks,(doc test)
17:00clojurebot"([v]); test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception"
17:00gfredericksI don't know if anybody really uses that, but there it is.
17:01gfredericksclojurebot: #((:test (meta %))) is a super minimal testing framework
17:01clojurebotYou don't have to tell me twice.
17:01danielcomptonrurumate: I think it's because of the arities that a transducer would require conflict with partition's existing arities. There's partition-all
17:01danielcompton though
17:01danielcompton,(partition-all 2)
17:01clojurebot#<core$partition_all$fn__6741 clojure.core$partition_all$fn__6741@13ae860>
17:02Bronsathis is another reason why I think putting the transducers & the seq fns in the same var was a bad idea.
17:03Bronsaif the seq fn has more than one arity, the transducer version won't be able to implement them all
17:03Bronsae.g. the partition-all transducer can't take the `pad` argument
17:04Bronsaerr, the `step` argument
17:04rurumate,(transduce (partition-all 2) conj [] [1 2 3])
17:04clojurebot[[1 2] [3]]
17:05rurumatedoes tools.analyzer.jvm support reader macros?
17:05Bronsatools.analyzer has nothing to do with the reader
17:05rurumateoh right
17:05rurumateI was confused about that
17:08Bronsarurumate: tools.reader otoh ..
17:09rurumatethat's a thing?
17:09Bronsahttps://github.com/clojure/tools.reader
17:09black_13SagiCZ1: still here?
17:12rurumateBronsa: I'm trying to find out what the :op is. For example, why is :do the :op of (try)?
17:13rurumatefor what purpose?
17:15Bronsarurumate: well I'll explain you why in a second but first, you shouldn't assume specific :ops, all t.a.jvm can guarantee you is that for whatever form you input you'll get an AST that represents a form equal to the one you input in
17:16Bronsarurumate: so the analyzer will transform (try foo bar baz) in (try (do foo bar baz)), this is where the do comes from
17:17Bronsarurumate: the analyzer will also omit the try if the try form has neither a catch nor a finally statement so (try (do ..)) -> (do ..)
17:19rurumateamazing, I added a catch and now the :op is :try
17:19alpheusCan I do destructuring binding forms without literals? Or do I have to use macros for that.
17:20rurumateBronsa: what is the :op field good for if I can not assume specific ops? something is not clear to me
17:21alpheushttp://clojure.org/special_forms#binding-forms makes it pretty clear that they must be data structure literals, but did I miss something?
17:21rurumateBronsa: is there a specification of what the analyzer should do?
17:21andyfrurumate: If you are trying to look through ASTs and correspond them directly with particular source forms, there are the :form and :raw-forms keys that might be of interest
17:22andyfPerhaps we can help more if you described what you are trying to do with the ASTs?
17:22rurumatenothing in particular, just trying to familiarize with the AST format of c.t.a
17:23SagiCZ1black_13: im back
17:23rurumateI was wondering if some specification exists
17:23andyfthere are some docs for it here: https://github.com/clojure/tools.analyzer/tree/master/spec
17:24black_13i have intellij installed now downloading the cursive plugin
17:24black_13SagiCZ1: do you have to uninstall lein
17:24rurumateandyf: yes! thanks
17:24SagiCZ1black_13: great.. look around in intellij, it works similary to eclipse, its just faster and doesnt make you want to kill yourself.
17:24SagiCZ1i dont think u have to uninstall it
17:25black_13cool
17:25andyfA similar dir exists for things unique to tools.analyzer.jvm that would not be present, for example, in a ClojureScript version: https://github.com/clojure/tools.analyzer.jvm/blob/master/spec/ast-ref.edn
17:26Bronsarurumate: there is generally a 1:1 corrispondence between the macroexpanded input and the output AST, but in some cases the analyzer might insert other nodes/do some syntactic transformation to the code that breaks the 1:1 corrispondence
17:27Bronsarurumate: so for example there's no difference between (try 1) and (do 1) and the analyzer in this case choses to treat the former try expression as the simpler do expression
17:27Bronsarurumate: this is something that the clojure compiler does too by the way
17:31Bronsarurumate: here's a better view of the spec that andyf linked http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html
17:31rurumatedoes tools.analyzer implement macroexpansion? or is it delegating to macroexpand
17:31Bronsarurumate: t.a.jvm implements its own macroexpander
17:32andyfwhich can be overridden by the caller if you desire.
17:32Bronsarurumate: it's quite complex but here it is https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L86-L176
17:34black_13lein is nice
17:36gfredericks(inc lein)
17:36lazybot⇒ 3
17:36arrdem(identity leiningen)
17:36lazybotleiningen has karma 7.
17:37gfredericks(- leiningen)
17:37arrdemlazybot should realy feature an aliases table..
17:37gfredericks(/ leiningen)
17:43danielcomptonarrdem: alias scala -> scalable language
17:43metellus(identity lein)
17:43lazybotlein has karma 3.
17:43arrdemdanielcompton: hehe I really enjoyed that talk
17:43danielcomptonarrdem: good perspective on why fire and brimstone isn't always the best way to evolve a language
17:44arrdemdanielcompton: for sure... given appropriate goals of a lang.
17:44arrdemI mean.. fire and brimstone isn't a _bad_ thing if your goal as a lang is to experiment
17:44arrdembut I think that his point that Java as a lang is about stability and the consequent decisions was a valuable one
17:46danielcomptonarrdem: yeah. I wasn't so keen on his characterisation of some of his users as unskilled though. It might be true, but I prefer to believe that people can learn new concepts
17:48micryptarrdem: Sorry to interrupt, but what talk was that?
17:48arrdemdanielcompton: sure... but I think we represent a very different crowd than an "average" dev shop even
17:48arrdemdanielcompton: I mean... there was a guy in here a while back asking how to use Clojure as a scripting language the same way you would use php or perl
17:48danielcomptonarrdem: yeah, I know. That's why I struggle with that idea myself, and I'm not sure what to think
17:48arrdemdanielcompton: and the guy rejected all notion of better architecture because it was "too complex" for the guys adminned for
17:50danielcomptonarrdem: he rejected it for the people below him in his company?
17:50arrdemyep
17:51arrdemhe wanted a way to (load) another file, fast, for side-effects same way you do load in other langs
17:53danielcomptonmicrypt: https://www.youtube.com/watch?v=2y5Pv4yN0b0&amp;spfreload=10
17:55micryptdanielcompton: Thanks.
17:58danielcomptonarrdem: you TA right?
17:59arrdemdanielcompton: ya
17:59arrdemhence last night's ranting... grading time :P
17:59danielcomptondo you think there are students that are just unteachable of higher level concepts?
18:00arrdemugh
18:00danielcomptonugh question or ugh answer?
18:01arrdemugh question. give me five years, a few million for some real studies and I'll get back to you
18:01danielcomptonarrdem: np
18:01technomancythere's no such thing as unteachable, only unwilling
18:01arrdem^ that
18:01technomancywell, barring mental disorders
18:02arrdemyeah... that's where things get really fun
18:02technomancywhere you draw the line on that is really difficult and extremely touchy
18:03technomancybut if you could get rid of all the students who aren't actually interested in learning, you might at least have a shot at getting it right
18:03arrdemthat fits nicely with my experience
18:03arrdemthere are kids who want a degree and to get on with their lives
18:03arrdemand there are kids who legitimately want to learn something
18:07arrdemtechnomancy: got a minute?
18:08technomancyarrdem: sure, for a bit
18:08arrdemtechnomancy: sweet. I'd like you to take a look at the new lein alias based lein-grim. lemme push this so you can see it..
18:08technomancyoh cool; we talked about this a while ago?
18:08arrdemyeah
18:09arrdemI'm close to having it working, but I think I need some of your magic to finish it.
18:11technomancyall I have left is Magic Missle
18:11technomancyHTH
18:11arrdemtechnomancy: https://github.com/clojure-grimoire/lein-grim/tree/develop
18:11arrdemso the alias I'm trying to use is right there in the readme...
18:12arrdemhttps://github.com/clojure-grimoire/lein-grim/blob/develop/src/grimoire/doc.clj#L175-L176
18:12arrdemThat is the function I'm trying to drive with that alias
18:12technomancyso
18:12arrdemunfortunately the alias doesn't seem to be stringing the classpath as I need.
18:13technomancyone solution would be to just use the production profile and scan the classpath for every ns that's not in a jar
18:13technomancybut the production profile doesn't have grimoire
18:13arrdemright
18:14technomancyoh yeah, the group/artifact/version is actually available at runtime with pom.properties now
18:14technomancyprovided you don't need pre-2.5.0 support
18:14arrdemdo I look like I care about legacy users? I'm 22. ain't got time for that shit.
18:14technomancygood point
18:14technomancyso yeah, do that
18:14technomancybut the source-paths is trickier
18:14danielcomptonarrdem: fire and brimstone
18:15arrdemdanielcompton: the Grimoire codebase is hell on earth rn
18:15technomancywhat happens when you try to pass :project/source-paths as an arg?
18:15arrdemtechnomancy: string encoding error, I forget the exact stack trace
18:15technomancyarrdem: before it reaches in-project grimoire?
18:15arrdemtechnomancy: yep
18:15arrdemiirc
18:16technomancydrat
18:16technomancythe solution might be that we need to pr-str all :project/whatever substitutions
18:24gizmo385How can I import a java file that is in the same directory as my Clojure file?
18:27arrdemtechnomancy: yeah using :project/source-paths errors out for me
18:27arrdemlein 2.4.3
18:29akoshi
18:29Guest24650hi
18:29oyvinrobgizmo385: (import package.name.ClassName) ?
18:30Guest24650I just started learning clojure and I came up to ask, if you have a good suggestion for an IRC channel for guys learning the language
18:31gizmo385oyvinrob, tried that
18:31gizmo385ClassNotFoundException
18:31oyvinrobgizmo385: the class has to be compiled and added to the classpath
18:31oyvinrobgizmo385: are you using leiningen?
18:32gizmo385No because I'm trying to build a clojure extension to a pre-existing Java project
18:32gizmo385And reorganizing the entire project structure to fit with leiningen doesn't really seem that practical
18:33danielcomptonGuest24650: I think there's #learnclojure
18:33rhg331,(java.io.File. "/")
18:33clojurebot#<File />
18:33oyvinrobgizmo385: hmm, well then you have to make sure that the class you need is being compiled by your existing build system, and added to the classpath that is used when running the clojure ext
18:33rhg331ok
18:33rhg331it just bans writes
18:33technomancyarrdem: it might need a change in leiningen
18:33technomancyif :project/foo currently only works with numbers and strings that's lame
18:33rhg331was woried my own sandbox was being weird
18:34gizmo385oyvinrob, Is there anyway to add a directory to a classpath with leiningen?
18:34arrdemtechnomancy: (u_u)
18:34gizmo385So that I could create src/main/clojure and point it towards the directory with the compiled java classes?
18:34rhg331not at runtime
18:35gizmo385Because I tried just changing :java-source-paths and :source-paths and it caused similar issues
18:35Raynesjustin_smith: Interestingly, since the integration of new irclj, lazybot has been utterly stable.
18:35RaynesI wonder if my socketing was just dumb in the original version...
18:35rhg331:resource-paths i think
18:35rhg331for plain add to classpath
18:52arrdemtechnomancy: it looks like :source-paths is being str'd as a list, of strings and then eval-string'd somewhere to generate a "str cannot be cast to fn" exception.
18:59danielcomptonDoes anyone have a cleaner solution to patching a library than this? https://github.com/jonase/kibit/blob/upgrade-deps/src/kibit/check.clj#L1-L26
19:01arrdemas monkey patches go.. could be worse
19:01danielcomptonarrdem: seems preferable than making a clojars fork for a one line change
19:01arrdemagreed
19:02arrdemmaybe pull that patch code out into it's own file and (load) that file when you need to?
19:02arrdem(ns kibit.check ...) (load "monkey-patch.clj")
19:02arrdemjust so you keep the ns being the first thing
19:02arrdemthere isn't an ordering requiremnt I can see between the monkey patch and the ns form
19:03danielcomptonarrdem: I'd need to do this everywhere that uses core.logic.unifier right?
19:03danielcomptonarrdem: although I think I need to do my current solution everywhere too
19:03danielcompton'solution'
19:03arrdemtechnomancy: no... with neither solution do you need to do that everywhere
19:04arrdemoops. danielcompton not technomancy
19:04arrdemjust add that monkey patch somewhere at the root of your application. defs are global, and require will never reload unless told to do so
19:04arrdemso that root monkey patch will cover all of kibit
19:04arrdemno need to repeat yourself
19:05danielcomptonwhat if someone never requires kibit.check if they're using it as a library?
19:05arrdemyeck
19:06danielcomptonput it in the project.clj hahaha
19:06arrdemif that's the alternative I'd say bug dnolen to get that patch merged with the threat of beer or something
19:06arrdemew pls no
19:07danielcomptonwould monkey-patch.clj go outside of the src directory?
19:21arrdemdanielcompton: a realization: by changing that def, you're lying about the transitively depended version of core.logic by altering it. If you need that patch, the nicest thing you can do is have the patched fn somewhere you can require it in. altering it in place is a packaging fault.
19:27andyfdanielcompton: I don?t know if it is cleaner, but it can be effective to copy a library into your own, and change its namespace names. Then it ?becomes your own code?, and you have no external dependency. You can undo that with a later release if the dependency fixes the problem you need fixed.
19:28andyfRequires compatible licenses, the willingness on your part to do such a thing, and for there to be no need to 'communicate data' between your copy&renamed version and the original (or that they be compatible in that regard)
19:34danielcomptonarrdem: do you mean require it in in my own ns? The problem is that prep* is a private function that isn't used directly
19:36arrdemdanielcompton: oh ugh. yeah I'd seriously hold off until you can scare up a patched core.logic release.
19:36arrdemwhich I know is a bad answer... but anything else is worse :/
19:40danielcomptonarrdem: hmmm. Making a fork seems like the cleanest option. It makes the dependency clear, doesn't require copying the project and changing my directory structure e.t.c., and is easily changed later if the patch comes in
19:40arrdemdanielcompton: sure if you want to drop a new release right meow that's your best option imo
19:41danielcomptonarrdem: I'm heading away to Europe in two weeks and it'd be nice to drop an early christmas present before I go away
19:41arrdemdanielcompton: I suspect you can get some act from dnolen in two weeks :P he's pretty good about this stuff.
19:42danielcomptonk, I'll give it a week, there's other things to work on in kibit while I wait
19:52andyfThis is temporarily the "people who hack on jonase's projects" channel :)
19:52arrdemI mean...
19:52arrdem#clojure is just one big hack :P
19:53arrdemokay lein-grim 0.3.0 ready methinks...
19:53amalloydanielcompton: is there some reason that it matters?
19:54andyfguilt of inefficient use of hardware?
19:54danielcomptonamalloy: it just feels a bit horrifying when you unpack a jar and see all of the classes wizz by
19:54danielcomptonamalloy: although that's more about how many dependencies a simple project can have
19:55amalloyandyf: sure, but class count specifically? there are plenty of other sins to be thinking about in a jvm program
19:55andyfoh, I have never worried about number of class files. I am simply projecting why he might be concerned :)
19:55Glenjaminthink about all those projects that aim to minimise dependencies. and wonder how much they wrote themselves which already existed
19:56arrdemhow the hell is this function...
19:57dcunit3dhey guys I've got some questions about generating java classes using clojure. i know that it's possible, but I'm wondering if it's feasible to generate the classes used for Aparapi, java's OpenCL API.
19:57arrdemandyf: :P sorry
19:57dcunit3dhere's a gist with a sample Aparapi class: https://gist.github.com/dcunited001/eba5027134089619e703
19:58dcunit3dthere's a few keywords that are specific in there. a few method names that have to match up exactly, etc.
19:59dcunit3di watched a talk about using Clojure to generate some of the classes used for Hadoop jobs
19:59andyfand here I am guilty of misspelling a commonly said phrase, when that annoys me when I notice someone else doing it. I should have said "bated breath", as in "abated" or "lessened".
20:00amalloyandyf: unless you are in the habit of eating worms or something. then your breath might be baited
20:00dcunit3dby the way, i'm signed in with irssi, is anyone getting my messages? for whatever reason, when i use irssi it seems like i'm on mute or something
20:00dcunit3di just recently started using irssi again, with SASL
20:00danielcomptondcunit3d: reading load and clear
20:00amalloydcunit3d: yes, it's fine
20:01dcunit3ddanielcompton amalloy: cool thanks, i was just wondering. i was logging in under the name dc_ about a week ago
20:01andyfI don't know if you follow xkcd, or its "what if?" series, but that reminds me of the 2nd of the "alternative universe what ifs" here: http://what-if.xkcd.com/120/
20:02dcunit3di might just repurpose some of the examples i saw with hadoop a few weeks ago. just not sure if the classes will match up in a way that works with Aparapi
20:02dcunit3dbut if they did, a DSL for generating those AoT classes would be pretty powerful
20:03amalloyandyf: also http://xkcd.com/1268/
20:03andyfdcunit3d: what are the requirements for the class you want to generate? e.g. it needs to extend class com.amd.aparapi.Kernel?
20:04dcunit3dandyf: it's mostly the @override keyword i'm worried about
20:05dcunit3dandyf: you have to @override the public void run() method
20:05dcunit3dand i think Aparapi takes the bytecode for that method and converts it into a parallelized method that's run on the GPU
20:05andyfIsn't @override in Java just a way to ask the compiler to give you a compilation error if the signature does not match one in the superclass?
20:06dcunit3di'm not sure how aparapi works
20:06amalloyandyf: yes
20:06dcunit3dandyf: it's actually been a long time since I've written any java, so i don't know
20:07andyfIt sounds like the @override isn't necessary to make this work. Just a way to help catch typos in method signatures.
20:07dcunit3dandyf: awesome, so i think this is possible
20:12andyfdcunit3d: I have only read the intro pages of the aparapi project, but it says: "it will attempt to convert the bytecode of the overridden run() method (and all run-reachable methods) to OpenCL? and execute the code on the GPU. If it can?t then the Java? code is executed using a thread pool"
20:12andyfI haven't yet found a description of what conditions the byte code must meet in order to be convertible by aparapi
20:13andyfIt is possible you will be able to call aparapi and get correct results, but perhaps only because it used the fallback mechanism of not using the GPU.
20:19danielcomptonandyf: this looks like what you're after https://code.google.com/p/aparapi/wiki/JavaKernelGuidelines
20:21andyfdcunit3d: You'll probably want to (set! *unchecked-math* true) on any Clojure code you try this with, do not use any Clojure data structures in the kernels, and hope your GPU supports doubles, because Clojure primitive math defaults to doubles, and I think may not be capable of generating primitive math operations on floats.
20:28amalloyandyf: indeed clojure will not do primitive math on floats
20:29danielcomptonis there a function to pull out a keyword from a map, no matter where it is? I was thinking of getting a seq of nested keys but I'm not sure what it would be called
20:30danielcomptonah, zippers might be the key
20:50irctcHi. Can someone help me figure out how to join vectors the way I want? I'm trying to do the following:
20:51irctcfunction f takes an arg and returns data like [[1 2 3][4 5 6]]
20:51irctcI'm trying to (mapv #(f %) arg-list)
20:51danielcomptonirctc: what do you want the output to look like?
20:52irctcI'd like [[1 2 3][4 5 6][7 8 9][10 11 12]]
20:52danielcomptonicedp: what's the input?
20:52irctcI'm getting [[[1 2 3][...]] etc
20:52danielcomptonirctc: is that a nested vector of nested vectors?
20:52irctcI'm trying to end up with one 2d vector
20:52irctcyes
20:53irctceach output of function f is a few vectors in a vector
20:53danielcompton,(apply concat [[[1 2 3] [4 5 6]]])
20:53clojurebot([1 2 3] [4 5 6])
20:53irctcultimately I want all of the inner vectors to just be in one big series
20:53irctchmm
20:54dbaschirctc: what does your function do?
20:54irctc,(apply concat [[[1 2 3][4 5 6]][[7 8 9][10 11 12]]]
20:54clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
20:54irctc,(apply concat [[[1 2 3][4 5 6]][[7 8 9][10 11 12]]])
20:54clojurebot([1 2 3] [4 5 6] [7 8 9] [10 11 12])
20:54irctcit's complicated what the function does, but it outputs a vector of several vectors
20:54irctcI think this apply concat is what I need
20:55RaynesI herd u liek vectors
20:55_alejandroirctc: mapcat should do it
20:55irctcok, I'll look that up
20:55irctcthanks for all the suggestions. back in a min
20:55_alejandro,(mapcat #(repeat 2 %) [[1 2 3] [4 5 6]])
20:55clojurebot([1 2 3] [1 2 3] [4 5 6] [4 5 6])
20:55_alejandrovs
20:55_alejandro,(mapv #(repeat 2 %) [[1 2 3] [4 5 6]])
20:55clojurebot[([1 2 3] [1 2 3]) ([4 5 6] [4 5 6])]
20:56irctcahh
20:56dmahantawhat does double square bracket mean defn foo [[a b]]
20:56_alejandrodmahanta: it means destructure the argument
20:56_alejandrodmahanta: so the function takes 1 arg that is a vector with at least 2 items
20:56_alejandrodmahanta: the first item is called a, the second b
20:57_alejandro((fn [[a b]] (prn "A: " a)) [1 2])
20:57_alejandro,((fn [[a b]] (prn "A: " a)) [1 2])
20:57clojurebot"A: " 1\n
20:57dmahantagot it thanks
20:58irctcmapcat is great
20:58irctcnow I just have one more wrinkle
20:59irctcI'd like to "prepend" an array to that array of arrays, such that ["A" "B" "C"] + [[1 2 3][4 5 6]...] => [["A" "B" "C"][1 2 3][4 5 6]...]
21:00irctcso (generate-header-vector) + (mapcat ...)
21:00_alejandroirctc: concat?
21:01_alejandro,(concat [:a :b :c] (mapcat #(repeat 2 %) [[1 2 3] [4 5 6]]))
21:01clojurebot(:a :b :c [1 2 3] [1 2 3] ...)
21:01_alejandro,(concat [[:a :b :c]] (mapcat #(repeat 2 %) [[1 2 3] [4 5 6]]))
21:01clojurebot([:a :b :c] [1 2 3] [1 2 3] [4 5 6] [4 5 6])
21:01_alejandro,(cons [:a :b :c] (mapcat #(repeat 2 %) [[1 2 3] [4 5 6]]))
21:01clojurebot([:a :b :c] [1 2 3] [1 2 3] [4 5 6] [4 5 6])
21:02irctcI like the results, but I feel like it's going to be really confusing to read my code later
21:03irctcok, the (cons) is more reasonable without the extra []
21:03irctcthanks!
21:03_alejandroirctc: yeah, don't know if that's going to help make it understandable :-)
21:03irctccons I get. I'm just so used to having what seems obvious to me not work, I didn't even try that one!
21:06irctcthanks all, now I can go to bed where my brain has apparently already been for a few hours!
22:00seancorfieldjust watched rich's Inside Transducers talk from the conj - he talks about educe but that doesn't seem to be in 1.7.0 master yet?
22:01gfredericksis he just making up words now?
22:03justin_smithseancorfield: I think it is something like eduction
22:03seancorfieldhttp://www.merriam-webster.com/dictionary/educe
22:03seancorfieldah yes, thanx justin_smith
22:04seancorfieldclojure.core/eduction
22:04seancorfield([xform coll])
22:04seancorfield Returns a reducible/iterable/seqable application of
22:04seancorfield the transducer to the items in coll. Note that these applications
22:04seancorfield will be performed every time reduce/iterator/seq is called.
22:05seancorfieldand it's in alpha 4 so no need for master
22:05justin_smithRaynes: well, regardless of the reason, it's good news that it stays up now
22:06seancorfield+1 justin_smith
22:06seancorfieldheh, used to a bot in another channel
22:06seancorfield(inc justin_smith)
22:06lazybot⇒ 146
22:08gfredericks(dec the bot in the other channel)
22:08lazybot⇒ -1
22:11seancorfieldCurry wins. Variants are not Unions will be dessert.
22:37danielcomptonWhat do people think about a Clojure port of https://github.com/fxn/i-told-you-it-was-private?
22:39justin_smithdanielcompton: I wonder if anyone has actually gotten their files removed by that thing
22:39danielcomptonjustin_smith: only once
22:41danielcomptonhttps://github.com/fxn/i-told-you-it-was-private/issues/4
22:42csd_Is it possible for a namespace A to include another ns B's functions such that when I load ns A in the repl that ns B's functions are available to me?
22:43gfrederickscsd_: not really; is your motivation about namespace/file structuring, or about repl utilities/convenience, or something else?
22:44justin_smithcsd_: you could loop and intern matching vars based on the output of ns-publics - but it seems like a weird thing
22:44csd_gfredericks: laziness mostly, the one ns is basically wrapping the other and adding some functions. but i can't easily load them both right now because of name conflicts
22:45gfredericks,'ping
22:45clojurebotping
22:45gfrederickserc and/or freenode just told me I was banned
22:46justin_smithwoah, weird
22:46csd_it said you were K-lined
22:46gfredericksbut here I am back so I guess I'm not? Anyhow if csd_ replied to me I missed it
22:46csd_gfredericks: laziness mostly, the one ns is basically wrapping the
22:46csd_ other and adding some functions. but i can't easily load them both
22:46csd_ right now because of name conflicts
22:46csd_i wish erc could copy/paste properly
22:47gfrederickscsd_: I assume you know about (require '[foo :as bar])?
22:47justin_smithgfredericks: http://en.wikipedia.org/wiki/IRCd#K-line
22:47justin_smithgfredericks: may want to check you don't have a security issue with your client
22:56gfredericks...erc?
22:58csd_are Jaaod and dakrone bots of yours? they were k-lined when you were
22:59gfredericksnope
23:00csd_i'm guessing its probably some server issue
23:04gfrederickscomputers are the worst
23:07thesebi'm glad Clojure is ported to CLR and .NET
23:07thesebbut
23:07thesebthat means if you are addicted to the JVM libraries you lose right?
23:07gfredericksno you win because you keep using clojure on the jvm
23:08thesebgfredericks: my point is when python was ported to JVM i think he dragged along all the libraries.....i dunno if the CLR port actually ported all the JvM libraries...did they?
23:09justin_smithon the other hand, you can do decent native style GUI apps
23:09gfrederickswell "is ported to" might be strong language
23:09thesebjustin_smith: on CLR port?
23:09gfredericksclojure kind of reinvents itself on each new platform
23:09justin_smiththeseb: people don't even use python3 because it has less library support
23:09gfredericksyou could think of them as dialects of clojure
23:10justin_smiththeseb: yeah, unlike java you can get a decent compatible UI
23:10thesebjustin_smith: yes but only for Windoze right?
23:10justin_smiththeseb: gnome uses mono for GUI stuff
23:10justin_smithso no, not just for windows, but maybe not for mac?
23:12thesebjustin_smith: wait...didn't java make a swing replacement that looked native for different platforms?
23:12justin_smiththeseb: which one is that?
23:12thesebdunno....what is the best of the best java gui ?
23:13thesebjustin_smith: but regardless...imho...no one uses guis anymore right? they all use html right! :)
23:16csd_i cant wait until things come full circle and its easy to use command line to use facebook, twitter, etc
23:49kenrestivothere's a twitter commandline client, i used to use it
23:52justin_smiththere are irc chans where the bot does semi-automated tweeting
23:53justin_smiththey are one of the better things in the web about having an accessible API actually