#clojure log - Oct 13 2013

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

0:00 allenj12: i think ill right it out the long way then look for shortcuts ty

0:00 arrdem: eval tends to be OK only when doing something that fundimentally involves code generation, such as parser generation or query optimization... partial applications and returning functions are totally cool, and probably what you want to look at.

0:02 allenj12: arrdem, hmm kk

0:05 coventry: dnolen: Wow, multi-signature defns generate huge analyses. Might want to pprint the one for (defn foo ([a] a) ([a b] (+ a b)))

0:05 Anyway, pretty cool.

0:06 dnolen: coventry: the analysis is really big, data just copied around into the tree - annoying for humans reading the AST but useful in the implementation.

0:06 analysis "isn't" really big

0:06 coventry: i.e. you just seeing a lot of redundant data

0:07 coventry: but thanks for checking it out

0:17 coventry: Oh, OK.

0:18 dnolen: coventry: in future we'll likely emit a minimal tree (nice for humans) and the redundant information would be provided in passes

0:31 babu`: dakrone, any idea when you will fix issue 153: Please add support for proxy authorization

0:46 technomancy: babu`: speaking from experience: issues that affect a tiny slice of people typically don't get fixed until one of those people steps up and does the fixing

1:09 benkay: ic/join #clojurescript

1:09 derp

1:10 satshaba2: OK so I need to calculate some values vith great precision, but I need to use the constant e. So I get that from Math.E and it's a double. What effect will that have on the rest of my calculations?

1:11 is there a way to convert it to an arbitrary precison number?

1:11 like the literals in the rest of clojure?

1:11 technomancy: satshaba2: 0.1 type literals in clojure aren't arbitrary precision, unfortunately

1:12 the only language I know that does that is racket

1:12 satshaba2: hmmm ok

1:16 jonasen: dnolen: bbloom: I read the logs and saw you had an interesting discussion with cemerickon cljs "static" fields. I brought this up last summer https://groups.google.com/forum/#!topic/clojure-dev/Ge5uEqlUcJk and essentially agree with everything you said

1:20 allenj12: if i have a vector of sets [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}] and all values are unique and i want to find the set with a specific key value

1:23 woops nvm i had the answer i was just being dumb and indexed poorly sry

1:24 benkay: does anyone have a clue about calling clojurescript functions at a repl to which a browser is connected and evaluating them in that browser's context?

1:26 satshaba2: benkay: I think LightTable does something like that

1:32 what's the most idiomatic way to sum up a vector?

1:33 i.s. (sum [1,2,3,4,5])

1:33 i.e.*

1:33 I couldn't find a sum builtin like in python

1:33 marcopolo2: benkay: as long as you are using a browser repl, by definition it should run in the browser context

1:33 ,(reduce + [1,2,3,4])

1:33 clojurebot: 10

1:33 satshaba2: ok thanks

1:34 marcopolo2: satshaba2: np

1:35 benkay: satshaba2: i have already poured far too much time into learning Emacs. i'm not about to abandon that for an IDE built by someone whose mission is to "fix programming".

1:35 satshaba2: haha, but I bet he's *soooo* close

1:35 benkay: great goal, i'm sure, but i can't afford to take a dependency on a bipolar lisp programmer's emacs replacement ;)

1:36 satshaba2: understandable

1:36 benkay: not in the sense of casting aspersions on mental illness but in the classic essay sense of the world

1:36 word*

1:36 marcopolo2: that's what i was banking on! i can't figure out how to get access to the clojurescript functions that i've already written and are already executing in that context from the repl though.

1:38 in an ideal world i could just C-c C-k and then call my fn's

1:50 arrdem: ah ffs.

1:51 bitemyapp: was there a fix to the "old nrepl, new lein" bug mentioned earlier? I'm reproducing it :D

1:53 dpathakj: arrdem: I had that problem too earlier today. solution: upgrade your nrepl.

1:54 satshaba2: is there anything like haskell's zipWith in clojure?

1:54 arrdem: dpathakj: hum... package.el claims I'm fully up to date :/

1:55 dpathakj: marmalade or melpa? that was my problem.

1:55 arrdem: lemme check, I think I have both configured.

