#clojure logs

2013-04-07

00:57nightfly__Is there a simple way to replace the nth item in a lazy sequence?
01:01nightfly__nevermind, was a silly idea
04:50dribneta little tripped up on my first serious macro...
04:52dribnettrying to recursively call the macro on a collection, but don't have the right mental model i guess.
04:52dribnet(defmacro ct-clj [x] (cond (coll? x) (concat (list 'cljs.core/array) (map #(ct-clj %) x))))
04:53dribneti get "clojure.lang.ArityException: Wrong number of args (1) passed to: tags$ct-clj"
04:58dribnetok, constructed simpler case
04:58dribnet(defmacro inwards [x] (if (coll? x) (map #(inwards %) x) "x"))
05:00dribnetanyone bored enough to hand-hold me to enlightenment and tell me why this fails for (inward [5])
05:24mjcwhat "should" inward [5] return ?
05:27dribnet["x"]
05:37dribnet(but it was all screwed up)
05:38dribnetthis is closer, but doesn't recurse
05:38dribnet(defmacro inwards [x]
05:38dribnet (if (coll? x)
05:38dribnet (vec (map #(inwards %) x))
05:38dribnet "x"))
05:39dribnetuser=> (inwards [1 2 [3 4 5]]) ; => ["x" "x" "x"]
05:42hyPiRiondribnet: what should a macro return?
05:44hyPiRionA macro should return a form, not a result
05:45hyPiRion&(clojure.walk/macroexpand-all '(cond foo bar baz quux :else something))
05:45lazybot⇒ (if foo bar (if baz quux (if :else something nil)))
05:45hyPiRion^that's what you should produce, not the result
05:49dribnetthanks hyp... i think.
05:49dribnetin my case as an exercise, i was trying to translate [1 2 [3 4 5]] into ["x" "x" ["x" "x" "x"]]
05:50dribnet(at compile time)
05:50dribnetbut i will think on what you said.
06:00dribnethyPiRion: what is wrong with a macro returning a result
06:01dribnetie: if one wanted to convert [1 2 3] to {"x" "x" "x"] *at compile time*, what is the alternative?
06:15Pupnikhttp://vimeo.com/9270320 fascinating
06:26mjc(defmacro inwards [& args] `(clojure.walk/prewalk #(if (coll? %) (identity %) "x") ~@args))
06:51Glenjaminis hiccup suitable for generating xml, or is there a hiccup-like library for it?
07:22sveduboisI am using a java method, which is public void setEnvmapped(boolean mode)
07:22sveduboisWhen I write (.setEnvmapped true)
07:22sveduboisI get this error: clojure.lang.Compiler$CompilerException: java.lang.NullPointerException
07:22sveduboisWhat I am doing wrong?
07:30borkdudesvedubois (.setEnvmapped object true) or (SomeClass/setEnvmapped true) depending on static or member method
07:31borkdudesvedubois your code now is equivalent to true.setEnvmapped()
07:34sveduboisWhen I write this: (.setEnvmapped box true)
07:34sveduboisI obtain again an error: java.lang.NullPointerException: null
07:36Glenjaminis 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
07:40borkdudesvedubois this probably means box is null
07:45sveduboisborkdude: Yes, box was not well defined, now it works
08:06sveduboisHow I can merge these 2 lines into only 1 line?
08:06svedubois(doto world
08:06svedubois (.. getCamera (setPosition 0 0 0))
08:06svedubois (.. getCamera (lookAt (.getTransformedCenter box))))
08:06sveduboisSomething like this, but correctly:
08:06svedubois(doto world
08:06svedubois (.. getCamera (setPosition 0 0 0)
08:06svedubois (lookAt (.getTransformedCenter box))))
08:07Foxboronsvedubois: maybe make a macro?
08:45noncomhi! 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?
08:46klangIs anybody running emacs and clojure on two different hosts, connecting to clojure via nrepl?
08:47klang`(int 0xFFFFFFFF)
08:47hyPiRionnoncom: yeah, Clojure is a but different there, but klang has the right idea
08:47klang.. that's not an int.
08:48hyPiRion,(unchecked-int 0xFFFFFF)
08:48clojurebot16777215
08:48hyPiRionwhoops
08:48hyPiRion,(unchecked-int 0xFFFFFFFF)
08:48clojurebot-1
08:48hyPiRion,(int 0xFFFFFFFF) ; errors
08:48clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 4294967295>
08:48noncomwell, it is 4 bytes which is used to store colors as ints for ages
08:48klanghyPiRion: thank's that was what I tried to do :-D
08:48noncomthayeah i got same errors
08:49noncomi will try the proposed idea now
08:49hyPiRionnoncom: 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
08:49hyPiRionIt's not exactly where Clojure shines, heh.
08:50noncomyeah 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.. :)
08:53noncomwell, 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 :)
08:53noncomthanks for the help!
08:53klangnocom: to be fair, you have already started to convert your data before involving clojure, right?
08:54noncomklang: 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.
08:54hyPiRionnoncom: 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
08:54hyPiRion(ints, I mean)
08:55noncomyeah, generally, I don't mind longs.. but for bit operations like color component extraction and packing that matters
08:55teromnoncom: you may want to look into quil if you haven't already
08:56klangnoncom: fair enof.
09:08noncomterom: 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..
09:09noncomand the sun is shining again!
09:19sveduboisCan you recommend me any 3d library for clojure to write a simple viewer 3D?
09:36noncomehhh... 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
09:38noncomoh, nope, SORRY. this time - my fault.
09:38noncomall is fine
10:50ravstermorning, all
11:04DORNERbc
11:35Glenjaminis there a simple way to juggle a function around if it doesn't fit the form required by -> ?
11:37mmitchellanyone here using clojure-hadoop?
11:40dnolenGlenjamin: not really. People have created arbitrary threading libs (not that I recommend them)
11:41mpenetGlenjamin: you can always wrap it in (#(... %)), but it's a bit hairy
11:41Glenjaminyeah, it was the first item so i just wrapped the call inline
11:49TimMcmpenet: Or in that case, use ->>
11:50TimMc,(-> 5 (- 1) (->> (str "->")))
11:50clojurebot"->4"
11:56dpathakjGlenjamin: https://github.com/rplevy/swiss-arrows ?
11:58dpathakjNot sure if this fits your definition of 'simple way'… or indeed 'juggle'
12:02hyPiRion&(as-> 5 x (- x 1) (str "->" x))
12:02lazybotjava.lang.RuntimeException: Unable to resolve symbol: as-> in this context
12:11mpenetTimMc: Yes my example wasn't really good :)
12:23Glenjaminif you're still talking about the arrows, the problem was that 1 out of 4 needed ->> and 3 out of 4 needed ->
12:48simardI'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:48simardthe clojure files are pretty small btw..
13:01Glenjaminis 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:09Glenjaminah, i have to use import and change dashes to underscores..
13:14dnolensimard: sounds unusual maybe ask on the mailing list
13:15dnolenGlenjamin: yeah, probably makes sense to avoid dashes in record/type names
13:16Glenjaminthe dash is in the namespace :(
13:27dnolenGlenjamin: oh right, yeah not much you can do about that.
13:27Glenjaminpresumably in theory :import in ns could convert dashes to underscores
13:33Glenjaminis there a core function that turns snake_case into dashed-case ?
13:36Okasu,(clojure.string/replace "sn_n_a_ke" #"_" "-")
13:36clojurebot"sn-n-a-ke"
13:37Okasu,(symbol (clojure.string/replace "sn_n_a_ke" #"_" "-"))
13:37clojurebotsn-n-a-ke
13:37FoxboronWhy is replace in clojure.string? why cant we just type (replace "string" #"" " ")?
13:37FoxboronBothered me when using replace lately
13:38hyPiRionBecause it's a string operation?
13:38xeqiheh, it bothers me that core has a bunch of things that could be namespaced
13:38FoxboronhyPiRion: but it could be in the default namespace
13:38xeqire-* for example
13:39AimHere'replace' could easily be a good name for a core function on any collection, not just a string
13:39Foxboron^that
13:39AimHereMaybe they wanted to leave that one open for future expansion
13:40hyPiRionFoxboron: well, there is one already
13:40hyPiRion,(replace {:a 1 :b 2} [:a :b :c])
13:40clojurebot[1 2 :c]
13:40AimHereOops, seems they pinched it already
13:40FoxboronhyPiRion: but why not have it as a string operation :/?
13:41AimHereWhat would you call the one that acts on any collection?
13:41AimHereThere already is a namespace for string things.
13:42AimHereI get the feeling that functions that act on all collections are the ones that should be in core
13:42hyPiRion,(remove #{:a :b :c} [:a :d :b :c :e])
13:42clojurebot(:d :e)
13:42hyPiRionShould that be a string operation too?
13:42AimHere,(clojure.string/remove "yxxxxexxxxxsxxx" #"x")
13:42clojurebot#<CompilerException java.lang.RuntimeException: No such var: clojure.string/remove, compiling:(NO_SOURCE_PATH:0:0)>
13:43hyPiRionAimHere: It's called replace :p
13:43hyPiRion,(concat [:a :b :c] [:d :e :f]) ; also potential string operation
13:43clojurebot(:a :b :c :d :e ...)
13:43FoxboronAimHere: saying it that way makes sense
13:49Okasu,(defmacro normalize [name [& args] & body] `(defn ~(symbol (clojure.string/replace name #"_" "-")) [~@args] ~@body))
13:49clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
13:50Okasu>SANBOX
13:50xeqiit's full
13:54OkasuIs it typo?
14:02Glenjaminheh, thats a good point
14:03Glenjaminthe 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:05hyPiRion,demunge
14:05clojurebot#<repl$demunge clojure.repl$demunge@18b034b>
14:05hyPiRion,(demunge "hello_world_BANG_")
14:05clojurebot"hello-world!"
14:06hyPiRionalso, for measurement
14:06hyPiRion,(munge "hello-world!")
14:06clojurebot"hello_world_BANG_"
14:21Glenjamin,(munge "hello_world_BANG_")
14:21clojurebot"hello_world_BANG_"
14:21Glenjaminthats also a valid name, how come they don't clash?
14:41hyPiRionGlenjamin: internal magic
14:49Glenjamino.O
14:50Okasu,'([~@`'()])
14:50clojurebot([(clojure.core/unquote-splicing (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/list)))))])
14:50Glenjamincan anyone recommend a decent lib for modelling html forms data/validation/output ?
14:50Okasu,'([,~@`'()])
14:50clojurebot([(clojure.core/unquote-splicing (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/list)))))])
14:51Okasu,'([,~@`'()]..............)
14:51clojurebot([(clojure.core/unquote-splicing (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/list)))))] ..............)
14:51OkasuGlenjamin: Have seen Javelin?
14:52Glenjaminthat's not really what i'm after
14:54Okasu,'(.[.,.~.@.`.'.(.).].); heh
14:54clojurebot(. [. . (clojure.core/unquote .) (clojure.core/deref .) (quote .'.) ...] .)
15:07AsgardBSDWhoa...
15:08AsgardBSD581 user (well, now 580) in that channel, and only 370 in scala channel
15:08AsgardBSDWas sure that Scala was more popular than clojure...
15:21danielglauserAsgardBSD: I suspect that IRC is more popular with Clojure folks than Scala folks
15:25pmonksCould also be because it's a weekend. Who'd be on a computer on the weekend??
15:25lazybotpmonks: What are you, crazy? Of course not!
15:25borkdudehmm, is it possible to get the current week number in clj-time?
15:26borkdudepmonks this number is pretty constant during weekdays, sometimes 600+
15:26mpenetlots of emacs users, which happens to be an excellent irc client too
15:26mpenetthere's that
15:26danielglauserpmonks: Are you Peter Monks from California?
15:26pmonksYep - hey Dan! ;-)
15:27danielglauserHi Peter! I didn't think you had joined the dark side yet!
15:27borkdudethis does it for me: (.toString (org.joda.time.DateTime/now) "ww")
15:27pmonksI feel like I'm coming from the dark side. ;-)
15:28AsgardBSDAnyway, I start to be also interested by clojure...
15:29pmonksIt's bloody awesome. <disclaimer>I'm still a clojure n00b</>
15:30pmonksAnyone know how long it takes to stop being a clojure n00b? I'm guessing a loooooong time...
15:31danielglauserpmonks: for you? Well, it might take a while...:)
15:32Okasupmonks: Nah, it's easy if you have other lisps background.
15:32danielglauserpmonks: I recently scored a job doing Clojure full time, that has helped quite a bit
15:32OkasuBut if your only background is something like java, yes it may take a while. :)
15:33Okasudanielglauser: Whoa, lucky you.
15:33danielglauserOkasu: Thanks!
15:33Okasudanielglauser: Can you tell us a story how did you found that job if it's not a secret?
15:34Okasuare*
15:34danielglauserOkasu: Sure, it's no secret. In fact, I'm surprised my coworkers aren't razzing me right now
15:35danielglauserI got into Clojure through drinking. After a few beers I signed up to present on it for the local Java user group
15:35pmonksDoes the job also involve drinking? If so, let me know the next time there's an open position!
15:35danielglauserinc
15:36danielglauserAfter doing a couple presentations someone handed me the reigns to the local Clojure group
15:36akhudek"I got into Clojure through drinking."
15:36pmonksdrink -> clojure -> drink ?
15:36danielglauserOne of the guys in the group scored a job with Sonian
15:37danielglauserI advertised the open position with Sonian for about a year and a half. Finally I decided to go for it myself
15:37danielglauserAnd here I am. Full time Clojure. And it's awesome.
15:38danielglauserpmonks: exactly. Folks word it like this: (-> drink clojure drink)
15:38danielglauserakhudek: Sometimes drinking does lead to good things. Especially around large groups of geeks
15:40pmonks(loop [beverage :trumer] (do (scull) (recur :jaegermeister))) ?
15:40pmonksdoh - should be (scull beverage)
15:41danielglauserpmonks: it just takes time. I now find prefix notation much less ambiguous than infix
15:42pmonksDitto. Don't like chaining though - prefer explicit nesting. I think my brain is too old to parse in two different directions...
15:42pmonks(not that I've done a huge amount of Java interop yet - I could imagine it'd be handy there)
15:43danielglauserpmonks: By chaining do you mean the threading macro?
15:43pmonksYah
15:44danielglauserThat 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:44pmonksI'm still making use of lots of little named fns to help with nesting
15:44danielglauserMy early stuff was just for me so I didn't care if I wasn't using the latest and greatest technique
15:44n_bThreading macro is one of my favourite things; makes lots of code so much easier to understand
15:44Netfeeddoes 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:45pmonksYeah - I just have trouble switching between left to right and "inside out" mental parsing...
15:45pmonksI 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:46pmonksI'm guessing the non-n00bs would probably do a lot of that as one-liners…
15:46n_bI 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:48pmonksYeah I could see how that would read naturally - it's a linear series of steps.
15:49pmonksAny thoughts on "the Lisp Curse" (http://www.winestockwebdesign.com/Essays/Lisp_Curse.html), specifically as it relates to Clojure?
15:51pmonksIn 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:51pmonksAnd I don't cope with the Paradox of Choice very well. ;-)
15:52danielglauserpmonks: usually you can identify a *popular* library
15:52danielglauserThat's one thing this channel is good for
15:52pmonksI tried that approach with music at one point, and ended up listening to a lot of Spice Girls. ;-(
15:53mthvedti think in the age of open-source everything, *every* language suffers from the alleged lisp curse
15:53xeqipmonks: I use irc as my filter
15:53n_bpmonks: In addition to what danielglauser said, I also find the differences are typically well documented.
15:53mthvedtmultiple, incompletely-documented ways to do things
15:53danielglausermthvedt: Exactly! Patches welcomed.
15:55pmonksYah 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:55danielglauserMy last gig involved a good bit of Ruby and in all fairness I feel the documentation in the Clojure space is generally better
15:55pmonksI end up spending an hour evaluating the alternatives, instead of an hour on just "git r done".
15:56pmonksTrue, 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:56pmonksugh autocorrect - "lein repl"
15:56mthvedtpmonks: if you're worried about choosing the right library, a nice thing about clojure is it's very easy to decouple
15:56danielglauserpmonks: I usually ask first. If that doesn't get me what I need then I lein repo away. :)
15:56mthvedti naturally find i use a given library in only a few spots anyway
15:56antares_yeah, experimenting in Java without the REPL is a bit time consuming
15:57mthvedtso you might as well grab the first one and change later
15:57pmonksI used to do that in Groovy - nearest thing to a repl Java has. ;-)
15:58pmonks@mthvedt - yeah you're right - "nothing but functions" is very liberating
15:58pmonksReminds me of my (brief!) Miranda days...
15:58danielglauserpmonks: depending on your setup you're typically only a few keystrokes away from a repl
15:59mthvedtother languages a lot of times choosing a library becomes the one true way
15:59mthvedtlike, good luck un-springifying a spring app
15:59mthvedtin java
16:01pbostromI'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:01danielglauserpmonks: I find I write tests a lot more often in Clojure
16:01pbostromThe 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:02antares_pbostrom: most likely you'd need a new type and extend-protocol
16:02pmonksdanielglauser: "lein midje :autotest" is bluddy brilliant
16:03antares_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:03danielglauserpmonks: I haven't seen that. I like midje but our 20K+ lines of Clojure code at work rely upon clojure.test
16:03pmonksIf I ever meet Brian Marick in person I'm going to give him a great big :-*
16:03pmonks<did I just say that out loud?>
16:03pbostromantares_: thanks, I'll take a look
16:04danielglauserpmonks: That can be arranged. Well, you are from San Francisco..
16:04pmonks:-D
16:24AsgardBSDI 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:24lazybotAsgardBSD: Uh, no. Why would you even ask?
16:24AsgardBSDhi lazybot
16:26hyPiRionoh, lazybot, you respond so lazily
16:26hyPiRionAsgardBSD: Do you know any lisp? If not, Clojure is a nice lisp to learn
16:26ravsterlisp is your friend.
16:27AsgardBSDWell, does learning lisp is useful...
16:27xeqiAsgardBSD: 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:28BodilAsgardBSD: It'll probably make you a smarter programmer, especially with the macros. Probably not a more recruitable one. :)
16:29algernonAsgardBSD: I found that learning lisp was *very* beneficial, even if I don't write much clojure (nor lisp) in my day job.
16:31algernonAsgardBSD: 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:35mpenetas for big libraries: check Storm or Cascalog, but you don't say much about what you are looking for.
16:41rhg135Hello 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:41supersymI 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:48noidirhg135, you have to (:import java.net.Proxy$Type)
16:49rhg135oh
16:49rhg135import the inner class too?
16:50noidiimporting the outer class does not import the inner class
16:51rhg135ok
16:51rhg135that makes sense
16:51noidiin my opinion it doesn't :)
16:51noidibut that's the way it is
16:53no7hinganybody got a link to more shoreleave projects, besides the SOLR one?
17:14Willyfrogyogthos, are you the author of luminus?
17:14yogthosWillyfrog: yup
17:15Willyfroggreat! thanks for the lib :)
17:15WillyfrogI noticed a minor error on the docs, though
17:15Willyfrogbut not sure if I should modify it
17:15yogthosWillyfrog: yeah sure thing, help's always appreciated :)
17:16Willyfrogis just the flash-put on the sessions section has a parameter missed
17:16Willyfrog*missing
17:16yogthosWillyfrog: ah
17:16yogthosWillyfrog: I could fix that right now :)
17:16Willyfrog:)
17:17yogthosWillyfrog: should be fixed :)
17:17WillyfrogSince I'm beginning with clojure (and luminus of course) I wasn't sure
17:18Willyfroggreat!
17:18Willyfrogas I said, nice job
17:18WillyfrogIt is helping me get the hang of clojure with a project :)
17:19WillyfrogIt would be a lot harder otherwise
17:19yogthosWillyfrog: that was the reason I started it
17:19yogthosWillyfrog: I got pretty frustrated whenI was figuring that stuff out :)
17:20yogthosWillyfrog: figured I could wrap it all up nicely so others don't have to go through that
17:20Willyfrogyup, I was following a couple of tutorials about ring and compojure, but I missed how a few things connected
17:21yogthosyeah 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:21yogthosI've been playing with clojurescript more now, so I'll add some docs on that as well soon
17:22WillyfrogI'll better learn well one clojure before jumping to another ^_^
21:01ttimvishershould i be able to bind a route-param in compojure to a part that contains a `.` character?
21:03ttimvisherI'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:10gfredericksttimvisher: somebody was asking about that several days ago. I didn't see the resolution. I know regexes were mentioned.
21:10ttimvishergfredericks: now I have 2 problems. ;)
21:11gfredericks~regex
21:11clojurebotSometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.
21:11gfredericks~regex
21:11clojurebotSometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.
21:11gfrederickswe need more regex quotes
21:14ttimvisherfor re+lz
21:18rhg135i got enlightened, how about just using a caching proxy
21:18rhg135more DRY
21:26murtaza52rhg135: care to share it with us?
21:30rhg135squid maybe?
21:30rhg135i'm conjecturing
21:41xeqittimvisher: you can (GET ["/user/:username" :user #"[^/]"] request ....)
21:42rhg135I meant for me
21:43murtaza52rhg135: I mean how is it more DRY ?
21:44rhg135I'm trying to write caching code
22:57murtaza52what is clojure.lang.MapEntry - a hash-map {:a 2} or the vector passed in map fn when processing a hash-map [:a 2]
23:05gfredericksthe latter
23:05gfredericks,(type {:a 2})
23:05clojurebotclojure.lang.PersistentArrayMap
23:06gfredericks,(type (first {:a 2}))
23:06clojurebotclojure.lang.MapEntry
23:06gfredericks,(key (first {:a 2}))
23:06clojurebot:a
23:07murtaza52thanks
23:10murtaza52I 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:11murtaza52I mean how do I call sorted-map-by on an existing hash-map
23:17gfredericks,(into (sorted-map-by compare) {:a 2 :b 3 :c 5})
23:17clojurebot{:a 2, :b 3, :c 5}
23:39murtaza52thanks
23:53iceyesI'm reading clojure programming and I couldn't find reduce-by on the docs.
23:55iceyesWas it renamed or removed from the API?
23:58ivaniceyes: it's defined on pg 119-120
23:59iceyesivan: oh damn need to get some sleep. thanks
23:59ivannp