#clojure log - Nov 17 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:08 justin_smith: danielcompton: yeah, that's a pain - I guess you could post a bug report for each one :)

0:09 danielcompton: justin_smith: each REPL environment or each library?

0:09 cfleming: danielcompton: Cursive actually does this when AOT compiling, but fiddling with the output of people's REPLs is a sensitive topic :)

0:10 justin_smith: danielcompton: each library

0:10 cfleming: justin_smith: It should be possible to hide them in the REPL I think.

0:11 justin_smith: sure :) I was being somewhat glib

0:12 cfleming: Hehe, sorry, that got lost in IRC static :)

0:15 arrdem: yay http://conj.io unbroken!

0:15 danielcompton: arrdem: new grimoire home?

0:16 arrdem: danielcompton: well the both point to the same VM :P

0:16 but yeah

0:16 danielcompton: arrdem: how about http://conj.it

0:16 ghadishayban: working on reflection "linking" right now, hope i can get it working before the conj

0:16 arrdem: lol

0:16 Jaood: arrdem: at first I though you were linking to a clojure conference ;)

0:17 arrdem: ghadishayban: we're finally online at once :P

0:17 danielcompton: or http://putamapon.it

0:17 ghadishayban: i.e. only incur reflection once

0:17 arrdem: ghadishayban: TL;DR no Oxcart never did actual function inlining itself

0:17 danielcompton: ghadishayban: how can you only reflect once?

0:17 arrdem: ghadishayban: the most I ever got working was static method/arity linking.

0:17 justin_smith: ghadishayban: oh, nice, self-modifying reflection :)

0:17 ghadishayban: danielcompton: rewrite the callsite with invokedynamic

0:18 justin_smith: that is nicely meta

0:41 danielcompton: what's a clojure programmers favourite song?

0:42 https://www.youtube.com/watch?v=R_uwZZB5Yv0

0:42 fn pig, aka fan pig

0:59 arrdem:

0:59 &';

0:59 lazybot: ⇒ ;

0:59 arrdem:

0:59 &:;

0:59 lazybot: ⇒ :;

1:00 arrdem: &(let [; 1] (+ ; ; ;))

1:00 lazybot: ⇒ 3

1:00 * arrdem watches the world burn

1:03 TEttinger: ,(map int "(let [; 1])")

1:03 clojurebot: (40 108 101 116 32 ...)

1:03 TEttinger: ,(map int "[; 1])")

1:03 clojurebot: (91 894 32 49 93 ...)

1:03 TEttinger: 894 eh?

1:04 ,(char 894)

1:04 clojurebot:

1:04 arrdem: Greek question mark

1:04 TEttinger: ha!

1:04 arrdem: conveniently rendered using effectively the same glyph as our old friend ##(int \;)

1:04 lazybot: ⇒ 59

1:24 cfleming: ghadishayban: Looking forward to seeing that working!

1:25 Unicode must open up a whole world of phishing possibilities.

1:25 arrdem: oh yes

1:25 it's pretty scary

1:31 Kneiva: cfleming & arrdem: I get these nice spam mails: http://kneiva.raah.fi/unicode.png

1:31 arrdem: le sigh...

1:31 Grimoire 0.3.9b live

1:32 minor formatting changes, three PRs and a not trash text/plain 404 page for cider-grimoire

1:32 looong overdue on that one

1:37 engblom: Is there any companion library to Quil for getting widgets? I would want to place things like input boxes and buttons on a Quil canvas.

1:37 Or is there any other library giving you a chance to do both animation and placing widgets?

1:39 kenrestivo: more 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?

1:40 i discovered AsynchronousFileChannel, but not sure if it is the right thing

1:42 justin_smith: kenrestivo: I am thinking something using WatchService https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html

1:43 kenrestivo: will look, thanks. i gotta say, you seem to know the JVM pretty thoroughly.

1:43 must have spent a lot of time in the java salt mines.

1:43 danielcompton: cfleming: I think the browsers have put a fairly tight leash on using unicode in URL's

1:44 justin_smith: kenrestivo: I am a compulsive reader of docs...

1:44 kenrestivo: and I often try to do odd things, looking for the tool that will do it

1:46 I 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

2:02 * zerkms just realized their 60 lines clojure program consumes 120Mb of RAM

2:02 ghadishayban: time for bed. just got the one-time reflector working

2:06 justin_smith: zerkms: hell, I could consume more than that with one line of C if I tried :)

2:06 zerkms: in all seriousness, yes, clojure uses quite a bit of RAM as a baseline

2:06 zerkms: seems like I will not finish my program then

2:07 I expected to really use it in production

2:07 but 100+mb per container is too much

2:07 especially keeping in mind it will run on 100+ containers

2:07 justin_smith: zerkms: why do you need multiple clojure instances running on one machine?

2:07 zerkms: which is 10+gb of ram in total

2:07 justin_smith: zerkms: isolating parts of a clojure program is trivial

2:07 zerkms: they are in different openvz containers

2:08 justin_smith: zerkms: and this is something that couldn't be done by isolating parts of a single clojure server process?

2:08 zerkms: I don't understand what you say ;-)

2:09 what "isolating" means here?

2:09 justin_smith: zerkms: that's what openvz is for, right? isolating processes? I find I can isolate things effectively within one clojure process.

2:09 thanks to default immutibility, for starters

2:09 zerkms: openvz isolates resources yep

2:10 so 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)

2:10 justin_smith: OK, so multiple vms is a premise here

2:10 zerkms: yep

2:11 justin_smith: then 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)

2:11 zerkms: what about scala?

2:11 I don't want to do that in python

2:12 justin_smith: scala is also a memory hog

2:12 zerkms: that sucks :-(

2:12 justin_smith: do you have something against OCaml?

2:13 zerkms: I haven't seen a single line of code for it

2:13 justin_smith: it's in the ml family, not super far from haskell in it's basic syntax

2:13 zerkms: ml is more or less acceptable

2:13 justin_smith: but less theoretical / faster compiling / smaller footprint

2:14 zerkms: these days I read purely functional data structures, that uses standard ml as a syntax

2:14 with basic erlang/haskel syntax knowledge I understand it without issues

2:14 justin_smith: the 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.

2:15 but if you want one big program, with many threads, and good immutible behavior, and awesome jvm interop, do try clojure

2:15 zerkms: what about haskell then?

2:15 justin_smith: clojure is awesome

2:15 haskell is more of a mem / cpu hog than ocaml

2:16 zerkms: clojure is awesome indeed

2:16 * zerkms sighs

2:16 shem: what about racket?

2:16 justin_smith: Racket's decent too, yeah. But not as good performance wise as clojure, not to mention ocaml.

2:17 zerkms: in my env dummy hello world + (read-line) clojure app takes 65 mb

2:18 justin_smith: not surprised, yeah, like most other langs, in order to run anything at all you need the full compiler resident in memory

2:18 *like most other lisps

2:18 heh

2:20 shem: racket's compiled, isn't it? and typed racket seems clean and easy to use

2:20 which is why i've been eyeing it

2:21 but the syntax seems clunkier than clojure

2:23 justin_smith: shem: does it have a tree-shaking compiler?

2:23 * zerkms is wailing: terrible day: stomacache, headphones wire got broken and now clojure

2:24 justin_smith: shem: clojure compiles all code too. It just doesn't know how to drop unused parts of itself.

2:24 shem: justin_smith: right. i haven't looked that closely.

2:25 arrdem: the price of a single pass compiler...

2:25 engblom: Racket has two things better than Clojure: Better GUI libraries and compilation to native code.

2:25 arrdem: ish

2:28 justin_smith: engblom: well, chicken scheme has a native code compiler too, it still doesn't perfrom well at all

2:29 native-code can mean a lot of things once you are generating the code programatically

2:29 engblom: That is very true.

2:29 arrdem: gon store all my values on the stack

2:29 justin_smith: hehe

2:29 arrdem: fast 'cause native, right?

2:30 engblom: Racket, however, is fast.

2:30 Jaood: afaik distributing a racket executable is like distributing java app excutable where the jvm is bundled in

2:30 racket compiles to bytecode

2:31 engblom: I 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.

2:31 Jaood: engblom: clojure is not really lazy

2:32 justin_smith: Jaood: lazy functions are more common in core clojure libs / idiomatic clojure code than in racket though

2:32 engblom: ,(take 5 (iterate inc 1))

2:32 clojurebot: (1 2 3 4 5)

2:33 engblom: That was pretty lazy, in my opinion.

2:34 justin_smith: racket has a lazy flavor available http://docs.racket-lang.org/lazy/

2:34 looks pretty comprehensive actually, it's just not the default

2:34 Jaood: justin_smith: yeah, I meant . Clojure’s laziness does not serve the same purpose as Haskell

2:35 In Clojure, laziness is restricted to sequences, with the rest of the language and its data structures being otherwise entirely “eagerly” evaluated.

2:35 justin_smith: Jaood: except for promise / delay maybe?

2:36 though writing your code with a delay on every value and a deref on every usage would get very tedious

2:38 Jaood: justin_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

2:40 justin_smith: Jaood: 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

2:41 engblom: If 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.

2:42 justin_smith: Jaood: actually, looking at those docs, it looks like lazy-racket is more of a lazy lang in the way you are talking about

2:43 Jaood: justin_smith: that would be dangerous in clojure since since lazy sequences may be batched as a performance optimization

2:43 making the realization of items run ahead of consumption

2:44 justin_smith: Jaood: yeah, I was not talking about using lazy-seqs to delay evaluations there

2:45 ,(def d (delay (do (println 42) 0)))

2:45 clojurebot: #'sandbox/d

2:45 justin_smith: that's guaranteed not to run until deref

2:45 ,@d

2:45 clojurebot: 42\n0

2:45 justin_smith: ,@d

2:45 clojurebot: 0

2:48 Jaood: justin_smith: yeah, I see you what mean there

2:48 justin_smith: definitely clumsier than a lazy language

2:49 Jaood: justin_smith: right, I was addressing engblom's statement about haskell

2:50 justin_smith: aha, I just connected the dots, seeing your point above more clearly

3:28 TIL 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 ...)))

