#clojure log - Apr 07 2013

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

0:57 nightfly__: Is there a simple way to replace the nth item in a lazy sequence?

1:01 nevermind, was a silly idea

4:50 dribnet: a little tripped up on my first serious macro...

4:52 trying to recursively call the macro on a collection, but don't have the right mental model i guess.

4:52 (defmacro ct-clj [x] (cond (coll? x) (concat (list 'cljs.core/array) (map #(ct-clj %) x))))

4:53 i get "clojure.lang.ArityException: Wrong number of args (1) passed to: tags$ct-clj"

4:58 ok, constructed simpler case

4:58 (defmacro inwards [x] (if (coll? x) (map #(inwards %) x) "x"))

5:00 anyone bored enough to hand-hold me to enlightenment and tell me why this fails for (inward [5])

5:24 mjc: what "should" inward [5] return ?

5:27 dribnet: ["x"]

5:37 (but it was all screwed up)

5:38 this is closer, but doesn't recurse

5:38 (defmacro inwards [x]

5:38 (if (coll? x)

5:38 (vec (map #(inwards %) x))

5:38 "x"))

5:39 user=> (inwards [1 2 [3 4 5]]) ; => ["x" "x" "x"]

5:42 hyPiRion: dribnet: what should a macro return?

5:44 A macro should return a form, not a result

5:45 &(clojure.walk/macroexpand-all '(cond foo bar baz quux :else something))

5:45 lazybot: ⇒ (if foo bar (if baz quux (if :else something nil)))

5:45 hyPiRion: ^that's what you should produce, not the result

5:49 dribnet: thanks hyp... i think.

5:49 in my case as an exercise, i was trying to translate [1 2 [3 4 5]] into ["x" "x" ["x" "x" "x"]]

5:50 (at compile time)

5:50 but i will think on what you said.

6:00 hyPiRion: what is wrong with a macro returning a result

6:01 ie: if one wanted to convert [1 2 3] to {"x" "x" "x"] *at compile time*, what is the alternative?

6:15 Pupnik: http://vimeo.com/9270320 fascinating

6:26 mjc: (defmacro inwards [& args] `(clojure.walk/prewalk #(if (coll? %) (identity %) "x") ~@args))

6:51 Glenjamin: is hiccup suitable for generating xml, or is there a hiccup-like library for it?

7:22 svedubois: I am using a java method, which is public void setEnvmapped(boolean mode)

7:22 When I write (.setEnvmapped true)

7:22 I get this error: clojure.lang.Compiler$CompilerException: java.lang.NullPointerException

7:22 What I am doing wrong?

7:30 borkdude: svedubois (.setEnvmapped object true) or (SomeClass/setEnvmapped true) depending on static or member method

7:31 svedubois your code now is equivalent to true.setEnvmapped()

7:34 svedubois: When I write this: (.setEnvmapped box true)

7:34 I obtain again an error: java.lang.NullPointerException: null

7:36 Glenjamin: is anyone familar with clojure.zip / clojure.data.zip ? I'm using it to extract data from xml, but i can't figure out how to make an "or" predicate

7:40 borkdude: svedubois this probably means box is null

7:45 svedubois: borkdude: Yes, box was not well defined, now it works

8:06 How I can merge these 2 lines into only 1 line?

8:06 (doto world

8:06 (.. getCamera (setPosition 0 0 0))

8:06 (.. getCamera (lookAt (.getTransformedCenter box))))

8:06 Something like this, but correctly:

8:06 (doto world

8:06 (.. getCamera (setPosition 0 0 0)

8:06 (lookAt (.getTransformedCenter box))))

8:07 Foxboron: svedubois: maybe make a macro?

8:45 noncom: hi! i'm working with a Java array of ints that stores colors as ints. So I try putting 0xFFFFFFFF color in the array cells. What I get is all kind of strange things since 0xFFFFFFFF is not considered int, but is long!!! Never had this crazy problem in Java... how to fix it in Clojure?

8:46 klang: Is anybody running emacs and clojure on two different hosts, connecting to clojure via nrepl?

8:47 `(int 0xFFFFFFFF)

8:47 hyPiRion: noncom: yeah, Clojure is a but different there, but klang has the right idea

8:47 klang: .. that's not an int.

8:48 hyPiRion: ,(unchecked-int 0xFFFFFF)

8:48 clojurebot: 16777215

8:48 hyPiRion: whoops

8:48 ,(unchecked-int 0xFFFFFFFF)

8:48 clojurebot: -1

8:48 hyPiRion: ,(int 0xFFFFFFFF) ; errors

8:48 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 4294967295>

8:48 noncom: well, it is 4 bytes which is used to store colors as ints for ages

8:48 klang: hyPiRion: thank's that was what I tried to do :-D

8:48 noncom: thayeah i got same errors

8:49 i will try the proposed idea now

8:49 hyPiRion: noncom: yeah, but Clojure runs with longs as default. It's a bit messy to work with Java integer primitives and convert them from one and another

8:49 It's not exactly where Clojure shines, heh.

8:50 noncom: yeah maybe but thousands of data standards use ints (like this one, with colors).. so using `(int 0xFFFFFFFF) or (unchecked-int 0xFFFFFFFF) is idiomatic? a little strange for a data-oriented language.. :)

8:53 well, anyway... at least it is explicit in the code.. it's just the first time i have encountered something like that so a bit chocked :)

8:53 thanks for the help!

8:53 klang: nocom: to be fair, you have already started to convert your data before involving clojure, right?

8:54 noncom: klang: umm.. not really understand what you mean. I am using Processing, a Java graphics lib. It has a class PImage (Processing image) that stores data like that. Actually, I bet, even Photoshop does that.

8:54 hyPiRion: noncom: Oh right, unchecked-int is fine. What I said isn't that you should use longs at all cost, only that it is a bit confusing to use them at first

8:54 (ints, I mean)

8:55 noncom: yeah, generally, I don't mind longs.. but for bit operations like color component extraction and packing that matters

8:55 terom: noncom: you may want to look into quil if you haven't already

8:56 klang: noncom: fair enof.

9:08 noncom: terom: yeah, thanks, i'm using it! a very nice library, making a lot of things easier, but unfortunately, it does not wrap routines that work with pixels of a particular image. Only working with pixels of the whole window is implemented.. oh well, no big problem using Java methods directly - just a little dot here and there.. except for that thing with colors, but it is not a Quil problem..

9:09 and the sun is shining again!

9:19 svedubois: Can you recommend me any 3d library for clojure to write a simple viewer 3D?

9:36 noncom: ehhh... nope.. although I can now force Clojure to treat 0xFFFFFFFF as an int, still I can't get it to understand that I'm working with an array of ints and want ints there. Although the picture seems to be drawn correctly, the value that I get when querying the array are not what should be threre. I've tried all the combinations of unchecked-int, aset-int and ints to make it work but it doesn't

9:38 oh, nope, SORRY. this time - my fault.

9:38 all is fine

10:50 ravster: morning, all

11:04 DORNER: bc

11:35 Glenjamin: is there a simple way to juggle a function around if it doesn't fit the form required by -> ?

11:37 mmitchell: anyone here using clojure-hadoop?

11:40 dnolen: Glenjamin: not really. People have created arbitrary threading libs (not that I recommend them)

11:41 mpenet: Glenjamin: you can always wrap it in (#(... %)), but it's a bit hairy

11:41 Glenjamin: yeah, it was the first item so i just wrapped the call inline

11:49 TimMc: mpenet: Or in that case, use ->>

11:50 ,(-> 5 (- 1) (->> (str "->")))

11:50 clojurebot: "->4"

11:56 dpathakj: Glenjamin: https://github.com/rplevy/swiss-arrows ?

11:58 Not sure if this fits your definition of 'simple way'… or indeed 'juggle'

12:02 hyPiRion: &(as-> 5 x (- x 1) (str "->" x))

12:02 lazybot: java.lang.RuntimeException: Unable to resolve symbol: as-> in this context

12:11 mpenet: TimMc: Yes my example wasn't really good :)

12:23 Glenjamin: if you're still talking about the arrows, the problem was that 1 out of 4 needed ->> and 3 out of 4 needed ->

12:48 simard: I'm using maven to build my clojure/scala/java mixed source project and I only have two clojure files to compile. These two files on their own take a LONG time (around a minute) to compile, while the rest of the project which consists of dozens of scala/java files take less time to compile (a few dozen seconds at most). What could be so slow here ?

12:48 the clojure files are pretty small btw..

13:01 Glenjamin: is there a way to refer to records other than their fully qualified name? I'm trying to do a type check and can't seem to figure it out

13:09 ah, i have to use import and change dashes to underscores..

13:14 dnolen: simard: sounds unusual maybe ask on the mailing list

13:15 Glenjamin: yeah, probably makes sense to avoid dashes in record/type names

13:16 Glenjamin: the dash is in the namespace :(

13:27 dnolen: Glenjamin: oh right, yeah not much you can do about that.

13:27 Glenjamin: presumably in theory :import in ns could convert dashes to underscores

13:33 is there a core function that turns snake_case into dashed-case ?

13:36 Okasu: ,(clojure.string/replace "sn_n_a_ke" #"_" "-")

13:36 clojurebot: "sn-n-a-ke"

13:37 Okasu: ,(symbol (clojure.string/replace "sn_n_a_ke" #"_" "-"))

13:37 clojurebot: sn-n-a-ke

13:37 Foxboron: Why is replace in clojure.string? why cant we just type (replace "string" #"" " ")?

13:37 Bothered me when using replace lately

13:38 hyPiRion: Because it's a string operation?

13:38 xeqi: heh, it bothers me that core has a bunch of things that could be namespaced

13:38 Foxboron: hyPiRion: but it could be in the default namespace

13:38 xeqi: re-* for example

13:39 AimHere: 'replace' could easily be a good name for a core function on any collection, not just a string

13:39 Foxboron: ^that

13:39 AimHere: Maybe they wanted to leave that one open for future expansion

13:40 hyPiRion: Foxboron: well, there is one already

13:40 ,(replace {:a 1 :b 2} [:a :b :c])

13:40 clojurebot: [1 2 :c]

13:40 AimHere: Oops, seems they pinched it already

13:40 Foxboron: hyPiRion: but why not have it as a string operation :/?

13:41 AimHere: What would you call the one that acts on any collection?

13:41 There already is a namespace for string things.

13:42 I get the feeling that functions that act on all collections are the ones that should be in core

13:42 hyPiRion: ,(remove #{:a :b :c} [:a :d :b :c :e])

13:42 clojurebot: (:d :e)

13:42 hyPiRion: Should that be a string operation too?

13:42 AimHere: ,(clojure.string/remove "yxxxxexxxxxsxxx" #"x")

13:42 clojurebot: #<CompilerException java.lang.RuntimeException: No such var: clojure.string/remove, compiling:(NO_SOURCE_PATH:0:0)>

13:43 hyPiRion: AimHere: It's called replace :p

13:43 ,(concat [:a :b :c] [:d :e :f]) ; also potential string operation

13:43 clojurebot: (:a :b :c :d :e ...)

13:43 Foxboron: AimHere: saying it that way makes sense

13:49 Okasu: ,(defmacro normalize [name [& args] & body] `(defn ~(symbol (clojure.string/replace name #"_" "-")) [~@args] ~@body))

13:49 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

13:50 Okasu: >SANBOX

13:50 xeqi: it's full

13:54 Okasu: Is it typo?

14:02 Glenjamin: heh, thats a good point

14:03 the actual normalise logic is simple enough, i just expected there to be a core function, since core will have to do it a lot to java paths and things

14:05 hyPiRion: ,demunge

14:05 clojurebot: #<repl$demunge clojure.repl$demunge@18b034b>

14:05 hyPiRion: ,(demunge "hello_world_BANG_")

14:05 clojurebot: "hello-world!"

14:06 hyPiRion: also, for measurement

14:06 ,(munge "hello-world!")

14:06 clojurebot: "hello_world_BANG_"

14:21 Glenjamin: ,(munge "hello_world_BANG_")

14:21 clojurebot: "hello_world_BANG_"

14:21 Glenjamin: thats also a valid name, how come they don't clash?

14:41 hyPiRion: Glenjamin: internal magic

14:49 Glenjamin: o.O

14:50 Okasu: ,'([~@`'()])

14:50 clojurebot: ([(clojure.core/unquote-splicing (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/list)))))])

14:50 Glenjamin: can anyone recommend a decent lib for modelling html forms data/validation/output ?

14:50 Okasu: ,'([,~@`'()])

14:50 clojurebot: ([(clojure.core/unquote-splicing (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/list)))))])

14:51 Okasu: ,'([,~@`'()]..............)

14:51 clojurebot: ([(clojure.core/unquote-splicing (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/list)))))] ..............)

