#clojure log - Sep 13 2013

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

0:26 am2605: Hiya. Using a lein project with nRepl / emacs, if I add a new dependency in my project.clj do I need to kill and restart nrepl to get it to recognise it? Or is there a better way?

0:26 coventry: am2605: Check out cemerick's pomegranate.

0:28 am2605: coventry: cheers, will do

0:28 `cbp: am2605: its standard to restart the repl after adding/removing dependencies, but work is being made on a solution ;)

0:28 coventry: `cbp: pomegranate seems like a solution to me. Works great.

0:29 `cbp: coventry: kinda, except it doesn't have a way to sync up with the project.clj + you can't do anything when you add a conflicting jar

0:30 s4muel: https://github.com/pallet/alembic

0:31 I've no idea if it actually works in practice, but it purports to do all those things.

0:31 `cbp: it syncs with project.clj but doesnt have an answer to conflicting jars

0:31 coventry: Oh, alembic looks very nice. Thanks.

0:32 s4muel: `cbp: from the docs, "The conflicting-versions function returns a sequence of dependencies for a distilled dependency, where the dependency jar version doesn't match the version currently on the classpath."

0:32 am2605: s4muel: yeah that does look nice - thanks

0:33 s4muel: np. I've just started to write enough clojure that this was becoming an issue for me as well, so I was just looking at all this stuff earlier today.

0:39 am2605: s4muel: just getting started myself really - well after 18 months of saying I'm going to look into it & reading, I'm finally actually writing some clojure code :)

0:42 s4muel: am2605: Yeah. I am actually an ops guy coming from Ruby/Python/Puppet DSL hell. I somehow discovered Riemann, then Clojure itself, and probably (un)learned more about programming in the past 6 months than the past decade.

0:54 callen: am2605: also look at alembic to just auto-sync with the project without having to type the dependency.

0:54 s4muel: sounds like a fun journey :)

0:54 I started using Ruby originally for dev-ops (pre-Chef), only did serious app dev in Python though.

0:56 s4muel: I made the same kind of journey with cfengine (Oh, yeah, Perl) and Puppet around the formative 1.0 stages. Things were rough back then and even though they have really smart people working at PL, they are still rough now

0:57 callen: I'm not really sold on Puppet/cfengine/Chef

0:57 I prefer fabric for small stuff, ansible for larger'ish stuff

1:00 s4muel: I watched a talk today where the speaker was just like 'i could not write one more iterator loop' (re: java) and I just felt the exact same way about nearly every tool I was using. Puppet, fabric + boto, you name it.

1:01 callen: s4muel: I wrote some code today that I was very pleased with that used select-keys, remove, loop/recur, and merge-with all in the same function :P

1:01 s4muel: Ansible is a step in the direction of simple, and I used it with much success, although I found that I was repeating myself *a LOT* even doing clever tricks with symlinking things into master_templates and master_roles and using jinja inheritance and blah blah fuckin blah

1:05 I implemented the reactor-tcp server in clojure, essentially a giant piece of interop exploration. It's really pretty simple, but I keep thinking (and this happens often with me and clojure) ... there's got to be more to it than that. There isn't.

1:07 * heath wants akka for clojure

1:10 s4muel: heath: you mean you want to see an akka wrapper / akka actor pattern or you want to see something akka-like?

1:10 callen: heath: there are bits and pieces of such a thing slowly coalescing. I doubt you'll see a "one framework to rule them all" type thing in Clojure.

1:10 heath: callen: links

1:10 s4muel: anything

1:11 s4muel: heath: clojurewerkz/meltdown & reactor/reactor is what i was just referring to

1:11 heath: i like how erlang from the get-go isn't restricted to shared memory

1:11 but a wrapper would be nice too

1:12 callen: heath: clojure/otp, avout, etc.

1:13 s4muel: heath: erlang has different design considerations, namely that of being a distributed system

1:14 heath: Storm has pretty decent clojure bindings, from what I've toyed with, if you're going distributed you could wrangle Storm DRPC.

1:14 heath: Also for serious event-processing juju read the riemann source

1:15 tbaldridge: heath: I see erlang's process model to be extremely limiting. Shared immutable memory isn't a bad thing

1:16 heath: IMO, actors go too far overboard and end up complicating otherwise simple designs.

1:16 callen: actors are too close to OO-esque imitation of a "just so" concept.

1:16 and the blending of producer/consumer makes me uncomfortable.

1:17 tbaldridge: callen: it's actually the blending of producer, consumer, state, and logic all into one nasty black box </rant>

1:17 napping: tbaldridge: that's why binaries are shared

1:17 tbaldridge: napping: ?

1:18 napping: Sharing immutable data in Erlang

1:18 tbaldridge: napping: Erlang doesn't share immutable data. In order to access it you have to request the data. In Clojure you simply deref the atom/var/whatever

1:19 napping: So if the actor you're requesting the data from is backed up, you're sunk. There's no way to get at your data.

1:20 napping: So you're really claiming the ways you request immutable data in clojure are more robust under overload than those in Erlang?

1:22 tbaldridge: napping: Not really claiming. It's a known fact. Clojure references are always available, in Erlang everything is message passing. These are well known facts. For what Erlang was designed it's model works well.

1:23 napping: I've worked with some fairly large systems in Clojure, and the limits of Erlang would be very limiting. With Clojure I can have a 12 GB cache and have dozens of threads reading from it at any time. With Erlang that'd require sharding and a ton of other complicated stuff to get it to perform properly under load.

1:26 callen: tbaldridge: what was that anyway?

1:27 tbaldridge: callen: the system I'm talking about?

1:27 heath: that's all i wanted, a little discussion from others on the subject, ty

1:27 callen: tbaldridge: yeah, I'm just curious about it.

1:28 tbaldridge: heath: if you want clojure's take on all this, I might suggest looking at something like RabbitMQ or Kafka combined with core.async.

1:28 napping: tbaldridge: do you know what I mean by binary?

1:28 tbaldridge: heath: so the Clojure way is probably closer to processes with queues between them.

1:29 napping: maybe not?

1:29 * heath thought rabbitmq was erlang

1:29 napping: It might be trouble to flatten the data, but would work for sharing immutable stuff

1:29 tbaldridge: heath: it is, its a distributed queue.

1:29 heath: with interfaces for almost every language on the planet

1:29 napping: http://www.erlang.org/doc/man/binary.html basically vectors of bytes, but they get shared and refcounted between processes

1:30 heath: ah, https://github.com/clojure/core.async

1:30 alright

1:30 napping: and especially if you're doing networking stuff and mostly have that kind of data to shovel around, does a decent job in practice to cut down on copying

1:31 tbaldridge: napping: sharing the data isn't the problem, it's modification/reading of shared state.

1:33 napping: let's say I have a large dataset. I have a stream of events that modify that dataset. That's easily modeled by both Erlang and Clojure, a queue of events that modify the the current state. The problem is that other processes can't read that data without waiting for the "read" message to be processed by the state maintainer. With Clojure you just us an agent, any thread can deref for almost no cost, and deref can

1:33 never block.

1:36 napping: It doesn't seem likely for that to matter - if the state owner can't keep up you're going to have problems either way, and if they can then read messages would also be processed reasonably quickly

1:37 It's nicer, but not such an absolute difference

1:38 tbaldridge: napping: that's the entire difference between clojure and erlang right there. Rich Hickey's original talks on Clojure state that as the idea. Reading should not have to wait on writing. And yeah, in my experience it was a big problem. Especially with bursty sources.

1:38 callen: I'd rather slow down writes and let them eat the dirt than block reads too.

1:38 it's very rare you want parity in priority between the two. Very rare.

1:39 tbaldridge: Consider the one time when you get a burst of data and the writer has to now handle 1000 msgs, your readers now block until all that writing is done. It's coupling and in distributed environments, coupling is bad.

1:39 callen: tbaldridge: I think you have to either get bitten by this stuff, or really grok and absorb what Hickey has been saying to appreciate it.

1:39 SegFaultAX: Goat farms are awesome, just sayin.

1:39 callen: SegFaultAX: wedding gift from your amish relatives?

1:40 tbaldridge: It gets really bad when those readers are also writing to their internal state, now one slow queue can backup others, and the whole thing goes downhil.

1:40 *downhill

1:40 callen: yep.

1:40 SegFaultAX: We went out to Harley Farms today on a company fieldtrip.

1:40 callen: SegFaultAX: did you get headbutted by a goat?

1:40 SegFaultAX: Yes! Haha

1:40 callen: sweeet

1:41 the trip was a success then.

1:41 SegFaultAX: They tried to eat my shirt, too.

1:41 Haha

1:41 callen: SegFaultAX: don't make me laugh, I'm still sick and it hurts to laugh :(

1:41 SegFaultAX: I've been hammered since 10am.

1:42 Raynes: Good work.

1:42 dobry-den: Why doesn't Clojure support numbers with underscores (10_000) like Java does?

1:43 callen: dobry-den: 10e?

1:43 dobry-den: errr, 10e3

1:43 SegFaultAX: Raynes: Startups... you know how it is.

1:43 Raynes: SegFaultAX: Oh, I'm not judging. Pretty sure there are pictures of me sleeping on the kitchen table at work at some point.

1:44 SegFaultAX: Raynes: :) <3

1:44 Raynes: Los Angeles may have gotten the better of me on that particular night.

1:44 <3

1:44 s4muel: Haha. You have to differentiate yourself somehow, instead of work-at-home fridays it's get-drunk-on-a-goat-farm thursdays

1:44 SegFaultAX: s4muel: Are you in SF?

1:44 s4muel: Chicago.

1:44 callen: damn.

1:45 SegFaultAX: Bummer, Harley Farms is /awesome/

1:45 callen: SegFaultAX: have any goat meat?

1:45 SegFaultAX: callen: No. But it's a dairy. Most amazing goat cheese.

1:45 Seriously, still warm.

1:46 (Only half kidding)

1:47 Raynes: Last time I was in Santa Monica it definitely got the better of me. :D

1:47 Raynes: :D

1:47 I actually spend most of my time in Santa Monica. Our office is on the promenade.

1:47 SegFaultAX: So much fun stuff in that area.

1:48 Food, bars, dance, hooka, whatever you want.

1:48 Raynes: You should come hang out with boredomist and I, SegFaultAX. <3

1:48 boredomist: don't drag me into your antics

1:48 Raynes: :p

1:49 SegFaultAX: I am so down for your antics.

1:49 callen: wait a second

1:49 boredomist: who are you? Alan?

1:49 boredomist: shh

1:49 Raynes: Nope. He's my rommate.

1:49 callen: oh, I know who you are.

1:49 Raynes: roommate*

1:49 callen: boredomist: I didn't know you coded.

1:49 Raynes: Yes you did.

1:50 callen: no I didn't.

1:50 boredomist: callen: wait do i know you?

1:50 Raynes: I told you why he's in LA, right?

1:50 callen: I've been sick enough that I don't really remember anything. mind like a collander.

1:50 boredomist: i just lurk here

1:50 callen: Raynes: ohhhh right

1:50 the meat grinder.

1:50 * boredomist goes back into hiding

1:53 SegFaultAX: I think I need to buy a ticket to euro clj.

1:54 s4muel: The speaker list is pretty intense

1:55 SegFaultAX: s4muel: No joke.

1:55 s4muel: Cool, they put the program up.

1:55 dissipate_: when is the next clojure west conference?

3:44 clj_newb_2345: is there a simple way to make https request over clojure? (clojure is the CLIENT, not the server)

3:48 guns: clj_newb_2345: (slurp "https://foo.com/&quot;)

4:16 * ucb waves

4:32 muhoo: clj_newb_2345: clj-http

4:32 if you want more fancy stuff than slurp, or if you need POST, etc

4:33 SegFaultAX: also, pescadero is awesome

5:55 si14: Wow. (count (.getDeclaredFields (.getClass …some simple record…))) → 128

5:56 is there any reason why Clojure adds all methods as fields?

5:56 if I understand correctly, this will blow the cache for small records

6:21 opqdonut: si14: if the fields are from a superclass, it won't

6:21 no, wait, it will

6:22 I only get 31 fields for a trivial record

6:22 si14: opqdonut: I have some methods in that record

6:23 nevertheless, 31 field for trivial record? seriously?

6:23 opqdonut: of those 31 fields most are static, only 4 are nonstatic

6:23 static ones don't inflate the size of an instance

6:23 for (defrecord Foo [a b]) the fields are:

6:24 #<Field public final java.lang.Object user.Foo.a> #<Field public final java.lang.Object user.Foo.b> #<Field public final java.lang.Object user.Foo.__meta> #<Field public final java.lang.Object user.Foo.__extmap>

6:24 which seems pretty ok

6:24 si14: the size of instance for my object is 288 bytes

6:25 for (deftype Foo [^doubles data ^int ndims ^ints shape ^ints strides ^int offset])

6:25 *bits

6:26 opqdonut: I tried adding some methods but they didn't show up as fields. this is clojure 1.4.

6:26 si14: hm, suddenly it seems reasonable, even fits in the cache line. OK :)

7:12 borkdude: how do I run lein test and override :jvm-opts with a custom value (using a profile)? (see #leiningen for more info)

7:13 mercwithamouth: hrmm does anyone use emacs-live by chance? just loaded it in...a bit much but at the same time not bad

7:13 wei_: trying to translate a java snippet. how would I import some.package.*

7:15 scottj: wei_: I don't think there's a way built-in, you have to name each class afaik

7:15 wei_: ok. thanks scottj

7:16 tangrammer: wei_: And i think that you'll have to include the jar dependency

7:17 wei_: tangrammer: since it's available in maven, i can just include it in the leiningen dependency list.. seems to work

7:18 tangrammer: wei_: maybe that helps you http://citizen428.net/blog/2009/09/06/using-java-libraries-from-clojure

7:19 scottj: tangrammer: I think he's just interested in the * part of his question

7:21 tangrammer: scottj: i remember that it is not possible

7:21 scottj: i think that I read it in a hickey article

8:00 zanes: Anyone have clojure-test-mode crash with a NPE when trying to run tests?

8:34 Bronsa: coventry: ping

8:55 wei_: is there a clojure equivalent of import static?

9:02 clgv: wei_: not really

9:03 wei_: clgv: thanks. found an easy workaround..

9:03 clgv: wei_: memfn + def?

9:04 wei_: or just class import and using class name? which is the fastet approach but not comparable to import static ;)

9:04 wei_: yup the latter

9:05 btw, how would I write this? StringUtils.isBlank(aString)

9:05 clgv: wei_: (StringUtils/isBlank a-string)

9:06 wei_: aha. thanks!

9:06 (inc clgv)

9:06 lazybot: ⇒ 7

9:06 sheldonh: "OutOfMemoryError Java heap space" from (take 100000000 (iterate inc 0)) ... a hundred million numbers doesn't seem like a lot :(

9:06 clgv: sheldonh: dont print them^^

9:07 ,(let [numbers (take 100000000 (iterate inc 0))] (count numbers))

9:07 clojurebot: Execution Timed Out

9:07 sheldonh: ahhh

9:07 thanks :)

9:08 clgv: always `def` those lazy-seqs that might not fit into memory

9:08 sheldonh: clgv: in the repl, or always always?

9:08 clgv: sheldonh: in the REPL. otherwise see the let above ;)

9:12 sheldonh: cool, thanks :)

9:15 wei_: what's an good way to add a callback to a java object's event listener? https://gist.github.com/yayitswei/6550221

9:17 coventry: Bronsa: Pong, but stepping out for a couple of hours. Thanks for the comments on the patch. I will revise it as you request.

9:45 clj_newb_2345: http://blog.mongodb.org/post/172254834/mongodb-is-fantastic-for-logging + using mongodb to store clojure data structures

9:45 is fucking life changing

9:45 I don't know how to express how fucking awesome this is

9:45 I

9:45 I'm now convinced that no-sql is not complete bs

9:47 clgv: clj_newb_2345: but be careful with large data since keywords consume memory for every instance...

9:48 clj_newb_2345: what?

9:48 clojurebot: what is cells

9:48 clj_newb_2345: what do you mean?

9:48 why are keywords not supposed to consume memory?

9:48 why is it surprising that {:name "Turing", :IQ 999} qould rewuire memory?

9:49 clgv: clj_newb_2345: I had very large data composed of clojure maps where attributes were keywords. in clojure each keyword is allocated only once in mongodb they are stored as strings and there seems to be no "internalization" logic like in java/clojure

9:50 jonasen: I've got a strange problem with (probably) nrepl.el. I get "RuntimeException: Unable to resolve symbol: cljs-object in this context, compiling:(/tmp/form-init42453....)" when I do C-x C-e on a form like '(cljs-object "(ns foo)")'. If I change the call to e.g. '(cljs-object "(+ 1 2)")' there are no exception (and I get the expected result). Everything works if I use 'lein repl' instead of nrepl.el. Has anyone had similar problems?

9:50 augustl: serializing and storing clojure data structures as strings sounds pretty bad :)

9:50 clgv: augustl: it is 40GB datomic db => 350GB mongodb ;)

9:50 clj_newb_2345: I see, so :if-I-had-this-really-fucking-long-ass-keyword-multiple-times ... in clojure, it's sizeof(char) * length of keyword + sizeof(pointer) * number of time it occurs. In mongodb, it's size of char * length of keyword * number of time it appears ?

9:51 clgv: right

9:51 clj_newb_2345: wait what?

9:51 why is datomic 10x more efficient?

9:51 does datomic exploit sharing of clojure data structures?

9:51 clgv: I had many small maps ^^

9:51 leifw: probably compression

9:51 clgv: less than 10 kv-pairs

9:52 lunk: hello, can a function definition with multiple signatures have a shared (let binding?

9:52 augustl: clj_newb_2345: datomic can't store clojure data, no. You only get strings, numbers, etc

9:52 clgv: clj_newb_2345: in that case definitely not. since the structure didnt share anything

9:52 augustl: lunk: what would you bind, since you'd need to bind before your arguments are available? :)

9:53 lunk: augustl: i want to have a bound, shared, i/o task, let me make a paste

9:53 clj_newb_2345: so why is datomic 10x more effiient thatn mongodb?

9:53 tbaldridge: clj_newb_2345: datomic is more efficient because of the serialization system it uses. It stores data in binary form. So things like keywords actually get saved as integers.

9:53 lunk: augustl: and then optionally filter it

9:53 clj_newb_2345: clgv: be honest here -- do you have equity in relevance software? :-)

9:53 augustl: clj_newb_2345: I would guess that clgv was storing datomic entities serialized as maps into mongodb?

9:53 tbaldridge: clj_newb_2345: the serializer that Datomic uses (is OSS) https://github.com/Datomic/fressian

9:54 *its OSS

9:54 augustl: true, datomic does compress before storing

9:54 clgv: clj_newb_2345: nope. I also do not suggest that you use it at this point. stole me 3-4 days for my use case with a result that provided hardly any advantage on my previous non-db setup.

9:55 clj_newb_2345: clgv: it == mongodb or it == datomic, in "I also do not suggest that you use it at this point."

9:55 clgv: clj_newb_2345: it just came to my mind because of the clojure maps as data objects to store in mongodb

9:55 tbaldridge: clj_newb_2345: datomic also requires that you declare your schema up-front. If you know the schema, then you can even save maps in the proper order, at that point a list of maps becomes a list of map values.

9:55 lunk: augustl: http://pastebin.com/p6XXHMAP see how I'm memoizing the main dataset creation? i was wondering if i could keep that and also integrate the dataset2 function with the date filter (x days of data)

9:56 clgv: clj_newb_2345: I meant datomic. mongo does not fit either since I had to query into the document and the huge size of the data

9:57 clj_newb_2345: if I tried again, I'd use an sql db for that use case probably with korma

9:57 hanDerPeder: whats the correct way of dealing with two dependencies A and B both depending on dependency C, but different versions?

9:58 augustl: lunk: why do you overdide the function yahoo-dataset with a call to that function?

9:58 lunk: it caches the full dataset

9:58 hanDerPeder: more concretely, can I tell leiningen to use the newset version of C?

9:58 augustl: lunk: why the same name for the cache though?

9:58 lunk: augustl: memoization so i don't download the data each time

9:58 clgv: clj_newb_2345: what tbaldridge said is the major reason I guess. you have the "keywords" of the maps predefined and thus they do not need to be stored with every entity

9:59 lunk: augustl: something out of the memoization manual page

9:59 augustl: I see, didn't know this was a common pattenr

9:59 lunk: august1: it automagically handles all inputs parameters, very slick

10:00 augustl: so my question is, can i have an optional 'days of data' parameter without breaking out the call to yahoo-dataset2, (which with the let binding also uses the cached copy)

10:01 augustl: lunk: do you know if memoize-ttl supports multi-arity functions?

10:01 lunk: augustl: that is a good question, and 'arity' i think is the term i was lacking

10:01 augustl: lets go find out

10:02 augustl: lunk: fyi, you can do (defn ([foo] ...) ([foo bar] ...))

10:02 err, with a function name in between :)

10:02 lunk: well see, i don't want to 'cache' each filtered dataset

10:02 i want to cache the WHOLE thing, and then optionally return just a subset if a parameter exists

10:04 augustl: lunk: is there any duplication you want to remove? I don't see any duplication in your paste

10:05 lunk: augustl: more of a nice-to-have, i want a multi-arity method, that caches the whole dataset, while having the yahoo-dataset2 function as a filter of the cached dataset

10:05 augustl: memoization does support multi-arity functions

10:06 (defn- multi-arity ([x] x) ([x y] (+ x y))) (def multi-arity (memo-ttl multi-arity (* 4 60 60 1000)))

10:06 augustl: no point in memoizing anything but the read-dataset call though, I guess

10:06 clojurebot: Cool story bro.

10:06 lunk: augustl: exactly

10:06 augustl: so what's the problem with your code? :)

10:06 it seems to do the job

10:06 lunk: augustl: oh it works, it could just work better!

10:07 (more-better code)

10:07 ;)

10:13 sdegutis: It would probably be a fun project to port http://xkcd.com/actuary.py.txt to Clojure.

10:13 lunk: augustl: ugh, this works, gives me my desired method signature arity, but is fugly. http://pastebin.com/0mxPJhRh

10:19 clgv: sdegutis: please do and announce on the ML ;)

10:19 sdegutis: is there a related comic to that script?

10:19 sdegutis: clgv: Would that be an appropriate venue to announce such a thing?

10:20 clgv: http://blog.xkcd.com/2012/07/12/a-morbid-python-script/

10:20 clgv: sdegutis: dont know. but why not? at least I'll here when it is finished that way ;)

10:21 sdegutis: clgv: okay I may give it a shot, thanks

10:21 clgv: *hear it

10:22 sdegutis: Actually no, I can't. It's too hard for me.

10:22 lunk: augustl: boom! ard for me.

10:22 09:55:13 -!- yogthos is now known as yogthos|away

10:22 dangit

10:22 augustl: http://pastebin.com/zdXFUbns just have it call itself

11:04 gfredericks: huh. this equality bug with sets and negative numbers is apparently still around

11:04 ,(let [n1 -5, n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2})])

11:04 clojurebot: [true false]

11:05 clgv: gfredericks: are you sure the negative numbers are the problem and not the different integer types?

11:05 ,(let [n1 5, n2 (BigInteger. "5")] [(= n1 n2) (= #{n1} #{n2})])

11:05 clojurebot: [true true]

11:05 clgv: humm. interesting.

11:06 gfredericks: there was a similar bug with Integer that was quasi-fixed before

11:06 clgv: ,(let [n1 (BigInteger. "-5"), n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2})])

11:06 clojurebot: [true true]

11:07 gfredericks: http://dev.clojure.org/jira/browse/CLJ-1106

11:07 ,(let [n1 -5, n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])

11:07 clojurebot: [true false true]

11:09 clgv: gfredericks: time for another ticket since CLJ-1106 is reported to be fixed in 1.5

11:10 ,(let [n1 -5, n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2]) (= {n1 n2} {n2 n1})])

11:10 clojurebot: [true false true true]

11:11 gfredericks: clgv: yeah I left a comment asking if it should be a new ticket; I guess I'll go ahead and make one

11:12 ,(let [n1 -5, n2 -5N] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])

11:12 clojurebot: [true true true]

11:12 gfredericks: apparently it's okay for BigInt

11:12 clgv: gfredericks: from bureaucratic point of view you definitely need a new one ^^

11:12 gfredericks: I was only using a BigInteger because of some datomic bug :)

11:13 clgv: lol. I dont want to see any datomic stacktraces for the next months ;)

11:14 gfredericks: ,(let [n1 -5 n2 (BigInteger. "-5")] [(= #{n1} #{n2}) (= [n1] [n2])])

11:14 clojurebot: [false true]

11:15 gfredericks: ,(let [n1 -5 n2 (BigInteger. "-5")] [(= #{n1} #{n2}) (= [#{n1}] [#{n2}])])

11:15 clojurebot: [false false]

11:15 clgv: thanks to OOP it doesnt matter where you embed the sets ;)

11:16 not to say that that is bad...

11:16 gfredericks: http://dev.clojure.org/jira/browse/CLJ-1262

11:17 clgv: gfredericks: did you try bigdecimal?

11:17 ,(let [n1 -5.0 n2 (BigDecimal. "-5.0")] [(= #{n1} #{n2}) (= [n1] [n2])])

11:17 clojurebot: [false false]

11:18 clgv: humm mabye that is on purpose..

11:18 ,(let [n1 -5.0 n2 (BigDecimal. "-5.0")] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])

11:18 clojurebot: [false false false]

11:19 clgv: ,*clojure-version*

11:19 clojurebot: {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}

11:19 clgv: &*clojure-version*

11:19 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

11:19 gfredericks: clgv: yeah the floats aren't normally equal to each other I don't think

11:19 clgv: ,(let [n1 -5.0 n2 -5.0] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])

11:19 clojurebot: [true true true]

11:19 clgv: ;)

11:20 asteve: I have a string "123.456" and I want to keep the 123 portion and convert that to a long

11:20 would you use Float/parseFloat?

11:20 clgv: but BigDecimal represents arbitrary precision floating point numbers

11:20 andyfingerhut: https://github.com/jafingerhut/thalia/blob/master/doc/other-topics/equality.md

11:20 Gives a summary of = and == behavior in Clojure 1.5.1, followed by more details

11:20 clgv: andyfingerhut: gread :)

11:20 *great

11:21 ,(let [n1 -5.0 n2 (BigDecimal. "-5.0")] [(== n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])

11:21 clojurebot: [true false false]

11:21 clgv: so the question is should numbers in collections be compared numerically by default...

11:22 `cbp: ,(long (Double/valueOf "123.425"))

