#clojure log - Sep 14 2013

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

0:02 coventry`: Anyway, amalloy was right. This limitation stands in the way of using core.async to do a lazy split-with. I could work around it by putting unlimited queues between my code and the core.async channels, but that seems wrong on a couple of levels.

0:03 Implementing it was a great exercise for learning core.async, though. :-)

1:51 s4muel: yyyyyyyyyykkj======================]==]]]]]]]]]]]]]]]]]]]]]]]]pppppppppppppppppppppppp000000000000000000000000000000000000000000000000000000000000

1:51 0]]]]]]]]]

1:51 00000000000]]]]]]]]]]]]]]]i

1:52 7777711111111ewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwjjjju

1:52 0]]]]]]]]]

1:53 3333-......H

1:53 So in other news, I am fostering kittens for a bit

1:53 Sorry about that.

1:54 * s4muel changes to #macdev to idle

1:59 seancorfield: s4muel: mine do that sometimes if i leave the keyboard accessible when i leave the room!

2:05 SegFaultAX: s4muel: That made it go from annoying to awesome! :)

2:07 callen: s4muel: way to make your foibles adorable.

2:09 s4muel: I don't know if this is adorable or malevolence, though: http://i.imgur.com/vSwRSkD.jpg

2:10 SegFaultAX: s4muel: whynotboth.jpg

2:10 s4muel: True.

2:11 callen: s4muel: zomg kitty

2:11 s4muel: I know, I know. cats and the internet -- ehrmagerd!

2:11 callen: killing me man. I'm trying to be srsface and get some work done

2:11 but noooooo, there's kitties afoot. No work getting done now.

2:12 s4muel: I can't even show you the picture of how one is sleeping on my magic trackpad

2:13 wei_: s4muel: very cute

2:18 callen: s4muel: my head is going to asplode.

2:18 s4muel: you'll be responsible for the death of a Clojure programmer. If head sploding must happen, do it in #php yeesh.

2:18 s4muel: callen: what work? http://i.imgur.com/35Atdfo.jpg

2:19 aaaand I'm done.

2:19 callen: I just physically leaned back in my couch and silently laughed from the cute

2:25 seancorfield: callen: this should completely put paid to any work then... http://bangles.com/kittens/cute.html

2:30 callen: *_*

2:31 hrm. that moment when you realize there are PRs for what you were working on already.

2:45 oh oh, I get it. It's "chunk all the things!" weekend.

2:47 uvtc: How can I make use of a file that I've just tried to get ahold of via `(clojure.java.io/resource "stuff.txt")`? What can I do with that "java.net.URL" returned by `resource`? For example, how would I read the lines from that stuff.txt file?

2:48 andyfingerhut: (clojure.java.io/reader url) returns a reader you can pass to many other functions

2:50 uvtc: Hi andyfingerhut . Thanks. I just tried `(let [stuff (file-seq (io/resource "stuff.txt"))] ...)`, and then `stuff` appears to be a seq, but I don't see how to get the lines out of it. :)

2:52 I'm getting java.net.URL cannot be cast to java.io.File, or java.io.BufferedReader...

2:52 s4muel: uvtc: try (slurp (io/resource "foo"))

2:52 andyfingerhut: Did you try (line-seq (io/reader (io/resource "stuff.txt"))) ?

2:52 uvtc: s4muel, oooh, that works. Thanks.

2:53 andyfingerhut, Ah. No, didn't try that one. Thanks for the pointer.

2:55 s4muel: TIL slurp works on URLs too (thanks, guns!)

2:57 uvtc: andyfingerhut, Ok. Thanks. `(let [lines (line-seq (io/reader (io/resource "stuff.txt")))] ...)` works. :)

2:57 callen: import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories.EnterpriseGradeFizzBuzzSolutionStrategyFactory;

2:57 andyfingerhut: Good. That was from memory, so hoping I didn't lead you astray

2:58 callen: That is some serious enterprise-y naming

2:58 Where should I send the purchase order? :)

2:59 callen: andyfingerhut: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition/tree/master/src/main/java/com/seriouscompany/business/java/fizzbuzz/packagenamingpackage

3:00 seancorfield: hmm, unfortunately this import is real: (import (com.iesnare.www.dra.api.CheckTransactionDetails

3:00 CheckTransactionDetailsResponseDetailsDetail

3:00 holders.CheckTransactionDetailsResponseDetailsHolder))

3:00 uvtc: This is serious and no-nonsense.

3:01 callen: #ReasonsIamGladToWriteClojureAndNotJava

3:01 andyfingerhut: DepartmentOfRedundancyDepartment

3:01 uvtc: Brushing up on my rusty Java-ese: if someone wanted to use a .properties file in a Clojure app, they'd put it into the my-proj/resources dir and load it with io/resource, correct?

3:03 andyfingerhut: I've tested something like that recently while working on a Clojure bug, and it worked. I forgot whether it required specifying the name of the "resource" directory in the Leiningen project.clj file or not.

3:04 perhaps :resource-paths See sample.project.clj in the Leiningen docs

3:04 uvtc: This is probably a silly terminology question, but do you think .properties files are "resources"?

3:05 callen: uvtc: many things are resorces.

3:05 resources*

3:05 andyfingerhut: Ad regarding the bug, don't use non-ASCII characters in your file names :)

3:06 wei_: seancorfield: what's a DetailsResponseDetailsDetail?

3:06 seancorfield: it's from Iovation's fraud analysis SOAP WSDL

3:06 uvtc: andyfingerhut, I think :resource-paths is for when I want to specify some other dir as (or in addition to) my resources dir (my-proj/resources). Does that sound correct? (Hm. It looks like maybe in Java-land, resources are stored alongside source files?)

3:07 callen, right (images, for example). Thanks.

3:08 andyfingerhut: I just now learned that M-. in Emacs with nrepl can jump to function definitions inside of jar files in your ~/.m2 local Maven repo. Seriously cool.

3:10 rurumate: andyfingerhut: only if nrepl was started in the right dir, and you might have to eval the current buffer with C-c k before it works. C-c M-n is also worth learning.

3:10 uvtc: andyfingerhut, looks like now, if working in a project created via `lein new app my-proj` (which creates an empty resources dir for you), you don't need to specify "resources" in any path explicitly.

3:11 andyfingerhut, thanks for the help. :)

3:11 andyfingerhut: rurumate: I don't recall doing anything special, and I definitely didn't do C-c k. I did require the namespace containing the function call on which I did M-.

3:12 rurumate: andyfingerhut: just in case it doesn't work one day

3:22 Acio: had a question, solved it meself, yay

3:26 rurumate: andyfingerhut: sorry it's C-c C-k to load the file, not C-c k

3:28 Acio: care to share the question, and the solution?

3:29 Acio: rurumate: just newbie, couldn't find out how to convert fraction to a decimal, and now i found with-precision and bigdec

3:29 noto2: also, ##(* 1/7 1.0)

3:29 lazybot: ⇒ 0.1428571428571429

3:30 rurumate: Acio: there is also (float 3/4)

3:30 and (double 3/4)

3:30 noto2: but yeah, bigdec will be more precise

3:31 Acio: oh wow, not sure why thsoe didn't occur to em

3:31 thanks!

3:31 TEttinger: if you're adding lots of weird little decimal numbers like ##(apply + (repeat 10 0.1))

3:31 lazybot: ⇒ 0.9999999999999999

3:31 TEttinger: then you would prefer bigdec

3:34 Acio: thanks!

3:46 rhg: I think 99% of mindprod.com/jgloss/unmain.html is impossible in clojure lol

3:48 callen: rhg: is that a challenge?

3:49 rhg: I have macros man. I make nightma^H^H^H^H^Hdreams happen.

3:49 rhg: Plz no

3:49 callen: wat r u doin...is that macro generating a class factory? HOOMAN. STAHP.

3:49 rhg: For all that's good. Plz no

3:51 I fporgot about macros powerz

3:52 callen: they all forget, until they see some Lisp necromancer's attempt at recreating the universe in his own image.

3:52 rhg: Id like to see it, then burn it and bury it 500ft underground

3:53 Nice laugh

3:55 I'm having to write c++, it doesn't need more obfuscation

3:56 callen: my dream one day is to write a C++ program that generates a lookup table statically using templates at compile time for some reasonably complicated but still doable problem

3:56 then join the Basque freedom fighters, get them to switch to my cause

3:57 rhg: Gl.....

3:57 callen: and use my terrorist allies to kidnap Alexandrescu, and force him to read the C++ code

3:58 NSAPrismBot: callen: What?

3:58 rhg: I find c++ to be chore because I don't enjoy it

4:00 TEttinger: `seen callen