14:51 Okasu: Glenjamin: Have seen Javelin?

14:52 Glenjamin: that's not really what i'm after

14:54 Okasu: ,'(.[.,.~.@.`.'.(.).].); heh

14:54 clojurebot: (. [. . (clojure.core/unquote .) (clojure.core/deref .) (quote .'.) ...] .)

15:07 AsgardBSD: Whoa...

15:08 581 user (well, now 580) in that channel, and only 370 in scala channel

15:08 Was sure that Scala was more popular than clojure...

15:21 danielglauser: AsgardBSD: I suspect that IRC is more popular with Clojure folks than Scala folks

15:25 pmonks: Could also be because it's a weekend. Who'd be on a computer on the weekend??

15:25 lazybot: pmonks: What are you, crazy? Of course not!

15:25 borkdude: hmm, is it possible to get the current week number in clj-time?

15:26 pmonks this number is pretty constant during weekdays, sometimes 600+

15:26 mpenet: lots of emacs users, which happens to be an excellent irc client too

15:26 there's that

15:26 danielglauser: pmonks: Are you Peter Monks from California?

15:26 pmonks: Yep - hey Dan! ;-)

15:27 danielglauser: Hi Peter! I didn't think you had joined the dark side yet!

15:27 borkdude: this does it for me: (.toString (org.joda.time.DateTime/now) "ww")

15:27 pmonks: I feel like I'm coming from the dark side. ;-)

15:28 AsgardBSD: Anyway, I start to be also interested by clojure...

15:29 pmonks: It's bloody awesome. <disclaimer>I'm still a clojure n00b</>

15:30 Anyone know how long it takes to stop being a clojure n00b? I'm guessing a loooooong time...

15:31 danielglauser: pmonks: for you? Well, it might take a while...:)

15:32 Okasu: pmonks: Nah, it's easy if you have other lisps background.

15:32 * Okasu came from scheme and common lisp.

15:32 danielglauser: pmonks: I recently scored a job doing Clojure full time, that has helped quite a bit

15:32 Okasu: But if your only background is something like java, yes it may take a while. :)