11:22 clojurebot: 123

11:22 clgv: ,(Integer/parseInt "123.456")

11:22 clojurebot: #<NumberFormatException java.lang.NumberFormatException: For input string: "123.456">

11:23 gfredericks: andyfingerhut: so is CLJ-1262 not a bug then?

11:24 andyfingerhut: gfredericks: checking ...

11:24 gfredericks: andyfingerhut: your doc seems to explicitely call out the possibility

11:24 andyfingerhut: Note that CLJ-1036 was judged as out of scope for Clojure by Rich, even though BigInteger hash values are inconsistent with = integer values of other types.

11:25 That might be the root issue of CLJ-1262, too, but I will take a look here

11:25 gfredericks: I would have thought that (not= (= [x] [y]) (= #{x} #{y})) was always a bad thing, but I guess the latter depends on hashing while the former doesn't

11:26 ,(let [n1 -5, n2 (BigInteger. "-5")] (= {n1 :foo} {n2 :foo}))

11:26 clojurebot: true

11:26 gfredericks: ^ they compare equal as map keys though :/

11:28 andyfingerhut: gfredericks: Small maps are array-maps. Try using hash-map explicitly to construct them

11:28 gfredericks: oh right

11:29 ,(let [n1 -5, n2 (BigInteger. "-5")] (= (hash-map n1 :foo) (hash-map n2 :foo)))

11:29 clojurebot: false

11:29 gfredericks: ah ha

11:29 andyfingerhut: Sets are compared for equality first by # of elements, then by iterating through one set and checking whether each element is in the other set. contains? and other forms of set membership are based on comparing hash values, so it appears that the root cause of CLJ-1252 and CLJ-1036 are the same.

11:30 i.e. BigInteger values that are = to other int types can have different hash values.

11:31 I certainly wouldn't mind if CLJ-1252 was vetted and had a patch applied for it, though :)

11:34 gfredericks: Do you see BigInteger values pop up in any of your applications, without going out of your way to force them in there?

11:35 My guess is it should only happen in some Java interop cases. That doesn't make them unimportant -- I am just trying to think through the scenarios when they can be created.

11:37 lolkatz: Is there anything that resembles cheshire, for clojurescript?

11:38 dnolen: lolkatz: many JavaScript targets have native JSON parsers / serializers, is there something specific your looking for?

11:43 lolkatz: dnolen: I'm used to response maps having specific fields like :status and :body, looking for something that doesn't require learning these things over again

11:44 dnolen: lolkatz: k, I'm not aware of anything like cheshire for CLJS

11:44 lolkatz: dnolen: oops, I meant clj-http

11:44 not cheshire, d'ouh!

11:45 dnolen: lolkatz: yeah I was confused there. https://github.com/r0man/cljs-http

11:45 lolkatz: oh nice, thanks

12:00 gfredericks: andyfingerhut: there's a datomic bug that forced me to use BigInteger

12:00 also datomic likes sets so I was using sets too :)

12:01 andyfingerhut: You may add weight to the case for CLJ-1252 if you mention how you came across it.

12:01 Or it might get the datomic bug fixed :)

