2014-09-09
| 00:26 | arrdem | &(count (for [x (range 9999)] (zero? (mod x 2)))) |
| 00:26 | lazybot | Execution Timed Out! |
| 00:33 | justin_s` | &(count (for [x (range 9999)] (zero? (mod x 2)))) |
| 00:33 | lazybot | Execution Timed Out! |
| 00:40 | elarson | I was trying to give core.async a try and I get this error: reduce already refers to: #'clojure.core.async/reduce in namespace |
| 00:40 | yedi | does anyone know why the macro go isn't being recognized in cljs? (https://gist.github.com/yedi/42dad0640f57327b16ea) |
| 00:41 | yedi | whenever i uncomment that section, i get a cannot read property 'call' of undefined at line 22 |
| 00:41 | yedi | go-loop seems to work fine however |
| 00:42 | yedi | nvm, looks like the error is within the go block and debugging it is just janky |
| 00:55 | J_Arcane | which JDK should I be running for Clojure on windows? |
| 01:07 | maxthoursie | elarson: there's a reduce function in core.async, which is also in core, if you import both, you'll get a clash |
| 01:07 | joshuafcole_ | Is destructuring capable of taking a map and destructuring it into a vec with keys in the order given? |
| 01:08 | joshuafcole_ | e.g. I'd want something like (bogus synax) |
| 01:09 | joshuafcole_ | (let [[:keys [x y]] point]) ; -> [(:x point) (:y point)] |
| 01:09 | maxthoursie | elarson: I would recommend [:require [core.async :as async]] or similar |
| 01:11 | joshuafcole_ | I guess I'm probably just trying to be too clever about it. There isnt' really a good way to get a symbol in there to name the list anyway. |
| 01:12 | maxthoursie | joshuafcole_: (let [{:keys [x y]} point] [x y]) ? |
| 01:13 | maxthoursie | J_Arcane: dont think it matters much, what is your choices? |
| 01:14 | maxthoursie | J_Arcane: I've used the latest JDK7 |
| 01:15 | joshuafcole_ | maxthoursie: yeah, I think that's the closest I can get. Thanks! |
| 01:17 | dorkmafia | let's say i created a library project for myself to use lein new mylib how do i reference mylib in another project? :) |
| 01:17 | maxthoursie | joshuafcole_: or something like ((juxt :x :y) point) |
| 01:17 | maxthoursie | joshuafcole_: that's not destructing anymore though |
| 01:19 | J_Arcane | maxthoursie |
| 01:19 | dorkmafia | symlinks cool |
| 01:19 | J_Arcane | Well, it seems that I'm getting a pile of errors when I run lein repl on jdk 8, so I'm gonna try 7. |
| 01:20 | maxthoursie | J_Arcane: oh, that's surprising, but I haven't tried it |
| 01:20 | maxthoursie | dorkmafia: or something like https://github.com/kumarshantanu/lein-localrepo maybe |
| 01:21 | dorkmafia | maxthoursie: i was going to try with the checkouts dir what should i symlink in there? and then what do i put in my lein project dependencies? |
| 01:23 | maxthoursie | dorkmafia: sorry, I don't know, havn't run into it yet, but I suspect I will |
| 01:24 | dorkmafia | :( |
| 01:27 | J_Arcane | huh, no, same page full of errors on 1.7 too. :P |
| 01:30 | J_Arcane | Is this at all normal? http://pastebin.com/hTrThtys |
| 01:34 | J_Arcane | Huh. Apparently a known issue: https://github.com/technomancy/leiningen/issues/1625 |
| 01:54 | justin_smith | J_Arcane: is this inside a project directory? |
| 01:54 | joshuafcole | I'm looking to construct a 2 dimensional grid of values as a vec of vecs. The obvious way I can think of to do so is with nested maps (one per dimension). I feel like there's probably a cleaner way to do it (perhaps doseq?) that doesn't require the explicit nesting, but I can't think of what it would be |
| 01:54 | J_Arcane | Nay. Just running the bare repl from anywhere. I forget if I tried it in a project. |
| 01:55 | J_Arcane | 2.4.2 works fine from anywhere though, so I'm mollified. |
| 01:55 | joshuafcole | I know doseq can provide the values from N ranges the way I'd like it to, but I'm not sure how I'd neatly compose the actual result from it, since it's intended for side effects |
| 01:55 | joshuafcole | And actually, come to think of it, it doesn't really need to be structured as a vec of vecs, it just needs to be addressable by coord |
| 01:55 | justin_smith | joshuafcole: for is like a lazy doseq that returns all the results |
| 01:56 | joshuafcole | ah derp, I didn't even think of that. Laziness should be fine in this case, since I'm going to be consuming the values directly. |
| 01:56 | joshuafcole | Cheers |
| 02:03 | J_Arcane | Hrm. My Light Table docs functions don't seem to be working. |
| 02:05 | seancorfield | J_Arcane can you be a bit more specific? |
| 02:05 | seancorfield | Do you mean showing docs for LT, or for a specific symbol? |
| 02:10 | J_Arcane | seancorfield: the language docs. Neither in-line with the right click or the search seem to do anything at all. |
| 02:14 | J_Arcane | OK, it seems it was missing some deps that the koan-runner was preventing it from acquiring, but now in attempting it I get a stream of console errors. |
| 02:14 | J_Arcane | search works now, just not the right-clock option. |
| 03:48 | sveri | Hi, using stuarts tools.namespace is there a way to keep some namespaces from being refreshed when calling (refresh)? |
| 05:05 | ARM9 | any idea why lein repl goes bonkers? |
| 05:06 | hyPiRion | ARM9: it's the dreaded technomancy/leiningen#1625 |
| 05:06 | lazybot | nREPL barfing in non-project REPLs -- https://github.com/technomancy/leiningen/issues/1625 is open |
| 05:06 | ARM9 | NoSuchMethodError clojure.tools.nrepl.StdOutBuffer.length() and then the classic wall of at namespace.xyz java errors |
| 05:06 | ARM9 | I'll have a look |
| 05:06 | hyPiRion | it's solved on master, we're working on a new release coming in a few days |
| 05:06 | hyPiRion | in the meantime you can do `lein downgrade 2.4.2` |
| 05:07 | ARM9 | cheers |
| 05:20 | clgv | hyPiRion: is there a short explanation why that happened all of a sudden with the last release? |
| 05:21 | hyPiRion | clgv: We still don't know really. https://github.com/technomancy/leiningen/issues/1629 |
| 05:21 | hyPiRion | Or at least I don't know |
| 05:21 | hyPiRion | Aether magic |
| 05:22 | clgv | ok. not so "repeatable" it seems ;) |
| 05:23 | hyPiRion | oh, it's repeatable |
| 05:23 | hyPiRion | But bumping version numbers somehow solved the issue |
| 05:23 | clgv | well I meant the dependency resolution which seems to differ as described in the ticket |
| 05:24 | clgv | but must be pretty weird since it did not seem to occur in other projects |
| 05:24 | hyPiRion | ~mystery |
| 05:24 | clojurebot | mystery is http://p.hagelb.org/mystery.gif |
| 05:25 | clgv | :P |
| 05:25 | ddellacosta | that is such a cute image |
| 05:25 | ddellacosta | the bug itself is not cute |
| 05:26 | hyPiRion | It's not a funny bug, trust me |
| 05:26 | hyPiRion | Esp. because Phil didn't manage to reproduce it at first |
| 05:34 | lvh | How do I use a leiningen checkout for a java dependency? |
| 05:34 | lvh | leiningen ignores it because there's no project.clj |
| 05:37 | wombawomba | I'm passing a really convoluted predicate (containing macros) to a macro. I would like to break this up into parts, e.g. turn (mymacro (or (= :something 2) (= :something-else 3))) into something like (mymacro (or something-equals-2 something-else-equals-3)). How would I do this? |
| 05:43 | dm3 | wombawomba: what did you try already? |
| 05:48 | wombawomba | dm3: er, I tried (def some-equals-2 '(= :something 2)) and (defmacro some-equals-2 [] (= :something 2)) |
| 05:48 | wombawomba | I don't really have any idea what I'm doing though |
| 05:49 | dm3 | that's the problem :) |
| 05:49 | dm3 | try macroexpanding the inner macros |
| 05:49 | dm3 | I would strongly advice coming up with the function-based API first and then wrapping into macros |
| 06:03 | wombawomba | Hmm, so there's no easy way to just transplant (= :something 2) out of the predicate and just have the compiler paste it back in regardless of its contents? In (pseudo-)C I would just #define some-equals-2 (= :something 2). |
| 06:03 | wombawomba | I figure I should be able to do something similar |
| 06:13 | clgv | lvh: do you plan to compile the java project yourself? |
| 06:15 | lvh | clgv: Not manually, no. I contributed a feature to an upstream Java project. I want to test that my Clojure code works with it. The Java project has not yet done a release, and would like me to manually confirm that the code does what I think (because they made some additional changes) before activating the release machinery. |
| 06:15 | lvh | So maybe what I want to say is "pretend that you got this thing off of maven even though you're atually getting it off of github" |
| 06:16 | clgv | lvh: so you temporarily need to build it until you are sure it works and it ends up in an official release? |
| 06:16 | clgv | lvh: is it maven based? |
| 06:17 | lvh | clgv: Correct. |
| 06:17 | lvh | clgv: Yes. At least, it has a pom.xml. I think that means it's Maven-based? |
| 06:18 | clgv | lvh: if so, just dont use it as checkout - change the version number to something that marks it as you temporary snapshot and then build and install locally it via maven. you can then use it as a normal dependency in your clojure project |
| 06:18 | piranha | is there a way to check that data.json/read-str didn't read the whole string? |
| 06:19 | clgv | lvh: update after changes are only one maven commandline execution |
| 06:19 | lvh | clgv: Wait, to be clear: the *upstream Java thing* is Maven based. I'm just using lein. |
| 06:19 | piranha | ,(clojure.data.json/read-str "1[]") |
| 06:20 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.data.json> |
| 06:20 | piranha | eh |
| 06:20 | piranha | anyway, it reads 1 from there and I would love to have exception |
| 06:20 | clgv | lvh: yeah, what I was saying is build your fork of the java project via maven (and install it locally) then get it in your clojure project as normal dependency |
| 06:20 | lvh | aha |
| 06:22 | clgv | lvh: probably "mvn package && mvn install" is what you need |
| 06:23 | lvh | clgv: Does "normal dependency" there mean I have to upload it to clojars/central? |
| 06:23 | clgv | lvh: depending on the pom.xml "mvn install" might suffice - I am no maven expert ;) |
| 06:23 | lvh | I'll try. Thanks :) |
| 06:23 | clgv | lvh: no you dont. it is locally installed on the maven folden on your current machine |
| 06:23 | lvh | Oh, cool. |
| 06:31 | clgv | lvh: probably someone should summarize those use cases in a blogpost or similar ^^ |
| 06:52 | CookedGryphon | gah, does anyone else use prelude? |
| 06:52 | CookedGryphon | and is cider utterly borked for you? |
| 07:03 | noncom|2 | clgv: ping |
| 07:04 | clgv | noncom|2: pong |
| 07:04 | noncom|2 | CookedGryphon: i am learning emacs, so prelude is my current main setup.. cider kinda works :) but it si not included with prelude.. |
| 07:04 | clgv | ah vectors in 1.7 will implement IReduce :D |
| 07:04 | CookedGryphon | noncom|2: it is if you enable the clojure module isn't it? |
| 07:05 | noncom|2 | clgv: hi! did you try to use the latest ccw with java 8 + eclipse luna ? i get some stalls with lein->update deps in eclipse.. |
| 07:05 | clgv | clgv: I switched back to kepler because of weird multiwindow issues with luna |
| 07:06 | clgv | noncom|2: what do you mean by "getting some stalls"? |
| 07:06 | noncom|2 | clgv: well, eclipse just hangs when i call Leiningen->Update dependencies .. |
| 07:06 | noncom|2 | and never comes back |
| 07:06 | clgv | noncom|2: my workspace shows errors that dependencies could not be retrieved which "lein deps" does not report |
| 07:07 | noncom|2 | clgv: is it in luna or kepler ? |
| 07:07 | clgv | luckily it does not prevent a repl to start. this is in kepler with latest ccw |
| 07:07 | noncom|2 | CookedGryphon: hmmm right.. still, working within emacs seems a bit complicated to me, i am in the process of learning.. |
| 07:09 | noncom|2 | clgv: well, kepler worked just fine for me.. all works at 100%.. i guess i'll go get back to it then :) luna will have to wait for some time i guess.. |
| 07:11 | noncom|2 | clgv: is your os linux or windows ? |
| 07:14 | clgv | noncom|2: linux |
| 07:15 | clgv | noncom|2: the multiwindow issue on luna is a showstopper for me as well |
| 07:16 | noncom|2 | clgv: how do you reproduce the multiwindow issue ? |
| 07:17 | clgv | noncom|2: I can't immediatel. It occurs after some time working in the project |
| 07:18 | clgv | noncom|2: https://code.google.com/p/counterclockwise/issues/detail?id=650 |
| 07:20 | noncom|2 | clgv: hmmmm... i see.. well.. eclipse keeps going astray with their changes to the api i guess :) |
| 07:21 | clgv | noncom|2: well probably CCW needs to drop support for older eclipse versions and move to the new eclipse 4 API. that compatibility layer for eclipse 3 plugins is probably causing this issue |
| 07:22 | clgv | not sure though |
| 07:23 | noncom|2 | clgc: what linux are you using ? are you installing eclipse from their website or via some linux app manager ? |
| 07:23 | noncom|2 | Clgv: sorry for mistyping the nic .. :) |
| 07:23 | noncom|2 | omg again.. |
| 07:23 | noncom|2 | :) |
| 07:23 | noncom|2 | phew.. |
| 07:24 | clgv | noncom|2: linux mint 17, I always install eclipse manually |
| 07:24 | clgv | noncom|2: if you dont know it just think "Ubuntu 14.04" ;) |
| 07:27 | noncom|2 | clgv: yeah, tried mint several times :) but mainly use ubuntu 14.04 for it being less in size. not my main os, so no care for media and other comfort stuff provided by mint.. |
| 07:28 | noncom|2 | clgv: currently researching the usability of clojure programming on android device with linux deploy + ubuntu 14.04.. i bet you remember this one |
| 07:31 | clgv | ah right |
| 07:32 | clgv | noncom|2: I like mint because it has two usable window managers where ubuntu has none ;) |
| 07:32 | clgv | warning: highly opinionated :P |
| 07:33 | clgv | ah well lets say subjective ;) |
| 07:33 | noncom|2 | haha.. well, i just put lxde on ubuntu for now :) less size, less memory.. less power consumption - that's vital for me now |
| 07:35 | clgv | I am running cinnamon on my workstations and mate on my laptop |
| 07:37 | clgv | I need usable shortcuts for those forward/backward slurp/barf commands |
| 08:52 | lavokad | every time evaluation in cider throws a error, the *cider-error* buffer gets focused? How can I avoid this? |
| 08:53 | apod | lavokad: (setq cider-auto-select-error-buffer nil) |
| 08:54 | lavokad | apod: thank you |
| 09:09 | mikker | How can I auto-run a command as soon as I start my lein repl? |
| 09:10 | arrdem | :injections or user.clj |
| 09:10 | mikker | Something like .irbrc (I'm a clojure beginner coming from ruby) |
| 09:10 | mikker | user.clj in proj root ? |
| 09:10 | arrdem | user.clj on the source path |
| 09:11 | arrdem | Clojure will by default load the file "user.clj" from the classpath as part of its boot sequence. whether this is a feature has been debated. |
| 09:12 | arrdem | alternatively if you want _global_ injections you could use the :injections key in your leiningen user profile |
| 09:12 | mikker | src/user.clj works, thanks |
| 09:12 | arrdem | those will be applied to any REPL you start with lein anywhere |
| 09:12 | arrdem | kk |
| 09:13 | mikker | I just want to automatically boot my ring server, when I start a repl |
| 09:13 | jaju | mikker: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded may be helpful. Talks about user.clj and excluding it in production etc. |
| 09:13 | jaju | In addition, I mean, to this discussion. |
| 09:14 | mikker | I saw that, never actually read it |
| 09:14 | mikker | Will do now |
| 09:14 | mikker | This is my third, I think, stab at my first clojure project and this time I think I'm getting it |
| 09:15 | mikker | (enough to get somewhere useful at least) |
| 09:16 | jaju | Incidentally, I am using clojurescript for the JS in an RoR project. Still trying to figure out the integration... |
| 09:16 | mikker | mix-n-match :) |
| 09:33 | clgv | is :inline-arities metadata something that is checked by the compiler on inlining? |
| 09:34 | clgv | humm seems it should be https://github.com/clojure/clojure/blob/1a560c80fece9de8d5d2b1260c4e5dff8be63eca/src/jvm/clojure/lang/Compiler.java#L6561 |
| 09:35 | clgv | but I get no error when using the wrong arity |
| 09:35 | clgv | well maybe it just does not inline then |
| 09:37 | clgv | ah ok that's it |
| 09:57 | thirdOrange | hi - if I have a default template leinigen project and add another file under source, how can i use that file in the lein repl? i get a could not locate...on classpath error |
| 09:57 | rweir | what did you call it, hwo did you try to load it |
| 09:58 | thirdOrange | first i tried sending it there using fim fireplace -> cpr hotekey, then i tried (load "mynamespace.second") |
| 09:58 | thirdOrange | vim fireplace |
| 09:58 | lvh | how do I spell a transducer that merges elems into a map? I was hoping either merge, but that doesn't appear to be it, or conj, but that appears to conj to []. |
| 09:59 | arrdem | lvh: conj of two element vectors onto a map should work.. |
| 10:00 | lvh | actually, lemme restart cider first, I'm still running .1.6 |
| 10:00 | clgv | thirdOrange: you probably didn't place and/or name the namespace file right and thus the classloader is not able to find it |
| 10:00 | arrdem | that could be an issue |
| 10:01 | clgv | thirdOrange: for the namespace "a.b.c" you need the file "c.clj" in the folder "src/a/b/" (assuming the default source folder "src") |
| 10:02 | thirdOrange | clgv: that was it. i had a dash in my file name but not in the namespace name. wasn't aware of that restriction, thanks! |
| 10:02 | clgv | thirdOrange: dashes need to be converted to underscore |
| 10:02 | arrdem | thirdOrange: dashes in namespace names correspond to _ in file names |
| 10:02 | lvh | hm, in alpha1, (conj) is still [], not a transducer |
| 10:02 | arrdem | lvh: alpha2? |
| 10:03 | thirdOrange | arrdem: ah thanks! |
| 10:03 | arrdem | thirdOrange: it's a known pitfall that Rich has been unwilling to improve the handling of for some reason |
| 10:04 | lvh | arrdem: that's a thing? http://clojure.org/downloads still says -alpha1 :/ |
| 10:04 | arrdem | I think the argument is that "everyone does it once and only once so why bother" |
| 10:04 | arrdem | lvh: hum... I would have sworn there was an alpha2 [ann] on the mailing list. |
| 10:04 | lvh | arrdem: maven central agrees with you |
| 10:04 | arrdem | https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-alpha2/ |
| 10:04 | lvh | so I guess the page just never got updated :) |
| 10:04 | arrdem | lol |
| 10:08 | lvh | arrdem: thanks :) |
| 10:19 | samflores | arrdem, alpha2 here: (type (conj)) ;; => clojure.lang.PersistentVector |
| 10:19 | samflores | shouldn't it be a fn? |
| 10:20 | samflores | like: (type (map identity)) ;; => clojure.core$map$fn__4341 |
| 10:21 | clgv | ,(conj) |
| 10:21 | clojurebot | [] |
| 10:22 | lvh | I guess async/into {} actually does what Iw ant |
| 10:31 | cbp | ,(type (map identity)) |
| 10:31 | clojurebot | clojure.core$map$fn__4341 |
| 10:31 | cbp | o snap |
| 10:31 | cbp | I've been away from clojure for too long it seems |
| 10:32 | TEttinger | ,(map identity) |
| 10:32 | clojurebot | #<core$map$fn__4341 clojure.core$map$fn__4341@450563> |
| 10:32 | TEttinger | woah |
| 10:32 | TEttinger | ,((map identity) [1 2 3]) |
| 10:32 | clojurebot | #<core$map$fn__4341$fn__4342 clojure.core$map$fn__4341$fn__4342@a21ac2> |
| 10:33 | TEttinger | ,((map identity)) |
| 10:33 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/map/fn--4341> |
| 10:33 | hyPiRion | xducers |
| 10:33 | TEttinger | how does that work? |
| 10:33 | cbp | ,*clojure-version* |
| 10:33 | clojurebot | {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"} |
| 10:34 | hyPiRion | $google clojure transducers hickey |
| 10:34 | lazybot | [Transducers are Coming — Cognitect Blog] http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming |
| 10:36 | clgv | clojurebot: transducers |are| explained here: http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming |
| 10:36 | clojurebot | Ack. Ack. |
| 10:36 | clgv | transducers? |
| 10:36 | clojurebot | transducers are a thing |
| 10:36 | clgv | :( |
| 10:36 | clgv | ~transducers |
| 10:36 | clojurebot | transducers are explained here: http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming |
| 10:36 | clgv | :D |
| 10:36 | mdrogalis | clgv: Emphasis on -are-. |
| 10:36 | mdrogalis | Just to be sure. |
| 10:36 | rweir | they're the monads of the clojure world |
| 10:36 | clgv | mdrogalis: huh? what? |
| 10:36 | rweir | can someone explain them to me in terms of a burrito in a space suit? |
| 10:37 | mdrogalis | clgv: Heh, just a joke. Nothing. |
| 10:37 | clgv | :P |
| 10:37 | hyPiRion | rweir: they are not monads, but have roughly the same "wat"-factor |
| 10:38 | clgv | function compositions would be a pretty general description, I guess |
| 10:38 | TEttinger | but not the same as comp, I guess |
| 10:40 | danneu | does anyone else have a problem with their aot compilation hanging every few times they push to heroku? |
| 10:40 | clgv | yes, something that has to fulfill the contract of "map" needs to include some iteration specific code |
| 10:41 | rweir | hyPiRion, yeah, I know, I meant that they're an important abstraction that seems exceedingly hard for people to get |
| 10:41 | rweir | [me included] |
| 10:42 | clgv | I dont know if I am wrong there, but I am reminded of ring middleware definitions when looking at the single arity implementation of "map" |
| 10:42 | hyPiRion | I wouldn't say hard necessarily, but very foreign |
| 10:43 | hyPiRion | I would guess I used more time to grok for loops the first time, compared to transducers |
| 10:43 | clgv | hyPiRion: the c/c++/java-things or the clojure "for"? |
| 10:46 | hyPiRion | clgv: java/c/c++/all-other-algol-like language style for |
| 10:46 | clgv | :O |
| 10:47 | justin_smith | I spent more time learning the word "bird" than the word "modem" - I think it may be related to the order I learned things |
| 10:47 | hyPiRion | huh? It was insanely hard to grok how it worked when I first started programming |
| 10:49 | clgv | "a function getting a function F as argument returning a function M that takes a function C as argument and recursively combining F and C" is pretty complicated compared to "iterate through all numbers between A and B" ;) maybe too much implementation details on 1-map |
| 10:49 | samflores | is the clojurebot source available? |
| 10:49 | rweir | c/c++ for is much harder than it looks, since it's for (arbitrary_expression ; arbitrary_expression ; arbitray_expression_interpreted_as_boolean) |
| 10:49 | justin_smith | samflores: yeah, it is findable on github |
| 10:49 | rweir | whereas e.g. python's is "hit the object with the 'next' stick until it is empty" |
| 10:49 | clgv | samflores: yes, look on github |
| 10:50 | samflores | thanks |
| 10:50 | clgv | $google clojurebot github |
| 10:50 | lazybot | [hiredman/clojurebot · GitHub] https://github.com/hiredman/clojurebot |
| 10:50 | clgv | $google lazybot github |
| 10:50 | lazybot | [Raynes/lazybot · GitHub] https://github.com/Raynes/lazybot |
| 11:13 | gdeer81 | arrdem, doing the clojurecup this year? |
| 11:56 | dorkmafia | #<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class org.jivesoftware.smack.XMPPConnection, compiling |
| 11:57 | dorkmafia | does that mean it can't find the jar? |
| 11:57 | gdeer81 | dorkmafia, it could mean you're trying to call the constructor with the wrong number of arguments |
| 11:57 | bbloom | I dislike JIRA so much that the new HipChat redesign makes me dislike it too: https://twitter.com/bjburton/status/509369159697068033/photo/1 |
| 11:58 | dorkmafia | it's an abstract class (defn stop [#^XMPPConnection conn] (when conn (.disconnect conn))) |
| 11:58 | dorkmafia | that's the only place it's called :\ |
| 11:59 | numberten | is there a good way to create new leaf values for prismatic's schema? |
| 11:59 | numberten | like a new primitive for non-zero ints or something |
| 12:00 | dorkmafia | or wait maybe here conn (XMPPConnection. connect-config)] |
| 12:01 | clgv | dorkmafia: Clojure does not find a constructor in the class that matches the constructor call in your code with respect to the number or arguments and maybe also the types of the arguments |
| 12:01 | gdeer81 | dorkmafia, the constructor is marked as protected |
| 12:01 | dorkmafia | got ya |
| 12:01 | clgv | dorkmafia: yeah, that's very likely the spot it complains about - you should have a line number in the exception as well |
| 12:02 | gfredericks | numberten: the pred function would help with that, no? |
| 12:03 | numberten | gfredericks: aye I just found that, thank you :) |
| 12:04 | dorkmafia | clgv it was just telling me line 1 before where the import was |
| 12:05 | dorkmafia | which was a bit frustrating :P |
| 13:10 | justin_smith | ,:ping |
| 13:10 | clojurebot | :ping |
| 13:14 | jtackett | hey does ring reload work if there is a long running process that needs to be returned to a web page? |
| 13:16 | justin_smith | by "long running process that nees to be returned to a web page" do you mean some result or statsu of a long running process needs to be used as input to render a page? |
| 13:16 | jtackett | yes |
| 13:16 | justin_smith | how do you bind that process for retrieval? |
| 13:16 | jtackett | the long running process would return the text that needs to be placed in a text area |
| 13:16 | justin_smith | is there an atom? something in the session? |
| 13:16 | jtackett | in a future |
| 13:17 | justin_smith | how is the future bound? in an atom? something in the session? |
| 13:17 | jtackett | write now the method is just called in the html view |
| 13:17 | justin_smith | a global var? |
| 13:17 | jtackett | not bound now |
| 13:17 | justin_smith | so, in the handler that renders the page, you have a local binding to a long running process |
| 13:17 | jtackett | yes |
| 13:18 | justin_smith | and the client just sits and waits for the long running process to complete before they get their response? |
| 13:18 | jtackett | yep |
| 13:18 | jtackett | which ultimately leads to a time out error |
| 13:18 | justin_smith | as I would expect |
| 13:19 | jtackett | would like to avoid web sockets and polling if possible |
| 13:19 | justin_smith | you could attach a binding to the long running process to the session, so they could get the result with a future request. Or you could write some front end AJAX that polls for the result and fills it in later. |
| 13:20 | justin_smith | with no web sockets or polling, your best bet is to attach a binding to the process in the session, and on the following request, check if it is complete, returning the result if it is available |
| 13:21 | jtackett | how does AJAX work? |
| 13:21 | justin_smith | ,(realized? (future (Thread/sleep 300000))) |
| 13:21 | clojurebot | #<SecurityException java.lang.SecurityException: no threads please> |
| 13:21 | justin_smith | bleh |
| 13:21 | justin_smith | jtackett: AJAX is where the javascript on the rendered page sends a request back to the server |
| 13:22 | justin_smith | and then, usually, uses the data it gets to update the page without a full reload of the page |
| 13:22 | jtackett | so what is an easy way to wrap a method call in AJAX? |
| 13:22 | justin_smith | like the way gmail or facebook can tell you about events even though you have not reloaded the page |
| 13:22 | justin_smith | method call? |
| 13:22 | jtackett | so in the view |
| 13:23 | jtackett | html page. …. <p> … blah blah (get-text “input”) … blah blah |
| 13:23 | justin_smith | jtackett: I don't know what you mean by view. In my professional experience the view is javascript / html / css that runs in the browser, but you use the word view to refer to things in clojure. |
| 13:23 | jtackett | yes think of the view as html |
| 13:24 | justin_smith | but there is an essential barrier here |
| 13:24 | justin_smith | things either execute on the client or server |
| 13:24 | jtackett | i am just using hiccup to render the html |
| 13:24 | justin_smith | the rendering that happens in clojure (in hiccup) is part of the server, so it is not part of the view |
| 13:24 | justin_smith | it is generating data for the view layer |
| 13:25 | jtackett | for me, the handler |
| 13:25 | justin_smith | in order to do AJAX you need javascript code that makes a request back to the server, with a callback that updates the DOM |
| 13:25 | jtackett | has routes, that call views (html code rendered by hiccup) |
| 13:25 | justin_smith | OK so in your model the browser doesn't even exist |
| 13:26 | jtackett | i don’t think so |
| 13:27 | Rhainur | jtackett: what are you trying to do again? why do you need to "wrap" a method call in AJAX? |
| 13:27 | justin_smith | You may need to adopt a different model of the architecture if you want a long running process to display results. With AJAX, the view is javascript running in the browser, and it polls for expected updates from the server (controller) |
| 13:27 | justin_smith | Rhainur: he has a long running process, and wants the results to show up to the browser, but the process takes so long the request times out |
| 13:28 | jtackett | I would like a long running process to return text thta would be displayed in the html |
| 13:29 | dgrnbrg | I want to give my library a name—it lets you use core.async with Ring: https://github.com/dgrnbrg/async-ring |
| 13:29 | dgrnbrg | however, Ring isn’t a name I can use |
| 13:29 | Rhainur | jtackett: do you know how long the process takes roughly? |
| 13:29 | jtackett | Rhainur: it varies based on the user input |
| 13:30 | jtackett | more than 30 secs though because that’s all heroku allows |
| 13:30 | Rhainur | oh hmmm |
| 13:30 | Rhainur | that's a different issue entirely |
| 13:31 | Rhainur | maybe you want to shift this to a background task |
| 13:31 | jtackett | tricky isn’t it |
| 13:31 | Rhainur | and poll for results |
| 13:31 | jtackett | I could do that |
| 13:31 | jtackett | how would I go about setting that up? |
| 13:31 | Rhainur | let's shift this to PM because this isn't really clojure related |
| 13:31 | justin_smith | if you are doing it all yourself, you may want to use clojurescript and core.async |
| 13:33 | dbasch | jtackett: what you’re trying to do it’s pretty standard, you just have to learn the tools. Have you checked out sente yet? |
| 13:33 | noonian | yeah, i was recommending chord for a slightly simpler introduction |
| 13:34 | jtackett | I have, but I am getting very confused since my project is set up with compojure and hiccup |
| 13:34 | jtackett | aka a view and a handler |
| 13:34 | jtackett | view for html |
| 13:34 | jtackett | handler for routes |
| 13:39 | justin_smith | as I said before, to really use things like long runnint processes and polling, your "view" has to conceptually be in the browser, not on the server |
| 13:40 | jtackett | the view is in the browser, it is html |
| 13:40 | amalloy | dgrnbrg: i just read your readme for async-ring, and i didn't see any mention of what looks like the most important feature: that you can return a channel from your handler function |
| 13:40 | dgrnbrg | Well, you actually create one channel per handler, instead of per request |
| 13:40 | justin_smith | jtackett: let me try again: you need logic that runs in the browser |
| 13:40 | amalloy | the whole readme looked like "here's how you can make a small change to your existing ring server and it'll now work with async-ring" |
| 13:41 | noonian | jtackett: you will need to have some javascript code execute from the browser in order to talk to your handler and ask if the process is done, or the server will have to tell the browser the process is done using something like websockets |
| 13:41 | dgrnbrg | amalloy: I think that Beauty in the most compelling thing right no |
| 13:41 | dgrnbrg | now |
| 13:41 | amalloy | dgrnbrg: then say that! i have to read the source to figure out how i would write anything with async-ring, aside from wrapping existing apps, which presumably doesn't buy me as much as drinking the kool-aid and writing async-style |
| 13:43 | jtackett | alright |
| 13:43 | jtackett | looks like i need to bite the bullet and learn clojure script |
| 13:43 | jtackett | shit.... |
| 13:43 | amalloy | anyway, i'm not really a prospective user, so feel free to ignore my advice: i was just providing feedback since you linked to your project |
| 13:44 | dbasch | jtackett: you don’t *need* to learn clojurescript, but you do need to think of the client side of your application and figure something out |
| 13:44 | gfredericks | amalloy: didn't he just ask for a name? In which case obviously ##(format "lib-%04d" (rand-int 10000)) |
| 13:44 | lazybot | ⇒ "lib-8127" |
| 13:45 | jtackett | alright dbasch: will do |
| 13:45 | jtackett | thank you guys for all the help |
| 13:45 | jtackett | I’ll be back |
| 13:45 | justin_smith | gfredericks: well, it worked for wd-40 and 409 |
| 13:45 | justin_smith | maybe the key is you need to have 40 as a substring |
| 13:46 | milos_cohagen | Y'all think it makes sense to keep hacking on this netty+core.async project I created? https://github.com/marsmining/nettyca |
| 13:46 | amalloy | gfredericks: he did, but i'm obstreperous and treat linked-to readmes as solicitations for any advice |
| 13:47 | milos_cohagen | Would be interested in if I'm just barking up the wrong tree |
| 13:48 | dgrnbrg | amalloy: I just rewrote the first few features—would you take a look? |
| 13:48 | Rhainur | jtackett: I need to point this out and everyone else will agree, if you don't know JS at all, learn that first before you learn clojurescript |
| 13:49 | Rhainur | you will really struggle to debug things if you don't understand JS |
| 13:49 | jtackett | got ya |
| 13:49 | jtackett | thank you |
| 13:49 | jtackett | i first learned java and then clojure |
| 13:49 | jtackett | similar concept |
| 13:49 | hiredman | reiddraper: I've noticed in my (small) usage of test.check I tend to end up writing a little interpreter and have test.check generate programs for that interpreter, and then have a little function that checks each step of the execution |
| 13:50 | hiredman | reiddraper: is that kind of thing common? |
| 13:50 | reiddraper | hiredman: maybe not 'common', but a great idea i think |
| 13:50 | amalloy | hiredman: that's what i did |
| 13:51 | amalloy | in my (one) usage of t.c |
| 13:51 | reiddraper | i've succesfully used that technique several times |
| 13:51 | amalloy | dgrnbrg: it looks more interesting to me now, yes. i don't think you should capitalize "Core.async", though, even at the beginning of a sentence/title |
| 13:51 | hiredman | so I am not entirely out to lunch with this, which is good to know |
| 13:52 | dgrnbrg | amalloy: I’ll change that |
| 13:52 | dgrnbrg | amalloy: any ideas for a better name? |
| 13:53 | dgrnbrg | what do you think of “Rasync HTTP” |
| 13:54 | amalloy | (rand-nth (line-seq (clojure.java.io/reader "/usr/share/dict/words"))) ;; => "ricing" |
| 13:54 | amalloy | as good a strategy as any |
| 13:54 | dbasch | amalloy: sic-granny |
| 13:54 | amalloy | wat |
| 13:54 | amalloy | that word is not in my dictionary |
| 13:55 | TimMc | anagram |
| 13:55 | dbasch | (anagram-generator “async ring”) |
| 13:55 | milos_cohagen | > as good a strategy as any |
| 13:55 | milos_cohagen | oops! wierd drag / copy / paste. 'scuse me |
| 13:57 | amalloy | dgrnbrg: i think you kinda get three choices: (1) a bland, descriptive name like async-ring; (2) a dictionary word, which you can choose at random or think about for a long time to find something punny; (3) ##(format "lib-%04d" (rand-int 10000)) |
| 13:57 | lazybot | ⇒ "lib-5842" |
| 13:57 | dgrnbrg | oi |
| 13:57 | TimMc | Dictionary word or in my case, taxonomic name of some organism. |
| 13:57 | amalloy | which one of those appeals to you is a matter of personal taste |
| 13:57 | TimMc | dgrnbrg: torus |
| 13:57 | technomancy | if you're working with ring, the obvious choice is a Wagnerian name |
| 13:58 | technomancy | come on you guys |
| 13:58 | amalloy | you could name it after a famous character from literature, but that's technomancy's thing |
| 13:58 | dgrnbrg | TimMc: that is amazing |
| 13:58 | technomancy | do I have to spell everything out for you |
| 13:58 | TimMc | Where does ring's name come from? |
| 13:58 | dgrnbrg | I’m leaning heavily towards Torus, unless there’s a ring-like character in Flatland |
| 13:58 | amalloy | TimMc: actually someone asked that in here just a week or two ago, and there might have been a plausible answer but i don't remember |
| 13:58 | technomancy | TimMc: the request/response cycle -> the ring cycle -> https://en.wikipedia.org/wiki/Der_Ring_des_Nibelungen |
| 13:59 | TimMc | really |
| 13:59 | TEttinger | dgrnbrg: maru is taken, but it's circle in japanese |
| 13:59 | amalloy | i remember mdeboard being involved in the discussion |
| 13:59 | TEttinger | also, Maru is the best cat. |
| 14:00 | TEttinger | http://imgur.com/gallery/vOZ3t |
| 14:00 | justin_smith | TEttinger: maru would be a good name for a library that gratuitously boxes data |
| 14:00 | dgrnbrg | perhaps Kol’tso, which is ring in russian |
| 14:00 | TEttinger | http://www.piumarta.com/software/maru/ |
| 14:01 | TimMc | (ring -> torus -> taurus (bull) -> goats) + (http -> web) = spidergoat |
| 14:01 | TEttinger | (inc justin_smith) |
| 14:01 | lazybot | ⇒ 76 |
| 14:01 | gfredericks | TimMc: waddabout async? |
| 14:01 | dgrnbrg | Actually, Nibelung is a pretty nice name—it’s a “cycle” that’s a “ring" |
| 14:01 | gfredericks | async -> sink -> plumber? |
| 14:01 | amalloy | [13:42:30] mdeboard: sdegutis: It is an homage to the black plague that rampaged through Europe in the dark ages. its hallmark was a rosey, ring-shaped rash. |
| 14:01 | amalloy | [13:43:16] mdeboard: Rich Hickey lost many close friends & relatives in the Black Death and so he vowed that his programming language would have a network adapter library to stand as eternal testament to their memory |
| 14:01 | amalloy | [13:43:34] mdeboard: And now you know... the rest of the story. |
| 14:01 | TEttinger | luigi |
| 14:01 | TimMc | gfredericks: You think a spidergoat can't handle async? |
| 14:02 | amalloy | so no, i guess not a plausible answer |
| 14:02 | gfredericks | TimMc: I think the name applies just as well to ring itself |
| 14:02 | dgrnbrg | and a cycle is like the async state machine |
| 14:02 | TimMc | ssshhhh |
| 14:02 | hiredman | taurine (an incredient in many energy drinks) comes from taurus because it was first isolated in the bile of bulls |
| 14:02 | TEttinger | Oroboros is probably taken |
| 14:02 | hiredman | (favorite energy drink/taurus related fact) |
| 14:03 | TimMc | incredient, is that an ingerdient I am incredulous about? |
| 14:03 | TEttinger | hoop maybe? |
| 14:03 | amalloy | TimMc: "ingerdient" makes your sarcastic correction less credible |
| 14:03 | TimMc | Nothing like a good ol' timey naming party. |
| 14:03 | TEttinger | ballmer, since he's loopy |
| 14:03 | dgrnbrg | TEttinger: I don’t think oroboros is taken |
| 14:03 | TimMc | amalloy: Ha! Muphry's Law strikes again. |
| 14:03 | milos_cohagen | lol @ all these naming shenanigans |
| 14:03 | hiredman | TimMc: well you would have to be incredulous about something with a misspelling like that |
| 14:03 | justin_smith | speaking of goats http://www.goat-simulator.com/ |
| 14:04 | amalloy | milos_cohagen: naming stuff is one of the two hard things in computer science |
| 14:04 | TimMc | amalloy: Not really a correction -- I think a word with that definition should exist. :-) |
| 14:04 | TEttinger | amalloy, the other being dealing with users/clients? |
| 14:04 | amalloy | TEttinger: caching and off-by-one errors |
| 14:04 | mikerod | cider is not displaying anything I print to *out* |
| 14:05 | justin_smith | the two hard cs problems: naming, caching, off by one errors |
| 14:05 | mikerod | is it doing something here |
| 14:05 | TEttinger | hahaha |
| 14:05 | TimMc | TEttinger: And if this were in-person, I would have yelled "concurrency" while amalloy was talking. |
| 14:05 | amalloy | hah |
| 14:05 | TEttinger | ha! |
| 14:05 | justin_smith | lol |
| 14:05 | TEttinger | (inc TimMc) |
| 14:05 | lazybot | ⇒ 67 |
| 14:05 | TimMc | but that would make it an off-by-two error |
| 14:05 | TEttinger | (inc amalloy) |
| 14:05 | lazybot | ⇒ 166 |
| 14:06 | amalloy | TimMc: i left the joke half-finished on purpose, so someone else could fill it in if they wanted, but then TEttinger asked me specifically, so i had to finish it myself |
| 14:06 | TEttinger | damn that's a lot of karma |
| 14:06 | amalloy | (inc TimMc) |
| 14:06 | lazybot | ⇒ 68 |
| 14:06 | amalloy | i like the concurrency addendum |
| 14:06 | justin_smith | interrjectum? |
| 14:06 | milos_cohagen | amalloy: speaking of naming things this cracked me up recently https://twitter.com/SlexAxton/status/507748452349251584 |
| 14:06 | justin_smith | yes, it is excellent |
| 14:07 | TimMc | dgrnbrg: knot |
| 14:07 | Bronsa | (inc TimMc) |
| 14:07 | lazybot | ⇒ 69 |
| 14:09 | TimMc | dgrnbrg: Oribtal? http://www.gideonweisz.com/album/orbitals/index.html?p=6 |
| 14:09 | TimMc | *orbital, ugh |
| 14:09 | dgrnbrg | I think that the winner has come in through the backchannel: Spirl - A Ring that doesn’t block |
| 14:10 | dgrnbrg | Spiral* |
| 14:10 | gfredericks | clojurebot: spirl is a rng that doesn't blck |
| 14:10 | clojurebot | c'est bon! |
| 14:16 | TEttinger | Bearhug would be Ring that blocks even more |
| 14:16 | TEttinger | or alternately Octagon |
| 14:17 | nullptr | orbit, saturn, hula .... |
| 15:01 | arohner | I have the strangest bug. My app works just fine if I 'lein run', but I get Caused by: java.lang.NoClassDefFoundError: com/stuartsierra/component/Lifecycle if I 'lein repl' then (require 'foo.main) |
| 15:03 | je | how come this: (map Integer. ["2" "5"]) throws "ClassNotFoundException: java.lang.Integer." when this (Integer. "2") gives me 2 ? |
| 15:03 | arohner | je Integer. isn't a function |
| 15:03 | arohner | ,(map #(Integer. %) ["2" "5"]) |
| 15:03 | clojurebot | (2 5) |
| 15:04 | je | arohner: thanks makes sense :) |
| 15:04 | arohner | java interop uses special forms, so you have to wrap in fns to make map, etc work |
| 15:04 | dogonthehorizon | arohner: Is the constructor not considered a function in this context? |
| 15:05 | arohner | dogonthehorizon: when I say "isn't a fn", I mean "doesn't inherit from clojure.lang.IFn" |
| 15:05 | arohner | so by that definition, Integer. is never a fn |
| 15:05 | arohner | it's a special form |
| 15:05 | dogonthehorizon | Ah, that makes sense. Thanks! |
| 15:09 | amalloy | it's funny that Integer. is the example that *everyone* uses when asking this question. i don't quite know why |
| 15:10 | DaReaper5 | Hey, I have a question: How do I get a value from a vector when I do not know the index AND the vector is a set of maps? |
| 15:10 | DaReaper5 | I was thinking a for with a :when. But I am not sure about the return. |
| 15:11 | Fare | what do you nkow? |
| 15:12 | DaReaper5 | with a traditional language I would have a for loop, have an if, and when found use a break; |
| 15:13 | amalloy | like, someone asked http://stackoverflow.com/questions/25632613/cant-map-integer?lq=1 just a week ago: Integer. again |
| 15:13 | dbasch | DaReaper5: if you need to get a value and you don’t know the index, why is it a vector? |
| 15:13 | DaReaper5 | i dont want to use a loop (that uses recur) but it might be the only option i see |
| 15:13 | DaReaper5 | dbasch: due to data structure requirements |
| 15:14 | dogonthehorizon | (map String. ["why" "doesn't" "this" "work" "amalloy?"]) |
| 15:14 | amalloy | DaReaper5: in general if you want the first item of a collection that satisfies a predicate, that's pretty easy to do in a number of ways, although you should usually consider a better data structure that doesn't require this looping |
| 15:15 | amalloy | (first (filter what-i-want? thingies)) |
| 15:15 | DaReaper5 | amalloy: i agree,and thanks for the example. That is better than "loop" :) |
| 15:16 | dbasch | &(map str ["but" "this" "does" "dogonthehorizon"]) |
| 15:16 | lazybot | ⇒ ("but" "this" "does" "dogonthehorizon") |
| 15:16 | amalloy | by the way. DaReaper5's suggestion of using a for-loop with a break reminds me of some pretty absurd code with a similar structure in the example code for kafka: check out "findNewLeader" in https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example, in particular the if/else flow around goToSleep and return |
| 15:17 | rickhall2000 | llasram: you around? |
| 15:17 | dogonthehorizon | dbasch: It was tongue-in-cheek to amalloy's question of why everyone users Integer. as an example of a Java constructor not working in map |
| 15:19 | milos_cohagen | Hey all, for learning purposes I wrote a small library of netty and core.async interop code. Do you think it might be useful to pursue further, or have any suggestions in general? https://github.com/marsmining/nettyca |
| 15:32 | dagda1 | if I have an infinite range, what the hell is (drop 10 (range)) taking as its end? |
| 15:32 | AimHere | it doesn't. |
| 15:32 | ToxicFrog | dagda1: it's not? It drops the first 10 elements of range and returns the rest. |
| 15:32 | dagda1 | AimHere: so it just spins |
| 15:32 | AimHere | The trick to laziness is that you never ever ask what the end of (range) is |
| 15:33 | AimHere | dagda1, only if you evaluate it |
| 15:33 | ToxicFrog | It doesn't need to know what the end of range is to discard the first ten elements from it. |
| 15:34 | ToxicFrog | ,(take 10 (drop 10 (range))) |
| 15:34 | clojurebot | (10 11 12 13 14 ...) |
| 15:35 | dagda1 | I'm trying to get my head round Lazyness, so if I have (take 5 (expensive-function)) how does lazyness work in this scenario |
| 15:35 | dagda1 | a lazy seq's next element is a function and not an actual element |
| 15:35 | AimHere | Well a lazy function is just a data structure that waits until you ask it for a value to give it |
| 15:35 | AimHere | *lazy sequence |
| 15:36 | AimHere | dagda1, there's a good treatment on Laziness in SICP if you're okay with learning a little light scheme |
| 15:37 | dagda1 | AimHere: what is SICP, structure and interpetation of computer programs? |
| 15:38 | AimHere | Yeah |
| 15:38 | J_Arcane | Laziness is fun. |
| 15:39 | mdrogalis | Sick-P. |
| 15:46 | irctc | I'm looking a working example of core.logic in ClojureScript |
| 15:47 | irctc | anybody knows where I can find this? |
| 15:55 | dnolen_ | irctc: in the core.logic repo there are tests/examples |
| 16:14 | arohner | oh fun, I have datomic + leiningen bug |
| 16:14 | arohner | I have a bug that only appears when doing 'lein repl', but not 'lein run', and only when datomic is required before stuartsierra.component |
| 16:17 | xeqi | that would be a strange bug |
| 16:19 | arohner | xeqi: tell me about it. It's taken a few hours to run down |
| 16:19 | arohner | I think something in the middle is mucking with my classloader |
| 16:20 | arohner | changing the order of requires definitely fixes it though |
| 16:32 | J_Arcane | OK, the clojure koans on recursion have completely broken my brain. |
| 16:33 | noonian | the first step towards self-actualization |
| 16:34 | J_Arcane | like, I get recursion in general fine, I'm not *that* new to Lisp, it's the sample problem (solving for even recursively) that I think I am too tired to make sense of. |
| 16:37 | noonian | if its the one i'm thinking of, the key is in what happens to an even (or odd) number when you decrement it |
| 16:38 | J_Arcane | right. Of course. I need a not. |
| 16:39 | J_Arcane | (I should've read ahead to the bigint version) |
| 16:40 | noonian | then make it tail recursive :) |
| 16:40 | noonian | heh |
| 16:50 | amalloy | eh, if you make it tail-recursive you end up realizing you've just written a while loop |
| 16:51 | noonian | well, thats worth something right? |
| 16:56 | dbasch | recurvise even? is quite silly anyway |
| 16:56 | dbasch | recursive |
| 16:57 | amalloy | dbasch: it's an okay introduction to thinking recursively, even if it's a terrible algorithm |
| 16:58 | dbasch | amalloy: at least it could be pow-2? |
| 16:58 | amalloy | dbasch: why would that be better? |
| 16:59 | SagiCZ1 | is there a clojure way to list all available methods/fields on a java type< |
| 16:59 | SagiCZ1 | ? |
| 16:59 | dbasch | amalloy: at least the obvious solution is not constant time |
| 16:59 | amalloy | SagiCZ1: clojure.java.reflect/reflect |
| 16:59 | SagiCZ1 | amalloy: thank you |
| 16:59 | amalloy | or, and i'm sure this will be easier, just look at the javadocs |
| 17:00 | dagda1 | is cons the only function that can return a lazy sequence |
| 17:00 | SagiCZ1 | amalloy: okay then :( |
| 17:00 | amalloy | dagda1: cons is one function that cannot return a lazy sequence |
| 17:01 | amalloy | you were asking the other day about your stack overflow in a recursive lazy seq with conj, right? and we told you to use cons |
| 17:01 | amalloy | cons doesn't return a lazy seq (the thing that does that is called lazy-seq), but it is a good tool to use as *part* of building a lazy seq |
| 17:02 | dagda1 | amalloy: yes, I got it workign but I'm trying to get a better understanding of lazy now https://gist.github.com/dagda1/9f6a503a8e35cb8006aa |
| 17:02 | J_Arcane | Well. I guess I have now learned that Clojure is indeed multithreaded ... |
| 17:03 | amalloy | dagda1: looks like a reasonable implementation of reductions |
| 17:04 | dagda1 | amalloy: I'm trying to blog about lazyness now to make sure I understand this properly |
| 17:05 | dagda1 | amally: so there is no real connection between cons and lazyness |
| 17:08 | noprompt | dnolen_, bbloom: ping |
| 17:09 | dnolen_ | noprompt: pong |
| 17:09 | noprompt | dnolen_: small question about resolving symbols with ana/resolve-var |
| 17:09 | gfredericks | dagda1: cons is compatible with laziness in that the second arg can be a lazy seq, and cons will not force it |
| 17:09 | amalloy | dagda1: your irc client will tab-complete usernames, so you don't have to spell them wrong |
| 17:09 | gfredericks | ,(take 3 (cons :haha (range))) |
| 17:09 | dnolen_ | noprompt: what's up? |
| 17:09 | clojurebot | (:haha 0 1) |
| 17:10 | noprompt | dnolen_: why does (resolve-var &env 'reify) return user/reify (assuming i'm in the user ns)? |
| 17:10 | dagda1 | amalloy: I am guilty of not using the autocomplete |
| 17:10 | noprompt | dnolen_: well, actually it returns {:ns user, :name user/reify} |
| 17:10 | dnolen_ | noprompt: resolve var always returns fully qualified symbols |
| 17:11 | amalloy | dnolen_: i'm no expert here, but why wouldn't it return clojure.core/reify? |
| 17:11 | dagda1 | gfredericks: so what gets returned is a structure that behaves like a sequence |
| 17:11 | noprompt | dnolen_: but in this case, user/reify would be incorrect. i guess the deeper question would be how could i get it to correctly resolve to clojure.core/reify? |
| 17:12 | dagda1 | gfredericks: a bit like an iterator in java |
| 17:12 | dnolen_ | noprompt: amalloy: oh hrm right |
| 17:12 | amalloy | dagda1: yes, a bit |
| 17:13 | noprompt | dnolen_: i'm sure there's a reason for having symbols that don't exist to resolve like that but i'm some what at a loss for why. for example, (ana/resolve-var &env 'lol) does this same thing even if lol does not exist in the ns. |
| 17:13 | amalloy | noprompt: well, backquote does the same thing |
| 17:13 | amalloy | ,`lol |
| 17:13 | clojurebot | sandbox/lol |
| 17:14 | dnolen_ | noprompt: yeah that's probably wrong but I guess most people haven't noticed since you can't use resolve-var really outside of macros |
| 17:14 | thesaskwatch | Hi .. I have a question about protocols. Why there are supposedly better than adapter pattern in oo? Let's say I have some external not modifiable object. I can wrap it with an adapter object which will have interface I like. Aren't protocols the same? Maybe with added benefit of not having to implement all interface methods. |
| 17:15 | noprompt | dnolen_: that's ok. what should the correct behavior be? |
| 17:15 | dnolen_ | noprompt: I suppose unqualified core symbols should probably resolve to core - it's a special case |
| 17:16 | dnolen_ | noprompt: as far as the 'lol case you need to use resolve-existing-var |
| 17:16 | dnolen_ | noprompt: resolve-var, resolve-existing-var are both a bit strange as they were designed to serve the analyzer/compiler |
| 17:17 | amalloy | thesaskwatch: that doesn't sound like protocols at all |
| 17:17 | noprompt | dnolen_: not necessarily. suppose `(:refer-clojure :exclude [reify]) (:require-macros [schema.macros :refer [reify]])` resolving reify in that ns should resolve to schema.macros/reify, no? |
| 17:17 | amalloy | a protocol is, if you like, just an interface with the additional feature that you can add implementations for it to already-existing classes |
| 17:17 | noprompt | dnolen_: or is this simply beyond the scope of resolution for purposes of the analyzer? |
| 17:17 | thesaskwatch | amalloy: I can do the same with adapter to new interface |
| 17:17 | dnolen_ | noprompt: yes but those kinds of cases should be handled if your analysis environment has that information |
| 17:18 | dnolen_ | not env arg |
| 17:18 | dnolen_ | but cljs.env/*compiler* dyn var |
| 17:18 | amalloy | thesaskwatch: no, you can't. say you want an interface like Printable, which should have an implementation for String. you can create a PrintableString wrapper, which works fine for the Printable interface, but you can't give that to other code and have it act like a string |
| 17:19 | noprompt | dnolen_: ok i can work with that. |
| 17:19 | amalloy | ie, instead of a string which is also printable, you end up with an opaque box which is printable but nothing else |
| 17:20 | thesaskwatch | amalloy: true .. string is a special case as it's final. But for extensible types it could be done. |
| 17:20 | noprompt | dnolen_: ugh, i'm just trying to make this tracing library accurate. |
| 17:20 | amalloy | thesaskwatch: the point is that you don't have to touch the classes you want to create implementations for. it's just a dispatch mechanism |
| 17:20 | dnolen_ | noprompt: I take it you're trying to use the analyzer to do this? |
| 17:21 | noprompt | dnolen_: yes. for thing like protocols, i need it. |
| 17:21 | noprompt | dnolen_: i need to be able to see om.core/IRender and not o/IRender, etc. |
| 17:22 | thesaskwatch | amalloy: ok, I'm starting to understand .. thank you |
| 17:22 | dnolen_ | noprompt: right, I think there's probably a bug around that too at the moment - would love to see it get fixed up |
| 17:22 | noonian | thesaskwatch: imagine a library where all the api functions return a type Foo, and you want to release a library that allows Foos to do something. in clojure with protocols someone could include your library and the Foo library and all would be good, with adapters youd have to wrap each api fn or create an abstraction for wrapping the return values from that library |
| 17:22 | noonian | aside from the issues with extending protocols and types you dont own |
| 17:23 | noprompt | dnolen_: i could take a stab at it. i've been playing with that ns a lot more. |
| 17:23 | thesaskwatch | noonian: in addition wrapper and the thing it wraps is not the same thing, and in case of protocol it's always the original value, right? |
| 17:23 | noprompt | dnolen_: just need to know what the correct behaviour should be. |
| 17:23 | dnolen_ | noprompt: you should always get back fully qualified names - no aliases |
| 17:23 | dnolen_ | om/IRender -> {:ns 'om.core :name om.core/IRender} |
| 17:23 | noonian | thesaskwatch: right, so you could make a protocol and implement it for Foo's and I could make a different protocol and extend it to Foos and now a Foo would support both of our protocols without our code knowing about each other |
| 17:24 | thesaskwatch | noonian: ok, it makes sense |
| 17:24 | dnolen_ | noprompt: the only special case for unqualified things is core |
| 17:24 | dnolen_ | noprompt: though the last clause in resolve-var should have caught reify |
| 17:25 | J_Arcane | Ow. Well, that wasn't fun. |
| 17:25 | noprompt | dnolen_: so it should resolve macro symbols properly? |
| 17:25 | dnolen_ | noprompt: yeah, I think that's what's broken - not handling macros |
| 17:25 | noprompt | dnolen_: which is why it's just falling through to the default case and returning {:ns user :name user/reify}? |
| 17:26 | dnolen_ | noprompt: well part of the issue is that resolve-var generally doesn't get called until after macroexpansion |
| 17:27 | dnolen_ | since macros aren't defined in ClojureScript there are no corresponding entries in the compilation environment |
| 17:30 | dnolen_ | noprompt: definitely something to fix in parse 'ns - :refer should popluate :defs |
| 17:31 | noprompt | dnolen_: this oughta be a fun one. |
| 17:31 | dnolen_ | noprompt: separate actionable tickets :) |
| 17:31 | noprompt | dnolen_: sure thing. |
| 17:31 | dnolen_ | noprompt: by which I just mean, no need to come up w/ a monster patch |
| 17:32 | dnolen_ | noprompt: there's small clean fixes to submit here |
| 17:32 | noprompt | dnolen_: tbaldridge has given me similar guidance on better errors in clojure.core |
| 17:34 | noprompt | dnolen_: is the :rename {foo bar} still something that'd we'd wanna add too? i've been pining to get that in. |
| 17:34 | dnolen_ | noprompt: sounds reasonable to me |
| 17:34 | dnolen_ | noprompt: never use that in Clojure myself |
| 17:35 | dnolen_ | but I can see why people want it |
| 17:35 | noprompt | dnolen_: i use on occasion. primarily this would be for consistency, unless there's a plan to deprecate that down the way. |
| 17:36 | amalloy | i used :rename recently, actually. i can't remember why at the moment |
| 17:37 | amalloy | (:require [hiccup.util :refer [escape-html] :rename {escape-html escape}]). apparently i just felt escape-html was a bad name. i'm not really going to hold this one up as a paragon of brilliance |
| 17:40 | noprompt | dnolen_: this tracing lib, aside from the yak shaving and bugs, is pretty awesome. for 90% of the println use cases, this eliminates them. |
| 17:40 | J_Arcane | welp. Seeing as how I just managed to force a system reboot with that last function, I think it's time I call it a night. :P |
| 17:41 | amalloy | J_Arcane: did you just fork-bomb yourself for fun? |
| 17:41 | dnolen_ | noprompt: it looks really neat from the images - looking forward to hearing more about it |
| 17:41 | dnolen_ | noprompt: you're probably pretty far along by now but also this seems like a good use case for tools.analyzer.js as well |
| 17:42 | J_Arcane | amalloy: Apparently I don't yet understand how to safely make a list-eater in Clojure. My solution to the recursive-reverse koan caused a run-away process instead ... |
| 17:42 | noprompt | dnolen_: general concept => https://github.com/spellhouse/clairvoyant#design |
| 17:42 | noprompt | dnolen_: i don't mind looking into the tools.analyzer.js lib. i was thinking about it this morning, in fact. |
| 17:43 | noprompt | dnolen_: any suggestions design ideas would be helpful. the main goal is to separate transformation of source code and what to do with trace data. |
| 17:45 | Bronsa | noprompt: using tools.analyzer.js for doing code transformations might have some rough cases around protocols/deftypes |
| 17:45 | thesaskwatch | Another question. Is it possible to add additional methods in defrecord beyond interfaces/protocols it implements? |
| 17:45 | thesaskwatch | (and if possible to make them private) ? |
| 17:46 | dnolen_ | noprompt: that sounds like a sound goal to me. |
| 17:46 | justin_smith | thesaskwatch: if they are private, why put them on the record? why not a function private to that ns that acts on that record type? |
| 17:47 | thesaskwatch | justin_smith: I don't see anything against it .. but was just wondering if some kind of encapsulation is possible |
| 17:48 | Bronsa | dnolen_: would you take a patch to change the deftype*/defrecord* special forms signature to take an additional body containing the inline-methods impl? the cljs analyzer uses an ugly hack to handle the deftype closed overs that I cannot use in t.a.js |
| 17:49 | Bronsa | what I'd like is to make deftype macroexpand into (deftype* type [args] (do inline-methods-impls)) rather than (do (deftype* type [args]) (do inline-methods-impls)) |
| 17:50 | justin_smith | thesaskwatch: For the deepest level of encapsulation, you can create an anonymous function local to some other scope, and not expose it outside that scope. All you need for this is a let binding or an argument to a function. For something a little more visible you can create functions that are private to an ns. |
| 17:50 | thesaskwatch | justin_smith: ok, I know this way, it's how one does it in javascript |
| 17:50 | thesaskwatch | justin_smith: was just wondering if it's clojure idiomatic |
| 17:50 | noprompt | Bronsa: would the analyzer tools help me do tricky stuff like this? https://github.com/spellhouse/clairvoyant/blob/master/src/clairvoyant/core.clj#L213-L220 |
| 17:51 | justin_smith | thesaskwatch: information hiding is not very idiomatic - with immutibility, it is often not needed |
| 17:51 | noprompt | Bronsa: tl;dr it's rewriting the function so i can see the inputs to the function when a precondition fails. |
| 17:51 | TimMc | Huh, I just saw (pst) drop the top-most exception, leaving a pretty inscrutable error message: https://gist.github.com/timmc/77dd67b6b4af7ab4afb7 |
| 17:52 | thesaskwatch | justin_smith: unfortunately not all code can be pure, with i/o it's becoming more complex |
| 17:52 | TimMc | Can anyone explain this behavior? |
| 17:52 | justin_smith | thesaskwatch: if someone calls a helper function from my ns, they may see their code break because it isn't meant to be used that way, but they cannot break my code, because nothing in my ns is mutible enough for their access to be able to break it |
| 17:52 | justin_smith | i/o has nothing to do with this |
| 17:53 | justin_smith | and i/o effects should not be exposed on an ns level - it should be local to some inner block |
| 17:53 | hiredman | TimMc: check the class of *e |
| 17:54 | hiredman | TimMc: likely it is some rx exception that does something on .printStackTrace that it doesn't do on getCause |
| 17:55 | thesaskwatch | justin_smith: ok, let's say I have irc client. It uses socket connection and data reader/writer. How would you encapsulate this using a set of pure functions? |
| 17:57 | justin_smith | thesaskwatch: the socket connection and reader/writer would be arguments passed in. They belong to the client / end user, not the library. |
| 17:57 | justin_smith | you provide a factory type function that initializes a connection, and then they pass that back to the relevant code |
| 17:57 | Bronsa | noprompt: ATM it won't work for extend-type/extend-protocol -- that's something that I will address in the next beta but I'll have time to do it only next week |
| 17:58 | justin_smith | nothing needs to be private, or even bound globally - just make sure it belongs to the right entity |
| 17:58 | Bronsa | noprompt: the issue is interaction between the runtime namespaces of t.a.js & cljs.analyzer, there's a cljs-env->env but not the other way around |
| 17:59 | thesaskwatch | justin_smith: but what I want the library to do is to manage those objects - to read and write messages, to close and reopen it when connection breaks, to notify about errors |
| 17:59 | thesaskwatch | justin_smith: I don't want to do that outside of the library .. that's what this library is supposed to do |
| 18:00 | amalloy | TimMc: or even just check (.getCause *e), and see if it returns something |
| 18:01 | amalloy | i don't actually use pst, but it seems like it's attempting to find the "root cause" exception and just print that, instead of printing the actual exception in *e |
| 18:03 | amalloy | TimMc: i suspect if you wrote instead (pst *e) you would get something a bit more palatable, and if you wrote (pst *e 1000) you would get the whole thing |
| 18:04 | justin_smith | thesaskwatch: you mentioned methods before. The only reason to hide the methods is if they are hard-coded to mutate a specific object. There can be good reason to isolate a state that you abstract over, but unless you are doing it wrong, there is little reason to hide the functions. |
| 18:06 | TimMc | amalloy: Wait, why would (pst) and (pst *e) be different? I thought that was just a shortcut. :-( |
| 18:06 | amalloy | TimMc: having just read the source of pst, the default behavior strikes me as reprehensible: find the innermost wrapped exception, and print the first 12 lines of its stacktrace, removing those that are obviously just noise from the clojure runtime |
| 18:06 | TimMc | Root cause it is. Ugh. |
| 18:06 | noprompt | Bronsa: yeah, i had to do some janky stuff to get extend-protocol to work with the same code i used for reify, extend-protocol, etc. |
| 18:06 | thesaskwatch | justin_smith: yes, I get that. However a different problem is that I need to manage some mutable references - readers and writers. I'd like to hide this from api users. That's why I was asking about encapsulation. |
| 18:07 | thesaskwatch | justin_smith: and the answer with closure variables seems like a solution |
| 18:07 | TimMc | hiredman: *e is just a java.lang.IllegalArgumentException. amalloy got it -- pst uses root cause for no apparent reason. |
| 18:07 | amalloy | TimMc: apparent reason: "to be friendly-looking" |
| 18:08 | amalloy | everyone complains about the "huge" "useless" stacktraces you get from java |
| 18:08 | amalloy | pst gets the right answer a lot of the time, and looks friendly to beginners; i wouldn't advocate experts using it |
| 18:09 | nullptr | http://imgur.com/jacoj |
| 18:11 | TimMc | The problem is that it (or something like it) is used to print the exception at the REPL. |
| 18:11 | TimMc | like (pst 0) or similar |
| 18:14 | dnolen_ | Bronsa: come up w/ a patch and I will take a look at it |
| 18:15 | amalloy | TimMc: use swank; problem solved? |
| 18:17 | amalloy | anyway, what repl is this? does lein repl really use pst? i thought it just printed (.getMessage *e) or something, and you have to use pst or getStackTrace yourself for details |
| 18:17 | Bronsa | dnolen_: ok |
| 18:24 | technomancy | Problem: Clojure stack traces are useless and terrible. Solution: don't print them. |
| 18:24 | technomancy | next! |
| 18:25 | noprompt | technomancy: are you trying to get my attention? :P |
| 18:26 | justin_smith | thesaskwatch: for your consideration: if you give the client a handle representing a connection, then some functions that act on said connection, you don't need to worry about how those details are stored in your lib, and your client can have as many connections as they like without having to jump through any weird hoops. |
| 18:27 | thesaskwatch | justin_smith: yes, it makes perfect sense |
| 18:27 | talios | technomancy - one of my pet hates is the compiler prints them, rather than just displaying the message - that change alone would make a lot of clojure tooling nicer to deal with. |
| 18:27 | talios | Mind you - that may have changed - been so long since I've actually done any clojure. |
| 18:28 | technomancy | talios: yeah, I'm sure all my jokes are way out of date given that the only clojure I write is on lein. |
| 18:28 | talios | technomancy - yeh? whats your main language of the day then these days? |
| 18:29 | technomancy | talios: erlang at work, C and Forth on microcontrollers for fun. |
| 18:29 | talios | forth! you old schooler |
| 18:29 | TimMc | amalloy: Yeah, lein repl. I think I would prefer .getMeessage. |
| 18:29 | xemdetia | .getMassage |
| 18:30 | TimMc | The real problem here is that pst is nice and short to type... :-P |
| 18:30 | TimMc | xemdetia: That too. |
| 18:30 | amalloy | TimMc: when i write (/ 100 0) in lein repl, i see just the one-line message |
| 18:30 | technomancy | talios: to escape the tedium of C |
| 18:30 | TimMc | same here |
| 18:30 | talios | technomancy - isn't that what Go is for? |
| 18:30 | technomancy | talios: bahahah |
| 18:30 | xemdetia | Go doesn't embed nicely |
| 18:30 | amalloy | so, sounds like the behavior you said you would prefer |
| 18:30 | xemdetia | as far as I've found out |
| 18:32 | TimMc | amalloy: Except in the case of this rx exception, the root cause is bring printed instead of the outermost one. |
| 18:32 | amalloy | oh, i see |
| 18:32 | TimMc | (Exception. "outer" (Exception. "inner")) doesn't replicate this... |
| 18:32 | amalloy | TimMc: i would guess that the async/whatever nature of rx causes the exceptions to be built in a weird order |
| 18:33 | TimMc | oh hmm |
| 18:34 | technomancy | talios: the only reason I'd use a language with as primitive of a type system, bad error system, and missing interactive development system is to do work on a microcontroller, but Google Go doesn't even support that. |
| 18:34 | TimMc | You're right, that inner exception *should* be the outer one. Shenenigans somewhere around here. |
| 18:34 | amalloy | because that stacktrace is upside-down compared to what we're used to, with what i'd expect to be the root cause (your attempt to call .map wrong) is allegedly caused by some other problem |
| 18:34 | danielcompton | technomancy: javascript's got you covered there |
| 18:35 | talios | danielcompton - js on a micro? |
| 18:36 | danielcompton | talios: yep, along with primitive type system and bad error system |
| 18:36 | talios | danielcompton - excellent! |
| 18:36 | technomancy | at least js has a repl |
| 18:39 | danielcompton | technomancy: yeah, that is a + |
| 18:39 | technomancy | not that I would use it by choice in any case |
| 18:40 | talios | danielcompton - stop currying your sentences, unless you want nann with that. |
| 18:40 | talios | oh wait - thats not an expression. wheres your ; damnit,. |
| 18:40 | talios | darn symbol heavy languages |
| 18:41 | justin_smith | technomancy: hell, even forth has an interactive mode |
| 18:41 | TimMc | Yet again I have found myself wishing for M-x paredit-reverse sexp |
| 18:41 | technomancy | justin_smith: that's exactly why I'm using it =) |
| 18:41 | TimMc | *paredit-reverse-sexp |
| 18:41 | technomancy | noninteractive development is the worst |
| 18:42 | amalloy | TimMc: whaaaaaat. like, you wrote (ys xs f map) accidentally? |
| 18:42 | TimMc | amalloy: -> |
| 18:42 | tadni_ | technomancy: Don't most work wish non-interactive dev? |
| 18:42 | xemdetia | RPN-clojure-mode |
| 18:43 | TimMc | although you'd also need some unnesting functions as well to turn (baz (bar (foo))) into (-> (foo) (bar) (baz)) |
| 18:44 | amalloy | yeah, that's not really reverse-sexp at all anymore. someone wrote arrowize-sexp some time ago |
| 18:45 | TimMc | And let's be fair, any time I want to reverse a sexp it's because I really want to invert the -> transform. :-) |
| 18:47 | TimMc | technomancy: Tell me of this refactorer for emacs... |
| 18:48 | technomancy | TimMc: it's called concatenative programming |
| 18:48 | TimMc | *squints skeptically* |
| 18:49 | technomancy | I have no idea what you're talking about, so I made something up? |
| 18:49 | microamp | technomancy: just curious, still digging ocaml? |
| 18:50 | TimMc | technomancy: http://logs.lazybot.org/irc.freenode.net/%23clojure/2011-10-03.txt grep arrowize |
| 18:50 | technomancy | microamp: I still like it, but I don't have any current projects that are a good fit for it |
| 18:50 | TimMc | This must be it: https://github.com/clojure-emacs/clj-refactor.el |
| 18:51 | microamp | technomancy: likely old news to some, but https://github.com/artagnon/rhine |
| 18:51 | technomancy | microamp: huh, interesting |
| 18:51 | mearnsh | that sounds neat |
| 18:51 | technomancy | I've seen a few attempts at clojure-on-llvm, but implementing in ocaml will undoubtedly give a good head start =) |
| 18:53 | hiredman | just looking at the rhine readme for a few moments reveals mistunderstandings of lexical scope |
| 18:53 | amalloy | TimMc: i've just discovered i can avoid having to back up my claims if i can imitate technomancy's style well enough to choose greppable words he would have used to say the same thing three years ago |
| 18:54 | TimMc | Naming consistency is fascinating. |
| 18:54 | TimMc | "What would I have called this file I wrote 5 years ago? Ah, there it is..." |
| 18:54 | xemdetia | I name all my projects based on TV shows I binge watch |
| 18:54 | xemdetia | I use my log of those shows to crossrefrence |
| 18:55 | amalloy | xemdetia: technomancy does a classier version of the same thing |
| 18:55 | xemdetia | sorry I am devoid of class |
| 18:55 | xemdetia | :( |
| 18:55 | technomancy | amalloy: I am actually not familiar with Wagner despite allusions otherwise. |
| 18:56 | amalloy | well, i meant your names from literature in general |
| 18:56 | technomancy | ah, yes |
| 18:56 | technomancy | I think of it more widely as fiction in general |
| 18:56 | amalloy | hiredman: wow, you're right. i was reading it and everything was making perfect sense, and then POW, what the heck is this dynamic scope |
| 18:57 | dorkmafia | how do you print to the console with clojure? |
| 18:58 | technomancy | I wonder if the reason no one paid attention to nrepl-discover is that I broke my theme of picking an interesting name. |
| 18:58 | hiredman | amalloy: I know, and you know what is wild, last I checked no one in the entire hackernews thread mentioned it |
| 18:59 | hiredman | amalloy: which is how I know it won't go anywhere, no one has actually looked it, just used saw lisp and fired back whatever their knee jerk lisp response is |
| 18:59 | hiredman | looked at it |
| 19:04 | dorkmafia | is there a console/log somewhere? |
| 19:05 | technomancy | dorkmafia: println |
| 19:07 | noonian | or js/console.log |
| 19:07 | turbofail | i certainly didn't look at rhine. even if it did use proper scope, it would take many years before it could even begin to approach the JVM clojure level of usefulness |
| 19:08 | amalloy | is it a bug or a feature that (js/console.log ...) works? i would expect (.log js/console ...) to be the thing you have to do |
| 19:09 | turbofail | also i'm just generally skeptical of LLVM stuff |
| 19:10 | technomancy | isn't LLVM a bit like ZeroMQ? |
| 19:10 | technomancy | "Not actually a (virtual machine|message queue) but attracts people who assume it is." |
| 19:11 | turbofail | yeah that seems rather apt |
| 19:11 | dorkmafia | ty technomancy |
| 19:11 | Bronsa | amalloy: according to dnolen_ it's expected behaviour |
| 19:12 | tbaldrid_ | technomancy: turbofail: it's really that LLVM uses VM in the literal sense of the word, not in the commonly used way. It really is a Virtual Machine, just a very low level one.. |
| 19:12 | justin_smith | technomancy: you could add mongodb as a db to that list |
| 19:13 | technomancy | justin_smith: hehe |
| 19:13 | mearnsh | technomancy: do you ship atreus outside the us |
| 19:13 | technomancy | mearnsh: yeah, I get a lot of international orders. shipping isn't free, but I'll just factor it in. |
| 19:13 | technomancy | "a lot" being relative of course =) |
| 19:13 | mearnsh | cool. neat project |
| 19:13 | technomancy | thanks |
| 19:15 | technomancy | mearnsh: I took down the option for fully-assembled boards in favour of emphasizing kits, but if you open up the web inspector you can un-invisiblize the "additional comments" section and request a fully-assembled board. |
| 19:16 | mearnsh | haha. kit's fine by me |
| 19:54 | dorkmafia | http://paste.debian.net/120125/ can someone give me some pointers on how to figure this out |
| 19:55 | hiredman | you are passing 2 args to send-message on line 83, it takes more than 2 |
| 19:55 | dorkmafia | it says I'm passing two args to the send-message function but I printed out the args and I only see one |
| 19:55 | dorkmafia | or rather in the code it looks correct |
| 19:55 | hiredman | the def for send-message there takes 4 arguments |
| 19:55 | dorkmafia | hiredman: do you see the println of the args though? |
| 19:56 | amalloy | dorkmafia: look at line 10 of your paste. you call send-message with two args |
| 19:56 | amalloy | conn, and (create-reply ...) |
| 20:01 | tadni_ | So, it appears cider-scratch doesn't jack into a cider repl ... you'd think it'd do so automatically. :^P |
| 20:01 | tadni_ | Not a big deal, but still a minor thing I'd think would be automated. |
| 20:01 | dorkmafia | amalloy doesn't it depend on what the output of (create-reply .. ) is? |
| 20:01 | amalloy | no |
| 20:01 | tadni_ | Well I guess a nrepl instance, not a "cider repl". :^P |
| 20:02 | amalloy | (create-reply ...) is exactly one object, no matter what. it can't be three objects. if you pass it, and one other object, to a function expecting four args, then you are passing only two args |
| 20:02 | dorkmafia | amalloy: https://github.com/dedeibel/xmpp-clj/blob/master/src/xmpp_clj/bot.clj#L70 this code works though all i did was upgrade the underlying jars |
| 20:03 | hiredman | dorkmafia: what makes you think it works? |
| 20:03 | amalloy | dorkmafia: the only way that code fails to throw an exception is if nobody runs it |
| 20:03 | hiredman | (that definitely doesn't) |
| 20:04 | dorkmafia | ok |
| 20:04 | dorkmafia | which means it's all horribly out of date |
| 20:04 | dorkmafia | thank you guys ;) |
| 20:04 | dorkmafia | :) |
| 20:05 | hiredman | that would never have worked on any version of clojure |
| 20:06 | dorkmafia | ah i upgraded the underlying smack jar |
| 20:06 | hiredman | that wouldn't change anything |
| 20:06 | hiredman | the clojure source code is plain incorrect |
| 20:06 | hiredman | has nothing to do with smack |
| 20:06 | amalloy | the xmpp code you linked to is not self-consistent. it can't run ever. i'm guessing it was in the middle of a rewrite that didn't get finished |
| 20:07 | dorkmafia | yah i'm rewriting it now to also have the latest smack jar |
| 20:07 | dorkmafia | i'm going to change the name instead of forking |
| 20:07 | dorkmafia | my working name for it so far is smackulre |
| 20:08 | amalloy | yeah, the last commit on that file, https://github.com/dedeibel/xmpp-clj/commit/d089da15cfa76d344752d748d93781646ea768e7, looks like it changed from working code to non-working code, and is labeled "cleanup" |
| 20:08 | dorkmafia | but it's my first time writing clojure so it's a bit rough |
| 20:16 | hiredman | xmpp as a protocol is pretty terrible, so that is going to be rough too |
| 20:17 | hiredman | streaming xml, not exchanging xml documents, but your entire interaction with the server is a single xml document |
| 20:17 | hiredman | insane |
| 20:51 | celwell | I'm using a simple "lein ring server", and plaintext responses are sent quickly, but I'm now testing a more involved bootstrap theme and it takes about 15 seconds to load! I can load the page up also instantly off my WAMP server (I'm on Windows), but the ring server is way too slow to develop efficiently. Any ideas? Has anyone experienced this? (I feel a lot of friction with the Clojure workflow, the simplicity of |
| 20:51 | celwell | PHP page reloads is beckoning me back to the mire of imperativity and state.) |
| 20:51 | beamso | i'm developing off ring and not seeing those types of delays |
| 20:52 | beamso | but it really depends on how your application is structured |
| 20:52 | beamso | i'd look at the network tab of the dev tools in chrome to see what is taking so long |
| 20:54 | justin_smith | celwell: are you testing the transfer times from the server, or total page render time? |
| 20:56 | justin_smith | and yeah, 15 seconds is kind of absurd - I can do complex pages with content from a db, templated using arbitrary clojure code in my template bodies, using partial templates that get combined at runtime, and have a local transfer time under 100ms |
| 20:56 | justin_smith | (this is with smart caching on the db side etc. but still...) |
| 20:57 | celwell | justin_smith: transfer time, I'm looking at chrome dev tools. I took out enlive templating and it's just the static resources. |
| 20:58 | justin_smith | 15 seconds for static resources? |
| 20:58 | hiredman | lein ring server injects various bits of middleware, so who knows what is happening |
| 20:58 | amalloy | does your network stack use baling wire for the loopback interface? |
| 20:58 | akurilin | Can someone much smarter than me tell me how you folks deal with email abuse? E.g. I let our users share some stuff with random people on the Internet through email, how do I prevent them from trolling us and abusing the system? Do I just count the # of emails they send in a day? |
| 20:58 | celwell | amalloy: ha i'm running locally |
| 20:59 | amalloy | celwell: right, the loopback interface is localhost. thus the joke |
| 20:59 | justin_smith | celwell: that's what loopback means |
| 20:59 | justin_smith | maybe your fs is mounted on a tape drive, and it takes that long for the ring server plugin to check for file changes to reload? |
| 21:00 | justin_smith | nfs over an analog modem? |
| 21:00 | amalloy | justin_smith: better yet, sshfs |
| 21:00 | justin_smith | over analog modem |
| 21:01 | amalloy | back in my clueless youth i tried working remotely via sshfs, instead of sshing to my work machine. took like...minutes and minutes to start lein repl |
| 21:04 | celwell | I think if I uberjar every change I can upload to aws and run from there all within 13s, saving 2s. |
| 21:06 | justin_smith | celwell: if you use a tool like yourkit or even jvisualvm (which comes with the jdk) it shouldn't take long to figure out what is making your requests take that long |
| 21:06 | celwell | The weird thing is that the latency is spread out over the all the resources (it's not like it's a 15s wait and then everything dumps) |
| 21:06 | justin_smith | also try using lein run instead of lein ring server |
| 21:08 | justin_smith | celwell: the two times I recall that kind of performance drain with ring were 1) someone put multiple calls to eval in a template renderer and 2) someone tried to use bcrypt for basic auth for each request |
| 21:09 | celwell | justin_smith: I thought it might be enlive, but when I just pipe it statically through (route/resources "/") it's the same. |
| 21:09 | amalloy | you're probably doing one stupid thing at the top level of your handler, something you don't need to do at all like writing 10MB of debug output, and that happens for each request the client makes |
| 21:10 | justin_smith | celwell: profile it - there is a free profiler with the jvm, it's really the best way |
| 21:10 | justin_smith | (it's not an excellent profiler, but it works) |
| 21:10 | amalloy | justin_smith: guessing is more fun. if you're right, you look like a genius |
| 21:10 | justin_smith | lol |
| 21:11 | justin_smith | celwell: grep your code for calls to (Thread/sleep 15000) |
| 21:12 | jtackett | anyone know the regex for a double dash? |
| 21:13 | justin_smith | ,(re-matches #"--" "--") ; like this? |
| 21:13 | clojurebot | "--" |
| 21:13 | jtackett | ya but that woun’t match like the combined one |
| 21:13 | jtackett | — |
| 21:14 | justin_smith | ,(re-matches #"—" "—") |
| 21:14 | clojurebot | "—" |
| 21:14 | jtackett | haha ya just realized it when I typed it |
| 21:14 | justin_smith | that's called EM DASH btw |
| 21:15 | justin_smith | https://img.4plebs.org/boards/pol/image/1403/06/1403061838700.png there is no easy regex for this |
| 21:16 | mearnsh | (dec justin_smith) |
| 21:16 | lazybot | ⇒ 75 |
| 21:16 | mearnsh | bad joke penalty :) |
| 21:16 | justin_smith | heh, I earned it |
| 21:17 | mearnsh | wasn't sure if dec was implemented |
| 21:17 | justin_smith | $karma so |
| 21:17 | lazybot | so has karma -33. |
| 21:17 | justin_smith | heh |
| 21:17 | mearnsh | haha, i see |
| 21:18 | xeqi | $karma MaxErrmin |
| 21:18 | lazybot | MaxErrmin has karma -1000.0. |
| 21:18 | justin_smith | lol |
| 21:18 | justin_smith | (dec MaxErrmin) |
| 21:18 | lazybot | ⇒ -1001.0 |
| 21:19 | justin_smith | it's still floating point, of course |
| 21:20 | mearnsh | wow what did MaxErrmin do |
| 21:20 | justin_smith | I think amalloy was messing around with the lazybot internals |
| 21:21 | mearnsh | oh yeah http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-07-31.txt |
| 21:22 | amalloy | xeqi applied one of the many lazybot security holes he keeps in his back pocket to set it to 1000. i countered by setting it to -1000, but since i did it through the mongodb shell it turned into a float |
| 21:23 | justin_smith | thanks for nothing, javascript |
| 21:23 | mearnsh | that sounds like a lousy shell |
| 21:23 | justin_smith | mearnsh: so unlike the other marvelous properties of mongodb |
| 21:23 | amalloy | it's good practice for people who frequently forget how to type NumberLong |
| 21:24 | justin_smith | https://www.youtube.com/watch?v=qjOZtWZ56lc |
| 21:25 | celwell | hmm... I killed all my java processes and then did "lein ring server", and the first load was sub-second; I pressed refresh and then back to 15s loads. |
| 21:26 | justin_smith | "it's time for wangernum, let's rotate the board" |
| 21:30 | amalloy | the first mitchell & webb sketch i saw was "A bigger spoon". it's quite amusing, and i can claim it's on-topic for #clojure because it reminds me of spec/requirements discussions with users: https://www.youtube.com/watch?v=Hu9nhExp5KI |
| 21:31 | justin_smith | danielcompton: the bag says "NO" on it, right? |
| 21:32 | danielcompton | justin_smith: lets rotate the bag! |
| 21:32 | justin_smith | heh |
| 21:32 | danielcompton | justin_smith: yes it says NO |
| 21:34 | akurilin | Random question: say you need to send bulk email. Assuming you don't care about the result right there and then, do you just send them to an agent and have that take care of sending them off asynchronously? |
| 21:34 | akurilin | The challenge there would be to make sure you're not suddenly failing everything without knowing about it |
| 21:34 | justin_smith | akurilin: you can set the error function for an agent |
| 21:35 | amalloy | akurilin: an agent doesn't make sense to me, unless you want to be careful to send exactly one email at a time, with no parallelism |
| 21:35 | akurilin | right, I'd have to make sure to log and track that |
| 21:35 | akurilin | amalloy: what would you recommend I use? |
| 21:36 | amalloy | i mean, it depends on your requirements, but an executor with its own threadpool (stuff from java.util.concurrent) is rarely far wrong |
| 21:36 | justin_smith | akurilin: what about an array of futures, and then you don't return until all features are completed (and handle all the errors as need be) |
| 21:36 | amalloy | $google raek exectuors in clojure |
| 21:36 | lazybot | [raek: Executors in Clojure] http://blog.raek.se/2011/01/24/executors-in-clojure/ |
| 21:37 | amalloy | wow, is that really 3 1/2 years old? i'm getting old |
| 21:38 | akurilin | oh cool, thanks for the link |
| 21:41 | nullptr | celwell: have you tried in multiple browsers? i've seen chrome get weird a few times when its cache is out of sync |
| 21:43 | celwell | nullptr: thanks, but no difference in firefox |
| 21:46 | nullptr | are you accessing your machine by ip address or hostname? |
| 21:47 | celwell | localhost:3000 |
| 21:47 | nullptr | try 127.0.0.1 ... just for fun |
| 21:48 | nullptr | localhost could map to ::1 and cause some kind of weird delay before reverting to ipv4 #speculation #reaching |
| 21:48 | arrdem | anyone worked with pattern expressions in Clojure? |
| 21:49 | arrdem | I'm aware of core.match but I was wondering if there were other games in twon |
| 21:49 | arrdem | *town |
| 21:49 | celwell | nullptr: no dice. i'm starting to think ring server is just actually that slow (at least on my machine) |
| 21:50 | nullptr | celwell: doubtful ... smells like networking ... you could try on a VM to confirm |
| 21:50 | justin_smith | celwell: have you tried profiling yet? |
| 21:55 | celwell | justin_smith: yes, but not able to discern much (might be my fault). here is the log dump if you care to import it: https://gist.github.com/celwell/eed6a902c26e4bbf36f8 |
| 21:55 | kenrestivo | turn ipv6 off. |
| 21:55 | celwell | a lot of time is spent on "sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run()" but I'm assume the problem is merely nested in there, not that itself |
| 21:56 | seabre | Does anyone use midje/lein-midje and environ/lein-environ together? When I run lein midje, my tests use my dev environment variables, not my test ones. |
| 21:56 | seabre | The workaround is to just to put them in .lein-env, but seems like I shouldn't have to do that. |
| 21:57 | jtackett | dumb question, but what's the best way to convert a lazy seq to a string |
| 21:58 | amalloy | celwell: try turning off the auto-reload feature in lein-ring. there's a lot of stuff in there that looks like searching the classpath for clojure files and checking if they've been modified |
| 21:58 | holo | jtackett (apply str my-seq) |
| 21:58 | celwell | jtackett: (holo's answer) but if it's infinite you need to (take) some first |
| 21:59 | jtackett | that was inefective |
| 21:59 | jtackett | can’t just apply str |
| 21:59 | cfleming | arrdem: depends what you're doing, have you seen seqex? |
| 21:59 | seabre | (str my-seq) doesn't work either? |
| 21:59 | jtackett | nope |
| 21:59 | cfleming | arrdem: for general matching AFAIK core.match is the only option |
| 21:59 | celwell | jtackett: (doall) first? |
| 21:59 | jtackett | haha tried that oo |
| 22:00 | jtackett | too |
| 22:00 | arrdem | cfleming: mmkay. thanks. |
| 22:00 | cfleming | arrdem: seqex is really great for macro stuff, I use something similar internally in Cursive. |
| 22:01 | arrdem | cfleming: yeah I remember it from the illuminated macros talk |
| 22:01 | cfleming | arrdem: but it's not very general. |
| 22:01 | jtackett | nvm got it |
| 22:02 | amalloy | jtackett: (pr-str my-seq) |
| 22:03 | arrdem | cfleming: ah see what I've done is built essentially a database of decomposed maps and I'm playing with a querry language based on structural pattern matching over maps in the database. |
| 22:03 | arrdem | cfleming: I was wondering if there was other prior art mod core.match which I need to play with anyway. |
| 22:04 | cfleming | arrdem: not that I know of - I think core.match is your option. |
| 22:04 | cfleming | arrdem: if you wanted to do something tricky you could use automata, maybe? Depends how complex your matching language needs to be. |
| 22:05 | celwell | amalloy: wow, that was right on. {:auto-reload? false} is giving me sub-second loads consistently. hmm... but I would like to have auto-reload... does this mean I need to terminate the ring server every change? |
| 22:05 | amalloy | celwell: just run your server from inside nrepl/cider/swank or something, and reload it by hand when you change things |
| 22:06 | amalloy | that's a much better dev setup than lein ring server anyway |
| 22:08 | beamso | by "reload it by hand when you change things", is there stuff that will automatically get picked up or does it always require that manual operation? |
| 22:09 | amalloy | beamso: if you make a change in foo.clj, then C-c C-k in that buffer (or whatever is equivalent for your editor tooling) |
| 22:10 | beamso | okay |
| 22:10 | beamso | i'm using cursive |
| 22:11 | justin_smith | celwell: you are spending a lot of time on file-seq |
| 22:12 | celwell | justin_smith: is ring's :auto-reload? doing that? |
| 22:12 | amalloy | justin_smith: already fixed that |
| 22:12 | justin_smith | OK, I didn't see all the scrollback |
| 22:13 | amalloy | justin_smith: i'm gonna take credit for guessing: "you're probably doing one stupid thing at the top level of your handler, something you don't need to do at all" |
| 22:14 | justin_smith | hah |
| 22:14 | amalloy | (as it turns out, scanning the entirety of your bootstrap resource files to see if any of them are clojure files that need to be reloaded) |
| 22:14 | justin_smith | ahh, that would probably have an effect, wouldn't it |
| 22:16 | celwell | amalloy: i see... makes sense. thanks for pinpointing the problem. i owe you a beer or coffee if you want it. i'm five minutes from santa monica |
| 22:17 | amalloy | celwell: hey, any time. i don't do this for the free coffee :) |
| 22:27 | cddr | Do clojure methods have anything like CLOS's eql specializer? |
| 22:30 | justin_smith | cddr: functions are only trivially equal, and methods aren't even first class |
| 22:30 | technomancy | cddr: multimethod dispatch uses isa? and associated hierarchies, so they can be customized with derive. |
| 22:30 | technomancy | that said, this is very rarely used |
| 22:30 | justin_smith | technomancy: oh yeah, that is probably closer to what is meant here |
| 22:31 | technomancy | clojure gets equality right out of the box for the most part, so you don't have to override it much |
| 22:31 | justin_smith | technomancy: the ability to dispatch using an arbitrary function with defmethod is kind of a superset of that feature anyway |
| 22:31 | technomancy | indeed |
| 22:32 | cddr | Thanks for the food for thought |
| 22:43 | Alvalo | Evening |
| 23:55 | jose_leeto | hello |