15:33 danielglauser: Whoa, lucky you.

15:33 danielglauser: Okasu: Thanks!

15:33 Okasu: danielglauser: Can you tell us a story how did you found that job if it's not a secret?

15:34 * Okasu thinks that FP jobs is rare thing nowadays.

15:34 Okasu: are*

15:34 danielglauser: Okasu: Sure, it's no secret. In fact, I'm surprised my coworkers aren't razzing me right now

15:35 * pmonks had no lisp previously - part of the reason he got interested in Clojure...

15:35 danielglauser: I got into Clojure through drinking. After a few beers I signed up to present on it for the local Java user group

15:35 pmonks: Does the job also involve drinking? If so, let me know the next time there's an open position!

15:35 danielglauser: inc

15:36 After doing a couple presentations someone handed me the reigns to the local Clojure group

15:36 akhudek: "I got into Clojure through drinking."

15:36 pmonks: drink -> clojure -> drink ?

15:36 danielglauser: One of the guys in the group scored a job with Sonian

15:37 I advertised the open position with Sonian for about a year and a half. Finally I decided to go for it myself

15:37 And here I am. Full time Clojure. And it's awesome.

15:38 pmonks: exactly. Folks word it like this: (-> drink clojure drink)

15:38 akhudek: Sometimes drinking does lead to good things. Especially around large groups of geeks

