2014-10-10
| 00:41 | brainproxy | is there a enlive selector for :type ? e.g. suppose I want to do a transform on comment nodes |
| 00:52 | johann | brainproxy: ya try using the :comment keyword |
| 00:56 | brainproxy | johann: how? (html/select resource [:comment]) ... that doesn't seem to work |
| 00:57 | johann | brainproxy: can you show me a snippet of the html you are working with? |
| 00:57 | brainproxy | it's just some html which has <!-- comments --> in various places |
| 00:57 | brainproxy | nothing unusual about it at all |
| 00:58 | johann | oh! i thought you were looking at xml with <comment></comment> tags |
| 00:58 | brainproxy | so, for example, if I swap :div for :comment, I get what I would expect |
| 00:58 | brainproxy | ah, I see |
| 00:58 | brainproxy | well what I want is to be able to select nodes which aren't tags per se |
| 00:58 | johann | ya interesting |
| 00:59 | brainproxy | they're in the sequences returned by enlive |
| 00:59 | brainproxy | {:type :comment ...} |
| 01:00 | johann | but your issue is that you can't access it with the select function |
| 01:00 | johann | right? |
| 01:00 | brainproxy | are with html/at, etc. |
| 01:00 | johann | but when you parse the entire document it shows it |
| 01:00 | brainproxy | is there a glob selector for any and all nodes? |
| 01:01 | brainproxy | then I could write my own transformer and choose to do something if (:type node) is :comment |
| 01:01 | brainproxy | otherwise, just dump node back out |
| 01:01 | johann | ya what you want is html/html-resource i think |
| 01:02 | brainproxy | yep, using that |
| 01:02 | brainproxy | I mean a selector that will match any node |
| 01:02 | brainproxy | within the body of html/at usage, etc. |
| 01:03 | johann | so you basically want just the clojure data of the html? |
| 01:03 | johann | sorry if i'm not helping! its late over here :) |
| 01:04 | squeedee | You know what I am finding harder than understanding functional programming.. functional unit tests. |
| 01:04 | brainproxy | no I have that also |
| 01:04 | brainproxy | :) |
| 01:04 | squeedee | I seem to only know how to define imperitive unit tests |
| 01:05 | johann | squeedee: always some resistance when taking on new modes of thought! |
| 01:07 | squeedee | i 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:07 | justin_smith | squeedee: 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:07 | squeedee | I'm not saying i'm suddenly great at functional, but I find it pretty easy to grok.. |
| 01:07 | squeedee | the tests, not so much.. |
| 01:07 | justin_smith | what's hard about the tests? |
| 01:08 | johann | ya it'd be cool for you to show an example |
| 01:08 | squeedee | Fact is my unit testing habbits in imperative style are what brought me here |
| 01:08 | squeedee | yeah ok lemme commit my rubbish |
| 01:09 | squeedee | by brought me here, i mean, my unit testing made me more and more 'functional' even in my imperative languages |
| 01:09 | johann | brainproxy: 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:11 | johann | squeedee: 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:13 | squeedee | johann not voila |
| 01:13 | squeedee | it made me appreciate functional composition more. It also made me appreciate data-is-king |
| 01:13 | squeedee | https://github.com/squeedee/lsystem/blob/master/test/lsystem/core_test.clj |
| 01:14 | johann | ya the data is king thing is still sort of marvelous to me |
| 01:15 | squeedee | johann: 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:15 | squeedee | so a lot of my objects became 'command' style objects. |
| 01:16 | squeedee | which is a really loose way of saying 'function' |
| 01:16 | johann | yeah right |
| 01:16 | johann | i've been working with quil, which is a clojure api over processing, so i'm dealing with a little oo lately |
| 01:17 | brainproxy | johann: (html/at resource **sel-for-any-node** (fn [n] (if (= (:type n) :comment) something n))) |
| 01:17 | johann | and 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:17 | squeedee | anyway, 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:18 | johann | what's your uncertainty? |
| 01:19 | squeedee | Tho to be certain, this is my first clojure app, and i know im just stood at the starting line |
| 01:19 | squeedee | well I'm used to my tests driving my design. |
| 01:19 | justin_smith | looking 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:20 | johann | squeedee: what's your workflow right now? are you using a repl? |
| 01:21 | squeedee | i 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:22 | squeedee | for this i moved out of the repl because i wanted to try test driving it. So I'm using LT and lein autoexpect |
| 01:22 | johann | kk |
| 01:22 | squeedee | I use eval in LT a lot |
| 01:22 | johann | ya i think having a short feedback loop to evaling smaller parts changes the role of tests a little |
| 01:23 | squeedee | dunno about that, works well in ruby, have a repl there |
| 01:23 | johann | squeedee: i'm playing with enlive right now |
| 01:23 | justin_smith | squeedee: 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:24 | brainproxy | johann: so the correct way to express **self-for-any-node** is [html/any-node] |
| 01:24 | johann | wait i meant brainproxy for that last tag my bad |
| 01:25 | justin_smith | squeedee: http://clojuredocs.org/clojure.test/are |
| 01:30 | squeedee | justin_smith: thanks for the tip, not sure how i feel about it tho. Looks like 'examples' in other frameworks i've seen. |
| 01:31 | justin_smith | looks like expectations isn't compatible with clojure.test anyway, I didn't realize |
| 01:31 | squeedee | sorry i mean 'theories' |
| 01:33 | squeedee | justin_smith: it has this: http://jayfields.com/expectations/templating.html |
| 01:34 | squeedee | although thats when you change the subject, not the parameters |
| 01:38 | vIkSiT | 'lo all |
| 01:38 | vIkSiT | has anyone used clojurescript secretary routes here? |
| 01:38 | vIkSiT | in conjunction with something like luminus? |
| 01:38 | vIkSiT | how do you ensure that routing from client side hpappens, while everything else is served from luminus? |
| 01:38 | vIkSiT | eg, /home should use scretary |
| 01:39 | vIkSiT | but /api/getHomeData should use luminus |
| 02:55 | learn2code | hi, i come here to learn clojure |
| 02:55 | TEttinger | learn2code, you picked the right place |
| 02:56 | learn2code | but this is the first time I am here |
| 02:56 | learn2code | and in IRC |
| 02:56 | learn2code | i dont know how IRC acutally works |
| 02:56 | TEttinger | there's some good stuff here http://clojure-doc.org/articles/content.html#essentials |
| 02:56 | TEttinger | it's a chatroom |
| 02:56 | TEttinger | there are many people here, but most aren't talking due to time zone differences |
| 02:57 | learn2code | yeah, it's so quiet now |
| 02:57 | TEttinger | during the day in the US it's much busier. |
| 02:58 | learn2code | yeah, i am in US |
| 02:58 | learn2code | I will try it tmr morning |
| 02:58 | TEttinger | is there a particular type of application you want to make with clojure? |
| 02:58 | learn2code | yes, I do have |
| 02:58 | TEttinger | web apps benefit a lot from it |
| 02:58 | TEttinger | I make games |
| 02:58 | learn2code | i want to build a small app |
| 02:59 | learn2code | just keep polling ebay |
| 02:59 | TEttinger | there's probably an API that can push updates? |
| 03:00 | learn2code | and notify me whenever a new listed shows up and the price is acceptable to me |
| 03:00 | learn2code | the input will be the <name> <price> |
| 03:00 | learn2code | yeah, I know |
| 03:00 | learn2code | clj-ebay |
| 03:00 | learn2code | i am using it |
| 03:00 | TEttinger | good! |
| 03:01 | learn2code | for keep polling the server I use at-at |
| 03:01 | learn2code | the point here is |
| 03:01 | learn2code | how to connect them together |
| 03:01 | learn2code | and handle the commandline to read arguments |
| 03:05 | TEttinger | at-at is great, yeah |
| 03:05 | TEttinger | there is a lib for better command line arg parsing |
| 03:07 | TEttinger | https://github.com/clojure/tools.cli |
| 03:08 | learn2code | thanks TEttinger |
| 03:09 | TEttinger | no prob |
| 03:11 | learn2code | how long have you been wokring with clojure |
| 03:12 | learn2code | do you know any interesting app with good doc in Clojure that I can find on Github |
| 03:16 | TEttinger | oh, sorry learn2code , I was in another channel. |
| 03:18 | TEttinger | I'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:18 | TEttinger | http://4clojure.com (or was it .net) is good |
| 03:18 | learn2code | lol |
| 03:18 | learn2code | i am looking at it now |
| 03:19 | TEttinger | I'd say leiningen itself may be a good option for a well-documented app on github |
| 03:19 | TEttinger | but I haven't read its source |
| 03:20 | TEttinger | there's documented source for lein here http://leiningen.org/reference.html |
| 03:21 | learn2code | nice |
| 03:22 | TEttinger | you'll likely encounter a lot of symbols that are confusing early on, there's a good guide out there... |
| 03:23 | learn2code | yeah, I collected a cheatsheet for me already |
| 03:24 | TEttinger | http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 03:26 | learn2code | wow |
| 03:26 | learn2code | thanks TEttinger |
| 03:26 | TEttinger | no problem! glad to help |
| 03:27 | learn2code | i am going to sleep |
| 03:27 | learn2code | is there anyway to meet you again |
| 03:27 | learn2code | in IRC? |
| 03:27 | learn2code | the same nick? |
| 03:27 | TEttinger | I'll likely be here in #clojure most days, same nick |
| 03:27 | learn2code | nice |
| 03:27 | learn2code | g9 |
| 03:28 | TEttinger | I have an IRC client that auto-joins several channels, #clojure is one |
| 03:29 | learn2code | you built by yourself or had from somewhere else |
| 03:30 | learn2code | that's exactly what I want |
| 03:35 | Rhainur | learn2code: most IRC clients do auto-joining |
| 04:13 | yekKhaste | hi every body! |
| 04:13 | yekKhaste | I want to start learning clojure |
| 04:14 | yekKhaste | but I have no exprince with lisp or functional programming |
| 04:14 | yekKhaste | Where is best place to start? |
| 04:15 | johann | yekKhaste: hi! |
| 04:15 | johann | yekKhaste: obviously this is a matter of personal taste, but this is a really nice resource for beginners http://www.braveclojure.com/ |
| 04:17 | yekKhaste | johann, Thank, but what next? |
| 04:17 | yekKhaste | where can I learn more about clojure |
| 04:17 | johann | i'd suggest starting off with the clojurekoans just so you can get introduced to the syntax and core ideas |
| 04:17 | johann | http://clojurekoans.com/ |
| 04:18 | yekKhaste | And is it possible to build android app with clojure? |
| 04:18 | yekKhaste | I hate java, but I like make android app |
| 04:19 | johann | ya theres a mailing list of people who use clojure on android |
| 04:19 | yekKhaste | johann, Thank a lot! |
| 04:19 | johann | no problem! |
| 04:20 | johann | if you need help setting your environment or anything let me know |
| 04:20 | johann | you should also check out lighttable. http://lighttable.com/ |
| 04:22 | johann | heres the mailing list for clojure-android if you want to ask them any questions https://groups.google.com/forum/#!forum/clojure-android |
| 04:49 | kenrestivo | i vaguely remember seeing a macro somewhere that'd turn [foo bar] into {:foo foo, :bar bar} |
| 04:49 | kenrestivo | now i can't find it tho |
| 04:52 | scottj | kenrestivo: flatland.useful.map/keyed |
| 04:52 | kenrestivo | aha! thanks, i had a feeling it'd be a flatland |
| 05:01 | donbonifacio | is there a way to reload all code in the repl? |
| 05:03 | schmir | donbonifacio: https://github.com/clojure/tools.namespace |
| 05:03 | kungi | donbonifacio: yes |
| 05:03 | kungi | donbonifacio: try tools.namespace, but think about global state first |
| 05:08 | donbonifacio | thanks :) 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:10 | kungi | donbonifacio: then tools.namespace.repl/refresh probably is what you need |
| 05:10 | kungi | donbonifacio: If you write a webapp you can also use a ring middleware to reload your files |
| 07:56 | conorbev | I 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:03 | noncom | conorbev: idk.. who knows.. |
| 08:07 | conorbev | OK :) |
| 08:17 | skratl0x1 | can anyone look at this one and suggest some improvements? http://stackoverflow.com/questions/26299169/updating-nested-structures-in-clojure |
| 08:23 | noncom | skratl0x1: well, idk, but try looking at a solution using (reduce) or reducers .. or even (loop)... |
| 08:23 | noncom | just implement them and see how they work.. |
| 08:27 | skratl0x1 | noncom: 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:28 | schmir | skratl0x1: 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:29 | noncom | skratl0x1: try first doing this with (reduce).. at least you will see the difference |
| 08:30 | skratl0x1 | schmir: because the application of this function is much more clear than reading through (into {} (for.. (for.. (into {} (for... (for ... |
| 08:30 | skratl0x1 | this is more generic approach to the problem, it makes the code much more readable |
| 08:36 | schmir | skratl0x1: (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:36 | schmir | (unless you really need the generic solution) |
| 08:37 | schmir | I think you should use a keyword instead of * |
| 08:37 | dmi3y | Guys, 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:38 | skratl0x1 | schmir: yeah, I made it use the * for its common use as a wildcard |
| 08:39 | skratl0x1 | schmir: anyway, the question was, given the API that I want, how to make the function /better/ |
| 08:40 | skratl0x1 | I don't think paths (including wildcards) or selectors is any kind of anti-pattern |
| 08:41 | skratl0x1 | not to mention that the f actually has to take the current path too |
| 08:50 | clgv | dmi3y: looks like a dependency conflict. what does "lein deps :tree" tell you? |
| 08:53 | dmi3y | @clgv yup, my deps tree looks scarry: https://www.refheap.com/91536 |
| 08:54 | dmi3y | clgv thanks for the tip |
| 08:55 | clgv | dmi3y: [org.elasticsearch/elasticsearch-hadoop "2.0.1"] wins of clj-time with respect to joda-time |
| 08:55 | clgv | s/of/over/ |
| 08:56 | clgv | dmi3y: so it probably pulls in an incompatible joda-time |
| 08:56 | dmi3y | so, can I just exlude joda-time from elasticsearch-hadoop deps? |
| 08:58 | clgv | dmi3y: 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:58 | dmi3y | clgv: got it, thank you |
| 08:58 | clgv | btw. why does "lein deps :tree" always print "warn" as first line? |
| 08:59 | schmir | skratl0x1: the function creates elements for non-existent keys |
| 09:01 | schmir | skratl0x1: (update-each-in {} [:xxx * :foo] first) |
| 09:01 | clgv | skratl0x1: depending on your scenario something like clojure.walk/postwalk-replace might be handy |
| 09:09 | gfredericks | reiddraper: 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:10 | gfredericks | I'm also trying to tackle gen-double is how I got on that topic |
| 09:11 | gfredericks | "just use a bigger size" is problematic because collections |
| 09:12 | gfredericks | maybe we could add generators for "small numbers" that work like the current ones, for whenever that's useful |
| 09:12 | gfredericks | or just assume people know how to call Math/log |
| 09:27 | clgv | gfredericks: what is the concrete problem? |
| 09:38 | mdeboard | global concrete shortage |
| 09:39 | mdeboard | I seriously can't believe I'm getting porn spam on irc |
| 09:39 | rolfb | mdeboard: spam on irc? never experienced |
| 09:40 | rolfb | unsolicitied pm's with links? |
| 09:40 | mdeboard | yeah |
| 09:40 | Bronsa | it's more frequent than one might expect |
| 09:40 | mdeboard | and it's ONLY in the clojure channel |
| 09:40 | mdeboard | Only from bots in the clojure channel, that is |
| 09:40 | ken_barber | yeah, we get lots in #puppet, pm or in chan |
| 09:40 | mdeboard | I'm in several other high traffic channels, never get bots |
| 09:40 | rolfb | wow |
| 09:40 | ken_barber | oh speak of the devil, its trisnti pinging me now |
| 09:40 | mdeboard | yeah |
| 09:40 | mdeboard | that was what prompted |
| 09:50 | gfredericks | clgv: in the default usage of test.check you'll pretty much never generate numbers outside of the range -200 ... 200 |
| 09:50 | clgv | gfredericks: ah right, because of the shrinking strategy |
| 09:50 | gfredericks | no |
| 09:50 | gfredericks | because of sizing |
| 09:51 | clgv | gfredericks: yeah is that not related to shrinking as well? |
| 09:51 | gfredericks | in that large numbers could prompt enormous shrinks? |
| 09:52 | clgv | ok, so you want to add generators with a maximum range that grows much faster or that does not grow at all? |
| 09:52 | gfredericks | grows much faster |
| 09:52 | gfredericks | exponentially faster probably |
| 09:52 | clgv | just trying to understand the issue ;) |
| 09:53 | gfredericks | i.e., it should not require customization to generate arbitrary numbers in the range of Long/{MIN,MAX}_VALUE |
| 09:53 | clgv | ok those are probably usefull for algorithms on numbers or differently stated: numbers that do not correspond to collection sizes or similar |
| 09:53 | clgv | ok, sounds pretty useful |
| 09:53 | gfredericks | yeah that's why I was thinking both sizing strategies could be useful |
| 09:54 | gfredericks | I'll probably just start by adding some generators to test.chuck |
| 09:54 | clgv | chuck the groundhog? :P |
| 10:16 | verma | what's the opposite of cider-jack-in? Like I want to kill the repl stuff that's running |
| 10:16 | CookedGryphon | cider-quit |
| 10:17 | verma | nice |
| 10:17 | verma | yay |
| 10:17 | verma | (inc CookedGryphon) |
| 10:17 | lazybot | ⇒ 3 |
| 10:18 | clgv | probably you'd sometimes prefer to kill it instead of quit ;) |
| 10:20 | verma | clgv there doesn't seem to be a cider-kill |
| 10:20 | verma | also, sometimes the repl window goes away |
| 10:20 | verma | how do I bring it back/ |
| 10:21 | clgv | verma: that was just a joke on "kill" ;) |
| 10:21 | verma | oh :P |
| 10:22 | clgv | but yeah I love my "killall -9 java" :D |
| 10:22 | clgv | ;) |
| 10:22 | verma | Yes, I've been needing it more often past few hours |
| 10:41 | perplexa | hi, can i ensure the order of execution of statements? |
| 10:42 | Bronsa | perplexa: are you asking if it's guaranteed that in (do 1 2 3) 1 will be executed before 2 before 3? |
| 10:42 | perplexa | Bronsa: yes exactly |
| 10:42 | Bronsa | yes |
| 10:42 | perplexa | i 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:42 | perplexa | which then breaks b |
| 10:43 | perplexa | Bronsa: how would i do that? |
| 10:43 | perplexa | also, trisnti is sending spam/worms/whatever - should remove from channel :P |
| 10:44 | clgv | perplexa: woah evil chains of side effects - try to be sure if that is really necessary |
| 10:44 | Bronsa | perplexa: I'm not sure I understand what you're asking anymore. it looks like you are doing side-effecty async stuff |
| 10:44 | perplexa | clgv: 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:45 | clgv | perplexa: if this is in parallel you can use promises to synchronize |
| 10:46 | perplexa | mh |
| 10:46 | clgv | each 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:47 | clgv | perplexa: ah ok so you need the data from (b) as result value? |
| 10:47 | perplexa | yep |
| 10:47 | clgv | then just adjust the idea above appropriately ;) |
| 10:48 | perplexa | reading up on promises |
| 10:48 | clgv | perplexa: 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:48 | perplexa | thank you |
| 10:48 | clgv | perplexa: if so you really dont need the promises ;) |
| 10:49 | perplexa | clgv: let me check |
| 10:49 | clgv | perplexa: if conenction implements java.io.Closeable you could just do (with-open [conn (create-zookeeper-connection)] (get-data-blocking conn)) |
| 10:49 | gilr00y | test test |
| 10:50 | perplexa | clgv: even when i use :async? false it tells me the connection has expired |
| 10:50 | perplexa | the connection is open, that works ;/ |
| 10:51 | clgv | perplexa: do you use clojure library for zookeeper or its java libs directly? |
| 10:51 | perplexa | fetching data usually takes a couple of secs and close always gets called first ;x |
| 10:51 | perplexa | using liebke/zookeeper-clj |
| 10:54 | clgv | perplexa: wow last update 3 years ago - are you sure you want to use that? |
| 10:54 | perplexa | no but i didn't find anything else |
| 10:55 | verma | man, my cljs repls keep dying :( |
| 10:58 | verma | any help appreciated: https://www.refheap.com/91544 |
| 10:58 | perplexa | clgv: i guess i'll instead just establish the zk connection when the app starts and close when it terminates ;/ |
| 11:01 | verma | I guess I am going to go restart my computer like some neanderthal :( |
| 11:05 | drorbemet | Hi, 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:08 | nwjsmith | drorbemet: cider probably https://github.com/clojure-emacs/cider |
| 11:18 | zot | is there a nice way to use (-> "resource.edn" io/resource … edn/read) instead of slurp + read-string? |
| 11:18 | drorbemet | nwjsmith: yes I am using cider. ... ok right I should try to stick to it's functions first, thanks |
| 11:22 | llasram | zot: Not built-in. I define a utility `edn-slurp` or such |
| 11:27 | zot | after much more googling, found this: (with-open [r (-> "ph-fs-c1.edn" io/resource io/reader java.io.PushbackReader.)] (edn/read r)) |
| 11:27 | zot | (that's my working version from the example) |
| 11:29 | llasram | zot: Yep, that basic structure should work fine (assuming your EDN files contain only a single top-level EDN form) |
| 11:29 | zot | they do ;) i was hoping something would return the PushbackReader directly, but that's still reasonably tight |
| 11:29 | si14 | how hard can it be to use Friend with bidi? |
| 11:30 | llasram | zot: There is not, but that is IMHO for the best. Learn to embrace the platform :-) |
| 11:35 | verma | its just a bad day :( can't get any cljs repls to work |
| 11:36 | arrdem | justin_smith: I'm pretty sure on that SO question he was working with an elided (deftype Double [x y]) |
| 11:40 | perplexa | ,(def x) (bound? x) |
| 11:40 | clojurebot | #'sandbox/x |
| 11:40 | perplexa | meh |
| 11:40 | gfredericks | ,(bound? x) |
| 11:40 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Var> |
| 11:40 | gfredericks | ,(bound? #'x) |
| 11:41 | clojurebot | false |
| 11:41 | perplexa | hmkay ;x |
| 11:41 | perplexa | ty |
| 11:46 | reiddraper | gfredericks: yeah the whole number generation in test.check could use an overhaul, including generating larger numbers when generating scalars |
| 11:47 | mmeix | I have a very basic newbie-question |
| 11:47 | mmeix | https://www.refheap.com/91545 |
| 11:48 | arrdem | mmeix: and is a macro not a function |
| 11:48 | arrdem | mmeix: macros cannot be partially applied |
| 11:48 | mmeix | ok |
| 11:48 | arrdem | mmeix: note that or is a macro as well. |
| 11:48 | mmeix | so this is why (comp not or) will not work |
| 11:48 | arrdem | mmeix: what you want here is (fn [x y] (and x y)), which is a function you can throw around |
| 11:48 | justin_smith | arrdem: yeah, probably, just didn't want to take that for granted |
| 11:48 | arrdem | *correct |
| 11:48 | arrdem | mmeix: coorect |
| 11:49 | arrdem | justin_smith: 's k I'll take all the sweet karma you don't need more anyway |
| 11:49 | justin_smith | heh |
| 11:49 | mmeix | thanks |
| 11:49 | arrdem | mmeix: np |
| 11:50 | justin_smith | arrdem: 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:50 | verma | any idea why this is happeneing: https://gist.github.com/verma/d3c2ac234f10aac62b0a |
| 11:50 | arrdem | justin_smith: agreed |
| 11:50 | verma | I feel my defrecord/defprotocol stuff is correct (I hope) |
| 11:50 | martinklepsch | what am I doing wrong if my (go .. (<! ... )) only does something the second time something should arrive? |
| 11:50 | arrdem | oh god that stack trace |
| 11:50 | verma | this is line 31 is my source though; https://gist.github.com/verma/d3c2ac234f10aac62b0a#file-renderer-cljs-L11 |
| 11:50 | Bronsa | verma: you have a defn inside the defrecord |
| 11:51 | verma | oh what |
| 11:51 | Bronsa | https://gist.github.com/verma/d3c2ac234f10aac62b0a#file-renderer-cljs-L31 |
| 11:51 | arrdem | (inc Bronsa) |
| 11:51 | verma | oh what the f**ck |
| 11:51 | lazybot | ⇒ 60 |
| 11:51 | verma | (inc Bronsa) |
| 11:51 | lazybot | ⇒ 61 |
| 11:51 | verma | man |
| 11:51 | verma | :D |
| 11:51 | verma | dafuq did that come from |
| 11:51 | verma | I am not even sure |
| 11:52 | verma | I think I am splitting into two personalites, for real, one tries to fuck up with the other |
| 11:53 | verma | Bronsa, everything is working now :) thanks |
| 11:55 | Bronsa | np |
| 11:56 | mmeix | follow-up question |
| 11:56 | mmeix | I can say: |
| 11:56 | mmeix | (defn nor [v w] (not (or v w))) |
| 11:56 | arrdem | sure |
| 11:57 | nkoza | mmeix: but nor will evaluate his arguments, you should implement it as a macro to short-circuit like or does |
| 11:57 | pyninja | what's the best way to distribute a clojure project as a command line script? |
| 11:59 | justin_smith | pyninja: uberjar - jars support embedded shebang |
| 12:00 | pyninja | justin_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:01 | justin_smith | https://gist.github.com/briandealwis/782862 |
| 12:02 | justin_smith | this will never work on Windows, btw |
| 12:02 | justin_smith | and the linux version is actually via configuring binfmt-misc iirc |
| 12:02 | gfredericks | reiddraper: (->> (gen/sample gen-double 100) shuffle (take 10)) |
| 12:03 | gfredericks | (-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:03 | pyninja | justin_smith, thanks, will try |
| 12:03 | gfredericks | I just fmapped it from a significant and exponent |
| 12:03 | gfredericks | I can't remember if there were any known downsides with that approach? |
| 12:06 | gfredericks | I just did a failing property that checks that a random double is < 42.0 |
| 12:06 | gfredericks | it failed at 9.811099542902225E117 and shrunk to 64.0 |
| 12:09 | reiddraper | gfredericks: yeah i think shrinking was kind of the open question with doubles |
| 12:10 | reiddraper | gfredericks: also not sure i follow that last example, both 9.8 and 64.0 it considered < 42.0? |
| 12:10 | mmeix | I have a follow-up question (please bear with basic stuff) https://www.refheap.com/91547 |
| 12:11 | justin_smith | ,(or [false false]) ; mmeix |
| 12:11 | clojurebot | [false false] |
| 12:11 | justin_smith | ,(boolean (or [false false])) ; mmeix |
| 12:11 | clojurebot | true |
| 12:12 | justin_smith | it's a collection of falses, and collections are truthy |
| 12:12 | Bronsa | ,(some [false nil true]) |
| 12:12 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/some> |
| 12:12 | Bronsa | ,(some identity [false nil true]) |
| 12:12 | clojurebot | true |
| 12:12 | mmeix | ah, i see ... what would be the remedy? |
| 12:12 | justin_smith | Bronsa: for style points, (some boolean [false nil true]) would be nice here :) |
| 12:13 | Bronsa | mmeix: use some/not-any/every? when you need to apply or/and |
| 12:14 | mmeix | aha ... this wan't obvious to me |
| 12:14 | Bronsa | justin_smith: meh, truthy and falsey are good enough for me :) |
| 12:14 | mmeix | so simple "or" and "and" only for two arguments? |
| 12:15 | Bronsa | mmeix: no |
| 12:15 | Bronsa | ,(or nil false true) |
| 12:15 | clojurebot | true |
| 12:15 | mmeix | right |
| 12:15 | Bronsa | mmeix: what you're trying to do there is to apply "or" to a collection of values |
| 12:15 | mmeix | I wanted to create a nor with variable argument number |
| 12:15 | Bronsa | and that's not possible because or is a macro |
| 12:15 | Bronsa | you have to use a function for that |
| 12:16 | mmeix | so this is a real followup to my older question |
| 12:16 | mmeix | ok - thanks |
| 12:16 | Bronsa | clojure has a bunch of functions that usually can be used when you want to "apply" or/and |
| 12:16 | bbloom | puredanger: 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:16 | mmeix | thanks all! |
| 12:16 | Bronsa | those are some, not-any?, every?, not-every, every-pred, some-fn |
| 12:17 | Bronsa | look them up, the docstrings are pretty nice |
| 12:17 | mmeix | great |
| 12:17 | mmeix | thnx again |
| 12:17 | Bronsa | np |
| 12:17 | bbloom | puredanger: 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:19 | cka3yc | how to do realtimeoutput to console ? (clojure.java.shell/sh "ping" "google.com") |
| 12:24 | cka3yc | sh returns a map of |
| 12:24 | cka3yc | :out => sub-process's stdout (as byte[] or String) |
| 12:25 | cka3yc | but how can I read it line by line (before process is finished)? |
| 12:30 | cka3yc | anyone? |
| 12:30 | clojurebot | anyone is anybody |
| 12:31 | clgv | cka3yc: there is a library from raynes that provides the input/ouput streams to you |
| 12:31 | Raynes | das conch |
| 12:31 | clgv | Raynes: oh he is alive. long time no (irc) see ;) |
| 12:31 | Raynes | You don't want the input or output streams though. |
| 12:31 | Raynes | I'm always here. |
| 12:31 | Raynes | Just too busy to stare at the channel all the time these days. |
| 12:31 | Raynes | Always around for pings though :) |
| 12:32 | clgv | did I just address you directly with "he" - guess I should be going home soon... |
| 12:33 | cka3yc | "You don't want the input or output streams though" why? |
| 12:33 | clgv | cka3yc: do you want to interact with the programm as in "simulate a commandline user"? |
| 12:33 | Raynes | Oh, sorry, forgot to actually be helpful. |
| 12:34 | Raynes | Conch gives you a high level interface that can return a lazy sequence of lines while the process is running. |
| 12:34 | clgv | Raynes: yeah your signal to noise ratio has seen better times ;) |
| 12:34 | Raynes | I suggest you use that rather than reimplement it on top of the lower level streams. |
| 12:34 | clgv | Raynes: ah interesting, I guess I used a pretty old version of it |
| 12:35 | cka3yc | yes, I want to show output to user line by line when it comes in and not when subprocess is done |
| 12:35 | clgv | uh right. 0.2.4 ... havent touched that code in a while |
| 12:36 | cka3yc | (future (sh/stream-to-out p :out)) ? |
| 12:39 | justin_smith | ProcessBuilder isn't super hard to use either, and it provides very flexible streaming of stdout / stderr / stdin (into the process) |
| 12:39 | clgv | cka3yc: looks like what you need, from the name ;) |
| 12:40 | Raynes | It really isn't. |
| 12:40 | Raynes | The README has detailed instructions for using conch to get a lazy seq of lines from a process. |
| 12:40 | clgv | didnt he want to stream output as it's available |
| 12:40 | Raynes | He wanted to stream line by line. |
| 12:40 | Raynes | Or, that's what he said. |
| 12:41 | cka3yc | thanks, will go learn java then |
| 12:41 | clgv | ah ok, I thought that was just a way of saying "asap" |
| 12:42 | stuartsierra | Is there a Java process-invocation scheme that gives you NIO channels instead of streams? |
| 12:48 | justin_smith | stuartsierra: the default for ProcessBuilder is a ProcessBuilder.Redirect/PIPE, I wonder if that has any relation to nio.channels.Pipe? |
| 12:48 | justin_smith | probably not |
| 12:52 | stuartsierra | Looks like it only supports redirection to files or inheriting from the current process. |
| 12:53 | justin_smith | stuartsierra: it does InputStream / OutputStream |
| 12:53 | justin_smith | my usual technique is a thread that reads from the stream and prints when lines are complete |
| 12:53 | stuartsierra | Yes, those are blocking I/O. I was wondering if I could do async I/O with a process. |
| 12:53 | justin_smith | right |
| 12:56 | stuartsierra | Process.getInputStream returns a java.lang.UNIXProcess$ProcessPipeInputStream |
| 12:58 | stuartsierra | Oh, but you *can* wrap a Channel around an InputStream. |
| 12:58 | technomancy | "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:59 | technomancy | wait actually http://chainsawsuit.com/comic/2014/10/08/nod-with-feeling/ |
| 13:00 | mdeboard | :| |
| 13:02 | justin_smith | OT: best company to buy a domain name from? |
| 13:03 | arrdem | I've heard good things about Ghandi and they package DNS with domains for dirt cheap |
| 13:03 | arrdem | will probably be moving my stuff to them when my existing dyndns subscriptions get closer to expirint |
| 13:04 | clgv | technomancy: haha :D |
| 13:05 | gfredericks | oh god cider has gotten itself into some sort of funk where it errors every 1 second |
| 13:07 | CookedGryphon | gfredericks: sounds familiar |
| 13:08 | gfredericks | couldn'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:09 | nullptr | though, cider updates approximately hourly and sometimes just fetching all the latest bits fixes weird behavior for a while |
| 13:10 | arrdem | isn't that just doing a git local install and picking a tag? |
| 13:11 | gfredericks | git submodules probably? |
| 13:12 | technomancy | gfredericks: el-get |
| 13:14 | gfredericks | technomancy: lets me fix versions? |
| 13:14 | technomancy | gfredericks: yeap |
| 13:14 | technomancy | gfredericks: also supports TLS |
| 13:15 | gfredericks | "The Latest Soup" |
| 13:15 | gfredericks | Leftover |
| 13:15 | gfredericks | Sandwich |
| 13:15 | gfredericks | the lettuce salad |
| 13:16 | gfredericks | technomancy: I will look into this thamks |
| 13:16 | gfredericks | (inc technomancy) |
| 13:16 | lazybot | ⇒ 144 |
| 13:16 | gfredericks | square! |
| 13:16 | technomancy | gfredericks: it's not quite as polished, but it puts the user back in control |
| 13:23 | llasram | (inc technomancy) |
| 13:23 | lazybot | ⇒ 145 |
| 13:23 | llasram | technomancy's too hip to be square |
| 13:29 | dwysocki | could somebody explain to me the limitations of Engelberg's instaparse's total parse mode? |
| 13:29 | dwysocki | I'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:30 | dwysocki | instead it returns only a :failure node, containing the entire program's text |
| 13:30 | dwysocki | so somehow I'm mis-interpreting the way it works |
| 13:33 | arrdem | dwysocki: by default instaparse will do total parsing, you need to enable partial parsing probaboy |
| 13:33 | arrdem | *probably |
| 13:38 | gfredericks | test.check double generator https://github.com/gfredericks/test.chuck/commit/d330aadc335d3910de524d35d2e9a10ac4441002 |
| 13:39 | reiddraper | gfredericks: woot |
| 13:42 | justin_smith | arrdem: http://noisesmith.org/ thanks for the advice |
| 13:42 | clgv | gfredericks: Chuck Norris counted to infinity. Twice! |
| 13:42 | arrdem | justin_smith: hope it works out for you |
| 13:43 | arrdem | justin_smith: was .com taken? you could have gotten .us and been cool like technomancy :P |
| 13:43 | justin_smith | heh |
| 13:43 | justin_smith | arrdem: godaddy parked - and I plan to use it for my open source stuff, so org seemed more apropriate anyway |
| 13:44 | dwysocki | arrdem: 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:44 | mping | hi |
| 13:44 | arrdem | dwysocki: no a total parse is all or nothing |
| 13:44 | technomancy | actually I had people think I created http://www.technomancy.org/google-suggest-venn which was actually kind of cool |
| 13:44 | arrdem | dwysocki: AFAIK |
| 13:45 | arrdem | dwysocki: hacking on something else and not looking at the docs atm |
| 13:45 | dwysocki | arrdem: that seems counter to the example in the readme |
| 13:45 | arrdem | dwysocki: then ignore me |
| 13:45 | dwysocki | arrdem: lol ok |
| 13:45 | arrdem | dwysocki: :P |
| 13:45 | dwysocki | arrdem: thanks for helping anyway |
| 13:46 | dwysocki | I'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:46 | dwysocki | I thought total parse mode was the way to do it, but it doesn't seem to work as I thought :\ |
| 13:48 | nwjsmith | Java 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:48 | clgv | nwjsmith: type hint "^Object" is worthless |
| 13:49 | Bronsa | ,(defrecord x [] Object (hashCode [_] 1)) |
| 13:49 | clojurebot | #<CompilerException java.lang.ClassFormatError: Duplicate method name&signature in class file sandbox/x, compiling:(NO_SOURCE_PATH:0:0)> |
| 13:50 | Bronsa | ,(deftype x [] Object (hashCode [_] 1)) |
| 13:50 | clojurebot | sandbox.x |
| 13:50 | Bronsa | ,(.hashCode ^Object (x.)) |
| 13:50 | clojurebot | 1 |
| 13:50 | Bronsa | nwjsmith: ^ no issue |
| 13:50 | clgv | nwjsmith: methods on the JVM are virtual by default so you can not select a method by casting |
| 13:51 | dwysocki | does anybody know of any projects that actually use instaparse? |
| 13:51 | dwysocki | the documentation is nice, but I'd like to see some real examples |
| 13:51 | nwjsmith | clvv: 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:52 | arrdem | dwysocki: https://github.com/arrdem/dogeon :P |
| 13:52 | dwysocki | lol |
| 13:52 | nwjsmith | clgv: on reading my question, I'm answering my own question |
| 13:52 | dwysocki | arrdem: I'll look at it anyway |
| 13:53 | arrdem | dwysocki: how kind if you :P |
| 13:53 | dwysocki | oh, that reminds me |
| 13:53 | dwysocki | is there anything better than slurp for inputting the code to parse? |
| 13:54 | dwysocki | seems like there should be a lazier way to do it |
| 13:59 | bwreilly | there isn't a destructuring syntax for simply dumping all the keys in a map, is there? |
| 13:59 | bwreilly | something like |
| 13:59 | bwreilly | (let [{:keys :all} {:a "welp"}] a) => "welp" |
| 13:59 | arrdem | bwreilly: how could there be? |
| 13:59 | arrdem | bwreilly: local bindings are static, a map is arbitrary |
| 13:59 | gfredericks | eval! |
| 14:00 | arrdem | gfredericks: shhhhh |
| 14:01 | gfredericks | also, walk the code and replaced all unresolved symbols with map lookups |
| 14:02 | gfredericks | which has a laughable amount of edge cases |
| 14:02 | gfredericks | so...do it |
| 14:02 | bwreilly | haha |
| 14:02 | gfredericks | method-missing.clj |
| 14:02 | arrdem | o gawd wai |
| 14:06 | gfredericks | WARNING: CIDER's version (0.7.0) does not match cider-nrepl's version ("0.7.0") |
| 14:06 | gfredericks | I think that's due to my whidbey problems actually |
| 14:07 | justin_smith | is there a "cider errors" twitter parody account yet? |
| 14:07 | gfredericks | justin_smith: I think it's comparing "0.7.0" to "\"0.7.0\"" |
| 14:07 | justin_smith | but why would either version string have quotes in it? |
| 14:08 | gfredericks | mine does because whidbey |
| 14:08 | gfredericks | is malfunctioning |
| 14:08 | gfredericks | and double quoting everything |
| 14:09 | gfredericks | everything in my repl gets printed as if wrapped in pr-str |
| 14:09 | justin_smith | interesting |
| 14:09 | gfredericks | because whidbeys' middleware is pprinting and the builtin pr-str middleware is still there too |
| 14:11 | gfredericks | there'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:11 | gfredericks | probably *any other* middleware mentions pr-values and that's all it takes |
| 14:15 | dwysocki | from what I've found on github and google |
| 14:15 | dwysocki | it doesn't look like anybody has tried writing a very big parser in instaparse |
| 14:16 | dwysocki | just nice little languages |
| 14:16 | dwysocki | does anybody think I should just switch to clj-antlr if I'm trying to a rather complicated parser? |
| 14:16 | pjstadig | https://github.com/pjstadig/clojure/commit/d8b5178f3836d5ff5ec19d3eda7aa7f79fceecee |
| 14:17 | dwysocki | the biggest issue I'm seeing right now with instaparse is its error reporting |
| 14:17 | dwysocki | it gives you one error, and ends |
| 14:17 | dwysocki | I need error recovery, which antlr supports |
| 14:20 | arrdem | pjstadig: nice! |
| 14:20 | pjstadig | arrdem: i'm offering it to anyone who wants to push it through the clojure contribution process |
| 14:22 | pjstadig | i've signed the CA so there shouldn't be any problem there (not that it's that much code anyway) |
| 14:22 | stuartsierra | pjstadig: looks relatively easy. Have you submitted a patch on JIRA? |
| 14:23 | tvanhens | anyone been able to read config variables in project.clj during the build phase of heroku? |
| 14:23 | technomancy | tvanhens: I would highly recommend against that |
| 14:23 | technomancy | there are ways you can do it, but it's almost always a bad idea |
| 14:23 | puredanger | pjstadig: please submit! |
| 14:23 | tvanhens | how do you configure creds for things like s3 wagon? |
| 14:23 | technomancy | tvanhens: ah, yes credentials are a special case where it's OK |
| 14:24 | tvanhens | yeah its only for creds |
| 14:24 | tvanhens | for s3 wagon and datomic |
| 14:24 | technomancy | tvanhens: LEIN_USERNAME, LEIN_PASSWORD, and LEIN_PASSPHRASE are propagated automatically |
| 14:24 | technomancy | for other things, see https://github.com/heroku/heroku-buildpack-clojure#configuration |
| 14:25 | tvanhens | awesome, thanks :) |
| 14:31 | edbond | why nil here? (async/<!! (async/onto-chan (chan 100) ["ABC" "DEF"])) |
| 14:31 | edbond | ,(async/<!! (async/onto-chan (chan 100) ["ABC" "DEF"])) |
| 14:31 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: async, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:32 | tvanhens | technomancy, 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:35 | edbond | hm, (async/<!! (async/to-chan ["ABC" "DEF"])) works fine |
| 14:41 | drorbemet1 | What 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:42 | edbond | problem solved, onto-chan doesn't return chan ^_^ |
| 14:43 | stompyj | What does #’ mean in clojure? |
| 14:43 | stompyj | I’m not familiar with it, and it’s hard to search |
| 14:44 | jeremyheiler | stompyj: var |
| 14:44 | justin_smith | ,'#'+ |
| 14:44 | clojurebot | (var +) |
| 14:44 | stompyj | aha |
| 14:44 | stompyj | thanks! |
| 14:44 | edbond | stompyj, http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 14:45 | stompyj | danke |
| 14:45 | drorbemet1 | I would like to start cider repl using emacs lisp on startup of emacs |
| 14:45 | jeremyheiler | stompyj: also http://clojure.org/reader |
| 14:45 | dthurn | q: are there versions of 'conj' that default to different types, like say a set, when the first arg is nil? |
| 14:46 | jeremyheiler | dthurn: you can use fnil to make one |
| 14:46 | pjstadig | stuartsierra: puredanger: http://dev.clojure.org/jira/browse/CLJ-1561 i guess |
| 14:46 | puredanger | thx |
| 14:46 | jeremyheiler | ,((fnil conj #{}) nil 1) |
| 14:46 | clojurebot | #{1} |
| 14:47 | dthurn | cool, thanks |
| 14:47 | justin_smith | very useful when used inside update-in |
| 14:48 | stuartsierra | dthurn: Note: if this is used in a performance-sensitive loop, define the `fnil` function once outside the loop. |
| 14:49 | stuartsierra | I recall someone wrote a test.check extension for describing systems in terms of actions, anybody remember the name? |
| 15:03 | amalloy | bwreilly: http://stackoverflow.com/questions/9345056/in-clojure-how-to-destructure-all-the-keys-of-a-map |
| 15:04 | bwreilly | amalloy: thanks |
| 15:04 | arrdem | we don't have a "defmemfn", do we? |
| 15:05 | arrdem | for "mem" being "memoize" not "member" |
| 15:06 | bwreilly | really a curiosity, I've been soured on the more elaborate means of destructuring recently around readability/visibility issues |
| 15:11 | puredanger | we released transducers for Java, JavaScript, and Ruby today if anyone is interested http://cognitect-labs.github.io/ |
| 15:11 | puredanger | you know, for those "other" languages :) |
| 15:12 | arrdem | puredanger: when does the Haskell edition come out? |
| 15:12 | puredanger | no plans for that one :) left for the reader…. |
| 15:13 | arrdem | puredanger: so why have a custom function type that happens not to be clojure.lang.Fn? |
| 15:14 | puredanger | so it's not tied to Clojure? |
| 15:14 | puredanger | re Haskell… https://twitter.com/bodil/status/513031949586141184 :) |
| 15:15 | arrdem | lols |
| 15:15 | puredanger | he did actually say that too :) |
| 15:16 | mdeboard | puredanger: you work at cognitect too? |
| 15:16 | puredanger | yes |
| 15:16 | grim_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:16 | grim_radical | :/ |
| 15:16 | mdeboard | live by the sword |
| 15:17 | llasram | And Cognitect's policy toward open source software remains as insane as ever |
| 15:20 | dysfun | :( |
| 15:22 | amalloy | arrdem: 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:23 | amalloy | it's better to memoize functions within some kind of scope so you can free them when you're done |
| 15:24 | arrdem | amalloy: yeah exactly that's bitten me before |
| 15:24 | arrdem | *that has |
| 15:27 | amalloy | $mail danielcompton i released useful 0.11.3 for you |
| 15:27 | lazybot | Message saved. |
| 16:02 | technomancy | llasram: "technically open source" |
| 16:06 | pjstadig | technomancy: llasram: "transparent source" |
| 16:06 | llasram | (inc pjstadig) |
| 16:06 | lazybot | ⇒ 7 |
| 16:39 | lvh | is there a particularly good lein template for doing om (cljs) + sente (clj srver side) development? |
| 16:39 | lvh | seems like you always have to set one or the other up manually |
| 16:42 | amalloy | "transparent source". i like that description |
| 16:44 | gfredericks | it's at least forkable right? |
| 17:16 | puredanger | bbloom: btw I did see your message above re portable catch all and will try to bring that out more on the page |
| 17:17 | bbloom | puredanger: cool thanks |
| 17:18 | brianwong | hey 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:18 | brianwong | hopefully this example helps |
| 17:18 | brianwong | https://www.refheap.com/91577 |
| 17:18 | bbloom | puredanger: those damn js semantics, huh? |
| 17:18 | dogonthehorizon | Hey 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:19 | justin_smith | brianwong: yeah, that's what with-redefs is for |
| 17:19 | justin_smith | (doc with-redefs) |
| 17:19 | clojurebot | "([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:20 | jeremyheiler | brianwong: you just need a reference to teh var that holds that function |
| 17:20 | justin_smith | jeremyheiler: with with-redefs you don't even need that |
| 17:20 | brianwong | all the examples seem to mock out functions defined in the namespace being tested |
| 17:21 | brianwong | not functions that the namespace is calling out |
| 17:21 | justin_smith | brianwong: doesn't matter, that is arbitrary |
| 17:21 | brianwong | so what would the symbol be in my case? |
| 17:21 | brianwong | ec2/run-instances? |
| 17:21 | justin_smith | yes |
| 17:22 | brianwong | arg |
| 17:22 | brianwong | argh |
| 17:22 | brianwong | i had it, i just forgot the #' |
| 17:22 | brianwong | thanks. it worked |
| 17:22 | brianwong | for with-redefs-fn |
| 17:23 | justin_smith | ,(doc with-redefs-fn) |
| 17:23 | clojurebot | "([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:23 | justin_smith | why not just use with-redefs? |
| 17:23 | brianwong | im trying to read the difference right now |
| 17:23 | brianwong | thanks |
| 17:25 | justin_smith | another 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:26 | justin_smith | brianwong: look at the source of with-redefs - I think with-redefs-fn is just there to implement the with-redefs macro |
| 17:26 | justin_smith | $source with-redefs |
| 17:26 | lazybot | with-redefs is http://is.gd/rdnNKM |
| 17:28 | rurumate | suppose 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:28 | justin_smith | rurumate: what editor? |
| 17:29 | rurumate | emacs |
| 17:29 | justin_smith | there is an auto-string-escape mode |
| 17:29 | rurumate | neat, I'll check it out |
| 17:29 | justin_smith | string-edit.el M-x string-edit-at-point |
| 17:29 | justin_smith | it even works recursively :) |
| 17:30 | Balveda | "No cljson encoding for '{"_id" #<ObjectId 543848e84e19b68fa401e6a3>, "applicant" "JG", "appid" 1, "yob" 1999, "answer" "KPO"}'." |
| 17:30 | justin_smith | I bind it to C-c e |
| 17:30 | Balveda | What's the deal with this? |
| 17:30 | justin_smith | Balveda: what json lib is that using? |
| 17:30 | justin_smith | never mind, found it, cljson uses cheshire |
| 17:31 | justin_smith | the "_id" key's value is something the cheshire does not know how to encode |
| 17:32 | justin_smith | you can add new encoders so it knows how to handle various classes: http://dakrone.github.io/cheshire/cheshire.generate.html#var-add-encoder |
| 17:32 | justin_smith | but the reader will need to know the same rules if you want to create the same object type, of course |
| 17:37 | amalloy | or, more likely, tell your mongodb client not to give you the _id |
| 17:37 | amalloy | or just remove it yourself before encoding the object |
| 17:37 | justin_smith | this is also an option, yes |
| 17:39 | amalloy | i 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:41 | pandeiro | is there a trick to lower compilation time for projects with timbre? |
| 17:44 | Balveda | I was thinking the same thing |
| 17:44 | Balveda | Thanks |
| 18:00 | dweave | hi 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:01 | bbloom | dweave: use whatever you're comfortable with |
| 18:01 | rurumate | dweave: sublime is proprietary software afaik? also emacs is quite good |
| 18:01 | bbloom | dweave: don't try to learn a language and an editor at the same time |
| 18:02 | dweave | thanks bbloom |
| 18:02 | dweave | thats what i thought, wasn’t going to try to pick up emacs, but was wondering if something like light table had some advantage |
| 18:02 | dweave | doesn’t seem that way really tho |
| 18:02 | rurumate | I learned clojure and emacs at once. it worked fine and made sense to me |
| 18:03 | bbloom | dweave: 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:04 | rurumate | I think editor choice is quite important question for beginners. And some editors may be more frustrating than others. |
| 18:05 | dweave | why is clojure so editor sensitive i don’t really get that |
| 18:05 | dweave | not understanding what emacs really brings to the table for clojure that it wouldn’t do so for other languages |
| 18:05 | rurumate | because, a repl is less fun without autocomplete, syntax highlighting, and paredit |
| 18:06 | dweave | for instance sublime has a repl |
| 18:06 | ed-g | does 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:06 | bbloom | dweave: clojure (and many/most other lisps) are designed to support editing your program while it is running |
| 18:06 | bbloom | dweave: and your editor can support you in communicating with your running program |
| 18:06 | dweave | hmm i see |
| 18:06 | dweave | thanks i have to do some more reading it soudns like |
| 18:07 | rurumate | there's a video on youtube called clojure paredit speedrun or something, it helped me get started |
| 18:14 | amalloy | ed-g: iirc it's something like (ANY ["/bar/:baz" {:baz #"[\w,]+"}]- |
| 18:15 | catern | dweave: emacs is the best editor anyway, it's just more accepted in clojureland |
| 18:15 | dweave | ha everyone I know that uses it admits they secretly hate it |
| 18:16 | dweave | i’ve always been a vim guy |
| 18:16 | bbloom | dweave: there are many vim users in clojure land. tpope's vim-fireplace works great |
| 18:16 | bbloom | dweave: i myself am a fireplace user |
| 18:17 | catern | dweave: i also have been a vim guy, but I switched to emacs with evil-mode, vim emulation, because it is superior |
| 18:17 | amalloy | dweave: 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:17 | bbloom | the editor war is totally not necessary here |
| 18:18 | bbloom | dweave: use what you're familiar with. don't try to learn two things at once |
| 18:18 | amalloy | or: do try, because it's fun. but don't do it because you feel you have to |
| 18:18 | dweave | haha |
| 18:18 | dweave | i’ll figure it out |
| 18:18 | bbloom | amalloy: learning a new editor is my definition of "not very much fun" |
| 18:18 | bbloom | :-) |
| 18:19 | amalloy | bbloom: i had fun learning them both at once |
| 18:19 | amalloy | so i always have to object when advice is given to the effect that it's unconditionally bad |
| 18:19 | catern | amalloy: that's the best thing about emacs! then you don't have to hear me harp about it |
| 18:19 | catern | after you switch |
| 18:19 | amalloy | catern: that's what /ignore is for |
| 18:19 | catern | :( |
| 18:20 | bbloom | amalloy: 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:20 | bbloom | amalloy: 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:20 | amalloy | yeah, i bet |
| 18:21 | dweave | language agnostic: what is the benefit of emacs in evil mode |
| 18:21 | ed-g | amalloy: thanks! |
| 18:21 | amalloy | i opened up eclipse for the first time in months today, and kept hitting C-x C-s to save |
| 18:21 | dweave | seems like the bindings are the editor in the case of vim and emacs |
| 18:21 | catern | i'm glad people editor-warred around me, that way i switched to the superior editor |
| 18:21 | catern | dweave: certainly not! |
| 18:21 | ed-g | for those in the studio audience, full route syntax docs at https://github.com/weavejester/clout |
| 18:22 | dweave | catern do go on, to me I use vim because of the key bindings mainly |
| 18:22 | dweave | and because it looks cool |
| 18:22 | catern | dweave: 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:22 | amalloy | vim has some really advanced editing capabilities |
| 18:22 | dweave | emacs doens’t look cool |
| 18:22 | technomancy | dweave: the command language is the main strength of vim, and the programming language is the main strength of emacs. |
| 18:22 | justin_smith | dweave: emacs has a number of extensions and features - many use emacs specifically because of things like org-mode or the interactive process integration |
| 18:22 | amalloy | (inc technomancy) |
| 18:22 | lazybot | ⇒ 146 |
| 18:22 | technomancy | you may notice these two things are not mutually exclusive |
| 18:23 | catern | I really need to adapt that comment into a blogpost |
| 18:23 | justin_smith | dweave: 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:23 | catern | even if it is wrong in some ways, I hate linking to it |
| 18:23 | johnwalker | ,(clojure.java.browse/browse-url "http://google.com") |
| 18:23 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.java.browse> |
| 18:23 | johnwalker | darn |
| 18:23 | catern | justin_smith: well emacs key bindings are default or available many places |
| 18:23 | justin_smith | sure- but I don't actually like them |
| 18:23 | justin_smith | vi bindings are better |
| 18:23 | amalloy | "how do you work in vim?" "here is why i love emacs"??? |
| 18:23 | catern | agreed |
| 18:23 | lazybot | amalloy: Yes, 100% for sure. |
| 18:24 | tjd | johnwalker: you tried. |
| 18:24 | amalloy | $google google |
| 18:24 | lazybot | [Google] http://www.google.com/ |
| 18:24 | justin_smith | $google google google |
| 18:24 | lazybot | [Google] http://www.google.com/ |
| 18:24 | catern | dweave: and emacs does look cool, hmm... I guess these are some good screenshots http://tuhdo.github.io/emacs-tutor.html |
| 18:24 | johnwalker | i did try. |
| 18:25 | justin_smith | catern: woah, someone who actually turns on nyan-mode |
| 18:26 | catern | i know someone who leaves it on, it's kinda amusing |
| 18:26 | justin_smith | my 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:27 | justin_smith | dweave: 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:34 | catern | yes, emacs is something you grow up to |
| 18:49 | vIkSiT | hello all |
| 18:49 | vIkSiT | has anyone here used secretary routes with compojure/luminus? |
| 19:12 | qbg | Has anyone adapted core.async to produce a transducer instead? |
| 19:14 | qbg | go! to be specific |
| 19:25 | dopamean_ | 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:25 | dopamean_ | it seems that id need one function to return a promise and another to deliver the value? |
| 19:26 | dopamean_ | i also dont understand what happens if the http request fails |
| 19:27 | qbg | You could deliver some sort of error response |
| 19:29 | dopamean_ | the people suggesting returning the promise seemed to imply that this would somehow avoid exceptions |
| 19:36 | qbg | I'm not seeing how |
| 19:36 | dopamean_ | nor am i |
| 19:37 | dopamean_ | but i dont really understand what a promise adds here anyway |
| 19:37 | dopamean_ | so i dont really understand the suggestion at all |
| 19:38 | qbg | The code that makes the request doesn't have to block until it actually needs the result if you use a promise |
| 19:41 | dopamean_ | im not really sure what that means. i think i need to look at more examples. |
| 19:42 | justin_smith | dopamean_: often a future is more applicable - unless you have some other custom worker pool you want to execute the task |
| 19:43 | technomancy | dopamean_: 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:43 | justin_smith | also 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:44 | justin_smith | ) |
| 19:45 | dopamean_ | @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:45 | dopamean_ | or would it be better to throw the exception |
| 19:46 | technomancy | dopamean_: returning an error value only makes sense if you have an option type |
| 19:47 | technomancy | since clojure doesn't ship with pattern matching out of the box, that style is pretty rare |
| 19:47 | technomancy | error values that aren't option types are the worst |
| 19:47 | dopamean_ | good to know. i kind of figured as much and wasnt particularly fond of that idea |
| 19:48 | amalloy | just return Double/NaN whenever something goes wrong. it will never fail to surprise the user |
| 19:48 | technomancy | yeah, this isn't Google Go; we have a civilized approach to error handling =) |
| 19:48 | technomancy | amalloy notwithstanding |
| 19:48 | dopamean_ | lol |
| 19:48 | amalloy | clojurebot: amalloy |has| a sadistic approach to error handling |
| 19:48 | clojurebot | Ik begrijp |
| 19:49 | qbg | (System/exit 0) |
| 19:49 | qbg | *really* surprise the user :p |
| 19:49 | technomancy | ~guards |
| 19:49 | clojurebot | SEIZE HIM! |
| 19:50 | dopamean_ | thanks for the advice guys. i really appreciate it. |
| 19:51 | technomancy | np |
| 20:41 | ed-g | Hello, 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:44 | ed-g | This 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:45 | dnolen_ | loving the Chestnut http://swannodette.github.io/2014/10/10/magic/ |
| 20:51 | nullptr | dnolen_: neat -- looks like it was updating from a save hook? you didn't have to eval your changes? |
| 20:54 | dnolen_ | nullptr: yes, figwheel updates namespaces when you save - you can use defonce to protect app state |
| 20:54 | nullptr | i see ... seems like something that would start to lag as your app gets huge, no? |
| 20:56 | justin_smith | ed-g: yesql is pulling in clojure.java.jdbc, you can use the jdbc classes |
| 20:56 | ed-g | justin_smith: thanks! :-) |
| 20:57 | dnolen_ | nullptr: I don't see how |
| 20:57 | dnolen_ | nullptr: but you might not be familiar with the Om rendering model |
| 20:57 | dnolen_ | nullptr: browsers can eval tens of thousands of lines of JS at ridiculous speeds |
| 20:58 | nullptr | i'm thinking more of the cljs->js translation, not the browser runtime (yes, familiar with om model) |
| 20:59 | dnolen_ | nullptr: I don't follow why would you use cljs->js outside of interop? |
| 20:59 | dnolen_ | nullptr: and even then you should just have the data in the right format |
| 21:00 | dnolen_ | cljs->js is a sign of not accepting the truth of interop |
| 21:01 | nullptr | if i'm not using chestnut, i'm using lein cljsbuild, which is doing cljs->js each time i save |
| 21:01 | dnolen_ | nullptr: huh? no |
| 21:01 | dnolen_ | nullptr: chestnut uses fighwhell which just calls the cljs compiler, same as cjlsbiuld |
| 21:01 | dnolen_ | cljsbuild |
| 21:02 | dnolen_ | cljs->js is a helper for converting data structures - has nothing to w/ compile time generation of JS |
| 21:02 | justin_smith | are you talking about the cljs->js function, or about the compilation process? |
| 21:02 | nullptr | oh, heh |
| 21:02 | nullptr | yes, compilation process -- that explains the confusion |
| 21:02 | dnolen_ | nullptr: figwheel compiles only the namespaces that change, no problems here |
| 21:02 | nullptr | gotcha |
| 21:03 | dnolen_ | nullptr: since a file maps to namespace, this should never be an issue even if your project is massive |
| 21:03 | nullptr | that's really nice |
| 21:03 | ed-g | ok, 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:04 | nullptr | i 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:04 | nullptr | but if it's smart about what actually gets translated that shouldn't be an issue in practice |
| 21:04 | justin_smith | ed-g: first thing I would do is see if there is a newer org.postgresql version that does implement that feature |
| 21:05 | justin_smith | ed-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:05 | dnolen_ | nullptr: large code bases definitely affect first compile (I'm working on fixing that) but incremental compilation has worked for a while now |
| 21:06 | ed-g | justin_smith: maybe I should just return an array of EDN string which can be parsed into a map. |
| 21:06 | justin_smith | it seems like that would be much easier |
| 21:06 | nullptr | yeah, 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:09 | justin_smith | TIL postgres has built in geometric datatypes http://jdbc.postgresql.org/documentation/head/geometric.html |
| 21:46 | verma | technomancy, sorry off topic, but what's the quicking way to turn my wired kb to a bluetooth/wireless one? |
| 22:07 | amalloy | scissors |
| 22:17 | justin_smith | stay tuned for the next episode, where we introduce the qualifying adjective "working" |
| 22:26 | technomancy | verma: I've never really looked into BT |
| 22:31 | technomancy | not really keen on the idea of keeping yet another battery charged |
| 22:48 | verma | technomancy, wireless poker2 would be nice though, take it around with me, the wire always seems like a hassle |
| 22:53 | numberten | ,(clojure.string/trim-newline "test\n") |
| 22:53 | clojurebot | "test" |
| 23:24 | kenrestivo | verma: http://handheldsci.com/kb ? |
| 23:44 | amalloy | if you're carrying a whole keyboard with you, i don't imagine a wire would be a big deal |
| 23:45 | amalloy | spend like two seconds wrapping it around the keyboard when you pick it up |
| 23:46 | TEttinger | amalloy, for things like android phones/tablets with BT but no plugs, maybe |
| 23:47 | amalloy | TEttinger: indeed, that sounds plausible. i was objecting to "the wire always seems like a hassle" |
| 23:47 | TEttinger | I was DCed for a while |
| 23:55 | verma | kenrestivo, 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 |