#clojure logs

2013-10-22

00:53jared314binding gives me a warning about not dynamic
00:54technomancyjared314: you can bind *ns*
00:54amalloyjared314: (eval `(do (in-ns ~'whatever.core) ~@forms))
00:55jared314this is the code: https://www.refheap.com/20060
00:55jared314perhaps it is the my repl instance
00:58jared314nm it was my repl instance
01:21jared314does the reader literal tag only apply to the next valid form?
01:25justdithi guys! I'm doing tests for my app which uses asynchronous call from Langohr. And I have a problem: lein exits before that asyn call finishes.
01:25justditIs there a way to solve this problem?
01:29coventrygfredericks: That trick of bashing LispReader/macros is awesome!
01:29amalloygfredericks: what have you done?
01:30coventryI will only use this power for good. :-)
01:34jared314coventry: what was this?
01:35bitemyappseangrove: http://nathanic.org/posts/2013/typed-clojure-tour/
01:36seangroveOh, very nice!
01:36seangroveI'll check this out sometime this week or weekend, need to add it to my core.async test
01:36coventryjared314: gfredericks's marginalia link demonstrates a way of implementing reader macros by fiddling with clojure's internal java structures.
01:37jared314coventry: can you post the link again? just lost my history
01:38coventryLogs are here: http://logs.lazybot.org/irc.freenode.net/%23clojure Link is https://github.com/gdeer81/marginalia/blob/master/src/marginalia/parser.clj#L63
01:39coventry*poof*
01:39jared314coventry: neat!
01:58arrdemjkkramer: any interest in structural hashing for Loom?
01:58arrdemjkkramer: I just did graph structural hashing and would be happy to work on a PR if you think it's something Loom could use.
02:28ta479,help
02:28clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: help in this context, compiling:(NO_SOURCE_PATH:0:0)>
02:51akurilinIs there any way of aliasing compojure routes without much duplication?
02:52akurilinAs in, my api routes are foo.bar.com/1/somethings and that doesn't look super nice in the URL bar if you're serving both HTML and json from the same routes
02:54xsynakurilin: json/1/somethings vs 1/somethings ?
02:55akurilinas in, I'd rather remove the api version from the URL since that's more internal
02:55akurilinand for mobile clients
02:56xsynah
02:56xsynI'm not sure how that would work
03:03ta479what are the major web frameworks for clojure, like Scala's Lift, play, scalatra, unfiltered, etc.?
03:06xsynta479: there's a library you can look at lib-noir, Clojure is more llibrary than framework driven
03:06xsynlook at lib-noir and compojure
03:09ta479xsyn: are there any examples I can learn from
03:11scottjta479: also pedestal
03:13xsynalso pedestal
03:14xsynwhich, depending on what you want to do may be like tying a rocket to your car ;)
03:14xsynta479: I'm trying to find what I got started with
03:14xsynta479: My understanding of Pedestal is that it's amazing for single page apps, scottj is that right?
03:15scottjxsyn: that's my understanding. I haven't used it.
03:15H4nsdoes anyone know whether there is a trick that makes primsmatic's schema.core support recursive definitions?
03:16H4nsi tried just specifying the name of a schema in its own definition, but that ends up with an unbound reference which cannot be validated
03:19H4nshttp://cljbin.com/paste/52661e2de4b067e3f51a922b
03:41ta479what's the difference between == and =
03:44xsynI'm not sure in Clojure
03:44xsynbut generally = is has same value
03:44junk325= is type independent
03:44xsyn== is same value and type
03:44junk325== tests for identical values
03:45ta479I don't get it
03:47jared314i thought == was only for numbers
03:48jared314,(== 1 1.0)
03:48clojurebottrue
03:49jared314,(== 1 "1")
03:49clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
03:49jared314,(= 1 "1")
03:49clojurebotfalse
03:50jared314,(= 1 1.0)
03:50clojurebotfalse
03:51ta479,(== 1.0 1)
03:51clojurebottrue
03:52ta479still confused
03:52jared314the value of 1 and 1.0 are the same
03:52jared314but
03:52jared314the type of 1 and 1.0 is different
03:53jared314== for numbers compares value
03:53ta479so xsyn meant = tests for same value and type?
03:53junk325look at the source
03:53ta479because he said == does that
03:53junk325https://github.com/richhickey/clojure/blob/a1eff35124b923ef8539a35e7a292813ba54a0e0/src/clj/clojure/core.clj#L886
03:54xsyn== tests for value and type
03:54xsyn= test for value
03:54jared314are you sure?
03:55junk325no
03:55junk325it's not based on type, solely
03:56junk325jared314: for numbers == just checks equivalence
03:57junk325for other types it tests for identical values
03:57jared314== doesn't work for other types, just numbers
03:57junk325== uses `(. clojure.lang.Numbers (equiv ~x ~y))
03:57xsynWhy would you specifically define an operator just for values?
03:57junk325= uses (clojure.lang.Util/equiv x y)
03:58junk325that's the difference between the two
03:58jared314xsyn: to easily compare double and int
03:58junk325how are you defining "values"?
03:58xsynah
03:58jared314number values
03:59ta479,(== "1")
03:59clojurebottrue
03:59xsynyes, that makes sense
03:59junk325yeah, what you said jared314
03:59Jarda,(== "1" 1)
03:59clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
03:59junk325= will equate nil with other non-nil values
03:59Jarda,(= nil 2)
03:59clojurebotfalse
03:59junk325== will only equate 0 with 0 in any form and not nil
03:59Jarda,(= nil 0)
03:59clojurebotfalse
04:00junk325,(= nil 0)
04:00clojurebotfalse
04:00junk325,(= nil false)
04:00clojurebotfalse
04:00ta479== only works on numbers though, so there are no other types it works with except for the trivial unary case
04:00jared314,(== 2 2/1)
04:00clojurebottrue
04:01junk325ta479 is right
04:01junk325(== nil 0) gives an exception
04:02junk325the docs should be more explicit about this
04:02akurilinHey guys, has anybody here dealt with the issue of selmer not being able to find .html templates once the project is uberjarred?
04:02jared314there should be better docs on the whole
04:03akurilinGetting a FileNotFoundException, but otherwise it works just fine non-jarred
04:03junk325lol
04:03jared314but that is a big task
04:03junk325a lot of the docs are written very obscurely
04:03junk325some are like mindtrap puzzles
04:03jared314they assume you have read the source
04:03jared314which isn't a bad skill to have
04:04junk325sometimes the source required digging into core clojure java
04:05gwsakurilin: what version of selmer
04:05ta479the doc for == also says returns non-nil which is ambiguous when it really always returns a bool
04:05jared314akurilin: is the template in the uberjar?
04:05akurilingws 0 4 6
04:05akurilinjared314, yes, I unzipped and looked inside
04:05gwsakurilin: i ask because of this https://github.com/yogthos/Selmer/commit/33f004e407b626bba0403568d8a6a9dd2bf567f2
04:05gwstry 0.4.8?
04:05amalloyakurilin: you're probably using (file ...) instead of (resource ...) somewhere
04:06amalloyie, "look here in the filesystem" (which doesn't exist in the deploy environment, rather than "look here on the classpath" (which the uberjar contains a copy of)
04:07akurilingws, yeah that was it :(
04:07akurilingws, or :) I mean
04:07akurilinamalloy, I was using render-file taking classpath in consideration, but I know what you mean, probably ran into that issue as well a dozen times.
04:10jared314there was a project awhile back, that showed up on hacker news, about searchable clojure function examples
04:10jared314you would search for a function and get example usages from some place
04:10jared314i wonder what happened to that
04:11akurilinyogthos, thanks for fixing that btw, made my night :)
04:12akurilinbitemyapp, btw, totally did what you mentioned a while ago with the gradual transition off of backbone to server-side rendering. Carving out one route at a time in nginx, chunk of the site is rendered by a completely different app
04:14jared314what is the preferred way to add new entries to *data-readers*? binding or set!
04:19ddellacostajared314: I seem to recall it being something different than this, but clojuredocs.org, while out of date, still has plenty of useful clojure function examples
04:20jared314ddellacosta: i remember it being different too. I think he was using the datomic clojure parser at the time.
04:21ddellacostajared314: yah, you could feed a "before and after" or something in, and it would give you functions that did what you wanted, right?
04:22jared314ddellacosta: I don't remember that part, but that would be cool
04:23ddellacostajared314: ah, maybe I'm thinking of something else then
04:24jared314ddellacosta: http://getclojure.org/
04:24ddellacostaoh neat
04:24ddellacostaoh, that's super fun
04:24ddellacostathanks jared314
04:26ddellacostaha, the first few results for juxt are hilarious: http://getclojure.org/search?q=juxt&amp;num=0
04:26jared314https://news.ycombinator.com/item?id=5839659
04:27ta479,(not= 1.0 1)
04:27clojurebottrue
04:27ddellacostajuxt juxt juxt juxt juxt juxt
04:27ta479,(not= 1 1)
04:27clojurebotfalse
04:27ta479,(not= 1 "1")
04:27clojurebottrue
04:27jared314he pulled the examples from the IRC logs
04:27jared314and clojuredocs
04:28ddellacostayah, wish they had added project links per that HN comment
04:28ddellacostaand there are definitely some garbage results, but ah well. Still a nifty idea
04:28ddellacostawith some refining thing it could be a great tool
04:28ddellacosta*think
04:29jared314it might be neat to parse the open source clojure projects and get a graph db of the related functions
04:30ddellacostajared314: ah, to see what kind of functions are used in conjunction with each other more often, for example?
04:30ddellacostathat would indeed be coo;
04:30jared314yes
04:30ddellacosta*cool
04:31xsynwoah, juxt is awesome
04:32xsynthe documentation is insane though
04:32ta479(cf map) is really long
04:33jared314is anyone board enough to take a look at my code and tell me if i'm doing something stupid
04:34jared314?
04:34jared314bored*
04:34jared314https://gist.github.com/Jared314/7095415
04:41jared314i'll take that as a nope
04:54ucbjared314: I'm not bored but need a distraction :)
04:54ucblooking.
04:54jared314ucb: thanks
04:55ucbright. Well above my punching weight. Apologies :(
04:55jared314ucb: np
04:56jared314ucb: I need to get back on task anyway
04:56ucbjared314: :)
04:56nonubyjared314, perhaps take a look at clojure style guide, above my punching weight too to comment on anything but style
04:58jared314nonuby: https://github.com/bbatsov/clojure-style-guide ?
04:58nonubythats the one
05:12uruvieljared314: what are you trying to do exactly? It looks like you want to parse some HTML (guessing from the hiccup) into a custom language?
05:12musicalchairjared314: that's interesting. it looks fun to play with. A bit above my punching weight & I'm not sure exactly where you're going with this (though I can guess). I might've shied away from using eval and written some sort of specific evaluator. I'd probably start with insta/transformer, actually. One thing to note is the implicit 'magic' of your code means you can't have a rule named 'grammar'. I would
05:12musicalchairsay that sort of style goes against the grain of clojure community but that's no reason to stop, necessarily
05:13jared314uruviel: i'm translating hiccup to sexp because instaparse only has hiccup and enlive output formats
05:13jared314uruviel: and you cannot add more
05:14uruvieljared314: aahh right, now I see. Haven't played with instaparse yet (it's on the todo-list somewhere)
05:14jared314musicalchair: i wasn't sure where to put the grammar
05:15musicalchairjared314: if you used insta/transformer, you could retain the implicit magic 'ns defines a langauge' by having a grammar var (as you do) and a transformer var that contains the transform map
05:15jared314musicalchair: i was hoping that the "user" would write the namespace and then use the register function
05:16yojimb012345hey all, question about decomposition within a fn i.e. double square brackets, I know what this code does but I am having problems visualising in steps what the syntax is saying specifically of the [[h s]] bit: (doseq [line (map (fn [[h s]] (str h " (" s ")")) (partition 2 (hn-headlines-and-points)))] (println line)))
05:16uruvieljared314: so (guessing here) you want to generate a language that generates sexp's?
05:17jared314uruviel: yes, it would simplify implementing the language functionality
05:17jared314uruviel: but, it was just an idea
05:18uruvieljared314: hmm interesting approach, any specific DSL (using the term liberally here) in mind? I mean, I assume you'd like a custom language instead of vanilla Clojure because you'd be able to express some abstractions better
05:19musicalchairjared314: if you didn't want to use insta/transformer, you could still have a 'fn-map' var (or something) and in hiccup->sexp, make some gensyms for the fn, use the gensyms instead of the ns syms, and wrap the form in a let that binds the fns to the gensyms. a little complicated...
05:20jared314musicalchair: hold on, still looking at the instaparse source to see if transformer will work
05:21jared314yojimb012345: the mapped function takes the partitioned items and splits them back out into to then concat them into a string
05:21notofiWhy is this function also "declaring(defn init [] (defn add5 [a] (+ a 5)))
05:21notofiWhy is this function "declaring" add5 without me even calling (init)
05:23jared314yojimb012345: it will take the (1 2) and assign 1 to h and 2 to s
05:24uruvielnotofi: because defn simply expands to (def (fn ...)) and defs define vars, which are bound to the namespace (iirc)
05:25notofiuruviel: yes but the "defn add5" is never evaluated
05:25notofiuruviel: it should only be evaluated when I call (init)
05:27uruvielnotofi: it shouldn't and it doesn't in my REPL
05:28notofiuruviel: In my repl its like this: user=> (defn init [] (def Z 100))
05:28uruvielnotofi: http://pastebin.com/4Wj5DGPj
05:28notofi#'user/init
05:28notofiuser=> Z
05:28notofi#<Unbound Unbound: #'user/Z>
05:28TEttingeryes
05:28TEttingerthat means it isn't declared
05:29TEttingerunbound fn
05:29TEttingeror rather unbound unbound
05:29TEttingerit doesn't even know its an fn yet
05:29notofibut the symbol Z should not be able to be resolved
05:29TEttingerit isn't.
05:29TEttingertry calling it
05:30TEttingerheck try calling qwerrtyyyyyy
05:30TEttingershould be the same
05:30notofiits not the same
05:30notofiuser=> Y
05:30notofiCompilerException java.lang.RuntimeException: Unable to resolve symbol: Y in this context, compiling:(NO_SOURCE_PATH:0:0)
05:30clojurebotHuh?
05:30notofiuser=> Z
05:30notofi#<Unbound Unbound: #'user/Z>
05:30TEttingeroh interesting
05:31notofiit has the same effect as if I would be (declare Z)
05:31TEttingeryou can still defn over it
05:32TEttingeryou're right, that is odd. it probably has to do with some compile-time stuff with defn
05:33uruvielnotofi: hmm that's weird. You might wanna look through the defn source, maybe that explains it
05:34jared314musicalchair: I was hoping to extend the functions called beyond just transformations. So, you could implement the functionality of a dsl with clojure functions that match the grammar rules. I could generalize the hiccup->sexp to be a parse-tree transform though.
05:44jared314musicalchair & uruviel thanks for the help
08:35jtoyis there a simple function to check if a type is any numeric value? I am getting back nil or NaN or Infinity sometimes, but i want the value to be any float or integer
08:35llasramYes, but -- ##(number? Double/NaN)
08:35lazybot⇒ true
08:40jtoyI will just check for the type being a double or integer than
08:40jtoyi didnt know about number?
08:40llasram##(float? Double/NaN)
08:40lazybot⇒ true
08:40llasram##(instance? Double Double/NaN)
08:40lazybot⇒ true
08:40llasramBut: ##(Double/isNaN Double/NaN)
08:40lazybot⇒ true
08:41llasramBut: ##(Double/isInfinite Double/POSITIVE_INFINITY)
08:41lazybot⇒ true
08:41llasramSo those may be what you really want to check
09:09glosoliI have a map like this {:entry1 "val1" :entry2 "val2" :entry3 "val3"} I am curious if there is some alternative to update-in, that could update given set of keys by executing function on each of the value ?
09:10llasramglosoli: It's not in the standard lib, but a function usually named `map-vals` is a pretty common utility function
09:10mdrogalisglosoli: fmap?
09:10mdrogalisclojure.algo.functors I think
09:10glosoliaaa ok thanks sirs
09:10mdrogalisAs llasram said, not in the standard lib.
09:31coventry2mdrogalis: clojure.algo.generic.functor
09:34yedi_https://github.com/yedi/chatter/blob/master/src-cljs/chatter/app.cljs ; why is (name :keyword) causing raising an exception here?
09:34yedi_dnolen bitemyapp, just a ping to see if you guys were able to take a look aat this
09:35Morgawryedi_: what exception is raised?
09:36mdrogaliscoventry2: Thanks :)
09:38yedi_Morgawr: https://gist.github.com/yedi/9562cebf6bc6e74d0a1a
09:41Morgawryedi_: weird, I don't really know D:
09:45yedi_Morgawr: thanks for lookin anyways
09:46Morgawryedi_: does it happen if you use the full name? cljs.core/name ?
09:46Morgawrbecause maybe it's getting shadowed/masked by something else
09:47yedi_ill try it
09:52yedi_no change
09:53Morgawryedi_: that's weird then, I know they changed the way keywords are stored in cljs internally, the version I have of cljs is still an old one so I can't test (also on a bad connection)
09:53Morgawrmight be a bug
09:53Morgawrdoes it happen in a cljs rhino repl too?
09:53yedi_i had one in the 1800s and then someone also suggested i upgrade to the newest when this bug appeared
09:54yedi_but it didn't fix it
09:54yedi_i just put up the whole repository so people can try to figure out if im doing something dumb elsewhere
09:55yedi_and nope
09:55yedi_it doesn't happen in a rhino repl. which is what makes this so odd
09:56Morgawryedi_: yeah, definitely weird, I wish I knew more about cljs to help but unfortunately I don't
09:57yedi_yea np
09:57vanitha./script/run Error: Could not find or load main class clojure.main
09:57vanithabeginner to clojure. looking for your help. unable to get koans to run
10:07xeqivanitha: which version of leiningen are you using?
11:05dbsrhey all
11:05dbsrim using euler challenges to learn clojure, i only started just now, and i was wondering about indentation
11:06dbsror rather newlines
11:06dbsrwhen to start one
11:06dbsris this ok for example http://bpaste.net/show/142834/
11:06mdrogalisdbsr: https://github.com/bbatsov/clojure-style-guide
11:06mdrogalisdbsr: Use =, not == :)
11:07dnolenyedi: your example app is pretty complicate w/ no instructions on how to run it.
11:07glosoliis there some nice pastebin for clojure that runs the code ?
11:07dbsrthanks mdrogalis
11:08H4nsglosoli: cljbin.com
11:08dbsrwhats the difference if I may ask? like js == ===?
11:09tazjinHej guys! If I set repositories in a Leiningen profile it seems like the ^:replace metadata is ignored. Is there a workaround?
11:09mdrogalisdbsr: = for value equality, == is numeric equality I think?
11:09mdrogalisI've actually never seen anyone use ==
11:09winkglosoli: http://cljbin.com/
11:09dbsrheh, got it from here http://java.ociweb.com/mark/clojure/article.html#FP
11:10glosolithanks sirs
11:22dobry-denI find myself frequently mapping `int` across byte-arrays to do seq things on them (like concat), and then (byte-array (map byte ...)) when i'm done.
11:22yedidnolen: my b, I added instructions for running it: https://github.com/yedi/chatter/blob/master/README.md
11:23dobry-denI don't remember my question
11:25arrdemclojurebot: ping
11:25clojurebotPONG!
11:25`cbpdobry-den: :P
11:26Morgawrhttp://nathanic.org/posts/2013/typed-clojure-tour/ really great article found on HN, probably it's been shared before but.. enjoy :)
11:27arrdemMorgawr: the author posed it in #typed-clojure about 24hrs ago. Good read.
11:27Morgawraw damn, there's a #typed-clojure channel
11:27Morgawrthanks for letting me know :)
11:27dobry-denHere's a question: Would you say it's bad form to (let [x (get mymap :mykey (ex-info "Invalid"))] ...) instead of checking `x` in the body?
11:28arrdemyeah it's kinda dumb... so low traffic that they should really be in here.
11:28llasramdobry-den: Well, `ex-info` just returns an exception, not throws it, so...
11:28Morgawrarrdem: I'll just idle, sniping for interesting conversations hehe
11:28llasramdobry-den: But `get` is just a function, which evaluates all of it's arguments first, so doesn't really support that sort of idiom
11:29arrdemMorgawr: lurkin is the way to do it..
11:29dobry-denllasram: I meant `or`
11:29llasramI think that one seems perfectly reasonable :-)
11:29llasramWell, unless the value in the map might be `false` or `nil`
11:30dobry-denllasram: I'm pretty newb with exceptions. I've been using ex-info this week for exceptions but never came across a difference between returning them vs throwing them
11:30dobry-deni seem thrown in that any time they are evaluated in my code they show up to the user and halt progress
11:30ToBeReplaceddobry-den: i would do that in a precondition
11:31llasram##(ex-info "foo" {})
11:31lazybot⇒ #<ExceptionInfo clojure.lang.ExceptionInfo: foo {}>
11:31llasram##(throw (ex-info "foo" {}))
11:31lazybotclojure.lang.ExceptionInfo: foo {}
11:31ToBeReplacedlike (defn myfun [m] {:pre [(contains? m :mykey)]} ...)
11:31xeqidobry-den: are you interested in something like ##(doc if-let) ?
11:31lazybot⇒ "Macro ([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
11:31llasramAn exception is just an instance of a class which extends Exception (or more generally, Throwable)
11:32llasramIt doesn't cause non-local exits until you `throw` it
11:33cleos_freyhey guys, is there anyway to pull out the doc string of a method (eg, (do-magic myfn) => "This is a docstring")
11:33dobry-denllasram: Weird, maybe I just thought I tested it
11:33llasramcleos_frey: ##(-> #'first meta :doc)
11:33lazybot⇒ "Returns the first item in the collection. Calls seq on its\n argument. If coll is nil, returns nil."
11:34dobry-denToBeReplaced: that's great, thanks.
11:34cleos_freyllasram: what do the hashes mean?
11:34jkkramerdobry-den: for that use case, there's also safe-get: https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj#L89
11:34llasramcleos_frey: The ## outside the parens just tells lazybot to evaluate it
11:35jkkrameror prismatic's schema, for describing/enforcing more complex data shapes
11:35cleos_freyoh haha
11:35llasramcleos_frey: The #' means you want the var itself for `first`, not the value of the var `first`
11:35llasram##[first #'first]
11:35lazybot⇒ [#<core$first clojure.core$first@d1931f> #'clojure.core/first]
11:36dnolendbsr: == is only for numbers
11:36ToBeReplacedi'd like to see more clojure libraries use preconditions to sanitize their "options" input -- it's a pet peeve of mine when i pass ":stream" to find out i should be passing ":as-stream" or similar
11:37cleos_freyllasram: perfect, thank you!
11:46dbsrhey, how woould i rewrite this http://java.ociweb.com/mark/clojure/article.html#FP so the iteration / comprehension stops when the sum of the filtered result is > n?
11:46dbsrow wrong link
11:46dbsrhttp://bpaste.net/show/142844/
11:46mdrogalisdbsr: take-while
11:47llasramHmm, I don't think so
11:47llasramIf you're using Clojure 1.5.x, you can write it using `reduce` and `reduced`
11:47mdrogalisllasram: Where do you see the problem?
11:47dbsrlemme see, i only installed it this afternoon
11:47dbsrits 1.5.1
11:48cleos_frey[I/exit
11:48dbsrimma have a look at the docs, thanks mdrogalis llasram
11:48llasrammdrogalis: take-while applies a predicate to the individual values, not to an aggregation over the values
11:48cleos_freylets try that again
11:48llasramdbsr: One sec -- when you say "installed," OOC what did you mean?
11:48dbsrheh, through the package manager of arch
11:49mdrogalisllasram: Ah, nice. I was too quick.
11:49llasramdbsr: If that didn't actually install Leiningen, then most people here would suggest doing that before playing around much further: http://leiningen.org/
11:49dbsrgot lein running, thanks :)
11:49llasramOk, cool :-)
11:49dbsruse lein repl for the vim plugin
11:49llasramAwesome
11:50dbsryea, looks like reduce should do the trick, thanks again
11:50mdrogalisllasram: Can you show me an example of using reduced ? I haven't see it before.
11:52llasramSure: ##(reduce (fn [sum x] (let [sum (+ x sum)] (if (pos? sum) (reduced sum) sum))) -123 (range))
11:52lazybotjava.lang.RuntimeException: Unable to resolve symbol: reduced in this context
11:52llasramHah, lazybot
11:52llasram,(reduce (fn [sum x] (let [sum (+ x sum)] (if (pos? sum) (reduced sum) sum))) -123 (range))
11:52clojurebot13
11:52llasram&*clojure-version*
11:52lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
11:52hyPiRionwhaaat
11:52llasramGet with the times, lazybot!
11:53hyPiRionRaynes: what have you done? :o
11:53mdrogalisllasram: Ah, nice. Thanks :)
12:00tickinghas anybody thought about writing a websocket as core.async channel abstraction lib? I'm wondering if ws should retain their unbounded nature or if a protocol should enforce boundedness like with regular channels.
12:03xeqiticking: https://github.com/lynaghk/jetty7-websockets-async
12:03mdrogalisticking: Let applications decide IMO.
12:04xeqiit was used in the torus pong clojure cup submission https://github.com/uswitch/torus-pong/
12:04tbaldridgeticking if you are going to that I'd recommend looking into using dropping buffers as well. The semantics around alts! are a bit interesting. what does this mean? (alts! [[socket1 42] [socket2 42]]). If you want to stick to core.async semantics that should send to either one or the other, not both.
12:04tickingxeqi: yeah kevin simply uses dropping channels iirc, but no guarantee of delivery over a guarantee of delivery medium seems like the worst default to me
12:05tbaldridgeticking: this is a network connection, you can never really guarantee delivery.
12:05tickingtbaldridge: on not delivery the connection closes
12:06tbaldridgeWhat if you put into a channel and them the socket closes, what do you do with the value you took from the channel?
12:06tbaldridgewhat do you do if the message gets to the remote end, and the remote buffer is full?
12:07tickingyeah, but you know that the last n (depending on the websocket buffer size) messages might got lost
12:07tickingtbaldridge: yeah, thus the protocol on top of ws messages that enforces delivery
12:08tickingwell, delivery of channel closing
12:09tbaldridgeticking: so basically make everything use (dropping-buffer n)
12:09tbaldridgeticking: or sliding-buffer, but IMO that's the only way to do networking with core.async correctly.
12:09tickingtbaldridge: dropping buffers put you into a limbo of a semibroken connection
12:10tbaldridgeticking: welcome to networking. The only reliable semantics are "at least once delivery"+ack messages+idempotent messages
12:10tbaldridgeticking: notice how not even Erlang attempts to solve this. In Erlang everything is "best effort delivery"
12:11tickingerlang is the actor model, core async is csp
12:11tickingthey have a fundamentally different approach when it comes to message passing
12:11tbaldridgeticking: and networks are not csp. Don't try to turn them into something they are not. Physical machines have locks, transactions etc.
12:12tickingtbaldridge: and still we generally use tcp instead of udp
12:12tbaldridgeThat's why CSP exists at all, we can guarantee that a CPU core won't suddenly disconnect from the system. We know that if we put memory into memory location X it will get there, (aside from torching the machine).
12:13tickingtbaldridge: just because we can't guarantee delivery absolutely, does not mean we have to give no guarantees
12:14seangrovetbaldridge: If core.async can't guarantee memory updates through a simple machine torching, sounds like a ticket needs to be filed
12:14tickingtbaldridge: with a certain certainty yes
12:14tbaldridgeseangrove: ??
12:14lazybottbaldridge: Uh, no. Why would you even ask?
12:15seangrovetbaldridge: Sorry, attempt at humor and and apparent miss
12:15tickingtbaldridge: nevertheless we can guarantee certain things for example, we guarantee delivery except for the n last send messages
12:15tbaldridgeticking: that's fine, but that doesn't match the core.async semantics. So now we're in a odd world where a thing looks like a channel, acts like a channel, but has different semantics.
12:16tbaldridgeticking: so that's my point. Either make everything unreliable (and have it fit with core.async semantics), or make it a completely different thing that isn't called a channel.
12:17tickingtbaldridge: no not really, say we have a simple send ack-receive protocol on top of websockets, we should be able to leave unreceived messages in the cannel
12:18tickingwhich is exactly core.asyc semantics, if its not removed it stays in the channel
12:18seangroveticking: Isn't that something you could build on top of core.async as a library?
12:18tickingtbaldridge: if the connection breaks down, your application disgards that half filled but now closed channel
12:19tbaldridgeticking: so that's the problem. Core.async uses two-phase commit. And now you hit the messenger problem. You send "recv message", the remote end acks it, you never get the ack (connection dies). Now what? The remote end is processing the message, but it hasn't been removed from the queue.
12:19tickingseangrove: I'm definately not proposing this to be built into core.async
12:20tickingtbaldridge: when your websocket dies you can assume that the client dies as well
12:20tbaldridgeticking: really? Did it process the message? If the remote end was going to launch a missile, was the missile launched or not?
12:21tbaldridgeit all comes down to this problem: http://en.wikipedia.org/wiki/Two_Generals'_Problem and it cannot be fixed, that's life. Network connections are unreliable.
12:21tickingtbaldridge: you are assuming that the two sides have the same authority
12:21tbaldridgeThe only way fix it is via idempotent messages. At that point reliability doesn't matter.
12:21tickingtbaldridge: with websockets they have not
12:22tbaldridge?
12:22tickingtbaldridge: ther client is basically a slave, once the connection breaks down, it dies as well
12:23tbaldridgeticking: that's not exactly true. I worked on a system that used websockets. They auto-reconnect. I would often restart the server and never restart the client. The WS would reconnect and continue to operate as expected.
12:24tickingtbaldridge: that is a border case I'm happy to ignore
12:25tickingtbaldridge: in 99% of all web applications the server is assumed to be reliable while the client is not
12:26tickingtbaldridge: but even in your scenario the client basically becomes the classical server and vice versa
12:27tbaldridgeI suppose, if you ignore certain physical constraints, it becomes easier to write code that works in the "normal" case.
12:28tbaldridgeI would prefer to write systems that continue to work even if things aren't "normal".
12:28tickingtbaldridge: why do you treat websockets like udp, they are not
12:29seangroveticking: With websockets, is there no possible way a message ACK can be lost?
12:29seangroveIs it guaranteed to be delivered even if it's dropped several times?
12:29tbaldridgeticking: It's just that the most common intersection of core.async and ws looks something like UDP. Stop trying to make things look like channels that aren't channels, and I don't have a problem.
12:30tickingseangrove: with every use case proposed so far, when the ack gets lost, the side which send the ack is dead
12:30tickingseangrove: so you never get a split brain situation
12:31seangroveWell, it's all over my head. But I suppose if you can get it to work, it would be interesting to see.
12:32tickingtbaldridge: udp looses messages between messages, websockets don't do that, so they are basically an unbounded chan which looses its messages when closed
12:33tickingtbaldridge: so an unbounded single consumer multiple producer channel
12:33tbaldridgeticking: unbounded chan that looses messages is nothing like CSP
12:33tbaldridgeor looses on close that is.
12:34tickingtbaldridge: with buffersize 0 it is
12:34tbaldridgeticking: with buffersize of 0 you can't even enqueue unless a remote side will accept the message and then it always delivers the message (even if the channel is closed).
12:37tickingtbaldridge: 1 yes wheres the problem, 2 that sounds like a bug to me
12:37tbaldridgeticking: all I'm saying here, is that a lot of people have but thought into this, and there's a reason Kevin's system uses dropping-buffers.
12:38tbaldridgeAnd with idempotent messages one can always add reliable messaging to something like Kevin's code.
12:39tickingtbaldridge: yeah but idempotency is a whole unnessecary can of worms
12:40tickingtbaldridge: look I agree 100% percent with you, when it comes to networking in general, just not for websockets^^
12:41dobry-den(.toByteArray (biginteger x)) -> No method .toByteArray for clojure.lang.BigInt. (.toByteArray (.toBigInteger (biginteger x)) -> No method .toBigInteger for java.math.BigInteger.
12:43tbaldridgeWebsockets are not magic, they are network protocols. I don't see how it is any different
12:47tickingtbaldridge: in the way one client's existence depends on the existence of the connection
12:51tbaldridgeticking: I suppose you could get by with saying "if the network connection dies you must restart your app". Although for most systems I work on that would be a painful requirement.
12:52tbaldridgeticking: switch off the VPN, reload your app. Switch from Wifi to hardline, restart your app. Someone steps in front of your flaky wifi connection, restart the app.
12:53tickingtbaldridge: yes to all but the last one ^^
12:53tbaldridgeLike I said, redefine the parameters of the problem, and I suppose something like this could work. But I'd hate to base an entire app on such assumptions.
12:55tbaldridgeA better idea, imo is to use unreliable semantics, then use core.async to layer reliable semantics on top when you need them. Mix in a bit of idempotent-ency where needed and that sounds like a much better solution, imo.
13:02seangrovebitemyapp: You remember at the prismatic meetup they talked about marquee they would insert in code in different sections? I was wondering if there's actually a term for that
13:02technomancypage breaks or gtfo
13:02seangrovetechnomancy: in source code?
13:03technomancyseangrove: hells yea
13:04technomancythey're just whitespace
13:13arrdemtechnomancy: what exacly does that generate in an editor?
13:13arrdem* how does it render
13:13technomancyarrdem: emacs renders it as ^L
13:15technomancysupposedly there are tricks to get it to render like an <hr>
13:15technomancyhmm; I should set that up
13:16seangrovetechnomancy: Please share if you find it
13:16arrdem; C-79 RET -
13:16arrdem:P
13:17coventryhttp://www.emacswiki.org/emacs/PageBreaks
13:17arrdem(inc coventry)
13:17lazybot⇒ 3
13:17technomancyemacs also has bindings for jumping forward and backward by pages
13:18arrdemtechnomancy: I know Emacs can navigate by pages, I was curious if emacs did whitespace padding to fit _only_ one page-break deliminated hunk on the screen
13:19technomancyarrdem: nah
13:20tickingtbaldridge: btw, you convinced me to go with reconnect-ability and unreliability, but I still 90% of all code will ignore the latter
13:20ticking*think
13:23technomancyI can confirm that M-x package-install page-break-lines works
13:23coventryI'm wondering whether it would be a good idea for the compile/eval functions in Compiler.java to wrap any exceptions from calls to macroexpand* in CompilerExceptions. Would make it easier to find errors by providing source location info. Anyone seen prior discussion of ideas like this?
13:35coventryI guess the try/catch in AnalyzeSeq gets most of these cases already, actually.
14:49metactusis there a way to recur with a different arity if the function is overloaded?
14:50amalloymetactus: not tail-recursively (ie, with recur), but you can just call the function again, by name
14:51jared314what about trampoline?
14:51amalloycompletely irrelevant
14:52jared314amalloy: ouch, just trying to learn here
14:52metactusamalloy: that worked, thanks
14:52mdrogalisThat was a bit uncalled for. :/
14:52AimHereIf you call the function again, that will eat up the stack though, won't it?
14:53coventrytrampoline actually seems like a sensible solution, if the different-arity calls turn out to overflow the stack.
14:56amalloycoventry: (defn foo ([x] x) ([x y] (trampoline #(foo x)))) doesn't use up any less stack space; you have to rewrite other related functions in order to get a net benefit from the trampoline
14:59mikerodWould AOT compilation be to blame (or a suspect) for slower start up times of an uber-jar that has the clojure jar along with a small program written in clj?
14:59mikerodWith verbose output on java jar, it seems that a lot of classes are being loaded upfront, is this expected?
15:00technomancymikerod: I've never heard of AOT being anything but a help for startup time
15:01mikerodtechnomancy: that's what I was thinking
15:02coventryamalloy: Yes, it's pointless to transfer through a trampoline call. It might make sense in the context of a trampoline for foo to return something like #(if pred (foo x) (foo x y)), though.
15:03bitemyappseangrove: the marquee thing, was this one of the lightning talks or a Prismatic thing?
15:03coventrys/transfer/recur/
15:07dnolenyedi: not sure when I'll have time to look at your app, IMO you should try to recreate the problem with a simpler app with no deps besides CLJ and CLJS.
15:29dobry-denIn Java, if you pass `array1` into (fn [array] array[0] = "foo"), does that mutate array1 or just a copy of it?
15:30ndpAs with most things in Java, array parameters are pass-by-reference so that will mutate array1 in place.
15:31dobry-denndp: thanks
15:31dobry-denthat's really confusing
15:33ndpWhat's really annoying coming from Clojure is how the Guava Collections libraries handle sorting - they generally sort in place. It really messes with my Zen thing.
15:33cmajor7need an opinion: need to walk a sequence until something is found. "map/reduce/filter" walk the sequence in full. "loop" is "somewhat too imperative" :), maybe "while".. but also feels very similar to loop. what do you guys think?
15:33coventrycmajor7: check out (reduced) for stopping a reduce loop.
15:34hyPiRionmap and filter doesn't walk a sequence in full.
15:34ndpfilter returns a lazy seq so you can stop iteration when you find the element
15:34dobry-dencmajor7: (first (filter pred coll)) stops at first match becuase filter is lazy
15:35llasrammod chunking
15:35Morgawrcmajor7: maybe take-while? depends on what you need
15:35amalloyalso (some is-this-the-thing? coll)
15:36amalloywell, i guess that returns a boolean, so is only what you want if you just want to know whether something is there, rather than what is there
15:36cmajor7coventry: I think that is exactly what was missing.. reduced was added in 1.5, missed it.
15:36dobry-denllasram: are 32 realized at a time
15:36Raynesgf3: You're unoriginal and that's bad and you should feel bad.
15:37llasramdobry-den: That's how the current implementation works, yeah
15:37hyPiRion&*clojure-version*
15:37lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
15:37dobry-denndp: ive had my clojure blinders on for so long that the ruby version would also mutate in place. i remember now that it was what inspired me to try clojure after working on a large codebase.
15:37cmajor7amalloy: some is good too, I am doing ternary tree breadth first search.. (until I find something) so on each level I do (3^level) things.. hence wanted to stop somewhere..
15:38gf3Raynes: I used to think I was too hip to be unoriginal
15:38llasramRaynes: Yeah, what's up with lazybot? Poor, sad, old lazybot
15:38gf3Raynes: Now I just have too many pairs of tight pants
15:38Rayneslazybot: kill
15:38lazybotKILL IT WITH FIRE!
15:38Raynesgf3: You should use snapchat.
15:38gf3Raynes: I am a snapchat machine
15:38gf3Raynes: Add me: LOLgianni
15:39bitemyappgf3: if I add you, do you promise to send pictures of the puppy?
15:40gf3bitemyapp: Sadly I'm on the other side of Canada now :(
15:40gf3bitemyapp: But I can send you cute-as-fuck cat snaps
15:40bitemyappgf3: deal.
15:40gf3bitemyapp: Also shitty dance moves and really horrible selfies
15:41gf3Raynes: Also FWIW I agree with you, re: beard
15:41cmajor7dobry-den (and others): yep, (first (filter pred..)) will also "do it" since map/reduce/filter are in fact lazy (although by 32). cool, now I have plenty to choose from, although "reduced" sounds great to try, since it is all new and shiny :)
15:41llasramcmajor7: `reduce` is not lazy
15:41llasramFYI
15:41Raynesgf3: Fight the power!
15:42Raynesbitemyapp, gf3: Funfact: I walked past the snapchat headquarters on the Venice boardwalk about two weeks ago. Didn't even realize it was there until I saw the big ol' snapchat icon.
15:42hyPiRionhuh what beard
15:42gf3Raynes: And then it disappeared after 10s
15:42pandeiroshould async's go blocks work as expected when used from the browser REPL? or only in pre-compiled code?
15:43bitemyappRaynes: I saw when I visited you in LA
15:43bitemyappsaw it*
15:43cmajor7llasram: but "reduced" will stop it whenever "I want" e.g. "found"
15:43cmajor7,(doc reduced)
15:43bitemyapptheir beachhouse is the best use of VC money I've ever seen
15:43clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
15:43Raynesgf3: lol
15:43llasramcmajor7: Yes. Doesn't make it lazy though :-)
15:43cemerickdnolen: On cljs master, (rseq []) => (); Clojure returns nil for the same. Do you want a ticket for that?
15:44cmajor7llasram: oh, you are referring to my statement of it being lazy. yes, it is not. thx
15:45bitemyapphrm. Creepy. My landlord has a snapchat account that starts with "PicChic"
15:45dnolencemerick: sure, preferable that the patch follow any performance related optimizations present in Clojure
15:45dnolencemerick: not saying there are any (haven't looked myself)
15:46cemerickdnolen: Sure; I'm personally more interested in correctness/compat at the moment, but I'll take a look.
15:49dnolencemerick: ok I took at peek, I want a fast patch for that just like Clojure + tests
15:49dnolencemerick: implementers of IReversible need to do the right thing.
15:49cemerickdnolen: sorted-map is correct, which is something
15:54dnolencemerick: as long you're there note you can type-hint the return value of rseq as ^seq, and type-hint coll as ^not-native in this case.
15:58cemerickdnolen: OK, "fast patch"? The fix is to simply drop the else branch from -rseq @ 3315, no? (and 707 for that matter)
15:59dnolencemerick: sounds good to me, I just didn't want a seq or empty? call in rseq
15:59cemerickoh, sure
15:59cemerickI'm going to have to read the compiler a bit to really know what the ^seq and ^not-native hints are for. Will take a closer look at that later.
16:00cemerickI mean, I can guess, but that's probably not a good idea. :-)
16:00dnolencemerick: ^seq is just to propagate information so we don't have truth calls around conventions like
16:00dnolen(if (seq foo) ...)
16:00dnolenor
16:00dnolen(let [s (seq foo)] (if s ...))
16:00dnolen^not-native is to remove protocol indirection
16:00cemerickdnolen: so ^seq guarantees not-empty?
16:00dnolenand get direct dispatch
16:01dnolencemerick: no in this case ^seq just means it's a ^seq value, nil or a seq
16:01cemerickok
16:01cemerickdnolen: *realized*, then?
16:02dnolencemerick: nope, it's like the ^boolean type hint
16:02dnolenit's really just for (if x ...)
16:02cemerickdnolen: then how does it help you avoid (seq x)?
16:02cemericki.e. if it's a lazy, empty seq
16:02dnolencemerick: sorry I think you're getting confused what it's for
16:03cemerickheh
16:03cemerickalmost surely
16:03dnolen(defn ^seq rseq [coll] ...)
16:03cemerickNeed to read some internals :-)
16:03dnolenthis communicates to the compiler that the result can be tested with (if x ...)
16:03dnolenw/o needed to check for stupid JS false-y values
16:03dnolenneeding
16:04dnoleni.e 0 and the blank string
16:04cemerickdnolen: ok, so it's more of a host mask than actually statically guaranteeing anything about (seq x)
16:04tos9 /qui
16:05dnolencemerick: yep, only about performance same as ^boolean
16:05clojurebotExcuse me?
16:06cemerickdnolen: and will ^not-native on rseq's `coll` arg emit a warning on e.g. `(rseq (js/Array.))`?
16:06dnolencemerick: no, runtime exception just like Clojure
16:07dnolencemerick: none these type hints are about verification - only optimizations hints to the compiler
16:08dnolencemerick: though later down the line when we have more inference in the compiler - I would like to start emitting warnings
16:11pandeirodnolen: should go blocks work from the browser repl or just in pre-compiled code?
16:12dnolenpandeiro: I don't see why it would make a difference, though doing go block at the REPL might get hairy with running event loops
16:12dnolener go loops
16:12pandeirodnolen: yeah i am just trying to recreate your examples (the simplest ones) from your blog
16:13pandeiroand what i notice is that (<! ...) doesn't seem to work
16:13pandeirostuff gets put! on channels fine and the go block itself returns some kind of object with dirty puts et al
16:14dnolenpandeiro: I haven't tried core.async w/ brepl so I can't say definitively but I'd be very surprised.
16:14pandeirobut the special <! take operation doesn't do anything
16:14dnolenpandeiro: <! only works in a go block
16:14pandeiroright i am evaling the whole form
16:14pandeiro(go (let ... (while true ... (<! ...))))
16:15dnolenpandeiro: but what channel are you reading from and is someone else *already* reading from it
16:15dnolenpandeiro: which is what I alluded to above, running go loops and REPL interaction is going to be very tricky
16:15pandeirookay...
16:16pandeiroi defined a listen exactly like yours, with no callback but returning a channel
16:16pandeirothen i do (let [c (chan)] (go ...)) and use that very chan
16:16pandeiroeven that first use would have issues?
16:17pandeirosorry (let [c (listen ...) ] above
16:19dnolenpandeiro: if you evaluate the entire let block should be OK
16:19pandeirodnolen: i am using a pre-compiled cljs, that wouldn't be an issue though i imagine
16:19pandeiro( cljs i am using is this: https://gist.github.com/pandeiro/6628294/raw/clojurescript.plus.js )
16:20dnolenpandeiro: I would not expect that to work at all
16:20noncomi know i can destuct maps in function arguments. but can i destruct nested maps?
16:20dnolenpandeiro: core.async now needs 1934
16:20pandeirodnolen: i have a more recent build locally
16:21pandeirodnolen: as for not working, every other lib seems to
16:21pandeiroit lets me start up a browser repl server and have cljs anywhere i inject a bookmarklet, which is fun
16:21dnolenpandeiro: because you're getting lucky
16:21dnolenpandeiro: in general you cannot rely on this behavior
16:21dnolenpandeiro: core.async is perf sensitive and relies on 1934
16:22dnolenchanges in 1934, I mean
16:22pandeirodnolen: ah yeah no the build i am using i 1934
16:22pandeirothe github one is old
16:22pandeiroi have another local version
16:22pandeirobut you meant 'getting lucky' about the pre-built cljs in general?
16:22dnolenpandeiro: yes
16:22pandeiroworking with the browser repl / bookmarklet?
16:22dnolenpandeiro: you must build everything together
16:22pandeirowhy is that lucky?
16:22ianeslick@cemerick Do you have a second to chat about immutant logging?
16:22dnolenpandeiro: because the compiler could change
16:22pandeiroah
16:22dnolencalling conventions and who knows what else
16:23ianeslick@cemerick There is an interesting issue regarding making dynamic logging changes 'sticky'
16:23pandeirobut *if it built*
16:23cemerickianeslick: oh?
16:23dnolenpandeiro: yes if everything is built with the same version of the compiler - this approach could work - though I don't see the point.
16:24ianeslick@cemerick If I call .setLevelName on the result of a .getLogger call it doesn't stick. But if the Logger from getLogger is printed to the repl, then I call .setLevelName, it works. Feels like something somewhere is lazy
16:24dnolenbbiab
16:24ianeslick@cemerick I can't figure out what the repl is doing that causes the logger (a new logger) to be persisted.
16:25ta479Can anyone explain this complicated type signature to me: http://pastebin.com/HfKvqQLg
16:26cemerickianeslick: well, j.u.l.Loggers don't have much smarts to them, so I'd doubt there's laziness around
16:26ta479it seems unnecessarily complicated compared to haskell's fmap :: (a -> b) -> f a -> f b
16:26cemerickianeslick: are you doing something similar to my gist?
16:26ianeslickYes
16:27ianeslickYes, I didn't see anything walking through the code
16:27brehautta479: if clojure's map and haskell's fmap did the same thing, then saying map's type is unnecessarily complex would be sensible. but they dont
16:27cemerickianeslick: I'm still on immutant 1.0.1 I think, if that matters *shrug*
16:27ianeslickProbably not, I don't think the log manager was updated.
16:28ta479brehaut: the only difference I see is variadic parameters
16:28brehautta479: clojure's map is only fmap over sequences, not arbitrary structures, but it is also also zip due to varargs
16:28ianeslickI can log against the logger, but the log level doesn't stick until I allow the logger to be printed by the REPL. Very odd!
16:29brehautta479: also, typed clojures type system is different to haskells. it can encode some things that are difficult in haskell, eg non-empty sequences
16:29cemerickianeslick: There's absolutely either a race condition or a module init order issue that forces the application of that namespace at the *end* of my immutant.init. Are you doing that? Even if you are, it may be that we're forcing the loading of modules in different orders, at different times, etc.
16:30ianeslick@cemerick This phenomenon happens after load time; I use XML to set a default state, then am writing some REPL tools to change settings during development. e.g. this works: (switchboard.utils.sys/set-logger-level (str *ns*) :debug)
16:30ianeslickBut this has no effect: (do (switchboard.utils.sys/set-logger-level (str *ns*) :debug) nil)
16:31ianeslick(defn set-logger-level
16:31ianeslick "Sets the log level for a namespace"
16:31ianeslick [namespace level]
16:31ianeslick (let [level (.toUpperCase (name level))]
16:31ianeslick (doto (get-logger namespace)
16:31ianeslick (.setLevelName level)
16:31ianeslick (.log (Level/parse level)
16:31ianeslick (str "Enabling logging of " *ns* " at " level))
16:31ianeslick (.getLogContext))))
16:31ianeslickSorry, should have been a gist, but it's small
16:31brehautta479: keep in mind, haskell's library is developed in sync with its type system. clojure's library develops in isolation and the type system must then provide types for those idioms. it does result in more complex types for core functions due to their flexibility.
16:31ianeslickIn both of those cases, the enable logging statement is issued but only in the 'printed at the repl' case does it persist.
16:33cemerickianeslick: how are you starting your REPL?
16:33ianeslickIt's an nrepl attached to immutant.
16:33cemerickianeslick: right, but: are you letting immutant start it, or are you controlling it?
16:34ta479brehaut: so is it possible to make a much slimmer type signature for a custom map and lose some flexibility?
16:34brehautta479: yes
16:34brehautta479: but why would you
16:34ianeslickLetting immutant start the repl server.
16:35ianeslickThen connect from emacs
16:35ianeslickSame effect occurs if I use nrepl-inspect instead of just printing it.
16:37noncomcan i do a nested destructuring of a nested map?
16:37cemerickianeslick: so, I don't have any theories re: the effect of the REPL on the 'stickiness'. I'm willing to bet it's a misattribution, and you're just getting the "correct" logger sometimes, sometimes not (due to classloader wonkiness). Does your logging config work properly when applied at the end of your immutant.init?
16:38amalloynoncom: certainly, why not?
16:38noncomamalloy: could you show how it looks like? i just can't guess..
16:39amalloynoncom: do you know how to destructure a map? it's just applying further destructuring to the "names" of the locals you bind
16:39noncom(defn f [& {:keys [a b c]}] ...)
16:40noncombut how i destructure a, b or c? in a separate let?
16:40amalloynoncom: that is shorthand for a more general destructuring
16:40amalloy&(let [{{:keys [first]} :name} {:name {:first "john" :last "smith"}}] first)
16:40lazybot⇒ "john"
16:41noncomaha.. i see... is it possible to take it to arguments destructuring or do i have to use this full form?
16:42hyPiRionThat doesn't make sense
16:42noncomwhat do you mean?
16:43hyPiRionIf you have {:keys [{...}]}, then what does {...} refer to?
16:43hyPiRion(If I read you correctly, I am not sure I am)
16:43hyPiRionYou can use the :as directive inside a map to keep it though.
16:44noncomyeah, and that is the same kind of problem that i originnaly stepped into. thought maybe there is a way. also didn't know about what amalloy showed - looks cool
16:44noncomyeah, so an :as or further lets are the way
16:45hyPiRion,(let [{{:keys [first] :as person} :name} {:first "john" :age 21}] [first person])
16:45clojurebot[nil nil]
16:45amalloynoncom: you should practice destructuring maps without using :keys
16:45hyPiRionwell obviously I forgot something there
16:45hyPiRion,(let [{{:keys [first] :as person} :person} {:person {:first "john" :age 21}}] [first person])
16:45clojurebot["john" {:age 21, :first "john"}]
16:45amalloythe convenient shortcut :keys seems to be causing you to not understand the more-general things being pointed out to you
16:46noncomamalloy: how do i do destructuring without :keys? the "let" examples above use :keys
16:46hyPiRion,(let [{{first :first :as person} :person} {:person {:first "john" :age 21}}] [first person])
16:46clojurebot["john" {:age 21, :first "john"}]
16:46amalloy$google clojure destructure map
16:46lazybot[Jay Fields' Thoughts: Clojure: Destructuring] http://blog.jayfields.com/2010/07/clojure-destructuring.html
16:47noncomah right..
16:47noncomthanks guys, you made good examples!
16:47noncomso no way to destructure a nested map right inside function params declaration?
16:48noncomoh sorry
16:48noncomfound it in the jayfields examples
16:48noncomok, i'll go practive
16:48noncom*practice
16:52ta479brehaut: because a lot of the higher order function types are something I can't imagine myself writing in my own code
16:53ta479HOD types for clojure.core functions
16:53ta479just doesn't seem practical
16:53brehautta479: why would you be writing types for core?
16:54ta479no, types for my own HOD functions
16:54ta479HOF*
16:55brehautta479: thats entirely different to writing types for functions in core
16:55brehautta479: in particular, you probably arent supporting a wide range of interfaces
16:56ianeslick@cemerick I can try that, but I'm applying it interactively so I'm unclear how within the same repl session the class loader environment would change. I'm only evaluating the loggers for actively loaded classes, the repl is in the loaded class's namespace, and I'm making those two calls one of which enables the logger and one of which doesn't.
16:56ianeslick@cemerick The misattribution is likely, but I can't figure out what else I might attribute the difference to
16:57technomancyianeslick: this isn't twitter; easy with the derefs
16:57ianeslick@oops
16:57technomancyyou'll cause his transactions to retry
16:57ianeslick#oops?
16:57ianeslickIRC #noob
16:57ianeslickI always forget the conventions...
16:57mtpthis isn't twitter
16:58ianeslickmtp: I'm being facetious
16:58mtphard to tell :)
16:58ianeslickAlthough I did forget the '@name' vs. name: to call out someone specifically.
17:00cemerickianeslick: Yeah, it doesn't make sense on the face of it. I just have a hard time believing that REPL printing can affect the state of a Logger.
17:01ianeslickcemerick: I hear you and agree. I'll noodle on it some more.
17:11sverihi, do you know a place where people can code together online?
17:12TimMcLike a multiplayer web IDE?
17:12sveriexactly
17:12technomancythere is https://syme.herokuapp.com that I made
17:12sverii often thought that it would be more fun to solve puzzles together or work on a project
17:13sveritechnomancy: ah, i see, thats a nice start
17:13sveribut somehow the community is missing
17:14technomancysveri: right, you need to arrange beforehand with whoever you're collaborating with
17:14technomancyI find IRC to be a great medium for that =)
17:14sveriyea thats right, partially
17:14sveribut imagine something like a chat server
17:14sveriyou can scroll coding rooms
17:15sveriand people sit and talk about something, everybody can join
17:15sverifor instance if you dont wanna hack on something but like to watch somebody hack
17:16technomancythat'd be cool
17:16technomancycould just use a freenode channel though
17:17sveriyea, but i know a lot of coders that dont use irc and watch me like a maniac when i tell them i ask questions in the irc from time to time
17:17technomancyinvite them in; we won't bite
17:17technomancywell except for bitemyapp
17:17sveri:D
17:17sverii know
17:18sveribut its almost always like: "IRC? does it still exist?" :D
17:18TimMcMan, if I didn't have IRC, I'd be like "What is computer? How does Clojure?"
17:18grncdrsveri: there's also https://friendco.de/ that might interest you
17:18TimMc...although StackOverflow is becoming a pretty amazing resource.
17:19sverigrncdr: thats almost what i am looking for, but again not open enough
17:20sverihm, dismissing the fact that the try it now button isnt working :D
17:21grncdrsveri: yeah I have no affiliation with it
17:22grncdrplayed around a bit when it was announced and moved on
17:22sverigrncdr: yea, was no offense, good to know that something like that exists
17:30musicalchairsveri: I like your idea; I've been thinking in a similar vein or two recently
17:30TimMcHmm, someone was talking about a collaborative editing thing recently...
17:35bhenrywhat does it mean when a namespace compiles fine in the repl, but when trying to run `lein ring server` that same namespace won't compile because it can't resolve a particular symbol from another namespace?
17:37technomancybhenry: you deleted a var or created something in the repl that doesn't exist on disk
17:38bhenrytechnomancy: it's a brand new nrepl session in emacs and all i do is C-c-k within the namespace in question. it compiles fine.
17:38technomancyoh, no idea then. check to see if it works from lein run?
17:38technomancyI don't use lein-ring
17:41technomancyIMO sticking with lein run and lein repl is a lot simpler
17:42bitemyappbhenry: what symbol, anyway?
17:42bitemyappbhenry: lein ring is mostly handling auto-reloads which is basically just some middleware and #' of the app var.
17:43bitemyappit does some other things like designate takedown/init functions but I think realistically you don't want to rely on the magic and instead just understand what's going on.
17:45bhenrybitemyapp: it's a symbol in my own namespace. but it compiles from the repl, and not from the lein ring server command. it breaks in the lein ring server command after i switch from clojure 1.4 to clojure 1.5, but in the repl, it compiles with either dependency
17:45hiredmanbhenry: have you cleared out target/classes/?
17:46bhenrynot if lein clean doesn't do that.
17:46bhenryhiredman: ^^
17:47hiredmanI dunno, if the directy exists delete it
17:47bhenryhiredman: target/classes is empty
17:47hiredmanbhenry: what symbol is it?
17:48hiredmanbhenry: how are you loading code in the repl?
17:48hiredmanbhenry: do you have a pastebin of the stacktrace?
17:49bitemyappbhenry: run lein clean, refheap the code, include the stacktrace.
17:54bhenrybitemyapp: here is the code: https://gist.github.com/bhenry/b0b77e4fab6b862b728f here is the stack: https://www.refheap.com/e0dc2bb00296b669e454871db
17:55bhenryif i C-c-k (nrepl in emacs) inside of either of those files, they compile fine with either version of clojure. but that stacktrace happens in the terminal with 1.5.1 but works fine with 1.4.0
17:56bitemyappbhenry: show me a project.clj
17:56bitemyappI need version numbers.
17:56bitemyappand lein ring config.
17:57hiredmanah, you shouldn't do that
17:58hiredmanbut why it is doing that, I'm not sure, I bet lein ring is swallowing the exception loading *.config
17:58hiredmanyou should use clojure.java.io/resource
17:58bhenrybitemyapp: https://gist.github.com/bhenry/b0b77e4fab6b862b728f same link, but with new stuff.
17:59bitemyappbhenry: that's not how you should do a config.
17:59bitemyappbhenry: use this: https://github.com/weavejester/environ/
17:59bitemyappbhenry: make it a plain clojure file, use whatever is in the environment, fallback to defaults.
18:00bitemyappand hiredman is right, use cji/resource when you do need to load files, but you're doing configuration in general wrong anyway.
18:00technomancyhttps://twitter.com/mikerubits/status/392748169735323648
18:01bitemyapptechnomancy: <3
18:02bhenryit's fair to have your opinion about something. i didn't write that, so i will not change it. something tells me that it's not the cause of my problem, though.
18:03bhenryif i did anything that expectedly only works in 1.4.0 and not 1.5.1 please let me know what it is (our other project on 1.5.1 has its configs set up the same way, and it works fine)
18:05hiredmanbhenry: my guess is both your calls to slurp are throwing exceptions because the working directory of lein ring server isn't what you expect it to be, and lein ring server is somehow masking those exceptions
18:05bitemyappbhenry: if something fails to compile and load, then the symbol referred from it will fail to exist.
18:05bitemyappand what hiredman just said.
18:05bitemyappun-jankifying your config solves this problem too.
18:06hiredmanput in some printlns to verify the exception, then switch to io/resource
18:07satshaba2ok I want to use typed clojure
18:08bitemyappsatshaba2: cool!
18:08satshaba2but when I try to only type 1 function
18:08bitemyappsatshaba2: http://nathanic.org/posts/2013/typed-clojure-tour/?utm_source=dlvr.it&amp;utm_medium=twitter
18:08satshaba2it complains when it checks the rest
18:08bitemyappsatshaba2: you generally have to be explicit about typing everything in core.typed
18:08satshaba2haha, yes I've been reading it
18:08satshaba2huh ok. So it's all or nothing?
18:08satshaba2at what granularity?
18:08satshaba2name space?
18:09dnolensatshaba2: yes
18:09bitemyappsatshaba2: technically namespace, but you'll have to ^:no-check a bunch of stuff for it not to spread outside that namespace.
18:10satshaba2OK cool! thanks!
18:12coventryThat blog post makes typed clojure look like a lot of work. The type for map is longer than a naive implementation of the function, for instance. Is it paying off for people.
18:12coventry?
18:13bitemyappcoventry: it's tedious compared to what I'm used to, but I'm still interesting in using it more.
18:13bitemyappcoventry: def-alias goes a long way too.
18:13bhenrybitemyapp: it correctly prints the result of the slurp statement right in the terminal from which i run `lein ring server`
18:15bhenrybitemyapp: i updated the gist with how i printed it. i can't see an explanation why it is running that just fine, but not finding it from crypto.
18:19bitemyappbhenry: you shouldn't really be def'ing file operations like that either, should be a function or memoized fn.
18:19mikerodmaven-shade-plugin changed all the timestamps in my uber jar. This caused all AOT clojure files to be re-compiled at startup. Made start up very slow. boo
18:20mikerodThis took me a while to discover what the problem was.
18:20bhenryi've got guys that do this. all i'm trying to do is update dependencies. and don't know how to track down why this doesn't work in 1.5.1 but it works in 1.4.0 without issue.
18:20bitemyappmikerod: nasty.
18:22mikerodbitemyapp: Yeah, I ended up using lein uberjar and didn't have the same issue.
18:22mikerodThen I noticed the timestamps.
18:25TEttingerbhenry, you saw that analytics.engine uses clojure 1.5.1 as a dep right?
18:26bhenryYES! that's why i need to get the project working with 1.5.1. we are beginning the move to make this standalone project a part of analytics-engine.
18:26bhenryTEttinger: ^
18:26TEttingerah ok
18:27bhenrywhen I uncomment the 1.4.0 line in the project.clj everything goes back to working just fine.
18:28TEttingerdid you link the full stacktrace yet?
18:55glosolinrepl was so awesome until some retard started renaming :)
18:56bitemyappglosoli: as much as I dislike the unnecessary rename, said retard is also maintaining your tools for you :)
18:57glosoliJust to make clear, and not to sound disrespectful, but is it maintenance when all he does now is fixing after shit made up by renaming ?
18:58mgaareif you liked nrepl 0.2, you can get it from marmalade and keep using that
18:59glosolimgaare: Kinda looking forward to Cursive... :)
18:59technomancynrepl.el is the new slime!
19:00mgaareglosoli: what is that?
19:00TimMcsveri: http://www.pairprogramwith.me/ has a big ol' list of pairing tools and services.
19:00technomancywhich is to say, the new thing that will confuse newcomers as they try to navigate outdated documentation
19:00glosolimgaare: IDE for Clojure :) based on Intellij :)
19:00glosolitechnomancy: But you know what's cool now? at least Newcomers won't confuse the meaning of nrepl-emacs and nrepl lol
19:01glosolisure they willl...
19:01mgaareah, ok
19:01technomancyglosoli: I'm just glad I'm not stuck maintaining it
19:02glosolitechnomancy: Yeah :)
19:02mgaareI don't mind the new name
19:04bitemyappI'm ambivalent but think it's silly.
19:04bitemyappit'll be nice once the dust clears just on account of being less ambiguous as to which component of nrepl one is referring to.
19:04bitemyappthe server or the client on Emacs.
19:05bitemyapptechnomancy: I've had some people ask that I move faster on grom because they find grench too annoying to install btw.
19:05technomancygrom is your haskell one?
19:05bitemyapptechnomancy: aye
19:06technomancybitemyapp: is it the libffi or libreadline dependency that's annoying? or are people compiling the whole thing?
19:06bitemyapptechnomancy: compiling the whole thing with opam, I think they find having to install all that obnoxious.
19:06technomancywhy not use the bins?
19:06bitemyappI don't care since I like having a working ocaml compiler + libs ready to go.
19:06technomancyyeah, opam takes ages
19:06bitemyapptechnomancy: they aren't advertised obviously enough, apparently.
19:06technomancyhuh
19:06technomancythanks for telling me
19:07bitemyapptechnomancy: no problem.
19:07bitemyapptechnomancy: I look forward to doing a comparison between the two.
19:07bitemyappI've used OCaml and Haskell but I've never had the chance to directly compare them.
19:08Raynesbitemyapp: Time is Money by You Me At Six
19:09bitemyappRaynes: I'm listening to Black Boned Angel. this better be good.
19:12technomancybitemyapp: these friends are macosecksists?
19:12bitemyapptechnomancy: pretty sure.
19:13technomancyk, someone submitted a brew recipe fwiw
19:13bitemyappif that compiles from scratch he'll still be pissed, but I'll let him know.
19:13technomancyheh; no idea but it wouldn't surprise me
19:13technomancylolhomebrew
19:21bitemyapptechnomancy: homebrew is pretty terrible.
19:21bitemyappRaynes: okay that was good. Back to my black metal though.
19:32satshaba2any style tips on https://www.refheap.com/20083?
19:33satshaba2I've solved the problem, but did I do it in an idiomatic way
19:34satshaba2?
19:38TEttingersatshaba2, I'm not sure about using the same name for different symbols. like which "words" is it?
19:41satshaba2TEttinger: good point. Mostly I'm wondering if letfn is the right approach
19:41satshaba2I wish I had Haskell's `where`
19:42satshaba2could I make a macro for that ?
19:42bitemyappsatshaba2: please don't.
19:42metactusmacro pariahs D:
19:42metactus /wrist
19:42bitemyappsatshaba2: your code is briefer than the math.combinatorics version, but I'm trying to figure out why yours is producing slightly different data.
19:43satshaba2hahaha
19:43bitemyappit seems roughly equivalent to (combinations (set (mapcat concat words)) 3)
19:43satshaba2is it something in combinatorics? I was just trying to solve a short problem
19:44brehautsatshaba2: are you referring to where being after the body rather than let which is before, or the recursive definitions allowed by where?
19:44satshaba2yes
19:44brehaut(and letfn)
19:44satshaba2sorry, the former
19:44satshaba2the where being after the body
19:44satshaba2for me that's a cleaner read
19:44brehautin haskell i agree
19:44bitemyappin Clojure, not so much.
19:45brehautclojure is mostly strict, so theres a certain clarity to let having the definitions before the body because that is when they are evaluated
19:45satshaba2ah I see
19:46brehauthaskell, where is semantically fine due to the pervasive non-strictness
19:46satshaba2interesting
19:46satshaba2so would that code be considered idiomatic?
19:46satshaba2and readable?
19:47brehautsatshaba2: sure. seems clean.
19:47brehautsatshaba2: some people might opt for a let rather than letfn
19:47satshaba2let with an fn?
19:47brehautyeah
19:47satshaba2neat
19:47brehautor let with a #( )
19:47brehautletfn is a special case of let + fn because it allows the functions to be mutually recursive
19:48satshaba2really? I thought i was just a way of naming your fn so you could recur on it within that fn
19:48brehautyou can do that with fn
19:48satshaba2oh oh i see
19:48brehautfn accepts a name
19:48satshaba2ah, cool!
19:48brehautbut (letfn [a … b …] …) a and b can recursive into each other
19:49satshaba2awesome. thanks a bunch!
19:49brehautnp
20:07TEttingersatshaba2, I'm a bit confused, is it supposed to have duplicates?
20:07TEttinger(for [a (words 0) b (words 1) c (words 2)] [a b c]) seems to work without producing duplicates
20:13hyPiRion(apply clojure.math.combinatorics/cartesian-product words) should also work fine.
20:25dbsrhey all, im having some trouble with using reduce / reduction correctly
20:26dbsrfor this code: http://bpaste.net/show/142987/
20:27dbsri would like to stop the iteration when the sum of the filter is > n, since n wouldnt be a perfect number at this point
20:28dbsrI dont understand how I can use reduction here, since if I put reduction at the start the function would no longer return the result of the n == sum condtion
20:28TEttingersounds like a use for loop/recur, with a conditional
20:28hyPiRionsounds like take-while or something
20:29TEttingeror that
20:29dbsrTEttinger: ill have a look at the docs, I was asking because I understood 'one' shouldnt use for loops in clojure
20:31TEttingernot a for loop, loop/recur
20:31TEttingerbut take-while is better I think
20:33Morgawrhow would you do that with take-while?
20:33Morgawryou'd have to accumulate the sum
20:33Morgawrwouldn't you?
20:33hyPiRionshh on you
20:33Morgawr:(
20:33hyPiRion:p
20:33Morgawrw-w-was I wrong?
20:34hyPiRionno
20:34rasmustoyou'd change the fn to have an accumulator, yea?
20:34Morgawrrasmusto: well yeah but it kind of defeats the point then
20:34hyPiRionwell, you could probably use reductions, but that's be messy
20:34rasmustoMorgawr: what point is that?
20:35Morgawrrasmusto: being elegant and non-hacky
20:36rasmustoan inner loop/recur w/ an accumulator is a non-elegant hack?
20:36Morgawrmore elegant than engineering an accumulator with take-while... or at least that's what I'd say
20:36Morgawrbut not sure how you'd use an accumulator with take-while actually so I'm probably wrong
20:38hyPiRiondbsr: https://www.refheap.com/20085 is how I would've done it.
20:39dbsrhow can I add to the total sum of proper divisors in a take while loop?
20:39dbsrow, thanks hyPiRion ill have a look
20:40dbsrlater, i like puzzling this out
20:40dbsrfor now :d
20:40hyPiRiona take-while is probably a horrible fit in hindsight
20:41dbsrheh ok, what doc should i be reading instead?
20:41hyPiRionactually, there's probably a bug there. replace < with <= and you'll be fine.
20:43dbsrdidnt know about ? in fn definitions heh
20:43hyPiRionit's a common idiom for functions returning true/false
20:43dbsrthose are for truth conditions?
20:43rasmustoit's just a notation thing
20:44hyPiRionyeah, those you usually call isCondition and stuff in other languages
20:44dbsrcool heh
20:44hyPiRionand yeah, it's just notation
20:44dbsrand zero? is shorthand for (= 0 foo)
20:45hyPiRionyeah
20:45hyPiRion"shorthand", because it's actually longer
20:47dbsranyhows, i think i get reduce now, thanks a lot hyPiRion
20:48hyPiRionnp
20:50rasmustohyPiRion: good example, I like that reduce + reduced can be like a take-while w/ some sort of state
20:50hyPiRionhmm, you made me think there
20:52rasmustoI have this weird example of doing something similar. I had think I had an impl using reduce before https://www.refheap.com/20086
20:52rasmustoby similar I mean not at all the same
20:53rasmustoand by impl I mean horrible code
20:55Morgawr(fn [n] (loop [ s (range 1 n) sum 0] (cond (> sum n) false (and (= sum n) (empty? s)) true (empty? s) false (zero? (mod n (first s))) (recur (rest s) (+ sum (first s))) :else (recur (rest s) sum))))
20:55Morgawrthis is my solution :D
20:55Morgawrand it's terribly ugly haha
20:55Morgawr(re: perfect number)
20:58hyPiRionhttps://www.refheap.com/20087
20:59MorgawrhyPiRion: I'd love to actually pair that with filter as well
20:59Morgawrso you like.. walk the list, filter and reduce at the same time
20:59Morgawrand exit on false condition
21:00hyPiRionsounds like a kitchen sink
21:00MorgawrI don't think it's something that unusual
21:00MorgawrI mean, if you filter you already have to realize the whole list, right?
21:00hyPiRionno
21:00hyPiRionfilter is lazy
21:00rasmustoreduce would, but you can "reduced" it
21:01Morgawrfilter is not lazy...
21:01Morgawror is it?
21:01hyPiRion,(filter even? (range))
21:01clojurebot(0 2 4 6 8 ...)
21:01Morgawrmmm
21:02Morgawr,(take 6 (filter even? (range)))
21:02clojurebot(0 2 4 6 8 ...)
21:02jmonettahi guys
21:02Morgawr,(take 6 (filter even? (repeat 5))
21:02clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
21:02Morgawr^ ?
21:02Morgawroh wait
21:02Morgawrderp
21:02Morgawrthat never returns any value
21:02Morgawrsorry hyPiRion you're right, I'm just tired
21:02MorgawrI guess I'll head to bed, night
21:02jmonettatalking about laziness, can someone tell me why this takes 5 seconds instead of 2? (take 2 (map (fn [x] (Thread/sleep 1000) (* x 2)) (range 5)))
21:03hyPiRion$google fogus chunked lazy seq
21:03lazybot[fogus: De-chunkifying Sequences in Clojure] http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/
21:03hyPiRionjmonetta: ^
21:03jmonettathx!
21:05rasmusto,(time (doall (take 33 (map (fn [x] (Thread/sleep 10) (* x 2)) (range)))))
21:05clojurebot"Elapsed time: 654.421377 msecs"\n(0 2 4 6 8 ...)
21:18timvisher,(apply < [[1 1 1] [1 1 2] [1 1 3] [1 1 4] [1 1 5] [1 1 6] [1 1 7] [1 1 8] [1 1 9]])
21:18clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
21:18hyPiRionsort perhaps?
21:18timvisherhmm. interesting. clojurescript says that's true
21:18timvisherbut then says (apply < [[1 1 1] [1 1 2] [1 1 3] [1 1 4] [1 1 5] [1 1 6] [1 1 7] [1 1 8] [1 1 9] [1 1 10]]) is false
21:19timvisherbut i guess that's undefined behavior
21:19hyPiRionoh, I'd guess that's lexicographically comparisons
21:19timvisherhyPiRion: I'm actually trying to assert that a set of maps ascend.
21:19timvisherusing juxt
21:19timvisherbut vectors don't seem to compare, unless you're sorting
21:19timvisherwhich is strange
21:20timvisherhowever, compare works fine
21:20hyPiRioncould you use compare?
21:20hyPiRionas in
21:20hyPiRionah
21:20timvisherbut it's just strange that compare works but none of the other operators do
21:20timvisherbut that's what i'll have to do. :\
21:22timvisherit's also a shame that compare isn't variable arity :(
21:28timvisherhyPiRion: that's annoying. :) https://gist.github.com/timvisher/7110708
21:28timvisherlooks like it's working though. thanks for the help!
21:28hyPiRionOooh, I see. Yeah, that would be annoying
21:29hyPiRionnot sure what I helped you with, but you're welcome I guess :p
21:29timvishermeh. call it moral support. ;)
21:29timvishergoing to the conj?
21:29hyPiRionyeah
21:30timvisheror is that morale support?
21:30timvisheris that even a phrase?
21:30timvisheri'm tired. :\
21:30timvishernice! it's my first year.
21:30timvisherpretty excited. :)
21:30hyPiRionI think it's "moral support", but I'd guess the actual American/English people here would know better
21:31timvisherinteresting. that's indeed right. i'll have to look up the etymology of that.
21:31timvisherhas anyone heard of someone working on cljs-time (or some other name)?
21:32hyPiRionIt's my first year too. Hopefully I'll be able to go on a yearly basis, but it's expensive to travel over the atlantic ocean =/
21:33timvisherlol. have you been to euroclojure?
21:33hyPiRionno, couldn't afford it because I wasted all my money on tickets to the US. heh
21:33timvishermeta
21:34hyPiRionThere's a reason I don't study economics
21:39gfredericksI used to live in south carolina, and instead of driving a few hours to clojure/conj I flew across the country to clojure/west
21:40brehautgfredericks: you must be a lisp programmer: value, over cost
21:40hyPiRionAren't we all.
21:41hyPiRionI wonder when the schedule turns up.
21:41brehaut(apologies to perlis)
21:41gfredericksthis is like my third year in a row missing clojure/conj?
21:42brehautgfredericks: think of the positives; we can hang out on #clojure and amalloy wont be here to correct us
21:43hyPiRionbrehaut: Oh, he will if you summon him
21:43gfredericksamalloy is going too?
21:43brehauti have no idea
21:43gfrederickshe never goes to conferences
21:43brehautgfredericks: i think you are thinking of me
21:43gfredericksbrehaut: no you never go to conferences but it doesn't surprise anybody
21:43brehautthis is true
21:54xeqihyPiRion: the conj schedule? or just the talk list?
21:54hyPiRionxeqi: the talks, but they come out at the same time, don't they?
21:55xeqihyPiRion: http://lanyrd.com/2013/clojureconj/schedule/
21:55hyPiRion:o
21:56hyPiRionI see Rich have his "To Better Do" app once again
21:56hyPiRion(inc xeqi)
21:56lazybot⇒ 10
22:01amalloywhat? brehaut, let me correct you: i won't be at the conj
22:02bitemyapphe doesn't need to be at the conj to correct you.
22:03bitemyapphe's a part of the space time continuum. A fundamental particle.
22:03bitemyappif you deref a real-life atom, one of the values will be amalloy, telling you you're doing it wrong.
22:03gfredericks~amalloy
22:03clojurebotamalloy is <amalloy> just use juxt, it'll be great
22:04marcopolo2rkneufeld: yt?
22:04llasramWhen you write a function which accepts a function and returns a function which returns a function, the result of calling that function is amalloy
22:04bitemyappllasram: so most Haskell code is just a doppelganger for amalloy?
22:05amalloyi should /part now and forever, and let the myth keep growing
22:05bitemyappThe fire rises!
22:05gfredericksin ten years we'll have bitter factions just based on how to pronounce the first syllable in his nick
22:06amalloyand the faction who thinks being bitter is a form of worship
22:06bitemyappwars between the ay-ists and ah-ists will bleed into the non-programming world. World War 3 will be a resource war fought in Africa to feed the opposing factions from those split over how to pronounce the first 'a' in amalloy.
22:07bitemyappand with that, I'm off to Clojure Dojo. hope I see some of you there :)
22:10cespareHow do I refer to the objects, bytes, etc (that I use inside a normal function for type hinting like ^objects, ^bytes) inside a macro? I'm basically doing this: http://stackoverflow.com/a/11920022
22:10cesparein that code he's using `BufferedImage -- how do I refer to objects instead?
22:12gfredericks,`objects
22:12clojurebotsandbox/objects
22:12gfrederickshm
22:12gfredericks,'objects maybe
22:12clojurebotobjects
22:13gfredericks((fn [^objects a] (aget a 0)) (into-array Object [7]))
22:13gfredericks'((fn [^objects a] (aget a 0)) (into-array Object [7]))
22:13gfredericksaaaah
22:13gfredericks,((fn [^objects a] (aget a 0)) (into-array Object [7]))
22:13clojurebot7
22:13gfredericks,((fn [^objects a] (aget a 0)) (into-array Long [7]))
22:13clojurebot7
22:13gfredericks,((fn [^objects a] (aget a 0)) (into-array Long/TYPE [7]))
22:13clojurebot#<ClassCastException java.lang.ClassCastException: [J cannot be cast to [Ljava.lang.Object;>
22:13gfredericksphew it worked
22:15marcopolo2rkneufeld: ping
22:15rkneufeldHey
22:15cesparegfredericks: erm, what's the conclusion?
22:15marcopolo2rkneufeld: Cool, I don't wanna use a lot of your time
22:16marcopolo2rkneufeld: I'm glad you wanna make sure we does this right, I respect that
22:16marcopolo2rkneufeld: I'm still new to pedestal so I don't quite understand all of it yet
22:16cesparegfredericks: Whether I do `objects or 'objects, I get a classcastexception evaluating the macro
22:16marcopolo2rkneufeld: can you briefly explain what [:build :triggers] does?
22:20gfrederickscespare: what's your code look like?
22:20gfredericks'objects is what it should be
22:26cesparegfredericks: well, i ended up doing something different with the code anyway. I don't have something handy to show you atm
22:26cespareI don't really understand the SO answer from amalloy, though.
22:27cespareDoes the type hint get evaluated when the macro is evaluated, even if it's in a syntax quite?
22:27cespare*quote
22:29cespareoh, i see. ^ is a reader macro.
22:30gfredericksyeah; you need the metadata to make its way through the macroexpansion into the compilation phase
22:30gfredericksusing ^ just gets metadata attached to the symbols in the macro definition, while you need it to be on the symbols _passed to_ the macro and returned from it
22:30gfredericks...crazy subtle distinction
22:55bhenrybitemyapp: hiredman: i switched to clojure.java.io/resource. here is the repl working, and the lein-ring which i believe just runs the app, throwing the error in the stacktrace and pointing at config.clj https://gist.github.com/bhenry/f42daf5ef4ec6b448228
22:55bhenryuuuh, i said that wrong
23:13`cbpbitemyapp: ping
23:24`cbp:-(