#clojure logs

2014-11-17

00:08justin_smithdanielcompton: yeah, that's a pain - I guess you could post a bug report for each one :)
00:09danielcomptonjustin_smith: each REPL environment or each library?
00:09cflemingdanielcompton: Cursive actually does this when AOT compiling, but fiddling with the output of people's REPLs is a sensitive topic :)
00:10justin_smithdanielcompton: each library
00:10cflemingjustin_smith: It should be possible to hide them in the REPL I think.
00:11justin_smithsure :) I was being somewhat glib
00:12cflemingHehe, sorry, that got lost in IRC static :)
00:15arrdemyay http://conj.io unbroken!
00:15danielcomptonarrdem: new grimoire home?
00:16arrdemdanielcompton: well the both point to the same VM :P
00:16arrdembut yeah
00:16danielcomptonarrdem: how about http://conj.it
00:16ghadishaybanworking on reflection "linking" right now, hope i can get it working before the conj
00:16arrdemlol
00:16Jaoodarrdem: at first I though you were linking to a clojure conference ;)
00:17arrdemghadishayban: we're finally online at once :P
00:17danielcomptonor http://putamapon.it
00:17ghadishaybani.e. only incur reflection once
00:17arrdemghadishayban: TL;DR no Oxcart never did actual function inlining itself
00:17danielcomptonghadishayban: how can you only reflect once?
00:17arrdemghadishayban: the most I ever got working was static method/arity linking.
00:17justin_smithghadishayban: oh, nice, self-modifying reflection :)
00:17ghadishaybandanielcompton: rewrite the callsite with invokedynamic
00:18justin_smiththat is nicely meta
00:41danielcomptonwhat's a clojure programmers favourite song?
00:42danielcomptonhttps://www.youtube.com/watch?v=R_uwZZB5Yv0
00:42danielcomptonfn pig, aka fan pig
00:59arrdem
00:59arrdem&';
00:59lazybot⇒ ;
00:59arrdem
00:59arrdem&:;
00:59lazybot⇒ :;
01:00arrdem&(let [; 1] (+ ; ; ;))
01:00lazybot⇒ 3
01:03TEttinger,(map int "(let [; 1])")
01:03clojurebot(40 108 101 116 32 ...)
01:03TEttinger,(map int "[; 1])")
01:03clojurebot(91 894 32 49 93 ...)
01:03TEttinger894 eh?
01:04TEttinger,(char 894)
01:04clojurebot
01:04arrdemGreek question mark
01:04TEttingerha!
01:04arrdemconveniently rendered using effectively the same glyph as our old friend ##(int \;)
01:04lazybot⇒ 59
01:24cflemingghadishayban: Looking forward to seeing that working!
01:25cflemingUnicode must open up a whole world of phishing possibilities.
01:25arrdemoh yes
01:25arrdemit's pretty scary
01:31Kneivacfleming & arrdem: I get these nice spam mails: http://kneiva.raah.fi/unicode.png
01:31arrdemle sigh...
01:31arrdemGrimoire 0.3.9b live
01:32arrdemminor formatting changes, three PRs and a not trash text/plain 404 page for cider-grimoire
01:32arrdemlooong overdue on that one
01:37engblomIs there any companion library to Quil for getting widgets? I would want to place things like input boxes and buttons on a Quil canvas.
01:37engblomOr is there any other library giving you a chance to do both animation and placing widgets?
01:39kenrestivomore of a java question than a clojure question, but is there an equivalent in java/clojure to POLLPRI ? i.e. to block waiting for priority data from a file descriptor?
01:40kenrestivoi discovered AsynchronousFileChannel, but not sure if it is the right thing
01:42justin_smithkenrestivo: I am thinking something using WatchService https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html
01:43kenrestivowill look, thanks. i gotta say, you seem to know the JVM pretty thoroughly.
01:43kenrestivomust have spent a lot of time in the java salt mines.
01:43danielcomptoncfleming: I think the browsers have put a fairly tight leash on using unicode in URL's
01:44justin_smithkenrestivo: I am a compulsive reader of docs...
01:44justin_smithkenrestivo: and I often try to do odd things, looking for the tool that will do it
01:46justin_smithI decided to work with watcherservice when I was contributing to ToBeReplaced java.nio wrapper - I wanted something actually useful to be there to go with the directory watching, so I needed to figure out that API
02:02ghadishaybantime for bed. just got the one-time reflector working
02:06justin_smithzerkms: hell, I could consume more than that with one line of C if I tried :)
02:06justin_smithzerkms: in all seriousness, yes, clojure uses quite a bit of RAM as a baseline
02:06zerkmsseems like I will not finish my program then
02:07zerkmsI expected to really use it in production
02:07zerkmsbut 100+mb per container is too much
02:07zerkmsespecially keeping in mind it will run on 100+ containers
02:07justin_smithzerkms: why do you need multiple clojure instances running on one machine?
02:07zerkmswhich is 10+gb of ram in total
02:07justin_smithzerkms: isolating parts of a clojure program is trivial
02:07zerkmsthey are in different openvz containers
02:08justin_smithzerkms: and this is something that couldn't be done by isolating parts of a single clojure server process?
02:08zerkmsI don't understand what you say ;-)
02:09zerkmswhat "isolating" means here?
02:09justin_smithzerkms: that's what openvz is for, right? isolating processes? I find I can isolate things effectively within one clojure process.
02:09justin_smiththanks to default immutibility, for starters
02:09zerkmsopenvz isolates resources yep
02:10zerkmsso the task - it's ~100 VMs and every needs its own copy of long living program (which I supposed to implement in clojure for fun)
02:10justin_smithOK, so multiple vms is a premise here
02:10zerkmsyep
02:11justin_smiththen yeah, clojure probably isn't a great fit. You can get OCaml's memory footprint very small, if you are looking for alternatives with similar featuresets (and don't need in-process concurrency)
02:11zerkmswhat about scala?
02:11zerkmsI don't want to do that in python
02:12justin_smithscala is also a memory hog
02:12zerkmsthat sucks :-(
02:12justin_smithdo you have something against OCaml?
02:13zerkmsI haven't seen a single line of code for it
02:13justin_smithit's in the ml family, not super far from haskell in it's basic syntax
02:13zerkmsml is more or less acceptable
02:13justin_smithbut less theoretical / faster compiling / smaller footprint
02:14zerkmsthese days I read purely functional data structures, that uses standard ml as a syntax
02:14zerkmswith basic erlang/haskel syntax knowledge I understand it without issues
02:14justin_smiththe thing is that in ocaml to do threading you need multiple processes running really. Which is annoying. But the programs are small, so it balances out a bit.
02:15justin_smithbut if you want one big program, with many threads, and good immutible behavior, and awesome jvm interop, do try clojure
02:15zerkmswhat about haskell then?
02:15justin_smithclojure is awesome
02:15justin_smithhaskell is more of a mem / cpu hog than ocaml
02:16zerkmsclojure is awesome indeed
02:16shemwhat about racket?
02:16justin_smithRacket's decent too, yeah. But not as good performance wise as clojure, not to mention ocaml.
02:17zerkmsin my env dummy hello world + (read-line) clojure app takes 65 mb
02:18justin_smithnot surprised, yeah, like most other langs, in order to run anything at all you need the full compiler resident in memory
02:18justin_smith*like most other lisps
02:18justin_smithheh
02:20shemracket's compiled, isn't it? and typed racket seems clean and easy to use
02:20shemwhich is why i've been eyeing it
02:21shembut the syntax seems clunkier than clojure
02:23justin_smithshem: does it have a tree-shaking compiler?
02:24justin_smithshem: clojure compiles all code too. It just doesn't know how to drop unused parts of itself.
02:24shemjustin_smith: right. i haven't looked that closely.
02:25arrdemthe price of a single pass compiler...
02:25engblomRacket has two things better than Clojure: Better GUI libraries and compilation to native code.
02:25arrdemish
02:28justin_smithengblom: well, chicken scheme has a native code compiler too, it still doesn't perfrom well at all
02:29justin_smithnative-code can mean a lot of things once you are generating the code programatically
02:29engblomThat is very true.
02:29arrdemgon store all my values on the stack
02:29justin_smithhehe
02:29arrdemfast 'cause native, right?
02:30engblomRacket, however, is fast.
02:30Jaoodafaik distributing a racket executable is like distributing java app excutable where the jvm is bundled in
02:30Jaoodracket compiles to bytecode
02:31engblomI still prefer Clojure over Racket, even though I am no expert in either. Clojure is easier if you have some kind of Haskell background. I really like lazy programming languages.
02:31Jaoodengblom: clojure is not really lazy
02:32justin_smithJaood: lazy functions are more common in core clojure libs / idiomatic clojure code than in racket though
02:32engblom,(take 5 (iterate inc 1))
02:32clojurebot(1 2 3 4 5)
02:33engblomThat was pretty lazy, in my opinion.
02:34justin_smithracket has a lazy flavor available http://docs.racket-lang.org/lazy/
02:34justin_smithlooks pretty comprehensive actually, it's just not the default
02:34Jaoodjustin_smith: yeah, I meant . Clojure’s laziness does not serve the same purpose as Haskell
02:35Jaood In Clojure, laziness is restricted to sequences, with the rest of the language and its data structures being otherwise entirely “eagerly” evaluated.
02:35justin_smithJaood: except for promise / delay maybe?
02:36justin_smiththough writing your code with a delay on every value and a deref on every usage would get very tedious
02:38Jaoodjustin_smith: don't think so, laziness in clojure is not used much for controlling execution flow like in haskell, its more of a process data thing in clojure
02:40justin_smithJaood: not saying it is typically used the same way, just saying it could be used to have the same semantics. Like when I have a let block and don't want certain parts of it evaluated depending on complex conditions, but I don't want to turn it into multiple let blocks, I can use delay
02:41engblomIf you need both a canvas for animations and widgets (buttons, input boxes), what libraries are the best options. I was coding with Quil yesterday and really liked it, but I would need some widgets too. I would love to be able to put some widgets floating over a Quil animation.
02:42justin_smithJaood: actually, looking at those docs, it looks like lazy-racket is more of a lazy lang in the way you are talking about
02:43Jaoodjustin_smith: that would be dangerous in clojure since since lazy sequences may be batched as a performance optimization
02:43Jaoodmaking the realization of items run ahead of consumption
02:44justin_smithJaood: yeah, I was not talking about using lazy-seqs to delay evaluations there
02:45justin_smith,(def d (delay (do (println 42) 0)))
02:45clojurebot#'sandbox/d
02:45justin_smiththat's guaranteed not to run until deref
02:45justin_smith,@d
02:45clojurebot42\n0
02:45justin_smith,@d
02:45clojurebot0
02:48Jaoodjustin_smith: yeah, I see you what mean there
02:48justin_smithdefinitely clumsier than a lazy language
02:49Jaoodjustin_smith: right, I was addressing engblom's statement about haskell
02:50justin_smithaha, I just connected the dots, seeing your point above more clearly
03:28justin_smithTIL a nice trick for reading from a fifo, where multiple programs may be writing to the fifo with pauses in between: (apply concat (repeatedly #(line-seq ...)))
03:34fairuzHi guys, is it possible to have something like (defn foo [x a b] (def x (..computation between a and b here))). And I can call foo like this (foo abc 1 2) so in the end I will get a symbol called abc with some values?
03:34justin_smithfairuz: a macro can do that, a defn no
03:35zerkmsbut it sounds dirty isn't it?
03:35fairuzjustin_smith: ok
03:37justin_smithzerkms: def<foo> forms are popular
03:38justin_smithzerkms: maybe more popular than they should be...
03:39fairuzactually I want to use this for my "seeding initial data" code. I'm thinking to have something like this http://pastebin.com/cNnPwrWE where the first 2 lines will create 2 nodes in the database and the third line will link the former nodes.
03:39justin_smith,(->> 'clojure.core ns-publics keys (map name) (filter #(.startsWith % "def")) (clojure.string/join " "))
03:39clojurebot"deftype defstruct definline definterface default-data-readers defn defmethod defonce defn- defprotocol defmacro defmulti defrecord"
03:39fairuzI'm still thinking how I can approach this
03:41justin_smithfairuz: why not a let block instead of def?
03:42TEttingerugh... I'm hitting a block with trying to get leiningen to compile a java main class that calls clojure code
03:42stainperhaps better let Maven build Java code
03:43TEttingerthe thing is the clojure isn't built yet that the java needs to call
03:43justin_smith,(->> (all-ns) (mapcat (comp keys ns-publics)) (map name) (filter #(.startsWith % "def")) (remove #(.startsWith % "default")) (clojure.string/join " "))
03:43clojurebot"deftype defstruct definline definterface defn defmethod defonce defn- defprotocol defmacro defmulti defrecord"
03:44TEttingerI'm trying to figure out why Packr fails on clojure projects with a -main fn written in clojure, but works on java main methods
03:45TEttingerhttps://github.com/libgdx/packr/issues/33#issuecomment-62863164
03:46fairuzSo my first approach is to use EDN something like in the paste bin, then the first line will actually insert into database and normally it will give me reference. So I want to store this reference inside a1.
03:46fairuzSame thing for the second line
03:47justin_smithfairuz: OK. this can all be done in a let block. def is for creating globals
03:48justin_smithclojure is not like js or scheme where def creates local bindings
03:52justin_smith(let [a1 {:action 'create 'a1 {:val1 111 :val2 222}} a2 {:action 'create 'a2 {:val1 111 :val2 222}} a3 {:action 'link 'a3 {:nodeA a1 :nodeB a2}}] a3)
03:52justin_smith,(let [a1 {:action 'create 'a1 {:val1 111 :val2 222}} a2 {:action 'create 'a2 {:val1 111 :val2 222}} a3 {:action 'link 'a3 {:nodeA a1 :nodeB a2}}] a3)
03:52clojurebot{:action link, a3 {:nodeA {a1 {:val1 111, :val2 222}, :action create}, :nodeB {a2 {:val1 111, :val2 222}, :action create}}}
03:54fairuzoh ok
03:55fairuzlooks good!
03:56justin_smithalso, may I suggest {:name 'a1 :data {:val1 111, val2 222}} - this form is much easier to work with
03:56justin_smithor you can even lift the data...
03:56justin_smith{:name 'a1 :val1 111 :val2 222}
03:57justin_smithand then you can do ##(group-by :name [{:name 'a1 :val1 111} {:name 'a2 :val 122}])
03:57lazybot⇒ {a1 [{:name a1, :val1 111}], a2 [{:name a2, :val 122}]}
03:57justin_smithand other related nice operations
03:58fairuzLet me read this carefully first :)
03:58justin_smithof course
04:02fairuzhm sorry. I'm still confused. :) So with this it's possible if I have {:name 'a1 :val1 111 :val2 222}
04:03fairuzthen my function will process this, e.g put 111 and 222 in the database, and get back the reference and put it in a1?
04:03justin_smithwhat scope should this a1 have?
04:04fairuzOnly in this file/function
04:04fairuzI just want to reuse a1 in the other lines
04:06justin_smiththen I think you want something like (defn foo [] (let [a1 (create {...}) a2 (create {...}) a3 (link a1 a2)] ...))
04:06fairuzSince it will be run only once (it's for initial graph data loading)
04:06fairuzCan let [a1 (create {...}) a2 (create {...}) a3 (link a1 a2)] ... comes from a file?
04:06fairuzlet say EDN? or something more practical taht you can suggest
04:06justin_smithsure
04:07justin_smiththough if you want it all to come from a file you probably just want to do a reduce or walk on the file
04:09fairuzI'm not really sure what read-string from edn uses
04:09fairuzDo you mean to reduce/map them once I read using read-string of edn?
04:10justin_smith,(reduce (fn [db datum] (assoc db (:name datum) {:data datum})) {} '[{:name a1 :data [0 1 2]} {:name a2 :data "hello"} {:name a3 :links [a1 a2]}])
04:10clojurebot{a3 {:data {:name a3, :links [a1 a2]}}, a2 {:data {:name a2, :data "hello"}}, a1 {:data {:name a1, :data [0 1 2]}}}
04:10justin_smithyeah
04:10justin_smithso imagine if above, instead of calling assoc, I was running some db insertion
04:10justin_smithand perhaps looking for a :links key, and inserting that link in the db if it was there...
04:11justin_smithand you can get this all from a simple (read-string (slurp "data.edn")) of course
04:14fairuznice!
04:15fairuzI'll try to make a simple working thing :)
04:17justin_smithfairuz: in fact, reduce is better for a purely functional example for above, but for side-effecting db inserts, doseq may be much clearer
04:17fairuzBoth doing the same thing?
04:19justin_smith,(doseq [e '[{:name a1 :data [0 1 2]} {:name a2 :data "hello"} {:name a3 :links [a1 a2]}]] (print ['i (:name e) [(:data e)] [(:links e)]]))
04:19clojurebot[i a1 [[0 1 2]] [nil]][i a2 [hello] [nil]][i a3 [nil] [[a1 a2]]]
04:19justin_smithdoseq returns nil
04:19justin_smithit only runs for side effects
04:19justin_smithso you could imagine instead of printing a vector that starts with 'i it ran an insert
04:21fairuzok
04:21TEttingerhttps://github.com/libgdx/packr/issues/33 so this issue only seems to show up when bundling JREs with uberjars made by lein.
04:22fairuzA lot to digest
04:22justin_smithfairuz: sure. How would you usually do this in a language you know well?
04:25fairuzThis is quite new since I'm doing this initial data loading for a graph database. The only experience I had with loading a graph database is with a tree-like data structure. So you just need to know the parent (to link the child with the parent). In this case, the initial data file is quite easy, I just make an xml with the child as the sub tag of the parent tag.
04:25fairuzThe problem here it's no more a tree-like structure, siblings can have links between them
04:26justin_smithfairuz: have you heard of "adjacency list" graph representation?
04:26justin_smithhttp://en.wikipedia.org/wiki/Adjacency_list
04:26fairuzjustin_smith: um nope
04:27fairuzah
04:27fairuzso I want to have something like that. So my idea is to first to create all the nodes. (to get their references)
04:27fairuzThen link them using the references
04:28justin_smithyour input could like like [{:name 'a :arrows '[b c]} {:name 'b :arrows '[b a]}] etc.
04:28justin_smithright
04:28fairuzYep
04:28fairuzthat's how I want to proceed
04:28fairuzThat's why I need to create the references first
04:28fairuzthe re-use it after
04:30justin_smithso I would first (doseq [key (map :name data)] (insert key)) then (doseq [datum data] (make-links (:name datum) (:arrows datum)))
04:30justin_smithand later you may add other keys if the links or nodes need to carry their own info...
04:35fairuzOk. I'm still struggling reading clojure code, so bare with me. heh
04:35fairuzIt's getting easier though, which is good
04:41fairuzThanks for the help justin_smith
06:25crisptrutskiis there a function to see all protocols a type or instance is extending? as opposed to `extenders` available in the other direction
06:28crisptrutskitrying to understand the difference between `indexed?` and `sequential?`, and why the former is only in clojurescript and not clojure
06:50r4viwhat's a sensible way of doing the inverse of a reduce. I want to reduce a list of functions over a value. value will get passed through each function then the result to the next. kind of like (f3 (f2 (f1 v))) but I have vec with all the functions in [f1 f2 f3]
06:52ucbr4vi: juxt
06:52ucb,(doc juxt)
06:52clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
06:53ucboh, right, misread your question
06:54ucbr4vi: you can use -> or reduce over the vector of fns?
06:54r4vii was thinking reduce too
06:54ucb (-> v f1 f2 f3) is quite readable too
06:55r4vihmm yes
06:55ucbor would it be (-> (f1) (f2) ...)?
06:55ucbI forget.
06:55ucbI rarely use -> myself
06:55ucbif you have the fns in a vector already, I'd reduce over it
06:57r4vi,(doc reduce)
06:57clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
06:57r4viI can't figure out how to get the value to reduce across the functions if I used reduce
06:58ucb(reduce (fn [x f] (f x)) v [f1 f2 f3]) should do the trick I think
06:59ucb,(reduce (fn [x f] (f x)) 0 [inc inc inc])
06:59clojurebot3
06:59ucbyuppe
07:02r4vinice thanks
07:34rus`hello guys, could you suggest some good book on Clojure?
07:35rus`ebook maybe, so I can start earlier
07:36mearnsh~books
07:36clojurebotbooks is http://www.pragprog.com/titles/shcloj/programming-clojure
07:36mearnsh~book
07:36clojurebotbook is books
07:37mearnshrus`: what's your programming background
07:37rus`mearnsh: Common Lisp
07:38mearnshJoy of Clojure might be a good choice then
07:40mearnshit's faster paced than most but if you're familiar with CL you'll be fine. it's a great book
07:41rus`mearnsh: excellent, thanks! and there is a foreword by Steve Yegge for additional entertainment
07:41m1dnight_I'm trying to play around with the clojure bot but I can't seem to find the list of command prefixes?
07:41m1dnight_Is it in the database?
09:00engblomIs anyone here able to tell how I set up an own clojurebot?
09:00engblomThere seem to be no documentation boundled with the source.
09:01clgvengblom: if I remember correctly, lazybot has more information available
09:02clgvuntil he started aging lazybot was the cooler one anyway ;)
09:02clgv&(clojure-version)
09:02lazybot⇒ "1.7.0-alpha1"
09:02clgvoh interesting
09:02engblomclgv: Yes, lazybot seem to be quite easy to install but requires a mongodb server. I would not be willing to set up this for just a bot.
09:02clgvhe seems to have had a rejuvenation potion recently
09:03agarmanengblom: mongodb is a 2 minute setup
09:04rweirthen years of regret
09:04clgv:D :P
09:04clojurebotExcuse me?
09:05clgvdidn't you find rweir's comment funny??
09:05lazybotclgv: Uh, no. Why would you even ask?
09:05engblomagarman: It is not the work I am against. I am sure it is less work to set up mongodb and lazybot than to get clojurebot to work. It is just that I do not want one service more running on my shell server...
09:06clgvengblom: well you write the maintainer of clojurebot to get more information
09:06clgvengblom: sql? that is so 2000s ;) :P
09:07clgvengblom: clojurebot has a setup.sh and example.config - those should help right?
09:08agarmanengblom: mongodb is about the same level of complexity of sqllit
09:09engblomclgv: setup.sh is for setting up a chroot environment. example.config is good to have but I do not know what to rename it to unless I begin plowing through the sources.
09:10clgvengblom: so the easiest way seems to be asking hiredman
09:10engblomagarman: With simple I did not necessary mean less complex. I meant more that it does not require any service running. sqlite is just a library using a file as database.
09:10agarmanyeah, mongodb doesn't embed
09:14justin_smithclgv: I updated lazybot to fix its downtime issues, figured I would try updating the clojure version while I was at it, and amazingly enough, it just worked
09:15justin_smithI don't own the repo, I just submitted a huge PR
09:16clgvjustin_smith: so you are lazybot's fountain of youth ;)
09:16clgvjustin_smith: good job
09:17clgv,(clojure-version)
09:17clojurebot"1.7.0-master-SNAPSHOT"
09:17clgvclojurebot could be more specific ;)
09:17clgvor is it really tracking bleeding edge master?
09:19Guest4839hey i'm trying out clojure for the first time
09:19mgaarewelcome panther_
09:19panther_i know about haskell, ml, and racket
09:20mgaareyou should be in good shape then
09:20agarmanpanther_: clojure will be closest to racket
09:21panther_racket was pretty cool. i also tried scala but it was too slow (JVM)
09:21panther_racket, clojure :: lisp dialects
09:21agarmanpanther_: Clojure is also JVM
09:21agarmanpanther_: was it the Scala compiler that was too slow, or the running code?
09:22panther_i just typed 3+1 or something like that into the REPL and it took many seconds to return the result
09:22panther_i wasn't doing anything crazy like a qsort function
09:22agarmanpanther_: Scala brings up a REPL prompt quickly, but the first few commands are slow
09:23clgvpanther_: that sounds weird. especially as an argument that the language is too slow...
09:23panther_oooh
09:23panther_thanks
09:23agarmanpanther_: when I was doing Scala work, I just hit enter 3 or 4 times after starting the REPL
09:23agarmanand that was usually enough to get it going
09:23panther_i see. Well then i will not judge a language on its first few tries
09:23clgvagarman: is that already some kind o f design pattern? :P
09:24panther_thanks
09:24mgaareyou have to beat scala like a donkey
09:25agarmanpanther_: but I wouldn't recommend Scala as its implicits make the language arbitrarily complex. And the version to version upgrade is the worst I've ever experienced in a language
09:26panther_i feel really stupid right now because i'm trying out a language on windows.
09:26panther_my Linux laptop contains most of my dev stuf
09:39H4nswhat would be the best way to track line numbers in an input data file while reading it? i would like to use edn or clojure as syntax in the files, so line-wise reading does not help me too much.
09:42stuartsierraH4ns: maybe Clojure's LineNumberingPushbackReader
09:43H4nsstuartsierra: i've found that, but then got lost in a maze of classes and interfaces and very slim documentation. thanks for pointing me back :)
09:46stuartsierraH4ns: You're welcome. It's not a public part of Clojure, so you won't find any docs, but it shouldn't be too hard to figure out what it's doing from the source.
09:46stuartsierraThere's probably a similar line-numbering reader in some (documented) Java library.
09:47stuartsierraLike Apache Commons I/O or Guava.
09:49H4nsstuartsierra: i could steal the usage from https://github.com/dwysocki/lojic/blob/37fc2623f5fb280cf47c38cf2c271015b85e8e82/src/lojic/core.clj#L17, thanks!
09:55ordnungswidrigH4ns: https://docs.oracle.com/javase/7/docs/api/java/io/LineNumberReader.html
10:39jobxAre core.async threads similar in memory size to Golang's threads, excluding JVM startup, ie. additional threads?
10:40clgvjobx: afair the use java threads managed by a threadpool - so threads are reused
10:41jobxclgv: Does this make core.async threads more efficient then?
10:41jobxclgv: I'm new to the JVM
10:42clgvclgv: no idea what golang does.
10:42clgvjobx: ^^
10:44clgvjobx: but on average there is no overhead due to thread creation. there is only a synchronized queue involved
10:44jobxclgv: Any idea how much RAM per thread?
10:45clgvjobx: no. but you have only a constant number of threads
10:47csd_What's the best way for me to perform a println that involves concating strings that are built up across several line, including conditionals and inside do statements?
10:47jobxclgv: Hmm, don't quite get it as I read core.async was similar to Golang's lightweight goroutines which can be generated in the 1000's quite cheaply
10:48csd_I guess I'm wondering whether StringBuilder is my best bet
10:48clgvjobx: core.async uses a fixed size threadpool afair. but you can easily have more "thread" forms in parallel than then number of used threads
10:49clgvjobx: the threads wait for tasks that get submitted to a queue
10:51clgvjobx: for more details you can ask the devs, e.g. tbaldridge
10:51eric_normandjobx: you can make many core.async go-processes
10:51eric_normandjobx: but behind the scenes, to execute them, they use a shared thread pool
10:52jobxeric_normand: I see. Just trying to get a rough comparison or memory requirements Clojure vs Gloang, minus base JVM requirements
10:53clgvjobx: just implement a small benchmark in both and measure?
10:53tbaldridgejobx: go processes in core.async are just callbacks, so there's not much overhead there.
10:53jobxtbaldridge: I see. Thanks.
10:58clgvtbaldridge: is the pattern (if ^boolean (prop? x) ...) just better documented or does ^boolean have an effect on the compiler?
10:59Bronsaclgv: that's a cljs compiler hint
10:59sdegutisIs it too harsh to refuse to re-license a library you mostly wrote so that a semi-major open source programming language which you strongly disagree with can include it in their standard library?
10:59clgvBronsa: oh I landed in the wrong tree. thanks
11:11tbaldridgesdegutis: depends on the open source language, the licenses etc.
11:12sdegutisAh.
11:13clgvsdegutis: which semi-major os prog lang are you talking about?
11:13sdegutisSomeone wanted to work towards including a Go library I wrote into Go's stdlib.
11:14arrdemwhy would it be harsh to refuse to re-license something you wrote? it's yours after all.
11:14sdegutisI refused to relicense it and sign whatever thing I would have had to sign, and I'm having a really hard time thinking I made the wrong decision.
11:15sdegutisarrdem: Because it meant they had to rewrite it from scratch if they want to use it in Go's stdlib.
11:15sdegutisThey're essentially having to do more work than they would have because of me.
11:16arrdemno, they're doing work they would have done anyway and which you are in a position to save them
11:16arrdem*from repeating
11:16tbaldridgesdegutis: stinks to be them for having a crappy contrib process ;-)
11:16arrdem^ that
11:16arrdemI choose to give away the stuff I write in my spare time. If you don't like the terms, deal or pay me to change em.
11:17arrdemjust my (cynical) 0.02
11:17clgvtbaldridge: but it wouldnt be that different with clojure, would it? you have to be EPL compatible and sign the CA
11:17sdegutisI usually am find with people using my code, but writing that one Go lib was a painful process in itself, and in the end I abandoned it and deleted the lib, although someone forked it and it lived on.
11:17clgvso GPL is out of scope
11:18tbaldridgeclgv: yep, and if I had a GPL lib that the "clojure people" (whoever that is) desperately wanted, I'd say the same thing.
11:18sdegutisSo I was really only objecting on principle, because writing it was such a painful process and the end result was ugly, all thanks to the nature of the language. And I don't want to encourage that kind of language being used.
11:18tbaldridgeclgv: that being said, I use EPL on all my clojure projects just to avoid that problem.
11:19clgvtbaldridge: the incompatibility is a pain for "itext", you can't use any uptodate version of it in EPL projects... :(
11:19sdegutisSo it just feels like I only have an arrogant reason to ultimately make someone else do double work.
11:20tbaldridgesdegutis: what's the current license?
11:20emacsnubHey everyone, I was told starter kits weren't recommended for clojure dev w/ emacs. Does that mean I should avoid all emacs preconfigs like Prelude or OME?
11:20tbaldridgesdegutis: and have you ever accepted a pull request on the project.
11:25arrdememacsnub: basically. just take the time to find bits you like and add them to your own config it's rarely worth the trouble that using someone else's wholesale will bring.
11:27emacsnub:arrdem Thanks for the heads up! I've actually tried that a couple of times haha. Its just that I can't even seem to get the basic stuff working :(.
11:27luxbockhttps://github.com/emacs-tw/awesome-emacs is a good resource
11:29emacsnub:luxbock thanks!
11:30emacsnubOh yeah, is remmapping caps lock to ctl enough to prevent emacs pinky? I was trying to use ergoemacs, but it clashes w/ paredit a lot, and smartparens has had weird issues for me
11:32luxbockemacsnub: it goes a long way, but that obviously depends on how much of your day you spend in Emacs, and what kind of keyboard you have
11:32emacsnuboh that's true
11:32schmiremacsnub: I'd say try to use the control keys on both sides of your keyboard
11:33luxbockI use mostly my laptop which doesn't have the greatest keyboard so I actually started using evil-mode with Emacs, despite never having used Vim before
11:33emacsnub:schmir but sticking with the default keybindings should be ok, right
11:35sg2002Wasn't emacs-prelude develed by on of the cider developers? Don't think there would be any conflict.
11:35clojurebotHuh?
11:35schmiremacsnub: get a keyboard that's comfortable for you and make short breaks at least every hour.
11:35emacsnub:schmir I will. Thank you!
11:35technomancymove your control key to your thumb for great justice
11:36luxbockhas anyone given this a try yet? https://github.com/promethial/paxedit
11:36sg2002emacsnub: I'd say go with some starter kit and if something does not work, you can always fix it yourself and learn some more about what that kit does. Later, when you're comfortable, you'd start experimenting with different libraries.
11:37technomancysg2002: most starter kits have rubbish docs and are difficult to fix when things go wrong
11:37emacsnub:sg2002 thanks for the suggestion!
11:38sg2002technomancy: Prelude and emacs-starter-lit look fine to me.
11:38emacsnub:technomancy I've used your starter kit and it wasn't too bad. Something weird happened at some point though
11:38technomancysg2002: emacs-starter-kit is lame
11:38sg2002technomancy: Possibly, haven't looked into it that well.
11:38technomancy~geometry
11:38clojurebotIt's greek to me.
11:39technomancy._.
11:39technomancy"Emacs needs some theology and geometry; some taste and decency. I suspect we are teetering at the edge of an abyss." etc
11:39sg2002technomancy: Personally I use ergoemacs. ;-) Hope I would not get banned for mentioning it. :-)
11:39technomancywe get confused people in the #emacs channel on a daily basis
11:40technomancyprelude, esk, emacs-live, they're all the same
11:40technomancy(probably people just don't ask about ergomacs probably because they know xah has a bad reputation)
11:41sg2002technomancy: Haha.
11:43m1dnight_When I run (dorun (apply pcalls <something something>)), can I expect all the functions in that body to return?
11:43m1dnight_I seem to shut down my agents before they all finish and get refused to execute exception
11:44m1dnight_https://www.refheap.com/93519 # Source
11:44m1dnight_When I comment out shutdown-agents it all works fine
11:44clgvm1dnight_: better dont use any of those p(map|calls) ...
11:44m1dnight_hrm?
11:44m1dnight_Why not?
11:45clgvyour dorun already indicates that you are not interested in semi-lazy sequences that are evaluated in parallel.
11:46clgvyou want to run several functions in parallel and use what your hardware offers, right?
11:46m1dnight_yes, that is correct
11:47m1dnight_it's a stresstest for my refs implementation
11:47clgv"pmap" will prevent that as soon as your functions have different runtimes
11:47sg2002technomancy: emacsnub: I still think that it's better start with a kit that includes some large crazy thing like icicles or helm, and go from there. If you start from scratch you just wouldn't know what you're missing.
11:47clgvm1dnight_: oh just use futures then
11:47m1dnight_yeah, but that's the error i'm getting, the agents are shut down and I seem to add another future to my agents
11:47m1dnight_so I'm guessing something is returning before all the functions have been executed..
11:47m1dnight_I don't really get it
11:47m1dnight_I didnt change a whole lot in the code, I think
11:47technomancysg2002: sure, just don't come crying to #emacs when it breaks =)
11:48clgvm1dnight_: you got your code on github or similar?
11:48emacsnub:technomancy I just followed this tutorial/starter kit: https://github.com/technomancy/emacs-starter-kit/ and its great! I couldn't add marmalade or melpa until I added (require 'package) at the top though. Why is that?
11:48m1dnight_yeah hold on
11:48m1dnight_https://github.com/m1dnight/stm-in-clojure-leiningen
11:48sdegutistbaldridge: no, and it's whatever license it is when you don't specify a license
11:49m1dnight_did a quick push just now :)
11:49sg2002technomancy: As someone said to me once "Here in #emacs we can help you with any emacs package except cider and icicles." :-)
11:49Bronsaemacsnub: there's no reason for the leading colon before nicks in irc
11:49mgaareBronsa: don't you want to be a keyword?
11:49technomancysdegutis: releasing software without a license is a crap move no matter the context
11:49emacsnubBronsa thanks!
11:50sdegutistechnomancy: I was young and care-free :P
11:50technomancyemacsnub: the purpose of that page is mostly to get people to stop using the starter kit rather than actual instruction, but thanks
11:50sg2002technomancy: Oh, I meant CEDET. ;-)
11:51clgvm1dnight_: which test namespace specifically?
11:51clgvm1dnight_: examples.clj?
11:55clgvm1dnight_: I used the following for parallel tests https://gist.github.com/guv/d91b39ea19c47bc8afed
11:57clgvm1dnight_: if your code within the futures might throw exceptions you should wrap the `deref` into try-catch to make sure all futures get dereferenced
12:00m1dnight_yes, clgv
12:01m1dnight_but the exact error I get is Task java.util.concurrent.FutureTask@3c18b340 rejected from java.util.concurrent.ThreadPoolExecutor@79a04d92[Shutting down, pool size = 2, active threads = 2, queued tasks = 0, completed tasks = 8]
12:01m1dnight_I don't really get it
12:01m1dnight_I should have 10 completed tasks, so I'm guessing that the tasks aren't in the pool yet before I shut down the agents
12:01m1dnight_stack trace is pretty vague about it too
12:02m1dnight_I'll give your code a shot
12:02clgvm1dnight_: ah lol you shutdown agents in the namespace
12:02m1dnight_yeah :p
12:02m1dnight_but the point is, the unit test works for the vanilla release (the codebase I received)
12:02clgvm1dnight_: pretty bad idea. you should only do something like that at the end of a -main function
12:02m1dnight_but I changed a few things in the actor model (a thread-local transaction var is an atom with a map in it, instead of the naked map)
12:02m1dnight_hrm, okay
12:03m1dnight_but I'm wondering what could be the cause that my implementation causes this error and the professor's one not
12:03clgvm1dnight_: no that code is evaluated with the namespace, so you shutdown the agent thread pool when the namespace is loaded
12:03m1dnight_*blink*
12:03clgvthat's very likely before the test is run ;)
12:04m1dnight_but I evaluate (run-tests) before it, when i load the namesapce, no?
12:04clgvdoes (run-tests) block?
12:04clgvto include it in the namespace is odd anyway
12:06clgvm1dnight_: why do you want to shut it down anyway? my test skeleton, the one I posted, uses futures as well and has no problems with the running threadpool in "lein test"
12:10emacsnubhaha, sorry I'm treating this like #emacs, but can someone tell me how to have ido-ubiquotous enabled by default?
12:11technomancyemacsnub: (ido-ubiquitous-mode t) I think
12:16emacsnubtechnomancy I had this in my init.el: (require 'ido) (setq ido-everywhere t) (ido-ubiquotous-mode t)
12:16emacsnubtechnomancy and it said symbol's definition is void
12:17technomancyemacsnub: sounds like it isn't installed
12:18emacsnubtechnomancy if i do M-x ido-ubiquotous-mode I get autocompletions when I want to install packages
12:19emacsnubbut without that I don't have autocompletions
12:20emacsnuboh i think it was a typo in my init...
12:22emacsnubtechnomancy YESSS!! THAT DID IT!!! THANK YOU!!!
12:22mmitchellanyone know if it's possible to generate a class using annotations like this? http://www.sureshpw.com/2013/09/javajson-polymorphic-mapping-using.html
12:23mmitchellI need to add something like @JsonTypeName('foo') - in java, this happens before the class declaration
12:23clgvmmitchell: you should probably define that class in java then
12:24clgvmmitchell: if this is not needed because of legacy code, you should better not use this approach
12:26mmitchellclgv: so define the class that requires annotations in Java - you're last comment sorry not following... Are you basically saying just don't do this in Clojure?
12:26mmitchells/you're/your
12:27clgvmmitchell: yes
12:27clgvmmitchell: if not for legacy reasons, don't do this
12:28mmitchellDang, yeah not legacy, but required to interact with a Java framework I'm working with.
12:28m1dnight_clgv: Yeah, I think I figured it out now
12:29m1dnight_when I do lein test <namespace> it evaluates the test when loading, then shuts down the pool and then runs the tests again
12:29munderwoHi all. I’ve been using etags to navigate around in emacs and its been really good. Although I realise they are not mutually exclusive, does cider have something like this? where you can go to the definition of the symbol at your point?
12:29m1dnight_and that's the problem
12:29joegallomunderwo: M-.
12:29technomancymunderwo: yeah, cider is way better than etags at that
12:29munderwoahh cool…
12:29clgvm1dnight_: not really the namespace is loaded completely and after that the tests are run
12:30m1dnight_but it runs the test twice?
12:30m1dnight_That's why I figured it would run the tests when loading the namspace
12:30munderwodoes it work with clojurescript as well? Also when I did that it said it had no nrepl connection buffer
12:30clgvmmitchell: so you must use a framework that assumes classes like that? then just define them in java in your project
12:31clgvm1dnight_: it only runs those twice because you have that (run-tests) in the namespace. just remove that as well
12:31clgvm1dnight_: can you answer the question why you want to shut down the agent threadpool?
12:31m1dnight_clgv: I'm not sure, it's given code. But my guess is that this project was not in leiningen and simply run with a clojure jar
12:31mmitchellclgv: yes, I have to add those nutty annotations. OK so define the class in Java (in my Clojure project under "src/java" or something right?). Then can I still define the main code in Clojure?
12:31m1dnight_and therefore they would shut it down
12:32clgvm1dnight_: that might be the case. just remove it and use "lein test" ^^
12:33clgvmmitchell: yes. see the sample project.clj for a setup for distinct java and clojure source paths
12:33mmitchellclgv: awesome, starting to make sense. Thanks!
12:51sdegutisAre there any (popular or not) alternatives to Compojure?
12:52clgvsdegutis: liberator?
12:52sdegutisThanks, looking at it.
12:54hiredmanztellman: does riffle have ranged iteration?
12:55nkozasdegutis: moustache, bishop, bidi, compojure-api, clothesline route-one
12:56sdegutisBishop eh? Someone likes X-Men.
12:56technomancyor chess
12:56sdegutisOh right, that too.
12:57technomancyor like ... the Roman Church?
12:57sdegutis~guards
12:57clojurebotSEIZE HIM!
12:57technomancymy son is named after a bishop
12:57sdegutisAnyway I liked the kitchen scene in Days of Future Past. That's probably my favorite scene in any movie ever.
12:57technomancy(middle name, but still)
12:58{blake}Bishop? Or Alien.
13:00ianbishopDoes anyone have experience moving a mid-size org from Java to Clojure via internal training & have a few min to chat?
13:01{blake}Holy synchronicity, Batman!
13:01sdegutisI've been looking into the opposite.
13:02emacsnubhow can I enable autoindenting for clojure code in emacs?
13:02hyPiRiontechnomancy: does your son only move diagonally?
13:02technomancyhe'd probably get a kick out of that if I told him, hehe
13:03ianbishopsdegutis: what's your reasoning for that?
13:04sdegutisianbishop: I've been dabbling with Java 8 and so far I like what I see, and it's faster than Clojure.
13:06ianbishopsdegutis: ah, fair enough. I'm not worried about that size of speed improvement
13:08sdegutisAlso I'm starting to find that Java can be non-complex and functional without necessarily being Clojure.
13:14clgvsdegutis: if that static wip branch gets included in clojure 1.7 or 1.8, there is no real argument supporting your claim - except you refer to startup time only with respect to "faster"
13:14technomancyclgv: he's just messing with you
13:15munderwoHi all, looking for a way to convert [“foo” “bar”] to [[:option “foo”] [:option “bar”]]
13:15{blake}munderwo: (for [x ["foo" "bar"]] [:option x])
13:16{blake}Wrap that in a "(into [] ...)" to get a vector instead of a list.
13:16munderwoOh nice!
13:16postpunkjustin,(mapv (fn [k] [:option k]) ["foo" "bar"])
13:16clojurebot[[:option "foo"] [:option "bar"]]
13:16munderwoahh soo many options :)
13:16munderwoI tried map.. but not mapv
13:17clgvtechnomancy: not sure about that ;)
13:18technomancyclgv: the subtlety is what makes him a master
13:18munderwohmm actually I tried map with #([:option %]) but that didnt seem to work..
13:18Bronsaclgv: according to puredanger direct is out of scope for 1.7
13:18munderwo,(mapv #([:option %]) ["foo" "bar"])
13:18clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>
13:19munderwoHmm… why does the above not work?
13:19Bronsa,'#([:foo %])
13:19clojurebot(fn* [p1__78#] ([:foo p1__78#]))
13:19joegallo#(...) expects an actual function as its first argument
13:19Bronsa,(macroexpand-1 '(fn [x] [:foo x]))
13:19clojurebot(fn* ([x] [:foo x]))
13:19joegallo[] is not what you think it is in that context
13:19ianbishop,(mapv #(vector :option %) ["foo" "bar"])
13:19clojurebot[[:option "foo"] [:option "bar"]]
13:19munderwoahhhh… wow… interesting… you learn something everyday :)
13:19clgvBronsa: ah, too bad. then I have to write a patch macro to achieve something similar. clojure 1.8 probably won't be released unti the end of 2015 I guess
13:20Bronsaclgv: no idea
13:20clgvor are there plans to have shorter release cycles?
13:20Bronsadon't ask me.
13:20Bronsaclgv: I've heard core talking of shorter release cycles since 1.3
13:21clgvBronsa: good sign :P
13:21mdrogalisAnyone ever seen a defmulti dispatch work correctly in the REPL, when when AOT'ed - cannot find its defmethod implementation?
13:21clgvBronsa: 1.3 was the version where I waited the longest before adoption
13:21hiredmanyou are not loading the namespace where the defmethod is
13:21mdrogalisPrinting `methods` inside the defmulti shows that it *should* find its implementation - when AOT'ed, even.
13:22Bronsamdrogalis: are you using class as dispatch fn?
13:22hiredmanoh, are you dispatching on the type of a deftype?
13:22mdrogalishiredman: The ns load is in the same file as the defmulti
13:22hiredmanor defrecord or whatever
13:22mdrogalisBronsa: Yeah
13:22mdrogalisRecord, in fact. Yep
13:22mdrogalis... I'm about to learn something new/terrible. D:
13:22Bronsamdrogalis: yeah AOT'ing defmethods with class literals can be problematic
13:22hiredmanthe type in your dispatch has the same name, but is different
13:22Bronsa^
13:22hiredmanthat can happen for a number of reasons
13:23mdrogalisIs there a common resolution or alternate route that I can take? The records are from Component.
13:24ztellmanhiredman: you can do key iteration, but it doesn't keep them in lexicographic order
13:24ztellmanhiredman: so bascially, no
13:24hiredmanztellman: ok, thanks, very cool btw
13:24ztellmanthanks!
13:25hiredmanmdrogalis: well, you can try and figure out how you are ending up with multiple types with that name
13:25hiredmanmdrogalis: for aot projects I believe that often comes down to namespace loading order
13:25mdrogalishiredman: Hmm, okay. That's helpful.
13:26stuartsierramdrogalis: If you're mixing any AOT-compiled code with live reloading at the REPL, all sorts of strange things happen.
13:26mdrogalisI appreciate the insight. Thanks hiredman & Bronsa.
13:26mdrogalisstuartsierra: Pretty much sums up my situation.
13:26stuartsierramdrogalis: No hope, then. Pick one or the other.
13:26technomancyAOT-compiled code is fine as long as it's not records/protocols
13:27mdrogalisstuartsierra: Fair enough.
13:27stuartsierratechnomancy and I have different biases. I blame everything on AOT-compilation; he blames protocols.
13:27BronsaI cannot help but believing that at the core of all those issues there's a bug in how the compiler handles the dynamicclassloader
13:28technomancyhttps://github.com/github/linguist/issues/1721#issuecomment-63344390 <- he claims that the official docs recommend textmate's clojure grammar =(
13:28clgvengblom: your chance to ask hiredman ;)
13:29hiredmanwait, what?
13:29mdrogalistechnomancy: That was some pretty-looking Racket code. Re Twitter
13:30technomancymdrogalis: making an art form of hideous highlighting
13:30Bronsawhat official docs is he talking about?
13:30technomancyBronsa: guessing the wiki
13:32technomancyit's not linked from clojure.org, though sublime somehow is
13:32mdrogalishiredman & stuartsierra: Yeah, seems the defrecord files are loaded twice - once at uberwar compilation time, next at uberwar deployment time inside Tomcat.
13:33mdrogalisSince Ring needs access to the handler var, seems impossible to have it both ways - as stuartsierra said.
13:41engblomWhy is this causing an eternal loop: http://pastebin.com/VD7XDGfR (This is quil.core/mouse-pressed? The documentation is here: http://quil.info/api/input/mouse#mouse-pressed_q
13:41engblomIt should quit looping as soon as the mouse button is released, but it does not.
13:45aperiodicengblom: that value can only be updated outside of your draw loop (a processing applet, hence quil, cannot do anything else while executing your draw fn). once mouse-pressed? is true, you never give it the chance to update the value.
13:47engblomaperiodic: That was bad for me. As I have quil refreshing 30 times/s I catch too many mouse-pressed? When I want only one click, I get 3-4 clicks. I added those lines to make sure it is considering one click as one click.
13:50dgellowHi guys and girls.
13:51dgellowDo you know if the clutch project (clojure lib for couchdb) is still active ?
13:51dgellowAnd if not, what are you using to interface with couch ?
13:52dgellowsorry TimMc, english is not my first language :)
13:52TimMcno worries
13:52metelluswe don't really have a good word to match up with "guy"
13:52aperiodicengblom: pass a callback fn as the value of the :mouse-pressed / :mouse-clicked option to sketch / defsketch http://quil.info/api/environment#sketch
13:52TimMcmetellus: "gals"? *shrug*
13:53metellusvery *shrug*
13:53TimMcheh
13:53joegallofurthermore, since we're getting our jimmies rustled, guy is offensive http://www.etymonline.com/index.php?term=guy&amp;allowed_in_frame=0
13:53technomancyI've always preferred the good old traditional "GREETINGS, HUMANS"
13:53clgvhiredman: engbloom has questions about the clojurebot setup earlier^^
13:54joegallotechnomancy: that's offensive
13:54dgellow"effigy of Guy Fawkes," leader of the Gunpowder Plot to blow up British king and Parliament"
13:54clgv~guards
13:54clojurebotSEIZE HIM!
13:55TimMcjoegallo: I heard no rustling.
13:55TimMcPerhaps you have better ears than I.
13:55metellus~gourds
13:55clojurebotSQUEEZE HIM!
13:55joegalloLOL
13:55clgvlol?
13:58TimMcdgellow: It certainly looks worrying -- no activity in 11 months.
13:59dgellowTimMc: Yeah :(
14:00TimMcMaybe it's complete. :-)
14:03dgellowI cannot make it work in project.
14:03dgellowI just opened an issue here https://github.com/clojure-clutch/clutch/issues/85
14:04dgellowmaybe you have an idea of what I'm doing wrong ?
14:15tmarbleI'm running [cider/cider-nrepl "0.8.0-20141113.231027-33"] + ~/.emacs.d/elpa/cider-20141116.1221/ yet I still get
14:15tmarbleWARNING: The following required nREPL ops are not supported: toggle-trace (??)
14:21danielcomptonmetellus: I prefer folks
14:22danielcomptonbut mammals is a more inclusive term, remember, on the internet no-one knows you're a dog
14:22xemdetiacarbon based meat popsicles
14:22edwping
14:24dbaschdanielcompton: by now that’s been subsumed by “on the internet no one knows anything”
14:24technomancyhaha
14:26edwtmarble: The tracking code was touched recently. Don't know if that may be related.
14:26edws/tracking/tracing/
14:27edwBut I didn't get that error. Consider `rm -rf ~/.m2/repository/cider/cider-nrepl/0.8.0-SNAPSHOT`-ing.
14:27tmarbleedw: I see that in the changelog... What is the best practice here? load *.el from recent github checkout (and hope it matches .m2)?
14:27edwtmarble: I'm using the same version of cider as you are.
14:28tmarbleor use cider from MELPA (and hope it lines up with whatever is in .m2)?
14:28edwtmarble: If you blow it away, you'll get the newest.
14:28tmarbleedw: I did that.. the versions above are latest
14:28sorbo_when I open a file with with-open and call line-seq on the BufferedReader, I get my seq of lines (which I want!). however, I want to preserve whitespace in whitespace-only lines, which clojure compacts to empty string
14:28sorbo_how do I keep whitespace-only lines?
14:29edwtmarble: Huh. Did you happen to `lein clean`? Worth a shot.
14:29sorbo_e.g. a line of 20 spaces comes in as “”
14:29sorbo_rather than “ “
14:30ToxicFrogsorbo_: line-seq is just a really simple wrapper about BufferedReader::readLine()
14:30ToxicFrogSo this sounds like some kind of undocumented "feature" of readLine
14:31stuartsierra,(line-seq (java.io.BufferedReader. (java.io.StringReader. " \n \n \n\n")))
14:31clojurebot(" " " " " " "")
14:31stuartsierraIt's not line-seq.
14:32stuartsierraOr readLine.
14:32amalloysorbo_: it is something else you are doing, like calling trim or something
14:36mwfoglemanengblom: cool! what did you use?
14:38engblommwfogleman: Quil
14:39mwfoglemancan you apply a lein template to an existing project?
14:40ghadishaybanif another bug shows up in #'reduced handling I'm going to jump off a cliff
14:41Bronsaghadishayban: one sec
14:41ghadishaybanoh no
14:41Bronsa, (.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))) 1)
14:41clojurebot#<Reduced@1ddd078: "foo">
14:41Bronsathere
14:41BronsaI just fixed that
14:41ghadishaybani saw
14:41tim__sometimes I wonder if it wouldn't be better to do what Python does, and throw StopIteration()
14:41ghadishaybanwe all thank you Bronsa
14:42ghadishaybanBronsa: btw I implemented a "one-time" reflector last night
14:42Bronsaghadishayban: luckly clojure's reduce apparently doesn't use PersistentList/reduce
14:42tmarbleedw: lein clean did not work, but I removed cider from MELPA and did this instead: (add-to-list 'load-path "/home/tmarble/src/github/clojure-emacs/cider") -- and that worked (no complaints about toggle-trace)
14:42ghadishaybanoh it doesn't?
14:42sorbo_ToxicFrog: nah, no trim
14:42sorbo_that’s the weird thing
14:43sorbo_it’s literally just BufferedReader, followed by a (doall line-seq rdr)
14:43sorbo_since I’ve bound the reader to rdr
14:43sorbo_and the lines come through perfectly, only the all-whitespace ones are just empty string
14:43Bronsaghadishayban: no, it uses the internal-reduce impl
14:43sorbo_not strings of \space
14:43sorbo_hm
14:43dbaschsorbo_: refheap your code?
14:43ghadishaybanBronsa: i see
14:43amalloysorbo_: surely you mean (doall (line-seq rdr)). it's hard to debug if you paste code that isn't actually what you're running
14:44sorbo_amalloy: correct
14:44sorbo_I’ll tinker with it and post a pastebin in a few if I can’t figure out what I’m doing wrong
14:44sorbo_thanks guys
14:44Bronsaghadishayban: I really don't understand why it's neccessary to have CollReduce/InternalReduce/IReduce rather than just one interface and a protocol backing that interface
14:45Bronsait's really hard to understand what reduce impl will be used for a coll
14:45stuartsierraBronsa: Partly it's the evolution of reduce to reducers to transducers.
14:45ghadishaybanBronsa: yeah at first I understood but now it just seems like a poor man's polymorphic inline cache
14:45ghadishaybanBronsa: I'm mentioning it briefly in my conj talk
14:45Bronsastuartsierra: InternalReuce now seems completely unnecessary to me
14:45stuartsierraThe different interfaces have caused a lot of confusion for everyone, even making performance patches harder to implement.
14:46tbaldridgestuartsierra: and last Friday Bronsa pointed out to me that ChunkedSeq.reduce is not IReduce.reduce ....yeah....
14:46Bronsait's even more confusing since a bunch of collections implement IReduce but that impl will never be used by reduce
14:46sorbo_so
14:46ghadishaybanwhat you really want is the callsite cache to be on the caller of reduce, not inside core/reduce
14:46sorbo_the problem is
14:46sorbo_I am dumb
14:46sorbo_fixed it
14:47Bronsatbaldridge: I actually understood the rationale for that, don't remember if I told you about it
14:47sorbo_the whitespace-only lines I imagined were just \ns
14:47sorbo_>_<
14:47sorbo_actually inserting whitespace solved the problem
14:47tbaldridgeBronsa: yeah I get the rationale as well. I just wish there was a better way
14:47stuartsierraLots of things are unnecessary or, in hindsight, misapplied, but "fixing" them would break something else somewhere.
14:47tbaldridgehence the reason for ReduceInit
14:47clojurebotGabh mo leithscéal?
14:48tbaldridgeclojurebot: fail
14:48clojurebotPardon?
14:49ghadishaybanBronsa: https://github.com/ghadishayban/reducers/blob/master/src/ghadi/reducers.clj#L7-L14
14:49stuartsierratbaldridge solved the problem by implementing his own language.
14:49ghadishaybanstuartsierra: lol
14:49Bronsabefore reducers this mess was still there but at least all the implementations were consistent
14:49Bronsanow some implementation handle reduced right, some partially, some don't at all
14:49ghadishaybanBronsa: I've found that macro "helpful" https://github.com/ghadishayban/reducers/blob/master/src/ghadi/reducers.clj#L35-L41
14:50Bronsaghadishayban: 1.7 should have an unreduced function
14:50ghadishaybannot the same thing
14:50Bronsaah, I missed the else arg sorru
14:50Bronsasorry*
14:51Bronsayeah that looks nice
14:51ghadishaybanunreduced is useful for transducers though
14:51BronsaI could actually use that macro for t.a
14:51ghadishaybancrib away
14:51BronsaI just added reduced support to the walking functions and that might help
14:53ghadishaybani very much enjoyed querying the AST using datalog btw
14:53ghadishaybanlots of interesting data there
14:55ghadishaybanBronsa: it is *possible* that the IReduceInit special casing in transduce may be applied to reduce as well, making it more likely to hit the bug that you exposed in PersistentList's .reduce
14:55Bronsaghadishayban: ah yeah, definitely
14:55Bronsaghadishayban: the bug is in the IReduceInit reduce arity
14:55ghadishaybansolution: macros for java
14:56amalloyso wait, what was the bug in IPList/reduce?
14:56ghadishaybanreduced handling, the favorite nemesis
14:56Bronsa,(.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))) 1) ;; amalloy
14:56clojurebot#<Reduced@de04cd: "foo">
14:57Bronsaamalloy: a reduced in the last iteration of a reduce will not be unwrapped
14:57amalloyi see
14:57Bronsawell
14:57Bronsaof a reduce with init
14:57Bronsa,(.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))))
14:57clojurebot"foo"
14:57amalloyand this is only if you use .reduce instead of reduce
14:57amalloyeg because you are java code
14:57amalloyright?
14:58Bronsaamalloy: yes but as ghadishayban just pointed out, transduce uses IReduceInit/reduce directly rather than going through CollReduce/reduce
15:01Bronsastuartsierra: since puredanger's not here, do you happen to know if the clojure/conj talks will be live streamed?
15:06stuartsierraBronsa: I don't know for certain, but I very much doubt it. Live streaming is expensive.
15:08TimMcand difficult
15:09danielcompton,(require '[test.check.generators :as gen]
15:09clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
15:09danielcompton,(require '[test.check.generators :as gen])
15:09clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate test/check/generators__init.class or test/check/generators.clj on classpath.>
15:09danielcomptonworth a try
15:10danielcomptonI've got some interesting behaviour with test.check and I'm not sure if it's a bug or feature
15:10ghadishaybanBronsa: so I have a commit that makes (fn [x a] (.concat x a)) only reflect the first time through the function
15:10danielcompton(last (sort (gen/sample gen/s-pos-int 1000000))) returns 100, i.e. the largest int generated in 10 million runs is 100. I expected it to grow larger and larger over time
15:11ghadishaybanBronsa: uses invokedynamic to rewrite the callsite. surprisingly not hard to write. haven't accounted for re-linking it when the target class changes, but it is almost trivial
15:11Bronsaghadishayban: nice
15:11ghadishaybanBronsa: I also got rid of the ILookupThunk stuff for KeywordInvokes
15:11ghadishaybanBronsa: and instead install a guard on the Record's class, and a direct MethodHandle field access to the particular field
15:12Bronsaghadishayban: how about the protocol-fn callsites?
15:12Bronsaare the caches there still necessary or can they be avoided?
15:13ghadishaybanthe static field caches can go away, it's all encapsulated in the CallSite
15:13ghadishaybanI have an implementation I made a few months ago for protocol-fn callsite, mimics the callsite caching that is there in the current compiler
15:13ghadishaybanBut I think I can improve upon it...just not enough time
15:13BronsaI can relate to that :)
15:15akkadis there an easy way to compare two jars for differences in code?
15:16edwtmarble: That is odd. But all's well that ends well. Also, insert obligatory warning against using non-stable MELPA. (A warning I do not heed myself.)
15:17ghadishaybanBronsa: one thing I have been thinking about recently is a reified callframe
15:18ghadishaybanBronsa: like if all invokes took a Scope/Frame object before the args. Would almost certainly be slow, but it would allow things like a "tracing" mode
15:18danielcomptonakkad: you could unpack them and diff the folders?
15:18ghadishaybanactually there are probably ways to achieve tracing without having the arg everywhere
15:19Bronsaghadishayban: that would be a major ABI change
15:19ghadishaybansure would
15:19Bronsa*breaking change
15:19ghadishaybanso far everything I have done is compatible
15:20weiany thoughts on freactive so far?
15:20ghadishaybanbut there are some interesting designs that are possible if not restricted by ABI
15:20akkaddanielcompton: that's what I did
15:20danielcomptonakkad: did it work?
15:21ghadishaybanBronsa: for example IReduceInit / CollReduce can really be seen as part of the same protocol
15:22ghadishaybanBronsa: and if you had protocols at the bottom of the impl, funny-business like seqFrom could disappear and possibly be optimized https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L490-L501
15:22Bronsaright
15:24ghadishaybaninlining across function boundaries/HOFs is a problem that if solved could enable a much bigger jump in performance than a few yak-shaves here or there
15:24ghadishaybanThis is a preview of my talk on thursday
15:25ghadishaybanI have no solutions, btw
15:25Bronsa[spoilers]
15:25ghadishaybanheh
15:25BronsaI look forward to seeing a recording of your talk
15:30danielcomptonI'm trying to translate this Java algorithm to Clojure to count the number of high bits in a Long: http://stackoverflow.com/a/109025/826486. I've got it working for input below 256, but it doesn't work above that. I've got a naive working version, and the full algorithm at https://www.refheap.com/93523. Can anyone see what I'm doing wrong?
15:32amalloydanielcompton: by "high bits" you mean bits which are 1? i thought you meant leading 1s
15:32ghadishaybanInteger/bitCount + a mask is the shitty answer
15:33amalloyis there a reason you're not just using (Long/bitCount x)?
15:33ghadishaybanamalloy: jinx
15:33danielcomptonamalloy: yeah, bits that are on. I thought that was what high bit meant but looking now I was wrong
15:34amalloyghadishayban: i'm curious what bitmask you think is useful here
15:34amalloyif we're already using bitCount
15:34ghadishaybanwhatever high bits mean
15:34ghadishaybanmaybe i don't follow
15:35danielcomptonLong/bitCount is the answer here
15:35dbaschghadishayban: he means “set bits"
15:35danielcomptoncertainly easier than trying to read the bit shifting algorithm
15:36dbaschdanielcompton: TIL http://kent-vandervelden.blogspot.com/2009/10/counting-bits-population-count-and.html
15:36ghadishaybanthe JVM will intrinsify it too
15:36ghadishaybanPOPCNT instruction i think
15:36danielcomptonlooks like Java does something similar under the covers: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Long.java#Long.bitCount%28long%29
15:38dbaschdanielcompton: and by default it uses the cpu instruction in recent versions if available
15:38danielcomptondbasch: thanks, that was really interesting
15:39ghadishaybanit's part of the secret sauce to persistent hashmaps
15:39ghadishaybanmakes them fast
15:41danielcomptonghadishayban: interesting https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L752
15:53danielcomptonWow Long/bitCount takes 2 nanoseconds vs my naive version taking 100 milliseconds
15:55danielcomptonThe bitshifting version took 50 ns but wasn't giving correct results so it's not particularly useful
15:56danielcomptonamalloy: I guess that makes you a 1000x programmer then?
15:58amalloyis that some kind of standard term? i don't think i'm a thousand people. if you're comparing speeds, i have to complain that i'm getting the short end of the stick: i sped up your program by a factor of 50,000!
15:58xemdetia_it's a logarithmic person scale
16:03dbaschdanielcompton: curious how you’re measuring the speed of Long/bitCount
16:03danielcomptondbasch: criterium
16:04danielcomptonamalloy: Well I can't pay you 50,000x so 1,000x will have to do
16:04danielcomptondbasch: I thought that would be the right way to get it optimised fully?
16:05kenrestivoit just occurred to me how much adding a new library to a project.clj :dependencies is like building a house of cards. you just never know which one will cause the whole thing to fall over.
16:05danielcomptonkenrestivo: usually it's the one you just added :)
16:05kenrestivoright, just like a house of cards. here goes..... WIN! or... here goes... AAWWWW...
16:06amalloykenrestivo: prophecies foretell of a man who can finally solve the problem of Dependency Hell for all programming languages. he will usher us into a new era of enlightenment
16:06kenrestivowho says it'll be a man? but yeah, it's a Hard Problem.
16:07amalloykenrestivo: it's true, i could have made it more gender-neutral. but it was tricky to work out the "he" in the second sentence, and plus prophecies are historically sexist anyway?
16:07joegalloindeed, not a man, but a god
16:08danielcomptonI'd really like to see a Clojure take on OSGI
16:08danielcomptonI know Clojure OSGI exists (and the person who wrote it) but it doesn't seem *simple* to me
16:08danielcompton(inc talios)
16:08lazybot⇒ 3
16:09bjaA man once solved dependency hell, but his black art of static linkage was abhorrent to all those who witnessed it.
16:09dbaschwhat is the right pronoun for an AI?
16:09amalloydbasch: lord and master
16:09danielcompton$google roko's basilisk
16:09lazybot[Roko's basilisk - RationalWiki] http://rationalwiki.org/wiki/Roko's_basilisk
16:10danielcomptonRoko's basilisk is still in my top 5 funniest things on the internet
16:10hyPiRiondbasch: they, unless they identify with something
16:10hyPiRiondon't think they've come that far yet
16:10bjahyPiRion: #ai #otherkin?
16:11bjasorry, was wasting time on tumblr today
16:12amalloydanielcompton: that is pretty entertaining
16:12metellusdbasch: only for versions of the singularity that are similar to roko's basilisk
16:13dbaschreading now
16:30mskoudhaving a 2d vector [[0 0 0 0][0 0 0 0]...] im looking for a way to create a rectangle fx [[0 1 1 0][0 1 1 0]...]. I can use assoc-in to update individual positions but how do i make a function to make a comple rectangle. (defn make-rect [2dvector offsetx offsety width height] ?)?
16:31amalloymskoud: 2dvector isn't actually a legal name
16:31anneliesThat's a vector of vectors, not a 2D vector.
16:31mskoudno sorry, lets call it d2vector.
16:32amalloyannelies: that seems like even less useful nitpicking than mine
16:32mskoudthe problem is i need to assoc-in multiple times using the result from the prev assoc-in in the next assoc-in...
16:33amalloymskoud: one approach would be to use offset/width to produce a sequence of [x y] pairs, and then reduce over them using assoc-in
16:33amalloyreduce is exactly the pattern fo "do X multiple times, using the result of the previous call to X"
16:33dbaschmskoud: what do you need the original vector for?
16:33mskoudi dont need the org vector, just the result.
16:34mskoudill look into a solution with reduce. Thanks.
16:35dbaschmskoud: but then you want padding?
16:35{blake}I'm running Eastwood and it's telling me I'm using the wrong arity (for hiccup.form/submit-button, says there should be two parms [attr-map? text], when there's only one [text] that I can see. Also the code works. Should I care?
16:36amalloy{blake}: it sounds like eastwood inspects the :arglists of functions you call, and expects those to reflect what args they actually take
16:36amalloywhereas hiccup fabricates its own arglists. i certainly wouldn't care about that warning
16:36mskouddbasch: no padding, the 2d vector is just initialised with 0, and (make-rect 1 1 2 2) place a rect inside the 2d-vector at a given position.
16:38dbaschmskoud: so you want ((0 0 0) (0 1 1) (0 1 1)) ?
16:38{blake}amalloy: I think I understand those words. But if I look at hiccup.form, I see the one-arity version. So where does the two-arity version come from?
16:38mskoudyes, but the 2d vector may be larger
16:39dbaschmskoud: the “outer” vector is fixed?
16:39dbaschouter rectangle I mean
16:39mskoudyes
16:39{blake}amalloy: OH, wait! Nevermind, I got it. Thanks.
16:39{blake}(inc amalloy)
16:39lazybot⇒ 191
16:39amalloy{blake}: you're sure submit-button is the function it's warning about?
16:40{blake}"Function on var #'hiccup.form/submit-button called with 1 args, but it is only known to take one of the following args: [attr-map? text]"
16:40{blake}Is the exact text.
16:40{blake}But I see now I'm calling it sometimes with one parm, sometimes with two. Which...huh.
16:40amalloyhuh. well, i'm a bit puzzled. it sounds like you figured it out; what was going on?
16:41{blake}hang on...
16:43amalloy{blake}: i think you have an older version of hiccup somewhere, because it used to be that submit-button was defined via defelem, which included an optional attr-map
16:43amalloysearch for "defelem" on https://github.com/jonase/eastwood, for example
16:43{blake}amalloy: Yes. That is how submit-button is defined.
16:44amalloy{blake}: it's not anymore
16:44{blake}amalloy: I wonder if it's a cursive thing. The code IS working.
16:44amalloyoh, nm
16:44amalloyyes it is
16:45{blake}amalloy: OK, so I'm not crazy. (At least this isn't evidence of same.)
16:45{blake}amalloy: Why is passing two parameters working? Macro magic?
16:45amalloy{blake}: tldr: submit-button adds support for an optional attr-map, by accepting any number of args, and lies about how it works by producing a fake :arglists entry; this confuses eastwood and is a known issue
16:46amalloy(defelem submit-buttom "" [text] ...) expands to something like (defn ^{:arglists [attr-map? text]} submit-button [& args] (let [[attrs text] (magic args)] ...))
16:47{blake}amalloy: Right. I got it now. Lies...all is lies.
16:47amalloyyep
16:48{blake}And that's cool, man.
16:49mgaarelisp's parens are like Zuckerberg's hoodie
16:49justin_smithit's a signifier that we are all douchebags?
16:49justin_smithunpeet: stop spamming
16:49justin_smithtechnomancy: ^^^
16:51mgaaresimple syntax means you don't waste energy on low-value syntax decisions (unlike, say, Scala). Zuckberberg wears the same hoodie every day so he doesn't have to waste energy on thinking about clothes
16:51mi6x3mhey, can anyone recommend a templating library for clojure code itself?
16:55dbaschmgaare: he probably likes to wear hoodies, and came up with an ok rationalization for his taste (unlike the lisp syntax which is indeed awesome)
16:55SagiCZ1is there any variant of sort function that returns lazy sequence? i guess that makes no sense huh..
16:56dbaschmgaare: I don’t like to worry about clothes so I live in a portable cardboard box
16:56tuftSagiCZ1: if you make one sell it for $10e6 =)
16:56dbaschI also don’t waste time leaving the house because I take it with me
16:57mgaaredbasch: could substitue Steve Jobs's turtleneck for Zuck's hoodie and have the same effect
16:57SagiCZ1tuft: but there are some algorithms that can sort by batches and then merge them or something..
16:57dbaschmgaare: or randomly grab whatever is clean, which is what most of us do
16:58joegalloone could write a lazy version of a selection sort... but why would you...
16:59SagiCZ1joegallo: what if you cant fit the collection you want to sort in memory..
17:00SagiCZ1*what if you cant fit the collection in memory
17:00joegalloexternal merge sort
17:00amalloyit's certainly not impossible to write a lazy version of a mergesort. haskell does it in like one line
17:01anneliesPerl probably does it in five characters.
17:01amalloybut it's not a good solution to "too big to fit in memory"
17:01SagiCZ1amalloy: so did the author get $10e6?
17:01mi6x3many way to get a namespace from a symbol?
17:01amalloy&(doc find-ns)
17:01lazybot⇒ "([sym]); Returns the namespace named by the symbol or nil if it doesn't exist."
17:02mi6x3mthanks amalloy
17:02dbaschSagiCZ1: https://github.com/chrismgray/clojure-heap-sort
17:02mi6x3myou need an inc, i'll give you an inc
17:02dbasch(haven’t looked at it, but read the blog post)
17:02mi6x3m(inc amalloy)
17:02lazybot⇒ 192
17:02SagiCZ1dbasch: thanks
17:02tuftmi6x3m: you can get them from var metadata too if it's not a symbol literal in code you're working with
17:02dbaschwow, amalloy is only 8 karma from his second life-sized cardboard cutout of rich hickey
17:03technomancy(inc dbasch)
17:03lazybot⇒ 17
17:03amalloydbasch: i've been dying to get a picture of the two of them high-fiving each other
17:04dbaschamalloy: (concat hickey-cutout (reverse hickey-cutout))
17:04dbaschthat would work better if it were a sequence of legos or something
17:04mearnshhaha
17:05justin_smithdbasch: that sounds like paper dolls to me
17:15gfredericksdoes anybody know why nrepl uses an atom to hold the session?
17:17dbaschgfredericks: because it’s the obvious way to do it?
17:17gfredericksI don't know of any case where it's mutated
17:18gfredericksby "the session" I mean the map of dynamic vars to their values
17:20gfrederickshmmm; looks sticky
17:20gfredericksI just want to sit down for a week and refactor nrepl
17:20danielcomptonIs there any way to destructure anonymous function literals? i.e. #()'s
17:21amalloydanielcompton: do you mean, destructure the arguments to them? destructuring a function itself is such a wrong question i almost fell out of my chair
17:21dbaschamalloy: danielcompton surely meant “deconstruct” as in Derrida
17:21danielcomptonamalloy: yes destructuring the args. Not sure how to destructure a function
17:21{blake}post-modern programming
17:22amalloydanielcompton: no. if you need to do anything at all complicated in a #() function, just use a real (fn []) lambda instead
17:22danielcomptonamalloy_: thought that was the case but I'd try and ask anyway. It's not an easy thing to google for
17:26danielcompton(inc amalloy)
17:26lazybot⇒ 193
17:27danielcomptongetting closer...
17:30anneliesI want to write an AWK-like library for Clojure.
17:30anneliesI love AWK and I love Clojure.
17:32justin_smithannelies: cool
17:32justin_smithannelies: I was thinking an expect tool for clojure would be neat
17:32justin_smithspeaking of text streaming / text processing madness
17:32TimMcyak streaming
17:33justin_smithannelies: you could call it boston-clock
17:33justin_smithaka clawk
17:33mi6x3mannelies: do you love popcorn?
17:33anneliesNo, it always gets between my teeth and takes ages to get it out.
17:33anneliesAnd it doesn't taste very well either.
17:33mi6x3mthen don't write a popcorn library for clojure
17:33anneliesSo it'd be near grapefruit if it were a fruit.
17:34mi6x3manyone knows a templating library for clojure source?
17:34joegallothat is, creating more clojure source from templates where you'll fill in the blanks in the clojure source?
17:35danielcomptonmi6x3m: lein templates?
17:35danielcomptonmi6x3m: what are you trying to do with it?
17:35mi6x3mdefine a template, specify variables through clojure code
17:35mi6x3mand get clojure code as string
17:36joegallothat's macros and, well, normal clojure...
17:36mi6x3mI need it formatted though
17:36danielcomptonmi6x3m: use a pretty printer?
17:36joegalloclojure.pprint/pprint does a decent enough job
17:36mi6x3mnot in this case, anyhow, time for bed :)
17:38anneliesSomething like this: https://gist.github.com/rightfold/1fe7b754a2d0248e1cfb
17:44anneliesBut generalised to work in any kind of sequence, not just with strings.
17:45arrdema good text munging lib would be nice to have
17:46dbascharrdem: what things would you want to do with a text munging lib? I’ve done a fair amount of text munging in various places but haven’t shared most of it
17:47arrdemdbasch: that's a legitimate question and I don't have a good answer
17:48arrdemthe text munging tools I've built for myself are stuff like paragraph/block detection and indentation/unindentation
17:50bobpoekertarrdem: does instaparse maybe do what you want?
17:50technomancyinstagrammar
17:50anneliesinstagram
17:50arrdemdoes Instaparse support context sensitive grammars? I don't think it does..
17:51arrdemshould set up a repo that's just Instaparse grammars for known PLs
17:51arrdemit'd be fun
17:51bobpoekertI think it supports PEG
17:51arrdemwant to parse $OTHER_PLEB_LANGUAGE? we have a library for that..
17:52bobpoekertyou could probably write a shim around IntelliJ's plugin architecture
17:52bobpoekertor eclipse
17:52bobpoekertpeople have already written intellij and eclipse plugins for pretty much everything
17:53bobpoekertwouldn't be as clean but it'd be hecka less work
17:56anneliesNot for Eiffel. :(
17:57bobpoekertaww
18:32danielszmulewiczI don't understand following leiningen behavior. If I put the following line in my project.clj :production {:dependencies [[org.clojure/tools.nrepl "0.2.5"]]}, and then run `lein with-profile production uberjar`, I am getting the following error java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class
18:32danielszmulewicz
18:33panther_Clojure's Fast! :D
18:33danielszmulewiczThe only way to get it to produce the uberjar is with the dependency defined in the base dependencies.
18:34danielszmulewiczIn other words, can't I have production specific dependencies with leiningen?
18:35technomancydanielszmulewicz: someone opened a bug about a problem specific to tools.nrepl; this might be that. does it occur with other deps too?
18:35danielszmulewicztechnomancy: I don't know. I can try.
18:37danielszmulewicztechnomancy: Yes! It looks like Ddpendencies are not picked up when set in production.
18:38technomancydanielszmulewicz: on 2.5.0?
18:39danielszmulewiczcorrect.
18:39technomancycan you open an issue?
18:39danielszmulewiczSure.
18:39jkjearlier i hit a problem with lein compiling the aot classes only for uberjar... though i made the profiles exactly the same
18:39jkjdidn't find any uberjar magic in code though, so i gave up and blamed sunspots
18:42technomancyuberjar strips out the default profiles, probably in a way that's subtly wrong
18:47{blake}Config info. How to load/store in Clojure. Atom?
18:48akurilinHas anybody ever attempted to turn results of large joins into distinct sets of values once they make it back to clojure? e.g. you select * join tables foo and bar, and when you parse the results you split them into [foos] and [bars] ?
19:42justin_smithakurilin: yes, caribou does this extensively
19:43justin_smithin fact building trees
19:43justin_smith(unless I misunderstand you)
20:20mmitchellhow can i add simple annotation to a gen-class? The java equivalent is simply @Stage -- I'm trying this in my gen-class, but not working: :name ^{java.lang.annotation.Target [com.foo.Stage]} classNameHere
20:29raspasov_hey guys, I'm trying to run lein autoexpect but I'm getting Exception in thread "main" java.lang.AssertionError: Assert failed: (vector? (:dependencies project []))
20:30dbaschraspasov_: sounds like your project.clj is incorrect
20:30raspasov_the non auto-refresh command "lein expectations" compiles fine
20:30raspasov_but as long as I add [lein-autoexpect "1.4.0"]
20:30raspasov_to :plugins
20:30raspasov_it errors
20:31amalloyit sounds like the :dependencies in your project are wrong
20:31dbaschpaste your project.clj somewhere
20:32raspasov_https://gist.github.com/raspasov/78d79ba54278d9a28168
20:33raspasov_I've been dealing with a bunch of project.clj files in the last 1.5 years - I don't see any apparent problem (my project compiles fine otherwise)
20:33raspasov_it's just that "lein autoexpect" fails
20:35danielcomptonraspasov_: so it compiles with autoexpect in, you just can't run lein autoexpect?
20:35raspasov_yes
20:36danielcomptonraspasov_: can you past the full stacktrace somewhere?
20:36danielcomptonpaste
20:37raspasov_https://gist.github.com/raspasov/9c7fda31d0c6cf7dfc3f
20:39amalloyraspasov_: lein-environ looks suspicious
20:39amalloyusing lein-jacker, and depending on clojure 1.2.1, makes me think it is super old
20:39raspasov_hm I think it's out of date
20:39raspasov_thanks for the hint - let me try upgrading it!
20:47dbaschraspasov_: it’s actually lein-protobuf
20:47raspasov_yes I just found that
20:48raspasov_by removing lein-protobuf it seems to work
20:49amalloydbasch: welllll, whether it is an issue with lein-protobuf or with leinjacker depends on the lein spec
20:50amalloylein-protobuf converts (rather pointlessly, but that's neither here nor there) :dependencies into a lazy seq rather than a vector, and leinjacker throws up if it finds a non-vector. who is at fault?
20:50danielcomptonamalloy: both
20:50dbaschamalloy: lein-protobuf is bringing in an old version of leinjacker, that’s what I meant by “is” :)
20:51amalloydbasch: whaaaaaat. i barely touched lein-protobuf, but i didn't think we used leinjacker
20:51danielcomptonleinjacker should be checking for sequential? instead of vector?
20:51amalloydanielcompton: the newer version in fact does that
20:51amalloyhttps://github.com/sattvik/leinjacker/commit/a2d631915a2f3adc3f0c68833ceaa72d139a91a1 suggests
20:51dbaschPossibly confusing dependencies found:
20:51dbasch[lein-protobuf "0.4.1"] -> [leinjacker "0.4.0"]
20:51amalloyas of two friggin years ago
20:51amalloyman, it totally does, dbasch. that is so gross
20:52amalloyi guess it must have made sense two years ago, during the lein2 revolution
20:52danielcomptonmaybe lein autoexpect is at fault for messing with the deps in the first place?
20:53amalloydanielcompton: i believe i've heard technomancy say that messing with deps in a plugin basically always breaks things. otoh, a lot of plugins do it, so i dunno
20:53danielcomptonhttps://github.com/jakemcc/lein-autoexpect/blob/master/autoexpect/src/leiningen/autoexpect.clj#L10-L11 seems unnecessary if the user added them at install time
20:53raspasov_yea I found some other unrelated github issues around this (vector?) checking
20:54mmitchellugh, i've tried everything I can think of. If anyone could give me a tip on how to add an annotation to a class via gen-class, it would make my week.
20:54danielcomptontalios: ?
20:54talioshullo
20:55danielcomptontalios: can you help mmitchell? You're pretty clued up about that kind of stuff
20:55raspasov_so any idea if I can fix this on the fly? :)
20:55danielcomptonraspasov_: the solution to plugins messing with your dependencies is to write your own plugin to put the dependencies back together
20:56taliosmmm, annotations - lets think. annotation on the _actual_ class?
20:56taliosi.e. @Foo public class xxxx {}
20:56talioshrm - not sure if clojure actually lets you do that - hrm
20:57raspasov_danielcompton: any way I can maybe bump up the lein-protobuf dependency to leinjacker 0.4.2
20:57raspasov_I think this might fix it
20:57dbaschtalios: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/genclass/examples.clj#L34
20:57raspasov_(but not sure)
20:57mmitchel_sorry lost my connection there. Did I miss anything? :)
20:58dbaschmmitchel_: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/genclass/examples.clj#L34
20:59taliosah you can do it from (gen-class - not :gen-class on the NS - keep forgetting their's the alternative
21:00mmitchelldbasch: thanks, will have a look!
21:01mmitchelldbasch: ok so it's just metadata on the class name?
21:02danielcomptonraspasov_: you could try adding leinjacker "0.4.2" to your dependencies, I'm not sure if that will be included. I would guess not because it's being evaluated in leiningen, not your project
21:02danielcomptonthough
21:02raspasov_ok thanks! I'll give it a shot
21:02dbaschmmitchell: haven’t tried it but I assume that test passes
21:14QPrgrmhello baby
21:15QPrgrm==bby
21:34seancorfielddakrone: I had some code using clj-http 0.6.3 that POSTed JPG images to a server - I updated to 1.0.1 and the POSTs no longer work: the POSTed data is no longer a valid image... I've dug through the commit history but don't seem anything obvious that I need to change in my code :(
21:39raspasov_btw guys I bumped up the leinjacker dependency on lein-protobuf to 0.4.2 and now lein-autoexpect seems to work
21:40raspasov_sent in this pull request as well https://github.com/ninjudd/lein-protobuf/pull/10/commits
21:45akurilinjustin_smith: which part of caribou can I find that in?
21:55danielszmulewiczjava.lang.StackOverflowError, compiling clojurescript on one machine. No problem on another.
21:59justin_smithakurilin: caribou.model does that sort of stuff
22:00greenyouseanyone know how to use .lein-classpath for testing leiningen plugins? (to avoid "lein install")
22:02akurilinjustin_smith: wow that's a big ass library
22:02akurilinwhat exactly is caribou again?
22:09justin_smithakurilin: it was developed as a RAD system for webapps
22:09justin_smithakurilin: a replacement for RoR kind of stuff
22:23akurilinjustin_smith: googling for RAD system is totally not what I expected to find
22:23justin_smithhah
22:23akurilinjustin_smith: so ActiveRecord-style ORM?
22:23justin_smithkind of
22:23justin_smithyeah
22:23justin_smithbasically data models defined in clojure edn
22:24justin_smithand that is translated to sql db
22:24justin_smithwith a web based admin for defining said models, and making entries
22:24justin_smithand specific webapp stuff like creating pages and assigning controllers / actions / templates via point and click
22:25justin_smiththe system reads all the page definitions from the db, and turns it into a running app
22:42akurilininteresting
22:42akurilinthat sounds pretty cool
22:43akurilindefininetly and impressive amount of work went into that
22:44justin_smithheh, yeah
22:44justin_smithit was my first clojure project, but I just came in to help a friend
22:45justin_smithmany things I would do differently today (as with him, I am sure)
22:45justin_smithit's less active since the company laid us off and stopped using clojure (for client reasons)
22:45csd_Why does the idiom (when (= (loop (recur)) :continue)) work? Best as I can tell, it works with any keyword. This doesn't appear to be mentioned in the docs.
22:46justin_smithcsd_: wait, that looks wrong
22:46justin_smith(loop (recur)) is not valid
22:47csd_thats truncated
22:47justin_smithOK, I just don't even get what it's truncated from
22:47csd_or abbreviated rather
22:48csd_http://pastebin.com/tqj9r6Ac
22:49csd_i found the idiom searching for how to nest loop statements
22:49justin_smith(when (= :anything) :continue) is absurd
22:49justin_smithit always returns continue
22:49justin_smitherr sorry
22:49justin_smiththat's not what it is
22:49csd_the :continue is within the =
22:50justin_smith(when (= x y) :continue)
22:50justin_smithright
22:50justin_smithoh, shit
22:50justin_smith(when (= x continue))
22:50justin_smithis silly - it always returns nil
22:50justin_smithand the when does nothing, it may as well be do
22:50justin_smithor not be there
22:51csd_oh i think i see
22:51justin_smithit's actually very odd code, to my eye
22:51csd_the code within is being evaluated for its side effects, and so it doesnt matter of the test is false because it still gets evaluated
22:51justin_smithright, the when does nothing
22:52csd_its from http://rosettacode.org/wiki/Loops/Nested#Clojure
22:52justin_smiththe return value of = is not making any difference
22:52csd_I was just lucky that it happened to work for my purposes
22:52justin_smithhehe
22:52justin_smithyeah, that is weird code
22:52csd_I think its just there to prevent clojure complaining about the second recur statement
22:52andyfi haven?t seen this code, but if the condition of the when is false, the forms in its body will not be executed, side effects or not
22:53justin_smithcsd_: ? why would multiple recur statements even matter?
22:53justin_smithandyf: empty body
22:53csd_i was getting an error about tail recursion earlier
22:53justin_smithit's a when that only has the condition part
22:53justin_smithcsd_: the when macro is not going to make a difference there
22:53csd_oh interesting
22:54justin_smithOK, in print-matrix, there is actually a body in both the when blocks
22:54justin_smithso that makes more sense
22:54justin_smithit's still just common lisp that someone is trying to make clojury
22:54justin_smithit's not really clojure per se
22:54justin_smithI mean it's technically valid...
22:54justin_smithbut it's common lisp code
22:55andyfsee the code now in csd_'s paste. The loop looks like it always returns nil, so the (= (loop ...) :continue) will always be false.
22:55justin_smithandyf: but it doesn't matter
22:55justin_smithbecause there is no body
22:55justin_smithand yeah, it will not return :continue
22:55andyfright. So you can remove the outer when, leaving only the loop, and it should do exaclty the same thing.
22:55justin_smithexactly
22:56justin_smithalso, the nested when in the rosetta code is silly
22:56csd_ok you're right that does work
22:57justin_smith,(= (for [x (range 10) y (range 10)] [x y]) (for [x (range 10)] (for [y (range 10)] [x y])))
22:57clojurebotfalse
22:57andyfThe rosetta code actually can return :continue from the inner loop, though, so it can make a difference in the overall behavior.
22:57justin_smitherr
22:58andyfI'm not saying that I know what the rosetta code is trying to do yet, or how I might write code to achieve the same effect, but at least the comparison to :continue is not always false.
22:58justin_smithahh, now I see what it was doing
22:58justin_smithandyf: yeah, true that
23:10fairuzjustin_smith: hey. I'm still confused about yesterday :(
23:12justin_smithOK...
23:12fairuzI come out with this edn. http://pastebin.com/WhMWdsYU
23:13fairuzStill confused on how to pass the reference to link them
23:16justin_smith,(def edn '{:create [{:ref ct1 :node { :label "BrandType" :name "type A" :desc "This is a description"}} {:ref ct2 :node { :label "BrandType" :name "type B" :desc "This is a description"}} {:ref ct3 :node { :label "BrandType" :name "type C" :desc "This is a description"}}] :link [{:ref ctl1 :label "BrankLink" :name "isLinkedTo" :nodeA ct1 :nodeB ct2} {:ref ctl2 :label "BrankLink" :name "isLinkedTo" :nodeA ct1 :nodeB ct3} {:ref ctl3
23:16justin_smith:label "BrankLink" :name "isLinkedTo" :nodeA ct2 :nodeB ct3}]})
23:16clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
23:16justin_smitherr oops
23:16justin_smithtoo verbose for irc
23:18justin_smithfairuz: so does the graph api take identifiers when making a retrieval or link call?
23:19fairuzFor link call yes
23:19fairuzwe will get the indentifier when doing retrieval or creating new nodes
23:20justin_smithso you may want something like (map (fn [[n [d]]] (insert n d) n) (group-by :ref (:create edn))) - that will do all the inserts, and then return all symbols inserted
23:20justin_smithoh, the insert returns you identifier...
23:20fairuzyep
23:21fairuzSo basically the map in :create should gives me the list of identifiers that I can use in :link
23:21justin_smithso you may want something like (map (fn [[n [d]]] [n (insert n d)]) (group-by :ref (:create edn))) - that sill insert each item, and then return a vector containing the :ref key and the identifier as a pair
23:21justin_smithif you wrap that in (into {} ...) you get a hash map, from :ref key, to the indentifier that was inserted for that key
23:22justin_smiththen you can use a lookup
23:23justin_smith(def edn '{:create [{:ref ct1 :node { :label "brtp" :name "type A" :desc "This is a description"}} {:ref ct2 :node { :label "brtp" :name "type B" :desc "This is a description"}} {:ref ct3 :node { :label "brtp" :name "type C" :desc "This is a description"}}] :link [{:ref ctl1 :label "BrankLink" :name "to" :nodeA ct1 :nodeB ct2} {:ref ctl2 :label "BrankLink" :name "to" :nodeA ct1 :nodeB ct3} {:ref ctl3 :label "BrankLink" :name "to" :no
23:23justin_smithct2 :nodeB ct3}]})
23:23justin_smithman, still too long
23:23justin_smith,(def edn '{:create [{:ref ct1 :node { :label "brtp" :name "type A" :desc "This is a description"}} {:ref ct2 :node { :label "brtp" :name "type B" :desc ""}} {:ref ct3 :node { :label "brtp" :name "type C"}}] :link [{:ref ctl1 :label "BrankLink" :name "to" :nodeA ct1 :nodeB ct2} {:ref ctl2 :label "BrankLink" :name "to" :nodeA ct1 :nodeB ct3} {:ref ctl3 :label "BrankLink" :name "to" :nodeA ct2 :nodeB ct3}]})
23:23clojurebot#'sandbox/edn
23:24justin_smith,(into {} (map (fn [[n [d]]] [n (hash d)]) (group-by :ref (:create edn))))
23:24clojurebot{ct1 1330914623, ct2 -568547736, ct3 -302159458}
23:24justin_smiththat's pretending that "hash" is the function that returns you identifier
23:25justin_smithnow you can use that map to lookup id from key, right?
23:26fairuzyep!
23:26fairuzneed some time to digest and test :)
23:26justin_smithyou can do a doseq (or if you consume the results, a map) to create links
23:26justin_smithright
23:26justin_smiththat destructuring is a bit funky to be sure
23:27justin_smith[[n [d]]] is taking a hash-entry [k v] and extracting the key, calling it n, and then getting the first entry of the value, calling that first entry v
23:28fairuz*in my mind* whattttt
23:28fairuz:)
23:29justin_smith,(let [[[n [d]]] '(a '(b c d))] {:n n :d d})
23:29clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Symbol>
23:29justin_smitherr
23:29justin_smith,(let [[n [d]] '(a '(b c d))] {:n n :d d})
23:29clojurebot{:n a, :d quote}
23:29justin_smiththere we go (and oops
23:29justin_smith)
23:29justin_smith,(let [[n [d]] '(a (b c d))] {:n n :d d})
23:29clojurebot{:n a, :d b}
23:29justin_smithmaybe that helps?
23:35fairuzhmm, I'm not getting the last one
23:37arrdembesides exist, what do the Clojure docs not do for you?
23:38arrdemsearch I suspect is gonna be the big one
23:40justin_smith,(let [[n [d]] '(a (b))] {:n n :d d}); fairuz - what about this?
23:40clojurebot{:n a, :d b}