12:01 gfredericks: well I think the datomic bug might be fixed in a recent version

12:41 jonasen: I've got a strange problem with (probably) nrepl.el. I get "RuntimeException: Unable to resolve symbol: cljs-object in this context, compiling:(/tmp/form-init42453....)" when I do C-x C-e on a form like '(cljs-object "(ns foo)")'. If I change the call to e.g. '(cljs-object "(+ 1 2)")' there are no exceptions (and I get the expected result). Everything works if I use 'lein repl' instead of nrepl.el. Has anyone had similar problems?

12:52 dnolen: tbaldridge: I pushed the necessary changes for CLJS > 1877 here http://github.com/clojure/core.async/compare/keywords

12:52 tbaldridge: dnolen: looks good to me

12:53 dnolen: tbaldridge: I didn't merge it in because I wasn't sure about the stuff happening in master around releases

12:53 tbaldridge: dnolen: they just cut an alpha release, so we should probably merge asap

12:53 dnolen: tbaldridge: k will merge it in

12:53 tbaldridge: dnolen: see https://twitter.com/puredanger/status/378553787289321473

12:53 dnolen: tbaldridge: it does means core.async will pin users to CLJS > 1877

12:54 tbaldridge: dnolen: yeah, but I'm not sure of a better way. It's still alpha after all :-)