4:01 rhg: So, what's the worst macro you've seen?

4:02 llasram: TEttinger: #clojure/seen callen

4:02 TEttinger: llasram, wondering what the char was to issue a command to lazybot

4:02 llasram: $seen TEttinger

4:03 lazybot: TEttinger was last seen talking on #clojure 12 seconds and 479 milliseconds ago.

4:03 callen: $seen callen

4:03 lazybot: callen was last seen talking on #clojure 63 milliseconds ago.

4:03 TEttinger: hm

4:03 callen: do ho ho. clever.

4:03 TEttinger: it doesn't have what you said?

4:03 callen: I was expecting it to miss my request.

4:03 TEttinger: I must have added that

4:09 amalloy: incidentally, callen, i think it notices the request only by coincidence: lazybot's plugin-dispatching code calls things in arbitrary order, and for whatever reason it turns out that seen-logging happens before responding to seen

4:16 rhg: Callen, I challenge to write clojure so bad it makes grown men cry

4:17 callen: rhg: I'd rather write Clojure so bad that it makes the Clojure Cup judges cry.

4:18 rhg: K

4:19 Idk how hard that is tho

4:20 A mutable var loop?

4:21 s4muel: use java collections directly

4:21 rhg: Oh

4:21 Fugly.

4:21 s4muel: all of a sudden, everything's mutable! But then again, that's not really clojure, that's just parens around java :)

4:22 callen: s4muel: then write macro shims for mutable uses of java collections.

4:22 s4muel: that shadow core functions

4:22 TEttinger: use OpenCAL or some other obscure language's data from clojure

4:22 s4muel: write a protocol that reflects the properties of every object created then throw them away

4:23 rhg: 0.o

4:23 s4muel: there's opportunities for badness everywhere, but you just have to go so far far out of your way

4:23 TEttinger: JNI. anything in JNI

4:25 rhg: Ik there's worst...

4:26 s4muel: use java.io.shell to write your actual code out to strings of a php file and run it

4:26 that's the king