1:56 dpathakj: which are you using? I've just had both enabled forever.

1:56 satshaba2: found it: (map + [1 2 3] [4 5 6])

1:56 dpathakj: so did i.

1:56 satshaba2: ,(map + [1 2 3] [4 5 6])

1:56 clojurebot: (5 7 9)

1:59 dpathakj: i had marmalade and melpa, and several packages turned out to have been grabbed from melpa. restarted without melpa enabled, downloaded the missing stuff, and was good.

2:01 arrdem: dpathakj: hum... I tried restarting with both repos and neither seems to fix it.

2:04 dpathakj: arrdem: is your problem the same as mine was? M-x nrepl-jack-in -> blank repl buffer that doesn't eval?

2:04 arrdem: dpathakj: that's the one...

2:05 dpathakj: I may just git reset --hard my .emacs.d/

2:06 dpathakj: so try enabling only marmalade, restarting, m-x package-list-packages … ing… , and see what you see. i saw a whole bunch of 'new' packages, among which were those i wanted.

2:06 arrdem: ok. resetting to before my last package upgrade didn't do it for some reason... :/

2:08 ok.. on only marmalade I don't see any changes to nrepl.

2:13 satshaba2: why is (type 100M) a java.math.BigDecimal

2:13 and (type 100N) at clojure.lang.BigInt

2:13 ?

2:13 dpathakj: try uninstalling and reinstalling it. i do not know how emacs deals with multiple package sources so this may be worthless advice but it's worth a shot.

2:13 satshaba2: ,(type 100M)

2:13 clojurebot: java.math.BigDecimal

2:14 satshaba2: ,(type 100N)

2:14 clojurebot: clojure.lang.BigInt

2:14 satshaba2: ,(type (bigint 1))

2:14 clojurebot: clojure.lang.BigInt

2:14 satshaba2: ,(type (bigint 1.0))

2:14 clojurebot: clojure.lang.BigInt

2:15 dpathakj: http://clojure.org/data_structures says: "Numeric literals for BigInt and BigDecimal are specified using a postfix N and M respectively."

2:16 satshaba2: dpathakj: right but is clojure.lang.BigInt as math.BigInteger?

2:17 arrdem: dpathakj: well here goes... nuking from orbit :D

2:17 dpathakj: wait

2:17 or not

2:17 but i wanted to know if un/reinstalling it would work

2:17 arrdem: everything's under git. I can just revert if this doesn't work :D

2:20 that totally did _not_ work.

2:20 drat

2:21 dpathakj: satshaba2: are they the same? no. but BigInt uses BigInteger. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/BigInt.java

2:22 arrdem: dpathakj: well.... if I back up to my last package upgrade on 10/5/2013 everything works again....

2:22 dpathakj: what date convention do you observe? is that a week or five months ago? :)

2:23 arrdem: dpathakj: that's a week ago.

2:23 satshaba2: dpathakj: Thanks!

2:25 dpathakj: arrdem: hmm.

2:29 so `ls .emacs.d/elpa/` shows nrepl-0.2.0/ ? or some other directory name involving a date?

2:30 arrdem: dpathakj: nrepl-20130924.1016

2:30 er.

2:30 I have two nrepl- dirs.

2:36 dpathakj: both look like nrepl-yearmonthdate.time ?

2:38 that is the melpa format. i can reproduce the bug by killing off my nrepl-0.2.0/ directory (from marmalade) and redownloading from melpa.

2:38 arrdem: yep. and the other is just .elc files that didn't get nuked by the git reset

2:38 I can confirm melpa format.

2:38 dpathakj: and then i can fix it by the reverse.

2:38 arrdem: ok gonna try and verify the fix.

2:59 dpathakj: arrdem: how'd it go?

3:00 arrdem: dpathakj: haven't tried yet.. I'm doing work in my working config :P

3:00 dpathakj: pfft, work

3:03 well good luck

4:56 sm0ke: anyone using lighttable?

9:36 noncom: why is this so?

9:36 https://www.refheap.com/19744

