#clojure logs

2014-01-15

00:03rubber-duckso the error goes away when I remove the recur in catch block
00:05AJ256Anyone: localrepo plugin, pomegranate library, creating a local maven repository, etc. I've found a lot of different answers on Google for how to add local jars as dependencies to leiningen projects. Anyone in here have any experience and an opinion on the fastest/easiest way to add a local jar as a dependency?
00:17bendb,(help)
00:17clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: help in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:18ddellacostaAJ256: I think it depends on what you are trying to do with it. For something experimental that I'm not actually hacking on, I'll simply run lein install in the lib directory and then require it from the relevant project. But I've used checkouts in the past if I've wanted to work on the library's code at the same time as the project using the lib. Pomegranate and lein-try seem to be great if you're just trying out a lib to see if
00:18ddellacostayou want to use it (although, I've never used pomegranate and I may not understand its use-cases well).
00:20ddellacostaAJ256: honestly, don't understand the use-case for lein-localrepo either. Seems like it's just giving you more fine-grained control over your default local maven repo?
00:20ddellacostagranted, seems handy
00:21AJ256Thanks, ddellacosta. I'm trying to hack on a lib at the same time as the library that depends on it. And I don't want to release it to the world until I'm ready. (It's for work. It's open source, so I can put it on clojars eventually, but I need to have a certain minimum level of quality before I release it.)
00:22AJ256*at the same time as the app that depends on it
00:22ddellacostaAJ256: in that case, I imagine putting the lib in the checkouts directory would work the best for you: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L273
00:23ddellacostaAJ256: sorry, this is probably a better link: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#checkout-dependencies
00:23ddellacostamaybe you're already familiar with checkouts though
00:24alewis it possible to cider-jack-in with a particular leiningen profile?
00:24AJ256I'm still relatively new to clojure, and even newer to leiningen, so no. Not familiar with checkouts yet.
00:27AJ256ddellacosta: yes the second link makes a little more sense to me than the first. :D
00:27ddellacostaAJ256: yep, sorry 'bout the confusion. :-)
00:29AJ256Ha, not at all ddellacosta! Thanks for the tips! I'll check this out tomorrow and give it a go.
00:29AJ256Thanks!
00:29ddellacostaAJ256: np, good luck!
00:36eric_normandI like Clojure :)
00:36grncdrI was just thinking the same thing
00:36grncdrI need to find a small contract where they don't care about the implementation so I can build a full webapp in Clojure
00:37eric_normandhave you tried the "it's just a java library" approach?
00:39ddellacostaeric_normand: loved your post re: Hindley-Milner in Clojure, btw. Been learning Haskell lately and it nicely dovetails with what I've been learning.
00:40TolstoyHm. Any reason [clojurewerkz/cassaforte "1.3.0-beta7"] doesn't seem to pull in dependencies?
00:40eric_normandddellacosta: thanks. I'm glad you liked it
00:40TolstoyException in thread "main" java.lang.ClassNotFoundException: org.apache.cassandra.db.marshal.UTF8Type
00:41ddellacostaTolstoy: is it possible an older version of cassandra is getting pulled it by something else?
00:41Tolstoyddellacosta: Not sure. I created a new project (first use of cassandra ever).
00:42ddellacostaTolstoy: ah, okay, then sounds like maybe not. I would do a lein deps and poke around. Sorry I don't have much more than that...
00:43TolstoyTime to revisit good ole ~/.m2, eh? ;)
00:43abaranoskybitemyapp: sorry I dissappeared after asking you guys about a JSON library. I totally forgot I had asked, and some work stuff came up.
00:44abaranoskyWe haven't yet identified any performance issues with any particular JSON serialization library, but a coworker was wondering which would be fastest. I always use Cheshire because I like its flexibility.
00:45eric_normandTolstoy: try lein deps :tree
00:45Tolstoyeric_normand: Did that right off. Maybe it should be pulling in something but isn't.
00:46Tolstoyeric_normand, ddellacosta: https://github.com/clojurewerkz/cassaforte/issues/26
00:46ddellacostaTolstoy: ah, there ya go. :-)
00:47Tolstoyddellacosta: Wow, that pull in half the internet. ;)
00:51Tolstoybeta8 did the trick. Sheesh! ;)
01:17andyfOK, basic question about protocols here (I haven't used them in my code yet). Why is there a warning if you create two protocols that have a method name in common?
01:18hiredmanandyf: they aren't methods, they are functions, they live in vars as per normal
01:18hiredmanso they will overwrite each other
01:19andyfhiredman: OK. But there is no warning if you re-defn the same function multiple times.
01:20hiredmanandyf: I imagine the defprotocol macro checks and issues the warning
01:20andyfI mean, I guess I'm not complaining that someone was considerate enough to put in the warning. Just surprised me at first.
01:22hiredmanprotocols are neat, and can do some cool stuff, but there are all kinds of fiddly bits people tend to screw up, so sadly, best to avoid them
01:22hiredmanlots of confusion around functions and methods and protocols and interfaces
01:23logic_progif a document is copyrihted, how many people can I share it with for educational purposes?
01:24hiredmanthat isn't even getting in to the problems you can have with stale classes and weird classloader issues and what not
01:28andyfIs there some special significance or behavior to protocol methods whose name begins with a dash?
01:29amalloyandyf: no
01:29hiredmanit is a convention for protocol functions that are the underlying implementation for some other function to be so named
01:29hiredmanso if conj was part of a protocol you might have conj as the function and -conj as the underlying protocol function
01:30hiredman(convention meaning dnolen does it in clojurescript)
01:30andyfgood to know. Sort of like the convention where foo* is a function that does most of the heavy lifting for a macro named foo
01:30andyfhiredman: and core.logic
01:30amalloyyeah, i was going to say dnolen just uses it for all protocol functions
01:30amalloybut hiredman is probably more right
01:34andyfMight just be a bug in Clojure/Java, but defining a protocol where the method name begins with a dash, and only one arg, causes a reflection warning (if they are enabled), but I don't see any other combinations that do that.
01:34hiredmanandyf: are you using the latest master?
01:35andyfhiredman: 1.5.1, I think. I'll try it with latest to see if anything changes
01:35hiredmanI seem to recall a bug like that, but I thought it was patched
01:38andyfSounds familiar. Probably this one http://dev.clojure.org/jira/browse/CLJ-1202
01:39amalloyoh good. i thought i fixed that; glad to hear it's just not in a release yet
01:50chareok so the problem with clojure is that its dynamically typed which means I can't convince my friends to use it
01:51charehow do I love that
01:51charesolve that
01:51andyffind new friends
01:51andyf:)
01:52chareand haskell is just too scary to them to even contemplate
01:53bitemyappabeaumont_: what-evs.
01:53bitemyappoh. wrong person.
01:53bitemyappn/m
01:53bitemyappsigh dammit baranosky.
01:55chareso andyf no solution for me?
01:55andyfchare: I gave you one, albeit not terribly seriously. Could work, though, if you wanted to go for it.
01:57chareisn't there something like typed clojure or something
02:00eggheadchare: typed clojure, while cool, probably won't sell people who don't like dynamic typing on dynamic typing
02:00chareegghead uh explain why not
02:01bitemyapptyped clojure isn't that nice or fundamental to clojure
02:01bitemyappit's a way to harden up code.
02:01eggheadchare: because compile time checks or else!
02:01egghead:p
02:02eggheadi'd just explain how clojure offers everything you need for typed systems with multimethods, protocols, etc
02:02eggheadyou can program to contracts, you can dispatch off type
02:02eggheadyou can enforce inputs and outputs at the bytecode level what more do these people want
02:03chareegghead you're making things too complicated, they only understand the term static typing
02:03chareanything more is too complicated
02:05eggheadchare: just tell them that clojure is staticly typed with such good type inference that you don't need to declare the types
02:05charebut thats lying
02:05charethey know i'll be lying
02:05eggheadthen when they ask about types because they pass the wrong type just teach them about multimethods and protocols
02:06eggheadlol chare
02:06eggheadobv
02:06eggheadbut if they don't want to learn you aren't going to convince them to by saying 'dynamic typing!'
02:07chareegghead damn it i'm going to be stuck with python or ruby forever
02:07eggheadwut
02:07eggheadif they are using ruby or py they can certainly use clj as an alternative
02:09charethats not how they think
02:14noonianhmm, but both python and ruby have dynamic typing?
02:16charethey make exceptions for ruby and python...
02:19chareok this is what I'm going to do
02:19charegive them clojure ultimatum
02:19charenot budge
02:20eric_normandchare: they have authority to choose python and ruby? but you don't have same authority to choose clojure?
02:22chareok so if I suggest clojure whats to stop them from countering with nodejs
02:24andyfchare: If you are looking for some kind of irrefutable argument for Clojure that everyone will be convinced by, you aren't going to find one.
02:24andyfnor for any other technology
02:25chareandyf so in other words you're saying my friends are stupid
02:25noonianjust not interested in learning clojure from the way it sounds
02:25andyfI am saying that there are practically no statements in the world that you could get everyone to agree on. Don't bemoan the fact, just accept it and move on to more interesting questions.
02:28andyfMake Clojure your hobby, even if it isn't your day job. If it is really important to you that it is your day job, get better at it and look for opportunities.
02:33chareso lets go back to making a game in clojure
02:33logic_proglet's figure out how to make money with clojure
02:34bitemyapplogic_prog: I like your idea.
02:34noonianyes!
02:34logic_progbitemyapp: I feel that clojrue makes me a 10x engineer
02:34logic_progthus, i should be able to make 1M /year
02:34bitemyapplogic_prog: math looks right.
02:34logic_progbitemyapp: you look like a 20x engineer. Tell me about your 2M / year job.
02:35logic_progI'm thinking baout building a search service on top of dropbox
02:35logic_progi.e. a better way to search through your dropbox docs
02:35bitemyapplogic_prog: cool.
02:38ddellacostaman, I like source maps but they really seem to slow down my incremental compilation
02:38logic_progbitemyapp: you have any good ideas?
02:39bitemyapplogic_prog: I'm sorry, was that supposed to be a serious question?
02:39charelets use clojure in same way to thwart the nsa
02:39bitemyapplogic_prog: it's a little hard for me to tell at the moment who is being serious and who is not.
02:41noonianits a superposition
02:41logic_progyes, the company is both alive and dead until one tries to raise a VC round
02:42logic_progonce the VC measures things like growht, revenue, etc ... then it's forced to either "funded" or "not-funded" stage
02:46quizdrthe doc for both (ns) and (in-ns) both say: Sets *ns* to the namespace named by name (unevaluated), creating it
02:46quizdr if needed. So what exactly is the difference?
02:46hiredmanns is a macro that contains a call to in-ns in the expansion
02:47hiredmanin-ns is a function
02:47hiredmanuse ns
02:48quizdrwhy do books such as Halloway's often suggest/teach to use in-ns? there must be some reason
02:49amalloyhalloway's book is older than the hills, but even then i expect if he's telling you to use in-ns you're probably mistaken. ns was around then, right?
02:49amalloyhe might be explaining to you how it works, just in case you ever need to know
02:49quizdrno, i'm reading the second edition, just released.
02:50hiredmanin-ns is often used to change the value of *ns* while at the repl
02:50noonianyeah, in-ns is useful from the repl
02:50quizdrso again, what is the actual difference between using it or just ns, even from the repl?
02:51noonianuse ns in your programs, thats where you do all your requires and imports. use in-ns from the repl to switch to the ns's declared in your programs and test your code
02:51andyfTry this at a REPL, and you will see everything that (ns foo.bar) does that in-ns does not: (pprint (macroexpand '(ns foo.bar)))
02:51SegFaultAXquizdr: The difference is in-ns is a function, whereas ns is a helper macro.
02:53quizdrandyf that's useful thanks
03:15logic_progin cljs, is it possible to create a _buffered_ cljs/chan that has _infinite_ size?
03:15logic_progi.e. I want the buffer to just continuousy grow
03:15logic_prograther than have a limit
03:17mischovI believe I remember something in some talk about core.async that mentioned not allowing that foot-shooting to occur, but I could be entirely wrong.
03:18logic_progthis is foot shooting?
03:18logic_progto have a channel without a buffer
03:18logic_proghmm
03:20SegFaultAXlogic_prog: Unbounded buffering is expressly prohibited. Back pressure is a good thing, embrace it.
03:20mischov"What we do not provide and will not provide are unbounded buffers"
03:21mischovhttp://www.infoq.com/presentations/clojure-core-async at 23:00
03:22SegFaultAXBecause it makes absolutely no sense.
03:23SegFaultAXWhat rationale could there be for "I want this buffer to grow until all available ram is consumed, and my application crashes unrecoverably due to OOM"
03:24quizdrthat can be a desirable effect for anyone writing a virus, so there is some use
03:25SegFaultAXJava isn't the most typical platform for virus authors.
03:25quizdrtell that to Android users
03:25SegFaultAXAnd anyway, it would be a relatively short lived attack unless -Xmx == total available vram.
03:26SegFaultAXquizdr: It's not as if Android is /only/ capable of running Java.
03:26bitemyapplogic_prog: don't do that.
03:26logic_prognoted
03:26logic_progyeah, watching Rich Hickey take it apart
03:26quizdrnot an Anroid user or developer but I thought Java was the official language of Android
03:27SegFaultAXOfficial is not the same as only permitted language.
03:27SegFaultAXThere is a native toolkit as well.
03:27quizdrbut it is the most widespread language, and Android is also the most virus-prone mobile OS, so Java is indeed a target of virus authors
03:27SegFaultAXquizdr: http://developer.android.com/tools/sdk/ndk/index.html
03:28SegFaultAXI don't have any evidence to support or reject that claim. The point is authors would not be limited to java.
03:29quizdrhttp://tech.fortune.cnn.com/2013/04/14/apple-enterprise-android-malware/
03:30SegFaultAXquizdr: Greater freedom for the consumer comes at the cost of larger attack surfaces.
03:31quizdrAndroid is likely the reason Java is now a major target of virus authors.
03:31mischovNot particularly applicable, but made me think of it.. http://java-0day.com/
03:32SegFaultAXquizdr: It probably has more to do with the Android market share dwarfing all other platforms, globally.
03:33SegFaultAXThere are also more viruses targeting MS platforms than OSX platforms. Does that imply that OSX is more secure? Of course not, but why go after something that has 5 - 10% of the overall market share when you can instead attack something that has > 85%
03:34bitemyappsafari is easier to hack these days than IE, but IE is the bigger target.
03:34bitemyappthat wasn't always the case.
03:34logic_progis the behabior of "put!" on a full channel defined?
03:34SegFaultAXIE also happens to be one of the most (if not /the/ most) standard compliant browser.
03:34logic_proghttps://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async.cljs#L87 sys very little
03:34SegFaultAXThat sure as shit wasn't always the case.
03:35quizdrmy point was simply that Java is a source of virus writing after all, regardless of the reasons
03:38bitemyappSegFaultAX: uh, sorta. IE9 still flakes out on some stuff.
03:38bitemyappJava browser JRE is a fat source of exploits.
03:38SegFaultAXbitemyapp: IE9 is a piece of shit. I'm talking about 11
03:39quizdrIE is sure not as much of a joy to use as other browsers though. for example, IE has nothing on lynx
03:39bitemyappI like this guy.
03:39SegFaultAXquizdr: That's not exactly an apples-to-apples comparison, though.
03:39bitemyappcan we keep him?
03:41quizdrhi
03:58testcloj`
03:58testcloj`(def a {:a []})
03:58testcloj`(def b {:a 2})
03:58testcloj`(def c [{:a 2} {:a 3}])
03:58testcloj`(merge-with conj a b) -->this works
03:58testcloj`(merge-with conj a c) --> this doesn't work, since c is a vector, but how to make it work?
04:01noonian,(let [a {:a []}, c [{:a 2} {:a 3}]] (map (partial merge-with conj a) c))
04:01clojurebot({:a [2]} {:a [3]})
04:02quizdrnoonian nice
04:02amalloy(apply merge-with conj a c)
04:02TEttingeramalloy, that only works if a is a map, right?
04:03amalloyalthough it's rather suspect that the types of the values in a are different from those in b
04:03amalloywell uh...it is a map?
04:03TEttingerwell if c and a are reversed it fails right?
04:03amalloylike, nothing involving merge-with a will work if a is not a map
04:03quizdramalloy how is your apply any different than the original example?
04:03quizdraren't they both just calling merge-with with the same args?
04:03amalloy(apply f x [y z]) => (apply f x y z)
04:03amalloyer
04:03amalloy(apply f x [y z]) => (f x y z)
04:04quizdrah the apply splices for you, got it
04:04noonian,(let [a {:a []}, c [{:a 2} {:a 3}]] (apply merge-with conj a c))
04:04clojurebot{:a [2 3]}
04:05noonianso different semantics and it depends on what he wanted heh
04:05TEttinger,(let [a {:a []}, c [{:a 2} {:a 3}]] (apply merge-with conj c a))
04:05clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
04:05quizdrhanging out in this room is like going to a party except you leave with *more* brain cells
04:06TEttingerthis one's a bit of a brain-bender yeah
04:09magnarsAnyone know how/why/where Ring adds ;charset=ISO-8859-1 to my Content-Type header? And possibly how I can make it serve utf-8 instead?
04:10noonian,(let [a {:a []}, c [{:a 2} {:a 3}]] (reduce (partial merge-with conj) (conj c a)))
04:10clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
04:11AeroNotixany docs on running compojure with SSL?
04:11noonian,(let [a {:a []}, c [{:a 2} {:a 3}]] (reduce (partial merge-with conj) {:a []} (conj c a)))
04:11clojurebot{:a [2 3 []]}
04:11noonianhmm
04:12AeroNotixor with ring w/e. I cannot use nginx to terminate SSL connections since this application is processing CC information, and thus all connections need to go through SSL for PCI compliance
04:21nooniani think friend can do ssl
04:22nooniansee https://github.com/cemerick/friend and http://clojure-yap.blogspot.com/2013/07/setting-up-friend-few-preliminaries.html
04:22clgvAeroNotix: pretty easy. just configure jetty to use SSL. you'll need to pass it a keystore containing the certificate
04:23AeroNotixclgv: ok cheers
04:23clgvAeroNotix: (jetty/run-jetty routes {:ssl? true, :keystore "path/to/keystore.ks", :key-password "verysecret"})
04:24clgvbetter not include it in the source ;)
04:24AeroNotix:)
04:25mischovmagnars: ring-middleware-format might be what you're looking for
04:27mischovmagnars: or it might not be. either way, https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/content_type.clj
04:29magnarsmischov: ah, yes, I've got that. The problem is that it forces iso-8859-1 on me for some reason.
04:29TEttingermagnars, that's the encoding of cmd.exe on windows by default I think
04:30TEttingerif things are being piped through there, it might explain it
04:31magnarsit's probably the encoding on my terminal as well, even if it is on OSX. So I have to find a way to override the default encoding in Java somehow?
04:31mischovTry making a handler to set the content type as UTF-8
04:33mischover.. not handler, wrapper... middleware wrapper
04:33magnarsyeah, that works. Thanks.
04:34testcloj`
04:34testcloj` how to create the following
04:34testcloj` ([] [] [] [])
04:34testcloj` I tried the following, but doesn't work
04:34testcloj` (take 4 (repeatedly #([])))
04:35noonian,(doc repeatedly)
04:35clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
04:35TEttinger,(repeat 4 [])
04:35clojurebot([] [] [] [])
04:35quizdr,'([] [] [] [])
04:35clojurebot([] [] [] [])
04:35noonian(take 4 (cycle [[]]))
04:36noonian,(take 4 (cycle [[]]))
04:36clojurebot([] [] [] [])
04:37mischovquizdr: I see you, and raise you (identity '([] [] [] []))
04:38bitemyapp,#('([] [] [] []))
04:38clojurebot#<sandbox$eval119$fn__120 sandbox$eval119$fn__120@1a72123>
04:38bitemyapp,(#('([] [] [] [])))
04:38clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
04:39bitemyappright. fuck me.
04:39quizdrmischov i call your bet (eval (eval (quote (quote (identity '([] [] [] []))))))
04:40bitemyappmischov: http://words.steveklabnik.com/a-30-minute-introduction-to-rust http://steveklabnik.github.io/nobody_knows_rust
04:40mischovquizdr: Ah, so you did have the two evals...
04:41quizdri bet you thought i had three... i'm that good. i can bluff with the best of them.
04:41TEttinger,(take 4 (map vec (repeat nil)))
04:41clojurebot([] [] [] [])
04:42mischovbitemyapp: wtf format for a slideshow is that! :D
04:43bitemyappmischov: I've seen hipsters using it lately, think it's based on that one dude's JS.
04:43bitemyappI forget his name, he makes a bunch of impressive pretty JS widget thingies.
04:43mischovbitemyapp: oh- him!
04:44bitemyappmischov: you know who I'm thinking of?
04:45mischovbitemyapp: absolutely not.
04:45jonathanjwhat's an efficient way to produce a new seq without the last item?
04:45jonathanjbutlast?
04:46bitemyappmischov: Hakim! http://lab.hakim.se/reveal-js/#/
04:46bitemyappmischov: http://lab.hakim.se/
04:46mischovbitemyapp: vertical slides are ux silliness.
04:47quizdrjonathanj drop-last? ,(doc drop-last)
04:47jonathanji'm reimplementing `comp`: http://cljbin.com/paste/52d65895e4b0120cbe8ee015
04:47mischovbitemyapp: at least in the same presentation with horizontal slides...
04:47bitemyappmischov: I know that. I don't know why people do that stuff.
04:48mischovbecause it makes them smile.
04:48bitemyappmischov: anyway, the presentation is secondary to the blog post, that tells you the "what's actually different about this?" bits. The Rust tutorial is pretty short too. http://static.rust-lang.org/doc/0.9/tutorial.html
04:48Glenjamini think the idea is optional slides
04:48bitemyappthey're not optional.
04:48Glenjaminso you can go left->right, but drill down if you have time
04:48Glenjaminoh
04:49Glenjaminwell, thats the intention of the feature afaik
04:49mischovbitemyapp: I'll check it out after sleep. :D Thanks.
04:49bitemyappmischov: cheers.
04:49mischovGlenjamin: in the presentation in question his topics are horizontal and the parts of each topic are vertical
04:50Glenjamini suppose in theory he could stop going down after a few, and move onto the next section
04:50Glenjaminalthough they're not structured that way, i see
04:51Glenjaminyeah, basically the whole deck is down from slide 1
04:51noonianwhats the difference between butlast and drop-last?
04:52fredyrnoonian: laziness
04:52andyfdrop-last is lazy, butlast is not
04:53noonianthanks, and it looks like the only difference from drop is it makes a new seq instead of returning the same one
04:53mischovdrop-last can also drop more than 1
04:59TEttinger,(defn comptroller [& funs] (fn [& args] (reduce #(apply %2 (if (seq? %1) %1 [%1])) args (reverse funs))))
04:59clojurebot#'sandbox/comptroller
05:00TEttinger,((comptroller str +) 1 2 3)
05:00clojurebot"6"
05:00piranhasomehow core.async works very occasionally for me. It's like magic, sometimes it works and sometimes it does not
05:01piranha:\
05:01piranhaI don't even know how to describe that... quite frustrating
05:05noncompiranha: https://www.youtube.com/watch?v=JYAq-7sOzXQ
05:06piranhanoncom: yes that's exactly it!
05:06piranhanoncom: I do (put! chan :keyword) in few places and it works only for a first time, but then it worked all the time when I did it from dev tools console
05:06piranhabut now it stopped catching messages from console... and still works once for messages from code
05:07piranhathat's somehow really disturbing
05:07piranhaI'm pretty sure it's my fault but it's not immediately obvious from the code what I did wrong %)
05:08noncomif you want someone to comment on that i think you should post a refheap. core.async is encouraged to use by this community so people will try to help i think
05:08piranhawell here is my code: https://github.com/piranha/locations/blob/master/src/locations/core.cljs#L48-L51
05:08piranhait's quite simple
05:09piranhaand I guess that calling qwe('search') at least should print :search to console...
05:09piranhaand real put!s are in views.cljs
05:13noncompiranha: oh, sorry, me myself is not a big expert in core.async, especially in its cljs incarnation (although it must work the same way). maybe you could ask some time later today in this channel when someone who is very familiar with core.async can answer
05:14piranhanoncom: sure, it's just I'm frustrated right now and there is nobody around in real life I could speak with, and I had to let this frustration out... :)
05:14noncom:)
05:14piranhaanyway yes, I'll ask later for sure
05:14noncomit happens to me from time to time too
05:15piranha:)
05:15fredyrpiranha: may i ask why you extend string to be clonable?
05:16piranhafredyr: so that I could use it as an Om's cursor
05:16fredyrhmm
05:16piranhaOm by default extends map and vector (and maybe list)
05:16fredyrthat might explain why i had problems yesterday then
05:16piranhabut you can't supply a string to a component and then expect a component to update it since there is not metadata
05:16piranhaso you extend it with -clone which returns boxed string
05:17fredyrbut isn't that when you're having a string as the actual cursor?
05:17piranhahaha that may be a problem :) the same thing with a number
05:17piranhawell I have a string as a cursor, it just needs to be wrapped in a String object
05:17piranha(js/String. "actual string")
05:17fredyri had a map as the cursor coming in to the component
05:18fredyrbut wasnt able to destructure the cursor to get strings
05:18fredyrthat i could use in the html
05:18fredyrhttps://gist.github.com/fredyr/8424220
05:18piranhahm that's strange
05:18fredyrto get it to work i had to do (om/value)
05:19piranhafredyr: no real idea why it's behaving so, I think you might want to wait for dnolen as well :)
05:19fredyrright
05:19fredyr:)
05:20fredyri almost always miss the us folks
05:20fredyrbeing on cet time i mean
05:23clgvfredyr: you can catch them in the afternoon easily
05:24fredyryeah
05:24piranhayeah just need some patience :) I'm in EET and still able to catch them
05:24fredyrhah
05:25piranhabut it's true, time makes everything hard :)
05:26fredyrit more like the combination of time zones, work and family thats doing it
05:26fredyr:)
05:27fredyrbtw i can recommend tim baldrigde's break down of the core.async internals if you haven't watched
05:28fredyrthey were really cool imo
05:28piranhayeah it's in my queue
05:29fredyris that a fifo or priority queue?
05:29fredyr(;
05:30clgvfredyr: you got a link to the video, since google doesnt return anything useful
05:30fredyrhttp://www.youtube.com/watch?v=R3PZMIwXN_g
05:31fredyrthere's a part II and one called deep walking macros in the same serie
05:31fredyrs
05:31piranhafredyr: ah, not this one? http://www.youtube.com/watch?v=enwIIGzhahw
05:31piranhamy link seems to be an overview
05:31piranhaok, that's less interesting :)
05:31fredyrthat one is good also
05:32fredyrbut more as an introduction
05:33fredyrthe go macro vids are more like macrology galore, state monads and headasplodes
05:38sg2002Hello. Can somebody help me with setting cider? I get this: error in process sentinel: Could not start nREPL server: "eval" íå ÿâëÿåòñÿ âíóòðåííåé èëè âíåøíåé
05:38sg2002êîìàíäîé, èñïîëíÿåìîé ïðîãðàììîé èëè ïàêåòíûì ôàéëîì.
05:38sg2002
05:39ior3ksg2002: does "lein repl" work?
05:40mrcheekssg2002: how did you install it? via package-install? Do you also have lein install?
05:40mrcheeksinstalled*
05:41sg2002I have lein installed. Lein works.
05:41mrcheekswhat about the cider installation then?
05:41sg2002Installed via package install.
05:43mrcheeksTry to 'pastebin/refheap' your setup for cider
05:43sg2002I'm using windows by the way. It looks like some kind of message from shell, just in the wrong codepage.
05:43mrcheeksah Windows...
05:44sg2002mrcheeks: Don't have any. Just basic thing from the readme.
05:44testcloj`{1 "abc", 2 "def" 3 "qq"}
05:44testcloj`{:a [1],:b [1 2], :c [2 3]}
05:44testcloj`how to get the following ?
05:44testcloj`{:a "abc",:b "abc,def", :c "def,qq"}
05:46sg2002Oh, was able to read the message... Hmm.
05:47noncomsg2002: your message says that eval is not an executable command
05:47sg2002noncom: Yep.
05:47noncomlooks like you feed it to cmd instead of clojure repl
05:48sg2002Yeah, seems so. Why would that happen?
05:51AeroNotixWhat other shells are available for Clojure?
05:51AeroNotix(ala python=>ipython)
05:52fredyrAeroNotix: does light table count?
05:53noncomsg2002: well, idk what is your setup... what you try to start and how
05:53AeroNotixfredyr: no
05:53sg2002Hmm. Just reinstalling package helped. Guess my cider installation got broken somehow. Plus it kind of updated from nrepl, haven't used clojure in emacs in quite a while.
05:53noncomoh well..
05:54sg2002Thanks for the hlep anyway.
05:55sm0kefor a class generated using gen-class how do i change the state variable?
05:56sm0keit seems to be a stupid final
05:56sm0keand i cant use atom
05:56sm0kecan i ask the state variable of gen-class to be non final
05:58sm0keanyone?
05:58clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
05:58sm0keclojurebot: dont mess with me
05:58clojurebotexcusez-moi
05:58sm0kegrrr
06:05sm0keso i want a mutable map in clojure, how do i do it?..there i said it
06:08AeroNotixsm0ke: ref/atom?
06:09ucbsm0ke: if this is related to gen-class, I believe you can manage mutable stable there
06:09sm0keAeroNotix: no i cant use atom, its not fucking serializable!!
06:09AeroNotixsm0ke: woah the hostility
06:09sm0kegod clojure makes it hard to mutate
06:09sm0keAeroNotix: sorry
06:09AeroNotixsm0ke: that's kind of the point
06:09fredyrsm0ke: transient map doesn't do it?
06:09AeroNotixtransients should do it
06:09sm0kefredyr: yes exactly
06:10sm0kefredyr: AeroNotix thanks i was looking into just that
06:10sm0keso transient map with assoc! and dissoc! right?
06:12fredyryes
06:12sm0kei hope there was a better solution
06:12AeroNotix,(def mut-map (transient {}))
06:12clojurebot#'sandbox/mut-map
06:12sm0keits like trading clojure goodness for serialization
06:12AeroNotix,(assoc! mut-map :k :v)
06:12clojurebot#<IllegalAccessError java.lang.IllegalAccessError: Transient used by non-owner thread>
06:12AeroNotixWHAT EVER
06:14sm0kethere should be a serializable stm solution
06:14fredyruser> ,(let [t (transient {})] (assoc! t :hello :world) (persistent! t))
06:15fredyr,(let [t (transient {})] (assoc! t :hello :world) (persistent! t))
06:15clojurebot{:hello :world}
06:18sm0kejust tell me transient doesnt imply what transient means in java
06:19fredyrit doesnt
06:19sm0kephew!
06:20clgvsm0ke: it is an optimization to build up collections faster. often the pattern is (->> some-coll (reduce (fn ..) (transient [])) persistent!)
06:20DerGuteMoritznote that you still need to reassign the var even with transients
06:20DerGuteMoritzthey do mutate in place but not reliably
06:20clgvusing a transient in a variable is not idiomatic afaik
06:21DerGuteMoritzsm0ke: can't you use a box type of sorts?
06:21DerGuteMoritzclgv: yeah, I'd think so, too
06:21DerGuteMoritzits purpose is to be used in a short-lived local context
06:21clgvsm0ke: you definitely should go for ref or atom depending on whether you need transactions or not
06:23pyrtsaOften you don't want to use transient anyway, because many core functions such as `into` do use transients internally. Just use an atom or a ref and do multiple updates at once when possible.
06:23sm0kewtf man! transientmap is not serializable!
06:23sm0kewtf
06:24sm0kefredyr: liar
06:24pyrtsaA transient map has many issues. For instance, you can't list its keys.
06:24fredyr:S
06:24DerGuteMoritz,(def foo (clojure.lang.Box. 1))
06:24clojurebot#'sandbox/foo
06:24DerGuteMoritz,(.-val foo)
06:24clojurebot1
06:24pyrtsaIt's intended for a very limited use case.
06:24DerGuteMoritz,(set! (.-val foo) 2)
06:24clojurebot2
06:24DerGuteMoritz,(.-val foo)
06:24clojurebot2
06:24fredyrsm0ke: sorry didn't know if it was serializeable or not
06:24fredyrsm0ke: just gave an option for mutable maps
06:25pyrtsasm0ke: What are you trying to do?
06:25sm0kewell
06:25DerGuteMoritzsm0ke: yo, no need to be hostile
06:25fredyrsm0ke: but if mutable map is what you want you might want to just use java.util.HashMap
06:25sm0kei just want a mutable fucking variable for my gen class which i can serialize
06:25DerGuteMoritzsm0ke: did you see my clojure.lang.Box example above?=
06:25sm0kefredyr: sorry
06:26DerGuteMoritzit's not serializable either AFAIK but it is trivial to make your own box type that is
06:26sm0kei dont understand why a transient map isnt serializable
06:26fredyr,(java.util.HashMap. {:wow :such :anger :doge})
06:26clojurebot{:anger :doge, :wow :such}
06:27sm0ke,(instance? java.io.Serializable (transient {}))
06:27clojurebotfalse
06:28sm0ke,(instance? java.io.Serializable {})
06:28clojurebottrue
06:28sm0ke,(instance? java.io.Serializable (clojure.lang.Box. 1))
06:28clojurebotfalse
06:28sm0kehmm
06:28sm0kewhat are the options
06:28pyrtsasm0ke: Probably because no one thought it should be. Transients were built to be just quick ways to construct persistent data structures.
06:28fredyr,(instance? java.io.Serializable (java.util.HashMap. {:wow :such :anger :doge}))
06:28clojurebottrue
06:28sm0kepyrtsa: so what should i do for a mutable serializable data strucutre
06:29pyrtsasm0ke: Try java.util.HashMap.
06:29sm0keheh
06:29DerGuteMoritzsm0ke: just roll your own serializable version of https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Box.java
06:29sm0keDerGuteMoritz: sounds like work!
06:29pyrtsasm0ke: No, seriously. Your use case doesn't sound like idiomatic Clojure, so why try to use idiomatic Clojure for it?
06:29DerGuteMoritzsm0ke: well or use Java's stdlib
06:30DerGuteMoritzsm0ke: if java.util.HashMap is what you want, why not use it?
06:30DerGuteMoritzright, what pyrtsa says
06:30DerGuteMoritzserializing clojure data is done via EDN usually
06:30sm0keyep, makes sense
06:30sm0keDerGuteMoritz: there i no explicit serialization
06:31DerGuteMoritzsm0ke: hm?
06:32sm0keDerGuteMoritz: the user of my api can create objects and send over network
06:32sm0keoh wait
06:32sm0kedoes java.io.Serializable iterface has methods for onSerialization? onDeserialization?
06:33sm0keyeah
06:33DerGuteMoritzsm0ke: well the wire format is your choice, you could use EDN instead of Java serialization
06:33sm0keonRead onWrite should do right
06:46sobelmy repl (1.5.1) prints 'nil' after every println. is that normal?
06:46sobelit also prints the parameter string, but i get a 'nil' printed on a new line too
06:46karlssobel: println's return value is nil.
06:46sobelah ok
06:47sobeli just didn't see it in any of the tutorial material i'm using so i wasn't sure if mine was subtly broken or what
06:47sobelbut that makes perfect sense
06:48sobelso far i'm liking http://www.braveclojure.com/do-things/ but pointers to other new-to-clojure material are welcome.
06:49sm0keugh.. overwring serializable methods left me wondering how to re initialize the final variable!
06:49sm0kei think the best option was what pyrtsa suggested
06:52CookedGryphonsm0ke: have you looked at nippy?
06:52CookedGryphonjust joining the conversation now, but if you're talking about serializing stuff to send over the wire, it's a really nice option
06:53sm0keCookedGryphon: yea but the problem is i cannot control serialization explicitly
06:54CookedGryphonwhat do you mean?
06:55sm0kewhat if the class you want to be serializable is just a instance variable in some other class user of the api created?
06:55sm0kewhich is being serialized by standard java api
06:55CookedGryphonit's compatible with normal java serializable
06:55CookedGryphonand it uses protocols so you can extend it to whatevery ou want
06:56CookedGryphonyou can even pass in a single extra option to encrypt it
06:57sm0keCookedGryphon: well yea i have been using it for a while, but i dont see how it solves the problem
06:57sm0kemay be i am not thinking otb
06:58CookedGryphontry explaining again, I don't get what your issue is
06:59clgvclojurebot allows defs?
06:59clgv,(defn f [x] (inc x))
06:59clojurebot#'sandbox/f
06:59clgvwow
06:59clgvthat's new
06:59clgv(f 0)
06:59clgv,(f 0)
06:59clojurebot1
06:59AeroNotix,(sandbox/f 10)
06:59clojurebot11
07:00sm0keCookedGryphon: make a class using gen-class which has a mutable variable and is serializable
07:00AeroNotix,(prn (repeat 10))
07:00clojurebot(10 10 10 10 10 ...)\n
07:00sm0keCookedGryphon: a map variable would be nice
07:01sm0keCookedGryphon: atoms are welcome for sake of idiomatic clojure writing
07:01AeroNotixclever girl
07:03CookedGryphon2 options, extend java serializable, job done, or (extend-freeze MyType 1 [x data-output-stream] (.writeUTF data-output-stream (freeze (.getMyMapVariable x))) .....
07:03CookedGryphonand then extend-thaw the other way
07:03CookedGryphonwrite each of the things you want to save to the output stream, then read them off the input stream in the same order
07:05clgvsm0ke: I wouldn't serialize clojure datastructures via serialization. you'll serialize a lot of useless internal structure of the datastructures
07:06AeroNotixsm0ke: https://github.com/edn-format/edn ?
07:07sm0kewhat if the class is being used by some java guy?
07:07sm0kehe doesnt know edn or nippy
07:07AeroNotixscrew him ;)
07:07AeroNotixj/k
07:07sm0kehe want to do a.x=2
07:07CookedGryphonhe can know edn
07:07sm0keAeroNotix: childish
07:07AeroNotixsm0ke: twas a joke
07:07CookedGryphonor you provide a wrapper which accesses it through your clojure api
07:08AeroNotixa wrapper would be nice
07:08sm0keok guys i am going to use a HashMap unless someone can come up with a way to overrite onRead and onWrite
07:25sm0keok .. but i still think transient should extend serializable
07:26sm0kedo you guys think someone should open a ticket for it? or is there some insight on why its no like so
07:37CookedGryphonsm0ke: you aren't supposed to let transients escape your function, trying to do anything like assoc or conj on a transient will throw an exception
07:37sm0keCookedGryphon: yea but there are assco! and dissoc!
07:37CookedGryphonto stop you accidentally leaking transients into a context requiring/expecting a persistent
07:38CookedGryphonyeah, but if you're not meant to let them out of your function, you most certainly aren't meant to keep them around long enough to serialise them
07:38sm0keCookedGryphon: i dont see what anything of this has to do with it being serializable
07:38CookedGryphonyou aren't meant to observe it outside of the function that makes it
07:38sm0keCookedGryphon: i can do a (def a (transient {}))
07:39sm0keobserve it from anywhere now
07:39CookedGryphonyes, you can do all sorts of things you're not supposed to
07:39CookedGryphondoesn't mean you should, and definitely doesn't mean it was the way it was intended do be used
07:40CookedGryphonif you don't want your datastructure persistent and immutable, don't use a persistent immutable datastructure, it's inefficient if nothing else
07:41sobelhaving read up on lock-free data structures, i am MUCH happier with immutable data structures
07:41sobellightbulb moment
07:42sobelit really took some theory reading to figure out the wisdom in it.
07:42CookedGryphontransient/persistent is meant to be used in very confined areas, where you can see everything that's happening to it and therefore easily reason about it - "If a tree falls in the woods, does it make a sound?
07:42CookedGryphonIf a pure function mutates some local data in order to produce an immutable return value, is that ok?"
07:42CookedGryphon(from http://clojure.org/transients)
07:44augustlsobel: just chiming in and seconding that you shouldn't use transient outside of function-local values
07:44augustlyou should always take and return immutable values. If you have a function that takes a transient as an argument, kittens will die, and so on :)
07:44sobelTL/DR: Concurrency is hard
07:44sobel:)
07:44augustltransients are only about performance
07:45lockslet's go shopping
07:45locksbut we take to take turns
07:45locksor we can go to different stores at the same time
07:45augustlalso, a transient isn't truly mutable. (do (def a (transient {})) (assoc! a :foo "123") (println (:a foo))) => nil
07:45locksand then meet somewhere
07:45locksunless someone is l--oh boy.
07:45augustlyou still have to use the return value from assoc! and friends
07:45sm0kewell CookedGryphon if a tree would fell in the forest i should be able to take it home and burn the wood
07:45sw1nnanyone around who's playing with om?
07:45sm0kelol
07:45sobeli would not be in a position to self-teach clojure if i hadn't tackled SQL already. i don't know how someone could transition from OO to FP without the same experience.
07:46sw1nnI've got a test project that renders some components, but I'm getting lots of 'mysterious' <span data-reactid=".r[4jfl6].[0].[0].[0].{cljs$lang$protocol_mask$partition0$}">167668511</span>
07:46lockssw1nn: not yet, but I bet dnolen knows a thing or too
07:47dnolensw1nn: it seems like you may be accidentally providing a data structure as the key, instead of some simpler value like a string or number
07:47CookedGryphonsm0ke: no you shouldn't. Clojure's constraints are what give it value. The fact that you can't just do whatever the hell you like, means that other people reading your code have a much easier time of it, and so do you as your codebase grows beyond a trivial size
07:47sw1nndnolen. thnks, that makes sense.
07:48augustlsobel: immutable values is the biggest takeway from Clojure into other environments imo :)
07:49augustlsuch benefits, wow
07:49sm0keCookedGryphon: i am sorry but i still dont see what the hell anything of that has to do with serializability
07:49sm0keCookedGryphon: just my opinion
07:49augustloh I just realized I meant sm0ke not sobel :)
07:49sobelso tabcomplete
07:50sm0keabsolutely, immutable is good
07:50edbondsw1nn, try to apply dom/* function. like (apply dom/div nil (map .....))
07:50augustlactually braincomplete, saw both your names ;)
07:50sobelso early, much squinting
07:50CookedGryphonsm0ke: because if you are serializing and then instantly deserializing within the tight inner loop of a single function, you're doing something very very wrong and misunderstanding the fundamentals
07:50sobelsry, done dogeing
07:50CookedGryphonbrb
07:51sm0keCookedGryphon: ok
07:51lockssobel: much apology, such sincerity
07:51augustlvery meme :)
07:52sm0kei dont know man, the fact that no one else agrees with me must be beacuse i am wrong
07:52augustlsm0ke: agrees with you that passing around transients is OK?
07:52edbonddnolen, how to om/transact! without re-render?
07:52dnolenedbond: not currently possible, but what's the use case?
07:53sm0keaugustl: i said serializability, you CAN pass them around doesnt meant they SHOULD
07:53sm0keaugustl: i never made that statement
07:53augustlsm0ke: yeah I agree
07:54sm0keaugustl: serializability is nothing, given things you can already do with them
07:54sm0keso i dont see the fkn point
07:55edbonddnolen, thanks. This is very specific, will try to find another way to block until render finish.
07:56dnolenedbond: re-renders are never immediate
07:57edbonddnolen, only on requestAnimationFrame, I know
07:57fredyr_dnolen: yesterday i ran into trouble when trying to destructure a cursor in om, https://gist.github.com/fredyr/8424220
07:58fredyr_dnolen: is there something obvously wrong in there, would you say?
07:59edbondfredyr_, did you try lein cljsbuild clean and compile again?
08:00fredyr_dnolen: it works fine if I do (om/value state) though
08:00dnolenfredyr_: did you extend-type string to ICloneable?
08:00fredyr_dnolen: no i haven't
08:01fredyr_dnolen: should i?
08:01dnolenfredyr_: hmm I don't know, in the middle of some other stuff. But that seems like a bug to me file a GitHub issue please
08:02fredyr_dnolen: ok sure
08:02fredyr_dnolen: is the gist info enough or would you like something more complete?
08:03dnolenfredyr_: gist is minimal enough, but please put the contents directly into the issue, thanks.
08:03fredyr_dnolen: ok will do
08:05edbondfredyr_, what om, cljs versions do you use? I pasted your code and see div > h2
08:05fredyr_edbond: 0.1.6
08:05edbondfredyr_, if you had previous versions may be worth to do clean, both lein deps and cljsbuild.
08:06edbondsometimes it helps for me
08:06fredyr_edbond: yeah that might be a reason
08:06fredyr_edbond: lein cljsbuild clean
08:06edbondand lein deps clean
08:07fredyr_edbond: ah that one i haven't done before
08:09rurumate_I have a map from strings to vectors of strings like this: {"a" ["foo" "bar"] "b" ["baz"]}. how to invert?
08:09rurumate_should become {"foo" "a" "bar" "a" "baz" "b"}
08:10AimHereI'd probably knock up something with reduce-kv for that kind of problem
08:11fredyr_edbond: no luck unfortunately with cleaning
08:12edbondfredyr_, hm, I can paste compiled js probably to compare
08:13edbondfredyr_, clojurescript 0.0-2138, lein-cljsbuild 1.0.2-SNAPSHOT
08:13edbondom 1.0.6
08:14edbondfredyr_, did you try om/examples, they works?
08:14AimHere,(reduce-kv (fn [m k v] (apply assoc m (interleave v (repeat k)))) {} {:a [:foo :bar] :b [:baz]})
08:14clojurebot{:baz :b, :bar :a, :foo :a}
08:15lumafi,(into {} (for [[k vv] {"a" ["foo" "bar"] "b" ["baz"]}, v vv] [v k]))
08:15clojurebot{"foo" "a", "bar" "a", "baz" "b"}
08:16fredyr_edbond: so i can get my code to work if i wrap the cursor with om/value before accessing author
08:17fredyr_edbond: and i do some build-all stuff and so on that works fine
08:21testclohow to destruct a map? for the following e.g. I want to get the key and value for each pair
08:21testclo(def a {1 2,3 4})
08:21testclo(map (fn[key val]) a )
08:23AimHere,(map identity {:a 1 :b 2 :c 3})
08:23clojurebot([:a 1] [:c 3] [:b 2])
08:23AimHereThat sort of thing?
08:23jcromartie(seq {:x 1 :y 2})
08:23jcromartieerr
08:23AimHereWhen you treat a map as a sequence, it turns into a sequence of [k v] pairs
08:23jcromartie,(seq {:x 1 :y 2})
08:23clojurebot([:y 2] [:x 1])
08:24fredyr_edbond: im on cljs 0.0-2127, that could perhaps be the reason
08:24jcromartie,(map type {:x 1 :y 2})
08:24clojurebot(clojure.lang.MapEntry clojure.lang.MapEntry)
08:25jcromartie,(map count {:x 1 :y 2})
08:25clojurebot(2 2)
08:27fredyr_edbond: OHHHZOMG
08:28edbondfredyr_, did that helps?
08:29fredyr_edbond: it did!!
08:29fredyr_edbond: now it works fine, so it seems like there was something in the cljs version
08:29dnolenfredyr_: oh yeah, the README says 2138
08:29dnolenfredyr_: but perhaps I should make that more clear
08:36fredyr_dnolen: sorry to bother you with that
08:38noncomare there already some examples or tutorials on macro architecture of guis with core.async? not just one or two elements or a simple website, but full-scale uis?
08:39noncomi've been looking for examples on csp but did not find
08:49fredyr_edbond: thanks very much
08:49edbondfredyr_, you are welcome
08:50quizdr,(println "thanks everyone, see you tomorrow")
08:50clojurebotthanks everyone, see you tomorrow\n
09:11sritchieI'm going to brave it and ask a shell question here… do you guys know why this works with &&, but fails with ||?
09:12sritchieif [ -z $CIRCLE_CI ] && [ $CIRCLE_BRANCH != "develop" ]; then echo "WORKING"; fi
09:12sritchie-bash: [: !=: unary operator expected
09:12sritchiewhen I use ||
09:12clojurebotHuh?
09:13hyPiRionsritchie: I guess $CIRCLE_BRANCH results into nothing, and then you get the expression [ != "develop" ]
09:13hyPiRionso wrap it in ""s
09:13sritchieah, gotcha
09:14hyPiRionsame with $CIRCLE_CI I guess
09:14sritchiestrangely that one works, even if I sub in some random var
09:14sritchiecool, makes sense
09:14sritchiemuch like when I learned clojure, digging into bash is changing the way I think about programming :)
09:15demon386In a good way?...
09:15sritchiehaha, not yet
09:17hyPiRionsritchie: I feel that with every language with some new concept I haven't yet learned, which usually is a net gain
09:18hyPiRionBash gave me the value of printing to stdout
09:18hyPiRionor uh, "value"
09:31locksdnolen: are you planning on having a section on your cljs tutorial on how to tweak LT itself?
09:38rurumate_AimHere: thanks mate, sorry for late reply
09:39rurumate_it seems to work, amazing stuff
09:51instilledhi. i'm trying to remove maps from a list where a-key matches an item in a list, i.e something like this: (map #(if ((:a-key %1) in list) nil %1) some-list-of-maps). Is there an idiomatic clojure way of doing this?
09:53hyPiRioninstilled: so you have one list with maps, one key, and one list with items?
09:57instilledhyPiRion: I have a 'list of maps' and a 'list of values' and would like to remove all maps the 'list of maps' where a certain key, let's say :x, matches a value in the 'list of values'
09:58hyPiRioninstilled: okay, gotcha
09:58instilledhyPiRion: i have it working but it feels like there is a more clojure way of doing the same thing….
09:58hyPiRioninstilled: so the "safest" way of doing it would be this: (let [list-set (set item-list)] (remove #(some->> (find % my-key) second (contains? list-set)) list-of-maps))
09:59instilledihyPiRion: i use filter and a set as a predicate...
09:59hyPiRionthis won't remove the map if the key is not existant, and key can be nil
10:00hyPiRionalthough, ugh, this won't work if the value is nil.
10:02hyPiRion(let [list-set (set item-list)] (remove #(some-> (find % my-key) (as-> tuple (contains? list-set (second tuple)))) list-of-maps)) should also preserve nil values, if that's what you're looking for
10:02instilledhyPiRion: ok. right. (some #{"val"} nil) does return nil. and it shouldn't in my case. I'll get my head around you solution …
10:03AeroNotixI'm using SSL+jetty, when I try to `lein run' it gives me a java.net.SocketException: Permission denied. Trying to run on SSL.
10:03instilledhyPiRion: cheers a lot!
10:03hyPiRioninstilled: I would guess my first solution is essentially the same as yours, just a bit more convoluted. I attempted to handle nil keys and nil values with it, but failed :p
10:04hyPiRionAeroNotix: I would guess you need permission to listen to those ports. Ports below a specific range usually must.
10:05AeroNotixhyPiRion: sure, but it's running on 8080
10:06AeroNotixhyPiRion: and I need to have the clojure jar running SSL due to some legal restrictions, so I can't just have nginx proxy to it or w/e
10:07hyPiRionthen I'm not sure. Are you sure the httpS port is running on 8080 and not the http one? https is by default 443 and won't change if just http changs.
10:08hyPiRion(But yeah, it's defineatedly configurable.)
10:08AeroNotix:ssl-port 8080
10:08AeroNotixin the jetty optoins
10:08hyPiRionokay, then I have no idea.
10:09AeroNotix:(
10:09hyPiRionYou probably need a certificate for it, but I don't think it should give a socket exception
10:09AeroNotixIt works when I run it as root
10:10pcnAeroNotix: then it is trying to bind to a low port
10:10AeroNotixpcn: It's running on 8080
10:10AeroNotixwhich is not a privelidged port
10:10hyPiRionAeroNotix: have you changed :port to something else?
10:11pcnWhat hyPiRion said
10:11AeroNotixhyPiRion: :port is blank
10:11AeroNotixI didn't set it
10:11pcnSet it to something else and try
10:11AeroNotixsecond
10:11hyPiRionWhat pcn said
10:11hyPiRion:p
10:11AeroNotixthat works :)
10:11AeroNotixit probably has a default
10:11pcnBecause it's possible that by making it empty, you're telling jetty to bind to port 80
10:12hyPiRionor in this case, attempt to bind to port 80
10:12hyPiRionthen fail horribly
10:12AeroNotixyeah, the default for :port must be 80
10:12AeroNotixhttp://clojuredocs.org/ring/ring.adapter.jetty/run-jetty
10:13AeroNotixit mentions other defaults... but not :port
10:13hyPiRionyeah, that should definitely be fixed
10:13AeroNotixindeed
10:16hyPiRionAeroNotix: ah, it's just not updated
10:17hyPiRionhttps://github.com/mmcgrana/ring/blob/master/ring-jetty-adapter/src/ring/adapter/jetty.clj#L62-L77 <- actual docstring
10:18AeroNotixsweet!
10:37gfredericksis using long names for bit operations some sort of lisp tradition?
10:39gfredericks,'(|| && << >> <<< >>>)
10:39clojurebot(|| && << >> <<< ...)
10:39gfredericksI guess the one we can't get is ^
10:39hyPiRiongfredericks: At least we don't have double-float-negative-epsilon and friends
10:39CookedGryphonit's not really a language designed for a lot of bit-twiddling
10:39CookedGryphonyou only give short names to things you use every day, otherwise you give it a descriptive name
10:40hyPiRionor least-negative-normalized-double-float
10:45gfredericksFP units should be separate chips like GPUs
10:45arrdemgfredericks: nooooooo
10:45arrdemgfredericks: dude. that would suck ass from a performance standpoint.
10:45gfredericksdo your whole computation on that chip them
10:45gfredericksthen*
10:46arrdemgfredericks: IEEE floating point in software? why....
10:46gfredericksnot in software
10:46gfredericksjust not all wrapped up in the main CPU
10:47gfredericksI _would_ claim that the FP unit isn't used much on most computers, but comically that's probably not true thanks to people building websites
10:47gfredericksthere's a bimodal use case for FP
10:47winkand I thought you proposed a functional programming unit for a second...
10:48wink.oO( i.e. LISP machine )
10:48arrdemwink: that's even sillier than saying we should throw away the floating point unit...
10:49gfredericks"Floating point numbers are useful for certain kinds of scientific computing and also for building a blog."
10:49progo:)
10:49arrdemthe issue with having offchip components is that the IO times are so bad that unless you have an exceedingly large workload the IO time dominates
10:50gfredericksarrdem: I'm focusing on the world I work in where the FP unit is totally unused and so there are no consequences
10:50hyPiRionhah
10:50gfredericksother worlds are obviously irrelevant
10:50winkarrdem: pff :P
10:50arrdemgfredericks: and one of my involvements here at school is high performance scientific computing, so I can tell you that's silly :D
10:51gfredericksscientists are a bunch of integer-haters
10:51gfredericksdown with hardware!
10:52nDuffHeh.
10:52gfredericksand finally blogs became possible
10:52arrdemgfredericks: lolz
10:53arrdemnDuff: i48g
10:53arrdem*i486
10:54gfredericks386 was ints only?
10:54arrdemgfredericks: yeah the original 386 architecture didn't have all the floating point augmentations
10:55chronnogfredericks: yout had to use a math coprocessor if you wanted FP
10:55john2xwhat's the standard filetype for storing app settings/metadata? e.g. yaml for Ruby/Python projects, json for js projects
10:55chronnogfredericks: http://en.wikipedia.org/wiki/Coprocessor#Intel_coprocessors
10:55john2xor is it project.clj? (can I reference keys in project.clj in a project?)
10:56arrdem$google clojure edn
10:56lazybot[edn-format/edn · GitHub] https://github.com/edn-format/edn
10:56arrdem$google tools reader edn
10:56lazybot[clojure/tools.reader · GitHub] https://github.com/clojure/tools.reader
10:56arrdemjohn2x: ^
10:57arrdemjohn2x: project.clj is specific to the leiningen build system... your app won't ever be aware of what's in there.
10:57gfredericksbring back the coprocessor!
10:57chronnogfredericks: lol
10:57john2xarrdem: thanks. yeah, that's what I thought.
10:57CookedGryphonjohn2x: or if you want a little extra help https://github.com/TouchType/conf-er
10:57arrdemgfredericks: if you want to _add_ some coprocessors I'm okay with that... using such additions as an excuse to remove the FPU is silly.
10:57arrdemthat said webdev is silly
10:59pcnarrdem gfredericks 386 sx was no fp, dx had both right?
10:59arrdemhuh. looks like there was an FPU standard prior to the i486.. http://en.wikipedia.org/wiki/Intel_80387#80387
10:59john2xCookedGryphon: even better. thanks!
11:07CookedGryphonjohn2x: no problem. Let me know if you have any problems or feature requests
11:08john2xCookedGryphon: will do, thanks.
11:12AeroNotixare multimethods the best way to dispatch on type when working with built in types and java classes?
11:12AeroNotixI want to dispatch a function on a map and a java class.
11:12`cbpif it's just type you can use protocols
11:12AeroNotixboom
11:13`cbpheadshot?
11:14AeroNotixHEADSHOT
11:23katoxarrdem: it helped, I had one of those ;)
11:31CookedGryphonhow do i "copy" a channel in core.async
11:32CookedGryphonI have something pulling from it, and I want something else to be able to observe the same data without affecting the first thing
11:32rkneufeldCookedGryphon: mult, no?
11:33CookedGryphonrkneufeld: do i need to do that to the top level one and change my existing loop to tap from that mult?
11:34CookedGryphonor does mult not consume the channel you apply mult to?
11:34rkneufeldI'm not sure, I've never used it–just aware of it.
11:34rkneufeldI'd have to read http://clojure.github.io/core.async/#clojure.core.async/mult to say better.
11:35CookedGryphonyeah, I'm reading that, still not clear though
11:35stuartsierraI don't think you can 'copy' a channel without consuming it.
11:36CookedGryphonstuartsierra: that was my thinking, okay, so I'll mult the incoming channel and change the loop already consuming it to consume a tap instead and it's all good
11:36CookedGryphonthanks
11:36stuartsierrayes
11:36stuartsierrayou're welcome
11:36arrdemhum... anyone care to comment on ztellman's gloss?
11:36mdrogalisI was under the impression that that was what map was for.
11:36mdrogalisOr this isn't a one-time-only copy?
11:37CookedGryphoni mean I want to observe the data that's going through a channel to something else without affecting the existing observer
11:37mdrogalisCookedGryphon: Ah, I understand.
11:42jjttjjare there any decent guidelines for when to switch from positional parameters to a single map as a parameter? Or when is it better to use destructuring to just do named args like (foo :animal "cat"), etc
11:42jjttjjthe clojure-style-guide says to avoid using more than 4 positional params but what if these are db "add" functions and half of your models have only a few fields and the rest have a lot more than 4
11:43andyfIs there a way to set Leiningen :source-paths from the command line?
11:43jjttjj(I get hung up on a lot of stupid things when I should just be building stuff, just curious what other peoples' opinions are on this)
11:44stcredzerojjttjj: I think that's normal. If you're not doing that as a programmer, you're probably not trying.
11:45jjttjjstcredzero: good to know :)
11:46gfredericksandyf: like for a single run of `lein something`?
11:47andyfgfredericks: yes. If editing ~/.lein/profiles.clj is the next best thing, I can script that, instead.
11:49gfredericksandyf: it would surprise me if you could; integrating environ w/ leiningen sounds like an interesting idea
11:50locksjjttjj: I don't have an answer, but I'll validate your concerns in that I think about this sort of thing often
11:50clgvCookedGryphon: you can check whether you can copy the buffer of a channel - if so you can plug them together manually to get hold of the buffer
11:51stcredzerolocks: In other words, you're telling him he should be worried, but not to be worried about the fact he is worried.
11:53CookedGryphonclgv: explain? Do you mean poking about in the internals? or am i misunderstanding you
11:53stuartsierrajjttjj: It really comes down to developer experience. If you're having trouble remembering the argument order, or creating bugs by getting it wrong, it's probably time to switch to maps or keyword args.
11:53gfrederickshas the clojurewest.org site been down for 24 hrs now?
11:53stuartsierragfredericks: works for me
11:54jjttjjstuartsierra, locks: thanks for the input
11:55clgvCookedGryphon: you can create a buffer manually and then create a channel with it. if you keep the buffer around and buffers can be copied, you can copy the content of the channel without consuming it
11:56clgvCookedGryphon: oh humm well, that assumes that the buffer is some mutable thingy which might not be true in case it is a persistent data structure
11:56CookedGryphonI think for this particular use case mult/tap is what I want, as it makes it apparent what's happening, but that sounds like a neat trick I might play with later (I want to make something to do riemann monitoring of throughput/speed etc)
11:58clgvok buffers are implemented via linkedlist in a mutable fashion^^
11:59gfrederickshuh maybe my office internet connection provides every site except clojurewest.org
11:59gfrederickspresumably it is NSFW
12:01gfredericksoh it only works with www
12:01gfredericksI doughnot understand the internets
12:01stuartsierragfredericks: Odd, it redirects to www. automatically for me.
12:02gfredericksyes I can't get any of my coworkers to reproduce this
12:03gfredericksso it's local to my machine, but happens both in the linux virtualbox vm _and_ in OSX
12:03gfredericks`curl clojurewest.org` hangs while www succeeds
12:03gfredericksI give up computers
12:03stuartsierraTry clearing your DNS cache (I don't remember how to do that)
12:04deadghostcomputers are overrated anyways
12:11technomancyandyf: the update-in task is basically for that
12:12gfrederickstechnomancy: WAT is that
12:13lsdafjklsdAnyone know how to hook a browser repl up to a clojurescript project? I've got the script tag in my <head></head> section and can see it connected, but not sure how to send commands to the browser from my cljs file
12:13lsdafjklsdin a LightTable context
12:13lsdafjklsdforgot to mention that, trying to get lighttable working
12:13andyftechnomancy: cool. Looks like something like 'lein update-in :source-paths concat :test-paths ...' should append test paths to source paths for that command?
12:14andyfI'm just looking for something that will let me do 'lein check' on all of the source and test files, without having to edit project.clj if possible, since I want to do it on about 60 projects.
12:14technomancyandyf: I don't think it will look up keywords in the project map like that
12:15technomancyyou need to provide whatever you want to concat as an arg
12:15technomancygfredericks: it's a way to sate my endless desire for higher-order tasks is all
12:15andyftechnomancy: OK. I think I can get it down to a few cases, perhaps. Thanks for the tip.
12:15gfrederickstechnomancy: am I crazy or does this make it difficult to override something?
12:15gfredericksi.e., there is no assoc-in
12:15jjl`_does anyone know if anyone has tried to update ritz-nrepl's emacs bindings to work with cider?
12:16technomancygfredericks: there's a special-case for the base map
12:16rurumate_,(type '2)
12:16clojurebotjava.lang.Long
12:16rurumate_why is '2 not a symbol?
12:16gfrederickstechnomancy: yeah I just tried `lein update-in '' assoc :foo "bar" ...` and that worked
12:17gfredericksrurumate_: ' doesn't create symbols, it just suppresses evaluation
12:17technomancynote you have to double-quote strings due to shells being shells
12:17gfredericks,(map type ['true 'nil 'false ':foo])
12:17clojurebot(java.lang.Boolean nil java.lang.Boolean clojure.lang.Keyword)
12:17technomancyit's easy to get a symbol when you meant to pass in a string
12:17gfredericksclojurebot: shells |are| shells
12:17clojurebotc'est bon!
12:21gfrederickstechnomancy: how to update the base map should prollably be in the docstring eh? I'll go fiddle that
12:22technomancygfredericks: I think it is?
12:22technomancyis says use a colon instead of an empty string, but it still works
12:22gfrederickstechnomancy: clearly I do not read anything
12:23technomancyhow can you be expected to, with today's active lifestyles
12:35justin_smithman, Polvo is a nostalgia trip
12:36matt444Is there a version of partial that executes a function with no arguments?
12:36CookedGryphonmatt444: uh... the function itself?
12:36justin_smithwhen I was a little kid looking for harsh noise tapes at the weirdo record store, they would always be playing the latest Polvo / Trumans Water / Sonic Youth / whatever on the sound system
12:36technomancymatt444: like you would with currying? not to my knowledge
12:36justin_smithbecause that was the "cool weird music" at the time
12:36pyrtsa,((partial inc) 1)
12:36clojurebot2
12:36matt444technomancy: arg, ok thanks
12:37technomancymatt444: partial doesn't know anything about the underlying function's arity afaik
12:37pyrtsa,((partial +))
12:37clojurebot0
12:37matt444the docs suggest they expect at least an arity of 1
12:38BronsaI really wish IFn had a .arglists
12:38technomancyBronsa: I'd settle for metadata
12:38technomancyactually I'd prefer it, but whatever
12:38pyrtsamatt444: You're right, the docstring of partial is inexact.
12:38Bronsatechnomancy: not reilable
12:39technomancyit'd be reliable if all the HOFs knew about it
12:39technomancynot something you can necessarily retrofit though
12:40andyfBronsa: So I'm liking Sean Corfield's suggestion of a linter that warns about vars with :arglists that do not match the arities of the fn that is its value. Seem like a reasonable idea to you, too?
12:40matt444(defn solo [fun] (fn [& args] (fun)))
12:40Bronsatechnomancy: we already have this problem in eastwood/tools.analyzer where some functions (even in clojure.core) alter their :arglists for documentation purposes
12:40andyfBronsa: But the clojure.core versions only do it for macros, I think, which does not affect the analyzer?
12:40technomancyoooh sketchy
12:41andyfBronsa: or at least not the wrong arity warning?
12:41technomancyLeiningen has something like a :help-arglists so you can do that without screwing with the actual value but still provide helpful hinting
12:41Bronsaandyf: yeah right, but they set the bad example
12:42Bronsaandyf: btw warning about not-matching :arglists sounds reasonable
12:42andyfWe could steer people with the warnings to use a different keyword like :help-arglists for Clojure, too.
12:42BronsaI guess the problem is that clojure.core/doc uses :arglists
12:42andyfEspecially if Leiningen had a modified version of doc that checked for :help-arglists before :arglists :-)
12:42technomancymaybe :human-arglists
12:43technomancyandyf: it's just the help task
12:43matt444#() is what I need
12:43matt444except that it can't be nested
12:43andyftechnomancy: Sure. I mean that there is apropos-better in reply, I think, and it could rebind doc, too.
12:46ior3knot sure if on-topic, but anyone read: http://prog21.dadgum.com/189.html ? Specifically, would anyone be able to shed some light on what is meant by "If I were writing such a simulation in a functional style, then the fixes listed above would be there from the start. It's a more natural way to work when there aren't mutable data structures."?
12:48zerowidthior3k: he's referring to an earlier statement, re: "The fix is to never pollute the simulation by adding new objects mid-frame. "
12:48zerowidthbasically, not mutating state until you've calculated everything you need to calculate
12:48koalallamaany tips on how to avoid Java OOM with thise code: https://gist.github.com/ctrlrsf/12ea523e63539f166375
12:49zerowidthif you're doing the simulation with FP, you'd be unable (or it'd be more obviously a problem) to do that
12:49ior3kzerowidth: right, but given my very limited understanding about functional programming, I'd probably do exactly the same... or maybe I'm misunderstanding. If I updated an atom, wouldn't the change be immediately visible?
12:49zerowidthwell, i can tell you what i'm doing for a very simple physics thing
12:50zerowidthwhich i think falls under the purview of a functional simulation ...
12:51zerowidthi have a single atom for the entire state, and instead of updating each piece of it (and replacing the atom), i do it all at once: (swap! state update-physics time-delta) where update-physics does something like (assoc state :positions (updated-positions (:positions state)))
12:52zerowidthand if that's not idiomatic, i'm all ears for code critique
12:52zerowidthior3k: so i *think* that's what he means.
12:52S11001001koalallama: allnums and zerocounts can't be global defs
12:53S11001001koalallama: make them functions instead and it's a different story
12:53ior3kzerowidth: don't know if you read Brian Marick's book (https://leanpub.com/fp-oo) but he mentions a style that he calls "data-flow style" which seems to be the style you mentioned
12:53S11001001koalallama: well, zerocounts anyway. Forget whether it matters for allnums.
12:54koalallamacan you elaborate why/how that would affect its memory footprint?
12:54koalallamait runs for about 60mins on my machine and then dies. I presume because the map keeps growing as range generates higher numbers
12:54S11001001koalallama: https://stackoverflow.com/questions/2214258/holding-onto-the-head-of-a-sequence
12:54michaniskinare ring middleware functions a kind of monad? if so, what is the name of this monad?
12:54coaxmeta1hey does anyone do clojure in vim with slimv? is that viable?
12:55koalallamaok, thanks
12:55technomancycoaxmeta1: I think everyone has migrated over to fireplace
12:55S11001001michaniskin: what's the type of a ring middleware function?
12:56coaxmeta1technomancy: oh I didn't even know about that. THanks. tpope makes a lot of good vim plugins
12:56michaniskinS11001001: (fn [continue] (fn [arg] ...))
12:56technomancyFSVO everyone
12:56michaniskinS11001001: the inner fn is expected to call the continuation and return the result
12:58S11001001so what is that (a -> z) -> b -> z? Yeah I think there's a monad there over the type of values passed to `continue', or `a'.
12:59michaniskinS11001001: to be more precise, there is a Handler type which is a function (Map -> Map)
13:00michaniskinS11001001: then there is the wrapper, which is what i'm interested in, which is (Handler -> Map), i think
13:01S11001001michaniskin: if you don't have a type variable you don't have a monad. That doesn't mean the interpreter isn't permitted to constrain it in some way, because a method of interpretation isn't required to form a monad. If you let the argument to continue vary freely you have a monad.
13:02S11001001s,vary,varying,
13:02S11001001er, no I was right the first time, syntactically
13:04knyonIs there a particular idiom for reading an EDN from the classpath?
13:04knyonseems I see a lot of the (-> "some.edn" clojure.java.io/resource clojure.java.io/reader java.io.PushbackReader. clojure.edn/read) pattern
13:04knyonseems verbose
13:04justin_smithknyon: (read (io/reader (io/resource "classpath/relative/file.edn")))
13:04technomancyyou can slurp from a resource if it's small
13:05justin_smithtechnomancy: but then you need to read-string, and you could just read
13:05michaniskinS11001001: thanks
13:05justin_smithknyon: oh yeah, I forgot the PushbackReader step, my bad
13:06knyonjustin_smith: does clojure.core/read work as clojure.edn/read?
13:06justin_smithknyon: yeah, it is a bit odd that there isn't a shorthand for that (read-resource modeled on read-string perhaps?)
13:06justin_smithknyon: yeah, but clojure.edn/read is actually better
13:06justin_smithusually
13:06technomancyknyon: depends where the data is coming from
13:07technomancyuse edn if it's unsafe, use read if it's a configgy thing
13:07knyonOh, that's interesting
13:07andyfknyon: Read this before using clojure.core/read. There are valid use cases, but be wary
13:07andyfknyon: http://clojuredocs.org/clojure_core/clojure.core/read
13:07knyonandyf: justin_smith: much appreciated. That about covers my question
13:08justin_smithtechnomancy: well, how often would a classpath resource be unsafe? usually it is something you bundled and deployed
13:08technomancyheh, true
13:08technomancyif a user can write to your classpath you've already lost
13:09knyonmaybe for clear semantics, it's better to go with clojure.edn
13:09knyoneven if it's safe
13:09technomancyit's less flexible
13:10technomancyusing the reader lets them have an escape hatch if they need to calculate something in the config file due to you not having thought of a certain case or something
13:11knyonFair enough, but that should be part of the semantic decision. clojure.edn/read means 'hey, I expect an edn and I expect you not to evaluate anything in it". core/read otherwise
13:11S11001001michaniskin: http://lpaste.net/98542
13:12technomancyI'm a big fan of "declarative with escape hatches" for config
13:13technomancybit if it's statistical data or something then yeah, it's overkill
13:13S11001001michaniskin: (because fmap is free an RMF interpreter that takes the In -> Out request handler and an RMF In is not necessary)
13:14michaniskinS11001001: that's a little over my head at the moment. i think i need to research more before i can ask the question i really want to ask :)
13:18rjknighti don't suppose there are any instaparse gurus around?
13:19rjknighti'm probably doing something extremely stupid but can't figure out exactly what it is
13:19hiredmanI am not a guru, but I have used it and think it is great
13:19CookedGryphonalso not a guru but have used it, put your problem in a gist and we'll see?
13:20rjknightwill do
13:21knyonIs there some handy std lib function which takes a namespace and provides a path? Eg, "." and "-" to "/" and "_". Not hard rolling my own, but if it's available
13:21matt444Can someone give me a sanity check? Compiler is complaining about recur argument count mismatch: https://www.refheap.com/24019
13:22CookedGryphonmatt444: what's that anonymous function doing there?
13:22CookedGryphonmatt444: you're trying to recur into an anonymous function with one argument
13:22CookedGryphongiving it three arguments
13:22Bronsamatt444: you cannot use recur like that
13:22matt444i'm trying to recur back up to crawl-items
13:22hiredman#() is a new function, and a new recur point
13:22koalallamaS11001001: if you're still around, can you check https://gist.github.com/ctrlrsf/12ea523e63539f166375
13:22matt444gotcha
13:23matt444so how do i do the thing i'm trying to do?
13:23Bronsas/recur/crawl-items
13:23koalallamaS11001001: I read the SO article, and I suspect reduce is holding onto the head of zerocounts. Not sure how to avoid that though.
13:23matt444ah, ok
13:23matt444thanks everyone
13:24CookedGryphonkoalallama: you're keeping a reference to the whole list generated by map in zerocounts, and it can't throw it away because you're referencing it later on to print out the last item, so it holds on to the whole list
13:25koalallamaCookedGryphon: right, but what would be the stragety to avoid this?
13:25koalallamaCookedGryphon: a doseq and walk the map?
13:25koalallamas/map/sequence/g
13:25rjknighthiredman, CookedGryphon: https://gist.github.com/robknight/8441515
13:26CookedGryphonkoalallama: well do you need to print the last item of zerocounts for a start?
13:26koalallamayup..
13:26rjknightwhat i'm expecting is that each of those numbers parse as a Word, and the spaces as Whitespace
13:27rjknightit works with 7 numbers, but bombs out with 8 or more
13:28hiredmanbombs out how?
13:28rjknightout of memory
13:28hiredmanah, too many possible valid parses I guess
13:29hiredmanpossibly due to all the use of *
13:29CookedGryphonhiredman: you are saying any number of whitespace characters is whitespace, and any number of characters is a word, and then any number of any number of those is a contentLine
13:29CookedGryphontry taking out the + from ContentLine
13:29rjknightok
13:30CookedGryphonor the * from whitespace?
13:30rjknighti'm porting this over from peg.js, where something pretty similar worked
13:30hiredman* is typically zero or more, + is 1 or more
13:32rjknightok, that worked, at least for the out-of-memory errors :)
13:33CookedGryphonkoalallama: you would be better off just working out that last item separately, you could even get rid of the map entirely and just use reduce with an accumulator
13:34hiredmanI almost never use ()*, I tend to prefer recursive rules, but that seems like just a matter of taste
13:34CookedGryphonkoalallama: but similarly you would get best performance if you make sure you don't keep a reference to allnums so it can be disposed of
13:37S11001001koalallama: do it backwards starting with a backwards range, then (last zerocounts) becomes (first zerocounts)
13:38S11001001koalallama: and moving that up to before the reduce call because you don't need to hold onto zerocounts past the reduce call.
13:39koalallamaCookedGryphon: thanks for your input. I've changed code to a doseq and memory is steady now. https://gist.github.com/ctrlrsf/12ea523e63539f166375
13:40CookedGryphonkoalallama: that's not good, sorry
13:40CookedGryphonkoalallama: you shouldn't be using doseq for this, doseq is for side effecting functions only, and you shouldn't be using def inside a call like that
13:40CookedGryphonmy memory steady version looks like this: (reduce (fn [acc x] (+ acc (count (filter #(= \0 %) (str x))))) (range (inc maxnum)))
13:40koalallamadon't be sorry :)
13:41koalallamamakes sense
13:41CookedGryphonkoalallama: perhaps a little premature, but you could make this really fly with reducers :P
13:42koalallamayeah, a bit :)
13:42zerowidthCookedGryphon: would love to see that
13:43przemek_hi,
13:43rasmustoprzemek_: ,:hi
13:43przemek_I'm trying to migrate from intelij to emacs and there is one issue I have been trying to solve but failed
13:43przemek_I can't make it reformat code like idea does
13:44przemek_what can be done is "indenting"
13:44przemek_which doesn't format stuff like this: "(for [a (range 1 100) ) ]
13:44CookedGryphonzerowidth: I had a little look, but apparently reducible range hasn't made it into reducers yet which makes it trickier :(
13:45przemek_the thing is there are white spaces after ( or before ]
13:45zerowidthCookedGryphon: without knowing how reducers work, could you make a lazy-seq by hand or something that would work the same?
13:45TimMcprzemek_: Reindenting only handles leading whitespace.
13:45przemek_idea can remove trailing and adjacent whitespaces + indent linens
13:45przemek_I am sure it is doable in emacs
13:46technomancyM-x delete-trailing-whitespace
13:46przemek_but I suppose it has to do with language code style
13:46technomancynothing for stuff inside the parens though; that's just weird
13:46przemek_I know
13:46przemek_have tried that
13:46CookedGryphonzerowidth: reducers avoid lazy seq overhead, they use random access vectors and build up a "recipe" for making and combining the values
13:46CookedGryphonso you don't have to step through one at a time
13:46zerowidthoh, neat
13:46technomancyproblem with deleting trailing whitespaces is that it zaps commas too
13:47CookedGryphonso the reduce can be using all your cores to do different chunks of the range at a time then combine them
13:47przemek_so what I can do is to use paredit mode and do my best not to introduce whitespaces inside S-exps?
13:47przemek_kinda sad
13:47przemek_:)
13:47zerowidthCookedGryphon: is it easy to convert a map on a fixed sequence to a reducer? how does that compare with pmap?
13:48technomancywell you already have to be careful not to introduce whitespace inside the middle of an identifier
13:48CookedGryphonzerowidth: trouble is, just that range as a vector uses up a lot of memory, so you need a reducers friendly one which doesn't actually generate a vector in memory but just gives you back the right range when you ask it for chunks
13:49hyPiRionprzemek_: you could probably add a hook which does that, but I'm not sure it would be that valuable
13:49CookedGryphonzerowidth: pretty easy if it's already in a vector, and it makes better use of the processor than pmap which just blindly splits the work and still has all the lazy seq overhead
13:49przemek_well ...
13:49hyPiRionYou generally manage to avoid those whitespaces anyway
13:49zerowidthCookedGryphon: so a reducer-aware range would have to be able to produce parts of the range simultaneously?
13:49hyPiRionAt least with some clojure practise
13:49CookedGryphonzerowidth: exactly
13:49przemek_idea's plugin's code must have it
13:49koalallamaCookedGryphon: thanks again. last paste: https://gist.github.com/ctrlrsf/12ea523e63539f166375
13:49przemek_so I can imagine cider gets the buffer
13:50przemek_and processes with that code
13:50zerowidthi imagine pmap for this thing i'm looking at is a premature optimization... and all the more so since i'm doing it in cljs first and only thinking about pushing it server-side later >_<
13:50hiredmansomeone had a patch for reducer's friendly range
13:50przemek_no one has needed this so far?
13:50koalallamaCookedGryphon: my friend trolled me into working on this when he posted his version in awk
13:50hiredmanpmap is terrible
13:50CookedGryphonhiredman: Yeah, I'm looking at it, it's not made it in yet though
13:51przemek_I hate to have to "polish" my code manually deleting spaces
13:51CookedGryphonkoalallama: that's more like it :)
13:52CookedGryphonkoalallama: one discrepancy, your previous code was doing the lastzeros count on (inc maxnum), this is doing it on maxnum
13:52CookedGryphonand i don't get what the def lastzeros 0 and sum 0 are there for
13:52koalallamagood catch!
13:53jjl`_is anyone who works on cider-mode around?
13:53koalallamaCookedGryphon: bit-rotting.. obviously not needed either
13:54CookedGryphonkoalallama: wait, you might have been right, range is non-inclusive, so you don't need the inc, my bad
13:55koalallamarefresh gist if you're not board of this already. moved the inc to the maxnum def at the top.
13:55koalallamabored*
13:56CookedGryphonkoalallama: (last (range num)) is not num, you were right first time
13:56koalallama(ignore all I've just said, you were right that I was right)
13:59CookedGryphonlol, anyway, I'd like to see a version of that with reducers, but reducers/range isn't easily available and it's time for me to go home. Bye!
14:02koalallamaS11001001: thanks to you as well!
14:34mikerod,((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))
14:34clojurebot((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))
14:34mikerodyay, Recursion theorem in practice
14:43AeroNotixcider has ruined me
14:43AeroNotixIt's very good
14:44AeroNotixI tried Clojure back in pre-1.0 days (iirc?) with SLIME and ehhh it didn't quite fit like SLIME fits with Common Lisp. But CIDER? So good.
14:45technomancythere's still a number of things slime can do that cider can't
14:45AeroNotixtechnomancy: probably
14:45seangroveIs dorun blocking?
14:45hyPiRionseangrove: yes
14:46seangrovehyPiRion: Thanks, I thought it would be, but I'm seeing some strange things locally
14:47bufferlosshi, I'm interested in doing some hobbyist type projects with Clojure - specifically video games and or video game related stuff. I checked http://www.clojure-toolbox.com/ but there don't seem to currently be many good options for interactive 3D graphics ala OpenGL
14:48bufferlossthe one OpenGL thing that does exist explicitly states that development is slow and possibly non-existent
14:48kristofSounds like territory not yet trodden upon
14:48bufferlossmy other thought was to use Clojure in a similar way to e.g. Lua to allow users and 3rd parties to script game interactions
14:48bufferlosswondering if anyone has had experience with the latter or knows of any other good/viable options for the former
14:48bufferlosse.g. something that's not OpenGL
14:48kristofI imagine that there are bindings to OpenGL in Java, so it wouldn't be TREMENDOUSLY hard to wrap those in Clojure...
14:49bufferlosskristof, yeah I would guess the same as well
14:49arrdemkristof: it's jus that those bindings aren't especially good
14:49bufferlosswhat does minecraft use btw? does anyone know?
14:49kristofarrdem: Nobody wants to do intensive graphics calculating in java anyway
14:49Wild_Catbufferloss: it uses Java3D
14:49bufferlossdid they write e.g. their own occlusion culling algorithms?
14:49bufferlossWild_Cat, ok thanks
14:50bufferlosshow bad of an idea would it be to try to "hook in" to clojure "from" a C++ engine? ala allowing game event scripting with lua for example
14:50Wild_Catbufferloss: you'd get the JVM's memory footprint combined with C++'s safety and ease of debugging.
14:51Wild_Catso pretty bad, all in all, IMO
14:51benkayhey y'all, i'm having trouble deref'ing a future - i keep getting java.lang.ClassCastExceptions when trying to deref the return value of a Datomic transaction to get at its innards. here's the relevant paste (https://www.refheap.com/24040): any idea what i don't understand about futures in Clojure?
14:51bufferlossWild_Cat, lol, ok
14:51Wild_Catbufferloss: if you're gonna go with a straight C/C++ engine and main loop you might as well use Lua for scripting, that's what it's made for
14:51`cbpyou could try clojurescript + node_webkit for 2d graphics
14:52`cbp+ webgl
14:52bufferlossWild_Cat, yeah I suppose, I was actually contemplating trying to link against a common lisp runtime for example instead of lua
14:52bufferlossthough I haven't done any common lisp (it's kind of defunct isn't it?)
14:54andyfbufferloss: No more defunct than usual :-)
14:54mikerodAeroNotix: I upgraded from nrepl.el to cider (after uninstalling nrepl.el) and everything became unstable and wouldnt' work
14:54bufferlossandyf, heh, ok
14:54mikerodso I reverted, I guess I'll have to do that again and tackle whatever issues I'm having. I would have expected a seemless transition though
14:54mikerodsince it was just a rename
14:54mikerodwell I guess not *just* a rename
14:55technomancybufferloss: guile or chicken would be a lot easier to embed
14:55andyfbufferloss: The highest performance open source implementation I know of, SBCL, is still being maintained and improved by volunteers, and a guy named Zach Beane (sp?) actively maintains QuickLisp, which helps in distributing a set of up to date CL libraries.
14:56stuartsierraClojure isn't great as a user scripting language because it compiles to JVM classes; there's no interpreter.
14:57tim_that being said, I'd be tempted to just use OpenGL from clojure
14:57tbaldridgeor even from Java, and wrap the Java core with Clojure.
14:57bufferlossyeah actually I will likely try playing with Java3D just from within Clojure and see how that goes
14:57tbaldridgeClojure + eval on the JVM should make a fairly fast scripting language.
15:03bufferlossandyf, ok I'll give that a look as well, thanks
15:08AeroNotixWhat do people recommend for a YAML parser/writer library?
15:11dobry-den(clojure.string/replace text #"(?i)(:usa)" "<img src='/smilies/$1.gif'>") <-- Is it possible to (lower-case $1) somehow?
15:11dobry-deni.e. :UsA -> <img src='/smilies/usa.gif'>
15:14AeroNotixdobry-den: regex
15:14AeroNotixpolak?
15:15dobry-denno, just lived in praha.
15:16TimMc&(clojure.string/replace "FOO" #"O+" clojure.string/lower-case)
15:16lazybot⇒ "Foo"
15:17AeroNotix,:foo
15:17clojurebot:foo
15:17AeroNotix,:choo
15:17clojurebot:choo
15:17AeroNotixtrain!
15:18AeroNotixTimMc: that works only if they know beforehand what they are replacing
15:19dobry-denAeroNotix: I see that \L will lowercase the match.
15:20dobry-den"\L$1" doesn't seem to work though
15:23zerowidth,(clojure.string/replace "foo:UsA:bar" #"(?i)(:usa)" (fn [[_ s]] (str "<img src=\"/images/" (clojure.string/lower-case s) ".gif\">") ))
15:23clojurebot"foo<img src=\"/images/:usa.gif\">:bar"
15:26dobry-denzerowidth: thanks for spelling it out. that function signature makes sense to me now
15:27zerowidthi'm not clear on the function parameters to the string/replace function, but that seemed to work
15:34dobry-denwhat's actually happening when running a website via "lein ring server" compared to lein running it?
15:43jcromartiegrrrr… don't do this: (if this (throw …) (do something))
15:43jcromartiedobry-den: lein ring server starts jetty with the handler var as indicated in your project.clj
15:44jcromartiedobry-den: "lein run" just runs the :main specified in your project.clj, where it would be up to you to start jetty
15:45jcromartiedobry-den: and it should be a namespace with a -main fn specified by :main, vs. a var bound to a handler specified by :handler (I think?)
15:45Wild_Catjcromartie: why is that if block bad practice?
15:45jcromartieWild_Cat: if you're just checking something, use when and throw
15:45jcromartieit's particularly obnoxious when it's a long chain
15:46jcromartie(if a (throw …) (if b (throw …) (if c (throw …) (do-stuff)))
15:46Wild_Catjcromartie: oh wait, didn't see the do thing was in the else block.
15:46Wild_CatOK, I get it
16:01jcromartieI feel like I've made a design mistake, where I have all these functions taking a map containing a ref and dereferencing it to pass to the pure business domain functions
16:02jcromartieso, all over the place, it's like (fn [{:keys [read-model]} id] (get-user @read-model id))
16:03jcromartiemaybe I'll just deref and assoc in that map in a higher level place
16:07jcromartieanybody want to take a look at this CQRS/event type deal for me https://gist.github.com/jcromartie/094b36e20132c970fbc0
16:17matt444is there a primer article on core.async that anyone can recommend?
16:20stuartsierramatt444: maybe tbaldridge's talk video http://www.youtube.com/watch?v=enwIIGzhahw
16:23matt444stuartsierra: thanks!
16:23stuartsierrayou're welcmoe
16:26mrhankyshould i avoid slurp when reading three txt files with a total size of 50kb ?
16:26mrhankyi read slurp should be avoided on larger files
16:27jcromartiemrhanky: so long as the strings that are created are not too large
16:27matt444Also this: http://swannodette.github.io/2013/11/07/clojurescript-101/
16:27technomancymrhanky: "large" means "might not fit in memory"
16:28mrhankyoh okay :)
16:28technomancypresumably you are not running clojure on an arduino =)
16:28jcromartieRaspberry Pi maybe :P
16:41TimMcOK, who decided that maps and records should not be =, but lists and vectors could be?
16:41TimMcI would like to have a chat with them, perhaps involving some swearing.
16:41technomancywe warned you
16:41technomancywe warned you about records bro
16:42technomancythey're just like stairs
16:42TEttingerheh
16:42jcromartiehuh
16:42TEttingerit's a joke from a comic
16:42tcrayfordanybody ever see a ClassNotFoundException when using tooooools.namespace.repl/refresh, but upon normal import at the repl everything works fine?
16:43locksTEttinger: isn’t everything
16:43technomancyseangrove: http://www.mspaintadventures.com/sweetbroandhellajeff/comoc.php?cid=001.jpg
16:43TEttingerha
16:43tcrayfordor alternatively an error like "AVLTransientMap could not be cast to AVLTransientMap" ?
16:43TEttingerit's number 1 eh?
16:44technomancyobligatory http://p.hagelb.org/mystery.gif
16:44TEttingertechnomancy, it will make no sense out of context as an intentionally bad comic
16:44TEttingerthen again, it doesn't in context either
16:44technomancyTEttinger: I was gonna say...
16:46TEttingerhttps://twitter.com/BarackObana I do find the joke twitter account even funnier, especially when the student who clearly spoke little English mistook Obana for Obama
16:47seangrovetechnomancy is obviously operating at a highe rlevel than I am
16:48TimMcseangrove: It's a terrible webcomic that a character from another webcomic writes.
16:49seangroveTimMc: Ah, ok. That helps a bit.
16:49technomancyTEttinger: or https://twitter.com/Bill_Nye__Tho
16:50tcrayfordit's fine. am just working around by rm -rf ing everything out of ~/.m2 before any lein invocation
16:50jcromartieDoes anybody else read "[f & args]" as "f'n args!"
16:50TimMcIntentionally bad art is not to everyone's taste.
16:51TEttingerthat's grea technomancy
16:52stuartsierratcrayford: is anything AOT-compiled?
16:53tcrayfordI assume not, given that I've been running `lein clean` before starting up my repl
16:53tcrayfordstuartsierra: actually, I fixed it by doing a require of the clojure namespace that defines the deftype before importing it
16:54stuartsierratcrayford: Ah yes, that is simply a load-order issue.
16:55tcrayfordweirdly, I was seeing the ns that defined that type before the thing that imported it in the list that refresh spews out, so kinda unsure why that fixed it
16:56tcrayfordthe TransientMap error is quite probably an AOT compilation issue (it's not related to tools.ns), but currently it doesn't go away with lein clean, only rm -rf ing ~/.m2/repository/avl (which is somewhat frustrating)
17:00stuartsierraYes any time you have something that looks like "class Foo is not a Foo" it's probably caused by stale copies of the same class somewhere.
17:00taliosmmm, starting the day with S.M.A.R.T. controller failures - fun fun fun
17:01tcrayfordyeah, pretty much what I figured. Strange that `lein clean` isn't killing it though ;)
17:02chrisbposhey. i remember a few months ago coming across a cool clojure learning site, it was a bit like the ruby/clojure koans, but it evaluated your answers right on the website, anyone know where this is?
17:03chrisbposit was kind of zen-themed
17:04BobSchackchrisbpos: http://clojurescriptkoans.com/
17:04BobSchack?
17:05chrisbposyep!!
17:05chrisbposthanks very much BobSchack
17:05BobSchacknp
17:23seangrovesritchie: Hey, you're using storm right?
17:23sritchienot anymore, but I worked on it for quite a while
17:23sritchiewith, rather
17:23seangrovesritchie: If you used it on a clojure 1.5.1 project, would love to know how you got it setup
17:23sritchieoh, I was using it from Scala
17:24seangroveDid you set it up initially?
17:24seangroveIt's been pretty painful to get running :P
17:25seangroveEspecially running into problems knowing if jzmq is working properly
17:25quizdr,(rest [1 2 3)
17:25clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
17:26quizdr,(rest [1 2 3])
17:26clojurebot(2 3)
17:26quizdrSo I rest a vector, and get a seq, right?
17:26quizdrso then why would anyone need to do (seq (rest [1 2 3])) if rest already returns a seq?
17:27seangrovesritchie: And where did you get help from whenever you ran into trouble? #storm-user is silent
17:27sritchieyeah, it was rough - mostly I just read code
17:27sritchieor talked to the storm team at twitter,
17:27sritchiebut those guys didn't really know clojure, strangely enough
17:28sritchiethere's one guy who works on storm who's the man
17:28sritchiejason jackson
17:28sritchieseangrove: nathan seems to have fully checked out too
17:31bitemyappsritchie: hello puppy monster.
17:31sritchie:)
17:31bitemyappsritchie: you are killing me.
17:31sritchiehaha, I should set up a drop cam
17:31sritchieit's too much, dude
17:31bitemyappI like this idea.
17:31bitemyappsritchie: put up a web page.
17:31seangrovesritchie: Ah, bummer. Did it feel like a solid project to use, or was it stagnating?
17:31bitemyapppuppy-cam.
17:32sritchiebitemyapp: in haskell
17:32bitemyappsritchie: you know me, sir.
17:32sritchieyou couldn't stay away from that page
17:32bitemyappheroin.
17:32sritchieall puppies, no runtime exceptions
17:32sritchieseangrove: you know, lots of people are building on it, and the apache thing may give it a boost -
17:32bitemyappfunny you say that, Google's AI competition Haskell example has a partial function that throws :(
17:33sritchiehaha, oh no!
17:33bitemyappond default input! the buggers.
17:33seangrovesritchie: That's what I thought, but it's been pretty iffy to setup
17:33sritchieseangrove: but, I dunno, it was a pretty annoying proj to build on (for Summingbird)
17:33bitemyappoh well, at least it's the typical mistake. Calling head on an empty list. Woo.
17:33sritchiehaha, yup
17:33sritchieheadOption all the way
17:33tcrayfordsritchie: annnd now I'm super glad I didn't decide to use storm 10 months ago
17:34bitemyappsritchie: you can do that in Haskell, but the culture prefers pattern matching that *ONE* thing. Everything else is Maybe.
17:34sritchieif you can handle a few dropped items, I'd go with Akka… BUT, I haven't been using it personally
17:34sritchiethe dynamic topology scaling is killer
17:34sritchieI think they added a nice layer on top to give the at-least-once semantics with akka...
17:34sritchieforget what it's called
17:34bitemyappsritchie: perhaps Kafka?
17:35sritchiekafka's awesome
17:35bitemyappseangrove: do you just need a more reliable queue or what?
17:35sritchieif you're using storm you need a stream processor
17:35bitemyappat-least-once + origin-generated UUID + logs = happy times with sanity intact.
17:36bitemyappseangrove: what were you originally looking into Storm for?
17:36jjl`_question for emacs users: what are you actually using to have a sane environment for developing clojure? i'm really not happy with what i'm doing
17:36seangrovebitemyapp: Reliable, distributed workers, etc.
17:37bitemyappseangrove: just use a multi-stage queue. Keep it simple.
17:38bitemyappseangrove: failed/timed out tasks go to a secondary queue
17:38technomancyyeah, I could not figure out why Storm is so much more complicated than just sending sexps over rabbitmq for the vast majority of applications
17:38bitemyappseangrove: our data warehouse at work is RabbitMQ feeding into Datomic. Running on Clojure.
17:39seangrovebitemyapp: That might be a better option ultimately
17:39bitemyapptechnomancy: the topologies in Storm are actually easier to understand than RabbitMQ routing and a bit more powerful.
17:39quizdrjjl` i find emacs Live by sam aaron to be a simple one-stop shop to getting everything setup.
17:39bitemyapptechnomancy: rabbitmq routing was designed by a sadistic telecom employee.
17:39tcrayfordtechnomancy: at least storm doesn't claim to beat the cap theorem ;)
17:39bitemyappbindings. whatever the fuck.
17:39quizdrjjl` https://github.com/overtone/emacs-live
17:39technomancybitemyapp: sure, but you only have like three routing patterns you actually need in practice
17:40bitemyappseangrove: take UUID generation from origin seriously though, it enables at-least-once idempotent push!
17:40bitemyapptechnomancy: for a pure MQ sure. technomancy: the problems Storm gets used for, typically, are a bit different.
17:40bitemyapptechnomancy: Storm is closer to distributed dataflow than an MQ.
17:41quizdrjjl`_ i guess i was writing your nick wrong
17:41bitemyapptechnomancy: one of the current challenges of distributed computing is that if an existing tool is even a bit removed from the ideal solution for your problem, it more often than not just won't work at all.
17:42bitemyappthus the seeming NIH going on. We don't have very good building blocks for these problems.
17:42technomancybitemyapp: the only take-away I could find about what it could do that a queue couldn't from the strangeloop talk was that the sharding algorithm he was using with the queue at the time couldn't handle changing the size of the worker queue or something
17:42jjl`_quizdr: does that just use cider-mode?
17:42technomancyI'm sure there's more to it, but he just did a really bad job of explaining why in that talk
17:42quizdrit has nrepl and i think they just added cider to it but it's in the dev packs not the default packs if I recall
17:43zerowidthwouldn't you want to be able to handle queue size changes?
17:43quizdrit instantly works. just install lein and emacs live and you have clojure working out of the box
17:43technomancyzerowidth: sure; he was just using a crappy queue
17:43technomancysomething based on cassandra I think?
17:44zerowidthahh
17:44jjl`_quizdr: ah they've just upgraded to cider. nrepl was renamed to cider.
17:44jjl`_quizdr: i've just finished hacking on nrepl-ritz to enable single step debugging with cider-mode. but i'm generally unhappy with it so far
17:45quizdrin emacs?
17:45technomancyjjl`_: maybe you could be more specific?
17:45jjl`_i'd probably use lighttable, but it doesn't have a decade of training my fingers
17:45jjl`_technomancy: breakpoints appear to be entirely broken, debug on exception seems to be entirely broken, to start with two
17:46technomancyoh, about ritz specifically;
17:46technomancyI thought you meant about emacs in general
17:46jjl`_yes. there are some other annoyances too, but they're comparatively general
17:46quizdri found emacs quite easy to adapt to actually *using* I haven't fully understand the criticism against it for workflow. but I *do* find emacs hellish to understand for setup and config purposes, which is why I like Emacs Live since it sets everything up automatically up front so I can just focus on the work. I hear Rich Hickey himself ain't much of an emacs guy
17:46sritchiebitemyapp: I want to get a datomic instance set up for the social graph stuff I'm starting to push
17:46sritchiethe "follows" and "watches", etc relationships
17:47jjl`_there are some bizarre situations where i find the indentation to be horribly wrong as well, but i guess i just have to go figure out the switches for that
17:47sritchieexcited to try out some of the stuff you've pushed
17:47quizdrhmm that doesn't sound right. the indentation is a major aspect of clojure/lisp work, and emacs live seems to get that right. maybe you didn't have a good setup inside emacs
17:48bitemyappsritchie: it would be nice if Brambling had a user that wasn't me or my coworker.
17:48technomancyindentation? wrong? it's unpossible.
17:48jjl`_right now i'm using cider largely uncustomised (i'm turning on eldoc)
17:50quizdrtake a look at all the packs emacs live installs. it's a lot more than just cider. is cider alone supposed to be a complete clojure IDE?
17:50technomancyemacs live jumbles together a lot of unrelated junk
17:50jjl`_i gather that was the intention for cider, yes
17:50technomancyI wouldn't recommend it unless you're actually into the whole live-coding scene
17:50bitemyappI'm not really keen on Emacs Live.
17:51bitemyappit destroys the whole "building your lightsaber" experience.
17:51jjl`_this.
17:51jjl`_also, i don't really want to take my huge config and borg it into someone else's
17:51bitemyappThat too.
17:51quizdrbitemyapp that is correct, but if you are new to emacs and don't have 2 months to waste learning how it works under the hood, emacs live is the best way to get going with clojure and emacs with zero setup on your part
17:51bitemyapp"waste learning"
17:52technomancyif you don't have the time to spend to do it right, you should wait and switch to emacs when you do have the time
17:52technomancyit'll still be there
17:52quizdri disagree
17:52rasmusto~emacs.d
17:52clojurebotNo entiendo
17:52quizdremacs live is really great to use
17:52jjl`_erm... i guarantee you'll spend more time in your editor as a programmer than anything else. worth learning.
17:52quizdrwhen you are ready to customize, that can wait until the future moment
17:52bitemyappIf you don't have time to learn, you don't have time to be a programmer.
17:52quizdrthat's a ridiculous comment
17:52quizdrtime is not infinite
17:53quizdryou can learn how to setup emacs and spend a lot of time on that, or you can jump in and start actually coding. you can customize the IDE at a later time
17:53bitemyappI don't know what your experience, but I find that most of my job is learning. Application flows from the learning that happened.
17:53quizdryes, but you surely realize that you can't learn everything at once. so you prioritize.
17:53bitemyappBeing able to edit text sounds pretty important to me.
17:53quizdrlearning how to code in a new language is more important to me than learning how to setup an IDE
17:54technomancyif you're learning clojure still, you shouldn't be learning a new editor; emacs live or not
17:54bitemyappI'd agree with that.
17:54bitemyappHalf-assing is a waste of time.
17:54jjl`_i think emacs is much easier to learn than an IDE anyway
17:54jjl`_you only need a handful of chords to get going and then you add the bits you want as you decide you want them
17:54quizdremacs seems really easy to use for actually creating code, so i'm not sure what the deal is with its criticisms. but understanding its customizations can be a test of patience
17:54jjl`_e.g. i added multiple cursors a few weeks ago. i never would have learned how to use them from someone else's config
17:55kristofI don't think that applies to just chords.
17:55technomancynothing to get you motivated to learn elisp like having spent the last few months trying to learn clojure using textmate
17:55kristofYou just work with bare emacs functionality until you think "I hate _____, how do I fix this?" Google/ask, profit
17:56kristofAre people really complaining about emacs? The tutorial takes 20 minutes and then you're good to go, forever.
17:56quizdri'm sure everyone in here had joy when first using a computer for the very first time, even if you had zero idea how it actually worked behind the scenes. understanding the backend of emacs or any other IDE is orthogonal to actually using it effectively as a learner.
17:56bitemyapptechnomancy: the kiddles use Sublime Text now.
17:56bitemyapptechnomancy: get with the times man.
17:57ieurebitemyapp, Lightroom
17:57technomancybitemyapp: oh right; textmate isn't even proprietary anymore
17:58kristofmumble mumble lighttable
17:59zerowidthwait, there's a spreadsheet?
17:59technomancyzerowidth: it's just a CSV
18:00sritchiebitemyapp: how are you guys deploying datomic?
18:00quizdrfor example, there is a reason why "list in a box" was so successful and used in so many books as the recommended IDE. great to learn Common Lisp without the learner having to spend a very long time learning to configure it on his/her own
18:00sritchieEC2?
18:00quizdr"lisp in a box"
18:00bitemyappsritchie: yap.
18:00bitemyappsritchie: provisioned IOPS for production instances. PostgreSQL storage layer.
18:01sritchiebitemyapp: n00b Q - if peers suck down a bunch of data to do computations,
18:01sritchiebitemyapp: could that overload a heroku instance, say?
18:01sritchiebitemyapp: I should probably do at least ANY reading on datomic configs before asking such questions.
18:01bitemyappsritchie: you really do not want a peer on a Heroku instance.
18:01bitemyappsritchie: like, really really.
18:01bitemyappsritchie: you need fat RAM to make good use of datomic.
18:01sritchieokay
18:02sritchieso if I go this route, gotta migrate out of heroku to elastic beanstalk, or some other deploy environment
18:02sritchieor rathole and set up a whole docker thing
18:02sritchie:)
18:02bitemyappsritchie: probably, unless you want to hide the peers behind an API the heroku instances can call.
18:02xuserbitemyapp: why pgsql?
18:02bitemyappsritchie: https://github.com/bitemyapp/berossus/
18:02sritchienice
18:02bitemyappxuser: because I'm not a card-carrying communist that uses things like DynamoDB.
18:03bitemyappxuser: more seriously, I know PostgreSQL and how it behaves and it's something we can redeploy internally or leased machines if needs be.
18:03bitemyappxuser: I can't "re-deploy" DynamoDB if we get tired of getting robbed by them.
18:04technomancysingle-vendor lock-in: only a problem when it's amazon now?
18:04bitemyapptechnomancy: I offered a way to make Heroku instances work :)
18:04quizdrhas anyone found a really good tutorial on setting up a Clojure environment on elastic beanstalk or google app engine or basically any paas that is not Heroku? the Heroku folks are smart in realizing that they can spoil a lot of devs by taking care of all the sys admin for you
18:04technomancythis CSV is getting longer
18:05bitemyappsritchie: unless you somehow have surplus labor to go around, I would avoid dev-ops rabbit holes as much as possible.
18:05xuserbitemyapp: is the transactor local storage bad?
18:06sritchieyeah, I already went through a fun ansible / pallet period
18:06sritchiethe zen of devops, like sharpening 1000 pencils in a sitting
18:06bitemyappxuser: are you asking about ephemeral disk backed Datomic storages?
18:06bitemyappsritchie: and then writing nothing.
18:06sritchie:)
18:08xuserbitemyapp: I guess, why ephemeral?
18:08gaverhaeHey! Anyone here familiar with clojure.java.jdbc?
18:08bitemyappxuser: have you used EC2 before?
18:08sritchietechnomancy: here's an odd one: [do cljx, cljsbuild once dev, repl] and standalone-repl have a type mismatch merging profiles.
18:08bitemyappxuser: I'm having a hard time understanding what question you were trying to ask.
18:08sritchietechnomancy: what's standalone-repl refer to?
18:09xuserbitemyapp: the bult-in storage capabiltiy of datomic
18:09xuseris it not meant for production?
18:10bitemyappxuser: you're talking about the frickin' dev storage?
18:11xuserbitemyapp: yes
18:11bitemyappxuser: if you use something named "dev" in production you deserve what'll come to you.
18:11bitemyappxuser: it's H2.
18:11bitemyappyou do not...want to use H2 in production-anything.
18:11jjl`_to be fair, it refers to it as 'transactor local', as opposed to 'dev'
18:11bitemyappjjl`_: the config file says "dev"
18:12bitemyappwhen people ask questions, I check my code, not their godforsaken website.
18:12bitemyapptheir documentation has not historically helped us much.
18:12jjl`_:)
18:12bitemyappworking code and pestering them via support went much further.
18:13technomancysritchie: I think it might have been a workaround for a bug in older lein versions; is it still around?
18:13sritchiejust showed up on heroku
18:13technomancysritchie: on a recently-deployed app?
18:13sritchieyeah, just a minute ago
18:13sritchietechnomancy: I had to do some really funky build stuff to get around these issues with Austin destroying my AOT compilation...
18:13technomancyok, means I forgot to do some cleanup is all
18:13sritchieso, liberal use of ^:replace
18:13technomancyshould be able to safely ignore it
18:14sritchieokay, cool
18:15matt444If you right a function that uses chans internally, does a function that uses it need to know that chans are being used, need to use any special syntax?
18:16matt444They have to use take!, right?
18:19matt444or no, you use <!
18:22shaungilchristlike function that returns a chan you mean?
18:23xuserbitemyapp: you are worried about aws lock-in but not datomic lock-in?
18:24scape:)
18:25technomancysee, no datomic
18:25scapelol
18:25technomancycarry on; nothing to see here =)
18:26justin_smithregarding aws lockin, who good an option is openstack, and how hard is it to target openstack as an aws replacement?
18:27alewI heard openstack isn't doing so well
18:28scapeI was rather happy with Linode, AWS pricing fluxuates too easily
18:28nDuffjustin_smith: *shrug*. Depends on how much AWS infrastructure you're using.
18:28nDuffjustin_smith: ...Amazon is certainly adding new APIs faster than they're being implemented elsewhere.
18:32luxbockI'm trying to solve Project Euler problem 3 without looking at other peoples solutions and I'm stuck
18:32luxbockhttps://gist.github.com/8446851
18:33luxbockthe number presented in the problem is so large that it jams my repl
18:33bitemyappxuser: I'm pretty grumpy about the fact that it's not open source.
18:34bitemyappxuser: but I don't have a great alternative at the moment for a historical database.
18:34arrdemluxbock: you can write a better primality test than that...
18:34arrdemluxbock: also memoization would be nice here
18:34hyPiRionluxbock: remember that factors are not the same as prime factors
18:34luxbockah, what algorithm should I be using? I got this one from SO
18:35arrdemluxbock: this is good, you can just tune it some
18:35arrdemluxbock: also hyPiRion hit this nail on the head
18:35luxbockoh yeah the factors function isn't really used for anything
18:36arrdemluxbock: really what you want to do is build a cache of {a | (prime? a) && (zero? (n % a))}
18:36luxbockI had it there from an earlier attempt that was doomed to fail
18:36arrdemluxbock: which is trivial if you just compute all prime factors up to (sqrt n)
18:36arrdemsorry. just primes. no factor requirement.
18:36arrdemthen the largest n \in that set is your largest prime factor
18:37luxbockalright, I'll check out memoize as well
18:37arrdemluxbock: memoize is really gonna help if you do this counting up thing.
18:38luxbockbut shouldn't the way I was doing it be even faster? although I now realize that starting at half of n is far too high
18:38luxbockdo I really have to calculate all the primes between 2 to n, when I only need the highest?
18:38arrdemluxbock: not [8,n), [8,(sqrt n)]
18:39arrdemwell... I guess it's really [4,sqrt(n)]
18:39hyPiRionluxbock: it's sufficient to calculate up to sqrt(n), if you divide the number with the primes you've found so far
18:39arrdemthe point is that if you count _up_ you have this O(1) primality table lookup from memoize on your side.
18:41luxbockah, so I should be counting up and not down
18:41arrdemluxbock: yes, and the table of known primes is crucial to doing this really fast.
18:41arrdemluxbock: retaining a table known primes will be much more efficient than memoizing the entire prime? function.
18:43hyPiRionIt's not that critical for this one, actually.
18:44luxbockso what would be a better test for primality?
18:44luxbockhttp://en.literateprograms.org/Miller-Rabin_primality_test_%28Clojure%29
18:44luxbockI found this but it seems like an overkill
18:44hyPiRionluxbock: the primality test you already got is sufficient for this problem
18:44luxbockok
18:46hyPiRion(Shameless self-plug: If you need a more performant one later, https://github.com/hyPiRion/primes is pretty fast and is thread-safe)
18:46luxbockcool
18:50koreth_For what it's worth, I found 4clojure and exercism.io to be better Clojure learning tools than Project Euler. PE is great for testing your computational mathematics skills but its problems are mostly pretty far removed from anything you'd actually do in real life (well, unless you are a mathematician!)
18:51luxbockyeah I know, I'm kind of learning how to use simple-check at the same time
18:52hyPiRionluxbock: In this case, it's sufficient to find the prime numbers below sqrt(n) dividing n. That can be done through `(filter (fn [num] (and (prime? num) (divides? n num))) (range (Math/sqrt n)))`
18:53luxbockoh duh, and here I was writing a loop
18:55hyPiRionit's one of the things which comes with training in functional languages
18:56luxbockI think that's how I would usually write it, but I had this idea in my head that loops are more efficient
18:56bitemyappluxbock: why?
18:57luxbockfrom reading Mikera's posts on core.matrix, but that level of optimization is far above my skill level
18:57bitemyappluxbock: some of that might have more to do with the limitations of Clojure than anything involving FP.
18:57bitemyappluxbock: there are languages that do things like loop and stream fusion of higher order functions like fold.
18:57luxbockactually the other purpose for playing with project Euler problems for me was to do micro benchmarks with criterium for different approaches
18:58luxbockyeah I don't doubt that at all
18:58luxbockfor me compilers are pure black box magic though
18:59luxbockso I go by bits and pieces of what I read here and there
18:59zbyte64Anyone know how to write an om component (reactjs) that returns a string as html? (the string is generated by a 3rd party js library)
19:00luxbockbut this is actually exactly what I wanted to do.. I'll write the loop version next and then compare them
19:00zbyte64returning a function or a string creates an invariant exception
19:25aleware there any good instrumentation solutions for clojure ala new relic?
19:26technomancynew relic works with clojure
19:27alewnot automatically
19:27alewyou have to provide annotations
19:27technomancyit does a bunch of stuff without annotations
19:28technomancymaybe with annotations it does more though
19:28alewThrowing it up on heroku with just the default setup only shows me memory usage, nothing else
19:29technomancyhm; I have seen it do a pretty thorough profiling without changing any source
19:29technomancythis was 2 years ago though
19:29alewapparently one of the versions they released had accidently support for ring instrumentation
19:30quizdris there a practical limit to the number of args you can send to apply? in common lisp, this limit can be very low dependent on the implementation
19:32rasmustoquizdr: there's a limit to the number of arguments that a fn can take, but you can do [blah & more] to get the rest
19:32nDuffquizdr: in general, Clojure falls back to being inefficient if you're using a really large number, as opposed to just not working.
19:32nDuff(err, number of args)
19:32cgaghttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L612
19:32cgagif you're curious
19:33nDuffquizdr: ...though there _are_ some fairly low limits on how many args a function can take if you're using primitive data types.
19:34quizdrok, i was reading about how some functions use apply in their implementation, such as join.
19:35nDuffquizdr: *nod*. In general, that'll fall back to an implementation that passes an Object[] as the last argument (which is how Java's varargs work in general), and can thus handle an arbitrary length.
19:45lsdafjklsdAnyone using lightable to develop clojurescript apps and know how to hook up a browser repl?
19:45john2xanybody using revise? I was wondering on what's the standard way of creating the database and tables.. would an arbitrary "script" (that's not part of the main project's namespace?) that creates it suffice?
19:50technomancyclojurebot: clojars migrations?
19:50clojurebotCool story bro.
19:50technomancyaw come on
19:50technomancyI know I've taught you that before
19:51matt444What is the difference between a chan and port?
19:51matt444Seem to the same
19:51technomancyclojurebot: clojars migrations |are| just a namespace with functions: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj
19:51clojurebotAck. Ack.
19:51technomancyjohn2x: ^ check that out
19:59lsdafjklsdclojurebot: clojars migrations?
19:59clojurebotclojars migrations are just a namespace with functions: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj
20:15arrdemtechnomancy: does clojurebot not provide inference engine responses to arbitrary channel text?
20:16arrdemI'm looking at the inference engine and it doesn't look like arbitrary patterns can be matched...
20:16technomancyarrdem: I feel like if I dove into the source it would take away the mystery
20:18technomancyarrdem: that said I think for every line there's a 1% chance he'll interpret it as being addressed to him
20:18arohnerwhen parsing some XML w/ clojure.data.xml, I'm hitting https://gist.github.com/arohner/8448042 I think it has something to do w/ XML namespaces?
20:18technomancy"Namespaces? But XML doesn't have namespaces." --every XML library author, at first
20:19arohner:-)
20:19arrdemtechnomancy: ok. I was kinda looking for a way to make clojurebot match "*.pastebin*."
20:27squidzis there a good way to profile clojurescript performance?
20:28bbloomsquidz: w/ source maps, standard js profilign tools apply
20:29squidzbbloom: okay thanks
20:36davorbhey. i'm new to clojure, but i've used common lisp before. can i use slime with clojure or something similar?
20:36jack_rabbitnrepl
20:36jack_rabbitdavorb, it's about the same.
20:36davorbthanks jack_rabbit
20:36jack_rabbitnp :)
20:38AimHeredavorb, there IS clojure slime. But everyone stopped using it when they discovered nrepl
20:39davorband can someone explain to me what leiningen is? is it like ruby gems or is it like javascript's yeoman?
20:40davorbor is it sort of like grunt?
20:40davorbi've looked at it, and it feels like you've got a bunch of grunt tasks and then you run them
20:40bjadavorb, sorta like grunt. it's a nicer interface to maven
20:40davorbah, okay. so it's basically a build manager?
20:41bjayes, but it has a lot of development-related functionality too
20:41AimHereSomething like that. Basically if you're doing anything in clojure, you want it, and you want it bad
20:41bjaAimHere, if you do stuff in other languages you want it and want it bad too.
20:41bjawant to kill myself when I use pip/virtualenv
20:41AimHereIt's clojure's swiss-army build tool
20:42bitemyappdavorb: Clojure is just a library.
20:42bitemyappdavorb: Leiningen and nrepl are your interfaces to the language-that-is-a-library
20:43davorbbitemyapp: okay, i think i get it. thanks.
20:52chareok bad news
20:52chareI had discussion with friends
20:52charethey want ruby on rails
20:52charetell me that clojure has something I can counter with
20:52cgagthat's a hard battle to win
20:53locksthere’s pedestal…
20:54cgagimmutability by default, much better performance, actual concurrency support
20:54bitemyappguys
20:54bitemyappdon't waste your time on this person.
20:54locksthat’s harsh
20:54bitemyappHe's a troll or at minimum not quite psychotypical.
20:54bitemyapplocks: he's been trolling this channel since last year.
20:54AimHereNothing wrong with a little light trolling
20:55bitemyapplocks: he's the whole reason we had to bring active ops back.
20:55bitemyappsingle-handedly.
20:55AimHereEspecially since all it'll get him is a salespitch for clojure!
20:55locksmaybe he just needs love
20:55bitemyappI'm not exaggerating.
20:55bitemyapplocks: we uh, tried that. He never stops language trolling. Ever.
20:55bitemyapplocks: months and months on end.
20:55bitemyappPlease stop polluting the channel with this.
20:55bitemyappIf you really want to help him, have him query you.
20:55charebitemyapp why dho you hate me
20:56bitemyappchare: you don't code.
20:56bitemyappchare: you waste the time of people that do.
20:56chareyou are overexaggerating
20:56chareand what is pedestal
20:56bitemyappyou don't need to prefix 'exaggerating' with 'over'.
20:57bitemyappExaggeration is exaggeration. Overexaggeration is redundant.
20:57bitemyappAnd I'm not exaggerating.
20:57lockschare: pedestal is a web framework for clojure, it is very similar to ruby on rails
20:57AimHereoverexaggerating is a pretty good self-referential term.
20:57charehow similar is similiar
20:58rkneufeldlocks: wut
20:58bjachare, they are both web frameworks
20:58lockschare: they both show HTML in your browser
20:58bitemyapprkneufeld: but the real question is, do you *really* want to dive in?
21:00bitemyapplocks: I don't think you've used Pedestal mate. It's quite nice, but I don't think I'd call it similar, let alone 'very', to Rails at all. It's the closest thing Clojure has to a fully integrated web stack though, which is possibly desirable if you don't like more componentized approaches like Ring/Compojure/et al.
21:00quizdri'm a little confused by the arguments list that starts out this function, is it a destructing form? (fn primes-from [n [f & r]] .....
21:00bitemyapplocks: there's a big emphasis in Pedestal on things that Rails, frankly, can't even do at all.
21:01bjabitemyapp, caribou looks framework-ish
21:01locksbitemyapp: I was suppose to counter-troll him, not troll you
21:01bjaI haven't seen any other frameworks that are being maintained
21:01arrdemwhy isn't /ignore working on chare...
21:01bjaunless you count immutant
21:01locksI was about to say datomic is a clojure library for mysql but, well
21:01bitemyapplocks: this isn't trolling and you're propagating inaccurate information in a public channel and adding to the pollution. Just stop.
21:02AimHerequizdr, yes, that's what it seems to do
21:02bitemyappbja: Luminus is what I usually recommend to people that want a shake-n-bake way to get started.
21:02luxbockthere's also http://hoplon.io/
21:02bitemyappbja: Caribou is half-way point between the template-y Luminus and the framework approach.
21:03bitemyappthis is information that could go on the wiki....hmmm.
21:03charewhat are these supposed things that pedestal can do but rails can't
21:04bitemyappchare: learn to google, wastrel.
21:05charebitemyapp: you're the expert so I defer to your expertise
21:06bitemyappchare: I want some evidence that you're going to stop wasting peoples' time and start writing code before I lift a finger on your behalf. You've wasted countless hours already.
21:07kristof"If you don't like componentized appraoches like Ring/Compojure/et al"
21:07bitemyappkristof: what?
21:07kristofYou know, once I read somewhere that component mix and match web development was "the Clojure Way". I think that was someone justifying the lack of a full web stack floating around.
21:08seubertit used to be a fuller web stack, this is intentional
21:08quizdrif I want a function to accept a vector as an argument, I must use & to access all the elements in the vector, right? Because just binding the whole vector to a single argument variable doesn't seem to do this: (defn gsg [j [r]] [ j r]) returns (gsg 1 [2 4 5 6]) --> [1 2]
21:08kristofProbably.
21:08bitemyappseubert: not fuller, just more integrated.
21:08arrdembitemyapp: if one was so inclined you could probably compute the average response time per word of #clojure, count the number of words ever sent to chare/chord and then compute the USD price of wasted developer time...
21:08kristofWhat's the equivalent of Rack for Clojure?
21:08seubertright, sorry bitemyapp
21:08bitemyappkristof: we atomized Noir on purpose.
21:08cgagquizdr: yeah, looks like that takes a number and a seq, and binds the first element of that seq to f and the rest of it to r
21:08ddellacostakristof: ring
21:08cgagoh wow
21:08cgagwoops
21:08kristofOh, that's right
21:08bitemyappkristof: in Haskell that'd be WAI.
21:08bitemyapparrdem: tempting.
21:08kristofYes, I remember reading about WAI
21:08bitemyapparrdem: I should invoice the motherfucker.
21:09bitemyapparrdem: and put up a trust fund for learning Clojure developers that disburses money for books.
21:09bitemyappbooks*
21:09bitemyappyou only get reimbursed if you actually read the book.
21:09charebitemyapp: if we want clojure to beat ruby then we need you to be working on the nextgen framework for clojure
21:09kristofbitemyapp: the funds would go directly to No Starch Press
21:10arrdemkristof: I find this outcome acceptable
21:10bitemyappkristof: LYAH?
21:10kristofchare: I believe he just said not 3 minutes "start writing code before I lift a finger on your behalf"
21:11kristofbitemyapp: I wasn't aware that NSP was the one that published the LYAH book
21:11locksmy LYAH book arrived with the spine unglued :(
21:11lockshazards of mail
21:11kristoflocks: less starch that way
21:11bitemyapplocks: yeowch.
21:11bjachare, I don't know that anyone is looking to beat ruby
21:11bitemyappkristof: LYSE too.
21:12bitemyappchare: I don't write that much Clojure outside of work anymore.
21:12kristofLearn You Some Erlang?
21:12bitemyappkristof: yis.
21:12locksI re-started reading joy of clojure 2ed today
21:12bitemyapplocks: still MEAP?
21:12locksbitemyapp: yup
21:12locksthink so
21:13kristofDid they push the release date on that one?
21:13quizdrah i figured out my brain fry on the destructing thanks cgag and AimHere
21:13bitemyappI think I'm already on that. Saw an email update about it.
21:13lockslast update was somewhere last week
21:14charewhy is there no learn you a clojure book
21:14lockskristof: "Expected publication Winter 2014"
21:14kristoflocks: Guess I was thinking about something else.
21:14ddellacostachare: Clojure Programming works for that (http://www.clojurebook.com/)
21:14bitemyappddellacosta: and then some.
21:15chareddellacosta: not paying
21:15quizdrchard a new book on Web development in Clojure was just released today
21:15quizdri meant chare not chard
21:15bitemyappwhatever, that's been one of his names too.
21:15quizdrha ha
21:16ddellacostachare: if you need free resources to learn Clojure, you can start the way I did, with 4clojure and the Clojure core API reference. That combined with stack overflow and asking meaningful questions on IRC is a great way to learn.
21:16lockshttp://en.wikibooks.org/wiki/Clojure_Programming
21:17locksclojurescriptkoans.com
21:17locksetc
21:17ddellacostalocks: yeah, great links
21:17ddellacostaforgot about clojurescriptkoans
21:17locksthe koans aren’t for everyone
21:19quizdrwait did chare say there is no clojure book out there? by last count there are at least 8 or 9 solid Clojure books in publication
21:19chareFREE BOK
21:19quizdrchard did you ever go to the cinema?
21:20quizdrchare
21:20quizdrdo you go to the cinema ever, or sometimes stop for a meal at a restaurant?
21:20arrdembitemyapp: so this dropbox thing worked out pretty well...
21:20arrdembitemyapp: now I have ~/doc/org/* sync magically across mobile, laptop and desktop :D
21:20xuserchare: http://www.braveclojure.com/
21:21ddellacostachare, are you finding any of these links useful to you?
21:21bitemyapparrdem: eggscellent :)
21:21chareddellacosta: I haven't started yet still reading erlang book
21:21ddellacostachare: your point?
21:22luxbockarrdem: are you using MobileOrg?
21:23`cbpclojure cookbook is free
21:26quizdrthere are some great links here, interesting books i've never heard of and that are free, sweet, thanks guys. chare hope you are paying attention.
21:27jcromartiehttp://www.youtube.com/watch?v=XluovrUA6Bk
21:27ddellacostaquizdr: glad someone is getting something out of it. :-)
21:28chareso clojure needs to kill ruby and python thats all I care about eventually
21:28ddellacostajcromartie: I think he's holding a copy of "The Internet Gazette" at the top, excellent
21:28ddellacostachare: alright, I tried to give you the benefit of the doubt. I wish you adieu and good luck.
21:29quizdrmy first clojure book was the OReilly book. it was a bit intimidating for someone totally new to this kind of programming, let alone the language. after 150 pages, i switched to Halloway's book, much more accessible to a newcomer
21:29quizdri look forward to the OReilly book after I have a few thousand lines of Clojure under my belt
21:29chareddellacosta admit it you want python and ruby to die too
21:32kristofchare: Such a hard stance. You fighter! Why do you feel this way?
21:32charekristof I'm just saying what I think not hiding the politically incorrect view that you're afraid to say
21:32quizdrno kidding. his thinking is very black and white. in his defense, this is a typical perception for many with a programmer's mind. but those who appreciate the grey areas will get more out of programming, and of life. i think clojure was created with such perception
21:33kristofchare: You remind me of Napoleon "liberating" Europe.
21:33kristofAnyway, I am too busy enjoying my life to embark on a crusade.
21:33charequizdr why do you fight the urges to say you hate python and ruby
21:34quizdrchard no one here is "afraid" to say "python must die." why do you think that? who wants them to "die"? who has the energy to waste on such nonsense? you are a troll man.
21:35ddellacostanow that we've established that, let us let the troll starve and encourage it to move on to seek more bountiful pastures
21:35quizdrddellacosta agreed my brother
21:36ddellacostaquizdr: :-)
21:36quizdri'm going to go get some biryani now and satisfy my taste buds with some spicy curry
21:36kristofOh! You lucky duck.
21:37quizdri'd say you should join me but i suspect that's not practical or likely.
21:37kristofI will travel the world over for spicy foods.
21:37quizdras do i
21:37kristofOh, that's actually a good idea. I wonder if my girlfriend would go for that...
21:37matt444Any hint at what I'm doing wrong here? https://www.refheap.com/24088
21:38quizdranyone else in here from Singapore?
21:38arrdemluxbock: yep :D
21:38arrdemluxbock: haven't used it for anything yet but I just got the import/export crud set up.
21:38quizdrthere's a big Haskell group here in Singapore but I'd love to get some Clojure meet ups going too. Heck I've never even used Haskell.
21:39ddellacostaquizdr: you are in Singapore? Are you doing Clojure there? I worked there for a short period when I was at my last company (based in Tokyo).
21:39quizdri'm in Singapore for about 2 years now. but my work is in C++ (unfortunately). Clojure is strictly a hobby for now
21:40quizdrsee yalls later
21:40charedon't fight the anger I let out all the rage
21:41luxbockarrdem: hmm it's never worked for me for some reason, but my org-setup is fairly customized so might be because of that
21:41ddellacostaquizdr: gotcha, enjoy
21:41arrdemluxbock: it turns out that mobile-org has some import-export work that needs to be done
21:42arrdemluxbock: it initially wasn't working for me either but after some bludgeoning it submitted
21:42ddellacostamatt444: what happens if you get rid of the close! ?
21:42luxbockmaybe I'll give it another go later today
21:43matt444@ddellacosta: same result
21:43arrdemluxbock: http://stackoverflow.com/questions/8432108/how-to-automatically-do-org-mobile-push-org-mobile-pull-in-emacs
21:44arrdemluxbock: http://orgmode.org/manual/MobileOrg.html#MobileOrg
21:44ddellacostamatt444: what result do you get by the way?
21:44matt444ddellacosta: 3
21:45luxbockare you storing your org-files in Dropbox only or are you using symlinks?
21:45arrdemluxbock: I have everything treed out in ~/doc and symlinked from ~/Dropbox to whatever I wanted DB to sync for me
21:45arrdemworked a treat
21:46arrdemonce I set up matching symlinks on all my boxes
21:46luxbockalright, I'll give it another go later today, thanks for the links
21:47ddellacostamatt444: not positive but I suspect you'll have to call <! multiple times to get all the values out of the merged channel. You may try to put that last line in a (while true ...) loop.
21:48matt444ddellacosta: yes, i think you're right
21:50ddellacostamatt444: ah, except by just looping through it, you'll just call map over and over, so that won't work. You probably will need to merge the channels outside of a while loop, then try pulling from the merged channel inside the loop.
21:51ddellacostaagain, not positive; haven't used merge much and not confident I grasp the semantics of it fully
21:51ddellacostanot much = not at all
22:07squidzi'm trying to make a function faster in clojurescript. The funciton uses assoc which seems to slowing it down. Does anybody know a faster way to implement this? Here is the funciton https://www.refheap.com/24094
22:10squidzit takes a map and one of the maps keys(group key), then returns a new map where every key is combined with the selected 'group key'
22:11AimHeresquidz, I don't know if it'll be faster, but you tried zipmap?
22:11AimHereSomething like (zipmap (map #(str k group-name) (keys m)) (vals m))
22:12dnolensquidz: also might be faster to use (into {} ...) as that will use transients
22:12AimHereYou might need to change the name of the 'map' argument
22:13squidzi'll try it with into and zipmap to see if that helps
22:13dnolensquidz: how big is the map?
22:13squidzaround 15-20 key values, but that is being called around 700 times
22:15AimHereOh, note that there's a 'reduce-kv' function for the sort of job you're doing
22:16AimHere(reduce-kv (fn [m k v] ... ) instead of the syntax you were using
22:17AimHereHang on, calling a function 700 times on 20 sets of keys?
22:17AimHereSo each time this is happening, you're morphing a key and then associng it back in place, taking whatever performance penalties for deleting and inserting a key?
22:18AimHereFor each key, can you fix it that you're doing all the mutations at once? You'd be saving 680 hash lookups
22:20dnolensquidz: how long is that taking (and under what circumstances?)
22:22eggheaddnolen: you should link to kioo in the om readme :)
22:22dnolenegghead: thx for the reminder will do
22:27squidzdnolen: right now it is taking around 3 seconds. What I am actually trying to do is given an array of maps, I want to transform so that the array shortens and the maps gain extra keys. I basicallly group by a key then for each of those gorups I output a map with combinations of that key with the remaining keys in the map. Here is all the code for an example https://www.refheap.com/24096
22:27dnolensquidz: 3 seconds? on what browser?
22:28dnolensquidz: I just made a map of 20 keys and I could run your function 700 times in ~45ms
22:31squidzon chrome. Let me give you a cljsfiddle http://cljsfiddle.net/fiddle/beandipper.datameld
22:31squidzit may be the other funcitons that call it
22:32dnolensquidz: even using your last refheap it takes < 30ms for 700 runs of meld-data
22:34squidzdnolen: here is chromes flame chart http://imgur.com/GLnb580
22:37squidzfor me the input for meld-data has 672 maps, each map having the length 13
22:38dnolensquidz: that's not a particularly informative flame chart w/o more information
22:38squidzdnolen: do you want the input data?
22:38dnolensquidz: that would help considerably
22:38dnolensquidz: what optimization settings here? advanced?
22:43squidzdnolen: simple optimization here is the data http://pastebin.com/5TTxj2rm
22:44jcromartiedear god, I've been trying to make this huge refactor all day and I'm just now finally getting the REPL to start…? maybe?
22:44jcromartieI suck
22:45dnolensquidz: that's not EDN, are you calling clj->js inside the loop?
22:45dnolensquidz: er js->clj
22:45warzhi all. new to clojure here. when writing a lib, like clj-http, is everything in `client.clj` visible to my app, or is there a way to export only certain functions, etc?
22:45warzlooks like everything is public, if you will
22:45squidzI am feeding the data like data -> js->clj -> meld-data
22:46squidzso only once before the call of meld-data
22:46dnolensquidz: k trying it out here
22:48jcromartiephew, it compiles finally
22:48jcromartieI know I should have done it in bite-size pieces
22:49jcromartiebut, records...
22:50jcromartieif I could just listen to technomancy...
22:51technomancyclojurebot: stairs is <reply>we warned you about stairs! http://www.mspaintadventures.com/sweetbroandhellajeff/archive/001.jpg
22:51clojurebotc'est bon!
22:52jcromartietomorrow will be time for serious pair up and code review, to get this thing in shape
22:52technomancyclojurebot: records is stairs
22:52clojurebotc'est bon!
22:53dnolensquidz: which group are you using?
22:53dnolensquidz: like that's the argument to meld-data here?
22:53squidzthe group is "scenario"
22:54squidzso (meld-data "scenario" data)
22:54dnolensquidz: cannot repro under advanced
22:54dnolensquidz: ~279ms
22:54dnolensquidz: under Node.js which is usually slower than Chrome
22:55dnolensquidz: for EDN conversion and call to meld
22:56dnolenafter JIT kicks in, ~110ms on my machine
22:56squidzhmmmm. I'm calling it in a go block. That shouldn't effect it so much right?
22:58dnolensquidz: seems unlike but your flamegraph is bizarrely noisy leading up to the call
22:58squidzpulling the data from a chan
22:58dnolensquidz: you're pulling data out of the chan in one big piece?
22:58squidzyes I think so
22:58dnolensquidz: under simple I see ~200ms
22:59dnolenstill nothing close to what you're seeing
23:00dnolensquidz: probably going to need a minimal reproducible case that removes all the surrounding context for me to dig in further.
23:01dnolensquidz: but from what I can tell, nothing slow about your data transform
23:01dnolenwell, not 3secs slow way
23:01squidzhm okay. Maybe trying to get a reproducable case will lead me to the problem if it is elsewhere in the project
23:02squidzi'll try to get a simple reproducable case and if I am still getting the same results i'll give you the simple case, but I sense that isolatiing it out will let me figure it out
23:09dnolensquidz: a simple perf test would be to set a global and then call your meld-data on a timeout to get it out of the go block stuff
23:12ddellacostavery confused with setting up cljx: I can load my cljx namespace in the (non cljs-) console, and cljx seems to be picking up changes based on my configuration, but I see no files produced and clojurescript is obviously not finding my cljx namespaces when I load it up in the browser. What is going on?
23:15akurilinDoes everybody else also implement logging as a one-time string dump in their Ring apps? As in, if you're printlning away one piece of information at a time, as opposed to building the entire log string first, you end up with a garbled mess during concurrent requests.
23:16akurilinI'm even bubbling up exceptions in the response map to the logger to prevent that from being a mess as well.
23:17`cbpuse an agen? :pt
23:17`cbpagent*
23:17akurilinTaking over exception propagation feels a bit strange.
23:17akurilin`cbp: this would effectively serialize it for me?
23:19`cbpa logging agent would fix the many things writing at once to a file
23:19`cbpit would queue the writes
23:21akurilingot it
23:29ddellacostaalright, so apparently you can't specify a specific filename in cljx source-paths...
23:34sritchiedo you guys know if anyone's written the inverse of ring's nested-params?
23:34sritchieto generate a map of params like {"card[zip]" "22302"} from input like {:card {:zip 22302}}
23:48ddellacostasritchie: I don't know of anything specifically, but where are you trying to use this? Is it within the context of an HTTP request, client or server-side?
23:48sritchiethis is for constructing requests to the stripe API
23:48sritchieAPI calls
23:49ddellacostasritchie: I don't know if it does all of what you need, but ring.util.codec has *some* functionality that will let you do stuff like {"foo" ["a" "b"]} => "foo=a&foo=b"
23:49sritchieah, okay
23:49sritchieI'll take a look
23:49ddellacostasorry, probably a bad example
23:49sritchieno, good pointer for a place to look
23:50ddellacostabut maybe that can help...will think of what else is out there.