4:26 rurumate: in LazySeq.java#seq there is a loop where this check is run repeatedly: "((LazySeq) ls).sval() instanceof LazySeq" It checks whether the "sv" of a LazySeq "ls" is also a LazySeq. Is there a way to run this test in clojure, or to get at the "sv" (because sval() is package-private)

4:27 rhg: Perl.

4:27 rurumate: for example, what would the "sv" of (filter' #(= 9999 %) (range)) be?

4:28 rhg: ?

4:28 Oh

4:28 Java

4:28 rurumate: (first (first (filter' #(= 9999 %) (range)))) will call LazySeq.seq(), which runs a loop checking "((LazySeq) ls).sval() instanceof LazySeq" repeatedly

4:29 ..which is why that expression doesn't blow the stack (it runs a while loop that is implemented in java, in LazySeq.first()

4:30 ..unfortunately, and for obvious reasons, it doesn't work that way in clojurescript (there is no underlying jvm)

4:31 ..and the stack fills up

4:33 rhg: S4muel, I wonder about clojure not PHP; bad PHP is easy

4:36 s4muel: rhg: Heh, poorly worded - I meant just straight up writing php code in a clojure string(s), spitting to file, and running it. Nonsensical *and* abominable.

4:36 rhg: Agreed

4:37 s4muel: rurumate: that's an interesting problem. You would think that nested lazy-seqs made it in. maybe you found a bug?

4:38 rhg: Bad clojure without interop or macros is improbable

4:39 callen: rhg: I can prove that wrong in a single github link :)

4:40 rhg: Rly?

4:40 0.0

4:40 rurumate: s4muel: yes I think it's a bug in clojurescript, it's documented here: http://dev.clojure.org/jira/browse/CLJS-587

4:41 anyway gotta run, hope someone can fix this

4:41 clojurebot: Titim gan éirí ort.

4:44 rhg: L8r folks

4:52 borkdude: If Java is also coffee, what is Clojure?

7:16 klokbaske: So, functional reactive programming vs csp (eg core.async). What's the difference?

7:17 I've used the former a couple of times, and it seems to me that core.async's channels are much like signals in Frp

7:19 pyrtsa: klokbaske: This might not be summing it entirely, but in FRP, you streams generally don't know where they are pushing their events to. In CSP, the channels are visible in the definition of the CSPs.

7:20 Which, at least in my opinion, makes CSP much more imperative than FRP.

7:26 klokbaske: pyrtsa: can you elaborate on how the channels are more visible than streams? I'm not sure I follow ...

7:28 pyrtsa: klokbaske: When you're using core.async, you explicitly `put!` values into a given channel. In FRP, less so.

7:31 In a function you write in CSP, you may have more than one channel you're sending values to, in FRP the explicit pieces of code -- RxJava example being: (.onNext observer value) -- are rarely explicitly written and almost always only push values into one single observer.

7:31 klokbaske: pyrtsa: ok, i see what you mean with imperative then.

7:32 pyrtsa: In FRP, you're mostly using stream combinators, i.e. your code contains zero onNext's, onError's or onCompleted's.

7:38 klokbaske: pyrtsa: ok. i recognize what you say about frp, but I probably have to study some more core.async code to be able to relate it to frp. Can you recommend any?

7:41 pyrtsa: Hmm, there's so little material about core.async out there yet.

7:41 G0SUB: pyrtsa: you can always read the code :)

7:41 pyrtsa: G0SUB: Yeah, I was about to suggest that to klokbaske. :)

7:42 klokbaske: Have you understood what core.async does behind the scenes? E.g. what happens when a value is put into a channel.

7:43 In other words, what the fuss with goroutines is.

7:44 G0SUB: pyrtsa, klokbaske: by the way, excellent blog post explaining the innards of core.async http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/

7:46 pyrtsa: Yes, that's a good one.

7:46 klokbaske: pyrtsa: no, it's still pretty much a blackbox for me.

7:46 pyrtsa: klokbaske: How about coroutines in general?

7:46 klokbaske: G0SUB: i'll look into that one.

7:47 I think I'll have to brush up on coroutines as well. Didn't know they where related to csp

7:48 pyrtsa: klokbaske: The above link should open it up a bit.

7:49 klokbaske: Great! Thanks a lot for the pointers. I'll see if I can wrap my head around it :-)

8:15 squidz: i'm trying to do some DOM manipulation using dommy. I am trying to create/update nodes based on the values of a map I pass. Does anybody know if it is possible to set dom element properties while defining a dommy template?

8:20 that is within the hiccup-like syntax

8:48 seangrove: squidz: haven't used dommy yet, how do you like it?

8:50 squidz: it seems okay, but I haven't used it much yet. I used enlive a long time ago, but if I remember correctly, I think it kind of forced me into using a single page application. Dommy is more along the lines of jquery I suppose

9:01 clj_newb_2345: i fucking hate this -- I want emacs to be written in clojure, but then more elisp pacakges I install, the most unlikey that faint dreams becomes

9:01 why is that emacs must be built on top of mutable cons cells rather than persistent data structures?

9:01 woe woe woe to the software of the world

9:09 supersym: probably has to do with emacs being ancient :P

9:10 tbh I don't use emacs at all, learning curve would not be worth it atm I feel

9:11 clj_newb_2345: emacs is fucking awesome

9:13 supersym: oh I bet...and I can see why people here prefer it over vim(L)

9:15 but currently I feel I get less annoyed using LT over emacs (with the keybindings, new extensions, new concepts etc)

9:15 seangrove: What's the version of google-closure-library I should be using with the latest version of clojurescript?

9:18 supersym: seangrove: https://github.com/clojure/clojurescript/blob/master/project.clj

9:18 isn't that what you are looking for? its a dependency anyway

9:23 seangrove: supersym: That looks hopeful, thanks

9:24 Looks like that might have done it, thanks again supersym

9:25 supersym: yw

10:21 seangrove: dnolen: Working on cleaning up the source map patch, merged current master into it, running into a strange optimization bug: https://www.refheap.com/18664

10:21 This is with simple optimizations - it looks like the closure compiler is doing dead code removal, but I'm not sure why it's qualifying those lines as dead code

10:40 si14: guys, do you have any idea why there is such a huge performance hit in the second case? https://gist.github.com/si14/737920b513fb8ccae152

10:41 the only difference to me is that one value should be passed through iterations

10:41 I can't see how this can make 4x difference in this case.

11:22 borkdude: Are there any tools for clojure that let you express: I want to restrict access to this and that function to this and that namespace or function?

11:22 ambrosebs: borkdude: I don't think so.

11:23 borkdude: maybe not a runtime, static check would be ok

11:24 maybe a tool that shows who is calling a specific function then, yes, rgrep

11:24 tools that show you a graph of dependencies between namespaces then?

11:25 ambrosebs: borkdude: fwiw jvm.tools.analyzer provides a fully expanded AST to harvest var occurrences.

11:25 borkdude: tools.namespaces then provides ns dep info.

11:25 borkdude: ambrosebs I'll take a look at it

11:26 supersym: borkdude: https://github.com/Hendekagon/lein-clique

11:26 borkdude: supersym cool thanks

11:27 ambrosebs: supersym: how does it work?

11:28 supersym: does it know about local scope etc?

11:29 borkdude: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/tools/logging__init.class or clojure/tools/logging.clj on classpath

11:29 supersym: its a dependency grapher,... uses tools.namespace

11:30 borkdude: supersym I get the above error

11:30 supersym: "tools that show you a graph of dependencies between namespaces then" not the first part about restricting access

11:30 borkdude: supersym dependency graphing is good enough for me now

11:30 supersym: borkdude: ensure you have that dependency

11:31 lein compile && export CLASSPATH=`lein classpath`

11:31 also always check `lein deps :tree` to see if there are conflicting dependencies

11:31 and.... you must have graphviz installed of course

11:31 it uses dot notation to generate these

11:32 a bit like they do here https://gist.github.com/w01fe/4958807

11:34 borkdude: supersym should't a leiningen plugin declare its own dependencies?

11:35 ambrosebs: supersym: I meant how does it work out function dependencies? After a quick look, it seems it's very rough.

11:35 which I guess is fine for exploratory stuff.

11:38 borkdude: supersym I installed graphviz and included the dep

11:38 supersym now it spit out a deps.dot - how can I view it?

11:40 gfredericks: dot -Tsvg -o deps.svg deps.dot

11:40 I think

11:41 borkdude: gfredericks great, thanks

11:42 supersym: borkdude: sorry, you are correct

11:43 ambrosebs: oh it isn't a sophisticated tool

11:43 ambrosebs: supersym: no.

11:43 supersym: couldn't tell from the readme

11:44 supersym: takes only used fns in a given function

11:44 ambrosebs: supersym: I assume things like locals aliasing vars confuse it?

11:45 shadowing rather

11:46 supersym: ambrosebs: I would assume so, reading strings to execute code (not that you should use anything besides edn read string, but anyway) and such aren't picked up

11:47 ambrosebs: supersym: pretty cool how small the implementation is to get most of the benefits tho.

11:48 borkdude: I get a lot of overlapping nodes, can I use a layout engine that prevents it?

11:48 supersym: I agree... its nice for those projects, especially larger ones, to gain some quick insight... I'm really a visual person so these kind of tools are useful now and then

11:48 borkdude: this is very useful for discovering functions that are actually never used :)

