#clojure log - Jun 22 2011

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:41 sunnibo: question: is there any well-formed URL checking lib? i don't want to check if the URL is valid or not. i just want to check if the given string is a URL or not.

0:46 amalloy: sunnibo: uhhh, the thing you want to do and the thing you don't want to do seem to be the same thing. http://www.someurlimadeup.com isn't "invalid" just because nobody owns that domain name

0:47 but i think ##(java.net.URL. "http://whatever.com") will work, by throwing an exception if it's invalid

0:47 sexpbot: ⟹ #<URL http://whatever.com>

0:48 amalloy: &(java.net.URL. "test")

0:48 sexpbot: java.net.MalformedURLException: no protocol: test

0:52 sunnibo: thanks, amalloy

2:01 question: how can i get a number from a string? the given string is an alphanumeric. i want to get the number part. ex) "123'" -> 123

2:06 amalloy: $findfn "123" 123

2:06 sexpbot: [clojure.core/read-string clojure.core/bigdec clojure.core/bigint]

2:07 Scriptor: ,(doc read-string)

2:07 clojurebot: "([s]); Reads one object from the string s"

2:07 Scriptor: ,(read-string "123")

2:07 clojurebot: 123

2:07 Scriptor: ,(read-string "123'")

2:07 clojurebot: 123

2:07 Scriptor: sunnibo: looks liek that's what you want

2:07 *like

2:22 rhdoenges: sunnibo: or (Integer. "123")

