2012-03-08
| 00:00 | technomancy | oh that's right; what you want is filter-indexed, but for some reason it doesn't exist |
| 00:00 | tmciver | ,(apply + (take-nth 2 '(1 2 51 44 66 77))) |
| 00:00 | clojurebot | 118 |
| 00:00 | technomancy | good man |
| 00:01 | tmciver | thanks. I'm gettin' there. |
| 00:01 | dreampeppers99 | great! |
| 00:01 | dreampeppers99 | and for even elements |
| 00:01 | dreampeppers99 | the take-nth won't work |
| 00:02 | dreampeppers99 | (apply + (take-nth 2 (rest '(1 2 51 44 66 77)))) |
| 00:02 | tmciver | yup |
| 00:02 | dreampeppers99 | ,(apply + (take-nth 2 (rest '(1 2 51 44 66 77)))) |
| 00:02 | clojurebot | 123 |
| 00:02 | dreampeppers99 | ,(apply + (take-nth 2 (rest '(1 2 3)))) |
| 00:02 | clojurebot | 2 |
| 00:02 | dreampeppers99 | ,(apply + (take-nth 2 ('(1 2 3)))) |
| 00:02 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn> |
| 00:02 | dreampeppers99 | ,(apply + (take-nth 2 '(1 2 3))) |
| 00:02 | clojurebot | 4 |
| 00:02 | dreampeppers99 | perfect :D |
| 00:05 | dreampeppers99 | why can't I apply the reduce function instead of + ? |
| 00:05 | dreampeppers99 | ,(apply + (take-nth 2 '(1 2 51 44 66 77))) |
| 00:05 | clojurebot | 118 |
| 00:05 | dreampeppers99 | ,(reduce + (take-nth 2 '(1 2 51 44 66 77))) |
| 00:05 | clojurebot | 118 |
| 00:05 | dreampeppers99 | ,(reduce + (take-nth 2 '(1 2 51))) |
| 00:05 | clojurebot | 52 |
| 00:05 | dreampeppers99 | ,(apply + (take-nth 2 '(1 2 51))) |
| 00:05 | clojurebot | 52 |
| 00:05 | dreampeppers99 | ,(apply + (take-nth 2 '(1 2))) |
| 00:05 | clojurebot | 1 |
| 00:05 | dreampeppers99 | ,(reduce + (take-nth 2 '(1 2))) |
| 00:05 | clojurebot | 1 |
| 00:06 | dreampeppers99 | nevermind silliest of mine |
| 00:06 | dreampeppers99 | once again thank you guys! |
| 00:06 | dreampeppers99 | :D |
| 00:07 | Lajla | Why can he dod that and not I? |
| 00:07 | technomancy | Did You Know™: it is actually possible to communicate with clojurebot via private /msg calls? |
| 00:07 | dreampeppers99 | sorry for that! |
| 00:07 | dreampeppers99 | I didn't know, my mistake. |
| 00:07 | Lajla | dreampeppers99, do not let them take away your freedom |
| 00:07 | technomancy | no worries; not much going on in here anyway |
| 00:07 | Lajla | your faith |
| 00:08 | ibdknox | technomancy: what's the fun in that |
| 00:08 | Lajla | your freedom to love, your freedom to hate, your freedom to worship His Divine Shadow |
| 00:08 | ibdknox | technomancy: last time I did it, clojurebot was getting inappropriate |
| 00:08 | tmciver | lol |
| 00:08 | dreampeppers99 | is this the "official" irc channel for clojure? |
| 00:08 | ibdknox | yes |
| 00:09 | tmciver | ibdknox: tell him he has to take you out to dinner first. |
| 00:09 | technomancy | ibdknox: "get a room you two"? |
| 00:09 | ibdknox | haha |
| 00:09 | ibdknox | tmciver: I did, but then he was trying to guilt me saying he's never been outside of #clojure |
| 00:10 | tmciver | ibdknox: don't you fall for his tricks; you'll regret it in the morning (I know I did) |
| 00:10 | ibdknox | lol |
| 00:10 | ibdknox | tricksy little hobbitses, that one |
| 00:11 | tmciver | what's it doing?! |
| 00:12 | ibdknox | can one of you guys manufacture some more time for me? |
| 00:13 | technomancy | to the tardis! |
| 00:13 | Null-A | ibdknox: sure, don't sleep tonight. |
| 00:14 | dreampeppers99 | just for the record I was trying to solve the Peasant Multiplication using Clojure. Since I'm a newbie for Clojure my solution is very poor coded. But, anyway thanks for your helping. |
| 00:14 | ibdknox | haha. Touche. |
| 00:14 | Null-A | that's what separates from clojure hackers from the boys |
| 00:15 | ibdknox | that's what I wanna be when I grow up :D |
| 00:16 | Null-A | you will one day young grasshopper |
| 00:16 | Iceland_jack | · |
| 00:24 | amalloy | technomancy: filter-indexed strikes me as annoyingly specialized (same with keep-indexed fwiw): don't clutter the stdlib with combinations of existing functions. i'd prefer to see mapcat-indexed added, and from that you can easily derive map-indexed, filter-indexed, keep-indexed, whatever you need for your actual problem |
| 00:24 | technomancy | or just ... indexed? |
| 00:25 | amalloy | i suppose. that was removed because it leads to a lot more consing, so i was assuming we keep it out |
| 00:27 | technomancy | I'd vote for keep the most general and the most efficient |
| 00:28 | ibdknox | what's this? |
| 00:28 | technomancy | ibdknox: indexed from contrib got promoted into a bunch of core functions: map-indexed, keep-indexed, and maybe another one? |
| 00:29 | ibdknox | ah |
| 00:29 | amalloy | i can't think of any others |
| 00:29 | technomancy | which is annoying because they're complected, but apparently composing map and indexed is "too slow" |
| 00:29 | technomancy | so you're on your own if you want filter-indexed |
| 00:30 | technomancy | you have to do something dumb like (filter f (map-indexed vector coll)) |
| 00:42 | rlb | I'd like to partition a collection on boundaries defined by a predicate. i.e.: |
| 00:42 | rlb | (partition-foo #(re-matches "id:.*" %1) ["id: 1" "a" "b" "id: 2" "x"]) |
| 00:42 | rlb | => [["id: 1" "a" "b"] ["id: 2" "x"]] |
| 00:42 | rlb | Is there already something like that? |
| 00:42 | Iceland_jack | separate? |
| 00:42 | clojurebot | separate is in clojure.contrib.seq-utils, but just use (juxt filter remove) instead |
| 00:43 | sritchie | partition-by? |
| 00:43 | sritchie | hmm, not quite |
| 00:43 | sritchie | ,(partition-by #(re-matches #"id:.*" %1) ["id: 1" "a" "b" "id: 2" "x"]) |
| 00:43 | clojurebot | (("id: 1") ("a" "b") ("id: 2") ("x")) |
| 00:44 | rlb | I want the "id: .." line to be part of the group. |
| 00:45 | amalloy | (useful.seq/partition-between (fn [[a b]] (re-matches #"^id:.*" b)) coll), roughly |
| 00:46 | amalloy | https://github.com/flatland/useful/blob/develop/src/useful/seq.clj |
| 00:46 | rlb | amalloy: exactly -- thanks. |
| 00:54 | gtuckerkellogg | ,(def foo "foo") |
| 00:54 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 00:54 | gtuckerkellogg | ,(java.util.regex.Pattern/compile (def foo "foo") |
| 00:54 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 00:54 | gtuckerkellogg | ,(java.util.regex.Pattern/compile "foo") |
| 00:54 | clojurebot | #"foo" |
| 00:55 | gtuckerkellogg | is that the best (only) way to create a regex from a string in Clojure? (supposing (def foo "foo") |
| 00:56 | amalloy | hm, it occurs to me there ought to be a cleverer way to implement partition-between, reusing pieces of the input sequence as the args to the split? function |
| 00:56 | Raynes | amalloy: It occurs to me that a lot occurs to you. |
| 00:57 | amalloy | i'm the occurrence nexus of the country |
| 00:57 | Raynes | Have you ever considered seeing if anything occurs to a doctor about how much occurs to you? Perhaps there is a medication for it. |
| 01:04 | Null-A | gtuckerkellogg: ,(re-pattern "foo") |
| 01:04 | Null-A | ,(re-pattern "foo") |
| 01:04 | clojurebot | #"foo" |
| 01:08 | gtuckerkellogg | thanks |
| 01:34 | johnmn3 | What layout manager is most recommended to use with seesaw? |
| 02:25 | gf3 | has anyone experience issues with validations in noir 1.2.2? |
| 02:26 | gf3 | I get the following when I try to use validation/rule or validation/errors? → |
| 02:26 | gf3 | ClassCastException clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref clojure.core/deref (core.clj:2078) |
| 02:26 | gf3 | with any kind of input |
| 02:29 | gf3 | example → http://cloud.gf3.ca/EqcH |
| 02:44 | _ulises | morning all |
| 02:53 | seancorfield | if i have some-lib-1.4.2.jar and some-lib-1.4.3.jar on my classpath, is there some mechanism that chooses which one to load? (this question came up in another non-clojure context and after googling i'm not sure what the definitive answer is) |
| 02:54 | raek | I think that load-file will search the jars for the file in the order they appear on the classpath |
| 02:54 | raek | which can be really bad |
| 02:56 | raek | 1.4.2 has foo, which uses bar and 1.4.3 has only bar, then if you have them ordered as 1.4.3, 1.4.2 on the classpath and try to load foo, version 1.4.2 of foo will load and cause version 1.4.3 of bar to load |
| 03:00 | osa1 | can anyone verify that this code works on clojure 1.3 https://github.com/clojure/clojure-contrib/blob/b8d2743d3a89e13fc9deb2844ca2167b34aaa9b6/src/main/clojure/clojure/contrib/zip_filter/xml.clj#L88 ? |
| 03:01 | osa1 | or is there a newer version of this? |
| 03:04 | zamaterian | osa1, read http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 03:09 | osa1 | zamaterian: ok, this doesn't work either https://github.com/clojure/data.zip/blob/master/src/test/clojure/clojure/data/zip/xml_test.clj |
| 03:11 | georgek | hi, I'm getting started with cljs and cljs/one, sometimes I kill the cljs/one repl for whatever reason, but if I want to restart the repl I get "BindException Address already in use: JVM_Bind java.net.PlainSocketImpl.socketBind", what's the right way to restart? |
| 03:11 | zamaterian | osa1, I have a project where i'm using zip xml from [org.clojure/data.zip "0.1.0"] together with clojure 1.3 |
| 03:13 | osa1 | zamaterian: is it on github? I could have a look |
| 03:14 | zamaterian | seancorfield, if you have one or mere lib with conficts in version in the same classpath you could use -Xbootclasspath with suns java bin |
| 03:16 | zamaterian | osa1, its in a private repository... 2 sek I will cut the relevant parts out into a gist |
| 03:25 | zamaterian | osa1, https://gist.github.com/1999613 |
| 03:28 | osa1 | zamaterian: great, thanks |
| 03:47 | osa1 | does anyone know a function to build get data url for http from a map or vector? |
| 03:50 | osa1 | whatever, I've just wrote one |
| 03:53 | zamaterian | osa1, (map slurp ["http://github.com" "http://slashdot.org/"]) :-) |
| 03:57 | osa1 | zamaterian: sorry for my english. what I meant was, I need to generate URL's for from maps, for example {1 2 3 "a b"} should return me 1=2&3=a+b etc. |
| 04:28 | gtuckerkellogg | what's the easiest way to keep the non-nil members of a list? |
| 04:29 | lucian | ,(filter (complement nil?) [1 2 3 nil 4 5 nil]) |
| 04:29 | clojurebot | (1 2 3 4 5) |
| 04:30 | gtuckerkellogg | is that considered idiomatic? |
| 04:30 | gtuckerkellogg | how about |
| 04:30 | lucian | i don't really know, tbh. but it works |
| 04:30 | tomoj | (keep identity coll) ? |
| 04:31 | tomoj | and/or (filter identity coll)? |
| 04:31 | gtuckerkellogg | ,(filter (fn [x] x) (1 2 3 nil 4 5)) |
| 04:31 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 04:31 | gtuckerkellogg | ,(filter (fn [x] x) '(1 2 3 nil 4 5 )) |
| 04:31 | clojurebot | (1 2 3 4 5) |
| 04:32 | gtuckerkellogg | although that's not exactly what I asked is it |
| 04:32 | gtuckerkellogg | hmm |
| 04:32 | tomoj | I sometimes imagine that keep has a one-arg version that is (keep identity coll) |
| 04:32 | amalloy | (remove nil? xs) |
| 04:32 | lucian | why bother with a fn? tomoj suggested identity |
| 04:32 | tomoj | oh, right |
| 04:32 | tomoj | if you really want "non-nil".. |
| 04:32 | gtuckerkellogg | ok, thanks |
| 04:32 | tomoj | (remove nil? coll) |
| 04:34 | tomoj | hmm is xs in fashion or is it just you amalloy |
| 04:35 | lucian | tomoj: i've seen it a lot in haskell and ml, like x::xs |
| 04:35 | amalloy | *shrug* a list where each element is x, is xs |
| 04:35 | tomoj | right |
| 04:35 | lucian | "a bunch of x -s" is what it sounds like to me |
| 04:35 | amalloy | coll is probably a better answer to this particular question, but i certainly didn't care |
| 04:36 | tomoj | I often want to use that style but feel like it's not clojure idiom |
| 04:37 | tomoj | but would probably use it more if I saw it more.. |
| 04:39 | gf3 | hey guys, why would noir *not* use atoms here? https://github.com/ibdknox/noir/blob/1.3/src/noir/session.clj#L13 |
| 04:39 | clgv | tomoj: 'coll is very descriptive as well^^ |
| 04:40 | zamaterian | gf3, look at line 83 |
| 04:40 | zamaterian | s/83/82 |
| 04:40 | clgv | gf3: because this way you can have multiple request with different sessions at the same time in different threads - that wont be possible with an atom |
| 04:41 | gf3 | clgv: ahh, makes sense |
| 04:42 | gf3 | clgv: I'm running into issues where I try to access the session and it is unbound |
| 04:42 | gf3 | which is why I asked |
| 04:42 | clgv | gf3: then you probably forgot to add a "middleware statement" like wrap-session or something similar |
| 04:43 | clgv | gf3: this one: https://github.com/ibdknox/noir/blob/1.3/src/noir/session.clj#L55 |
| 04:47 | gf3 | clgv: I don't think I am, hmm |
| 04:47 | gf3 | clgv: it doesn't always fail, just sometimes |
| 04:48 | clgv | gf3: if that ring middleware wrap-noir-sessions is registered correctly and you are only accessing it from requests that should be fine |
| 04:49 | clgv | gf3: if you are in clojure 1.2(.1) then there might be an issue if you access it from a different thread than the request thread |
| 04:49 | gf3 | clgv: it seems to fail when accessed from a model inside a partial |
| 04:49 | gf3 | page → partial → partial → model |
| 04:53 | osa1 | I have a map with names for keys and integers for values, how can I sort it's values? |
| 04:55 | gf3 | osa1: (sort (vals your-map)) |
| 04:55 | osa1 | gf3: I also need keys of this vals after sorting :) |
| 04:57 | osa1 | (sort #(compare (nth %1 1) (nth %2 1)) map) |
| 04:57 | gf3 | osa1: (sort #(compare (last %1) (last %2)) your-map) |
| 04:59 | y3di | hey guys, im starting out with clooj. I defined a (coin-toss) function but when I try to run it in the repl I get this error |
| 04:59 | y3di | compiling:(NO_SOURCE_PATH:1) |
| 05:00 | y3di | in full: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: coin-toss in this context, compiling:(NO_SOURCE_PATH:1)> |
| 05:00 | vijaykiran | y3di: did you (use 'yournamespace) in the repl ? |
| 05:01 | vijaykiran | where yournamespace is where you defined your coin-toss |
| 05:01 | y3di | nope, thanks |
| 05:02 | y3di | so i tried this: (use 'gamble-core) |
| 05:02 | y3di | but i get a file not found exception |
| 05:03 | raek | y3di: what is the file path of the namespace? gamble/core.clj or gamble_core.clj? |
| 05:03 | y3di | this is what I have at the top of core.clj inside my 'gamble' folder: (ns gamble.core) |
| 05:03 | raek | y3di: then do a (use 'gamble.core) :-) |
| 05:03 | raek | period in name = subdirectory in file system |
| 05:04 | raek | hyphen in name = underscore in file path |
| 05:04 | y3di | ok, thanks alot, not sure why i used hyphen in the first place.. |
| 05:14 | y3di | sorry for the newb questions but im getting the same error i was before when i try to run toss-score or t |
| 05:14 | y3di | https://gist.github.com/2000130 |
| 05:15 | y3di | but (coin-toss) works fine |
| 05:19 | vijaykiran | you may need to reload the namespace after you added these functions |
| 05:19 | vijaykiran | (use 'gamble.core :reload) |
| 05:24 | xkb | Hi |
| 05:24 | vijaykiran | y3di: ^^ |
| 05:24 | xkb | Im working on some 4Clojure problems, and my alternative to map blows the heap. Any idea why? code is @ https://gist.github.com/2000178 |
| 05:24 | vijaykiran | xkb: Hi |
| 05:25 | y3di | vijaykiran: thanks, I guess clooj doesn't auto reload on save |
| 05:25 | xkb | never mind the strange list/cons action, was trying out some alternative list creation forms |
| 05:26 | vijaykiran | btw - why pp is (def pp fn .. ) ? you can use (defn .. ) .. right ? |
| 05:26 | xkb | yes |
| 05:26 | xkb | but in 4clojure you need to answer inline |
| 05:27 | xkb | as an anoymous function I suppose |
| 05:28 | xkb | see http://www.4clojure.com/problem/118 for example |
| 05:29 | xkb | that's the one I'm working on now |
| 05:29 | pipeline | 4clojure is pretty awesome |
| 05:30 | pipeline | but the "def is bad" thing drives me a little crazy since it means a bunch of copy/pasting |
| 05:30 | xkb | yep |
| 05:30 | xkb | my whole emacs scatch file is filled with def's for 4clojure :P |
| 05:31 | xkb | I did like most of the challenges |
| 05:31 | xkb | I think my solution for this one is not lazy |
| 05:31 | pipeline | of course copy/pasting only drives me crazy because some combinatino of my firefox version and the rich text js in 4clojure breaks paste from emacs |
| 05:31 | xkb | and that's why it blows |
| 05:31 | xkb | hehe |
| 05:31 | xkb | same here |
| 05:31 | xkb | so I work the other way around |
| 05:31 | pipeline | yeah I think that's how they test for laziness: huge sequences |
| 05:31 | xkb | from 4clojure past to emacs |
| 05:32 | xkb | paste* |
| 05:32 | xkb | reduce works on lazy seq's |
| 05:32 | xkb | so that can't be it |
| 05:33 | xkb | so that leaves the seq I'm building |
| 05:34 | vijaykiran | may be use lazy-cons ? |
| 05:35 | vijaykiran | http://clojure.org/lazy |
| 05:38 | xkb | hmm good tip |
| 05:38 | xkb | let's see |
| 05:43 | xkb | hehe solved it |
| 05:43 | xkb | using lazy-seq |
| 05:44 | vijaykiran | yeah .. sorry lazy-seq not lazy-cons :) |
| 06:03 | y3di | why does 'its' break the convention of possession using apostrophes? Is there a particular reason for this? |
| 06:06 | loops | ok, have spent 2 hours trying to figure out how to use leiningen, ready to set my hair on fire :oP |
| 06:07 | loops | it says you need to run v1 lein install in "leiningen-core subproject directory" where is that directory? |
| 06:08 | zamaterian | loops, leiningen is only for lein 2 |
| 06:08 | loops | zam.. yeah.. i kinda answered my own question.. i just dont have a v1 to use for bootstrapping |
| 06:08 | zamaterian | loops, ups leiningen-core is only for lein 2 |
| 06:09 | loops | so i was checking it out from git history, but of course that removes the v2 leiningen-core directory ;o) |
| 06:10 | loops | bit of a catch-22, would be nice if old version wasn't needed for us noobs ;o) |
| 06:13 | loops | just checked out v1 and renamed the script to lein1... and used it for bootstrap.. easy once ya grok the problem |
| 06:14 | loops | thx zama |
| 06:15 | vijaykiran | y3di: I think the rule (or exception rather) is for all the possesive pronouns |
| 06:17 | y3di | yea i forgot that it was the same way for his, hers, whose, etc |
| 06:44 | randomnamehere | hi ;) |
| 06:45 | randomnamehere | How can I yield functions for each entry in a list ? |
| 06:45 | randomnamehere | ("x" "y" "z") << delete (x) delete (y) delete (z) ... ? |
| 06:45 | clgv | randomnamehere: example? |
| 06:46 | clgv | is (map delete '("x" "y" "z")) what you mean? |
| 06:46 | clgv | &(map inc [1 5 9]) |
| 06:46 | lazybot | ⇒ (2 6 10) |
| 06:47 | randomnamehere | maybe reduce? |
| 06:47 | clgv | can you give input and epected output? |
| 06:47 | thorwil | map is lazy, isn't it? |
| 06:47 | clgv | yes |
| 06:48 | randomnamehere | input: ["people_9b59a761-f360-4e53-98b4-d2352b275a70" "people_a563d6e9-841b-4f2c-87c2-c7e697f9d104"] |
| 06:48 | randomnamehere | output should be function calls to (.delete ... ) |
| 06:48 | clgv | ah |
| 06:48 | clgv | (doseq [p people] (.delete p)) |
| 06:49 | clgv | that will call 'delete on each 'p from the 'people collection |
| 06:49 | randomnamehere | Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by "for" << "for" = |
| 06:49 | clgv | for is lazy again^^ |
| 06:50 | randomnamehere | I do not understand the documentation of that ;) |
| 06:50 | randomnamehere | (doseq [p people] (.delete p)) << where is the "for" ? |
| 06:50 | raek | randomnamehere: doseq uses the same syntax as for |
| 06:50 | clgv | no for needed. you can use the same optional parameters as in 'for |
| 06:50 | clgv | (doseq [p people :when (.ugly p)] (.delete p)) ;) |
| 06:51 | raek | (for [p people] (.delete p)) yields a lazy sequence of the return values of the .delete calls |
| 06:51 | randomnamehere | is it also possible to use: (reduce (.delete p) [p people]) ? |
| 06:51 | raek | doseq is similar, but does not create a sequence and is not lazy |
| 06:52 | raek | randomnamehere: you cannot call reduce like that |
| 06:52 | clgv | randomnamehere: if you dont want to return a value 'reduce is wrong. |
| 06:52 | clgv | randomnamehere: what's your objection concerning 'doseq ? |
| 06:52 | randomnamehere | dosseq documentation: Does not retain the head of the sequence. Returns nil. |
| 06:53 | clgv | yep. it's intended for side effects and not returning anything |
| 06:53 | randomnamehere | none objection clgv , I only really try to understand what I do |
| 06:53 | clgv | randomnamehere: ok. doseq is more like a for-loop in c++ or java |
| 06:53 | randomnamehere | okay and if .delete returns futures which can tell if the delete happened i have to use some other things |
| 06:54 | raek | (doseq [p people] (.delete p)) expands into something like (loop [ps people] (when (seq ps) (.delete (first ps)) (recur (rest ps)))) |
| 06:54 | clgv | randomnamehere: than you could use (doall (map #(.delete %) people)) where 'doall is needed to force deletion immediately |
| 06:54 | raek | randomnamehere: yes, if you care about the return values, use for or map |
| 06:54 | clgv | *then |
| 06:54 | randomnamehere | Ahh,... but it does not happen in parallel ;( |
| 06:55 | randomnamehere | How can I feed a list in and do parallel .delete actions? |
| 06:55 | raek | randomnamehere: submit them to an ExecutionService |
| 06:56 | raek | randomnamehere: you said that .delete returns a future. does that mean that the work of .delete is performed in another thread? |
| 06:56 | randomnamehere | is there no simple solution in clojure, like (doparallel [p people] (.delete p)) |
| 06:57 | raek | well, there is pmap, which is like map but performs some of the calculation in parallel |
| 06:57 | randomnamehere | Ahh raek, you are right... |
| 06:57 | raek | but only a fixed number of them at the same time |
| 06:58 | randomnamehere | wow, nice. But it seem I do not need pmap cause the java library behind also creates threads |
| 06:58 | randomnamehere | (doall (map #(.delete %) people)) << this is more kind of functional style, isn't it? |
| 06:58 | lucian | you could also use memfn, but it's not really a significant improvement |
| 06:59 | raek | if you want to block for all of them to return, you could do (doseq [f (map #(.delete %) people)] (.get f)) |
| 06:59 | raek | sorry |
| 06:59 | raek | (doseq [f (doall (map #(.delete %) people))] (.get f)) |
| 06:59 | randomnamehere | What does #( %) ? |
| 07:00 | randomnamehere | % is each item? |
| 07:00 | raek | #(.delete %) is a short form for (fn [x] (.delete x)) |
| 07:00 | raek | you cannot write just ".delete" since java methods are not clojure functions |
| 07:00 | lucian | you could also do (map (memfn .delete) people) |
| 07:00 | raek | (memfn predates the #(...) shorthand syntax) |
| 07:01 | lucian | uh, without the dot. (memfn delete) |
| 07:01 | randomnamehere | but delete only tooks one value, not the whole keyset |
| 07:01 | lucian | of course, that's what map does |
| 07:02 | lucian | raek: you're right, i just found it more clear sometimes |
| 07:03 | randomnamehere | (doseq [p people :when (.ugly p)] (.delete p)) ;) << i like that one |
| 07:03 | raek | randomnamehere: in case you need to do the threading yourself sometime: http://blog.raek.se/2011/01/24/executors-in-clojure/ |
| 07:04 | raek | the last example is the most relevant |
| 07:04 | randomnamehere | (doseq [f (doall (map #(.delete %) people))] (.get f)) << this one? |
| 07:04 | raek | sorry, the last repl example in the blog post :-) |
| 07:05 | raek | anyway, an explanation of (doseq [f (doall (map #(.delete %) people))] (.get f)): |
| 07:05 | randomnamehere | future-call ? |
| 07:05 | raek | first it uses map to create a lazy sequence iof (.delete p1) (.delete p2) (.delete p3)... |
| 07:05 | raek | randomnamehere: no the one before that |
| 07:06 | randomnamehere | ahh ok |
| 07:06 | raek | then 'doall' is used to make sure all .delete calls have been forced |
| 07:06 | raek | at this point all the .deletes are ticking in the background |
| 07:06 | raek | then we iterate over all the futures they returned and wait for them to finish, one by one |
| 07:07 | raek | using the doseq loop |
| 07:07 | randomnamehere | yeahh! |
| 07:07 | randomnamehere | super-awesome |
| 07:08 | raek | assuming you have the java.util.concurrent.Future kind of futures |
| 07:10 | randomnamehere | "doseq should be a vector" |
| 07:11 | randomnamehere | hmpf |
| 07:13 | raek | randomnamehere: did you mean "doseq requires a vector for its binding"? |
| 07:13 | randomnamehere | yes |
| 07:13 | randomnamehere | java.lang.IllegalArgumentException: Parameter declaration doseq should be a vector |
| 07:14 | randomnamehere | (doseq [f (doall (map #(.delete %) (cget bucket)))] (.get f)) |
| 07:14 | randomnamehere | mh |
| 07:14 | raek | the syntax of doseq requires you to first have a vector of name-expression pairs and then one or more body expressions |
| 07:14 | randomnamehere | isn't this the case? |
| 07:14 | randomnamehere | [f ...] (body) |
| 07:14 | raek | yes |
| 07:15 | randomnamehere | So why doesn't clojure like it? |
| 07:15 | raek | randomnamehere: that line parses for me |
| 07:15 | raek | does it look exactly like that in your code? |
| 07:16 | randomnamehere | (defn cremoveall "Removes all items from collection including the head node" (doseq [f (doall (map #(.delete %) (cget bucket)))] (.get f))) |
| 07:16 | randomnamehere | ahh |
| 07:17 | randomnamehere | missed [bucket] |
| 07:17 | raek | yeah |
| 07:17 | raek | ah, now I see |
| 07:17 | raek | you can have variadic defns like this: (defn foo ([] ...) ([x] ...) ([x y] ...)) |
| 07:18 | raek | and clojure tried to parse your (doseq ...) as a ([x y] ...) |
| 07:18 | raek | ergo the "doseq should be a vector" |
| 07:22 | randomnamehere | (defn cdeleteall "Removes all items from collection including the head node" [bucket] (doseq [f (doall (map #(.delete (find-connection) %) (cget bucket)))] (.get f))) |
| 07:22 | randomnamehere | now i need to append the value of bucket to the list returned by cget bucket |
| 07:23 | randomnamehere | think conj will work |
| 07:48 | tutysara_ | I am wanted to change the path to the lein executabe, I got this command from techomancy - (setq clojure-swank-command "/path-to-lein/lein jack-in %s"). I am putting this in the scratch bufffer and executing it (M-x eval-buffer). Is that the right way to do this? |
| 07:48 | tutysara_ | *technomancy |
| 07:49 | lucian | i'm assuming you have your real path there |
| 07:51 | tutysara_ | lucian : yes you are right, i am using this - (setq clojure-swank-command "/cygdrive/c/cygwin/home/Administrator/bin/lein jack-in %s") |
| 07:51 | lucian | you might want to put that in your ~/.emacs if you want it to happen when you open emacs |
| 07:53 | tutysara_ | lucian : if i execute it from scratch buffer will it wont take effect immediately for that session, I am evaluating this command from scratch and the next thing I do is hit M-x clojure-jack-in and see if it works |
| 07:54 | tutysara_ | lucian : if i execute it from scratch buffer will it wont take effect immediately for that session ?, I am evaluating this command from scratch and the next thing I do is hit M-x clojure-jack-in and see if it works |
| 07:54 | lucian | what you eval should take effect |
| 07:56 | tutysara_ | lucian : any way i will try your suggestion, put that in .emacs and see if that works |
| 07:59 | tutysara_ | lucian : same error buddy : ( |
| 07:59 | lucian | what is the error? |
| 08:06 | tutysara_ | start-process-shell-command: Spawning child process: invalid argument |
| 08:17 | gf3 | ibdknox: am I wrong in thinking build-dirs should include (:src-dir opts)? https://github.com/ibdknox/noir-cljs/blob/master/src/noir/cljs/watcher.clj#L108 |
| 08:25 | clgv | gf3: are you using noir with cljs? did you find a good guide for it? |
| 08:25 | gf3 | clgv: I'm attempting to |
| 08:26 | clgv | gf3: will your project be on github? |
| 08:26 | gf3 | clgv: and no, I haven't found a good guide, I am considering writing one |
| 08:26 | clgv | gf3: even better ^^ |
| 08:26 | gf3 | woo |
| 08:27 | randomnamehere | I want to remove a part from an entry in memcached... |
| 08:27 | randomnamehere | clojurestack.memcache=> (with-mc db-nodes (cgetmap "people")) #<HashMap {people_621a0f2c-9376-4476-b23f-57f99ac9c0de="hanna-lena" , people_dfa7df94-39ef-45b7-9cf1-22d3311507bd="martin" }> |
| 08:28 | clgv | I have build a little webapp that renders incanter charts for some timeseries. the app could be a little more responsive via js... |
| 08:28 | randomnamehere | (defn cdeleteitem "Removes item from collection" [bucket item] (let [bucketcontents (cgetmap bucket)] ) |
| 08:28 | randomnamehere | how to find the item with (= ...) and get the key to remove? |
| 08:30 | clgv | randomnamehere: do you know it's key? |
| 08:30 | nachtalp | randomnamehere: try to use filter maybe? |
| 08:30 | gju | anyone else having problems installing swank-clojure via lein? |
| 08:31 | clgv | randomnamehere: if not you can treat the map as collection of key-value-pairs |
| 08:31 | randomnamehere | yes clgv this should work |
| 08:35 | randomnamehere | filter + map |
| 08:38 | randomnamehere | (filter #(= "martin" (val %)) (with-mc db-nodes (cgetmap "people"))) |
| 08:38 | randomnamehere | () |
| 08:38 | randomnamehere | mhh |
| 09:18 | gtuckerkellogg | So i have a big long vector, which I'd like to be able to modify in a concurrent fashion. |
| 09:18 | gtuckerkellogg | there's no coordination needed |
| 09:18 | gtuckerkellogg | but two thread should not modify the same element |
| 09:19 | gtuckerkellogg | as I undertand it (and I may not) my recommended option would be to creat this as a vector of atoms |
| 09:20 | clgv | gtuckerkellogg: the same element at the same time or the same element at all in the whole runtime? |
| 09:20 | gtuckerkellogg | i meean agents |
| 09:20 | gtuckerkellogg | the same element at the same time |
| 09:21 | gtuckerkellogg | it's a non-deterministic algorithm where threads can modify individual elements of the array |
| 09:22 | gtuckerkellogg | so if it's a vector of agents, individual threads can modify them asynchronously and without coordination, and no collisions can ever happen |
| 09:22 | clgv | gtuckerkellogg: hm then vector of atoms sounds about right, if concurrent modifiations of the array at different elements are allowed |
| 09:22 | gtuckerkellogg | yes, they are |
| 09:23 | gtuckerkellogg | they can be asynchronous, so it could be agents, right? |
| 09:23 | clgv | I dont understand the last question |
| 09:24 | gtuckerkellogg | why use atoms instead of agents? |
| 09:26 | gtuckerkellogg | that's what I was asking in the last question |
| 09:27 | chouser | gtuckerkellogg: you might consider a ConcurrentHashMap if performance is a goal. http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ConcurrentHashMap.html |
| 09:27 | chouser | Not sure how well a map will work for you instead of a vector. |
| 09:27 | gtrak` | atoms are much lighter-weight, if it's not worth the overhead of an STM and task processing consider atoms |
| 09:28 | gtrak` | your vector will effectively be a vector of AtomicReferences |
| 09:28 | clgv | gtuckerkellogg: it's a question what you want. atoms are just coordinating access to a value. an agent has a value that is modified by jobs in its eventqueue |
| 09:29 | gtuckerkellogg | thats' a helpful way of putting i |
| 09:29 | gtuckerkellogg | it |
| 09:29 | randomnamehere | how can I exclude something from a list |
| 09:29 | randomnamehere | ["people_621a0f2c-9376-4476-b23f-57f99ac9c0de" "people_dfa7df94-39ef-45b7-9cf1-22d3311507bd" "people_fdd5e1f7-464a-4980-a691-d65e1c24a0fe"] |
| 09:29 | gtrak` | filter |
| 09:31 | clgv | filter |
| 09:31 | gtrak` | ,(take 5 (cycle 'filter)) |
| 09:31 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol> |
| 09:32 | clgv | &(take 5 (cycle ['filter])) |
| 09:32 | clgv | ,(take 5 (cycle ['filter])) |
| 09:32 | clojurebot | (filter filter filter filter filter) |
| 09:33 | gtrak` | ,(filter #(not (= % 'filter)) (take 5 (cycle ['filter]))) |
| 09:33 | clojurebot | () |
| 09:33 | gtrak` | ,(filter #(= % 'filter) (take 5 (cycle ['filter]))) |
| 09:33 | clojurebot | (filter filter filter filter filter) |
| 09:34 | lnostdal | i'm using locally generated snapshots; is there some way (an option or something) of making lein not look for updates from various external resources? |
| 09:34 | lnostdal | e.g. stuff like "[INFO] snapshot org.clojure:math.numeric-tower:0.0.2-SNAPSHOT: checking for updates from clojars" .. i don't need or want that |
| 09:35 | gtrak` | there's the lein checkouts feature |
| 09:36 | lnostdal | so i just symlink a checkouts folder to ~/.m2/repository ? |
| 09:37 | lnostdal | kinda hard to tell whether it worked because sometimes lein doesn't "check for updates" |
| 09:38 | lnostdal | who'd want to update random dependencies at random points in time while doing development? .... doesn't make sense |
| 09:39 | clgv | lnostdal: lein's checkouts feature is to link another lein project in the checkouts folder |
| 09:40 | gtrak` | lol mindspring |
| 09:40 | gtrak` | lnostdal, so basically you skip the part where you generate the snapshot and just link in the source |
| 09:42 | lnostdal | gtrak`, i've found that that stuff doesn't actually work; some projects have several directories with source .. which they install via mvn install or lein install as separate mvn projects etc. |
| 09:42 | lnostdal | ring seems to do this i think |
| 09:42 | gtrak` | ah, yea, I think checkouts assumes just pure clojure source |
| 09:43 | gtrak` | lnostdal, I imagine for the ring subprojects you'd have to link in each individually |
| 09:43 | lnostdal | yes, something like that .. and it's just stupid; not gonna deal with that |
| 09:44 | gtrak` | yea, from looking at it, that's exactly what you'd do |
| 09:44 | lnostdal | ..and i recall trying anyways, and it didn't work in some casess |
| 09:50 | gtrak` | i think it won't work if the project has custom tasks or plugins or hooks |
| 09:53 | clgv | gtrak`: checkouts works with java source as well |
| 09:54 | gtrak` | oh, nice, maven projects too? |
| 09:54 | clgv | gtrak`: afaik it uses the project.clj of the checkouts project |
| 10:01 | randomnamehere | yeah, finished. |
| 10:01 | randomnamehere | http://goo.gl/0SYZX |
| 10:04 | randomnamehere | Feel free to improve :) If you have any hints what can be done better this is also welcome |
| 10:05 | clgv | randomnamehere: what is memcached? |
| 10:06 | randomnamehere | http://memcached.org/ |
| 10:06 | randomnamehere | one of the fastest memory caching systems out there |
| 10:07 | randomnamehere | You can use it as key value store with http://www.couchbase.com/couchbase-server/features |
| 10:07 | randomnamehere | Then it is persistent to disc, distributed and so on |
| 10:07 | beffbernard | Question: Anyone have success running a swt app on emacs + swank-clojure? It requires the java process run with this switch -XstartOnFirstThread |
| 10:07 | dgrnbrg | In clojure.core.jdbc in clojure 1.3, if I have functions that use with-connection, and I call them within another function's with-connection to the same DB, will it reuse that connection? |
| 10:08 | randomnamehere | The other NoSQL stuff is full of Logic, Query systems and so on. This makes this kind of systems very slow |
| 10:08 | beffbernard | I can run fine with lein run but I'd like to be more interactive and run it on emacs |
| 10:09 | randomnamehere | Even faster than sql databases, but memcached has outstanding performance. There are a lot of java applications which put a lot of data (HTTP-Sessions) to memcached instead of the sql-db |
| 10:10 | raek | beffbernard: does it work to add that option to the project.clj file? |
| 10:10 | beffbernard | raek: I have this in my project.clj :jvm-opts ["-XstartOnFirstThread"] |
| 10:14 | randomnamehere | clgv: but memcached offers not functionality to store collections of items. The application has to implement such things itself. It works very well for small pieces of data. On Heroku for example you can store bigger data in EC2 buckets. I a solution like memcached + ec2 seems nice |
| 10:19 | randomnamehere | If you have any ideas how to improve it, let me know ;) |
| 10:19 | lpetit | clgv: hello |
| 10:19 | clgv | lpetit: hi |
| 10:20 | lpetit | clgv: have you seen the announce for the new beta version of CCW today ? |
| 10:20 | clgv | lpetit: oh, not yet. thx |
| 10:20 | randomnamehere | what is a CCW? |
| 10:21 | lpetit | clgv: it's really just a bunch of paredit/strict mode bug fixes, so really worth upgrading |
| 10:21 | clgv | randomnamehere: eclipse plugin for clojure named counterclockwise |
| 10:22 | lpetit | clgv: and the leiningen support is going well. Not sure I'll be ready to release at the same time as leiningen 2, we'll see :) |
| 10:22 | clgv | lpetit: today I missed something like leiningen support. I had a bugfix in one of my basic libs that required me to alter 5 buildpaths ;) |
| 10:23 | lpetit | clgv: I intend to release leiningen support separately from ccw, so that life cycles are separate, until it's good enough to be shipped along ccw. |
| 10:24 | lpetit | clgv: and this will allow me to deliver something quicker, even if not feature complete |
| 10:24 | lpetit | s/quicker/faster/ |
| 10:24 | clgv | ah ok |
| 10:26 | lpetit | clgv: first release either today, either next thursday, with a leiningen class path container, a button to enable/disable "leiningen support" (automatically adding the leiningen container to the build path + a builder re-computing the leinigen dependencies every time the project.clj file is touched) + a button to manually force the re-computation of the leiningen dependencies from the project.clj file. |
| 10:27 | clgv | lpetit: =) |
| 10:28 | clgv | lpetit: I get persuaded more and more that I need to hack CCW's repl view to support history search like in the bash |
| 10:29 | lpetit | clgv: I remember you talked about this earlier. Did you also file an issue for this? If not, would be great. |
| 10:30 | clgv | lpetit: no issue, yet. |
| 10:30 | lpetit | clgv: please, help yourself ;-) |
| 10:31 | clgv | lpetit: gotta find an easy way for a 3D plot in java first ;) |
| 10:31 | lpetit | clgv: "Take a pause, File an issue" :) |
| 10:36 | dgrnbrg | What's the best library for making a CLI program if I'm using lein-uberjar? |
| 10:45 | clgv | dgrnbrg: there is a with-command-line macro |
| 10:45 | TimMc | What does that do? |
| 10:46 | dgrnbrg | clgv: is that the easiest/slickest way? will it work w/ uberjar? |
| 10:46 | TimMc | dgrnbrg: Wait, do you want something like GNU GetOpt, or a shell-like interface? |
| 10:47 | dgrnbrg | like getopt |
| 10:47 | TimMc | check out clojopts |
| 10:47 | dgrnbrg | I have a cli program I want to distribute |
| 10:50 | TimMc | dgrnbrg: Here's an example of clojopts in use: https://github.com/timmc/kpawebgen/blob/master/clj/src/kpawebgen/core.clj#L44 |
| 10:52 | clgv | TimMc: looks similar to the with-command-line one. maybe some more features ^^ |
| 10:53 | TimMc | clgv: Where does with-command-line live? |
| 10:54 | clgv | TimMc: good question. I found it via google a long time ago |
| 10:54 | TimMc | I see it in contrib... |
| 10:55 | TimMc | I'd trust clojopts more, since it is backed by GetOpt itself. |
| 10:56 | TimMc | Also, I can verify that it uses juxt in at least one place. |
| 11:05 | dgrnbrg | I have a jar I depend on that's not in a maven repo |
| 11:05 | dgrnbrg | how do I make uberjar stop deleting it? |
| 11:07 | TimMc | dgrnbrg: Put it in a repo. |
| 11:08 | TimMc | dgrnbrg: s3-private-wagon will allow you to keep it in S3 |
| 11:08 | dgrnbrg | TimMc: that's not an option. It's impossible for me to get maven to work/use a repo at work |
| 11:08 | dgrnbrg | can I copy it somewhere to trick maven? |
| 11:08 | dgrnbrg | or is there another artifacts dir so I can check it into my reop? |
| 11:08 | dgrnbrg | *repo? |
| 11:08 | TimMc | Oh, I remember this problem now... you've got this proxy problem. |
| 11:08 | dgrnbrg | Yeah |
| 11:09 | dgrnbrg | I did solve that, but it's painful |
| 11:09 | dgrnbrg | and setting up a new repo is impossible (effectively) |
| 11:09 | dgrnbrg | I just need to get tools.jar from java7 |
| 11:09 | clgv | lpetit: done |
| 11:09 | clgv | dgrnbrg: you can switch off implict cleans |
| 11:10 | dgrnbrg | clgv: how do I do that? |
| 11:10 | clgv | dgrnbrg: it's in the example on the leiningen readme |
| 11:10 | dgrnbrg | got it, thanks |
| 11:11 | TimMc | dgrnbrg: I think you can also add things explicitly to the classpath. |
| 11:12 | dgrnbrg | interesting... |
| 11:12 | dgrnbrg | I'll investigate all these things |
| 11:13 | TimMc | dgrnbrg: Always worth another skim through the sample project file. |
| 11:13 | dgrnbrg | TimMc: indeed it is :) |
| 11:14 | dgrnbrg | I just spend so much time looking up things that I get lazy sometimes ;) |
| 11:15 | randomnamehere | (= (list __) '(:a :b :c)) |
| 11:15 | randomnamehere | what might __ be? |
| 11:15 | raek | :a :b :c? |
| 11:15 | Bronsa | without the question mark. |
| 11:15 | raek | it can't be just one value |
| 11:16 | randomnamehere | it works, but why? |
| 11:17 | Bronsa | ,(list :a :b :c) |
| 11:17 | clojurebot | (:a :b :c) |
| 11:18 | dgrnbrg | do you know any programmatic APIs to interact w/ the AST of java source? I'm using doclet, but it's really slow and crappy, and I'm concerned it'll be hard to use antlr |
| 11:18 | clgv | humm clojars doesnt list my uploaded jar :( |
| 11:18 | TimMc | randomnamehere: Doing 4clojure problems? |
| 11:19 | randomnamehere | yes TimMc |
| 11:19 | randomnamehere | ,(:a :b :c) |
| 11:19 | clojurebot | :c |
| 11:19 | randomnamehere | WTF? |
| 11:19 | TimMc | Yeah, I've complained in the past that it's not really clear that a blank can take multiple expressions. |
| 11:20 | lucian | randomnamehere: unquoted lists are executed |
| 11:20 | raek | dgrnbrg: antlr is actually pretty painless to use from clojure |
| 11:20 | TimMc | randomnamehere: Oh, *that* has to do with keywords acting as functions. |
| 11:20 | raek | check out the lein-antlr plugin |
| 11:20 | lucian | in this case :a is a function, and it's called with :b and :c as arguments |
| 11:20 | randomnamehere | lucian: and they are quoted with list ? |
| 11:20 | vijaykiran | How can I "replace" a value for key in a vector of maps .. ? |
| 11:20 | Bronsa | randomnamehere: thats kinda like (get :b :a :c) |
| 11:20 | clgv | what do I need to add to a jar to have it registered in clojars? |
| 11:20 | Bronsa | it returns :c because it's not-found-value |
| 11:20 | lucian | randomnamehere: (list :a :b :c) means calling the function list with :a :b :c as params |
| 11:20 | Bronsa | ,(doc get) |
| 11:20 | clojurebot | "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present." |
| 11:20 | lucian | ,'(:a :b :) |
| 11:20 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :> |
| 11:20 | dgrnbrg | raek: thanks |
| 11:21 | lucian | ,'(:a :b :c) |
| 11:21 | clojurebot | (:a :b :c) |
| 11:21 | randomnamehere | ,(list a b c) |
| 11:21 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0)> |
| 11:21 | randomnamehere | whiy isn't this working? |
| 11:21 | Iceland_jack | ,(list 'a 'b 'c) |
| 11:21 | clojurebot | (a b c) |
| 11:21 | randomnamehere | quoting,.mhhh |
| 11:21 | TimMc | clgv: Nothing in particular. Just follow the clojars instructions. |
| 11:21 | lucian | ,(= (list :a :b :c) '(:a :b :c)) |
| 11:21 | clojurebot | true |
| 11:21 | dgrnbrg | raek: is there a javac task as well? |
| 11:21 | Bronsa | randomnamehere: you have to (quote) or ' in order to prevent things to be evaluated |
| 11:21 | randomnamehere | ,(list "a" "b" "c") |
| 11:21 | clojurebot | ("a" "b" "c") |
| 11:21 | clgv | TimMc: hm ok, trying the "POM" wikipage now |
| 11:21 | raek | dgrnbrg: yes, that's built in leiningen |
| 11:22 | randomnamehere | okay, understood |
| 11:22 | TimMc | clgv: Huh? No, the instructions are here: http://clojars.org/ |
| 11:22 | randomnamehere | but why does :a work when : does no quotation? |
| 11:22 | TimMc | clgv: Just `lein jar, pom` and `scp pom.xml mylib.jar clojars@clojars.org:` |
| 11:22 | Bronsa | because symbols evaluate to themselves |
| 11:22 | amro | :a is a keyword |
| 11:22 | Bronsa | ,(eval :a) |
| 11:22 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 11:22 | amro | it always evaluates to itself |
| 11:22 | Bronsa | oh :( |
| 11:22 | clgv | TimMc: it's a java dep not available in any maven repo |
| 11:23 | Bronsa | user=> (eval :a) |
| 11:23 | Bronsa | :a |
| 11:23 | raek | dgrnbrg: this is how my project.clj file looks like https://gist.github.com/2001893 |
| 11:23 | TimMc | clgv: Ah! Yeah, you'll need to build a pom.xml for it and push both at the same time. |
| 11:23 | raek | when I have edited the grammar, I run "lein antlr && lein javac" and restart clojure from emacs by running clojure-jack-in |
| 11:24 | dgrnbrg | raek: awesome…that looks perfect/easy |
| 11:24 | Bronsa | clgv: use this https://github.com/ato/lein-clojars |
| 11:24 | raek | I was really surprised that it worked so well |
| 11:24 | Bronsa | then you just need to `lein push` |
| 11:25 | TimMc | You'll still need a pom. |
| 11:25 | raek | it was way messier to get it working in an eclipse java project |
| 11:25 | TimMc | Bronsa: That's for pushing from a lein project, not just some random jar, yeah? |
| 11:25 | Bronsa | i think so |
| 11:26 | clgv | ah well. seems it worked. |
| 11:32 | TimMc | clgv: Which? |
| 11:32 | clgv | TimMc: ? |
| 11:32 | TimMc | which worked? |
| 11:32 | clgv | ah. I added it via the pom |
| 11:32 | clgv | lein-clojars didnt work for me in the past |
| 11:33 | randomnamehere | ,(reverse "DLROW OLLEH") |
| 11:33 | clojurebot | (\H \E \L \L \O ...) |
| 11:34 | Iceland_jack | ,(apply str (reverse "DLROW OLLEH")) |
| 11:34 | clojurebot | "HELLO WORLD" |
| 11:34 | Iceland_jack | (: |
| 11:41 | frito | Hi, any pointers to calling Java classes with main methods. |
| 11:42 | frito | For instance if I instantiate one, is main called implicitly or does it have to be explicit |
| 11:42 | clgv | frito: main is a static method and is not called automatically |
| 11:43 | frito | OK - thx |
| 11:43 | TimMc | frito: You call Foo/main, not (.main (Foo.)) |
| 11:43 | TimMc | Well, (Foo/main) |
| 11:44 | randomnamehere | (= (__ "Dave") "Hello, Dave!") |
| 11:44 | randomnamehere | ,(= (str "Hello, " "Dave") "Hello, Dave!") |
| 11:44 | clojurebot | false |
| 11:44 | TimMc | &(str "Hello, " "Dave") |
| 11:45 | TimMc | Raynes: Can you restart lazybot? |
| 11:45 | TimMc | ,(str "Hello, " "Dave") |
| 11:45 | clojurebot | "Hello, Dave" |
| 11:45 | randomnamehere | how to move the ! to the end? |
| 11:46 | TimMc | randomnamehere: While it is possibleto solve this one by putting two expressions in the blank, you could also use an inline function. |
| 11:46 | TimMc | also, there is a #4clojure channel, just so you know :-) |
| 11:48 | clgv | randomnamehere: (format "Hello, %s!" "Dave") |
| 11:48 | randomnamehere | java.security.PrivilegedActionException: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) |
| 11:49 | randomnamehere | ahh seen it |
| 11:49 | clgv | ,(#(str "Hello, " % "!") "Dave") |
| 11:49 | clojurebot | "Hello, Dave!" |
| 11:49 | TimMc | So, kind of the point of 4clojure is to teach yourself this stuff. |
| 11:50 | TimMc | It's kind of weird to ask for answers, or give them (without asking if spoilers are OK) |
| 11:59 | clgv | how was the fast way to get a two dimensional vector in a 2-dim array? |
| 11:59 | clgv | *2-dim double array |
| 12:03 | TimMc | Some combo of map and into-array? |
| 12:07 | clgv | hmyeah (into-array (map double-array ...)) |
| 12:10 | lancero | is there any online guide on installing clojure 1.3 / emacs 24 / swank / clojure-mode on windows? |
| 12:10 | randomnamehere | lancero: good question ;) |
| 12:12 | owain` | Clojure box is a quick way to get set up if you're forced to use Windows for any reason. Not sure what version of Emacs. Might be 23 |
| 12:12 | owain` | http://clojure.bighugh.com/ |
| 12:15 | llasram | lancero: The first step is to realize that you don't "install" Clojure. To install something that gives you a Clojure environment, install Leiningen. lein supports windows, emacs supports windows, and everything else Should Just Work [1] |
| 12:15 | llasram | [1] Not tested myself. YMMV :-) |
| 12:17 | lancero | llasrm: well I could rephrase my questions to: any online guide to getting lein / clojure 1.3 / emacs 24 / swank / clojure-mode to just work on windows? |
| 12:18 | llasram | Follow the official instructions for installing each individual thing? |
| 12:18 | llasram | Not being facetious |
| 12:35 | gf3 | is there something like (filter) but it stops after the first match? |
| 12:35 | gf3 | like (some) but it returns the item, not a boolean |
| 12:35 | RickInGA | &(some odd? [1 2 3]) |
| 12:35 | TimMc | gf3: (first (filter ...)) |
| 12:36 | RickInGA | filter is lazy, so you should be able to take 1 |
| 12:36 | RickInGA | (take 1 (filter odd? [1 2 3])) |
| 12:36 | gf3 | okay cool, thx |
| 12:36 | RickInGA | &(take 1 (filter odd? [1 2 3])) |
| 12:36 | TimMc | RickInGA: But that gives back a seq, not a value. |
| 12:36 | RickInGA | is lazybot sleeping, or am I doing something wrong? |
| 12:36 | TimMc | *the value |
| 12:37 | TimMc | Yeah, botdown. |
| 12:37 | dakrone | ,(take 1 (filter odd? [1 2 3])) |
| 12:37 | clojurebot | (1) |
| 12:38 | RickInGA | ,(some odd? [1 2 3]) |
| 12:38 | clojurebot | true |
| 12:38 | RickInGA | doh, I thought that returned the first item |
| 12:39 | Bronsa | ,(first (filter odd? [1 2 3])) |
| 12:39 | clojurebot | 1 |
| 12:42 | bpsm | (some f xs) returns the first ( f x) which is truthy, not the first x for which (f x) is truthy. |
| 12:43 | RickInGA | bpsm: thanks |
| 12:43 | bpsm | Presumably there's some clever idiom that takes advantage of that behavior, but I don't know it. |
| 12:45 | RickInGA | don't know if anyone on is in the Atlanta area, but a few from this channel are getting together at Harp Irish Pub in Roswell this evening. |
| 12:46 | llasram | RickInGA: Doh! I'm in Atlanta, but have other plans tonight |
| 12:46 | llasram | I didn't actualy realize this city hosted other Clojure users :-) |
| 12:46 | gf3 | rude |
| 12:47 | llasram | Incipient users group? |
| 12:48 | RickInGA | llasram I think so. There is a Lisp meetup group, not sure how active it is. |
| 12:48 | RickInGA | gf3 rude? |
| 12:49 | gf3 | (just kidding) |
| 12:49 | RickInGA | gf3: ok, :) You're invited too! where are you? |
| 12:49 | gf3 | sadly I'm in Toronto |
| 12:50 | llasram | RickInGA: That'd be pretty cool. I'm definitely interested |
| 12:50 | zawzey | Hi, any idea why there's a bug here: https://gist.github.com/6a8fe84c110a54203937 |
| 12:50 | zawzey | The number of items in the map is less than the input |
| 12:50 | ibdknox | gf3, yeah that should be part of the watcher. |
| 12:51 | gf3 | ibdknox: okay cool, 'cause I find things are getting a bit messy putting it all in "src/" |
| 12:51 | ibdknox | gf3, haha you can tell which codepath I use ;) |
| 12:52 | gf3 | ibdknox: :D |
| 12:53 | dnolen | redinger: think we can starting filling out the GSoC app today? |
| 12:54 | zawzey | Formatted to make the code legible |
| 12:54 | ibdknox | dnolen, I'm going to add a couple projects tonight |
| 12:54 | llasram | zawzey: I don't think sorted-map-by or comparators work the way you think they do |
| 12:54 | dnolen | ibdknox: sweet! the more the merrier |
| 12:55 | zawzey | llasram: and how would you explain that |
| 12:55 | ibdknox | I think a good, pretty easy one would be to create noir-static. A little static site generator that reads Noir's route table |
| 12:55 | zawzey | llasram: i'm aware usually for sorted-by keys are being compared, but i would like to sort based on the values |
| 12:55 | jkkramer | zawzey: you probably want a priority-map instead. sorted map items that compare as equal are considered the same item |
| 12:55 | ibdknox | we can have our own, much cooler jekyll :) |
| 12:55 | zawzey | jkkramer: ahh, i see |
| 12:55 | llasram | ,(apply sorted-map-by (constantly 0) (range 20)) |
| 12:56 | jkkramer | zawzey: https://github.com/clojure/data.priority-map |
| 12:56 | clojurebot | {0 19} |
| 12:56 | zawzey | jkkramer: but then again, if i compare the keys instead of the key-value sorted-map-by works |
| 12:57 | gf3 | ibdknox: oh, another little issue I noticed, if the path contains "cljs" it fails to parse properly |
| 12:57 | jkkramer | zawzey: because the keys are distinct |
| 12:57 | gf3 | ibdknox: for example the following files won't generate "src/my-app/cljs/core.cljs" |
| 12:57 | gf3 | ibdknox: but this will: "src/my-app/js/core.cljs" |
| 12:58 | ibdknox | gf3, weird |
| 12:58 | ibdknox | gf3, as in it fails to watch it, or the compiler doesn't compile it? |
| 12:58 | zawzey | jkkramer: i see, thanks... |
| 12:58 | zawzey | llasram: gotcha, thanks |
| 12:58 | ibdknox | oo |
| 12:58 | gf3 | ibdknox: both I guess |
| 12:59 | ibdknox | gf3, yeah don't do that |
| 12:59 | ibdknox | haha |
| 12:59 | ibdknox | you're replace cljs.core |
| 12:59 | ibdknox | replacing* |
| 12:59 | llasram | zawzey: You can just make sure the keys compared are unique: https://gist.github.com/ee28d4333002d516dffd |
| 12:59 | gf3 | ibdknox: ruh roh |
| 12:59 | llasram | s,are unique,are distinct if the keys are actually distinct, |
| 13:00 | ibdknox | it should be fine if it's cljs/something/core.cljs |
| 13:00 | ibdknox | I think that path is hardcoded in the compiler |
| 13:00 | ibdknox | you might want to file a bug for it |
| 13:00 | gf3 | ibdknox: indeed, just not the watcher |
| 13:01 | jkkramer | llasram: zawzey: if you assoc/dissoc that map, though, it will not be sorted by the new values |
| 13:01 | llasram | jkkramer: true |
| 13:04 | zawzey | llasram: great, thanks |
| 13:05 | zawzey | i should add that example to clojuredocs |
| 13:10 | di-csuehs | reminder to self: "for" list comprehension is lazy....still. |
| 13:34 | rplevy | does anyone who uses cucumber-clojure (cucumber-jvm) know if reading tabular data is broken? |
| 13:45 | jsabeaudry | The disadvantage of using send-off everywhere instead of send is higher resources usage? |
| 13:45 | gtrak` | is there a complement to the bean function? |
| 13:46 | TimMc | gtrak`: What would that do? |
| 13:46 | gtrak` | set properties from a map of keywords to vals on a bean |
| 13:47 | TimMc | hmm |
| 13:47 | TimMc | An existing bean object, existing class (instantiating and then pumping in vals), or creating a class for the vals? |
| 13:48 | technomancy | (doto (java.util.Properties.) (.putAll {"hello" "world"})) |
| 13:49 | raek | jsabeaudry: yes. |
| 13:50 | raek | send uses a fixed size thread pool and send-off allocates new threads when needed |
| 13:50 | raek | if your functions don't block or take very long time to execute, it's safe to use send |
| 13:51 | jonasen | dnolen: Time for another core.logic question? |
| 13:51 | dnolen | jonasen: shoot |
| 13:51 | jonasen | https://refheap.com/paste/972 |
| 13:51 | jonasen | dnolen: the first expression doesn't unify. Why? |
| 13:52 | dnolen | you can't just use a dot like that |
| 13:52 | dnolen | (_ . _), (_ _ . _) etc are the only valid ways to use . |
| 13:52 | jonasen | dnolen: ok |
| 13:53 | gtrak` | TimMc, yes, an existing class, for instance a spring bean |
| 13:53 | dnolen | jonasen: actually I guess (. _) currently works, not sure what I think about that. |
| 13:53 | Lajla | raek, my love. |
| 13:53 | Lajla | Let us worship His Shadow together. |
| 13:54 | dnolen | jonasen: but no, the . only works with list syntax, I don't see an obvious issue at the moment with it working with vectors ... feel free to open a ticket. |
| 13:54 | jonasen | I would like to unify (fn [. ?x] (?fun . ?x)) with (fn [x y] (+ x y)) if you know what I mean |
| 13:56 | Bronsa | what are the advantages of using core.logic's unifier over core.unify? |
| 13:57 | jonasen | dnolen: core.logic is new territory for me... so expect a silly question daily. |
| 13:59 | dnolen | jonasen: why not (fn ?args (?fun . ?args)) ? |
| 14:01 | jonasen | dnolen: That seems to work. Thanks! |
| 14:01 | dnolen | jonasen: out of curiosity whats kinds of features are you all adding? |
| 14:02 | jonasen | dnolen: this rule is for suggesting (map inc [1 2 3]) instead of (map #(inc %) [1 2 3]) |
| 14:02 | gtrak` | TimMc, I found a solution in setter-fn: https://bitbucket.org/kumarshantanu/clj-argutil/src/d4732e993c30/src/main/clj/org/bituf/clj_argutil.clj |
| 14:02 | dnolen | jonasen: ha, nice :) |
| 14:03 | dnolen | jonasen: do you all have a lein-kibit yet? |
| 14:05 | dnolen | jonasen: heh, I see that lein kibit already works. |
| 14:07 | jonasen | dnolen: yes. It should work. You'll need to use master with lein 2.0 though. |
| 14:08 | dnolen | I haven't ventured yet into lein 2.0, does it just work? i.e. no breakage? |
| 14:09 | technomancy | dnolen: most of the breakage is in 3rd-party plugins |
| 14:09 | technomancy | all the core changes are handled for you by lein-precate |
| 14:10 | _ulises | what's the preferred way of parsing (possibly broken) HTML? is it with enlive? |
| 14:11 | technomancy | most of the broken plugins are the more obscure ones; lein-ring and lein-midje are the only widely-used ones that still aren't compatible |
| 14:13 | ibdknox | I should go fix mine, huh? |
| 14:14 | chouser | _ulises: I've used tagsoup successfully |
| 14:14 | ibdknox | there's a clj-tagsoup as well |
| 14:14 | ibdknox | https://github.com/nathell/clj-tagsoup |
| 14:15 | chouser | data.xml ought to work on top of tagsoup |
| 14:15 | technomancy | ibdknox: lein-noir? would be cool to get it on newnew, yeah |
| 14:15 | ibdknox | it technically is |
| 14:15 | jkkramer | _ulises: I've had best results with jsoup. no clojure wrapper, but it's an html5-compliant parser |
| 14:15 | dnolen | jonasen: ohpauleez emailed me about recursively applying rules, did you all sort this out? |
| 14:16 | _ulises | interesting |
| 14:16 | _ulises | thanks for the responses, now I have to go and investigate |
| 14:16 | dnolen | technomancy: hmm, Exception in thread "main" java.lang.NullPointerException when I try to run lein2 |
| 14:18 | technomancy | dnolen: there's a known issue when you first run it outside a project without any profiles |
| 14:19 | technomancy | fixed in master, but I haven't pushed an updated preview2 yet |
| 14:21 | jonasen | dnolen: I think I know how to do it. Just got to read some prolog literature first :) |
| 14:21 | dnolen | jonasen: k, let me know if you all need more pointers |
| 14:21 | dnolen | technomancy: thx, that works |
| 14:23 | ivan | is there any literature on dynamically scoped variables? when do you use them instead of passing things around? |
| 14:24 | dnolen | ivan: it's instructive to see where Clojure uses them. They are awesome, but really should be used very sparingly. kinda like macros. |
| 14:25 | randomnamehere | ,(fn [x & y] (last (sort (y))) 1 8 3 4) |
| 14:25 | clojurebot | #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@eb6899> |
| 14:25 | randomnamehere | ,(fn [x & y] (doall (last (sort (y)))) 1 8 3 4) |
| 14:25 | clojurebot | #<sandbox$eval55$fn__56 sandbox$eval55$fn__56@4bddfd> |
| 14:25 | ivan | dnolen: thanks, I'll take a closer look |
| 14:27 | `fogus | ,((fn [x & y] (last (sort y))) 1 8 3 4) |
| 14:27 | clojurebot | 8 |
| 14:37 | `fogus | technomancy: What service do you use to print Lein stickers? |
| 14:37 | technomancy | `fogus: I used psprint.com; they were fine. |
| 14:38 | `fogus | Excellent, thank you |
| 14:38 | Raynes | `fogus: Print me some fogus stickers. I'd wear those with pride. |
| 14:42 | `fogus | Just pretend this is me: http://www.zazzle.com/lucha_libre_mexican_wrestling_sticker-217976188315608984 |
| 14:43 | TimMc | `fogus: I already do. |
| 14:43 | Raynes | Wait, it isn't? |
| 14:43 | tylergillies | lolz |
| 15:03 | randomnamehere | ,(apply (fn dx [x & y] (if-not (= nil (next y)) (dx y) y)) [1 2 3 4 5]) |
| 15:03 | clojurebot | nil |
| 15:03 | randomnamehere | why nil? hmpf |
| 15:03 | randomnamehere | ,(apply (fn dx [x & y] (if-let [d (next y)] (dx y) y)) [1 2 3 4 5]) |
| 15:03 | clojurebot | nil |
| 15:05 | raek | randomnamehere: you're never doing anything with x |
| 15:05 | randomnamehere | raek: I know it is just to test |
| 15:05 | raek | randomnamehere: what do you expect it to output? |
| 15:06 | randomnamehere | the last item |
| 15:07 | raek | ,(apply (fn dx [x & y] (if-let [d (next y)] (apply dx y) y)) [1 2 3 4 5]) |
| 15:07 | clojurebot | (5) |
| 15:07 | raek | randomnamehere: ^ |
| 15:08 | raek | ,(apply (fn dx [x & y] (if (seq y) (apply dx y) x)) [1 2 3 4 5]) |
| 15:08 | clojurebot | 5 |
| 15:08 | randomnamehere | ahhh apply does the trick? |
| 15:09 | raek | yes |
| 15:09 | randomnamehere | why do I need it? |
| 15:09 | raek | dx takes the input as separate arguments |
| 15:09 | duck1123 | without apply, you'd only be passing one |
| 15:09 | TimMc | randomnamehere: The same reason apply was used in the original call to dx |
| 15:10 | raek | if you do (dx y) you call it with only one argument - the items wrapped in a collection |
| 15:10 | randomnamehere | but It should be evaluated if it is in () TimMc ?! |
| 15:10 | randomnamehere | ahhh raek understand ;) |
| 15:10 | TimMc | randomnamehere: Yes... but apply isn't just "call" |
| 15:12 | randomnamehere | TimMc: what then? |
| 15:13 | TimMc | I mean, it ends up calling the function, but arranges the arguments differently. |
| 15:16 | randomnamehere | Found another solution |
| 15:16 | randomnamehere | v |
| 15:16 | randomnamehere | #(nth % (dec (count %))) |
| 15:17 | randomnamehere | It's better than just #(first (reverse %)) |
| 15:17 | randomnamehere | isn't it` |
| 15:17 | randomnamehere | reverse builds a new list in memory, count does not?! |
| 15:17 | TimMc | &(doc count) |
| 15:17 | lazybot | ⇒ "([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps" |
| 15:18 | randomnamehere | &(doc reverse) |
| 15:18 | lazybot | ⇒ "([coll]); Returns a seq of the items in coll in reverse order. Not lazy." |
| 15:18 | randomnamehere | I assume getting the index is better ^^ |
| 15:18 | TimMc | randomnamehere: count does a constant-time count when possible, but when given a seq it walks it (and realizes it) |
| 15:18 | llasram | &(count (range)) |
| 15:19 | lazybot | Execution Timed Out! |
| 15:19 | randomnamehere | How does the bots here work? |
| 15:19 | TimMc | llasram: Interestingly, (range) is no longer an infinite seq in 1.3. |
| 15:19 | randomnamehere | Is there anywhere the source of the bots |
| 15:19 | TimMc | randomnamehere: Yeah, just look on github. |
| 15:19 | llasram | TimMc: You mean 1.4...? |
| 15:20 | randomnamehere | TimMc: which project? |
| 15:20 | TimMc | randomnamehere: I don't know, use Google. |
| 15:20 | TimMc | (or DuckDuckGo, or Bing, or Altavista...) |
| 15:20 | randomnamehere | is it your bot? Have you written it? |
| 15:20 | TimMc | nope |
| 15:21 | TimMc | llasram: 1.3 switched to non-autopromoting arithmetic by default |
| 15:21 | randomnamehere | WTF DuckDuckGo |
| 15:21 | llasram | randomnamehere: This is lazybot: https://github.com/flatland/lazybot |
| 15:22 | Raynes | Holy crap. lazybot has 65 watchers. |
| 15:22 | Raynes | amalloy: We're being watched. |
| 15:22 | Raynes | Act natural. |
| 15:22 | llasram | TimMc: Right... Oh! so therefore it's bounded by maxint! |
| 15:23 | TimMc | &(take 2 (range (- Long/MAX_VALUE 64) Double/POSITIVE_INFINITY)) |
| 15:23 | lazybot | ⇒ (9223372036854775743 9223372036854775744) |
| 15:23 | TimMc | &(take 2 (range (- Long/MAX_VALUE 1) Double/POSITIVE_INFINITY)) |
| 15:23 | lazybot | java.lang.ArithmeticException: integer overflow |
| 15:25 | llasram | &(take 2 (range (bigint (- Long/MAX_VALUE 1)) Double/POSITIVE_INFINITY)) |
| 15:25 | lazybot | ⇒ (9223372036854775806N 9223372036854775807N) |
| 15:25 | llasram | So consistent, at least |
| 15:25 | llasram | That makes complete sense to me |
| 15:25 | jsabeaudry | &(send-off (agent {}) (fn [a] (send-off (agent {}) (fn [b] (println "foo") b)) (Thread/sleep 5000) a)) |
| 15:25 | lazybot | java.lang.SecurityException: You tripped the alarm! send-off is bad! |
| 15:26 | jsabeaudry | Can anyone explain why "foo" takes 5 seconds to appear? |
| 15:26 | llasram | But it is non-obvious what the correct behavior of (range) should be then :-/ |
| 15:26 | llasram | (to me) |
| 15:27 | jsabeaudry | Are agents tasks only sent at the end of the current agent task or something? |
| 15:27 | llasram | jsabeaudry: the raison d'etre of agents is to serialize uncoordinated updates to a value |
| 15:27 | TimMc | &(take 3 (iterate #(+' % 1) (- Long/MAX_VALUE 1))) |
| 15:27 | lazybot | ⇒ (9223372036854775806 9223372036854775807 9223372036854775808N) |
| 15:28 | llasram | jsabeaudry: So the second send-off queues the task right away, but it doesn't actually run until the first one finishes |
| 15:29 | TimMc | Change one to a send, see what happens. |
| 15:29 | jsabeaudry | llasram, even though they are two diffrent agents? |
| 15:29 | llasram | blarp |
| 15:29 | llasram | My brain totally failed to parse that :-) |
| 15:30 | jsabeaudry | TimMc, no difference |
| 15:33 | jsabeaudry | This looks like a bug to me |
| 15:33 | Raynes | It's not a bug, it's a feature. |
| 15:34 | TimMc | You're just saying that. |
| 15:34 | Raynes | I say that to all the bugs. |
| 15:35 | llasram | Looking at clojure.lang.Agent, it has explicit code to defer queue any other agent executions from within a given agent |
| 15:37 | llasram | There's static thread-local holding persistent vector. If it's null when the agent action is enqueued, the action is sent to the executor queue right away |
| 15:38 | llasram | If it's not null, the action is cons'd onto the vector |
| 15:39 | TimMc | llasram: How is action failure handled? |
| 15:39 | llasram | And when agent actions run the start by setting the thread-local to an empty vector, and finish by enqueueing actions in their thread-local queue to the pool |
| 15:39 | TimMc | Is the queue dropped? |
| 15:39 | llasram | Ah! Yes |
| 15:39 | llasram | If the agent fails, any queued agent actions are silently dropped |
| 15:39 | TimMc | Same with dosync and failure/retry |
| 15:40 | llasram | Slightly unexpected to me, but makes total sense |
| 15:40 | jsabeaudry | llasram, Ah that must be the reason why they arent dispatched immediately |
| 15:42 | llasram | And it is documented on clojure.org/agents: "If during the [action] function execution any other dispatches are made (directly or indirectly), they will be held until after the state of the Agent has been changed." |
| 15:42 | jsabeaudry | Well in this case, I can't use agents, I guess I'll go with good old locks |
| 15:42 | llasram | Cool. Good to know. |
| 15:43 | jsabeaudry | llasram, Thank you very much for your help! |
| 15:43 | llasram | np |
| 15:43 | randomnamehere | Can the bot be used to do any damage? |
| 15:43 | randomnamehere | or is it kind of sandboxed? |
| 15:43 | TimMc | Doubly sandboxed. |
| 15:44 | TimMc | randomnamehere: The JVM sandbox prevents I/O, etc. |
| 15:45 | TimMc | randomnamehere: The Clojure sandbox (clojail, for lazybot) prevents you from messing up the Clojure environment (redefining things, etc.) |
| 15:45 | Raynes | TimMc: You used the phrase 'doubly sandboxed' -- you must have watched my conj talk. |
| 15:46 | TimMc | NOPE. |
| 15:46 | Raynes | TimMc: We can't be friends. |
| 15:46 | TimMc | YEP. |
| 15:47 | TimMc | randomnamehere: Oh, and clojurebot automatically restarts every 15 minutes, probably because it doesn't have very good Clojure environment sandboxing. |
| 15:47 | brehaut | TimMc: lazybot throws out its sandbox too doesnt it? |
| 15:48 | TimMc | Don't ask me, I didn't watch Raynes' talk. |
| 15:48 | randomnamehere | I wanna watch the talk later |
| 15:48 | tmciver | zing! |
| 15:48 | randomnamehere | Raynes: is the bot from you? |
| 15:48 | Raynes | TimMc: No, it never throws out its sandbox. |
| 15:48 | randomnamehere | Or the jail? |
| 15:48 | Raynes | randomnamehere: Both the jail and the bot are me and amalloy. |
| 15:48 | TimMc | It just dies periodically and has to be restarted. |
| 15:48 | randomnamehere | I can't make HTTP Calls, IO or so from the bots? So how do the plugins do? |
| 15:48 | TimMc | randomnamehere: clojurebot is run by hiredman |
| 15:49 | Raynes | The bot was originally me with some amalloy on top. The jail was both me and amalloy equally, I'd think. |
| 15:49 | TimMc | randomnamehere: The jailed eval thingy *is* a plugin. |
| 15:49 | Raynes | The sandbox only applies to the code you execute via & and ##. It doesn't apply to the plugins. |
| 15:49 | Raynes | The plugins are free to do whatever they like. |
| 15:49 | randomnamehere | nice! |
| 15:50 | randomnamehere | I thought about also host a bot |
| 15:50 | randomnamehere | clojure is fun |
| 15:50 | randomnamehere | but I'm afraid of losing control and be part of a botnet :) |
| 15:50 | doug | ok, i've got a freshly-developed clojure app that talks to a browser app via websockets |
| 15:51 | randomnamehere | Raynes: is there any documentation about the sandboxing? |
| 15:51 | doug | i'm trying to figure out what the best option for deployment is |
| 15:51 | doug | packaging everything and running jetty? |
| 15:51 | lake | I just created a hello_world.clj file, how do I run it? |
| 15:51 | Raynes | randomnamehere: https://github.com/flatland/clojail |
| 15:53 | doug | i guess the first issue should be: do people actually use clojure in production? |
| 15:53 | doug | if not, i guess lein run is all that's needed |
| 15:53 | Raynes | Of course they do. |
| 15:54 | TimMc | but lein run can be sufficient for a lot of use cases |
| 15:54 | randomnamehere | Hahah Raynes nice text about security in the end |
| 15:54 | randomnamehere | technicans tend to say, yes that is realistic |
| 15:55 | randomnamehere | businessman will think, we will not but that :) |
| 15:55 | randomnamehere | secure-enough... :) |
| 15:55 | TimMc | Raynes: I think I've seen the slides, but not the video. |
| 15:55 | lake | i found my answer: java -cp /usr/share/clojure/clojure.jar clojure.main problem1.clj |
| 15:55 | lake | seems long winded |
| 15:56 | TimMc | lake: Use Leiningen, it is way easier. |
| 15:57 | the-kenny | Anyone using paredit with Emacs 24? I can't get it to work nicely with { and } |
| 15:57 | TimMc | De facto clojure build/dev tool. |
| 15:57 | the-kenny | {} works fine in Fundamental mode + paredit, as soon as I enable clojure-mode or any other lisp-mode, curly braces are broken. |
| 15:57 | randomnamehere | Is anyone of you rich h. ? |
| 15:58 | the-kenny | { inserts the closing } correcly, hitting DEL doesn't remove the matching } anymore. Typing } to move to the closing } is broken too. |
| 15:59 | llasram | the-kenny: What does emacs say the } key is bound to? |
| 15:59 | the-kenny | llasram: } paredit-close-curly |
| 16:00 | the-kenny | { is paredit-open-curly, as expected. |
| 16:00 | TimMc | randomnamehere: Not as far as I know. He's only in here rarely, and uses his real name. |
| 16:00 | randomnamehere | He can be proud about that big community |
| 16:00 | randomnamehere | and all that stuff like lein and so on |
| 16:00 | the-kenny | As I said, it works fine in Fundamental Mode. The bindings look the same when I switch to lisp-mode, but there paredit-*-curly is broken. (Same in clojure-mode) |
| 16:01 | Vinzent | Hi. I wonder why flatten on sets always returns an empty seq? |
| 16:02 | Vinzent | As stated in its doc, it "Takes any nested combination of sequential things". Woudn't be better if it'd throw an exception when set is passed? |
| 16:02 | tmciver | ,(doc flatten) |
| 16:02 | clojurebot | "([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence." |
| 16:02 | tmciver | sets aren't sequential. |
| 16:02 | TimMc | ~flatten |
| 16:02 | clojurebot | flatten just means you failed to use ->> and mapcat correctly |
| 16:03 | TimMc | ~flatten |
| 16:03 | 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. |
| 16:03 | TimMc | &(sequential? #{}) |
| 16:03 | lazybot | ⇒ false |
| 16:03 | tmciver | TimMc: why does clojurebot give two different responses there? |
| 16:03 | TimMc | Vinzent: ^ and ^^ |
| 16:03 | llasram | the-kenny: My elisp-fu is defeating me, but my spider sense is suggesting that your syntax table under clojure-mode doesn't have {} properly paired |
| 16:03 | TimMc | tmciver: Multiple factoids stored under "flatten". |
| 16:04 | Vinzent | tmciver, yes, I know, I've written about it. The problem is that it doesn't throw an exception, but returns (). |
| 16:04 | tmciver | TimMc: so if you keep issuing a ~something it iterates through them? |
| 16:04 | TimMc | tmciver: Random selection. |
| 16:04 | TimMc | tmciver: Ask it ~paste repeatedly (in /query clojurebot of course) |
| 16:05 | the-kenny | llasram: Hm. But then I must have the same error in lisp-mode and lisp-interaction-mode as well. I haven't changed any variable in these modes. |
| 16:05 | jlaskowski | Hi |
| 16:05 | Vinzent | TimMc, thanks, but I've asked the question not becuase I'm using flatten, I just found this strange behaviour by accident. |
| 16:05 | tmciver | Vinzent: do you expect it to? The doc isn't specific about the behavior with sets. |
| 16:05 | jlaskowski | Why am I not able to set a :dynamic metadata for vars in clojure 1.3.0? |
| 16:06 | Vinzent | tmciver, well, sets are not sequentials, and flatten expects a sequential. It's pretty clear that sets are not correct input for this function. |
| 16:06 | llasram | the-kenny: I think {} aren't usually considered paired in other lisp-modes |
| 16:07 | llasram | the-kenny: AH, here we go: try having emacs evaluate (string (char-syntax ?\})) in a clojure-mode buffer |
| 16:07 | the-kenny | llasram: yup, but paredit ignores this. squared braces works fine there. |
| 16:07 | tmciver | jlaskowski: I can set :dynamic meta in my 1.3 repl. |
| 16:07 | Vinzent | jlaskowski, (def ^:dynamic *foo*) works for me |
| 16:08 | jlaskowski | is ^:dynamic for unbound vars only? |
| 16:08 | Raynes | nopw. |
| 16:08 | Raynes | nope* |
| 16:08 | jlaskowski | what's your (clojure-version)? |
| 16:08 | jlaskowski | "1.3.0" |
| 16:09 | jlaskowski | user=> (def ^:dynamic b 1) |
| 16:09 | jlaskowski | ^{:ns #<Namespace user>, :name b, :line 1, :file "NO_SOURCE_PATH"} #'user/b |
| 16:09 | jlaskowski | and binding form warns me about reassignment |
| 16:09 | jlaskowski | (I've even been looking at the source code of clojure :)) |
| 16:10 | Vinzent | jlaskowski, maybe it's because you named it b, not *b* |
| 16:10 | Vinzent | (just a guess) |
| 16:10 | jlaskowski | nope |
| 16:10 | tmciver | ,(source flatten) |
| 16:10 | clojurebot | Source not found |
| 16:10 | jlaskowski | earmuffs just make the warning earlier when used in def |
| 16:10 | tmciver | &(source flatten) |
| 16:10 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: source in this context |
| 16:11 | the-kenny | llasram: Huh, wait. I just restarted Emacs, and now the curly braces work in clojure-mode, but still fail in other lisp-modes. Evaluating your code returns ")" in (not broken) clojure-mode and "_" in broken lisp-modes. |
| 16:11 | jlaskowski | I've already spent almost half a day and am stuck |
| 16:12 | tmciver | Vinzent: a look at the source for flatten has it using sequential? for the branch funtion to tree-seq. Looks like that's why it returns (). It doesn't throw for things that aren't sequential. |
| 16:12 | Raynes | tmciver: https://refheap.com/paste/974 |
| 16:12 | Raynes | My favorite flatten. |
| 16:12 | tmciver | Raynes: Where's that from? Is it yours? |
| 16:13 | Raynes | It's in clojail. |
| 16:13 | Raynes | Man, has nobody seen my talk? |
| 16:13 | tmciver | Raynes: I saw it . . . I was there. :) |
| 16:13 | Raynes | Hahaha, oh. |
| 16:13 | Raynes | This is the flatten-all I mentioned in said talk. |
| 16:14 | tmciver | Raynes: I haven't memorized that part yet. |
| 16:14 | Vinzent | tmciver, I understand it doesn't :) they definitely should start using trammel |
| 16:14 | TimMc | jlaskowski: Probably needs more context. |
| 16:14 | Raynes | The reason for it is ##(flatten [[{:foo :bar}]]) |
| 16:14 | lazybot | ⇒ ({:foo :bar}) |
| 16:14 | Raynes | It doesn't flatten maps. |
| 16:14 | Raynes | flatten-all does |
| 16:14 | TimMc | Raynes: And that makes it hard to look for bad symbols, yes. |
| 16:14 | TimMc | <- hasn't seen the talk, though |
| 16:15 | the-kenny | llasram: Ah, now I why it doesn't work in *-lisp-mode. clojure-mode does some modifications to the syntax table in order to make { and [ work nicely. While this doesn't explain why M-{ (which didn't work in clojure-mode two hours ago) works flawlessly now, I'm happy. Thanks for your help :) |
| 16:16 | Vinzent | Raynes, that makes sense (probably), thank you! |
| 16:16 | Raynes | Huh, did I help you? |
| 16:16 | Vinzent | don't you? |
| 16:17 | Raynes | Oh, were you the one asking about flatten? |
| 16:17 | Vinzent | yep |
| 16:17 | Raynes | Oh, you're welcome. Come again. |
| 16:18 | Bronsa | why is it seq and not just identity? |
| 16:18 | amalloy | more characters, bro. gotta trim down that source code |
| 16:19 | Raynes | By using juxt. |
| 16:19 | Raynes | Amirite? |
| 16:19 | Bronsa | lol |
| 16:27 | randomnamehere | Raynes: about RefHeap We aren't entirely satisfied with existing pastebins |
| 16:28 | randomnamehere | What is your problem with github gist? |
| 16:28 | Raynes | I think Gist is great, but there are some things we can do with refheap that they aren't doing with gist. |
| 16:28 | Raynes | For example, simple code evaluation is coming soon. |
| 16:29 | Raynes | Revisions and such as well. |
| 16:29 | randomnamehere | Raynes: gist has revisions |
| 16:29 | Raynes | Yes, I know. |
| 16:29 | ibdknox | also it's going to use the Angelina AI to turn your pastes into a game |
| 16:29 | Raynes | I also like our website better in general. |
| 16:30 | Raynes | I like the fact that it is open source and we can do whatever we want with it on a whim. |
| 16:30 | Raynes | It is written in Clojure with an emphasis on Clojure, so if Clojure people want something, they can easily contribute. |
| 16:30 | TimMc | Such as add and remove iguanas? |
| 16:30 | technomancy | why would you remove an iguana? |
| 16:30 | ibdknox | that's just ridiculous |
| 16:30 | doug | how can i read an environment variable in clojure? |
| 16:30 | TimMc | I don't know, ask Raynes! |
| 16:31 | TimMc | doug: System/getProperty ? |
| 16:31 | Raynes | I've done a bit of work on Pygment's Clojure lexer, so the Clojure highlighting is better in refheap than in gist (though once gist updates its pygments, that'll change). |
| 16:31 | ibdknox | TimMc: professionalism and all that. Raynes is entering the working world soon, it's tainting him |
| 16:31 | Raynes | But our highlighting is more complex in general. |
| 16:31 | Raynes | TimMc: Noooo |
| 16:31 | doug | maybe System/getenv |
| 16:31 | Raynes | System/getenv |
| 16:31 | TimMc | Ah, that's the one. |
| 16:31 | ibdknox | System/doTheRightThing |
| 16:32 | Raynes | randomnamehere: The biggest thing is that we can do whatever we want with refheap. Can't do that with gist. |
| 16:32 | llasram | the-kenny: Cool. Glad to help! |
| 16:32 | randomnamehere | Raynes: yeah |
| 16:32 | ibdknox | also it's fun? |
| 16:32 | ibdknox | that should be enough |
| 16:33 | Raynes | RefHeap doesn't really stand out from other pastebins yet, but it will. We've got lots of ideas. The issue tracker has most of them. |
| 16:33 | Raynes | And as long as people like ibdknox are interested in it and using it, I'll still be motivated to work on it. |
| 16:34 | doug | not sure i like this |
| 16:34 | doug | (if-let [dir (System/getenv "XDG_RUNTIME_DIR")] dir (System/getenv "HOME")) |
| 16:34 | randomnamehere | Nice Raynes, I like it |
| 16:35 | ibdknox | doug: use or |
| 16:35 | Raynes | It's also pretty awesome that it seems to have become the defacto pastebin for #clojure. |
| 16:35 | ibdknox | (or (System/getenv "X..") (System/getenv "HOME")) |
| 16:35 | Raynes | TimMc despises BrowserID but still recommends the site. :D |
| 16:36 | ibdknox | Raynes: I think TimMc might actually be a robot controlled by clojurebot |
| 16:36 | ibdknox | so I assume his motives are likely subversive |
| 16:36 | doug | ibdknox++ |
| 16:38 | llasram | (inc ibdknox) |
| 16:38 | lazybot | ⇒ 7 |
| 16:39 | randomnamehere | Raynes: I think the design is a bit dark |
| 16:41 | Raynes | Heh |
| 16:41 | TimMc | *beep* |
| 16:41 | TimMc | I mean |
| 16:41 | ibdknox | Clojure is akin to dark magic |
| 16:41 | TimMc | "hah hah" |
| 16:41 | ibdknox | PROOF |
| 16:41 | Raynes | It'll get even darker when I work in codemirror because I'll be using the same color theme as the pastes. |
| 16:44 | randomnamehere | that makes my eyes tired ;( |
| 16:44 | ibdknox | huh |
| 16:45 | ibdknox | just use gist then :) |
| 16:45 | Raynes | I wasn't aware that dark colors easily made eyes tired. |
| 16:46 | ibdknox | it's a holy war |
| 16:46 | Bronsa | it's proven |
| 16:46 | Raynes | No colors I could ever choose would satisfy everybody. |
| 16:47 | ibdknox | Bronsa: source? |
| 16:47 | ibdknox | every time I've ever seen this come up, I've never seen anything even remotely close to definitive |
| 16:47 | Bronsa | i remember an article posted on HN some months ago |
| 16:47 | randomnamehere | Raynes: dark, non dark skin, switchable with javascript shortcut and remembering function will be a big plus |
| 16:47 | bigs | couple of people did a science |
| 16:48 | dan`b | or just tell people to use greasemonkey :-) |
| 16:48 | TimMc | or Stylish |
| 16:48 | randomnamehere | Write a URL shortener? Nice ? |
| 16:48 | randomnamehere | I've written an image hosting app |
| 16:48 | amalloy | my IRC client is light-themed, and just looking at this discussion makes my eyes tired. counterexample right there? |
| 16:48 | dan`b | I find dark text/light backgrounds easiest, but that's just as likely to be habit as anything else |
| 16:48 | randomnamehere | but for url-shortener you'll need a short domain |
| 16:48 | technomancy | it depends on the lighting of the room you're in, among other things |
| 16:49 | tmciver | And I want a pony, and a train set and a . . . |
| 16:49 | ibdknox | randomnamehere: huh? |
| 16:49 | Raynes | ibdknox: He is talking about an issue. |
| 16:49 | bigs | eww url shorteners |
| 16:49 | Raynes | ibdknox: Where I mentioned I was considering writing a URL shortener. |
| 16:49 | TimMc | randomnamehere: Ugh, don't bring another URL shortner into the world, unless you're prepared to maintain it and defend it against spam. |
| 16:49 | ibdknox | oh |
| 16:49 | Raynes | TimMc: Me, bro. |
| 16:49 | randomnamehere | which is easy to remember and short = $$$ |
| 16:49 | Raynes | Not him. |
| 16:49 | TimMc | Raynes: That goes for you too. |
| 16:50 | drostie | tmciver: rainbow dash is mine, get your own pony. :x |
| 16:50 | ibdknox | technomancy: we did a basic study at MSFT, the overwhelming majority preferred a dark theme |
| 16:50 | Raynes | Switchable colors on refheap are an idea. I'm just not sure people will ever spend so much time on the site as to have a chance to care. |
| 16:51 | TimMc | ibdknox: Dark theme allows more colors, as far as I can tell. |
| 16:51 | technomancy | the color of the background isn't even really the deciding factor; it's how much contrast is present between the background and the text |
| 16:51 | ibdknox | TimMc: significantly |
| 16:51 | amalloy | or notice. 75% of features on a website never get noticed by a user |
| 16:51 | Raynes | amalloy: That too. |
| 16:51 | Raynes | I would never use it. |
| 16:52 | randomnamehere | thx technomancy |
| 16:52 | Raynes | RefHeap is bright enough that I can see it in sunlight. |
| 16:52 | randomnamehere | the contrast is the problem |
| 16:52 | randomnamehere | haven't known how to tell... |
| 16:52 | Raynes | I was using a higher contrast color theme for the actual code a few days ago. |
| 16:52 | Raynes | But some guy opened an issue complaining about it, and it hurt my eyes as well. |
| 16:53 | brehaut | the tricky thing with contrast is that as active lit screens get better, it becomes harder to get a good contrast for everyone |
| 16:53 | ibdknox | yeah, I don't sit there and stare at pastes all day that I would care about this |
| 16:55 | amalloy | a real friend of Raynes would make the refheap browser window always-on-top |
| 16:55 | Raynes | Of course. |
| 16:56 | randomnamehere | Raynes: why do you have a checkbox and not a create private & create public button on it? |
| 16:56 | randomnamehere | Do not want to copy too much from gist? ;) |
| 16:56 | Raynes | Because having two buttons to do the same thing in different ways is tacky. |
| 16:56 | Raynes | In slightly different ways* |
| 16:57 | Raynes | Private vs non-private is a 'yes' or 'no' state, which is what a checkbox is for. |
| 16:57 | Raynes | I'd rather have a button there though. A toggle button. |
| 16:57 | Raynes | That changes colors when clicked. |
| 16:57 | Raynes | But I'm not good enough with design to do that. |
| 16:57 | ibdknox | go go JavaScript |
| 16:57 | TimMc | Raynes: And shape, too. |
| 16:58 | Raynes | ibdknox: I think jquery ui has something like this. |
| 16:58 | Raynes | I haven't looked into it though. |
| 16:58 | ibdknox | TimMc: it turns into a hypercube |
| 16:58 | TimMc | Raynes: I think like 10% of the population has some form of color vision defect or anomaly. |
| 16:58 | Raynes | It could be an open padlock icon that when clicked turns into a closed padlock icon. |
| 16:58 | randomnamehere | I talked to many people who said it is an advantage not to have a checkbox when adding company code and you miss out the checkbox ;) |
| 16:59 | randomnamehere | More common than clicking on the wrong button |
| 16:59 | TimMc | randomnamehere: Umm... don't put company code on a public pastebin? o.O |
| 16:59 | randomnamehere | TimMc: only unsensitive things |
| 16:59 | TimMc | *shrug* |
| 17:00 | Raynes | Maybe instead of a checkbox or button at all, people can just cover up the pastebox with their hands to keep other people from seeing. |
| 17:00 | ibdknox | the troll gaze is strong with this one |
| 17:00 | Raynes | Private! |
| 17:00 | TimMc | Raynes: WORKS_FOR_ME |
| 17:01 | technomancy | more importantly, works for the TSA |
| 17:01 | ibdknox | lol |
| 17:01 | ibdknox | ~rimshot |
| 17:02 | clojurebot | Badum, *tish* |
| 17:06 | randomnamehere | TSA? |
| 17:07 | ibdknox | .. |
| 17:07 | Raynes | $google TSA |
| 17:07 | lazybot | [TSA | Transportation Security Administration | U.S. Department of ...] http://www.tsa.gov/ |
| 17:07 | randomnamehere | nice |
| 17:11 | ibdknox | this is definitely going to attract good candidates: http://news.ycombinator.com/item?id=3681659 |
| 17:17 | technomancy | anyone know enough about lein-ring to explain what the in-war-path does? |
| 17:20 | llasram | Provides a source of puns? |
| 17:21 | technomancy | yes, I can't help but think staring at all this code about wars is going to leave me with some violent tendencies |
| 17:23 | pipeline | ibdknox: i don't see a problem |
| 17:23 | ibdknox | my initial reading of it was basically "not very good? You can do this then!" |
| 17:24 | ibdknox | just the headline |
| 17:25 | TimMc | It looks cool on second glance only. |
| 17:26 | randomnamehere | have a look |
| 17:26 | randomnamehere | https://refheap.com/paste/984 |
| 17:27 | jodaro | that sounds like taskrabbi |
| 17:27 | jodaro | t |
| 17:35 | uvtc | I'm finding that searching clojars for libs is not very fruitful, because the clojar pages I find only tell how to fetch the lib for my project. Very few seem to have a link back to their github page. |
| 17:35 | ibdknox | just use google/github search |
| 17:35 | ibdknox | or ask here |
| 17:36 | technomancy | uvtc: if you can report bugs with libraries that don't have URLs, it would be helpful |
| 17:36 | technomancy | but 90% of them are easily found on github |
| 17:36 | technomancy | how would I test if lein-ring uberwar worked? |
| 17:36 | technomancy | do I need tomcat or something? |
| 17:36 | ibdknox | yeah |
| 17:37 | technomancy | booooooring |
| 17:37 | ibdknox | lol |
| 17:37 | ibdknox | I agree |
| 17:37 | uvtc | technomancy, I can do that. Maybe the community as a whole should plan a day to just pore over Clojars packages looking for ones that don't have a link ... |
| 17:37 | uvtc | Or maybe that could be automated. |
| 17:38 | technomancy | it could and should be automated |
| 17:38 | technomancy | the clojuresphere codebase would make it easy |
| 17:38 | technomancy | sounds like a great starter project for someone looking to learn Clojure! =D |
| 17:38 | randomnamehere | Is there a collection of useful clojure links? |
| 17:38 | uvtc | Unable to find clojuresphere on clojars search {ducks} :) |
| 17:38 | technomancy | haha |
| 17:39 | technomancy | http://clojuresphere.herokuapp.com |
| 17:45 | ibdknox | http://www.clojure-toolbox.com/ |
| 17:47 | jeffdik | off to the Greenville Java Users Group ... I really need to start a Clojure Users Group |
| 17:48 | uvtc | ibdknox, thanks for that link. Didn't know about it. |
| 17:48 | TimMc | jeffdik: Subvert the acronym and turn it into a JVM Users Group |
| 17:50 | uvtc | technomancy, will look into the source code for clojuresphere. Hopefully though someone will beat me to that project. |
| 17:50 | uvtc | s/someone/someone else/ |
| 17:53 | justicefries | la clojure vs enclojure vs emacs? |
| 17:55 | TimMc | Emacs if all else is equal. |
| 17:55 | TimMc | But go with what you know. |
| 17:55 | justicefries | I didn't catch that, I had to restart and my ZNC didn't catch me up |
| 17:56 | TimMc | justicefries: Emacs if all else is equal, but go with what you know. |
| 17:56 | technomancy | don't learn emacs and clojure at the same time |
| 17:56 | amalloy | he said if you don't use emacs you're lame |
| 17:56 | justicefries | I'm a vim user. :D |
| 17:56 | justicefries | but SLIME seems wrong. |
| 17:56 | TimMc | amalloy and technomancy are both correct. |
| 17:56 | TimMc | justicefries: You can use vim with Clojure! |
| 17:57 | justicefries | I have the VimClojure plugin. |
| 18:02 | gtrak` | should new clojure users use lein 2 or stick to 1.7 for now? |
| 18:05 | technomancy | gtrak`: probably best for them to stick with 1.x for now |
| 18:06 | gtrak` | that's what I figured |
| 18:12 | gtrak` | I emailed that riddell.us guy like two weeks ago to take his shit down, now I have a friend that got confused by him... grrrrr |
| 18:12 | lazybot | The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.grrrrr |
| 18:33 | acagle | /flush |
| 18:36 | seancorfield | hey perezd ! |
| 18:36 | perezd | hey there |
| 18:38 | rfgpfeiffer | org-babel clojure support still requires slime |
| 18:43 | rfgpfeiffer | technomancy: can I run clojure-jack-in conditionally only when it is not connected yet? |
| 18:45 | technomancy | sure, just check slime-connected-p first? |
| 18:47 | rfgpfeiffer | thanks, i forgot that emacs uses -p on predicates |
| 18:47 | sjl | I've got two libraries I want to glue together: metrics-clojure and ring. What's the right way to structure this? A contrib.ring namespace in metrics-clojure? A separate metrics-clojure-ring project? |
| 18:48 | ibdknox | sjl: separate project |
| 18:48 | technomancy | rfgpfeiffer: elisp tip: pretend it's the 80s |
| 18:48 | sjl | ibdknox: yeah, that's what I was leaning toward |
| 18:48 | brehaut | technomancy: replace everything with a 4GL? |
| 18:49 | technomancy | brehaut: pretend your language is to primitive to support non-alphanumerics in identifiers is what I was thinking |
| 18:49 | brehaut | technomancy: thats probably less of a handicap |
| 18:49 | sjl | ibdknox: unrelated, but where can I send pull requests for Noir's website/docs? I don't see a docs/ folder in the noir repo or a gh-pages branch... |
| 18:50 | ibdknox | sjl: what's the bug? http://github.com/ibdknox/webnoir |
| 18:51 | technomancy | holy smokes; lein-ring is sloooooooow on lein1 |
| 18:51 | technomancy | what the heck |
| 18:51 | sjl | ibdknox: I think the middleware page should give an example of using a middleware that takes arguments... had to hunt around to figure out it's not (add-middleware (foo "arg")) like it would be if you were using -> |
| 18:53 | ibdknox | sjl: ah, looks like the add-middleware docstring could just use a little adjusting |
| 18:54 | arohner | If I have a fn that needs to use (locking), is there an idiom for the monitor to use that's similar to _ in variable names? |
| 19:02 | technomancy | weavejester: hey |
| 19:03 | TimMc | riddell.us 1 2 3 4 testing |
| 19:03 | lazybot | The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.testing |
| 19:04 | TimMc | amalloy: Why does lazybot append the last word of my msg there? |
| 19:04 | qbg | It's too lazy to drop it? |
| 19:07 | amalloy | huh |
| 19:07 | amalloy | my lazy regex, i guess |
| 19:09 | sjl | hmm, so I'm making a new project that I want to test. I symlinked it into checkouts, but leiningen is still trying to find it online, and I haven't uploaded it yet |
| 19:09 | amalloy | actualyl i have no idea. the regex looks fine, and the code for handling it looks fine too |
| 19:09 | sjl | do I need to do something special to make it look in checkouts/ for dependencies? |
| 19:09 | TimMc | sjl: I think it will still try to download it, even if it isn't going to be on the classpath. |
| 19:09 | TimMc | Not going to guarantee that, though. |
| 19:09 | sjl | hmm |
| 19:09 | technomancy | slj: do a lein install in the dependency |
| 19:09 | TimMc | Or rather, it is probably *shadowed* on the classpath. |
| 19:10 | sjl | so how do I develop the initial version? |
| 19:10 | technomancy | the source will still be preferred |
| 19:11 | sjl | technomancy: ah, ok, thanks |
| 19:13 | qbg | My persistent memory tables for core.logic are statistically significantly faster than rels by a hair. (thanks to criterium for benchmarking) |
| 19:21 | sjl | ibdknox: is there any way to use Noir and cheshire at the same time? Right now it seems Noir requires clj-json which requires Jackson 1.5 and Cheshire requires Jackson 1.9.5... |
| 19:22 | ibdknox | sjl: 1.3.0-alpha10 is stable despite the name and uses cheshire |
| 19:22 | sjl | ibdknox: Hmm... how would I support people running earlier versions of Noir? |
| 19:24 | TimMc | sjl: You may be able to pin the version of Jackson to 1.9.5 |
| 19:25 | TimMc | which *should* be backwards compatible, since it is the same major version |
| 19:26 | ibdknox | I think I tried to do that and it failed epically |
| 19:26 | ibdknox | I may have just been doing it wrong though |
| 19:27 | technomancy | (ns clj-json.core) (def encode cheshire.core/encode) (def decode cheshire.core/decode) |
| 19:27 | ibdknox | actually, I think I just put them in the same project. I didn't force the jackson version |
| 19:29 | johnmn3 | evenin' |
| 19:53 | weavejester | technomancy: Should we talk this over in IRC rather then in the GitHub issues? |
| 19:54 | technomancy | works for me =) |
| 19:54 | weavejester | technomancy: ring-server depends on Ring 1.0.2, so the beta version of Hiccup 1.0 shouldn't be in your deps |
| 19:55 | technomancy | weavejester: oh, super |
| 19:55 | technomancy | weavejester: I guess it only would have been a problem if we moved run-server into ring-devel |
| 19:56 | weavejester | technomancy: I don't think it would have been a problem even then… |
| 19:56 | weavejester | technomancy: Is ring-server not working for you? |
| 19:57 | technomancy | weavejester: I played around briefly with moving it into ring-devel before I heard about ring-server, and it broke in my project that was using old-hiccup. I haven't tried ring-server |
| 19:57 | weavejester | technomancy: Oh, you were using the master branch of Ring? |
| 19:58 | technomancy | yeah |
| 19:58 | weavejester | technomancy: That's a 1.1 snapshot. I have a "1.0" branch for continuing version 1.0 stuff (patches etc.) |
| 19:58 | technomancy | gotcha; cool |
| 19:58 | weavejester | technomancy: Mark's always been big on trying stuff as external libraries first, so although ring-server and lein-ring might end up in Ring (maybe 1.2), they'll be separate libraries first. |
| 19:59 | weavejester | technomancy: Can a plugin add a dependency to the project map before running eval-in-project? |
| 19:59 | weavejester | technomancy: i.e. inject a dependency |
| 19:59 | technomancy | weavejester: yeah, my WIP branch does that |
| 20:00 | weavejester | technomancy: Awesome. Okay so this weekend I'll finish off ring-server. It's nearly done anyway. |
| 20:00 | technomancy | weavejester: excellent |
| 20:00 | weavejester | technomancy: And then it's just a case of injecting the dep and running eval-in-project. |
| 20:01 | technomancy | weavejester: plus a couple other changes to avoid using :library-path |
| 20:01 | technomancy | but yeah, that's all hacked out |
| 20:01 | weavejester | technomancy: Do you have code to that effect? |
| 20:01 | technomancy | yeah, it's all together on the WIP branch |
| 20:01 | technomancy | for the record, lein2 is waaaay faster to uberwar than lein1 |
| 20:02 | weavejester | technomancy: Ah, awesome. I'll take a look when it's not 1am :) |
| 20:02 | technomancy | heh; sure =) |
| 20:02 | weavejester | technomancy: BTW, do you work for Heroku these days? |
| 20:02 | technomancy | the war/uberwar stuff works with my existing pull request + the data.xml one |
| 20:02 | technomancy | yeah |
| 20:02 | technomancy | got to spend the morning moving clojars off sha1 for passwords |
| 20:02 | weavejester | technomancy: I almost ran into Mark in London. He's at QCon, right? |
| 20:03 | technomancy | due to the npm breach |
| 20:03 | technomancy | oh yeah, I think so |
| 20:03 | technomancy | too bad you missed him |
| 20:03 | technomancy | I can't make it to euroclojure this year but am looking forward to next time |
| 20:04 | weavejester | technomancy: I was just about to say hi when Rich's talk started, so I figured I'd wait until after, but he snuck out before the second talk |
| 20:05 | weavejester | technomancy: Hopefully I can catch him before he heads back and buy him a drink :) |
| 20:08 | callen | technomancy: wait, people actually use sha1 for passwords? :( |
| 20:08 | callen | who...why? :( |
| 20:08 | technomancy | callen: =( |
| 20:08 | technomancy | callen: it's amazing that clojars has survived for so long without a maintainer |
| 20:09 | technomancy | https://github.com/ato/clojars-web/graphs/impact <- last nontrivial work: nov 2011 |
| 20:09 | technomancy | 2010 rather |
| 20:10 | devn | :( |
| 20:12 | technomancy | anyway, as soon as I hear back from him I'm going to deploy the bcrypt branch |
| 20:12 | technomancy | ...and possibly wipe out the existing sha1 hashes |
| 20:20 | weavejester | technomancy: Wouldn't that wipe out everyone's passwords? |
| 20:21 | technomancy | yes |
| 20:21 | technomancy | but you don't need your password to do anything except change your pubkey and add people to groups |
| 20:21 | technomancy | because everything else goes through SSH |
| 20:24 | weavejester | technomancy: So how do I get into my account if the password is wiped? |
| 20:24 | technomancy | there's a password reset |
| 20:24 | TimMc | technomancy: Would you consider a migration period? Logins match against SHA1 and generate new bcrypt. |
| 20:25 | technomancy | we have to wipe the old hashes anyway because not everyone still uses clojars |
| 20:25 | TimMc | Wait... this isn't just for login passwords? |
| 20:25 | technomancy | this is just for the web ui |
| 20:25 | technomancy | oh crap |
| 20:26 | technomancy | the forgot password functionality emails it in cleartext |
| 20:26 | weavejester | The way I've seen migrations done is to add a "password type" column, and mark all the existing passwords as SHA1 |
| 20:26 | TimMc | technomancy: *nice* |
| 20:26 | TimMc | So you can do the migration! |
| 20:26 | gfredericks | technomancy: email an immediately-expired password? |
| 20:26 | weavejester | Then when a user logs in, convert the password to BCrypt and change the "password type" |
| 20:27 | sritchie | any core.logic experts around? |
| 20:27 | weavejester | technomancy: How can the forgot password mail it in cleartext if it's SHA1-hashed? |
| 20:27 | gfredericks | probably a new password |
| 20:27 | technomancy | weavejester: yeah, it's a new one |
| 20:27 | technomancy | still horrible |
| 20:27 | TimMc | oh, OK |
| 20:27 | weavejester | Oh right |
| 20:27 | gfredericks | technomancy: ROT13! |
| 20:28 | technomancy | aw yeah |
| 20:28 | weavejester | Horrible why? Because there's no time limit? |
| 20:28 | weavejester | With plaintext email you have to send something that can potentially be subverted. |
| 20:29 | technomancy | hmm... I was thinking it's horrible because it doesn't force you to change it once you log in |
| 20:29 | weavejester | Ohh |
| 20:29 | technomancy | but the fact that it's random is probably enough to convince you to change it =) |
| 20:29 | TimMc | weavejester: Best is a one-time login URL that allows password setting. |
| 20:29 | gfredericks | technomancy: nah, you just use gmail search whenever you need to enter your password |
| 20:29 | TimMc | technomancy: I'd be more convinced to change it if it were "password123". |
| 20:29 | weavejester | TimMc: With a time limit on the login |
| 20:29 | TimMc | weavejester: right |
| 20:30 | weavejester | I had a neat scheme for sending emails over HTTPS... |
| 20:30 | gfredericks | diffie-hellman? |
| 20:31 | weavejester | I need to write it up at some point, even if plaintext email has too much momentum, it's an interesting theoretical exercise. |
| 20:31 | technomancy | I guess sending a plaintext fresh password is OK if you make it clear it needs to be changed once they log in |
| 20:31 | technomancy | it's not pratically any different from a reset token |
| 20:32 | romanandreg | has anyone had come with this issue on Clojurescript's `cljs.closure/build` function: java.lang.AssertionError: Assert failed: Can't recur here|frame |
| 20:32 | romanandreg | ? |
| 20:33 | romanandreg | trying to figure out why is happening |
| 20:34 | TimMc | Ugh, I've seen that. I think it's a compiler bug? |
| 20:34 | romanandreg | do you know what might cause it? |
| 20:35 | TimMc | Nah, it's one of the reasons I gave up on writing try-cljs.com |
| 20:35 | TimMc | That was a bit ago, though! |
| 20:37 | romanandreg | hehe |
| 20:38 | callen | technomancy: so you moved it to bcrypt or some equivalent...riiight? |
| 20:38 | technomancy | callen: yeah, just waiting to hear back from ato before I deploy |
| 20:39 | technomancy | https://mobile.twitter.com/technomancy/status/177863341371424768 |
| 20:39 | callen | technomancy: thank you, I've been trying to kill the "salts are fine" fallacy for several years now. |
| 20:40 | callen | or more specifically, fast hash algo + salt |
| 20:40 | technomancy | it's pretty cool to just tweak the work factor and watch the slowdown double |
| 20:40 | callen | technomancy: >:password "fuuuuuu" \n lol |
| 20:40 | clojurebot | Excuse me? |
| 20:41 | TimMc | Good stuff. |
| 20:53 | technomancy | ok, it turns out rehashing on successful login is easy |
| 20:53 | callen | technomancy: I would hope so. you've already got the data, just re-encrypt with bcrypt and stash it. |
| 20:54 | callen | technomancy: who is maintaining clojars? |
| 20:54 | technomancy | nobody |
| 20:54 | technomancy | well |
| 20:54 | technomancy | I am, now. |
| 20:54 | callen | do you have control over the domainz/ |
| 20:54 | callen | domain? |
| 20:54 | technomancy | the original author has agreed to let me move it to heroku once I port it to postgres and s3 |
| 20:54 | technomancy | but that's still a ways away |
| 20:55 | callen | I always forget you're a heroku employee. |
| 20:55 | technomancy | I've got Big Plans for clojars |
| 20:56 | alex_baranosky | technomancy, do you have a list of those plans anywhere? |
| 20:57 | technomancy | alex_baranosky: the tl;dr: http://p.hagelb.org/clojars-todo.html |
| 20:57 | technomancy | I plan on drafting up a more concrete proposal soon |
| 20:58 | technomancy | once we have HTTP deploy it will be a lot easier to hack on |
| 20:58 | alex_baranosky | technomancy, looks great. |
| 20:59 | johnmn3 | technomancy looks great? |
| 20:59 | alex_baranosky | johnmn3, his list of changes to clojars that he posted |
| 20:59 | technomancy | heh |
| 20:59 | johnmn3 | oh.. right... |
| 21:00 | johnmn3 | sorry, I just came in on the tail end of that conversation. :) |
| 21:00 | xeqi | +1 for browse web interface / older versions |
| 21:00 | xeqi | that was gonna be one of the first things I looked at |
| 21:00 | johnmn3 | I'm pretty stoked about the api |
| 21:01 | johnmn3 | hoping to see it used in clooj in the future |
| 21:01 | technomancy | which api? |
| 21:01 | technomancy | oh, leiningen-core? |
| 21:01 | johnmn3 | yea |
| 21:02 | technomancy | hopefully! |
| 21:03 | johnmn3 | Thing about clooj though, the source is straight up java written in clojure. I was thinking trying to move some of clooj to seesaw. |
| 21:08 | johnmn3 | so I'm making a program that helps analysts operate a web interface that they use to process research items. and I'm thinking about what kind of licensing to use when selling the program to their organization.. per seat licensing or per resarch item. |
| 21:09 | johnmn3 | essentially, the tool takes a ten minute per item processing time and brings it around 4 minutes. |
| 21:10 | johnmn3 | So it more than doubles productivity, so I'd like to lean toward charging per item. |
| 21:14 | johnmn3 | anyone have any experience with those kinds of contracts? |
| 21:30 | amalloy | that doesn't sound like a #clojure question at all. ask in #what-do-i-charge-for-software or something? |
| 21:30 | qbg | They're called "lawyers" |
| 21:30 | technomancy | yeah, this is a hippie channel; none of this money stuff. |
| 21:31 | qbg | Tort law is hard, get someone who is good at it. |
| 21:32 | TimMc | technomancy: I wonder if it's kosher to bcrypt-hash the SHA1 hashes. |
| 21:32 | gfredericks | TimMc: I bet it is |
| 21:32 | TimMc | I know that double-encrypting can actually make encryption weaker in some circumstances, but I don't know if that applies to hashes. |
| 21:33 | technomancy | TimMc: I think with the rehash-on-login we can just hold off and wipe the sha hashes in a couple weeks |
| 21:34 | TimMc | OK, great. |
| 21:36 | qbg | dnolen: Persistent memory tables for core.logic are coming along great |
| 21:37 | technomancy | johnmn3: kidding btw; I just doubt folks in here have much useful experience with that. |
| 21:38 | dnolen | qbg: whoa! |
| 21:38 | dnolen | qbg: awesome |
| 21:38 | qbg | query performance is a hair faster than rels for the single index case |
| 21:39 | qbg | (as per criterium) |
| 21:40 | qbg | Once try to improve on the update functions and maybe write a few more tests, it might be ready for an enhancement on JIRA |
| 21:40 | dnolen | qbg: excellent |
| 21:40 | qbg | I got a >100x speed up during dev by writing a macro :) |
| 21:41 | dnolen | heh |
| 21:41 | qbg | They can also be faster than rels in the multiple index case because I do more aggressive query optimization |
| 21:41 | qbg | Though it does introduce an overhead |
| 21:42 | qbg | Before I special cased the single index case, it was ~1.3x slower than rels |
| 21:43 | gtuckerkellogg | i bought the PDF rough cut of the forthcoming O'Reilly "Clojure Programming" book |
| 21:43 | dhconnelly | how is it? |
| 21:43 | dhconnelly | i just preordered the print book |
| 21:43 | gtuckerkellogg | TERRIFIC |
| 21:44 | gtuckerkellogg | damn it is great |
| 21:44 | dhconnelly | awesome |
| 21:44 | gtuckerkellogg | i became aware of it because there was a github repo with the code samples, and it pointed me to the book |
| 21:44 | gtuckerkellogg | but now that i have the book, i can't find the github repo |
| 21:44 | gtuckerkellogg | D'oh! |
| 21:45 | dhconnelly | they have a twitter for the book |
| 21:45 | dhconnelly | if you haven't seen it |
| 21:45 | technomancy | go cemerick =D |
| 21:47 | y3di | guys im having trouble understanding this snippet of code from http://eddology.com/post/14592579289/busy-persons-clojure |
| 21:47 | y3di | (if-let [prev-count (results score)] (assoc results score (inc prev-count)) (assoc results score 1))) |
| 21:47 | cemerick | gtuckerkellogg: sample projects will be here once I get them cleaned up: https://github.com/clojurebook |
| 21:48 | cemerick | gtuckerkellogg: follow @ClojureBook or subscribe to the ML on http://clojurebook.com to be notified when it lands |
| 21:48 | y3di | specifically, [prev-count (results score)] im not sure I underestand how prev-count works |
| 21:48 | gtuckerkellogg | best IRC session ever |
| 21:48 | johnmn3 | technomancy: okay, how about the eclipse license? What kinds of constraints to I have from a business perspective? If I deploy a gui, do I have to provide my source code? |
| 21:48 | cemerick | gtuckerkellogg: and, thanks for the kind words :-) Tell your friends. ;-) |
| 21:49 | gtuckerkellogg | cemerick, it's a great read. I'll be notified of its landing when the hard copy arrives on my doorstep :) |
| 21:49 | TimMc | cemerick: What audiences does it target? |
| 21:50 | tmciver | y3di: [prev-count (results score)] is a binding form; results is a function call with arg score. The result of that function call are bound to the var prev-count. |
| 21:50 | cemerick | TimMc: The relevant part of the preface is excerpted at the top of http://clojurebook.com :-) |
| 21:50 | TimMc | thanks |
| 21:50 | tmciver | y3di: see the docs for let. |
| 21:50 | cemerick | tl;dr: engaged Java devs + ruby/python devs |
| 21:50 | TimMc | interesting |
| 21:51 | cemerick | a.k.a. introduction to Clojure with no bullshit and high expectations |
| 21:52 | cemerick | Christophe put some killer generified maze generation and game of life impls in there. |
| 21:52 | brehaut_ | it happens to have the best enlive introduction around |
| 21:52 | brehaut_ | (not surprising) |
| 21:52 | cemerick | (just an example) |
| 21:52 | gtuckerkellogg | "introduction to Clojure with no bullshit and high expectations" should be the official subtitle |
| 21:53 | gtuckerkellogg | No need cemerick. I'll shill |
| 21:54 | cemerick | I try to avoid it, esp. around here. People are subjected to my yammerings enough as it ls. :-) |
| 21:54 | brehaut_ | cemerick: s/yammering/fondness for rhetoric/ ;) |
| 21:56 | cemerick | brehaut_: hah; I think it was hiredman that said something like "oh, I saw a reply from cemerick, but knew I wouldn't be able to get through the wall of text" :-P |
| 21:56 | brehaut_ | lol |
| 21:57 | cemerick | "let me add my 2¢, but first, I will thrill you with 'Ode to the Closing Parenthesis', in 7 parts" |
| 21:58 | brehaut_ | haha |
| 21:58 | gtuckerkellogg | haha |
| 21:58 | qbg | dnolen: It also looks like if Rels are ported to persistent memory tables, a few outstanding JIRA issues could also be closed. |
| 22:06 | dnolen | qbg: excellent |
| 22:30 | qbg | b |
| 22:30 | hugod | qbg: written by a brit... |
| 22:31 | qbg | b |
| 22:32 | qbg | 'optimisations' just looks weird to this American |
| 22:32 | qbg | But strangely, labour does not |
| 22:32 | brehaut | qbg: aluminium or aluminum ? |
| 22:33 | technomancy | 'merikins; what do they know about spelling anyway |
| 22:33 | qbg | They both look weird :) |
| 22:34 | qbg | Other than that, Criterium is very excellent |
| 22:35 | amalloy | fwiw i prefer optimisations to labour |
| 22:35 | amalloy | but i'm pretty tolerant of british spellings. i read a lot of their books |
| 22:35 | hugod | qbg: glad you are finding a use for it :) |
| 22:36 | qbg | If I was writing it, the line would be "Warming up the JIT", but it isn't a deal breaker at all :) |
| 22:36 | brehaut | about the only american spelling that actually bugs me these days is 'mom' |
| 22:37 | qbg | What is the British version of mom again? |
| 22:37 | brehaut | mum |
| 22:38 | technomancy | amalloy: they do have some good ones, don't they |
| 22:38 | technomancy | mum is fine; mummy still weirds me out a bit |
| 22:38 | qbg | Cookie vs biscuit is still something I can't fully comprehend |
| 22:38 | jodaro | crisps |
| 22:39 | brehaut | technomancy: are we still talking the parential relationship, or the desiccated cloth wrapped corpse? |
| 22:39 | amalloy | why can't it be both? |
| 22:39 | qbg | Be nice to your mother! |
| 22:39 | qbg | :p |
| 22:42 | hugod | I occasionally catch my self using gas, trunk, or hood, but not very often |
| 22:43 | qbg | b |
| 22:43 | gfredericks | c |
| 22:43 | qbg | Why can't the cursor go where I'm looking? :( |
| 22:44 | gfredericks | qbg: you should use longer passwords |
| 22:45 | qbg | Don't edit cross VM |
| 22:45 | qbg | More specifically, don't use Emacs cross VMs |
| 22:45 | gfredericks | qbg: two cursors blinking at the same time? |
| 22:45 | qbg | Yep |
| 22:46 | gfredericks | shell into the vm! |
| 22:46 | qbg | I forget why I'm using IRC from Windows, when I could be using it from Linux instead |
| 22:51 | brehaut | time for the weekend. later! |
| 22:52 | xandrews | is it possible to create an object if I am looking it up at run-time? for example (new (lookup-class :foo)) |
| 22:52 | qbg | Yes, using reflection |
| 22:53 | qbg | For example, (.newInstance (Class/forName "java.util.ArrayList")) |
| 22:54 | qbg | For ctor args you'll have to lookup the appropriate ctor first |
| 22:54 | xandrews | ah, didn't know about .newInstance |
| 22:55 | xandrews | that doesn't seem to work for records though |
| 22:55 | qbg | .newInstance is for zero arg constructors only |
| 22:59 | qbg | (.newInstance (.getConstructor (Class/forName "java.util.ArrayList") (into-array Class [java.util.Collection])) (into-array [[1 2 3]])) |
| 22:59 | qbg | (java.util.ArrayList. [1 2 3]) is so much easier :) |
| 23:00 | xandrews | yeah... I could use multimethods, but the body of the method would just be repeated for each type |
| 23:00 | qbg | 1.3 defines ctor functions for records |
| 23:01 | qbg | (defrecord Foo [a b c]) defines ->Foo |
| 23:01 | qbg | It also defines map->Foo |
| 23:02 | qbg | Maybe you'll want to use those instead? |
| 23:03 | xandrews | ohh map->Foo is nice... not sure it helps in my case... I suppose i could store a reference to map->Foo instead of Foo itself |
| 23:03 | qbg | You could reflect on the Clojure namespace |
| 23:04 | qbg | (resolve (symbol (str "map->" "Foo"))) |
| 23:04 | qbg | or ns-resolve |
| 23:05 | xandrews | cool. so i have a couple of decent options now. thanks! |
| 23:05 | xandrews | For some reason .getConstructor is not defined for the record |
| 23:06 | qbg | Are you calling it on the class? |
| 23:07 | xandrews | yeah. I also tried using class/forName like you did above |
| 23:07 | qbg | (.getConstructor Foo (into-array Class [Object Object Object])) works for me |
| 23:10 | qbg | Are you trying this at a REPL? Did you verify your classes are really classes? |
| 23:10 | xandrews | oh my bad.. I guess the argument to getConstructor is the array of arguments? |
| 23:10 | qbg | Yes |
| 23:10 | qbg | It is varargs |
| 23:10 | xandrews | ok. that was my problem |
| 23:10 | xandrews | sorry. not a java guy |
| 23:10 | qbg | varargs are nasty for interop |
| 23:12 | romanandreg | has anyone has had an issue with cljs/gclosure that the cljs.core.fn function is not defined? |
| 23:14 | romanandreg | I'm doing development mode, and when I do require in an script tag of the webpage I get this failures https://skitch.com/romanandreg2/8etp1/cljs-issue-1 |
| 23:14 | romanandreg | super annoying |
| 23:14 | romanandreg | also when doing a goog.require('library') I get an error from FF |
| 23:15 | romanandreg | https://skitch.com/romanandreg2/8etp5/cljs-issue-2 |
| 23:24 | dnolen | hmm lein2 foo doesn't seem to work |
| 23:26 | technomancy | dnolen: is it the NPE when you run outside a project? |
| 23:26 | technomancy | or something else I should fix before preview2? |
| 23:26 | dnolen | technomancy: sorry I meant, lein2 new foo doesn't work |
| 23:27 | technomancy | what's wrong? |
| 23:28 | dnolen | Exception in thread "main" java.lang.NullPointerException |
| 23:28 | dnolen | at leiningen.core.classpath$resolve_dependencies.doInvoke(classpath.clj:88) |
| 23:28 | dnolen | |
| 23:28 | technomancy | yeah, looks to be the same bug |
| 23:28 | technomancy | fixed on master, but I'll get preview2 out asap |
| 23:28 | dnolen | k, thx |
| 23:29 | dnolen | has anyone got the datomic appliance to actually work? |
| 23:39 | devn | dnolen: not i...yet |
| 23:40 | devn | dnolen: where are you stuck at? |
| 23:40 | dnolen | devn: just doesn't work |
| 23:41 | devn | that's vague. what's broken? |
| 23:41 | devn | like you go to X, and Y never happens... |
| 23:41 | dnolen | devn: error starting up the image |
| 23:41 | devn | on AWS? |
| 23:41 | technomancy | dnolen: "lein2 upgrade" should take care of you |
| 23:41 | dnolen | devn: no on my machine via virtual box |
| 23:41 | dnolen | technomancy: thx |
| 23:41 | devn | OSX? |
| 23:42 | dnolen | devn: yes |
| 23:42 | devn | dnolen: hm -- ill give it a try |
| 23:43 | devn | dnolen: i finally got to watch the minikanren/ckanren talk from clojure/conj this past year |
| 23:43 | dnolen | devn: whadya think? |
| 23:43 | devn | I laughed out loud, man. |
| 23:43 | devn | fantastic talk. incredibly interesting ideas. |
| 23:44 | devn | and good people 'taboot 'taboot. :) |
| 23:44 | devn | kibitz is the beginning of the promise that has been core.logic, for me anyway |
| 23:44 | devn | and then ambrose tweeting about typed clojure |
| 23:45 | devn | this community is wonderful. |
| 23:47 | dnolen | devn: haha, yeah the Friedman & Byrd talk is hilarious |
| 23:48 | uvtc | Is there a function naming convention regarding leading or trailing hyphens? I see that I'm supposed to use "-main" for the name of my project's "main" fn. |
| 23:48 | dnolen | technomancy: thx, seems fixed now! |
| 23:49 | dnolen | devn: also agree that kibit looks neat |
| 23:49 | technomancy | great |
| 23:51 | technomancy | uvtc: it means it's a java method |
| 23:51 | technomancy | or it's traditionally used in java method names anyway |
| 23:51 | uvtc | technomancy, ! |
| 23:53 | uvtc | technomancy, when I write a "main-" fn in my core.clj, I also put a (:gen-class :main true) at the top... |
| 23:54 | uvtc | (in the `ns` call) |
| 23:54 | devn | dnolen: it's thanks to you that kibit exists |
| 23:54 | technomancy | uvtc: yes, that's necessary to make an uberjar work |
| 23:54 | technomancy | (but not to use "lein run") |
| 23:54 | uvtc | technomancy, Right -- I've seen that firsthand. |
| 23:54 | devn | dnolen: i have grand plans for unifying all of the exploratory tools that have come to exist in clojure |
| 23:54 | devn | dnolen: with some new ones for fun |
| 23:54 | devn | pardon me, fn |
| 23:55 | uvtc | technomancy, I'm trying to understand what you mean by "it's a java fn"... |
| 23:55 | uvtc | technomancy, sorry -- java method. |
| 23:56 | dnolen | devn: thx! but really thanks to lots of people! |
| 23:56 | uvtc | In what other case would you write a method with a trailing hyphen? |
| 23:57 | devn | dnolen: yeah, I don't mean to give all the credit, but it is a fact that without you core.logic wouldn't exist |
| 23:57 | devn | so...thanks, to you and everyone else |
| 23:58 | uvtc | Searching for "hyphen" at clojure.org isn't turning anything up for me. |
| 23:59 | technomancy | uvtc: by default, gen-class finds all defns with a - prefix to turn them into methods |
| 23:59 | technomancy | (this can be changed) |