12:54 dnolen: tbaldridge: k just wanted to check

12:56 bobbrahms: hey man

12:56 question

12:56 you building a recent version of the strings 640 branch?

12:56 silasdavis: I'm getting an 'unable to resolve symbol recur in this context'

12:56 bobbrahms: sorry misfire

12:56 silasdavis: is recur allowed in a fn in a let binding

12:56 ?

13:01 Bronsa: silasdavis: nopaste your code

13:03 silasdavis: Bronsa, sorry looking at wrong recur, resolved thanks

13:03 Bronsa: ok

13:34 asteve: I have a line that looks like this (long (* (Float/parseFloat "1234.5678") 1000))

13:35 in production I'm getting type casting errors, can't cast long to double; I can't repeat them locally

13:35 is there something glaringly wrong with the approach?

13:35 should I be use BigDecimal?

13:38 dnolen: asteve: are you sure that's the offending line? Do you have a stack trace?

13:39 coventry: asteve: did you sort out which version of clojure you're running on storm?

13:39 asteve: coventry: yes - that's all set now

13:39 coventry: some of the issues were related to storm shipping with a a clojure jar built on 1.4 and I was attempting to use 1.5.1

13:40 dnolen: I don't have a stack trace

13:40 dnolen: asteve: then why do you think that line is the problem?

13:41 asteve: dnolen: I know where in the code the exception is being thrown and it's the only place that deals with numbers - I admin this is not a full proof debug plan

13:41 coventry: asteve: Wrap the form in the code suggested here: http://stackoverflow.com/questions/17314128/get-stacktrace-as-string

13:42 dnolen: asteve: you should probably figure out a way to log the entire exception - otherwise just guessing. That code doesn't look problematic to me.

13:44 asteve: I will attempt to do what coventry said, in the meantime this is what storm is giving me https://gist.github.com/sannessa/487a9883751a8971e842

13:46 sandbags: i realise this isn't a Java group but since we do have to work with java.net.URL and friends ... am i right in thinking the only way to have a URLConnection not follow redirects is to use the static method on HttpUrlConnection?

13:46 i.e. for all URLConnections

13:47 seems a little gross but that's what i'm reading

13:48 dnolen: asteve: https://github.com/nathanmarz/storm/blob/master/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java#L87

13:48 asteve: you're going to want the whole trace, that's where the error is thrown

13:49 asteve: right

13:54 sandbags: ah.. the delightfully named setInstanceFollowRedirects

13:54 gawd bless those JDK authors

13:54 clojurebot: It's greek to me.

13:56 sandbags: amen to that clojurebot

13:56 coventry: Should "grench test" DWIW?

14:04 Bronsa: coventry: I took the changes on the tests out of your patch, those were commented because tagged literals don't exist in e.g. clojure 1.3 so those would fail

14:04 coventry: pushed, thanks

14:04 coventry: NP.

14:07 technomancy: coventry: I think yes?

14:10 coventry: technomancy: I'm getting the failures shown in <https://www.refheap.com/18638>. Fails with a different stack trace if I try doing the "lein repl" in a project directory.

14:12 technomancy: huh. did you build from master

14:12 ?

14:12 oh, you need to be running lein from master

14:12 the error you get on older lein is really unclear =(

14:13 coventry: Oh, right. I forgot about that. Thanks.

14:13 technomancy: in case anyone hasn't seen it yet: https://i.cloudup.com/YTMd2VkRWl-2000x2000.jpeg

14:15 coventry: Great, that works. Thanks again.

14:16 danielszmulewicz: technomancy: 'reposoitory of all wisdom' gaffe, anyone?

14:16 technomancy: http://edition.cnn.com/2013/08/12/world/asia/australia-abbott-suppository-gaffe/index.html

14:17 silasdavis: is there a clojure function like (split-by pred coll) that outputs ((<elements where pred truthy>) (<the rest>))?

14:18 llasram: silasdavis: `split-with`

14:19 silasdavis: llasram, thanks thought there would be

14:19 technomancy: danielszmulewicz: hah not bad

14:19 danielszmulewicz: technomancy: :-)

14:20 dnolen: CLJS relevant 1878 changes landed in core.async master

14:20 silasdavis: llasram, actually that just seesm to split where pred is first true

14:21 llasram: silasdavis: Oh, then I think you just want (juxt filter remove)

14:21 rasmusto: silasdavis: how about group-by? it returns a map though

14:22 ,(group-by pos? (range 10))

14:22 clojurebot: {false [0], true [1 2 3 4 5 ...]}

14:23 silasdavis: llasram, yeah that passes over the list twice though

14:23 rasmusto, yeah that'd worlk

14:23 rasmusto: silasdavis: doesn't look like it's lazy though, since it gives vectors back, not sure if that's what you want (I could be wrong)

14:23 llasram: silasdavis: If you want a lazy solution, there isn't another option

14:24 dnolen: nice summary of the rough source map support currently in CLJS - http://beandipper.github.io

14:29 silasdavis: llasram, it's not clear to me how this could be lazy in the pairs anyway