11:48 supersym: generating a graph of NASA WorldWind project once was fun

11:52 borkdude: supersym is is possible to create a graph at the namespace level instead of function level? I think that would be also useful to get a larger overview

11:52 supersym now I get a giant graph with a lot of overlapping nodes

12:06 supersym are you the author of this plugin?

12:07 supersym I see a commit on july 24 that the tools.logging dep is removed, but the plugin still installs 0.1.0-SNAPSHOT as a dep, this is where it goes wrong I thikn

12:33 supersym: borkdude: no I am not

12:33 last time I used it, things looked fine

12:34 borkdude: probably before june 24

12:40 supersym: haha... let me take a look, I've got some time now

12:44 seangrove: dnolen: Nevermind with that code, there was some temporary cache issues. Still have the problem, but tracking it down

12:48 supersym: borkdude: once I added [org.clojure/tools.logging "0.2.6"], then convert the dot to svg looks good here

12:48 of course if there aren't many dependencies, the whole tree will be kind of..erh flat

12:49 borkdude: supersym yes, it does here too

12:49 supersym but I've got a lot of deps between a lot of functions

12:49 supersym I got the plugin working, but it should be fixed I mean

12:50 supersym: yeah.. I get you... I'll see if I can do a pull request

12:52 borkdude: supersym I can do it myself later

13:15 supersym: yeah I'm trying to track where that logging dependency is coming from