3:34 fairuz: Hi 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?

3:34 justin_smith: fairuz: a macro can do that, a defn no

3:35 zerkms: but it sounds dirty isn't it?

3:35 fairuz: justin_smith: ok

3:37 justin_smith: zerkms: def<foo> forms are popular

3:38 zerkms: maybe more popular than they should be...

3:39 fairuz: actually 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.

3:39 justin_smith: ,(->> 'clojure.core ns-publics keys (map name) (filter #(.startsWith % "def")) (clojure.string/join " "))

3:39 clojurebot: "deftype defstruct definline definterface default-data-readers defn defmethod defonce defn- defprotocol defmacro defmulti defrecord"

3:39 fairuz: I'm still thinking how I can approach this

3:41 justin_smith: fairuz: why not a let block instead of def?

3:42 TEttinger: ugh... I'm hitting a block with trying to get leiningen to compile a java main class that calls clojure code

3:42 stain: perhaps better let Maven build Java code

3:43 TEttinger: the thing is the clojure isn't built yet that the java needs to call

3:43 justin_smith: ,(->> (all-ns) (mapcat (comp keys ns-publics)) (map name) (filter #(.startsWith % "def")) (remove #(.startsWith % "default")) (clojure.string/join " "))

3:43 clojurebot: "deftype defstruct definline definterface defn defmethod defonce defn- defprotocol defmacro defmulti defrecord"

3:44 TEttinger: I'm trying to figure out why Packr fails on clojure projects with a -main fn written in clojure, but works on java main methods

3:45 https://github.com/libgdx/packr/issues/33#issuecomment-62863164

3:46 fairuz: So 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.

3:46 Same thing for the second line

3:47 justin_smith: fairuz: OK. this can all be done in a let block. def is for creating globals

3:48 clojure is not like js or scheme where def creates local bindings

3:52 (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)

3:52 ,(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)

3:52 clojurebot: {:action link, a3 {:nodeA {a1 {:val1 111, :val2 222}, :action create}, :nodeB {a2 {:val1 111, :val2 222}, :action create}}}

3:54 fairuz: oh ok

3:55 looks good!

3:56 justin_smith: also, may I suggest {:name 'a1 :data {:val1 111, val2 222}} - this form is much easier to work with

3:56 or you can even lift the data...

3:56 {:name 'a1 :val1 111 :val2 222}

3:57 and then you can do ##(group-by :name [{:name 'a1 :val1 111} {:name 'a2 :val 122}])

3:57 lazybot: ⇒ {a1 [{:name a1, :val1 111}], a2 [{:name a2, :val 122}]}

3:57 justin_smith: and other related nice operations

3:58 fairuz: Let me read this carefully first :)

3:58 justin_smith: of course

4:02 fairuz: hm sorry. I'm still confused. :) So with this it's possible if I have {:name 'a1 :val1 111 :val2 222}

4:03 then my function will process this, e.g put 111 and 222 in the database, and get back the reference and put it in a1?

4:03 justin_smith: what scope should this a1 have?

4:04 fairuz: Only in this file/function

4:04 I just want to reuse a1 in the other lines

4:06 justin_smith: then I think you want something like (defn foo [] (let [a1 (create {...}) a2 (create {...}) a3 (link a1 a2)] ...))

4:06 fairuz: Since it will be run only once (it's for initial graph data loading)

4:06 Can let [a1 (create {...}) a2 (create {...}) a3 (link a1 a2)] ... comes from a file?

4:06 let say EDN? or something more practical taht you can suggest

4:06 justin_smith: sure

4:07 though if you want it all to come from a file you probably just want to do a reduce or walk on the file

4:09 fairuz: I'm not really sure what read-string from edn uses

4:09 Do you mean to reduce/map them once I read using read-string of edn?

4:10 justin_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]}])

4:10 clojurebot: {a3 {:data {:name a3, :links [a1 a2]}}, a2 {:data {:name a2, :data "hello"}}, a1 {:data {:name a1, :data [0 1 2]}}}

4:10 justin_smith: yeah

4:10 so imagine if above, instead of calling assoc, I was running some db insertion

4:10 and perhaps looking for a :links key, and inserting that link in the db if it was there...

4:11 and you can get this all from a simple (read-string (slurp "data.edn")) of course

4:14 fairuz: nice!

4:15 I'll try to make a simple working thing :)

4:17 justin_smith: fairuz: in fact, reduce is better for a purely functional example for above, but for side-effecting db inserts, doseq may be much clearer

4:17 fairuz: Both doing the same thing?

4:19 justin_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)]]))

4:19 clojurebot: [i a1 [[0 1 2]] [nil]][i a2 [hello] [nil]][i a3 [nil] [[a1 a2]]]

4:19 justin_smith: doseq returns nil

4:19 it only runs for side effects

4:19 so you could imagine instead of printing a vector that starts with 'i it ran an insert

4:21 fairuz: ok

4:21 TEttinger: https://github.com/libgdx/packr/issues/33 so this issue only seems to show up when bundling JREs with uberjars made by lein.

4:22 fairuz: A lot to digest

4:22 justin_smith: fairuz: sure. How would you usually do this in a language you know well?

4:25 fairuz: This 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.

4:25 The problem here it's no more a tree-like structure, siblings can have links between them

4:26 justin_smith: fairuz: have you heard of "adjacency list" graph representation?

4:26 http://en.wikipedia.org/wiki/Adjacency_list

4:26 fairuz: justin_smith: um nope

4:27 ah

4:27 so I want to have something like that. So my idea is to first to create all the nodes. (to get their references)

4:27 Then link them using the references

4:28 justin_smith: your input could like like [{:name 'a :arrows '[b c]} {:name 'b :arrows '[b a]}] etc.

4:28 right

4:28 fairuz: Yep

4:28 that's how I want to proceed

4:28 That's why I need to create the references first

4:28 the re-use it after

4:30 justin_smith: so I would first (doseq [key (map :name data)] (insert key)) then (doseq [datum data] (make-links (:name datum) (:arrows datum)))

4:30 and later you may add other keys if the links or nodes need to carry their own info...

4:35 fairuz: Ok. I'm still struggling reading clojure code, so bare with me. heh

4:35 It's getting easier though, which is good

4:41 Thanks for the help justin_smith

6:25 crisptrutski: is there a function to see all protocols a type or instance is extending? as opposed to `extenders` available in the other direction

6:28 trying to understand the difference between `indexed?` and `sequential?`, and why the former is only in clojurescript and not clojure

6:50 r4vi: what'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]

6:52 ucb: r4vi: juxt

6:52 ,(doc juxt)

6:52 clojurebot: "([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)]"

6:53 ucb: oh, right, misread your question

6:54 r4vi: you can use -> or reduce over the vector of fns?

6:54 r4vi: i was thinking reduce too

6:54 ucb: (-> v f1 f2 f3) is quite readable too

6:55 r4vi: hmm yes

6:55 ucb: or would it be (-> (f1) (f2) ...)?

6:55 I forget.

6:55 I rarely use -> myself

6:55 if you have the fns in a vector already, I'd reduce over it

6:57 r4vi: ,(doc reduce)

6:57 clojurebot: "([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...

6:57 r4vi: I can't figure out how to get the value to reduce across the functions if I used reduce

6:58 ucb: (reduce (fn [x f] (f x)) v [f1 f2 f3]) should do the trick I think

6:59 ,(reduce (fn [x f] (f x)) 0 [inc inc inc])

6:59 clojurebot: 3

6:59 ucb: yuppe

7:02 r4vi: nice thanks

7:34 rus`: hello guys, could you suggest some good book on Clojure?

7:35 ebook maybe, so I can start earlier

7:36 mearnsh: ~books

7:36 clojurebot: books is http://www.pragprog.com/titles/shcloj/programming-clojure

7:36 mearnsh: ~book

7:36 clojurebot: book is books

7:37 mearnsh: rus`: what's your programming background

7:37 rus`: mearnsh: Common Lisp

7:38 mearnsh: Joy of Clojure might be a good choice then

7:40 it's faster paced than most but if you're familiar with CL you'll be fine. it's a great book

7:41 rus`: mearnsh: excellent, thanks! and there is a foreword by Steve Yegge for additional entertainment

7:41 m1dnight_: I'm trying to play around with the clojure bot but I can't seem to find the list of command prefixes?

7:41 Is it in the database?

9:00 engblom: Is anyone here able to tell how I set up an own clojurebot?

9:00 There seem to be no documentation boundled with the source.

9:01 clgv: engblom: if I remember correctly, lazybot has more information available

9:02 until he started aging lazybot was the cooler one anyway ;)

9:02 &(clojure-version)

9:02 lazybot: ⇒ "1.7.0-alpha1"

9:02 clgv: oh interesting

9:02 engblom: clgv: 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.

9:02 clgv: he seems to have had a rejuvenation potion recently

9:03 agarman: engblom: mongodb is a 2 minute setup

9:04 rweir: then years of regret

9:04 clgv: :D :P

9:04 clojurebot: Excuse me?

9:05 clgv: didn't you find rweir's comment funny??

9:05 lazybot: clgv: Uh, no. Why would you even ask?

9:05 engblom: agarman: 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...

9:06 * engblom is wishing lazybot would use sqlite or any other "simple" database

9:06 clgv: engblom: well you write the maintainer of clojurebot to get more information

9:06 engblom: sql? that is so 2000s ;) :P

9:07 engblom: clojurebot has a setup.sh and example.config - those should help right?

9:08 agarman: engblom: mongodb is about the same level of complexity of sqllit

9:09 engblom: clgv: 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.

9:10 clgv: engblom: so the easiest way seems to be asking hiredman