9:42 ucb: ,(type (rest '(thing and-thing)))

9:42 clojurebot: clojure.lang.PersistentList

9:43 ucb: ,(type (drop 1 '(thing and-thing)))

9:43 clojurebot: clojure.lang.LazySeq

10:01 noncom: ucb: ok, i see, but is that considered normal? if yes, then how is it usually dealt with? (presuming i want to receive PersistentList). What if I (drop 20) - i can't use (rest) instead of it...

10:03 ucb: noncom: I think that's normal in the sense that the docs clearly say what each of drop and rest return. Further, conj 'conjs' the item onto the collection however its behaviour varies on the concrete type of the collection.

10:08 gfredericks: ,(-> (a b c) quote rest type)

10:08 clojurebot: clojure.lang.PersistentList

10:08 gfredericks: ,(->> (a b c) quote (drop 1) type)

10:08 clojurebot: clojure.lang.LazySeq

10:09 gfredericks: noncom: why are you concerned with the type of the object?

10:18 noncom: gfredericks: later i want to make a (fn [x] ..) from it.. i guess i'll have to use (eval) anyway...

11:07 arkh: any pedestal users on? I'm wondering how to introduce a macro like cond-let in a (ns ^:shared ...) fashion

11:39 noncom: how do i replace a symbol in an s-expression, passed to a macros, for another namespace-qualified one? i get some strange error. Specifying the qualification manually helps, but I would like to avoid that?

11:39 example: https://www.refheap.com/19748

11:41 edited the example, removed the quote on the passed expression, sorry. but nevertheless..

11:58 llasram: noncom: Not the solution to your immediate problem, but maybe use tools.macros symbol-macrolet?

11:58 `cbp: noncom: remove the eval

12:00 (defmacro call-me [sexpr] (replace-something sexpr))

12:02 Morgawr: hello, I have a weird questions, does anyone have any good literature/resources to read about dealing with mutable state in clojure? I know clojure mostly deals with immutable but I wanted to write something where I'd need mutable data structures and wanted to know how to deal with it (either java interop or pure clojure)

12:05 glosoli: Anyone using datomic here ?

12:12 Morgawr: https://github.com/halgari/clojure-metal this is interesting, anybody got experience with it and the current state?

12:12 noncom: `cbp: but actually IRL i am building a (fn) and if I do not call for (eval), it remains being a PersistentList, without the ability to use it as an (fn)

12:15 `cbp: noncom: actually your code is fine i guess you just were calling call-me with wrong arguments

12:16 llasram: noncom: I'm skeptical you need eval... What's the broader problem?

12:16 `cbp: although eval as the return value of a macro is pretty weird

12:17 llasram: `cbp: weird / probably usually wrong

12:17 `cbp: noncom: that error shows up when you try to use an object as the return value of a macro

12:17 noncom: i need a factory of (fn)s to which i could pass something like (wow [x] (+ x one two three)) and receive (fn wow [x] (+ x ns-1/one ns-2/two ns-2/three)) ...

12:18 i mean it must replace certain symbols with qualified ones..

12:18 just to unload the user from specifying the qualification manually

12:19 llasram: noncom: You don't need eval for that -- just a macro. The macro should return the modified list, which will then be compiled in place of the original from, producing a function at compile-time

12:19 noncom: but then when i try to call the forged (fn) with (apply) it gives: ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.IFn clojure.core/apply (core.clj:617)

12:20 `cbp: noncom: paste? :P

12:21 noncom: uh, well, it's a part of bigger code which is not yet factored well..

12:22 llasram: noncom: Well, try to make a minimal example. In general what you've described should work just fine

12:22 (w/o eval)

12:22 noncom: ok

12:30 `cbp: noncom: https://www.refheap.com/19749

12:31 (I just didnt know how you were creating the fn)

12:32 noncom: `cbp: you're using ` which resolves the symbols.. but i don't use it.. i'm preparing a refheap now..

12:40 hmmm the test case that i've prepared works ok...

12:41 looks like there is some different problem somewhere in the code..

12:51 ok i've figured it

12:51 https://www.refheap.com/19750

12:51 the problem is that i use ^:dynamic for the replacement

12:53 but still i don't understand why can't it handle a dnamic variable like that..

12:54 llasram: noncom: Hmm. Actually, I think the problem is that w/in a macro, you're using postwalk-replace to swap the symbol `something` for the *value* of the var `something`. Try changing your map to {'something `something}

12:57 noncom: oh wow

12:57 that's what

12:57 and that's why it worked in the example of `cbp

13:21 although still i have to use (eval) to avoid that: ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.IFn clojure.core/apply (core.clj:617)

13:22 llasram: noncom: Still really shouldn't. Minimal example?

13:22 noncom: the prepared example works fine, but my real code doesn't..

13:22 so i will look now more

13:57 no, can't find it now. all seems fine. guess i'll take a fresh look tomorrow or so..

13:58 just somehow the returned value does not get evaluated

13:58 creating similar conditions in my test example does not give the same symptoms

14:01 `cbp: :P

14:25 gdev: marginalia 0.8.0 milestone pushed to December 31st.

14:27 only two years overdue

14:29 gfredericks: noncom: cons vs persistent list is not normally an issue when using macros

14:31 muhoo: glosoli: yah, but a better place to ask might be #datomic

14:32 i can guarantee you everyone there is :-)

14:32 glosoli: muhoo: thanks sir, obvious thing I did not try h,m

14:45 gfredericks: so apparently the args to read-eval are unevaluated.

14:46 #=(drop 1 (range 10)) => (10)

14:46 #=(drop (inc 0) (range 10)) => PersistentList cannot be cast to Number

14:46 * gfredericks did not expect that

14:47 gfredericks: and the first item has to be a symbol

14:48 curiously an easy workaround is to use #=(eval ...)

15:32 strangeworks: Hi there guys! I'm one of the vim guys, and everywhere in clojure resources highly recommended to use emacs. What benefits of using emacs instead of vim for clojure development?

15:35 dobry-den: strangeworks: i was solely a vim user until i decided to check out emacs for clojure on a whim

15:35 with evil-mode, it's pretty much vim

15:36 strangeworks: benefits include: no vimscript

15:37 mtp: vimscript is pretty asstastic tbh

15:37 dobry-den: i've never used vim for clojure though. i dont know how good its repl integration is.

15:37 mtp: "vim blows at interacting with subprocesses"

15:37 marcopolo2: strangeworks: I've used vim with clojure for a while, and it's fine

15:38 I've been jealous of emacs users with their slimeyness, but their are plugins that bring similar behaviour to vim

15:38 dobry-den: as long as you can eval the current file and eval the current line in vim, it'd be alright

15:39 marcopolo2: strangeworks: I recommend vimclojure (https://github.com/vim-scripts/VimClojure) for syntax and rainbow parens, and fireplace (https://github.com/tpope/vim-fireplace) for repl support

15:40 je: After Clojurescript update (1885 to 1934), on compile I get: ArityException: Wrong number of args (3) passed to: reader-types$indexing-push-back-reader

15:40 Anyone know why?

15:40 dobry-den: marcopolo2: where does the output show up when you eval a line with fireplace?

15:42 marcopolo2: dobry-den: I don't know what it's called, but the spot spot where you write :commands expands to print the result

15:42 dobry-den: oh right

15:42 duh

15:43 marcopolo2: I also use vim-slime for working with a clojurescript browser repl since it doesn't have an nREPL interface

15:43 jonasen: je: You probably have to add the latest tools.reader to your project.clj

15:44 [org.clojure/tools.reader "0.7.9"]

15:46 je: jonasen: thanks, adding [org.clojure/tools.reader "0.7.9"] as a dep to my project file seemed to work

15:48 jonasen: je: np

16:37 gfredericks: good clojure interview question: why does LazySeq force itself when you use with-meta?

16:37 corecode: hi

17:27 gfredericks: bbloom: ping

17:28 bbloom: gfredericks: heh. good timing. i haven't been at my desk all day. literally just sat down

17:28 what's up?

17:28 gfredericks: bbloom: I'm disappointed with clojure.pprint because it ignores print-method and (I assume) just uses toString

17:28 curious what fipp does by default

17:29 coventry: Why doesn't (doall (range 3.2e7)) stack overflow? Aren't you hitting the (range) call at the bottom of the definition of range a million times?

17:29 gfredericks: coventry: it's inside of lazy-seq

17:29 so no

17:29 bbloom: gfredericks: one of fipp's goals was to make writing custom printers super easy. so there's < 60 lines of code to look at & it's very "declarative"

17:29 https://github.com/brandonbloom/fipp/blob/master/src/fipp/edn.clj

17:30 gfredericks: looks like pr-str by default

17:30 coventry: gfredericks. Oh, so it's a new function for each chunk. I get it. Thanks.

17:30 bbloom: gfredericks: yup. do you have a suggestion for a better default?

17:30 gfredericks: nope I think that's prfect

17:31 fits my particular need at least

17:31 thanks

17:31 now to figure out how to get a jdk 7 on this vm

17:31 bbloom: gfredericks: I'm pretty proud of how clean/simple that file is :-)

17:33 gfredericks: yeah it seems goodly

17:33 corecode: hi, i have no experience with java. i'd like to plot something like this, using clojure: http://ols.lxtreme.nl/img/cursors-and-signals.png any suggestions which API to look at?

17:42 coventry: As for why (with-meta lazyseq foo) forces lazyseq, it's so that there is some static structure for the return value to share. If you instantiated the with-meta r.v. with lazyseq's fn value, all kinds of confusion could arise, particularly if the fn had side effects.

17:42 Fun question!

17:43 bja: what is the idiomatic way of telling if I'm dealing with a record class or an instance of that record?

17:44 I've been doing something like (if (= (class thing) (class Object)) "it's a Record" "it's an instance of a Record") but that doesn't seem right

17:45 AimHere: It's strange that you're writing code that gets confused between a record and an instance of same

17:46 llasram: bja: IMHO that's not generally the sort of thing you'd need to check, any more than e.g. checking if every argument is a number vs the string representation of a number

17:47 gfredericks: coventry: yeah that was my guess too. you're hired.

17:47 I'm pretty sure that could be avoided though. Maybe not with perf implications.

17:47 without*

17:47 coventry: Heh.

17:49 bja: explanation: working with Redis and want to be able to calculate a key. If it's an instance of a record, I can look up the needed info in the record. If it's the record itself, I'd return a partial where you supply some more info (an id for instance)

17:50 coventry: Are there any tools for inspecting lazy structures without forcing them, like the haskell debugger has?

17:50 AimHere: Unless you've got a pressing performance need, wouldn't that be a good case for a multimethod?

17:50 bja: AimHere: still need a function to pass to the multimethod that tells between the record and the instance

17:50 llasram: bja: BTW, I think when most people say "record" they mean an instance

17:50 AimHere: bja, right, and you use 'type

17:50 coventry: *forcing them further

17:51 AimHere: bja or 'class' if you like. I think they're synonyms in clojure

17:52 llasram: AimHere: `type` checks `:type` metadata, then delegates to `class`, so is a bit more extensible

17:54 bja: AimHere: yes, but that doesn't help me I don't think. If I do (defrecord Foo []) and then (defmulti foo-ness type) followed by (defmethod foo-ness Foo ([_] "foo"), then (foo-ness (Foo.)) and (foo-ness Foo) I believe are the same call

17:54 llasram: bja: But really, ##(mapv class? [String "some string"])

17:54 lazybot: ⇒ [true false]

17:55 llasram: bja: no... ##(mapv class [String "a string"])

17:55 lazybot: ⇒ [java.lang.Class java.lang.String]

17:55 llasram: Great time to be lazy, lazybot

17:55 ,(mapv class [String "a string"])

17:55 clojurebot: [java.lang.Class java.lang.String]

17:55 AimHere: bja > You should have a (defmethod foo-ness Foo) and a (defmethod foo-ness java.lang.Class) or some other ancestor of Foo

17:55 llasram: netsplit?

17:56 AimHere: bja (type (Foo.)) and (type Foo) are different things

17:56 bja: I think class? is the answer I was looking for

17:57 specifically, I'm already doing it with multimethods, but the multimethods handle various types of things (Account, User, etc)

17:58 i.e., (redis-item-key User) vs (redis-item-key Account) would both need to be bound to the multimethod implementation for java.lang.Class

17:59 hmm, gist time

18:16 distilling into a gist showed me the folly of my api...

18:39 avishai: can i define a protocol with methods that collide with existing methods?

18:39 e.g. name ?

18:40 AimHere: I doubt it, usually clojure complains at me when I try that sort of thing

18:42 avishai: hm

18:42 i really want some record to have a "name"

18:42 i guess i can use a field

18:42 AimHere: Hmmm, I just tried it, and I did get a warning, but it did let me do it

18:43 But it's likely safer to just shove anything static like that in a field and call it :name, or you can play at being a Java coder and have a getName method

18:44 avishai: bad habits die hard ;)

18:47 amalloy: avishai: of course you can do that. you'll have to put a :refer-clojure clause in your namespace to avoid conflicting with the core function of the same name, but that's what namespaces are for

18:50 avishai: isn't name polymorphic?

18:51 seangrove: avishai: The argument to name has to impelment the INamed protocol, I believe

18:51 Maybe that's just clojurescript though

18:55 Morgawr: is there any performance hit when using a *lot* of active agents at the same time in a machine? Meaning, you have way more agents than active cores?

18:56 and any way to schedule them to give a fair share of computation to each? (not sure how the agent thread pool is actually implemented, if anyone got resources it would be great)

18:56 brehaut: Morgawr: send uses a threadpool of CPUs+2 from memory, send-off jsut starts a new thread

18:57 Morgawr: brehaut: any way to specify that? for example if I want a specific thread running alongside my application dedicated to one specific core and I don't want it to get scheduled out by other agents

18:57 like I have 8 cores and I want 7 of them dedicted to agent pooling and 1 thread for another process

18:58 brehaut: no idea sorry

18:58 Morgawr: it's ok, thanks for the answer ;)

19:04 Lajjla: Chousuke, ajatteletko joskus musta vieläkin?

19:17 Morgawr: is it possible to filter references based on their metadata? if yes, is it faster than accessing the contents? if I have a map like {:a 1 :b 2 :c 3} and metadata like #^has-c is it faster (if possible) to filter on #^has-c rather than testing for :c ?

19:20 llasram: Morgawr: yes; maybe*; maybe*

19:20 * The potential for speed-up is minimal. The right thing to do is almost certainly just to check for the key's presence

19:21 Metadata is also stored in a map, so you'd just be trading one map lookup for another

19:21 Morgawr: so, how would I filter based on metadata? I was looking for a function but couldn't find it, it would be great if you could point me to the right place :)

19:21 mm, that makes sense

19:21 gfredericks: (comp filter meta)

19:21 no don't do that

19:22 llasram: (filter (comp :some-meta-key meta) ...)

19:52 cleos_frey: what's the purpose of the "^" character? I have this snippet: "(defn- reader-peek ^long [^Reader reader] ... "

19:53 brehaut: cleos_frey: it assigns metadata to the next thing read

19:53 cleos_frey: in that case its assigning a type hint

19:53 cleos_frey: so it's saying "reader is type Reader"

19:54 brehaut: yes

19:54 but its not a static type

19:54 cleos_frey: and I guess "^long" means this function returns a long?

19:54 brehaut: its a type hint; it only applies to performance optimizations

19:54 yes

19:54 cleos_frey: oh!

19:55 well, I guess the next question would be why wouldn't you type hint everything?

19:55 is it only wise for high traffic functions?

19:55 brehaut: because a) the compiler gets it right quite often

19:55 b) who wants that crap all over their code

19:55 (doc *warn-on-reflection*)

19:55 clojurebot: "; When set to true, the compiler will emit warnings when reflection is needed to resolve Java method calls or field accesses. Defaults to false."

19:56 brehaut: you only need atype hint when the compiler resorts to reflectioin

19:56 which primarily happens when dealing with java interop

19:56 cleos_frey: I see that makes sense

19:56 thanks brehaut!

19:56 brehaut: no worries

20:01 `cbp: coventry: sorry to bother you but did you ever find out how to do the nrepl trick of sending expressions to the repl from a clojure buffer?

20:02 cleos_frey: `cbp: are you talking about sending code from vim to nrepl? If so, I use fireplace.vim plugin for that

20:03 `cbp: cleos_frey: no I'm talking about emacs

20:03 cleos_frey: `cbp: ah, whoops

20:04 `cbp: Instead of typing into the repl you type in the clojure file buffer and it copies, pastes and evaluates into the repl buffer

20:13 hiredman: dnolen: that dummy value for unifying with I suggested doesn't actually work as a replacement for _, not extending the subst map breaks some things like reification

20:15 akurilin: Do you guys have any preference for tools to monitor your apps / machines they run on? Nagios seems to be the household name, but supposedly it also takes forever to set up.

20:16 Morgawr: anybody knows how the scheduling algorithm works for the agent thread pool in clojure and how can one influence it to give fair share to all agents or bigger weights on some of them compared to others? Or any read about agent pool schedulin in general would be great

20:24 joegallo: Morgawr: let's imagine i don't know, because i don't

20:24 i know that you send functions off to agents, so lets look at the source for send

20:24 https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L1917

20:24 apparently it hits a thing in clojure.lang.Agent called the pooledExecutor

20:25 and popping over there, we see it's definely thusly

20:25 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L49

20:26 so now we're just looking at plain old java

20:26 Morgawr: joegallo: alright, I guess I'll inspect that

20:26 joegallo: specifically http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool%28int,%20java.util.concurrent.ThreadFactory%29

20:26 and http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html

20:28 Morgawr: what I'm wondering is how fair the share of work between each agent is

20:28 if I am recursively calling (send *agent* function)

20:28 to create some sort of infinite looping

20:29 joegallo: and that calls a http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html

20:29 and that uses a LinkedBlockingQueue to queue up the tasks that will be executed

20:30 so my guess is that you've got N threads pulling work off the queue, FIFO, and just banging away on the tasks that have been put in there

20:31 Morgawr: any reason why it uses a FixedThreadPool compared to a ScheduledThreadPool?

20:32 mm.. nvm, looks like futures in Clojure use the scheduledThreadPool thing... and equally that's how send-off is implemented for agents iirc

20:32 anyhow thanks for the great help joegallo

21:08 gtrak: in emacs, does anyone know how to display the eval result below the eval'd line, preferably commented?

21:09 ah, hmm, nrepl-eval-print-last-expression looks like a starting point

22:06 lgastako: Hi I'm getting this error http://pastie.org/8400365 when I try to start an nrepl instance for my project. This question http://stackoverflow.com/q/369122/ seems to suggest the general type of problem I have, but not where. "lein run" runs my code just fine. I tried deleting my ~/.lein/nrepl-history file just in case that was it but no dice.

22:07 Any suggestions on what to investigate next?

22:23 llasram: lgastako: Do other `lein` tasks work?

22:46 coventry: lgastako: I don't think lein reads your project's source code on startup by default. I would start by looking at your project.clj (maybe evaling it in a different repl) and the packages it attempts to load.

23:00 gfredericks: bbloom: if I want to pprint canonically I'll have to walk my data structure myself and convert the maps to sorted-maps?

23:01 bbloom: gfredericks: pretty much

23:01 gfredericks: bbloom: is that something you'd be interested in supporting?

23:02 doesn't sound obviously easy

23:02 given you can't assume the keys are comparable

23:02 in general

23:05 bbloom: gfredericks: i'm interested in a better mechanism for composing and customizing conversions from objects to "pretty documents"

23:05 i'm not 100% satisfied with the IPretty protocol, since it doesn't let you do the sorts of things like you want to do

23:05 however, i think the solution might be an extra level in between where there is like a abstract pretty document w/ css-style settings or something to that effect. i haven't given it a ton of thought though

23:06 gfredericks: it _does_ let me re-impliment IPretty for IPersistent map I suppose, eh? as the easiest haxy workaround?

23:06 bbloom: yeah, that's by far the easiest hacky work around. however, realize that you'll lose the linear time/space promise if you try to sort the keys of an arbitrarily large map

23:07 * gfredericks realizes it

23:07 gfredericks: Houston, we have a logarithm.

23:08 bbloom: do you have access to an actual sorted map type?

23:09 b/c you could convert to that, then define IPretty for that type

23:10 gfredericks: it's the converting that would be the hassle

23:10 this particular application is not afraid of a few HAX

23:11 bbloom: then hax away

23:11 gfredericks: :)

23:11 bbloom: thx

23:11 bbloom: really, what this thing needs is an ML module :-P

23:12 protocols, like haskell's type classes, are great when you really only have one meaningful definition for the generic methods. or when it's reasonable to wrap a "newtype" around it

23:13 luckily, it's a 1-method protocol

23:14 gfredericks: actually, i got a great solution for you!

23:14 gfredericks: try (fipp.edn/pprint fipp.edn/IPretty) and you might see where I'm going :-P

23:15 you can define your own IPretty, then use clojure.core/extend with the results of (:impls fipp.edn/IPretty)

23:15 then you can extend over your own version of the protocol & define your own printer with defprinter

23:15 that's basically the same as copy pasting the edn file, but it would be < 5 lines instead of 60+ lines

23:16 and future proof!

23:21 dcunit3d: whats the best way to compile a jar from a github branch

23:22 to specify in project.clj

23:25 is there anyway to do that?

23:27 it looks like there is, via lein git-deps https://github.com/tobyhede/lein-git-deps

23:29 lgastako: coventry and llasram, sorry I got interrupted.

23:29 I reduced my project.clj to this: http://pastie.org/8400467

23:29 and still get the same error

23:29 And yes, other lein commands work (e.g. lein check)

23:30 llasram: lgastako: The value of :main should be a symbol, not a string

23:30 lgastako: But FYI, specifying main w/o ^:skip-aot and/or explicitly including it in :aot is deprecated, and can have unexpected side-effects

23:32 lgastako: thanks llasram that was indeed the problem

23:33 I will read up on the aot stuff. I'm a noob

23:34 llasram: I wonder what clojurebot has to say about AOT...

23:34 ~aot

23:34 clojurebot: http://i.qkme.me/3vb225.jpg

23:34 llasram: Not the most useful answer ever

23:34 lgastako: No, but moderately amusing :)

23:36 llasram: Basically, in Clojure AOT (ahead-of-time compilation) should generally only be used as a deployment optimization. The side-effect of producing concrete class files on disk can lead to a variety of hard-to-diagnose development-time problems

23:36 lgastako: As long as I'm here does anyone happen to know how to do an "INSERT ... RETURNING" using korma?

23:36 llasram: nack

23:37 lgastako: So for my main I should do something like ":main ^{:skip-aot true} foo.core" ?

23:38 llasram: Or just ^:skip-aot (which means the same thing as ^{:skip-aot true})

23:39 lgastako: Thanks

23:45 coventry: Is this a terrible idea? I have a macro which macroexpands and transforms its argument, then wraps any top-level forms in the expansion in itself. At the next stage of evaluation, those forms get macroexpanded, transformed and get their internals wrapped too, and so on. It's basically a workaround for this bug in ztellman's code-transformation library https://github.com/ztellman/riddley/issues/9 because it ensures that all

23:45 transformation occurs in the actual evaluation context.

23:45 dcunit3d: so i'm trying to use lein git-deps, but now i'm running into some dependency issues when i load my repl

23:46 it looks like i need to manually specify the :source-paths key

23:47 so i have :source-paths ["src" ".lein-git-deps/clatrix/src"], but now it looks like lein isn't loading other dependencies

23:47 am i missing a directory?

23:48 actually it looks like its not loading the dependencies for clatrix

23:49 coventry: dcunit3d: Why use git-deps rather than a lein checkout dependency?

23:50 dcunit3d: didn't know about lein checkout

23:50 thanks, i'll take a look

23:50 coventry: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

23:53 Roxxi: What logging libraries are popular for Clojure? I see clojure/tools.logging, and ptaoussanis/timbre- are these pretty much the standard?

23:55 dcunit3d: basically trying to get claytrix.core/reshape working. created a pullreq for it.

23:55 or clatrix. claytrix is a matrix remake in clay animation

23:57 llasram: Roxxi: Those are the ones I've heard of. FWIW, tools.logging does everything I've needed

23:58 Roxxi: That's what I was leaning toward since it looked more standard.

23:58 Thanks, llasram!

Logging service provided by n01se.net