15:40 pmonks: (loop [beverage :trumer] (do (scull) (recur :jaegermeister))) ?

15:40 doh - should be (scull beverage)

15:41 * pmonks is a n00b *sigh*...

15:41 danielglauser: pmonks: it just takes time. I now find prefix notation much less ambiguous than infix

15:42 pmonks: Ditto. Don't like chaining though - prefer explicit nesting. I think my brain is too old to parse in two different directions...

15:42 (not that I've done a huge amount of Java interop yet - I could imagine it'd be handy there)

15:43 danielglauser: pmonks: By chaining do you mean the threading macro?

15:43 pmonks: Yah

15:44 danielglauser: That one gave me fits for a while. What got me over the hump was refactoring some heavily nested code to use the threading macro.

15:44 pmonks: I'm still making use of lots of little named fns to help with nesting

15:44 danielglauser: My early stuff was just for me so I didn't care if I wasn't using the latest and greatest technique

15:44 n_b: Threading macro is one of my favourite things; makes lots of code so much easier to understand

15:44 Netfeed: does anyone know if it's possible to run functions inside an update or insert in clojure.java.jdbc? i want to set a field to NOW()

15:45 pmonks: Yeah - I just have trouble switching between left to right and "inside out" mental parsing...

15:45 * pmonks is getting old...