9:10 engblom: agarman: 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.

9:10 agarman: yeah, mongodb doesn't embed

9:14 justin_smith: clgv: 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

9:15 I don't own the repo, I just submitted a huge PR

9:16 clgv: justin_smith: so you are lazybot's fountain of youth ;)

9:16 justin_smith: good job

9:17 ,(clojure-version)

9:17 clojurebot: "1.7.0-master-SNAPSHOT"

9:17 clgv: clojurebot could be more specific ;)

9:17 or is it really tracking bleeding edge master?

9:19 Guest4839: hey i'm trying out clojure for the first time

9:19 mgaare: welcome panther_

9:19 panther_: i know about haskell, ml, and racket

9:20 mgaare: you should be in good shape then

9:20 agarman: panther_: clojure will be closest to racket

9:21 panther_: racket was pretty cool. i also tried scala but it was too slow (JVM)

9:21 racket, clojure :: lisp dialects

9:21 agarman: panther_: Clojure is also JVM

9:21 panther_: was it the Scala compiler that was too slow, or the running code?

9:22 panther_: i just typed 3+1 or something like that into the REPL and it took many seconds to return the result

9:22 i wasn't doing anything crazy like a qsort function

9:22 agarman: panther_: Scala brings up a REPL prompt quickly, but the first few commands are slow

9:23 clgv: panther_: that sounds weird. especially as an argument that the language is too slow...

9:23 panther_: oooh

9:23 thanks

9:23 agarman: panther_: when I was doing Scala work, I just hit enter 3 or 4 times after starting the REPL

9:23 and that was usually enough to get it going

9:23 panther_: i see. Well then i will not judge a language on its first few tries

9:23 clgv: agarman: is that already some kind o f design pattern? :P

9:24 panther_: thanks

9:24 mgaare: you have to beat scala like a donkey

9:25 agarman: panther_: 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

9:26 panther_: i feel really stupid right now because i'm trying out a language on windows.

9:26 my Linux laptop contains most of my dev stuf

9:39 H4ns: what 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.

9:42 stuartsierra: H4ns: maybe Clojure's LineNumberingPushbackReader

9:43 H4ns: stuartsierra: i've found that, but then got lost in a maze of classes and interfaces and very slim documentation. thanks for pointing me back :)

9:46 stuartsierra: H4ns: 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.

9:46 There's probably a similar line-numbering reader in some (documented) Java library.

9:47 Like Apache Commons I/O or Guava.

9:49 H4ns: stuartsierra: i could steal the usage from https://github.com/dwysocki/lojic/blob/37fc2623f5fb280cf47c38cf2c271015b85e8e82/src/lojic/core.clj#L17, thanks!

9:55 ordnungswidrig: H4ns: https://docs.oracle.com/javase/7/docs/api/java/io/LineNumberReader.html

10:39 jobx: Are core.async threads similar in memory size to Golang's threads, excluding JVM startup, ie. additional threads?

10:40 clgv: jobx: afair the use java threads managed by a threadpool - so threads are reused

10:41 jobx: clgv: Does this make core.async threads more efficient then?

10:41 clgv: I'm new to the JVM

10:42 clgv: clgv: no idea what golang does.

10:42 jobx: ^^

10:44 jobx: but on average there is no overhead due to thread creation. there is only a synchronized queue involved

10:44 jobx: clgv: Any idea how much RAM per thread?

10:45 clgv: jobx: no. but you have only a constant number of threads

10:47 csd_: 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:47 jobx: clgv: 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:48 csd_: I guess I'm wondering whether StringBuilder is my best bet

10:48 clgv: jobx: 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:49 jobx: the threads wait for tasks that get submitted to a queue

10:51 jobx: for more details you can ask the devs, e.g. tbaldridge

10:51 eric_normand: jobx: you can make many core.async go-processes

10:51 jobx: but behind the scenes, to execute them, they use a shared thread pool

10:52 jobx: eric_normand: I see. Just trying to get a rough comparison or memory requirements Clojure vs Gloang, minus base JVM requirements

10:53 clgv: jobx: just implement a small benchmark in both and measure?

10:53 tbaldridge: jobx: go processes in core.async are just callbacks, so there's not much overhead there.

10:53 jobx: tbaldridge: I see. Thanks.

10:58 clgv: tbaldridge: is the pattern (if ^boolean (prop? x) ...) just better documented or does ^boolean have an effect on the compiler?

10:59 Bronsa: clgv: that's a cljs compiler hint

10:59 sdegutis: Is 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:59 clgv: Bronsa: oh I landed in the wrong tree. thanks

11:11 tbaldridge: sdegutis: depends on the open source language, the licenses etc.

11:12 sdegutis: Ah.

11:13 clgv: sdegutis: which semi-major os prog lang are you talking about?

11:13 sdegutis: Someone wanted to work towards including a Go library I wrote into Go's stdlib.

11:14 arrdem: why would it be harsh to refuse to re-license something you wrote? it's yours after all.

11:14 sdegutis: I 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:15 arrdem: Because it meant they had to rewrite it from scratch if they want to use it in Go's stdlib.

11:15 They're essentially having to do more work than they would have because of me.

11:16 arrdem: no, they're doing work they would have done anyway and which you are in a position to save them

11:16 *from repeating

11:16 tbaldridge: sdegutis: stinks to be them for having a crappy contrib process ;-)

11:16 arrdem: ^ that

11:16 I 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:17 just my (cynical) 0.02

11:17 clgv: tbaldridge: but it wouldnt be that different with clojure, would it? you have to be EPL compatible and sign the CA

11:17 sdegutis: I 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:17 clgv: so GPL is out of scope

11:18 tbaldridge: clgv: yep, and if I had a GPL lib that the "clojure people" (whoever that is) desperately wanted, I'd say the same thing.

11:18 sdegutis: So 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:18 tbaldridge: clgv: that being said, I use EPL on all my clojure projects just to avoid that problem.

11:19 clgv: tbaldridge: the incompatibility is a pain for "itext", you can't use any uptodate version of it in EPL projects... :(

11:19 sdegutis: So it just feels like I only have an arrogant reason to ultimately make someone else do double work.

11:20 tbaldridge: sdegutis: what's the current license?

11:20 emacsnub: Hey 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:20 tbaldridge: sdegutis: and have you ever accepted a pull request on the project.

11:25 arrdem: emacsnub: 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:27 emacsnub: :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:27 luxbock: https://github.com/emacs-tw/awesome-emacs is a good resource

11:29 emacsnub: :luxbock thanks!

11:30 Oh 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:32 luxbock: emacsnub: 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:32 emacsnub: oh that's true

11:32 schmir: emacsnub: I'd say try to use the control keys on both sides of your keyboard

11:33 luxbock: I 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:33 emacsnub: :schmir but sticking with the default keybindings should be ok, right

11:35 sg2002: Wasn't emacs-prelude develed by on of the cider developers? Don't think there would be any conflict.

11:35 clojurebot: Huh?

11:35 schmir: emacsnub: get a keyboard that's comfortable for you and make short breaks at least every hour.

11:35 emacsnub: :schmir I will. Thank you!

11:35 technomancy: move your control key to your thumb for great justice

11:36 luxbock: has anyone given this a try yet? https://github.com/promethial/paxedit

11:36 sg2002: emacsnub: 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:37 technomancy: sg2002: most starter kits have rubbish docs and are difficult to fix when things go wrong

11:37 emacsnub: :sg2002 thanks for the suggestion!

11:38 sg2002: technomancy: Prelude and emacs-starter-lit look fine to me.

11:38 emacsnub: :technomancy I've used your starter kit and it wasn't too bad. Something weird happened at some point though

11:38 technomancy: sg2002: emacs-starter-kit is lame

11:38 sg2002: technomancy: Possibly, haven't looked into it that well.

11:38 technomancy: ~geometry

11:38 clojurebot: It's greek to me.

11:39 technomancy: ._.

11:39 "Emacs needs some theology and geometry; some taste and decency. I suspect we are teetering at the edge of an abyss." etc

11:39 sg2002: technomancy: Personally I use ergoemacs. ;-) Hope I would not get banned for mentioning it. :-)

11:39 technomancy: we get confused people in the #emacs channel on a daily basis

11:40 prelude, esk, emacs-live, they're all the same

11:40 (probably people just don't ask about ergomacs probably because they know xah has a bad reputation)

11:41 sg2002: technomancy: Haha.

11:43 m1dnight_: When I run (dorun (apply pcalls <something something>)), can I expect all the functions in that body to return?

11:43 I seem to shut down my agents before they all finish and get refused to execute exception

11:44 https://www.refheap.com/93519 # Source

11:44 When I comment out shutdown-agents it all works fine

11:44 clgv: m1dnight_: better dont use any of those p(map|calls) ...

11:44 m1dnight_: hrm?

11:44 Why not?

11:45 clgv: your dorun already indicates that you are not interested in semi-lazy sequences that are evaluated in parallel.

11:46 you want to run several functions in parallel and use what your hardware offers, right?

11:46 m1dnight_: yes, that is correct

11:47 it's a stresstest for my refs implementation

11:47 clgv: "pmap" will prevent that as soon as your functions have different runtimes

11:47 sg2002: technomancy: 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:47 clgv: m1dnight_: oh just use futures then

11:47 m1dnight_: 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:47 so I'm guessing something is returning before all the functions have been executed..

11:47 I don't really get it

11:47 I didnt change a whole lot in the code, I think

11:47 technomancy: sg2002: sure, just don't come crying to #emacs when it breaks =)

11:48 clgv: m1dnight_: you got your code on github or similar?

11:48 emacsnub: :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:48 m1dnight_: yeah hold on

11:48 https://github.com/m1dnight/stm-in-clojure-leiningen

11:48 sdegutis: tbaldridge: no, and it's whatever license it is when you don't specify a license

11:49 m1dnight_: did a quick push just now :)

