2012-12-16
| 00:10 | holo | when i execute `lein compile :main` ( with ":main ^{:skip-aot true} app.server") in bin/build, why "Running: lein with-profile production compile..." messages disapear from the buildpack message output? |
| 00:13 | holo | i'm hoping that with :main, it will still use the adequate profile, and heroku build system would notify me of that |
| 00:26 | n_b | Well Raynes, I may have goofed submitting a pull request to clj-github, but at least my typo while copying with-auth made me begin to understand how quoting in macros works! |
| 00:26 | Raynes | lol |
| 00:27 | n_b | so at least there's that |
| 00:27 | n_b | I'll give Tentacles a run through once I finally finish this Twilio library |
| 00:29 | n_b | although at my current rate of progress they'll probably be out of business by the time that happens >< |
| 00:30 | seangrove | aphyr: I just ran across riemann, and it looks terrifyingly interesting |
| 00:30 | aphyr | Thanks! :) |
| 00:32 | seangrove | I've been looking to adapt Heroku's pulse for some things, but I think I'll play around with Riemann first |
| 00:32 | aphyr | full disclosure the UI is in a *terrible* state right now |
| 00:32 | aphyr | I desperately need to finish the websockets js interface |
| 00:33 | Raynes | callen: I've been told to apologize for taking up dsantiago's time over the weekend on a non-his-templating-language project. Hope you don't hate me. ;) |
| 00:33 | aphyr | somehow working 12 hours a day on this project and there is never enough time, haha |
| 00:34 | seangrove | Hah |
| 00:34 | seangrove | I'd love to see this connected to a frontend system |
| 00:34 | seangrove | Client-side browser apps are pretty much completely black-box right now |
| 00:34 | seangrove | Looking forward to instrumenting it! |
| 00:35 | aphyr | It's intended to support arbitrary UIs |
| 00:35 | aphyr | I'm just the only one building one right now |
| 00:35 | aphyr | Oh, you mean instrumenting web pages themselves? Check out the node client. |
| 00:35 | aphyr | I'll probably add an HTTP interface at some point even though it'll be dog slow, just for the js crowd |
| 00:36 | n_b | Is it worth following the clj mailing list if you're a relative newcomer to the language? |
| 00:36 | seangrove | Yeah, Zenbox runs for days, and I need to keep track of how many messages we're dropping, our response time client-side, perf stats, memory consumption, etc. |
| 00:36 | mdeboard | I'd kill for a live step-through debugger for cascalog |
| 00:36 | mdeboard | literally |
| 00:36 | aphyr | seangrove: let me know if it works for you! I'm usually around on #riemann. |
| 00:36 | seangrove | mdeboard: That's quite a low bar |
| 00:36 | mdeboard | seangrove: I'm not a people person |
| 00:37 | seangrove | aphyr: Will take a look later this week or next weekend probably, have to finish an rpc layer first |
| 00:37 | seangrove | mdeboard: But it'd be a real hassle... it'd make enjoying your debugger much more complex, what with the subsequent investigations, questioning, etc. |
| 00:38 | mdeboard | :) |
| 00:38 | mdeboard | Just saying, pdb nails it. Dunno if it's even possible with clojure. |
| 01:00 | amalloy | mdeboard: i'm sure pdb would have trouble with hadoop too :P |
| 01:01 | mdeboard | Yeah, I'm sure it's apples and oranges under the hood. I love that introspection though. |
| 01:02 | mdeboard | Probably a crutch though. Good tests would be a huge step up. |
| 01:26 | hammer | if i have an object defined as w, and toString it with (.toString w), I get what I expect, but if I put it in a list with (def el '(w)), I just get "w" for (.toString (first el)) |
| 01:27 | hammer | i can't figure out why |
| 01:28 | Raynes | hammer: What do you expect to get? |
| 01:28 | hammer | trying to make a simple example |
| 01:29 | hammer | so (.toString w) is like "#<Worker: host:"host", port:6000>" |
| 01:29 | amalloy | hammer: '(w) does not make a list containing the value of w |
| 01:29 | amalloy | it makes a list containing the symbol w |
| 01:30 | metellus | does that mean that (.toString (first (list w))) would do what he wants? |
| 01:30 | amalloy | of course |
| 01:30 | amalloy | although, don't use .toString when you have str |
| 01:31 | hammer | so '(w) and (list w) aren't the same? |
| 01:31 | Raynes | No. |
| 01:31 | Raynes | List evaluates its arguments. |
| 01:31 | amalloy | indeed. if they were, rich wouldn't have bothered to add the other :) |
| 01:31 | Raynes | ' tells Clojure to quote the thing in front of it, meaning it leaves it unevaluated. |
| 01:32 | Raynes | So you get the symbol w instead of the value it refers to. |
| 01:32 | hammer | i guess i would have expected that from 'w |
| 01:32 | hammer | and i was thinking of (w) as the list |
| 01:32 | Raynes | You probably don't want a list here anyways, fwiw. |
| 01:33 | Raynes | Unless you have a specific reason for using a list, a vector is usually better. |
| 01:33 | Raynes | [w] |
| 01:33 | amalloy | *shrug* he probably wants any kind of seq |
| 01:33 | hammer | i'm implementing a thrift interface |
| 01:33 | Raynes | Yeah, but if he is writing literals and doesn't care about having a list, amalloy. |
| 01:33 | hammer | it'll return a list of workers, so list made sense |
| 01:34 | hammer | well, seemed obvious |
| 01:34 | hammer | vector until the last second make more sense? |
| 01:34 | amalloy | it'll probably be a lazy seq eventually |
| 01:34 | Raynes | It's just easier to write [w] instead of (list w) if that's what you have to do. |
| 01:36 | hammer | so '[w] and [w] |
| 01:36 | hammer | what's the difference |
| 01:38 | hammer | never mind |
| 01:38 | hammer | think i got it |
| 01:45 | mdeboard | I feel like this is a really dumb question but what's the function that returns true if a series of predicates are true? like the threading macro but for truthiness. `(->true? 1 (> 2) (= 1))' would yield true, for example. |
| 01:46 | mdeboard | this obviously already exists, I just can't find/remember it. |
| 01:46 | metellus | I think every-pred? |
| 01:47 | mdeboard | That's pretty close. I think maybe I'm thinking of something in 1.5 |
| 01:51 | n_b | There's no way to have a let immediately underneath a (defn) right? |
| 01:51 | mdeboard | Like, before the signature? |
| 01:52 | n_b | I looked at the source and just want to make sure I'm not misunderstanding how it binds things |
| 01:52 | mdeboard | `(defn foo (let [a 1 b 2]) (do-stuff a b))' |
| 01:52 | mdeboard | ? |
| 01:52 | n_b | yes |
| 01:52 | mdeboard | no |
| 01:52 | n_b | OK, that's what I would've thought |
| 01:53 | mdeboard | Well, there IS a way. |
| 01:53 | mdeboard | but it'd be dumb. |
| 01:53 | mdeboard | (macros) |
| 01:53 | n_b | Essentially what I want is something like (defn foo (let [bar 1] ([] (identity bar)) ([baz] (+ bar baz))) |
| 01:54 | mdeboard | why |
| 01:54 | mdeboard | like, arity dispatch? |
| 01:54 | mdeboard | I dunno, no, don't do that |
| 01:54 | mdeboard | can't* |
| 01:55 | n_b | I'm writing an API wrapper, where there's a fn `get-resource`. I was hoping to make it act so that (get-resource) returns a lazy seq while something like (get-resource some-id) returns an instance |
| 01:55 | mdeboard | Yeah you can do arity dispatch |
| 01:55 | n_b | Right |
| 01:56 | n_b | I know that; the problem is they both have a base-url that gets included as an arg to the make-api-call fn they both call, and I was hoping to have them share it without having a def somewhere |
| 01:56 | n_b | just as a little DRY |
| 01:56 | n_b | making a make-resource-call probably makes more sense than writing some horrible macro though |
| 01:56 | n_b | so I'll just not do it |
| 01:57 | n_b | It seemed like a bad idea from the start, but I'm new enough to the language I thought I might see if there's an idiomatic way I didn't know of for something like this |
| 01:57 | mdeboard | I dunno if you can/how you can do arity dispatch with e.g. (partial make-api-call base-url) |
| 01:59 | n_b | I'll play around a bit and see if I can't devise a better solution, thanks for the feedback! |
| 02:25 | muhoo | wait, isn't arity dispatch built into defn? |
| 02:25 | amalloy | muhoo: into IFn |
| 02:27 | n_b | the problem isn't arity dispatch, it's having the signatures within a let |
| 02:28 | muhoo | does letfn do arity dispatch? |
| 02:28 | n_b | ohhh |
| 02:31 | n_b | `(letfn [url "foo" fn1 [] (identity url) fn2 [pth] (str url '/' pth)] (fn1) (fn2)) |
| 02:32 | amalloy | n_b: that is not at all what a letfn looks like |
| 02:33 | n_b | amalloy: Actually looking it up showed me that |
| 02:34 | n_b | but am I misunderstanding the docstring or does letfn only bind fns? |
| 02:34 | amalloy | it does indeed |
| 02:35 | bbloom | n_b: http://clojuredocs.org/clojure_core/clojure.core/letfn |
| 02:35 | bbloom | probably also needs a mutual recursion example :-) |
| 02:36 | n_b | So it seems I'm an idiot who immediately jumped to the most complex solution I could think of |
| 02:36 | bbloom | i've only ever used letfn for mutual recursion one time. otherwise, i just can never get used to the syntax and use a regular let |
| 02:36 | n_b | because (let [foo "bar"] (defn baz [bat] (str bat foo))) does what I want |
| 02:38 | n_b | I'm not sure why I thought it wouldn yield |
| 02:38 | n_b | d |
| 02:38 | n_b | *I'm not sure why I thought it wouldn't yield its result in this case. |
| 02:40 | n_b | but thank you for pointing me in the right (very obvious in retrospect) direction, and I apologise for cluttering up the channel with what was ultimately such a simple question |
| 03:40 | bbloom | n_b: never apologize for learning: just learn from your learning too and think through your next question with the experience of your last one! both experience in clojure and in asking questions! :-) |
| 03:47 | TEttinger3 | Raynes: http://ideone.com/SDbRn0 nesting for lazybot |
| 03:47 | TEttinger3 | it is quite sloppy but works |
| 04:14 | TEttinger3 | $mail Raynes Nesting commands for lazybot: a reality! http://ideone.com/SDbRn0 |
| 04:14 | lazybot | Message saved. |
| 05:19 | Raynes | TEttinger3: Pretty sure that wont work |
| 05:19 | Raynes | |
| 05:20 | Raynes | TEttinger3: It'll work in specific situations, but you can't always know that the next thing to be put in the stream is from the plugin you're calling. |
| 05:20 | Raynes | If you have a bot in many channels, for example. |
| 05:20 | TEttinger | true |
| 05:20 | TEttinger | it seems to work in my testing channel on quakenet |
| 05:21 | Raynes | But still pretty cool. |
| 05:21 | TEttinger | yeah, nesting is a pain |
| 08:26 | thorwil | for moving from using org.clojure/java.jdbc to korma, i'd like to have both around during the transition. but: |
| 08:26 | thorwil | java.io.FileNotFoundException: Could not locate clojure/java/jdbc/internal__init.class or clojure/java/jdbc/internal.clj on classpath |
| 08:27 | p_l | a/act |
| 08:28 | hyPiRion | thorwil: You could refheap the project.clj? |
| 08:28 | Raynes | Dear everyone. Refheap supports markdown as of 30 seconds ago. https://www.refheap.com/paste/7622 |
| 08:29 | hyPiRion | Raynes: grats :) |
| 08:29 | thorwil | hyPiRion: https://www.refheap.com/paste/7623 |
| 08:30 | thorwil | the only new thing is the korma item |
| 08:35 | thorwil | could it be korma and clojure.java.jdbc cannot coexist? |
| 08:35 | hyPiRion | I thought so at first, but a clean run with both seems to work. |
| 08:35 | hyPiRion | Give me a second, I'm fetching the deps |
| 08:36 | hyPiRion | When does the error occur? |
| 08:37 | borkdude | Raynes nice |
| 08:38 | thorwil | hyPiRion: on doing "lein immutant run". when it starts services |
| 08:38 | hyPiRion | oh, thorwil, sorry |
| 08:38 | hyPiRion | I noticed it now |
| 08:38 | hyPiRion | Korma wants [org.clojure/java.jdbc "0.2.2"] |
| 08:38 | hyPiRion | Try to exclude it, and check what happens |
| 08:40 | thorwil | dang, i even have the lein pedantic plugin, shouldn't it catch that |
| 08:43 | thorwil | just specifying the same version 0.2.2 didn't help |
| 08:43 | nonrecursive | hi all - I want to store some application variables in leiningen. how do I read the variables? i.e - (defproject proj "0.0.1-SNAPSHOT" :random-setting "setting") |
| 08:43 | nonrecursive | how would I read :random-setting elsewhere in the app? |
| 08:44 | thorwil | hyPiRion: doing [korma "0.3.0-beta9" :exclusions [org.clojure/java.jdbc]] also doesn't help |
| 08:44 | hyPiRion | thorwil: strange. |
| 08:44 | thorwil | hyPiRion: thank you for looking into this, i give up and drop my jdbc now. cold turkey :} |
| 08:44 | Raynes | Hrm, fenced code blocks no work for some reason. They work locally. |
| 08:45 | hyPiRion | thorwil: You could try and downgrade the jdbc to 0.2.2 and see what happens |
| 08:45 | hyPiRion | if not, I'd probably just kill the jdbc as you suggest |
| 08:45 | thorwil | hyPiRion: tried already |
| 08:45 | hyPiRion | ah |
| 09:24 | Raynes | Rolled back markdown support for now. I can't figure out why it works fine locally but not on Heroku. |
| 09:41 | no7hing | does clojure have something similar to java beans? |
| 09:41 | no7hing | defrecord/deftype won't do because of their constructors |
| 09:43 | borkdude | no7hing it has a bean function which turns a java "bean" into an immutable map, but that's probably not what you need |
| 09:43 | no7hing | sadly no |
| 09:43 | no7hing | i need to talk to a legacy AMF service that insists on getting deserializable pojos |
| 09:44 | no7hing | if they need a constructor - it fails |
| 09:45 | no7hing | wanted to find a way around gen-class because of it's AOT and the need for custom serialization |
| 09:45 | raek | no7hing: one pretty simple solution is to write the class you need for interop in java and let it delegate its behavior to clojure code |
| 09:45 | borkdude | no7hing I'm no expert on beans/pojos, but maybe it's better to work with regular Java beans than clojure datastructures? |
| 09:46 | raek | also, compilation of java files can be handled by leiningen |
| 09:46 | no7hing | more or less the same solution nearly at the same time - maybe it's time for java |
| 09:46 | no7hing | oh, didn't know that |
| 09:47 | no7hing | will have a look down that alley |
| 09:47 | no7hing | thanks :) |
| 09:48 | raek | no7hing: :java-source-paths ["src/java"], :source-paths ["src/clj"] |
| 09:48 | raek | then do a "lein javac" before you start the repl |
| 09:48 | raek | you need to restart the repl when you want to rewrite the class, though |
| 09:49 | raek | but you have that problem (and other ones) too when you use gen-class |
| 09:49 | no7hing | exactly |
| 09:49 | borkdude | raek +1 |
| 09:50 | no7hing | i think this sounds nicer all in all then going the all-clojure way |
| 09:50 | raek | one pretty neat approach is to implement a "skeleton" class and a private interface in java, let the skeleton delegate to an instance of that interface, and then implement the interface in clojure using reify or proxy |
| 09:50 | cemerick | no7hing: defrecords *are* Java-serializable |
| 09:51 | cemerick | why is a no-arg ctor necessary on the consumer side? |
| 09:51 | no7hing | @cemeric: blazeds insists on it |
| 09:51 | cemerick | heh; oh really |
| 09:51 | no7hing | Adobe BlazeDS |
| 09:52 | cemerick | even if they're just .readObject'ing off of a stream? |
| 09:52 | no7hing | flex.messaging.MessageException: Unable to create a new instance of type 'hellgate.types.Foo'. Types cannot be instantiated without a public, no arguments constructor. |
| 09:52 | cemerick | weird |
| 09:52 | no7hing | haven't looked to deep into the blazers end of things |
| 09:52 | cemerick | well, you can certainly make a record into a JavaBean-compliant class |
| 09:52 | no7hing | to/too |
| 09:53 | no7hing | wouldn't that require a lot of manual wiring? |
| 09:54 | no7hing | and any pointers to an example? i think i've googled for every combination of terms |
| 09:54 | cemerick | nah; just a macro that produces the appropriate BeanInfo impl |
| 09:54 | no7hing | hmm |
| 09:55 | cemerick | I wrote half of a macro do to that once, but that's lost in time at this point |
| 09:56 | no7hing | maybe i'll just take the easy way out this time |
| 09:56 | cemerick | Yeah, doing it in Java is the sensible thing to do. |
| 09:57 | no7hing | thanks all |
| 09:57 | cemerick | depending on what is touching the data on the other end (your stuff?) you could just ship pr-str'd Clojure data :-P |
| 10:01 | no7hing | that's where flash resides |
| 10:01 | no7hing | :D |
| 10:01 | no7hing | so many rings of hell to jump through |
| 10:01 | no7hing | hence the temporary project name |
| 10:28 | mich2 | does anyone know by chance if there is something to use datomic as a picture database |
| 10:28 | mich2 | so i can store metadata related to image files and then qurey that? |
| 10:36 | hcumberdale | Hi ;) |
| 10:37 | hcumberdale | How to put a single parameter in a list but let the parameter untouched if it is already a list? |
| 10:38 | ivan | ,(conj #{3} 3 5) |
| 10:38 | clojurebot | #{3 5} |
| 10:38 | hcumberdale | ,{:x 1 :y 2} |
| 10:38 | clojurebot | {:y 2, :x 1} |
| 10:38 | hcumberdale | ,[ {:x 1 :y 2 } {:x 3 y 4} ] |
| 10:38 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: y in this context, compiling:(NO_SOURCE_PATH:0)> |
| 10:38 | borkdude | hcumberdale merge-with? |
| 10:39 | hcumberdale | ,[ {:x 1 :y 2 } {:x 3 :y 4} ] |
| 10:39 | clojurebot | [{:y 2, :x 1} {:y 4, :x 3}] |
| 10:39 | hcumberdale | this is how it should look like |
| 10:39 | hcumberdale | (vector {:y 2, :x 1}) |
| 10:39 | hcumberdale | ,(vector {:y 2, :x 1}) |
| 10:39 | clojurebot | [{:y 2, :x 1}] |
| 10:39 | gfredericks | ,(map (fn [x] (if (sequential? x) x [x])) [1 2 [3 4] [[5] [6]]]) |
| 10:39 | clojurebot | ([1] [2] [3 4] [[5] [6]]) |
| 10:40 | hcumberdale | ,(sequential {:x 1 :y 2}) |
| 10:40 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sequential in this context, compiling:(NO_SOURCE_PATH:0)> |
| 10:40 | hcumberdale | ,(sequential? {:x 1 :y 2}) |
| 10:40 | clojurebot | false |
| 10:40 | hcumberdale | ahh! |
| 10:41 | hcumberdale | ,(map (fn [x] (if (sequential? x) x [x])) {:x 1 :y 2}) |
| 10:41 | clojurebot | ([:y 2] [:x 1]) |
| 10:42 | hcumberdale | same result as (seq ...) |
| 10:43 | gfredericks | hcumberdale: what do you want the result to be for {:x 1 :y 2}? |
| 10:45 | hcumberdale | ahh (defn one-item-vec [x] (if (sequential? x) x [x])) works |
| 10:46 | hcumberdale | gfredericks: ring file uploads... if there is a multiple="multiple" a vec with maps for each file is returned |
| 10:47 | hcumberdale | If multiple="multiple" but only one file is uploaded, it is simply one map {} |
| 10:47 | hcumberdale | Not in a vector |
| 10:47 | Raynes | There we go. Refheap markdown support is back. Never ask me about the bug that broke fenced code blocks on Linux but not OS X. It's gonna be awhile before I can talk about it. Gonna go curl up and die now. Later. |
| 10:48 | borkdude | Raynes what is a fenced code block? ;)) |
| 10:48 | hcumberdale | But I want to doseq the my parameter also for one {} |
| 10:48 | hcumberdale | So I need it to be one item in a vec,... thx gfredericks |
| 10:49 | hcumberdale | Is there no short-form for (defn one-item-vec [x] (if (sequential? x) x [x])) ? |
| 10:50 | gfredericks | #(if (sequential? %) % [%]) |
| 10:50 | gfredericks | useful probably has an HOF to do that point-free |
| 10:50 | gfredericks | probably like (to-fix (complement sequential?) list) |
| 10:50 | borkdude | useful is a lib or msth? |
| 10:51 | gfredericks | a lib |
| 10:51 | gfredericks | flatland/useful |
| 10:51 | gfredericks | what is msth? |
| 10:51 | gfredericks | microsoft-thing? |
| 10:51 | borkdude | typo |
| 10:51 | borkdude | monad software transactional hysteria |
| 10:52 | borkdude | so it's either a lib or that. ok, a lib, good. |
| 10:55 | gfredericks | :) |
| 11:10 | hcumberdale | Is it possible that (case does not match strings the right way? |
| 11:10 | clojurebot | the best way to represent X is as a regular clojure map. (for most values of x) |
| 11:16 | metajack | Is there any reason that (def comment nil) would work but (let [e nil] (def comment nil)) would crash with NPE? |
| 11:17 | metajack | I discovered this trying to (defentity comment …) in korma, but I've managed to reduce it to the above test case. |
| 11:17 | metajack | (note also that :refer-clojure :exclude [comment] makes the NPE go away, but it's a little odd. |
| 11:18 | djwonk | I'm looking for some pointers on how to design an API to wrap cached web content. I want to cache the content in S3 but the metadata in a local DB. |
| 11:20 | djwonk | One option is `get-url` which checks the cache first and then calls clj-http.client if needed. I'm also wondering if I should make fetching the body lazy. |
| 11:26 | hcumberdale | ,(let [ext "abc"] (case "abcde.abc" ext 1 "y" 2)) |
| 11:26 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: abcde.abc> |
| 11:27 | hcumberdale | ok. |
| 11:27 | hcumberdale | ,(let [ext "abc"] (case "abc" ext 1 "y" 2)) |
| 11:27 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: abc> |
| 11:27 | hcumberdale | ?? |
| 11:27 | lazybot | hcumberdale: What are you, crazy? Of course not! |
| 11:28 | hcumberdale | what is the problem here with the 'case' macro? |
| 11:30 | AimHere | hcumberdale, the problem is that it can only take compile-time constants for the test-constants |
| 11:31 | AimHere | If you really need to test against a variable something, use cond |
| 11:31 | svedubois | I would like to use clojure in an android application. I am following this tutorial http://alfredodinapoli.wordpress.com/category/android/ |
| 11:32 | svedubois | When I try to import the jar created with lein into IntelliJ Idea I get some errors. |
| 11:33 | svedubois | I don't know how to add a jar created with lein into IntelliJ Idea using Open Module settings. |
| 11:34 | svedubois | Do you know how I can add a jar into IntelliJ Idea? |
| 11:34 | hcumberdale | AimHere: thx. |
| 11:46 | svedubois | Any suggestion how to use clojure and java inside IntelliJ Idea?? |
| 11:46 | lazybot | svedubois: Definitely not. |
| 11:46 | svedubois | Do you know any tutorial to use clojure in android apps?? |
| 11:46 | lazybot | svedubois: Uh, no. Why would you even ask? |
| 11:48 | AimHere | svedubois, unfortunately, I think in this instance, that bot should probably be ignored. |
| 11:48 | AimHere | I don't know the answer to your problem, and I'm not sure anyone else here does |
| 11:49 | AimHere | But having that bot pass the Turing test with people having genuine queries is probably a bad move |
| 11:51 | svedubois | ?? |
| 11:51 | lazybot | svedubois: What are you, crazy? Of course not! |
| 11:54 | raek | ?? |
| 11:54 | lazybot | raek: Uh, no. Why would you even ask? |
| 11:55 | raek | lazybot: bad bot. |
| 11:55 | raek | maybe it triggers on double question marks |
| 11:55 | mthvedt | ?? |
| 11:55 | lazybot | mthvedt: Uh, no. Why would you even ask? |
| 11:56 | mthvedt | is lazybot's source available somewhere? |
| 11:56 | raek | lazybot: source? |
| 11:57 | raek | mthvedt: I think this is the offical repo: https://github.com/flatland/lazybot |
| 11:58 | mthvedt | raek: thanks |
| 12:03 | thorwil | what do i have to do, to use a korma defdb in another namespace? referring to it is insufficient |
| 12:06 | raek | thorwil: what does the defdb call expand to? |
| 12:07 | mtamrf | are there any native clojure libs or wrappers for image processing? |
| 12:08 | thorwil | raek: https://www.refheap.com/paste/7640 |
| 12:08 | bl00dshooter | mtamrf: not that I know of |
| 12:08 | bl00dshooter | You'd probably have to use a java lib |
| 12:09 | thorwil | raek: it seems the thing to do is requiring, e.g. [tlog.data.access :refer [db]], to then call db before any transaction |
| 12:11 | raek | if defdb merely creates a value and expands into an ordinary def, then that's the way to do it |
| 12:12 | raek | you access it "the usual way" you access vars of another namespace |
| 12:12 | raek | thorwil: what does (macroexpand-1 '(defdb ...)) return? |
| 12:13 | thorwil | raek: (clojure.core/let [spec__2572__auto__ (postgres {:db "tlog", :user "postgres", :password "database", :host "localhost", :port "5432", :delimiters ""})] (clojure.core/defonce dbl (korma.db/create-db spec__2572__auto__)) (korma.db/default-connection dbl)) |
| 12:13 | raek | ok, it just creates a var using defonce |
| 12:14 | raek | thorwil: also, you wrote [tlog.data.access :refer [db]] instead of [tlog.data.access :refer [dbl]] here in irc |
| 12:14 | thorwil | raek: yes, that's testing on repl vs what i actually have in the files |
| 12:16 | thorwil | raek: so calling db in every namespace where i use korma is the right thing to do? |
| 12:18 | NonInc | Good evening! Would you please help me finding an idiomatic way getting the key corresponding to the numerical biggest value of a map? |
| 12:19 | NonInc | Everything I could think of would be a translation of a imperative language. |
| 12:20 | thorwil | NonInc: what shall happen if the biggest value appears more than once? |
| 12:21 | NonInc | thorwil: if it would, i would not mind overwriting it because per definition it will not. |
| 12:24 | edlothiol | ,(apply max-key val {:a 1 :b 2 :c 3}) |
| 12:24 | clojurebot | [:c 3] |
| 12:24 | edlothiol | NonInc: see above (you can then get the key with key if you need it) |
| 12:24 | NonInc | thank you edlothiol |
| 12:25 | NonInc | i guess one cannot create a sorted by value map? |
| 12:26 | NonInc | 'the-simple-way' |
| 12:26 | thorwil | NonInc: hash maps don't keep order, but array-maps do |
| 12:26 | mattmoss | clojure.set/map-invert ? |
| 12:26 | mattmoss | oops, i misunderstood |
| 12:26 | thorwil | so you surely can sort into an array-map |
| 12:27 | NonInc | would be looking into (into (sorted-map-by ...) ...) the way to start? |
| 12:27 | edlothiol | NonInc: sorted-map-by sorts only by keys |
| 12:27 | NonInc | a shame |
| 12:27 | edlothiol | I think |
| 12:28 | tpope | this reminds me of a question I've had ever since I first started |
| 12:28 | tpope | ,(-> (apply max-key val {:a 1 :b 2 :c 3}) key) |
| 12:28 | clojurebot | :c |
| 12:28 | tpope | ,(-> (apply max-key val {:a 1 :b 2 :c 3}) pr-str read-string key) |
| 12:28 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry> |
| 12:28 | tpope | why does printing and reading return a different type of object? |
| 12:29 | tgoossens | just reading for the first time about scala. Actually at first sight, it seems sweet |
| 12:30 | stuartsierra | tpope: Some less-commonly-used types, like Map$Entry, have printed representations as other types. |
| 12:31 | stuartsierra | tpope: You can bind *print-dup* true to get exact types from 'pr'. |
| 12:31 | NonInc | tpope: pr-str read-string key ... whats that? i guess converting a key to a symbol would be (read-str (name :key)) |
| 12:32 | tpope | NonInc: here it is without the threading macro: |
| 12:32 | tpope | ,(key (read-string (pr-str (apply max-key val {:a 1 :b 2 :c 3})))) |
| 12:32 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry> |
| 12:33 | tpope | stuartsierra: so the rationale is basically, "this is a rare enough use case that it's not normally worth worrying about"? |
| 12:33 | stuartsierra | tpope: I suppose so. Again, *print-dup* is there if you need i.t |
| 12:33 | tgoossens | it provides lots of functionality that i found appealing to clojure and which is not supported in java |
| 12:33 | NonInc | tpope: that seems quite interesting. |
| 12:34 | thorwil | ,(apply array-map (apply concat (sort-by second {:a 3 :b 1 :c 5}))) |
| 12:34 | clojurebot | {:b 1, :a 3, :c 5} |
| 12:34 | thorwil | not happy about the apply concat, though |
| 12:34 | tpope | ,(binding [*print-dup* true] (key (read-string (pr-str (apply max-key val {:a 1 :b 2 :c 3}))))) |
| 12:34 | clojurebot | #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.> |
| 12:34 | NonInc | thorwil: thats beautiful, thanks :D |
| 12:34 | tpope | hmm well I get a real error locally. what am I doing wrong? |
| 12:35 | tpope | this is just a curiosity. I don't currently "need it" |
| 12:35 | hyPiRion | ,(into (array-map) (sort-by second {:a 3 :b 1 :c 5})) |
| 12:35 | clojurebot | {:b 1, :a 3, :c 5} |
| 12:37 | thorwil | much better. that (array-map) works like that is new for me :) |
| 12:37 | thorwil | though of course, why wouldn't it |
| 12:38 | NonInc | hyPiRion: your version does not work for me |
| 12:38 | NonInc | ill make a pastebin |
| 12:39 | Bronsa | don't trust that |
| 12:39 | Bronsa | ,(into (array-map) (sort-by second {:a 3 :b 1 :c 5 :d 7 :e 8 :f 9 :g 10 :h 11 :i 12})) |
| 12:39 | clojurebot | {:a 3, :c 5, :b 1, :f 9, :g 10, ...} |
| 12:40 | thorwil | ,(apply conj (sort-by second {:a 3 :b 1 :c 5 :d 7 :e 8 :f 9 :g 10 :h 11 :i 12})) |
| 12:40 | clojurebot | [:b 1 [:a 3] [:c 5] [:d 7] ...] |
| 12:40 | stuartsierra | tpope: Clojurebot is also binding *read-eval* false for safety. It's true by default in most REPLs. |
| 12:41 | stuartsierra | ,(binding [*print-dup* true] (pr-str (apply max-key val {:a 1 :b 2 :c 3})))"#=(clojure.lang.MapEntry/create [:c 3])" |
| 12:41 | clojurebot | "#=(clojure.lang.MapEntry/create [:c 3])" |
| 12:41 | NonInc | As Bronsa pointed out thorwil's version works whereas hyPiRion's does not (https://gist.github.com/4309965 ProfitsSortedA does not equal ProfitsSortedB) |
| 12:42 | stuartsierra | tpope: It appears that the `print-dup` multimethod is not correctly defined for MapEntry. |
| 12:42 | Bronsa | ,(let [m {:a 3 :b 1 :c 5 :d 7 :e 8 :f 9 :g 10 :h 11 :i 12}] (into (sorted-map-by #(compare (m %2) (m %))) m)) |
| 12:42 | clojurebot | {:i 12, :h 11, :g 10, :f 9, :e 8, ...} |
| 12:42 | thorwil | the (into (array-map) approach returns a clojure.lang.PersistentHashMap |
| 12:42 | Bronsa | wops |
| 12:42 | Bronsa | ,(let [m {:a 3 :b 1 :c 5 :d 7 :e 8 :f 9 :g 10 :h 11 :i 12}] (into (sorted-map-by #(compare (m %) (m %2))) m)) |
| 12:42 | clojurebot | {:b 1, :a 3, :c 5, :d 7, :e 8, ...} |
| 12:42 | Bronsa | here |
| 12:45 | thorwil | oh, Bronsa that gives a PersistentTreeMap |
| 12:45 | Bronsa | yeah, sorted-map == PersistentTreeMap |
| 12:49 | thorwil | http://blackstag.com/blog.posting?id=19 makes it sound like array-maps are actually a special case meant for less than 9 items |
| 12:51 | hyPiRion | yeah |
| 12:51 | hyPiRion | Funny and sad. |
| 12:52 | Bronsa | why? |
| 12:52 | clojurebot | Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 12:52 | hyPiRion | ,(class (into (array-map) (map vec (partition 2 (range 16))))) |
| 12:52 | clojurebot | clojure.lang.PersistentArrayMap |
| 12:52 | hyPiRion | ,(class (into (array-map) (map vec (partition 2 (range 18))))) |
| 12:52 | clojurebot | clojure.lang.PersistentHashMap |
| 12:53 | jballanc | ,*clojure-version |
| 12:53 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: *clojure-version in this context, compiling:(NO_SOURCE_PATH:0)> |
| 12:53 | jballanc | whoops... |
| 12:53 | jballanc | ,*clojure-version* |
| 12:53 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 12:55 | hyPiRion | Well, that's a tease. |
| 12:56 | hyPiRion | ,(class (apply array-map (range 100))) |
| 12:56 | clojurebot | clojure.lang.PersistentArrayMap |
| 12:56 | hyPiRion | ,(class (assoc (apply array-map (range 100)) 0 2)) |
| 12:56 | clojurebot | clojure.lang.PersistentArrayMap |
| 12:56 | hyPiRion | ,(class (assoc (apply array-map (range 100)) 1 2)) |
| 12:56 | clojurebot | clojure.lang.PersistentHashMap |
| 12:56 | hyPiRion | ,(class (dissoc (apply array-map (range 100)) 6)) |
| 12:56 | clojurebot | clojure.lang.PersistentArrayMap |
| 12:57 | hyPiRion | Adding new elements to an arraymap turns it into hash map if you have more than 8 elements in it. |
| 12:57 | hyPiRion | *shrug* |
| 13:03 | hcumberd` | Is there any way to list-dir with date-modified, date-created and so on in Raynes fs/... ? |
| 13:07 | hcumberd` | (fs/iterate-dir "/opt/tbx") |
| 13:15 | TimMc | Well, that's an unexpected error: https://www.refheap.com/paste/7641 |
| 13:15 | TimMc | "java.lang.VerifyError: (class: lein_otf/loader$_main, method: doInvoke signature: (Ljava/lang/Object;)Ljava/lang/Object;) Unable to pop operand off an empty stack (loader.clj:40)" |
| 13:18 | raek | oh my... bug in the clojure compiler? |
| 13:19 | TimMc | Seems it, although it's probably a result of the previous errors. |
| 13:20 | TimMc | On the other hand... ^:internal shouldn't have been a bug, yeah? |
| 13:20 | TimMc | (I was annotating a public defn as being not for public consumption.) |
| 14:37 | hyPiRion | Dangit, naming stuff is hard. |
| 14:41 | egghead | just call it 'data' or 'worker' |
| 14:42 | egghead | There are only two hard things in Computer Science: cache invalidation and naming things |
| 14:47 | bbloom | tpope: also regarding printing and reading not being exact mirrors of each other |
| 14:47 | bbloom | there are some things that are simply never gonna be readable: like unknown java objects |
| 14:47 | bbloom | hence the #<unreadable> |
| 14:48 | tpope | yeah that's not surprising |
| 14:48 | bbloom | but you also need to watch out for things like ##(pr-str (sorted-set 1 2 3)) |
| 14:48 | lazybot | ⇒ "#{1 2 3}" |
| 14:48 | bbloom | no indication of sorting :-/ |
| 14:48 | zilti | What's the notation for a binary number in clojure/java? The equivalent of 0x notation for hexadecimal numbers |
| 14:48 | tpope | it was a little surprising that what was printed as a vector wasn't a vector |
| 14:49 | bbloom | tpope: i agree, it stinks |
| 14:54 | bbloom | zilti: i think you use any radix from 2 to 36 like this: |
| 14:54 | bbloom | ,2r101010 |
| 14:54 | clojurebot | 42 |
| 14:55 | zilti | bbloom: Thanks. But: |
| 14:55 | zilti | ,2r11111111 |
| 14:55 | clojurebot | 255 |
| 14:55 | zilti | huh |
| 14:56 | zilti | ,(byte 2r11111111) |
| 14:56 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 255> |
| 14:57 | ivan | byte is signed, apparently |
| 14:57 | ToxicFrog | zilti: JVM <byte> type is always signed, IIRC |
| 14:57 | tufflax | ,Byte/MAX_VALUE |
| 14:57 | clojurebot | 127 |
| 14:58 | ToxicFrog | ,[Byte/MIN_VALUE Byte/MAX_VALUE] |
| 14:58 | clojurebot | [-128 127] |
| 14:58 | ToxicFrog | I'm not sure why they thought this was a good idea. |
| 14:58 | hyPiRion | ,(unchecked-byte 2r11111111) |
| 14:58 | clojurebot | -1 |
| 14:59 | bbloom | holy hell i hate java's signed bytes. |
| 14:59 | bbloom | argh. |
| 15:02 | hiredman | bbloom: they do suck |
| 15:02 | hiredman | makes porting anything that uses bytes a pain |
| 15:03 | hiredman | https://github.com/hiredman/ed25519/blob/master/src/ed25519/core.clj#L25 |
| 15:04 | bbloom | hiredman: i talked to a guy who had implemented some of the encryption stuff in the original java library :-/ |
| 15:04 | bbloom | his commentary was hilarious |
| 15:05 | hiredman | I bet |
| 15:09 | TimMc | hyPiRion: I name all my variables after chemical elements. |
| 15:10 | hyPiRion | TimMc: It's a bad thing to do for libraries. |
| 15:12 | TimMc | hyPiRion: Actually, for libraries I pick names using biological taxonomy. |
| 15:12 | TimMc | E.g., my photo gallery project is called "pellucida", after glass frogs. |
| 15:15 | TimMc | I have a languishing bookmarking project called "chelydra", after snapping turtles. |
| 15:19 | hyPiRion | TimMc: Well, I can do that, but it's more like giving functions a descriptive name |
| 15:20 | hyPiRion | "phenex" or "gaap" wouldn't be describing what the function does. |
| 15:21 | TimMc | Yeah, for functions and locals I actually pick descriptive names. |
| 15:21 | TimMc | (Chemical elements can be great for naming computers, though.) |
| 15:22 | TimMc | I don't mean to make light of the naming problem. Just the other day I was struggling to come up with a good name for the first local in this let form: https://github.com/timmc/lein-otf/blob/master/src/lein_otf/plugin.clj#L17 |
| 15:23 | TimMc | It was very unsatisfying. |
| 15:24 | bbloom | juggle* seems as good as any for such a short function :-P |
| 15:24 | TimMc | (Context: llasram had called it "juggle", which shadowed the defn, and that bothered me.) |
| 15:37 | seangrove | Any reason why :cljs/quit in nrepl.el wouldn't cause it to go back to the clojure repl? |
| 15:38 | seangrove | zenbox.client.rpc> :cljs/quit => :cljs/quit |
| 15:39 | hyPiRion | isn't :cljs/quit just a keyword? |
| 15:39 | hyPiRion | ,:cljs/quit |
| 15:39 | clojurebot | :cljs/quit |
| 15:39 | seangrove | Yeah, but the instructions say Type `:cljs/quit` to stop the ClojureScript REPL |
| 15:39 | Bronsa | hyPiRion: the cljs repl checks for the input form to be :cljs/quit |
| 15:40 | hyPiRion | okay |
| 15:40 | Bronsa | if it is, then it exits, otherwise it evaluates the form |
| 15:40 | seangrove | Ah, cool, was wondering that myself too, hyPiRion |
| 15:41 | Bronsa | https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl.clj#L180 |
| 15:41 | seangrove | But even so, still doesn't quit |
| 15:43 | seangrove | Doesn't matter what ns I'm in (not that it should) either |
| 15:47 | mdeboard | Is the nrepl buffer the destination for stdout? Trying to figure out how to get Cascalog's stdout tap into nrepl |
| 15:48 | seangrove | mdeboard: Have you tried (with-out-str ...) ? |
| 15:59 | seangrove | Is this a reasonably idiomatic macro? https://www.refheap.com/paste/7645 |
| 16:00 | seangrove | the ~'bridge part is slightly bothersome, because it means that the ns using this macro has to have a function called bridge, and it has to be the specific one I'm thinking about |
| 16:01 | seangrove | I could change it out to be the fully-qualified name (zenbox.client.host-cs-bridge/bridge ...) instead of ~'bridge, I suppose |
| 16:02 | hyPiRion | seangrove: Is the macro defined within zenbox.client.host-cs-bridge? |
| 16:02 | hyPiRion | If so, you could omit ~' |
| 16:02 | seangrove | hyPiRion: No, zenbox.client.host-cs-bridge is in cljs, and the macro is of course in clojure |
| 16:02 | hyPiRion | oh |
| 16:02 | hyPiRion | ,(require '[clojure.string :as str]) |
| 16:02 | clojurebot | nil |
| 16:03 | hyPiRion | ,`(str/join "" [1 2 3]) |
| 16:03 | clojurebot | (clojure.string/join "" [1 2 3]) |
| 16:06 | mdeboard | seangrove: For Cascalog specifically? No |
| 16:18 | tomoj | I only recently realized that juggle' is valid in addition to juggle* |
| 16:19 | bbloom | tomoj: yeah, i've seen the use of ' to mean "prime" but it fucks with my brain when it's mixed in with ~, ~@, ', `, etc |
| 16:20 | bbloom | i do so little arithmetic that i just read * as prime |
| 16:22 | TimMc | tomoj: Ever since 1.3, yes. |
| 16:23 | hyPiRion | ehh |
| 16:23 | hyPiRion | *heh |
| 16:23 | bbloom | heh* |
| 16:24 | TimMc | &((first [inc' inc]) Long/MAX_VALUE) |
| 16:24 | lazybot | ⇒ 9223372036854775808N |
| 16:24 | hyPiRion | ,(let [-' [10]] `(~@-')) |
| 16:24 | clojurebot | (10) |
| 16:28 | hyPiRion | didn't know you could put them within names |
| 16:29 | hyPiRion | ,(let [do not, don't (not do)] (do (or) don't)) |
| 16:29 | clojurebot | false |
| 16:29 | metellus | ,(boolean not) |
| 16:29 | clojurebot | true |
| 16:29 | hyPiRion | ,(Boolean. false) |
| 16:29 | clojurebot | false |
| 16:29 | hyPiRion | ,(not (Boolean. false)) |
| 16:29 | clojurebot | false |
| 16:31 | AimHere | ,(false? (Boolean. false)) |
| 16:31 | clojurebot | false |
| 16:31 | sgeo_ | o.O |
| 16:32 | sgeo_ | Don't construct Booleans, I guess? |
| 16:32 | AimHere | Thereby proving that Rich Hickey is a Cretan |
| 16:32 | sgeo_ | ,(class false) |
| 16:32 | clojurebot | java.lang.Boolean |
| 16:32 | sgeo_ | ,(class (Boolean. false) |
| 16:32 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 16:32 | sgeo_ | ,(class (Boolean. false)) |
| 16:32 | clojurebot | java.lang.Boolean |
| 16:32 | tpope | ,(= false (Boolean. false)) |
| 16:32 | clojurebot | true |
| 16:32 | hyPiRion | Oh, how we love (Boolean. false), am I right? |
| 16:32 | bbloom | ,(= (Boolean. false) false) |
| 16:32 | clojurebot | true |
| 16:33 | hyPiRion | ,(= (not (Boolean. false)) (Boolean. false)) |
| 16:33 | sgeo_ | Is it too soon to blame this on Java making the constructor public? |
| 16:33 | clojurebot | true |
| 16:34 | ivan | = is some serious funny business |
| 16:35 | AimHere | ,(nth (iterate #(Boolean. %) false) 1000) |
| 16:35 | clojurebot | false |
| 16:36 | AimHere | ,(false? (nth (iterate #(Boolean. %) false) 1000)) |
| 16:36 | clojurebot | false |
| 16:36 | AimHere | It's Boolean. false, all the way down |
| 16:37 | hyPiRion | = is very funny, yes. |
| 16:37 | ivan | ,(false? (nth (iterate #(Boolean. %) false) 0)) |
| 16:37 | clojurebot | true |
| 16:38 | AimHere | Nothing is true |
| 16:38 | AimHere | Everything is permissible |
| 16:38 | hyPiRion | ,(let [not (memoize not)] [(not (Boolean. false)) (not false)]) |
| 16:38 | clojurebot | [false false] |
| 16:40 | tpope | what do you guys think of "fuzzy complete" with respect to clojure code? |
| 16:40 | tpope | this guy is trying pretty aggressively to get me to add it to foreplay.vim |
| 16:40 | tpope | I don't like it |
| 16:41 | bbloom | what does "fuzzy complete" imply? |
| 16:41 | bbloom | like camelHumpsInJava where you can type chij ? |
| 16:41 | ivan | that kind where the editor uses the existing buffer as the completion dictionary? |
| 16:41 | tpope | bbloom: yeah, but even broader in this case |
| 16:41 | bbloom | mayb eyou could type this-is-a-long-identifier by typing tiali |
| 16:42 | tpope | I tried st<C-X><C-O> and the first result was satisfies? |
| 16:42 | tpope | D: |
| 16:42 | bbloom | *shrug* i pretty much never use completion |
| 16:42 | tpope | I don't really either |
| 16:43 | tpope | which makes the idea of me being handed a giant fuzzy complete algorithm to maintain all the more distressing |
| 16:43 | bbloom | i know a lot of folks who do, but my experience has been that navigating completion requires brain cycles i can't afford to spend & it never gets to muscle memory because i never complete the same values often enough. |
| 16:44 | tpope | actually I use plain old buffer completion (the kind ivan was talking about) all over the place |
| 16:44 | tpope | but not omnicomplete, really |
| 16:45 | bbloom | looking at patch now, seems like it needs some custom clj code to execute |
| 16:45 | bbloom | would it be possible to let someone override the clj that presents completion? |
| 16:45 | tpope | I don't like that either |
| 16:46 | bbloom | and then fuzzy completion could be a clj library that any plugin could use by virtue of delegating to my-fuzzy-lib/complete |
| 16:47 | tpope | so would they install it like as a lein plugin? |
| 16:47 | tpope | this sounds so complicated |
| 16:49 | bbloom | yeah, better yet: ignore the pull request :-P |
| 16:52 | tpope | I think I'm gonna go push back |
| 17:13 | cemerick | tpope: particular editors and editor plugins should be completion-agnostic IMO |
| 17:14 | tpope | cemerick: could you clarify? |
| 17:14 | cemerick | That stuff needs to be driven REPL-server-side (via e.g. https://github.com/pallet/ritz/tree/develop/nrepl-middleware) |
| 17:14 | cemerick | tpope: we're coming from a history of every environment maintaining its own completion/introspection/etc/etc/etc libraries |
| 17:16 | tpope | well, yes, that's what I'm doing. With the caveat that it's currently just a couple of calls to things like ns-aliases |
| 17:41 | ravster | hello everyone |
| 17:41 | ravster | which datomic client is most favoured at the moment? |
| 17:44 | tomoj | isn't there just the one? |
| 17:46 | ravster | tomoj: I could just require datomic.api, but was wondering if people prefer any particular wrapper around it. |
| 17:46 | ravster | theres 2 I'm interested in right now, one by tborg and one by zolodeck |
| 17:48 | tomoj | tborg/datomic-schema? |
| 17:49 | ravster | tomoj: yup |
| 17:50 | tomoj | personally, I definitely wouldn't use that |
| 17:50 | tomoj | it hasn't changed in 8 months and it's written in ruby apparently because the author didn't know how to use tempids correctly |
| 17:51 | ravster | oh, okay |
| 17:51 | tomoj | demonic looks more interesting |
| 17:51 | ravster | that makes my decision easier. thanks tomoj |
| 17:52 | cemerick | tpope: if you're presuming lein underneath foreplay, then you can use clojure-complete, which is currently baked into reply |
| 17:52 | cemerick | s/which/support for which |
| 17:52 | tomoj | but demonic looks, uh |
| 17:53 | tomoj | evil? |
| 17:53 | clojurebot | evil is eval |
| 17:54 | mehwork | in the clojure code (/ 2 4) is the / considered a function since it's the first element in the parentheses - or is it still just an operator? |
| 17:54 | AimHere | Is there a difference between an operator and a function? |
| 17:54 | tomoj | I think the idea of holding transactions and batching them up is definitely useful |
| 17:55 | ravster | lol clojurebot |
| 17:55 | mehwork | AimHere: in other languages yeah |
| 17:55 | AimHere | Well yes. But I meant in clojure |
| 17:55 | mehwork | idk, i've been doing clojure for about 5 minutes |
| 17:56 | tomoj | but the crud api at least seems suspect |
| 17:56 | tpope | cemerick: saw that. but I think I'm currently capturing a bit more information than it provides (e.g., Vim provides a place to show the expected parameters of a function) |
| 17:56 | AimHere | mehwork, well I've been faffing around with it for longer, and I don't think there's a difference |
| 17:56 | tpope | cemerick: I do plan to use clojure-complete for java classes |
| 17:57 | AimHere | mehwork, you can have things being the 'first element in the parentheses' not being a function. Macros and special forms for instance |
| 18:00 | tomoj | I think if you want a fake connection that you can flush to a real connection, you should just do that |
| 18:00 | tomoj | and offer datomic's api instead of, or at least underneath, something that appeases ploppers |
| 18:15 | cemerick | tpope: That's fair; whatever enhancements you have, I'd hope the maintainers of clojure-complete and/or ritz will incorporate them |
| 18:15 | tpope | I guess I will follow up with that at some point |
| 18:16 | seangrove | Damnit |
| 18:17 | seangrove | How can I use clj->js in a macro and not have it expanded to the current namespace? |
| 18:17 | seangrove | Do I have to ~'clj->js or type the full namespaced name? |
| 18:18 | hyPiRion | or require/use it |
| 18:18 | seangrove | I see |
| 18:18 | seangrove | Frustrating since I keep forgetting it, but sensible |
| 18:36 | tomoj | I wish you could alias nonexistent namespaces |
| 18:37 | tomoj | if you're lucky, there is a clojure namespace with the same name as the cljs namespace |
| 18:37 | tomoj | then you can require the clojure one and use its alias for the cljs one in macros |
| 18:40 | callen | I wish there was a decent HTML templating library for Clojure. |
| 18:45 | ghachey | I've been struggling with a problem similar to <http://grokbase.com/t/gg/clojure/125t8rpw7n/selecting-subsets-of-maps>. I need to extract subsets of an arbitrarily nested map, but with the added complexity of known knowing the keys in advanced. Christophe Grand provided a nice solution here <https://gist.github.com/2823916>, but unfortunately I do not think this handles my case. It seems one should just be able to provide a modified i |
| 18:46 | ghachey | sorry, I meant to say "not knowing the keys in advanced". |
| 18:49 | ivan | cut off after "provide a modified i" |
| 18:51 | ghachey | provide a modified implementation of Christophe's protocol, but this is quite hard for a beginner like me, any ideas? |
| 18:54 | mdeboard | ghachey: I don't understand the "not knowing the keys in advance" piece. I mean, I get it, but that doesn't seem like added complexity. Doesn't the first response in your link address that pretty well? |
| 18:58 | ghachey | mdeboard: If it does I am not sure how. I think I need to work at it a bit more before asking for help. |
| 19:00 | mdeboard | ghachey: Well, the "that" in "address that pretty well" is "not knowing the keys in advance". Or did you mean not knowing the keys in the target map? I was assuming you meant the keys that were being sought and so couldn't hard-code them. |
| 19:03 | ghachey | mdeboard: here is a sample of the map <http://pastebin.com/WA5awtKZ>. You will see the IP addresses there in the map: they're never the same and I know know ahead of time what they will be. But I would like to extract them and some additional info. |
| 19:04 | ghachey | mdeboard: you assumed correctly. |
| 19:06 | mdeboard | ghachey: So, you want to traverse a tree of unknown depth, and if the set of children of a node match some pattern, you want to return a sbuset of those children? (Where the nodes are keys of a map) |
| 19:07 | ghachey | Yes. |
| 19:09 | mdeboard | you said "sample of THE map", does that mean the map always has that structure? and you just want to find the key that matches the pattern of an IP address? |
| 19:11 | mdeboard | Oh I see |
| 19:12 | ghachey | sorry about the confusion. Yes, the map is always of that structure (with more or less data). |
| 19:12 | mdeboard | Nah it's ok, it's an interesting thing to think about. |
| 19:15 | mdeboard | ghachey: Is the question, "Find all maps that have a value that looks like an IPv4 or IPv6 address, and select the key with that IP-address-y value, plus a few more key/value pairs from there" or "Find all maps that have keys that look like an IPv4 or IPv6 address, then retrieve a subset of k/v pairs from that key's value"? |
| 19:16 | ghachey | This is not "a sample of the map" as I said eariler. It is the full map (one of many hundred thousands in a CouchDB DB) but they're always different (come with more/less IP addresses with more/less nested traffic data) |
| 19:16 | mdeboard | I see |
| 19:17 | ghachey | mdeboard: the latter seems to desbcrivbe better what I am trying now. |
| 19:21 | ghachey | k |
| 19:23 | mdeboard | ghachey: https://gist.github.com/4314523 ? |
| 19:23 | mdeboard | in that sample you pasted it returns '(:192.168.1.1 :00:26:37:64:96:95 :20:4E:7F:3F:A8:A4 :192.168.1.5) |
| 19:24 | mdeboard | I'm probably woefully misunderstanding |
| 19:24 | mdeboard | since I'm using regex |
| 19:26 | brehaut | mdeboard: lol |
| 19:27 | amalloy | ,:foo:bar:baz ; is this really a legal keyword? |
| 19:27 | clojurebot | :foo:bar:baz |
| 19:27 | amalloy | apparently yes. not one i'd encourage using, though |
| 19:27 | mdeboard | ,:foo:bar\ :baz |
| 19:27 | clojurebot | :foo:bar |
| 19:27 | mdeboard | aw |
| 19:28 | amalloy | luckily, the clojure reader is not gcc, so that doesn't work |
| 19:29 | tomoj | user> println 'foo' |
| 19:29 | tomoj | foo' |
| 19:29 | brehaut | hurrah for foo prime |
| 19:31 | tpope | ,(keyword "foo:bar :baz") |
| 19:31 | clojurebot | :foo:bar :baz |
| 19:31 | tpope | ;) |
| 19:31 | amalloy | tpope: yes, we're well aware you can make any string into a keyword. but if the reader won't ever produce it, it's not really a good idea to use |
| 19:32 | ghachey | mdeboard: What I'd like it to return would be something like <http://pastebin.com/2YLSK4Av> |
| 19:47 | mdeboard | ghachey: https://gist.github.com/4314690 |
| 19:47 | mdeboard | that's probably gross but it gets basically everything but the datetime, which you can probably get yourself eh |
| 19:48 | mdeboard | also, seriously, there's almost certainly a better way to do it. I dunno if zippers can be used to walk maps but if they can that's probably a more elegant solution |
| 19:50 | amalloy | zippers are rarely more elegant for reading maps; they're sometimes handy for modifying them |
| 19:50 | mdeboard | and if you're always going to want the same fields (i.e. it's always bytesRcvd, etc.) then just hardcode the members `my-keys' as keywords and delete the `keys-sought' binding in `get-conn-info' |
| 19:52 | ghachey | thanks mdeboard: that looks like something I can work with for now. |
| 19:52 | mdeboard | np |
| 19:54 | mdeboard | ghachey: that will fall apart if the level of the IP address keys change level at all. |
| 20:00 | ghachey | mdeboard: I saw that, and they do not change level. It will work for me for now :) |
| 20:02 | ravster | hello everyone |
| 20:02 | mdeboard | hi |
| 20:10 | mdeboard | Just to confirm: I'm not doing wrong, nrepl really doesn't display stdout output from a different thread? Based on https://groups.google.com/forum/#!msg/nrepl-el/3GDsRkX1IDE/TEMT2aYjW5EJ |
| 20:48 | creese | How do you load a file into the repl using nrepl.el? I'm getting unknown symbol errors. |
| 20:52 | ivan | creese: C-c C-k nrepl-load-current-buffer |
| 20:54 | mdeboard | creese: Or you can do nrepl-eval-buffer, then (ns whatever-your-namespace.is) |
| 20:55 | creese | when you do the initial jack in from a file, it should already have evaluating everything, right? |
| 20:56 | mdeboard | I think you still have to change to the namespace |
| 20:56 | mdeboard | in the repl |
| 20:56 | creese | yes |
| 20:56 | creese | (into-ns 'whatever) |
| 20:56 | mdeboard | (ns whatever) |
| 20:56 | mdeboard | is what I do |
| 20:56 | mdeboard | I don't know what (into-ns) is |
| 20:56 | mdeboard | ,(doc into-ns) |
| 20:56 | clojurebot | Cool story bro. |
| 20:59 | creese | I think it's in-ns |
| 21:03 | creese | I can change into the ns but I still get symbol errors when I try to run foo |
| 21:08 | creese | I guess it doesn't evaluate when you jack in |
| 22:32 | technomancy | tpope: FWIW pushing that stuff server-side is absolutely the way to go |
| 22:32 | technomancy | dont let crazy gross logic like that sneak into the client |
| 22:33 | tpope | well it was simple logic until he got ahold of it :/ |
| 22:33 | brehaut | technomancy: more JS programmers need to here that |
| 22:35 | tpope | technomancy: oh, are you responding to my earlier discussion in here or have you been following the github issue? |
| 22:36 | technomancy | tpope: just scrollback |
| 22:36 | tpope | ok |
| 23:16 | Raynes | dsantiago: You there? |
| 23:31 | tpope | technomancy: when you say server side, do mean like https://github.com/technomancy/clojure-mode/blob/master/clojure-test-mode.el#L195-241 ? Or do you mean push what I need to other library maintainers? |
| 23:32 | Raynes | dsantiago: Sending you a pull request regarding what I was gonna ask about. |
| 23:43 | technomancy | tpope: I mean as a library preferably exposed as an nrepl middleware |
| 23:43 | technomancy | clojure-test-mode predates nrepl by ~3 years =) |
| 23:43 | tpope | so people need to install like a lein plugin or something in order to complete? |
| 23:44 | technomancy | tpope: IIRC clojure-complete is part of the default stack |
| 23:44 | tpope | yeah it appears to be |
| 23:44 | tpope | the sticky part is what I'm doing above and beyond that |
| 23:44 | tpope | which isn't much |
| 23:44 | tpope | and very vim specific |
| 23:49 | dsantiago | raynes: I don't think this is right. |
| 23:49 | Raynes | dsantiago: Thank God for pull requests. |
| 23:50 | Raynes | dsantiago: What did I screw up? :( |
| 23:54 | dsantiago | Raynes: Just conceptually, I disagree with your goal. |
| 23:54 | Raynes | dsantiago: I don't understand. Why is breaking on nil a good thing? |
| 23:55 | dsantiago | What other meaningless things should we accept in the input? |
| 23:55 | Raynes | Okay. |
| 23:56 | Raynes | Well, thanks for taking a look. :> |
| 23:57 | dsantiago | No problem |