2012-04-24
| 00:08 | dnolen | yoklov: a bit late for Ludum dare but (set! ctxt -fillStyle "...") is now in master. |
| 00:08 | dnolen | yoklov: gave it a quick spin and I think it's a big win for JS interop. |
| 00:10 | yoklov | dnolen: it looks much better |
| 00:11 | spjt | I think Emacs is harder just because it seems impossible to find out how to do anything |
| 00:11 | yoklov | dnolen: it looks like like it will help a lot |
| 00:12 | kovasb | dnolen: how is it different from using aset? |
| 00:15 | kovasb | spjt: lol |
| 00:15 | dnolen | yoklov: excellent. |
| 00:16 | emezeske | spjt: If you want to measure that, you'll need a metric to describe how good someone is at each (Clojure and Emacs) after a certain amount of time. |
| 00:17 | emezeske | spjt: And then you need some way to objectively compare that metric between the two. |
| 00:17 | yoklov | kovasb: aset feels like breaking the abstraction somewhat |
| 00:17 | yoklov | like aset on a dom node |
| 00:17 | clojurebot | your random number generator is brokem |
| 00:18 | dnolen | kovasb: not that much different, but reads more sensibly, and emits more sensible looking JS code. |
| 00:18 | kovasb | yoklov: agree, was just wondering if there is a functional difference |
| 00:18 | yoklov | kovasb: i don't think so, but the closure compiler might behave differently? |
| 00:19 | kovasb | yoklov: yea, with aset you have to refer to the property as a string |
| 00:19 | dnolen | mmarczyk: about your hash code caching patch. |
| 00:19 | spjt | emezeske: Maybe I just had a rough start with Emacs. I really enjoyed Clojure until I tried to get it working in Emacs. |
| 00:19 | mmarczyk | dnolen: ? |
| 00:21 | emezeske | spjt: I could see learning two big new things at the same time being very difficult. |
| 00:21 | ivan | spjt: IntelliJ is okay, but better for browsing code than editing lisp |
| 00:21 | dnolen | mmarczyk: perhaps we can avoid calling aset and using and an exposed key name. |
| 00:21 | dnolen | mmarczyk: about about a ^:mutable hashCode field and an Object setCache method. |
| 00:21 | devn | dnolen: i drew you a portrait: https://skitch.com/thinkslate/8ik1x/dnolen |
| 00:21 | devn | in honor of student acceptance for GSoC |
| 00:21 | dnolen | devn: haha awesome :) |
| 00:22 | devn | :) |
| 00:22 | dnolen | mmarczyk: setHashCode rather. |
| 00:22 | mmarczyk | dnolen: sure, but then that will need to be supported explicitly by all data structures |
| 00:23 | mmarczyk | dnolen: and then |
| 00:23 | mmarczyk | dnolen: either the functions calculating the hashes will assume setHashCode is available |
| 00:23 | spjt | I'm actually starting to like emacs now, although I just use inferior-lisp because I gave up on that slime/swank stuff. Is there really any benefit to it? |
| 00:23 | mmarczyk | dnolen: so could as well assume they know which property is used |
| 00:23 | mmarczyk | dnolen: or the DSs will be doing the entirety of the hashing |
| 00:24 | dnolen | mmarczyk: you can't set hashCode on things like strings, numbers anyway. |
| 00:24 | mmarczyk | dnolen: they don't use hash-coll / hash-imap / hash-iset though |
| 00:24 | dnolen | mmarczyk: I'm also thinking about portability - that's not going to fly elsewhere. |
| 00:25 | mmarczyk | dnolen: sure, the only approach which always works is having the DS handle this itself |
| 00:25 | mmarczyk | dnolen: actually that can still be done in a clean way, though |
| 00:26 | dnolen | mmarczyk: yes, but that's what happens in the Java implementations right? |
| 00:26 | mmarczyk | dnolen: yes, although there there are those APersistentFoo abstract base classes which handle this |
| 00:26 | mmarczyk | dnolen: so less repetition |
| 00:27 | mmarczyk | dnolen: *but*, I can just write a macro for this |
| 00:27 | mmarczyk | dnolen: then -hash becomes (-hash [coll] (caching-hash hash-coll coll __hash)), say |
| 00:29 | muhoo | any idea why the datomic docs consider the postgres backend to be not for "production" use? |
| 00:29 | dnolen | mmarczyk: sounds better. |
| 00:29 | mmarczyk | dnolen: ok |
| 00:31 | dnolen | mmarczyk: hmm, I'm a bit confused. |
| 00:31 | mmarczyk | dnolen: ? |
| 00:31 | dnolen | mmarczyk: why can't those aset lines become (.setHashCode x h) ? |
| 00:32 | mmarczyk | dnolen: they could, but then you'd have to be sure that there is a .setHashCode method (method, not protocol method) available on x |
| 00:32 | mmarczyk | dnolen: so may or may not fly elsewhere |
| 00:32 | mmarczyk | dnolen: so if the goal is to make this future proof |
| 00:33 | dnolen | mmarczyk: hmm ... any reason to no make it a protocol? |
| 00:33 | dnolen | mmarczyk: overhead of protocol doesn't matter here now that I think about it. |
| 00:34 | mmarczyk | dnolen: adding .setHashCode is no more extra complexity in code than adding a macro and handling it in -hash |
| 00:35 | mmarczyk | dnolen: the latter approach also let's the DS decide whether it wants to have its hash code cached -- I don't care that much about it (as evidenced by the current patch), but it feels cleaner, so if the code becomes more complex anyway... |
| 00:35 | wkmanire | Howdy folks. |
| 00:36 | muhoo | wkmanire: yo |
| 00:37 | wkmanire | muhoo: Whatchya up to Muhoo? |
| 00:37 | muhoo | doing my newbie thang, is all :-) |
| 00:38 | wkmanire | I got to spend the day hacking javascript. |
| 00:38 | scriptor | how was it? |
| 00:38 | muhoo | is that an improvement over vb? |
| 00:38 | wkmanire | So, much better than usual. |
| 00:38 | wkmanire | Javascrit vies for my #1 spot as favorite language. |
| 00:38 | wkmanire | Javascript* |
| 00:38 | scriptor | interesting |
| 00:38 | scriptor | better than vbscript ;? |
| 00:38 | dnolen | mmarczyk: hmm ICacheHashCode seems enticing, perhaps some interesting uses for perf sensitive applications? |
| 00:39 | spjt | Even the guy who invented javascript thinks it sucks. |
| 00:39 | ben_m | Just have to avoid the not so good parts, then it's a nice language. |
| 00:39 | wkmanire | spjt: His views clash with most of the community. |
| 00:40 | mmarczyk | dnolen: well, it doesn't feel like a public interface to me |
| 00:40 | ivan | wkmanire: tell me where the find JavaScript's repr() or == ;) |
| 00:40 | muhoo | i figured out that if i looked at (comp foo bar baz) as #(foo (bar (baz))) without all the parens, i won't get confused as to its order of operations :-) |
| 00:40 | wkmanire | ivan: where to find? |
| 00:40 | ivan | and which properties you shouldn't put in an object because IE6-8 won't iterate over them |
| 00:41 | spjt | "JS had to 'look like Java' only less so, be Java?s dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JS would have happened" |
| 00:41 | dnolen | mmarczyk: you're probably right, that's why I didn't jump on the current patch :) seems a bit too exposed. |
| 00:41 | ivan | wkmanire: they're pretty useful things to have, in any (?) language |
| 00:41 | mmarczyk | dnolen: hm :-) |
| 00:42 | dnolen | mmarczyk: let's go with each DS doing it's own caching in -hash |
| 00:42 | wkmanire | ivan: Well, you have == and ===. |
| 00:42 | wkmanire | ivan: Coercive and strict/reference comparison. |
| 00:42 | scriptor | kinda like good ole' php |
| 00:42 | mmarczyk | dnolen: cool, ultimately it is probably the cleanest approach conceptually -- clean is good -- will be back with an appropriate patch in a minute |
| 00:43 | wkmanire | You can algorithmically traverse any object tree (that you made yourself)... |
| 00:43 | ivan | I like my [1, 2] == [1, 2] == True |
| 00:43 | ivan | wkmanire: indeed. but a proper equality and repr protocol should really be part of the language, and thankfully it is in ClojureScript |
| 00:44 | scriptor | ivan: isn't that the same in python? |
| 00:44 | wkmanire | ivan: You don't like [object Object]? |
| 00:44 | ivan | scriptor: in JS non-primitives are compared by reference |
| 00:45 | ivan | wkmanire: heh, no |
| 00:45 | scriptor | ah |
| 00:45 | wkmanire | You can always attach a toString implementation to your object. |
| 00:45 | wkmanire | I admit it is a pain in the ass to always do that. |
| 00:45 | ivan | string-based repr protocols are wrong because they involve repeated copying for deeply nested objects |
| 00:46 | ivan | but anyway I solved this in my own library that no one uses :) |
| 00:46 | wkmanire | If you see it as text on your screen then concatenation is happening somewhere. |
| 00:55 | wkmanire | anway, I'm excited to mess with clojure script. |
| 00:55 | wkmanire | I plan to do that as soon as I get through basic HTML form and query CRUD with Noir. |
| 00:56 | muhoo | clojurescript is very exciting |
| 00:57 | mmarczyk | dnolen: I'm leaning towards not having all the types declare a __hash field and just set!-ing it instead when appropriate, which is at initial hash calculation time and whenever with-meta is called; does this seem fine? |
| 00:58 | dnolen | mmarczyk: you can't call set! inside of deftypes |
| 00:59 | dnolen | mmarczyk: unless the field is marked ^:mutable |
| 01:01 | mmarczyk | dnolen: not (set! __hash 1235), (set! this -__hash 1235) |
| 01:01 | mmarczyk | dnolen: which works fine |
| 01:03 | dnolen | mmarczyk: ha! no guarantee that the second one will continue to work. |
| 01:03 | dnolen | mmarczyk: lets make the field explicit. I think that will have to be the case with many hosts. |
| 01:03 | mmarczyk | dnolen: sounds like it's gonna be an explicit __hash field then? :-P |
| 01:04 | mmarczyk | oh, I've been late by a second. |
| 01:04 | jlongster | hey guys, I'm trying to get a basic clojurescript example compiling. I'm doing something basically like this: https://github.com/emezeske/lein-cljsbuild/blob/0.1.8/example-projects/simple/project.clj |
| 01:04 | jlongster | but when I run "lein cljsbuild once", I get nothign |
| 01:04 | jlongster | *nothing |
| 01:07 | emezeske | jlongster: When you say "basically like this", what is different? |
| 01:08 | dnolen | jlongster: "nothing" as in not even "Compiling Clojurescript" ? |
| 01:08 | jlongster | emezeske: my project doesn't have any clojure in it, so it's simpler: http://paste.lisp.org/display/129129 |
| 01:08 | jlongster | dnolen: I see that, but no files are created |
| 01:08 | dnolen | jlongster: does your src file actually end in a .cljs extension and not .clj |
| 01:09 | dnolen | jlongster: I screw that up often. |
| 01:09 | jlongster | dnolen: ah, nope. |
| 01:09 | dnolen | jlongster: dcpu compiler in CLJS I see, exciting! |
| 01:10 | jlongster | dnolen: yep! should be fun! |
| 01:10 | jlongster | I'd like for it to be a long-term project and be based on cljs so it benefits from all you guys' work |
| 01:11 | jlongster | awh, I get a file but now it throws an error |
| 01:12 | jlongster | here's my source: http://paste.lisp.org/display/129129#1 |
| 01:12 | dnolen | jlongster: your Scheme-y ways won't fool the CLJS compiler. |
| 01:12 | jlongster | dnolen: I can fool it with macros, just you watch! |
| 01:13 | dnolen | jlongster: throws an error when? when you try to run? |
| 01:13 | jlongster | "Cannot set property 'Unicode' of undefined" when I just do `node dcpu.js` |
| 01:13 | kovasb | cljsbuild silently fails in my experience |
| 01:13 | dnolen | jlongster: yeah another common error that I need to fix. |
| 01:13 | wkmanire | jlongster: Can you paste the javascript it output? |
| 01:13 | jlongster | good.string is null? |
| 01:14 | wkmanire | I'm curious to see it. |
| 01:14 | jlongster | it's 13000 lines long :/ |
| 01:14 | dnolen | jlongster: if you're targeting node you need to compile w/ :optimizations :simple |
| 01:14 | wkmanire | Seriously? |
| 01:14 | wkmanire | helloworld? |
| 01:14 | wkmanire | :( |
| 01:14 | jlongster | dnolen: ah |
| 01:14 | dnolen | jlongster: well at least :simple, :advanced works too. |
| 01:14 | jlongster | is it not doing dead code elimination? |
| 01:14 | dnolen | jlongster: only :advanced does that. |
| 01:14 | jlongster | oooh, right |
| 01:15 | wkmanire | :advanced will put it through closure compiler's advanced mode if I remember, so there would be nothing for me tos ee. |
| 01:15 | dnolen | jlongster: any particular reason you're dev'ing against node instead of against a browser? |
| 01:15 | wkmanire | to see8 |
| 01:15 | kovasb | jlongster: you can also try to manually invoke the cljs compiler, as shown on the clojurescript wiki |
| 01:15 | wkmanire | Just a bunch of munged shtuff. |
| 01:16 | jlongster | dnolen: it's just a library, I'd like to develop it cli-style with some Makefiles and stuff for a few helpful things |
| 01:16 | jlongster | I think cljs should support that, maybe not quite as focused on it, but still should have some love |
| 01:17 | jlongster | kovasb: that's true, though lein is nice |
| 01:17 | dnolen | jlongster: definitely - there's just not good interactive Node.js support yet is all. |
| 01:17 | dnolen | tho perhaps some folks are workig on that. |
| 01:17 | kovasb | jlongster: yea, i resort to it only when I think errors are happening that are not being shown |
| 01:18 | emezeske | kovasb: If you can make a repro case for silent failures, I'd love to fix that |
| 01:18 | jlongster | dnolen: fwiw, outlet didn't support interactive stuff with node.js yet either, so I was developing it test driven-style, so it should be fine |
| 01:18 | emezeske | kovasb: Never seen it myself, though, so not much I can do. |
| 01:19 | jlongster | dnolen: though it might be worth throwing it in the browser if I feel like interactiveness would help |
| 01:19 | jlongster | I might be interested helping developing some libraries for node interactiveness too |
| 01:20 | dnolen | jlongster: the CLJS test driven style of development could improve as well. |
| 01:20 | kovasb | emezeske: i think it might have to do with stale files; when i remove all the generated stuff it seems to be better |
| 01:20 | jlongster | dnolen: early stages! |
| 01:21 | dnolen | jlongster: way early. |
| 01:21 | kovasb | emezeske: i also tend to run it side by side with cljs-noir, so dunno if there is an interaction there. |
| 01:21 | emezeske | kovasb: What version of the plugin? |
| 01:22 | kovasb | emezeske: i've used several, not sure if I've seen it in the latest |
| 01:22 | kovasb | emezeske: will keep an eye out |
| 01:22 | emezeske | kovasb: Okay, well if you figure out a way to trigger silent errors on demand, I will definitely fix that. |
| 01:23 | kovasb | emezeske: cool |
| 01:24 | dnolen | jlongster: you know about lein cljsbuild auto right? |
| 01:24 | jlongster | dnolen: yep, that's what I'm using, `lein cljsbuild auto` |
| 01:24 | dnolen | jlongster: cool, that saves a lot of time. |
| 01:25 | jlongster | yeah |
| 01:25 | jlongster | although it's been stuck for about 30 seconds now with optimization :simple? |
| 01:25 | jlongster | oh, does "auto" make it stay alive? |
| 01:26 | jlongster | oh, nevermind, there we go |
| 01:30 | dnolen | 30s is really long, I think the release version of CLJS may have mem leak that I recently fixed. |
| 01:32 | jlongster | dnolen: gotcha. it seems to be compiling faster once cljsbuild boots up (with the auto mode) |
| 01:32 | charles_r | Having trouble getting java into my code. Can anyone help me with this? |
| 01:32 | yoklov | jlongster: i had that issue too, its totally fixed in newer releases |
| 01:32 | dnolen | jlongster: actually I'm wrong, current release came out before my foobar. |
| 01:33 | jlongster | dnolen: yoklov: I installed lein through homebrew and then cljsbuild through lein, I have no idea if that's up-to-date or not |
| 01:35 | emezeske | jlongster: You want :plugins [[lein-cljsbuild "0.1.8"]] in your project.clj file. If that's there, you're good. |
| 01:35 | jlongster | emezeske: cool, got that |
| 01:36 | jlongster | for some reason it's the "auto" mode that seems slow, not sure. just using "once", it seems to build it in 10 seconds |
| 01:37 | emezeske | jlongster: And how long in auto mode? |
| 01:38 | jlongster | emezeske: it never finished :/ indicative of some kind of loop or blocked thread? |
| 01:38 | dnolen | jlongster: does it get slower over time? |
| 01:38 | emezeske | jlongster: Never finished? Have you tried saving a file? |
| 01:38 | emezeske | jlongster: It won't do anything if the target is up to date |
| 01:38 | jlongster | dnolen: haven't watched it long enough to see |
| 01:38 | dnolen | jlongster: I mean, did it successfully build a few times? |
| 01:39 | jlongster | emezeske: dnolen: ah, I didn't realized it stayed alive and kept recompiling, and I had to save the file after running it. it seems normal now! |
| 01:39 | jlongster | and compiles much faster on subsequent compilations |
| 01:39 | jlongster | from 10s to ~3s |
| 01:39 | dnolen | jlongster: heh yes :) |
| 01:40 | jlongster | neat |
| 01:40 | emezeske | ^_^ |
| 01:40 | jlongster | thanks guys |
| 01:40 | jlongster | awh, I get no output though when running the script with node |
| 01:40 | jlongster | maybe I'll solve that later |
| 01:41 | dnolen | jlongster: paste? |
| 01:41 | jlongster | dnolen: same as before: http://paste.lisp.org/display/129129#1 |
| 01:41 | KognizantKog | jlongster: Sorry, just showed up, but I am curious as to what you are working on currently? I used to follow your scheme on iphone blog posts. |
| 01:42 | arohner | is there a hiccup-like thing for XML? |
| 01:43 | jlongster | KognizantKog: oh hai! glad to here that! Currently hacking on a static Lisp that compiles everything out to optimized assembly code :) |
| 01:43 | jlongster | KognizantKog: think GOAL, currently targeting DCPU-16 for the new Mojang game |
| 01:43 | KognizantKog | Oh, very cool! |
| 01:43 | jlongster | https://github.com/jlongster/dcpu-lisp |
| 01:44 | jlongster | yeah, it's nice, I'd like to high computation stuff for games some day |
| 01:46 | dnolen | jlongster: did you set :target :nodejs in your project.clj :cjlsbuild :compiler settings? |
| 01:47 | jlongster | dnolen: I had not! trying that now |
| 01:47 | dnolen | jlongster: just tried it seems to work. |
| 01:48 | KognizantKog | I'd like it if you did that, as well. Lol. And I've been seeing a lot of articles dealing with DCPU-16, but all I really know is that notch designed a CPU and assembly language for an upcoming game. Why is everyone so excited about writing compilers for it (genuine curiosity)? |
| 01:49 | jlongster | KognizantKog: it's fun to hack on stuff with such a vibrant community, and Notch has a good reputation for succeeded in his ideas which will be an awesome game, and the earlier we build stuff for it the better |
| 01:49 | jlongster | *succeeding |
| 01:51 | jlongster | dnolen: it works now, thanks! |
| 01:51 | jlongster | out of curiousity, what makes subsequent builds so much faster? |
| 01:51 | dnolen | jlongster: jvm warmup time mostly. |
| 01:51 | KognizantKog | Gotcha. Just wondering. I've never played minecraft (mostly because I live in an area where the best I can do it satellite internet, and that isn't good enough), but I know his reputation, so I can understand. |
| 01:52 | dnolen | jlongster: er, that and files that haven't changed don't recompiled. |
| 01:52 | dnolen | don't get. |
| 01:52 | jlongster | dnolen: damn, really? yeah, this is just one file, so must be the jvm |
| 01:52 | dnolen | jlongster: and 4000 lines of core.cljs |
| 01:53 | jlongster | oh, true |
| 01:53 | jlongster | it takes Outlet about 12 seconds to compile dcpu-lisp right now anyway, heh |
| 01:53 | jlongster | unfortunately, it's not a constant warmup time, it's just slow |
| 01:53 | jlongster | but the live compiling is nice |
| 01:54 | jlongster | (in cljs that is) |
| 01:56 | jlongster | thanks for the help guys, I'll save my language-specific questions for tomorrow :) |
| 02:17 | photex | hi folks, what am I misunderstanding, when the namespace of a static method gets stripped during macro expansion? |
| 02:18 | photex | so, in my macro I have System/getenv |
| 02:18 | photex | but after expansion it's just getenv |
| 02:25 | tomoj | are you using emacs' macroexpansion? |
| 02:25 | photex | yeah |
| 02:25 | photex | and I'm trying to compile with slime |
| 02:26 | photex | C-c C-c |
| 02:26 | tomoj | ,(macroexpand-1 '(foo (System/getenv))) |
| 02:26 | _KY_ | Is it good practice to modify a def variable with a new binding? |
| 02:26 | clojurebot | (foo (System/getenv)) |
| 02:26 | tomoj | slime is just lying to you |
| 02:26 | photex | thanks tomoj |
| 02:27 | tomoj | it tries to remove namespaces so you don't wind up with stuff like this |
| 02:27 | tomoj | ,`(+ 1 2) |
| 02:27 | clojurebot | (clojure.core/+ 1 2) |
| 02:27 | tomoj | because that can be very hard to read |
| 02:27 | tomoj | unfortunately it removes too much... |
| 02:28 | _KY_ | I'm trying to modify a hash-map... |
| 02:30 | photex | I see |
| 02:31 | _KY_ | I can use merge but how can I change the original def'ed variable? |
| 02:35 | yoklov | _KY_: you should try to avoid mutation |
| 02:35 | _KY_ | But it's a large data structure... |
| 02:35 | yoklov | if that was your question |
| 02:36 | yoklov | so? |
| 02:36 | _KY_ | I just want to grow a hash-map |
| 02:36 | _KY_ | That's how they are supposed to be used, right? |
| 02:36 | yoklov | you want to add/remove a value? |
| 02:36 | yoklov | you can get a new one with that change |
| 02:36 | _KY_ | Yeah |
| 02:37 | yoklov | if you want a mutable variable you can use a reference type |
| 02:37 | _KY_ | But what if I want to refer to the new one globally? |
| 02:37 | _KY_ | Instead of passing it around among functions |
| 02:38 | yoklov | (def foo (atom {})) |
| 02:38 | yoklov | (swap! foo assoc :baz 1) |
| 02:38 | yoklov | or use refs if you're messing with threads |
| 02:39 | yoklov | i guess. if thats the case you might know about the issue than i. |
| 02:39 | tomoj | you likely need neither refs nor atoms |
| 02:40 | yoklov | i usually end up having at least one piece of state |
| 02:40 | yoklov | essentially always |
| 02:40 | _KY_ | tomoj: what should I use? |
| 02:41 | tomoj | impossible to tell without more detail |
| 02:41 | yoklov | _KY_: he means you should thread the value through your computation |
| 02:41 | yoklov | probably |
| 02:42 | yoklov | instead of ever actually changing its value, update it over time |
| 02:42 | _KY_ | Lets say I (def myhash (hash-map :a one :but 2)) |
| 02:42 | _KY_ | Lets say I (def myhash (hash-map :a 1 :b 2)) |
| 02:42 | _KY_ | But then I added some more elements to the hash |
| 02:42 | _KY_ | I want to be able to use the new hashmap globally |
| 02:43 | _KY_ | It seems to be more intuitive |
| 02:43 | yoklov | _KY_: global mutable state is probably not good |
| 02:43 | yoklov | why don't you try passing the value into a function |
| 02:43 | _KY_ | Not good because of threads? |
| 02:44 | yoklov | Not good either way. Especially terrible if you have threads |
| 02:44 | yoklov | Not good because of high coupling |
| 02:45 | _KY_ | I may use refs then |
| 02:46 | yoklov | do you have threads? |
| 02:46 | yoklov | atoms are still thread safe, but use refs if you want it to be synchronous |
| 02:46 | yoklov | err |
| 02:46 | yoklov | coordinated |
| 02:46 | tomoj | if you want good advice you need to give more detail about what you're actually trying to do |
| 02:46 | _KY_ | I may use threads in the future....' |
| 02:47 | _KY_ | The hash-map is just a data store |
| 02:47 | _KY_ | And I expect it would be used globally by various functions |
| 02:47 | yoklov | _KY_: atoms are still thread safe, but if you are going to care about the order of the updates, i think. |
| 02:47 | _KY_ | It's like a small-scale database |
| 02:48 | yoklov | *err you use refs, i think |
| 02:48 | tomoj | if you really need an in-memory key/value store it may make sense to use a hashmap inside an atom |
| 02:49 | _KY_ | What's difference between atom and refs? |
| 02:49 | tomoj | use refs when you have more than one object across which to coordinate 'changes' |
| 02:49 | tomoj | like a bunch of hash-maps instead of just one |
| 02:50 | _KY_ | The order of update may not matter that much for my use-case |
| 02:50 | _KY_ | IE, things can happen asynchronously |
| 02:51 | tomoj | (set db k v) is (swap! db assoc k v) and (get db k) is (@db k) |
| 02:51 | _KY_ | I see.... |
| 02:51 | espeed | Hi, this will print the sequence all on one line: (-> (generate-seq) println) -- how would you modify that so that it prints each item in the sequence? |
| 02:52 | tomoj | get rid of the arrow, use doseq |
| 02:52 | yoklov | (->> (generate-seq) (map println) doall) |
| 02:52 | espeed | I'm trying to learn how to use the Thrush op |
| 02:52 | _KY_ | What does the arrow do? |
| 02:53 | yoklov | espeed: ->> is the same as -> but with the last element |
| 02:53 | espeed | yoklov: will it not work with -> ? |
| 02:54 | yoklov | espeed: yeah because it would end up as (doall (map (generate-seq) println)) |
| 02:54 | yoklov | and map wants the seq as the 2nd arg |
| 02:55 | yoklov | ,(macroexpand '(-> (generate-seq) (map println) doall)) |
| 02:55 | clojurebot | (doall (clojure.core/-> (generate-seq) (map println))) |
| 02:55 | yoklov | ,(macroexpand '(->> (generate-seq) (map println) doall)) |
| 02:55 | clojurebot | (doall (clojure.core/->> (generate-seq) (map println))) |
| 02:56 | yoklov | err |
| 02:57 | yoklov | ,(require 'clojure.pprint) |
| 02:57 | clojurebot | nil |
| 02:57 | yoklov | ,(clojure.pprint/macroexpand-all '(-> (generate-seq) (map println) doall)) |
| 02:57 | clojurebot | #<CompilerException java.lang.RuntimeException: No such var: clojure.pprint/macroexpand-all, compiling:(NO_SOURCE_PATH:0)> |
| 02:57 | yoklov | hm. |
| 02:57 | yoklov | whatever i'm out |
| 02:58 | espeed | yoklov: thanks. |
| 03:06 | _KY_ | I can't find the reference to ->, what is it? |
| 03:06 | ben_m | ,(doc ->) |
| 03:07 | clojurebot | "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 03:13 | espeed | -> is sometimes called the Thrush macro |
| 03:17 | tomoj | ,(do (require 'clojure.tools.macro) (clojure.tools.macro/mexpand-all '(-> (generate-seq) (map println) doall))) |
| 03:18 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.tools.macro> |
| 03:25 | _KY_ | Thanks=) |
| 03:26 | fooblya_monad | How do you exit from lein repl in Windows? :) |
| 03:36 | muhoo | reboot? :-) |
| 04:22 | kral | namaste |
| 04:48 | Joe___ | hey, how do I add third-path libraries to my clojure? |
| 04:50 | clgv | Joe___: you should be using leiningen and then you can add them to the :dependencies |
| 04:50 | Joe___ | thanks, clgv |
| 04:51 | clgv | Joe___: "lein deps" will then fetch the dependencies for you |
| 04:51 | AWizzArd | If you use Leiningen 2 then you don’t even need to run “lein deps”. |
| 04:54 | clgv | didnt know that yet. |
| 05:08 | espeed | In my project.clj file I have :main myproj.core so it executes when I do lein run. Say you have another file in your project that you want to execute with lein, how do you do that? |
| 05:09 | clgv | espeed: you can use "lein repl" and switch to that namespace |
| 05:10 | espeed | but what if you just want to run it in the console? |
| 05:11 | clgv | espeed: you want to run the content of the namespace standalone? |
| 05:12 | clgv | espeed: in that case: I read an announcement of the "lein exec" plugin |
| 05:12 | clgv | that could fit |
| 05:13 | espeed | yes. I think I just found it -- you add an alias to the namespace in project.clj -- :something some.namespace |
| 05:13 | espeed | and then do "lein run :something" |
| 05:17 | ben_m | You can just do lein run -m namespace |
| 05:19 | espeed | thanks ben_m |
| 05:19 | ben_m | np :) |
| 05:19 | ben_m | lein help run for more details |
| 05:42 | AWizzArd | How can I add [criterium "0.2.1-SNAPSHOT"] as a dev dependency for every project with Leiningen 2? I tried to add it in my profiles.clj under :dev {:dependencies […]}, but under “lein pprint” it then doesn’t show up, and isn’t available via “lein swank”. Adding it to my :user {:dependencies […]} works, but it then also goes into my Überjar, which I don’t want. |
| 05:44 | tomoj | do you only use criterium from the repl? |
| 05:47 | AWizzArd | tomoj: I have several more libs that I want to use a dev deps in every project. |
| 05:48 | tomoj | and you only use them all from the repl? |
| 05:48 | AWizzArd | Over seven, and I don’t want to add them manually to every single project. |
| 05:48 | AWizzArd | Yes, only for the repl. But sometimes I decide lateron that I want some in my project. Then I move them of course into the project.clj file. |
| 05:48 | tomoj | right, well, dunno. |
| 06:06 | ivan | strings with backslashes are not simple |
| 06:06 | Borkdude | I have a noir website which I "lein uberjarred". java -jar uberjarfile.jar works great, but only when I run it from the project's directory |
| 06:06 | Borkdude | what could be wrong? |
| 06:11 | fliebel | Borkdude: what does it do when tie does not run? |
| 06:11 | Borkdude | fliebel: tie? |
| 06:11 | fliebel | it |
| 06:11 | Borkdude | maybe it is this issue: http://groups.google.com/group/clj-noir/browse_thread/thread/cdd5449cd344d964/ec45996748d8da67?show_docid=ec45996748d8da67&pli=1 |
| 06:12 | Borkdude | fliebel: then it doesn't do anything? |
| 06:12 | fliebel | Borkdude: Not even a stack trace? |
| 06:13 | Borkdude | fliebel: I don't understand. when I don't run it, the webserver is not running |
| 06:15 | fliebel | Borkdude: Well, if you leave the jar inside the project it works, and starts a server, but when you take the jar somewhere else, and run it, what happens? It just sits there? |
| 06:15 | Borkdude | fliebel: the web server starts and noir comes with an error message: "we lost that one" |
| 06:16 | Borkdude | very informative :) |
| 06:17 | fliebel | Borkdude: git clone gh.com/noir; grep -r "we lost that one" . |
| 06:18 | kab3wm | Borkdude: I'm working on a noir project right now.. give me a sec, I'll test mine like you did. |
| 06:20 | Borkdude | kab3wm: I moved the uberjar from a mac machine to a windows machine and then tested it |
| 06:20 | Borkdude | kab3wm: but it doesn't even work when I run it from another directory on my mac |
| 06:20 | kab3wm | ok, I'm going to test the second scenario.. |
| 06:21 | Borkdude | kab3wm: when I unzip the jar I see all the resources are there |
| 06:24 | Borkdude | kab3wm: when I change the (server/load-views …) to a static require, it works now on my mac |
| 06:27 | Borkdude | kab3wm: fliebel: great, works on windows now too |
| 06:27 | kab3wm | lol.. sounds like a bug. mines still compiling. |
| 06:28 | Borkdude | kab3wm: yes, weird |
| 06:32 | Borkdude | kab3wm: how is it going now? |
| 06:34 | kab3wm | Borkdude: still compiling.. seems unusually long. |
| 07:05 | muhoo | any good advice for a nice format for documenting a REST api? |
| 07:16 | vijaykiran | muhoo: http://swagger.wordnik.com/ looks good |
| 07:16 | vijaykiran | but I think it is for JAX-RS/Java stuff |
| 07:17 | vijaykiran | would be nice to have a clojure version of it though |
| 07:31 | tomoj | https://gist.github.com/412667882bd834a455ec |
| 07:31 | tomoj | anything missing? |
| 07:31 | tomoj | emacs or paredit or clojure-mode or whatever |
| 07:36 | groundnuty | hey, are there any clojure based frameworks? like groovy has grail and griffon |
| 07:40 | vijaykiran | groundnuty: web-app frameworks ? |
| 07:40 | vijaykiran | there's noir |
| 07:41 | groundnuty | vijaykiran: I just googled a few. I guess I wanted to ask you guys for recomendations. Grails seems quite mature - anything liket that? |
| 07:44 | G0SUB | groundnuty, Clojure has libraries, frameworks, not so much. |
| 07:55 | vijaykiran | groundnuty: clojure way of doing it would be pick-your-own-libs to build a framework |
| 07:56 | cmiles74 | whois tmciver |
| 07:56 | vijaykiran | noir does it for you - with ring/compojure/hiccup etc. |
| 08:43 | RickInGA | Uncle Bob is backing light table https://twitter.com/#!/unclebobmartin/status/194701465980383232 |
| 08:54 | Borkdude | groundnuty: frameworks? noooooooo.. libraries |
| 08:56 | clgv | hairsplitting :P |
| 09:10 | beffbernard | In what situations would one use hiccup.def/defelem over noir.core/defpartial? |
| 09:11 | RickInGA | beffbernard: defpartial is used for combining elements that you use together… for example add and edit forms for the same data will have a lot of fields in common |
| 09:14 | beffbernard | RickInGA: it also returns a string instead of a vector |
| 09:15 | RickInGA | beffbernard: I haven't used defelm, but if it does have similar behavior, remember you can use hiccup without noir |
| 09:15 | xumingmingv | a silly question, what's the coding style for clojure's parenthesis? |
| 09:15 | xumingmingv | when there are too many levels of parenthesis |
| 09:15 | RickInGA | xumingmingv: you mean an indentation style? |
| 09:15 | xumingmingv | yes |
| 09:16 | xumingmingv | when should be seperate several parenthesis into several line |
| 09:16 | xumingmingv | e.g.https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/daemon/task.clj#L107 |
| 09:16 | xumingmingv | all in one line |
| 09:17 | xumingmingv | e.g.https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/daemon/task.clj#L126-L127 |
| 09:17 | xumingmingv | in two lines |
| 09:17 | xumingmingv | is there a rule for this? |
| 09:18 | xeqi | all in one line |
| 09:18 | RickInGA | xumingmingv: no hard rule, generally you don't want lines to grow too long because people tend to work in small console windows |
| 09:19 | RickInGA | xumingmingv: generally the best place to break is at a new open parens, and tabbed over a couple of spaces to show that it is related |
| 09:20 | beffbernard | I leave my closing parens all on my last line of code but having a mode like paredit-mode makes you forget about the matching closing paren |
| 09:20 | xumingmingv | oh, i actually mean the right part of "()" -> ")", when there are too many levels, it becomes hard to tell which matches which, for example ")))))", when should be seperate it into "))" |
| 09:21 | RickInGA | xumingmingv: I don't put closing parens on a separate line, but the code you posted does, and I am not going to say that nathanmarz is doing it wrong! |
| 09:21 | S11001001 | I don't know anything about nathanmarz, but broadly, the rule is all on one line, no matter how many there are. |
| 09:22 | RickInGA | xumingmingv: I don't really worry about closing parens, but that might be because I use paredit, which keeps my parens matched. If I didn't have a tool like that, I may be tempted to start lining them up |
| 09:25 | xumingmingv | haha, yeah, i just feel difficult when i need to tell which right-parenthesis matches its left. So the general rule is keeping all the closing parenthesis in one line? |
| 09:29 | S11001001 | xumingmingv: Aye. I don't think paredit is a prerequisite for getting it right, but editor highlighting definitely is |
| 09:30 | S11001001 | as for picking out structure, the idea is to use indentation rather than counting parens to figure out code structure |
| 09:30 | S11001001 | I would call knowing how to indent lisp an editor prerequisite too |
| 09:31 | xumingmingv | thanks S11001001 RickInGA beffbernard |
| 09:35 | rmrfchik | errr, looking for Meikel Brandmeyer (VimClojure author). email on vim.sf.net is wrong |
| 09:38 | noidi | rmrfchik, his homepage's contact button links to mailto:mb@kotka.de |
| 09:40 | rmrfchik | noidi: thanks! |
| 09:40 | rmrfchik | noidi: and what homepage address is...? |
| 09:49 | Borkdude | ouch… from twitter: i love how #clojure ’s official news feed is a blogger site that hasn’t been updated since 2010 |
| 09:49 | Borkdude | maybe just delete that blogger site ;-) |
| 09:49 | Borkdude | or is it immutable? |
| 09:49 | solussd_ | Noir question: is :as valid syntax in the destructuring form of a defpage? |
| 09:55 | Borkdude | or wait, in the history of lisp 1.5 year is almost nothing |
| 09:55 | Borkdude | solussd: yes, I think so |
| 09:56 | solussd_ | hmm.. I'm getting the error: "Routes must either be a string or vector, not a class clojure.lang.PersistentArrayMap" |
| 09:57 | solussd_ | with something of the form (defpage [:get "/somewhere"] {:keys [a b c] :as all} ..) |
| 09:57 | Borkdude | solussd: I'm working on something that looks like this: (defpage [:post "/"] {:as button-pressed} |
| 09:57 | solussd_ | ill try that |
| 09:59 | hugod | AWizzArd: I think you want to add criterium to your :user profile in ~/.lein/profiles.clj |
| 09:59 | mmarczyk | dnolen: I think I might have run into a compiler bug while working on the hash caching ticket, so it'll take a while longer while I produce a fix |
| 10:00 | hugod | AWizzArd: And I just released criterium 0.2.1 |
| 10:00 | mmarczyk | dnolen: in the meantime, I've run into a couple smaller issues while going through the code making changes, there's a patch ready on http://dev.clojure.org/jira/browse/CLJS-201 -- includes at least one serious bug fix |
| 10:02 | AWizzArd | hugod: I also had it in my :user {:dependencies […]}. It is not so much about Criterium (which I want to use). I could put in anything else there. This seems to be a Leiningen issue. Leiningen 2 treats the entries in my profiles.clj as project dependencies, not as dev dependencies. |
| 10:02 | AWizzArd | That means it will include them in my Überjar too. |
| 10:02 | hugod | that seems like a bug in lein2 |
| 10:02 | AWizzArd | Only because I used a snapshot version of Criterium I noticed this, because when I wanted to make an Überjar, Leiningen suddenly complained. |
| 10:03 | AWizzArd | hugod: yes, probably a bug in L2. I already filed an Issue in the tracker for this. |
| 10:05 | noidi | rmrfchik, http://kotka.de/ |
| 10:29 | Borkdude | what is the kind of "map" fn you use if you're only interested in side effects? doseq? |
| 10:30 | AWizzArd | Borkdude: yes |
| 10:30 | bsteuber | Borkdude: or (dorun (map ...)) |
| 10:30 | Borkdude | I see, I don't really need a binding, this is why I doubted if doseq was "the way" |
| 10:31 | Borkdude | tnx |
| 10:31 | bsteuber | yes if the function already exists dorun + map might be prettier |
| 10:31 | bsteuber | otherwise doseq is the common way |
| 10:32 | Borkdude | for readability it is nice to have the binding though |
| 10:32 | mmarczyk | doseq avoids constructing a seq |
| 10:33 | AWizzArd | Borkdude: so your side effects actually have nothing to do with the sequence over which you want to map a function? |
| 10:33 | AWizzArd | Maybe repeatedly could then be useful for you too. |
| 10:34 | Borkdude | AWizzArd: no, the side effects have something to do, but I don't need to name the element I want to "map" over in a binding |
| 10:34 | dnolen | more JS->CLJS synonyms http://himera.herokuapp.com/synonym.html |
| 10:35 | Borkdude | AWizzArd: to illustrate what I'm trying to do: https://gist.github.com/2480095 |
| 10:35 | AWizzArd | Borkdude: in this example you have two doseqs, which both make use of the binding |
| 10:36 | AWizzArd | Looks pretty good to me. |
| 10:36 | Borkdude | AWizzArd: yes, but I could avoid it by using (dorun (map …)) but this reads easier I think |
| 10:36 | AWizzArd | Borkdude: can you show this example with dorun+map? |
| 10:39 | Borkdude | AWizzArd: added below, at least avoided one doseq |
| 10:40 | AWizzArd | Hmm, both look good to me. |
| 10:40 | mmarczyk | Borkdude: why do you want to avoid a doseq though? it is the more efficient solution |
| 10:40 | AWizzArd | I personally would use doseq here, but this is just a matter of taste. |
| 10:40 | mmarczyk | Borkdude: and it's hardly less legible |
| 10:42 | Borkdude | AWizzArd: another one added blow |
| 10:42 | Borkdude | below |
| 10:42 | Borkdude | mmarczyk: you're right and I find doseq even more legible here |
| 10:43 | mmarczyk | ok |
| 10:43 | Borkdude | would maybe be a nice refactoring option for "a future IDE": turn (dorun (map …)) into (doseq […] …) and vice versa ;-) |
| 10:44 | mmarczyk | well, it is *the* most efficient solution, in fact, since a handwritten loop/recur is unlikely to take chunking into account like doseq does |
| 10:45 | gfredericks | Borkdude: kibit could catch that |
| 10:46 | Borkdude | gfredericks: cool, never toyed with that |
| 10:46 | gfredericks | me neither |
| 10:47 | mmarczyk | oh, interesting! |
| 10:49 | Borkdude | I wonder what logic programming has to do with.. refactoring.. but I guess I have to find this out |
| 10:50 | gfredericks | I imagine it lets you describe the refactoring possibilities declaratively |
| 11:00 | laurus | How can I understand the function from _The Joy of Clojure_ at http://cljbin.com/paste/4f96bdf2e4b0b761a9752e81 ? |
| 11:01 | S11001001 | laurus: uh, er, how about trying it out with some different values, and then maybe walking through the function with an imaginary value, imagining what happens at each step? |
| 11:02 | laurus | S11001001, I'm trying to do that, but somehow it's difficult. |
| 11:02 | Borkdude | laurus: from what I see, it returns the position of key (in the case of a map) of an element in a collection |
| 11:02 | augustl | do the dots in namespace names have any meaning, or is it just a naming convention? Can I for example dynamically get all "sub" namespaces of com.mything? I.e. com.mything.foo, com.mything.bar. |
| 11:03 | noidi | laurus, the code samples in JoC are far from obvious, but it's very enlightening to take the time to work them out |
| 11:04 | TimMc | augustl: Well, I guess you could go through java.lang.reflect with Packages... |
| 11:04 | laurus | noidi, ok. Maybe I just need to go "deeper" into it. |
| 11:04 | Borkdude | laurus: http://cljbin.com/paste/4f96bf09e4b0b761a9752e84 |
| 11:04 | augustl | TimMc: it seems like the namespaces aren't stored in a structured map based on the dots, or something like that |
| 11:04 | S11001001 | laurus: you can also try out pieces of the code to break it down. Trying out that cmp separately should be enlightening |
| 11:04 | augustl | guess I could also iterate (all-ns) and see if the name starts with com.mything |
| 11:06 | Borkdude | nice thing, this cljbin… no information about the author etc? |
| 11:06 | augustl | what I'm actually trying to do: Load all files in a folder and assume they have a public var "pages", and use those pages vars in my program. Perhaps that's a bad idea |
| 11:06 | augustl | just seems less magical than a singleton atom or something like that |
| 11:06 | Borkdude | I have a suspicion who made it ;) |
| 11:07 | laurus | Thanks! |
| 11:07 | mmarczyk | Borkdude: there's GitHub link on the page |
| 11:07 | Borkdude | mmarczyk: ah, of course. I thought it meant, it stored the source of the paste on github… stupid me ;) |
| 11:08 | mmarczyk | :-) |
| 11:09 | Borkdude | that would make sense I guess, use github as a storage for the source but evaluate it somewhere else |
| 11:25 | mwillhite | I'm having a noob issue: trying to access a def binding from another file |
| 11:26 | mwillhite | I require the other file as foo.bar.templates |
| 11:26 | mwillhite | the def is called "templates" |
| 11:27 | mwillhite | in the other file, when I try to call "templates" in my core.clj it can't find it |
| 11:27 | gfredericks | foo.bar.templates/templates then? |
| 11:28 | mwillhite | nice thanks :) |
| 11:47 | timvisher | hey all |
| 11:48 | timvisher | did stu's work with repl reflection ever go anywhere. i think he talked about it at the end of his simple ain't easy talk, perhaps? |
| 12:14 | mmarczyk | dnolen: ping? |
| 12:14 | dnolen | mmarczyk: pong |
| 12:14 | mmarczyk | hi |
| 12:15 | mmarczyk | got a minute to look at CLJS-201 ? |
| 12:15 | mmarczyk | includes a major bugfix for PTM |
| 12:16 | laurus | What does this impenetrable sentence mean? "As shown, we’re still using type-based predicates, but we’ve raised the level of abstraction to the equality partitions in order to build contextually relevant indices." |
| 12:16 | mmarczyk | (CLJS-200 -- hash caching -- is ready too, though as of now w/o support for defrecords -- coming soon) |
| 12:17 | RickInGA | laurus what is that from? |
| 12:17 | laurus | RickInGA, _The Joy of Clojure_. |
| 12:18 | mmarczyk | laurus: without knowing the relevant passage I'd guess maybe it's about ifn? / map? / etc. abstractions being checked for (as opposed to concrete types) |
| 12:18 | mmarczyk | laurus: page number for context? |
| 12:19 | dnolen | mmarczyk: resolved, will have to look at the other ticket later, thx. |
| 12:19 | laurus | mmarczyk, 102. |
| 12:19 | mmarczyk | dnolen: cool, thanks! |
| 12:22 | pandeiro | laurus: he's saying that now the type checking is happening over the equality partitions instead of just somewhat randomly |
| 12:22 | pandeiro | i just re-read that chapter |
| 12:22 | laurus | What is an "equality partition"? |
| 12:22 | pandeiro | different kinds of sequences that will be equal to each other or not |
| 12:23 | RickInGA | dnolen: the synonyms page looks great! |
| 12:23 | dnolen | RickInGA: thanks |
| 12:23 | antares_ | cemerick: your url lib deals with constructing URLs, right? or parsing them, too? |
| 12:23 | pandeiro | did you do a synonyms like the dart link? |
| 12:23 | pandeiro | (dnolen) |
| 12:24 | cemerick | antares_: all parsing is passed off to java.net.URL, with all the caveats that that implies |
| 12:24 | pandeiro | oh nice found it |
| 12:24 | cemerick | Really, it just provides strings -> record -> string round-tripping. |
| 12:24 | TimMc | laurus: Last table on this page: http://www.brainonfire.net/files/seqs-and-colls/main.html |
| 12:25 | antares_ | cemerick: ok. I am working on a forgiving URL/URI parser in Java (well, Ragel that will generate Java). Do you think I should try making it a standalone library and not part of Urly? |
| 12:25 | laurus | TimMc, ah, that's what it's talking about. Thanks! |
| 12:25 | cemerick | antares_: That's up to you :-) |
| 12:25 | laurus | Also thanks, pandeiro. |
| 12:25 | cemerick | URL/URI parsing sounds like something I wouldn't want to touch with a 10-foot pole. |
| 12:25 | antares_ | cemerick: if it's a standalone lib, url could reuse it. If it is part of Urly, then no. |
| 12:26 | Hali_303 | hi! is there a utility function that takes x and if x is a seq then returns it unchanged if x is a non-seq, it wraps it in a seq? |
| 12:26 | antares_ | cemerick: but maybe you just never had problems with java.net.URL. If you don't parse URLs found on the web, I definitely can see why the JDK parser is good enough. |
| 12:26 | cemerick | antares_: Many things may want to reuse it. To be clear, I'm never consuming URLs from outside sources, so my use cases are a lot narrower than yours I suspect. |
| 12:26 | TimMc | Hali_303: So (range) -> (range) but 5 -> (cons 5 nil)? |
| 12:26 | cemerick | yeah |
| 12:26 | RickInGA | ibdknox: did you see Uncle Bob's tweets about Light Table? |
| 12:27 | antares_ | cemerick: understood. Ok, I will try making it a standalone lib. |
| 12:27 | cemerick | antares_: so, most of my url lib usage is input to clj-http, etc. |
| 12:27 | Hali_303 | TimMc: yes |
| 12:27 | cemerick | i.e. to drive rest API access, etc |
| 12:27 | TimMc | Hali_303: And you're certain that you'll never be passed a seq as a data element? |
| 12:28 | Hali_303 | TimMc: ? |
| 12:28 | TimMc | But no, not that I know of. |
| 12:28 | Hali_303 | i see, thanks! |
| 12:28 | TimMc | Hali_303: How will you handle nil? |
| 12:28 | gfredericks | (flatland.useful.fn/fix foo seq? list) |
| 12:29 | gfredericks | s/flatland.// |
| 12:29 | pandeiro | ok how do i discover a java class's methods at the repl again? there's a better way than (seq (class ...)) ? something more readable? |
| 12:29 | pandeiro | err forgot the .getMethods in the middle |
| 12:30 | gfredericks | readable code or readable output? |
| 12:30 | pandeiro | just for inspecting at the repl, so output i guess |
| 12:31 | gfredericks | (->> x class .getMethods seq (map (memfn getName))) maybe? |
| 12:31 | gfredericks | maybe add sort at the end for good measure |
| 12:31 | pandeiro | gfredericks: cool, thanks... i thought there might be a shorthand for something similar |
| 12:31 | laurus | I don't understand the function here (also from _The Joy of Clojure_): http://cljbin.com/paste/4f96d335e4b0b761a9752e86 . I don't understand how i is set to v, since v is not defined before the for. |
| 12:31 | gfredericks | not that I know of |
| 12:32 | gfredericks | laurus: for is list comprehension |
| 12:32 | gfredericks | so (index coll) is expected to return a seq of pairs |
| 12:33 | gfredericks | and for each one i will be bound to the first element of the pair and v to the second |
| 12:33 | laurus | gfredericks, yes, but how can it loop over i if i is set to v but v is undefined? |
| 12:33 | gfredericks | laurus: it is equivalent to (for [pair (index coll)] (let [[i v] pair] ...)) |
| 12:33 | gfredericks | at least if we ignore the :when clause |
| 12:34 | gfredericks | laurus: do you understand what (let [[x y] foo] ...) does? |
| 12:34 | laurus | gfredericks, yes |
| 12:34 | gfredericks | okay; I'm not sure what you mean by "loop over i" and "i is set to v" |
| 12:35 | Borkdude | laurus: does the term destructuring ring any bells? |
| 12:35 | gfredericks | &(for [[k v] {:foo "jams" 12 15}] (str "I have a " k " and a " v)) |
| 12:35 | lazybot | ⇒ ("I have a :foo and a jams" "I have a 12 and a 15") |
| 12:35 | laurus | Borkdude, oh, I had forgotten about that :P |
| 12:35 | clojurebot | :negative/num-1 + :positive/num-1 = :zero/zero |
| 12:36 | gfredericks | clojurebot: what the heck are you talking about? |
| 12:36 | clojurebot | Leiningen's "checkout dependencies" feature (see the README) allows you to override a declared dependency with a local copy symlinked inside the ./checkouts dir. |
| 12:37 | exupero | I'm trying to do `lein run` on a Noir project and it dies with: lein: line 292: 4890 Killed $RLWRAP $LEIN_JAVA_CMD -Xbootclasspath/a:"$CLOJURE_JAR" -client $LEIN_JVM_OPTS -XX:+TieredCompilation -Dleiningen.original.pwd="$ORIGINAL_PWD" -Dleiningen.trampoline-file=$TRAMPOLINE_FILE -cp "$CLASSPATH" $JLINE clojure.main -e "(use 'leiningen.core)(-main)" $NULL_DEVICE "$@" |
| 12:37 | exupero | Any ideas why? |
| 12:45 | laurus | Ah, I get it. |
| 12:53 | antares_ | what repository Clojure 1.5-SNAPSHOTs are published to? |
| 12:54 | antares_ | oss.sonatype.org: https://oss.sonatype.org/index.html#nexus-search;classname~Clojure |
| 12:56 | ibdknox | RickInGA: yeah :) He's one of the 1k backers! |
| 12:57 | RickInGA | ibdknox: nice, but his endorsement should help even more |
| 12:57 | AimHere | antares > clojure/clojure on github, I reckon |
| 12:57 | AimHere | If you're willing to use git to fetch your snapshots, at least |
| 12:57 | RickInGA | ibdknox gratz on crossing 50% |
| 12:58 | ibdknox | RickInGA: thanks :) |
| 13:06 | RickInGA | cool, someone is doing SICP in Clojure http://sicpinclojure.com/ |
| 13:07 | redinger | RickInGA: I was excited when i found that a couple years ago, but I don't think it's been updated in quite a while |
| 13:07 | yoklov | it's pretty hard to do the later chapters in anything other than scheme |
| 13:07 | AimHere | I think the guy doing 'On Lisp' in Clojure didn't get that far |
| 13:09 | gfredericks | common lisp symbols are _weird_ |
| 13:10 | technomancy | gfredericks: it's a floor wax! it's a dessert topping! it's a storage location! |
| 13:11 | gfredericks | technomancy: I kinda hope I never learn about them :/ |
| 13:12 | RickInGA | AimHere: a couple of people have done some of OnLisp in Clojure. Fogus did chapters 2-6 and Stuart, (7, 9 and 10?) I am slowly going through onlisp now. I will post the first half of chapter 7 later today |
| 13:14 | RickInGA | s/Stuart/Stuart Halloway/ |
| 13:15 | redinger | gfredericks: You've just given me an idea of how we should differentiate between the Stuarts around the office |
| 13:17 | gfredericks | Stuarth & Stuarts |
| 13:17 | gfredericks | hopefully "Stuarts" and "The stuarts" are grammatically disjoint |
| 13:18 | gfredericks | redinger: apologize to Stuarth for me if it catches on |
| 13:19 | redinger | I'm sure it'll be an upgrade from the evil Stuart |
| 13:22 | laurus | When I run this in clojure-py: (def [n min_max mean var skew kurt] (vector (stats/describe s))) , I get AttributeError: 'PersistentVector' object has no attribute 'ns' . Here, stats refers to scipy.stats. |
| 13:22 | laurus | Why? |
| 13:22 | clojurebot | Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 13:23 | gfredericks | laurus: doesn't def normally require a symbol as the first thing? |
| 13:23 | gfredericks | are you trying to destructure within def? |
| 13:23 | laurus | gfredericks, yes :P Haha |
| 13:23 | ibdknox | that won't work |
| 13:23 | ibdknox | lol |
| 13:23 | gfredericks | laurus: lesson learned too well |
| 13:24 | gfredericks | ibdknox: it's not theoretically impossible is it? |
| 13:24 | ibdknox | not at all |
| 13:24 | ibdknox | it could be done |
| 13:24 | laurus | gfredericks, how would you convert this Python code into Clojure? |
| 13:24 | laurus | n, min_max, mean, var, skew, kurt = stats.describe(s) |
| 13:24 | ibdknox | just doesn't work in the current implementation :) |
| 13:24 | gfredericks | laurus: if you're not trying to def globals then you should use let instead |
| 13:24 | gfredericks | which does support destructuring |
| 13:25 | gfredericks | although that's not a happy solution for working in a repl :/ |
| 13:25 | gfredericks | that would be a fun macro |
| 13:25 | laurus | gfredericks, yeah. :P |
| 13:25 | gfredericks | defd |
| 13:25 | laurus | But it's okay actually, I'll just define a function to print out all those terms. |
| 13:25 | laurus | Thanks. |
| 13:26 | gfredericks | I wonder if it could be written without having to enumerate all destructuring forms... |
| 13:26 | hiredman | ,(doc destructure) |
| 13:27 | clojurebot | "([bindings]); " |
| 13:27 | hiredman | ,(destrucuture '[[a b] x]) |
| 13:27 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: destrucuture in this context, compiling:(NO_SOURCE_PATH:0)> |
| 13:27 | hiredman | ,(destructure '[[a b] x]) |
| 13:27 | clojurebot | [vec__78 x a (clojure.core/nth vec__78 0 nil) b ...] |
| 13:27 | gfredericks | hiredman: well that certainly helps :) |
| 13:28 | hiredman | maybe a little |
| 13:28 | gfredericks | I guess you'de have to filter out the gensyms |
| 13:28 | gfredericks | I was thinking just flatten the form and pull out all the symbols |
| 13:28 | hiredman | ~flatten |
| 13:28 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 13:29 | gfredericks | ...does that apply here? |
| 13:31 | gfredericks | would just need a version of flatten that pulls out keys/values from maps |
| 13:33 | daniel_ | im in a lein project and have code like this (def some-string "Fsdfdsfds") |
| 13:33 | daniel_ | in the lein repl, what if i change this in the code? how can i reload it? |
| 13:33 | daniel_ | im trying use and require, neither seems to reload this var |
| 13:34 | gfredericks | (require 'foo :reload) |
| 13:34 | ibdknox | (require 'some.ns :reload) |
| 13:34 | daniel_ | ta |
| 13:34 | fdaoud | hi everyone. say you have afn that takes [x & xs], so normally (afn "a" 1 2 3 4). But now you have xs being [1 2 3 4]. Would you use (apply afn (cons "a" xs)), or (apply (partial afn "a") xs), or something else? |
| 13:35 | gfredericks | the first should work, but also (apply afn "a" xs) |
| 13:35 | daniel_ | and a normal require doesnt work because... |
| 13:35 | gfredericks | daniel_: because it would be bad if require always reloaded |
| 13:35 | fdaoud | gfredericks: oh,nice, I don't know how I missed that. Thanks! |
| 13:36 | daniel_ | i see, so it caches it |
| 13:36 | daniel_ | :reload doesn't seem to work either |
| 13:36 | gfredericks | did you save the file? |
| 13:36 | daniel_ | yeah |
| 13:36 | gfredericks | then I don't know |
| 13:37 | ibdknox | :reload definitely works, so there's something else going on |
| 13:37 | gfredericks | unless you def'd a separate var in the repl |
| 13:37 | gfredericks | i.e., the one in the code is in a different namespace than the one you're seeing at the repl |
| 13:37 | gfredericks | if you give the fully qualified name for the var-from-the-code at the repl, it is still stale? |
| 13:38 | daniel_ | ah, thats it |
| 13:38 | daniel_ | i was in the user namespace and not giving the fully qualified path |
| 13:38 | daniel_ | i see the same works with use |
| 13:39 | daniel_ | so i dont have to namespace everything |
| 13:39 | solussd | korma's 'insert' function says it returns the id of the last inserted item, but it looks like it returns this form {:last_insert_rowid() 234}. Note the () at the end of the keyword. Is the database specific? I'm using sqlite |
| 13:41 | ibdknox | solussd: it depends on the driver unfortunately :( |
| 13:41 | ibdknox | jdbc isn't the most uniform thing I've ever seen |
| 13:41 | ibdknox | heh |
| 13:44 | rplevy | There was a discussion a while ago about more flexible string literals. As a less powerful alternative, does any util library contain a string function that given reader-valid content allows you have unquoted strings? kind of like the comment macro but for string? Here is what I mean (via my implementation): https://gist.github.com/2481715 I feel like I must have thought of this before, because it's so obvious. I thi |
| 13:44 | rplevy | nk this would be useful, just as the comment macro is useful despite the reader-validity requirement. |
| 13:45 | hiredman | the jdbc api actually provides a jdbcCompliant method that returns a boolean |
| 13:46 | hiredman | it is great |
| 13:46 | gfredericks | hiredman: so I guess legal responses are true, false, and a NotImplementedException? :) |
| 13:47 | jonny | Helllo people |
| 13:47 | jonny | Anybody here have any experience getting clojure to work in emacs? |
| 13:48 | hiredman | whoop |
| 13:48 | gfredericks | rplevy: your interpolation solution only works with read-time values; but http://github.com/fredericksgary/misquote gives an alternative way to do that kind of thing |
| 13:48 | hiredman | s |
| 13:48 | hiredman | I wrote part of a jdbc driver on top of the rest api provided by agilezen |
| 13:48 | rplevy | ah, nice |
| 13:48 | rplevy | hiredman: |
| 13:48 | rplevy | er gfredericks |
| 13:48 | rplevy | sorry |
| 13:49 | gfredericks | rplevy: also I don't think you could ever get something to work in metadata the way you have it |
| 13:50 | gfredericks | at least not without some manual post-processing |
| 13:50 | jonny | I'm having a really hard time getting emacs working with slime and clojure-swank |
| 13:50 | jonny | Has anybody had success? |
| 13:50 | RickInGA | johnny: yes |
| 13:50 | jonny | I know at least somebody has done it before |
| 13:50 | jonny | it's in all the the tutorials |
| 13:50 | jonny | but it's not working for me :( |
| 13:50 | RickInGA | what operating system are you using? |
| 13:50 | jonny | Mac OS X |
| 13:51 | RickInGA | have you installed leiningen? |
| 13:51 | jonny | yup |
| 13:51 | rplevy | gfredericks: what do you mean, re metadata? |
| 13:51 | jonny | i've been trying different setups for hours |
| 13:51 | gfredericks | rplevy: I believe metadata is only read, not evaled |
| 13:51 | jonny | but i'll figure out what error i was getting |
| 13:52 | jonny | and come back here |
| 13:52 | ystael | jonny: i found that it caused problems when i had too much installed, or stale versions |
| 13:52 | gfredericks | &(meta (read-string "#^{:foo (+ 1 2)} bar")) |
| 13:52 | lazybot | ⇒ {:foo (+ 1 2)} |
| 13:52 | ystael | what emacs are you using? |
| 13:52 | jonny | oh |
| 13:52 | jonny | umm |
| 13:52 | gfredericks | rplevy: like that ^ |
| 13:52 | RickInGA | johnny: are you trying to launch from gui or from terminal? |
| 13:52 | jonny | I'm launching from GUI |
| 13:52 | jonny | carbon emacs i think |
| 13:52 | RickInGA | OS X screws up the paths when you launch from gui |
| 13:52 | jonny | oh |
| 13:53 | jonny | yeah i was having problems with paths |
| 13:53 | RickInGA | you will need to navigcate to a project inside of a terminal, and then launch emacs from there |
| 13:53 | jonny | I'll try just using termincal |
| 13:53 | jonny | ahhhh |
| 13:53 | gfredericks | rplevy: though another macro that processes the metadata could get around that |
| 13:53 | gfredericks | also with-meta should work I think |
| 13:54 | jonny | okay i'm going to give this another shot from terminal |
| 13:54 | ystael | RickInGA: can you describe that problem a little more? i have a working GUI-launch setup on my mac that doesn't seem to suffer from it, but i may be missing something |
| 13:54 | jonny | should i be using the most recent versions of everything? |
| 13:55 | jonny | I was reading in some places that clojure-swank doesn't work with the newest version of SLIME |
| 13:55 | rplevy | gfredericks: this is kind of a mind-bending use case because you are constructing a string to pass to the reader, when it has already gone through the reader by virtue of being processed by qq |
| 13:55 | RickInGA | ysteal: I don't know enough to elaborate. It was just a fact I came accross a couple of timees when I was trying to get set up on a mac |
| 13:56 | technomancy | jonny: if you just stick with the swank-clojure readme and ignore everything else you should be fine |
| 13:56 | ystael | jonny: i can tell you what worked for me. install a 24.0.9x pretest from emacsformacosx.com/builds. then follow the directions on github.com/technomancy/swank-clojure |
| 13:56 | jonny | k i'll try that |
| 13:56 | technomancy | there are a lot of really bad instructions out there that will waste your time |
| 13:57 | jonny | I've been experience that... |
| 13:57 | rplevy | gfredericks: or rather, in order to have been processed by qq it had to be processed by the reader first |
| 13:57 | gfredericks | yep |
| 13:57 | technomancy | jonny: if you can leave comments on the bad instructions pointing people to the swank-clojure readme or "getting started with emacs" on dev.clojure.org that might help people in the future |
| 13:57 | technomancy | unfortunately sometimes there's nothing you can do |
| 13:57 | jonny | yeah that's a good idea, i'll try to do that |
| 13:58 | gfredericks | technomancy: maybe if we can pass one of these excellent internet censorship bills you can send a takedown notice or something |
| 13:58 | rplevy | gfredericks: so when would that be useful? |
| 13:58 | gfredericks | rplevy: what part? |
| 13:58 | technomancy | gfredericks: yeah, we could copyright all possible misleading instructions and then DCMA those suckers! |
| 13:58 | gfredericks | hell yeah |
| 13:59 | rplevy | dealing with metadata in the hypothetical qq macro |
| 13:59 | technomancy | I like it |
| 13:59 | gfredericks | cut off their advertising accounts |
| 13:59 | gfredericks | rplevy: well you were trying to do it in the gist example |
| 13:59 | gfredericks | is the only reason I brought it up |
| 14:00 | rplevy | oh I see... |
| 14:00 | gfredericks | my point was the way you have it there qq would never get called |
| 14:00 | gfredericks | not on line 12 at least |
| 14:00 | muhoo | what's the name of the lein tool for noir that will automatically reload namespaces as the files change? |
| 14:01 | ibdknox | muhoo: noir does that by default |
| 14:01 | RickInGA | ugghh I hate writing cover letters |
| 14:01 | muhoo | does it do that when running the server from the repl? from trampoline repl too? |
| 14:02 | ibdknox | muhoo: yep |
| 14:02 | muhoo | thanks! |
| 14:05 | rplevy | gfredericks: I fixed to say what I meant, this was a typo |
| 14:05 | gfredericks | oh okay |
| 14:06 | mdeboard | in-flight wi-fi, this is seriously the future. |
| 14:06 | rplevy | gfredericks: the metadata was supposed to be on the function, as a docstring |
| 14:06 | laurus | I want to convert this Python to Clojure: stats.norm.rvs(loc=3.5, scale=2.0) |
| 14:06 | rplevy | gfredericks: (defn ^{:doc (qq this docstring is "a little better")} myfn2 [] ) |
| 14:06 | ibdknox | mdeboard: lol I can never bring myself to pay that much for it though |
| 14:06 | laurus | The closest I can get is (kwapply (.rvs (stats/norm)) {"loc" 3.5 "scale" 2.0}) |
| 14:06 | laurus | But it gives a bug. |
| 14:07 | gfredericks | rplevy: that would still not work |
| 14:07 | mdeboard | ibdknox: $5 for wifi for the whole flight? |
| 14:07 | rplevy | it does though |
| 14:07 | mdeboard | that's a bargain |
| 14:07 | ibdknox | mdeboard: woah it's only $5? |
| 14:07 | mdeboard | Yeah, on Delta |
| 14:07 | ibdknox | well shit |
| 14:07 | ibdknox | that's totally worth it then :) |
| 14:07 | rplevy | gfredericks: I can tell you for sure that it does because I tried it :) |
| 14:07 | mdeboard | yeah it's pretty speedy too, surprisingly. |
| 14:07 | mdeboard | Anyway totally off-topic, I was just surprised. Sorry. |
| 14:08 | jonny | In Emacs for Mac OS X (terminal version), I'm pressing M-x and it's just inserting this character into the buffer: ≈ |
| 14:08 | gfredericks | rplevy: okay then I must not know how clojure works |
| 14:08 | rplevy | gfredericks: and the interpolation works too |
| 14:08 | rplevy | gfredericks: always more to learn :) |
| 14:08 | jonny | it was working normally in the gui version... |
| 14:08 | gfredericks | yeah that I expect. I just don't expect code in the metadata to ever get run |
| 14:09 | gfredericks | rplevy: compare with ##(meta (read-string "^{:doc (str (+ 1 2))} foo")) |
| 14:09 | lazybot | ⇒ {:doc (str (+ 1 2))} |
| 14:09 | laurus | Got it: (kwapply (.-rvs stats/norm) {"loc" 3.5 "scale" 2.0}) |
| 14:10 | jonny | oh |
| 14:10 | technomancy | jonny: I think that's just the Mac terminal being buggered |
| 14:10 | jonny | M is escape |
| 14:10 | jonny | i thought so too, but M-x is Esc-x |
| 14:10 | jonny | for some reason |
| 14:10 | technomancy | yeah, the default settings on the mac terminal are awful |
| 14:13 | rplevy | jonny: usually meta is both ESC and ALT, right? |
| 14:13 | rplevy | either / or |
| 14:13 | jonny | well, in Carbon Emacs it was just Alt |
| 14:14 | jonny | esc was for cancelling |
| 14:14 | technomancy | I don't think that's true; esc always functions as an additional meta |
| 14:14 | rplevy | I don't know I have Ubuntu on my work mac :) this solves all problems |
| 14:14 | jonny | hmm |
| 14:15 | jonny | maybe I was just unaware of that |
| 14:15 | jonny | probably the case |
| 14:15 | technomancy | rplevy: good man |
| 14:15 | rplevy | technomancy: :) |
| 14:15 | rplevy | other than power managment / battery life problems haha (I think I can fix that thoghgh) |
| 14:15 | rplevy | though* |
| 14:16 | technomancy | powertop is really good for that kind of thing |
| 14:17 | rplevy | yeah |
| 14:17 | jonny | The instructions for installing Clojure Mode on github ask me to do M-x eval-buffer and then M-x package-refresh-contents. What's the purpose of M-x eval-buffer? |
| 14:17 | jonny | It always just fails for me |
| 14:17 | technomancy | jonny: to load the code that adds marmalade as a package source |
| 14:17 | technomancy | if you've added it to init.el, you could restart; it will serve the same purpose |
| 14:18 | jonny | calling M-x eval-buffer just results in: "Symbol's value as variable is void: Welcome" |
| 14:19 | technomancy | ok, either you're running it in the wrong buffer or you've pasted something that doesn't belong |
| 14:20 | jonny | ohhhhhh |
| 14:20 | jonny | Yeah, the instructions were asking me to edit ~/.emacs.d/init.el, which I was doing in vim |
| 14:21 | jonny | not in emacs |
| 14:21 | jonny | but if were doing it in emacs |
| 14:21 | jonny | it would have worked |
| 14:21 | jonny | cool, thanks for clearing that up for me |
| 14:22 | mdeboard | Anyone seen this error for `clojure-jack-in`: "Process swank exited abnormally with code 1 |
| 14:22 | mdeboard | That's not a task. Use "lein help" to list all tasks. |
| 14:22 | mdeboard | " |
| 14:22 | mdeboard | cor |
| 14:24 | jonasen | sattvik: thanks for leinjacker! I needed it |
| 14:24 | technomancy | mdeboard: means lein-swank isn't installed |
| 14:25 | mdeboard | I see. Is this a separate installation? |
| 14:27 | mdeboard | I ask because I've never had to do anything but follow the instructions at the repo. I just ran lein upgrade just in case, but.. |
| 14:27 | muhoo | is there cl-format magick to get "first", "second","third", etc from an int? |
| 14:29 | sattvik | jonasen: No problem. I'm glad someone's finding it helpful. |
| 14:30 | technomancy | mdeboard: what version of lein, and how did you install the swank plugin? |
| 14:31 | mdeboard | lein 1.7 and... |
| 14:33 | daniel_ | (ns chess.core (:use [clojure.string :only split])) |
| 14:33 | daniel_ | whats wrong with that? |
| 14:34 | mdeboard | How is swank not installed. bleh. Also not an available choice from elpa |
| 14:34 | ibdknox | :only [split] |
| 14:34 | Raynes | mdeboard: You don't want any slime or swank from elpa |
| 14:35 | Raynes | mdeboard: All you need is clojure-mode and the swank-clojure leiningen plugin. |
| 14:35 | daniel_ | thanks ibdknox |
| 14:36 | mdeboard | Weird, I guess I've reformatted this machine since last using clojure mode on it. |
| 14:39 | Raynes | ibdknox: 105k! |
| 14:39 | mdeboard | ahhh there we go. |
| 14:39 | Raynes | Somehow. Still no 10k or 5k backers. |
| 14:39 | ibdknox | Raynes: yeah :) Gruber and UncleBob helped a lot there |
| 14:39 | daniel_ | can anyone tell me the regular expression to split by "/" or " "? |
| 14:41 | Raynes | &(clojure.string/split #"/" "10/02/1994") |
| 14:41 | lazybot | java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern |
| 14:41 | Raynes | &(clojure.string/split "10/02/1994" #"/") |
| 14:41 | lazybot | ⇒ ["10" "02" "1994"] |
| 14:41 | Raynes | Damn ordering. |
| 14:41 | daniel_ | got it, it's 3 |
| 14:42 | daniel_ | #("/| ") even |
| 14:42 | Raynes | Oh. I didn't realize you meant the same regex. |
| 14:42 | Raynes | :p |
| 14:42 | Raynes | Hey, I got you half way thre! |
| 14:42 | Raynes | there* |
| 14:44 | TimMc | daniel_: #"[/ ]" |
| 14:45 | muhoo | jqueryui tabs made sleazy: https://refheap.com/paste/2323 |
| 14:45 | daniel_ | TimMc: works as well, thanks |
| 14:52 | jweiss | are there docs about the 1.4 reader beyond the release notes? |
| 14:54 | dgrnbrg | jweiss: I think there's not much to it: you define the shortname/qualified name mapping, and the function that you write takes the item read after the reader macro and returns the new object. |
| 14:55 | jweiss | dgrnbrg: what comprises an "item" |
| 14:55 | dgrnbrg | jweiss: the thing which is read |
| 14:55 | dgrnbrg | a form == an item |
| 14:56 | dgrnbrg | so if you have #foo (blah [baz]), you'll get '(blah [baz]) passed to the function that you aliased to #foo |
| 14:56 | dgrnbrg | if you have #foo "00_00_11_11", then you'll get "00_00_11_11" passed to the function that you aliased to #foo |
| 14:56 | jweiss | dgrnbrg: so if i wanted to read, say, csv, it would have to be in quotes? |
| 14:57 | jweiss | and then process the string? |
| 14:57 | dgrnbrg | Yes |
| 14:57 | dgrnbrg | but that's not a proper application of 1.4's reader |
| 14:57 | jweiss | right, just an example |
| 14:58 | dgrnbrg | it's more useful for things you wish had a literal/immediate representation |
| 14:58 | jweiss | csv is better read using the csv lib :) |
| 14:58 | dgrnbrg | say, you could do it for ssh connections |
| 14:58 | dgrnbrg | as #remote "user:password@host:port" |
| 14:58 | jweiss | ah i see, so kinda the same functionality as print-dup but easier :) |
| 14:58 | dgrnbrg | and #remote returns some sort of object representing the connection (or a potential connection) |
| 14:59 | dgrnbrg | it's exactly for print-dup type applications |
| 14:59 | dgrnbrg | for a form that's easier for humans to understand when its serialized |
| 14:59 | dgrnbrg | and for terser representations of different types of objects |
| 15:00 | jweiss | i see. i am supposed to implement 'keyword driven testing' keywords are just function calls, so i thought maybe the reader could just read a table-like file and spit out (myfn arg arg) |
| 15:00 | jweiss | but i think that's better done outside the reader |
| 15:00 | dgrnbrg | ah, yeah |
| 15:01 | dgrnbrg | i'd do that in another way |
| 15:01 | jweiss | dgrnbrg: i assume i'd have to use eval then |
| 15:01 | dgrnbrg | (-> (read-lines my-file) (split '.') (eval `(myfn (first %) (second %))) |
| 15:01 | dgrnbrg | that doesn't work, but it's the model I'd try |
| 15:02 | dgrnbrg | or actually, just do (->> (read-lines my-file) (split " ") (apply myfn)) |
| 15:03 | jweiss | dgrnbrg: the fn name is in the file too |
| 15:03 | jweiss | so it'd need to be resolved |
| 15:03 | dgrnbrg | (apply veal)? |
| 15:03 | jonny | yeessss! i have finally arrived! |
| 15:04 | dgrnbrg | (apply eval)? |
| 15:04 | jweiss | dgrnbrg: yep |
| 15:04 | jonny | clojure coding heaven! |
| 15:04 | jonny | welll maybe that's going too far... |
| 15:05 | jonny | thanks technomancy for your help! |
| 15:05 | daniel_ | whats the best way of converting a string into a vector of chars |
| 15:06 | dgrnbrg | ,(into [] "mystr") |
| 15:06 | clojurebot | [\m \y \s \t \r] |
| 15:06 | dgrnbrg | ,(vec "mystr") |
| 15:06 | clojurebot | [\m \y \s \t \r] |
| 15:06 | dgrnbrg | daniel_: I prefer the second one |
| 15:07 | jonny | In lisp, there's a &body parameter type which is used so that the editor knows how to properly indent the parameters of a function call |
| 15:07 | jonny | does clojure have that? |
| 15:09 | daniel_ | yeah, just vec is nice and simple |
| 15:09 | daniel_ | thanks dgrnbrg |
| 15:09 | dgrnbrg | daniel_: anytime :) |
| 15:10 | solussd | what's the best way to get the mime-type of a file sent in a multipart post to Noir |
| 15:10 | solussd | (?) |
| 15:15 | dgrnbrg | jonny: i don't understand what you mean wrt indenting the parameters of a function? |
| 15:15 | dgrnbrg | do you mean at the declaration site or at the call site? |
| 15:15 | jonny | like |
| 15:15 | muhoo | solussd: http://francesco-cek.com/uploading-a-file-to-amazon-s3-using-clojure-and-noir-2/ |
| 15:15 | daniel_ | (vec (replace lst #"[0-8]" #(take % (repeat \-))))) |
| 15:15 | nDuff | If I use ensure on my refs before changing them, will this prevent anything past the ensure from potentially needing to be retried? |
| 15:16 | daniel_ | ,(vec (replace "fff4" #"[0-8]" #(take % (repeat \-))))) |
| 15:16 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$replace> |
| 15:16 | muhoo | solussd: or https://gist.github.com/1315692 |
| 15:16 | daniel_ | replace takes 3 args doesnt it? |
| 15:16 | daniel_ | ah, wait |
| 15:17 | daniel_ | need to apply str to the last bit probably |
| 15:17 | solussd | muhoo: thanks |
| 15:17 | muhoo | man i am so happy. with stencil/moustache, i can have my html crap in nxml-mode, nice and clean. and anything i need to generate programmatically i can use hiccup and {{{}}} to unescape it. joy. |
| 15:17 | jonny | dgrnbrg: this is taken from Practical Common Lisp "Another special feature of macro parameter lists is that you can use &body as a synonym for &rest. Semantically &body and &rest are equivalent, but many development environments will use the presence of a &body parameter to modify how they indent uses of the macro--typically &body parameters are used to hold a list of forms that make up the body of the macro." |
| 15:17 | amalloy | jonny: not really. you have to configure the editor |
| 15:17 | jonny | oh |
| 15:18 | jonny | darn |
| 15:18 | amalloy | are you using emacs? it's pretty easy to configure for new macros |
| 15:18 | daniel_ | still doesnt work :( |
| 15:18 | jonny | yeah |
| 15:18 | jonny | how does that work? |
| 15:18 | jonny | i'm completely new to emacs |
| 15:18 | amalloy | M-x customize-variable RET clojure-defun-indents |
| 15:18 | jonny | oh |
| 15:18 | dgrnbrg | daniel_: what is your input and goal output? |
| 15:19 | raek | daniel_: are you trying to use clojure.core/replace or clojure.string/replace? |
| 15:19 | solussd | muhoo: those don't show how to extract the mime type. :( I need to know so I can give them proper extensions-- or, can I get the original filename? |
| 15:19 | daniel_ | say i have a string "fff4", i want that turned into "fff----" (4 dashes) |
| 15:19 | daniel_ | oh raek, good point |
| 15:20 | raek | &(clojure.string/replace "fff4" #"[0-8]" #(take % (repeat \-))) |
| 15:20 | lazybot | java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.String |
| 15:20 | raek | &(clojure.string/replace "fff4" #"[0-8]" #(apply str (take % (repeat \-)))) |
| 15:20 | lazybot | java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number |
| 15:21 | raek | &(clojure.string/replace "fff4" #"[0-8]" #(apply str (take (Integer/parseInt %) (repeat \-)))) |
| 15:21 | lazybot | ⇒ "fff----" |
| 15:21 | daniel_ | great, i'd just run into that String cast to Number and was gunna ask what that was about |
| 15:23 | beffbernard | Does (apply hash-map {"trevor" "Trevor"}) turn a clojure map into a java hashmap? |
| 15:23 | Raynes | &(doc hash-map) |
| 15:23 | lazybot | ⇒ "([] [& keyvals]); keyval => key val Returns a new hash map with supplied mappings." |
| 15:23 | Raynes | It returns a Clojure map. |
| 15:23 | beffbernard | bah |
| 15:23 | raek | beffbernard: no, (hash-map a b c d) is the same as {a b c d} |
| 15:23 | Raynes | (type (hash-map :foo "bar")) |
| 15:24 | Raynes | &[(type (hash-map :foo "bar")) |
| 15:24 | lazybot | java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 15:24 | Raynes | Damn it. |
| 15:24 | raek | but as a function |
| 15:24 | Raynes | &(type (hash-map :foo "bar")) |
| 15:24 | lazybot | ⇒ clojure.lang.PersistentHashMap |
| 15:24 | sattvik | It still implement's Java's Map interface, I believe. |
| 15:24 | beffbernard | O'rly? |
| 15:25 | raek | beffbernard: you can use the constructor of java.util.HashMap that takes another java.util.Map |
| 15:25 | jonny | amalloy: you're right, that was easy! thanks for the tip |
| 15:25 | raek | beffbernard: (HashMap. {:a 1, :b 2}) |
| 15:26 | raek | because of what sattvik said |
| 15:26 | amalloy | jonny: you're welcome! i also added the feature :) |
| 15:26 | beffbernard | raek: I'm mucking around with thrift and one of my stucts has a map<string, string> which is just java.util.Map |
| 15:26 | beffbernard | raek: also, thanks |
| 15:26 | jonny | oh! wow! you're a genius!! |
| 15:27 | daniel_ | is it a convention writing function names like somelist->somevector when it's converting one form into another? |
| 15:27 | Raynes | jonny: It's true, he is. It's his ponytail. The longer it grows, the more he knows. |
| 15:27 | jonny | :O |
| 15:28 | jonny | mind=blown |
| 15:28 | beffbernard | I thought I had to coerce clojure map -> java map but I can just pass it in and works fine |
| 15:28 | jonny | the world of clojure is really a magical place |
| 15:28 | beffbernard | sattvik: +1 |
| 15:29 | sattvik | beffbernard: Thanks. All of the Clojure collections generally implement a read-only version of the various Java collections interfaces. |
| 15:29 | Raynes | &(supers (class {})) |
| 15:29 | lazybot | ⇒ #{java.util.Map clojure.lang.IMeta clojure.lang.APersistentMap clojure.lang.IEditableCollection clojure.lang.Seqable clojure.lang.MapEquivalence java.lang.Object java.io.Serializable java.lang.Iterable java.util.concurrent.Callable java.lang.Runnable clojure.lang.IP... https://refheap.com/paste/2327 |
| 15:29 | Raynes | beffbernard: ^ |
| 15:30 | Raynes | A Clojure map *is* a Java map. |
| 15:30 | beffbernard | Raynes: thanks.. I need to remember (supers (class …)) |
| 15:30 | Raynes | beffbernard: I just spent the last 10 minutes trying to remember what that function was called, so don't feel bad. |
| 15:31 | beffbernard | Raynes: word |
| 15:31 | gfredericks | "trying to remember" is a difficult action to describe |
| 15:31 | gfredericks | at least beyond those three words |
| 15:32 | gfredericks | I will consider AI to be unattained until the computer has to try to remember things |
| 15:34 | beffbernard | &(java.util.Hashmap. {:foo :bar}) |
| 15:34 | lazybot | java.lang.ClassNotFoundException: java.util.Hashmap |
| 15:34 | beffbernard | &(java.util.HashMap. {:foo :bar}) |
| 15:34 | lazybot | ⇒ #<HashMap {:foo=:bar}> |
| 15:34 | beffbernard | &(into {} (java.util.HashMap. {:foo :bar})) |
| 15:34 | lazybot | ⇒ {:foo :bar} |
| 15:37 | muhoo | solussd: it's in the map returned by that function, IIRC |
| 15:37 | solussd | muyou are correct. thanks again |
| 15:39 | maio | Emacs question: is it possible to show function signature in minibuffer? (as Emacs do in elisp files?) |
| 15:40 | amalloy | that Just Works if you're connected with slime/swank |
| 15:40 | beffbernard | Eldoc mode? |
| 15:40 | maio | it works in REPL but not whan I'm editing buffer |
| 15:41 | maio | beffbernard: thanks |
| 15:45 | pelleb | Guys I just pushed the first feature complete version of Clauth, which is a OAuth2 provider library, which can also be used for primary authentication in ring apps. http://pelle.github.com/clauth/ |
| 15:47 | fliebel | pelleb: Cool. Provider, uh? Last tiem I checked the Clojure client thing, it was fairly outdated. |
| 15:49 | pelleb | I'll take a look at it to see if I can help it out. I started work on a provider part for clj-oauth a couple of years back. Never had time to finish it, but it was OAuth1 and should not be used for new projects anyway now. |
| 15:49 | fliebel | Is that still true, or can we happily connect to Twitter and such using Clojure? (i understand that is probably not your lib, bu tI suppose you know the field) |
| 15:49 | gfredericks | pelleb: cemerick just started an auth library I think |
| 15:50 | pelleb | Yeah friend I think. I want to take a look at it. If anything can be integrated/shared it would be cool. |
| 15:50 | _KY_ | Is clojure lazy by default? |
| 15:51 | cemerick | All the OAuth stuff baffles me, frankly. |
| 15:51 | cemerick | terminology overload |
| 15:51 | fliebel | _KY_: I'd say so.... |
| 15:51 | pelleb | Right now clauth is pretty low level and has a focus on the oauth backend which I need for my apps |
| 15:51 | Raynes | cemerick: Thank you so very much. |
| 15:51 | Raynes | It is ridiculously complicated. |
| 15:51 | _KY_ | Pretty much like haskell? |
| 15:51 | xeqi | no, but some functions return lazy seqs |
| 15:51 | pelleb | cemerick: oauth 1 was very complex, oauth2 not so much. |
| 15:52 | cemerick | *shrug* |
| 15:52 | cemerick | Raynes: what, is that a controversial point? |
| 15:52 | Raynes | *shrug* |
| 15:52 | _KY_ | Ok... |
| 15:52 | cemerick | We'll all *shrug* our way to the yak barn now… |
| 15:52 | Raynes | fliebel: The entire languge is lazy. |
| 15:52 | Raynes | language* |
| 15:52 | Raynes | Not just collections. |
| 15:53 | cemerick | pelleb: I'd be stoked to have an OAuth workflow for Friend around, FWIW. |
| 15:53 | gfredericks | every haskell program returns immediately and just prints a lazy object |
| 15:53 | Raynes | Haskell is so lazy that code doesn't even run. |
| 15:53 | cemerick | What baffles me the most is that, even among sites that use OAuth, support for them appears to require site-specific stuff. |
| 15:54 | Raynes | It tells you to do it yourself. |
| 15:54 | pelleb | cemerick: one thing is that is a provider and not designed to say authenticate towards facebook. I'll look and see if it can be done as a workflow. |
| 15:54 | beffbernard | Can you typehint a map? |
| 15:55 | pelleb | What you have to remember is that oauth2 is just a building block in your api, it doesn't tell you how to build your api. |
| 15:55 | mpenet | A lot of the big services using oauth manage to add their own sauce for making it no so trivial to make something really cross-service compatible |
| 15:55 | pelleb | It was never designed either for Facebook Connect type apis. OpenID Connect (the new OpenID standard) is though, which I hope to implement soon as well. |
| 15:55 | mpenet | like custom parameters for device type or whatever |
| 15:55 | mpenet | a bit of a pita |
| 15:55 | fliebel | Raynes, gfredericks: ... you either run code or you don't. So in what sense can code be lazy? |
| 15:56 | cemerick | pelleb: a meta authentication api, then |
| 15:56 | gfredericks | fliebel: I don't actually know I was just making haskell jokes |
| 15:56 | ibdknox | fliebel: they were being funny |
| 15:56 | xeqi | fliebel: lazy as a language descriptor usually means function arguments are not evaluated |
| 15:56 | Raynes | fliebel: For example, there is no short circuiting 'and' or 'or'. |
| 15:56 | xeqi | fliebel: so if can just be a function |
| 15:56 | pelleb | mpenet: for oauth1 a lot of those things were necessary, for oauth2 it shouldn't be. But I agree many providers overcomplicated it. |
| 15:56 | dnolen | ibdknox: your last tweet has a bad link |
| 15:56 | mpenet | yup, it is getting better, fortunately |
| 15:57 | fliebel | ok... so it's another macro avoidance trick. good. |
| 15:57 | Raynes | fliebel: 'and' and 'or' are just functions, because the second argument isn't evaluated unless it is actually used. |
| 15:57 | ibdknox | dnolen: thanks for the heads up :) |
| 15:58 | cemerick | pelleb: FWIW, the readme for Clauth is impenetrable to me. :-) |
| 15:58 | S11001001 | fliebel: it's a macro-avoidance-and-you-can-compose-them-at-runtime trick |
| 15:58 | dnolen | ibdknox: I think you've got a good chance of making it. |
| 15:58 | ibdknox | dnolen: it'll come down to companies in the end I think |
| 15:58 | ibdknox | dnolen: either that or more of these "celebrity" endorsements |
| 15:59 | ibdknox | dnolen: either way though, the social proof is there. I could raise money to make it happen |
| 15:59 | dnolen | or 900 people w/ $100 donations ;) |
| 16:00 | ibdknox | :D |
| 16:00 | fliebel | ibdknox: FYI, I didn't pledge because I don't have a credit card. There is not much you can do about it, but credit cards are not in wide use in NL. |
| 16:00 | dnolen | 2000 donations is a lot |
| 16:00 | ibdknox | dnolen: it's a ton, I'm tremendously impressed by the whole thing |
| 16:01 | ibdknox | fliebel: really? That's interesting. Everything is done in hard currency? |
| 16:01 | hiredman | ^- ditto |
| 16:01 | hiredman | (fascinating) |
| 16:01 | fliebel | ibdknox: No, we have debit cards, and use IDEAL for online banking. |
| 16:02 | ibdknox | I guess now that I think about it, all the time I spent in Germany people didn't use cards much either |
| 16:02 | fliebel | Netherlands |
| 16:02 | gfredericks | New Leazand? |
| 16:02 | gfredericks | oh |
| 16:02 | jodaro | heh |
| 16:02 | gfredericks | New Lampshire |
| 16:02 | jodaro | New Lizardville |
| 16:02 | fliebel | Near Pizza |
| 16:02 | gfredericks | if there's not a New London somewhere in the world I'll be upset |
| 16:03 | ibdknox | there is |
| 16:03 | gfredericks | good |
| 16:03 | jodaro | i think there is one in CT |
| 16:03 | hiredman | fliebel: debit cards in the us are usually usable as "credit cards" at online stores |
| 16:03 | ibdknox | it's in connecticut |
| 16:03 | jodaro | yes, nailed it! |
| 16:03 | jodaro | its good to be right about at least one thing per day |
| 16:03 | ibdknox | haha |
| 16:03 | ibdknox | srsly |
| 16:03 | raek | swedish debit cards are usually usable as credit cards |
| 16:04 | fliebel | hiredman: I'm not sure if it's the same thing. I think you can pay a monthly fee to have a credit card on you debit card... |
| 16:05 | hiredman | in canada they have some kind of chips in their debit cards, and tim horton's doesn't take visa |
| 16:05 | hiredman | (or doesn't take visa debit cards, or something) |
| 16:05 | cemerick | pelleb: BTW, that's just a function of my not understanding OAuth, not a comment on your documentation (which appears very comprehensive). |
| 16:07 | jodaro | if you have an O that requires Auth, you use OAuth |
| 16:07 | jodaro | pretty straightforward, actually |
| 16:07 | muhoo | throughotu the northeast towns are named (map #(str "New " %) seq-of-towns-in-england) |
| 16:07 | cemerick | jodaro: ooooooh, I get it now! :-P |
| 16:08 | cemerick | muhoo: some of 'em are lifted wholesale, e.g. Northampton |
| 16:08 | ibdknox | cemerick: seriously man, where did you learn to program? ;) |
| 16:09 | jodaro | muhoo: yeah, the brits were just like "fuck it, lets just call it New Whatever" |
| 16:09 | _KY_ | I have a sequence of sequences, I want to find all permutations of its elements, ie, a1.b1.c1... and a2.b1.c1... and a3.b1.c1.... and so on... |
| 16:09 | cemerick | ibdknox: I'm the proverbial million monkeys, all rolled up. |
| 16:09 | ibdknox | haha |
| 16:09 | fliebel | muhoo: Also, some used to be called New <dutch city>, but I don't think they stayed long enough. |
| 16:09 | gfredericks | jodaro: the other half of the time they'd name something after whoever was the monarch at the time |
| 16:09 | TimMc | fliebel: If you send me Bitcoin, I can pledge for you. :-P |
| 16:09 | amalloy | _KY_: that's a cartesian product, not permutations. and there's something in algo.combinatorics (i think that's the name now?) to do that |
| 16:09 | jodaro | "oy vey, another town to name? hey nigel, where are you from?" |
| 16:10 | gfredericks | lotta things were named after the local natives, which isn't so lame |
| 16:10 | _KY_ | Maybe doseq can do that? |
| 16:10 | gfredericks | until you kill them all |
| 16:10 | amalloy | if the sequence were of fixed length you could do it trivially with for (not doseq) |
| 16:10 | jodaro | like |
| 16:10 | jodaro | woonsocket |
| 16:10 | _KY_ | (Doseq [a seq1 b seq2 c seq3 ....]) |
| 16:10 | ibdknox | amalloy: :p |
| 16:11 | gfredericks | _KY_: doseq is for side effects |
| 16:11 | muhoo | i wouldn't call oauth hard, just byzantine and messy and filled with incidental complexity |
| 16:11 | _KY_ | No, they're not of fixed length |
| 16:11 | gfredericks | muhoo: what would you call hard? |
| 16:11 | TimMc | jodaro: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg, Webster, MA |
| 16:11 | fliebel | TimMc: I don't have any. How much bitcoin is 17 dollar? |
| 16:11 | gfredericks | TimMc: please tell me you made that up |
| 16:11 | jodaro | webstah mass |
| 16:11 | ibdknox | amalloy: oh, I thought you were referencing the previous (str "New " ..) bit of code |
| 16:11 | muhoo | gfredericks: haskell :-) |
| 16:11 | TimMc | $google Chargoggagoggmanchauggagoggchaubunagungamaugg |
| 16:11 | ibdknox | amalloy: carry on |
| 16:11 | lazybot | [Lake Chaubunagungamaug - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Lake_Chaubunagungamaug |
| 16:12 | jodaro | wow |
| 16:12 | _KY_ | I read that doseq can take multiple sequences and permute their elements automatically |
| 16:12 | TimMc | fliebel: Like 3 BTC. But it's still tricky to get them outside of the US. -.- |
| 16:12 | amalloy | man, ibdknox, i can't even *find* that previous thing to figure out what you were accusing me of |
| 16:13 | fliebel | TimMc: That's weird, for a distributed virtual corrency. |
| 16:13 | gfredericks | _KY_: doseq has the same behavior as for in that regard, but doesn't return the result (since it's just for side effects) |
| 16:13 | muhoo | i distinguish between "hard", as in , you have to be really smart to understand this, and "messy", which means you just need patience and fortitude and time to get into the twisted head of whomever wrote it. |
| 16:13 | ibdknox | amalloy: "muhoo: throughotu the northeast towns are named (map #(str "New " %) seq-of-towns-in-england)" |
| 16:13 | gfredericks | muhoo: that makes sense |
| 16:13 | raek | _KY_: both in (doseq [x x-seq, y y-seq] (f x y)) and (for [x x-seq, y y-seq] (f x y)) f will be applied to each pair of the cartesian product of x-seq and y-seq |
| 16:13 | TimMc | fliebel: Existing financial systems tend to discourage interchange with novel currencies, I think. |
| 16:14 | raek | (assuming that the whole sequence for returns is consumed) |
| 16:14 | _KY_ | ,(doseq [a [1 2] b '[x y z w]] (println a "." b)) |
| 16:14 | pelleb | cemerick: I guess I need to move all the standards specific stuff down and start with how you use it. Thats what comes from working in the standards world for too long. |
| 16:14 | clojurebot | 1 . x |
| 16:14 | clojurebot | 1 . y |
| 16:14 | clojurebot | 1 . z |
| 16:14 | clojurebot | 1 . w |
| 16:14 | clojurebot | 2 . x |
| 16:14 | clojurebot | 2 . y |
| 16:14 | clojurebot | 2 . z |
| 16:14 | clojurebot | 2 . w |
| 16:14 | muhoo | clojurebot does doseq?! |
| 16:14 | _KY_ | =) |
| 16:14 | gfredericks | I've never seen a bot make that much noise |
| 16:15 | raek | gfredericks: you should have seen when I accidentally gave it a chunked seq of println calls... |
| 16:15 | gfredericks | 32 lines I bet |
| 16:15 | raek | yup :-) |
| 16:15 | gfredericks | now I think I have seen such a thing before |
| 16:15 | gfredericks | what a spectacle |
| 16:15 | gfredericks | the locals were talking about it for months |
| 16:15 | _KY_ | What's difference between doseq and for? |
| 16:16 | gfredericks | _KY_: doseq is for side-effects and returns nil; for is lazy and returns a seq |
| 16:16 | S11001001 | _KY_: for is a sugary do for the list monad, doseq is a sugary forM_ |
| 16:16 | _KY_ | Ah I see... "for" is what I need then |
| 16:16 | muhoo | cemerick: pelleb: is there some inclination to have clauth and friend integrated somehow? |
| 16:16 | mpenet | for also has some nice additions, ilke :while :let etc |
| 16:17 | mpenet | *like |
| 16:17 | TimMc | gfredericks: I think it only stops when the rate-limiter collides with the timeout. |
| 16:17 | cemerick | muhoo: I've been wanting to see an OAuth workflow for Friend from day one. |
| 16:17 | ibdknox | mpenet: doseq does too, doesn't it? |
| 16:17 | pelleb | muhoo: I'd be happy to help making an oauth provider workflow for friend |
| 16:17 | mpenet | oh it does? I didn't know |
| 16:17 | muhoo | iirc, friend needed some mods in order to make the auth providers modular? |
| 16:17 | cemerick | There's about 20 different OAuth bits for Clojure though, and I've clearly not taken the time to understand what each does. :-) |
| 16:18 | pelleb | cemerick: I can help on an oauth client workflow as well for authenticating with facebook. |
| 16:18 | gunnarahlberg | :q |
| 16:18 | gunnarahlberg | oups |
| 16:18 | hiredman | doseq does crazy stuff like |
| 16:18 | pelleb | cemerick: I'll look through the client libraries and try to get a status on where they all are. |
| 16:18 | hiredman | ,(doseq [] 1) |
| 16:18 | clojurebot | 1 |
| 16:18 | cemerick | muhoo: no mods needed; a workflow is just a function — essentially, a ring handler with some additional options. |
| 16:18 | hiredman | ,(for [] 1) |
| 16:18 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.Exception: Unsupported binding form: > |
| 16:18 | jodaro | are my jvm heap utilization graphs supposed to look like a serrated knife? |
| 16:19 | pelleb | cemerick: I believe clj-oauth does both oauth 1 and 2 so it would work in theory with both twitter, facebook and github. |
| 16:19 | pelleb | But I'll look at where it is. |
| 16:19 | TimMc | hiredman: I guess that makes sense from a cartesian product perspective. |
| 16:19 | cemerick | pelleb: Oh, so clauth is for hosting your own OAuth endpoint? |
| 16:19 | pelleb | cemerick: yes |
| 16:19 | cemerick | heh, well, that explains part of my confusion |
| 16:19 | TimMc | How many runs? (apply * (map count seqs)) |
| 16:19 | hiredman | TimMc: it's jsut an accident of doseq's implementation |
| 16:19 | gfredericks | TimMc: it does? it wouldn't be just an empty list? |
| 16:20 | pelleb | cemerick: I need it for a bunch of payment applications I am working on based on http://opentransact.org |
| 16:20 | gfredericks | TimMc: or [[]] |
| 16:20 | S11001001 | jodaro: yes |
| 16:20 | jodaro | i'm guessing thats gc in action |
| 16:20 | gfredericks | TimMc: since your product there returns 1 |
| 16:20 | pelleb | cemerick: clauth should support pretty much everything facebooks oauth implementation does. |
| 16:20 | gfredericks | TimMc: oh wait sorry didn't see stuff |
| 16:21 | TimMc | &(doseq [x (range 5)] 8) |
| 16:21 | lazybot | ⇒ nil |
| 16:21 | muhoo | that'd make it really useful as a test harness for any ouath client lib maybe |
| 16:24 | hiredman | jodaro: you will in all likelihood see more of a sawtooth pattern in clojure than say java, due in some part to immutable structures generating more garbage than mutable ones, but if there is a problem there are usually ways to deal with it |
| 16:24 | jodaro | this is actually all java for now |
| 16:25 | hiredman | I am staring at a saw tooth heap usage graph at this very moment |
| 16:25 | jodaro | i'm debugging my new employers various java codebase woes in preparation for dropping the whole damn thing and rewriting it |
| 16:25 | jodaro | makes sense |
| 16:26 | hiredman | (which is an improvement over the constant 45 degree climb that was on the graph before) |
| 16:27 | jodaro | this app stays pretty steady but it definitely grows |
| 16:27 | jodaro | and then we get an influx of these new "configs" which it previously stored and never aged out in a map |
| 16:27 | jodaro | until the twice daily restart cleaned it up |
| 16:27 | jodaro | no one bothered to actually figure out how to deal with it |
| 16:28 | TimMc | jodaro: Don't check in the fix or they'll want to keep using it. :-( |
| 16:28 | jodaro | heh |
| 16:28 | jodaro | totally |
| 16:28 | jodaro | well i quickly replaced the map with ehcache |
| 16:29 | jodaro | fortunately it worked in a way that would allow it to lazy load configs that lru out |
| 16:29 | jodaro | but it turns out apparently that that isn't whats sucking up all the memory |
| 16:29 | jodaro | so now i'm digging deeper |
| 16:30 | muhoo | is there a cache in noir or something, or some way to fore-invalidate it, or otherwise to make the ns recompile for the jetty server? |
| 16:30 | muhoo | i've made changes to a view, but the generated html is not changing. works fine in the repl, if i :reload especially, but it doesn't seem to change what gets sent to the browser |
| 16:31 | TimMc | dev mode? |
| 16:31 | ibdknox | it should |
| 16:31 | muhoo | it's in dev mode |
| 16:31 | ibdknox | one reason that can happen |
| 16:31 | ibdknox | is if your file is compile erroring |
| 16:32 | ibdknox | which is not uncommon when working in a repl (usually because of ordering) |
| 16:32 | TimMc | oooh |
| 16:32 | ibdknox | it should still throw up a 500 the first time you bring it up |
| 16:32 | muhoo | it's the browser |
| 16:33 | ibdknox | noir doesn't cache anything |
| 16:33 | muhoo | i sniffed the network, noir is putting out the right stuff. the browser is showing me cached crap |
| 16:33 | ibdknox | lol |
| 16:33 | TimMc | C-F5 |
| 16:33 | ibdknox | cmd-shift-r ;) |
| 16:34 | ibdknox | TimMc: mine's cooler. it has COMMAND in it |
| 16:34 | TimMc | :-( |
| 16:34 | muhoo | yeah, i tried that already like 5 times. oh well, manually clearing cache in prefernces fixed it |
| 16:35 | TimMc | So is a Command & Control center a computer lab with both Mac and Linux (or Windows)? |
| 16:35 | ibdknox | TimMc: haha |
| 16:35 | ibdknox | ~rimshot |
| 16:35 | clojurebot | Badum, *tish* |
| 16:35 | TimMc | muhoo: What did you use to sniff? |
| 16:37 | muhoo | wireshark |
| 16:37 | TimMc | Ah, makes sense. I should learn to use that. |
| 16:39 | jodaro | how many "can you please ..." emails before the ops guy just give me ALL=(ALL) ALL |
| 16:39 | felideon | so what's a good Clojure book for someone with a Common Lisp background. |
| 16:40 | austinh | felideon: I'm really enjoying "Clojure Programming" |
| 16:40 | S11001001 | felideon: watch half an hour of rhickey's presentation for lispers, play around in the repl, stop using side-effects, done |
| 16:40 | muhoo | hehehe |
| 16:40 | fliebel | felideon: Clojure is sufficiently complicated that it contains an ad hoc, informally- specified, bug-ridden, slow implementation of half of Common Lisp |
| 16:40 | muhoo | oh and learn to love (->) |
| 16:41 | muhoo | and [ ] |
| 16:41 | amalloy | still trying to get the #clojure logs into the results for that google search, fliebel? |
| 16:41 | felideon | muhoo: -> will be a tough one to love |
| 16:41 | felideon | fliebel: :) |
| 16:41 | amalloy | felideon: so were parens, once |
| 16:41 | felideon | never for me! |
| 16:41 | fliebel | amalloy: yup. Failing horribly though. |
| 16:42 | muhoo | i really love the threading macros, but then i come from a.land().where().this[].happens().alot(); |
| 16:42 | felideon | i feel like i'm figuring most of it out just by reading clojure code. |
| 16:42 | felideon | while looking up stuff i dont get (like -> at first) |
| 16:43 | felideon | S11001001: i'll look that up |
| 16:43 | muhoo | it's just the reverse of (foo (bar (baz))) => (-> baz bar foo) |
| 16:43 | fliebel | amalloy: Second page!!!! http://www.google.nl/search?client=safari&rls=en&q=half+broken+implementation+lisp+big&ie=UTF-8&oe=UTF-8&redir_esc=&ei=2g2XT5vMG8qYOorjrO8N#q=ad+hoc%2C+informally-+specified%2C+bug-ridden%2C+slow+implementation+of+half+of+Common+Lisp+clojure&hl=nl&client=safari&rls=en&prmd=imvns&ei=eA6XT__HGcehOq29vNcN&start=10&sa=N&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=998e298776ba03c5 |
| 16:43 | muhoo | fine be you'll and backwards read to learn |
| 16:43 | S11001001 | muhoo: you put too many parens in |
| 16:43 | TimMc | aieeee |
| 16:43 | austinh | :) |
| 16:44 | felideon | muhoo: i like reading inside out |
| 16:44 | felideon | :) |
| 16:44 | dnolen_ | austinh: are you Austin Haas? |
| 16:44 | S11001001 | -> is smalltalky so I like it |
| 16:44 | muhoo | fliebel: then blow off (-> ) and use comp instead? |
| 16:44 | austinh | dnolen_: Yes. |
| 16:44 | TimMc | felideon: (doc) new functions, there are some surprisingly-named things (like contains?) |
| 16:44 | muhoo | at least comp is in lisp order: (comp foo bar baz), just without the parans |
| 16:45 | dnolen_ | austinh: cool! swannodette on Twitter - I was bugging you earlier today about your CL game stuff. |
| 16:45 | fliebel | Juts a few more mentions of "ad hoc, informally- specified, bug-ridden, slow implementation of half of Common Lisp" and we'll be on page one. |
| 16:45 | austinh | dnolen_: BTW, you are 90% responsible for getting me interested in Clojure. I'd been aware of it for a long time, of course, but people kept retweeting you, then I started following you on Twitter... |
| 16:45 | muhoo | felideon: iirc, the -> macro was specificlaly added to deal with java interop. i guess if you're not doing much java, you can live without -> |
| 16:46 | felideon | muhoo: ah, well the docs say -> is more 'readable' |
| 16:46 | TimMc | Nah, I use -> for non-interop stuff all the time. |
| 16:46 | felideon | i guess for rubyists and stuff it might be |
| 16:46 | gfredericks | muhoo: yeah me too |
| 16:46 | muhoo | i do too, but that's my preference. if you don't like it, i can't think of a situation where it'd be necessary to use it |
| 16:46 | gfredericks | felideon: well it's more flexible than comp, and certainly nicer than any nested equivalent |
| 16:47 | dnolen_ | austinh: haha, I *am* ethusiastic. |
| 16:47 | TimMc | To heck with syntactic sugar, the language is Turing-complete! That was good enough for my grand-pappy... |
| 16:47 | amalloy | felideon: -> is best in moderation. i love it not because it reduces nesting or parens, but mostly because it lets me write my code in an order that emphasizes or "describes" what i'm doing |
| 16:48 | _KY_ | How do I merge 2 lists such that [1 2 3 4] and [x y z w] becomes [1 x, 2 y, 3 z, 4 w]? |
| 16:49 | TimMc | interleave |
| 16:49 | _KY_ | Thanks=) |
| 16:50 | felideon | I see |
| 16:50 | TimMc | $findfn [1 2 3] '[a b c] '[1 a 2 b 3 c] |
| 16:50 | lazybot | [clojure.core/interleave] |
| 16:50 | gfredericks | TimMc: (mapcat vector ...) would be the unpreferred way to do it |
| 16:51 | TimMc | I think I would have to agree. |
| 16:51 | S11001001 | you can also write <- and add it to rplevy's swiss-arrows; <<- is already there |
| 16:55 | gfredericks | I wonder how often html/xml is clojure-readable |
| 16:55 | gfredericks | &(quote (<html><head><script type="text/javascript"></script></head></html>)) |
| 16:55 | lazybot | ⇒ (<html><head><script type= "text/javascript" ></script></head></html>) |
| 16:56 | dnolen_ | felideon: there's not many good resources for folks coming from other Lisps. Would make a nice online resource. |
| 16:57 | puchacz | is there any? |
| 16:57 | gfredericks | there's that list of differences on clojure.org |
| 16:57 | puchacz | online resources for common lispers |
| 16:57 | felideon | http://clojure.org/lisps has some stuff |
| 16:57 | dnolen_ | puchacz: not much beyond rhickye's presentations, clojure.org, and that ridiculous Lisp feature matrix. |
| 16:58 | puchacz | ok, thx.... |
| 16:59 | austinh | I thought I would just be skimming Clojure Programming, picking up trivial syntax and naming differences, but I'm finding it necessary to read pretty much the whole thing. |
| 16:59 | felideon | austinh: really? |
| 16:59 | puchacz | has anybody installed clojure as a procedural language in postgres btw? |
| 16:59 | puchacz | (this is my attraction, I cannot put CL there) |
| 17:00 | dnolen_ | austinh: the new O'Reilly one? |
| 17:00 | technomancy | puchacz: the JVM is not very good for embedding, but clojurescript would probably work on the embedded v8 engine |
| 17:00 | austinh | felideon: Yeah. I mean, it's easy to grok macros, of course, and other minor differences, but the way Clojure is structured on those simple immutable data types is really pervasive. |
| 17:00 | austinh | dnolen_: Yes. |
| 17:01 | hiredman | technomancy: there are projects for using java as a PL |
| 17:01 | puchacz | technomancy: there is PL/Java in postgres already |
| 17:01 | technomancy | oh, shows how much I know |
| 17:01 | puchacz | not sure how well it plays with clojure though |
| 17:01 | puchacz | in production environment! |
| 17:02 | hiredman | only real way to tell |
| 17:02 | puchacz | yes, find a person who did it before me :) |
| 17:02 | gfredericks | modify the cljs compiler to emit java? |
| 17:02 | patchwork | Where is the ring.server.leiningen namespace defined? |
| 17:03 | patchwork | I mean, what project? |
| 17:03 | patchwork | It is not in lein-ring or any of the ring-core subprojects |
| 17:04 | technomancy | patchwork: I think there's a ring-server jar |
| 17:04 | technomancy | http://clojars.org/ring-server |
| 17:05 | patchwork | Aha, which is different from ring-serve |
| 17:06 | jayunit100 | been wondering --- alot of the advantages of clojure are adding dynamic aspects to the JVM, getting around boiler plate, and integration with the vast existing java landscape. Dont you lose this when you move to clojurescript ? And then... make the language fork into two different varieties ? |
| 17:07 | gfredericks | jayunit100: there's a stack of similar benefits to being in JS-land |
| 17:07 | ibdknox | jayunit100: JS is collecting quite a landscape of libraries itself. But yes, that means there will be different layers of interop |
| 17:07 | technomancy | jayunit100: the main thing you lose is eval and reified namespaces afaik |
| 17:07 | ibdknox | jayunit100: but given the trend toward base abstractions (e.g. ring) in the clojure community, that may not mean fracturing at all |
| 17:07 | technomancy | from a dynamicity perspective |
| 17:08 | hiredman | and vars |
| 17:14 | mebaran151 | I'm having a little bit of trouble clj-http? On error statuses, I can't seem to get it to return the body of the error or the ExceptionInfo objects as documented |
| 17:14 | mebaran151 | Also is there an easy way to spy on the request it's posting? |
| 17:15 | dnolen_ | jayunit100: not sure I follow |
| 17:15 | dakrone | mebaran151: check out :throw-entire-message? and send :save-request? |
| 17:15 | joegallo | mebaran151: httptea is a clever little http proxy (written in java) that i've used for such things |
| 17:15 | dakrone | mebaran151: how are you catching the exception? |
| 17:16 | dakrone | I need to actually document :save-request? |
| 17:19 | mebaran151 | hey dakrone, try+ with a catch block |
| 17:20 | mebaran151 | let me make a gist of of the method |
| 17:21 | jayunit100 | sorry guys got distracted by solr |
| 17:21 | jayunit100 | dnolen : the JVM was an excellent selling point for clojure. One of the biggest ones. |
| 17:24 | jayunit100 | javascript is dynamic (one of clojures benefits), and isnt generally run inside the JVM (Another core aspect of cloJure's original identity) ... |
| 17:25 | jayunit100 | so i guess im kind of wondering - what non-obvious benefits we might get from writing clojure that doesn't compile down to java byte code. Other than just the fun of being able to write clojure on the browser. |
| 17:26 | dnolen_ | jayunit100: I take it you haven't written a lot of JavaScript |
| 17:26 | austinh | I'd rather write Clojure than Javascript. |
| 17:26 | gfredericks | jayunit100: I think a lot of people consider that aspect to be a bit more than just "fun" |
| 17:26 | jayunit100 | not tooo much. okay... touche maybe |
| 17:27 | technomancy | I'd say it's more about not losing your mind than about fun in and of itself |
| 17:27 | jayunit100 | okay... I see. |
| 17:28 | austinh | The prospect of reusing code between the frontend and backend is also very appealing to me. |
| 17:28 | umren | that's why node exists : |
| 17:29 | jayunit100 | ive seen some nightmarish javascript... but then again, but I've also seemed some succint js to. js is generally easier to be succint w/ than java. not as much boilerplate. |
| 17:29 | umren | clojure can't beat it there.. |
| 17:29 | jodaro | mouthless |
| 17:30 | jodaro | like in the twilight zone movie |
| 17:30 | Roxxi | What is the clojure idiom for appending lists? (e.g. scheme's srfi-1 append: (append '(a b c) '(d e f)) => '(a b c d e f)) |
| 17:30 | gfredericks | jodaro: perhaps "i" would be winking or something |
| 17:30 | gfredericks | Roxxi: concat |
| 17:30 | Roxxi | thanks |
| 17:32 | dnolen_ | jayunit100: you looked at the Himera JS synonym page right? gives a good quick summary of what ClojureScript offers over JS. |
| 17:32 | jayunit100 | dnolen: I haven't I was more just thinking out loud |
| 17:32 | Roxxi | gfredericks: http://srfi.schemers.org/srfi-1/srfi-1.html |
| 17:32 | jodaro | scheme requests for implementation |
| 17:32 | Roxxi | That too |
| 17:33 | dnolen_ | jayunit100: http://himera.herokuapp.com/synonym.html |
| 17:33 | jodaro | let me google that for me |
| 17:33 | gfredericks | I was reading a paper with some CL in it today and so it seemed believable that "srfi-1" was something you put in your code |
| 17:34 | jayunit100 | dnolen thanx btw - i saw the predicate dispatch talk the other day - very in depth i think i have to watch it again. but it was super pedagogical for me |
| 17:34 | gfredericks | okay g2g |
| 17:39 | mebaran151 | dakrone: here's a gist: https://gist.github.com/2483993. I keep getting plain exceptions without the body. |
| 17:40 | dakrone | mebaran151: change the catch line from (catch Exception e e) to (catch map? m m) |
| 17:41 | mebaran151 | dakrone, now it just throws the Exception |
| 17:42 | mebaran151 | it's also weird I'm getting a 400 response code |
| 17:43 | dakrone | mebaran151: you shouldn't, I get a map from: (try+ (get "http://aoeu.com/aoeu") (catch map? m m)) |
| 17:43 | dakrone | mebaran151: do you have an older version of something? |
| 17:44 | mebaran151 | oh my I do! |
| 17:44 | solussd | anyone use Korma w/ sqlite? Seems to choke on (aggregate (count :*)) |
| 17:44 | mebaran151 | I took the lein line from the mmcgrana version not yours |
| 17:44 | dakrone | mebaran151: oh yea, that's a very old version that won't have any of this stuff |
| 17:45 | mebaran151 | heh now it works |
| 17:45 | mebaran151 | I guess :form-params was not implmented earlier |
| 17:46 | iwo | hey, is there a way in clojure to pass a symbol (or symbols) to a function, then refer to that symbol by name within the function? |
| 17:47 | mebaran151 | and the :as :json option is so clutch, thanks Dakrone |
| 17:47 | dakrone | mebaran151: good luck! |
| 17:47 | iwo | i'd like to pass a collection of symbols to a function, but allow the function to refer to them by name. is this possible? |
| 17:48 | technomancy | iwo: refer to them by what kind of name? |
| 17:48 | iwo | something like this: #('a 'b 'c) |
| 17:50 | neotyk | dnolen_: updated CLJS-35, can't reproduce this failure |
| 17:50 | iwo | or better yet this: (defn myfunc [s] (...)) (myfunc ['a 'b 'c]) |
| 17:51 | dnolen_ | neotyk: I consistently got an error about robot.txt being invalid for property ppu |
| 17:51 | iwo | is there any way to refer to 'a 'b and 'c inside ... |
| 17:52 | _tca | refer to them by name? |
| 17:52 | dnolen_ | if anybody wants to see CLJS use a new version of Closure, please test this patch http://dev.clojure.org/jira/browse/CLJS-35 - I could not get browser REPL working. More experience reports needed. |
| 17:54 | neotyk | dnolen_: I got that error with file protocol |
| 17:54 | dnolen_ | neotyk: and what did you do different, serve the page from ring instead? |
| 17:54 | neotyk | dnolen_: nginx |
| 17:55 | neotyk | but yes, used http |
| 17:55 | dnolen_ | neotyk: yeah I won't take that patch unless it's been fully explored whether that can be avoided. |
| 17:55 | neotyk | dnolen_: I got same error with file protocol on current release as well |
| 17:55 | dnolen_ | neotyk: it works fine for me. |
| 17:55 | iwo | technomancy: so i have a collection that i know contains N symbols, and a function that needs to refer to those symbols |
| 17:55 | neotyk | dnolen_: let me revert and test file protocol |
| 17:56 | dnolen_ | neotyk: recheckout the repo, bootstrap and try again. many files get left around and don't get recompiled. |
| 17:56 | iwo | i don't know N, but I know that all symbols needed by the function will be present in the collection |
| 17:56 | dnolen_ | neotyk: I got into a weird state yesterday where I had reverted and saw the same issue. |
| 17:57 | technomancy | iwo: are you asking how to check if a given object is in a collection? |
| 17:57 | neotyk | dnolen_: will clean up samples/repl before |
| 17:57 | dnolen_ | neotyk: again, it full it working for me after I reverted your patches, checked master and boostrapped |
| 17:58 | iwo | technomancy: hmm, no. sorry i don't have the knowledge to explain this better. example: |
| 17:59 | iwo | (defn use-some-symbols ['a 'b 'c] #(str 'a 'b 'c)) |
| 17:59 | neotyk | dnolen_: on master got "Uncaught Error: URI file:/robots.txt is invalid for field ppu" |
| 17:59 | neotyk | dnolen_: let me bootstrap from clean clone |
| 18:00 | mfex | neotyk, dnolen_ : I use this to use a more recent closure version: https://github.com/thegeez/clj-browserchannel/blob/master/chat-demo/project.clj |
| 18:00 | technomancy | ,((fn [[a b c]] (str a "-" b "-" c)) [:a :b :c]) |
| 18:00 | clojurebot | ":a-:b-:c" |
| 18:00 | technomancy | iwo: that might be what you're looking for; not sure |
| 18:01 | _tca | iwo: you want #(stuff %a %b %c) instead of #(stuff %1 %2 %3) ? |
| 18:02 | iwo | yeah, don't really want it to be order dependent |
| 18:02 | dnolen_ | neotyk: I gotta run, but in order to take that patch I will need to hear more confirmations that it doesn't break stuff. |
| 18:02 | iwo | technomancy: is the comma significant there? (or is it for the bot?) |
| 18:02 | technomancy | it's for the bot |
| 18:03 | ivan | I'm calling a 0-arg Clojure function from Java (it's a Runnable?) and I get: Exception in thread "AWT-EventQueue-0" clojure.lang.ArityException: Wrong number of args (0) passed to: repl$thread-stopper$fn |
| 18:03 | ivan | is there some kind of arg I have to pass in? |
| 18:03 | neotyk | dnolen_: reproduced, clean clone on master works with file proto |
| 18:04 | iwo | technomancy: yeah, i guess i'm probably just talking about named arguments here :\ |
| 18:04 | sritchie | ivan: should just be myFn.invoke() |
| 18:05 | sritchie | ivan: treat it as an IFn |
| 18:05 | iwo | technomancy: i was hoping i could somehow refer to symbols (known within some scope) without explicitly declaring them via fn |
| 18:05 | ivan | sritchie: thanks, I'll try that |
| 18:05 | technomancy | ,((fn [& {:keys [a b c]}] (str a "-" b "-" c)) :a "hello" :b "world") |
| 18:05 | clojurebot | "hello-world-" |
| 18:05 | technomancy | all locals must be declared in the parameter list |
| 18:08 | iwo | technomancy: thanks for the help, i need to take what i've learned and rethink what i'm trying to do here :) |
| 18:08 | technomancy | sure |
| 18:09 | ivan | looks like run() does call invoke() |
| 18:11 | ivan | does this function take more than 0 args? (fn [] (stopper)) |
| 18:11 | ivan | I am a little bewildered by the error message |
| 18:12 | ivan | stopper is (clojure.repl/thread-stopper thread) |
| 18:13 | sritchie | ivan: looks like the error's with stopper |
| 18:13 | sritchie | what's the actual fn definition of stopper? |
| 18:14 | ivan | stopper is a local created in a let block: stopper (clojure.repl/thread-stopper thread) |
| 18:15 | ivan | I thought there might be some bug with multi-arity functions, which is why I wrapped it in a fn |
| 18:15 | mfex | ivan stopper requires 1 argument |
| 18:15 | ivan | using IFn and .invoke() results in the same |
| 18:16 | mfex | the doc says "Returns a function that takes one arg" http://clojure.github.com/clojure/clojure.repl-api.html#clojure.repl/thread-stopper |
| 18:16 | ivan | mfex: oh yeah, you're right, sorry! |
| 18:16 | ivan | pity about the tracebacks ;) |
| 18:17 | mfex | well you are passing the wrong number of args to repl thread-stopper :) |
| 18:45 | banjiewen | technomancy: does leiningen have a verbose output option? I'm hanging on `lein uberjar` with no output. |
| 18:47 | technomancy | banjiewen: not really. are you on the latest? |
| 18:47 | banjiewen | technomancy: no, 1.7.1 |
| 18:47 | technomancy | hm; does `lein compile` have the same problem? |
| 18:49 | banjiewen | yep |
| 18:49 | technomancy | banjiewen: ok, so you've got something in your code keeping it from finishing |
| 18:50 | banjiewen | technomancy: well I assumed it was my fault ;) |
| 18:50 | ivan | is there a language-agnostic Callable/Runnable interface that lets me pass arguments to the function? |
| 18:51 | ivan | perhaps even just one string argument |
| 18:56 | amalloy | banjiewen: often this is caused by one of your namespaces doing something side-effectful at the top level - at compile time. eg, (def connection (get-sql-connection)) |
| 18:57 | mebaran151 | ivan, any reason wouldn't just make close the run method over your argument? |
| 18:57 | ivan | mebaran151: I didn't want to pass multiple runnables into Java, but maybe I'll just do that |
| 18:58 | mebaran151 | do you instantiate your own runnable? You could create the closure in the factory function |
| 19:01 | ivan | mebaran151: I just pass a function from Clojure -> Java |
| 19:01 | ivan | mebaran151: but I'll think about that. Thanks. |
| 19:02 | mebaran151 | heh probably partial would be all you need actually |
| 19:02 | mebaran151 | (partial function str-arg) => instant runnable builder |
| 19:03 | sattvik | ivan: Functions are runnable/callabe. |
| 19:03 | sattvik | ,(.call #(str "foo")) |
| 19:03 | clojurebot | "foo" |
| 19:03 | ivan | sattvik: I didn't want to make this Java code depend on clojure.lang.IFn though |
| 19:04 | sattvik | ivan: It doesn't have to. Function implement the Runnable and Callable interfaces. |
| 19:04 | ivan | and those don't take args :-) |
| 19:04 | ivan | mebaran151: thanks |
| 19:05 | sattvik | Are you making them in Clojure and passing them to Java? |
| 19:05 | ivan | yes |
| 19:05 | mebaran151 | ,((partial count "foo")) |
| 19:05 | clojurebot | 3 |
| 19:06 | sattvik | Is the argument being passed from Clojure or from Java? |
| 19:06 | ivan | Java decides on the string argument |
| 19:07 | ivan | OTOH maybe I should just rewrite all this Java in Clojure, heh |
| 19:08 | sattvik | ivan: Well, if you want to interop with Java, it might be easiest to use a deftype that also implements Callable or Runnable. That makes the interop relatively painless. |
| 19:08 | mebaran151 | sattvik: using partial, he gets all that for free :) |
| 19:08 | mebaran151 | he just gets to prepass his string argument |
| 19:09 | sattvik | mebaran151: That's the thing: how is he passing the string argument? |
| 19:09 | sattvik | I premuse you'd want to avoid things like RT.invoke(...). |
| 19:09 | sattvik | s/premuse/presume/ |
| 19:09 | hiredman | just use IFn from java |
| 19:10 | hiredman | new AFn(){ public Object invoke(Object) {...}} |
| 19:10 | hiredman | (AFn is the abstract version of IFn if you want to avoid typing a lot of stuff) |
| 19:13 | sattvik | hiredman: That's a good option, especially if the implementation doesn't have to be in Clojure. |
| 19:15 | aperiodic | using IFn in java is pretty painless; that's how i patched up a java kinect wrapper so i could have it run clojure functions as callbacks |
| 19:15 | aperiodic | took all of five minutes |
| 19:19 | netrealm | Is it possible to overload a function with same arity, but using type hints to differentiate? |
| 19:19 | hiredman | no |
| 19:19 | alex_baranosky | nope |
| 19:21 | netrealm | Okay, cool. Thanks. |
| 19:21 | alex_baranosky | netrealm, use a multimethod |
| 19:21 | alex_baranosky | or protocol |
| 19:22 | sattvik | netrealm: Under most circumstances, you can't (though you can still check types at runtime). |
| 19:23 | sattvik | Although, definterface to do it. |
| 19:23 | netrealm | alex_baranosky: is there a preference between those two? Or does it mainly depend on how one is using it? |
| 19:23 | netrealm | sattvik: Thanks, I will look at definterface. |
| 19:23 | alex_baranosky | multimethods are more flexible, I always use them first |
| 19:23 | sattvik | Well, protocols can only dispatch on the type of the first argument, I believe. |
| 19:24 | alex_baranosky | and consider protocols an optimization |
| 19:25 | netrealm | Alright, cool. |
| 19:37 | beffbernard | Is there any way to change values in a defrecord? Or do I have to create a new instance with the updated value? |
| 19:40 | sattvik | beffbernard: You can use any standard map function, but records are immutable. I don't think there is any way to mutate in place. |
| 19:41 | beffbernard | so something like update-in? |
| 19:41 | beffbernard | then just use the resulting value? |
| 19:41 | sattvik | beffbernard: Yes. |
| 19:41 | beffbernard | sattvik: fair enough |
| 19:42 | sattvik | Pretty much, anything you can 'do' to a map, you can do to a record as well. |
| 19:46 | beffbernard | Ok.. I feel that I don't need to use defrecord, is there a stigma against using defstruct or just a plain old map? |
| 19:47 | beffbernard | I also ran into an issue trying to use a defrecord in another namespace.. import didn't seem to work and I wasn't aot compiling |
| 19:48 | technomancy | beffbernard: definitely best to start with maps |
| 19:49 | beffbernard | technomancy: I'll probably refactor my defrecords shortly then |
| 19:49 | aaelony | How can I get clojure.lang.LazySeq@.... values to resolve? Basically, I need to convert non strings. apply str gets me closer but it seems to do some clobbering as well. https://refheap.com/paste/2329 any help appreciated... |
| 19:52 | sattvik | aaelony: You could try something like doall to realise the seq. |
| 19:53 | sattvik | Maybe (str (doall x)) might do it? |
| 19:53 | aaelony | I've tried doall, must not be doing it right |
| 19:53 | technomancy | maybe apply pr-str instead of str |
| 19:53 | aaelony | ah.. interesting... |
| 19:54 | aaelony | no worries, I'll keep tinkering :) |
| 19:54 | cemerick | amalloy: when can I reasonably start pestering you to push a release of ring-gzip-middleware? ;-) |
| 19:56 | alex_baranosky | beffbernard, start with maps, then if you're not sure use maps anyway. You pretty much never need to use records. |
| 20:00 | yoklov | beffbernard: use records if you are using maps and you run into performance issues |
| 20:05 | aaelony | here is a simpler formulation: https://refheap.com/paste/2330 basically i need to convert [["abc" "def"]["xyz" 123] to [["abc" "def"]["xyz" "123"] |
| 20:07 | emezeske | &(for [x [["abc" "def"] ["xyz" 123]]] (map str x)) |
| 20:07 | lazybot | ⇒ (("abc" "def") ("xyz" "123")) |
| 20:07 | emezeske | aaelony: ^ |
| 20:08 | aaelony | emezeske: thanks... looks so simple |
| 20:09 | emezeske | aaelony: I don't know if it's the best way, but it's *a* way :) |
| 20:09 | aaelony | looks fine to me |
| 20:09 | aaelony | thanks |
| 20:09 | emezeske | aaelony: np |
| 20:14 | amalloy | cemerick: 0.1.2 is on clojars now |
| 20:14 | cemerick | amalloy: you are a gentleman and a scholar :-) |
| 20:15 | amalloy | i guess maybe i should have made it 0.2.0 or something, since you totally broke it for lein1 users |
| 20:16 | technomancy | ring middleware that depends on your lein version? |
| 20:17 | amalloy | technomancy: oh, only to build, not to use |
| 20:17 | amalloy | https://github.com/amalloy/ring-gzip-middleware/blob/master/project.clj |
| 20:17 | technomancy | oh, whew |
| 20:19 | amalloy | cemerick: github says you've now done more work on this project than i have |
| 20:20 | cemerick | I really need to work on my yak tolerance. |
| 20:20 | ibdknox | I had bad things happen when I tried to use ring-gzip on heroku |
| 20:20 | ibdknox | it would randomly choose not to serve certain files |
| 20:20 | ibdknox | twas very odd |
| 20:21 | cemerick | ibdknox: using it right now…seems ok? |
| 20:21 | emezeske | cemerick: FYI: I'm almost done integrating friend into my project, and it's been great so far. |
| 20:21 | ibdknox | it worked fine locally |
| 20:21 | ibdknox | I haven't tried it in a while :) |
| 20:21 | cemerick | emezeske: awesome. :-D |
| 20:25 | amalloy | ibdknox: i'm choosing to write that down to some sort of chris-granger-specific disease |
| 20:26 | ibdknox | lol |
| 20:27 | dougs87 | Clojure newb question: I have a jar file that my project needs that isn't from clojars. where can i put that file for lein to find it at compile time? (lein 2.x) |
| 20:27 | hiredman | dougs87: a maven repo |
| 20:28 | dougs87 | hiredman: is clojars just a maven repo at some level? |
| 20:29 | hiredman | at every level |
| 20:29 | hiredman | lein just talkes to maven repos |
| 20:29 | hiredman | it has some set of default repos and you can add more if you like |
| 20:30 | dougs87 | so a private repo is my only option? there's no location on my filesystem that would be searched by default, or directory in my project home? |
| 20:30 | hiredman | https://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md |
| 20:30 | dnolen | dougs87: you can also install that jar locally |
| 20:30 | amalloy | ~repeatability |
| 20:30 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 20:31 | hiredman | you can, for example, just toss the jars on s3 in the right way and they can be used as a maven repo |
| 20:31 | hiredman | maven repos are just bunch of files served over http |
| 20:32 | dougs87 | ok - thanks all for the direction |
| 20:34 | hiredman | I'd also recommend you search other public maven repos for the library you are looking for, unless it is some kind of internal thing it is most likely in a maven repo already |
| 20:36 | technomancy | dougs87: if this is an OSS jar, then you should open a bug report if it's not in a public maven repo |
| 20:40 | ivan | is there a way to say "private except when you call it from the code generated by a public macro"? |
| 20:41 | ivan | otherwise I think I think I have to turn these helpers into macros too |
| 20:41 | technomancy | ivan: I use ^:internal for that |
| 20:41 | ivan | thanks |
| 20:45 | ivan | I don't even know why this giant macro is a macro, perhaps because it needs to capture the local vars |
| 20:45 | ivan | I should probably turn most of it into a function |
| 21:21 | Frozenlock | I have a macro with keys argument-> {:keys [arg1 arg2 arg3]} & body... . Calling the function with the following arguments works: (my-fn {:arg1 1 :arg2 2 :arg3 3} body). However, I'm unable to place the arguments in a let binding -> (let [config {:arg1 1 :arg2 2 :arg3 3}] (my-fn config body). Any advice? |
| 21:35 | ivan | if you grabbed a fancy Clojure REPL that did (set! *print-level* 15) (set! *print-length* 103) by default, would you be annoyed? |
| 21:36 | felideon | technomancy: why do you think db-agnostic migrations are unrealistic, such as Lobos? (and Rails migrations, Django South, etc., in turn) |
| 21:40 | hiredman | migrations on non-relational stores are generally a bad idea |
| 21:40 | felideon | i dont think Lobos purports to support non-relational stores? |
| 21:41 | hiredman | then what is so agnostic about it? |
| 21:41 | felideon | well it's not tied to a specific vendor |
| 21:42 | felideon | eg postgres |
| 21:42 | gfredericks | Frozenlock: that's not how macros work |
| 21:43 | hiredman | felideon: I imagine if technomancy said something about db agnostic migrations being unrealistic he was most likely talking about migrations and nosql whatever |
| 21:43 | gfredericks | Frozenlock: the macro receives the syntactic forms you give it; any further advice would probably require knowing why you're making a macro |
| 21:44 | Frozenlock | Without going too much in details, I'm trying to do a secure operation (à la with-open). |
| 21:44 | felideon | hiredman: maybe |
| 21:44 | Frozenlock | The keys argument are there to setup the evironment. |
| 21:44 | gfredericks | Frozenlock: I think most with-foo macros can be done with a very small macro that defers to a with-foo-fn function |
| 21:45 | gfredericks | my theory is that that can make it easier to do |
| 21:45 | gfredericks | i.e., (defmacro with-foo [x & body] `(with-foo-fn ~x (fn [] ~@body))) |
| 21:46 | Frozenlock | Nice! Would be easier to read too! |
| 21:46 | Frozenlock | Thanks :) |
| 21:47 | gfredericks | Frozenlock: yessir :) |
| 21:48 | ivan | what does the @ do in (map key @clojure.lang.Compiler/LOCAL_ENV)? |
| 21:49 | amalloy | &'@foo |
| 21:49 | lazybot | ⇒ (clojure.core/deref foo) |
| 21:49 | ivan | oh, right, thanks |
| 21:50 | laurus | Does anyone know how to translate this Python to clojure-py? stats.binom.pmf(tries, 10, 0.5) |
| 21:50 | laurus | Here, stats refers to scipy.stats, and tries = range(11) |
| 21:54 | laurus | Is there any way to turn a LazySeq into a non-lazy one? |
| 21:54 | xeqi | dorun |
| 21:55 | xeqi | wait, doall |
| 21:56 | laurus | xeqi, so how would I make a non-lazy seq out of (range 11) ? If I run (doall (range 11)) I get ((0 1 2...)) rather than (0 1 2...). |
| 21:57 | xeqi | &(doall (range 11)) |
| 21:57 | lazybot | ⇒ (0 1 2 3 4 5 6 7 8 9 10) |
| 21:58 | laurus | Hmm. I was defining a variable as (range 11) and then running (doall myvariable). |
| 21:58 | xeqi | &(let [x (range 11)] (doall x)) |
| 21:58 | lazybot | ⇒ (0 1 2 3 4 5 6 7 8 9 10) |
| 21:58 | laurus | Ah, thanks! |
| 21:58 | laurus | But it still seems to be a lazyseq somehow. |
| 21:59 | xeqi | are you trying to mutate your variable? |
| 21:59 | laurus | I guess so. |
| 21:59 | laurus | I'm using clojure-py, and I'm getting this: |
| 21:59 | laurus | TypeError: unsupported operand type(s) for -: 'LazySeq' and 'float' |
| 22:00 | laurus | That's why I'm trying to de-lazify it. |
| 22:00 | xeqi | I'm not use to clojure-py, is that saying you are calling the fn '-'? |
| 22:00 | xeqi | or "-:" |
| 22:00 | laurus | That - is in Python. |
| 22:01 | xeqi | ah |
| 22:01 | laurus | It refers to k = arr((k-loc)) |
| 22:01 | laurus | In the scipy library :P |
| 22:01 | xeqi | so you have a (def varname (range 11)) somewhere? |
| 22:01 | laurus | Yes. |
| 22:02 | xeqi | do (def varname (doall (range 11))) instead |
| 22:02 | laurus | I tried that too, but it's still a LazySeq |
| 22:02 | xeqi | ah, so it is |
| 22:03 | laurus | What should I do? |
| 22:03 | xeqi | tried py/list? |
| 22:04 | laurus | That did it! |
| 22:04 | laurus | Thanks xeqi! |
| 22:04 | laurus | It's too bad this stuff doesn't integrate a bit better though. |
| 22:05 | xeqi | sometimes interop with the host environment requires converting to a host type |
| 22:05 | bdesham | &(seq (doall (range 11))) |
| 22:05 | lazybot | ⇒ (0 1 2 3 4 5 6 7 8 9 10) |
| 22:06 | laurus | bdesham, unfortunately that doesn't work well either because it's ChunkedCons now :P |
| 22:06 | bdesham | goodness gracious, what is that |
| 22:06 | technomancy | felideon: trying to normalize queries and inserts across all relational DBs is reasonable since there is a standard, but normalizing DDL is basically going to amount to a huge pile of edge cases where fixing a bug in one adapter causes bugs in others |
| 22:06 | laurus | bdesham, no idea! ;) |
| 22:07 | bdesham | :) |
| 22:07 | laurus | Welcome to the exciting new world of clojure-py! ;) |
| 22:09 | technomancy | felideon: furthermore I think usually DB-agnostic migrations are driven by a desire to be able to swap out the DB as an implementation detail, which seemed like a reasonable goal when ActiveRecord came out but has proven to be a pipe dream |
| 22:09 | felideon | technomancy: so current 'solutions' are limited to a certain subset of DDL capabilities? |
| 22:10 | technomancy | well, portability is limited to a subset |
| 22:12 | felideon | technomancy: how has that been proven? numerous edge case issues? |
| 22:13 | technomancy | felideon: right; the notion of "develop against sqlite and deploy against postgres" used to be popular among rails devs it became obvious there are simply too many subtle differences |
| 22:14 | felideon | oh wow, people actually did that? |
| 22:14 | technomancy | =( |
| 22:14 | xeqi | and more |
| 22:14 | technomancy | I would argue that even developing on a different OS and version of your database from production is asking for trouble for complex applications |
| 22:14 | xeqi | local nginx or webrick, deploy apache |
| 22:14 | xeqi | mac vs linux |
| 22:15 | felideon | or deploy webrick |
| 22:15 | felideon | (in my company's case) |
| 22:15 | xeqi | heh, I never saw that one |
| 22:15 | technomancy | http://teddziuba.com/2011/03/osx-unsuitable-web-development.html <- totally flamebait, but makes some good points |
| 22:15 | felideon | yeah. a shell script that launched 20 webrick instances behind apache load balancing |
| 22:15 | technomancy | whoa |
| 22:16 | xeqi | even worse than mongrel clustering |
| 22:17 | technomancy | http://jp1.r0tt.com/l_134c4160-6ab5-11e1-860d-f73448f00001.jpg |
| 22:17 | bdesham | oh, I love it when people call it "MacOS X" or "MacOSX" or "MAC" or crap like that |
| 22:17 | felideon | I came in without knowing a lick about Rails and stuff, but I slapped on Passenger on REE. |
| 22:17 | technomancy | bdesham: my favourite is macosecks |
| 22:17 | felideon | lol |
| 22:18 | technomancy | there are still people around who refuse to write LISP in lower case |
| 22:18 | felideon | bdesham: i call it 'best linocks distro' |
| 22:18 | felideon | technomancy: ugh yes |
| 22:19 | amalloy | laurus: it seems like you ask a lot about clojure-py in here, and there's never anyone who knows the answer. maybe you'd be better off asking on their mailing list or similar? |
| 22:21 | laurus | amalloy, ok! |
| 22:21 | laurus | Sorry if it's bothering you. |
| 22:21 | amalloy | i'm not especially bothered (and if i were, who cares - i don't own this channel) |
| 22:22 | amalloy | but you'd probably get better answers |
| 22:22 | laurus | Alright, I'll give it a whirl. |
| 22:25 | felideon | technomancy: heh, i had neer read that dziuba post |
| 22:27 | technomancy | it makes me smile |
| 22:29 | technomancy | I'm surprised he doesn't mention case-insensitivity; that's a huge facepalm issue |
| 22:29 | felideon | haha |
| 22:29 | ivan | does anything look wrong in https://github.com/alandipert/clj-swingrepl/blob/ivank-fixes/src/clj/org/dipert/swingrepl/main.clj? |
| 22:30 | ivan | I changed a lot of stuff and I had no idea what I was doing |
| 22:36 | felideon | ,'foo |
| 22:36 | clojurebot | foo |
| 22:36 | felideon | &'foo |
| 22:36 | lazybot | ⇒ foo |
| 22:36 | felideon | oh |
| 22:39 | bdesham | ,"&'foo" |
| 22:39 | clojurebot | "&'foo" |
| 22:40 | bdesham | damn |
| 22:40 | gfredericks | ,(println "&'foo") |
| 22:40 | clojurebot | &'foo |
| 22:40 | lazybot | ⇒ foo |
| 22:41 | bdesham | ah, there you go |
| 22:44 | felideon | hmm too bad laybot prepends the ⇒ |
| 22:44 | felideon | lazybot* |
| 22:45 | Raynes | Yeah, it'd be great if I were stupid. |
| 22:45 | gfredericks | :) |
| 22:45 | amalloy | haha |
| 22:45 | amalloy | i have good news, then |
| 22:45 | gfredericks | Raynes: what you didn't want to make the channel totally worthless for most hours of the day? |
| 22:45 | Raynes | Shucks. |
| 22:46 | gfredericks | wait I guess the channel would shut them up for spamming pretty quick |
| 22:46 | felideon | Raynes: hahaha sorry |
| 22:58 | Lajla | Raynes, why do we have 2 bots? |
| 23:03 | Frozenlock | gfredericks: i just realized that what I was trying to do wouldn't have worked with a function either. If I have a function with keys argument, how can I use a map as input? For example, if I have (fn [:keys {arg1 arg2 arg3}] body), is there a way to use the hashmap {:arg1 1 :arg 2 :arg3 3} as input? |
| 23:05 | xeqi | &((fn [{:keys [a b c]}] [a b c]) {:a 1 :b 2 :c 3}) |
| 23:05 | lazybot | ⇒ [1 2 3] |
| 23:05 | skelternet | I didn't expect compiling my app to actually call the function and attempt to connect to the ldap server. |
| 23:05 | gfredericks | Frozenlock: are you hoping to be able to call it with varargs like (f :a 1 :b 2 :c 3), or just the way xeqi just did? |
| 23:06 | gfredericks | skelternet: anything you do at the top level will get run when compiling |
| 23:07 | skelternet | gfred: Ok…so…for things like connections, should I use (delay…) ? |
| 23:07 | gfredericks | I've done that. there might be a more idiomatic way I'm not thinking of. |
| 23:07 | Frozenlock | Well I was hoping to avoid rewriting everything in the map.; (fn map body). Done. |
| 23:07 | gfredericks | Frozenlock: it should work; check the example xeqi gave |
| 23:08 | xeqi | (when-not *complile-files* ...) ? |
| 23:08 | skelternet | gfred: yeah…I'd like whoever I hand this off to to be able to compile while not connected to a network with our active directory and database connections ;) |
| 23:08 | xeqi | *compile-files* |
| 23:09 | gfredericks | xeqi: so that'll still be run later? |
| 23:12 | xeqi | .. I'm not sure, just learned about it last week |
| 23:13 | xeqi | but I've seen it used for reading configs later, so I think so |
| 23:16 | Frozenlock | ,((fn [&{:keys [a b c]}] [a b c]) {:a 1 :b 2 :c 3}) |
| 23:16 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {:a 1, :c 3, :b 2}> |
| 23:16 | Frozenlock | bingo- the & was messing everything |
| 23:17 | xeqi | ,((fn [&{:keys [a b c]}] [a b c]) :a 1 :b 2 :c 3}) |
| 23:17 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }> |
| 23:17 | xeqi | ,((fn [&{:keys [a b c]}] [a b c]) :a 1 :b 2 :c 3) |
| 23:17 | clojurebot | [1 2 3] |
| 23:17 | gfredericks | Frozenlock: yeah that's for if you want to do it varargs style like I mentioned earlier |
| 23:17 | gfredericks | and like xeqi just demonstrated once again :) |
| 23:18 | Frozenlock | Yes, but I couldn't for the life of me see what I was doing differently than xeqi's |
| 23:21 | gfredericks | stupid characters |
| 23:21 | Frozenlock | well.. stupid me :p |
| 23:26 | skelternet | (bind [*goodnights*... |