11:49 sg2002: technomancy: As someone said to me once "Here in #emacs we can help you with any emacs package except cider and icicles." :-)

11:49 Bronsa: emacsnub: there's no reason for the leading colon before nicks in irc

11:49 mgaare: Bronsa: don't you want to be a keyword?

11:49 technomancy: sdegutis: releasing software without a license is a crap move no matter the context

11:49 emacsnub: Bronsa thanks!

11:50 sdegutis: technomancy: I was young and care-free :P

11:50 technomancy: emacsnub: the purpose of that page is mostly to get people to stop using the starter kit rather than actual instruction, but thanks

11:50 sg2002: technomancy: Oh, I meant CEDET. ;-)

11:51 clgv: m1dnight_: which test namespace specifically?

11:51 m1dnight_: examples.clj?

11:55 m1dnight_: I used the following for parallel tests https://gist.github.com/guv/d91b39ea19c47bc8afed

11:57 m1dnight_: 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:00 m1dnight_: yes, clgv

12:01 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:01 I don't really get it

12:01 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:01 stack trace is pretty vague about it too

12:02 I'll give your code a shot

12:02 clgv: m1dnight_: ah lol you shutdown agents in the namespace

12:02 m1dnight_: yeah :p

12:02 but the point is, the unit test works for the vanilla release (the codebase I received)

12:02 clgv: m1dnight_: pretty bad idea. you should only do something like that at the end of a -main function

12:02 m1dnight_: 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:02 hrm, okay

12:03 but I'm wondering what could be the cause that my implementation causes this error and the professor's one not

12:03 clgv: m1dnight_: no that code is evaluated with the namespace, so you shutdown the agent thread pool when the namespace is loaded

12:03 m1dnight_: *blink*

12:03 clgv: that's very likely before the test is run ;)

12:04 m1dnight_: but I evaluate (run-tests) before it, when i load the namesapce, no?

12:04 clgv: does (run-tests) block?

12:04 to include it in the namespace is odd anyway

12:06 m1dnight_: 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:10 emacsnub: haha, sorry I'm treating this like #emacs, but can someone tell me how to have ido-ubiquotous enabled by default?

12:11 technomancy: emacsnub: (ido-ubiquitous-mode t) I think

12:16 emacsnub: technomancy I had this in my init.el: (require 'ido) (setq ido-everywhere t) (ido-ubiquotous-mode t)

12:16 technomancy and it said symbol's definition is void

12:17 technomancy: emacsnub: sounds like it isn't installed

12:18 emacsnub: technomancy if i do M-x ido-ubiquotous-mode I get autocompletions when I want to install packages

12:19 but without that I don't have autocompletions

12:20 oh i think it was a typo in my init...

12:22 technomancy YESSS!! THAT DID IT!!! THANK YOU!!!

12:22 mmitchell: anyone 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:23 I need to add something like @JsonTypeName('foo') - in java, this happens before the class declaration

12:23 clgv: mmitchell: you should probably define that class in java then

12:24 mmitchell: if this is not needed because of legacy code, you should better not use this approach

12:26 mmitchell: clgv: 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:26 s/you're/your

12:27 clgv: mmitchell: yes

12:27 mmitchell: if not for legacy reasons, don't do this

12:28 mmitchell: Dang, yeah not legacy, but required to interact with a Java framework I'm working with.

12:28 m1dnight_: clgv: Yeah, I think I figured it out now

12:29 when I do lein test <namespace> it evaluates the test when loading, then shuts down the pool and then runs the tests again

12:29 munderwo: Hi 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:29 m1dnight_: and that's the problem

12:29 joegallo: munderwo: M-.

12:29 technomancy: munderwo: yeah, cider is way better than etags at that

12:29 munderwo: ahh cool…

12:29 clgv: m1dnight_: not really the namespace is loaded completely and after that the tests are run

12:30 m1dnight_: but it runs the test twice?

12:30 That's why I figured it would run the tests when loading the namspace

12:30 munderwo: does it work with clojurescript as well? Also when I did that it said it had no nrepl connection buffer

12:30 clgv: mmitchell: so you must use a framework that assumes classes like that? then just define them in java in your project

12:31 m1dnight_: it only runs those twice because you have that (run-tests) in the namespace. just remove that as well

12:31 m1dnight_: can you answer the question why you want to shut down the agent threadpool?

12:31 m1dnight_: 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:31 mmitchell: clgv: 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:31 m1dnight_: and therefore they would shut it down

12:32 clgv: m1dnight_: that might be the case. just remove it and use "lein test" ^^

12:33 mmitchell: yes. see the sample project.clj for a setup for distinct java and clojure source paths

12:33 mmitchell: clgv: awesome, starting to make sense. Thanks!

12:51 sdegutis: Are there any (popular or not) alternatives to Compojure?

12:52 clgv: sdegutis: liberator?

12:52 sdegutis: Thanks, looking at it.

12:54 hiredman: ztellman: does riffle have ranged iteration?

12:55 nkoza: sdegutis: moustache, bishop, bidi, compojure-api, clothesline route-one

12:56 sdegutis: Bishop eh? Someone likes X-Men.

12:56 technomancy: or chess

12:56 sdegutis: Oh right, that too.

12:57 technomancy: or like ... the Roman Church?

12:57 sdegutis: ~guards

12:57 clojurebot: SEIZE HIM!

12:57 technomancy: my son is named after a bishop

12:57 sdegutis: Anyway I liked the kitchen scene in Days of Future Past. That's probably my favorite scene in any movie ever.

12:57 technomancy: (middle name, but still)

12:58 {blake}: Bishop? Or Alien.

13:00 ianbishop: Does 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:01 sdegutis: I've been looking into the opposite.

13:02 emacsnub: how can I enable autoindenting for clojure code in emacs?

13:02 hyPiRion: technomancy: does your son only move diagonally?

13:02 technomancy: he'd probably get a kick out of that if I told him, hehe

13:03 ianbishop: sdegutis: what's your reasoning for that?

13:04 sdegutis: ianbishop: I've been dabbling with Java 8 and so far I like what I see, and it's faster than Clojure.

13:06 ianbishop: sdegutis: ah, fair enough. I'm not worried about that size of speed improvement

13:08 sdegutis: Also I'm starting to find that Java can be non-complex and functional without necessarily being Clojure.

13:14 clgv: sdegutis: 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:14 technomancy: clgv: he's just messing with you

13:15 munderwo: Hi 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 Wrap that in a "(into [] ...)" to get a vector instead of a list.

13:16 munderwo: Oh nice!

13:16 postpunkjustin: ,(mapv (fn [k] [:option k]) ["foo" "bar"])

13:16 clojurebot: [[:option "foo"] [:option "bar"]]

13:16 munderwo: ahh soo many options :)

13:16 I tried map.. but not mapv

13:17 clgv: technomancy: not sure about that ;)

13:18 technomancy: clgv: the subtlety is what makes him a master

13:18 munderwo: hmm actually I tried map with #([:option %]) but that didnt seem to work..

13:18 Bronsa: clgv: according to puredanger direct is out of scope for 1.7