15:45 pmonks: I do like lots of little fns though e.g. https://github.com/pmonks/clojure-adventures/blob/master/letterpress-solver/src/letterpress_solver/solver.clj

15:46 I'm guessing the non-n00bs would probably do a lot of that as one-liners…

15:46 n_b: I handle a lot of data transformation and processing, so it ends up looking something like (->> load-data do-foo modify-bar save-somewhere-esle)

15:48 pmonks: Yeah I could see how that would read naturally - it's a linear series of steps.

15:49 Any thoughts on "the Lisp Curse" (http://www.winestockwebdesign.com/Essays/Lisp_Curse.html), specifically as it relates to Clojure?

15:51 In mucking about in a few random area (webapps, parsers and some thread pool management stuff) I've noticed there's almost never a single library.

15:51 And I don't cope with the Paradox of Choice very well. ;-)

15:52 danielglauser: pmonks: usually you can identify a *popular* library

15:52 That's one thing this channel is good for

15:52 pmonks: I tried that approach with music at one point, and ended up listening to a lot of Spice Girls. ;-(

15:53 mthvedt: i think in the age of open-source everything, *every* language suffers from the alleged lisp curse

15:53 xeqi: pmonks: I use irc as my filter

15:53 n_b: pmonks: In addition to what danielglauser said, I also find the differences are typically well documented.

15:53 mthvedt: multiple, incompletely-documented ways to do things

15:53 danielglauser: mthvedt: Exactly! Patches welcomed.

15:55 pmonks: Yah I get the open source thing (happen to work for an open source company), but it is kind of a pain when I just want to get something done.

15:55 danielglauser: My last gig involved a good bit of Ruby and in all fairness I feel the documentation in the Clojure space is generally better

15:55 pmonks: I end up spending an hour evaluating the alternatives, instead of an hour on just "git r done".

15:56 True, and the ease of evaluation (compared to Java) is waaaaaaaaaaaaay easier. Most stuff is just a project.clj update and a "lein repo" away from experimentation.

15:56 ugh autocorrect - "lein repl"

15:56 mthvedt: pmonks: if you're worried about choosing the right library, a nice thing about clojure is it's very easy to decouple

15:56 danielglauser: pmonks: I usually ask first. If that doesn't get me what I need then I lein repo away. :)

15:56 mthvedt: i naturally find i use a given library in only a few spots anyway

15:56 antares_: yeah, experimenting in Java without the REPL is a bit time consuming

15:57 mthvedt: so you might as well grab the first one and change later

15:57 pmonks: I used to do that in Groovy - nearest thing to a repl Java has. ;-)

15:58 @mthvedt - yeah you're right - "nothing but functions" is very liberating

15:58 Reminds me of my (brief!) Miranda days...

15:58 danielglauser: pmonks: depending on your setup you're typically only a few keystrokes away from a repl

15:59 mthvedt: other languages a lot of times choosing a library becomes the one true way

15:59 like, good luck un-springifying a spring app

15:59 in java

16:01 pbostrom: I'm using a library (core.cache) that has a deftype that I want to use, but I want to redefine one function in that type, I'm not sure what to do to accomplish this though, I think either extend or extend-type, can someone point me in the right direction?

16:01 danielglauser: pmonks: I find I write tests a lot more often in Clojure

16:01 pbostrom: The other wrinkle is that the library provides a factory function to create that type, so I'm not sure if I can just call the function to return the original type, extend it to my new type with my new single function, and it works

16:02 antares_: pbostrom: most likely you'd need a new type and extend-protocol

16:02 pmonks: danielglauser: "lein midje :autotest" is bluddy brilliant

16:03 antares_: pbostrom: a couple of examples, although they don't reuse anything https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/cache.clj, https://github.com/michaelklishin/welle/blob/master/src/clojure/clojurewerkz/welle/cache.clj

16:03 danielglauser: pmonks: I haven't seen that. I like midje but our 20K+ lines of Clojure code at work rely upon clojure.test

16:03 pmonks: If I ever meet Brian Marick in person I'm going to give him a great big :-*

16:03 <did I just say that out loud?>

16:03 pbostrom: antares_: thanks, I'll take a look

16:04 danielglauser: pmonks: That can be arranged. Well, you are from San Francisco..

16:04 pmonks: :-D

16:24 AsgardBSD: I want to know if I shall bother learning Clojure if I already know Haskell and Scala and some imperative language (C, C++, Java, Ruby, Python), Does clojure will give me any benifit? Is Clojure widely used? Can i find a job with clojure? Is there are any big library to clojure??

16:24 lazybot: AsgardBSD: Uh, no. Why would you even ask?

16:24 AsgardBSD: hi lazybot

16:26 hyPiRion: oh, lazybot, you respond so lazily

16:26 AsgardBSD: Do you know any lisp? If not, Clojure is a nice lisp to learn

16:26 ravster: lisp is your friend.

16:27 AsgardBSD: Well, does learning lisp is useful...

16:27 xeqi: AsgardBSD: what kind of benefit are you looking for? It's used by several companies. I know of at least 4 companies looking for clojure people. Library for what domain?

16:28 Bodil: AsgardBSD: It'll probably make you a smarter programmer, especially with the macros. Probably not a more recruitable one. :)

16:29 algernon: AsgardBSD: I found that learning lisp was *very* beneficial, even if I don't write much clojure (nor lisp) in my day job.

16:31 AsgardBSD: there were quite a few huge revelations while learning and playig with Clojure that I could apply to code I wrote in other languages too (note: I also toyed with Haskell before that).

16:35 mpenet: as for big libraries: check Storm or Cascalog, but you don't say much about what you are looking for.

16:41 rhg135: Hello all I just have a quick question, if i use this https://www.refheap.com/paste/13386 it works fine, but if i use just Proxy$Type/SOCKS i get an exception any reason?

16:41 supersym: I don't really know how Haskell compares to clojure, but I bet it doesn't have the same clean seperation of sequences and immutable collections, state, stm etc.

16:48 noidi: rhg135, you have to (:import java.net.Proxy$Type)

16:49 rhg135: oh

16:49 import the inner class too?

16:50 noidi: importing the outer class does not import the inner class

16:51 rhg135: ok

16:51 that makes sense

16:51 noidi: in my opinion it doesn't :)

16:51 but that's the way it is

16:53 no7hing: anybody got a link to more shoreleave projects, besides the SOLR one?

17:14 Willyfrog: yogthos, are you the author of luminus?

17:14 yogthos: Willyfrog: yup

17:15 Willyfrog: great! thanks for the lib :)