14:30 llasram: silasdavis: I'm afraid I'm not following...?

14:30 silasdavis: like is (let [foo ((partial (juxt filter remove) odd?) [1 2 3 4 5])] (take 1 (first foo)))

14:30 giving me lazy access to the odd numbers?

14:31 llasram: Oh, yes

14:31 silasdavis: or is it triggering the whole evaluation

14:31 llasram: Each is holding the head to the original seq though

14:32 So in each you'll only force evaluation of the original seq up to the point you've forced in the either of filter/remove seqs

14:32 silasdavis: oh really

14:32 ok

14:32 asteve: sritchie: are you about?

14:33 tupi: folks, does (do s-exp1 s-exp2 ...) returns the value of the last s-exp executed ?

14:33 coventry: tupi: Yes, if there's no exception.

14:33 tupi: tx

14:34 coventry: Try /msg clojurebot ,(do 1 2 3 4 5) to test this kind of thing out in a repl.

14:35 sdegutis: /msg clojurebot ,(do 1 2 3 4 5) to test this kind of thing out in a repl.

14:35 Neat.

14:38 sritchie: asteve: hey, yeah

14:38 what's up?

14:39 asteve: sritchie: storm question: 2013-09-13 17:24:41 task [INFO] Emitting: 5 default ["a" "b" "c" "d"]; does this mean the bolt with id "5" is emitting ["a" "b" "c" "d]?

14:39 I asked them same question in #storm-user but it is dead

14:42 sritchie: I haven't used straight-up storm in a while, but looks like that's correct to me

14:43 asteve: ok, thanks

14:49 Bronsa: ew

14:55 mdrogalis: sritchie: ping

14:55 sritchie: mdrogalis: yo

14:55 hey!

14:55 mdrogalis: Congrats on the speaking gig at Conj!

15:03 callen: The mailing list needs a clippy assistant. "It looks like you're posting a library/tool announcement, but I don't see a URL in your post. Are you sure you want to continue?"

15:03 ucb: heh

15:15 gfredericks: why does `lein trampoline repl` not start an nrepl server?

15:18 coventry: silasdavis, llasram: You could probably make a version of split-with which returned two lazy sequences and only evaluated the original sequence once, if you used core.async. Not sure the overhead would be worth it, though. :-)

15:19 wei_: (inc mdrogalis)

15:19 lazybot: ⇒ 2

15:20 wei_: (inc chrisfjones)

15:20 lazybot: ⇒ 1

15:24 bracki: Does anybody use vim-static-clojure and has modelines working for them?

15:26 technomancy: gfredericks: because typically the client runs in leiningen's process

15:27 which doesn't exist when trampolining

15:27 gfredericks: `lein trampoline repl :headless` will though

15:35 sdegutis: Ah `lein ring uberjar` looks really useful.

15:36 amalloy: coventry: i'm not so sure about that core.async split-with, but i'd be interested in being proved wrong

15:41 ed_g: is there any equivalent to letrec in clojure besides letfn? some of the things I want to give names to are not functions?

15:42 zilti: ed_g: def

15:43 *let

15:44 ed_g: zilti: is there actually a star-let? or I do in fact have to create a global binding in the name space?

15:45 hiredman: ed_g: just don't create self refering structures

15:46 ed_g: hiredman: it is not self referencing at run time, it just refers to the name.

15:49 hiredman: ed_g: that is self referencing

15:51 ed_g: hiredman: ok I suppose in a manner of speaking. what doesn't make sense to me is why letfn is OK but letrec is not OK.

15:51 gfredericks: technomancy: oh sweet thx

15:52 technomancy: that also explains why it all of a sudden downloaded some reply stuff that it hadn't needed before

15:52 ed_g: or why simple things are possible in global def's that are not possible using let.

15:52 hiredman: ed_g: def and let do something very different, clojure is not scheme

15:53 def interns a var with a given name, and gives the var a value, let binds a local name to a value

15:54 ed_g: hiredman: what does letfn do?

15:54 i appreciate the help by the way

15:55 hiredman: letfn is more like let, but the compiler does some shenanigans

15:56 `cbp: letfn is 'paralell' like common lisp's let unlike clojure's let (sorry i don't know racket)

15:56 hiredman: ed_g: the thing is, creating immutable datastructures can be done, but sort of not really, and either you have to do knot tying or fake it via mutating the "immutable" structure

15:57 doing it for fuctions is slightly less hand wavy

15:57 ed_g: I suppose I could replace all the constants with a function which returns the "constant". performance isn't an issue.

15:58 hiredman: you can of course tie the knot yourself using things like delay

16:00 clojurebot: letfn?

16:00 clojurebot: Gabh mo leithscéal?

16:00 hiredman: clojurebot: letfn is https://gist.github.com/hiredman/1179073

16:00 clojurebot: Ok.

16:01 `cbp: letfn is letfn* :(

16:03 bracki: Style question. 'foo-to-bar' or 'foo->bar'?

16:04 `cbp: foo->bar

16:04 ed_g: hiredman: ok very interesting.

16:04 sdegutis: hiredman: wat

16:35 noprompt: dnolen: i upgraded to cljs 1877 last night and core.async stopped working. :-/

16:35 dnolen: noprompt: you need 1878 you need core.async master

16:35 noprompt: dnolen: oh, hehe, just noticed the PR. sorry!

16:36 dnolen: i mean the commit.

16:36 dnolen: noprompt: will be fixed in the next core.async release

16:36 noprompt: in meantime you can do what you've been doing - working with SNAPSHOT

16:36 noprompt: dnolen: i can still use it from checkouts though?

16:36 k

16:39 dnolen: is that the right way to use "edge" versions of libs?

16:39 ie. the checkouts dir?

16:40 sdegutis: ,(let [[one :as all] [1 2 3]] [one all])

16:40 clojurebot: [1 [1 2 3]]

16:40 sdegutis: weird.

16:46 noprompt: nm

16:47 amalloy: hiredman: isn't ~(reduce into (vec a) [b c]) just [~@a ~@b ~@c]?

16:47 (referring to your letfn)

16:48 very cool letfn, though; i think i understand how to do it with promises, but i'm going to have to read over that several times to understand how you did it with delays

16:56 janiczek: Guys, is there some "clojure-php" project underway? (In the same spirit as ClojureCLR, CLJS, clojure-py, clojure-scheme)

16:57 callen: janiczek: don't.

16:58 tbaldridge: janiczek: if someone did that I would imagine they wouldn't live long enough to regret it :-P

16:58 scriptor: it'd probably be a traumatic experience

16:58 Bronsa: amalloy: the `[~@x] way of concatting multiple vectors is inefficient compared to using reduce into though

17:00 tbaldridge: Clojure on PHP : http://1.bp.blogspot.com/-xP-p-nGtozA/UJvqlRf0g3I/AAAAAAAABJ4/NP51t22n5hM/s320/c.gif

17:00 janiczek: callen: tbaldridge: :)) yeah, I guess.

17:01 amalloy: Bronsa: well, (a), this is at macroexpansion time, and (b), are you sure? reduce into is building multiple vectors, which could get a little expensive. i mean, you're probably right, but there's some real expense in both approaches

17:01 Bronsa: amalloy: ~@ transforms to apply+vector+concat

17:02 amalloy: indeed

17:02 Bronsa: amalloy: to be clear, I use `[~@x] a LOT to concat vectors in CinC

17:02 I'm just saying, maybe performances is why he wrote it that way

17:03 janiczek: but it's a wonderful thought - probably around 90% of webhostings (at least here in Czech Republic) are PHP, majority of clients are going to pick cheap hosting instead of dedicated server or something - it would be great to Clojure on PHP.

17:05 mgaare_: janiczek: have you tried digitalocean?

17:06 nDuff: janiczek: remember, clojure depends fairly hard on interop with its host platform

17:07 janiczek: it won't be a reasonable experience if the host platform is utter crap, even if it _did_ provide sufficient foundation to build a robust implementation.

17:07 amalloy: Bronsa: a quick bench with criterium suggests that [~@a ~@b ~@c] takes about 10% longer, fwiw

17:08 or, actually, i misread and it's about 100% longer. so that's pretty significant, although of course it doesn't matter at macro time

17:09 janiczek: mgaare_: no I haven't - thanks for reccomendation!

17:10 nDuff: mhm ... I imagine writing the implementation would be a horror.

17:11 nDuff: maybe we need some kind of total_hours_wasted_here for that. http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

17:34 noprompt: cemerick: austin is "the bomb." thank you.

17:35 cemerick: noprompt: and not "The Bomb", or even The Bomb? Feh. ;-)

17:35 np, enjoy :-)

17:35 dnolen: noprompt: no I think the right way is to use sonatype repo

17:35 noprompt: other lein install

17:35 noprompt: I only use checkouts if I need to debug some libs at the same time - usually clojurescript + something else.

17:36 s/debug/patch

17:36 "or lein install"

17:36 Raynes: cemerick: How's things?

17:36 Haven't talked to you in quite a while.

17:37 cemerick: Raynes: honestly, sorta shitty lately. But, no worries.

17:37 noprompt: dnolen: ah, ok. gotcha.

17:37 Raynes: Aw.

17:42 tupi: how should i rewrite this code so that i only parse a range once:

17:42 (let [results (ResultsTable/getResultsTable) xstart (for [i (range counter)] (int (.getValue results "XStart" i))) ystart (for [i (range counter)] (int (.getValue results "YStart" i)))] ...)

17:43 i scheme i would use arrays, or initialize vectors and set their values as apropriate ...

17:48 seangrove: tupi: https://www.refheap.com/18649 ?

17:49 tupi: seangrove: well that is what i am doing, but how doing things in 1 for only?

17:49 tx to ehlp me of course :)

17:49 seangrove: tupi: Perhaps use destructuring? https://www.refheap.com/18649

17:50 Ah, no, that won't work in this case

17:50 tupi: is there an example of intializing vectors somewhere ?

17:51 or sequences or what ever would come from 'external' values, computation on them and storing the results in a couple of different sequences ...

17:57 ... (for [i (range counter)] (set! xstart i (int (.getValue results "XStart" i))) (set! ystart i (int (.getValue results "YStart" i))) (set! dirc i (Math/sqrt (/ (* 4 (.getValue results "Area" i)) Math/PI))) ...)

17:59 amalloy: tupi: (for [...] (...anything with a ! in it...)) is probably always an error

17:59 tupi: amalloy: i am looking for an example of some code that would parse the range once only , performing calculus and storing the results ...

18:00 `cbp: tupi: that wont work, replace for with doseq