13:18 munderwo: ,(mapv #([:option %]) ["foo" "bar"])

13:18 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>

13:19 munderwo: Hmm… why does the above not work?

13:19 Bronsa: ,'#([:foo %])

13:19 clojurebot: (fn* [p1__78#] ([:foo p1__78#]))

13:19 joegallo: #(...) expects an actual function as its first argument

13:19 Bronsa: ,(macroexpand-1 '(fn [x] [:foo x]))

13:19 clojurebot: (fn* ([x] [:foo x]))

13:19 joegallo: [] is not what you think it is in that context

13:19 ianbishop: ,(mapv #(vector :option %) ["foo" "bar"])

13:19 clojurebot: [[:option "foo"] [:option "bar"]]

13:19 munderwo: ahhhh… wow… interesting… you learn something everyday :)

13:19 clgv: Bronsa: 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:20 Bronsa: clgv: no idea

13:20 clgv: or are there plans to have shorter release cycles?

13:20 Bronsa: don't ask me.

13:20 clgv: I've heard core talking of shorter release cycles since 1.3

13:21 clgv: Bronsa: good sign :P

13:21 mdrogalis: Anyone ever seen a defmulti dispatch work correctly in the REPL, when when AOT'ed - cannot find its defmethod implementation?

13:21 clgv: Bronsa: 1.3 was the version where I waited the longest before adoption

13:21 hiredman: you are not loading the namespace where the defmethod is

13:21 mdrogalis: Printing `methods` inside the defmulti shows that it *should* find its implementation - when AOT'ed, even.

13:22 Bronsa: mdrogalis: are you using class as dispatch fn?

13:22 hiredman: oh, are you dispatching on the type of a deftype?

13:22 mdrogalis: hiredman: The ns load is in the same file as the defmulti

13:22 hiredman: or defrecord or whatever

13:22 mdrogalis: Bronsa: Yeah

13:22 Record, in fact. Yep

13:22 ... I'm about to learn something new/terrible. D:

13:22 Bronsa: mdrogalis: yeah AOT'ing defmethods with class literals can be problematic

13:22 hiredman: the type in your dispatch has the same name, but is different

13:22 Bronsa: ^

13:22 hiredman: that can happen for a number of reasons

13:23 mdrogalis: Is there a common resolution or alternate route that I can take? The records are from Component.

13:24 ztellman: hiredman: you can do key iteration, but it doesn't keep them in lexicographic order

13:24 * technomancy glances around innocently

13:24 ztellman: hiredman: so bascially, no

13:24 hiredman: ztellman: ok, thanks, very cool btw

13:24 ztellman: thanks!

13:25 hiredman: mdrogalis: well, you can try and figure out how you are ending up with multiple types with that name

13:25 mdrogalis: for aot projects I believe that often comes down to namespace loading order

13:25 mdrogalis: hiredman: Hmm, okay. That's helpful.

13:26 stuartsierra: mdrogalis: If you're mixing any AOT-compiled code with live reloading at the REPL, all sorts of strange things happen.

13:26 mdrogalis: I appreciate the insight. Thanks hiredman & Bronsa.

13:26 stuartsierra: Pretty much sums up my situation.

13:26 stuartsierra: mdrogalis: No hope, then. Pick one or the other.

13:26 technomancy: AOT-compiled code is fine as long as it's not records/protocols

13:27 mdrogalis: stuartsierra: Fair enough.

13:27 stuartsierra: technomancy and I have different biases. I blame everything on AOT-compilation; he blames protocols.

13:27 Bronsa: I cannot help but believing that at the core of all those issues there's a bug in how the compiler handles the dynamicclassloader

13:28 technomancy: https://github.com/github/linguist/issues/1721#issuecomment-63344390 <- he claims that the official docs recommend textmate's clojure grammar =(

13:28 clgv: engblom: your chance to ask hiredman ;)

13:29 hiredman: wait, what?

13:29 mdrogalis: technomancy: That was some pretty-looking Racket code. Re Twitter

13:30 technomancy: mdrogalis: making an art form of hideous highlighting

13:30 Bronsa: what official docs is he talking about?

13:30 technomancy: Bronsa: guessing the wiki

13:32 it's not linked from clojure.org, though sublime somehow is

13:32 mdrogalis: hiredman & stuartsierra: Yeah, seems the defrecord files are loaded twice - once at uberwar compilation time, next at uberwar deployment time inside Tomcat.

13:33 Since Ring needs access to the handler var, seems impossible to have it both ways - as stuartsierra said.

13:41 engblom: Why 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:41 It should quit looping as soon as the mouse button is released, but it does not.

13:45 aperiodic: engblom: 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:47 engblom: aperiodic: 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:50 dgellow: Hi guys and girls.

13:51 Do you know if the clutch project (clojure lib for couchdb) is still active ?

13:51 And if not, what are you using to interface with couch ?

13:51 * TimMc guesses there are probably women in the channel, but not girls

13:52 dgellow: sorry TimMc, english is not my first language :)

13:52 TimMc: no worries

13:52 metellus: we don't really have a good word to match up with "guy"

13:52 aperiodic: engblom: pass a callback fn as the value of the :mouse-pressed / :mouse-clicked option to sketch / defsketch http://quil.info/api/environment#sketch

13:52 TimMc: metellus: "gals"? *shrug*

13:53 metellus: very *shrug*

13:53 TimMc: heh

13:53 joegallo: furthermore, since we're getting our jimmies rustled, guy is offensive http://www.etymonline.com/index.php?term=guy&allowed_in_frame=0

13:53 technomancy: I've always preferred the good old traditional "GREETINGS, HUMANS"

13:53 clgv: hiredman: engbloom has questions about the clojurebot setup earlier^^

13:54 joegallo: technomancy: that's offensive

13:54 dgellow: "effigy of Guy Fawkes," leader of the Gunpowder Plot to blow up British king and Parliament"

13:54 clgv: ~guards

13:54 clojurebot: SEIZE HIM!

13:55 TimMc: joegallo: I heard no rustling.

13:55 Perhaps you have better ears than I.

13:55 metellus: ~gourds

13:55 clojurebot: SQUEEZE HIM!

13:55 joegallo: LOL

13:55 clgv: lol?

13:58 TimMc: dgellow: It certainly looks worrying -- no activity in 11 months.

13:59 dgellow: TimMc: Yeah :(

14:00 TimMc: Maybe it's complete. :-)

14:03 dgellow: I cannot make it work in project.

14:03 I just opened an issue here https://github.com/clojure-clutch/clutch/issues/85

14:04 maybe you have an idea of what I'm doing wrong ?

14:15 tmarble: I'm running [cider/cider-nrepl "0.8.0-20141113.231027-33"] + ~/.emacs.d/elpa/cider-20141116.1221/ yet I still get

14:15 WARNING: The following required nREPL ops are not supported: toggle-trace (??)

14:21 danielcompton: metellus: I prefer folks

14:22 but mammals is a more inclusive term, remember, on the internet no-one knows you're a dog

14:22 xemdetia: carbon based meat popsicles

14:22 edw: ping

14:24 dbasch: danielcompton: by now that’s been subsumed by “on the internet no one knows anything”

14:24 technomancy: haha

14:26 edw: tmarble: The tracking code was touched recently. Don't know if that may be related.

14:26 s/tracking/tracing/

14:27 But I didn't get that error. Consider `rm -rf ~/.m2/repository/cider/cider-nrepl/0.8.0-SNAPSHOT`-ing.

14:27 tmarble: edw: I see that in the changelog... What is the best practice here? load *.el from recent github checkout (and hope it matches .m2)?

14:27 edw: tmarble: I'm using the same version of cider as you are.

14:28 tmarble: or use cider from MELPA (and hope it lines up with whatever is in .m2)?

14:28 edw: tmarble: If you blow it away, you'll get the newest.

14:28 tmarble: edw: I did that.. the versions above are latest

14:28 sorbo_: 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:28 how do I keep whitespace-only lines?

14:29 edw: tmarble: Huh. Did you happen to `lein clean`? Worth a shot.

14:29 sorbo_: e.g. a line of 20 spaces comes in as “”

14:29 rather than “ “

14:30 ToxicFrog: sorbo_: line-seq is just a really simple wrapper about BufferedReader::readLine()

14:30 So this sounds like some kind of undocumented "feature" of readLine

14:31 stuartsierra: ,(line-seq (java.io.BufferedReader. (java.io.StringReader. " \n \n \n\n")))

14:31 clojurebot: (" " " " " " "")

14:31 stuartsierra: It's not line-seq.

14:32 Or readLine.

14:32 amalloy: sorbo_: it is something else you are doing, like calling trim or something

14:35 * engblom has made his first graphical game with Clojure. He feels satisfied.

14:36 mwfogleman: engblom: cool! what did you use?

14:38 engblom: mwfogleman: Quil

14:39 mwfogleman: can you apply a lein template to an existing project?

14:40 ghadishayban: if another bug shows up in #'reduced handling I'm going to jump off a cliff

14:41 Bronsa: ghadishayban: one sec

14:41 ghadishayban: oh no

14:41 Bronsa: , (.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))) 1)

14:41 clojurebot: #<Reduced@1ddd078: "foo">

14:41 Bronsa: there

14:41 I just fixed that

14:41 ghadishayban: i saw

14:41 tim__: sometimes I wonder if it wouldn't be better to do what Python does, and throw StopIteration()

14:41 ghadishayban: we all thank you Bronsa

14:42 Bronsa: btw I implemented a "one-time" reflector last night

14:42 Bronsa: ghadishayban: luckly clojure's reduce apparently doesn't use PersistentList/reduce

14:42 tmarble: edw: 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:42 ghadishayban: oh it doesn't?

14:42 sorbo_: ToxicFrog: nah, no trim

14:42 that’s the weird thing

14:43 it’s literally just BufferedReader, followed by a (doall line-seq rdr)

14:43 since I’ve bound the reader to rdr

14:43 and the lines come through perfectly, only the all-whitespace ones are just empty string

14:43 Bronsa: ghadishayban: no, it uses the internal-reduce impl

14:43 sorbo_: not strings of \space

14:43 hm

14:43 dbasch: sorbo_: refheap your code?

14:43 ghadishayban: Bronsa: i see

14:43 amalloy: sorbo_: 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:44 sorbo_: amalloy: correct

14:44 I’ll tinker with it and post a pastebin in a few if I can’t figure out what I’m doing wrong

14:44 thanks guys

14:44 Bronsa: ghadishayban: 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:45 it's really hard to understand what reduce impl will be used for a coll

14:45 stuartsierra: Bronsa: Partly it's the evolution of reduce to reducers to transducers.

14:45 ghadishayban: Bronsa: yeah at first I understood but now it just seems like a poor man's polymorphic inline cache

14:45 Bronsa: I'm mentioning it briefly in my conj talk

14:45 Bronsa: stuartsierra: InternalReuce now seems completely unnecessary to me

14:45 stuartsierra: The different interfaces have caused a lot of confusion for everyone, even making performance patches harder to implement.

14:46 tbaldridge: stuartsierra: and last Friday Bronsa pointed out to me that ChunkedSeq.reduce is not IReduce.reduce ....yeah....

14:46 Bronsa: it's even more confusing since a bunch of collections implement IReduce but that impl will never be used by reduce

14:46 sorbo_: so

14:46 ghadishayban: what you really want is the callsite cache to be on the caller of reduce, not inside core/reduce

14:46 sorbo_: the problem is

14:46 I am dumb

14:46 fixed it

14:47 Bronsa: tbaldridge: I actually understood the rationale for that, don't remember if I told you about it

14:47 sorbo_: the whitespace-only lines I imagined were just \ns

14:47 >_<

14:47 actually inserting whitespace solved the problem

14:47 tbaldridge: Bronsa: yeah I get the rationale as well. I just wish there was a better way

14:47 stuartsierra: Lots of things are unnecessary or, in hindsight, misapplied, but "fixing" them would break something else somewhere.

14:47 tbaldridge: hence the reason for ReduceInit

14:47 clojurebot: Gabh mo leithscéal?

14:48 tbaldridge: clojurebot: fail

14:48 clojurebot: Pardon?

14:49 ghadishayban: Bronsa: https://github.com/ghadishayban/reducers/blob/master/src/ghadi/reducers.clj#L7-L14

14:49 stuartsierra: tbaldridge solved the problem by implementing his own language.

14:49 ghadishayban: stuartsierra: lol

14:49 Bronsa: before reducers this mess was still there but at least all the implementations were consistent

14:49 now some implementation handle reduced right, some partially, some don't at all

14:49 ghadishayban: Bronsa: I've found that macro "helpful" https://github.com/ghadishayban/reducers/blob/master/src/ghadi/reducers.clj#L35-L41

