#clojure logs

2012-03-31

00:00ibdknoxit's neat and a wonderful source of documentation :)
00:01autodidaktoibdknox: documentation?
00:01ibdknoxit has an epic wiki
00:01ibdknoxbrenton did great work on that
00:01autodidaktoah
00:04johnkpaul-afkoakwise: great, thank you!
00:04johnkpaul-afkvery happy to not only know that it wasn't just me going crazy, but also that someone could fix it so soon
00:06autodidaktoibdknox: reading the google group thread on the pinot separation. I agree with the need of an awesome united wiki/documentation for Noir/Pinot :)
00:06ibdknoxnone of the new libs have had an official release yet :)
00:08autodidaktoibdknox: you're overworked, delegate
00:09ibdknoxthat's likely what will need to happen at some point soon
00:09ibdknoxI seem to only be getting busier
00:46gtrak``is there a complement to group-by that inverts the relationship, vals are what's returned from the function?
00:46qbginverts how?
00:47gtrak``with group-by, original seq is the vals, i want the original seq to be the keys
00:47qbgReturns a map of val -> group?
00:49gtrak``I suppose I could just reduce assoc, but that's lame
00:49qbgSo you want a result like {:a [:a], :b [:b :b :b]} for example?
00:49ibdknoxgtrak``: I don't understand what you're asking for
00:50gtrak``just... inputs [:a :b :c :d], result is {:a (f :a) :b (f :b) ...}
00:50qbgCheck out zipmap
00:51qbg&(let [x [1 2 3 4]] (zipmap x (map inc x)))
00:51lazybot⇒ {4 5, 3 4, 2 3, 1 2}
00:51gtrak``ah, perfect
00:51gtrak``i remember people hating on zipmap, just found this to look at though: http://stackoverflow.com/questions/6135764/when-to-use-zipmap-and-when-map-vector
02:06muhooso if i were to try to use a persistent store for sessions in noir, it looks like session.clj just stores sessions in a map in an atom
02:06muhooso, what kind of database would i use that has functions like assoc, get, swap!, and reset!
02:07muhooor rather, that'd work with those core clojure functions.
02:12muhoohmm, there's this i see now: https://gist.github.com/1565647
02:17ibdknoxmuhoo: just use a different session store
02:17ibdknoxlike the mongo one: https://github.com/amalloy/mongo-session/blob/develop/src/mongo_session/core.clj
02:18muhoook, thanks
02:28muhoohee hee hee. try this if you dare: https://refheap.com/paste/1603
02:28muhoowarning: don't try it on a repl that has history or data you care about
02:30muhoo&(use '[ring.middleware.session.store :only [SessionStore]])
02:30lazybotjava.io.FileNotFoundException: Could not locate ring/middleware/session/store__init.class or ring/middleware/session/store.clj on classpath:
02:30muhoogood
02:32muhooprint_r() in php has it, ffs, so i'm sure it can be done in clojure too
02:42muhooaha! (set! *print-level* 15)
02:48emezeskeIf anyone ran into issues with lein-cljsbuild 0.1.4 with hooks enabled: I just released 0.1.5, which should fix that.
05:11adriannhalo
07:33tomojjs2-mode highlights lines with a warning "Code has no side effects" :)
08:35frankvilhelmsen/who *sam*
08:36AimHere/whois frankvilhelmsen
08:38solussd_I was thinking, it would be nice to have pre/post condition support in protocol declarations. Right now the best I can do is describe in the docstrings for the protocol functions what the implementor is suppose to do, but the protocol cannot enforce any details of the interface- notably its input and output. :/
08:47gfrederickssolussd_: I can imagine a macro that does that
08:48gfredericksno I can't
08:48solussd_gfredericks: I can't think of a way to do it using a macro around defprotocol
08:48solussd_b/c I want to be able to (defrecord …. Protocol .. implementations)
08:48gfredericksyeah that's why I retracted
08:49solussd_;)
08:49gfredericksso if we redef one of the protocol functions after defining the protocol, does that either crash or somehow screw things up?
08:53solussd_hmm
08:54gfredericksalso I think fogus's relevant library does stuff with adding constraints afterwards
08:54gfredericksthough that's not any more obviously bound to succeed
10:21gortsleighIn Korma, is it possible to specify entity relationship for something like table 'song' with column 'artistid' that joins to table 'artist' on (song.artistid = artist.id) ??
10:21lazybotgortsleigh: Uh, no. Why would you even ask?
10:43borkgiven a list of maps, how can I find the map with the maximum :x value?
10:44gfrederickshm
10:45gfredericks&(first (sort-by (comp - :x) [{:x 12} {:x 18} {:x -8}]))
10:45lazybot⇒ {:x 18}
10:46AimHereSomething like &(reduce #(if (> (%1 :x) (%2 :x)) %1 %2) {:x 1} {:x 14} {:x 17})
10:46gfredericksthat's not the most efficient way, but the linear-time solution might require some custom loop code or something
10:46gfredericksor reduce :)
10:47gfredericksI knew there'd be something
10:47AimHere&(reduce #(if (> (%1 :x) (%2 :x)) %1 %2) [{:x 1} {:x 414} {:x 17}])
10:47lazybot⇒ {:x 414}
10:47AimHereThe more I play with clojure, the more I like reduce
10:47borkthanks!
10:47borkright after i asked the question, i remembered about reduce
10:47borkyay reduce!
10:48bork... for some reason it didn't occur to me to think about the 2-parameter case first
10:48borkis there an easy to find the first local maximum in a list?
10:49gfredericksreduce! or loop if you want to short circuit
10:49gfredericksno wait there's a lazy way too i think
10:50borkmaybe i could do something like
10:50gfredericks"local maximum" just means element greater than both neighbors right?
10:50gfredericks&(partition 3 1 (range 5))
10:50borkyeah
10:50lazybot⇒ ((0 1 2) (1 2 3) (2 3 4))
10:50gfredericksso doing that ^ would be a good pr-step
10:50gfrederickspre-step
10:50borkoh, and then i could use 'some'
10:50gfredericksyeah something like that
10:51gfredericks(def first-local-max (comp (partial some #(...)) (partial partition 3 1))) :D
10:52gfredericksbork: you don't need it here I was just indulging in some point-free play
10:52gfredericksbut it's good to know about
10:57the-kennyHey, I just wrote a small elisp function to run lein-cljsbuild in a dedicated Emacs buffer. As a bonus you get "Build {succeeded,failed}" messages in the minibuffer: https://gist.github.com/2265584
10:57the-kennyMight be useful for some people
11:06borkgfredericks: also came up with (defn localmax [x & xs] (if (and xs (< x (first xs))) (apply localmax xs) x)
11:26gfredericksbork: I think that particular impl would eat a lot of stack
11:26Phallah-&(let [some-datum (list (symbol "I worship His Shadow"))] (= some-datum (read-str (print-string some-datum))))
11:26lazybotjava.lang.RuntimeException: Unable to resolve symbol: read-str in this context
11:26Phallah-&(let [some-datum (list (symbol "I worship His Shadow"))] (= some-datum (read-string (print-str some-datum))))
11:26lazybot⇒ false
11:26Phallah-Burp
11:26Phallah-So ehhh
11:27Phallah-does Clojure have support for multiple value return?
11:31progousing the usual datastructures is idiomatic
11:34ZokaPhallah-: yes, just return them in a vector
11:35BronsaPhallah-: spaces in symbol are not supported
11:35Phallah-Okay, I take that as a no then.
11:35Phallah-But thanks for assuming I'm stupid.
11:35Phallah-Bronsa, I know
11:35borkgfredericks: oh, okay! i don't have a good understanding of how the builtin functions work
11:35Phallah-that is what makes it burpidurp
11:35Bronsaoh.
11:35Phallah-Because (symbol "Some spaces and tralalala"
11:35bork(yet)
11:36Phallah-Doesn't signal an error
11:36Phallah-&(symbol? (symbol "Burp herp derp"))
11:36lazybot⇒ true
11:36Phallah-I beg to differ!
11:36Bronsaoh, that bugs me too
11:36Phallah-Quite
11:36Phallah-I love a man who gets bugged by this kind of stuff
11:37Phallah-&(print (list (symbol "This doesn't quite do what one expects"))
11:37lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
11:37Phallah-&(print (list (symbol "This doesn't quite do what one expects")))
11:37lazybot⇒ (This doesn't quite do what one expects)nil
12:20muhoofliebel__: i haven't written stuff to use it, but i use ols, which seems a lot more reliable since they switched from rxtx to purejavacomm, fwiw
12:21fliebel__muhoo: https://github.com/nyholku/purejavacomm/pull/5 :/
12:21fliebel__(= fliebel pepijndevos)
12:22muhoonice
12:23fliebel__Anyway, after writing half of clojure.core in Python, writing my DPScope interface was fairly easy.
12:25muhoo!
12:25muhoowhat, greenspun's law?
12:25fliebel__$google greenspun's law
12:25lazybot[Greenspun's tenth rule - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Greenspun's_tenth_rule
12:26muhooalso, i looked at that patch, didn't see any change to that case statement excelt indentation, afaict
12:27fliebel__muhoo: The change is that I don't use the case statement, on Mac, we twiddle some ioctl parameters instead.
12:48muhoohuh. maybe a bsd termios vs linux termios difference.
12:49muhoostill, imagine trying to fix that in rxtx?
12:51muhoofliebel__: did you build your own dpscope or buy one?
13:26fliebel__muhoo: buy one
13:31Phallah-&(apply vector [[1 2 3] [4 5 6] [7 8 9]])
13:31lazybot⇒ [[1 2 3] [4 5 6] [7 8 9]]
13:32Phallah-&(map vector [[1 2 3] [4 5 6] [7 8 9]])
13:32lazybot⇒ ([[1 2 3]] [[4 5 6]] [[7 8 9]])
13:32Phallah-&(apply map vector [[1 2 3] [4 5 6] [7 8 9]])
13:32lazybot⇒ ([1 4 7] [2 5 8] [3 6 9])
13:34Iceland_jackCheck out http://en.wikipedia.org/wiki/Convolution_%28computer_science%29#In_programming_languages
13:39mbriggshey guys, using noir (wrapper on top of compojure), do you know if there is any way to set both the response status code and the content type?
13:39mbriggsthe noir.response ns seems to just do one thing for each method
13:41mbriggsnvm, was reading response.clj, and set-headers is low level enough to do multiple things
13:45xeqimbriggs: I think you can use ->> to thread them
13:47RickInGAI am working through ch 2 in the reasoned schemer, and I wasn't sure why this code gave me an error: https://refheap.com/paste/1614
13:50oakwisednolen: how are you testing the browser repl against cljs HEAD? It seems broken in either `cljsbuild repl-listen` or started manually in 1006 and 1010, but works in 993 for me.
13:52cjfriszRickInGA: what error are you getting?
13:53RickInGAIt says it can't create ISeq from a logic var
13:54RickInGAif I write it as (cons x (cons y ()) I get (grape (a)) because y resolves to the list '(a)
13:54cjfriszRight
13:55RickInGA&(cons 'a '(b))
13:55lazybot⇒ (a b)
13:55cjfriszI've used a fair amount of miniKanren in Scheme but never core.logic and this sounds like a Clojure-specific problem
13:55cjfriszSo it might be a question specifically for dnolen unless I'm overlooking something
13:55xeqiRickInGA: have they introduced conso in chp 2?
13:56RickInGAxeqi yes
13:56cjfriszHe should be able to use cons there
13:56cjfriszAnd "Reasoned" uses cons there specifically
13:56xeqiah
13:57cjfriszThe point is supposed to be that a grounded logic variable is just a normal value.
13:59RickInGAxeqi: does work there.
13:59RickInGAer, conso does work there
14:00cjfriszYou shouldn't have to use conso
14:01jonasenRickInGA: in clojure, cons takes a seq as its second argument. In scheme both the car and the cdr can be any object
14:01cjfriszYes...but why wouldn't y be a sequence in this case?
14:01RickInGAjonasen: so it is not recognizing the lvar as a seq, even though it has been set to (a)
14:02jonasenRickInGA: yes (i think so)
14:02jonasenYou could simply do (== [x y] r)
14:03RickInGAah, I needed lcons
14:05cjfriszI see
14:05RickInGAI don't understand why y wasn't a sequence, but like jonasen said, it didn't have to be a sequence in scheme… lcons allows you to cons even if the second item isn't a seq
14:05RickInGAhttps://github.com/clojure/core.logic/wiki/Differences-from-The-Reasoned-Schemer
14:05mk,(doc lcons)
14:05clojurebotNo entiendo
14:06RickInGAthanks all for the help!
14:06mk,(cons 1 [2 3])
14:06clojurebot(1 2 3)
14:07mk[2 3] isn't a seq either, but perhaps I've missed something important mentioned above
14:07RickInGAmk: I may have used 'seq' improperly… vectors do implement ISeq, which is the relevant fact
14:08xeqi&(seq? [2 3])
14:08lazybot⇒ false
14:08RickInGA&(sequable? [2 3])
14:08lazybotjava.lang.RuntimeException: Unable to resolve symbol: sequable? in this context
14:08RickInGA&(sequential? [2 3])
14:08lazybot⇒ true
14:29weavejesterGah, someone "lein push"ed my project before I did :(
14:37simardhello, I have a clojure sandbox in which I have a few functions defined. The init is done from the main thread and I then start a swank server wrapped in a future. I gain access to the sandbox through emacs and issue some commands: https://gist.github.com/2267395
14:37simardI can see the function jump is defined in the sandbox, but whenever I define a new function (asdf), jump disapears
14:38simardthere's probably something basic I don't understand about threads here, can anyone help ?
14:46dnolenoakwise: yes, I think brenton's last commit may have messed things up.
14:46dnolenoakwise: I emailed him, hopefully we can get that sorted out with a new release.
14:47oakwisednolen: great
15:14TimMcweavejester: Ouch. rotary?
15:14weavejesterTimMc: Yeah, hopefully it'll be sorted out soon
15:15weavejesterTimMc: Until then I'll just push to org.clojars.weavejester/rotary
15:26gtrak``what's the best guide for a step debugger? I have some hairy code that's hard to test
15:32aperiodicgtrak``: i usually just use debug-repl https://github.com/GeorgeJahad/debug-repl
15:32gtrak``ah, neato
15:33gtrak``but it doesn't step
15:45aperiodicyeah, i usually just stick it where i'd stick breakpoints in a stepping debugger
15:46hugodgtrak``: ritz does stepping, though I think cdt does too
15:46aperiodicyou can terminate it by evaluating the empty list, and then control passes back to your code
15:47gtrak``i think i figured it out, i'm doing stuff that cares about identity, so things that shouldn't be equal are evaluating equal.. :/ hammock time
15:51gtrak``basically, trying to do some simple rigid body collisions and failing :-), I tried to build maps of game objects to corresponding rigid-bodies, but it got complicated, I might just add a key to the game object for the rigid body instead
15:58TimMcMy kingdom for a step debugger that lets me inspect return values.
16:02jayunit100user=> (derive ::rect ::shape)
16:02jayunit100nil
16:02jayunit100user=> (derive :rect :shape)
16:02jayunit100java.lang.AssertionError: Assert failed: (namespace parent) (NO_SOURCE_FILE:0)
16:02jayunit100Curious -> what is the "double colon" doing ?
16:03Bronsa,::a
16:03clojurebot:sandbox/a
16:03RickInGAjayunit100: I believe :: resolves to a namespace
16:03RickInGAs/resolves/qualifies/
16:03Bronsait qualifies the keyword to the current namespace
16:04Bronsa,(= ::a (keyword (str *ns*) "a"))
16:04clojurebottrue
16:05jayunit100,(= ::a (keyword (str *ns*) "a"))
16:05clojurebottrue
16:05jayunit100,(= :a (keyword (str *ns*) "a"))
16:05clojurebotfalse
16:05fliebel__$mail samaaron Am I correct that your RxTx does not include parallel natives? :( had to figure that out on a 800MHz Windows machine.
16:05lazybotMessage saved.
16:05Bronsa:a is not namespace qualified
16:05Bronsa(= :a :sandbox/a)
16:05Bronsa,(= :a :sandbox/a)
16:05clojurebotfalse
16:05Bronsa,(= ::a :sandbox/a)
16:05clojurebottrue
16:06gfredericks,(= :a (keyword "a"))
16:06clojurebottrue
16:06jayunit100why do i need to qualify a namespace for a multimethod
16:06jayunit100shouldnt the qualification be local to the dispatcher ?
16:08jayunit100hmmm maybe im not thinking about this the right way :0
16:09jayunit100,(::a)
16:09clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :sandbox/a>
16:09jayunit100,::a
16:10clojurebot:sandbox/a
16:10gfredericks$doc derive
16:10jayunit100okay --- so why does a have to be namespaced for a multimethod ?
16:10gfredericks,(doc derive)
16:10clojurebot"([tag parent] [h tag parent]); Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy."
16:10jayunit100aha
16:10jayunit100so derive doesnt work if the parent is NOT namespace-qualified.
16:11gfrederickssounds like both have to be qualified
16:11jayunit100so ... what is the namespace qualification buying us ?
16:11gfrederickswell at least for the global hierarchy
16:11gfredericksit is ensuring you don't affect other stuff going on elsewhere in the program
16:11gfredericksthat's my guess
16:12gfrederickswhy it matters with an explicit hierarchy...dunno
16:12gfredericksmaybe just for consistency? :/
16:16yoklovjayunit100, i think its just normal collision detection stuff. if you derive something in a hierarchy and then someone does that later, they could accidentally override one of your bindings (derivations?)
16:17yoklovif its namespace qualified that won't happen
16:17jayunit100yeah ok that makes sense
16:17jayunit100it, unfortunately, complicates my ability to adopt the theory behind multimethods though. accidental complexity rears its ugly head.
16:18yoklovwhat's happening?
16:18jayunit100trying to figure out why multimethods are more effective then run-of-the-mill polymorphism (i.e. c++ java style)
16:19yoklovit gives you more flexible dispatch
16:19yoklove.g. multiple dispatch
16:19yoklov(or more). in c++/java you'd use the visitor pattern for this, which is far more complex
16:20gfredericksnot to mention dispatching on arbitrary functions is more general than always and only dispatching on type
16:20yoklov^
16:21yoklovmultimethods are one of my favorite features of clojure, but i rarely use them in a way similar to OO
16:21jayunit100in java, you can delegate using class annotations combined with reflection . right ?
16:21yokloverr, what?
16:22jayunit100Well.. i guess even then you still have to "check" each classes annotation values, which would amount to the visitor pattern.
16:22yoklovsounds ugly.
16:22yoklovmultimethods are much cleaner.
16:23yoklov(and if you don't need a hierarchy you don't need namespace qualify your keywords)
16:23jayunit100can you elaborate on the last statement ?
16:23yoklovoh
16:23jayunit100"(and if you don't need a hierarchy you don't need namespace qualify your keywords)"
16:23yoklovif you never use derive
16:23yoklovtheres no problem.
16:24yoklov(defmulti foo some-function-which-returns-a-non-namespace-qualified-keyword) (defmethod :bar …) etc.
16:25jayunit100... i guess im still wondering --> how can you compare java object's polymorphism with that of a clojure function's ploymorphism.
16:25yoklovi mean the hierarchies are certainly powerful, but you don't need them in every case
16:25yoklovoh
16:25jayunit100java functions are polymorphic w/ their primitives.
16:25jayunit100s/primitives/arguments
16:26yoklovthat's the same as a multimethod whose dispatch function is class
16:26jayunit100the dispatching is done for you by method name and args alone, and confirmed at compile time .
16:26yoklovwell, i don't really think that when it occurs effects the semantics a lot
16:27yoklovand clojure functions can already dispatch on number of args, if you want type of args or type confirmation… clojure's a dynamic language
16:29yoklovif you want something like that protocols are what you should look into anyway.
16:30jayunit100ah i see . the magic is in the dispatching function.
16:31jayunit100thats what i was missing
16:31yoklovthe magic is that you can provide an arbitrary one
16:31jayunit100yeah.
16:31yoklovnot just "on type"
16:31jayunit100so, if we only dispatch on the # of args and their types its equivalent to java.
16:31yoklovright.
16:31yokloveven then
16:31jayunit100thanks mister yoklov :)
16:31yoklovnp
16:35jayunit100yeah , these multimethods are nice - we define a function in the dispatcher, and then
16:35jayunit100we simply match the output of the function to predicates in each "case"
16:36jayunit100can the "cases" be predicates themselves ?
16:36clojurebotCool story bro.
16:36gfredericksI think they're just values
16:36gfrederickselse things that are values and functions would be ambiguous
16:36jayunit100how did clojurebot know that i was rambling ? :)
16:36gfredericksclojurebot is very attentive
16:36jayunit100ha. so ... what about wildcards.
16:37gfredericksI think you can give a default implementation
16:37yoklov:default
16:38yoklovyou can also do something like [::foo ::bar ::baz], and it will dispatch against each in turn (e.g. if those all derived from ::frob, it would match [::frob ::frob ::frob] also)
16:39jayunit100so, a dispatcher will run multiple methods at one time? its not just a greedy first match -> run .
16:39yoklovno
16:40yoklovyou'd need a
16:40yoklov(defmulti [::frob ::frob ::frob] …) for that
16:40yoklov*for my example
16:40yoklovand if there are 2 matches you need to do prefer-method
16:40jayunit100(doc defmulti)
16:40clojurebot"([name docstring? attr-map? dispatch-fn & ...]); Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :default the default dispatch value, defaults to :default :hierarchy the isa? hierarchy to use for dispatching defaults to the global hierarchy"
16:40yoklovwhoops
16:40yoklov(defmethod [::frob ::frob ::frob])
16:41yoklovis what i meant.
16:41yoklovand then a function name too.
16:41jayunit100ah ok
16:41yoklov(defmethod some-method [::frob ::frob ::frob]) there.
16:42jayunit100I think that method would only run if the result of the function was [::frob :: frob ::frob]
16:43yoklovor a 3-element vector of things which decend from ::frob
16:43gfredericksI don't think I've ever heard of someone making extensive use of the hierarchy feature
16:43yoklovno, me neither
16:44gfrederickslet's rip that out into a library and add a function that tests if an item is in a collection
16:45yoklovhm?
16:46gfredericksbad joke
16:48yoklovlol, it's okay
16:48ferdI need to do String interpolation and found strint: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/strint.clj
16:48ferdis it available anywhere as a maven artifact?
16:49gfredericksferd: I think there are some unofficial snapshots on clojars
16:49gfredericksno guarantee they've got that exact code
16:49ferdgfredericks: thanks... will check
16:50gfredericksferd: I assume you already know about clojure.core/format?
16:52ferdgfredericks: yes, thanks. I like strint better though
16:53gfredericksit does look interesting
16:55ferdI need to do templates, and they'd look cleaner with string interpolation
16:56ferd(format ) has its uses though... mmm... if you need to actually "format" each value (alignment, numer decimals, etc)
16:56gfrederickshuh
16:57gfredericksI guess if you want to emit a "~(" you can do "~(str \"~(\")"
16:59ferd:-\ should have a way to escape, like \~
17:00gfredericksjust read through the code, don't think so
17:00gfredericksI like ~~ as an escape better though
17:02ferdgfredericks: agreed... Clojure uses \ for escaping within strings right? so... it would require two backslashes to work
17:02gfredericksexactly
17:02gfredericksand ~~ covers pretty much all cases and is unambiguous I think
17:03gfrederickslike %% in format strings
17:04jayunit100im trying to run the string partition function from the repl... but its breaking because the repl is tring to run the numerical partition function.
17:04jayunit100I assume clojure.contrib.string.partition wont work -- to obvious. :)
17:05RickInGAjayunit100 you can require the string ns and give it an alias
17:06jayunit100alias?
17:06gfredericks(:require [clojure.contrib.string.partition :as spart])
17:06jayunit100can i just reference it explicitly ?
17:06jayunit100rather than aliasing, id like to reference the function inline .
17:07gfredericksthen at least require the ns regularly
17:07jayunit100(clojure.contrib.string.partition "a" "AabC")
17:07jayunit100so ... there is no way to reference the partition function explicitly ?
17:08yoklovclojure.contrib.string/partition ?
17:08jayunit100oh ooop
17:08jayunit100than
17:08jayunit100x
17:18weavejesterIf you have a function like… (fn [x & {:as opts}] …)
17:19weavejesterThen apply doesn't work. Is there anything like apply that can be used instead?
17:19weavejesterOr is it recommended not to have keyword arguments?
17:19amalloyweavejester: "apply doesn't work"?
17:20amalloy&(apply (fn [x & {:as opts}] (:x opts)) 1 '(:x 3))
17:20lazybot⇒ 3
17:20weavejesteramalloy: Because (apply foo {:a 1, :b 2}) expands to (foo [:a 1] [:b 2])
17:20amalloypersonally, i recommend using kwargs only at the outer shell of your api, and just pass around maps once you get any deeper
17:21weavejesterYeah, but I have a create-table and an update-table
17:21weavejesterAnd I want to have a "ensure-table" that either creates or updates
17:21weavejesterSo all three are exposed to the user
17:22weavejesterI wonder if I should just use maps instead of kwargs
17:22amalloy(defn update-table* [x opts] ...) (defn update-table [x & {:as opts}] (update-table x opts)), if you're married to this API
17:22amalloy(except you should probably fix the obvious error in that)
17:23weavejesterHm… I'm not married to the API. I could have (create-table cred "foo" {:hash-key "id", :range-key "date"}) instead of (create-table cred "foo" :hash-key "id" :range-key "date")
17:24weavejesterOr even: (create-table cred {:name "foo" :hash-key "id" :range-key "date"})
17:25amalloythat also makes it easier for the user to store/load their options from some config file
17:26amalloywhich is the kind of thing it sounds like your users will want to do
17:27TimMc~mapply
17:27clojurebotmapply is (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
17:28TimMcweavejester: ^ *shrug*
17:29weavejester&(doc mapply)
17:29lazybotjava.lang.RuntimeException: Unable to resolve var: mapply in this context
17:29weavejesterI might just have everything use maps. Easier :)
17:30amalloyTimMc: your mapply factoid seems to be difficult for people to recognize
17:30amalloyclojurebot: forget mapply |is| (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
17:30amalloyclojurebot: mapply |is| (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
17:30clojurebotI forgot that mapply is (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
17:30clojurebotYou don't have to tell me twice.
17:30amalloyoops
17:32amalloy~mapply
17:32clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
17:32TimMchrm
17:32TimMcMight be better, yeah.
17:46jhicknerIn my clojurescript code I keep wanting to use defrecord and extend it to Object so I can create "classes" with "instance methods". Is that bad practice? stuff like this: https://gist.github.com/2268831
17:49arohnerjhickner: yes. Rather than thinking in instance methods, think of protocols as "properties this thing has"
17:50arohnerso yes, sockets are a weird beast, but rather than putting (close) on websocket, consider a protocol Closable
17:50arohnerthat's if you're going to reuse these protocols at all
17:50arohnerif not, just write fns that take sockets as arguments
18:03amalloyarohner: you're going to have to catch him during one of the brief periods between his logging-in and getting disconnected
18:05jhicknersorry, not sure why that's happening
18:23devnhm, im having issues with org-babel
18:23devni can't seem it to give me a result of evaluation that *isn't* a table
18:24devnwhen i evaluate my begin_src block containing (+ 1 1) it prints the results as: | | 2 |
18:25gtrak``you guys wanna see a shitty physics simulation written in clojure with quil for drawing? https://github.com/gtrak/quilltest just lein run it
18:27gtrak``wasd adds acceleration to the balls, q stops the game-loop, escape will kill the process
18:29gtrak``i'm still not sure why they only actually collide half the time :-)
18:38lynaghk`Does anyone know of decent clojure libs for interacting with webpages for scraping? Something like Mechanize from the perl/ruby worlds?
18:39devnanyone have any ideas? This is driving me a little crazy.
18:39devnlynaghk`: You can try enlive if you like, but to answer you question succinctly, no -- I do not believe something like that exists right now in Clojure
18:40lynaghk`devn: yeah, I was looking at enlive for tag matching, but I need to actually submit forms and such. I'm compiling PhantomJS right now, so I was just doing some idle daydreaming while waiting = )
18:44y3diwhat clojure podcasts besides mostlylazy exist?
18:44RickInGAthink relevance
18:44RickInGAhttp://thinkrelevance.com/blog/tags/podcast
18:46devnlynaghk`: oh...well, i mean, there's clj-webdriver
18:46devnwhich is really nice, but maybe not what you need
18:46devnit's not headless
18:47lynaghk`devn: yeah, I need something headless.
18:48lynaghk`I am just googling around about using mechanize through jruby
18:48lynaghk`Any way to get jruby gems handled transparently using Lein?
18:54gtrak``this quil example I just made is also an example of an asynchronous update/draw loop, they run on separate threads
18:54Araqhow does clojure deal with ambiguous multimethods? runtime exception?
18:54gtrak``the atom makes it super trivial
18:59hugodb
19:13emezeskednolen: Is there an upstream case for the clojurescript repl issues?
19:14dnolenemezeske: I already emailed brenton - he's going to fix tonight, and they'll cut a release on Monday.
19:14emezeskednolen: As usual, you da man!
19:15devnAraq: prefer-method
19:34arohnerlynaghk`: webdriver can use htmlunit, which is headless, but isn't a full-featured browser
19:34arohnerlynaghk`: similar to links
19:35arohnerlynaghk`: also, https://github.com/detro/ghostdriver
19:37arohneranother option is 'normal' webdriver + Xvfb
19:37devndoh, and here i was writing a simple wrapper around htmlunit for the last hour or two
19:38devni think im gonna just keep working on it
19:39arohnerthe new clj-webdriver alphas with taxi are really nice
19:39gfredericksdevn: something on github?
19:39devngfredericks: not yet, ive been toying around with protocols, multimethods, and now im back to just simple fn wrappers
19:39gfredericksdevn: threading-friendly fns? :)
19:40devn:)
19:41gfredericks(-> (start-browser "foo.com") (submit-form "#form" {...}) (should-see "made new foo"))
19:41iwohey, does anyone know why when i run a clojure repl with jline, the prompt 'user=>' seems to confuse jline?
19:42gfredericksiwo: I think maybe we hate jline
19:42gfredericksbut I could be wrong
19:42devngfredericks: well, now that you mention it, i wasn't thread friendly for a bit because i had a (with-client) macro
19:42gfredericksdevn: I don't know why I get fixated on that way of doing it
19:42gfredericksI wrote a library around that once
19:42devnit can be nice gfredericks but idk
19:42devnsometimes it can get too clever
19:42iwowhen i use up-arrow to recall the previous command, the text displayed is not insync with reality
19:43gfredericksdevn: it doesn't seem like a bad situation for a global
19:43iwoso when i move into the text with a cursor, i'm editing characters that are not the same as displayed
19:43gfredericksiwo: is installing rlwrap an option?
19:43iwothey're shifted because jline appears to not understand that there is a prompt 'user=>'
19:44devngfredericks: i started with (def *client* (new WebClient))
19:44iwogfredericks: i expect so, i'm just following a tutorial to set up a clojure dev environment and it recommends jline (i see it recommended quite a lot)
19:44iwoctrl-R history would be very nice
19:45gfredericksiwo: do you see it recommended in writing less than 2 years old?
19:45devni was thinking that way you could (with-client (make-client :other options :go here) (visit "http://www.google.com&quot;))
19:45gfredericks(two years in real life is equivalent to fifteen clojure years)
19:45devntoo much rumination
19:46iwogfredericks: i think so: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
19:47gfredericksiwo: if using (and learning if necessary) emacs is a valid option, that is where the most happiness lies
19:47gfredericksI've never seen jline work not terribly
19:47gtrak``not the riddell.us tutorial, use the swank-clojure docs and leiningen
19:47lazybotThe 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.leiningen
19:52iwothanks for the pointers
20:04TimMctechnomancy: This is how work gets done at Heroku, right? https://bitbucket.org/spooning/
20:04offby1taught my wife to program that way.
20:05gtrak``haha
20:05gtrak``brilliant
20:05offby1guy I knew in college tried to teach some neighborhood kids that way ... he'll be eligible for parole in 2025
20:06simardamalloy: I have a clojure sandbox in which I have a few functions defined. The init is done from the main thread and I then start a swank server wrapped in a future. I gain access to the sandbox through emacs and issue some commands. If I now (defn) some function from swank, the otherwise already defined functions disapear. See: https://gist.github.com/2267395
20:06TimMcHeroku seems like just the sort of crunchy granola place where these advanced team methodologies could work.
20:06simardamalloy: does that ring a bell ? could multithreading be somehow responsible for that ?
20:07offby1mmm ... granola
20:07mega`hahaha
20:07TimMc(Hmm, "crunchy granola" isn't actually what I meant, but it's close enough in semantic space for my purposes.)
20:07mega`lovws ir :S
20:07mega`:D*
20:09amalloyi doubt if swank is relevant. threading might be, i dunno; the ablity to def in a sandbox is a feature only Raynes has really worked on. but i do know there's a queue of def'd things, and as you def new ones the older ones disappear
20:10amalloy(which, btw Raynes, i still think is pointless)
20:11simarda queue where def'd things disappear ?
20:11simardthat sounds odd.
20:11Frozenlo`How does one force the evaluation of `map'? It returns a lazy sequence and I need it evaluated on the spot.
20:13gfredericksTimMc: perhaps you meant "soggy granola"?
20:14gfredericksFrozenlock: doall does that; I personally prefer doseq if you're using an anonymous function with your (doall (map ...))
20:16simardamalloy: max-defs 5
20:16simardno wonder !
20:16simardthank you
20:16simardyeah, I think it's pointless too, and, frustrating :D
20:17Frozenlockgfredericks: In this case I need to obtain the results. If I remember correctly doseq only returns nil. I'll try doall immediately!
20:17gfredericksFrozenlock: ah ha yes;
20:18Frozenlockgfredericks: Works as promised, thanks! :)
20:23gfredericksdoall rarely makes a liar out of me
20:32FrozenlockAw cmon! When I type the result (bound to 'tt') in the REPL, everything is fine, but when I do (spit "test.txt" tt), I get clojure.lang.LazySeq@91de0c38 in the file :(
20:37TimMcsimard: Double/POSITIVE_INFINITY, perhaps :-)
20:44FrozenlockI think I found a solution.. `into' seems to evaluate everything.
20:44devngfredericks: https://gist.github.com/bdc2f0729ea6d478ec08
20:44devngfredericks: that's all ive really finished tbqh
20:46TimMcFrozenlock: doall really should work there
20:47devngfredericks: (map attrs (take 3 (xpath (visit (make-client) "http://www.google.com&quot;) "//a")))
20:47devn=> ({:href "http://www.google.com/webhp?hl=en&amp;tab=ww&quot;, :id "gb_1", :class "gbzt gbz0l gbp1", :onclick "gbar.logger.il(1,{t:1});"} {:href "http://www.google.com/imghp?hl=en&amp;tab=wi&quot;, :id "gb_2", :class "gbzt", :onclick "gbar.qs(this);gbar.logger.il(1,{t:2});"} {:href "http://video.google.com/?hl=en&amp;tab=wv&quot;, :id "gb_12", :class "gbzt", :onclick "gbar.qs(this);gbar.logger.il(1,{t:12});"})
20:50gfredericksFrozenlock: when you're converting a data structure to a string pr-str might be helpful
20:51TimMcoh, that's the problem, yes
20:51mega`, [(str (range 0 5)) (pr-str (range 0 5))]
20:52clojurebot["clojure.lang.LazySeq@1b554e1" "(0 1 2 3 4)"]
20:52gfredericks,(str (doall (range 5)))
20:52clojurebot"clojure.lang.LazySeq@1b554e1"
20:52mega`&(doc pr-str)
20:52lazybot⇒ "([& xs]); pr to a string, returning it"
20:52FrozenlockInteresting...
20:52gfredericks&(doc pr)
20:52lazybot⇒ "([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
20:53FrozenlockShould I use this instead of `into'?
20:53gfredericksFrozenlock: yeah
20:53mega`unless you want a vector?
20:53FrozenlockYes.
20:53gfredericks(vec) is shorter than (into [])
20:53gfrederickstell all your friends
20:53mega`but less cool
20:53FrozenlockI was doing (vector my-stuff)
20:54gfredericksmega`: you see that's where you're wrong
20:54FrozenlockBefore using (into [])
20:54gfredericksthis is making less and less sense the more things you say
20:54FrozenlockUnsurprisingly :p
20:55Frozenlock(into []
20:55Frozenlock (map (fn [rd oids]
20:55Frozenlock (hash-map ....
20:55mega`anny one seen more programming related aprill fools stuff?
20:56gfredericksis the spooning video old hat by now?
20:56gfredericksI only just saw it
20:56mega`no me to
20:56mega`loved it tho :D
20:58gfrederickspull request will never mean the same thing again
20:59gfredericksdevn: that expression looked great for threading!
20:59gfredericks(-> (make-client) (visit "google.com") (xpath "//a") (->> (take 3) (map attrs)))
20:59ataraxso maybe this is a stupid question that will get me banned, but how do I learn clojure
21:00gfredericks~guards
21:00clojurebotSEIZE HIM!
21:00mega`BAAAAAN
21:00gfredericksatarax: you've failed the have-to-already-know-clojure test for this room
21:00mega`theres books ofc
21:01ataraxgfredericks: ok, I think I answered my own question - I should just sit here quietly and watch
21:01mega`and i saw the begining of a video series not to long ago
21:01gfredericksatarax: 4clojure.com maybe
21:01FrozenlockYes 4 clojure is great.
21:02gfrederickslazybot: does Frozenlock know clojure??
21:02lazybotgfredericks: Definitely not.
21:02Frozenlock:p
21:02ataraxare your bots here in clojure? :)
21:02FrozenlockWell no, which is why I use 4clojure
21:02gfredericks&(println "yes")
21:02lazybot⇒ yes nil
21:03gfredericks&(println "yes nil")
21:03lazybot⇒ yes nil nil
21:03ataraxhehe, nice
21:03gfredericks&(println "this sentence ends with")
21:03lazybot⇒ this sentence ends with nil
21:04offby1This sentence no verb.
21:05mega`http://tryclj.com/
21:05devngfredericks: yeah, i guess it's okay, but there's so much to do to make it usable as a general library
21:06gf3ibdknox: is Noir supposed to be a wine thing?
21:06offby1Pinot, I don't think so
21:06gfredericks$google greengrocer github
21:06lazybot[whymirror.github.com] http://whymirror.github.com/
21:06devngfredericks: maybe (defn with-client [c f & args] (apply #(f c %) args))
21:06gfredericksdevn: ^ that's my original shot at something like this
21:07devn(defn visit [^WebClient c, ^String url] (. c getPage url))
21:07gfredericksdoesn't use any underlying engine though
21:07atarax&(hello me)
21:07lazybotjava.lang.RuntimeException: Unable to resolve symbol: hello in this context
21:07gfrederickswait what
21:07devn&(hello "me")
21:07gfredericksdid lazybot return there
21:07lazybotjava.lang.RuntimeException: Unable to resolve symbol: hello in this context
21:07gfredericksdevn: I meant https://github.com/fredericksgary/greengrocer
21:07devn&'(hello me)
21:07lazybot⇒ (hello me)
21:08atarax&(defn hello [who] (str "Hello," who "!"))
21:08lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
21:08gf3haaaaaaaaa haaaaaaaaaaaa, offby1
21:08devngfredericks: cool
21:08offby1\o/
21:08devngfredericks: i think im taking a bit of a different approach -- i really just want epic screen scraping with ease
21:08ataraxuh, ok
21:08devnpredicates, inspectors, etc.
21:09gfredericksdevn: okay; maybe you and I aren't the same person after all
21:09devnlol
21:09devni can assure you we are not! (i think)
21:09atarax&((defn hello [who] (str "Hello, " who "!")))
21:09lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
21:10atarax&(+ 1 2)
21:10lazybot⇒ 3
21:10gfredericksatarax: lazybot also supports private messages :)
21:10ataraxthanks :)
21:10devngfredericks: do you know if Htmlunit supports CSS?
21:10devnselectors
21:11gfredericksdevn: man I didn't even know about Htmlunit until like last week
21:11devnnor i until today
21:11mega`, ((fn [who] (str "Hello, " who "!")) "mega")
21:11gfredericksI think it runs a JS engine though...
21:11clojurebot"Hello, mega!"
21:11devni was using cyberneko
21:11devnand i found it to be an epic PITA
21:11gfredericksPeople for the Ithical Treatment of Animals
21:11devnthen again, maybe it's not so bad
21:12devnim basically at the same point i was with cyberneko in htmlunit
21:12devnhtmlunit actually uses cyberneko under the covers
21:12devnfor tag balancing and what-not
21:14gfredericksdangit I don't know how to google for fogus's try-cljs app
21:15mega`do you mean the one whit the weird name?
21:15mega`himera
21:16gfredericksyep found it
21:16mega`think its a russian cat or something
21:20ataraxthanks for that 4clojure.com site, I'll ask what's next if I finish that
21:20mega`atarax: back in 5 then?
21:21ataraxmega`: i'm an idiot though, maybe not
21:21Licenserhmm is there something like dissoc for seqs so I can say (dissoc '(1 2 3) 1) -> '(1 3)
21:22TimMcLicenser: You want to remove things as specific indices?
21:22gfredericksnope
21:22gfredericksfinger trees if you really need to do that efficiently
21:22mega`Licenser: theres take and skip
21:22LicenserTimMc yap
21:23Licensermega` that is a good idea
21:24yoklovi should really just stop trying to use sets in cljs.
21:24yoklovthey are sloooooow :/
21:24LicenserI'll go with mega`s suggestion :)
21:28mega`yoklov: linear lookup??
21:28lazybotmega`: Definitely not.
21:28mega`ok :P
21:28yoklovmega: i think it needs to copy the entire set when you make a change
21:34gfredericksyoklov: no way
21:35gfredericks&(let [s (set (range 1000000))] (time ((disj s 8) 7)))
21:35lazybot⇒ "Elapsed time: 0.496074 msecs" 7
21:35yoklovgfredericks: clojurescript
21:35gfredericksoh
21:35gfrederickswell yes of course
21:35yoklovyup :(
21:35gfredericksoh I see you said "in cljs"
21:35gfredericksI repent in dust and ashes
21:36yoklovno problem :p
21:37TimMcAnyone here have experience dumping moderately large numbers of records (~50000) into SQLite without it taking forever?
21:38TimMcI'm wondering how to even tell whether SQLite or clojure.java.jdbc is the bottleneck.
21:38lynaghk`TimMc, yeah
21:38lynaghk`are you doing it in a transaction? That will make it hella faster
21:39TimMclynaghk`: Here's the code as it is: https://github.com/timmc/kpawebgen/blob/master/clj/src/kpawebgen/spit.clj#L59
21:40TimMc(The chunking into 10k blocks is for debugging.)
21:40TimMcI think that when I tried to wrap it in a transaction, it complained about already having one open.
21:42lynaghk`TimMc: what's goin on with the outer doseq?
21:43TimMcIterating over a list of tables.
21:43TimMcWell, a map.
21:43lynaghk`that's just named db? Okay.
21:44TimMcYes, for various reasons I'm sucking the data out of a different DB and doing everything in-memory.
21:44dnolenyoklov: yeah somebody needs to take on PersistentHashMap now that we have PersistentVector ...
21:45mega`dnolen: is PresistentVector written in cljs?? or in js
21:45dnolenmega`: cljs
21:45lynaghk`TimMc: I'm not sure where the outer transaction is coming from, sorry. I would try macroexpanding and seeing what's what. All I know is that for lots of inserts like this, if you wrap the entire thing in one DB transaction it will go much much faster.
21:50yoklovdnolen: yup. heh, i'd be down to try if nobody else gets to it by the summer
21:50TimMcI think insert-records is doing it. Well, time to dig into the source, I guess...
21:51TimMclynaghk`: Curiously, this operation is quite fast if I use a :memory: SQLite db.
21:51arohnerdo I need to do anything special to make a defrecord implement clojure.lang.IFn?
21:51lynaghk`TimMc: everything is faster in memory = )
21:52arohnerI'm (trying) to implement clojure.lang.IFn [this], and getting "Foo cannot be cast to clojure.lang.IFn
21:52gfredericksarohner: and you're calling it with no args?
21:52TimMclynaghk`: Maybe there's a way to build an in-memory DB and slap it down onto disk...
21:52arohnergfredericks: yes. I've only implemented (invoke [this}). Is that enough?
21:53gfredericksarohner: it just worked for me
21:53lynaghk`TimMc: I think the reason transactions help is that sqlite won't try to update indexes until the transaction is completed. That probably doesn't make much of a difference in memory, but really kills on disk.
21:53gfredericksarohner: I did (defrecord Foo [] clojure.lang.IFn (invoke [this] :nularity-foo))
21:54arohnergfredericks: thanks. going to try restarting the JVM. I had previously defined the class, so maybe that's a problem
21:54gfredericksbet so
21:59oakwisewow, source maps look amazing
21:59oakwisethat could be a huge boon to cljs if we beat coffeescript to the punch
22:00yoklovcoffeescript doesn't seem to care that much about them. it's output is much more readable than compiled cljs
22:01gfredericksI've spent lots of time debugging coffeescript and it wasn't really an issue
22:01yoklovnope
22:01oakwiseyeah I've had no problem debugging coffeescript with chrome tools but it's a huge scare factor for people
22:01yoklovclojurescript is more of a pain though.
22:02oakwiseat least from the not-yet-using-cs-or-cljs-devs I've talked to
22:02yoklovyeah, thats definitely true
22:11TimMclynaghk`: Oh silly me, I should have seen the sql/transaction command. I was trying to do BEGIN TRANSACTION >_<
22:12lynaghk`TimMc ahhhh. Well, at least it wasn't a missing colon or period or something = )
22:12TimMcNow it is fast!
22:13lynaghk`node.js fast?
22:13TimMchaha
22:13TimMcI wouldn't know.
22:15lynaghk`I haven't tried Datomic yet, but thus far SQLite is my favorite datastore ever.
22:25TimMcIt's pretty freaking convenient.
22:26TimMcI wish MySQL, PostGres, etc. had a file-based mode like SQLite. Testing would be so much easier...
22:27jordandanfordI'm somewhat new to Clojure, and I'm trying to make a Processing sketch using Quil – following the examples, here's how it's structured: https://gist.github.com/f223314b747981afc1fa
22:27gfredericksTimMc: file-based -> serverless?
22:27TimMcyep
22:28TimMcthat's the word
22:28gfredericksyeah I guess they're equivalent more or less
22:28gfrederickssorta
22:28jordandanfordWhat's the easiest way to run this?
22:29TimMcgfredericks: I guess it would be kinda hellish on the devs to try to make e.g. MySQL run in both serverless and server modes...
22:30ataraxI just started learning clojure and I can't do anything
22:30TimMcjordandanford: lein run, but that will look for a -main fn.
22:30TimMcjordandanford: You can also run it from the repl.
22:31jordandanfordIs that my only option?
22:32TimMcWell, for distribution you can build an uberjar, and run that with java -jar
22:32mutinyonthebayJust getting into Clojure w/ JOC; how can I declare a dependency to a contrib module in a lein project.clj?
22:32jordandanfordTimMc: Okay, thanks
22:33TimMcmutinyonthebay: Well, monolithic contrib is deprecated. Which part are you trying to use?
22:34mutinyonthebayTimMc: algo.monads
22:35mutinyonthebayTimMc: currently 0.1.3-SNAPSHOT, to my knowledge
22:35TimMc~contrib
22:35clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
22:36TimMcI see, that is new contrib.
22:36TimMc[org.clojure/algo.monads "0.1.3-SNAPSHOT"] should do it
22:36mutinyonthebayTimMc: Thanks!
22:37TimMc~builds
22:37clojurebotI don't understand.
22:37TimMchmm
22:37TimMcclojurebot: clojure build status?
22:37clojurebotPardon?
22:38TimMcclojurebot: build status is http://build.clojure.org/
22:38clojurebotAck. Ack.
22:39TimMcI'm actually not sure what the best way is right now to find the most recent release of new-contrib artifacts.
22:42mutinyonthebayTimMc: Yeah, I'm having a bit of a problem with it
22:44TimMcmutinyonthebay: The community generally releases to clojars. I suspect Clojure.org releases to Maven central, come to think of it.
22:44amalloycertainly it does
22:45ns_pabloanybody who's familiar with Compojure and Noir, how can I mix both and do something like this: (defroutes main-routes (context "/blog" [] blog-routes) other-routes))
22:45TimMcThose are the only two default release sites that Lein checks, right?
22:45ns_pabloand then (defroutes blog-routes (defpage "/something" [] ...)
22:46ns_pabloI've looked everywhere, including Noir source, but there doesn't seem to be any support for nested routes
22:49ns_pabloI've asked this a few times in #Noir but there doesn't seem to be any active user over there
22:50mutinyonthebayTimMc: I was getting an Artifact Missing error on lein deps until I added :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/&quot;}
22:51TimMcMight be one of your other deps.
22:51mutinyonthebayI just had clojure and monads
22:51mutinyonthebayIt was strange, but everything seems to fix itself with that repo
22:52TimMcMaven Central has v0.1.0
22:53xeqiclojure/core pushes snapshots to sonatype
22:53TimMcaha
22:53xeqior clojure/dev really
22:53xeqireleases go to maven central
22:53TimMcThat's curious.
22:54mutinyonthebayAh, I see
22:54xeqilein searches maven central and clojars by default
22:56Frozenlockns_pablo: I was checking for the same problem. I "fixed" it by simply putting the entire path: (defpage "/blog/something" [] ...
23:00ns_pabloFrozenlock: so you're repeating "/blog" for every route?
23:02ns_pabloFrozenlock that's what I usually find when looking at Noir source, but that's not gonna work with my app because I need to separate routes from views
23:02FrozenlockAs it is yes. PLEASE let me know if you stumble over a more elegant the solution "{
23:02gfredericks}"
23:02Frozenlock..
23:03gfredericksFrozenlock: you started it
23:03Frozenlock--> :P
23:03FrozenlockI know. My fault.
23:03ns_pabloIt's weird because since Noir build on top of Compojure, I would expect it to extend it, not limit features that are already available
23:03ns_pablo*builds
23:04ns_pabloI'd go with Moustache, but then I'd lose all the goodies from Noir...
23:20Frozenlockns_pablo: It is still possible to do powerful stuff with the url matching:
23:20Frozenlock(defpage "/user/:id" {:keys [id]}
23:20Frozenlock (str "You are user number " id))
23:21FrozenlockYou can even have another page "/user/:id/anotherPage" which is completely different.
23:23ns_pabloFrozenlock: yeah, it's fine for small apps, I guess. In my case I'm porting legacy code and I need a way to separate the code into indepentent "modules"
23:31arohnerif I have a templated java interface Foo<X>, and a method void bar(X arg), what does the reify call need to look like?
23:33TimMcarohner: You can skip the generics under most circumstances.
23:34arohnerTimMc: that's what I thought, but I'm getting "Can't define method not in interfaces"
23:34Lajla&(symbol ":()3732(3235) 3832 3dhdha %%%%% ashjad")
23:34lazybot⇒ :()3732(3235) 3832 3dhdha %%%%% ashjad
23:34arohnerlazybot: that's interesting
23:36amalloy(reify Foo (bar [this x]))
23:37Lajlaarohner, I do believe ti is a bug.
23:37LajlaAnd I shall not rest until it is avenged and vanquished
23:37arohneramalloy: that's what I tried. Do I have to do anything different because bar returns nil?
23:38amalloyLajla: just read one of the many mailing-list threads or stack-overflow questions about it
23:40amalloyarohner: no. whatever problem you're having is down to some specifics you glossed over with your foo/bar example
23:41arohneramalloy: ha. yeah, like misspelling the method name. I totally didn't just do that.
23:43y3dikeywords are functions so you can use them to look up values in maps. Can you not use normal primitives the same way? i.e. ("key" {"key" "value"})
23:43amalloyno, because they're not functions
23:44RaynesYou can't use toilet paper to open doors either.
23:44arohnery3di: keywords can implement clojure.lang.IFn, which takes a map as an argument. java strings are final, so that behavior can't be added to strings (or other primitives)
23:45flazzis there a way to run lein tasks from within emacs?
23:45RaynesM-!
23:46flazzRaynes: thanks! duh on my part
23:47Raynesflazz: You can also use eshell if you're running a lot of commands and want to keep the output handy on a buffer.
23:47RaynesM-x eshell
23:50flazzis there an emacs project mode people prefer for clojure projects?
23:50Frozenlock /troll-mode I like clojure-mode
23:51RaynesI've never used any sort of project mode.
23:52flazzi think i need learn-emacs-better-mode
23:53y3diyea pretty dumb q on my part... just wanted to belong ='[
23:53y3direal question: is the ' in '(1 2 3) and the . in (Date.) macros?
23:55TimMcReader "macro"s.
23:56Raynes&(doc .)
23:56lazybot⇒ "Special: .; The instance member form works for both fields and methods.\n They all expand into calls to the dot operator at macroexpansion time."
23:56RaynesTimMc: . is a special form.
23:57TimMcAh, so it is.
23:57Raynes' is a reader macro.
23:58Raynes&(doc quote)
23:58lazybot⇒ "Special: quote; Yields the unevaluated form."
23:58RaynesBut it expands to a special form.
23:58RaynesSo they're really both special forms.
23:58y3diwhats a special form? i don't think ive heard that term
23:59arohnery3di: http://clojure.org/special_forms
23:59arohnery3di: the built in forms that aren't fns or macros