#clojure logs

2012-10-24

00:51SgeoI should attempt to wrap my mind around derive
00:51SgeoIs it something like inheritance, kind of sort of?
00:52SgeoExcept I get the impression that everyone shies away from multimethods for "performance" reasons :(
00:52doomlordis there an existing c-embeddedable (subset-of-?)clojure, perhaps forked from a scheme or ecl
00:56RaynesSgeo: I don't think that is true.
00:56RaynesSgeo: If people shy away from multimethods, it's because protocols are a better fit. Protocols may be faster, but they also serve a completely different purpose.
00:56technomancymultimethods are the best*
00:57technomancy* - for polymorphism, which you really never need
01:01technomancySgeo: there are some locking issues with multimethods that have been fixed in 1.5, but most people who say "multimethods are too slow" haven't even measured the difference and just use protocols because whoa shiny
01:07Raynestechnomancy: You so do need polymorphism. Go look at the giant case switch in the node IRC library that makes up 98% of the whole library and then go look at my multimethod implementation of the same thing in Irclj. I'm shell shocked in languages that don't have multimethods now.
01:11perezdI need to make a clojure regex for a values like foo.bar.8000.status, foo.bar.9001.status
01:11perezdthat select anything foo.bar.*.status
01:12perezdnot sure whats right here..
01:12perezd#"foo\.bar\.\{1.4}\.status"
01:12perezdis what I tried
01:15SgeoSomeone in #lisp complained that on http://himera.herokuapp.com/synonym.html the "Closure and counters in loops"
01:15Sgeosection
01:15SgeoThe issue of whether or not looping constructs make a new binding or modify the old one is orthogonal to the issues of lexical scope and closures.
01:17unnaliperezd: {1,4} instead?
01:17perezdI actually had tha ti Think
01:18perezdjust kidding
01:18perezdI didnt
01:21amalloySgeo: i think that's a fair criticism of the himera page
01:21Sgeoamalloy, yeah, once I understood what they were getting at
01:22perezd#"frontend\.http\.\d{1,4}\.status"
01:22perezdthis is still wrong
01:25unnaliperezd: can you give an example of how you're testing it?
01:26perezdone sec
01:26unnali'cause it works for me
01:26unnali,(re-find #"frontend\.http\.\d{1,4}\.status" "frontend.http.1234.status")
01:26clojurebot"frontend.http.1234.status"
01:26perezdwerid..
01:27Sgeo,(class #'resolve)
01:27clojurebotclojure.lang.Var
01:27SgeoHmm, so when symbols are evaluated, they don't just evaluate to their var, they evaluate to what their var points to?
01:30unnaliSgeo: I'm not 100% sure at what stage it happens, but approximately, yes.
01:30unnaliif there isn't a lexical or something bound closer.
01:42SgeoIs loop/recur lexical or dynamic
01:45unnaliI'm not sure I understand your meaning correctly; functions introduce recur-targets, so there's no way that it would behave in a way that wouldn't be "lexical" or "dynamic", in a sense
01:46SgeoI can't recur from outside tail-call position
01:46SgeoOh, I didn't mention that I wanted to fake CL's block/return-from
01:46SgeoScrap the loop/recur question
01:46unnaliaha.
01:47unnalinot sure you'll manage that..
02:17SgeoIs macroexpand-all broken?
02:17Sgeohttp://ideone.com/Eoyc6K
02:26BikeSorry, sgeo. I don't actually know clojure, after all
02:27ForSparePartsIf I want a Java method to receive a Clojure function as an argument, what class/interface should I specify? I see a *ton* of things that have some relation to Fn.
02:27SgeoBike, you may end up learning
02:27ForSparePartsAFn/IFn/Fn, etc.
02:27BikePossibly.
02:27BikeAnyway, it seems as though the values of &env aren't intended for public use.
02:28SgeoYeah, pretty much
02:28SgeoOh, I finally remembered the name of a library I wanted to mention
02:29Sgeoserializable-fns uses &env, presumably to help capture closures.
02:30BikeCould I get a link?
02:31Sgeohttps://github.com/technomancy/serializable-fn
02:31BikeThanks.
02:31amalloySgeo: yes, macroexpand-all is broken by design
02:32Bike?
02:33Sgeoamalloy, o.O :( how so? I mean, it looks like it's trying to map macroexpand onto each macro, which won't preserve lexical environment
02:33SgeoDo you mean deliberately broken, or as in it makes no sense?
02:34amalloymeh. a question of degree. macroexpand-all is an attempt to use simple, crude tools to somehow achieve the subtlety of a compiler
02:34amalloyclojure.tools.macro/mexpand-all is much better, although probably not perfect
02:34SgeoIdeOne isn't likely to have clojure.tools.macro, is it?
02:35amalloydoes ideone have any compelling features?
02:35SgeoIt's on the web, meaning that I can be lazy and not need to open emacs or any Clojure implementation on my computer
02:36SgeoNice for quick demonstrations
02:36BikeSo, mexpand-all does what? Code walker?
02:36amalloywhat i mean is, whether something will work in ideone has never entered my consideration at all
02:38amalloyso i dunno if it has tools.macro
02:38SgeoBike, pretty much, I think
02:39SgeoYes
02:41BikeIf I'm reading this right, macroexpand-all just walks code dumbly as a tree? How does that ever work?
02:43Sgeo,(do (require 'clojure.walk) (clojure.walk/macroexpand-all '(quote (let [a 1] a))))
02:43clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk>
02:44Sgeo,(do (require 'clojure.walk :as 'walk) (walk/macroexpand-all '(quote (let [a 1] a))))
02:44clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol>
02:44Sgeo,(do (require ['clojure.walk :as 'walk]) (walk/macroexpand-all '(quote (let [a 1] a))))
02:44clojurebot(quote (let* [a 1] a))
02:44SgeoIt clearly doesn't.
02:44BikeWow.
02:45Sgeo,(quote (let [a 1] a))
02:45clojurebot(let [a 1] a)
02:45BikeI mean, does anybody actually try to use this, or... am I missing something
02:45SgeoWould be nice if clojuredoc.org supported comments
02:45SgeoWould be adding a comment to the effect of DON'T EVER USE THIS right now
02:46SgeoOh, hmm, it might
02:50perezdso , a regex that can match "frontend.http.8002.status" and "frontend.http.8001.status"
02:50perezdwhere the 8001/8002 is anything
02:50perezdany advice? banging my head against the wall..
02:50perezdseems super basic
02:50perezdbut its late and I'm fucking somethin gup
02:50perezdany number that is
02:51perezdbasically want frontend.http.*.status
02:51Bikefrontend\.http\.\\d*\.status, probably?
02:51perezdtrying..
02:52perezdnope :(
02:52Sgeohttp://clojuredocs.org/clojure_core/clojure.walk/macroexpand-all
02:52SgeoHmm, perhaps a bit alarmist?
02:53Bikethe !!! are a bit much, perhaps
02:54perezdBike any other advice?
02:54SgeoRemoved
02:54SgeoBy "anything" do you mean a number?
02:54Bikeperezd: try taking out one of the backslashes before the d, I always mess those up
02:54perezdyes
02:55perezdany 4 digit number
02:55Sgeoperezd, also, are you using the #" reader macro (probably not correct name, but that helps clue Bike in)
02:55Bikefrontend\dhttp\.\d{4}\.status ?
02:56perezdyes using #" "
02:56Bikeer. frontend\.http\.\d{4}\.status
02:56BikeSgeo: that reminds me, I was going to ask if there was something like reader macros in clojure, because then you could make your own backslash to make porting from cl a bit easier.
02:57AimHereThere's no actual reader macros
02:57Sgeomake my own backslash?
02:57SgeoBut ... it has something almost but not quite like reader macros, at least recently
02:57BikeA reader to more closely match CL's semantics, to save you some time, I mean.
02:57AimHereThe newest clojure had an extensible reader syntax or something
02:57perezdBike: still not workin :(
02:58SgeoBike, the details of what AimHere said will annoy you: It expects the code for it to be in one particular file
02:58Sgeorelative to the project's root
02:58BikeWeird.
02:58SgeoThat sort of thing is what annoys me about Clojure the most
02:59SgeoIf you want to add a library to your project, you tend to need to restart the REPL, although there's a library that works around that
02:59SgeoThe Clojure ecosystem is rather project oriented
03:01Bikeok, if I'm reading java docs right, perezd, it really ought to just be #"frontend\.http\.\\d{4}\.status". If it's not that it's something very much like that. "frontend.http." literal, then exactly four digits, then ".status" literal.
03:02perezdI read that too…trying again
03:02perezdfuckin doesn't work! ahasdhfjasjkdfh
03:02SgeoMaybe it's the surrounding code that's wrong, rather than the regex itself?
03:02Sgeo,(doc re-match)
03:02perezdits possible...
03:02clojurebotI don't understand.
03:03perezdBike: http://aphyr.github.com/riemann/configuring.html
03:03perezdlook at what they do for regex
03:03perezdthats what I am doing basically
03:04SgeoBike, um, that double \\
03:05Sgeo,(re-matches #"frontend\.http\.\\d{4}\.status" "frontend.http.8001.status")
03:05clojurebotnil
03:05Sgeo,(re-matches #"frontend\.http\.\d{4}\.status" "frontend.http.8001.status")
03:05clojurebot"frontend.http.8001.status"
03:05Bikereally starting to think using backslashes as both the escape character and the "regex class starts now" character was a mistake
03:05perezdI wish I knew why this didn't work
03:05perezdmaybe its a bug
03:05BikeI already suggested "frontend\.http\.\d{4}\.status" and perezd said it didn't work.
03:06Sgeoperezd, maybe you could paste a snippit of your code?
03:06perezdhttps://gist.github.com/1420f4e7495e6f4fa171
03:06perezdusing riemann config API
03:07perezdservice should accept a regex
03:07perezdaccording to: http://aphyr.github.com/riemann/configuring.html
03:08Sgeowhere is definitely a function?
03:08perezdyes
03:09perezdits working for non-regexes
03:10SgeoWhere is service defined?
03:10perezdI think where is some sort of macro
03:10perezdthat makes service become accessible
03:11BikeAccording do the documentation, «Replaces (metric x y z) with a test matching
03:11Bike(:metric event) to any of x, y, or z, either by = or re-find.»
03:11Bikeer, and does the same with service instead of metric.
03:11BikeSo it just matches it to the value of the event under the :server key. I think.
03:11perezdfound where in riemann.streams
03:12amalloythe regex already given is exactly correct, so any issues you're having are with this weirdo service api, not with regexes
03:12perezdright but (streams (where (service #"^eth0.*") (by :host (rate 1 graph)))) works
03:12BikePerhaps the name of the service isn't what you think it is?
03:13perezdconsidered that, but I've double checked…using the exact name works
03:13Sgeoperezd, as a string, or as the regex? If not the latter, try it as the latter, escaping .
03:14Sgeo(And try without escaping dot, it should match the service too, although it will match more)
03:18SgeoSo, in an attempt to show something cool
03:18Sgeo,(for [a (range 3) b (range 2) :when (> (+ a b) 1)] {:a a :b b})
03:18clojurebot({:a 1, :b 1} {:a 2, :b 0} {:a 2, :b 1})
03:20Bikenondeterministic programming, huh.
03:20BikeI didn't realize I was being sold to, though.
03:21doomlordi'm a leyman when it comes to lisp,but i'm generally finding clojure elegant
03:22Sgeodoomlord, I think Common Lisp's environment is generally nicer than Clojure, although as a whole it's less elegent
03:23doomlordis that comment on the toolchain vs clojures' hacks into the jvm :)
03:23doomlorda standalone clojure would be awesome. but then again the name wouldn't make sense
03:24BikeI'm sure a sufficiently determined programmer would be able to come up with a suitably ridiculous backronym.
03:24doomlordthe idea that cloujre is a "modern" lisp seems to make sense - there's lots of little choices in the standard macros that are helpful.
03:25Sgeodoomlord, it's nice not needing to make a new leiningen project and edit project.clj just to try some library
03:25SgeoAlthough I guess one-off might help with that?
03:25BikeLittle choices like what?
03:26SgeoClojure has a major focus on immutability, which I like, although I suspect doomlord isn't referring to that
03:26doomlordlet [ var0 expr0 var1 expr1 ...] versus let* (() () ()..)
03:26doomlordit could be i'm getting the "elegance" idea from the FP aswell, so perhaps thats unfair (fp comes with overhead)
03:26doomlord(ie. losing mutability optimizations)
03:27BikeSgeo: clojure has something like labels, I imagine, in which case you can bootstrap letrec
03:27doomlordi like funcallable objects too
03:27Bike[] is a vector, right? clojure's use of them does seem interesting.
03:28Sgeodoomlord, I think with closer-to-mop on CL you can do that on any CL that supports MOPish stuff, but it's ugly
03:28SgeoBike, yes
03:28doomlordand the threading macro! :) when i started tinkering with lisp i asked about making one of those... seemed natural but CL-ers claimed it would be an unusual style. I find the threadng macros help avoid excessive nesting depth
03:28BikeMOP has funcallable objects, yeah.
03:28doomlordits nice having it for the literal vectors IMO.
03:29Sgeodoomlord, I think I can grow to like it, but I was initially wanting something more functional
03:29SgeoYou can write something similar without macros
03:29SgeoAnd arguably more flexibly
03:29doomlordF# has |> .. which makes sense to me and again haskellers say "ew" to that
03:29Sgeo(thrush somemap #(assoc % :foo 20))
03:29SgeoWhat's |>, I don't know F#
03:30SgeoAlmost ashamed to say that there are languages that I know little about
03:30doomlordthreading macro as infix :)
03:30amalloySgeo: it's `$`
03:30doomlordits $ backwards
03:30SgeoAh
03:30doomlordsame deal. i asked on haskell, "is there.." and the answer was more or less "you're being stupid wanting to write code that way"
03:31doomlordi find with ->> you write the code as you think about it
03:31SgeoThere's going to be let-> in the future
03:31SgeoWhich is awesome
03:31SgeoAlso, you can put ->> inside -> comfortably
03:32doomlordi guess lot of the little macros can be done in CL. i made a "let" workalike, and a threading macro (i called it pipe)
03:32doomlordsomeone told me "reader macros" could actually implement vector /map literals, is that true?
03:32Sgeodoomlord, it should be possible to replicate most of the Clojure standard library in CL
03:33Sgeodoomlord, I believe so
03:33doomlordIMO the use of the other brackets doesn't go against the spirit of lisp: it is still trivial to parse
03:33tomojbut there is a reason clojure doesn't have reader macros
03:33BikeThere are a few CL reader macro libraries for hashtables.
03:34Bikereader macros basically let you do whatever you want, which has its advantages, and its disadvantages...
03:34doomlordi haven't delved into CLOS or multimethods yet, those look interesting
03:34Bikesuch as parsing being uncomputable. not a good thing.
03:35doomlordi suppose destructuring functoin arguments is well within macros that could be retrofitted
03:35doomlord(defn vec-cross[[ax ay az][bx by bz]]...
03:35Sgeodoomlord, let which has destructuring expands into let* which does not
03:35doomlordthat sort of thing is awesome
03:36SgeoCommon Lisp has a sort of destructuring
03:36SgeoDon't remember details though
03:36doomlordmultiple-value-bind ? and i've seen some in the loop macro.
03:36Bikedestructuring-bind, you mean?
03:36tomojimagine trying to do codeq with people using reader macro libraries :/
03:36Sgeocodeq?
03:36tomojinterestingly without a default reader literal thingy, I imagine codeq has a similar problem
03:36tomoj"reader literal" is a weird term
03:37doomlordperhaps the multiple-return values are more efficient in common lisp being a dedicated construct rather than vectors
03:37SgeoBike, what are some list manipulation functions that take keyword arguments?
03:37SgeoI have a point I want to make
03:37Bikeuh, like remove-if?
03:38Bikedoomlord: the idea with multiple values is that the return values could be put in registers rather than a composite data structure, I think
03:38SgeoBike, sure
03:38SgeoWhy does it take :start and :end keys?
03:39SgeoEfficiency purposes?
03:39doomlordi read it as stack but yeah.. 'vector' makes me think of more potentially going on re. allocation. I wonder if the implementations can just make it equivalent.
03:39Bikeso that you can operate on subsequences without explicitly constructing new objects, is what I would think, yes.
03:39SgeoDon't want to walk a list to drop a few things off the end then walk it again filtering?
03:39Bikeyeah.
03:39magnarsPlease help me with naming :-) "does this collection have both elements that fulfill a certain predicate, and elements that do not?" (mixed integer? list) ? (mixture integer? list) ? (diverse integer? list) ? (mix-of integer? list) ? (varies integer? list) ? Something else?
03:39SgeoClojure's sequence operations are lazy, meaning if you do that, you'll only walk the list once.
03:40Bikedoomlord: it'd have to be a pretty smart implementation, and you'd have to not rely on the function actualy returning a vector, etc
03:40BikeSgeo: not sure I understand. example?
03:40doomlordall? and not-all? all-satisfy? and not-all-satisfy?
03:40doomlord(all? integer? list) vs (not-all? integer? list)
03:41doomlord(all? ) and (any? )
03:41doomlordthats what i was calling them
03:42Sgeo,(map inc (drop-last 2 [1 2 3 4 5 6 7 8 9 10]))
03:42clojurebot(2 3 4 5 6 ...)
03:42doomlordoh .. fails on empty list perhaps
03:42Sgeo,(map inc (drop-last 2 [1 2 3 4]))
03:42clojurebot(2 3)
03:42SgeoThat is not as inefficient as it looks
03:42SgeoHmm, I should use a literal list
03:42Sgeo,(map inc (drop-last 2 '(1 2 3 4())
03:42clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
03:42Sgeo,(map inc (drop-last 2 '(1 2 3 4)))
03:42clojurebot(2 3)
03:43SgeoThe drop-last won't actually go ahead and walk the list as soon as you call it
03:43SgeoInstead, it will return a lazy-seq
03:43magnarsI'm looking for something that can replace (and (every? integer? list) (not-every? integer? list)) with a single call ... right now I think I prefer (mix-of? integer? list)
03:43doomlordmagnars: does your function have to return 'true' or 'false' for an empty list
03:43SgeoAnd the map also returns a lazy seq
03:43BikeOh, I see now.
03:43SgeoWith the effect of walking the original list once.
03:43tomojmagnars: uhh
03:43tomojisn't that just false?
03:44magnarsah doh, I meant "some" not "every"
03:44BikeYeah, that's probably a bit cleverer than passing a bunch of keys around.
03:44Bike(and (some? integer? list) (some (not integer?) list)), then?
03:45tomojno
03:45magnarsBike: yes, that's what I want a name for
03:45tomojsome-but-not-all :(
03:45doomlord(and (not-all? integer list) list) ... but you dont want to pass list twice
03:46BikeSgeo: map's still going to have to walk the whole list to figure out which two to drop, yes?
03:46doomlordah its not the same at all
03:46doomlordno where ner
03:46SgeoBike, Haskell is pervasive in this idea of not doing things until it's needed. That's not the case in Clojure, where it's just sequences that are like this, in a language that is fundamentally eager
03:46SgeoBike, yes
03:47SgeoBike, actually, lists store their length, come to think of it
03:47SgeoAlthough lazy sequences don't
03:47Sgeo,(counted? '())
03:47clojurebottrue
03:47Bikepresumably you can have infinite sequences as well.
03:47Sgeo,(counted? (map identity '()))
03:47clojurebotfalse
03:47SgeoYes.
03:47doomlord(any-and-any-not? integer? srclist ) :)
03:47Sgeo,(range)
03:47clojurebot(0 1 2 3 4 ...)
03:47Bike,(length (range))
03:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: length in this context, compiling:(NO_SOURCE_PATH:0)>
03:47Sgeo,(count (range))
03:48BikeOops.
03:48clojurebotExecution Timed Out
03:48Bikeso infinite sequences don't keep track of their infinitude.
03:48Bikebut yes, lazy sequences are cool. I particularly liked that part of SICP.
03:49doomlord(not-all-or-none? integer? ls )
03:49BikeWhere you could just define e as (lazy-cons 1 (integrate e))
03:49Bikeer, derivative.
03:49Sgeo,(doc lazy-seq)
03:49clojurebot"([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. See also - realized?"
03:49SgeoHmm, not the same as lazy-cons
03:49Sgeo(doc lazy-cons)
03:49clojurebotHuh?
03:49SgeoDarn
03:50BikeWell, yes, it seems like in Clojure lists are more like sequences, whereas in CL they're usually dumb conses.
03:50tomojI believe lazy-cons is a historical artifact
03:50SgeoHmm.... I think (def e (lazy-seq (cons 1 (derivative e))))
03:50SgeoDon't quote me on that though
03:50tomojmaybe it still could be rarely useful?
03:51tomojoh, wait, lazy-cons is gone
03:51Sgeo(comp lazy-seq cons)
03:51SgeoWhat's wrong with lazy-cons?
03:51BikeWait, there was actually a Clojure function called that? I was just quoting SICP.
03:51BikeIt was just a macro for (cons a (delay b)) as far as I remember.
03:52BikeYou could do the same thing in a more sequencey way, of course.
03:53Mr_BondHm, I really like Clojure as a language, but I think it's often hard to find my mistakes since the backtrace is from the java-generated code compiling.
03:53Mr_BondHow do you overcome this when coding Clojure?
03:53doomlordis there a plain interpreter or is it always compiled to jvm
03:54Mr_BondAFAIK, it's jvm, .net or javascript.
03:54Bike"Clojure has no interpreter.", very straightforward, clojure.org
03:55SgeoThe stacktraces are the worst part of Clojure
03:56tomojhttp://clojure.org/lazy has some notes about lazy-cons in clojure
03:56Mr_BondI see there is something called clojure.contrib.trace, which could be useful in some situations.
03:56Sgeotomoj, awesome
03:57muhoooh if you think java clojure stacktraces are bad, try clojurescript stacktraces
03:58tomojI think @ and seq should be synonyms on seqs
03:58tomojSgeo: what was your beef about names for promises something like "defer"?
03:59amalloymagnars: i dunno about your function's name, but isn't it just (apply not= (map pred coll))?
03:59Sgeotomoj, I don't remember
04:00SgeoOh, I found something
04:01Sgeo* Sgeo persists in suggesting that Deferreds should be Deferrable
04:01Sgeotomoj, oh, for your library
04:02doomlordwhats (not= ) with zero args
04:02SgeoYou were making a sort of promise-like thing that was intended to be monadic
04:02SgeoHowever, your code was not able to support the notion of a Deferred containing a Deferred
04:02tomojright
04:02SgeoAnd without that, it violates monad laws
04:02tomojI still don't care yet
04:03tomojbut I was stuck thinking about how promises in synchronous clojure require @
04:03tomojbut seq code doesn't
04:03tomojbut seq is just @ I think :)
04:03doomlordwhat should magnars function return with zero args... false i think
04:03Sgeo,(not=)
04:03clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$not-EQ->
04:04doomlord(mix-of? integer? nil) -> false, not "error wrong number of args" ?
04:04Sgeotomoj, ah, I see your point
04:05doomlordso apply not= would fail
04:05Sgeotomoj, I would say that the sequence manipulation functions are all expecting a seq, including possibly a lazy seq, but stuff for which you're using promises isn't generally expecting promises, but concrete non-promise values
04:05SgeoCould transform functions to expect promises
04:06SgeoBut then, what happens if you want to pass such a function a plain old value? Make a promise out of it. Now, what happens if you want to pass such a function a promise that it would somehow manipulate, but it's expecting a promise that the wrapped version will be waiting on
04:07tomojyeah
04:07SgeoThus, you'll be passing the wrapped version of the function a promise in a promise
04:08tomojI still don't think I care
04:08tomojthere is only one thing a promise can do
04:08tomojso if I do it for you, I only saved you work
04:08tomojnot sure though..
04:09SgeoA promise is a promise to return a value ... vs ... a promise is a promise to return a value that is not itself a promise
04:09tomojpromises aren't values :(
04:09SgeoThey aren't?
04:09Sgeo,(promise identity)
04:09clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$promise>
04:09Sgeo(doc promise)
04:09clojurebot"([]); Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block, unless the variant of deref with timeout is used. All subsequent derefs will return the same delivered value without blocking. See also - realized?."
04:09tomojdepends on how you define "value" of course
04:10Sgeo,(promise)
04:10clojurebot#<core$promise$reify__3678@5e329ba8: :pending>
04:10SgeoIt's a thing that can be passed around and manipulated
04:10SgeoSeems like a value to me, just as much as a function is a value.
04:12SgeoIt tends to be a bad idea to have abrupt exceptions to things, it confuses people and makes writing code harder, since people now have to check for the special case
04:15tomojI would say it's a monadic value, but..
04:16SgeoAre monadic values not values?
04:16amalloySgeo: that's a pretty broad definition of value. is a char* a value?
04:16tomojsometimes "value" can mean something different, where e.g. atoms/refs/(clojure.core/)promises aren't values
04:16doomlordwhats let-> that was mentioned above
04:16tomojyou have to deref to get the value
04:17amalloyyou can pass them around, but they change all the time. treating them as casually as you'd treat actual immutable values leads to devastation
04:17tomojor for defers (using "promise" is too confusing), you have to defer
04:18Sgeohmm
04:18Bikechar* as in a char pointer? of course that's a value, that what it's pointing to may change doesn't affect that...
04:19amalloyBike: that's a possible and useful definition of value, but not one that's popular in clojure
04:20SgeoI think I had Bike's definition in mind
04:20SgeoBut is there a Clojure term for the concept?
04:20SgeoIf an atom isn't a value, can we call it an entity?
04:20Bikesure. I thought you might have been speaking more broadly. If "value" means something more specific in the context of Clojure and/or promises, then that's that.
04:21amalloySgeo: call it an object, then. *anything* is an object, which is what you're calling values so far
04:21tomoj"entity" is taken by datomic :P
04:22Sgeotomoj, do you intend for your defers to only take values, or any objects?
04:23tomojI can't stop you from putting a non-value in there, but if you do, you lose all the nice properties I'm trying to get
04:23tomojso I don't care too much about supporting that
04:23tomoj..and if you want to stick an atom in there for some reason, it'll work
04:23tomojjust not a defer :/
04:25tomojbut you're probably right
04:25SgeoDoes it need to be a monad, or could you make it an applicative instead and still have it be nice to use?
04:25tomojif you have a cps transform that just converts deref -> defer, then I don't think it's a problem anyway
04:26tomojif you want to pass a defer to a function, you just don't deref (defer)
04:28SgeoHmm.
04:28SgeoSuddenly I'm wondering if defers are arrows
04:29Sgeo(As in, if it is an arrow, I guess I really can't object to making a fake monad)
04:33tomojapparently the Monad instance for Future is equivalent to the Writer monad
04:35tomojapplicative is not enough
04:37SgeoIn what sense?
04:38SgeoReason I ask is because if you find a use case for which applicative (or possibly arrow) is not enough, then I think it's quite likely that that use case will somehow involve nested defer
04:39tomojhmm
04:40tomojthe semantics are that the (eventual) value of (<*> future-f future-val) is (@future-f @future-val), occurring at the later of the times of future-f and future-val
04:41tomoj(>>= defer f) is (f @defer), which is itself a defer (pardon my terminology flux)
04:42tomoj(occurring at the later of the times of defer and (f @defer))
04:42tomojI'm not sure how >>= maps to my clojure ideas
04:47tomojone relevant example might be if you had a future seq (just like ISeq except rest returns a defer) of relative times, a future seq (or seq!?) of values, and a function that takes a relative time and a value and returns a defer that resolves to the value after the time
04:47tomojand map that function over the two (f)seqs
04:49tomojthat seems overly confusing
04:53SgeoSo, in order to resolve the resulting defer, you need to wait on two defers
04:53Sgeo?
04:53SgeoOh right, your problem was with not wanting to have a way to not join automatically
04:54tomojwell
04:54tomojthe functor is broken
04:55SgeoI'm sure there's something somewhere on why the monad laws should be obeyed
04:55tomoj(fmap (f :: a -> Future b) (a :: Future a)) :: Future b
04:55tomojI think
04:55tomoj>>= means you don't have to @@ in the case above
04:56tomoj(I think)
04:56Sgeohttp://www.haskell.org/haskellwiki/Monad_Laws
04:56shachaftomoj: That doesn't look like fmap.
04:56shachafI guess that's what you were saying.
04:57shachafWhat's Future?
04:57tomojhttp://conal.net/papers/push-pull-frp/
05:00tomoj"a value that can't be known yet"
05:02shachafThis seems to be a pretty specific meaning of the word "future".
05:03tomojit's confusing, since I don't mean clojure.core/future
05:03alex_baranoskymagnars: I'd call it `one-or-more`
05:04tomojbut-not-all? :(
05:06amalloymagnars: disparate?
05:15AtKaaZis this the right way to test for unbound? (= clojure.lang.Var$Unbound (class conn))
05:15AtKaaZor this? ##(bound? #'conn)
05:15lazybotjava.lang.RuntimeException: Unable to resolve var: conn in this context
05:16Sgeo(doc bound?)
05:16RaynesDon't know why you'd use the former given the latter.
05:16AtKaaZI just found that last one :/
05:16clojurebot"([& vars]); Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided."
05:16AtKaaZthanks
05:16Sgeo##(with-local-vars [boom] (bound? #'boom))
05:16lazybotjava.lang.IllegalArgumentException: with-local-vars requires an even number of forms in binding vector in clojure.core:1
05:17Sgeo##(with-local-vars [boom 5] (bound? #'boom))
05:17lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!
05:17AtKaaZI think I have to use it like this: (bound? (var conn))
05:17SgeoAtKaaZ, try attempting to resolve the symbol?
05:17RaynesUh
05:17RaynesThe bound of bound? is that the var *exists*, but isn't bound to anything.
05:17RaynesIf the var might not even exist, you're going to want to use resolve or something to check that it exists at all.
05:18SgeoExistent but unbound vars are created by declare
05:18tgoossensis there an easy way to execute shell commands (on linux) from clojure? (Perhaps by using a certain java lib?)
05:18AtKaaZI see what you mean, but in my case the var would always exist hmm... but I wouldn't mind being extra safe
05:18SgeoAtKaaZ, if it always exists, just use bound?
05:18RaynesSgeo: (def x) is also valid.
05:19Raynestgoossens: https://github.com/Raynes/conch
05:19tgoossensthanks
05:19RaynesOr clojure.java.shell if you don't want external dependencies/what conch offers and c.j.s does what you need.
05:19AtKaaZSgeo, maybe I should add the resolve test too? since I like defensive programming :)
05:19tgoossenswhat i need is
05:19tgoossensexecute a command
05:19tgoossensshow result
05:20tgoossensa "repl" for shell
05:20SgeoAtKaaZ, just be aware of namespacing issues
05:20RaynesThat isn't defensive programming. That's bizarre programming.
05:21RaynesMight as well check the type of all your integers *just to be sure*, and convert from strings and stuff *just in case*.
05:22AtKaaZI see what you mean
05:34clojurenewbhi guys, I'm looking for a nice way to process some keys in a map depending on the key name… its the age old serialisation treating everything as strings problem… one example, I'd like to convert {:a "one" :b "2" :c "3"} to {:a "one" :b 2 :c 3}, so only process keys :b and :c
05:36alex_baranoskyclojurenewb: if it is depending on key name… then just bond on the key names
05:36alex_baranoskyor is it on the value type?
05:37clojurenewbalex_baranosky: its on the key name, and it will always be from string to long
05:37tomojclojurenewb: I'm doing the same thing today
05:38ejacksonclojurenewb: you could use select-key to extract the subset you want , convert them all, and then merge wit the original map to 'overwrite'
05:39ejacksonselect-keys rather
05:39alex_baranosky(into {} (for [[k v] my-map] (cond (= :foo (class k)) (some-fn v) (= :bar (class k)) (other-fn v) :else ….))))))
05:39clojurenewbcool, I'll take a look thanks
05:39alex_baranoskyYou can only use select-keys if you know the keys
05:40alex_baranoskyI need more details to narrow down your options
05:40clojurenewbyes, I will always know the keys
05:41tomojI wrote this today https://www.refheap.com/paste/6096
05:41clojurenewband it will always be a string to long conversion
05:41tomojI think there is probably something better
05:41clojurenewbfor those select keys
05:42tomoj(update-all map :a #(Long. %) :b #(Long. %))
05:42tomojit uses update-in so also (update-all map [:x :y] #(Long. %)) to handle {:x {:y "1"}}
05:43clojurenewbI'll give it a go
05:43tgoossensI'm using clojure.java.shell/sh to execute shell commands. But commands like: "ls | grep test" gives me Exception in thread "main" java.io.IOException: Cannot run program "ls | grep test": error=2, No such file or directory
05:43tgoossens
05:44mishok13can anybody recommend HTTP user agent parsing library?
05:45mishok13user-agent-utils is not in Maven central or Clojars
05:47AtKaaZI'm getting an error and I notice it doesn't specify the exact line(*) in my source file which I loaded with Alt+Ctrl+L Load File in REPL (in eclipse+ccw): http://pastebin.com/9md7kNV2 is that(*) supposed to happen?
05:47ejacksonclojurenewb: if f is a the function that converts "one" to 1, then this will sort you (reduce (fn [om k] (update-in om [k] f)) m keys)
05:48tomojhmm
05:48tomojupdate-all seems silly, at least the implementation
05:49ejacksonreduce might be better ?
05:52tomojmaybe it should be (update-all [m kss f & args])
05:52clojurenewbejackson: I am pushing the limit of my understanding with your idea there.. can't figure out how to apply it
05:52tomoj(-> m (update-all [:a :b [:x :y]] #(Long. %)) (update-all [:date] parse-date))
05:52ejacksontomoj: yeah, if f is always the same.
05:53tomojer, the last one is silly ofc :)
05:53wei_how do you pass data structures to clojurescript upon initial load of your page? (e.g. not with remotes)
05:54tomojgood question
05:54tomojif you are advanced compiling, it seems difficult?
05:54ejacksonclojurenewb: https://www.refheap.com/paste/6097
05:55clojurenewbI see
05:55clojurenewbthx!
05:56AtKaaZregarding my previous error, that's what shows when I forget to add [] vector to the (defn x (println "some"))
05:56tomojwei_: the reader appears to be implemented in cljs
05:57tomojso, one possibility is to render something like `var data = "{:foo 3}";` in separate js file you serve
05:57tomojthen later in your cljs you could read it..
05:58wei_aha i see. thanks.
06:12clgvwhy are line breaks not matched by `re-find`? e.g. ##(re-find #"<bla>(.*)</>" "<bla>lala lulu\nlili</>")
06:12lazybot⇒ nil
06:12clgvwithout linebreak it works (re-find #"<bla>(.*)</>" "<bla>lala lulu lili</>")
06:12clgv&(re-find #"<bla>(.*)</>" "<bla>lala lulu lili</>")
06:12lazybot⇒ ["<bla>lala lulu lili</>" "lala lulu lili"]
06:14_ulisesclgv: there's a switch in perl regexps to match across \n; not sure what the switch in java would be though; point is: you're probably missing that switch
06:14_ulisesclgv: in perl you'd do /regexp/g <- the g there tells the engine to match across lines
06:14_ulisesi.e. globally
06:20AtKaaZMultiline mode can enabled via (?m). from here: http://nakkaya.com/2009/10/25/regular-expressions-in-clojure/
06:20clgv_ulises: ok. you are right. unluckily clojure re-pattern function has no support for options. thus I have to use Pattern class directly
06:20AtKaaZbut someone tell me where do I need to put that to work
06:21magnarsThanks for all the suggestions for naming the function (and (some pred list) (some (not pred) list)) ... right now the one I like best is (only-some pred list) - what do you think?
06:23alex_baranoskymagnars: that name isn't obvious to me
06:23alex_baranoskymagnars: what did you think of `at-least-one`
06:23AtKaaZ,(re-find #"(?sm)<bla>(.*)</>" "<bla>lala lulu\nlili</>")
06:24clojurebot["<bla>lala lulu\nlili</>" "lala lulu\nlili"]
06:24magnarsat-least-one isn't correct, since it would be true for a collection where all match
06:24alex_baranoskyah… its at-least-one-but-not-all … and that name is no good :)
06:24AtKaaZ(?s) In dotall mode, the expression . matches any character, including a line terminator.
06:24magnarsbit verbose maybe :)
06:25AtKaaZ,(re-find #"(?s)<bla>(.*)</>" "<bla>lala lulu\nlili</>")
06:25clojurebot["<bla>lala lulu\nlili</>" "lala lulu\nlili"]
06:25alex_baranosky`some-match-some-fail`
06:25_ulisesmagnars: how about one+-!all ;)
06:25clgvAtKaaZ: ah nice find :)
06:26alex_baranosky_ulises: fancy stuff
06:26_ulisesalex_baranosky: if by fancy you mean unreadable, then yes :D
06:26magnars_ulises: hehe :-) the best names I've found so far are disparate, varies, mix-of and only-some
06:27hyPiRionUh, that's not XML, is it?
06:27hyPiRion(Just a question)
06:27alex_baranoskymagnars: I personally wold go for more verbosity
06:28magnarsalex_baranosky: that's a valid opinion for sure. I'll give it some more thought.
06:28clgvhyPiRion: not it's borrowed from xml notation to add parameter docs in a docstring
06:28alex_baranoskymagnars: … because none of those names are understandable without reading the implementation… …. but that might be unavoidable
06:28clgvclgv: I just noticed that I do not support multiline docs for params
06:29hyPiRionclgv: Okay. It's kind of dangerous to parse this with regex though. might want to either find a lib or make a parser for it.
06:29hyPiRionTalking from own experience ;)
06:29clgvhyPiRion: why? because of errors in the string?
06:30hyPiRionclgv: http://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not
06:30mpanbtw guys, there was someone asking about clojure on hn but they seemed a little confused about what clojure is or isn't
06:30mpanso if someone wants to go and give them some pointers, http://news.ycombinator.com/item?id=4691615
06:30clgvhyPiRion: I do not want to parse html ;)
06:30hyPiRionIt really depends on what implementation you have though.
06:31clgvI just want to extract parameter descriptions from a "well formed" doc string. if the user makes errors he will see them ;)
06:31mpanI'm a bit too confused by what they said to really know what to say to them
06:31hyPiRionclgv: ah, then it should be okay.
06:32hyPiRionI suppose.
06:46kaoDhi
06:46mpanhi
06:49unnalihi
07:08wingyperhaps in an ideal scenario the functions will be immutable as well?
07:08wingyi mean saved throughout time
07:09wingynvm .. wild fantasies
07:19_uliseswingy: saved through time?
07:19wingyin a database
07:20AtKaaZyou can already in datomic no?
07:20wingymany many years from now we will have a central bank with all data logging everything
07:20_uliseswhat do you mean by saving a function through time? it's body? or?
07:20wingyyeah we can .. it all started with Rich!
07:20wingyhe is like John Conner
07:20wingywithout realizing it
07:20clgvwingy: I hope not to live in such a 1984 world ^^
07:20wingy_ulises: saving a the function so you can look at its body and also use it in your program like anything saved in datomic
07:22_ulisesah, gotcha
07:22_ulisessaved the function not in a local file but in a remote location but still be able to execute it, etc.
07:22_ulisessounds a lot like RPC
07:22_ulisesbut not quite
07:23wingyno i mean you fetch it like any data from the db then you exectute it in memory as usual
07:24mishok13I can't get simplest Java import to work properly in Clojure -- could somebody take a look at this: https://gist.github.com/3945518 ?
07:24wingybtw regarding code is data .. would it be okay to save functions then in a db to do what i just said?
07:25babilenHi all -- What is the fastest way to build a map from two sequences (key-seq and val-seq) ? val-seq is a reducer (from r/map mapped over key-seq) -- I essentially want a mapping key → f(key), but folding into a map is horribly slow, so I am looking for an alternative.
07:25mishok13I've never had any issues with Clojure packages downloaded from Maven/Clojar, but this one I had to install into local repo, that might be causing some issues
07:25wingysince code is data and data can be versionized using datomic .. a logical outcome would be that its okay to save functions if one needs it for some reason
07:25tgoossenswingy: mmyes why not
07:25hyPiRionbabilen: Do you mean like ##(zipmap [:a :b :c] (range 3))
07:25lazybot⇒ {:c 2, :b 1, :a 0}
07:26wingytgoossens: just forgot one caveat .. you can't save a data structure as it is in datomic .. you have to break it down .. forgot that
07:28_uliseswingy: nothing stops you from saving them as mysql blobs
07:28babilenhyPiRion: Yeah, that would be an option, but also strikes me as slower than it could be (due to it not using transients) -- I tried something like (r/fold (r/monoid merge hash-map) ... but that is slow (and not very parallel unfortunately)
07:28_uliseswingy: or even couchdb documents
07:28wingy_ulises: or even strings
07:28_uliseswingy: precisely
07:29babilenhyPiRion: Right now I am tempted to use (assoc! (transient {}) (interleave key-seq val-seq))) but am not sure if this is the best approach.
07:29babilenerr, (apply assoc! ... that is
07:30hyPiRionbabilen: you can do a transient version of the current zipmap-implementation.
07:30hyPiRionIf you lookup the source.
07:31hyPiRionIs the speed an issue in your case, btw?
07:32babilenhyPiRion: Unfortunately it is (i benchmarked it) ... I would, naturally, prefer to just use zipmap (et al.) but I was wondering if I could speed this up.
07:32babilenThe main problem is that reducing into a map is slow (which comes up once in a while on the mailing list too), but using at least a transient version of zipmap would help. I don't quite understand though why zipmap is *not* transient by default.
07:34hyPiRionbabilen: no transient! and persistent! in 1.0, and it worked fine, so why bother changing it?
07:34AtKaaZmishok13, that works for me with this set prior to running mvn command: JAVA_HOME=c:\Program Files\Java\jdk1.7.0_06 on win7 64bit
07:34babilenhyPiRion: Well, perfomance comes to mind. ;)
07:34AtKaaZmishok13, also using this mvn apache-maven-3.0.4
07:35babilenhyPiRion: I'll play a little
07:35hyPiRionbabilen: Try it out with reducing over a synchronized HashMap
07:36hyPiRionto check what the maximal performance with mutability is.
07:37babilenhyPiRion: I don't quite understand what you mean by that, could you elaborate a little?
07:38hyPiRionbabilen: Screw the synchronized part: Check out the speed difference over (do (.put hm k v) hm) rather than (assoc! hm k v)
07:39hyPiRionhttp://docs.oracle.com/javase/1.5.0/docs/api/java/util/HashMap.html
07:40Kneferilisanyone had experience with LiveCode?
07:40babilenhyPiRion: Ack, thanks!
07:43wingywhere can i find a list of all keys i can have in a meta data for functions?
07:47mpanhm? I thought you could set whatever you wanted
07:47mpanif you mean which keys have special significance, I'd be interested in knowing that too
08:00AtKaaZwingy: http://clojure.org/special_forms but they are not all, at least :column isn't there
08:01AtKaaZ,(keys (meta (resolve '+)))
08:01clojurebot(:ns :name :file :line :arglists ...)
08:02wingyim searching for a :see or :see-also meta data key for redirecting to a external homepage
08:02wingythe worse part is that the reference doc is not complete .. if one cant get that info from clojure homepage, where can one get it
08:02wingya full list of all meta data keys you can use would be great
08:02AtKaaZit's in the :doc in the case of +
08:02AtKaaZ,(:doc (meta (resolve '+)))
08:02clojurebot"Returns the sum of nums. (+) returns 0. Does not auto-promote\n longs, will throw on overflow. See also: +'"
08:03AtKaaZnevermind :)
08:03wingyi recall there is a special key for it
08:03wingy,(:doc (meta #'+))
08:03clojurebot"Returns the sum of nums. (+) returns 0. Does not auto-promote\n longs, will throw on overflow. See also: +'"
08:03AtKaaZ,(meta (resolve 'cl-format))
08:03clojurebotnil
08:04AtKaaZ:see-also [["http://whatever&quot; "Common Lisp the Language"]
08:06AtKaaZwingy: http://pastebin.com/bkRjp72a
08:06wingyAtKaaZ: thx!
08:09AtKaaZhmm it's the only use of :see-also in the entire clojure sourcecode ##(:see-also (meta (resolve 'clojure.pprint/cl-format)))
08:09lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
08:09antares_anyone in here going to the Conj?
08:10clgvwingy: define a function (defn f [x] ) in your file, eval it and use (-> #'f meta keys)
08:12wingyclgv: yeah .. i can get some of them that way
08:12clgvwingy: the othey keys are customly added in the definition form
08:12clgv*other
08:13wingyso :see-also is just a custom one?
08:13AtKaaZwingy, probably, since nothing else in clojure code uses it, except cl-format
08:13clgvwingy: yeah. I dont know where you found that one. it's probably for some documentation generation tool
08:13wingyokay
08:14wingyi forgot that clojure is an interactive platform .. everything you wanna check you check in the running instance
08:14AtKaaZ,(use 'clojure.pprint)
08:14clojurebotnil
08:14AtKaaZ,(:see-also (meta (var clojure.pprint/cl-format)))
08:14clojurebot[["http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node200.html#SECTION002633000000000000000&quot; "Common Lisp the Language"] ["http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm&quot; "Common Lisp HyperSpec"]]
08:17antares_anyway, if someone in here is going to the Conj, consider hosting an unsession on documentation: https://github.com/relevance/clojure-conj/wiki/Clojure-conj-2012-Unsessions
08:17antares_unlike monads and codeq, any progress with documentation benefit the entire Clojure community
08:17antares_*benefits
08:17antares_but I won't be at the conj so I can't host it
09:54samaarondoes anyone know how to set the java.library.path in CCW?
09:55ejacksonsamaaron: what ? oh wait... tomorrow :)
09:55AtKaaZsamaaron: with leiningen support?
09:56samaaronAtKaaZ: well, lein 2 should do this for you automagically, but it doesn't appear to in CCW
09:56samaaronalso, I tried adding a :native-path key to my project.clj but CCW seemed to ignore that too
09:57pandeiroi need to recurse through nested maps and do arbitrary modifications to some strings - which functions can help me?
09:57AtKaaZbut you still have to use lein to make .jars right?
09:57samaaronI'm just not sure if I want to introduce devs to *both* Emacs and Clojure in a workshop
09:58samaaronAtKaaZ: to be honest, I have no idea how CCW interacts with lein
09:58samaaronpandeiro: you might want to take a look at zippers
09:59pandeirosamaaron: i had an inkling zippers were relevant, thks
09:59samaaronpandeiro: np
10:00AtKaaZsamaaron, I didn't try much but I found that I had to use lein uberjar to create the jar, ccw wasn't enough, :native-path should've been it I think, wonder if it's obsolete now
10:00samaaronAtKaaZ: it doesn't appear to be obsolete in pure lein-land
10:00samaaronI'm just guessing that CCW doesn't support everything lein supports
10:01AtKaaZsamaaron, you're right it's not obsolete, :native-path "target/native"
10:01uvtcsamaaron: re. new users and Emacs vs. Eclipse; maybe have a peek at jEdit ... which recently got some Clojure indenting support. I made a note about it at http://clojure-doc.org/articles/ecosystem/development_tools.html#jedit
10:01AtKaaZsamaaron, maybe you can set it using :jvm-opts ["-Xmx512m"] ...?
10:02samaaronuvtc: how easy is it to get jEdit set up on a new machine - and does it support lein integration, docstring completion, partial compilation etc?
10:03uvtcsamaaron: As far as I know, it's just syntax highlighting and now indentation support. But I'm not a regular jEdit user. Perhaps someone else would know if it supports what you're looking for.
10:03AtKaaZsamaaron: https://code.google.com/p/counterclockwise/issues/detail?id=343
10:03samaaronAtKaaZ: I'm not sure that would work - the java.library.path gets passed as the argument to -D to the java command
10:03uvtcsamaaron: jEdit is written in Java, so, you just run its installer jar to install.
10:03samaaronuvtc: I'm really just looking for CCW with support for native deps
10:04uvtcsamaaron: check
10:04samaaronbut perhaps I'll have to look elsewhere
10:04samaaronargh
10:12lynaghk`Is it possible to access a protected field of a Java class from a subclass made in Clojure via proxy?
10:12lynaghk`The field is "printer", and I've tried (.printer this) within the method that I'm overriding but I'm not having any luck.
10:13ejacksonlynaghk: I had this issue about 2 years ago, and at that time the answer was no.
10:14lynaghk`ejackson: how'd you end up getting around it? Subclassing yourself in Java?
10:14ejacksonedited the java to make the field public :)
10:14ejacksonthree cheers for open source
10:14lynaghk`wahhhhhh
10:15AtKaaZsamaaron, it's working for me with :native-path it extracted the .dll files found in the .jars in the folder that I specified
10:15samaaronoh really?
10:15samaaronwhat did you put?
10:15samaaronwas it the full path?
10:15ejacksonit may have gotten fixed since then. Actually, I mis-recall, I was not using proxy but gen-class. Close.
10:16samaaronI didn't try that
10:16AtKaaZsamaaron: i added this line to project.clj :native-path "native2"
10:17lynaghk`ejackson: I'm not an expert on Java keywords, but my understanding is that "protected" fields should be acessible by subclasses. So does proxy not make a "real" subclass?
10:17samaaronnative2?
10:17AtKaaZsamaaron: and after save it made a native2 folder in project and all .dll are there from ie. in my case from jme3-lwjgl-natives...jar
10:17AtKaaZsamaaron: just a name for a folder "native2"
10:17samaaronoh ok - but can CCW see that?
10:17ejacksonlynaghk: I got nothing, dude. Not java fluent.
10:17samaaroni.e. does CCW set the java.library.path to native2
10:17AtKaaZlet me check
10:18lynaghk`ejackson: okay, thanks dude. I'll just give it a crack in Java-world.
10:18ejacksonlynaghk: is it static ? Have you tried this/printer
10:19AtKaaZsamaaron: i ran this in repl but it's nil ##(java.lang.System/getProperty "java.lang.library")
10:19lazybotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.lang.library read)
10:19AtKaaZsamaaron, oops, i corrected but native2 doesn't seem to be in the list
10:20AtKaaZ(java.lang.System/getProperty "java.library.path")
10:21samaaronAtKaaZ: yep, same here
10:25lynaghk`ejackson: this/printer throws "no such namespace: this"
10:30AtKaaZsamaaron, it's a bad hack but you can set it like so: :jvm-opts ["-Xmx512m" "-Djava.library.path=native2/"]
10:30AtKaaZthing is, it overwrites the previous value
10:31samaaronoh, really...
10:31samaaronawesome
10:31AtKaaZoh wait, it only works in lein (retesting)
10:31AtKaaZyep, only in command line lein :/ not in ccw
10:31samaaronargh
10:33AtKaaZmaybe you can do this: https://groups.google.com/d/msg/leiningen/2OZQPMi3cks/DPfsUVJ78hwJ
10:33AtKaaZthe extract is what :native-path already does
10:36samaaronAtKaaZ: oh, that might work...
10:36AtKaaZI think :native-path is meant to only do extract, nothing about setting that var; :native-path "src/native" ; where to extract native dependencies
10:38samaaronAtKaaZ: ha - success, I just needed to (System/setProperty "java.library.path" "target/native/macosx/x86_64")
10:38samaaronlaurentpetit: howdy
10:38samaaronI got overtone working by (System/setProperty "java.library.path" "target/native/macosx/x86_64")
10:44ejacksonsamaaron: I didn't know you could do that dynamically
10:44samaaronejackson: seems that you can :-)
10:54clgvsamaaron: ejackson: but might be safer to add that path instead of set it as only one
10:54samaaronclgv: oh, sure
11:22arrdemis there a clean way to accumulate values across several macros? say I wanted to define `mydef` such that it will expand into a def and add a key/val pair to some shared map
11:23arrdemhow would I acheive the side-effect of re-defining the map?
11:25ynnivso, is sharing code between clojure and clojurescript really this annoying?
11:26llasramarrdem: Check out the Clojure core implementation of protocols, specifically `extend`. It's not really a common idiom, but that's probably the closest
11:26ejacksonlynaghk: sorry, I meant use the classname for whatever this is.
11:27dnolenynniv: yes. are you using one of the various work arounds that people have built?
11:28ynnivI'm hoping not to, but it doesn't look like that's going to happen
11:28ynnivwhat's the favorite so far?
11:29dnolenynniv: lein-cljsbuild has some facilities. I don't know much about it though.
11:45BaldandersSo, I've been having some real problems with Leiningen getting jars from the maven repos, and I'm wnodering if anyone else has seen this or knows what to do about it. It takes a tremendously long time- I have had to leave it running overnight. And in some cases it is just failing to get jars. I'm specifically trying to get the deps for noir right now, but the slowness was happening even when lein was trying to get its own d
11:45Baldanders(though it did eventually get all of them, after several hours of gringing away. Any ideas?
11:46stankleyBaldanders: Hmmmm...
11:46BaldandersI'm on a windows 7 machine, btw, and my internet connection is otherwise fine.
11:46stankleyBaldanders: When was this, specifically?
11:47stankleyBaldanders: And are you still having problems?
11:47BaldandersI didd find this issue on the leiningen site: https://github.com/technomancy/leiningen/issues/534
11:47BaldandersI installed lein on Monda morning, I think. It has been consistent since then.
11:48BaldandersBut that issue is marked closed, as I guess they got some miror support into Leiningen that fixed it.
11:49BaldandersIt could just be a problem with the maven repos it is trying to use, but I would expect that if that were the case a lot of people would be seeing it.
11:50stankleyBaldanders: Yeah, that sucks. I started doing all my Clojure development in Virtual Machines, I don't know what you're working on, but check out my repo for a Vagrant VM: https://github.com/burningion/emacs-clojure-vagrant
11:50stankleyEmacs 24, Leinengen, Chef, and PostgreSQL
11:50stankleyMakes everything easy in my experience, YMMV
11:51stankleyHaven't had any slowness working in Linux
11:55Baldanders Hmm- well for the noir stuff I want to do I could do it in a VM, but there is some other stuff I want to do with Clojure that reaelly needs good performance, and the development really should be done under Windows.
11:55BaldandersBut may check out the VM you posted for the noir stuff, which is my more immediate priority. Thanks.
11:56BaldandersIt would be nice to figure this out though, as it makes using Leiningen basically imposiible for me, and I don't think I did anything wrong to cause it.
11:57BaldandersBut if no one here has any idea, maybe I should post to the leiningen group.
11:57BaldandersAnyway, thanks again.
11:57stankleyBaldanders: Feel you. Yeah, I would post to the group.
12:44bdeshamI'm looking for a function that will do "map" on the values of a map
12:45bdeshamso (my-function #(* 2 5) {:a 3 :b :4 :c 5}) -> {:a 6 :b 8 :c 10}
12:45bdeshamoops, should be #(* 2 %)
12:48dnolenyou know if the CLJS compiler would AOT it would probably be a lot faster ...
12:48bdesham,(apply hash-map (flatten (for [[k v] {:a 3 :b :4 :c 5}] [k (* 2 v)])))
12:48clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>
12:48bdesham,(apply hash-map (flatten (for [[k v] {:a 3 :b 4 :c 5}] [k (* 2 v)])))
12:48clojurebot{:a 6, :c 10, :b 8}
12:48bdeshamI'd like something without flatten though
12:50S11001001bdesham: put your map in a real map instead and change map to mapcat
12:50jkkramer,(into {} (for [[k v] {:a 3 :b 4 :c 5}] [k (* 2 v)])
12:50clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
12:50S11001001bdesham: you can also write this: (for [[k v] ... r [k ...]] r)
12:50jkkrameror use https://github.com/flatland/useful/blob/develop/src/useful/map.clj#L47
12:51S11001001jkkramer: that's much better, I didn't even read the whole expr :)
12:51bdeshamah, I know I've used (into {} ...) before but I forgot about it
12:51bdeshamthanks all!
12:53Iceland_jack,(into {} (for [[k v] {:a 3 :b 4 :c 5}] [k (* 2 v)]))
12:53clojurebot{:a 6, :c 10, :b 8}
12:56jkkramerthere must be a clojurebot quip for that
12:56jkkramer~map-vals
12:56clojurebotCool story bro.
13:08jsabeaudrywhat triggers the "Cool story bro." trolling?
13:08TimMcjsabeaudry: One of many "I don't have a factoid for that" responses.
13:08gfredericksI think it's just one of the things he says when he doesn't know what to say.
13:09gfredericksclojurebot: right?
13:09clojurebotto be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks
13:09jsabeaudryhahahah love it
13:10riddochcJust did a brew install clojure; brew install leiningen at work. Wish me luck. ;)
13:16antoineBhello, i don't remmember well thread and java,
13:16antoineBi want to build a backgroup thread that do some work, then sleeps in an infinite loop
13:17antoineBneed i just need Thread/sleep, or need i some extra instruction, to say to the scheduler that don't prorityze this thread?
13:17riddochcantoineB: look at futures.
13:18antoineBthe thread run indefinitly, so its not a future case
13:18riddochcEr, sorry, not futures, I don't know what I'm talking about. ;)
13:18AtKaaZantoineB: (.start (Thread. #(do (println 1) (Thread/sleep 1000))))
13:18riddochcI'm *fairly* sure clojure has what you're looking for built-in already.
13:19nDuffantoineB: there's a Timer/TimerTask in abstraction that Java has built in.
13:19technomancynothing wrong with falling back to java for this
13:19nDuffantoineB: I have a little helper built around it -- if you're interested, I can find it.
13:19AtKaaZnDuff, I'm interested
13:20nDuffhttps://gist.github.com/a7d911dc0df88c3c3c8f
13:21antoineBnDuff: super, thanks
13:22nDuff...actually, I left some helpers out of that. Revising...
13:23riddochctechnomancy: nothing wrong with it, agreed… it's also good to know what's in the clojure ecosystem anyway.
13:24riddochc…To the degree that one finds practical. (I'm trying to learn from simple v. easy)
13:25technomancyriddochc: I just mean that Clojure explicitly doesn't bother implementing certain things when Java does an actually decent job of them
13:26riddochcYeah. I just thought it's possible antoineB's could use something more specific.
13:26nDuffantoineB / AtKaaZ: Updated that with a helper for shutdown and an example.
13:26riddochc*shrug*
13:26AtKaaZthanks nDuff, still trying to understand it xD
13:26nDuffAtKaaZ: Feel free to ask any questions.
13:28AtKaaZnDuff: roger, for now I figured out I need to (import [java.util TimerTask Timer]) and define logger
13:29nDuffAhh, right. Sorry 'bout that.
13:29ohpauleezlynaghk: ping
13:29AtKaaZno need, I'm an abnormal (ie. newbie) clojure user :)
13:35AtKaaZnDuff, that's pretty cool ! just tested it
13:36jamiiThis is confusing me - https://gist.github.com/3947508
13:36jamiiMaybe something to do with classes being redefined?
13:37AtKaaZif you do a (class ...) to each what's it say? I'd try it but I'm missing that lib
13:41jamiiAtKaaZ: user> (class (pattern ?n))
13:41jamiistrucjure.pattern.Bind
13:41jamiiuser> (class #strucjure.pattern.Bind{:symbol n})
13:41jamiistrucjure.pattern.Bind
13:41jamiiuser> (= (class (pattern ?n)) (class #strucjure.pattern.Bind{:symbol n}))
13:41jamiifalse
13:41jamiiSorry, should have put that in the gist
13:43dnolenjamii: yeah if those aren't equal a problem w/ redef
13:44jamiidnolen: ok, I guess I'll just restart the repl
13:44AtKaaZwas there some *flag* that would make = also compare meta ?
13:51AtKaaZcould someone add an example here: http://clojuredocs.org/clojure_core/clojure.core/*print-meta*
13:52AtKaaZI tried to create an example in my repl, but it won't work
13:52S11001001AtKaaZ: paste example here
13:53AtKaaZS11001001, I tried several, pasting one ##(binding [*print-meta* true] print meta)
13:53lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
13:53AtKaaZ,(meta (var meta))
13:53clojurebot{:ns #<Namespace clojure.core>, :name meta, :arglists ([obj]), :added "1.0", :static true, ...}
13:54S11001001,(binding [*print-meta* true] (pr #'meta))
13:54clojurebot^{:ns #<Namespace clojure.core>, :name meta, :arglists ^{:line 196} ([obj]), :added "1.0", :static true, ...} #'clojure.core/meta
13:54AtKaaZon nice, only with pr i see
13:54S11001001,(print "hi")
13:54clojurebothi
13:55S11001001AtKaaZ: as you can see, print is utterly inappropriate for forms
13:55AtKaaZthank you
13:55S11001001pr/print dichotomy is like write/display dichotomy in scheme, repr/str in python
13:55rbxbxDoes Clojure provide any hooks/listeners/etc to trigger an action when a source file is loaded or reloaded ?
13:55ToBeReplacedtechnomancy: do you still develop and/or use radagast?
13:55AtKaaZS11001001, I know none of those
13:56rbxbxGoogling has failed me, but perhaps I've googled the wrong things.
13:57S11001001AtKaaZ: do you know any other languages with a generic print that prints strings in syntax suitable for string literals within that language?
13:58AtKaaZS11001001, do you mean like prints "a" as "a" not a ?
13:59nDuffS11001001: bash has its printf %q
13:59nDuff(though with the paucity of data types there, that hardly counts)
13:59TimMc,(print "a\\b") ;; AtKaaZ
13:59clojurebota\b
13:59ohpauleezdnolen: https://github.com/ohpauleez/core.logic/commit/1250ef7960540eae4d4c0412b1d157f172b3f61e
14:00AtKaaZS11001001, are you referring to pr-like print functions?
14:00ohpauleezpartial-map and easy unification ported
14:00S11001001AtKaaZ: yes
14:00ohpauleezOnce I get it cleaned up, I'll give you the patch
14:00dnolenohpauleez: that is awesome
14:00AtKaaZS11001001, cause those were some big words for me haha, I don't think that I know any though
14:01S11001001Ok.
14:02AtKaaZ,(pr "a")
14:02clojurebot"a"
14:03dnolenohpauleez: thanks, will definitely love to get that in the next 0.8.0 beta
14:03ohpauleezdnolen: I also have a ported clojure.pprint which I'll have a ticket and patch for on CLJS dev
14:03dnolenohpauleez: rad
14:03ohpauleezdefinitely, I think I can get it together for you for the next beta - should be all cleaned up by tomorrow the latest
14:05AtKaaZI'm curious to know the answer to rbxbx's question though, that reminds me of *compile-files* and possibly the fact that you can put code to be executed on reload in the ns
14:05uvtcI'm trying to get a simple Compojure + Hiccup app running, one which has two source files: src/test_app/{handler,views}.clj. However,
14:06uvtcI'm getting this exception: Parameter declaration hic-p/html5 should be a vector
14:07rbxbxAtKaaZ just leave the code bare in the file and it would run open being loaded is what you're suggesting?
14:07uvtcHere's the code:
14:07uvtchttps://gist.github.com/3947728
14:07AtKaaZrbxbx, something like that, I have a (println "loaded" *ns*) in my file
14:08rbxbxAtKaaZ hmm. That may work. Thanks :)
14:09rbxbxAtKaaZ: I was thinking about having the "listener" living outside that file, but maybe I'm just thinking about things wrong.
14:09uvtcAfaict, I'm passing hic-p/html5 just vectors...
14:10AtKaaZrbxbx, i think you can do that too, but the trigger will happen by calling some code within the file that's being (re)loaded
14:10AtKaaZnDuff, what is expected after the fn ? something like :key value on line 24
14:10AtKaaZnDuff, I should say this: {:keys [exception-handler]}
14:10rbxbxah
14:11nDuffAtKaaZ: That's an optional keyword argument, for if you want to provide your own exception handler rather than just sending it straight to log4j
14:12AtKaaZlog4j, that explains why I shouldn't have used java's Logger
14:12jkkrameruvtc: home-page is a defn without arguments. you want to add arguments or use plain def
14:13uvtcOh my goodness.
14:13patchworkAnyone have any idea why suddenly my cheshire (latest, 4.0.3) can't find org.codehaus.jackson.smile.SmileFactory?
14:13patchworkIt worked yesterday!
14:14jkkrameruvtc: I make that mistake regularly
14:14AtKaaZrbxbx: I was thinking like (send agent reloaded) but you'd have to put this line in every namespace(aka clj file) that you want to trigger, wonder if there's a way to include that code and be executed for each file, maybe a macro of the (ns ...)
14:14emezeskeuvtc: Totally unrelated to your problem, but did you know you can write [:div#header ...] instead of [:div {:id "header"} ...] ?
14:14uvtcjkkramer: thanks. I was staring right at that one without seeing it. :)
14:14rbxbxAtKaaZ that might start to get into dark magic though ;)
14:14AtKaaZnDuff, I would provide the ex handler as the value ? in :key1 value
14:15uvtcemezeske: Right. Thanks.
14:20nDuffAtKaaZ: :exception-handler your-handler-here, yes.
14:22AtKaaZnDuff, I didn't know how that destructuring worked, thanks
14:32wingyim trying to make a fn that is passed an XML map and returns the XML string
14:33wingyhttps://github.com/clojure/data.xml uses a FileWriter, I guess I need to use the java.io.StringWriter though
14:34wingybut I don't know how it works .. tried this https://www.refheap.com/paste/6105 without success .. could someone help out
14:34rbxbxwingy: can you just call (str map) ?
14:35S11001001wingy: you need to actually get the stuff you wrote into the stringwriter
14:35emezeskewingy: Did you see clojure.data.xml/emit-str ?
14:35emezeskewingy: https://github.com/clojure/data.xml/blob/master/src/main/clojure/clojure/data/xml.clj#L340
14:35wingyrbxbx: but that wont give me a xml string
14:36rbxbxah yes, emezeske's advice looks much better
14:41wingythat one seems to work only if i have created the xml data structure with xml/element
14:41wingyhmm
14:41wingybut perhaps that's what i want
14:42wingyi thought clojure map -> xml string .. but perhaps what i need to do is to create the clojure xml with xml/element like in the examples
14:46jonasenIf I recur from a multimethod, is the call going through the dispatch function or is the recur target the same method?
14:47AimHereYou could always test that
14:47wingyjonasen: i bet on the same function
14:48AimHereI know I'm going to!
14:49hiredmanjonasen: the same method
14:50jonasenhiredman: ok, thanks. That explains my infinite loop :)
14:51AtKaaZhow can I say (if undefined(symbol) then return {:undef nil} else {:defined symbol}) but the entire if block fails if the symbol is undefined because of the {:defined symbol} part
14:52jonasenhttps://gist.github.com/3948008
14:52bdeshamAtKaaZ: are you getting an exception? you could use (try ...) if so
14:53wingyjonasen: you dont have a exit strategy?
14:53wingyso it will run forever
14:53Sgeo,(special-symbol? 'loop*)
14:53clojurebottrue
14:53zerokarmaleftz[ ] Transfer Higher One to BoA
14:53AtKaaZbdesham, yes RuntimeException: Unable to resolve symbol, that might be a way indeed, I was hoping for another
14:53Sgeo,(special-symbol? 'recur)
14:53clojurebottrue
14:54wingyjonasen: https://gist.github.com/3948018
14:54wingytry and see if it will run forever
14:54AtKaaZbdesham, if I use that I could make the macros be functions... worth thinking about it
14:54bdeshamAtKaaZ, under what conditions would you have something that might be undefined? (I can understand that something might be nil, but undefined?)
14:55SgeoAtKaaZ, use &env to look up the symbol in the lexical environment and use resolve to check if it's in the dynamic environment?
14:55AtKaaZbdesham, say some exception happens and some defs weren't reached, I might test that in another ns
14:56jonasenhiredman: Do you know why it's that way? It's not what I expected
14:56AtKaaZSgeo, &env?
14:56SgeoAtKaaZ, in a macro, &env is a map where the keys are lexically defined symbols and the values are... just ignore those
14:57hiredmanjonasen: it falls out of the implementation of recur and multimethods
14:57AtKaaZSgeo, ok cool I'll check that more
14:57Sgeohttp://ideone.com/z6MTLx
15:00AtKaaZwow
15:02jonasenhiredman: Ok, no more recur+multimethods for me then
15:03jlewisis there an obvious builtin that gives you a list of all of the suffixes of a list? e.g. '(1 2 3) -> '((1 2 3) (2 3) (3))
15:04antares_dakrone: hey
15:05Sgeo,(clojure.lang.Compiler/specials)
15:05clojurebot{deftype* #<DeftypeParser clojure.lang.Compiler$NewInstanceExpr$DeftypeParser@75d7d567>, new #<Parser clojure.lang.Compiler$NewExpr$Parser@3a2371c0>, quote #<Parser clojure.lang.Compiler$ConstantExpr$Parser@614951ff>, & nil, var #<Parser clojure.lang.Compiler$TheVarExpr$Parser@3a8ff4b0>, ...}
15:05llasramjlewis: ##(take-while seq (iterate rest '(1 2 3)))
15:05lazybot⇒ ((1 2 3) (2 3) (3))
15:05Sgeo,(-> (clojure.lang.Compiler/specials) keys)
15:05clojurebot(deftype* new quote & var ...)
15:06Sgeo,clojure.lang.Compiler/specials
15:06clojurebot{deftype* #<DeftypeParser clojure.lang.Compiler$NewInstanceExpr$DeftypeParser@75d7d567>, new #<Parser clojure.lang.Compiler$NewExpr$Parser@3a2371c0>, quote #<Parser clojure.lang.Compiler$ConstantExpr$Parser@614951ff>, & nil, var #<Parser clojure.lang.Compiler$TheVarExpr$Parser@3a8ff4b0>, ...}
15:06jlewisthanks! just what i was trying to think of.
15:06SgeoHmm, why does parenthesizing not make it try to sue it as a function?
15:07amalloy,(macroexpand-1 '(clojure.lang.Compiler/specials))
15:07clojurebot(. clojure.lang.Compiler specials)
15:07AtKaaZSgeo, worked but looks like those were the keys
15:09SgeoAtKaaZ, hmm? The values of &env are internal stuff that I don't understand
15:10Sgeo,clojure.lang.Compiler/SOURCE
15:10clojurebot#'clojure.core/*source-path*
15:10Sgeo,clojure.lang.Compiler/LOADER
15:10clojurebot#<Var: --unnamed-->
15:11Sgeo,clojure.lang.Compiler/NO_RECUR
15:11clojurebot#<Var: --unnamed-->
15:11SgeoHmm, I don't entirely understand the difference between Var.create() and Var.create(null(
15:11Sgeo* Var.create(null)
15:14Sgeo,(resolve '.toString)
15:14clojurebotnil
15:14Sgeo,(resolve 'to.String)
15:14clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.ClassNotFoundException: to.String>
15:15Sgeo,(clojure.lang.Compiler/resolveSymbol 'resolve)
15:15clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: resolveSymbol, compiling:(NO_SOURCE_PATH:0)>
15:15Sgeoo.O
15:16Sgeo,(. clojure.lang.Compiler (resolveSymbol 'resolve))
15:16clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: resolveSymbol, compiling:(NO_SOURCE_PATH:0)>
15:16AtKaaZSgeo, ah I meant about this: ,(-> (clojure.lang.Compiler/specials) keys)
15:17AtKaaZcan CompilerException be caught?
15:17antares_hm, what's the best way to check if a namespace is available?
15:17amalloy&(doc find-ns)
15:17lazybot⇒ "([sym]); Returns the namespace named by the symbol or nil if it doesn't exist."
15:30antares_amalloy: thanks
15:32antares_amalloy: wow, apparently there is something called compile-if
15:32antares_&(doc compile-if)
15:32lazybotjava.lang.RuntimeException: Unable to resolve var: compile-if in this context
15:36antares_ok, it is defined clojure.reducers: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L37
15:39hiredmanantares_: I don't think it is intended for general use, it was added to fill a need in reducers
15:39antares_hiredman: I know. I need to extend a protocol only if a library (clojure.data.json is available)
15:39antares_https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33
15:39hiredmanand actually isn't great
15:40hiredmanbecause it sets in stone at compile time (and reducers is aot compiled)
15:40hiredmanantares_: I think I replied to your ml thread
15:40hiredmanprotocols create vars, you can check for the existence of the var
15:41antares_hiredman: what would the name of the var be for clojure.data.json/Write-JSON?
15:41hiredmanantares_: open a repl and check?
15:43hiredman,(ns-publics clojure.core.protocols)
15:43clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.core.protocols, compiling:(NO_SOURCE_PATH:0)>
15:43hiredman,(ns-publics clojure.core.protocols)
15:43clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.core.protocols, compiling:(NO_SOURCE_PATH:0)>
15:43hiredman,(ns-publics 'clojure.core.protocols)
15:43clojurebot{emit-array-impls #'clojure.core.protocols/emit-array-impls, arr-impl #'clojure.core.protocols/arr-impl, InternalReduce #'clojure.core.protocols/InternalReduce, internal-reduce #'clojure.core.protocols/internal-reduce}
15:44hiredman,(for [[k _] (ns-publics 'clojure.core.protocols) :when (map? (deref k))] k)
15:44clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IDeref>
15:44hiredman,(for [[_ k] (ns-publics 'clojure.core.protocols) :when (map? (deref k))] k)
15:44clojurebot(#'clojure.core.protocols/InternalReduce)
15:44hiredmanclojurebot: jerk
15:44clojurebotyou cut me deep, man.
16:01c-jayhey :) is there anything like a language specification for clojure? or something similar?
16:03wingyis json or xml more popular for clojure apps?
16:03dnolenc-jay: there is not
16:04c-jayoh, realy? i was afraid of... i wasn't able to find anything...
16:04c-jaydamn! ^^
16:04c-jayi would like to write a term paper about clojure. but i need a lang. spec. in order to get the language through the approval process
16:05c-jayhowever, thank you
16:05antares_hiredman: thanks, figured it out without checking for interfaces
16:06emezeskewingy: If you're choosing between json and xml, have you considered using clojure forms as a data exchange format? E.g. pr-str and read-string ?
16:07antares_wingy: I don't know a single person who uses XML without some legacy system requiring that
16:07antares_wingy: if you go with JSON, please use Cheshire and not clojure.data.json
16:08wingyantares_: why is that?
16:08wingyim using clojure.data.json atm
16:08wingysince it has clojure.data.xml as well
16:08wingysupervised by clojure team
16:08antares_wingy: because 0.2.0 is not compatible with 0.1.x, the entire public API has changed
16:08wingyemezeske: yeah ill use it between my frontend and backend
16:09emezeskewingy: Oh, this is for a public API?
16:09antares_wingy: cheshire is not likely to go through any breaking changes at 4.0, definitely not changes like clojure.data.json
16:09tomojwhat the heck? in some code I have (reset! debug [f v (map f v) (class v)]) (I know, I know :(). later, (last @debug) is PersistentVector, and (let [[f v mapped] @debug] (= (map f v) mapped)) is false
16:09wingyemezeske: yeah .. also i am using services, some support xml, some json .. and i was curious about which one i would actually prefer on clojure land
16:09antares_wingy: I don't understand the clojure.data.xml argument. clojure.data.xml is not similar to clojure.data.json in any way.
16:10antares_besides the name
16:10emezeskewingy: These days I think most people prefer json over xml.
16:10wingyantares_: at least its from the same team
16:10antares_wingy: not the same team at all
16:10wingyoh :)
16:10antares_wingy: each has a maintainer and they probably barely speak to each other
16:10antares_wingy: clojure.data.json 0.2 was a breaking release to a widely used library, without ANY ahead warnings
16:10wingyantares_: so its just about the API changes?
16:10wingyok
16:11antares_wingy: it is about ridiculous maintainership practices
16:11wingyi did a comparison before on speed and cheshire was speedier
16:11antares_and the CA process and general "clojure/core does not have to explain anything, it just does things and community sucks it up" philosophy
16:11antares_performance-wise, I don't think JSON serialization will be a major bottleneck
16:12antares_way back when cheshire was not extensible for custom data types
16:12antares_now it is, see cheshire.custom
16:13wingyantares_: he he did xml as well! :)
16:13tomojthe only explanation I can think of is that my persistent vector isn't persistent, which is.. probably wrong
16:15wingywould it make sense to support yaml and clojure data on my public API?
16:16antares_wingy: anyway, that's just my advice. Monger will have to somehow support all 3, currently supporting 2 is more painful than any other Clojure code I maintain. If I could, I'd drop clojure.data.json support completely but it is too late.
16:16wingyclojure data for clojure apps .. that would be cool .. its not that it requires a lot of coding
16:17amalloytomoj: (= f #(do % (rand-int 10))) is another example
16:17wingyantares_: i am working against an abstraction util/read-json / util/write-json so i can just switch the under the hood implementation
16:18wingya book taught me to work against abstractions, not implementations
16:18wingyfor better maintainability
16:18antares_wingy: that's what we have, too: https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj. Does that look pretty or easy to maintain to you?
16:19wingyantares_: why cant you drop clojure.data.json support?
16:19ToBeReplacedis (korma/sql-only (korma/select my-entity)) meant to return "SELECT \"my-entity\".* FROM \"my-entity\"?
16:19antares_wingy: because Monger has many users?
16:20antares_wingy: and I care about backwards compatibility?
16:20ToBeReplacedthe docs make it look like it's supposed to return "SELECT * FROM my-entity" but that's not what i see when running the docs in the repl
16:20wingyantares_: is there something clojure.data.json is doing that cheshire can't do?
16:21wingyhave i misunderstood .. you are using clojure.data.json under the hood in monger for parsing/stringifying json?
16:21antares_wingy: no. But it does not matter, people are not going to stop doing what they are doing and upgrade everything to Cheshire just because I removed it. They just won't upgrade Monger, ever.
16:21antares_wingy: no, just extending various JSON serializers to support mongodb types and Joda Time dates
16:22RaynesI'm not sure how I feel about the supporting multiple library thing.
16:22RaynesI'm a little concerned about what monger would look like if there were 10 highly used libraries for everything it does.
16:23tomojamalloy: yeah
16:23tomojbut I replaced f with (constantly 42)
16:23tomojproblem persists
16:23antares_Raynes: I am not going to support multiple libraries for anything but JSON
16:23Raynesantares_: I was mostly poking fun.
16:23tomojOH
16:23tomojshift
16:23tomojer, shit.
16:23Raynes<3
16:23amalloytomoj: in that case something is changing the atom other than that reset. i don't think the behavior you describe is possible otherwise
16:24tomojI had "map" bound to a map
16:24dnolenoptional warnings on shadowing might be nice ...
16:26tomojI started out with some simple function that just did an assoc, and was like "well, assoc shadows map, so I will too", then forgot when I later needed map. don't think I'll ever do that again..
16:26amalloydnolen: the trouble is, most of the time i want to be allowed to shadow names in peace, and when i start having crazy problems like tomoj i wouldn't think of turning those warnings on
16:36CR7hello everyone
16:36Raynescemerick: Did you see that tweet where the guy listened to our mostlylazy episode and it made I'm like MVS less? Mind blown.
16:36CR7can anyone tell something descriptive about clojure
16:36dnolenamalloy: yeah, still would be a good feature for a linter - sanity check before going down the debugging rabbit hole
16:39emezeskeamalloy: You want to shadow names in peace? http://i.qkme.me/3rhmtt.jpg
16:40emezeskeClearly clippy is the answer.
16:42amalloyemezeske: i am so far disappointed by my search for "emacs clippy"
16:43amalloythere are a surprising number of articles on some vim clippy thing, though
16:43emezeskeVim clippy?
16:43amalloyhttp://www.geekzone.co.nz/foobar/5656
16:43emezeskehahahahah
16:47antares_Raynes: https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj
16:48antares_Raynes: madness but it works after all
16:54jweiss_is there a clearer way to write (fn [& _] (foo)) (fn to ignore the arguments and call foo with no args). (constantly foo) doesn't quite work because that just returns foo, doesn't call it.
16:55AtKaaZ,#(#_%& foo)
16:55clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0)>
16:55jweiss_that's clearer? :)
16:55AtKaaZlol good point:D
16:56jweiss_shorter, yes :)
16:56joegallojweiss_: i would do what you did
16:56AtKaaZjweiss_: thing is that #_%& looks like a comment
16:56jweiss_AtKaaZ: i've never even seen that before
16:57AtKaaZjweiss_, yeah the way your wrote that is clear enough imho
16:58emezeskejweiss_: If you're doing it a lot, you could always ##(defn ignore-args [f] (fn [& _] (f)))
16:58lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
16:58emezeskeWell, lazybot's complaint notwithstanding, you get the picture
16:59jweiss_emezeske: yeah probably better as a macro (defmacro always-do [& body] `(fn [& _] ~@body))
17:00emezeskeI'd keep it as a function, but that's just IMO
17:00jweiss_well, in general i might want to call foo with args, just not the ones passed into the outer fn
17:01TimMc(defn nary [f] (fn [& _] (f)))
17:01TimMc(nary foo)
17:02gfredericks(defn nary [f & args] (fn [& _] (apply f args)))
17:03emezeskeI assumed that nary meant nullary
17:03TimMcgfredericks: Good call.
17:03AtKaaZ(fn [& ignore-all-args ] (foo))
17:03gfredericks(defn somary [f & args] (fn [& _] (apply f args)))
17:03emezeskelol
17:03emezeskeotherary
17:03gfredericksary
17:03TimMcarrr
17:03gfredericksvarargical
17:03emezeskeswapary has the advantage of being fun to say
17:05AtKaaZlol gfredericks
17:05antares_If you are not happy about the clojure.data.json API changes, vote http://dev.clojure.org/jira/browse/DJSON-5 up
17:06TimMc"For libraries that rely on data.json the 0.2 release was a major unexpected breakage."
17:07antares_TimMc: you don't agree with that?
17:07TimMcIs there some reason I *shouldn't* find that amusing?
17:07antares_TimMc: I am not sure what is amusing. Maybe the grammar is, I don't give a shit, I am not a native English speaker.
17:08TimMcThat's a pre-1.0 release. Of course it's going to break.
17:08antares_TimMc: but that's not how you maintain popular libraires
17:08antares_TimMc: that's too late to use lame excuses like that
17:08technomancydata.json is popular now? =)
17:08antares_the library has been around for what, a year?
17:08TimMcWell, the other things that's funny is that there was breakage on a minor version bump.
17:08ivanI grepped everything I use and found one instance of data.json in some tests
17:08technomancyaw hell, it's in the top 10 on clojuresphere
17:08technomancythat's just wrong
17:08antares_ivan: I know plenty of people using it
17:09antares_technomancy: more importantly, most of the changes were not necessary, like renaming c.d.j./json-str to /write-json
17:09technomancy◔_◔
17:09technomancylame
17:09antares_and not providing a compatibility function that is deprecated
17:09technomancywhy would you do that?
17:09nDuff*shrug*. Part of the point of naming something 0.x is to indicate that one reserves the right to make major changes at will.
17:09technomancyaliases are so easy to add
17:09nDuffThere's only a promise of stability post-1.0
17:10nDuffrelying on a pre-1.0 library is something one does at one's own risk.
17:10antares_nDuff: that's lame to say that for a 1 year old library that is supposed to be a contrib library
17:10gfredericksclojure breaks stuff all the time within 1.x
17:10antares_nDuff: the entire Clojure ecosystem beyond Lein and ClojureWerkz is 0.x or even 0.0.x
17:11antares_nDuff: it's just disrespectful to make breaking APi changes without any compatibility layer and not even ask on the mailing list
17:11antares_for a library that's in the top 10 on clojuresphere, at least
17:11antares_it's crazy that someone even has to explain this
17:11TimMcgfredericks: And that pisses me off. It should be Clojure v1, v2, v2.1, v3...
17:12TimMcAt least in that case it's a well-known violation of semver.
17:12gfredericksI want pinball-based numbers. If anything changes there is a minimum of version += 500
17:12nDuffTimMc++ (re: semver being the Expected Thing)
17:13emezeskegfredericks: Is a major release like a pinball multiplier?
17:13gfredericksemezeske: sure!
17:13emezeskegfredericks: Forking is multiball.
17:13technomancyyou can expect devs to track version numbers that don't make sense for the language itself, because you simply can't ignore clojure development
17:13technomancythe exception that proves the rule
17:18TimMcantares_: I'll still vote up, I'm just kind of baffled by both the maintainers and the users.
17:19RaynesI don't usually release 1.0.0s because I'm never really convinced of the stability of my libraries. ;)
17:20RaynesFor example, conch.sh is super new and nobody has used it yet, but it *is* usable, I just don't know that it is stable enough for 1.0.0 and don't like doing beta alpha and RC releases for 100 years.
17:20antares_Raynes: there is life past 1.0, bro
17:21antares_it's called 2.0, 3.0, 4.0
17:21TimMcRaynes: It doesn't have to be stable, you're just making a statement about API changes.
17:21RaynesYeah, but someone (you?) just pointed out that 1.0 is a promise of stability, antares_.
17:21RaynesI don't have that promise yet.
17:21RaynesnDuff, it looks like.
17:22emezeskeRaynes: I think 1.0 means "stable API," e.g. function names won't be changing out from underneath you for a while
17:22antares_Raynes: it's a promise of things being reasonably complete and not breaking in any serious way before 2.0.
17:22antares_Raynes: but not forever
17:22TimMc"breaking" as in API, not as in bugs
17:22antares_right
17:22emezeskeRaynes: I can't try to persuade you to go to 1.0, though -- lein-cljsbuild is still 0.2.x :P
17:22brehautdoes lein still default to version 1.0.0 in new projects?
17:22RaynesFair enough. I hate making those sorts of decisions.
17:23Raynesbrehaut: 'still'? It never did?
17:23brehautit totally did. with a -SNAPSHOT
17:23RaynesReally?
17:23brehautreally
17:23RaynesFar out.
17:23RaynesI doubt it.
17:23RaynesI'm not that ridiculous.
17:25antares_new projects should go to 1.0 when they are (mostly) complete as far as the initial scope goes, in my opinion
17:25antares_small libraries should be released as 1.0
17:25antares_because otherwise they will be on 0.0.1 forever
17:25antares_people are not comfortable using 0.0.1 stuff and it generally does not give you any idea bout the state of the project
17:26antares_given that most clojure libs are also not documented at all, it gives a very creepy impression of the community to some people
17:26brehautRaynes: https://github.com/technomancy/leiningen/blob/1.7.1/src/leiningen/new.clj#L24
17:26TimMcYep, I should just go ahead and bump lein-otf to 1.0.
17:26emezeskeYou guys might have convinced me to bump lein-cljsbuild to 1.0
17:27antares_emezeske: do it. You can always go to 1.1 or 1.5 or 2.0 fairly quickly. Nothing wrong with that.
17:27TimMctechnomancy: I am working on getting lein-otf to work on lein2... I'm adding in a profile and using it, but :main is being ignored.
17:27Raynesantares_: What people?
17:27RaynesIf that's true, then 90% of Clojure libraries must never see use.
17:27emezeskeantares_: I think I will. I haven't had to make any big public-facing changes for a while.
17:27antares_Raynes: many folks I know from both Java and Ruby felt very uneasy about 0.0.1 libraries without docs
17:27TimMctechnomancy: the result being that the lein_otf.loader isn't AOT'd and included in the jar. :-( But at least I'm working on it.
17:28TimMcantares_: Lack of docs is a huge problem.
17:28antares_Raynes: even if those libraries were pretty good and stable in every sense of the word
17:28RaynesSure you're not a statistician?
17:29antares_Raynes: I don't think joking about this is completely appropriate
17:29RaynesDo you know me?
17:30emezeskeJoking is always appropriate! -- Me
17:30RaynesI don't think we've met, I'm Raynes.
17:30antares_sometimes I get the impression that the best and brightest in the Clojure community proactively want people to NOT use Clojure
17:30doomlordthey want to keep it as a niche ?
17:30brehautO_o
17:30antares_that's why they do stuff like clojure.data.json 0.2 or ignoring working on the docs
17:30emezeskeantares_: Now that's just plain ridiculous
17:31emezeske"Never attribute to malice that which is adequately explained by stupidity."
17:31antares_emezeske: yeah? then why esoteric bullshit like core.logic gets all kinds of attention and docs are neglected at massive scale?
17:31RaynesThis is the second time in two weeks that you've summarized programming communities based on people you know during a conversation we've had, antares_. I just thought it was a little funny. I apologize if I offended you.
17:31antares_emezeske: or compatibility and ease of use are never a major topic of discussion?
17:31emezeskeantares_: See above.
17:31metellusantares_: because writing docs is boring?
17:31TimMcantares_: People scratch their own itches.
17:31brehautantares_: core.logic gets love because dnolen is super interested in logic programming and willing to pour his spare time into it
17:31TimMcWelcome to open source.
17:31antares_metellus: I disagree, writing docs is super fun
17:32TimMcNot for a lot of folks.
17:32antares_metellus: somehow in other ecosystems people end up having at least some docs
17:32emezeskeantares_: Why would you attribute it to malice? You have no grounds for that at all. There are a thousand reasons that don't involve people trying to actively discourage new clojure users.
17:32antares_emezeske: I said "I get the impression"
17:32antares_not that it is necessary so
17:32antares_Raynes: no offense taken
17:33antares_TimMc: ok, then we know what this community values
17:33antares_and does not value
17:34emezeskeantares_: I "get the impression" that you're making a lot of conjecture based on a relatively small sample set
17:34antares_and the picture (as far as clojure adoption and good experience for newcomers go) is pretty grim
17:34scriptorto be fair, you can't just say "welcome to open source" when other open source languages have pretty decent documentation, both for the core and for libs
17:34RaynesAnd here I thought Clojure was doing pretty well in the adoption area.
17:34scriptoris it?
17:34pisketti_antares_: I'm currently seeing a lot of Clojure adoption - at least here in Finland.
17:35pisketti_In commercial projects
17:35antares_emezeske: I've been around in this community for 1.5 years or so, maintain 20+ libraries, contribute almost all my spare time to clojure-doc.org and try to help with Lein. I think I kinda have seen enough to make such judgements.
17:35brehautquick everyone, to the annecdote machine!
17:35RaynesWe've got 400 more people in this channel than we did 2 years ago, tooling gets better every day, thought works moved Clojure to adopt in their thing people seem to care about...
17:35antares_pisketti_: yeah and those people are probably WTFing all day long for the first few weeks
17:35antares_pisketti_: not because of the language, just how much the docs are neglected and what development practices are used by some projects
17:35pisketti_I haven't been particlarly unhappy
17:36RaynesI've been here for… 3-4 years, maybe? And I disagree with everything you've said.
17:36antares_and at large, not many people care
17:36antares_because core.bullshit is so much more fun
17:36pisketti_antares_: Though things could be better but at least for me it hasn't been a huge issue
17:36RaynesYou're not going to get far by insulting core.logic and dnolen.
17:36Raynes:\
17:37antares_pisketti_: nice. But I know many people who don't have a great time.
17:37antares_Raynes: I am not talking about core.logic. There are also core.other-exotic-things
17:37RaynesAlso, what 'development practices' are the majority of Clojurians using that you find less than savory?
17:37emezeskeantares_: You're right, people should... work on things they're not as passionate about, for some "greater good?"
17:37emezeskeantares_: Good work gets done because people are having fun, or because of money
17:38pisketti_antares_: I hear you, but I agree with Raynes here in that it's no use blaming the brightest and most enthusiastic ppl.
17:39scriptoremezeske: for the good of the language you like, maybe?
17:39antares_emezeske: node.js (which I am not a fan of) author had made a decision to work on less fun stuff like a good HTTP client and a bunch of other protocol implementations very early on, in the standard package. All for it to be useful. It paid off as you can see.
17:39pisketti_antares_: If they wan't to use their free time to make libs and the whole community better, it's their right to choose what they contribute to
17:39RaynesHey, all I can say is that I try pretty hard to write good libraries, contribute to existing ones, and even write some docs every now and again. It's the best I can do in the time I am allotted and if it isn't sufficient, I tried. And I don't have half the responsibilities of most of the people around here. I have plenty of respect for them because of that.
17:39antares_pisketti_: I am not blaming people, I am saying that the values of this community are aligned to almost prevent adoption
17:39emezeskeantares_: "All for it to be useful." Is he some kind of monk? Or maybe he has fun being famous, or fun helping others, etc...?
17:39dnolenantares_: I wish core.logic got more love than it does! Including docs!
17:40emezeskescriptor: If you want the language to do good, and that's fun for you, great!
17:40antares_emezeske: he probably has fun being famous and seeing people use his projects. But also he wanted to make it all worthwhile.
17:40scriptoremezeske: it doesn't have to be fun, I meant that sometimes you might have to do something you're not passionate about so that the language you like to use might do better in the long run
17:41antares_emezeske: because if it does not get adopted, it means he has spent thousands of hours in vain, more or less
17:41pisketti_antares_: The thing with clojure libs is that you can usually take a quick look at the source and figure out what it does. That is not the case in many other languages
17:41antares_pisketti_: yeah? go tell that to a typical joe the programmer
17:42scriptorantares_: there's a difference between actively making it hard for clojure to spread and simply not helping it to spread in every way (ie. docs)
17:42Raynesbrehaut wrote an XML-RPC library. He must have good values.
17:42RaynesReal good ones, even.
17:42antares_pisketti_: I can read the source but I HATE to do that. That's why clojurewerkz.org stuff is documented.
17:42brehauthaha
17:42RaynesThat's the boringest shit ever.
17:42brehautmaybe i have a brain disease
17:42antares_(hate to read the source to figure out what should have been documented)
17:43scriptorrelying on reading the implementation of a lib isn't a very good idea
17:43Raynesantares_: Is conch well documented?
17:43ToBeReplacedscriptor: that's the exact thing that's bothering me with clojure so far
17:43pisketti_antares_: As I said, things could be better and you are right in that it is important to maintain and improve the docs
17:43ToBeReplacedevery single library i end up needing to read the source for
17:43antares_and to finally demonstrate what I am talking about, see what Unsessions are there suggested: https://github.com/relevance/clojure-conj/wiki/Clojure-conj-2012-Unsessions
17:44antares_again, highly esoteric stuff, besides running user groups and dojos
17:44TimMcpisketti_: ZenRobotics?
17:44Raynesantares_: Why not start a boring shit unsession then?
17:44antares_but no unsession on the docs, broken contribution process, sane maintenance practices
17:44technomancyantares_: relevance sells training =)
17:44ToBeReplacedwhich is great for me to learn, but holy cow it's annoying when it takes me 30 minutes to figure out things like how to pass the database connection through to execute a query
17:45antares_technomancy: that's what also puzzles me, they kinda heard of that "grow your market" thing, no?
17:45AtKaaZToBeReplaced for what lib?
17:45antares_ToBeReplaced: exactly!
17:45brehautwait, so type checking and testing are no longer sane development practises‽
17:45pisketti_TimMc: You mean if I work there?
17:45brehautsomeone better alert the haskell community double quick
17:46ToBeReplacedAtKaaZ: korma, heh...
17:46TimMcpisketti_: They're that one Clojure-using company in Finland, yeah?
17:46pisketti_No they aren't the only one. :)
17:46scriptorbrehaut: I agree regarding testing, but will type checked clojure really see much adoption anytime soon?
17:46TimMcCool.
17:47AtKaaZlol it says: Korma is a domain specific language for Clojure that takes the pain out of working with your favorite RDBMS
17:47brehautscriptor: i totally want to be able to type check my clojure code
17:47gfredericks+1
17:47antares_AtKaaZ: «…if you are the author of Korma»
17:47ToBeReplacedAtKaaZ: it's pretty slick... it's just i only wanted it to generate SQL, not to handle my database connections etc. etc., and i coudln't figure out how to rip it apart for a while
17:47Raynesantares_: You know, there was a whole meeting by contributors at last year's conference, right? And it wasn't an unsession or a scheduled session.
17:47pisketti_TimMc: I was just in a clojure event a couple of weeks ago (http://clojutre.org/) where a guy from ZenRobotics presented their stuff. Pretty impressive. :)
17:47antares_Raynes: I don't know, I haven't been there
17:47brehaut(inc gfredericks)
17:47lazybot⇒ 11
17:48technomancyRaynes: more or less a token effort; nothing changed
17:48AtKaaZantares_: it's funny because it doesn't seem to do that according to ToBeReplaced's 30min spent...
17:48Raynestechnomancy: And nothing would change because of an unsession either.
17:48antares_AtKaaZ: yup, it only takes the pain out of … if you are the author of that lib :)
17:48RaynesIf people don't want to write docs, they wont.
17:48AtKaaZantares_: oh I see what you mean haha
17:48antares_Raynes: somehow Python, PHP and JS communities pay attention to docs
17:49antares_and not highly esoteric programming languages topics
17:49scriptorand I doubt those who document projects in those languages do it because it's 'fun'
17:49pisketti_TimMc: I'm currently writing Clojure on my day job, but I'm pretty much the only one. I'm hoping to see it used more in the future.
17:49antares_anyway, I am growing convinced that long-term sustainability of a community depends on how many people are willing to do really boring work
17:49TimMcLiving the dream.
17:50Raynesantares_: Highly esoteric things are a part of Clojure culture. You have to deal with that. People here enjoy those things. That isn't going to change.
17:50scriptorantares_: encouraging docs and working on esoteric programming topics are mutually exclusive, it's possible to encourage both
17:50antares_and not shit rainbows all the time
17:50pisketti_TimMc: How do you know ZenRobotics?
17:50ToBeReplacedantares_: that's a little unfair though b/c a lot of essential libs made their way into core in some way or another, at which point heavier documentation were required
17:50TimMcscriptor: +not
17:50brehautscriptor: i think you mean orthoganal?
17:50antares_scriptor: they pretty much are, in practice. Values that a community has propagates.
17:50TimMcpisketti_: functionaljobs.com
17:50scriptorbrehaut: can I work complect into it somewhere? :)
17:51brehautscriptor: i hope so
17:51antares_Raynes: oh, sure. And that would be fine if practical things were not ignored. But they are.
17:51RaynesI didn't know things were in *that* bad a state of affairs.
17:52brehautantares_: you know whats really going to encourage people to write boring code and docs? crapping on the efforts of those people who have already done so
17:52dnolenantares_: If we wanted to boring work we'd probably be writing in something else.
17:52scriptorclojurebot: bring up the badness state of clojure charts, please
17:52clojurebotclojure is making your sexp smile
17:52RaynesYeah, I'm really offended by this whole debacle.
17:53RaynesI'm pretty close with these people that are currently being shat on. I've never seen them 'shit rainbows', but I have seem them work hard.
17:54scriptornobody is saying they're not working hard
17:54RaynesSure, on useless esoteric shitting rainbows kinda stuff.
17:54ToBeReplacedare there particular libraries that are missing more extensive documentation? i might be willing to donate some time, since i'll probably need to learn the in and outs anyway
17:54scriptorworking hard on esoteric stuff is still working hard
17:55scriptora todo list for various lib doc efforts would be kind of useful
17:55antares_I did not say that someone does or does not work hard
17:55antares_only that values of this community put esoteric stuff waaaay higher than documentation, backwards compatibility and ease of use for beginners
17:56antares_that's very problematic in my view, in the long run
17:56antares_you can't shit rainbows all the time. Sometimes you have to do boring, thankless work.
17:56RaynesMan.
17:56antares_otherwise beginners will never feel good when adopting your technology
17:57antares_no matter how many shiny toys there are
17:57antares_or great ideas
17:57antares_so the question is: do people in this community want it to grow?
17:57RaynesLet me know when you get your statue erected.
17:57antares_to repeat myself: I am sometimes convinced that they don't
17:57dnolenantares_: it will grow with or without. and it's nicer to just watch you do your thing and not hear you complain about it.
17:58dnolenantares_: which isn't to say complaining is bad - but you're singing the same song over and over again.
17:58antares_dnolen: yeah, the question is, would it be a tiny community of mostly hobbyists/dreamers or a sustainable community of people building real things
17:59antares_*will
17:59brehautwho says hobbiest and dreamers cant have a sustainable community‽
17:59dnolenantares_: I'd say it's already sustainable and growing at a healthy pace. seems like people really appreciate your contributions. at least as much as all this esoteric shit you keep talking about.
17:59RaynesI don't know, I'm 18 and hack Clojure for a living. I think we're doing pretty good on the building real things part.
18:00antares_dnolen: note that not many people complain about the docs, about poorly maintained libs, etc. How will things ever improve without such criticism?
18:00brehautantares_: by actually doing something about it? other than talking?
18:00RaynesMaybe people don't complain because there is less of a problem than you seem to think there is?
18:00scriptorgrowing doesn't have to be binary, you might still have otherwise very good programmer Joe or good company Acme going for Scala or whatever because it's easier to pick up
18:00scriptorand at least *seems* more well-documented
18:00antares_Raynes: what % of Clojure/Conj attendies hack clojure for a living? compared to a Ruby, Python or Java conferences?
18:01RaynesI don't know, you seem to be pretty good at this stat thing.
18:01ToBeReplacedantares_: example libs that need better docs? i'll spend some time and bring the thunder
18:01RaynesYou probably know more than I.
18:02dnolenantares_: comparing success against languages that are 15-20 years old ... seems unrealistic
18:02scriptorRaynes: to be fair, I don't think there might be many other 18 year olds working on clojure for a living
18:02antares_ToBeReplaced: Compojure, Noir and Ring are some very important projects that need better docs
18:02scriptordnolen has a point, what were docs for python like in the mid 90s?
18:02antares_dnolen: of course, if you don't cut yourself some slack, who will
18:02RaynesHe will likely mention node.js now.
18:03pisketti_antares_: Good job on clojure werkz. Hadn't heard about it before.
18:03ToBeReplacedRaynes: One notable point though is that even if you don't perceive a problem, the fact that someone thinks there is one suggests that there is... it means that there are at least some people who are turned off by documentation... whether or not that matters at this point in language development is another issue
18:03amalloyring's documentation is a shining beacon of light
18:04antares_dnolen: I feel like the Clojure community at 5 years needs to stop making excuses like that
18:04RaynesI'm not arguing that there isn't a problem, of course, it's just that he dug his own hole with the last one so I hopped in.
18:05antares_just like it is a bit late to make excuses about "we are growing, our contrib process will change"
18:05scriptoremezeske: of course, until it is resolved entirely amicably with tangible progress, as all irc debates tend to
18:06antares_Raynes: if you don't like node.js, coffeescript or any other shiny young tech, take a look at Go. Way better docs than Clojure.
18:06antares_Raynes: ~3 years old
18:06ToBeReplacedantares_: i can't speak for Noir, and i'll agree that there are probably some areas where compojure could use some more detail, but I found ring pretty excellent; are there particular problem areas?
18:06Raynesemezeske: I don't think anyone besides antares_ is arguing. I'm mostly making fun of his arrogance.
18:06scriptorantares_: also corporate support
18:06wingyThis line in my source code gives Invalid metho Code length error: https://www.refheap.com/paste/6112
18:06RaynesWhich I should stop doing and go get real work done.
18:07antares_ToBeReplaced: Ring may be in good shape now, I haven't read its docs for a year or so. Compojure is what I hear questions about the most.
18:07ToBeReplacedantares_: i actually found that once i stopped looking at noir, it all made sense >> the extra level of abstraction was too complicated for me, and it all worked once i went from ground up with ring
18:07wingyrelated to https://groups.google.com/forum/?fromgroups#!topic/clojure/ZL_1t3Rm8I4 .. is there anything i can do to make clojure parse it?
18:07emezeskescriptor: :P
18:08emezeskeRaynes: I like a good argument, in the "discussing opposing views" sense of the word
18:08ToBeReplacedantares_: i remember having some trouble when first looking at compojure because googled answers were not helpful >> compojure went from being a web framework to just a routing DSL >> i'm not sure how to fix that though?
18:08emezeskeRaynes: Somehow it's also come to mean "just yelling at one another" though
18:10antares_ToBeReplaced: it is trivial to get a basic example working, what is hard is finding an example of something less obvious, like accessing a rarely used piece of request info
18:10brehautantares_: that seems like quite a contrived complaint?
18:10antares_ToBeReplaced: some examples are just not there, that's all I am saying
18:10antares_brehaut: what specifically?
18:11brehautantares_: compojure is a thin layer on ring. its all just ring handlers, so its trivial to get any request data
18:11brehautand its always the same
18:11antares_brehaut: if you are about my Compojure docs comments, good docs cover all common and some uncommon use cases
18:11antares_brehaut: it does not matter, beginners need examples, period
18:11antares_brehaut: for experienced users, Compojure probably has just enough docs
18:12antares_but so is Clojure, if you are a long time user or programming languages aficionado
18:12dnolenantares_: what's I'm confused about it what isn't working for you. You made a docs site, people contribute, what's the problem?
18:12antares_the rest of the world does not find that sufficient or well presented (organized, explained, written in plain language)
18:13antares_dnolen: that problems such as docs or caring about backwards compatibility are such a low priority
18:13antares_dnolen: or rather, "not sexy", priority is the wrong word
18:13antares_dnolen: or maybe even "not respected"
18:13antares_Python community cares a great deal more about the docs
18:14brehautand yet you keep refering to projects that respect backwards compat and have docs
18:14antares_and less about highly experimental things
18:14ToBeReplacedany thoughts on how to fix issues with outdated info? for example, at the end of the day in emacs, the only installations i needed were nrepl.el and clojure-mode... yet any google search and you'll find 50 things about swank-clojure, SLIME, etc... even on dev.clojure.org
18:14antares_brehaut: like Ring and Compojure?
18:14brehautyes
18:14antares_brehaut: that's like 2 out of fucking 5000, dude
18:14brehautyou picked the examples, not me
18:14antares_brehaut: I did not, ToBeReplaced asked about some projects to look into
18:15antares_brehaut: if you think that overall Clojure projects care about docs and compatibility, go ask a Ruby developer with basic Clojure skills to glue together 4-5 randomly chosen libs from github
18:15scriptorToBeReplaced: a big reason why technomancy is crusading against not writing another 'how to get started with clojure' blog post
18:16antares_it will be great luck if 3 of them even have installation instructions people can understand
18:16nDuffantares_: *snerk*. You suggest that a _Ruby_ developer should be the person to have sane expectations re: compatibility?
18:16antares_nDuff: I am talking about documentation right now
18:17antares_nDuff: for compatibility benchmark, Java is definitely a better community to compare against
18:17ToBeReplacedscriptor: yeah; blog posts are the wrong medium for a problem space that is rapidly evolving
18:17antares_nDuff: Clojure libraries documentation as seen by beginners (e.g. Ruby developers)
18:17brehautin what planet is it a good idea for a new user to 'glue together' 'random' projects from git hub‽
18:18antares_brehaut: that will be just an experiment. Have you not seen people seriously confused by how to use a library because that library's README is useless?
18:18gfredericksbrehaut: that's all programming is 98% of the time
18:18scriptora beginner who wants to start a project that requires those libraries
18:18antares_like, completely useless, no even clear installation/dependency instructions?
18:18wingyrunning this line in the repl works fine: https://www.refheap.com/paste/6113 .. but in a file that is run it will give me error: Invalid method Code length 117308
18:18ToBeReplacedbrehaut: uh oh... that's what i'm doing...
18:18scriptorby 'random' I think antares_ just meant any plain old clojure libs
18:18wingyif anyone knows what the problem is please shout
18:19brehautToBeReplaced: you chose libraries at random‽
18:19ToBeReplacedwingy: that's way too long of a line to make sense of :)
18:19antares_wingy: JVM methods have max lengh (in bytes)
18:19ToBeReplacedbrehaut: maybe not random :)
18:19wingyToBeReplaced: i'll have it formatted properly in my test
18:19scriptorbrehaut: random in the "pick any library that a dev might need" not statistically random
18:19antares_wingy: literals are compiled down to sequential map updates, I guess
18:20antares_brehaut: dude you are way too focused on "random"
18:20wingyantares_: but i can run it on the repl
18:20scriptorantares_ is using the colloquial definition
18:20wingyguess the repl is not putting my code in a method
18:20nDuffSince when did Clojure libraries need installation instructions? Either it's in Clojars, or it's in Maven Central, or it isn't ready for use.
18:20antares_brehaut: go ask an experienced developer who is a Clojure n00b to use an average Clojure library
18:20antares_brehaut: that's very hard for them, there are usually no clear guidelines even for how to add a dependency
18:21brehautwait
18:21brehautso every library now has to provide basics on how to use the languages infrastructure?
18:21brehautand the language?
18:21antares_brehaut: if you haven't seen that, I suggest that you hang out around here more.
18:21brehautand all the dependancies?
18:21antares_brehaut: wow, you are more obtuse than I thought
18:21brehautno im not
18:21antares_brehaut: not the language. Just how to get started with a damn thing.
18:21brehauti dont expect every library to provide a whole cloth introduction to the language
18:22antares_brehaut: who said anything about introduction to the language?
18:22antares_ah, fuck it
18:22brehautyou are implying it
18:22antares_time to write some more clojure-doc.org
18:22antares_brehaut: I am not implying anything, maybe drink a coffee or two
18:22brehaut"no clear guidelines even for how to add a dependency"
18:23wingyantares_: http://www.coderanch.com/t/482213/java/java/fix-java-method-size-limit no way to fix this :(
18:23brehautthats a language / infrastructure level concern
18:23antares_brehaut: yes, newbs sometimes need hand holding to even add a library as a dependency
18:23antares_brehaut: huh??
18:23lazybotantares_: What are you, crazy? Of course not!
18:23wingybut that is silly in clj .. how can i work with large maps then?
18:23antares_wingy: it's a JVM limitation
18:24antares_wingy: the issue is not a large map but a large map *literal*
18:24wingyantares_: but it gets read in the repl
18:24antares_wingy: or functions with a very large number of locals
18:24wingyantares_: what exactly is a literal?
18:24antares_wingy: {…}
18:24antares_it is surprising that it works in the REPL
18:26wingyantares_: is there a work around so i can read my map in?
18:26antares_I've only hit this limit with a test that had a crazy number of locals
18:26antares_I've split it into several tests
18:27wingybut my map is pretty big .. how can i read it in
18:27antares_map literals can be split and merged, too
18:28wingyyou suggest me using (merge) ?
18:29antares_brehaut: re: hobbyists and dreamers can be a sustainable community only in theory
18:29antares_wingy: yes, try it
18:36wingythe weird thing is that the repl works
18:36wingyperhaps that is because its not putting anything in a method
18:41murphy607hi
19:12duck1123What are people using for producing simple graphs and stats about their apps? I'm thinking about using something like statsd, but I'm wondering if there is a better clojure option. Something + Incanter, perhaps?
19:14SegFaultAXduck1123: Riemann is a thing.
19:14hiredmanincanter's wrapper around jfree chart is kind of "meh"
19:14hiredmanusing jfreechart directly is not too bad
19:16duck1123I'm open to anything except for MicroStrategy (my day job / personal hell)
19:16technomancydec on incanter's jfreechart wrapper
19:19hiredmanhttps://gist.github.com/3949532 is what using jfreechart directly looks like for timeseries data
19:20duck1123That doesn't seem too bad. I currently don't have any real stats logging in this, but I decided I wanted a simple graph of posts per hour
19:20duck1123I might play with Riemann
19:20emezeskeduck1123: Is there something you don't like about statsd?
19:21SegFaultAXOr is it just that it isn't written in Clojure?
19:21hiredmanriemann and jfreechart are different things, jfreechart is just about creating charts, riemann is metrics gathering and charting I believe
19:21duck1123emezeske: I've only played with it a little bit and I liked it, I was just wondering if there was a better option
19:21hiredmanactually it looks like riemann doesn't do charting, it just forwards data to grpahite
19:22emezeskeduck1123: statsd/graphite are really quite nice
19:22duck1123right, I need both pieces
19:22SegFaultAXduck1123: There are lots of different options. Statsd is pretty standard. fnordmetric is also interesting.
19:22wingyhow can i compare where 2 strings differ?
19:23SegFaultAXwingy: Diff?
19:23wingySegFaultAX: yeah
19:23duck1123ok, no reason not to use statsd. Is there a good clojure wrapper, or am I going to have to write it?
19:23emezeskeduck1123: There's a statsd wrapper for every language ever :P
19:23duck1123I played with the java api for a second
19:23emezeskeduck1123: https://github.com/pyr/clj-statsd
19:24SegFaultAXThere's also an implementation of statsd itself in Clojure.
19:24SegFaultAXDunno if it's any good.
19:24duck1123excelent, then I'll just work on getting graphite up and running
19:25SegFaultAXemezeske: Js hate, if I had to guess.
19:25hiredmanwhat is there not to hate
19:25SegFaultAXhiredman: About statsd or about javascript?
19:26hiredmanjavascript and node.js
19:26emezeskeI'm not a JS or node.js fan, but I _am_ a fan of code that is already written/tested :)
19:26SegFaultAXhiredman: Nothing. In my opinion, javascript is a shitty language and a ridiculous choice for server-side development.
19:27SegFaultAXemezeske: Statsd isn't terribly complicated. Re-implementing it is not that difficult.
19:28emezeskeSegFaultAX: My point is that the original version is already implemented, and tested by lots and lots of people
19:28emezeskeSegFaultAX: Any small amount of implementation is more than zero
19:28duck1123perhaps for a proof of concept
19:28SegFaultAXemezeske: A fair point. My second argument for why people re-implemented it is they don't want to introduce node.js in their stack.
19:28hiredman"this python service cannot handle all these connections, let's write a service in js to put in front of it"
19:28SegFaultAXemezeske: Which is completely reasonable.
19:29emezeskeSegFaultAX: Yeah.
19:30emezeskehiredman: Surprisingly, statsd performs like a champ. But yeah, why the hell didn't they just patch graphite?
19:30SegFaultAXGraphite isn't the only backend for statsd
19:30SegFaultAXStatsd is just an aggregator.
19:31duck1123I'll probably end up writing my own consumer for the statsd data
19:31emezeskeSegFaultAX: Well, statsd originally scratched the graphite itch at etsy, right?
19:31emezeskeAaaaanyway...
19:31emezeskeIt's not worth discussing... We've already typed more lines of chat than statsd has lines of code :P
19:32SegFaultAXemezeske: It scratched the "make analytics easier to deploy" itch. Dunno if they wanted graphite specifically or if that was just the best option at the time and so became the default backend.
19:33wingyi really can't figure out why these 2 lines aren't identical https://www.refheap.com/paste/6117
19:35AdmiralBumbleBeeus_name us_login….
19:35AdmiralBumbleBeecompared to us_name,us_login...
19:35AdmiralBumbleBeeit's a string
19:35wingyah
19:35SegFaultAXAdmiralBumbleBee beat me to it.
19:38wingyAdmiralBumbleBee: how did you check?
19:38AdmiralBumbleBeeI used my eyes
19:38AdmiralBumbleBeeit was immediately obvious to me
19:38wingyseriously
19:39AdmiralBumbleBeeyou're talking to someone who spends half the day debugging handwritten assembly
19:39emezeskewingy: You could always paste into two files and use a diff tool
19:39wingyemezeske: i did i thought diff was checking line by line and those were single lines
19:40SegFaultAXByte-wise diff is supported by many diff tools.
19:41emezeskewingy: vimdiff highlights differences on the same line in color, I assume other diff tools can do the same (tkdiff, meld, etc)
19:46wingyemezeske: vimdiff was a great tool .. now they are identical
19:46wingyare you using vim and not emacs?
19:47emezeskewingy: Yep.
20:16thorbjornDXcan I use defmethod inside of a macro?
20:17hiredmanI'm not going to stop you
20:17thorbjornDXhiredman: ok :)
20:18thorbjornDXhiredman: I'll rephrase. Are there any gotchas to using def/defmulti/defmethod within a macro? I haven't used them as of yet.
20:19hiredmanit depends on what you mean by "using"
20:21thorbjornDXhiredman: I'd like to make a macro that takes a multimethod symbol, and some vector or map. The macro should create multimethods using the keys/vals I pass in. Let me whip up a paste
20:23hiredmanthorbjornDX: by "create multimethods" you mean "return a datastructure that creates multimethods when evaluated" ?
20:24thorbjornDXhiredman: yes, I believe so. Here is the code that I'd like to generate in a macro: http://pastebin.com/2xwNwwWp
20:25hiredmango ahead
20:33gfredericksthorbjornDX: did you need any more help with that macro? there's no conceptual reason it can't be done.
20:40frawrHi, is there an easy way to sum a list of lists? ((1 2 3) (5 7 9)) to (6 9 12)
20:40gfredericksmap +
20:40gfredericks,(map + [1 2 3] [5 7 9])
20:40clojurebot(6 9 12)
20:41gfredericks,(apply map + [[1 2 3] [5 7 9]])
20:41clojurebot(6 9 12)
20:41gfrederickseither way depending on if you have separate references to them or not
20:42frawr(apply map + (70 60 59 255) (69 55 54 255) (66 48 46 255) (70 56 56 255) (67 53 52 255) (65 47 45 255) (68 52 53 255) (66 50 50 255) (65 47 47 255))
20:42frawrerh
20:42frawr(apply map + (70 60 59 255) (69 55 54 255) (66 48 46 255) (70 56 56 255) (67 53 52 255) (65 47 45 255) (68 52 53 255) (66 50 50 255) (65 47 47 255))
20:42thorbjornDXgfredericks: I would appreciate some help. http://pastebin.com/9tn2GHjQ is what I have so far. macros + syntax quote + quote aren't quite second nature to me yet, hence the println
20:43gfredericksthorbjornDX: don't you want the name of the function as a parameter too?
20:44gfredericksthorbjornDX: are you looking for help with writing macros or just trying to get this done?
20:44frawrAh, I need to convert them to vectors first
20:44gfredericksfrawr: no you don't
20:44thorbjornDXgfredericks: I'd prefer a grasp of the basics first
20:44gfredericksfrawr: you can enter vectors in the code to avoid quoting the lists, but you definitely don't need to convert to vectors at runtime
20:44thorbjornDXgfredericks: ah, yes. The function name should be a second arg (in my case it's just a keyword)
20:45frawrOoh, I see the problem, I copied the dataset, and then used the list as functioncalls
20:45gfredericksthorbjornDX: you're saying it's the same as propname?
20:45gfredericksfrawr: yep; common confusion
20:45frawrthnx
20:46gfredericksthorbjornDX: one handy macro tip is that you can play with backquote outside of a macro definition
20:46thorbjornDXgfredericks: oh, sorry. (defprop foo multifnaccessor mapofkvsfordefmethod)
20:46gfredericks,(let [fn-name 'tompkins] `(do (defmulti ~fn-name [a b c] (+ 1 2 3))))
20:46clojurebot(do (clojure.core/defmulti tompkins [sandbox/a sandbox/b sandbox/c] (clojure.core/+ 1 2 3)))
20:47gfredericksso you can mess around with backquote until you can figure out how to generate the code you want, and then just stick that in the macro body
20:47thorbjornDXgfredericks: awesome, thanks for the tip
20:47frawrworks, thnx!
20:50gfredericksthorbjornDX: you can also play with passing the output of backquote to eval to verify that it works
20:51thorbjornDXgfredericks: ok. Another question, do I have to quote symbols that I pass in to a macro? Or will the macro suppress evaluation
20:51gfrederickssymbols such as your function name?
20:51thorbjornDXcorrect
20:52gfredericks,(let [fn-name 'foo] `(def ~foo [] nil))
20:52clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
20:52gfredericksbag
20:52gfredericks&(let [fn-name 'foo] `(def ~foo [] nil))
20:52lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
20:52gfredericksgeez
20:52gfredericks&(let [fn-name 'foo] `(don't-def ~foo [] nil))
20:52lazybotjava.lang.RuntimeException: Unable to resolve symbol: foo in this context
20:52gfredericksoh right
20:52gfredericks&(let [fn-name 'foo] `(don't-def ~fn-name [] nil))
20:52lazybot⇒ (clojure.core/don't-def foo [] nil)
20:52gfredericksphew
20:53gfredericksokay so I found it difficult to consider how to verbally eanswer you, so I hope the demo helped?
20:53thorbjornDXI believe so.
20:53gfredericksyou have the symbol at macro-runtime, so it's a piece of data
20:54gfredericksyou're just inserting it into the code-data-structure
20:54thorbjornDX~ just puts in namespace qualification?
20:54clojurebotunderscores in namespaces is a bad idea
20:54gfredericksno
20:54gfredericks~ unquotes
20:54clojurebotGabh mo leithscéal?
20:54gfredericksclojurebot: botsmack
20:54clojurebotbotsmack is headdesk
20:54thorbjornDXah, I see
20:54gfredericksthorbjornDX: notice that the foo symbol went through without qualification
20:54gfrederickseverything else got qualified
20:54gfredericks,`qualify-this
20:54clojurebotsandbox/qualify-this
20:55unnali,`~'not-this-thanks
20:55clojurebotnot-this-thanks
20:55duck1123thorbjornDX: I have a few macros here that define multimethods https://github.com/duck1123/ciste/blob/master/src/ciste/sections.clj
20:55duck1123if that helps
20:55thorbjornDXduck1123: it will, thank you
20:56thorbjornDXduck1123: is the [name# name] thing a convention?
20:56gfredericksno
20:56gfredericks,`foo#
20:56clojurebotfoo__103__auto__
20:56duck1123also https://github.com/duck1123/ciste/blob/master/src/ciste/filters.clj
20:56thorbjornDXgfredericks: ah, okay.
20:56duck1123I did that only so I wouldn't eval it more than once
20:57gfrederickswhen you introduce locals inside a backquote, suffixing # will 1) prevent qualification and 2) add gensym bits so that you don't worry about shadowing other locals
20:57gfredericksit also makes sure that multiple references to foo# in the same backquote expand to the same thing
20:57gfredericksso you'll need that when you do function args for your multimethod
20:58gfredericks,`(fn [a# b#] (+ a# (inc b#)))
20:58clojurebot(clojure.core/fn [a__130__auto__ b__131__auto__] (clojure.core/+ a__130__auto__ (clojure.core/inc b__131__auto__)))
20:58thorbjornDXokay. I can imagine some code where this could come up, but I don't think I'm quite up to writing it yet :)
20:59amalloyduck1123: the use of # at https://github.com/duck1123/ciste/blob/master/src/ciste/sections.clj#L65 is nonsense, don't encourage anyone to use it
20:59thorbjornDXgfredericks: duck1123: thanks for your help. I have to turn off my brain for the night.
21:00gfredericksthorbjornDX: oh sorry I didn't actually look at duck1123's code; amalloy is right
21:00duck1123I was wondering if that was overkill
21:00gfredericksI mean I stand by everything I said but what he's doing is different
21:00amalloyduck1123: it's not overkill, it's just pointless. name# has no special significance outside of a syntax-quote; you're just creating a new variable called name#
21:01amalloyfoo# outside a syntax-quote is almost always a mistake. (one that won't hurt anything except confuse readers)
21:01duck1123now that I'm looking at it, I see your point
21:01duck1123I wrote this some time ago
21:02Khaozi'm reading the Clojure Programmin book and through pages 72-75 it's presented more concepts about hof
21:02Khaozbut i cant get the point on returning functions from functions instead of defining functions and then using partial
21:03gfredericksKhaoz: you can't get the point like you don't know why it would ever be useful?
21:03Khaozyep
21:03Khaozat last in that example
21:03gfredericksit might be a bad example
21:04gfredericksnot everything is easily done with partial
21:04Khaozi dont think that is a bad example, just a simple one
21:04akhudekring and enlive are both good examples of this
21:04akhudekring might be the easiest though
21:05Khaozi will go forward some pages to get more into the clojure concepts
21:05Khaozthen i will take a look at the ring code
21:06akhudeklook at the ring middleware in particular
21:18hyPiRionKhaoz: One interesting example would, for instance, be some sort of rule compiler.
21:19hyPiRionYou have a lot of rules, and send it to some sort of "compiler function". You get a function back, and can use that one for, well, rule stuff.
21:20Khaozi will try to translate the examples on book to "normal" functions to see what kind of difficult i will have
22:19john2xhi. i'm getting something weird in my repl.. Integer/parseInt returns "Unable to find static field", but I can autocomplete it when hitting TAB. (using lein2)
22:19john2xnot just parseInt, all static methods
22:19Raynesjohn2x: If you're not calling it, it is looking it up as a static field and not a method.
22:19Raynes&Integer/parseInt
22:19lazybotjava.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer
22:19Raynes&(Integer/parseInt "1")
22:19lazybot⇒ 1
22:20RaynesJava methods aren't first class.
22:20john2xohh ok. thanks!
22:21john2xso I can't use them in map?
22:21unnalijohn2x: not directly, but you can use ##(map #(Integer/parseInt %) ["1" "2" "3"]) I guess?
22:21lazybot⇒ (1 2 3)
22:22john2xah yes, that'll do. thanks guys
22:23Sgeo,(Integer/parseInt "not a number")
22:23clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "not a number">
22:24Raynes&(Long. "1")
22:24lazybot⇒ 1
22:24Raynesjohn2x: ^ Also works.
22:24RaynesJust for kicks.
22:29jcromartieis there a good way to reload a namespace and change the dispatch fn of a multimethod?
22:29jcromartielooks like it "sticks"
22:35cmajor7what is the way to catch the "click/mousedown" event on TD in clojurescript?
22:35cmajor7*using jquery
22:35unnalion TD?
22:35cmajor7table cell
22:36unnalioh, <td>
22:36cmajor7yea
22:36unnalithe same as for regular jQuery I'd imagine?
22:36cmajor7can't seem to get clojurescript syntax for it..
22:36cmajor7to work
22:36unnaliwhat have you tried?
22:38cmajor7(jq/on (js/jQuery "X") :click (fn [e] ….), where tried for X: "td", "#table-id tr td", ".td-class", "#table-id>tr>td", etc...
22:38cmajor7*jq is js/jQuery
22:38cmajor7sorry: jq is "jayq.core"
22:39unnaliuh...
22:39unnalilemme look up on jayq
22:40cmajor7well. I tried (.on …) from jquery itself as well
22:40unnalithat looks like it should be okay.
22:40unnaliso should that, since that's all jayq.core/on does!: https://github.com/ibdknox/jayq/blob/master/src/jayq/core.cljs#L221
22:40unnalihave you tried inspecting the compiled JS?
22:40cmajor7no, good idea.. let me pull it up
22:42unnaliall the examples I see online don't have any direct invocation of "on", not sure what's the deal
22:43brehautmost of the standard jquery event handler methods (click, mousedown etc) are just shortcuts for one of on("click"… ) or bind("click"…) etc
22:46unnalibrehaut: I mean jayq.core/on, I should be clear.
22:47brehauti have no idea about jayq
22:47cmajor7jayq.core.on.call(null,jQuery("#table-class tr td"),"\uFDD0'mousedown",(function (e){…}
22:48cmajor7if I put another element. e.g. some div instead of "#table-class tr td", it does work
22:48cmajor7the problem seems to be <td> itself..
22:48unnalithat \uFDD0' is a bit odd…
22:48cmajor7*to get to it, so it reacts to click/mousedown
22:48cmajor7it is ":mousedown"
22:49cmajor7it does work for e.g. "<div>"
22:49unnaliare you sure that's a normal :? anyway, I'm not sure why it wouldn't work, that's a jQuery/DOM thing then.
22:50cmajor7let's say it is, then how to get a particular <td> to "click"?
22:51unnalino idea, some jQ/DOM intricacy I guess as to why it wouldn't click in the first place.
22:51unnaliI'd suggest messing around with jsfiddle or so
22:52unnaliit works for me?
22:52unnalihttp://jsfiddle.net/A3thz/
22:52unnali13:41 < cmajor7> | jayq.core.on.call(null,jQuery("#table-class tr td"),"\uFDD0'mousedown",(function (e){…}
22:52unnali#table-class ?
22:52unnalishouldn't that be .table-class?
23:14jcromartiePlaying with mutlimethod-based state machines with a simple "update" and "render" separation: https://gist.github.com/4ba56804cee48fc0e709
23:52ambrosebsI've just submitted my honours dissertation for marking "A Practical Optional Type System for Clojure" (corrections welcome) https://github.com/downloads/frenchy64/papers/paper.pdf
23:55tomojhow do you get a NullPointerException with an empty stack trace?
23:55tomojI should've googled first