14:50 Bronsa: ghadishayban: 1.7 should have an unreduced function

14:50 ghadishayban: not the same thing

14:50 Bronsa: ah, I missed the else arg sorru

14:50 sorry*

14:51 yeah that looks nice

14:51 ghadishayban: unreduced is useful for transducers though

14:51 Bronsa: I could actually use that macro for t.a

14:51 ghadishayban: crib away

14:51 Bronsa: I just added reduced support to the walking functions and that might help

14:53 ghadishayban: i very much enjoyed querying the AST using datalog btw

14:53 lots of interesting data there

14:55 Bronsa: 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:55 Bronsa: ghadishayban: ah yeah, definitely

14:55 ghadishayban: the bug is in the IReduceInit reduce arity

14:55 ghadishayban: solution: macros for java

14:56 amalloy: so wait, what was the bug in IPList/reduce?

14:56 ghadishayban: reduced handling, the favorite nemesis

14:56 Bronsa: ,(.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))) 1) ;; amalloy

14:56 clojurebot: #<Reduced@de04cd: "foo">

14:57 Bronsa: amalloy: a reduced in the last iteration of a reduce will not be unwrapped

14:57 amalloy: i see

14:57 Bronsa: well

14:57 of a reduce with init

14:57 ,(.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))))

14:57 clojurebot: "foo"

14:57 amalloy: and this is only if you use .reduce instead of reduce

14:57 eg because you are java code

14:57 right?

14:58 Bronsa: amalloy: yes but as ghadishayban just pointed out, transduce uses IReduceInit/reduce directly rather than going through CollReduce/reduce

15:01 stuartsierra: since puredanger's not here, do you happen to know if the clojure/conj talks will be live streamed?

15:06 stuartsierra: Bronsa: I don't know for certain, but I very much doubt it. Live streaming is expensive.

15:08 TimMc: and difficult