18:01 benkay: does anyone have anything to say about working with quantlib or opengamma from clojure?

18:02 tupi: `cbp: i don't know how to write that simple example using doseq either

18:03 how do initialize the 'whatever' that will receive the values ?

18:03 any example somewhere?

18:04 amalloy: tupi: all you've done is compute four vectors at once. that's really the same as computing a list of four-tuples, and then transposing it

18:06 (apply map list (for [i (range counter)] [(compute x) (compute y) (compute z)])) => ((x1 x2 ...) (y1 y2 ...) (z1 z2 ...))

18:09 tupi: ok, really funny [to me], let me try

18:15 amalloy: do you have receive, like (receive (a b c d) (apply map list (for ...)))

18:15 amalloy: (let [[a b c d] ...])

18:16 tupi: tx

18:18 muhoo: any ideas about constant g #<EOFException java.io.EOFException: Unexpected end of ZLIB input stream>

18:18 in clj-http?

18:25 callen: muhoo: https://github.com/dakrone/clj-http/issues/10

18:26 https://github.com/zk/clojuredocs/issues/36

18:38 robink: I have a Java object that implements toString that I want to output just as a string, without the classname in front of the string data. How can I pass it to str or call .toString on it without having the class name in the output?

18:40 nDuff: (.toString your-obj)

18:42 `cbp: robink: str calls .toString

18:42 robink: `cbp: Ah

18:42 nDuff: I end up with the class name when I do that

18:42 `cbp: ,(str (reify Object (toString [this] "Hello")))

18:42 clojurebot: "Hello"

18:42 nDuff: robink: then your object puts its class name into the string in its toString implementation.

18:44 robink: nDuff: Gotcha

18:44 `cbp: Thanks, that probably would have worked. I instead used the class' .buildVCardString method to output a pure string.

18:47 nDuff: robink: ...well, what `cbp was doing there was demonstrating that calling (str x) returns the output of (.toString x).

18:47 robink: nDuff: Ahh

18:48 nDuff: robink: ...by constructing an object which had a specific implementation of toString, and showing that str returned toString's return value.

18:50 robink: nDuff: Ah, OK

18:52 gosukiwi: I'm trying to make a little CLI utility, but I'm completely new to Closure and can't access other functions from inside main... I can't see the "create" function

18:52 Code: http://pastebin.com/iX7e2W08

18:54 `cbp: gosukiwi: that's because create is defined after -main

18:55 gosukiwi: put it before or put (declare create) before -main

18:56 gosukiwi: Oh, thanks! let me try that

18:57 callen: there are four different unique ID fields in this database and they are sparsely allocated.

18:58 `cbp: gosukiwi: oh wait nevermind. I just noticed your resolve stuff

18:58 gosukiwi: Oh, I put it before and still doesn't work

18:59 `cbp: gosukiwi: resolve will return a Var, so your fn? will always fail

18:59 gosukiwi: resolve is returning nil though shuoldn't it return something else?

19:19 sdegutis: I've been using a convention whereby I prefix my functions with "-" when I think they're probably stupid and need to be rethought.

19:19 I recommend it.

19:22 `cbp: I just yell FIXME

19:27 Raynes: gf3: Gotta say man, your phone is in significantly worse shape than mine at the moment.

19:27 noprompt: goog.text.LoremIpsum well that's cool

19:27 gf3: Raynes: Probably, man

19:28 Raynes: gf3: Though mine wasn't working when I dumped it in rice last night, there is a possibility it will turn on when I try to operate it in an hour. At least.

19:28 gf3: Raynes: Good call, I'm going to try the same thing

19:29 Raynes: Yeah, rice usually helps with exploded iPhones.

19:29 gf3: LIFEHACK

19:31 coventry`: It appears that the put onto e in the following core.async snippet parks the go block and hangs execution of the form. Is there a way to put something onto e and continue execution of the go block prior to someone taking from e? (let [c (chan) d (chan) e (chan)] (go (while true (<! d) (>! e true) (>! c 1))) (>!! d 'foo) (<!! c))

19:32 Oh, is it that the while true is causing e to fill up?

19:32 noprompt: nrepl-jump is so awesome.

19:33 gf3: Raynes: http://cloud.gf3.ca/RO8k

19:33 coventry`: It's not the loop in the go block. This also hangs: (let [c (chan) d (chan) e (chan)] (go (<! d) (>! e true) (>! c 1)) (>!! d 'foo) (<!! c))

19:34 Oh! So this is the difference between >! and "put!" (what I actually want.)

19:36 Raynes: gf3: Were you eligible for an upgrade? :P

19:36 gf3: Raynes: AppleCare+

19:37 Raynes: Lucky.

19:37 I just have to buy a new iPhone if this one doesn't start up.

20:03 noprompt: resources can be included with a jar right?

20:04 like an externs file or something for cljs?

20:06 justin_smith: noprompt: yeah, that is the default thing with an uberjar / uberwar

20:07 noprompt: justin_smith: but would that be included with, say, a jar pushed to clojars?

20:09 justin_smith: hmm

20:09 OscarZ: hi.. people on this channel.. what made you turn to clojure? I'm sure many of the people on this channel have a past in some other worlds... maybe Java.. Spring,, Ruby on rails.. even Python..

20:11 justin_smith: noprompt: I think, if it is in your source-paths or resource-paths in project.clj, it will

20:12 yeah, come to think of it, our jars rely on that for config files to be included with jars

20:13 noprompt: justin_smith: ah, ok. i just realized it might be a good idea to include an externs file with the little console lib i put together.

20:15 justin_smith: noprompt: yup, and you can use (io/resource ...) to find the stuff at runtime - it works whether it finds it in a jar or the fs

20:17 noprompt: justin_smith: right. this would be for cljs though. so i was just trying to confirm whether or not that would work or if someone would have to include the externs file themselves.

20:17 OscarZ: has anyone found any real-life difficulties or annoyances when switching to Clojure from Java or some other language ?

20:18 justin_smith: depends, is having to learn things annoying?

20:18 noprompt: OscarZ: i, for one, have not. in fact, i have found Clojure to be pretty much the answer to my prayers.

20:19 OscarZ: well i will say this, the stack traces were a bit annoying at first.

20:19 clojurebot: Excuse me?

20:19 OscarZ: my intention is not to say.. "a-ha! gotcha!".. more like learning about real-life experiences when switching to Clojure from more "mainstream" codebase like Java

20:20 justin_smith: the stack traces, the gotchas when macros get compiled and all code using the macro needs to be explicitly recompiled

20:20 warmup time

20:20 memory usage

20:21 OscarZ: yeah, I guess that is some kind of artifact of the functional nature of clojure?

20:22 noprompt: what do you mean?

20:23 OscarZ: justin_smith: what about the maintainability? do you think your code is easy to understand and maintain?

20:23 justin_smith: mem usage is affected by how the usage of persistent data structures

20:23 very maintainable

20:23 noprompt: maintainable++

20:23 justin_smith: yeah

20:23 noprompt: compared to the ruby code bases i maintain.

20:25 justin_smith: clojure idioms lend themselves to amazing amounts of composibility

20:25 especially if you avoid macros

20:25 noprompt: testing tends to be a joy too.

20:25 OscarZ: anyone here with some Django background ?

20:25 justin_smith: yup

20:25 noprompt: not constantly having to mock up the world or frisk objects, asking them if they received a method call and shit like that.

20:25 justin_smith: unit tests : functional programming :: chocolate : peanut-butter

20:26 noprompt: OscarZ: setting up the workflow can take a bit of getting used to.

20:27 but the landscape is getting better all the time.

20:27 justin_smith: noprompt: that's a big part of the learning thing I was alluding to above

20:27 OscarZ: noprompt: what kind of things for example?

