#clojure logs

2014-10-10

00:41brainproxyis there a enlive selector for :type ? e.g. suppose I want to do a transform on comment nodes
00:52johannbrainproxy: ya try using the :comment keyword
00:56brainproxyjohann: how? (html/select resource [:comment]) ... that doesn't seem to work
00:57johannbrainproxy: can you show me a snippet of the html you are working with?
00:57brainproxyit's just some html which has <!-- comments --> in various places
00:57brainproxynothing unusual about it at all
00:58johannoh! i thought you were looking at xml with <comment></comment> tags
00:58brainproxyso, for example, if I swap :div for :comment, I get what I would expect
00:58brainproxyah, I see
00:58brainproxywell what I want is to be able to select nodes which aren't tags per se
00:58johannya interesting
00:59brainproxythey're in the sequences returned by enlive
00:59brainproxy{:type :comment ...}
01:00johannbut your issue is that you can't access it with the select function
01:00johannright?
01:00brainproxyare with html/at, etc.
01:00johannbut when you parse the entire document it shows it
01:00brainproxyis there a glob selector for any and all nodes?
01:01brainproxythen I could write my own transformer and choose to do something if (:type node) is :comment
01:01brainproxyotherwise, just dump node back out
01:01johannya what you want is html/html-resource i think
01:02brainproxyyep, using that
01:02brainproxyI mean a selector that will match any node
01:02brainproxywithin the body of html/at usage, etc.
01:03johannso you basically want just the clojure data of the html?
01:03johannsorry if i'm not helping! its late over here :)
01:04squeedeeYou know what I am finding harder than understanding functional programming.. functional unit tests.
01:04brainproxyno I have that also
01:04brainproxy:)
01:04squeedeeI seem to only know how to define imperitive unit tests
01:05johannsqueedee: always some resistance when taking on new modes of thought!
01:07squeedeei very quickly grasped how to think about the decomposition of a problem into pure functions. No problem with composition using currying, lookups, and by pivoting on state.
01:07justin_smithsqueedee: functional unit tests are easier because with truly functional code you don't need mocking or anything else: just check if a given input gives the correct output
01:07squeedeeI'm not saying i'm suddenly great at functional, but I find it pretty easy to grok..
01:07squeedeethe tests, not so much..
01:07justin_smithwhat's hard about the tests?
01:08johannya it'd be cool for you to show an example
01:08squeedeeFact is my unit testing habbits in imperative style are what brought me here
01:08squeedeeyeah ok lemme commit my rubbish
01:09squeedeeby brought me here, i mean, my unit testing made me more and more 'functional' even in my imperative languages
01:09johannbrainproxy: i'm still a little unsure of what you are trying to accomplish. if you can be patient with me and maybe try to reword it i can dedicate some good willed googling in your direction ;)
01:11johannsqueedee: what do you mean by that? like the scope of your tests closed in to the smallest possible units (in most problem spaces i mean) and voila its function composition?
01:13squeedeejohann not voila
01:13squeedeeit made me appreciate functional composition more. It also made me appreciate data-is-king
01:13squeedeehttps://github.com/squeedee/lsystem/blob/master/test/lsystem/core_test.clj
01:14johannya the data is king thing is still sort of marvelous to me
01:15squeedeejohann: my tests wanted minimal dependencies for simplicity, and wanted to do very little, so rather than a ball of state with a ball of behaviours around it, i wanted functions that were not tied to the design of the object
01:15squeedeeso a lot of my objects became 'command' style objects.
01:16squeedeewhich is a really loose way of saying 'function'
01:16johannyeah right
01:16johanni've been working with quil, which is a clojure api over processing, so i'm dealing with a little oo lately
01:17brainproxyjohann: (html/at resource **sel-for-any-node** (fn [n] (if (= (:type n) :comment) something n)))
01:17johannand i finally got that like an object is this well intended behavior that is a big pain to use outside of its creation-context
01:17squeedeeanyway, it made sense to me what rich was talking about when i listened to him, and what folks were saying elsewhere in the functional camp. But tests, not so sure about them.
01:18johannwhat's your uncertainty?
01:19squeedeeTho to be certain, this is my first clojure app, and i know im just stood at the starting line
01:19squeedeewell I'm used to my tests driving my design.
01:19justin_smithlooking at that test code, I see a bunch of stateless functions, where you provide an input and verify the output. This is the right way to do clojure testing.
01:20johannsqueedee: what's your workflow right now? are you using a repl?
01:21squeedeei guess that makes sense, but what i found was that I made a choice for all the tests at once, not an incremental, refactored choice as i tried to make all conditions pass
01:22squeedeefor this i moved out of the repl because i wanted to try test driving it. So I'm using LT and lein autoexpect
01:22johannkk
01:22squeedeeI use eval in LT a lot
01:22johannya i think having a short feedback loop to evaling smaller parts changes the role of tests a little
01:23squeedeedunno about that, works well in ruby, have a repl there
01:23johannsqueedee: i'm playing with enlive right now
01:23justin_smithsqueedee: side note, your current tests could be much more concise using (clojure.test/are [x y] (= x (iterate test-rules y)) [\a] [\a] (vec "ab") (vec "ab") ...)
01:24brainproxyjohann: so the correct way to express **self-for-any-node** is [html/any-node]
01:24johannwait i meant brainproxy for that last tag my bad
01:25justin_smithsqueedee: http://clojuredocs.org/clojure.test/are
01:30squeedeejustin_smith: thanks for the tip, not sure how i feel about it tho. Looks like 'examples' in other frameworks i've seen.
01:31justin_smithlooks like expectations isn't compatible with clojure.test anyway, I didn't realize
01:31squeedeesorry i mean 'theories'
01:33squeedeejustin_smith: it has this: http://jayfields.com/expectations/templating.html
01:34squeedeealthough thats when you change the subject, not the parameters
01:38vIkSiT'lo all
01:38vIkSiThas anyone used clojurescript secretary routes here?
01:38vIkSiTin conjunction with something like luminus?
01:38vIkSiThow do you ensure that routing from client side hpappens, while everything else is served from luminus?
01:38vIkSiTeg, /home should use scretary
01:39vIkSiTbut /api/getHomeData should use luminus
02:55learn2codehi, i come here to learn clojure
02:55TEttingerlearn2code, you picked the right place
02:56learn2codebut this is the first time I am here
02:56learn2codeand in IRC
02:56learn2codei dont know how IRC acutally works
02:56TEttingerthere's some good stuff here http://clojure-doc.org/articles/content.html#essentials
02:56TEttingerit's a chatroom
02:56TEttingerthere are many people here, but most aren't talking due to time zone differences
02:57learn2codeyeah, it's so quiet now
02:57TEttingerduring the day in the US it's much busier.
02:58learn2codeyeah, i am in US
02:58learn2codeI will try it tmr morning
02:58TEttingeris there a particular type of application you want to make with clojure?
02:58learn2codeyes, I do have
02:58TEttingerweb apps benefit a lot from it
02:58TEttingerI make games
02:58learn2codei want to build a small app
02:59learn2codejust keep polling ebay
02:59TEttingerthere's probably an API that can push updates?
03:00learn2codeand notify me whenever a new listed shows up and the price is acceptable to me
03:00learn2codethe input will be the <name> <price>
03:00learn2codeyeah, I know
03:00learn2codeclj-ebay
03:00learn2codei am using it
03:00TEttingergood!
03:01learn2codefor keep polling the server I use at-at
03:01learn2codethe point here is
03:01learn2codehow to connect them together
03:01learn2codeand handle the commandline to read arguments
03:05TEttingerat-at is great, yeah
03:05TEttingerthere is a lib for better command line arg parsing
03:07TEttingerhttps://github.com/clojure/tools.cli
03:08learn2codethanks TEttinger
03:09TEttingerno prob
03:11learn2codehow long have you been wokring with clojure
03:12learn2codedo you know any interesting app with good doc in Clojure that I can find on Github
03:16TEttingeroh, sorry learn2code , I was in another channel.
03:18TEttingerI'd say I've been working with clojure, on and off, for... maybe 3-4 years. it took me a long time to learn it and I kept getting impatient. it's easier to learn now, more resources
03:18TEttingerhttp://4clojure.com (or was it .net) is good
03:18learn2codelol
03:18learn2codei am looking at it now
03:19TEttingerI'd say leiningen itself may be a good option for a well-documented app on github
03:19TEttingerbut I haven't read its source
03:20TEttingerthere's documented source for lein here http://leiningen.org/reference.html
03:21learn2codenice
03:22TEttingeryou'll likely encounter a lot of symbols that are confusing early on, there's a good guide out there...
03:23learn2codeyeah, I collected a cheatsheet for me already
03:24TEttingerhttp://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
03:26learn2codewow
03:26learn2codethanks TEttinger
03:26TEttingerno problem! glad to help
03:27learn2codei am going to sleep
03:27learn2codeis there anyway to meet you again
03:27learn2codein IRC?
03:27learn2codethe same nick?
03:27TEttingerI'll likely be here in #clojure most days, same nick
03:27learn2codenice
03:27learn2codeg9
03:28TEttingerI have an IRC client that auto-joins several channels, #clojure is one
03:29learn2codeyou built by yourself or had from somewhere else
03:30learn2codethat's exactly what I want
03:35Rhainurlearn2code: most IRC clients do auto-joining
04:13yekKhastehi every body!
04:13yekKhasteI want to start learning clojure
04:14yekKhastebut I have no exprince with lisp or functional programming
04:14yekKhasteWhere is best place to start?
04:15johannyekKhaste: hi!
04:15johannyekKhaste: obviously this is a matter of personal taste, but this is a really nice resource for beginners http://www.braveclojure.com/
04:17yekKhastejohann, Thank, but what next?
04:17yekKhastewhere can I learn more about clojure
04:17johanni'd suggest starting off with the clojurekoans just so you can get introduced to the syntax and core ideas
04:17johannhttp://clojurekoans.com/
04:18yekKhasteAnd is it possible to build android app with clojure?
04:18yekKhasteI hate java, but I like make android app
04:19johannya theres a mailing list of people who use clojure on android
04:19yekKhastejohann, Thank a lot!
04:19johannno problem!
04:20johannif you need help setting your environment or anything let me know
04:20johannyou should also check out lighttable. http://lighttable.com/
04:22johannheres the mailing list for clojure-android if you want to ask them any questions https://groups.google.com/forum/#!forum/clojure-android
04:49kenrestivoi vaguely remember seeing a macro somewhere that'd turn [foo bar] into {:foo foo, :bar bar}
04:49kenrestivonow i can't find it tho
04:52scottjkenrestivo: flatland.useful.map/keyed
04:52kenrestivoaha! thanks, i had a feeling it'd be a flatland
05:01donbonifaciois there a way to reload all code in the repl?
05:03schmirdonbonifacio: https://github.com/clojure/tools.namespace
05:03kungidonbonifacio: yes
05:03kungidonbonifacio: try tools.namespace, but think about global state first
05:08donbonifaciothanks :) I don't have global state. On my workflow I edit files in vim and after a while the repl stays out of date, and I'd like a sync without restart
05:10kungidonbonifacio: then tools.namespace.repl/refresh probably is what you need
05:10kungidonbonifacio: If you write a webapp you can also use a ring middleware to reload your files
07:56conorbevI just came across the function alter-var-root. Am I missing something or is it understandable that I'm surprised it doesn't end in ! ? It seems pretty similar in function to swap! on an atom.
08:03noncomconorbev: idk.. who knows..
08:07conorbevOK :)
08:17skratl0x1can anyone look at this one and suggest some improvements? http://stackoverflow.com/questions/26299169/updating-nested-structures-in-clojure
08:23noncomskratl0x1: well, idk, but try looking at a solution using (reduce) or reducers .. or even (loop)...
08:23noncomjust implement them and see how they work..
08:27skratl0x1noncom: aren't reducers mostly for multi-core applications? this one will run in cljs, but if reducers can simplify it / make it more readable, then why not, but how?
08:28schmirskratl0x1: I do think this is a bit too much magic. and I fail to see why the "by-hand" approach leads to ugly code
08:29noncomskratl0x1: try first doing this with (reduce).. at least you will see the difference
08:30skratl0x1schmir: because the application of this function is much more clear than reading through (into {} (for.. (for.. (into {} (for... (for ...
08:30skratl0x1this is more generic approach to the problem, it makes the code much more readable
08:36schmirskratl0x1: (map-values (fn [list-of-geoms] (map inc-buffer list-of-geoms)) sample) IMHO is much more readable. you just have to implement map-values and inc-buffer.
08:36schmir(unless you really need the generic solution)
08:37schmirI think you should use a keyword instead of *
08:37dmi3yGuys, I'm not able to use clj-time in my project for some reason: https://www.refheap.com/91532 Does anyone know what am I doing wrong?
08:38skratl0x1schmir: yeah, I made it use the * for its common use as a wildcard
08:39skratl0x1schmir: anyway, the question was, given the API that I want, how to make the function /better/
08:40skratl0x1I don't think paths (including wildcards) or selectors is any kind of anti-pattern
08:41skratl0x1not to mention that the f actually has to take the current path too
08:50clgvdmi3y: looks like a dependency conflict. what does "lein deps :tree" tell you?
08:53dmi3y@clgv yup, my deps tree looks scarry: https://www.refheap.com/91536
08:54dmi3yclgv thanks for the tip
08:55clgvdmi3y: [org.elasticsearch/elasticsearch-hadoop "2.0.1"] wins of clj-time with respect to joda-time
08:55clgvs/of/over/
08:56clgvdmi3y: so it probably pulls in an incompatible joda-time
08:56dmi3yso, can I just exlude joda-time from elasticsearch-hadoop deps?
08:58clgvdmi3y: without knowing that lib I can't tell. you can try - provided you have a good test suite you can be confident to a certain degree whether it works or doesn't work
08:58dmi3yclgv: got it, thank you
08:58clgvbtw. why does "lein deps :tree" always print "warn" as first line?
08:59schmirskratl0x1: the function creates elements for non-existent keys
09:01schmirskratl0x1: (update-each-in {} [:xxx * :foo] first)
09:01clgvskratl0x1: depending on your scenario something like clojure.walk/postwalk-replace might be handy
09:09gfredericksreiddraper: I've been pondering the problem of "test.check only generates tiny numbers" and was thinking maybe the size should bound the log of the numbers generated instead of their actual value?
09:10gfredericksI'm also trying to tackle gen-double is how I got on that topic
09:11gfredericks"just use a bigger size" is problematic because collections
09:12gfredericksmaybe we could add generators for "small numbers" that work like the current ones, for whenever that's useful
09:12gfredericksor just assume people know how to call Math/log
09:27clgvgfredericks: what is the concrete problem?
09:38mdeboardglobal concrete shortage
09:39mdeboardI seriously can't believe I'm getting porn spam on irc
09:39rolfbmdeboard: spam on irc? never experienced
09:40rolfbunsolicitied pm's with links?
09:40mdeboardyeah
09:40Bronsait's more frequent than one might expect
09:40mdeboardand it's ONLY in the clojure channel
09:40mdeboardOnly from bots in the clojure channel, that is
09:40ken_barberyeah, we get lots in #puppet, pm or in chan
09:40mdeboardI'm in several other high traffic channels, never get bots
09:40rolfbwow
09:40ken_barberoh speak of the devil, its trisnti pinging me now
09:40mdeboardyeah
09:40mdeboardthat was what prompted
09:50gfredericksclgv: in the default usage of test.check you'll pretty much never generate numbers outside of the range -200 ... 200
09:50clgvgfredericks: ah right, because of the shrinking strategy
09:50gfredericksno
09:50gfredericksbecause of sizing
09:51clgvgfredericks: yeah is that not related to shrinking as well?
09:51gfredericksin that large numbers could prompt enormous shrinks?
09:52clgvok, so you want to add generators with a maximum range that grows much faster or that does not grow at all?
09:52gfredericksgrows much faster
09:52gfredericksexponentially faster probably
09:52clgvjust trying to understand the issue ;)
09:53gfredericksi.e., it should not require customization to generate arbitrary numbers in the range of Long/{MIN,MAX}_VALUE
09:53clgvok those are probably usefull for algorithms on numbers or differently stated: numbers that do not correspond to collection sizes or similar
09:53clgvok, sounds pretty useful
09:53gfredericksyeah that's why I was thinking both sizing strategies could be useful
09:54gfredericksI'll probably just start by adding some generators to test.chuck
09:54clgvchuck the groundhog? :P
10:16vermawhat's the opposite of cider-jack-in? Like I want to kill the repl stuff that's running
10:16CookedGryphoncider-quit
10:17vermanice
10:17vermayay
10:17verma(inc CookedGryphon)
10:17lazybot⇒ 3
10:18clgvprobably you'd sometimes prefer to kill it instead of quit ;)
10:20vermaclgv there doesn't seem to be a cider-kill
10:20vermaalso, sometimes the repl window goes away
10:20vermahow do I bring it back/
10:21clgvverma: that was just a joke on "kill" ;)
10:21vermaoh :P
10:22clgvbut yeah I love my "killall -9 java" :D
10:22clgv;)
10:22vermaYes, I've been needing it more often past few hours
10:41perplexahi, can i ensure the order of execution of statements?
10:42Bronsaperplexa: are you asking if it's guaranteed that in (do 1 2 3) 1 will be executed before 2 before 3?
10:42perplexaBronsa: yes exactly
10:42Bronsayes
10:42perplexai have (a) (b) and (c), which need to get executed in order, b relies on a, and c should be executed last, but since b takes some time c always is first
10:42perplexawhich then breaks b
10:43perplexaBronsa: how would i do that?
10:43perplexaalso, trisnti is sending spam/worms/whatever - should remove from channel :P
10:44clgvperplexa: woah evil chains of side effects - try to be sure if that is really necessary
10:44Bronsaperplexa: I'm not sure I understand what you're asking anymore. it looks like you are doing side-effecty async stuff
10:44perplexaclgv: connecting to zookeeper, fetching data and dropping connection, yes, it's necessary i think. and since i only need to do it once, i don't want to leave the connection open
10:45clgvperplexa: if this is in parallel you can use promises to synchronize
10:46perplexamh
10:46clgveach function can return a promise which is delivered as soon as its work is completed and then you could do (do @(a) @(b) @(c))
10:47clgvperplexa: ah ok so you need the data from (b) as result value?
10:47perplexayep
10:47clgvthen just adjust the idea above appropriately ;)
10:48perplexareading up on promises
10:48clgvperplexa: humm a different question: doesnt the code initiating the connection block until you have one? and is there not a blocking method to wait for the data?
10:48perplexathank you
10:48clgvperplexa: if so you really dont need the promises ;)
10:49perplexaclgv: let me check
10:49clgvperplexa: if conenction implements java.io.Closeable you could just do (with-open [conn (create-zookeeper-connection)] (get-data-blocking conn))
10:49gilr00ytest test
10:50perplexaclgv: even when i use :async? false it tells me the connection has expired
10:50perplexathe connection is open, that works ;/
10:51clgvperplexa: do you use clojure library for zookeeper or its java libs directly?
10:51perplexafetching data usually takes a couple of secs and close always gets called first ;x
10:51perplexausing liebke/zookeeper-clj
10:54clgvperplexa: wow last update 3 years ago - are you sure you want to use that?
10:54perplexano but i didn't find anything else
10:55vermaman, my cljs repls keep dying :(
10:58vermaany help appreciated: https://www.refheap.com/91544
10:58perplexaclgv: i guess i'll instead just establish the zk connection when the app starts and close when it terminates ;/
11:01vermaI guess I am going to go restart my computer like some neanderthal :(
11:05drorbemetHi, maybe you have any suggestions on how to procede. I am searching for the current solution for completion and navigation in clojure projects. I am using emacs prelude as a base, and I am used to smex and org-mode: Should I use helm-clojure? I think I am struggling with compatibility issues and overlapping of functionality of the following modes: smex, ido, orgmode, company, helm.
11:08nwjsmithdrorbemet: cider probably https://github.com/clojure-emacs/cider
11:18zotis there a nice way to use (-> "resource.edn" io/resource … edn/read) instead of slurp + read-string?
11:18drorbemetnwjsmith: yes I am using cider. ... ok right I should try to stick to it's functions first, thanks
11:22llasramzot: Not built-in. I define a utility `edn-slurp` or such
11:27zotafter much more googling, found this: (with-open [r (-> "ph-fs-c1.edn" io/resource io/reader java.io.PushbackReader.)] (edn/read r))
11:27zot(that's my working version from the example)
11:29llasramzot: Yep, that basic structure should work fine (assuming your EDN files contain only a single top-level EDN form)
11:29zotthey do ;) i was hoping something would return the PushbackReader directly, but that's still reasonably tight
11:29si14how hard can it be to use Friend with bidi?
11:30llasramzot: There is not, but that is IMHO for the best. Learn to embrace the platform :-)
11:35vermaits just a bad day :( can't get any cljs repls to work
11:36arrdemjustin_smith: I'm pretty sure on that SO question he was working with an elided (deftype Double [x y])
11:40perplexa,(def x) (bound? x)
11:40clojurebot#'sandbox/x
11:40perplexameh
11:40gfredericks,(bound? x)
11:40clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Var>
11:40gfredericks,(bound? #'x)
11:41clojurebotfalse
11:41perplexahmkay ;x
11:41perplexaty
11:46reiddrapergfredericks: yeah the whole number generation in test.check could use an overhaul, including generating larger numbers when generating scalars
11:47mmeixI have a very basic newbie-question
11:47mmeixhttps://www.refheap.com/91545
11:48arrdemmmeix: and is a macro not a function
11:48arrdemmmeix: macros cannot be partially applied
11:48mmeixok
11:48arrdemmmeix: note that or is a macro as well.
11:48mmeixso this is why (comp not or) will not work
11:48arrdemmmeix: what you want here is (fn [x y] (and x y)), which is a function you can throw around
11:48justin_smitharrdem: yeah, probably, just didn't want to take that for granted
11:48arrdem*correct
11:48arrdemmmeix: coorect
11:49arrdemjustin_smith: 's k I'll take all the sweet karma you don't need more anyway
11:49justin_smithheh
11:49mmeixthanks
11:49arrdemmmeix: np
11:50justin_smitharrdem: also, that diagram is weird - it provides no way to distinguish between pointing to the head of a list and pointing to the element contained in the item at the head of the list
11:50vermaany idea why this is happeneing: https://gist.github.com/verma/d3c2ac234f10aac62b0a
11:50arrdemjustin_smith: agreed
11:50vermaI feel my defrecord/defprotocol stuff is correct (I hope)
11:50martinklepschwhat am I doing wrong if my (go .. (<! ... )) only does something the second time something should arrive?
11:50arrdemoh god that stack trace
11:50vermathis is line 31 is my source though; https://gist.github.com/verma/d3c2ac234f10aac62b0a#file-renderer-cljs-L11
11:50Bronsaverma: you have a defn inside the defrecord
11:51vermaoh what
11:51Bronsahttps://gist.github.com/verma/d3c2ac234f10aac62b0a#file-renderer-cljs-L31
11:51arrdem(inc Bronsa)
11:51vermaoh what the f**ck
11:51lazybot⇒ 60
11:51verma(inc Bronsa)
11:51lazybot⇒ 61
11:51vermaman
11:51verma:D
11:51vermadafuq did that come from
11:51vermaI am not even sure
11:52vermaI think I am splitting into two personalites, for real, one tries to fuck up with the other
11:53vermaBronsa, everything is working now :) thanks
11:55Bronsanp
11:56mmeixfollow-up question
11:56mmeixI can say:
11:56mmeix(defn nor [v w] (not (or v w)))
11:56arrdemsure
11:57nkozammeix: but nor will evaluate his arguments, you should implement it as a macro to short-circuit like or does
11:57pyninjawhat's the best way to distribute a clojure project as a command line script?
11:59justin_smithpyninja: uberjar - jars support embedded shebang
12:00pyninjajustin_smith, i ran `lein uberjar` and I can do `java -jar target/...-standalone.jar` now. What's the easiest way to avoid having to type `java -jar` every time? What do you mean by embedding shebang?
12:01justin_smithhttps://gist.github.com/briandealwis/782862
12:02justin_smiththis will never work on Windows, btw
12:02justin_smithand the linux version is actually via configuring binfmt-misc iirc
12:02gfredericksreiddraper: (->> (gen/sample gen-double 100) shuffle (take 10))
12:03gfredericks(-1.892723244743957E-168 -1.6700025521101543E-200 -2.386704789976519E-273 8.305320896742236E-221 -5.260968365987402E-108 6.572354280687105E285 -3.064843548259326E213 -3.2056301999684517E179 4.952015778406743E156 -Infinity)
12:03pyninjajustin_smith, thanks, will try
12:03gfredericksI just fmapped it from a significant and exponent
12:03gfredericksI can't remember if there were any known downsides with that approach?
12:06gfredericksI just did a failing property that checks that a random double is < 42.0
12:06gfredericksit failed at 9.811099542902225E117 and shrunk to 64.0
12:09reiddrapergfredericks: yeah i think shrinking was kind of the open question with doubles
12:10reiddrapergfredericks: also not sure i follow that last example, both 9.8 and 64.0 it considered < 42.0?
12:10mmeixI have a follow-up question (please bear with basic stuff) https://www.refheap.com/91547
12:11justin_smith,(or [false false]) ; mmeix
12:11clojurebot[false false]
12:11justin_smith,(boolean (or [false false])) ; mmeix
12:11clojurebottrue
12:12justin_smithit's a collection of falses, and collections are truthy
12:12Bronsa,(some [false nil true])
12:12clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/some>
12:12Bronsa,(some identity [false nil true])
12:12clojurebottrue
12:12mmeixah, i see ... what would be the remedy?
12:12justin_smithBronsa: for style points, (some boolean [false nil true]) would be nice here :)
12:13Bronsammeix: use some/not-any/every? when you need to apply or/and
12:14mmeixaha ... this wan't obvious to me
12:14Bronsajustin_smith: meh, truthy and falsey are good enough for me :)
12:14mmeixso simple "or" and "and" only for two arguments?
12:15Bronsammeix: no
12:15Bronsa,(or nil false true)
12:15clojurebottrue
12:15mmeixright
12:15Bronsammeix: what you're trying to do there is to apply "or" to a collection of values
12:15mmeixI wanted to create a nor with variable argument number
12:15Bronsaand that's not possible because or is a macro
12:15Bronsayou have to use a function for that
12:16mmeixso this is a real followup to my older question
12:16mmeixok - thanks
12:16Bronsaclojure has a bunch of functions that usually can be used when you want to "apply" or/and
12:16bbloompuredanger: i noticed you've been working on the feature expressions design page, i wanted to point out some extra complications with portable errors, so i updated http://dev.clojure.org/display/design/Platform+Errors
12:16mmeixthanks all!
12:16Bronsathose are some, not-any?, every?, not-every, every-pred, some-fn
12:17Bronsalook them up, the docstrings are pretty nice
12:17mmeixgreat
12:17mmeixthnx again
12:17Bronsanp
12:17bbloompuredanger: in short, js/Object isn't the superclass of all types, and it's possible to throw numbers, strings, etc that are not instances of Object, so you really do need a :default or comparable no-instanceof form
12:19cka3ychow to do realtimeoutput to console ? (clojure.java.shell/sh "ping" "google.com")
12:24cka3ycsh returns a map of
12:24cka3yc :out => sub-process's stdout (as byte[] or String)
12:25cka3ycbut how can I read it line by line (before process is finished)?
12:30cka3ycanyone?
12:30clojurebotanyone is anybody
12:31clgvcka3yc: there is a library from raynes that provides the input/ouput streams to you
12:31Raynesdas conch
12:31clgvRaynes: oh he is alive. long time no (irc) see ;)
12:31RaynesYou don't want the input or output streams though.
12:31RaynesI'm always here.
12:31RaynesJust too busy to stare at the channel all the time these days.
12:31RaynesAlways around for pings though :)
12:32clgvdid I just address you directly with "he" - guess I should be going home soon...
12:33cka3yc"You don't want the input or output streams though" why?
12:33clgvcka3yc: do you want to interact with the programm as in "simulate a commandline user"?
12:33RaynesOh, sorry, forgot to actually be helpful.
12:34RaynesConch gives you a high level interface that can return a lazy sequence of lines while the process is running.
12:34clgvRaynes: yeah your signal to noise ratio has seen better times ;)
12:34RaynesI suggest you use that rather than reimplement it on top of the lower level streams.
12:34clgvRaynes: ah interesting, I guess I used a pretty old version of it
12:35cka3ycyes, I want to show output to user line by line when it comes in and not when subprocess is done
12:35clgvuh right. 0.2.4 ... havent touched that code in a while
12:36cka3yc(future (sh/stream-to-out p :out)) ?
12:39justin_smithProcessBuilder isn't super hard to use either, and it provides very flexible streaming of stdout / stderr / stdin (into the process)
12:39clgvcka3yc: looks like what you need, from the name ;)
12:40RaynesIt really isn't.
12:40RaynesThe README has detailed instructions for using conch to get a lazy seq of lines from a process.
12:40clgvdidnt he want to stream output as it's available
12:40RaynesHe wanted to stream line by line.
12:40RaynesOr, that's what he said.
12:41cka3ycthanks, will go learn java then
12:41clgvah ok, I thought that was just a way of saying "asap"
12:42stuartsierraIs there a Java process-invocation scheme that gives you NIO channels instead of streams?
12:48justin_smithstuartsierra: the default for ProcessBuilder is a ProcessBuilder.Redirect/PIPE, I wonder if that has any relation to nio.channels.Pipe?
12:48justin_smithprobably not
12:52stuartsierraLooks like it only supports redirection to files or inheriting from the current process.
12:53justin_smithstuartsierra: it does InputStream / OutputStream
12:53justin_smithmy usual technique is a thread that reads from the stream and prints when lines are complete
12:53stuartsierraYes, those are blocking I/O. I was wondering if I could do async I/O with a process.
12:53justin_smithright
12:56stuartsierraProcess.getInputStream returns a java.lang.UNIXProcess$ProcessPipeInputStream
12:58stuartsierraOh, but you *can* wrap a Channel around an InputStream.
12:58technomancy"This project is famous. If that many other packages are referencing it, it must be good and useful." https://www.versioneye.com/java/org.clojure:clojure/1.6.0
12:59technomancywait actually http://chainsawsuit.com/comic/2014/10/08/nod-with-feeling/
13:00mdeboard:|
13:02justin_smithOT: best company to buy a domain name from?
13:03arrdemI've heard good things about Ghandi and they package DNS with domains for dirt cheap
13:03arrdemwill probably be moving my stuff to them when my existing dyndns subscriptions get closer to expirint
13:04clgvtechnomancy: haha :D
13:05gfredericksoh god cider has gotten itself into some sort of funk where it errors every 1 second
13:07CookedGryphongfredericks: sounds familiar
13:08gfrederickscouldn't figure out how to disable cider in that buffer because it takes more than 1 second for me to type M-x fundamental-mode, so I just did cider-quit
13:09nullptrthough, cider updates approximately hourly and sometimes just fetching all the latest bits fixes weird behavior for a while
13:10arrdemisn't that just doing a git local install and picking a tag?
13:11gfredericksgit submodules probably?
13:12technomancygfredericks: el-get
13:14gfrederickstechnomancy: lets me fix versions?
13:14technomancygfredericks: yeap
13:14technomancygfredericks: also supports TLS
13:15gfredericks"The Latest Soup"
13:15gfredericksLeftover
13:15gfredericksSandwich
13:15gfredericksthe lettuce salad
13:16gfrederickstechnomancy: I will look into this thamks
13:16gfredericks(inc technomancy)
13:16lazybot⇒ 144
13:16gfrederickssquare!
13:16technomancygfredericks: it's not quite as polished, but it puts the user back in control
13:23llasram(inc technomancy)
13:23lazybot⇒ 145
13:23llasramtechnomancy's too hip to be square
13:29dwysockicould somebody explain to me the limitations of Engelberg's instaparse's total parse mode?
13:29dwysockiI'm using it to parse a mini-java program, and I inserted an extra semicolon in the middle of the program, expecting it to parse up to there, and insert a :failure node
13:30dwysockiinstead it returns only a :failure node, containing the entire program's text
13:30dwysockiso somehow I'm mis-interpreting the way it works
13:33arrdemdwysocki: by default instaparse will do total parsing, you need to enable partial parsing probaboy
13:33arrdem*probably
13:38gfrederickstest.check double generator https://github.com/gfredericks/test.chuck/commit/d330aadc335d3910de524d35d2e9a10ac4441002
13:39reiddrapergfredericks: woot
13:42justin_smitharrdem: http://noisesmith.org/ thanks for the advice
13:42clgvgfredericks: Chuck Norris counted to infinity. Twice!
13:42arrdemjustin_smith: hope it works out for you
13:43arrdemjustin_smith: was .com taken? you could have gotten .us and been cool like technomancy :P
13:43justin_smithheh
13:43justin_smitharrdem: godaddy parked - and I plan to use it for my open source stuff, so org seemed more apropriate anyway
13:44dwysockiarrdem: I thought the point of total parses was to parse up to the point of failure, and insert a failure node containing whatever wasn't parsed
13:44mpinghi
13:44arrdemdwysocki: no a total parse is all or nothing
13:44technomancyactually I had people think I created http://www.technomancy.org/google-suggest-venn which was actually kind of cool
13:44arrdemdwysocki: AFAIK
13:45arrdemdwysocki: hacking on something else and not looking at the docs atm
13:45dwysockiarrdem: that seems counter to the example in the readme
13:45arrdemdwysocki: then ignore me
13:45dwysockiarrdem: lol ok
13:45arrdemdwysocki: :P
13:45dwysockiarrdem: thanks for helping anyway
13:46dwysockiI'm basically trying to parse up to the point of failure, and then, depending on context, parse what follows the failure with a different start rule
13:46dwysockiI thought total parse mode was the way to do it, but it doesn't seem to work as I thought :\
13:48nwjsmithJava Interop question: If I add a type hint ^Object for a call to .hashCode, is it problematic if the "actual" callee has it's own implementation of hashCode?
13:48clgvnwjsmith: type hint "^Object" is worthless
13:49Bronsa,(defrecord x [] Object (hashCode [_] 1))
13:49clojurebot#<CompilerException java.lang.ClassFormatError: Duplicate method name&signature in class file sandbox/x, compiling:(NO_SOURCE_PATH:0:0)>
13:50Bronsa,(deftype x [] Object (hashCode [_] 1))
13:50clojurebotsandbox.x
13:50Bronsa,(.hashCode ^Object (x.))
13:50clojurebot1
13:50Bronsanwjsmith: ^ no issue
13:50clgvnwjsmith: methods on the JVM are virtual by default so you can not select a method by casting
13:51dwysockidoes anybody know of any projects that actually use instaparse?
13:51dwysockithe documentation is nice, but I'd like to see some real examples
13:51nwjsmithclvv: k, so it's unreasonable to assume that I can ditch the reflection warnings for a function calling 'hashCode' on an unknown (at compile time) type
13:52arrdemdwysocki: https://github.com/arrdem/dogeon :P
13:52dwysockilol
13:52nwjsmithclgv: on reading my question, I'm answering my own question
13:52dwysockiarrdem: I'll look at it anyway
13:53arrdemdwysocki: how kind if you :P
13:53dwysockioh, that reminds me
13:53dwysockiis there anything better than slurp for inputting the code to parse?
13:54dwysockiseems like there should be a lazier way to do it
13:59bwreillythere isn't a destructuring syntax for simply dumping all the keys in a map, is there?
13:59bwreillysomething like
13:59bwreilly(let [{:keys :all} {:a "welp"}] a) => "welp"
13:59arrdembwreilly: how could there be?
13:59arrdembwreilly: local bindings are static, a map is arbitrary
13:59gfrederickseval!
14:00arrdemgfredericks: shhhhh
14:01gfredericksalso, walk the code and replaced all unresolved symbols with map lookups
14:02gfrederickswhich has a laughable amount of edge cases
14:02gfredericksso...do it
14:02bwreillyhaha
14:02gfredericksmethod-missing.clj
14:02arrdemo gawd wai
14:06gfredericksWARNING: CIDER's version (0.7.0) does not match cider-nrepl's version ("0.7.0")
14:06gfredericksI think that's due to my whidbey problems actually
14:07justin_smithis there a "cider errors" twitter parody account yet?
14:07gfredericksjustin_smith: I think it's comparing "0.7.0" to "\"0.7.0\""
14:07justin_smithbut why would either version string have quotes in it?
14:08gfredericksmine does because whidbey
14:08gfredericksis malfunctioning
14:08gfredericksand double quoting everything
14:09gfrederickseverything in my repl gets printed as if wrapped in pr-str
14:09justin_smithinteresting
14:09gfredericksbecause whidbeys' middleware is pprinting and the builtin pr-str middleware is still there too
14:11gfredericksthere's some haxy side-effects at the top level of the whidbey code but for some reason I haven't dug into yet that's sufficient for me
14:11gfredericksprobably *any other* middleware mentions pr-values and that's all it takes
14:15dwysockifrom what I've found on github and google
14:15dwysockiit doesn't look like anybody has tried writing a very big parser in instaparse
14:16dwysockijust nice little languages
14:16dwysockidoes anybody think I should just switch to clj-antlr if I'm trying to a rather complicated parser?
14:16pjstadighttps://github.com/pjstadig/clojure/commit/d8b5178f3836d5ff5ec19d3eda7aa7f79fceecee
14:17dwysockithe biggest issue I'm seeing right now with instaparse is its error reporting
14:17dwysockiit gives you one error, and ends
14:17dwysockiI need error recovery, which antlr supports
14:20arrdempjstadig: nice!
14:20pjstadigarrdem: i'm offering it to anyone who wants to push it through the clojure contribution process
14:22pjstadigi've signed the CA so there shouldn't be any problem there (not that it's that much code anyway)
14:22stuartsierrapjstadig: looks relatively easy. Have you submitted a patch on JIRA?
14:23tvanhensanyone been able to read config variables in project.clj during the build phase of heroku?
14:23technomancytvanhens: I would highly recommend against that
14:23technomancythere are ways you can do it, but it's almost always a bad idea
14:23puredangerpjstadig: please submit!
14:23tvanhenshow do you configure creds for things like s3 wagon?
14:23technomancytvanhens: ah, yes credentials are a special case where it's OK
14:24tvanhensyeah its only for creds
14:24tvanhensfor s3 wagon and datomic
14:24technomancytvanhens: LEIN_USERNAME, LEIN_PASSWORD, and LEIN_PASSPHRASE are propagated automatically
14:24technomancyfor other things, see https://github.com/heroku/heroku-buildpack-clojure#configuration
14:25tvanhensawesome, thanks :)
14:31edbondwhy nil here? (async/<!! (async/onto-chan (chan 100) ["ABC" "DEF"]))
14:31edbond,(async/<!! (async/onto-chan (chan 100) ["ABC" "DEF"]))
14:31clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: async, compiling:(NO_SOURCE_PATH:0:0)>
14:32tvanhenstechnomancy, do you know of any examples where BUILD_CONFIG_WHITELIST is used? I tried to add my keys space seperated to that var and re-pushed but it lead to a weird file not found error
14:35edbondhm, (async/<!! (async/to-chan ["ABC" "DEF"])) works fine
14:41drorbemet1What is the line to start cider repl using emacs lisp (cider-jack-in "~/clojureproject") gives me a promt for a path because it is interactive
14:42edbondproblem solved, onto-chan doesn't return chan ^_^
14:43stompyjWhat does #’ mean in clojure?
14:43stompyjI’m not familiar with it, and it’s hard to search
14:44jeremyheilerstompyj: var
14:44justin_smith,'#'+
14:44clojurebot(var +)
14:44stompyjaha
14:44stompyjthanks!
14:44edbondstompyj, http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
14:45stompyjdanke
14:45drorbemet1I would like to start cider repl using emacs lisp on startup of emacs
14:45jeremyheilerstompyj: also http://clojure.org/reader
14:45dthurnq: are there versions of 'conj' that default to different types, like say a set, when the first arg is nil?
14:46jeremyheilerdthurn: you can use fnil to make one
14:46pjstadigstuartsierra: puredanger: http://dev.clojure.org/jira/browse/CLJ-1561 i guess
14:46puredangerthx
14:46jeremyheiler,((fnil conj #{}) nil 1)
14:46clojurebot#{1}
14:47dthurncool, thanks
14:47justin_smithvery useful when used inside update-in
14:48stuartsierradthurn: Note: if this is used in a performance-sensitive loop, define the `fnil` function once outside the loop.
14:49stuartsierraI recall someone wrote a test.check extension for describing systems in terms of actions, anybody remember the name?
15:03amalloybwreilly: http://stackoverflow.com/questions/9345056/in-clojure-how-to-destructure-all-the-keys-of-a-map
15:04bwreillyamalloy: thanks
15:04arrdemwe don't have a "defmemfn", do we?
15:05arrdemfor "mem" being "memoize" not "member"
15:06bwreillyreally a curiosity, I've been soured on the more elaborate means of destructuring recently around readability/visibility issues
15:11puredangerwe released transducers for Java, JavaScript, and Ruby today if anyone is interested http://cognitect-labs.github.io/
15:11puredangeryou know, for those "other" languages :)
15:12arrdempuredanger: when does the Haskell edition come out?
15:12puredangerno plans for that one :) left for the reader….
15:13arrdempuredanger: so why have a custom function type that happens not to be clojure.lang.Fn?
15:14puredangerso it's not tied to Clojure?
15:14puredangerre Haskell… https://twitter.com/bodil/status/513031949586141184 :)
15:15arrdemlols
15:15puredangerhe did actually say that too :)
15:16mdeboardpuredanger: you work at cognitect too?
15:16puredangeryes
15:16grim_radical"Because transducers-java may be incorporated into products or client projects, we prefer to do development internally and do not accept pull requests or patches."
15:16grim_radical:/
15:16mdeboardlive by the sword
15:17llasramAnd Cognitect's policy toward open source software remains as insane as ever
15:20dysfun:(
15:22amalloyarrdem: no, there is no defmemfn. useful does actually have one, although i don't really recommend using it: you don't usually want your memoization cache permanently locked up in a var
15:23amalloyit's better to memoize functions within some kind of scope so you can free them when you're done
15:24arrdemamalloy: yeah exactly that's bitten me before
15:24arrdem*that has
15:27amalloy$mail danielcompton i released useful 0.11.3 for you
15:27lazybotMessage saved.
16:02technomancyllasram: "technically open source"
16:06pjstadigtechnomancy: llasram: "transparent source"
16:06llasram(inc pjstadig)
16:06lazybot⇒ 7
16:39lvhis there a particularly good lein template for doing om (cljs) + sente (clj srver side) development?
16:39lvhseems like you always have to set one or the other up manually
16:42amalloy"transparent source". i like that description
16:44gfredericksit's at least forkable right?
17:16puredangerbbloom: btw I did see your message above re portable catch all and will try to bring that out more on the page
17:17bbloompuredanger: cool thanks
17:18brianwonghey guys, i have a question about mocking and with-redefs-fn. I am trying to test a namespace, but i am trying to mock out a function that that namespace uses, not a function defined in the namespace being tested.
17:18brianwonghopefully this example helps
17:18brianwonghttps://www.refheap.com/91577
17:18bbloompuredanger: those damn js semantics, huh?
17:18dogonthehorizonHey folks, I'm rolling my own DSL and I'd like to limit the use of certain forms to specific parent forms. e.g. I would only like to realize send-test if it's parent form is method-call: (method-call (send-test "something")). Is this possible via macros or some other language construct currently in core?
17:19justin_smithbrianwong: yeah, that's what with-redefs is for
17:19justin_smith(doc with-redefs)
17:19clojurebot"([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mocking out functions durin
17:20jeremyheilerbrianwong: you just need a reference to teh var that holds that function
17:20justin_smithjeremyheiler: with with-redefs you don't even need that
17:20brianwongall the examples seem to mock out functions defined in the namespace being tested
17:21brianwongnot functions that the namespace is calling out
17:21justin_smithbrianwong: doesn't matter, that is arbitrary
17:21brianwongso what would the symbol be in my case?
17:21brianwongec2/run-instances?
17:21justin_smithyes
17:22brianwongarg
17:22brianwongargh
17:22brianwongi had it, i just forgot the #'
17:22brianwongthanks. it worked
17:22brianwongfor with-redefs-fn
17:23justin_smith,(doc with-redefs-fn)
17:23clojurebot"([binding-map func]); Temporarily redefines Vars during a call to func. Each val of binding-map will replace the root value of its key which must be a Var. After func is called with no args, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mocking out functions during testing."
17:23justin_smithwhy not just use with-redefs?
17:23brianwongim trying to read the difference right now
17:23brianwongthanks
17:25justin_smithanother tactic is to create a function that generates the arguments to ec2/run-instances, or takes ec2/run-instances as an argument. That way during testing you can verify that the correct argument list is generated, or pass in a replacement function directly without having to do any redefs.
17:26justin_smithbrianwong: look at the source of with-redefs - I think with-redefs-fn is just there to implement the with-redefs macro
17:26justin_smith$source with-redefs
17:26lazybotwith-redefs is http://is.gd/rdnNKM
17:28rurumatesuppose you have this json in the clipboard: {"foo":12}. you want to paste it into the repl, but it needs escaping. it's not enough to surround it with quotes, you also have to replace " with \". Is there a fast/easy way to do this?
17:28justin_smithrurumate: what editor?
17:29rurumateemacs
17:29justin_smiththere is an auto-string-escape mode
17:29rurumateneat, I'll check it out
17:29justin_smithstring-edit.el M-x string-edit-at-point
17:29justin_smithit even works recursively :)
17:30Balveda"No cljson encoding for '{"_id" #<ObjectId 543848e84e19b68fa401e6a3>, "applicant" "JG", "appid" 1, "yob" 1999, "answer" "KPO"}'."
17:30justin_smithI bind it to C-c e
17:30BalvedaWhat's the deal with this?
17:30justin_smithBalveda: what json lib is that using?
17:30justin_smithnever mind, found it, cljson uses cheshire
17:31justin_smiththe "_id" key's value is something the cheshire does not know how to encode
17:32justin_smithyou can add new encoders so it knows how to handle various classes: http://dakrone.github.io/cheshire/cheshire.generate.html#var-add-encoder
17:32justin_smithbut the reader will need to know the same rules if you want to create the same object type, of course
17:37amalloyor, more likely, tell your mongodb client not to give you the _id
17:37amalloyor just remove it yourself before encoding the object
17:37justin_smiththis is also an option, yes
17:39amalloyi saw "yob" in that mongodb map and thought maybe there was a swedish person applying for a job: http://search.dilbert.com/comic/Yust%20Sven
17:41pandeirois there a trick to lower compilation time for projects with timbre?
17:44BalvedaI was thinking the same thing
17:44BalvedaThanks
18:00dweavehi yall. new to clojure, haven’t used a lisp since school a number of years ago. have a new project at work and i’m trying to refresh myself a bit. Is there any reason not to use sublime text when working with clojure? Not seeing a lot of love for sublime + clojure around the interwebz. I do see that there are clojure plugins though.
18:01bbloomdweave: use whatever you're comfortable with
18:01rurumatedweave: sublime is proprietary software afaik? also emacs is quite good
18:01bbloomdweave: don't try to learn a language and an editor at the same time
18:02dweavethanks bbloom
18:02dweavethats what i thought, wasn’t going to try to pick up emacs, but was wondering if something like light table had some advantage
18:02dweavedoesn’t seem that way really tho
18:02rurumateI learned clojure and emacs at once. it worked fine and made sense to me
18:03bbloomdweave: you'll want to always work with a repl open and ready. eventually you'll get sick of copy pasting code back and forth, then you can investigate other tools / plugins / whatever
18:04rurumateI think editor choice is quite important question for beginners. And some editors may be more frustrating than others.
18:05dweavewhy is clojure so editor sensitive i don’t really get that
18:05dweavenot understanding what emacs really brings to the table for clojure that it wouldn’t do so for other languages
18:05rurumatebecause, a repl is less fun without autocomplete, syntax highlighting, and paredit
18:06dweavefor instance sublime has a repl
18:06ed-gdoes anyone know how to change the characters which are allowed for a variable in a defroutes path? for instace (defroutes foo (ANY "/bar/:baz" [baz] (handler baz))), I would like for baz to be able to contain "," but by default that character is not OK
18:06bbloomdweave: clojure (and many/most other lisps) are designed to support editing your program while it is running
18:06bbloomdweave: and your editor can support you in communicating with your running program
18:06dweavehmm i see
18:06dweavethanks i have to do some more reading it soudns like
18:07rurumatethere's a video on youtube called clojure paredit speedrun or something, it helped me get started
18:14amalloyed-g: iirc it's something like (ANY ["/bar/:baz" {:baz #"[\w,]+"}]-
18:15caterndweave: emacs is the best editor anyway, it's just more accepted in clojureland
18:15dweaveha everyone I know that uses it admits they secretly hate it
18:16dweavei’ve always been a vim guy
18:16bbloomdweave: there are many vim users in clojure land. tpope's vim-fireplace works great
18:16bbloomdweave: i myself am a fireplace user
18:17caterndweave: i also have been a vim guy, but I switched to emacs with evil-mode, vim emulation, because it is superior
18:17amalloydweave: the worst thing about emacs is that if you mention you use a different editor catern will tell you emacs is the only good one
18:17bbloomthe editor war is totally not necessary here
18:18bbloomdweave: use what you're familiar with. don't try to learn two things at once
18:18amalloyor: do try, because it's fun. but don't do it because you feel you have to
18:18dweavehaha
18:18dweavei’ll figure it out
18:18bbloomamalloy: learning a new editor is my definition of "not very much fun"
18:18bbloom:-)
18:19amalloybbloom: i had fun learning them both at once
18:19amalloyso i always have to object when advice is given to the effect that it's unconditionally bad
18:19caternamalloy: that's the best thing about emacs! then you don't have to hear me harp about it
18:19caternafter you switch
18:19amalloycatern: that's what /ignore is for
18:19catern:(
18:20bbloomamalloy: i'm not saying it's unconditionally bad, i'm saying that it's potentially bad and people generally come in here feeling obligated to learn emacs to write lisp of any kind
18:20bbloomamalloy: but, if you are coming from vim, evil mode or not, your fingers will hate you if you try to learn anything else along side another editor :-P
18:20amalloyyeah, i bet
18:21dweavelanguage agnostic: what is the benefit of emacs in evil mode
18:21ed-gamalloy: thanks!
18:21amalloyi opened up eclipse for the first time in months today, and kept hitting C-x C-s to save
18:21dweaveseems like the bindings are the editor in the case of vim and emacs
18:21caterni'm glad people editor-warred around me, that way i switched to the superior editor
18:21caterndweave: certainly not!
18:21ed-gfor those in the studio audience, full route syntax docs at https://github.com/weavejester/clout
18:22dweavecatern do go on, to me I use vim because of the key bindings mainly
18:22dweaveand because it looks cool
18:22caterndweave: consider http://upsilon.cc/~zack/blog/posts/2008/11/from_Vim_to_Emacs_-_part_2/ and, one second, eh, my comment here: http://www.reddit.com/r/vim/comments/2coqzs/how_do_you_work_with_vim/cjk7ndo
18:22amalloyvim has some really advanced editing capabilities
18:22dweaveemacs doens’t look cool
18:22technomancydweave: the command language is the main strength of vim, and the programming language is the main strength of emacs.
18:22justin_smithdweave: emacs has a number of extensions and features - many use emacs specifically because of things like org-mode or the interactive process integration
18:22amalloy(inc technomancy)
18:22lazybot⇒ 146
18:22technomancyyou may notice these two things are not mutually exclusive
18:23caternI really need to adapt that comment into a blogpost
18:23justin_smithdweave: I don't know of anyone who uses emacs because of the key bindings (unless it's just laziness "those are the bindings I know")
18:23caterneven if it is wrong in some ways, I hate linking to it
18:23johnwalker,(clojure.java.browse/browse-url "http://google.com&quot;)
18:23clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.java.browse>
18:23johnwalkerdarn
18:23caternjustin_smith: well emacs key bindings are default or available many places
18:23justin_smithsure- but I don't actually like them
18:23justin_smithvi bindings are better
18:23amalloy"how do you work in vim?" "here is why i love emacs"???
18:23caternagreed
18:23lazybotamalloy: Yes, 100% for sure.
18:24tjdjohnwalker: you tried.
18:24amalloy$google google
18:24lazybot[Google] http://www.google.com/
18:24justin_smith$google google google
18:24lazybot[Google] http://www.google.com/
18:24caterndweave: and emacs does look cool, hmm... I guess these are some good screenshots http://tuhdo.github.io/emacs-tutor.html
18:24johnwalkeri did try.
18:25justin_smithcatern: woah, someone who actually turns on nyan-mode
18:26caterni know someone who leaves it on, it's kinda amusing
18:26justin_smithmy modeline tends to get pretty crowded, if I could have nyan on it's own line at the top I would totally go for it
18:27justin_smithdweave: anyway, as an emacs user, I'll suggest not using emacs unless you need the features, and if you need the features, something like evil is helpful because you get the keybindings you know / like.
18:34caternyes, emacs is something you grow up to
18:49vIkSiThello all
18:49vIkSiThas anyone here used secretary routes with compojure/luminus?
19:12qbgHas anyone adapted core.async to produce a transducer instead?
19:14qbggo! to be specific
19:25dopamean_hey #clojure. im pretty new to the language and im trying to wrap my head around promises. i wrote a small library that makes some http requests and it was suggested to me that the functions making the requests return a promise but based on the basic stuff ive read about promises im not sure i understand how to do that
19:25dopamean_it seems that id need one function to return a promise and another to deliver the value?
19:26dopamean_i also dont understand what happens if the http request fails
19:27qbgYou could deliver some sort of error response
19:29dopamean_the people suggesting returning the promise seemed to imply that this would somehow avoid exceptions
19:36qbgI'm not seeing how
19:36dopamean_nor am i
19:37dopamean_but i dont really understand what a promise adds here anyway
19:37dopamean_so i dont really understand the suggestion at all
19:38qbgThe code that makes the request doesn't have to block until it actually needs the result if you use a promise
19:41dopamean_im not really sure what that means. i think i need to look at more examples.
19:42justin_smithdopamean_: often a future is more applicable - unless you have some other custom worker pool you want to execute the task
19:43technomancydopamean_: I'd stick with regular HTTP requests till you get more familiar with the language. it's difficult to see what a promise gets you outside very specific use cases that the client could simply wrap themselves.
19:43justin_smithalso futures are simple to use, and raise any error that may have come up when you dereference them (ie. try in the repl (def a (future (/ 1 0))) ... wait a moment ... @a (now you get the exception returned)
19:44justin_smith)
19:45dopamean_@technomancy - right now if the request is successful my function returns a map with certain values. do you think it would make sense to catch the exception if the request fails and have it return a map with some sort of error value?
19:45dopamean_or would it be better to throw the exception
19:46technomancydopamean_: returning an error value only makes sense if you have an option type
19:47technomancysince clojure doesn't ship with pattern matching out of the box, that style is pretty rare
19:47technomancyerror values that aren't option types are the worst
19:47dopamean_good to know. i kind of figured as much and wasnt particularly fond of that idea
19:48amalloyjust return Double/NaN whenever something goes wrong. it will never fail to surprise the user
19:48technomancyyeah, this isn't Google Go; we have a civilized approach to error handling =)
19:48technomancyamalloy notwithstanding
19:48dopamean_lol
19:48amalloyclojurebot: amalloy |has| a sadistic approach to error handling
19:48clojurebotIk begrijp
19:49qbg(System/exit 0)
19:49qbg*really* surprise the user :p
19:49technomancy~guards
19:49clojurebotSEIZE HIM!
19:50dopamean_thanks for the advice guys. i really appreciate it.
19:51technomancynp
20:41ed-gHello, I'm attempting to extend a protocol related to jdbc, so that I can pull PostgreSQL arrays as clojure vectors. I don't know how to access the relevent protocol. An example from the Internet has (extend-protocol jdbc/IResultSetReadColumn ...) however I don't have jdbc loaded; I'm using Postgres from yesql. Should I import jdbc directly from Java?
20:44ed-gThis is the article I'm referencing: http://hiim.tv/clojure/2014/05/15/clojure-postgres-json/ only I want to use (seq (.toArray *postgres-array-val*)) instead of json/read-str
20:45dnolen_loving the Chestnut http://swannodette.github.io/2014/10/10/magic/
20:51nullptrdnolen_: neat -- looks like it was updating from a save hook? you didn't have to eval your changes?
20:54dnolen_nullptr: yes, figwheel updates namespaces when you save - you can use defonce to protect app state
20:54nullptri see ... seems like something that would start to lag as your app gets huge, no?
20:56justin_smithed-g: yesql is pulling in clojure.java.jdbc, you can use the jdbc classes
20:56ed-gjustin_smith: thanks! :-)
20:57dnolen_nullptr: I don't see how
20:57dnolen_nullptr: but you might not be familiar with the Om rendering model
20:57dnolen_nullptr: browsers can eval tens of thousands of lines of JS at ridiculous speeds
20:58nullptri'm thinking more of the cljs->js translation, not the browser runtime (yes, familiar with om model)
20:59dnolen_nullptr: I don't follow why would you use cljs->js outside of interop?
20:59dnolen_nullptr: and even then you should just have the data in the right format
21:00dnolen_cljs->js is a sign of not accepting the truth of interop
21:01nullptrif i'm not using chestnut, i'm using lein cljsbuild, which is doing cljs->js each time i save
21:01dnolen_nullptr: huh? no
21:01dnolen_nullptr: chestnut uses fighwhell which just calls the cljs compiler, same as cjlsbiuld
21:01dnolen_cljsbuild
21:02dnolen_cljs->js is a helper for converting data structures - has nothing to w/ compile time generation of JS
21:02justin_smithare you talking about the cljs->js function, or about the compilation process?
21:02nullptroh, heh
21:02nullptryes, compilation process -- that explains the confusion
21:02dnolen_nullptr: figwheel compiles only the namespaces that change, no problems here
21:02nullptrgotcha
21:03dnolen_nullptr: since a file maps to namespace, this should never be an issue even if your project is massive
21:03nullptrthat's really nice
21:03ed-gok, followup question. I have arrays working, now I would like to support an array of hstore. The error I get is "java.sql.SQLFeatureNotSupportedException Method org.postgresql.jdbc4.Jdbc4Array.getArrayImpl(long,int,Map) is not yet implemented.". How can I add this feature to jdbc?
21:04nullptri am pretty familiar with gigantic js codebases, and as much as i enjoy working with cljs/om i have a vague fear of getting to a huge codebase and losing save/refresh workflow because the compilation time exceeds a certain threshold
21:04nullptrbut if it's smart about what actually gets translated that shouldn't be an issue in practice
21:04justin_smithed-g: first thing I would do is see if there is a newer org.postgresql version that does implement that feature
21:05justin_smithed-g: failing that, I guess look up the docs for extending a jdbc driver? It will explain everything in a java way of course.
21:05dnolen_nullptr: large code bases definitely affect first compile (I'm working on fixing that) but incremental compilation has worked for a while now
21:06ed-gjustin_smith: maybe I should just return an array of EDN string which can be parsed into a map.
21:06justin_smithit seems like that would be much easier
21:06nullptryeah, first compile doesn't bother me at all as long as incremental is good -- and cljsbuild has been plenty fast for everything i've done so far
21:09justin_smithTIL postgres has built in geometric datatypes http://jdbc.postgresql.org/documentation/head/geometric.html
21:46vermatechnomancy, sorry off topic, but what's the quicking way to turn my wired kb to a bluetooth/wireless one?
22:07amalloyscissors
22:17justin_smithstay tuned for the next episode, where we introduce the qualifying adjective "working"
22:26technomancyverma: I've never really looked into BT
22:31technomancynot really keen on the idea of keeping yet another battery charged
22:48vermatechnomancy, wireless poker2 would be nice though, take it around with me, the wire always seems like a hassle
22:53numberten,(clojure.string/trim-newline "test\n")
22:53clojurebot"test"
23:24kenrestivoverma: http://handheldsci.com/kb ?
23:44amalloyif you're carrying a whole keyboard with you, i don't imagine a wire would be a big deal
23:45amalloyspend like two seconds wrapping it around the keyboard when you pick it up
23:46TEttingeramalloy, for things like android phones/tablets with BT but no plugs, maybe
23:47amalloyTEttinger: indeed, that sounds plausible. i was objecting to "the wire always seems like a hassle"
23:47TEttingerI was DCed for a while
23:55vermakenrestivo, nice, but it says " Currently the adapter does NOT work with Mac. Let us know if Mac support is really important to you.", could have totally pulled it out of that case though