15:09 danielcompton: ,(require '[test.check.generators :as gen]

15:09 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

15:09 danielcompton: ,(require '[test.check.generators :as gen])

15:09 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate test/check/generators__init.class or test/check/generators.clj on classpath.>

15:09 danielcompton: worth a try

15:10 I've got some interesting behaviour with test.check and I'm not sure if it's a bug or feature

15:10 ghadishayban: Bronsa: so I have a commit that makes (fn [x a] (.concat x a)) only reflect the first time through the function

15:10 danielcompton: (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:11 ghadishayban: Bronsa: 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:11 Bronsa: ghadishayban: nice

15:11 ghadishayban: Bronsa: I also got rid of the ILookupThunk stuff for KeywordInvokes

15:11 Bronsa: and instead install a guard on the Record's class, and a direct MethodHandle field access to the particular field

15:12 Bronsa: ghadishayban: how about the protocol-fn callsites?

15:12 are the caches there still necessary or can they be avoided?

15:13 ghadishayban: the static field caches can go away, it's all encapsulated in the CallSite

15:13 I 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:13 But I think I can improve upon it...just not enough time

15:13 Bronsa: I can relate to that :)

15:15 akkad: is there an easy way to compare two jars for differences in code?

15:16 edw: tmarble: 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:17 ghadishayban: Bronsa: one thing I have been thinking about recently is a reified callframe

15:18 Bronsa: 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:18 danielcompton: akkad: you could unpack them and diff the folders?

15:18 ghadishayban: actually there are probably ways to achieve tracing without having the arg everywhere

15:19 Bronsa: ghadishayban: that would be a major ABI change

15:19 ghadishayban: sure would

15:19 Bronsa: *breaking change

15:19 ghadishayban: so far everything I have done is compatible

15:20 wei: any thoughts on freactive so far?

15:20 ghadishayban: but there are some interesting designs that are possible if not restricted by ABI

15:20 akkad: danielcompton: that's what I did

15:20 danielcompton: akkad: did it work?

15:21 ghadishayban: Bronsa: for example IReduceInit / CollReduce can really be seen as part of the same protocol

15:22 Bronsa: 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:22 Bronsa: right

15:24 ghadishayban: inlining 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:24 This is a preview of my talk on thursday

15:25 I have no solutions, btw

15:25 Bronsa: [spoilers]

15:25 ghadishayban: heh

15:25 Bronsa: I look forward to seeing a recording of your talk

15:30 danielcompton: I'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:32 amalloy: danielcompton: by "high bits" you mean bits which are 1? i thought you meant leading 1s

15:32 ghadishayban: Integer/bitCount + a mask is the shitty answer

15:33 amalloy: is there a reason you're not just using (Long/bitCount x)?

15:33 ghadishayban: amalloy: jinx

15:33 danielcompton: amalloy: yeah, bits that are on. I thought that was what high bit meant but looking now I was wrong

15:34 amalloy: ghadishayban: i'm curious what bitmask you think is useful here

15:34 if we're already using bitCount

15:34 ghadishayban: whatever high bits mean

15:34 maybe i don't follow

15:35 danielcompton: Long/bitCount is the answer here

15:35 dbasch: ghadishayban: he means “set bits"

15:35 danielcompton: certainly easier than trying to read the bit shifting algorithm

15:36 dbasch: danielcompton: TIL http://kent-vandervelden.blogspot.com/2009/10/counting-bits-population-count-and.html

15:36 ghadishayban: the JVM will intrinsify it too

15:36 POPCNT instruction i think

15:36 danielcompton: looks 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:38 dbasch: danielcompton: and by default it uses the cpu instruction in recent versions if available

15:38 danielcompton: dbasch: thanks, that was really interesting

15:39 ghadishayban: it's part of the secret sauce to persistent hashmaps

15:39 makes them fast

15:41 danielcompton: ghadishayban: interesting https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L752

15:53 Wow Long/bitCount takes 2 nanoseconds vs my naive version taking 100 milliseconds

15:55 The bitshifting version took 50 ns but wasn't giving correct results so it's not particularly useful

15:56 amalloy: I guess that makes you a 1000x programmer then?

15:58 amalloy: is 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:58 xemdetia_: it's a logarithmic person scale

16:03 dbasch: danielcompton: curious how you’re measuring the speed of Long/bitCount

16:03 danielcompton: dbasch: criterium

16:04 amalloy: Well I can't pay you 50,000x so 1,000x will have to do

16:04 dbasch: I thought that would be the right way to get it optimised fully?

16:05 kenrestivo: it 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:05 danielcompton: kenrestivo: usually it's the one you just added :)

16:05 kenrestivo: right, just like a house of cards. here goes..... WIN! or... here goes... AAWWWW...

16:06 amalloy: kenrestivo: 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:06 kenrestivo: who says it'll be a man? but yeah, it's a Hard Problem.

16:07 amalloy: kenrestivo: 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:07 joegallo: indeed, not a man, but a god

16:08 danielcompton: I'd really like to see a Clojure take on OSGI

16:08 I know Clojure OSGI exists (and the person who wrote it) but it doesn't seem *simple* to me

16:08 (inc talios)

16:08 lazybot: ⇒ 3

16:09 bja: A man once solved dependency hell, but his black art of static linkage was abhorrent to all those who witnessed it.

16:09 dbasch: what is the right pronoun for an AI?

16:09 amalloy: dbasch: lord and master

16:09 * dbasch doesn’t want to be killed by an AI for being disrespectful

16:09 danielcompton: $google roko's basilisk

16:09 lazybot: [Roko's basilisk - RationalWiki] http://rationalwiki.org/wiki/Roko's_basilisk

16:10 danielcompton: Roko's basilisk is still in my top 5 funniest things on the internet

16:10 hyPiRion: dbasch: they, unless they identify with something

16:10 don't think they've come that far yet

16:10 bja: hyPiRion: #ai #otherkin?

16:11 sorry, was wasting time on tumblr today

16:11 * dbasch wonders if claiming to believe in the Singularity is a bit like Pascal’s wager

16:12 amalloy: danielcompton: that is pretty entertaining

16:12 metellus: dbasch: only for versions of the singularity that are similar to roko's basilisk

16:13 dbasch: reading now

16:30 mskoud: having 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:31 amalloy: mskoud: 2dvector isn't actually a legal name

16:31 annelies: That's a vector of vectors, not a 2D vector.

16:31 mskoud: no sorry, lets call it d2vector.

16:32 amalloy: annelies: that seems like even less useful nitpicking than mine

16:32 mskoud: the problem is i need to assoc-in multiple times using the result from the prev assoc-in in the next assoc-in...

16:33 amalloy: mskoud: 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:33 reduce is exactly the pattern fo "do X multiple times, using the result of the previous call to X"

16:33 dbasch: mskoud: what do you need the original vector for?

16:33 mskoud: i dont need the org vector, just the result.

16:34 ill look into a solution with reduce. Thanks.

16:35 dbasch: mskoud: 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:36 amalloy: {blake}: it sounds like eastwood inspects the :arglists of functions you call, and expects those to reflect what args they actually take

16:36 whereas hiccup fabricates its own arglists. i certainly wouldn't care about that warning

16:36 mskoud: dbasch: 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:38 dbasch: mskoud: 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:38 mskoud: yes, but the 2d vector may be larger

16:39 dbasch: mskoud: the “outer” vector is fixed?

16:39 outer rectangle I mean

16:39 mskoud: yes

16:39 {blake}: amalloy: OH, wait! Nevermind, I got it. Thanks.

16:39 (inc amalloy)

16:39 lazybot: ⇒ 191

16:39 amalloy: {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 Is the exact text.

16:40 But I see now I'm calling it sometimes with one parm, sometimes with two. Which...huh.

16:40 amalloy: huh. well, i'm a bit puzzled. it sounds like you figured it out; what was going on?

16:41 {blake}: hang on...

16:43 amalloy: {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:43 search for "defelem" on https://github.com/jonase/eastwood, for example

16:43 {blake}: amalloy: Yes. That is how submit-button is defined.

16:44 amalloy: {blake}: it's not anymore

16:44 {blake}: amalloy: I wonder if it's a cursive thing. The code IS working.

16:44 amalloy: oh, nm

16:44 yes it is

16:45 {blake}: amalloy: OK, so I'm not crazy. (At least this isn't evidence of same.)

16:45 amalloy: Why is passing two parameters working? Macro magic?

16:45 amalloy: {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:46 (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:47 amalloy: yep

16:48 {blake}: And that's cool, man.

16:49 mgaare: lisp's parens are like Zuckerberg's hoodie

16:49 justin_smith: it's a signifier that we are all douchebags?

16:49 unpeet: stop spamming

16:49 technomancy: ^^^

16:51 mgaare: simple 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:51 mi6x3m: hey, can anyone recommend a templating library for clojure code itself?

16:55 dbasch: mgaare: 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:55 SagiCZ1: is there any variant of sort function that returns lazy sequence? i guess that makes no sense huh..

16:56 dbasch: mgaare: I don’t like to worry about clothes so I live in a portable cardboard box

16:56 tuft: SagiCZ1: if you make one sell it for $10e6 =)

16:56 * tuft doesn't like to worry about clothes so he has a wife.. so old fashion.

16:56 dbasch: I also don’t waste time leaving the house because I take it with me

16:57 mgaare: dbasch: could substitue Steve Jobs's turtleneck for Zuck's hoodie and have the same effect

16:57 SagiCZ1: tuft: but there are some algorithms that can sort by batches and then merge them or something..

16:57 dbasch: mgaare: or randomly grab whatever is clean, which is what most of us do

16:58 joegallo: one could write a lazy version of a selection sort... but why would you...

16:59 SagiCZ1: joegallo: what if you cant fit the collection you want to sort in memory..

17:00 *what if you cant fit the collection in memory

17:00 joegallo: external merge sort

17:00 amalloy: it's certainly not impossible to write a lazy version of a mergesort. haskell does it in like one line

17:01 annelies: Perl probably does it in five characters.

17:01 amalloy: but it's not a good solution to "too big to fit in memory"

17:01 SagiCZ1: amalloy: so did the author get $10e6?

17:01 mi6x3m: any way to get a namespace from a symbol?

17:01 amalloy: &(doc find-ns)

17:01 lazybot: ⇒ "([sym]); Returns the namespace named by the symbol or nil if it doesn't exist."

17:02 mi6x3m: thanks amalloy

17:02 dbasch: SagiCZ1: https://github.com/chrismgray/clojure-heap-sort

17:02 mi6x3m: you need an inc, i'll give you an inc

17:02 dbasch: (haven’t looked at it, but read the blog post)

17:02 mi6x3m: (inc amalloy)

17:02 lazybot: ⇒ 192

17:02 SagiCZ1: dbasch: thanks

17:02 tuft: mi6x3m: you can get them from var metadata too if it's not a symbol literal in code you're working with

17:02 dbasch: wow, amalloy is only 8 karma from his second life-sized cardboard cutout of rich hickey

17:03 technomancy: (inc dbasch)

17:03 lazybot: ⇒ 17

17:03 amalloy: dbasch: i've been dying to get a picture of the two of them high-fiving each other

17:04 dbasch: amalloy: (concat hickey-cutout (reverse hickey-cutout))

17:04 that would work better if it were a sequence of legos or something

17:04 mearnsh: haha

17:05 justin_smith: dbasch: that sounds like paper dolls to me

17:15 gfredericks: does anybody know why nrepl uses an atom to hold the session?

17:17 dbasch: gfredericks: because it’s the obvious way to do it?

17:17 gfredericks: I don't know of any case where it's mutated

17:18 by "the session" I mean the map of dynamic vars to their values

17:20 hmmm; looks sticky

17:20 I just want to sit down for a week and refactor nrepl

17:20 danielcompton: Is there any way to destructure anonymous function literals? i.e. #()'s

17:21 amalloy: danielcompton: 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:21 dbasch: amalloy: danielcompton surely meant “deconstruct” as in Derrida

17:21 danielcompton: amalloy: yes destructuring the args. Not sure how to destructure a function

17:21 {blake}: post-modern programming

17:22 amalloy: danielcompton: no. if you need to do anything at all complicated in a #() function, just use a real (fn []) lambda instead

17:22 danielcompton: amalloy_: thought that was the case but I'd try and ask anyway. It's not an easy thing to google for

17:26 (inc amalloy)

17:26 lazybot: ⇒ 193

17:27 danielcompton: getting closer...

17:30 annelies: I want to write an AWK-like library for Clojure.

17:30 I love AWK and I love Clojure.

17:32 justin_smith: annelies: cool

17:32 annelies: I was thinking an expect tool for clojure would be neat

17:32 speaking of text streaming / text processing madness

17:32 TimMc: yak streaming

17:33 justin_smith: annelies: you could call it boston-clock

17:33 aka clawk

17:33 mi6x3m: annelies: do you love popcorn?

17:33 annelies: No, it always gets between my teeth and takes ages to get it out.

17:33 And it doesn't taste very well either.

17:33 mi6x3m: then don't write a popcorn library for clojure

17:33 annelies: So it'd be near grapefruit if it were a fruit.

17:34 mi6x3m: anyone knows a templating library for clojure source?

17:34 joegallo: that is, creating more clojure source from templates where you'll fill in the blanks in the clojure source?

17:35 danielcompton: mi6x3m: lein templates?

17:35 mi6x3m: what are you trying to do with it?

17:35 mi6x3m: define a template, specify variables through clojure code

17:35 and get clojure code as string

17:36 joegallo: that's macros and, well, normal clojure...

17:36 mi6x3m: I need it formatted though

17:36 danielcompton: mi6x3m: use a pretty printer?

17:36 joegallo: clojure.pprint/pprint does a decent enough job

17:36 mi6x3m: not in this case, anyhow, time for bed :)

17:38 annelies: Something like this: https://gist.github.com/rightfold/1fe7b754a2d0248e1cfb

17:44 But generalised to work in any kind of sequence, not just with strings.

17:45 arrdem: a good text munging lib would be nice to have

17:46 dbasch: arrdem: 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:47 arrdem: dbasch: that's a legitimate question and I don't have a good answer

17:48 the text munging tools I've built for myself are stuff like paragraph/block detection and indentation/unindentation

17:50 bobpoekert: arrdem: does instaparse maybe do what you want?

17:50 technomancy: instagrammar

17:50 annelies: instagram

17:50 arrdem: does Instaparse support context sensitive grammars? I don't think it does..

17:51 should set up a repo that's just Instaparse grammars for known PLs

17:51 it'd be fun

17:51 bobpoekert: I think it supports PEG

17:51 arrdem: want to parse $OTHER_PLEB_LANGUAGE? we have a library for that..

17:52 bobpoekert: you could probably write a shim around IntelliJ's plugin architecture

17:52 or eclipse

17:52 people have already written intellij and eclipse plugins for pretty much everything

17:53 wouldn't be as clean but it'd be hecka less work

17:56 annelies: Not for Eiffel. :(

17:57 bobpoekert: aww

18:32 danielszmulewicz: I 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:33 panther_: Clojure's Fast! :D

18:33 danielszmulewicz: The only way to get it to produce the uberjar is with the dependency defined in the base dependencies.

18:34 In other words, can't I have production specific dependencies with leiningen?

18:35 technomancy: danielszmulewicz: someone opened a bug about a problem specific to tools.nrepl; this might be that. does it occur with other deps too?

18:35 danielszmulewicz: technomancy: I don't know. I can try.

18:37 technomancy: Yes! It looks like Ddpendencies are not picked up when set in production.

18:38 technomancy: danielszmulewicz: on 2.5.0?

18:39 danielszmulewicz: correct.

18:39 technomancy: can you open an issue?

18:39 danielszmulewicz: Sure.

18:39 jkj: earlier i hit a problem with lein compiling the aot classes only for uberjar... though i made the profiles exactly the same

18:39 didn't find any uberjar magic in code though, so i gave up and blamed sunspots

18:42 technomancy: uberjar 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:48 akurilin: Has 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:42 justin_smith: akurilin: yes, caribou does this extensively

19:43 in fact building trees

19:43 (unless I misunderstand you)

20:20 mmitchell: how 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:29 raspasov_: 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:30 dbasch: raspasov_: sounds like your project.clj is incorrect

20:30 raspasov_: the non auto-refresh command "lein expectations" compiles fine

20:30 but as long as I add [lein-autoexpect "1.4.0"]

20:30 to :plugins

20:30 it errors

20:31 amalloy: it sounds like the :dependencies in your project are wrong

20:31 dbasch: paste your project.clj somewhere

20:32 raspasov_: https://gist.github.com/raspasov/78d79ba54278d9a28168

20:33 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:33 it's just that "lein autoexpect" fails

20:35 danielcompton: raspasov_: so it compiles with autoexpect in, you just can't run lein autoexpect?

20:35 raspasov_: yes

20:36 danielcompton: raspasov_: can you past the full stacktrace somewhere?

20:36 paste

20:37 raspasov_: https://gist.github.com/raspasov/9c7fda31d0c6cf7dfc3f

20:39 amalloy: raspasov_: lein-environ looks suspicious

20:39 using lein-jacker, and depending on clojure 1.2.1, makes me think it is super old

20:39 raspasov_: hm I think it's out of date

20:39 thanks for the hint - let me try upgrading it!

20:47 dbasch: raspasov_: it’s actually lein-protobuf

20:47 raspasov_: yes I just found that

20:48 by removing lein-protobuf it seems to work

20:49 amalloy: dbasch: welllll, whether it is an issue with lein-protobuf or with leinjacker depends on the lein spec

20:50 lein-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:50 danielcompton: amalloy: both

20:50 dbasch: amalloy: lein-protobuf is bringing in an old version of leinjacker, that’s what I meant by “is” :)

20:51 amalloy: dbasch: whaaaaaat. i barely touched lein-protobuf, but i didn't think we used leinjacker

20:51 danielcompton: leinjacker should be checking for sequential? instead of vector?

20:51 amalloy: danielcompton: the newer version in fact does that

20:51 https://github.com/sattvik/leinjacker/commit/a2d631915a2f3adc3f0c68833ceaa72d139a91a1 suggests

20:51 dbasch: Possibly confusing dependencies found:

20:51 [lein-protobuf "0.4.1"] -> [leinjacker "0.4.0"]

20:51 amalloy: as of two friggin years ago

20:51 man, it totally does, dbasch. that is so gross

20:52 i guess it must have made sense two years ago, during the lein2 revolution

20:52 danielcompton: maybe lein autoexpect is at fault for messing with the deps in the first place?

20:53 amalloy: danielcompton: 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:53 danielcompton: https://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:53 raspasov_: yea I found some other unrelated github issues around this (vector?) checking

20:54 mmitchell: ugh, 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:54 danielcompton: talios: ?

20:54 talios: hullo

20:55 danielcompton: talios: can you help mmitchell? You're pretty clued up about that kind of stuff

20:55 raspasov_: so any idea if I can fix this on the fly? :)

20:55 danielcompton: raspasov_: the solution to plugins messing with your dependencies is to write your own plugin to put the dependencies back together

20:56 talios: mmm, annotations - lets think. annotation on the _actual_ class?

20:56 i.e. @Foo public class xxxx {}

20:56 hrm - not sure if clojure actually lets you do that - hrm

20:57 raspasov_: danielcompton: any way I can maybe bump up the lein-protobuf dependency to leinjacker 0.4.2

20:57 I think this might fix it

20:57 dbasch: talios: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/genclass/examples.clj#L34

20:57 raspasov_: (but not sure)

20:57 mmitchel_: sorry lost my connection there. Did I miss anything? :)

20:58 dbasch: mmitchel_: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/genclass/examples.clj#L34

20:59 talios: ah you can do it from (gen-class - not :gen-class on the NS - keep forgetting their's the alternative

21:00 mmitchell: dbasch: thanks, will have a look!

21:01 dbasch: ok so it's just metadata on the class name?

21:02 danielcompton: raspasov_: 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:02 though

21:02 raspasov_: ok thanks! I'll give it a shot

21:02 dbasch: mmitchell: haven’t tried it but I assume that test passes

21:14 QPrgrm: hello baby

21:15 ==bby

21:34 seancorfield: dakrone: 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:39 raspasov_: btw guys I bumped up the leinjacker dependency on lein-protobuf to 0.4.2 and now lein-autoexpect seems to work

21:40 sent in this pull request as well https://github.com/ninjudd/lein-protobuf/pull/10/commits

21:45 akurilin: justin_smith: which part of caribou can I find that in?

21:55 danielszmulewicz: java.lang.StackOverflowError, compiling clojurescript on one machine. No problem on another.

21:59 justin_smith: akurilin: caribou.model does that sort of stuff

22:00 greenyouse: anyone know how to use .lein-classpath for testing leiningen plugins? (to avoid "lein install")

22:02 akurilin: justin_smith: wow that's a big ass library

22:02 what exactly is caribou again?

22:09 justin_smith: akurilin: it was developed as a RAD system for webapps

22:09 akurilin: a replacement for RoR kind of stuff

22:23 akurilin: justin_smith: googling for RAD system is totally not what I expected to find

22:23 justin_smith: hah

22:23 akurilin: justin_smith: so ActiveRecord-style ORM?

22:23 justin_smith: kind of

22:23 yeah

22:23 basically data models defined in clojure edn

22:24 and that is translated to sql db

22:24 with a web based admin for defining said models, and making entries

22:24 and specific webapp stuff like creating pages and assigning controllers / actions / templates via point and click

22:25 the system reads all the page definitions from the db, and turns it into a running app

22:42 akurilin: interesting

22:42 that sounds pretty cool

22:43 defininetly and impressive amount of work went into that

22:44 justin_smith: heh, yeah

22:44 it was my first clojure project, but I just came in to help a friend

22:45 many things I would do differently today (as with him, I am sure)

22:45 it's less active since the company laid us off and stopped using clojure (for client reasons)

22:45 csd_: 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:46 justin_smith: csd_: wait, that looks wrong

22:46 (loop (recur)) is not valid

22:47 csd_: thats truncated

22:47 justin_smith: OK, I just don't even get what it's truncated from

22:47 csd_: or abbreviated rather

22:48 http://pastebin.com/tqj9r6Ac

22:49 i found the idiom searching for how to nest loop statements

22:49 justin_smith: (when (= :anything) :continue) is absurd

22:49 it always returns continue

22:49 err sorry

22:49 that's not what it is

22:49 csd_: the :continue is within the =

22:50 justin_smith: (when (= x y) :continue)

22:50 right

22:50 oh, shit

22:50 (when (= x continue))

22:50 is silly - it always returns nil

22:50 and the when does nothing, it may as well be do

22:50 or not be there

22:51 csd_: oh i think i see

22:51 justin_smith: it's actually very odd code, to my eye

22:51 csd_: 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:51 justin_smith: right, the when does nothing

22:52 csd_: its from http://rosettacode.org/wiki/Loops/Nested#Clojure

22:52 justin_smith: the return value of = is not making any difference

22:52 csd_: I was just lucky that it happened to work for my purposes

22:52 justin_smith: hehe

22:52 yeah, that is weird code

22:52 csd_: I think its just there to prevent clojure complaining about the second recur statement

22:52 andyf: i 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:53 justin_smith: csd_: ? why would multiple recur statements even matter?

22:53 andyf: empty body

22:53 csd_: i was getting an error about tail recursion earlier

22:53 justin_smith: it's a when that only has the condition part

22:53 csd_: the when macro is not going to make a difference there

22:53 csd_: oh interesting

22:54 justin_smith: OK, in print-matrix, there is actually a body in both the when blocks

22:54 so that makes more sense

22:54 it's still just common lisp that someone is trying to make clojury

22:54 it's not really clojure per se

22:54 I mean it's technically valid...

22:54 but it's common lisp code

22:55 andyf: see the code now in csd_'s paste. The loop looks like it always returns nil, so the (= (loop ...) :continue) will always be false.

22:55 justin_smith: andyf: but it doesn't matter

22:55 because there is no body

22:55 and yeah, it will not return :continue

22:55 andyf: right. So you can remove the outer when, leaving only the loop, and it should do exaclty the same thing.

22:55 justin_smith: exactly

22:56 also, the nested when in the rosetta code is silly

22:56 csd_: ok you're right that does work

22:57 justin_smith: ,(= (for [x (range 10) y (range 10)] [x y]) (for [x (range 10)] (for [y (range 10)] [x y])))

22:57 clojurebot: false

22:57 andyf: The rosetta code actually can return :continue from the inner loop, though, so it can make a difference in the overall behavior.

22:57 justin_smith: err

22:58 andyf: I'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:58 justin_smith: ahh, now I see what it was doing

22:58 andyf: yeah, true that

23:10 fairuz: justin_smith: hey. I'm still confused about yesterday :(

23:12 justin_smith: OK...

23:12 fairuz: I come out with this edn. http://pastebin.com/WhMWdsYU

23:13 Still confused on how to pass the reference to link them

23:16 justin_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:16 :label "BrankLink" :name "isLinkedTo" :nodeA ct2 :nodeB ct3}]})