20:28 noprompt: OscarZ: well when i started i was using vim-clojure and it was a little buggy and kind of a pain, so i switched to emacs+evil-mode and that took a bit to learn.

20:29 overall it was worth it though.

20:29 justin_smith: I was also a vi user (nvi) until I started using common lisp

20:30 noprompt: once you get your editor hooked up to nrepl and start developing it's very nice experience. the feed back loop is tight.

20:30 you don't have to dick around with tmux or something, or wait for your app to compile, etc.

20:30 OscarZ: Some time ago.. I was experimenting with some Clojure based web framework.. and I was stricken by the minimalism that it took to get stuff working.. setting up some routes.. the list paradigm gets on pretty well with client- side javascript etc..

20:31 the sheer minimalism was the main thing i think..

20:33 akurilin: What's the commonly accepted convention for naming test files and the test namespaces? Is it to suffix them with -test?

20:33 noprompt: OscarZ: the data structures and the core functions for operating on them in clojure is really what pushed me over the edge.

20:33 it's beautiful.

20:34 akurilin: typically yeah.

20:34 (ns foo) -> (ns foo-test)

20:34 akurilin: ok. I was doign foo.bar.baz -> test.foo.bar.baz

20:35 that breaks the conventions of a bunch of auto-testers out there :)

20:35 sad.

20:35 noprompt, thanks for clarifying :)

20:36 OscarZ: noprompt: yeah.. I had a look at Haskell at one point and you can see a similar thing there too

20:36 Haskell being in contrast a statically typed language with a powerful type system

20:37 danielszmulewicz: I'm transitioning from Ruby to Clojure for web development. Very challenging experience, but also rewarding.

20:37 noprompt: danielszmulewicz: it's funny, i think when i came to clojure from ruby i was really happy with the communities attitude.

20:38 at the time i was sick of OO and frameworks.

20:38 especially the ruby flavors of those things.

20:38 OscarZ: I bought and read a Ruby book..

20:39 noprompt: tired of OO design patterns. tired of special cases. tired of syntax. tired of complexity. tired of mutability.

20:39 OscarZ: for some reason I didnt feel the enlightement... it wasnt elegant..

20:40 noprompt: tired of ruby thought leaders and all of their bullshit.

20:40 danielszmulewicz: noprompt: how would you characterize the differences between the communities?

20:41 OscarZ: even though I dont know Haskell well enough.. i think it has been a great experience to try to learn it :)

20:42 clj_newb_2345: anyone have a datalog layer built on top of monger? (no, I don't want to use datomic)

20:42 OscarZ: to make any kind of sensible solution, it forces you to think of the core structure of the data you are dealing with

20:42 noprompt: danielszmulewicz: the clojure community seems to be more genuine and rational.

20:43 danielszmulewicz: i found the ruby community to be kind of rude and arrogant.

20:43 danielszmulewicz: noprompt: less posturing?

20:43 OscarZ: :(

20:44 I have asked stuff here before, and I've got really friendly answers...

20:44 noprompt: danielszmulewicz: these are just my experiences.

20:44 OscarZ: but I have to say the Haskell community has made the best impression in that regard

20:44 AimHere: The Haskell people are all just grateful that someone notices them at all :)

20:44 noprompt: danielszmulewicz: the clojure community tends to embrace new comers and typically willing to help you.

20:45 AimHere: haha! yes! they're a delightful group of people too.

20:45 OscarZ: AimHere: hehe.. I guess you got a point there but still :)

20:45 danielszmulewicz: noprompt: Michael Klishin (from Clojurewerkz) once said that the Clojure community reminded him the Ruby community of 2007

20:46 noprompt: communities have their own lifecycle

20:46 OscarZ: anyone who is seriously into programming should dive into Haskel

20:46 AimHere: So do we all turn into snotty jerks, or do they just turn up on the doorstep sometime in the next year or two?

20:46 OscarZ: l

20:47 danielszmulewicz: AimHere: :-)

20:47 noprompt: danielszmulewicz: i dunno. from what i understand this one's been around for a while and still pretty nice.

20:48 i think the same is true about the haskell community. everytime i needed help in #haskell people were helpful and respectful.

20:48 OscarZ: noprompt: respect for learning haskell too :)

20:49 danielszmulewicz: AimHere: as a community grows, a history builds up, with a mixed set of… everything that humans do

20:50 noprompt: long story short, i have nothing but good things to say about my experiences so far with the clojure community. it's doubtful the good spirit present here is likely to fade in the near-to-distant future.

20:50 danielszmulewicz: the entry barrier is very high for Haskell, that's why they have the nicest people

20:51 Clojure is built on solid ideas, that's what matters to me

20:51 noprompt: danielszmulewicz: if thinking and giving a shit is a "high bar" then maybe you're right.

20:51 :P

20:51 OscarZ: I'm not that into maths, but i've understood Haskell is based on Lambda Calculus which is pretty important concept in mathematics and thats why it intrigues so many people who are mathematically minded

20:52 noprompt: danielszmulewicz: i've met ruby programmers who wouldn't think for a second about the consequences of using something like self.extended(base).

20:53 some of them were allergic comments too because i guess they though tests == comments.

20:53 or rather documentation.

20:53 AimHere: OscarZ, Lisp is probably more lambda-calculus-ish

20:53 Haskell has a bit of category theory going on with the monads

20:54 supersym: I wouldn't want to change polish notation, I kinda got into it now and really like that part, anything else just feels weird atm :P

20:54 I must say, Haskell is pretty l33t though

20:55 noprompt: just got an email from cousera reminding me that i signed up for their statistics course.

20:55 w00t

20:55 OscarZ: AimHere: you probably understand it better than I do

20:57 AimHere: but I understand monadic types in Haskell are a bit like Generics in Java.. thought Java 1.6 type system is much less expressive than Haskell

20:58 noprompt: haskell isn't the type of language you would wanna program in if you were stoned or something.

20:58 ruby or javascript might be more suitable for that type of thing.

20:58 OscarZ: heheh

20:59 supersym: haha

20:59 OscarZ: im actually not sure if its not a good language to code stoned as you need a kind of mathematically sound view of things...

21:00 noprompt: i can't imagine a company built on haskell having a beer tap in the break room.

21:00 OscarZ: so its probably better to code that Airbus A321 flight management system in ruby :)

21:01 Pupnik_: OscarZ: amphetamines might be a better option

21:05 OscarZ: do we have any people here that have a real Enterprisey Java EE nightmare background ? with Enterprise Java Bens and all horrors ?

21:10 I think Clojure seems to be the exact opposite of the horrors of Java EE 1.5 where you had to write loads of horrible bureaucratic shit to make anything happen...

21:10 justin_smith: OscarZ: that describes a coworker of mine

21:10 OscarZ: but sure... there have been others already on this path Ruby, Python... many of them successfully

21:10 justin_smith: and because of that experience they pull him off of clojure to do spring / ee stuff sometimes

21:11 if you could see the comparison of our relative demeanor when I work on clojure sitting across from him doing spring...

21:11 OscarZ: hehe

21:11 justin_smith: sounds like fun

21:12 justin_smith: he is so jealous I think he may poison me just so he can get back to doing clojure again

21:13 I have been working on an aes encrypted credentials system for our webapps - like java keystore but with edn instead of key/value

21:13 OscarZ: my background was in Java.. I never really coded in Java EE.. from Java EE 6 its supposed to be better... I went to Spring... its ok, but you are working in the limitations of the language

21:13 justin_smith: is this foolish? am I missing out on something big by not using keystore?

21:13 OscarZ: only in Java 8 next year there will be real concept of function that has been in the javascript from the start..

21:14 justin_smith: keystore just seems so overengineered for what I am trying to do

21:15 OscarZ: then I looked into Python and Django... it seemed a kind of overwork.. very good if you need such an entity relationship thingy that keeps evolving..

21:16 supersym: OscarZ: I had the same impression about that

21:16 and they do have some solid libs in py

21:16 OscarZ: I mean.. its a great a system.. but its a bit too high level for me, when you really needed to customize that, I wasnt comfortable with that

21:16 supersym: they use that to teach at uni cs here in the netherlands

21:17 probably because it's made by a dutch guy though...

21:17 OscarZ: supersym: oh.. to teach what ?

21:17 supersym: computer science

21:17 I guess not if you study cognitive ai

21:18 I imagine they would use a lisp of some kind

21:18 OscarZ: supersym: I'm not sure if thats such a bad idea really...

21:18 aka: django is so convoluted

21:18 jimrthy: I just spent 6 months on a Django project that had evolved over several years. It wasn't as painful as, say, Java EE, but it was still miserable after getting some exposure to clojure

21:18 supersym: me neither

21:19 OscarZ: supersym: cognitive AI is very interesting to me... is that a real hard core subject some universities?

21:19 in

21:19 ^^

21:20 jimrthy: can you elaborate a bit why was that?

21:20 supersym: OscarZ: they teach it here in my home town actually, I think two more places in the country... how big it is? no idea

21:21 OscarZ: supersym: thats cool.. do they touch any interesting subjects as consciousness? :D

