#clojure logs

2013-09-13

00:26am2605Hiya. 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?
00:26coventryam2605: Check out cemerick's pomegranate.
00:28am2605coventry: cheers, will do
00:28`cbpam2605: its standard to restart the repl after adding/removing dependencies, but work is being made on a solution ;)
00:28coventry`cbp: pomegranate seems like a solution to me. Works great.
00:29`cbpcoventry: 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
00:30s4muelhttps://github.com/pallet/alembic
00:31s4muelI've no idea if it actually works in practice, but it purports to do all those things.
00:31`cbpit syncs with project.clj but doesnt have an answer to conflicting jars
00:31coventryOh, alembic looks very nice. Thanks.
00:32s4muel`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."
00:32am2605s4muel: yeah that does look nice - thanks
00:33s4muelnp. 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.
00:39am2605s4muel: 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 :)
00:42s4muelam2605: 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.
00:54callenam2605: also look at alembic to just auto-sync with the project without having to type the dependency.
00:54callens4muel: sounds like a fun journey :)
00:54callenI started using Ruby originally for dev-ops (pre-Chef), only did serious app dev in Python though.
00:56s4muelI 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
00:57callenI'm not really sold on Puppet/cfengine/Chef
00:57callenI prefer fabric for small stuff, ansible for larger'ish stuff
01:00s4muelI 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.
01:01callens4muel: 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
01:01s4muelAnsible 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
01:05s4muelI 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.
01:10s4muelheath: you mean you want to see an akka wrapper / akka actor pattern or you want to see something akka-like?
01:10callenheath: 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.
01:10heathcallen: links
01:10heaths4muel: anything
01:11s4muelheath: clojurewerkz/meltdown & reactor/reactor is what i was just referring to
01:11heathi like how erlang from the get-go isn't restricted to shared memory
01:11heathbut a wrapper would be nice too
01:12callenheath: clojure/otp, avout, etc.
01:13s4muelheath: erlang has different design considerations, namely that of being a distributed system
01:14s4muelheath: Storm has pretty decent clojure bindings, from what I've toyed with, if you're going distributed you could wrangle Storm DRPC.
01:14s4muelheath: Also for serious event-processing juju read the riemann source
01:15tbaldridgeheath: I see erlang's process model to be extremely limiting. Shared immutable memory isn't a bad thing
01:16tbaldridgeheath: IMO, actors go too far overboard and end up complicating otherwise simple designs.
01:16callenactors are too close to OO-esque imitation of a "just so" concept.
01:16callenand the blending of producer/consumer makes me uncomfortable.
01:17tbaldridgecallen: it's actually the blending of producer, consumer, state, and logic all into one nasty black box </rant>
01:17nappingtbaldridge: that's why binaries are shared
01:17tbaldridgenapping: ?
01:18nappingSharing immutable data in Erlang
01:18tbaldridgenapping: 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
01:19tbaldridgenapping: 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.
01:20nappingSo you're really claiming the ways you request immutable data in clojure are more robust under overload than those in Erlang?
01:22tbaldridgenapping: 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.
01:23tbaldridgenapping: 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.
01:26callentbaldridge: what was that anyway?
01:27tbaldridgecallen: the system I'm talking about?
01:27heaththat's all i wanted, a little discussion from others on the subject, ty
01:27callentbaldridge: yeah, I'm just curious about it.
01:28tbaldridgeheath: if you want clojure's take on all this, I might suggest looking at something like RabbitMQ or Kafka combined with core.async.
01:28nappingtbaldridge: do you know what I mean by binary?
01:28tbaldridgeheath: so the Clojure way is probably closer to processes with queues between them.
01:29tbaldridgenapping: maybe not?
01:29nappingIt might be trouble to flatten the data, but would work for sharing immutable stuff
01:29tbaldridgeheath: it is, its a distributed queue.
01:29tbaldridgeheath: with interfaces for almost every language on the planet
01:29nappinghttp://www.erlang.org/doc/man/binary.html basically vectors of bytes, but they get shared and refcounted between processes
01:30heathah, https://github.com/clojure/core.async
01:30heathalright
01:30nappingand 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
01:31tbaldridgenapping: sharing the data isn't the problem, it's modification/reading of shared state.
01:33tbaldridgenapping: 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
01:33tbaldridge never block.
01:36nappingIt 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
01:37nappingIt's nicer, but not such an absolute difference
01:38tbaldridgenapping: 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.
01:38callenI'd rather slow down writes and let them eat the dirt than block reads too.
01:38callenit's very rare you want parity in priority between the two. Very rare.
01:39tbaldridgeConsider 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.
01:39callentbaldridge: I think you have to either get bitten by this stuff, or really grok and absorb what Hickey has been saying to appreciate it.
01:39SegFaultAXGoat farms are awesome, just sayin.
01:39callenSegFaultAX: wedding gift from your amish relatives?
01:40tbaldridgeIt 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.
01:40tbaldridge*downhill
01:40callenyep.
01:40SegFaultAXWe went out to Harley Farms today on a company fieldtrip.
01:40callenSegFaultAX: did you get headbutted by a goat?
01:40SegFaultAXYes! Haha
01:40callensweeet
01:41callenthe trip was a success then.
01:41SegFaultAXThey tried to eat my shirt, too.
01:41SegFaultAXHaha
01:41callenSegFaultAX: don't make me laugh, I'm still sick and it hurts to laugh :(
01:41SegFaultAXI've been hammered since 10am.
01:42RaynesGood work.
01:42dobry-denWhy doesn't Clojure support numbers with underscores (10_000) like Java does?
01:43callendobry-den: 10e?
01:43callendobry-den: errr, 10e3
01:43SegFaultAXRaynes: Startups... you know how it is.
01:43RaynesSegFaultAX: Oh, I'm not judging. Pretty sure there are pictures of me sleeping on the kitchen table at work at some point.
01:44SegFaultAXRaynes: :) <3
01:44RaynesLos Angeles may have gotten the better of me on that particular night.
01:44Raynes<3
01:44s4muelHaha. You have to differentiate yourself somehow, instead of work-at-home fridays it's get-drunk-on-a-goat-farm thursdays
01:44SegFaultAXs4muel: Are you in SF?
01:44s4muelChicago.
01:44callendamn.
01:45SegFaultAXBummer, Harley Farms is /awesome/
01:45callenSegFaultAX: have any goat meat?
01:45SegFaultAXcallen: No. But it's a dairy. Most amazing goat cheese.
01:45SegFaultAXSeriously, still warm.
01:46SegFaultAX(Only half kidding)
01:47SegFaultAXRaynes: Last time I was in Santa Monica it definitely got the better of me. :D
01:47Raynes:D
01:47RaynesI actually spend most of my time in Santa Monica. Our office is on the promenade.
01:47SegFaultAXSo much fun stuff in that area.
01:48SegFaultAXFood, bars, dance, hooka, whatever you want.
01:48Raynes You should come hang out with boredomist and I, SegFaultAX. <3
01:48boredomistdon't drag me into your antics
01:48Raynes:p
01:49SegFaultAXI am so down for your antics.
01:49callenwait a second
01:49callenboredomist: who are you? Alan?
01:49boredomistshh
01:49RaynesNope. He's my rommate.
01:49callenoh, I know who you are.
01:49Raynesroommate*
01:49callenboredomist: I didn't know you coded.
01:49RaynesYes you did.
01:50callenno I didn't.
01:50boredomistcallen: wait do i know you?
01:50RaynesI told you why he's in LA, right?
01:50callenI've been sick enough that I don't really remember anything. mind like a collander.
01:50boredomisti just lurk here
01:50callenRaynes: ohhhh right
01:50callenthe meat grinder.
01:53SegFaultAXI think I need to buy a ticket to euro clj.
01:54s4muelThe speaker list is pretty intense
01:55SegFaultAXs4muel: No joke.
01:55s4muelCool, they put the program up.
01:55dissipate_when is the next clojure west conference?
03:44clj_newb_2345is there a simple way to make https request over clojure? (clojure is the CLIENT, not the server)
03:48gunsclj_newb_2345: (slurp "https://foo.com/&quot;)
04:32muhooclj_newb_2345: clj-http
04:32muhooif you want more fancy stuff than slurp, or if you need POST, etc
04:33muhooSegFaultAX: also, pescadero is awesome
05:55si14Wow. (count (.getDeclaredFields (.getClass …some simple record…))) → 128
05:56si14is there any reason why Clojure adds all methods as fields?
05:56si14if I understand correctly, this will blow the cache for small records
06:21opqdonutsi14: if the fields are from a superclass, it won't
06:21opqdonutno, wait, it will
06:22opqdonutI only get 31 fields for a trivial record
06:22si14opqdonut: I have some methods in that record
06:23si14nevertheless, 31 field for trivial record? seriously?
06:23opqdonutof those 31 fields most are static, only 4 are nonstatic
06:23opqdonutstatic ones don't inflate the size of an instance
06:23opqdonutfor (defrecord Foo [a b]) the fields are:
06:24opqdonut#<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>
06:24opqdonutwhich seems pretty ok
06:24si14the size of instance for my object is 288 bytes
06:25si14for (deftype Foo [^doubles data ^int ndims ^ints shape ^ints strides ^int offset])
06:25si14*bits
06:26opqdonutI tried adding some methods but they didn't show up as fields. this is clojure 1.4.
06:26si14hm, suddenly it seems reasonable, even fits in the cache line. OK :)
07:12borkdudehow do I run lein test and override :jvm-opts with a custom value (using a profile)? (see #leiningen for more info)
07:13mercwithamouthhrmm does anyone use emacs-live by chance? just loaded it in...a bit much but at the same time not bad
07:13wei_trying to translate a java snippet. how would I import some.package.*
07:15scottjwei_: I don't think there's a way built-in, you have to name each class afaik
07:15wei_ok. thanks scottj
07:16tangrammerwei_: And i think that you'll have to include the jar dependency
07:17wei_tangrammer: since it's available in maven, i can just include it in the leiningen dependency list.. seems to work
07:18tangrammerwei_: maybe that helps you http://citizen428.net/blog/2009/09/06/using-java-libraries-from-clojure
07:19scottjtangrammer: I think he's just interested in the * part of his question
07:21tangrammerscottj: i remember that it is not possible
07:21tangrammerscottj: i think that I read it in a hickey article
08:00zanesAnyone have clojure-test-mode crash with a NPE when trying to run tests?
08:34Bronsacoventry: ping
08:55wei_is there a clojure equivalent of import static?
09:02clgvwei_: not really
09:03wei_clgv: thanks. found an easy workaround..
09:03clgvwei_: memfn + def?
09:04clgvwei_: or just class import and using class name? which is the fastet approach but not comparable to import static ;)
09:04wei_yup the latter
09:05wei_btw, how would I write this? StringUtils.isBlank(aString)
09:05clgvwei_: (StringUtils/isBlank a-string)
09:06wei_aha. thanks!
09:06wei_(inc clgv)
09:06lazybot⇒ 7
09:06sheldonh"OutOfMemoryError Java heap space" from (take 100000000 (iterate inc 0)) ... a hundred million numbers doesn't seem like a lot :(
09:06clgvsheldonh: dont print them^^
09:07clgv,(let [numbers (take 100000000 (iterate inc 0))] (count numbers))
09:07clojurebotExecution Timed Out
09:07sheldonhahhh
09:07sheldonhthanks :)
09:08clgvalways `def` those lazy-seqs that might not fit into memory
09:08sheldonhclgv: in the repl, or always always?
09:08clgvsheldonh: in the REPL. otherwise see the let above ;)
09:12sheldonhcool, thanks :)
09:15wei_what's an good way to add a callback to a java object's event listener? https://gist.github.com/yayitswei/6550221
09:17coventryBronsa: Pong, but stepping out for a couple of hours. Thanks for the comments on the patch. I will revise it as you request.
09:45clj_newb_2345http://blog.mongodb.org/post/172254834/mongodb-is-fantastic-for-logging + using mongodb to store clojure data structures
09:45clj_newb_2345is fucking life changing
09:45clj_newb_2345I don't know how to express how fucking awesome this is
09:45clj_newb_2345I
09:45clj_newb_2345I'm now convinced that no-sql is not complete bs
09:47clgvclj_newb_2345: but be careful with large data since keywords consume memory for every instance...
09:48clj_newb_2345what?
09:48clojurebotwhat is cells
09:48clj_newb_2345what do you mean?
09:48clj_newb_2345why are keywords not supposed to consume memory?
09:48clj_newb_2345why is it surprising that {:name "Turing", :IQ 999} qould rewuire memory?
09:49clgvclj_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
09:50jonasenI'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?
09:50augustlserializing and storing clojure data structures as strings sounds pretty bad :)
09:50clgvaugustl: it is 40GB datomic db => 350GB mongodb ;)
09:50clj_newb_2345I 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 ?
09:51clgvright
09:51clj_newb_2345wait what?
09:51clj_newb_2345why is datomic 10x more efficient?
09:51clj_newb_2345does datomic exploit sharing of clojure data structures?
09:51clgvI had many small maps ^^
09:51leifwprobably compression
09:51clgvless than 10 kv-pairs
09:52lunkhello, can a function definition with multiple signatures have a shared (let binding?
09:52augustlclj_newb_2345: datomic can't store clojure data, no. You only get strings, numbers, etc
09:52clgv clj_newb_2345: in that case definitely not. since the structure didnt share anything
09:52augustllunk: what would you bind, since you'd need to bind before your arguments are available? :)
09:53lunkaugustl: i want to have a bound, shared, i/o task, let me make a paste
09:53clj_newb_2345so why is datomic 10x more effiient thatn mongodb?
09:53tbaldridgeclj_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.
09:53lunkaugustl: and then optionally filter it
09:53clj_newb_2345clgv: be honest here -- do you have equity in relevance software? :-)
09:53augustlclj_newb_2345: I would guess that clgv was storing datomic entities serialized as maps into mongodb?
09:53tbaldridgeclj_newb_2345: the serializer that Datomic uses (is OSS) https://github.com/Datomic/fressian
09:54tbaldridge*its OSS
09:54augustltrue, datomic does compress before storing
09:54clgvclj_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.
09:55clj_newb_2345clgv: it == mongodb or it == datomic, in "I also do not suggest that you use it at this point."
09:55clgvclj_newb_2345: it just came to my mind because of the clojure maps as data objects to store in mongodb
09:55tbaldridgeclj_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.
09:55lunkaugustl: 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)
09:56clgvclj_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
09:57clgvclj_newb_2345: if I tried again, I'd use an sql db for that use case probably with korma
09:57hanDerPederwhats the correct way of dealing with two dependencies A and B both depending on dependency C, but different versions?
09:58augustllunk: why do you overdide the function yahoo-dataset with a call to that function?
09:58lunkit caches the full dataset
09:58hanDerPedermore concretely, can I tell leiningen to use the newset version of C?
09:58augustllunk: why the same name for the cache though?
09:58lunkaugustl: memoization so i don't download the data each time
09:58clgvclj_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
09:59lunkaugustl: something out of the memoization manual page
09:59augustlI see, didn't know this was a common pattenr
09:59lunkaugust1: it automagically handles all inputs parameters, very slick
10:00lunkaugustl: 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:01augustllunk: do you know if memoize-ttl supports multi-arity functions?
10:01lunkaugustl: that is a good question, and 'arity' i think is the term i was lacking
10:01lunkaugustl: lets go find out
10:02augustllunk: fyi, you can do (defn ([foo] ...) ([foo bar] ...))
10:02augustlerr, with a function name in between :)
10:02lunkwell see, i don't want to 'cache' each filtered dataset
10:02lunki want to cache the WHOLE thing, and then optionally return just a subset if a parameter exists
10:04augustllunk: is there any duplication you want to remove? I don't see any duplication in your paste
10:05lunkaugustl: 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:05lunkaugustl: memoization does support multi-arity functions
10:06lunk(defn- multi-arity ([x] x) ([x y] (+ x y))) (def multi-arity (memo-ttl multi-arity (* 4 60 60 1000)))
10:06augustlno point in memoizing anything but the read-dataset call though, I guess
10:06clojurebotCool story bro.
10:06lunkaugustl: exactly
10:06augustlso what's the problem with your code? :)
10:06augustlit seems to do the job
10:06lunkaugustl: oh it works, it could just work better!
10:07lunk(more-better code)
10:07lunk;)
10:13sdegutisIt would probably be a fun project to port http://xkcd.com/actuary.py.txt to Clojure.
10:13lunkaugustl: ugh, this works, gives me my desired method signature arity, but is fugly. http://pastebin.com/0mxPJhRh
10:19clgvsdegutis: please do and announce on the ML ;)
10:19clgvsdegutis: is there a related comic to that script?
10:19sdegutisclgv: Would that be an appropriate venue to announce such a thing?
10:20sdegutisclgv: http://blog.xkcd.com/2012/07/12/a-morbid-python-script/
10:20clgvsdegutis: dont know. but why not? at least I'll here when it is finished that way ;)
10:21sdegutisclgv: okay I may give it a shot, thanks
10:21clgv*hear it
10:22sdegutisActually no, I can't. It's too hard for me.
10:22lunkaugustl: boom! ard for me.
10:22lunk09:55:13 -!- yogthos is now known as yogthos|away
10:22lunkdangit
10:22lunkaugustl: http://pastebin.com/zdXFUbns just have it call itself
11:04gfrederickshuh. this equality bug with sets and negative numbers is apparently still around
11:04gfredericks,(let [n1 -5, n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2})])
11:04clojurebot[true false]
11:05clgvgfredericks: are you sure the negative numbers are the problem and not the different integer types?
11:05clgv,(let [n1 5, n2 (BigInteger. "5")] [(= n1 n2) (= #{n1} #{n2})])
11:05clojurebot[true true]
11:05clgvhumm. interesting.
11:06gfredericksthere was a similar bug with Integer that was quasi-fixed before
11:06clgv,(let [n1 (BigInteger. "-5"), n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2})])
11:06clojurebot[true true]
11:07gfrederickshttp://dev.clojure.org/jira/browse/CLJ-1106
11:07gfredericks,(let [n1 -5, n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])
11:07clojurebot[true false true]
11:09clgvgfredericks: time for another ticket since CLJ-1106 is reported to be fixed in 1.5
11:10clgv,(let [n1 -5, n2 (BigInteger. "-5")] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2]) (= {n1 n2} {n2 n1})])
11:10clojurebot[true false true true]
11:11gfredericksclgv: yeah I left a comment asking if it should be a new ticket; I guess I'll go ahead and make one
11:12gfredericks,(let [n1 -5, n2 -5N] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])
11:12clojurebot[true true true]
11:12gfredericksapparently it's okay for BigInt
11:12clgvgfredericks: from bureaucratic point of view you definitely need a new one ^^
11:12gfredericksI was only using a BigInteger because of some datomic bug :)
11:13clgvlol. I dont want to see any datomic stacktraces for the next months ;)
11:14gfredericks,(let [n1 -5 n2 (BigInteger. "-5")] [(= #{n1} #{n2}) (= [n1] [n2])])
11:14clojurebot[false true]
11:15gfredericks,(let [n1 -5 n2 (BigInteger. "-5")] [(= #{n1} #{n2}) (= [#{n1}] [#{n2}])])
11:15clojurebot[false false]
11:15clgvthanks to OOP it doesnt matter where you embed the sets ;)
11:16clgvnot to say that that is bad...
11:16gfrederickshttp://dev.clojure.org/jira/browse/CLJ-1262
11:17clgvgfredericks: did you try bigdecimal?
11:17clgv ,(let [n1 -5.0 n2 (BigDecimal. "-5.0")] [(= #{n1} #{n2}) (= [n1] [n2])])
11:17clojurebot[false false]
11:18clgvhumm mabye that is on purpose..
11:18clgv ,(let [n1 -5.0 n2 (BigDecimal. "-5.0")] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])
11:18clojurebot[false false false]
11:19clgv,*clojure-version*
11:19clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
11:19clgv&*clojure-version*
11:19lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
11:19gfredericksclgv: yeah the floats aren't normally equal to each other I don't think
11:19clgv ,(let [n1 -5.0 n2 -5.0] [(= n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])
11:19clojurebot[true true true]
11:19clgv;)
11:20asteveI have a string "123.456" and I want to keep the 123 portion and convert that to a long
11:20astevewould you use Float/parseFloat?
11:20clgvbut BigDecimal represents arbitrary precision floating point numbers
11:20andyfingerhuthttps://github.com/jafingerhut/thalia/blob/master/doc/other-topics/equality.md
11:20andyfingerhutGives a summary of = and == behavior in Clojure 1.5.1, followed by more details
11:20clgvandyfingerhut: gread :)
11:20clgv*great
11:21clgv ,(let [n1 -5.0 n2 (BigDecimal. "-5.0")] [(== n1 n2) (= #{n1} #{n2}) (= [n1] [n2])])
11:21clojurebot[true false false]
11:21clgvso the question is should numbers in collections be compared numerically by default...
11:22`cbp,(long (Double/valueOf "123.425"))
11:22clojurebot123
11:22clgv,(Integer/parseInt "123.456")
11:22clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "123.456">
11:23gfredericksandyfingerhut: so is CLJ-1262 not a bug then?
11:24andyfingerhutgfredericks: checking ...
11:24gfredericksandyfingerhut: your doc seems to explicitely call out the possibility
11:24andyfingerhutNote 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:25andyfingerhutThat might be the root issue of CLJ-1262, too, but I will take a look here
11:25gfredericksI 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:26gfredericks,(let [n1 -5, n2 (BigInteger. "-5")] (= {n1 :foo} {n2 :foo}))
11:26clojurebottrue
11:26gfredericks^ they compare equal as map keys though :/
11:28andyfingerhutgfredericks: Small maps are array-maps. Try using hash-map explicitly to construct them
11:28gfredericksoh right
11:29gfredericks,(let [n1 -5, n2 (BigInteger. "-5")] (= (hash-map n1 :foo) (hash-map n2 :foo)))
11:29clojurebotfalse
11:29gfredericksah ha
11:29andyfingerhutSets 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:30andyfingerhuti.e. BigInteger values that are = to other int types can have different hash values.
11:31andyfingerhutI certainly wouldn't mind if CLJ-1252 was vetted and had a patch applied for it, though :)
11:34andyfingerhutgfredericks: Do you see BigInteger values pop up in any of your applications, without going out of your way to force them in there?
11:35andyfingerhutMy 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:37lolkatzIs there anything that resembles cheshire, for clojurescript?
11:38dnolenlolkatz: many JavaScript targets have native JSON parsers / serializers, is there something specific your looking for?
11:43lolkatzdnolen: 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:44dnolenlolkatz: k, I'm not aware of anything like cheshire for CLJS
11:44lolkatzdnolen: oops, I meant clj-http
11:44lolkatznot cheshire, d'ouh!
11:45dnolenlolkatz: yeah I was confused there. https://github.com/r0man/cljs-http
11:45lolkatzoh nice, thanks
12:00gfredericksandyfingerhut: there's a datomic bug that forced me to use BigInteger
12:00gfredericksalso datomic likes sets so I was using sets too :)
12:01andyfingerhutYou may add weight to the case for CLJ-1252 if you mention how you came across it.
12:01andyfingerhutOr it might get the datomic bug fixed :)
12:01gfrederickswell I think the datomic bug might be fixed in a recent version
12:41jonasenI'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:52dnolentbaldridge: I pushed the necessary changes for CLJS > 1877 here http://github.com/clojure/core.async/compare/keywords
12:52tbaldridgednolen: looks good to me
12:53dnolentbaldridge: I didn't merge it in because I wasn't sure about the stuff happening in master around releases
12:53tbaldridgednolen: they just cut an alpha release, so we should probably merge asap
12:53dnolentbaldridge: k will merge it in
12:53tbaldridgednolen: see https://twitter.com/puredanger/status/378553787289321473
12:53dnolentbaldridge: it does means core.async will pin users to CLJS > 1877
12:54tbaldridgednolen: yeah, but I'm not sure of a better way. It's still alpha after all :-)
12:54dnolentbaldridge: k just wanted to check
12:56bobbrahmshey man
12:56bobbrahmsquestion
12:56bobbrahmsyou building a recent version of the strings 640 branch?
12:56silasdavisI'm getting an 'unable to resolve symbol recur in this context'
12:56bobbrahmssorry misfire
12:56silasdavisis recur allowed in a fn in a let binding
12:56silasdavis?
13:01Bronsasilasdavis: nopaste your code
13:03silasdavisBronsa, sorry looking at wrong recur, resolved thanks
13:03Bronsaok
13:34asteveI have a line that looks like this (long (* (Float/parseFloat "1234.5678") 1000))
13:35astevein production I'm getting type casting errors, can't cast long to double; I can't repeat them locally
13:35asteveis there something glaringly wrong with the approach?
13:35asteveshould I be use BigDecimal?
13:38dnolenasteve: are you sure that's the offending line? Do you have a stack trace?
13:39coventryasteve: did you sort out which version of clojure you're running on storm?
13:39astevecoventry: yes - that's all set now
13:39astevecoventry: 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:40astevednolen: I don't have a stack trace
13:40dnolenasteve: then why do you think that line is the problem?
13:41astevednolen: 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:41coventryasteve: Wrap the form in the code suggested here: http://stackoverflow.com/questions/17314128/get-stacktrace-as-string
13:42dnolenasteve: you should probably figure out a way to log the entire exception - otherwise just guessing. That code doesn't look problematic to me.
13:44asteveI will attempt to do what coventry said, in the meantime this is what storm is giving me https://gist.github.com/sannessa/487a9883751a8971e842
13:46sandbagsi 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:46sandbagsi.e. for all URLConnections
13:47sandbagsseems a little gross but that's what i'm reading
13:48dnolenasteve: https://github.com/nathanmarz/storm/blob/master/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java#L87
13:48dnolenasteve: you're going to want the whole trace, that's where the error is thrown
13:49asteveright
13:54sandbagsah.. the delightfully named setInstanceFollowRedirects
13:54sandbagsgawd bless those JDK authors
13:54clojurebotIt's greek to me.
13:56sandbagsamen to that clojurebot
13:56coventryShould "grench test" DWIW?
14:04Bronsacoventry: 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:04Bronsacoventry: pushed, thanks
14:04coventryNP.
14:07technomancycoventry: I think yes?
14:10coventrytechnomancy: I'm getting the failures shown in <https://www.refheap.com/18638&gt;. Fails with a different stack trace if I try doing the "lein repl" in a project directory.
14:12technomancyhuh. did you build from master
14:12technomancy?
14:12technomancyoh, you need to be running lein from master
14:12technomancythe error you get on older lein is really unclear =(
14:13coventryOh, right. I forgot about that. Thanks.
14:13technomancyin case anyone hasn't seen it yet: https://i.cloudup.com/YTMd2VkRWl-2000x2000.jpeg
14:15coventryGreat, that works. Thanks again.
14:16danielszmulewicztechnomancy: 'reposoitory of all wisdom' gaffe, anyone?
14:16danielszmulewicztechnomancy: http://edition.cnn.com/2013/08/12/world/asia/australia-abbott-suppository-gaffe/index.html
14:17silasdavisis there a clojure function like (split-by pred coll) that outputs ((<elements where pred truthy>) (<the rest>))?
14:18llasramsilasdavis: `split-with`
14:19silasdavisllasram, thanks thought there would be
14:19technomancydanielszmulewicz: hah not bad
14:19danielszmulewicztechnomancy: :-)
14:20dnolenCLJS relevant 1878 changes landed in core.async master
14:20silasdavisllasram, actually that just seesm to split where pred is first true
14:21llasramsilasdavis: Oh, then I think you just want (juxt filter remove)
14:21rasmustosilasdavis: how about group-by? it returns a map though
14:22rasmusto,(group-by pos? (range 10))
14:22clojurebot{false [0], true [1 2 3 4 5 ...]}
14:23silasdavisllasram, yeah that passes over the list twice though
14:23silasdavisrasmusto, yeah that'd worlk
14:23rasmustosilasdavis: 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:23llasramsilasdavis: If you want a lazy solution, there isn't another option
14:24dnolennice summary of the rough source map support currently in CLJS - http://beandipper.github.io
14:29silasdavisllasram, it's not clear to me how this could be lazy in the pairs anyway
14:30llasramsilasdavis: I'm afraid I'm not following...?
14:30silasdavislike is (let [foo ((partial (juxt filter remove) odd?) [1 2 3 4 5])] (take 1 (first foo)))
14:30silasdavisgiving me lazy access to the odd numbers?
14:31llasramOh, yes
14:31silasdavisor is it triggering the whole evaluation
14:31llasramEach is holding the head to the original seq though
14:32llasramSo 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:32silasdavisoh really
14:32silasdavisok
14:32astevesritchie: are you about?
14:33tupifolks, does (do s-exp1 s-exp2 ...) returns the value of the last s-exp executed ?
14:33coventrytupi: Yes, if there's no exception.
14:33tupitx
14:34coventryTry /msg clojurebot ,(do 1 2 3 4 5) to test this kind of thing out in a repl.
14:35sdegutis/msg clojurebot ,(do 1 2 3 4 5) to test this kind of thing out in a repl.
14:35sdegutisNeat.
14:38sritchieasteve: hey, yeah
14:38sritchiewhat's up?
14:39astevesritchie: 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:39asteveI asked them same question in #storm-user but it is dead
14:42sritchieI haven't used straight-up storm in a while, but looks like that's correct to me
14:43asteveok, thanks
14:49Bronsaew
14:55mdrogalissritchie: ping
14:55sritchiemdrogalis: yo
14:55sritchiehey!
14:55mdrogalisCongrats on the speaking gig at Conj!
15:03callenThe 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:03ucbheh
15:15gfrederickswhy does `lein trampoline repl` not start an nrepl server?
15:18coventrysilasdavis, 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:19wei_(inc mdrogalis)
15:19lazybot⇒ 2
15:20wei_(inc chrisfjones)
15:20lazybot⇒ 1
15:24brackiDoes anybody use vim-static-clojure and has modelines working for them?
15:26technomancygfredericks: because typically the client runs in leiningen's process
15:27technomancywhich doesn't exist when trampolining
15:27technomancygfredericks: `lein trampoline repl :headless` will though
15:35sdegutisAh `lein ring uberjar` looks really useful.
15:36amalloycoventry: i'm not so sure about that core.async split-with, but i'd be interested in being proved wrong
15:41ed_gis there any equivalent to letrec in clojure besides letfn? some of the things I want to give names to are not functions?
15:42ziltied_g: def
15:43zilti*let
15:44ed_gzilti: is there actually a star-let? or I do in fact have to create a global binding in the name space?
15:45hiredmaned_g: just don't create self refering structures
15:46ed_ghiredman: it is not self referencing at run time, it just refers to the name.
15:49hiredmaned_g: that is self referencing
15:51ed_ghiredman: 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:51gfrederickstechnomancy: oh sweet thx
15:52gfrederickstechnomancy: that also explains why it all of a sudden downloaded some reply stuff that it hadn't needed before
15:52ed_gor why simple things are possible in global def's that are not possible using let.
15:52hiredmaned_g: def and let do something very different, clojure is not scheme
15:53hiredmandef interns a var with a given name, and gives the var a value, let binds a local name to a value
15:54ed_ghiredman: what does letfn do?
15:54ed_gi appreciate the help by the way
15:55hiredmanletfn is more like let, but the compiler does some shenanigans
15:56`cbpletfn is 'paralell' like common lisp's let unlike clojure's let (sorry i don't know racket)
15:56hiredmaned_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:57hiredmandoing it for fuctions is slightly less hand wavy
15:57ed_gI suppose I could replace all the constants with a function which returns the "constant". performance isn't an issue.
15:58hiredmanyou can of course tie the knot yourself using things like delay
16:00hiredmanclojurebot: letfn?
16:00clojurebotGabh mo leithscéal?
16:00hiredmanclojurebot: letfn is https://gist.github.com/hiredman/1179073
16:00clojurebotOk.
16:01`cbpletfn is letfn* :(
16:03brackiStyle question. 'foo-to-bar' or 'foo->bar'?
16:04`cbpfoo->bar
16:04ed_ghiredman: ok very interesting.
16:04sdegutishiredman: wat
16:35nopromptdnolen: i upgraded to cljs 1877 last night and core.async stopped working. :-/
16:35dnolennoprompt: you need 1878 you need core.async master
16:35nopromptdnolen: oh, hehe, just noticed the PR. sorry!
16:36nopromptdnolen: i mean the commit.
16:36dnolennoprompt: will be fixed in the next core.async release
16:36dnolennoprompt: in meantime you can do what you've been doing - working with SNAPSHOT
16:36nopromptdnolen: i can still use it from checkouts though?
16:36nopromptk
16:39nopromptdnolen: is that the right way to use "edge" versions of libs?
16:39nopromptie. the checkouts dir?
16:40sdegutis,(let [[one :as all] [1 2 3]] [one all])
16:40clojurebot[1 [1 2 3]]
16:40sdegutisweird.
16:46nopromptnm
16:47amalloyhiredman: isn't ~(reduce into (vec a) [b c]) just [~@a ~@b ~@c]?
16:47amalloy(referring to your letfn)
16:48amalloyvery 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:56janiczekGuys, is there some "clojure-php" project underway? (In the same spirit as ClojureCLR, CLJS, clojure-py, clojure-scheme)
16:57callenjaniczek: don't.
16:58tbaldridgejaniczek: if someone did that I would imagine they wouldn't live long enough to regret it :-P
16:58scriptorit'd probably be a traumatic experience
16:58Bronsaamalloy: the `[~@x] way of concatting multiple vectors is inefficient compared to using reduce into though
17:00tbaldridgeClojure on PHP : http://1.bp.blogspot.com/-xP-p-nGtozA/UJvqlRf0g3I/AAAAAAAABJ4/NP51t22n5hM/s320/c.gif
17:00janiczekcallen: tbaldridge: :)) yeah, I guess.
17:01amalloyBronsa: 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:01Bronsaamalloy: ~@ transforms to apply+vector+concat
17:02amalloyindeed
17:02Bronsaamalloy: to be clear, I use `[~@x] a LOT to concat vectors in CinC
17:02BronsaI'm just saying, maybe performances is why he wrote it that way
17:03janiczekbut 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:05mgaare_janiczek: have you tried digitalocean?
17:06nDuffjaniczek: remember, clojure depends fairly hard on interop with its host platform
17:07nDuffjaniczek: 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:07amalloyBronsa: a quick bench with criterium suggests that [~@a ~@b ~@c] takes about 10% longer, fwiw
17:08amalloyor, 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:09janiczekmgaare_: no I haven't - thanks for reccomendation!
17:10janiczeknDuff: mhm ... I imagine writing the implementation would be a horror.
17:11janiczeknDuff: 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:34nopromptcemerick: austin is "the bomb." thank you.
17:35cemericknoprompt: and not "The Bomb", or even The Bomb? Feh. ;-)
17:35cemericknp, enjoy :-)
17:35dnolennoprompt: no I think the right way is to use sonatype repo
17:35dnolennoprompt: other lein install
17:35dnolennoprompt: I only use checkouts if I need to debug some libs at the same time - usually clojurescript + something else.
17:36dnolens/debug/patch
17:36dnolen"or lein install"
17:36Raynescemerick: How's things?
17:36RaynesHaven't talked to you in quite a while.
17:37cemerickRaynes: honestly, sorta shitty lately. But, no worries.
17:37nopromptdnolen: ah, ok. gotcha.
17:37RaynesAw.
17:42tupihow should i rewrite this code so that i only parse a range once:
17:42tupi(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:43tupii scheme i would use arrays, or initialize vectors and set their values as apropriate ...
17:48seangrovetupi: https://www.refheap.com/18649 ?
17:49tupiseangrove: well that is what i am doing, but how doing things in 1 for only?
17:49tupitx to ehlp me of course :)
17:49seangrovetupi: Perhaps use destructuring? https://www.refheap.com/18649
17:50seangroveAh, no, that won't work in this case
17:50tupiis there an example of intializing vectors somewhere ?
17:51tupior sequences or what ever would come from 'external' values, computation on them and storing the results in a couple of different sequences ...
17:57tupi... (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:59amalloytupi: (for [...] (...anything with a ! in it...)) is probably always an error
17:59tupiamalloy: i am looking for an example of some code that would parse the range once only , performing calculus and storing the results ...
18:00`cbptupi: that wont work, replace for with doseq
18:01benkaydoes anyone have anything to say about working with quantlib or opengamma from clojure?
18:02tupi`cbp: i don't know how to write that simple example using doseq either
18:03tupihow do initialize the 'whatever' that will receive the values ?
18:03tupiany example somewhere?
18:04amalloytupi: 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:06amalloy(apply map list (for [i (range counter)] [(compute x) (compute y) (compute z)])) => ((x1 x2 ...) (y1 y2 ...) (z1 z2 ...))
18:09tupiok, really funny [to me], let me try
18:15tupiamalloy: do you have receive, like (receive (a b c d) (apply map list (for ...)))
18:15amalloy(let [[a b c d] ...])
18:16tupitx
18:18muhooany ideas about constant g #<EOFException java.io.EOFException: Unexpected end of ZLIB input stream>
18:18muhooin clj-http?
18:25callenmuhoo: https://github.com/dakrone/clj-http/issues/10
18:26callenhttps://github.com/zk/clojuredocs/issues/36
18:38robinkI 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:40nDuff(.toString your-obj)
18:42`cbprobink: str calls .toString
18:42robink`cbp: Ah
18:42robinknDuff: I end up with the class name when I do that
18:42`cbp,(str (reify Object (toString [this] "Hello")))
18:42clojurebot"Hello"
18:42nDuffrobink: then your object puts its class name into the string in its toString implementation.
18:44robinknDuff: Gotcha
18:44robink`cbp: Thanks, that probably would have worked. I instead used the class' .buildVCardString method to output a pure string.
18:47nDuffrobink: ...well, what `cbp was doing there was demonstrating that calling (str x) returns the output of (.toString x).
18:47robinknDuff: Ahh
18:48nDuffrobink: ...by constructing an object which had a specific implementation of toString, and showing that str returned toString's return value.
18:50robinknDuff: Ah, OK
18:52gosukiwiI'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:52gosukiwiCode: http://pastebin.com/iX7e2W08
18:54`cbpgosukiwi: that's because create is defined after -main
18:55`cbpgosukiwi: put it before or put (declare create) before -main
18:56gosukiwiOh, thanks! let me try that
18:57callenthere are four different unique ID fields in this database and they are sparsely allocated.
18:58`cbpgosukiwi: oh wait nevermind. I just noticed your resolve stuff
18:58gosukiwiOh, I put it before and still doesn't work
18:59`cbpgosukiwi: resolve will return a Var, so your fn? will always fail
18:59gosukiwiresolve is returning nil though shuoldn't it return something else?
19:19sdegutisI've been using a convention whereby I prefix my functions with "-" when I think they're probably stupid and need to be rethought.
19:19sdegutisI recommend it.
19:22`cbpI just yell FIXME
19:27Raynesgf3: Gotta say man, your phone is in significantly worse shape than mine at the moment.
19:27nopromptgoog.text.LoremIpsum well that's cool
19:27gf3Raynes: Probably, man
19:28Raynesgf3: 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:28gf3Raynes: Good call, I'm going to try the same thing
19:29RaynesYeah, rice usually helps with exploded iPhones.
19:29gf3LIFEHACK
19:31coventry`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:32coventry`Oh, is it that the while true is causing e to fill up?
19:32nopromptnrepl-jump is so awesome.
19:33gf3Raynes: http://cloud.gf3.ca/RO8k
19:33coventry`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:34coventry`Oh! So this is the difference between >! and "put!" (what I actually want.)
19:36Raynesgf3: Were you eligible for an upgrade? :P
19:36gf3Raynes: AppleCare+
19:37RaynesLucky.
19:37RaynesI just have to buy a new iPhone if this one doesn't start up.
20:03nopromptresources can be included with a jar right?
20:04nopromptlike an externs file or something for cljs?
20:06justin_smithnoprompt: yeah, that is the default thing with an uberjar / uberwar
20:07nopromptjustin_smith: but would that be included with, say, a jar pushed to clojars?
20:09justin_smithhmm
20:09OscarZhi.. 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:11justin_smithnoprompt: I think, if it is in your source-paths or resource-paths in project.clj, it will
20:12justin_smithyeah, come to think of it, our jars rely on that for config files to be included with jars
20:13nopromptjustin_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:15justin_smithnoprompt: 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:17nopromptjustin_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:17OscarZhas anyone found any real-life difficulties or annoyances when switching to Clojure from Java or some other language ?
20:18justin_smithdepends, is having to learn things annoying?
20:18nopromptOscarZ: i, for one, have not. in fact, i have found Clojure to be pretty much the answer to my prayers.
20:19nopromptOscarZ: well i will say this, the stack traces were a bit annoying at first.
20:19clojurebotExcuse me?
20:19OscarZmy 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:20justin_smiththe stack traces, the gotchas when macros get compiled and all code using the macro needs to be explicitly recompiled
20:20justin_smithwarmup time
20:20justin_smithmemory usage
20:21OscarZyeah, I guess that is some kind of artifact of the functional nature of clojure?
20:22nopromptwhat do you mean?
20:23OscarZjustin_smith: what about the maintainability? do you think your code is easy to understand and maintain?
20:23justin_smithmem usage is affected by how the usage of persistent data structures
20:23justin_smithvery maintainable
20:23nopromptmaintainable++
20:23justin_smithyeah
20:23nopromptcompared to the ruby code bases i maintain.
20:25justin_smithclojure idioms lend themselves to amazing amounts of composibility
20:25justin_smithespecially if you avoid macros
20:25noprompttesting tends to be a joy too.
20:25OscarZanyone here with some Django background ?
20:25justin_smithyup
20:25nopromptnot constantly having to mock up the world or frisk objects, asking them if they received a method call and shit like that.
20:25justin_smithunit tests : functional programming :: chocolate : peanut-butter
20:26nopromptOscarZ: setting up the workflow can take a bit of getting used to.
20:27nopromptbut the landscape is getting better all the time.
20:27justin_smithnoprompt: that's a big part of the learning thing I was alluding to above
20:27OscarZnoprompt: what kind of things for example?
20:28nopromptOscarZ: 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:29nopromptoverall it was worth it though.
20:29justin_smithI was also a vi user (nvi) until I started using common lisp
20:30nopromptonce you get your editor hooked up to nrepl and start developing it's very nice experience. the feed back loop is tight.
20:30nopromptyou don't have to dick around with tmux or something, or wait for your app to compile, etc.
20:30OscarZSome 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:31OscarZthe sheer minimalism was the main thing i think..
20:33akurilinWhat's the commonly accepted convention for naming test files and the test namespaces? Is it to suffix them with -test?
20:33nopromptOscarZ: the data structures and the core functions for operating on them in clojure is really what pushed me over the edge.
20:33nopromptit's beautiful.
20:34nopromptakurilin: typically yeah.
20:34noprompt(ns foo) -> (ns foo-test)
20:34akurilinok. I was doign foo.bar.baz -> test.foo.bar.baz
20:35akurilinthat breaks the conventions of a bunch of auto-testers out there :)
20:35akurilinsad.
20:35akurilinnoprompt, thanks for clarifying :)
20:36OscarZnoprompt: yeah.. I had a look at Haskell at one point and you can see a similar thing there too
20:36OscarZHaskell being in contrast a statically typed language with a powerful type system
20:37danielszmulewiczI'm transitioning from Ruby to Clojure for web development. Very challenging experience, but also rewarding.
20:37nopromptdanielszmulewicz: it's funny, i think when i came to clojure from ruby i was really happy with the communities attitude.
20:38nopromptat the time i was sick of OO and frameworks.
20:38nopromptespecially the ruby flavors of those things.
20:38OscarZI bought and read a Ruby book..
20:39noprompttired of OO design patterns. tired of special cases. tired of syntax. tired of complexity. tired of mutability.
20:39OscarZfor some reason I didnt feel the enlightement... it wasnt elegant..
20:40noprompttired of ruby thought leaders and all of their bullshit.
20:40danielszmulewicznoprompt: how would you characterize the differences between the communities?
20:41OscarZeven though I dont know Haskell well enough.. i think it has been a great experience to try to learn it :)
20:42clj_newb_2345anyone have a datalog layer built on top of monger? (no, I don't want to use datomic)
20:42OscarZto make any kind of sensible solution, it forces you to think of the core structure of the data you are dealing with
20:42nopromptdanielszmulewicz: the clojure community seems to be more genuine and rational.
20:43nopromptdanielszmulewicz: i found the ruby community to be kind of rude and arrogant.
20:43danielszmulewicznoprompt: less posturing?
20:43OscarZ:(
20:44OscarZI have asked stuff here before, and I've got really friendly answers...
20:44nopromptdanielszmulewicz: these are just my experiences.
20:44OscarZbut I have to say the Haskell community has made the best impression in that regard
20:44AimHereThe Haskell people are all just grateful that someone notices them at all :)
20:44nopromptdanielszmulewicz: the clojure community tends to embrace new comers and typically willing to help you.
20:45nopromptAimHere: haha! yes! they're a delightful group of people too.
20:45OscarZAimHere: hehe.. I guess you got a point there but still :)
20:45danielszmulewicznoprompt: Michael Klishin (from Clojurewerkz) once said that the Clojure community reminded him the Ruby community of 2007
20:46danielszmulewicznoprompt: communities have their own lifecycle
20:46OscarZanyone who is seriously into programming should dive into Haskel
20:46AimHereSo do we all turn into snotty jerks, or do they just turn up on the doorstep sometime in the next year or two?
20:46OscarZl
20:47danielszmulewiczAimHere: :-)
20:47nopromptdanielszmulewicz: i dunno. from what i understand this one's been around for a while and still pretty nice.
20:48noprompti think the same is true about the haskell community. everytime i needed help in #haskell people were helpful and respectful.
20:48OscarZnoprompt: respect for learning haskell too :)
20:49danielszmulewiczAimHere: as a community grows, a history builds up, with a mixed set of… everything that humans do
20:50nopromptlong 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:50danielszmulewiczthe entry barrier is very high for Haskell, that's why they have the nicest people
20:51danielszmulewiczClojure is built on solid ideas, that's what matters to me
20:51nopromptdanielszmulewicz: if thinking and giving a shit is a "high bar" then maybe you're right.
20:51noprompt:P
20:51OscarZI'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:52nopromptdanielszmulewicz: i've met ruby programmers who wouldn't think for a second about the consequences of using something like self.extended(base).
20:53nopromptsome of them were allergic comments too because i guess they though tests == comments.
20:53nopromptor rather documentation.
20:53AimHereOscarZ, Lisp is probably more lambda-calculus-ish
20:53AimHereHaskell has a bit of category theory going on with the monads
20:54supersymI 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:54supersymI must say, Haskell is pretty l33t though
20:55nopromptjust got an email from cousera reminding me that i signed up for their statistics course.
20:55nopromptw00t
20:55OscarZAimHere: you probably understand it better than I do
20:57OscarZAimHere: 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:58noprompthaskell isn't the type of language you would wanna program in if you were stoned or something.
20:58nopromptruby or javascript might be more suitable for that type of thing.
20:58OscarZheheh
20:59supersymhaha
20:59OscarZim actually not sure if its not a good language to code stoned as you need a kind of mathematically sound view of things...
21:00noprompti can't imagine a company built on haskell having a beer tap in the break room.
21:00OscarZso its probably better to code that Airbus A321 flight management system in ruby :)
21:01Pupnik_OscarZ: amphetamines might be a better option
21:05OscarZdo we have any people here that have a real Enterprisey Java EE nightmare background ? with Enterprise Java Bens and all horrors ?
21:10OscarZI 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:10justin_smithOscarZ: that describes a coworker of mine
21:10OscarZbut sure... there have been others already on this path Ruby, Python... many of them successfully
21:10justin_smithand because of that experience they pull him off of clojure to do spring / ee stuff sometimes
21:11justin_smithif you could see the comparison of our relative demeanor when I work on clojure sitting across from him doing spring...
21:11OscarZhehe
21:11OscarZjustin_smith: sounds like fun
21:12justin_smithhe is so jealous I think he may poison me just so he can get back to doing clojure again
21:13justin_smithI have been working on an aes encrypted credentials system for our webapps - like java keystore but with edn instead of key/value
21:13OscarZmy 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:13justin_smithis this foolish? am I missing out on something big by not using keystore?
21:13OscarZonly in Java 8 next year there will be real concept of function that has been in the javascript from the start..
21:14justin_smithkeystore just seems so overengineered for what I am trying to do
21:15OscarZ 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:16supersymOscarZ: I had the same impression about that
21:16supersymand they do have some solid libs in py
21:16OscarZI 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:16supersymthey use that to teach at uni cs here in the netherlands
21:17supersymprobably because it's made by a dutch guy though...
21:17OscarZsupersym: oh.. to teach what ?
21:17supersymcomputer science
21:17supersymI guess not if you study cognitive ai
21:18supersymI imagine they would use a lisp of some kind
21:18OscarZsupersym: I'm not sure if thats such a bad idea really...
21:18akadjango is so convoluted
21:18jimrthyI 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:18supersymme neither
21:19OscarZsupersym: cognitive AI is very interesting to me... is that a real hard core subject some universities?
21:19OscarZin
21:19OscarZ^^
21:20OscarZjimrthy: can you elaborate a bit why was that?
21:20supersymOscarZ: they teach it here in my home town actually, I think two more places in the country... how big it is? no idea
21:21OscarZsupersym: thats cool.. do they touch any interesting subjects as consciousness? :D
21:21jimrthyOscarZ: 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:22noprompti know (.write js/document "") is a mortal sin, but the cljs-repl doesn't like it.
21:22nopromptlocks up everytime
21:22noprompt*ever time
21:22noprompt:-/
21:23noprompt*every time
21:23jimrthyOscarZ: 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:24OscarZjimrthy: yeah.. I got that kind of impression too..
21:24jimrthyOscarZ: 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:24OscarZright..
21:24akaI go with Flask when using python for web dev.
21:26OscarZmaybe Scala language could be some kind of rival to Clojure too ?
21:26OscarZa next gen JVM language with a powerful static type system
21:26OscarZhave you guys got any experience on that?
21:27akathey kinda are rivals
21:27supersymOscarZ: this is some of it, their server is almost smoking it seems though http://www.tilburguniversity.edu/research/institutes-and-research-groups/ticc/
21:27akain that context
21:27OscarZI 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:28supersymI would think so too
21:28OscarZsupersym: what are you studying in there :)
21:28supersymML and scala would be something I'm likely to try out at some point, just for fun
21:28supersymme, nothing, I just live there :P
21:29tupihttp://paste.lisp.org/display/138930#2
21:29supersymI didn't do too well in school environments in my younger years so I joined the Air Force instead
21:30OscarZcool.. are you a fighter pilot? :)
21:30supersymsecurity grunt... well officer anyway
21:30supersymand I did induction courses (boot camp)
21:30supersymthat was fun
21:31OscarZheh
21:31rurumateThe type of (type (chunk-first (rest (vec (take 32 (range)))))) is cljs.core/ArrayChunk. Where can I read the source of that?
21:32rurumateor at least, some documentation
21:32supersymhttps://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L2128
21:32supersymthat seems a bit more unlikely
21:33Bronsarurumate: chunked seqs are mostly an implementation detail
21:33BronsaI don't think you'll find any documentation
21:34rurumateBronsa: well they seem to be a problem for filter
21:34OscarZI realize that I need to make a huge paradigm shift in my thinking about programming
21:35OscarZthat is towards to functional programming and the concepts they advocate
21:35Bronsarurumate: how so?
21:35OscarZClojure is for sure one choice
21:35rurumateBronsa: here http://dev.clojure.org/jira/browse/CLJS-587
21:36rurumateI browsed the stack a bit, and it seems the problem happens when filter uses the else-branch
21:36OscarZScala is one.. maybe a less steep learning curve but maybe deceivingly so
21:38rurumateBronsa: 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:38supersymOscarZ: I come from OOP, this is my first true functional language (I got in touch with the paradigm through coffeescript)
21:38supersymI must say... I wouldn't want to go back, it took a little while but .. holy mack that makes a difference in reasoning
21:39OscarZsupersym: oh.. what are the most amazing things in your opinion?
21:39supersymits hard to articulate
21:40rurumateBronsa: whereas (first (filter is-equal-9999 (reduce conj () (vec (take 10000 (range)))))) will blow the stack
21:40supersymand much is a combination of what clojure offers (like immutable values, perception of time with e.g. refs etc)
21:40rurumateBronsa: oops, here's is-equal-9999: (defn is-equal-9999 [x] (= 9999 x))
21:40OscarZI havent used Clojure much, but one thing i immediately noticed when experimenting with it
21:40supersymfor one, writing (pure or not) functions it makes for so much easier testing, knowing what to expect really as outcome
21:41OscarZthat everything I wrote was very minimalistic..
21:41Bronsarurumate: I could guess that :P
21:41rurumateBronsa: 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:42supersymclojure 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:43OscarZIt 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:43supersymyup
21:44OscarZthe clean syntax may seem like its superficial, but I think for us human beings stuff like XML is really horrible...
21:44supersymI used Visual Studio a lot, and it has great tools... but in the back of things tons of code was generated of course
21:45supersyma lot in xml/xaml as well
21:45rurumateOscarZ: it's horrible for computers, too. yuck
21:45OscarZhehe I guess it is
21:45supersymsomehow I keep feeling those tools are more for cubical programmers though...
21:45supersymdrag/drop code :P
21:46rurumatewhat are epiphanies
21:46OscarZA 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:47rurumatemaybe it will be necessary to implement some clojurescript "core" library in javascript?
21:49OscarZOur 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:49supersymrurumate: there is https://github.com/Gozala/wisp
21:49supersymthat is, you don't need a JVM for that to get nice JS
21:50supersymI 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:50OscarZhmm.. I think it would make an interesting cognitive science test
21:51OscarZit should be easy enough to test if people were able to understand more complex JSON data structures than logically equivalent XML data structures
21:51rurumatesupersym: nice, thanks
21:52devnOscarZ: I
21:53devnOscarZ: I'm quoting Rich: "What is JSON missing?" (w/r/t XML). "The X."
21:53devnEDN is great in that regard.
21:54OscarZdevn: I didnt get that ;)
21:54OscarZI'll have to read up on EDN
22:03OscarZits 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:04OscarZit should be interesting to test this.. i have no doubts about the results..
22:10appendonlyOscarZ: sapir-whorf hypothesis for programming languages. blub languages. http://www.paulgraham.com/avg.html
22:12OscarZthanks appendonly, I'll check it out
22:27gfrederickshaha this surprised me: ##(reduce = [1 1 1 1])
22:27lazybot⇒ false
22:30grandyhello, 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:30dissipate_gfredericks, how does that surprise you?
22:31gfredericksdissipate_: I've had a very mild amount of alcohol
22:32dissipate_gfredericks, you should be in #haskell then
22:33gfredericks,(reduce = [1 1])
22:33clojurebottrue
22:34arohner,(reduce = [1 1 true])
22:34clojurebottrue
22:34grandyanyone have any ideas on that trace?
22:37gfredericksarohner: ha
22:38gfredericksgrandy: you're running lein on the raspberry pi?
22:38grandytrying to... :) i think i migth have figured it out
22:39gfredericksis a raspberry pi good at running 2 jvms?
22:39gfredericksotherwise you might want to `lein trampoline`
22:53grandyi guess i didn't figure it out
22:53grandyno it's not all that good at it, pretty slow cpu
23:01hiredmangrandy: which jvm?
23:01grandyhiredman: openjdk
23:01grandyhiredman: was just the default on the distro
23:01hiredmanlast I hard the openjdk didn't have a jit for arm yet
23:01grandyhiredman: hmm
23:02grandyhiredman: that may be true, i'll try a different jvm i guess, new to this raspberry pi specific distro
23:02hiredmanthe latest arm jdk from oracle has hard float support so it'll run on the pi
23:02grandyahh perfect
23:02hiredmanbut you'll have to download it from oracle
23:06grandyhiredman: great! thanks for the tip
23:36coventry`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:51akurilinPlaying 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:52akurilinRaynes, ping, perhaps something you might have seen before?
23:57coventry`Why doesn't core.async limit the number of pending puts on a channel?
23:58coventry`Er, Why *does*, etc.