23:16 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:16 justin_smith: err oops

23:16 too verbose for irc

23:18 fairuz: so does the graph api take identifiers when making a retrieval or link call?

23:19 fairuz: For link call yes

23:19 we will get the indentifier when doing retrieval or creating new nodes

23:20 justin_smith: so 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:20 oh, the insert returns you identifier...

23:20 fairuz: yep

23:21 So basically the map in :create should gives me the list of identifiers that I can use in :link

23:21 justin_smith: so 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:21 if you wrap that in (into {} ...) you get a hash map, from :ref key, to the indentifier that was inserted for that key

23:22 then you can use a lookup

23:23 (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:23 ct2 :nodeB ct3}]})

23:23 man, still too long

23:23 ,(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:23 clojurebot: #'sandbox/edn

23:24 justin_smith: ,(into {} (map (fn [[n [d]]] [n (hash d)]) (group-by :ref (:create edn))))

23:24 clojurebot: {ct1 1330914623, ct2 -568547736, ct3 -302159458}

23:24 justin_smith: that's pretending that "hash" is the function that returns you identifier

23:25 now you can use that map to lookup id from key, right?

23:26 fairuz: yep!

23:26 need some time to digest and test :)

23:26 justin_smith: you can do a doseq (or if you consume the results, a map) to create links

23:26 right

23:26 that destructuring is a bit funky to be sure

23:27 [[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:28 fairuz: *in my mind* whattttt

23:28 :)

23:29 justin_smith: ,(let [[[n [d]]] '(a '(b c d))] {:n n :d d})

23:29 clojurebot: #<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Symbol>

23:29 justin_smith: err

23:29 ,(let [[n [d]] '(a '(b c d))] {:n n :d d})

23:29 clojurebot: {:n a, :d quote}

23:29 justin_smith: there we go (and oops

23:29 )

23:29 ,(let [[n [d]] '(a (b c d))] {:n n :d d})

23:29 clojurebot: {:n a, :d b}

23:29 justin_smith: maybe that helps?

23:35 fairuz: hmm, I'm not getting the last one

23:37 arrdem: besides exist, what do the Clojure docs not do for you?

23:38 search I suspect is gonna be the big one

23:40 justin_smith: ,(let [[n [d]] '(a (b))] {:n n :d d}); fairuz - what about this?

23:40 clojurebot: {:n a, :d b}

Logging service provided by n01se.net