21:21 jimrthy: OscarZ: Like aka said, it was horribly convoluted. To change pretty much anything, you had to touch 4-6 different source files, all over the directory tree.

21:22 noprompt: i know (.write js/document "") is a mortal sin, but the cljs-repl doesn't like it.

21:22 locks up everytime

21:22 *ever time

21:22 :-/

21:23 *every time

21:23 jimrthy: OscarZ: Django also has a bunch of magical convenience pieces that are great for slapping something together for a demo, but wound up making this thing basically impossible to unit test

21:24 OscarZ: jimrthy: yeah.. I got that kind of impression too..

21:24 jimrthy: OscarZ: The rest of it was more the company's fault than django's or python's. They're both decent tools, just not in the same league as lisp

21:24 OscarZ: right..

21:24 aka: I go with Flask when using python for web dev.

21:26 OscarZ: maybe Scala language could be some kind of rival to Clojure too ?

21:26 a next gen JVM language with a powerful static type system

21:26 have you guys got any experience on that?

21:27 aka: they kinda are rivals

21:27 supersym: OscarZ: this is some of it, their server is almost smoking it seems though http://www.tilburguniversity.edu/research/institutes-and-research-groups/ticc/

21:27 aka: in that context

21:27 OscarZ: I guess if Haskell guys were forced on gunpoint to switch to a JVM based language, it would be more likely to be Scala than Clojure ?

21:28 supersym: I would think so too

21:28 OscarZ: supersym: what are you studying in there :)

21:28 supersym: ML and scala would be something I'm likely to try out at some point, just for fun

21:28 me, nothing, I just live there :P

21:29 tupi: http://paste.lisp.org/display/138930#2

21:29 supersym: I didn't do too well in school environments in my younger years so I joined the Air Force instead

21:30 OscarZ: cool.. are you a fighter pilot? :)

21:30 supersym: security grunt... well officer anyway

21:30 and I did induction courses (boot camp)

21:30 that was fun

21:31 OscarZ: heh

21:31 rurumate: The type of (type (chunk-first (rest (vec (take 32 (range)))))) is cljs.core/ArrayChunk. Where can I read the source of that?

21:32 or at least, some documentation

21:32 supersym: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L2128

21:32 that seems a bit more unlikely

21:33 Bronsa: rurumate: chunked seqs are mostly an implementation detail

21:33 I don't think you'll find any documentation

21:34 rurumate: Bronsa: well they seem to be a problem for filter

21:34 OscarZ: I realize that I need to make a huge paradigm shift in my thinking about programming

21:35 that is towards to functional programming and the concepts they advocate

21:35 Bronsa: rurumate: how so?

21:35 OscarZ: Clojure is for sure one choice

21:35 rurumate: Bronsa: here http://dev.clojure.org/jira/browse/CLJS-587

21:36 I browsed the stack a bit, and it seems the problem happens when filter uses the else-branch

21:36 OscarZ: Scala is one.. maybe a less steep learning curve but maybe deceivingly so

21:38 rurumate: Bronsa: the stack of (first (filter is-equal-9999 (vec (take 10000 (range))))) for instance, it uses the then-branch, there is no stack problem

21:38 supersym: OscarZ: I come from OOP, this is my first true functional language (I got in touch with the paradigm through coffeescript)

21:38 I must say... I wouldn't want to go back, it took a little while but .. holy mack that makes a difference in reasoning

21:39 OscarZ: supersym: oh.. what are the most amazing things in your opinion?

21:39 supersym: its hard to articulate

21:40 rurumate: Bronsa: whereas (first (filter is-equal-9999 (reduce conj () (vec (take 10000 (range)))))) will blow the stack

21:40 supersym: and much is a combination of what clojure offers (like immutable values, perception of time with e.g. refs etc)

21:40 rurumate: Bronsa: oops, here's is-equal-9999: (defn is-equal-9999 [x] (= 9999 x))

21:40 OscarZ: I havent used Clojure much, but one thing i immediately noticed when experimenting with it

21:40 supersym: for one, writing (pure or not) functions it makes for so much easier testing, knowing what to expect really as outcome

21:41 OscarZ: that everything I wrote was very minimalistic..

21:41 Bronsa: rurumate: I could guess that :P

21:41 rurumate: Bronsa: also I used (defn lazy-next [i] (lazy-seq (cons i (lazy-next (inc i))))) and (lazy-next 0) instead of (range) but it should be the same

21:42 supersym: clojure is all about getting to know the data structures though,... I mean really know them, on several levels.. but you can take small steps and I ensure you'll have many epiphanies

21:43 OscarZ: It felt like I can syntactically express the very essence of the stuff I want to express.. in stark contrast to something like Java or XML where you have loads of redundant stuff and boiler plate

21:43 supersym: yup

21:44 OscarZ: the clean syntax may seem like its superficial, but I think for us human beings stuff like XML is really horrible...

21:44 supersym: I used Visual Studio a lot, and it has great tools... but in the back of things tons of code was generated of course

21:45 a lot in xml/xaml as well

21:45 rurumate: OscarZ: it's horrible for computers, too. yuck

21:45 OscarZ: hehe I guess it is

21:45 supersym: somehow I keep feeling those tools are more for cubical programmers though...

21:45 drag/drop code :P

21:46 rurumate: what are epiphanies

21:46 OscarZ: A while back I re-learned JavaScript and realized its a pretty cool language... and there in JS, when you deal with JSON data structures you can feel the same minimalism

21:47 rurumate: maybe it will be necessary to implement some clojurescript "core" library in javascript?

21:49 OscarZ: Our brain can work or hierarchies and stuff.. but the overload imposed by the XML closing tags etc. similar boilerplate shit really takes its toll

21:49 supersym: rurumate: there is https://github.com/Gozala/wisp

21:49 that is, you don't need a JVM for that to get nice JS

21:50 I don't think there is much in between, then again, Python also knows work to implement their own clojure (non-JVM), so god knows what other stuff is out there

21:50 OscarZ: hmm.. I think it would make an interesting cognitive science test

21:51 it should be easy enough to test if people were able to understand more complex JSON data structures than logically equivalent XML data structures

21:51 rurumate: supersym: nice, thanks

21:52 devn: OscarZ: I

21:53 OscarZ: I'm quoting Rich: "What is JSON missing?" (w/r/t XML). "The X."

21:53 EDN is great in that regard.

21:54 OscarZ: devn: I didnt get that ;)

21:54 I'll have to read up on EDN

22:03 its difficult to quantify.. but cognitively, what effects does the boilerplate imposed by some languages have to our thinking and reasoning about data structures and algorithms

22:04 it should be interesting to test this.. i have no doubts about the results..

22:10 appendonly: OscarZ: sapir-whorf hypothesis for programming languages. blub languages. http://www.paulgraham.com/avg.html

22:12 OscarZ: thanks appendonly, I'll check it out

22:27 gfredericks: haha this surprised me: ##(reduce = [1 1 1 1])

22:27 lazybot: ⇒ false

22:30 grandy: hello, trying to start a repl on my raspberry pi, and getting this error, can anyone make any sense of what might be going on... https://www.refheap.com/18658

22:30 dissipate_: gfredericks, how does that surprise you?

22:31 gfredericks: dissipate_: I've had a very mild amount of alcohol

22:32 dissipate_: gfredericks, you should be in #haskell then

22:33 gfredericks: ,(reduce = [1 1])

22:33 clojurebot: true

22:34 arohner: ,(reduce = [1 1 true])

22:34 clojurebot: true

22:34 grandy: anyone have any ideas on that trace?

22:37 gfredericks: arohner: ha

22:38 grandy: you're running lein on the raspberry pi?

22:38 * gfredericks doesn't know anything about raspberries or pi

22:38 grandy: trying to... :) i think i migth have figured it out

22:39 gfredericks: is a raspberry pi good at running 2 jvms?

22:39 otherwise you might want to `lein trampoline`

22:53 grandy: i guess i didn't figure it out

22:53 no it's not all that good at it, pretty slow cpu

23:01 hiredman: grandy: which jvm?

23:01 grandy: hiredman: openjdk

23:01 hiredman: was just the default on the distro

23:01 hiredman: last I hard the openjdk didn't have a jit for arm yet

23:01 grandy: hiredman: hmm

23:02 hiredman: that may be true, i'll try a different jvm i guess, new to this raspberry pi specific distro

23:02 hiredman: the latest arm jdk from oracle has hard float support so it'll run on the pi

23:02 grandy: ahh perfect

23:02 hiredman: but you'll have to download it from oracle

23:06 grandy: hiredman: great! thanks for the tip

23:36 coventry`: Is there a way to turn off font-locking in the emacs nrepl buffer? font-lock-mode and global-font-lock mode don't seem to work.

23:51 akurilin: Playing with lein prism. Does anybody know if it's possible to have it run under the test profile? As far as I can tell the first test run of prism is lein test, and the subsequent iterations are under a different profile.

23:52 Raynes, ping, perhaps something you might have seen before?

23:57 coventry`: Why doesn't core.async limit the number of pending puts on a channel?

23:58 Er, Why *does*, etc.

Logging service provided by n01se.net