13:15 also getting warnings from lacij... dependency version ranges... thats a bit lazy

13:16 for the rest that project looks quite nice https://github.com/pallix/lacij

13:16 borkdude: I have made a comment in one of the commits about it

13:17 dbasch: question: I'm using seq-utils/separate from clojure-contrib. Does anyone know if this has been moved to a modular library?

13:19 supersym: dbasch: not from what I can see

13:22 dbasch_: don't know if someone responded, my connection died after I asked the question

13:33 supersym: dbasch: not from what I can see

13:33 erh let me clarify that... the function is still there

13:33 nothing has moved

13:41 dbasch: thanks supersym

13:54 timgluz: Hello, does someone knows how to cancel cursor timeout for monger? I need to run long task, but after 30min, it raises exception.

13:56 ps: what do you think about this page? http://www.versioneye.com/clojure

14:04 SegFaultAX: So... if anyone was wondering: https://gist.github.com/SegFaultAX/6563909

14:17 supersym: timgluz: that should be possible http://api.mongodb.org/java/current/com/mongodb/DBCursor.html#setOptions(int

14:18 disable shouldn't be a problem, custom timeout isnt possible with java driver so it seems

14:18 timgluz: yes, monger.collection/find returns raw dbCursor

14:20 supersym: yeah so you are looking for this one, addOption QUERYOPTION_NOTIMEOUT

14:21 gdev: SegFaultAX, that's beautiful

14:30 I must dissect this class and study it AddressVerificationTaxProcessorTaxCalculator

14:32 arohner: brew update:

14:32 ==> Deleted Formulae

14:32 clojure

14:32 finally!

14:33 andyfingerhut: Would they accept a formula that simply had a note on the recommended way to install it?

14:33 arohner: idk. but getting them to believe that no, really, clojure shouldn't be packaged was quite uphill