2:22 ,(Integer. "123)

2:22 clojurebot: EOF while reading string

2:22 rhdoenges: ,(Integer. "123")

2:22 clojurebot: 123

2:22 rhdoenges: ,(Number. "123")

2:22 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Number

2:22 rhdoenges: ohkay.

2:22 so you want Integer probably

2:24 because this can happen:

2:24 ,(read-string "(1 2 3 4 5)")

2:24 clojurebot: (1 2 3 4 5)

2:25 Scriptor: ah, right, read as in clojure's reader

2:30 terom: Integer(String s) constructs a new Integer object; in case that matters, you can use also Integer#parseInt(String s).

2:30 ,(Integer/parseInt "123")

2:30 clojurebot: 123

2:32 Scriptor: terom: parseInt doesn't work when there are non-numeric characters, and that's what sunnibo needed

2:32 ,(Integer/parseint "123'")

2:32 clojurebot: java.lang.IllegalArgumentException: No matching method: parseint

2:32 Scriptor: ,(Integer/parseInt "123'")

2:32 clojurebot: java.lang.NumberFormatException: For input string: "123'"

2:32 terom: ,(Integer. "123'")

2:32 clojurebot: java.lang.NumberFormatException: For input string: "123'"

2:33 terom: Scriptor: true, and neither does Integer constructor.

2:33 Scriptor: yep, so I guess you'd have to rely on read-str, although if there's valid clojure code in the string there'd be problems

2:34 terom: Well, one could also use regexps. Depends on the input strings, really.

2:36 rhdoenges: (read-str "123") is prettier. Just be sure that you are passing safe input and you're fine.

2:38 *read-string

2:38 :P

2:39 Scriptor: ,(read-string "2 a")

2:39 clojurebot: 2

2:39 Scriptor: ,(read-string "2 :a")

2:39 clojurebot: 2

2:40 sunnibo: read-string would be good for me. thanks, guys!

2:40 Scriptor: sunnibo: careful if you do something like (read-string "a 2")

2:40 ,(read-string "a 2")

2:40 clojurebot: a

2:41 Scriptor: as you can see, it seems to go for the first token

2:42 I guess if you need to you could always do a string replace of anything that's not a digit with blak

2:46 amalloy: &(->> "a 123" (re-seq #"\d+") first read-string)

2:46 sexpbot: ⟹ 123

3:23 sunnibo: another question: ((1 2 3) (4 5) (6 7)) -> (1 2 3 4 5 6 7)

3:25 raek: sunnibo: ##(apply concat '((1 2 3) (4 5) (6 7)))

3:25 sexpbot: ⟹ (1 2 3 4 5 6 7)

3:26 raek: ,(apply concat '((1 2 3 (4 5)) (6 7)))

3:26 clojurebot: (1 2 3 (4 5) 6 7)

3:26 raek: ,(flatten '((1 2 3 (4 5)) (6 7)))

3:26 clojurebot: (1 2 3 4 5 6 7)

3:27 raek: "apply concat" does not have a shorter name unfortunately

3:30 and "flatten" is not in general a substitute

3:30 sunnibo: raek, thanks

3:49 Raynes: I propose that concat be renamed to octocat.

3:51 rhdoenges: I propose that github does all my programming and I eat calamari.

3:54 sunnibo: ,(and '(false false))

3:54 clojurebot: (false false)

3:55 sunnibo: ,(and '(false true))

3:55 clojurebot: (false true)

3:55 __name__: ,(apply and '(false false))

3:55 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/and

3:55 sunnibo: how can i get just 'false'?

3:55 raek: ,(every? identity '(false false))

3:55 clojurebot: false

3:56 sunnibo: ,(every? identity '(false true))

3:56 clojurebot: false

3:56 raek: ,(and :truthy :falsy)

3:56 clojurebot: :falsy

3:56 raek: ,(boolean (and :truthy :falsy))

3:56 clojurebot: true

3:56 sunnibo: ,(some identity '(false true))

3:56 clojurebot: true

3:56 sunnibo: yeah, but the parameter is a list

3:57 raek: eh, ":falsy" is of course truthy since it's neither nil nor false...

3:57 __name__: (every? true? [true false])

3:57 ,(every? true? [true false])

3:57 clojurebot: false

3:57 __name__: ,(every? true? [false false])

3:57 clojurebot: false

3:57 __name__: ,(every? true? [false true])

3:57 clojurebot: false

3:57 raek: ,(every? true? [1 2])

3:57 clojurebot: false

3:57 __name__: ,(every? true? [true true])

3:57 clojurebot: true

3:57 raek: ,(every? identity [1 2])

3:57 clojurebot: true

3:57 sunnibo: what's the 'identity

3:58 raek: sunnibo: the identity function just returns its argument

3:58 so the value itself is checked for truthiness

3:59 sunnibo: ,(identity '(false true))

3:59 clojurebot: (false true)

3:59 sunnibo: i got it

3:59 rhdoenges: ,(doc and)

3:59 clojurebot: "([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true."

3:59 raek: ,(every? identity [a b c]) is equivalent to (boolean (and (identity a) (identity b) (identity c)))) which is equivalent to (boolean (and a b c))

3:59 clojurebot: java.lang.Exception: Unable to resolve symbol: a in this context

4:24 sunnibo: question: i have a couple of lists, (1 2 3) (a b c) (u v s). how can i get (1 a u) (2 b v) (3 c s)?

4:27 Fossi: ,(find)

4:27 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$find

4:31 Scriptor: sunnibo: look into map, specifically passing it multiple lists

4:31 check out the examples: http://clojuredocs.org/clojure_core/clojure.core/map

4:36 sunnibo: ,(map list '(1 2 3) '(a b c) '(u v s))

4:36 clojurebot: ((1 a u) (2 b v) (3 c s))

4:39 Cozey: woo - lisp syntax is gaining popularity: http://programming.nu/

4:42 Fossi: weird

5:33 pyr: noir is really well polished

6:19 Cozey: how could i define a multimethod dispatch function, so it accepts a _set_ of values per each defmulti ?

6:20 bsteuber: Cozey: you can't using defmulti

6:20 but you can do that yourself

6:21 have one lookup function

6:21 and one facade function doing the dispatch

6:23 clgv: Cozey: I am not sure if I understood you completely - can you give an example of what you mean?

6:24 Cozey: well

6:25 (defmulti foo (fn [some-text value] some-text))

6:26 (defmethod #{"zebra" "horse"} [_ v] (run-away v))

6:26 (defmethod #{"fox"} [_ v] (hide v))

6:26 something like this

6:26 jhuni: ,(+ 1 1)

6:26 clojurebot: 2

6:27 clgv: ah ok

6:28 jhuni: ,(-> 0 inc inc)

6:28 clojurebot: 2

6:29 clgv: Cozey: you could implement bsteuber suggestion then or build an own macro that translates your "set defmethod" into single standard defmethods.

6:33 Cozey: hmm - lookup, disptach - which one is on defmulti and wher is the other one ?

6:33 clgv: Cozey: defmethod and defmulti almost instantly use the java part of the clojure implementation. so you cant just alter them easily

6:36 Cozey: clgv: generating few methods is not a bad idea

6:39 and in bsteuber's idea, how would that look ? defmethod always matches it's arguments with = right?

6:41 hmm. but from extensibility perspective, generating a defmethod for each set element is better

6:44 bsteuber: Cozey: true, so maybe it's simplest

6:44 to just have a macro define a method per key

6:45 manutter: can you use hierarchies for that?

6:46 clgv: Cozey: you could try something like that: (defmacro defmethod-set [name value & body] (if-not (set? value) `(defmethod ~name ~value ~@body) `(doseq [v# ~value] (defmethod ~name v# ~@body))))

6:46 I tried it for a simple value and a set

6:46 (defmethod-set foo #{"donkey", "horse"} [bla v] "donkey or horse")

6:46 (defmethod-set foo "zebra" [bla v] "zebra")

6:47 Cozey: yes - unfortunately in my example i dispatch on two values - from which only one is intended to be a set - but a general solution would create a cartesian product of both sets (it they were sets) and generate defmethods for this

6:47 clgv: it get's the job done, but it will define multiple implementations - one for each dispatch value.

6:48 Cozey: s/example/project/

6:48 sexpbot: <Cozey> yes - unfortunately in my project i dispatch on two values - from which only one is intended to be a set - but a general solution would create a cartesian product of both sets (it they were sets) and generate defmethods for this

6:48 Cozey: sexpbot: thanks :-)

6:48 clgv: hmm you can also skip the if-not and only use defmethod for value dispatch and defmethod-set for set dispatch

6:50 Cozey: yes

6:51 clgv: hmm you could also use the original defmethod only and built some sort of pre-dispatch into the dispatch function

6:52 Cozey: it's not possible to add a docstring to defmulti ?

6:52 "The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)"

6:53 clgv: (defmulti foo (fn [some-text value] (cond (#{"donkey" "horse"} some-text) :donkey-or-horse (= "zebra" some-text) :zebra :else :default)))

6:53 and then use the keywords in your defmethods

6:53 Cozey: uh my bad - it's ok

6:54 clgv: I think thats really elegant that way

6:54 Cozey: clgv: yes i thought about this too - but then it would not be possible to add new types - and that is what defmulti is all about

6:54 clgv: humm can you use a multimethod as dispatch function? ;)

6:54 Cozey: so the previous idea is better, because in the end we get a 'compatible' solution, typing less.

6:55 brialiant!

6:55 clgv: but still quite a bit of a hack ;)

6:56 Cozey: or maybe i could use a hierarchy ?

6:56 but can i use strings in hierarchies ?

6:56 bsteuber: no, only namespace-qualified keywords are allowed in hierarchies

6:56 and java classes as leaves

6:58 clgv: is there a clojure construct called "hierarchy"?

6:59 Cozey: i could convert the strings into keyword

6:59 http://clojure.org/multimethods

6:59 clgv: just got there through google ;)

7:00 Cozey: how to create a ::kw keyword ?

7:00 bound to a namespace?

7:01 ,(keyword *ns* "pe")

7:01 clojurebot: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to java.lang.String

7:01 clgv: Cozey: keywords are not really bound to namespaces - if you add :: in front it just adds the namespace as prefix to the keyword

7:01 Cozey: ,(doc keyword)

7:01 clojurebot: "([name] [ns name]); Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically."

7:01 Cozey: but how to run second form of keyword

7:02 terom: ,(keyword "ns" "keyword")

7:02 clojurebot: :ns/keyword

7:02 clgv: &(keyword (name *ns*) "pe")

7:02 sexpbot: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.Named

7:02 clgv: &(keyword (ns-name *ns*) "pe")

7:02 sexpbot: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String

7:02 bsteuber: haha

7:02 closer

7:02 terom: ,(keyword (str *ns*) "pe")

7:02 clojurebot: :sandbox/pe

7:02 bsteuber: but using *ns* doesn't make sense anyways

7:03 Cozey: why?

7:03 clojurebot: http://clojure.org/rationale

7:03 bsteuber: ,::pe

7:03 clojurebot: :sandbox/pe

7:03 bsteuber: because :: is shorter

7:03 clgv: bsteuber: he wants to generate keywords from strings ;)

7:04 bsteuber: damn :)

7:04 but I don't think a hierarchy will gain so much

7:04 because if you want to define many at once

7:04 you still need to generate all the derive-statements

7:05 Cozey: yes but it's shorter and extensible

7:06 when I think of it now, it's a perfect match for this use case

7:06 clgv: you can always write a wrapper macro or function ;)

7:07 Cozey: so your dsipatch function will always got to the highest parent in the hierachy and return that one?

7:08 Cozey: clgv: there's this isa? thing which is used automatically

7:09 i'll get it to work and show

7:10 clgv: Cozey: can't imagine a dynamic version with 'isa? but I'll wait and see^^

7:10 Cozey: the isa? should be automatic

7:10 here are examples : http://clojuredocs.org/clojure_core/1.2.0/clojure.core/defmulti

7:11 clgv: it's transitive for sure but I dont know how you want to write your dispatch function with it

7:14 ah. defmultia uses 'isa? instead of '=

7:28 Cozey: *ns* yields <user> when required from user, even if the function is in another ns

7:28 shoudl i harcode it like "foo.bar" or ?

7:36 terom: I'm not sure what you're doing (maybe you should paste your code somewhere), but maybe this could help: ##(read-string "::pe")

7:36 sexpbot: ⟹ :sandbox7608/pe

7:38 clgv: Cozey: thats expected behavior. *ns* returns the *ns* you are in. you might want to use ~*ns* within a macro

7:39 Cozey: mhm

7:39 clgv: Cozey: or you show us the example, what it does and tell us what it is intended to do ;)

7:40 Cozey: one sec:

7:40 https://github.com/lolownia/lancet/blob/master/src/lancet/core.clj#L58

7:42 that way i can write ant-tasks under lein using more idiomatic clojure: https://gist.github.com/1039929

7:43 clgv: so now the exact call and its output are needed ;)

7:44 Cozey: ?

7:45 (add-nested "exec" (ExecTask. .... ) "--help") will set --help argument on ExecTask

7:46 on the other hand (add-nested "war" (War. ...) (FileSet. ... ) ) will set filesets for Warfile to use. Ant has a bizzare API - that is: lot's of tasks use different input objects

7:46 clgv: humm I dont even see any usage of *ns* in there

7:46 Cozey: like ManifestTask for generating Manifest files - they use Manifest$Attribute

7:46 i have hardcoded lancet.core

7:47 line 68

7:47 not the best solution out there

7:51 enough. I'm going outside :-) thanks for help and have a nice day.

7:52 clgv: *ns* should work in there as well

8:14 concerning maps where is the difference between 'into and 'merge? which one should I prefer to use?

8:15 (doc into)

8:15 clojurebot: "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

8:15 clgv: ok merge supports multiple maps

8:17 bsteuber: into also works for other types

8:18 clgv: yes, it's more general.

9:01 shtutgart: In Midje, I've wrote (provided (get @an-atom anything) => :foo) and got "You claimed the following was needed, but it was never used: (get (clojure.core/deref an-atom) anything)". What might be the problem?

9:02 (of course I'm calling get on @an-atom)

9:17 manutter: shtutgart: I wonder if it would make a difference if you wrote out (deref an-atom) instead of using the shortcut @an-atom

9:23 raek: ,(read-string "@foo")

9:23 clojurebot: (clojure.core/deref foo)

9:24 raek: that seems unlikely. there shouldn't be any difference from the forms emitted by the reader. (except for the namespace qualification of the symbol, maybe)

9:34 pyr: hi

9:34 is it a known bug that (keyword "") breaks the code is data / data is code aspect of clojure

9:35 ,(read-string (str {(keyword "") :foo}))

9:35 clojurebot: java.lang.RuntimeException: java.lang.Exception: Invalid token: :

9:39 jochen_: hi, I have an enlive question: in swadonnette tutorial scrape2.clj, select with a set as second par is used to extract two items, but then partition2 with vector destructuring is used to assign to headline and points. Isn't this broken as a set does not guarantee any order?

9:39 cemerick: pyr: Not broken. Empty keywords just aren't readably printable.

9:41 pyr: it looks as if LispReader.java could be coerced into getting it right

9:42 cemerick: ok, but that breaks homoiconicity at least

9:42 cemerick: pyr: A saner approach (often-suggested) is to support arbitrary symbols and keywords via pipes. e.g. :|| for an empty keyword, or |foo bar| for a symbol with spaces, etc.

9:43 pyr: how? You're just bumping up against impl details of the reader.

9:45 pyr: well even if its not that important if it can be cleanly fixed in the reader it's just all for the better isn't it ?

9:47 cemerick: pyr: the empty keyword is just one edge case, along with keywords and symbols with constituent whitespace, colons, and slashes. "Fixing" the reader to handle just one of them isn't seen as a high priority, when there's likely an acceptable general-purpose solution.

9:48 clgv: pyr you can also do that: ##(keyword ":bla")

9:48 sexpbot: ⟹ ::bla

9:48 pyr: cemerick: 'k, got it

9:49 cemerick: pyr: If it's a big concern/problem for you, do feel free to take it on. My guess is that particular behaviour hasn't changed because no one has cared enough to push on it.

9:49 pyr: cemerick: nope, i didn't get that there were so many other non readable forms

9:50 cemerick: and indeed it doesn't make sense to fix just the one

9:50 it's true that i could have just tried ##(keyword " ")

9:50 sexpbot: ⟹ :

9:51 pyr: to see for myself :)

9:52 clgv: but I guess this one doesnt read-in like it should as well: ##(-> (keyword ":bla") str read-string)

9:52 sexpbot: ⟹ :sandbox7608/bla

9:53 clgv: it's discouraged in some doc to generate keywords like that but not impossible.

10:10 TimMc: ,(identical? :f (keyword "f"))

10:10 clojurebot: true

10:10 TimMc: good

10:17 clgv: &(identical? ::bla (keyword ":bla"))

10:17 sexpbot: ⟹ false

10:17 clgv: ;)

10:34 TimMc: eep

10:35 Oh, I see.

10:51 clgv: sexpbot: would you like to join #clojure.de? ;)

10:51 sexpbot: I'd do him. Hard.

11:03 ejackson: filthy bot - i hope you practice safe hex.

11:16 miltondsilva: hi, you all know this http://cemerick.com/2011/06/15/the-2011-state-of-clojure-survey-is-open/ so, in the comments section Chas Emerick says that a different survey covering other type of questions could be useful...

11:17 here is a draft of a possible survey

11:17 https://spreadsheets.google.com/spreadsheet/viewform?formkey=dFFJTTZWT2lXR1N1dTJTWk5mdjZXZlE6MQ

11:18 sugestions are very welcome (to add more questions or to add more options, I'm sure there are missing ones)

11:54 justinlilly: Hey folks. What's the preferred cheap/free hosting setup for a clojure webapp? AppEngine?

11:54 didn't know if there is a heroku-like equivalent in the JVM world.

11:54 dnolen: justinlilly: Clojure runs on Heroku

11:55 wastrel: never heard of heroku

11:56 justinlilly: ahh. neat. Didn't realize they offered more hosting options these days.

11:59 sritchie: jesus, just went into #java, it's crazy in there

11:59 pjstadig: justinlilly: they have this whole new procfile thing

11:59 sritchie: thank you all for your civility

11:59 pjstadig: where you can run pretty much anything you want

12:00 polyst: (inc sritchie)

12:00 sexpbot: ⟹ 1

12:00 justinlilly: hm. neat. I may check it out. Not having a reasonable place to deploy was one hesitation I had w/ messing around with some clojure webapps, but presumably, that's not an issue now :)

12:02 seancorfield__: i was pleasantly surprised by how easy it is to run clojure on heroku

12:04 TimMc: sritchie: "How does I hello world?"

12:05 "WHAT IS MAIN"

12:05 sritchie: one of the first things I saw was "YOU'RE SHADOWING THE FUCKING VARIABLE!!!"

12:05 TimMc: haha

12:05 sritchie: see, even cursing in here feels just wrong and terrible

12:06 TimMc: ~guards!

12:06 clojurebot: SEIZE HIM!

12:06 sritchie: clojurebot: botsnack

12:06 clojurebot: Thanks! Can I have chocolate next time

12:06 sritchie: obvi

12:06 polyst: $kill

12:06 sexpbot: KILL IT WITH FIRE!

12:07 clgv: clojurebot: chocolate

12:07 clojurebot: Pardon?

12:07 clgv: lol

12:07 * TimMc feeds clojurebot a kitten

12:07 dnolen: sritchie: well, you have to sympathize with #java. They must get the same 10 noob/student questions every couple of minutes.

12:09 sritchie: dnolen: yes, the point's well taken -- grizzled as they are, at least those guys are in there answering questions

12:21 wastrel: clojurebot eh

12:30 tufflax: When calling swap!, the actual swap happens in another thread right? I find that I'm using a lot of (swap! some-atom (constantly some-val)) and realized that that can be very bad if the last swap does not happen before I use the atom to create the next value that is gonna be the argument to constatly. I shouldn't be using constantly so much, right?

12:31 hiredman: tufflax: no

12:31 tufflax: no? :p

12:31 hiredman: tufflax: there was a question somewhere in there, the answer is no

12:31 clojurebot: c'est bon!

12:32 tufflax: hiredman there are 2 questions

12:32 hiredman: fine: no, whatever you like

12:33 tufflax: So swap! happens in the caller thread?

12:34 raek: tufflax: also, you can use reset! in this case

12:34 tufflax: yes

12:34 tufflax: ok, thanks

12:34 raek: tufflax: the current value is read, the function is applied to create a new value and then the new value is compare-and-set!'ed in

12:34 tufflax: ah ok

12:34 didn't know about reset!

12:35 raek: if the value had changed, the set fails and another attempt is done

12:35 tufflax: i see

12:37 edw: Anyone here use redistogo? I'm trying to figure out where, if anywhere to pass in the user from the redis URL.

12:38 I'm using redis-clojure...

12:38 abedra: how does one file an issue with Ring?

12:38 edw: Github?

12:38 clojurebot: github is http://github.com/clojure/clojure

12:38 abedra: there's no issue page up on the github wiki

12:40 edw: Hmm. The man doesn't want to be contacted...

12:41 pjstadig: http://groups.google.com/group/ring-clojure ?

12:45 abedra: edw, it's fine, I just emailed mark

12:45 there's a bug in wrap-params

12:46 under the hood it calls URLDecode/decode

12:46 and if the param passed in is "%" that blows up

12:46 throwing an exception and halting everything else

12:46 edw: Whereas it should call what? Something that also escapes query-string chars like ? and &

12:47 abedra: that's why I emailed mark

12:47 there are a few ways of working around this, but before I spend time putting together a patch I would like to get his input

12:47 edw: Right. I just forget the proper names of the more and less permissive versions.

12:49 hugod: Isn't weavejester maintaining ring now?

12:50 abedra: hugod, he might

12:50 be

12:50 i should send him a note as well

12:54 ilyak: Damn. Why doesn't my ccw builder build clojure files?

12:54 Is there any logs or something?

12:59 duncanm: hmm, anyone know how to copy an emacs stack trace?

13:00 the buffer seems kinda stuck, and once i press 'q', it goes away

13:09 dpritchett: I'm trying to figure out how my noir app is automatically reloading every time i save a view file. i can write a function, save, and hit f5 and the new function is there

13:09 I'm using lein run, noir uses ring/jetty by default i think

13:09 digging around in the respective sources to figureo ut where the hot reloads come in

13:10 mids: dpritchett: its the reload-modified middleware in https://github.com/ibdknox/noir/blob/master/src/noir/server.clj

13:10 dpritchett: thanks mids

13:11 I'm quite glad it's doing this I just didn't expect it :)

13:12 here's the ring.middleware.reload-modified source, fun read https://github.com/weavejester/ring-reload-modified/blob/master/src/ring/middleware/reload_modified.clj

13:39 amalloy: duncanm: C-x h to mark the whole buffer, then M-w to copy?

13:58 edw: Is there any consensus on the "best" redis client out there?

14:06 dpritchett: how can i use array literal notation side by side with an array generating function

14:06 say I have one function that returns an array with three k:v pairs

14:06 and i want to reference it from within a list where i specified two arrays literally and i want to specify the third using my function

14:07 e.g. https://gist.github.com/04a93dcf80d8a5dd6913

14:08 ah, found a stray paren nevermind

14:10 wastrel: parenthesis can be important

14:29 devn: Also, how does everyone manage getting the latest build with leiningen? Is there some easy route I'm missing?

14:35 dpritchett: i just run "lein update" sporadically

14:37 * hiredman has a git checkout and runs git pull

14:46 dnolen: it's a bit annoying that ls

14:47 oops sorry

14:47 polyst: (dec dnolen)

14:47 sexpbot: ⟹ 2

14:47 polyst: ;-)

15:00 amalloy: edw: i've used aleph a little for redis, and it seems fine

15:14 gtrak: you guys ever thought of using akka for multi-node stuff? are there other alternatives for clojure that work better?

15:15 seancorfield__: anyone use clojuresque with gradle? pros / cons vs leiningen?

15:16 hiredman: gtrak: depends what you are distributing

15:16 akka is actors righ?

15:16 right

15:16 gtrak: yes

15:16 dpritchett: does hiccup usually spit out source with no whitespace? http://3y5n.localtunnel.com/todos

15:17 gtrak: I don't know exactly what to distribute, but I want to prototype with it in mind, so I want something flexible and light

15:17 hiredman: actors are generally nice for modeling state machines, but if you are just distributing data processing in parallel then you don't need them

15:17 gtrak: how can you not know that?

15:18 gtrak: just experiementing

15:18 for my own gratification

15:18 hiredman: well then do whatever is most gratifying

15:19 amalloy: dpritchett: yes

15:19 gtrak: but i think it'll look like looping over a dataset, where the dataset is a cache that gets synched with a db or something

15:19 amalloy: i assume there's a setting/binding somewhere you can change

15:20 technomancy: I briefly looked into using akka. the docs assume you know scala, so I didn't get very far

15:20 actually kind of glad I didn't spend more time on it after reading this: http://blog.darevay.com/2011/06/clojure-and-akka-a-match-made-in/

15:21 gtrak: yea, I just saw that

15:21 though you see at the bottom jboner's interested in seeing it work

15:22 hiredman: I do have an as yet unannounced library that attempts to making working with message queues (hornetq) dirt simple to start with

15:22 https://github.com/hiredman/vespa-crabro

15:22 technomancy: gtrak: yeah, there's promise; it's just not there yet

16:15 amalloy: chouser: is there a finger-tree measure i could use/write that would support fast conjing onto one end, and fast dissoc from anywhere in the middle?

16:18 devn: this new noir web framework looks promising

16:18 https://github.com/ibdknox/noir

16:20 dpritchett: yeah its been fun playign with it today devn

16:20 i like having a few sensible defaults chosen for me so i don't have to figure out the whole stack myself

16:20 although reading this helped too http://brehaut.net/blog/2011/ring_introduction

16:31 hickster: whois chouser

17:04 devn: a nice guy

17:09 amalloy: devn: the official #clojure faq

18:10 sdeobald: Does anyone know if there's a function in contrib (or otherwise) to convert camelCase into hyphen-case?

18:12 amalloy: sdeobald: there are a few libraries with an implementation of that you could steal. i don't know of one in contrib

18:14 sdeobald: https://github.com/ninjudd/cake/blob/develop/src/cake/tasks/deps.clj#L95 is one, which i think i wrote

18:15 tremolo: couldn't you handle that with a relatively simple RegEx replace

18:20 sdeobald: amalloy: Thanks. Was just hoping to avoid writing yet another. Guess it's probably just time to suck it up and assemble some sort of generic utils lib.

18:21 amalloy: sdeobald: i approve of everyone having their own generic utils lib

21:17 arohner: chouser: remember my "bug report" a few days ago about clojure.data.xml.pull-parser holding on to head? Turns out, it was the clojure keywords not being GC'd issue

21:18 I'm succesfully dorun'ing across all of wikipedia now

21:37 alandipert: arohner: that's on 1.2?

21:38 arohner: alandipert: I was having problems on 1.2.0. The keyword GC issue is fixed in 1.2.1 (and trunk)

21:39 alandipert: arohner: cool, just wanted to make sure it didn't sneak back in

22:22 carllerche: is it possible to connect a repl to a running process?

22:25 cemerick: carllerche: if your running process is running a network REPL server (like swank or nREPL), yes

22:26 carllerche: cemerick: is it sane to run swank and such in production?

22:26 technomancy: we have swank in production

22:26 it's perfectly reasonable as long as you only listen on localhost

22:27 cemerick: carllerche: That's a loaded question. You certainly can (I do).

22:27 scgilardi: if you can arrange to run code in the process somehow, you can open up a repl over a socket. examples: http://sean8223.blogspot.com/2009/06/adding-remotely-accessible-repl-to.html and http://clojure.github.com/clojure-contrib/server-socket-api.html

Logging service provided by n01se.net