17:15 I noticed a minor error on the docs, though

17:15 but not sure if I should modify it

17:15 yogthos: Willyfrog: yeah sure thing, help's always appreciated :)

17:16 Willyfrog: is just the flash-put on the sessions section has a parameter missed

17:16 *missing

17:16 yogthos: Willyfrog: ah

17:16 Willyfrog: I could fix that right now :)

17:16 Willyfrog: :)

17:17 yogthos: Willyfrog: should be fixed :)

17:17 Willyfrog: Since I'm beginning with clojure (and luminus of course) I wasn't sure

17:18 great!

17:18 as I said, nice job

17:18 It is helping me get the hang of clojure with a project :)

17:19 It would be a lot harder otherwise

17:19 yogthos: Willyfrog: that was the reason I started it

17:19 Willyfrog: I got pretty frustrated whenI was figuring that stuff out :)

17:20 Willyfrog: figured I could wrap it all up nicely so others don't have to go through that

17:20 Willyfrog: yup, I was following a couple of tutorials about ring and compojure, but I missed how a few things connected

17:21 yogthos: yeah I find there's a few things which are tricky like middleware, some of it depends on what order you include it in for example

17:21 I've been playing with clojurescript more now, so I'll add some docs on that as well soon

17:22 Willyfrog: I'll better learn well one clojure before jumping to another ^_^