14:34 timgluz: (let [db-cur (coll/find "products" the-criteria)]

14:34 (.setOptions db-cur Bytes/QUERYOPTION_NOTIMEOUT)

14:34 (map #(from-db-object %1 true) db-cur))

14:34 thanks, @supersym. i got it work:

14:34 and now works as well find-maps, but without timeout

14:37 supersym: nice :)

14:39 tupi: hello. this (.setBatchMode true) gives me an error: No matching field found: setBatchMode for class java.lang.Boolean, any idea?

14:41 timgluz: tupi, are you missing object?

14:41 tupi: don't know :) [i am a novice in clojure, java and imagej :)]

14:42 gdev: tupi, you're calling setBatchMode on true

14:42 timgluz: :D well, i'm newbie too, but you're missing smt, because Boolean object doesnt have such a method

14:43 tupi: in the script i posted yesterday, http://paste.lisp.org/display/138930#2 which works fine, i am trying _not_ to get any display from IJ/run commands, such as (IJ/run imp "Measure" "")

14:43 so far i can not find how to tell imagej not to display anything [it defaults to display its ResultsTable, it appers

14:51 here is a new paste: I mistakenly inverted the values of conv2 in the text of the paste. but why are these values different? is my first version, (let [[perimc conv2] badly formed ? http://paste.lisp.org/display/138930#3

15:10 gdev: tupi, first extract your arity checking

15:15 tupi: gdev: sorry, i don't understand

15:17 gdev: tupi, (let [args *command-line-args* its-length (count args)] (if (= its-length 3) ... si begging for a refactor

15:19 tupi, if you're only expecting 3 arguments you could simply write (defn foo [d-name f-name f-ext] ..

15:20 tupi, then you wouldn't have to do arity checking yourself

15:23 tupi: gdev: let's forget the command lne arg treatment for now, indeed the caller of these scripts will be a scheme process which will do the arg treatment jobs.. I am concerned by my conv2 different values ...

15:25 all i can think of the cause of the problem is, maybe, destructuring is done in // as opposed to a let binding computation

15:27 then in my code, the first call to (.getValue results "Perim." i), in the (do ...) form, uses the freshly computed value, whereas the second 'destructuring' value, (/ (.getValue results "Perim." i) (nth perim i)) actually uses the 'old' value

15:30 joef_: tupi, the two versions are different

15:31 the `(let [[perimc conv2] …` looks suspicious since the `for` is probably not returning two values

15:31 tupi: joef_: it is returning 2 values

15:32 joef_: obj-nb = 2?

15:32 tupi: no

15:33 joef_: the `for` will return `obj-nb` values

15:33 tupi: joef_: no. it will return 2 sequences of obj-nb values

15:35 oh, i think i undertand, let me try somthing and bb

15:38 yes of course, my newbee mistake

15:40 (let [[perimc conv2] … actually returned obj-nb tuples of 2 values: of course it needs an (apply map list ... to 'extract' the 2 sequences i want ...

15:45 hexacode: anyone know of any really good hardware accelerated audio synthesizers...preferably gpu based not fpga but fpga isnt out of the question completely

15:47 tupi: as i did ask, here is the answer, it might help others ...

15:47 http://paste.lisp.org/display/138930#4

15:51 now i still have to undertand how _not_ to get any unwanted diplay on the outputport, but this is an imagej problem of course, not clojure related one ...

16:16 arrdem: anyone have a good Google Analytics alternative?

16:17 SegFaultAX: arrdem: For what?

16:29 gdev: Oh no... what have I done? https://gist.github.com/SegFaultAX/6563909

16:32 arrdem: SegFaultAX: just basic traffic logging for a blog

16:39 mtp: do your webserver access logs not suffice?

16:39 analog/goaccess/write-your-own-log-parser

16:39 "log to a database and analyze that"

16:40 * arrdem doesn't think nginx does any logging at all

16:40 mtp: nginx definitely does logging

16:46 callen: SegFaultAX: trollan. lol.

16:47 arrdem: why isn't google analytics good enough?

16:47 arrdem: alternately: https://heapanalytics.com/

16:48 you don't *really* want to implement your own analyt----oh damn.

16:48 * callen furiously scribbles notes

16:50 arrdem: callen: nerd sniped :D

16:50 callen: arrdem: yeah dude. you just gifted me my ClojureCup entry.

16:51 arrdem: callen: lol I'll be happy to see it

16:51 callen: arrdem: but in the meantime, raw logs, google analytics, heap analytics. the reason for using the latter two is that they gather and sift through a lot of client-centric information raw logs don't generally impart.

16:51 gdev: SegFaultAX, what *have* you done? 0_o

16:51 callen: gdev: trolled Twitter.

16:52 gdev: Halloway did the same recently. re: Spock Framework

16:52 I have to go now sadly, but thanks arrdem for the project idea.

16:52 gdev: callen, you will be missed ;,(

16:52 callen: gdev: well hopefully the nice young lady I am meeting for coffee doesn't kill me and use my organs for parts, so I'll be back eventually :P

16:53 arrdem: callen: as long as she sends us the brain...

16:53 * arrdem rummages for his lighning rod

16:54 gfredericks: b

16:54 gdev: callen, http://xkcd.com/306/

16:55 callen, remember the key to conversation is constructive criticism

16:55 arrdem: lazybot: ping

16:55 lazybot: arrdem: Ping completed in 0 seconds.

16:55 arrdem: clojurebot: ping

16:55 clojurebot: PONG!

16:55 arrdem: (inc gdev)

16:55 lazybot: ⇒ 2

16:57 jave: I'd like to add some clojure parts to an existing java web app. I think the clojure part can be mostly standalone. any hints how to do this?

17:01 gdev: jave, services

17:02 jave, your java web app could send things to a queue that your clojure service is listening to, process it, and send it back to a queue that your java app is listening to

17:17 kaw: Hey, I'm trying to use Clojurescript and domina, and getting a TypeError in the generated Javascript when trying to use by-class in domina 1.0.0: http://hastebin.com/panucorude.avrasm

17:18 Anyone have any idea what might cause that? Is it a bug in domina or could it be something in the way I'm including it?

17:19 Also, the problem is fixed if I replace "domina.domina" with "domina" in the generated code.. assuming this is a bug in domina, is there an easy way to get that patch into my cljsbuild workflow as a workaround?

17:21 arrdem: hyPiRion: is there an official clojurebot/lazybot api?

17:21 Raynes: …api?

17:22 arrdem: Raynes: looking for a way to access $karma without building my own IRC bot :P

17:22 Raynes: I see.

17:22 There is no API for that sort of thing.

17:22 arrdem: mmkay.

17:25 jacobsen_: rkneufeld: wondering if you have 120 seconds to chat about GUI recipes for Clojure Cookbook

17:27 jave: gdev: thats a thought, thanks

17:43 dobry-den: Does anyone know the key shortcut in emacs that toggles evil-mode to emacs mode (the <E> appears on the buffer bar)? i press it once a day by accident and only know how to return to evil by doing M-x evil-mode twice

17:47 Oh, found out about `C-h l` (show key press history). Apparently accidental press of C-z has been ruining my life for months now

17:53 akurilin: Is it a poor habit to expect the test profile to be enabled in leiningen when running tests? I'm trying to figure out if I should not rely on profiles to disable nrepl, modify logging etc.

18:01 arrdem: Raynes: thanks for refheap.el!

18:10 Raynes: arrdem: You're welcome!

18:14 arrdem: Raynes: can I update an existing paste?

18:14 that looks like a no...

18:15 Raynes: arrdem: On the website, yes. You can edit it. However, you need to have an account setup with refheap.el to edit a paste created with it, otherwise it won't know who created the paste. Anonymous users can edit their pastes, but a cookie is used to determine who owns those pastes and that cookie doesn't exist when the anonymous paste is created via refheap.el

18:15 arrdem: Raynes: Ok. Couldn't you setq the refheap URL after a successful paste and have subsequent pastes edit?

18:16 Raynes: I'd totally PR this behavior in if there's support on your end for it.

18:16 squidz: dobry-den: try doing M-x evil-normal-state to get it back to where it was

18:16 arrdem: Raynes: assuming that the username and token are set..

18:17 Raynes: arrdem: There is a refheap API call to edit a paste. I'd happily take a pull request to add this functionality in refheap.el.

18:17 clojurebot: 'Sea, mhuise.

18:18 arrdem: Raynes: awesome. I know what I'm doing tonight.

18:30 $karma gdev

18:30 lazybot: gdev has karma 2.

18:30 arrdem: $karma arrdem

18:30 lazybot: arrdem has karma 5.

18:31 gdev: you win this time arrdem D=

18:31 * arrdem cackles evily

18:34 * gdev will work for karma

18:42 dark_element: does clojurescript "0.0-1878" breaks core.async "0.1.222.0-83d0c2-alpha" ?

18:44 jplur: This is a pretty vague question, but would core.logic be a good choice for compiling 'human' CSS from html DOM that only has inline styles?

18:48 s4muel: jplur: You might be better off using something like Raynes' laser for html manip tasks.

18:48 jplur: But that is a pretty vague question.

18:48 supersym: yup

18:48 he did say so tho :)

18:49 s4muel: jplur: I'm assuming you would need to walk the dom, collect all the styles, and then... oh, gross. I just thought about how you are going to have to 'collapse' all that stuff

18:49 supersym: jplur: would this help? http://extractcss.com/

18:49 jplur: s4muel yeah sorry, I'm not worried about parsing and navigating the tree, just figuring out how to work with something that has infinite solutions, where I kind of know what is 'elegant'

18:50 supersym: yeah you generally don't want to think about these tasks :P

18:50 even worse: use regex to do it :)

18:52 lgs32a: does anybody know where there is no such thing as last-nth?

18:53 s4muel: jplur: there was another lib just released for constraints programming that might be a good fit, check the ML

18:53 dcunit3d: is there a good way to debug with the ritz repl on `lein test`

18:54 danielszmulewicz: lgs32a: last?

18:54 s4muel: lgs32a: you mean like nth, but counting from the last item in the seq?

18:57 lgs32a: yes

18:58 like take-last but for a single elem

18:58 danielszmulewicz: there is `last`, neto

18:58 there is first and last

18:58 lgs32a: yes but there is no last-nth

18:58 danielszmulewicz: lgs32a: ah, got you

18:59 dcunit3d: there is nthrest

18:59 and take-last

19:00 lgs32a: ah

19:01 s4muel: lgs32a: if you can reverse the sequence generation and take things from the front in a lazy way that's probably better

19:01 lgs32a: yes i know

19:01 jplur: s4muel: thanks, looks like I'll have to do some research. I think I'm trying to solve 'who is the grandmother of x' type problems with a weighted preference instead of a boolean, some of the constraint stuff looks usefull as well.

19:02 danielszmulewicz: is there anybody that has worked with liberator? I've got an issue with setting the session.

19:02 lgs32a: i just thought it would not be bad to have last-nth in the language

19:03 its basically (comp first take-last) if one imagines indices starting at 1

19:08 arityfn: Where is the abs function in clojure?

19:08 lgs32a: Math/abs

19:09 arityfn: ugh, about 15mins wasted.

19:09 lgs32a: written your own :P?

19:10 arityfn: I should have done since the start.

19:58 dnolen: lgs32a: peek works for vectors

19:59 mercwithamouth: does anyone have the clojure in action meap?

20:00 lgs32a: dnolen: thx

20:00 dnolen: but how can i access the nth with peek?

20:01 dnolen: lgs32a: oh, sorry misread you don't want the last element?

20:01 lgs32a: nah the nth last element

20:01 dnolen: lgs32a: oh you want nth from the last element like negative indices in Python?

20:01 lgs32a: like (= (last-nth 2 [1 2 3]) 1)

20:01 maybe i don't know python

20:01 dnolen: lgs32a: ok yeah doesn't exist

20:02 lgs32a: I'd be curious how a got implementation would look like

20:03 coventry`: For a clojure jar built from source, do I need to tell it or lein anything special in order to point it at jsr166y? The jar for it is not on my classpath in a "lein repl", though the reducers tests run fine in the clojure source dir.

20:05 TEttinger: ,(let [last-nth (fn [coll n] (nth coll (- (count coll) n)))] (= (last-nth [1 2 3] 2) 1))

20:05 clojurebot: false

20:05 TEttinger: damn

20:06 ,(let [last-nth (fn [coll n] (nth coll (- (count coll) n 1)))] (= (last-nth [1 2 3] 2) 1))

20:06 clojurebot: true

20:06 TEttinger: there you go

20:06 lgs32a: yeah

20:06 TEttinger: it will not work for lazy seqs

20:06 well infinite ones at least

20:06 lgs32a: thats what i thought

20:06 using count is fine?

20:06 TEttinger: count is fine for finite ones :D

20:07 ,(count (repeat 0))

20:07 lgs32a: he will never return :)

20:07 clojurebot: Execution Timed Out

20:07 TEttinger: this will probably timeout yep

20:08 amalloy: TEttinger: the function is impossible to write for lazy seqs anyway...?

20:08 TEttinger: but since last-nth has undefined behavior for infinite seqs... yeah

20:09 amalloy, but it works for lazy seqs

20:09 amalloy: oh, i meant infinite there

20:09 TEttinger: ,(let [last-nth (fn [coll n] (nth coll (- (count coll) n 1)))] (= (last-nth (map inc (range 3)) 2) 1)) ;;actually I should check

20:09 clojurebot: true

20:09 amalloy: anyway, rather than counting i think you'd be much better off using take-last, or reusing its implementation strategy

20:10 TEttinger: really?

20:10 this seems like a very small implementation

20:12 http://clojuredocs.org/clojure_core/clojure.core/take-last#source uses loop/recur, which seems less than optimal

20:12 lgs32a: the implementation of take-last seems kinda insane to me

20:13 TEttinger: amalloy, what's the strength in that implementation?

20:14 coventry`: Using count holds onto the head.

20:15 lgs32a: ah

20:15 coventry`: I committed some travesties trying to implement lazy sequences with core.async last night, but I learned a few things about lazy sequences. :-)

20:16 TEttinger: I'm actually not sure what holds onto the head means

20:16 coventry`: TEttinger: After the (count), the entire sequence needs to be in memory, and the sequence may be too long for that. take-last does not need to hold the whole thing in memory.

20:17 TEttinger: ah.

20:17 would .length work ?

20:17 ,(let [last-nth (fn [coll n] (nth coll (- (.length coll) n 1)))] (= (last-nth (map inc (range 3)) 2) 1))

20:17 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: length for class clojure.lang.LazySeq>

20:17 lgs32a: it does not exist for lists

20:17 TEttinger: oh getLength

20:18 coventry`: TEttinger: I don't see how you could get the length without evaluating the whole thing.

20:18 TEttinger: right lazyseqs aren't all in memory

20:18 they're instructions right? how to get the next element, like an iterator?

20:18 lgs32a: but why would count keep the head? after all its just counting, right?

20:19 coventry`: lgs32a: I assume count works by iterating over the list. Then, you need to keep it around to return the tail after that.

20:19 TEttinger: http://clojuredocs.org/clojure_core/clojure.core/count#source count actually isn't implemented in clojure

20:20 lgs32a: i will now look in RT source code

20:21 count is implemented via interface for each sequence type

20:21 coventry`: lgs32a: but for persistent collections, the relevant line is "return i + s.count();", i.e., it's doing the count by recursing over the entire collection.

20:22 lgs32a: where is that line

20:22 coventry`: in countFrom, which is called from count.

20:23 lgs32a: ah

20:24 TEttinger: uh is github down again?

20:24 it's observing yom kippur apparently

20:24 lgs32a: i wonder why they did not implement the Count interface for persistent structurs

20:26 coventry`: but i don't see recursion

20:26 the for loop simply invokes s.next();

20:27 coventry`: You're right. Plus, I was wrong about it being the relevant code. I think the relevant count method is actually in LazySeq.java, where it does just iterate over the sequence (public int count).

20:27 lgs32a: doesn't s=s.next() overwrite the current head

20:27 yea

20:29 coventry`: What I thought was recursion in RT/countFrom was the "s.count" in "return i + s.count()", but I am not sure what that method is for anymore.

20:30 lgs32a: nah its just if the tail-sequence suddenly implements Counted , its count is added to what has been counted

20:30 i think that could happen if you concat two seqs

20:30 because that returns a new lazy-seq

20:31 has anyone managed to run clojurec btw?

20:40 TEttinger: lgs32a, what's clojurec?

20:41 lgs32a: its an implentation of clojure on top of c if i am taken right

20:41 https://github.com/schani/clojurec

20:42 but whenever i tried to run the tests, i got different error message hash-maps

20:42 i also tried various things to get that bdw-gc right

20:51 coventry`: Hmm, if you define multimethods twice, you get screwed up dispatch. Why is that? https://www.refheap.com/18677

20:52 lgs32a: coventry`: multi-methods check whether the var has been bound to a multimethod already

20:53 ah no i mixed sth. up

20:53 coventry`: Should have posted the test as well. Edited the past.

20:53 paste. :-)

20:54 The (thrown?) test passes on the first run, but there's no IllegalArgumentException on the second run.

20:54 lgs32a: i supposed its related to that root-binding thing anyway

20:54 suppose

20:59 no i can't find any real explanation

21:18 cjfrisz: dnolen: I think I've got a protocol-related CLJS compiler bug for you

21:19 I rolled back to 1859 and the bug went away

21:19 Of course, I rolled back about 3 hours ago, but wasn't careful enough about files getting recompiled, so I still thought the bug was my fault

21:23 dcunit3d: what repl would you all recommend for emacs?

21:24 i'm using nrepl/ritz, but running into issues where java hangs and i have to close emacs.

21:24 should i try slime/swank (& ritz?)

21:24 coventry`: I use the regular nrepl. (C-c M-j or nrepl-jack-in from your project files).

21:25 dcunit3d: also, when i `nrepl-jack-in`, none of my files are loaded. is there a way to set that up so they load automatically. i'm running jack-in from my project.clj file.

21:37 cjfrisz: dnolen: disregard possible bug until further notice; just when I thought I'd isolated it, it seemed to go away in 1877

22:48 dcb: Is it possible to have a macro output multiple forms? e.g. (my-macro) -> (+ 1 1) (+ 2 2), or do you have to wrap the forms in a do?

22:56 lgs32a: you can output multiple forms

22:57 sontek: Have you guys played with aleph at all? Seems like its an alternative to http-kit?

23:01 dcb: lgs32a: do you have an example? Maybe a macro that outputs "(+ 1 1) (+ 2 2)"? I can't figure out how to do it, my best attempt is (defmacro my-macro [] `(+ 1 1) `(+ 2 2)), but that only outputs (+ 2 2)

23:04 lgs32a: hmz

23:04 dcb: i was wrong, only the last-form is evaluated

23:05 expanded

23:05 dcb: lgs32a: ok thanks. do it is

23:09 dissipate_: how easy is it to pick up clojurescript once you have learned clojure?

23:11 callen: dissipate_: about as easy as it is to learn Clojure and JavaScript

23:55 nybbles: hi! has anyone ever set up a browser repl as described in https://github.com/cemerick/piggieback#browser-repl such that /repl is just another endpoint in your application server?

23:55 i.e. whatever other routes i made as part of my app, such as /user/ would still work..

Logging service provided by n01se.net