#clojure logs

2012-09-19

00:01tomojhmm
00:01tomojwell, (class Post) is probably Class
00:01tomojdid you try just Post ?
00:02tomoj(class (class Post)) is also Class, though, so I don't know why that wouldn't work
00:02tomojoh
00:02tomojyou may have to pass the varargs in an array
00:02tomojmaybe try (.fetchConnection fb "boobs" Post (object-array []))
00:04tomojdo you really want to use restfb? seems like it shouldn't be hard to use a clojure http client
00:12loliveiratomoj: i thougth restfb was easier.
00:12loliveirabut i think i 'll give a try.
00:13loliveira... to http-client
00:14tomojclj-http is popular
00:19loliveirai know clj-http client, but somehow I didn't realize that could be better to call their api directlly. I make this kind of miss judgement all the time.
00:19loliveira=)
00:21dnolen`tomoj: I have no idea how that would work.
00:25SgeoHmm, clj-http does something called throwing a Slingshot stone
00:26technomancySgeo: it's basically an ex-info
00:26Sgeoex-info?
00:26technomancybut it predates ex-info so you can use it in older clojures
00:26technomancy,(doc ex-info)
00:26clojurebot"([msg map] [msg map cause]); Alpha - subject to change. Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."
00:26technomancyslingshot offers much nicer exception catching, but on the throwing side you should just use ex-info
00:27technomancywith slingshot you can actually destructure an exception, which is hot
00:27tomojdnolen`: well, say you can look at the analyzer output and determine where locals aren't needed anymore (I _think_ that's feasible). then you can stick some extra (set! local nil) into the analyze output before it gets emitted, right?
00:27SgeoIs it possible to resume from an exception with Slingshot?
00:27technomancyno, a condition system is orthogonal to slingshot
00:28Sgeo:(
00:28technomancyslingshot is just about enhanced catch
00:29technomancywell, it's good to be orthogonal
00:29amalloytechnomancy: it's not parallel, but i don't think it's orthogonal either. enhanced catch seems closely related to resuming
00:29technomancybut yes, it's a shame that no one's gone to the trouble of building a condition system apart from the old problematic error-kit
00:30Sgeoerror-kit?
00:30clojureboterror-kit is http://pragprog.com/magazines/2009-07/when-things-go-wrong
00:30technomancyan abandoned condition system that tried to do too much
00:31technomancyin particular, it embedded an object system in itself or something?
00:31SgeoI think my primary use of a condition system would be for developing, can fix an error and just continue
00:31technomancythe other problem is a condition system is fairly useless unless everyone uses it
00:32SgeoDoes the JVM or Clojure have anything like that?
00:32technomancyritz might
00:32technomancyfor dev-time only
00:33technomancynot sure why nobody has tackled that; it doesn't seem like an error-kit-lite would be terribly tricky to implement
00:34technomancyprobably because people realize the implementation is the easy part and getting people to actually use it is the difficult part
00:34frioclojure seems to be better than other languages ive come across in that regard though
00:34friopolitically, i mean
00:35friopeople seem to converge faster on a given solution
00:35SgeoAlthough, in some cases, the solution can be bad.... ok, not going to rant, not going to rant
00:35friobut yes, i was about to ask -- what is the preferred clojuric way for error handling? are people using monads?
00:35technomancyLeiningen could actually really benefit from conditions, but it's completely impractical because (at least in the case I'm thinking of) Maven would have to be involved too
00:35technomancyfrio: ex-info is a wonderful thing
00:36frio(id like to rewrite a small app ive used in monadic style :))
00:36technomancyplus if you're doing nontrivial catches, slingshot's try+ is really slick
00:36Sgeofrio, I'm starting to be disliked here for ranting about how much I dislike clojure.algo.monads
00:36technomancySgeo: you do understand that not many people actually do like it, right?
00:36friotechnomancy: so i should look at slingshot? ill google ex-info now :)
00:37Sgeotechnomancy, of the people who want to do monad stuff?
00:37technomancyfrio: ex-info is more important IMO, but if you have nontrivial requirements slingshot is great too
00:37frioSgeo: :<. is it just not a good monadic implementation? (i saw a blog post recently about part of it violating the monad laws)
00:37Sgeofrio, well, I did the reddit post and bug report
00:37friosmall world Sgeo :)
00:38friothanks technomancy, ill take a look at ex-info
00:38technomancySgeo: well in my experience people introducing monadic styles to a Clojure codebase bifurcate things unnecessarily without adding any expresivity or flexibility
00:38SgeoThat part though is just one of the provided monads, not the workings of algo.monads itself
00:38SgeoAlthough, if you're used to Haskell, and are insisting on algo.monads, do note that domonad works differently from do in Haskell: There's an implied return around the last part
00:39friowhat's wrong with algo.monads? i haven't looked at it yet
00:39frioim mainly looking to control flow through a series of expressions, several of which may error out
00:40frioso the Either monad seemed a good idea (but the old adage of "when you're used to a hammer, everything looks like a nail" applies, and i do want to investigate to find a more idiomatic clojure solution :))
00:41Sgeomaybe-m breaks the monad laws and is less useful than Maybe in Haskell (because you can't do Just Nothing), domonad should have a large warning for Haskell users, m-lift should be a function, and, less about algo.monads and more of a general thought, I think there should be a more general mechanism for doing the sort of thing that algo.monads does
00:41carksgeo : not in a dynamic language
00:42carkif you want to do monads like in haskell, use haskell ...or maybe scalla
00:42SgeoI
00:42cark-l
00:42SgeoI'm thinking about how to do something like return-type polymorphism in Clojure
00:42frioah right, I remember the Just Nothing thing now (and being surprised at people saying that was fine)
00:42Sgeofrio, where are people saying that that's fine to not support Just Nothing?
00:42carkSgeo: well, look at defmonadfn =P
00:43frioHN iirc Sgeo
00:43tomojhmm
00:43tomojI am implementing a monad and also currently can't have M M a
00:44Sgeofrio, any link? If the monads law breakage thing was more than a few days ago, it wasn't me
00:44Sgeocark, yeah, that's another thing that irks me, but unsure how to fix it
00:44carkwhat's to fix ?
00:44carkthat's why we're doing lisp, so that we can have macros that provide functionalities not available in the language
00:45friobleh, i cant find it Sgeo
00:45friolost in the morass of the internet
00:45carkcan'rt have return value polymophism ? rool your own !
00:45carkroll*
00:45Sgeocark, sure, but needing a different macro for defining functions that use monad functions seems inelegant. And what happens when I want to use a different sort of thing that needs the same sort of macro
00:46friothanks for the thoughts above though; ill take those into account when i look at rejigging my code soon
00:46carkroll your own, or generalize what you have
00:46SgeoRolling my own defblahfn could mean I can't write a function that uses both monad functions and my own functions
00:47technomancyex-info really is the coolest thing to happen to Clojure in a while
00:47SgeoI would be somewhat satisfied with a more generalized defsomethingfn, but I still think it's a bit ugly
00:47technomancyactually, it's the only thing I can think of off the top of my head since 1.2 that I actually use
00:47technomancyrequire/refer I guess? yawn.
00:48friotechnomancy: that's still used with try/catch/etc., right?
00:48frioit just captures more data?
00:48technomancyfrio: yeah
00:48technomancyyou can use ex-data to get the map back out, or destructure it automatically with try+ in slingshot
00:48friocool :)
00:49carkSgeo: the easy way out is to use dynamic vars
00:49technomancyoh, deref timeouts are the other thing I use
00:49frioill definitely take a look at it. i shy away from try/catch-style exception handling when i can fwiw, but using try/catch and ex-info is probably a better fit for the little app im scrapping together now (it'll apply easier than rewriting things monadically, at least, and i need to be focussing on starting to write clients now)
00:50Sgeocark, that makes sense, and have been thinking along those lines, but then there's difficulties with closures that get run outside of the context of the bindings of the dynamic vars
00:50technomancyex-info means nobody will have to gen-class for custom exceptions anymore
00:50frioooooooh
00:50technomancy(which was never a good idea anyway)
00:50carkSgeo: mhh true
00:50friothat's excellent :D
00:51Sgeofrio, oh, I have one more objection to algo.monads: it lumps in things like lifting and fmap with monads, instead of separating it out
00:52frioyeah, i saw fmap in there and was a little perplexed. i guess monads are functors, but yeah, it seems like that should be somewhere else
00:52Sgeocark, my most recent thinking has been along these lines: Have functions that are polymorphic on the return essentially return a function, and that function gets passed a type, or perhaps something else, and then the result of that is the final result
00:53carkSgeo: that's what defmonadfn does...kinda
00:53carkSgeo: but doing what you say literally ... that would'nt be very usable
00:54SgeoNot sure about that. A naive function can be wrapped with a lift-like thing that helps process the arguments if some of them may be of these polymorphic things
00:54friohrmmm
00:54frioclojure.contrib.condition -- largely unused, im guessing?
00:55carkhaha maybe there's a monad that could help with this return value polymorphism thing =)
00:55SgeoAlthough, I don't know if it's possible to access type hints of arbitrary functions
00:55Sgeocark, amusingly, I'm thinking that this is at least a Functor and possibly an Applicative Functor
00:57SgeoIs there any documentation about what metadata is available in general?
00:57Sgeo,(meta (fn [^String somestring] somestring))
00:57clojurebotnil
00:57carkright, wrap you function in another one which binds the *current-monad* var to the value saved at its creation time
00:58cark(wrap-in-current-monad f) would produce it
00:58Sgeocark, that seems more for the dynamic variable thing?
00:58carkyes
00:59carkoh you want a general solution to return value polymorphism ?
00:59carkgood luck with that !
00:59technomancyfrio: c.c.condition is a subset of slingshot
00:59technomancysame author
01:00frioah ok, thanks technomancy
01:00frioill need to check out slingshot then
01:00Sgeocark, easier than trying to dispatch on a function's return type without calling it
01:00frioive unearthed a post from 2007 where rich hickey is against the introduction of a condition system (sensibly: clojure runs on the jvm, therefore using the JVM's idiom makes sense and there were bigger fish to fry)
01:01friobut im guessing 5 years on it might be worth revisiting
01:01carkCL's condition system is nice, but i found that i was always using it like standard exceptions
01:02Sgeocark, even when the debugger caught the error and allowed you to resume?
01:02friofair enough cark :)
01:02carktho peter seibel had some nice talks about practical uses for conditions
01:03friolike I said (and sparked the monad debate off :p), the Either monad is my current local maxima (I don't really like try/catch as a pattern), but it seems like it's not very clojuric :)
01:03carkfrio : it's fine, whatever helps you is good enough =)
01:04carkgo for the end product, don't worry too much about details, or nothing ever gets done
01:04friofor sure. i get vaguely OCD about doing things The Right Way, but yep -- what you just said
01:04friothe price i pay is that i never actually finish anything :p
01:05carkhehe i have to fight it too
01:05SgeoHah, so I can get at the type hints
01:06SgeoBut... I did it not by looking at the function itself, but at the var made by defn
01:06Sgeo:(
01:06SgeoWhy isn't arglists associated with the fn?
01:06SgeoIs there a way to get that data from an fn?
01:07technomancyfrio: the problem is you'll never get total coverage since you'll be calling out to Java
01:07carkSgeo: i seem to remember there's some macro trickery that can get that
01:07frioyeah, you're right technomancy
01:08friothis has all been very informative, ty all :)
01:08technomancyso you have to choose between the conceptual integrity of a single system and the extra functionality of a dual system
01:08carki think either and maybe are better suited for code that does not interact with anything
01:08SgeoOh, metadata can specify the return-type of a function
01:08carklike a parser or a datastrcture
01:08carkSgeo: you got it backwards again
01:08SgeoI think maybe is supercedable by either in a dynamically typed language
01:09carkSgeo: you want the function to act differently depending on the expected return value
01:10Sgeocark, I was thinking of dispatch on types of different parts of a->b
01:10SgeoBut that's not especially needed for monads or functors or applicatives
01:11carkok well, it looks like you need to create your own language
01:11cark=)
01:11technomancyfrio: part of rich's argument was also that with dynamic binding you don't need to build a condition system into the language; it's easy to implement in a library
01:12technomancyand while that's technically true it ignores ecosystem issues
01:12SgeoYou don't need to build comp or partial into the language either
01:13Sgeoor map or filter or ->
01:13technomancyyeah, I don't think it's a good argument; just throwing it out there
01:28SgeoHmm http://stackoverflow.com/questions/1696693/clojure-how-to-find-out-the-arity-of-function-at-runtime
01:31carkSgeo: that may help : http://blog.jayfields.com/2011/02/clojure-and.html
01:32SgeoI once wanted something like &whole or &form for functions in Common Lisp. Funnily enough, it was because I wanted to fake a Clojure feature, and there was no way that I knew of to do the equivalent of setting arglists in CL
01:36SgeoAh, clojure.reflect is interesting
01:36SgeoBut... I don't think it actually shows the type-hints
01:39SgeoWhat I don't understand is why it's metadata on the var and not the function itself
01:39SgeoFunction itself makes more sense to me
01:47amalloyone reason, not that i've considered this carefully, is that vars can hold things that can't have metadata, eg (def ^:doc "blah" x 3)
01:48unlinkIf you want the metadata on the function, just write (def f ^{...} (fn [x] ...))
01:51amalloyunlink: try that, i dare you. a dollar says it doesn't work but (with-meta (fn [x] ...) {...}) does
01:51unlinkwfm
01:52amalloysigh, metadata is confusing. it's a good thing i don't bet more than i can afford on these things
01:52amalloy&(meta ^{:x 1} (fn []))
01:52lazybot⇒ nil
01:53amalloy,(meta ^{:x 1} (fn []))
01:53clojurebot{:x 1}
01:53amalloy,(meta (macroexpand-1 ' ^{:x 1} (fn [])))
01:53clojurebot{:x 1}
01:53amalloyi thought for sure the metadata would get dropped in the macroexpansion
01:54unlinkI only know this because I recently extensively evaluated using metadata to solve a problem I was facing.
01:55amalloyah, i see that defn has special code in it to compensate for the fact that metadata is normally dropped in macroexpansions
01:55unlink(Due to the lack of a built-in equivalent to Python's functools.wraps, I opted not to encode the information with metadata.)
02:17biscarchHas anyone run a geoNear command with the Monger library?
02:21SgeoI think I have a solution, but it's uglier than I'd like
02:23SgeoAll I have to do is coerce the IPolymorphicValue or whatever right before the first naive function uses it
02:24SgeoI think, if Clojure had a condition system and threw TypeErrors or something that specified the desired type whenever it gets it wrong, I would be in business with something more elegant
02:28tomojamalloy: know why it's different between bots?
02:28amalloytomoj: the macroexpander i wrote for lazybot's sandbox is no good
02:28tomojah
02:33tomojoh, d'oh, you can't just set vars to nil to do locals clearing in cljs, of course. hmm
02:36tomoj.. or can you? Compiler.java is fun..
02:36amalloyno?
02:36clojurebotno is tufflax: there was a question somewhere in there, the answer
02:38tomoj(let [coll (iterate inc 0)] (map #(* % %) coll))
02:39tomojseems like you can do something about that
02:43Sgeo,(map #(* % %) (range))
02:43clojurebot(0 1 4 9 16 ...)
02:43Sgeo^^(range) being a trick I saw on here I think
02:43nsxtis there a function like clojure.wal/walk that doesn't require the outer argument?
02:44tomojright, iterate was stuck in my head because I have my own iterate. but the point is that the #(* % %) closes over the coll local and so you hold the head
02:44Sgeo,(iterate #(* % %) 0)
02:44clojurebot(0 0 0 0 0 ...)
02:44Sgeo,(iterate #(* % %) 1)
02:44clojurebot(1 1 1 1 1 ...)
02:45SgeoOk, so maybe I need some sleep
02:45SgeoAh, I see your point
02:45SgeoWait, no
02:46SgeoWhy would #(* % %) close over a thing that it doesn't reference?
02:46Sgeo,(doc resolve)
02:46clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
02:46tomojin clojure it doesn't
02:46tomojin clojurescript, I think it does
02:46Sgeoo.O
02:46tomojI should double-check, I just ran my cljs program and saw unbounded memory growth and took that as confirmation
02:47tomojbut it wasn't a very simple program
02:48biscarchanyone use monger for a geoNear command?
02:52biscarchor are there order-preserving maps in clojure?
02:54carklike sorted-map ?
02:54amalloybiscarch: there is a library providing them, but i encourage you to rethink whether you actually want ordered maps - often if you care about order you just want a seq of kv pairs
02:55carkor finger-tree ?
02:55tomojhmm
02:55Sgeo,(first {:a 1})
02:55tomoja simpler test seems to show that you don't hold the head
02:55clojurebot[:a 1]
02:55Sgeo,(-> {:a 1} first class)
02:55clojurebotclojure.lang.MapEntry
02:56SgeoDoes it make sense for someone to make their own MapEntries, to represent a kv pair?
02:56biscarchamalloy: thanks, I'll look into seq of kv
02:56amalloy$google flatland ordered
02:56lazybot[flatland/ordered · GitHub] https://github.com/flatland/ordered
02:56amalloyin case you decide you want an ordered map after all
02:56SgeoOr do vectors make more sense for that case?
02:57carkohh do these keep the complexity garantees of sets and maps ?
02:57amalloycark: almost
02:57amalloydissoc is slow
02:58amalloyi could have made everything O(log2(n)), but it turns out to be a lot faster if you let dissoc get slow, and it's rare to need to dissoc in an order-preserving map, in my experience
02:59tomojdissoc is O(n) or what?
02:59carkinteresting nevertheless
02:59amalloytomoj: i don't remember. expensive
02:59tomojhmm
03:00amalloymight be n^2, but n seems more likely
03:00tomojwah?
03:00carkn^2 is not just slow =)
03:00amalloyi wrote it over a year ago, man, i don't remember what i did. the code is on github if you find yourself actually using dissoc
03:00tomojit looks like it just does a dissoc on a map and an assoc on a vector
03:01tomojwell and a get on the map
03:02amalloyoh. okay, so *that* compromise (there were a lot of options i had to choose between) makes everything fast (i think), but lets the thing grow without bound
03:02tomojyeah I see
03:03amalloyie, the vector containing a sorted view of the items will inset a nil in the middle
03:06tomojhuh, (nth (map #(* % %) (range)) 1e8) blows the stack in cljs
03:07tomoj(take 10 (drop 1e5 (map identity (range)))) works
03:08tomojbut (nth (map identity (range)) 1e5) blows the stack
03:08tomoj(nth (range) 1e8) works
03:08SgeoI was about to ask why the map identity, but I see
03:08Sgeoo.O
03:09biscarchamalloy: unfortunately I can't use sequences. I'm using a mongodb driver that throws an error if I try to use a seq.
03:09amalloybiscarch: but i don't think mongodb cares about the order of the map
03:10biscarchamalloy: that's what I thought. but when running a command using the Monger library, it re-orders my map and then returns 'near' is not a command
03:11biscarch{ "near" : 50 , "test" : 430 , "num" : 10 , "geoNear" : "bars"}
03:11biscarchis what it changes to
03:11biscarchand it comes back with: "no such cmd: near"
03:12biscarchso my assumption is that the first entry is the command
03:12amalloybiscarch: instead of assuming, i'd say to look up the mongodb query/command api
03:13amalloytomoj: pretty weird. nothing jumps out at me in the source for nth or map
03:13SgeoWould Clojure be an unusually bad starting language, due to having to learn Java interop at the same time as Clojure?
03:13biscarchamalloy: the syntax is correct in the mongodb docs, which is what the driver docs point to.
03:16tomojwould be nice if I got a stack trace..
03:20tomojah, fixed :D
03:20tomojlinear-traversal-nth is tail recursive but does not call recur
03:22SgeoIs Javascript also not TCO?
03:23SgeoWhat's with all these non-TCO languages?
03:23ivanno TCO in any JS engine I've heard of
03:24Sgeo:(
03:25SgeoI guess making it a thing that someone might inadverdantly rely on would be bad
03:25Sgeo"Oh hey, my function works well on this JS engine, I assume it's good enough for the web"
03:28amalloyah, well spotted tomoj. i didn't look at defn nth, but only at the protocol versions
03:33biscarchSgeo: you can kind of do tco in js manually
03:33biscarchSgeo: dece article: http://paulbarry.com/articles/2009/08/30/tail-call-optimization
03:35Sgeobiscarch, uh, that looks like an explanation of TCO, not how to do TCO in JS
03:36SgeoBut yeah, you could at least write a trampoline like in Clojure
03:36biscarchSgeo: that's about the best you get in js
03:37Sgeobiscarch, I don't think the article even mentions trampolining
03:40biscarchSgeo: The idea in js would be to return a value so that the recursive function doesn't need to keep the previously call on the stack.
03:41Sgeobiscarch, the point is that if Javascript is not tail-call optimized, then even though it shouldn't need to keep the previous call on the stack, it will.
03:41SgeoOh, are we speaking past each other?
03:42biscarchSgeo: true, and I think we are.
03:44SgeoI don't see a workaround for Javascript's lack of tail-call optimization in that article.
03:44biscarchSgeo: you would return a value so that the next time you call the recursive function, it doesn't have to wait and keep the previous call on the stack
03:46SgeoReturn a value from where to what?
03:51hum_phhiyas
03:51SgeoHI
03:51Sgeo*Hi
03:51hum_phlooking for some strategies for handling some java integration if anyone has 5 mins?
03:52hum_phRough background - I have a Map<String, Object> of inputs, and a Set<String> of output names, and a String script - need to return a Map<String, Object> of outputs - based on the supplied names...
03:52SgeoIn general, don't ask to ask, just ask. Although no guarantee that any person will stay talking and responsive for 5 minutes.
03:52hum_phheh
03:52Raynes~anyone
03:52clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
03:53Raynes:D
03:53hum_phmy current thinking is (with-local-vars ...) to bind the inputs, and outputs to nul - then unbind and rewrap on the way out
03:54Sgeo,(map identity (constantly 5)) ; Unrelated
03:54clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$constantly$fn__2351>
03:54hum_phso two questions: 1) is that a reasonable approach, or is there a saner way; and 2) if that's appropriate - what's the best way to get from a Map<String, Object> to those bindings - can't seem to get the String->var conversion thing happening
03:54SgeoWhy was I expecting that to work?
03:54hum_phall of which I'm sure is my lack of experience understanding
04:05amalloyhum_ph: no, with-local-vars is nuts; really the only reason to ever use it is if you're rich hickey. but i can't see any way to solve your problem given the data you have provided, in clojure or any other language. what does the set of output names do? you seem to have a Map<String, Object>, which is your goal output, and no obvious way to get a new Object from a given String
04:06hum_phamalloy: the java method is something like "public Map<String, Object> eval(Map<String, Object> inputs, Set<String> outputNames, String script) {..}"
04:06hum_phamalloy: where the result map is expected to have keys from outputNames
04:07tomojI'm thinking you don't actually hold the head in cljs with (let [coll (range)] (map #(* % %) coll))
04:07amalloyhaving a "script" String in clojure seems absurd. this whole thing just looks like a function that takes a map and returns a map
04:08Sgeoamalloy, I don't see what's wrong with with-local-vars, except possibly being unnecessary. It reminds me of the ST monad, similarly to transients.
04:09Sgeo,(with-local-vars [foo nil] foo) ; Trying to leak
04:09clojurebot#<Var: --unnamed-->
04:09hum_phamalloy: it's a plugin to an external server's scripting interface - so [admin] user can throw in arbitrary code through the browser and have it "do stuff" - or scheduled tasks can be scripted, etc etc
04:18tomojhah
04:18tomojmy memory leak is because of *1
04:31SgeoI wonder if anyone here has used (partial comp blah ...)
04:32SgeoSeems like it could be useful
04:41mpenetIs there a way to share code between builds using cljsbuild? I don't see an obvious way to do it reading at the docs
04:43tomojisn't the normal thing to share code?
04:44mpenetit should be, from what I can see you are meant to have it all in a single file. I need to try the :lib option still, there might be a way to get around that
04:44tomojnot sure what you mean, single file? you have some external js code?
04:45mpenetno it is all cljs: i have a "common" namespace that I want to use in 2 separate builds
04:45tomojoh, I see
04:46tomojwell I guess you could symlink it as a workaround..
04:46mpenetyeah I thought about that, feels dirty though, but it could be good enough
04:47SgeoHow far up skit's creek would I be just using lein repl and Notepad++?
04:48tomojhmm
04:48tomojcljs.closure seems to have no problem with a vector
04:48tomojdid you already try :source-path ["foo" "bar"] ?
04:49mpenetnope I didnt try it
04:49tomojdon't really expect it to work
04:49tomojI think cljsbuild would need to be patched
04:50mpenetyep it seems, it tries to coerce the vector to a java file I think
04:50tomojactually, cljs.closure's vector ICompilable does something different
04:51tomojso it might not even be possible without patching cljs?
04:51mpenethmm
04:51SgeoIs there a reason for the ordering of comp's arguments, other than tradition?
04:52Sgeo,(doc comp)
04:52clojurebot"([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
04:52tomojmaybe you wouldn't need to change cljs, but certainly cljsbuild :/
04:55SgeoOh hey I'm not the first to notice maybe-m's brokenness
04:55Sgeohttp://rhebus.posterous.com/learning-monads-in-clojure-a-warning
04:57mpenettomoj: cljs I think :( it s sent to cljs.closure/build which accepts a single source path or sexp
04:58mpenetbut that seems odd, given the error, I might be wrong
04:59tomojwell
04:59tomojcljsbuild could implement a new ICompilable which just compiled multiple dirs
05:00tomojthen you just have to go patch the places where cljsbuild thinks it's a string
05:05amalloySgeo: ((comp f g h) x) is (f (g (h x))): comp is in the same order as N literal invocations would be
05:05SgeoAh
05:05SgeoMakes se
05:05Sgeo*sense
05:08mpenettomoj: yes, this seems like a good solution, I'll try that.
05:10tomojI had thought of providing a way to specify :only/:exclude namespaces, but multiple source dirs would actually cover my use cases I think
05:14mpenetthis would also work with multiple file-path not only dirs
05:24tomojgreat
06:36mpenetHow does cljsbuild ("support" dir) end up bundled with the leiningen lein-cljsbuild plugin ?
06:39kralArrr everyone.
07:45CheironHi, i'm trying to use liberator. how to assign a function to :get request method and how to assign a function to :post request method?
08:18zepardhey
08:39gfrederickshello
08:41SgeoHi
08:41ljosHi - I am having a problem with noir and wondered if there was someone who could help me. I am trying to serve the content of a few csv files. Right now I have this: http://pastebin.com/7KV6vjer . The problem is that when I press the link it will not present the file, I have to refresh the page. Anyone who can tell me what I am doing wrong?
08:44ljosIn the browers I only get "undefined".
08:44gfredericksI can't imagine that the (into [] ...) is necessary on line 2, but that wouldn't be your problem
08:45ljosYeah. It is not. I had something else there before and forgot to remove that.
08:45gfredericksalso a <br> inside an <a> is weird
08:46ljosI just had it there because of how the for acts. I can try to move it out though.
08:46ludstongfredericks: Having a hyperlink on more than 1 line won't matter.
08:46ljosstill the same problem
08:46gfredericksludston: I wasn't suggesting that was his problem
08:47ludstonHow are you accessing the page you want the file on?
08:47ljosSo what I want to do is press the link and have the file presented.
08:47gfrederickspresented? you want it to download in the browser?
08:48ljosNo, served. So it gives me the download option.
08:48ljosIt does that if I refresh the page after I get an "undefined"
08:48gfrederickswhat exactly happens when you 'get an "undefined"'?
08:49ljosI press the link and it says "undefined" without quotes in the upper left corner.
08:49Cheironhi, any body is using liberator here?
08:49ljosIf I reload the page with the undefined it serves the file.
08:50gfredericksljos: have you tried hitting the download URL with curl?
08:50ludstonI have this bizzare theory, that could be entirely wrong
08:51ludstonBut could it have something to do with http? When you refresh the page, is it acting as a post-back rather than a get request?
08:52ljosgfredericks: It works perfectly fine if I do a (noir.util.test/send-request "/data/file.csv").
08:53ljosgfredericks: wget works as well.
08:53gfredericksljos: what if you wget with a POST like ludston theorizes?
08:54ljosludston: The developer tools in chrome desribes it as a GET request.
08:54ludstonIs there any other data in the GET request when you click on the hyperlink?
08:55ludstonAnything in the session or something stupid like that?
08:56ljosludston: actually there is some difference between the two. I will investigate...
08:57ludstonI'd be interested to know if you figure it out. I've barely touched noir
09:00ljosIt actually gets served, there is something wrong with something else.. maybe a part of the header.
09:10aibwhat are the practices for unit testing numeric functions? I not only want (is (= [1 2 3] [1.0 2 3])) but also (= 1.99999 2)
09:12ludstonaib: I'm not sure what you're asking. Are you asking about test frameworks, or how test those in such a way that their values will be true?
09:13aibah, forgot to specify. I was asking about clojure.test
09:15ludstonaib: I'm still not sure if you're asking about how to use the clojure.test api in general, or what the results of the tests you've defined are.
09:17aibI'm asking how people have solved the floating-point-equation/epsilon problem, as well as the problem that (long 0) does not equal (double 0) - regarding the clojure.test framework
09:17naegcore.logic: tried to put some goals into a function, but it doesn't behave as it should: http://bpaste.net/show/D4ey8nx5BhwhaFxaLJvT/
09:18aibshould I roll my own operators? is there some clojure.test.contrib? am I approaching this the wrong way, i.e. should I test my result /types/ as well?
09:18aibyou know, standard practices. what the world is going with nowadays
09:19naegaib: how are you testing those two numbers?
09:19naeg,(== (long 0) (double 0))
09:19clojurebottrue
09:20aibnaeg: (= [1 0 0] (some function which returns [1.0 0 0.0])) currently
09:20aib,(== [1 2 3] [1.0 2.0 3.0])
09:20clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
09:21Sgeo,(map == [1 2 3] [1.0 2.0 3.0])
09:21clojurebot(true true true)
09:22Sgeo,(every? (map == [1 2 3] [1.0 2.0 3.0]))
09:22clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$every-QMARK->
09:22aib,(and (true true true))
09:22clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
09:22aib,(and '(true true true))
09:22clojurebot(true true true)
09:22aibhmm
09:22Sgeo,(doc every?)
09:22clojurebot"([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
09:22ludston,(= [1 2 3] [1.0 2.0 3.0])
09:22clojurebotfalse
09:22duck1123a symbol is a truthy value
09:22ljosludston: This is so strange, there is no difference that I can find between pressing the link and reloading the page... :(
09:23Sgeo,(every? identity (map == [1 2 3] [1.0 2.0 3.0]))
09:23clojurebottrue
09:23Sgeo,(every? identity (map == [1 2 3] [1.0 2.0 3.1]))
09:23clojurebotfalse
09:23SgeoThat every? identity is ugly
09:23Sgeo,(doc any?)
09:23clojurebotPardon?
09:23Sgeo,(doc any)
09:23clojurebotHuh?
09:23Sgeo,(doc some)
09:23clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
09:23aib,(doc all)
09:23clojurebotIt's greek to me.
09:23jowag,(doc ==)
09:23clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false"
09:24ludstonljos: It must be some noir specific thing then. Try returning just "file" as the content of the webpage and see what happens.
09:24Sgeo,((comp (partial every? identity) (partial map ==)) [1 2 3] [1.0 2.0 3.0])
09:24clojurebottrue
09:26chronno,(every? true? (map == [1 2 3] [1.0 2.0 3.0]))
09:26clojurebottrue
09:26Sgeo...there's a true? why?
09:26Sgeo,(true? 5)
09:26clojurebotfalse
09:26aib,(doc partial)
09:26clojurebot"([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."
09:27loliveira,42
09:27clojurebot42
09:27aibpartial = curry?
09:27clojurebotI don't understand.
09:27Sgeoaib, yes
09:27chronnoI guess to complement "false?", not sure though
09:28ljosludston: there is something wrong with the link... I still get undefined, but now when I reload it it gives me the filename.
09:29ludstonljos: What happens when you take the :class "" out of :href?
09:29ludstonShouldn't the :class be in the anchor tag?
09:32aibthis is hard to search for: is there a is-vector? pred?
09:32ljosludston: This is what I get for being a smartass. I figured it out. It was a piece of javascript library that interacted with the href I think. Now it works.
09:32chronno,(doc vector?)
09:32clojurebot"([x]); Return true if x implements IPersistentVector"
09:32aibthanks
09:32ljosludston: thanks for your help.
09:33ludstonljos: So it WAS the :class? Or did you override the GET request with javascript?
09:33chronnoaib: np
09:34ljosludston: In an effort to remove as much code as possible to show to you guys, I removed the common/layout I had in my code. The layout imports some javascript that I think is doing strange things to my a-tag or href.
09:34chronnoaib: You can use find-doc to search the doc strings
09:35aibchronno: good tip :) thanks
09:35chronnoaib: make sure you are have clojure.repl available and then (find-doc #"vector")
09:35ljosludston: I have been using that javascript just fine for buttons and other things through the <a :href="link"> but it didn't linke this.
09:36ludstonljos: I'm glad you worked it out. Time to sleep.
09:44aibwhat does map apply to? IOW, what's the definition for (can-apply-map? x) where (map _ x) is valid?
09:49chronnoaib: in the case that was shown earlier, map was given two vectors so it applies "==" to elements at the same position for each vector
09:49aibyes, but why restrict my function to vectors when it can do much more? :)
09:50aibhttps://gist.github.com/3749769
09:51lotiadoes the future macro take an optional timeout and optional return value in case of timeout anymore, or is that supposed to be done via deref?
09:51aibsimply replace (vector?)s with (is-mappable?)s and it can work with anything that map can. Haskell practice :)
09:51chronno:-)
09:51clgvaib: you are aware that clojure data structures are compared by value and so a simple = is sufficient to compare them?
09:52aib*anything that map and eq-fn can work with :)
09:52aibclgv: yes, but
09:52aib,(= (long 0) (double 0))
09:52clojurebotfalse
09:52aib,(== (long 0) (double 0))
09:52clojurebottrue
09:53chronnoI'm a noob also, but I think the abstraction you are looking for then would be sequences
09:53aibI'll also need "nearly==" soon for floating-point "equality" checks, e.g. 1.99999 vs 2
09:53ludstonClojure has a "Close enough is good enough" predicate?
09:55clgvmidje has `roughly`
09:55aibI'd still need a recursive check to do (rougly== [x1 y1] [x2 y2])
09:56aibunless the "predicate" itself is recursive ("descending"), in which case I don't need anything else
09:57naegsome core.logic users here? Having strange behaviour: http://bpaste.net/show/OKOVq8ydgcZylMh3iayB/
09:57naegno idea where that exception comes from
10:05clgvaib: anyway, you can use sequential? or coll? as check
10:06Cheiron_hello, any one using liberator?
10:08ludstonCheiron: What's liberator?
10:08Cheironhttps://github.com/clojure-liberator/liberator
10:12aibclgv: ahh, coll?. thanks
10:25gfredericksdangit naeg left
10:33augustlis there a way to "rewind" an IO object prior to (slurp)? Currently getting nil from a slurp because I slurp something that has already been fully read.
10:33augustlthe object I'm slurping is a org.eclipse.jetty.server.HttpInput, which is a java.io.InputStream
10:36augustlis there a convention of some sort for middlewares that slurp the :body of a request so that other middlewares can also read it later?
10:36gfredericksaugustl: I think you could replace it with the string result
10:36gfredericksmaaaaybe
10:37gfredericksbut generally I think what you're talking about would defeat the purpose of using streams
10:37gfrederickssince you'd probably end up with the whole thing in memory at once
10:37gfredericksunless you wrote it to disk instead
10:37duck1123what about using mark and reset?
10:37augustlit does make sense to only read the body once, yeah
10:38duck1123looking at the docs, there are 2 methods called mark and reset http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/HttpInput.html
10:39duck1123I don't know if HttpInput supports it
10:40augustlalso, what's a good way to test that something is a slurp-able object (not a string with an URL or a path)?
10:44duck1123probably has something to do with IOFactory
10:46grettkeQuestion for Windows Emacs users: If you are using V24... from where did you get it? I don't see it on the gnu site.
10:48duck1123grettke: I always use http://ourcomments.org/Emacs/EmacsW32.html on windows
10:48erikogrettke: it's under the windows folder, you have to scroll a bit: http://ftp.gnu.org/pub/gnu/emacs/windows/
10:49grettkeeriko: I think they haven't released v24 yet :(
10:50grettkeeriko: Windows build I mean
10:50grettkeduck1123: oh ok, thanks
10:51duck1123I'm not sure what version that actually is now. (I couldn't find it on the site) but that one worked well enough for me
10:51erikogrettke: maybe I'm missing something but I see emacs-24.2-bin-i386.zip there. I haven't tried it, though. Sorry if it's nosie.
10:53grettkeeriko: I could be looking in the wrong place? I'm looking here: http://ftp.gnu.org/pub/gnu/emacs/windows/ . Is that where you are looking?
10:54grettkeeriko: Weird, the emacs home pages links to a different folder, http://ftp.gnu.org/gnu/emacs/windows/ has what you are pointing out
10:55grettkeeriko: Thanks I thought I was losing it.
10:55erikogrettke: Yeah, not sure what's up there. Mirrors, maybe? Anyway, hope that's the right one.
10:59grettkeeriko: It is perfect. Thanks!
11:01ro_stckirkendall: sup
11:33jro_How do you prefere pointing 'matrix' elements, (([[1 2] [3 4]] i) j) looks bit clumsy to point element i,j?
11:34jro_i.e. is there shorthand for applying for example (defn e [m i j k] (((m i) j) k))
11:35scriptor,(get-in [[1 2] [3 4]] 0 0)
11:35clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
11:35ohpauleezget-in
11:35scriptor,(get-in [[1 2] [3 4]] [0 0])
11:35clojurebot1
11:36jro_thanks
12:32jcromartiewhat's the state of zippers?
12:33jcromartieIs this the latest? http://clojure.github.com/clojure/clojure.zip-api.html
12:33jcromartieand what's the difference between clojure.data.xml and clojure.xml
12:34jcromartieobviously clojure.xml is older
12:34jcromartieclojure.data.xml does not appear on the official API docs despite appearing to be an official Clojure library
12:45powrtocwhats the best way of getting started with clojurescript, nrepl and leiningen these days?
12:45powrtocis there a template?
12:45clgvI get an AbstractMethodException with proxy. is it because of overriding some method?
12:48clgvcan I implement an abstract method via `porxy`?
12:48clgv*proxy
12:49nsxtpowrtoc: https://github.com/cemerick/piggieback maybe?
12:49raek_clgv: I think so, since you can implement interfaces with proxy
12:50raek_clgv: are you sure that the method arity is correct, etc?
12:50powrtocam I right in thinking that even within emacs, swank-clojure is now deprecated in favour of nRepl?
12:50clgvraek_: proxy doesnt need an explicit "this" right?
12:50jcromartiedang, don't try to print a zipper
12:50raek_clgv: yes. 'this' is magically bound in the body of the method
12:51raek_check out the macro expansion
12:51technomancypowrtoc: swank-clojure isn't going to break, but it's not getting any further development
12:51CheironHi clojurians! any fella uses liberator rest toolkit?
12:52powrtoctechnomancy, cool... what are people using these days? ritz?? It's been a while since I've done any clojure/clojurescript
12:52technomancyritz and nrepl.el should both work nicely
12:53clgvraek_: damn! you were right. I did a mistake with a macro and thus one method was missing in the proxy form :(
12:53technomancyI haven't done any clojurescript myself, but it sounds like lein-cljsbuild is more or less the way to go
12:53powrtoctechnomancy: yeah, that seems to be what people are running with...
12:53raek_clgv: you can also use the underlying functions instead of the 'proxy' macro
12:56raek_clgv: example of a "function version" of proxy: https://gist.github.com/1098101
12:57raek_(I used that in one of my project to get proxy methods which would pick up updated function defs)
12:59jcromartiein Xpath I can make compound predicates like [foo and bar]
12:59jcromartieis there any equivalent in a the xml-> zipper filter?
12:59powrtochmm when trying to run lein nrepl I get: Warning: profile :jpda not found. Exception in thread "main" clojure.lang.ArityException: Wrong number of args (1) passed to: nrepl$start-jpda-server
13:11velvia1newb question: how do I insert a sequence in the middle of another sequence?
13:12velvia1I couldn't find any built in function that does that
13:13technomancycombination of take, drop, and concat
13:14velvia1something like this?
13:14velvia1(defn insert [n list list2] (concat (take n list) list2 (drop n list))
13:14velvia1thought there would be something shorter than that
13:14casionyou want the members of the sequence in the new sequence, or you want the sequence itself inserted as a member of the sequence?
13:14velvia1members of sequence in new sequence
13:20antares_velvia1: then your concat-based code is what you need
13:20velvia1I see, thanks
13:21grettkeis marmelade the best place to pull down clojure-mode and all its requires from using elpa?
13:21technomancygrettke: yeah, definitely
13:22grettketechnomancy: thank you
13:22jweissam i missing an easier way to implement 'juxtcat'? https://www.refheap.com/paste/5158
13:25S11001001jweiss: (mapcat #(apply % args) fs)
13:25powrtocwill nrepl ever use edn?
13:26jweissS11001001: ah of course, thank you
13:26jweissi knew 3 apply's couldn't be right :)
13:38naegdnolen: hey, I'm the one who just wrote you that email about contributing to core.logic. No, I'm sadly not going to Strange Loop, too far away
13:40naegdnolen: will that session be recorded so I can watch it too?
13:41dnolennaeg: it will hopefully get recorded! I'll try my best to make that happen.
13:42ro_stckirkendall: i'm back
13:44naegdnolen: that would be great. Also, while you're around, could you probably take a look at my problem? I asked before, but nobody could help me: http://bpaste.net/show/OKOVq8ydgcZylMh3iayB/
13:44ro_stdnolen: how is your adventure with sourcemaps going? -curious-
13:45naegI'm trying to implement conways game of life in core.logic and I'm able to generate all neighbours with neighbouro. The two runs are both trying to find out whether the given coordinate has 3 living neighbours (the first one would be the correct run but fail with an exception and the second one is incorrect since there are only two distinct living neighbours)
13:58dnolennaeg: sorry, don't have time to really look at that this second.
13:59dnolenro_st: been a bit to busy prepping for strange loop talks to work on that.
13:59cemerickpowrtoc: cljsbuild + piggieback for the REPL stuff is the best combo for an nREPL ClojureScript environment at the moment.
13:59naegI'll play around with it again these days, maybe it solves itself
14:00ro_stdnolen: no worries. just thought i'd check in :-)
14:02hiredmancemerick: that depends what you want, if you want to embed a clojurescript repl in a browser, I dunno that piggieback would work well for that
14:02dnolennaeg: I'll try to take a look at it later this evening - probably something simple
14:03hiredmanif you want to pass clojurescript to nrepl, and get compiled js back you can use https://github.com/hiredman/nrepl-cljs-middleware
14:03naegdnolen: maybe, can't really tell. played around with it for hours. you got my email if I shouldn't be around then
14:03cemerickhiredman: True; though it sounded like powrtoc was aiming to do all his programming from emacs (or lein or whatever).
14:05cemerickhiredman: re: drawbridge nREPL client in cljs, that should be pretty straightforward given jquery or whatever bits the goog stuff provides, yah?
14:05hiredmandoes nrepl.el have some way to register handlers for messages?
14:05hiredmancemerick: https://github.com/hiredman/drawbridge-cljs
14:06cemerickhah!
14:06cemerickbeautiful
14:06hiredmanI haven't done any clojurescript in a month or two, so who knows if it still works
14:06cemerickman, I just can't gin up any motivation to learn those goog APIs though
14:07hiredmanyeah, that requires a lot of poking around and scanning the docs and examples
14:07hiredmandrawbridge-cljs started on jquery ajax stuff, until I figured out how to do with the goog stuff
14:08hiredman(le goog stuff?)
14:08cemerickI almost always have jquery coming in somewhere anyway, so…it's just too easy to not bother.
14:08cemerickThat's app stuff, of course.
14:11ro_stthat's over the wire with gz
14:12ro_stno jquery, because it'd add 15% to the download!
14:13ro_stusing just enfocus and plain cljs to do dom stuff
14:13ro_stand shoreleave for glue and remotes
14:13ro_stdoes cljs repl allow the use of stuff like shoreleave and enfocus?
14:14cemerickwhy wouldn't it?
14:14carkro_st: that's with advanced compilation
14:14cark?
14:14ro_styeah
14:15ro_sti guess the repl only works in whitespace mode?
14:15carkthat's quite a lot =/
14:15cemerickThat's probably right.
14:15ro_stcark, that's 250kb total page weight
14:15carkoh right
14:15ro_stjs, css, fonts, and the startup html
14:16carkany images in there ?
14:16carkanyways i mean : what's total size of your js ?
14:16ro_stone sprite
14:16ro_st80kb over the wire, 290kb on disk
14:17cark290k is with minification ?
14:17carki mean adavnced compilation
14:18dnolenro_st: how many lines of your own ClojureScript?
14:22ro_st2150 lines of app code
14:22ro_stand then enfocus (and domina) and shoreleave (remotes, browser, pubsub)
14:23ro_stcark: yup, advanced minification
14:23dnolenro_st: so lots :)
14:24ro_styup
14:24carkro_st: thanks for sharing those numbers
14:24dnolenro_st: and the gzipped JS is around 50k-60k or so?
14:24ro_st80kb
14:25ro_st1,890,250 main-debug.js
14:25ro_st 291,131 main.js
14:25dnolenro_st: not bad - I think CLJS strategy really pays off when you want to use really rich libraries w/o worrying too much about the final payload.
14:25dnolenro_st: whoa, 1.8 millions lines of JS?
14:25carkyes i find those numbers quite acceptable
14:25ro_stbytes :-)
14:25dnolenro_st: whew k
14:26ro_sti'm delighted. this is a v2 build of an app originally done with flex and air
14:26dnolenro_st: sweet!
14:26ro_sttry a 3.2mb swf on for size.
14:27ro_stwe have a working mvp up now at under 5kloc from the datomic schema through to the cljs
14:27carkwhat about browser compatibility, how far back do you go with all these libraries ?
14:27ro_stclojure is awesome.
14:27ro_stwe're not using any html5 stuff yet
14:27ro_stit's all working in ie8+
14:27carkkk
14:28carkso that's windows 7 onward, right ?
14:28ro_stplan to do the pjax thing, though, which does mean some fiddly bits
14:28ro_stxp goes to ie8
14:28carkok
14:28ro_stvista onward support 9
14:28carkgood ebnough then
14:28ro_styup
14:28carkenough*
14:29ro_stand we have very little to do for ipad. quite a lot to do for mobile, though
14:29ro_stthis is way, way better than the bloody flash player
14:30ro_sti've been pretty spammy with this, so forgive me if you've already seen it: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote
14:34ckirkendallro_st: how you doing
14:34ro_stgood, tx, and you? any luck? :-)
14:34ckirkendallro_st: I think I understand what is happening but it looks like a bug in FF and Chrome
14:35ro_stoh dear
14:35ro_stcan it be worked around, or are we toast?
14:35ckirkendallthe dom is being clone and there is no value="" attribute being placed on the item. However the value property is getting updated on the cloned one when you update the input on the screen if no value exists. Its not a clean clone there is still some form of connection with the value property.
14:36ro_stcrap brb
14:37ckirkendallThis problem seems to also exist for jquery
14:37ro_stdaughter wailing head off
14:37ckirkendalloh no
14:49jbarriosis kingtim/nrepl.el the version to use?
14:50jbarriosah, I don't have marmalade.. let's try that
14:53ro_stapologies
14:53ro_st2 year old. still learning to fall asleep on demand :-)
14:53ro_stok, ckirkendall, what are our options?
14:54ro_stthe input bug was the easiest way to demonstrate the issue, but we've had it with normal divs too
14:56ckirkendallNot sure I understand it with divs. That woudl contradict what I found. I think I can fix input in two ways. We can store the cache as text and serialize them out each time or we can run stuff through a transform before we hand it back that sets the property to the value of the attribute value.
14:57jbarriosaight, I just needed to upgrade nRepl to 0.1.4
14:57ckirkendallro_st: I inspected the dom in chrom and it was true that value attribute was blank
14:57ro_stthe text option sounds cleaner to me
14:58ckirkendallro_st: me too but there is a performance hit on that one.
14:58ro_sti thought the cache was text to begin with
14:58ckirkendallno its a dom fragment that we call cloneNode(true) on
14:58ro_staha
14:58ro_stperhaps we could support metadata on defsnippet to control text vs nodefragment caching?
14:59ckirkendallwhat is odd is that clone is cloning the dom but for form elements it seems some properties stay link until a value exists.
14:59ckirkendallthat might work
14:59ro_stunrelated, i tried the :compiled option on deftemplate and cljsbuild exploded :-)
14:59ro_ststracktrace as long as my arm
14:59ckirkendallhmmm
15:00ckirkendalljust on deftemplate or did you try it on both.
15:00ro_sti can file a formal issue for you so you can take a look when yo have a mo
15:00ckirkendallI have defsnippet compile in most of my test cases.
15:00ro_stdeftemplate. the docs and the source seemed to suggest that ony deftemplate supports it
15:00ckirkendallI will can you include your cljsbuild setup and clojure version
15:01ro_stoh! i'll give that a try then
15:01ro_stsure
15:01ckirkendallboth support it
15:01ro_stjust to confirm, it's (defthing :compiled sym "path" [args] …) right?
15:01ro_stthat's the order
15:01ckirkendallI am going to do some profiling to see what the performance impact is for text
15:02ckirkendallif its not that huge I may default to that
15:02ckirkendallyes
15:02ckirkendallwait let me look
15:03ckirkendallsym should be before the :compile
15:04ckirkendallI deconstruct it with sym first
15:04ro_stah, then your readme is wrong
15:05ro_stsee what i mean?
15:05ro_st:compiled after the sym works!
15:06ro_stok. we're going to continue forcibly reseting the things we find need to be reset and we'll see how things go once you manage to get to the text cache
15:07ro_stthanks for your prompt attention. bugs aside, enfocus is a great pleasure to use
15:08ckirkendallthanks for finding these, these edge cases are what need to weeded out before we get to 1.0 status.
15:09mpenetckirkendall: not sure it is a bug, isnt it a matter of prop vs attributes? at least .value and .checked (maybe even other) do not update the node attribute
15:09mpenet
15:10mpenetat least from the dom api perspective, not to say it's not weird, but at least it something documented
15:10ckirkendallmpenet: its a bit more complicated than just not updating the node attribute. it look like on first clone the value properties are still linked between the clone and the orignal. So when the clon is updated the original now has a new value.
15:11ckirkendallits really ugly
15:11abaloneis there an online clojurescript repl for random people to try things?
15:11mpenetaww ugly indeed
15:11ro_stabalone: himera
15:11abalonethanks!
15:11ro_stckirkendall: on first clone. are subsequent clones clean?
15:12ckirkendallIt seems only on first clone the value is linked.
15:12ckirkendallthat is why it keeps going back to the first value entered
15:12ro_stwhat if you throw away the first one?
15:13ckirkendallI might do that on load and see what happens.
15:13ckirkendallro_st: that would be awesome if it works
15:13ro_stkinda like the first beer. just a lining for the rest
15:13ckirkendalllol
15:14ro_stmay i suggest you start there? it might just sort it out
15:15ro_sti like that i can compile snippets. means i can cut our start up request count down to 10 :-)
15:19ro_sthmm. "(em/defsnippet context-toolbar :compiled" "java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String"
15:22ro_stckirkendall: i've tried :compiled after defsnippet, after the sym, and after the template path. each time i get cljsbuild exceptions
15:22jro_I'm defining a compojure route: (defroutes app-routes (GET "/rest/v1/throw" [] (throw (Exception. "ex")))). How I can define a handler which logs the exception thrown?
15:23ro_stjro_: a ring middleware, maybe?
15:23weavejesterjro_: You mean a middleware function?
15:23jro_yes
15:23weavejesterjro_: e.g. (defn wrap-catch-ex [handler] (fn [req] (try (handler req) (catch Exception ex (log ex))))
15:26ro_stckirkendall: does :compiled work with keyword selectors?
15:26ckirkendallro_st: odd, I will take a look
15:26ro_stckirkendall: i'm using keyword selectors, not string selectors.
15:26ckirkendallit should
15:26ro_stswitching to string selector fixes it
15:27ckirkendallhmmmm
15:27ckirkendallThat would be a bug
15:27ro_stno! i apologise
15:28ro_sti'm using a reference to a (def templates "some-path") instead of a string
15:28ro_stif i use the string, it works
15:28ro_stif i use the ref to the string, it dies
15:29ckirkendallyes that make sense
15:29ckirkendallbecause I don't have access to the value of the ref during compile time.
15:29ro_stis it because this is happening at compile time and it's not resolving htat reference
15:29ro_stahh
15:29ro_stok
15:29ckirkendallI need to update the documentation to make sure people realize that
15:31ro_stconfirmed. working
15:32ro_styikes. not such a good idea ito filesize. js now 604kb, or 603kb with gzip!
15:33ro_stor 2.2mb with no minification
15:33ro_sti think i'll keep the extra web requests :-)
15:33ckirkendalllol
15:34ckirkendallright now defsnippet brings in the whole file.
15:34ckirkendallI can fix that but I have to add a dependency to enlive.
15:35ckirkendallI am planning on that fix but it going to be a little while.
15:36ro_stthat's ok. i'm happy to stick to a runtime load. browser caches it just fine, and it means that we can use the templates from enlive if we want
15:40ro_stckirkendall: would you mind pinging me on twitter when you want me to give something a try?
15:40ro_stgotta go. thanks again :-)
15:42ckirkendallnp
15:54jro_somehow I cannot catch exceptions: the context is here, where I try to define an exception logger: (defn wrap-catch-ex [handler] (fn [req] (try (handler req) (catch Exception ex (.error logger ex)))))
15:55jro_https://github.com/jrosti/ontrail/blob/master/src/ontrail/core.clj#L69-70
16:18gfredericksjro_ is gone?
16:29noidi_I'm supposed to talk a bit about functional programming and code reuse to a bunch of Java programmers
16:29noidi_what do you think about this example https://gist.github.com/3751951
16:30noidi_I hope they'll be able to get the gist of the functional code even with all those horrible parentheses everywhere :)
16:31Iceland_jacknoidi_: maybe introduce #() a bit later on
16:32scriptoryea, it's not strictly necessary
16:32scriptorexplicit names keeps things clearer
16:34Iceland_jack#() is nice when you're better acquainted with the language, I can imagine that it would feel like a ternary operator to people that aren't familiar with folds or anonymous functions in the first place
16:35gtrakis there something akin to maven submodules and a reactor build in lein? I want to reference an undeployed project version in another project that builds a zip distribution
16:38noidi_Iceland_jack, you're probably right, thanks
16:38amalloyscriptor: are you skipping min-key and max-key on purpose?
16:38scriptoramalloy: er, what's the context?
16:39amalloyoh, i was just misreading who said what :P
16:39amalloyi meant noidi_
16:39noidi_I even considered doing the whole thing in JavaScript, but I'd rather show Clojure as "the better java"
16:40noidi_amalloy, simple reason: I didn't know about them :)
16:41scriptornoidi_: the implementations for them are pretty simple, so you can just wrap up by rewriting your code using them and then explaining how min-key and max-key themselves work
16:42amalloynoidi_: http://amalloy.hubpages.com/hub/What-is-Clojure has a bit on the same topic; feel free to steal some of it
16:42noidi_amalloy, thanks!
16:45noidi_scriptor, I don't know if that's necessary. The point I'm trying to convey is that when you solving a very specific problem using FP tends to lead to a very generic solution.
16:46noidi_s/when you//
16:58brainproxyif any of you folks are already in St. Louis, i.e. you've arrived early in anticipation of Strange Loop, please know you're welcome to come hang out tomorrow night at STLJS
16:58brainproxyhttp://www.stljs.org/events/68051712/
16:58brainproxyI'm the organizer, and though the meetup's focus is on node.js / javascript, many of the folks who attend are into all sorts of other stuff, like clojure / clojurescript
16:58brainproxyincluding me, of course
17:00irctc423Hi Clojure fans - question about interop and overloaded methods...
17:00irctc423I'm trying to call submit with a clojure fn
17:00irctc423but I can't make it choose the Callable version of the submit method, without reifying a Callable.
17:01nDuffIsn't IFn Callable?
17:01irctc423Is there a way to force it to choose the right version with type hints or anything?
17:01irctc423It is Callable, but it is also Runnable
17:01irctc423and submit has overloaded implementions with both.
17:01nDuffAhhh.
17:02irctc423this works: (.get (.submit exe (reify Callable (call [_] ((fn [] (+ 1 1)))))))
17:02irctc423this doesn't: (.get (.submit exe (fn [] (+ 1 1))))
17:03hiredmanirctc423: type hint your function as callable
17:03hiredman(.submit exe ^Callable foo)
17:04irctc423hiredman - I still get nil when I try that: (.get (.submit exe ^Callable (fn [] (+ 1 1))))
17:05hiredmanirctc423: you can't type hint a fn like that, you have to pull the fn out in to a let
17:05irctc423Ahh...
17:06S11001001shouldn't type of a lambda be known, due to fn* being special?
17:08irctc423thanks hiredman - I'm going to concentrate on getting my type hints to stick.
17:09nDuffS11001001: It's known to be IFn, but irctc423 wants to be more specific than that.
17:09hiredmanhttps://github.com/hiredman/clojurebot/blob/master/src/hiredman/schedule.clj
17:10S11001001nDuff: can fn* yield a non-AFunction?
17:11hiredmanif you type hint a fn form like ^Callable (fn ...) I am pretty sure you end up typehinting the return value of the fn, but if you bind the fn to a name like foo, then ^Callable foo will type hint the value of the name, which is the fn
17:14irctc423I still can't get it, but I see your example - I must be doing something wrong...Thanks a lot for the help.
17:15nDuffirctc423: (let [^Callable your-fn (fn [] + 1 1)] (.get (.submit exe your-fn))))
17:16irctc423nDuff: That gives you a result? I get nil on 1.4.0
17:16amalloyS11001001: fn yields something that is both Callable and Runnable, and the .submit function is overloaded to accept either
17:17amalloythe compiler can't decide at compile time which one you want to call, so it defers the decision to runtime
17:17nDuffirctc423: Haven't tested it -- didn't get enough context to know how to reproduce. What's "exe" supposed to be?
17:17irctc423nduff: sorry: (def exe (Executors/newSingleThreadExecutor))
17:17S11001001amalloy: ah, I see
17:20nDuff; (let [exe (java.util.concurrent.Executors/newSingleThreadExecutor)] (let [^Callable your-fn (fn [] (+ 1 1))] (.get (.submit exe your-fn))))
17:20nDuffirctc423: that returns 2 for me.
17:23irctc423nDuff: Me too! Now to figure out exactly how that is different from all the very similar attempts I have which don't work :)
17:23irctc423Thanks for the help...
17:27irctc423nDuff: The only difference is that you have the executor defined in a let, and I have it in a def...
17:29nDuff...is that to say that you can reproduce the issue with only that one change? If so, is the var you create with that def marked dynamic?
17:30irctc423Yes - just that one change. The exe var is not dynamic
17:36S11001001:r
17:36S11001001yep
17:37irctc423nDuff: Thanks for the help - signing off now. Might clean up my example and post to the group. a bientot
17:57y3diwhat are some examples of apps that use storm?
17:59lnostdaly3di: https://github.com/nathanmarz/storm/wiki/Powered-By ?
18:00y3dicool thanks
18:44tomojwell, this turned out pretty useless http://tomoj.s3.amazonaws.com/cljsprotos.html
18:51tomojI also didn't consider extend-type/extend-protocol :(
20:27gjcourtis there an easier way to do lazy connections than using an atom? ie: something like this? http://dl.dropbox.com/u/2110/Screenshots/0ht.png
20:29nDuffgjcourt: Depends on how much support you want to have for reconnecting on failures. If you don't care so much about that, there's delays
20:29nDuffgjcourt: ...if you _do_ care about that, I've been known to abuse agents for the purpose.
20:31gjcourtright, nDuff that makes sense
20:45tomojdnolen: think there are any important cljs-specific tests to add for clojure.data, or just porting the clojure tests OK?
20:47tomojI considered adding a test or two for every primitive type but it seems somewhat silly. I guess it can't hurt though
20:49dnolentomoj: hmm I'm not sure why there'd need to be specific cljs tests - a port of the clojure tests should suffice.
20:50dnolentomoj: btw, have you actually found yourself needing locals clearing in CLJS?
21:19TimMcI ran up against locals clearing in Chrome the other day.
21:20TimMcI was stopped in some 4-level-deep closure in the debugger, and it insisted that some local in the outermost fn scope was undefined. It took me 15 minutes to figure out why. >_<
21:27gfredericks,((apply comp (repeat 10000 identity)) 42)
21:27clojurebot42
21:28carknow that's what i call doing work =P
21:28gfredericksgotta keep the bots alert
21:28cark=)
21:36tomojdnolen: re locals clearing, no. I thought (let [coll (range)] (map #(* % %) coll)) held the head because the #(* % %) could have closed around coll. the real problem was just *1
21:38tomoj..and locals clearing wouldn't help there even if that was a real problem, I guess
21:39tomojTimMc: you mean Chrome does its own locals clearing?
21:39TimMctomoj: Yeah, this was straight-up JS.
21:41tomojthat's comforting, I was worried that I would eventually run into weird head-holding problems
21:46danielglauserWhy do folks sometime define functions with an opening paren before the vector of arguments and sometimes not?
21:46danielglauserFor example
21:47danielglauser(defn my-func "Documentation is cool" ([arg & more-args] …))
21:47danielglauservs
21:47eggsbydanielglauser: usually it's because the second way let's you do multiple arities
21:47metelluswith parens around the args, you can define the function for different numbers of arguments
21:47brehautdanielglauser: the function may have at some point had multiple arities
21:47danielglauser(defn my-func "Documentation is cool" [arg & more-args] ...))
21:47danielglausergot it
21:48tomojthree answers before the question was finished :)
21:48danielglauserCool, thanks!
21:48gfredericksjust in case nobody else answered your question, the reason is that that way you can have multiple modies for different arities
21:48eggsbyhi brehaut sup phraseology buddy
21:48danielglausergfredericks: You're like waaay too slow :)
21:48brehautphraseology?
21:48gfredericksdanielglauser: I mean I can't know for sure why any particular person would do it
21:48gfredericksdanielglauser: but if I had to guess what the most plausible reason was
21:48brehautgfredericks, are you mocking my slow ping?
21:49eggsbybrehaut: just that we worded it almost exactly the same :)
21:49gfredericksdanielglauser: it would be the one I stated
21:49brehauteggsby: aha :)
21:49gfredericksbrehaut: no just three people giving long identical simultaneous answers :)
21:49brehautah
21:51gfredericksI found myself, when in a time crunch, getting lazy about cljs function arities
21:52gfrederickse.g. treating (fn [a b] ...) like the second arg is optional
21:54TimMcSounds pretty sketchy.
21:54gfredericksyeah; I felt dirty; I don't know if cljs plans to cause that to error in the future
21:57tomojseems unlikely to me, wouldn't that be a significant perf hit?
21:58gfredericksprobably; though you could tie it into *assert*
21:58tomojI forget, can a fn tell the difference between undefined being passed and nothing being passed?
21:58gfredericksarguments.length maybe?
21:59tomojyeah right
22:07dnolenwhenever I think we have it rough in the the Clojure community I read a Node.js ML thread ...
22:07danielglauserNice
22:08danielglauserHow are folks deploying Noir apps? lein war then stick it on Tomcat or Jetty or lein run up on the remote server?
22:09danielglauserRelated why does noir.server use an old Jetty? 6.1.25 instead of 7 or 8?
22:10danielglauserTrying to figure out a good prod deployment for a Noir app. No legacy to deal with so I can do as I please.
22:12cgagML thread?
22:12xeqidanielglauser: clojars runs nginx in front of a jar w/ -main, basically equivalent to `lein trampoline run`
22:12xeqialso, it probably has jetty 6.1.25 due to ring-jetty-adapter bringing it in
22:13gfrederickscgag: mailing list
22:13amalloy4clojure actually uses lein trampoline run, with nginx in front
22:13xeqinewer ring versions are on a 7
22:13xeqinote, clojars uses compojure rather then noir, but the deployment would work the same
22:14gfredericksgood old ring
22:15danielglauserThanks folks
22:15eggsbylooks like the latest noir uses jetty 7
22:15eggsbyvia ring 1.1.1
22:15danielglausereggsby: Ah, I thought I was on the latest Noir
22:24Frozenlo`I'm trying to convert some JS from a closure example to cljs. Unfortunately the 'this' argument is confusing me. How can I use it in cljs? https://www.refheap.com/paste/5167
22:25TimMcFrozenlock: js/this ?
22:25xeqiFrozenlock: you could use this-as https://github.com/clojure/clojurescript/commit/09ff093dc86b455e3090ce3612c5e01f3b5bada6
22:26TimMcOh right, it has to be raw.
22:26FrozenlockOh so I can create a binding (this-as this (somefunction this...
22:29tomojbut how do you call Foo.call(this) ?
22:29tomojhuh
22:30tomoj(goog.fx.DragDrop this) seems to compile to the right thing
22:30Frozenlock--> (defn FooDrag [element] (this-as my-this
22:30Frozenlock (js/goog.fx.DragDrop.call my-this element)))
22:30Frozenlock??
22:30lazybotFrozenlock: Definitely not.
22:30Frozenlockthanks lazybot
22:30tomojoh, s/right/wrong/
22:31tomojyou're not supposed to use js*, right?
22:31FrozenlockWell it works as well with a dot.
22:32Frozenlock(.goog.fx.DragDrop.call my-this element)
22:32tomojjs/ is fine, I mean like (js* "goog.fx.DragDrop.call(this)")
22:32xeqitomoj: correct, theres a thread on the mailing list about that
22:34wschudyDoes anyone know if there's a way to get light-weight threads, greenlets, coroutines, or whatever you want to call them in clojure?
22:34FrozenlockHow do you deal with optional data? Normally I would just use '&' argument-name, but is there something special I should do here?
22:35tomojI want to extend a protocol to ISeq in cljs. two options: 1) instead define wrapper functions around the protocol fns which always check for ISeq satisfaction 2) extend the protocol to default and throw an error if not ISeq
22:36gfrederickstomoj: what are "the protocol fns" that you would wrap?
22:36gfredericksyou have to put the impl somewhere and you can't actually extend to another protocol can you?
22:38tomojI have a protocol like cljque's IFutureSeq, with -current and -later, where -current is like ISeq's first, and -later is like ISeq's rest but might return a promise of an IFutureSeq (where rest must always return an ISeq)
22:38wschudyAnother question: I'm surprised that in transactions the "ensure" behavior isn't the default. Why not make the "ensure" behavior the default with the more dangerous option available for people who specifically request it?
22:39tomojI have my own impl already, but ISeqs could be trivial IFutureSeqs
22:39gfrederickstomoj: now I'm curious what the use case is
22:39gfredericksi.e., I don't see what an IFutureSeq offers over an ISeq
22:40tomojso option 1) is (defn current [coll] (if (satisfies? ISeq coll) (first coll) (-current coll)))
22:40gfredericksI guess if you get the promise you can tell it's not ready yet?
22:40tomojwell
22:40tomojit's not a clojure promise
22:40tomojcljque calls it an INotify
22:40tomojand this is cljs (hence the problem with extending a protocol to ISeq)
22:41tomojso (promise) can't work
22:41tomojyou can't have ISeqs that wait on IO either, for example
22:41gfrederickssince it's all async
22:42gfredericksI guess lazy seqs are a bad abstraction for data IO in JS
22:43FrozenlockJS: FooDrag.prototype.createDragElement = function.... CLJS: (set! js/FooDrag.prototype.createDragElement (some-fn))
22:44FrozenlockWRONG
22:44FrozenlockOf course.
22:44xeqiFrozenlock: (set! ... some-fn) ; without ()s around some-fn ?
22:45gfredericksI've never tried to set foo.bar.baz before
22:45gfredericksdoes (set! (.-baz (.-bar foo)) ...) work?
22:45gfredericksor do you need a local?
22:45Frozenlockxeqi: #<ReferenceError: FooDrag is not defined> :-(
22:46xeqigfredericks: setting properties like that works, I've been playing with three.js like that
22:46gfredericks(let [foo (.-prototype js/FooDrag)] (set! (.-createDragElement foo) some-fn))
22:46gfredericksxeqi: oh nice
22:47FrozenlockStacktrace says is translate in the correct JS: :as "FooDrag.prototype.createDragElement = "
22:47FrozenlockI just need to find out why it's not defined. Back to the REPL!
22:48Frozenlocks/is/it
22:49tomojit's probably munged?
22:49tomojdid you try just FooDrag ?
22:49FrozenlockIsn't this only when using advanced compilation?
22:50FrozenlockYes, I've defined it earlier. However if I type FooDrag in the console, it says undefined.
22:50FrozenlockSo the functions defined in the REPL aren't usable in the console?
22:50tomojyou need to prefix with whatever namespace you're in
22:50FrozenlockOh I see
22:50tomojcljs.user.FooDrag for example
22:53FrozenlockOh wow. (set! cljscript-test.client.main/FooDrag.prototype.createDragElement +) worked.
22:53Khaozenough clojure for today
22:53FrozenlockI don't like that I need to type the namespace...
22:53Khaozcomplement, comp, partial and memoize just blowed my mind
22:53cgag:)
22:54cgagi love comp and partial
22:54Khaozi need to read a little bit more about them
22:57KhaozGood night for all.
22:57Khaozwell, it's late here in Brazil :)
23:09tomojSgeo: suppose that for some clojure abstraction (which is semantically a monad and a functor), (=<<) and fmap are fused into one function, which is of type both `(a -> m b) -> m a -> m b` and `(a -> b) -> f a -> f b` (and `(a -> m m b) -> m a -> m b` etc). is that obviously going to cause a lot of trouble? not using algo.monads. currently I also actually have `(a -> b) -> a -> m b` in there..
23:20Sgeotomoj, what's the difference between an m a and an f a? I should note that if it's both (a -> m b) -> m a -> m b and (a -> b) -> m a -> m b, then that's just a bind that if it sees that the function isn't returning the right sort of value, does a return on it then proceeds with the bind.
23:21SgeoSemantically, all monads should be functors.
23:22tomojno difference, I just used f in the fmap type
23:22SgeoAh
23:22tomojlambdabot tells me it's fmap, (=<<), (join .) . (=<<), ((join . join) .) . (=<<), etc
23:23tomojbut what is `(a -> b) -> a -> m b` ?
23:23tomojactually currently I just have `(a -> b) -> a -> b`, so $
23:24tomojit seems convenient but it seems so wrong that I feel it must cause inconvenience somehow
23:24Sgeo\f a -> return (f a)
23:25Sgeo(Probably a more pointfree way to write that)
23:25SgeoIn what way is it convenient?
23:26tomoj(return .)
23:27tomojwell, I don't see a need for values of type (m (m a)) etc
23:27tomojso I have one operator for the infinite list of operators above
23:29SgeoUh, does it support values of type (m (m a)) though?
23:30SgeoWill join :: m m a -> m a do something sensible, or will it just be identity?
23:33tomojit does the right thing
23:33tomojexcept I don't have a join currently
23:33abaloneare folks ok with paredit treating the { in #{a b c} as the opening delimiter, moving only the { on a backward slurp -- since paredit is for multiple languages and #{ isn't always an opening delimiter?
23:34tomojit's just baked into the one ($, fmap, =<<, (join .) . (=<<), etc) operator
23:34tomojby "right thing" I mean the joins in that operator respect the semantic monad morphism
23:35tomojwhich reminds me, actually, sometimes I find myself wanting the wrong thing, and that becomes inconvenient :)
23:36SgeoDoes your operator have special code to determine what to do? I guess I'm having trouble visualizing it
23:38tomojyes, it has two satisfies? checks, one for (a -> m a) promotion and one for (m m a -> m a) demotion
23:38Sgeo,(doc satisfies)
23:38clojurebotPardon?
23:38tomoj,(doc satisfies?)
23:38clojurebot"([protocol x]); Returns true if x satisfies the protocol"
23:39tomojthe operator is essentially `when` from https://github.com/kriskowal/q#the-middle
23:39clojurebot'Sea, mhuise.
23:39tomojclojurebot: forget the operator
23:39clojurebotthe operator is essentially `when` from https://github.com/kriskowal/q#the-middle
23:41tomojexcept I use $ in place of (return .)
23:42tomojwait, no. I use (return .) too
23:42SgeoI have a question about it, but ... not entirely sure
23:42SgeoWhat if the function you give it is an m a -> m b? Does it still correctly determine what it needs to do? What about m a -> m m b?
23:44tomojwell, if the function you give it is _really_ (m a -> m b), you surely get an error because it won't ever call the function with an (m a)
23:45tomojsimilarly for the other case
23:46SgeoEven thought in principle it should be capable of the type (m a -> m b) -> m m a -> m m b?
23:47tomojyou mean because it has type (a -> b) -> m a -> m b ?
23:47SgeoYes
23:47tomojright
23:47tomoj(m m a) is essentially uninhabited
23:48Sgeoreturn (return 5)
23:49tomojwell, shit
23:50tomoj(constantly (constantly 5)) is a value of type (m m Number) currently :)
23:51tomojconfusing name, `immediately` maybe would be better
23:52tomojbut that's a bug, my intent was that (immediately (immediately 5)) was the same as (immediately 5)
23:52SgeoJust a general reflection, but m m a tends to be more useful than it looks at first glance
23:52tomojyeah, that's what I fear
23:53tomojI can't think of any examples where I don't want to just join, yet
23:55tomojI wonder if that operator can be described more simply in terms of another typeclass
23:55amalloyabalone: if i ever did a backwards slurp i would object to that behavior
23:55SgeoI _think_ if you want to satisfy the monad laws, you need bind to work properly with that sort of m m a thing.
23:56amalloybut it's not clear that it's possible to fix without a lot of work on paredit, since afaik it's built on the assumption that delims are a single character
23:58Sgeotomoj, is it merely difficult to implement your operator to work with m m a properly?
23:58amalloytomoj, Sgeo: i don't really understand this conversation, but it sounds like tomoj is saying (m m a) isn't a useful type? surely that's useful when m is List
23:58tomojno, that's easy
23:59tomoj(m m a) for a particular monad
23:59Sgeoamalloy, he's not saying in general, but for the specific Monad he's working on
23:59tomojI guess the monad laws must contain the answer to my question
23:59SgeoI think it's definitely a questionable assumption, though. m m a tends to be surprisingly useful sometimes.
23:59tomojbut I need to stare at them for a while..