21:01 ttimvisher: should i be able to bind a route-param in compojure to a part that contains a `.` character?

21:03 I've defined a route `/user/:username/resource/page/:number` and when I hit it with `/user/tim.visher/resource/page/0` i get a 404. When I hit it with `/user/timvisher/resource/page/0` I get back the desired results.

21:10 gfredericks: ttimvisher: somebody was asking about that several days ago. I didn't see the resolution. I know regexes were mentioned.

21:10 ttimvisher: gfredericks: now I have 2 problems. ;)

21:11 gfredericks: ~regex

21:11 clojurebot: Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

21:11 gfredericks: ~regex

21:11 clojurebot: Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

21:11 gfredericks: we need more regex quotes

21:14 ttimvisher: for re+lz

21:18 rhg135: i got enlightened, how about just using a caching proxy

21:18 more DRY

21:26 murtaza52: rhg135: care to share it with us?

21:30 rhg135: squid maybe?

21:30 i'm conjecturing

21:41 xeqi: ttimvisher: you can (GET ["/user/:username" :user #"[^/]"] request ....)

21:42 rhg135: I meant for me

21:43 murtaza52: rhg135: I mean how is it more DRY ?

21:44 rhg135: I'm trying to write caching code

22:57 murtaza52: what is clojure.lang.MapEntry - a hash-map {:a 2} or the vector passed in map fn when processing a hash-map [:a 2]

23:05 gfredericks: the latter

23:05 ,(type {:a 2})

23:05 clojurebot: clojure.lang.PersistentArrayMap

23:06 gfredericks: ,(type (first {:a 2}))

23:06 clojurebot: clojure.lang.MapEntry

23:06 gfredericks: ,(key (first {:a 2}))

23:06 clojurebot: :a

23:07 murtaza52: thanks

23:10 I have a map and a custom comparator fn - (sorted-map-by sort-fn {:a 2 :b 3 :c 5}) - how do I pass an existing map into it

23:11 I mean how do I call sorted-map-by on an existing hash-map

23:17 gfredericks: ,(into (sorted-map-by compare) {:a 2 :b 3 :c 5})

23:17 clojurebot: {:a 2, :b 3, :c 5}

23:39 murtaza52: thanks

23:53 iceyes: I'm reading clojure programming and I couldn't find reduce-by on the docs.

23:55 Was it renamed or removed from the API?

23:58 ivan: iceyes: it's defined on pg 119-120

23:59 iceyes: ivan: oh damn need to get some sleep. thanks

23:59 ivan: np

Logging service provided by n01se.net