#clojure logs

2014-04-02

00:04sritchie_technomancy: hey, any idea what's up with that heroku issue I tweeted?
00:04sritchie_technomancy: seems like something's up with the Clojure buildpack
00:07beamsoothers are reporting that it's working again if you redeploy to heroku
00:07sritchie_ah, nice
00:07sritchie_will try now
00:07beamsothe issue appears to have been with heroku
00:07rootexdoes heroku supports http-kit?
00:10beamsoi believe the answer to that one is yes
00:15sritchie_rootex: yup, we've been working with it for a while
00:15sritchie_rootex: new relic had issues with it, if I recall
00:26bjeanesbeamso: hey sorry about that there was a bug introduced in the Heroku API today that affected some buildpacks. It's since been reverted
00:27beamsobjeanes: no apology necessary
00:27beamsonot currently using it :/
00:28beamsobut thanks for the fix
00:31bjeanessritchie_: do you have a link to that tweet?
00:31sritchie_bjeanes: this one? https://twitter.com/sritchie/status/451154520815312896
00:31bjeanesperfect, thanks
00:36bjeanes(just trying to track all the build packs it affected)
00:36sritchie_for sure
00:48aedonshould clojurescript code in a namespace/file/module that isn't required execute when the js file is loaded?
00:53technomancysritchie_: sorry, I'm not on twitter much these days; did you get it sorted out?
00:53sritchie_technomancy: no worries - looks like it started working again by the time I got back from dinner
00:53technomancycool, glad to hear it
02:05amalloyaedon: cljs code in a namespace that isn't required shouldn't exist at all, google closure will eliminate all the dead code, right?
02:10aedonamalloy: I'm using simple mode for development purposes, so I assume that doesn't apply
02:54sm0ketpop just killed it with timl
04:22petronwhy does the or macro need a let binding?
04:22petronwhy can't (or x y) just expand to (if x x y) ?
04:22petroninstead of (let [or 158 x] (if or__158 or__158 y)) ?
04:23Guest12324I've been trying whole day to make google sign in work using oauth2 with no luck
04:24Guest12324I followed the tutorial on this page https://coderwall.com/p/y9w4-g but can't figure out what is *request*
04:24Guest12324can anyone please help?
04:24sm0keoauth2 playground was helpful i remember once i was doing this
04:25sm0kehttps://developers.google.com/oauthplayground/
04:25Guest12324I tried that too. at this link https://developers.google.com/oauthplayground/
04:26sm0keGuest12324: i remeber just copying the access token from this ui into my code
04:26Guest12324this is the error I keep getting cannot find code parameter
04:26sm0keit works pretty fine after that
04:26Guest12324I also looked at the source code over here https://github.com/DerGuteMoritz/clj-oauth2/blob/master/src/clj_oauth2/client.clj
04:27Guest12324but this (oauth2/get-access-token google-com-oauth2 (:params request) auth-req)
04:27Guest12324looks different from this
04:27Guest12324(defn get-access-token [endpoint & [params {expected-state :state expected-scope :scope}]] (let [{:keys [state error]} params] (cond (string? error) (throw (OAuth2Exception. (:error_description params) error)) (and expected-state (not (= state expected-state))) (throw (OAuth2StateMismatchException. (format "Expected state %s but got %s" state e
04:27Guest12324i'll try it
04:32clgvpetron: because then the expression "x" would be computed twice
04:32petronI see, so the let binding computes the form of x?
04:34clgvpetron: yes the let binding binds the result of evaluating expression `x` to a local name that is used as predicate of the `if` and as return value in the "then case"
04:35clgvpetron: thus, `or` is even safe for side effects since they are not evaluated twice (provided the context is not an operation on a ref or atom)
04:35petroncool, thanks.
06:47CookedGryphonIs clojuredocs ever going to be brought up to date?
06:48CookedGryphonIt's really annoying, because it's one of the top hits for most clojure searches, and it's now painfully out of date missing several really useful commands
07:06mpenetthey should just improve the official site imho, stick disqus or something similar on every function (with separate page per function too) and be done with it
07:06mpenetthere were a few attempts to improve/update clojuredocs but I think it's all dormant
07:06mpenetnot to say dead
07:08FoxboronShould have been clojure april foolks
07:08Foxboron"clojuredocs update!"
07:08clgvFoxboron: you would have disappointed a lot of people badly ;)
07:09Foxboronclgv: i know :)
07:10CookedGryphonAll I really want is a site which listens for clojars and clojure artifact uploads and runs codox over them
07:10CookedGryphonand then like you say, disqus or something for comments
07:11augustlas long as I have the cheat sheet I'm happy ;)
07:11augustlhttp://clojure.org/cheatsheet that is
07:13CookedGryphonthere is a cool project one of my colleagues did called cloc
07:13CookedGryphonwhich scans your classpath and generates a documentation website for all the libraries you're using
07:13CookedGryphonwith local search too
07:13CookedGryphonbut I never think to run it
07:13krasclj-antlr question, my "actions" in the grammar file does not have any affect on the sequence produced as output. Any idea?
07:14CookedGryphonI wonder... could I make lein run that in the background whenever i set off a repl connection?
07:15clgvCookedGryphon: yes you can
07:15clgvCookedGryphon: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md#hooks
07:16beamsothis cloc : https://github.com/jaley/cloc ?
07:17CookedGryphonyeah that one
07:18beamsothe google for cloc lead me to gizmo, which i'd never heard of or seen before : https://github.com/clojurewerkz/gizmo
08:40katoxCookedGryphon: I'd say comments and examples on valuable to discover pitfalls and less known fn usages, it's certainly better to head onto clojuredocs than to stackoverflow directly ;)
08:41katoxwhat's stopping the update of the current site? what features are that badly needed?
08:42CookedGryphonwell, documentation for a version released in the last 3 years
08:42CookedGryphonI think they started a rewrite
08:42CookedGryphonit was all done in rails and then they started to rewrite it in clojure/script
08:42CookedGryphonand i don't know how that effort went/is going
08:54pepijndevosI can;t imagine why I've never come across this, but how do you get the last n chars from a string? Preferably without making it a seq first.
08:55katoxCookedGryphon: found some activity about 4-7 months ago (https://github.com/clojuredocs/web/commits/master, https://github.com/clojuredocs/doc-extractor/commits/master)
08:55opqdonutpepijndevos: String.substring
08:56opqdonutpepijndevos: oh, right, there's also clojure.core/subs
08:56clgvpepijndevos: clojure.core/subs
08:56katoxCookedGryphon: old cdocs seems to be rails2, I wonder if it's the extractor what's blocking the progress
08:56pepijndevos(subs s (- (count s) 2))
08:57pepijndevosgood enough, but ot as nice as the maybe nonsens str[-2:] in Python
09:06clgvpepijndevos: write a wrapper fn that implements that behavior. should be pretty easy
09:08pepijndevosyea...
09:34lgs32aIs there a collection of useful om components already?
09:35lgs32aI saw an empty repository on swanodettes gh
09:45dnolen_lgs32a: there's only a few things at this point - as people build more with it I think you'll see more useful om components over time
09:47lgs32adnolen_: thank you.
09:47gtrakis there a scrolling table component yet, or an existing one that's easy to integrate with om?
09:48lgs32athats what I was looking for too
09:48gtrakI might try to reinvent it, but I don't really know what I'm doing yet with regards to UI work :-)
09:48dnolen_gtrak: not that I'm aware of, a fixed cell height one would be really easy - variable cell height would be more challenging but also I think less commonly used
09:49gtrakah, fixed cell would be fine by me.
09:50gtrakwould om/react handle the diffs intelligently say on a scroll-down? Maybe it's good enough out of the box, honestly haven't tried yet.
09:51teslanickYou could delegate to an existing JS library. reify IWillMount, IWillUpdate and just step into JS interop.
09:52teslanickAnd IWillUnmount to clean up correctly.
09:52gtrakyea, good, I also wanted to know if that sort of thing was doable :-)
09:52dnolen_gtrak: it should do two things IMO, railroad its content (do not bother rendering more than can be seen) and be able to load contents lazily
09:53dnolen_delegating to an existing library could work but not ideal IMO for many reasons.
09:54gtrakI'll give it a try, I'm familiar with the adobe flex implementation and all the caching of elements at the top and such, but that was like 5 years ago, and doesn't fit with my understanding of react/om so far.
09:55dnolen_gtrak: conceptually won't be much different
10:07teslanickYeah, delegating to an existing library is kinda kludgy. But a really good datatable is a hard problem, and one that's been solved to some extent already.
10:09dnolen_teslanick: it's really not that hard, and most of what's out there is awful and certainly not designed for working efficiently immutable data structures
10:27sm0keis it possible to :aot :all without evaluation of global definitions like (def conn (connect ..))
10:28sm0keduring compile only functions like lein compile, install etc
10:46technomancysm0ke: you could do (when-not *compiling-files* ...) but it's pretty sketchy
10:50sqldiersm0ke: you may be looking for delay
10:50sqldierhttp://clojuredocs.org/clojure_core/1.3.0/clojure.core/delay
10:52gtraksm0ke: the use-case as presented is just a bad design :-)
10:53gtrakdon't do that, use like 'component' or something: https://github.com/stuartsierra/component
10:55gtrakwe've got a sizable application that just uses a simple hash-map for the same purpose.
11:11deadghostI can get data as csv, json, or xml
11:11deadghostshould I prefer any one of them
11:11deadghostare or they all about the same
11:13teslanickcsv is the easiest to parse, json is probably the most robust. xml is probably a waste of bytes. :)
11:14sm0keyea delays and *compile-files* was what i was using till now.
11:14sm0kedelay just adds overhead of unnecessary derefrencing
11:14sm0ke*compile-file* is ok , but not very pretty
11:15gtrakyou can make it prettier with a macro, but every time we've used a shared resource like that it eventually had to be refactored for injection.
11:16gtrakand that was at the point where it was already a huge hassle to work with the var version.
11:16gtrakfor mocking and such
11:18sm0kegtrak: how do you solve this with hash map?
11:19gtraksm0ke: you just write the functions to take an extra argument, then pass around the connection, initializing it somewhere further up.
11:20gtrakjust push the problem somewhere else, basically is what I'm suggesting :-). Have a central thing that deals with lifecycles of shared resources.
11:21gtrakthat isn't a clojure namespace.
11:22bodie_gtrak, that demo you linked me about using mutexes to lock framerate to a tight precision
11:22gtrakyea
11:22bodie_I was looking over it, quil had some stuff removed so I wasn't able to try it out
11:22gtrakoh really? it worked for me a bit ago.
11:22bodie_hum
11:22gtrakjust needs a lein run, I'll try it.
11:22bodie_quil.dynamic I think was taken out
11:22bodie_okay, nice :)
11:23gtrakyea, but, it should be using an old artifact.
11:23bodie_I need to do more learning before I can piece things together on my own, sadly
11:23bodie_ah
11:25gtrakbodie_: yea, I did a lein run and it worked just fine.
11:26bodie_ah, I see
11:26gtrakbesides the bugs of course
11:26gtraksometimes the balls spin around each other b/c the collision detection's a bit wonky :-)
11:27gtrakor they miss entirely
11:27gtrakbut you just wanted the timer part :-)
11:27gtrakthe simulation's running at 500fps and the drawing's at 60 here
11:27bodie_that's awesome
11:31gtrakbodie_: maybe you tried it when clojars was down :-)
11:33jjl`does clojars go down very often?
11:33mdrogalisNot really.
11:38hyPiRionwhat, Clojars down?
11:38gtrakcouple days ago
11:41gtrakbodie_: I made a vid a while back: https://www.youtube.com/watch?v=415OTzYEXsk
11:41gtrakWASD applies constant acceleration
11:42bodie_sweet!
11:43dnolen_cemerick: btw this new thing that prevents using lein based on version ranges is insanely annoying
11:43dnolen_cemerick: is there a way to turn this off? it's basically hell for anyone that works on ClojureScript itself
11:43dnolen_s/lein/lein-cljsbuild
11:44cemerickdnolen_: you're referring to the NPE you mentioned in a recent ML post?
11:45dnolen_cemerick: no I get a useless warning message "You're using [lein-cljsbuild "1.0.2"], which is known to work well with ClojureScript 0.0-2014 - 0.0-2173" then it aborts building
11:46cemerickdnolen_: the compatibility ranges are there for a reason; there are actual incompatibilities that cause problems silently otherwise. The reason why you're not using 1.0.3 has been addressed in the latest 1.0.4-SNAPSHOT.
11:47dnolen_cemerick: there needs to be a way to turn this off for anyone that works on the compiler
11:47dnolen_if I know that 1.0.2 works then I want to use it again existing projects with whatever released version of cljsbuild exists
11:48dnolen_the current behavior is insane for library developers who contribute to ClojureScript
11:48cemerickdnolen_: the alternative is what was happening before: things would go wrong, and it the known-working combinations of cljsbuild and ClojureScript was tribal knowledge.
11:49dnolen_cemerick: ^ I asked for a way to disable that's all
11:49dnolen_I understand the utility for normal users
11:51cemerickdnolen_: I'll consider adding a flag you can set in your :user profile; but, I don't currently see how you (or I, or any other contributor) doesn't benefit the same as "normal" users. If you're working on CLJS head, use the latest cljsbuild. If not, the rev of cljsbuild should correspond based on the known compatibility matrix.
11:52cemerickDoing otherwise will inevitably lead to API conflicts, or silent emission of strange/incorrect compilation output.
11:52cemerickExpertise doesn't exempt anyone.
11:53dnolen_cemerick: grrr is all I can say. This assumes cljsbuild head works, if doesn't and I know that 1.0.2 does work like I do now then what?
11:54cemerickdnolen_: In the current situation, 1.0.2 simply does _not_ work with CLJS head. It's not an API incompatibility, but certain things just won't work as expected (in this case, :libs, :foreign-libs, externs).
11:54dnolen_cemerick: but it does work for *libraries* (not applications that use those options)
11:54dnolen_I'm sorry hand holding stuff needs flags IMO
12:08technomancyif only there were a way compatibility concerns could be communicated
12:08technomancyperhaps by a series of numbers
12:09technomancyone might even separate them using dots
12:09llasramtechnomancy: April Fool's Day was yesterday, man
12:09technomancyllasram: dang, can't even blame time zones
12:11cemerickdnolen_: hopefully this will be satisfactory? https://github.com/emezeske/lein-cljsbuild/issues/305
12:11dnolen_cemerick: thanks
12:12hiredmanI thought core projects had to use maven, what is this lein-cljsbuild stuff?
12:14benmosswhat is the deal with versioning, what black magic is used to come up with something like 0.1.267.0-0d7780-alpha
12:15benmossthats a core async version
12:15clojurebotI don't understand.
12:15rasmustosemver + sha1 + branch?
12:15technomancyclojurebot: neither do I, clojurebot. neither do I.
12:15clojurebotPardon?
12:15clgvrasmusto: semver is a pretty wild guess here :P
12:16benmossbecause releases have to be cut for every commit or something?
12:16Bronsa0.1.<commit-count>.0-<commit-sha>-alpha
12:16rasmustoguess based on seeing numbers with dots only
12:16rasmustooh, commit count makes more sense for that third number
12:17clgvhopefully there comes a "stable" time for both of these libraries with actual version numbers ;)
12:18benmossand the lion will lay down with the lamb
12:18rootexbenmoss: it means "we don't know if what we are doing is right"
12:18coventryWhat could cause the austin repl to be unresponsive, even though the js console tells me that the initial XHR transactions with the austin server are coming through just fine?
12:21clgvrootex: that's what I thought as well
12:21clgvrootex: but you get told otherwise when you ask for the reason of the permanent alpha ;)
12:31coventryjstack tells me there's a thread blocked on a promise at the line (send-for-eval @(open-exchange session-id) session-id form return-value-fn) in austin:send_for_eval. So I guess somehow it's not hearing back from the client.
12:57amalloy(inc clojurebot)
12:57lazybot⇒ 40
12:59mdrogalisRaynes: #= club, #yolo
13:00Raynesswaaaaag
13:01amalloyclojurebot: twitter is that way; this is #clojure
13:01clojurebotRoger.
13:01llasramTIL "swag" in the sense of "swagger" vs "random loot"
13:08bodie_llasram, there's also "swag" as in drapes :P
13:09llasramWhoa
13:10bodie_right
13:10gfredericksTimMc: https://github.com/Prismatic/plumbing/issues/24
13:14maxthoursieNowadays I get an internal exception everytime I see a sentence in parens where the first word is not a function :)
13:15rasmustomaxthoursie: the :) looks like an unbalanced closing paren to me :(
13:15justin_smithmaxthoursie: would a verb suffice?
13:15maxthoursierasmusto: yes, that's another problem. it's almost a keyword though
13:16justin_smithsorry, that is to say: (suffice? (would verb))
13:16maxthoursiejustin_smith: sometimes, then I continue trying to parse arguments
13:17maxthoursieI'm also tempted to define a few functions that would make a sentence valid
13:19maxthoursiefrom http://en.wikipedia.org/wiki/Clojure (pronounced like "closure") (called "syntax quote") (including hashmaps, sets and lists)
13:19maxthoursieagree that it does look like function calls
13:20rasmusto,:o
13:20clojurebot:o
13:24justin_smith,:(
13:24clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
13:24justin_smithahh
13:24rasmustoclojurebot seems happy about that exception
13:25maxthoursie:>
13:25justin_smith,:﹙
13:25clojurebot:?
13:25justin_smithhe is OK with a smaller frown, just not a big one
13:25justin_smith&:﹙
13:25lazybot⇒ :﹙
13:25rasmusto##:
13:26rasmustois that one of those weird spaces again?
13:26blake__Problem: Given an arbitrary set of items and a length, create a set of all vectors of those items at that length. Like #{:black :white} 2 would give #{:black :black} #{:black :white} #{:white :black} #{:white :white}. This should be easy, I know, but I'm blanking.
13:26CookedGryphon,:(
13:26clojurebot:?
13:26blake__Wait, those should all be vectors, not sets. =P
13:26justin_smithrasmusto: small paren. I once went through all the unicode symbols that emacs recognizes as being matched delimiters, and we could have data literals for hundreds of unique data structures!
13:26rasmustojustin_smith: hah, my font shows it as "?"
13:27rasmustolooks like a variant of :P
13:27maxthoursieblake__: use a for
13:27justin_smithrasmusto: in emacs, M-x describe-char is my "what the hell is this unicode" tool
13:27CookedGryphon'(= :❪ :❨)
13:28CookedGryphon,(= :❪ :❨)
13:28rasmusto,(for [c1 '[b w] c2 '[b w]] [c1 c2])
13:28clojurebotfalse
13:28clojurebot([b b] [b w] [w b] [w w])
13:28blake__maxthoursie: I thought about for, but I guess I'm not seeing how to make it an arbitrary length.
13:28amalloyrasmusto: that doesn't scale to not knowing N
13:28justin_smithrasmusto: similarly M-x insert-char (C-x 8 <return>) allows inserting any unicode by name (with * for tab completion by glob)
13:28maxthoursieblake__: ah, sorry, missed that part
13:28rasmustooh right
13:28blake__maxthoursie: np...
13:29blake__nested for?
13:29maxthoursieblake__: clojure.math.combinatorics?
13:30amalloyblake__: #{:black :black} isn't a legal set
13:30amalloyso you probably want a list/seq
13:30justin_smithhe mentioned above he actually meant two element vectors
13:31amalloy&((fn choices [items n] (if (zero? n) [[]] (for [choice (choices items (dec n)), item items] (conj choice item)))) '#{black white} 3)
13:31lazybot⇒ ([black black black] [black black white] [black white black] [black white white] [white black black] [white black white] [white white black] [white white white])
13:31amalloythis is a pretty wasteful way to compute that, i think, but it works
13:33dnolen_stuartsierra: hey any chance we could get that 1.6.0 zip up? ClojureScript's bootstrap script relies on it is the reason I asked originally.
13:33amalloyno, i guess it's fine. not doing much unnecessary work
13:33amalloyblake__: ^ is a solution, if you missed it
13:34fro-hi folks!
13:34fro-Is there a (preferably native) Clojure binding to OrientDB, that supports the latest version of binary API?
13:35justin_smithfro-: if there is a java binding, java interop in clojure is very easy to do
13:35maxthoursiednolen_: I'd like to hear how you think hoplon relates to om
13:36justin_smithhttps://github.com/eduardoejp/clj-orient fro-: this is what you want I think
13:36dnolen_maxthoursie: there are just different approaches, however you could easily embed an Om component into a Hoplon application as far as I can tell.
13:36dnolen_s/there/they
13:36justin_smithfound it on orientdb's web page
13:37fro-I wrote question in detail there https://stackoverflow.com/questions/22817968/is-there-a-preferably-native-clojure-binding-to-orientdb-that-supports-the-la
13:37maxthoursiednolen_: right. Do you think it's possible to get hoplon to the same speed as om?
13:38dnolen_maxthoursie: I can't speak to that. It's not like Om is the fastest possible thing in the world - but it's fast enough for many tasks and certainly faster than more naive JS solutions.
13:38bodie_justin_smith, fro- -- OrientDB has a native Java API by default, so maybe that's the way to go
13:39justin_smithbodie_: well, someone did go and make a clojure binding, that likely makes it easier
13:39maxthoursiednolen_: Om's speed is thanks to (via react) minimizing the amount of mutations to the dom, right?
13:39dnolen_maxthoursie: the speed comes from faster equality checks via immutable data
13:40sm0kei have a feeling than most of the 'clojure bindings' are more of a hurdle than a facility
13:40maxthoursiednolen_: right, that's what om brings over pure react
13:40dnolen_maxthoursie: over the speed provided by React by minimizing and batching DOM updates
13:40rasmustoI made a thing: ##(eval (let [cs [:b :w] var-names (map (comp symbol #(str "v" %)) (range)) binding-vector (interleave var-names (repeat (count cs) cs))] `(for [~@binding-vector] [~@(take (count cs) var-names)])))
13:40lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
13:40rasmustoI made a thing: ##(let [cs [:b :w] var-names (map (comp symbol #(str "v" %)) (range)) binding-vector (interleave var-names (repeat (count cs) cs))] `(for [~@binding-vector] [~@(take (count cs) var-names)]))
13:40lazybot⇒ (clojure.core/for [v0 [:b :w] v1 [:b :w]] [v0 v1])
13:41maxthoursiednolen_: I should probably read up more on hoplon, but I got the impression that they replace the dom a lot
13:41fro-I just found no good alternatives to orient db.. Sounds like I will do it myself (write a lib)
13:41bbloommaxthoursie: and react's underlying speed comes from the "batching" dnolen mentioned, but specifically it's from letting the browser engine operate in parallel by not forcing invalidation to read from the dom
13:41justin_smithfro-: wait, you saw the clojure binding and java binding right? you can use either directly
13:41maxthoursiebbloom: ah, that's why it's expensive to read from it?
13:41justin_smithwhat lib would you need to write?
13:42maxthoursiebbloom: and hoplon doesn't do that either, right
13:42bbloommaxthoursie: think about it like get pixel and set pixel when drawing. if you have an in memory buffer, get pixel is cheap, but if you want to "get pixel" from your graphics card, you need to wait for the graphics card to finish, then send data back to you. every read from the dom causes a synchronization
13:42maxthoursieyup, got it
13:42bbloommaxthoursie: i don't know much about hoplon, i don't subscribe to the "spreadsheets == UIs" idea
13:42bbloomi also generally dislike the "mini language" approach to defining reactive cells
13:43fro-justin_smith: yes, but I will have a temptation to write a lib, during work with, I guess
13:43fro-justin_smith: a wrapper lib
13:43justin_smithbecause the existing wrapper sucks?
13:44maxthoursiebbloom: true. I'm skeptical but I have a feeling I should learn more about it before judging to much
13:45fro-justin_smith: in particular
13:45fro-justin_smith: it just does'nt work
13:46fro-justin_smith: but maybe I'll tend to hack existing lib
13:47amalloyi think if you try to write your own wrapper without first getting experience using the java bindings, you'll produce something that someone in irc will say "it just doesn't work" about
13:49sverihi, i have two lists (:key1 :key2) and (:sum1 :sum2) and i would like to create a list of maps from it like this: {:key1 {:summary :sum1} :key2 {:summary :sum2} }, how would i do that?
13:49fro-there is just no alternatives to orientdb.. My requirements is: ebbeddable, document-oriented/graph, popular..
13:51rasmustosveri: you wrote your output as a single map, not a list of maps by the way
13:51justin_smithfro-: seconding amalloy, figure out how to do it with interop, once it all works, then consider a wrapper lib
13:51justin_smith*making your own wrapper lib
13:51sverirasmusto: you are right, sorry, i meant a single map
13:51michaniskinmaxthoursie: people have embedded angular in hoplon, so i don't see why react wouldn't work, too
13:52sm0ke,(zipmap '(:key1 :key2) (map #(assoc {} :summary %) '(:sum1 :sum2)))
13:52sm0keoops
13:52sm0ke,(zipmap '(:key1 :key2) (map #(assoc {} :summary %) '(:sum1 :sum2))))
13:52clojurebot{:key2 {:summary :sum2}, :key1 {:summary :sum1}}
13:52lgs32a,(zipmap '(:key1 :key2) (map (partial-hash-map :summary) '(:sum1 :sum2)))
13:52clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: partial-hash-map in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:52rasmustosveri: you can use (into {} ...) on a list comprehension that produces vectors of keys and maps like what you want
13:52maxthoursiemichaniskin: huh, what's left of hoplon then?
13:52rasmustoor do something like that
13:52lgs32a,(zipmap '(:key1 :key2) (map (partial hash-map :summary) '(:sum1 :sum2)))
13:52clojurebot{:key2 {:summary :sum2}, :key1 {:summary :sum1}}
13:53michaniskinmaxthoursie: i mean you can have both in the same application
13:53michaniskinmaxthoursie: for example if you want to use something that's already written in angular
13:53sverilgs32a: sm0ke rasmusto thank you all, that looks nice :-)
13:54michaniskinmaxthoursie: or jquery plugins that are already written, or om components
13:54rasmustoin retrospect, I like zipmap more for your case
13:55maxthoursiemichaniskin: right, yeah they should be possible to combine, sure
14:02TimMcgfredericks: Neato.
14:05fro-justin_smith: I'll follow exactly this way, if I don't find alternative
14:06justin_smithas mentioned before, interop in clojure is pretty seamless, and translating existing java examples is usually easy once you figure out a few rules
14:09fro-justin_smith: I now, already used interop
14:12blake__Would a macro make sense?
14:14amalloyblake__: for what? did you miss all the answers to your earlier question?
14:15blake__Hmmm. I missed cookgryphon's but it also requires me to know the number of elements.
14:15blake__Anyway, I think I can use clojure.math.combinatorics.
14:17rasmustoblake__: don't use my macro, I posted it as a joke :p
14:18blake__heheh
14:18amalloyblake__: did you see mine? it's a function that does everything you need
14:19amalloycombinatorics is fine, and it does include exactly the function you need, calling it selections
14:19blake__No, I'm looking at combinations in combinatorics, and it's not that simple. I'm surprised.
14:19blake__amalloy: No!
14:19blake__Sorry--I didn't have "join" messages turned off on hexchat so I'm wading through a sea of noise.
14:20amalloy&((fn choices [items n] (if (zero? n) [[]] (for [choice (choices items (dec n)), item items] (conj choice item)))) '#{black white} 3)
14:20lazybot⇒ ([black black black] [black black white] [black white black] [black white white] [white black black] [white black white] [white white black] [white white white])
14:20amalloyso combinatorics is good, and presumably more efficient, but you also would benefit from knowing how to do this kind of recursive lazy thing yourself
14:21blake__amalloy: Oh, I like that better.
14:21blake__I don't need efficiency. I'm doing this to learn.
14:21blake__So, I guess I should say, I don't need efficiency, until I do. =P
14:22amalloyblake__: the pattern of using a two-layer for-comprehension to explore a tree of choices is quite widely applicable, if you tilt your head a bit to turn more things into trees
14:22amalloyhere, the tree is N levels deep, each of which has (count coll) identical choices
14:23blake__amalloy: Yeah, that's the thing I'm trying to get my head around.
14:23blake__amalloy: Thinking in terms of data structures.
14:23blake__amalloy: Is that & at the front a typo?
14:24amalloyno, that's asking lazybot to eval it
14:24blake__oh! cool.
14:24blake__&(+ 3 4)
14:24lazybot⇒ 7
14:27amalloyi wonder what the general version of this two-part for-comprehension pattern looks like. i think it's kinda the dual of tree-seq, right? seq-tree or something
14:28blake__tree-seq
14:34blake__Wait...how come this works with "black" and "white", as opposed to ":black" and ":white"? Why doesn't it try to eval "black" and "white"?
14:35amalloynotice i quoted the set: '#{black white}
14:35amalloy#{black white} would have failed because it tries to eval the symbols
14:36blake__Ah, okay... *phew*
14:52mikerodThere are no special rules on arity-overloading macros right?
14:53mikerodSeems like it'd evaluate as expected.
14:55trptcolinmikerod: whoa, i’d never seen one of those before, but i suspect sure you’re right
14:56tos90~/38
14:56Bronsatrptcolin: `or`?
14:57trptcolinBronsa: heh, i stand corrected of course
14:57Bronsa:)
14:59trptcolinmy memory is even shorter than i thought. i count 6 of them in my in-progress book on macros
14:59trptcolinwelp
15:08mikerodtrptcolin: :P
15:08mikerodtrptcolin: well, clojure.core/or and clojure.core/and
15:08mikerodare examples
15:09mikerodhowever, I was wondering if there is any sneaky stuff
15:09mikerodlike
15:10mikerod(defmacro overloaded-mac ([x] (overloaded-mac 1 2)) ([x y] [x y]))
15:10mikerodSo, where it immediately calls the same macro again during expansion, but this seems to work and I don't see why it wouldn't
15:10mikerodI just didn't see the question pop up through a search, so was curious
15:10Bronsamikerod: no, that doesn't work
15:10mikerodBronsa: oh, just saw that you said `or` right away :P
15:11hiredman`(overloaded-mac ...) is the way to do it
15:11Bronsamikerod: it only compiles fine, but if you try to invoke (overloaded-mac 1) you'll see it doesn't work
15:11RaynesSo Linode just had a heart attack.
15:12mikerodBronsa: I thought it might not work due to the implicit args to a macro
15:12mikerodBronsa: very weird too. it fails when I call it at first, but if I re call `defmacro` it works... wat
15:13Bronsamikerod: that's some weird behaviour with redefining a var and metadata
15:13llasramOh haha, because the first time it's not a macro
15:13llasramHilarity!
15:13Bronsallasram: exactly
15:13mikerodyuck
15:13mikerodso, the take away is; it is a bad idea?
15:14Bronsaif defmacro was defined by attaching :meta on the var instead of defining it as a function and later invoking .setMacro, that definition would fail at compile time
15:14Bronsaby attaching :macro to the meta of the var*
15:14Bronsamikerod: yes, don't do it. won't work.
15:15mikerodalternatives?
15:15mikerod(defmacro overloaded-mac ([x] `(overloaded-mac ~x 2)) ([x y] [x y])) ?
15:15Bronsamikerod: yes, what hiredman said
15:15mikerodBronsa: ugh! I didn't see that
15:15mikerodhiredman: thanks for the answer I missed...
15:17RaynesRefheap has returned from the bowels of Linode hell.
15:18Bronsalazybot too
15:18RaynesYep.
15:18RaynesIt was a restart.
15:18RaynesWe had nearly a year of uptime.
15:18RaynesI'm angry.
15:18Bronsa:(
15:18RaynesBut hey, hardware problems.
15:18RaynesCan't live with them, can't live without them.
15:18RaynesNow... 4clojure.
15:18RaynesCan I even remember how to start that thing?
15:19cbplein run eheheh
15:19Raynescbp: See, that'd be great but it's a tad more complicated because 4clojure crashes like three times a day and need things to bring it back up.
15:20cbpthat's scary. Why does it crash so much?
15:20Raynescbp: Because it allows people to execute code on it.
15:20xeqiif only there were processes on linux that would start and restart services..
15:20RaynesAnd people are assholes.
15:21RaynesThere is only so much sandboxing one can do.
15:21Raynesxeqi: It isn't really that simple.
15:21cbpah
15:21Raynesxeqi: 4Clojure doesn't just crash, it becomes unresponsive to http requests and keeps chugging.
15:21RaynesSo you have to be a little more clever and restart it.
15:22xeqiRaynes: true, I let my snark get out there. I'm not looking forward to when clojars's vps has a hardware failure
15:22RaynesBut we have a working process to do that, it's just I didn't make that process and am figuring out how to use it.
15:22RaynesAlso, things are SUPPOSED to start at startup.
15:22RaynesBut the problem is testing our scripts to do that requires restarting :P
15:22RaynesNobody got time for that
15:23RaynesThis whole server needs to get scrapped and a new instance built, but... nobody got time for that.
15:23xeqiheh, I've become a bigger fan of devops stuff after running into these problems too
15:23RaynesLikewise.
15:24xeqiRaynes: I don't suppose the other person just used monit, and if you start that service it'll bring everything up?
15:25RaynesNo.
15:25RaynesIt's a short shell script that doesn't appear to be working very well.
15:27aedonRaynes: sounds like a job for haproxy and some docker containers -- just make a new contiainer when one fails to respond
15:28RaynesSure, but this also should just be workign
15:29RaynesLike I said, there are a ton of things that need to be fixed with this server.
15:29RaynesThings learned by making this server suck.
15:29RaynesI just need to find a weekend to spend moving to a new vps.
15:33RaynesThere we go.
15:33RaynesMongo wasn't awake.
15:33cbpAlso need to port it to rethinkdb =D
15:34RaynesThe beauty of these projects is how open the source is :P
15:35carsonDoes anyone have experience calling netlogo headless from clojure? Can't get the example posted here: https://github.com/NetLogo/NetLogo/wiki/Controlling-API working.
15:35Raynescbp: Someone once ported refheap to datomic.
15:36RaynesBut I was extremely apprehensive about that.
15:36RaynesI'd love to move to rethink, postgres, etc.
15:36cbpdatomic would probably be pretty expensive
15:36RaynesBut I wouldn't love it so much as to really be motivated to do it myself.
15:36RaynesWell, I could run the free stuff.
15:36RaynesBut... like...
15:36RaynesOpen source and free plz
15:37bodie_If clojars is running on a vps, they better damn well have at least a good backup
15:38bodie_I worked at DigitalOcean, the failure rate of SSDs gets ridiculous
15:38bodie_if you're using vps, instances should be seen as disposable
15:41ordnungswidrig1why doesn't the emacs repl suppres exceptions from time to time
15:41ordnungswidrig1if have it in *e but i want it to popup in a buffer?!
15:43ordnungswidrigI meant "why does emacs suppress exceptions in the REPL"
15:55ordnungswidrigbodie_: how does the ssd failure show up for a typical linux process? io errors? are they silent?
15:58bodie_ordnungswidrig, everything was on raid5 so usually failures would be detected and taken care of
15:59ordnungswidrigbodie_: so a regular vps there is on raid5?
15:59bodie_if you have a failure without a hotswap, then you enter a degraded state where things are still functioning, mostly, and then if you have another failure basically everything is just majorly hosed
15:59bodie_the blades are, yes
16:00ordnungswidrigso this is opaque for me as a DO user
16:01bodie_right. if you suddenly notice unusually bad performance, you're either on a node with a noisy neighbor, or you're on a node with a bad disk
16:02bodie_almost all severe (beyond degraded state) disk failures (quite rare) were catastrophic to data on the node, though we did manage to recover a couple of nodes which had that condition
16:02ordnungswidrigbodie_: you mean when the ssd failed, it failed complete?
16:02bodie_right
16:03ordnungswidrigi like to have multiple nodes anyways. in multiple datacenters. on multiple continents.
16:03bodie_of course, when you have 2000 nodes, it probably wouldn't be obvious if one was halfway failed. I think I saw that happen once.
16:03ordnungswidrigstill working on multiple planets and solar systems
16:03bodie_yes. that is good :)
16:03bodie_cheap cloud = a great reason to have failovers
16:03ordnungswidriglatency hurts for the former two
16:03ordnungswidrigbodie_: that's how digital ocean attracted me :)
16:04bodie_hardware failures can and do happen on all vps providers, so I think DO makes the most sense bang-per-buck :)
16:04bodie_they have their faults, but they also have a great team
16:07ordnungswidrigto get on topic again, does anybody have experience on running clojure servers as docker containers?
16:08ordnungswidrigI made one based on an ubuntu base as well as on a stripped down busybox one. I had some problems with non-ending containers and zombies because of lingering standard out file descriptors or like that.
16:21technomancyclojars does have offsite backup fwiw
16:25ordnungswidrigtechnomancy: +1
16:25technomancynot my doing =)
16:25coventrykorma.core/as-sql will return the sql prepared query string. Is there any tool which will return the values which need to passed with the string to get it to work with exec-raw? E.g., how can I reconstruct the [71] given q in the following snippet? (let [q (-> (korm/select* db) (korm/where (= :id 71)))] (korma.core/exec-raw [(korma.core/as-sql q) [71]] :results))
16:28amalloycoventry: i'm not sure why you'd want to. if you're trusting korma to build the query for you, you might as well trust it to do the parameter substitution right
16:30coventryWhat I really want is a generic way to add "for update" to the end of a select. I'm open to suggestions for alternative ways to achieve that.
16:30Frozenlo`technomancy: Is there a special namespace I need to give to my tests? Each time I try to run them, it says it can't find them on my classpath :-/ As it is I follow this model: <main-project-name>.test.db.basics
16:31technomancyFrozenlock: no, there's nothing special needed
16:31coventryamalloy: So if there's a way to get the query with the parameters substituted in, that would be perfect, actually.
16:31Frozenlocktechnomancy: ok, thanks
16:31technomancyFrozenlock: changing :test-paths could mess it up
16:33Frozenlocktechnomancy: ah! I changed test-paths to "test/clj" and now it works fine. Thank you very much :-)
16:34coventryThere might be a way to do it with korma.core/raw, but I haven't figured out how, yet. The example of its usage in the docs is quite different from this case.
16:36cemerickfunny, the type returned by a data reader fn cannot contain fields whose names contain dashes, or bad things happen
16:40hiredmancemerick: do tell
16:40hiredmancemerick: I would guess cider/reply bug
16:41cemerickhrm
16:41trptcolinoh?
16:41cemerickhiredman: why?
16:41trptcolinyeah details please
16:41cemerickeliminating the dashed field yields expected behaviour, so I assumed the usual not-munging bug
16:42hiredmancemerick: because I've had trouble round tripping stuff with data readers through an emacs nrepl connection for example
16:42trptcolini wonder if the emacs client uses its own reader
16:42hiredmanI think in that case it was because I didn't have an associated print-method, which led me to believe something somewhere was doing an extra pr/read-string round trip
16:43llasramI've need to implement print-dup
16:43cemerickhiredman: everything works as expected without the dashed field. The error is produced by the compiler (no method named foo-bar found for type Baz, and so on)
16:44hiredmancemerick: I would be super surprised it that was actually data reader related, the data reader just hands stuff to the function you tell it to
16:44hiredmancemerick: oh, you mean a reader for a defrecord? not a reader specified in data_readers.clj ?
16:45Bronsacemerick: can you nopaste an example?
16:51cemerickBronsa, hiredman, trptcolin: https://www.refheap.com/70731
16:51cemerickseems pretty straightforward.
16:51cemerickI didn't end up caring that much, so not a big deal. But if it is munging, it's like the 103rd munging bug. :-)
16:52hiredmanexcept the data readers code never looks what is returned
16:53hiredmancemerick: what happens for (do #foo "5" nil) ?
16:54cemerickhiredman: dunno, I've moved on; but the _compiler_ needs to look at what is returned, or at least that's what I remember
16:54hiredmanOh, sure, to embed it in the bytecode
16:55llasramBut it should be looking at the `print-dup` result, which is undefined for that type, which causes an entirely different exception
16:55cemerickand there's where lack of munging would be a problem
16:55llasramSo.... that's weird
16:55Bronsameanwhile, I think I found a tools.reader bug testing this
16:55arrdemlolz
16:55cemerickllasram: I don't think compilation of tagged literals looks at print-dup output
16:56trptcolinyeah, fwiw it’s definitely in the language, not any nrepl tooling. just ran w/ clojure.main
16:56llasramWe're talking JVM Clojure or ClojureScript?
16:56cemerickJVM
16:56trptcolinjvm
16:56cemerickanyway, I do have print-dup defined for that type; but again, removing the dash from the type yield expected behaviour
16:57llasramcemerick: Then it definitely needs to `print-dup` to put the value in code. I mean, that's how arbitrary-reader-objects-in-code works. Yes?
16:59cemerickllasram: yeah, I guess you're right. Anyway, it's clearly looking at fields at some point.
16:59hiredmanyeah, getBasis doesn't have munging in the compiler
17:00hiredmanhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L4579
17:00cemerickhiredman: feel free to file a ticket you're so motivated. I did enough ticket-chasing for one day already. :-)
17:00trptcolinhonestly it seems sort of weird to me to have deftype even allow fields w/ hyphens since you can only refer to them munged into (.some_field (Foo. “5”)). or is the hyphenated version useful somewhere?
17:00hiredmancemerick: sure
17:01arrdemtrptcolin: it's normal to be able to use hypenated symbols elsewhere in Clojure, so the expectation is that it "just works"
17:02arrdemas it has not been otherwise documeted to be a problem.
17:02llasramNeat. I totally didn't realize that deftypes got that special treatment. Huh. But now I'm confused by past need to provide a `print-dup` for deftypes
17:03coventryThis is what I wound up with for that korma question. It depends a lot on korma internals, but it seems to work... https://www.refheap.com/70732
17:03cemerickarrdem: hypenation has been _the_ persistent nuisance problem in Clojure :-)
17:04arrdemcemerick: :-P I didn't say it was a _good_ idea...
17:04Bronsanevermind, no bug
17:07Bronsa.. but I'm not doing any munging for deftype fields in tools.emitter.jvm
17:09hiredmanBronsa: it is an issue of matching the munging, if you aren't doing munging on the one side, you should be fine on the other
17:10seangroveSo this seems like a problem to me:
17:10Bronsahiredman: except I'm munging on the other side :P
17:10seangrove,(keyword "this is it")
17:10clojurebot:this is it
17:10arrdemseangrove: ouch....
17:11seangrove,(read-string (pr-str (keyword "this is it")))
17:11clojurebot:this
17:11rasmusto,(keyword "no problem")
17:11clojurebot:no problem
17:11rasmusto,(symbol "no problem")
17:11clojurebotno problem
17:11arrdem,(keyword "there is nothing to be upset about")
17:11clojurebot:there is nothing to be upset about
17:11seangrovearrdem: Doesn't round-trip though
17:11rasmusto##(keyword "no problem")
17:11arrdemseangrove: exactly
17:12seangroveDoesn't serialize, essentially :P
17:12hiredmanBronsa: well, logically, you must be munging on both sides even if you don't think you are
17:12rasmusto&(keyword "no problem")
17:13llasramI wonder if it would work better if munging happened at the read/print boundary
17:13Bronsahiredman: I mean, I'm not munging when defining the class, but I'm munging the field lookup so (.foo-bar (x. 1)) won't work
17:13llasramSo internally no symbols or keywords ever contained "-"
17:13Bronsathe class has a foo-bar field but (.foo-bar ..) looks up for a foo_bar one
17:14hiredmanBronsa: ah, welllll
17:15llasramBronsa: Oh, the JVM allows '-' in such names?
17:15Bronsallasram: I don't know if it's allowed on the spec, but it's not complaining
17:15llasramInteresting
17:16Bronsallasram: even ASM's class checker doesn't complain about it
17:16hiredmanit is not terribly consistent, different classes of identifiers allow different things
17:17arrdemseangrove: I mean... really we just use keywords where clispers and schemers use quoted symbols, which is to say as a hack for more readable enums so...
17:17hiredman,(Character/isJavaIdentifierPart \-)
17:17clojurebotfalse
17:17hiredmanfeh
17:18hiredman,(Character/isJavaIdentifierStart \-)
17:18clojurebotfalse
17:18arrdemhiredman: right, - is only Java legal as arithmetic. :c
17:18technomancysuch a dumb design decision
17:18llasramWhat the JVM giveth, the Java taketh away
17:18seangrovearrdem: Yeah, non-serializable data makes me a sad panda though
17:18technomancyoptimizing for obfuscation
17:19arrdemseangrove: ah... nonprintable data makes me sad panda, serialization I tend to care less about.
17:19technomancy"if we allow for dashes in identifiers, how will we support math expressions that don't have spaces between the identifiers and the operators???" -> http://p.hagelb.org/127.gif
17:20arrdemtechnomancy: meh... it keeps the grammar nicer and whitespace insensitive... I understand it but I don't like it either.
17:21seangrovetechnomancy: I see your dumb statement, and raise you http://stackoverflow.com/a/14779648
17:21technomancyseangrove: http://p.hagelb.org/blam.gif
17:21arrdemseangrove: ... wow
17:22arrdemhttp://arrdem.com/images/upset.gif
17:22justin_smiththe fact that one person clicked the uparrow on that
17:22Frozenlockarrdem: 404 Not Found
17:22coventryOf all the things I saw yesterday, that was the one I laughed at hardest.
17:22arrdemFrozenlock: I wasn't fast enough on the git push :P
17:23arrdemfixed :c
17:23technomancyhttp://achewood.com/index.php?date=05022003 but for mutable strings
17:23arrdemunlike technomancy I don't have an amazing infrastructure for getting reaction pics when I need them with a single keychord. yet.
17:24AmandaCM-x omg?
17:24justin_smithwebcam -> facial recognition -> gif search -> url pasted to irc
17:24AmandaCHeh
17:24rasmustojustin_smith: https://github.com/mroth/lolcommits
17:24rasmustomost of the way there
17:25arrdemrasmusto: I think bitemyapp was doing a thing where all commits had gifs in the message for a while... results varied :P
17:25michal1Hi. Could you tell me what clojure web framework is the most mature with documentation and features?
17:25rasmusto:)
17:25SegFaultAXmichal1: Luminus. Not really a framework, but a set of great default libraries.
17:26cYmen_I could be wrong but I think lein new ... creates a new project in the current directory but lein new compojure-app ... creates a subdirectory. This seems undesirable..
17:26michal1how about caribou? Looks prety well.
17:27justin_smithmichal1: we have it well documented, but it is still alpha, has some rough edges
17:27Frozenlockcemerick: about friend, isn't there an `authenticated?' fn? Say for (if (auth...) logout-button login-button)
17:27justin_smithbut I (and usually patchwork except when he is on vacation in new zealand) am around to field questions about it
17:28arrdem,(- (int (inc (/ 25 2))) 6)
17:28clojurebot7
17:28arrdem(/ 20 3.5)
17:28arrdem,(/ 20 3.5)
17:28clojurebot5.714285714285714
17:29trptcolinFrozenlock: (if (cemerick.friend/current-authentication) logout-button login-button)
17:29trptcolinyou could boolean-cast it if you really need a boolean
17:30Frozenlocktrptcolin: Ah, makes sense, thanks
17:31michal1justin_smith: you are talking about caribou?
17:31justin_smithoh yeah, I am one of the caribou devs
17:32justin_smithsorry, I wasn't quite clear about that
17:36michal1justin_smith: It's...specyfical. I feel like with CherryPy(python) minimalism with nice features.
17:38coventrySpeaking of rough edges and web frameworks, I ran into a situation recently with ring where an assertion failure was causing the server to return a 500 error as it should, but the stack trace for the error was never printed out. Anyone run into this with standard ring middleware?
17:42abpcoventry: look in the nrepl-server buffer
17:42reiddrapergfredericks: got a chance to look at the gist, :when is 'such-that', yeah?
17:44coventryabp: Yeah, when I say the error wasn't printed out, I mean in the emacs nrepl server buffer.
17:45coventry...but the repl would report the assertion failure when I triggered the same code there.
17:45hiredmancemerick: http://dev.clojure.org/jira/browse/CLJ-1399 feel free to vote if you don't mind deluting the value of that vote in the future
17:46technomancystill nothing on http://dev.clojure.org/jira/browse/CLJ-1297 =\
17:46FelisCoraxcoventry: is it executing in a future or the likes? 'Cause I've noticed that rather than printing the error, they simply point to the error... or something of that nature.
17:47bbloomis there a clojure library of monotonic abstract types? I know core.logic has some stuff in fd, etc, but I'm wondering if there is something more general purpose out there?
17:48justin_smithin my experience emacs hosted process + heavy usage of threads (as one would see in ring request handling) = printouts lost to the ether
17:48justin_smithI start the process in an xterm and then start an nrepl server instance in the process which I then connect to
17:49justin_smiththis is particularly bad with core.async too
17:50gfredericksreiddraper: exactly
17:50gfredericksreiddraper: I think for/doseq are kind of clojure's monad syntax, so this kind of thing seems to make sense to me
17:50coventryFelisCorax: I'm not causing it to execute in a future, but it's possible (but unlikely) that some ring middleware is.
17:50reiddrapergfredericks: does the body you provide return a generator or a value?
17:51justin_smithcoventry: each request gets a thread in ring/jetty at least
17:51gfredericksreiddraper: the body returns a value; could go either way of course, but value felt less surprising
17:51justin_smithwhich should have the same issues that futures and core.async see with output disappearing
17:51justin_smith(really this is an emacs nrepl.el / cider issue)
17:52coventryjustin_smith: Oh... that's possible. I'll play with it some more later.
17:52reiddrapergfredericks: neat. i'd be curious to get some feedback from some other users, but this seems reasonable. can you start a jira thread?
17:53gfredericksreiddraper: sure
17:53reiddrapergfredericks: much appreciated
17:58gfredericksI have a version that mostly works. The main thing missing is the ability to have a :let directly before a :when
17:58gfrederickssupporting :when was tricksier than I expected
17:58gfrederickswithout :when it's a pretty basic recursive macro
17:59stuartsierra1coventry: Clojure pre/post conditions and assertions throw AssertionError, which is a subclass of Error, not Exception. Many frameworks/libraries only catch Exception, not all Throwables.
18:00stuartsierra1In general, you don't want to catch Throwable. Logging or displaying errors is the exception, no pun intended.
18:01gfredericksapparently ring.middleware.stacktrace does not know about this exception: https://github.com/mmcgrana/ring/blob/master/ring-devel/src/ring/middleware/stacktrace.clj
18:01cemerickhiredman: voted, though I'm not convinced of the utility of it
18:01cemericks/utility/effectiveness
18:02hiredmancemerick: :)
18:02gfrederickswait
18:02gfredericksthat was an old ring
18:02gfredericksnew ring catches Throwable
18:03llasramI guess always create a github org for any project you think both (a) will become popular, and (b) you will move on from?
18:04gfredericks:/
18:04reiddraperheh
18:04gfrederickswhat happens if your lib becomes a contrib lib? :P
18:05llasramDoesn't all further development cease, making the location of the official repo irrelevant?
18:05bbloomyou can email github support to reparent the forked-from pointers
18:05llasramI kid, I kid
18:05reiddraperI missed the context here, but when i link to github, i always include a ref or sha in the url, better permalinks
18:05michaniskinis there a replacement for -?> (thread-first, like -> but short-circuits and returns nil when any threaded expr evals to nil)
18:05gfredericksreiddraper: context is googling for repos that have changed owners/orgs
18:05llasrammichaniskin: some->
18:06michaniskinllasram: thanks!
18:06rasmustosome-> over the rainbow
18:06reiddrapergfredericks:ah, yeah the best workarund i know is just to link to the new location from the old one, in the readme
18:06llasramI pronounce that as "thread some over the rainbow," which my parser rejects
18:06coventrystuartsierra1, gfredericks: OK, it seems like any assertion failure has the same behavior in ring. That's a bother, sounds like using assert in a ring route isn't very useful.
18:07gfrederickscoventry: what version of ring-devel are you using?
18:07coventry1.2.0
18:08gfredericksah ha
18:08stuartsierra1coventry: it's easy to write a middleware that catches all exceptions
18:08gfrederickswell back in the 1.2.0 days it was still ignoring Throwable: https://github.com/ring-clojure/ring/blob/1.2.0/ring-devel/src/ring/middleware/stacktrace.clj
18:08brehautpalindromic exclaimations for all
18:08coventrygfredericks: Thanks, I'll try upgrading.
18:09gfrederickscoventry: looks like 1.2.2 still doesn't have it; the commit is https://github.com/ring-clojure/ring/commit/c86494086ce00c60b946c1c6321f48241cfb6cda
18:09gfredericksbut I don't know if that's released
18:09gfredericksdoesn't seem to be based on git tags
18:09gfredericks$latest ring/ring-devel
18:10gfredericksyou could deploy master to clojars yourself :)
18:11coventryThanks, gfredericks. I'll try that in a lein checkout.
18:12llasramWhich utility library was which had a template/macro for fully implementing IFn in a deftype?
18:16gfredericksI did that somewhere by hand
18:16AmandaCOk, I’m probably missing something simple here, but I’ve got a bunch of [word count] vectors inside a big vector. I want to know the word with the highest count, how can I do this? :s
18:16hiredman,(doc max-key)
18:16clojurebot"([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."
18:16justin_smithAmandaC: (first (sort-by second vs))
18:16rasmusto,(max-key second [['a 2] ['b 4]])
18:16clojurebot[[a 2] [b 4]]
18:16gfredericksllasram: it's a 10 line paste :) https://github.com/fredericksgary/lib-7607/blob/master/src/com/gfredericks/lib_7607/serialization.clj#L68
18:16rasmusto,(apply max-key second [['a 2] ['b 4]])
18:16clojurebot[b 4]
18:17rasmustoI always miss that "apply"
18:17AmandaCah, thanks rasmusto
18:17llasramgfredericks: Of course! lib-7607. Why couldn't I remember that
18:17llasramgfredericks: :-p
18:17llasram(that actually is in fact the one)
18:17AmandaCI saw max-key but I couldn’t figure it out, and it always was just returning the source data it seemed.
18:17rasmustoAmandaC: if you're counting in a separate step, you can simplify to this: ##(apply max-key count ["123" "1234" "12345"])
18:18gfredericksllasram: looks like that macro assumes you just want to delegate to one of the fields
18:18justin_smithyeah, max-key is better because it does not need to build up the list
18:19llasramgfredericks: Yeah... I'm trying to decide if I want to do it that way. I think probably do anyway
18:19amalloy_gfredericks: def-ifn-type follows a pattern i don't super-love, for these deftype helpers: it includes the deftype! that way you can't def an ifn type and a map type, if someone had a def-map-type macro. better, imo, to have it be a function that just returns the (for ...) part of that body, so that you can glue an ifn-body together with a map-body
18:19AmandaCwell, not bloated, I guess, for what it is. <.<
18:19rasmustoAmandaC: ok, my first example should work then :)
18:19AmandaCyeah, the apply max-key one did the trick
18:20gfredericksamalloy: but who on *earth* would have a def-map-type macro?
18:21gfredericksAmandaC: (use 'clojure.repl)
18:21hiredmanAmandaC: it is in clojure.repl namespace, and only refered in to the user namespace by default
18:21AmandaCahhh
18:22gfredericksI have a repl-utils library that lets me just type (&bs) and the current namespace gets all convenientized
18:22llasramIs there any sort of existing `identity`-macro? So you can splicing unquote etc forms which then just get compiled
18:22gfredericksllasram: I think that's the backtick library
18:22gfredericksmaybe?
18:22llasramEhhhh, not quite
18:23amalloyllasram: i think you may mean something like https://github.com/flatland/useful/blob/develop/src/flatland/useful/macro.clj#L17?
18:23llasramI think basically just want an `eval` which when called at top level just plops in the form for the regular compilation process to handle
18:24gfredericksamalloy: I'm going to posit that you wrote the docstring for that macro
18:24amalloygfredericks: not a difficult leap to make, but i wonder what makes you say that
18:24llasramI think you are excellent at this positing
18:25gfredericksamalloy: the explanatory style at the end seemed your personality
18:25llasramAm I missing something which makes such a macro useless?
18:25llasramI'm thinking of situations like amalloy's proposed macro which generates just the IFn implementation for a deftype. Because it's multiple forms, you'd want to splice in the result
18:25amalloyllasram: you can't do that at anything but the top level
18:26amalloyso it doesn't help at all for the IFn case
18:26ztellmanamalloy: def-abstract-type, c'mon
18:26amalloyor maybe i misunderstood you
18:26ztellmanthis problem has been solved in a highly questionable way, let's all just use that
18:26gfredericksyay it worked it worked! ztellman is here with another macro!
18:27llasramamalloy: I'm thinking: (identity-macro `(deftype Blah [f] ~@(ifn-wrapper f)))
18:27ztellmanllasram: https://github.com/ztellman/potemkin#def-abstract-type-and-deftype
18:27ztellmanthis is how I add in IFn functionality to def-map-type in Potemkin
18:28amalloyllasram: that certainly seems appealing to me, and yet it also seems like it's not different from eval in any obvious way
18:28llasramztellman: Ok, makes sense to have particular support for types. But this is something I've wanted for other situations too
18:29llasramamalloy: Yeah, I think the compiler could certainly handle `eval` exactly this way, except that we know the implementation doesn't :-)
18:29ztellmanllasram: sure, what you really want is a macro version of syntax-quote
18:29ztellmanso that you could just do (magic-template-macro (deftype Blah [f] ~@(...)))
18:29ztellmanno need for eval
18:30llasramztellman: good point
18:30llasramBut alas on that note I must depart
18:30amalloya macro that just returns its body isn't a solution, because the body here is (seq (concat '[deftype] '[Blah] '[[f]] ...)), and not (deftype ...)
18:30ztellmanI'm working on something for this, a partial implementation is at https://github.com/ztellman/potemkin/blob/master/src/potemkin/template.clj
18:31ztellmanamalloy: if my aforementioned macro is a macro, that'll get worked out at compile-time
18:31gtrakdidn't bbloom make that already?
18:31gtrakhttps://github.com/brandonbloom/backtick
18:31ztellmangtrak: sorta, the version I linked to doesn't require gensyms or ~' or any of that other line noise
18:32ztellmanbecause it enforces hygiene at compile time rather than read time
18:32bbloomgfredericks: ztellman's version is a tad different
18:32gtrakah
18:34gfredericksbbloom: I think that statement might be true independent of the context
18:34Bronsaztellman: your deftype+/def-abstract-type look an awful lot like my deftrait/deftype from https://github.com/Bronsa/neurotic :)
18:35ztellmanBronsa: it's not a revolutionary idea, I'll admit
18:35bbloomgfredericks: rewrite to "has slightly different goals"
18:36em-dashwhen I'm consuming an existing, JSON-based, API with ClojureScript, are there any readily-accessible functions/tools for converting jsIdiomaticCamelCase -> cljs-idiomatic-levitating-snake-case?
18:37justin_smithem-dash: the correct term is kebab-case
18:37gtrakem-dash: I'd just stick to the json version :-)
18:37gtrak:thisIsNotSoBad
18:38justin_smithhttps://github.com/qerub/camel-snake-kebab camel-snake-kebab should work in cljs I think
18:38em-dashgtrak: not *so* bad, but why settle? :)
18:38em-dashjustin_smith: thanks, I'll check that out!
18:38gtrakwell.. I guess, I like less things in between my things.
18:38justin_smithem-dash: the only imports on the lib are clojure.lang imports and the project is just one source file, so if it is not cljs-compatible out of the box, it will be easy to port
18:41bbloomem-dash: i'd go further: just use strings as keys
18:41bbloomem-dash: the keyword-ization thing is fragile and pointless
18:43em-dashbbloom: I'm using an API response as the bulk of an Om app's app-state. If I don't convert keys I'm going to be stuck with strings for lookup all over my app.
18:43em-dashmaybe not a meaningful place to apply effort, but it sorta offends my sensibilities :/
18:44bbloomi guess it's a reasonable thing to do if you're also converting objs to maps and arrays to vectors
18:45bbloomi just see lots of simple/small usages of js->clj that could easily be addressed with an aget or two
18:45dnolen_em-dash: you could implement IEncodeClojure for Keyword in your application to get the behavior you need from js->clj
18:46abpwow, I've got quite some talent running into the sharpest knives when trying something new. reactjs needs an explicit tbody for dynamic tables, first thing I failed into while writing something more complex using om.
18:47em-dashbbloom: haven't checked, but I would think use of `aget` might break under advanced compilation (where `aget`ing a prop from a lib, not from data off the wire). do you know anything about that?
18:48em-dashdnolen_: thanks, that seems like a (potentially) cleaner approach
18:48bbloomem-dash: aget will work fine on data loaded from JSON.parse etc
18:48dnolen_em-dash: hrm, actually looking at the js->clj - the needed hook is missing ...
18:49em-dashdnolen_: ok, thanks for checking, I'm not even sure where to look and would have beat my tender little head against the wall while wailing 'why?!?'
18:50em-dashbbloom: righto, but using aget on stuff that's passed through the closure compiler is a no-no, right? (I thought I read that along the way somewhere)
18:50em-dasher, specifically a no-no w/r/t advanced compilation mode
18:50bbloomem-dash: search for "Using string names to refer to object properties" on this page: https://developers.google.com/closure/compiler/docs/limitations
18:52em-dashbbloom: thanks!
18:52lynaghkdnolen_: ping
18:54dnolen_lynaghk: pong
18:55lynaghkdnolen_: I had a conceptual question about om if you have a sec
18:55dnolen_lynaghk: go for it
18:55lynaghkin particular, is it necessary for there to be a distinction between user-defined components and html tags
18:56lynaghkI can throw around (dom/div ...) constructions, but when I have my own widgets I need to do this (build-all) stuff
18:56bbloomlynaghk: there isn't such a distinction in React itself beyond the implementation details
18:56lynaghkone of my favorite things from Angular is being able to define new tags and then not think about 'em any more
18:57lynaghkso I was wondering if there's some reason such a scheme wouldn't work in reacot
18:57lynaghk*react
18:58dnolen_lynaghk: it's a tradeoff, React in fact works that way
18:58lynaghkhttps://github.com/holmsand/reagent seems to have a more uniform treatment (assuming the :div keywords are just sugar to keep people from having to :require :refer [div])
18:58dnolen_lynaghk: Om does not because I want component construction to be interceptable
18:58lynaghkah, got it.
18:58bbloomdnolen_: can you intercept div construction?
18:58dnolen_lynaghk: yeah I think uniformity here is valued over adaptability, I don't really care that much about uniformity
18:58lynaghkif you weren't using build, then presumably you'd have to run a fork of React so that you can hook into their compilation process?
18:59dnolen_lynaghk: there isn't a compilation process really
18:59dnolen_lynaghk: when React is a little more pluggable in the future we may be able to recover uniformity
18:59dnolen_bbloom: cannot
19:00bbloomdnolen_: random idea: could you just define a higher-order html-element component that takes the tag as a parameter?
19:00noonianyou can just write functions that return om.dom nodes though if you don't wan't to have to deal with the component stuff and just use a top level om component to kick things off
19:00dnolen_bbloom: could, don't really care that much about it though
19:00benmosshmm. in Om it’s not possible to use strings as cursors?
19:00bbloomdnolen_: yeah, but for intercepting textareas or whatever, it would be cool
19:00lynaghkRight now it seems like a leaky abstraction to me---why should I have to care that "button" comes from the browser but that "fancyButton" needs to be invoked differently because it comes from a coworker?
19:01dnolen_benmoss: it is but you're on your own. very gross because of JavaScript String Object native distinction
19:01bbloomdnolen_: you'd only need to define a single "element" function and somebody else could supply the std lib with div and input and all that jazz
19:02bbloomdnolen_: but it looks like you already have a "tags" collection to go off of
19:02dnolen_lynaghk: I've already said what I have to say about it :) I didn't make the choice lightly, and there are a couple other ideas as well that just don't line up w/ how React works
19:02benmossdnolen_: just was thinking i’d write a “validating-input” component and pass it just the string, but blows up with “No protocol method ICursor.-path defined for type string”
19:02dnolen_benmoss: read the first tutorial please
19:02lynaghkdnolen_: oh, definitely---the above idea is my first gut feeling, but I know you've thought way more about it than I have, which is why I wanted to ask = )
19:03coventrylynaghk: You might be able to extend sablono with custom elements.
19:03mvzinkbenmoss: the bit about implementing ICloneable for String
19:03benmossah mvzink thanks
19:03dnolen_lynaghk: a lot of the burden is because React works a certain way and we have to interact w/ it in a certain way
19:03dnolen_lynaghk: when React loosens up these things, we have more flexibility as well
19:04lynaghkdnolen_: ah, got it. Is there a good wiki or mailing list discussion about React's design and Om's considerations thereon? Or should I just settle down and read both sources a few times?
19:04dnolen_lynaghk: sadly a lot of this knowledge comes from talking directly with the React devs in person, specifically Pete Hunt and Sebatien Markbage
19:05dnolen_lynaghk: corner these guys and buy them a drink ;)
19:05dnolen_s/Sebatien/Sebastien
19:05lynaghkdnolen_: that is the only way I know how to learn software things = )
19:06lynaghkdnolen_: thanks for the info, I'll dig 'round a bit more
19:06dnolen_lynaghk: Sebastien is the main full time dev - he does most of the internals
19:06dnolen_lynaghk: the conversation I had w/ him at Clojure/West was very good - React is going in the right direction
19:06dnolen_on the road map is splitting out the OO stuff so we have a better interface
19:06gozalaanyone able to help me out with core.async question ?
19:06dnolen_as well making the rendering more pluggable (WebGL/Canvas etc)
19:06dnolen_Objective-C too
19:07lynaghkdnolen_: damn, I didn't know he was there. I would've loved to talk with the react guys
19:08dnolen_lynaghk: actually he wasn't there, just met for beers on Wednesday night, he works at FB and lives in SF
19:08amalloy~anyone
19:08clojurebotJust 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 ..."
19:08bbloomlynaghk: dnolen_ invited him out for drinks one night. i agree: that guy definitely has strong sense of the problem & solution
19:09bbloomtpope: vim indenting question for you, but this might be a question for guns / vim-static
19:10lynaghkbbloom:, dnolen_: have either of you seen interesting solutions for where styling fits into all of this?
19:10bbloomtpope: if i write something like (blah blah blah [<cr> then, as expected, the cursor opens a new line lined up with the [ ... but if i outdent, type some, then press <cr> again... it still lines up with the [ even though i'd expect it to line up with the last line... any way to fix that?
19:11bbloomlynaghk: we discussed it a bit, i have ideas but i haven't worked out details yet
19:12lynaghkbbloom: I'd be interested to see what you come up with.
19:12dnolen_lynaghk: bbloom: I think the big takeaway is to address the styling and non-interference of styling as one thing. layout is another thing - it's probably worth thinking about this wrt layout http://gridstylesheets.org
19:12lynaghkI feel like a lot of styling, especially web-app component styling, is a big out-of-band interface that represents conceptual states with classes
19:12bbloomlynaghk: i have lots of notes on the "essence" of styling/layout, i've been sharing them peace meal w/ seangrove. i have a thought or two on how to make the browser implementation not suck, but i haven't any evidence that i can actually solve that problem
19:13rasmustobbloom: you want something on the line after the [ to be lined up with the first blah (after the "(") ?
19:14lynaghkdnolen_: totally agreed that it'd be good to separate layout, aesthetic styling (i.e., typeface), and functional styling ('error' class makes red text visible)
19:14bbloomdnolen_: lynaghk: i'm not a huge believer in constraint-based layout outside of top-level grids
19:14bbloomlynaghk: dnolen_ i think it's good to have two distinct sets of abstractions, but those two subsystems need to communicate *very closely*
19:15lynaghkbbloom: two sets = aesthetic styling, layout?
19:15bbloomrasmusto: if i type an ( or a [ or whatever without anything after it, i want 2-space indent, instead of alignment
19:15dnolen_lynaghk: given the success of React, I suspect something similar can be done w/ CSS, computing which styles should be applied in memory, as well computing non-interference
19:15bbloomlynaghk: yeah, styling and layout
19:15dnolen_lynaghk: the more I think about Shadow DOM the more I get scared
19:16bbloomlynaghk: in short, i think that a good styling system works a lot like a data-only prototypical inheritence object system and a good layout system works a lot like a physics engine, driven by properties of the object system.... ie see games again :-P
19:16lynaghkdnolen_: when you say "which styles" you mean a pre-specified mapping of domain properties (e.g., invalid input) to visual aeshetics (red text)?
19:17dnolen_lynaghk: I'm not really concerned about visual aesthetics vs. domain properties - too high level of concern
19:17rasmustobbloom: you might be talking about "lispwords" or clojure_special_indent_words in vim-clojure-static. Don't know if there a way to make it global
19:18dnolen_more concerned about getting a sensible approach period for efficiently styling components w/o interference
19:18dnolen_w/o the complexity of Shadow DOM
19:18lynaghkdnolen_: oh, you mean you are thinking of an alternative to CSS selectors when deciding how to apply rules?
19:18bbloomdnolen_: yeah, there's two halfs of hte problem: styling/layout at it's core... and making a damn browser behave itself
19:18dnolen_lynaghk: yes something that delivers the good parts of CSS w/o the issues that performs well in modern browsers for components
19:19lynaghkdnolen_: you think shadow DOM is analogous to private classes/methods? Treating the symptoms and not the problem?
19:19dnolen_lynaghk: yes treats the symptoms, and then has to pile on complex hacks to make it work
19:20bbloomrasmusto: not quite.... close though, so i know it's possible somehow
19:20bbloomagreed fully on shadow dom nonsense
19:20bbloommore OOP silliness
19:20lynaghkdnolen_: what are the biggest issues you have with CSS now?
19:21dnolen_lynaghk: interference
19:21dnolen_lynaghk: so I want what Shadow DOM delivers w/o the complexity and cognitive load.
19:22lynaghkdnolen_: interference = it's too easy to write over-general rules?
19:23dnolen_lynaghk: no I can't give you widget that you can just drop into a page that works because styles unrelated affect it
19:23lynaghkthere's a fine line between that being a bug and a feature (e.g., your widget matches the typeface on my website)
19:24dnolen_lynaghk: having worked on website for years w/ draconian styling rules - still not worth it
19:24lynaghkyeah, totally fair. it's something Ryan and I have been discussing as well
19:25lynaghkwell, I'm going to take all of this over to my hammock and ideate for a few weeks. thanks dnolen_, bbloom.
19:27bbloomlynaghk: i've got a kinda nebulous thought about transclusion of styling being a bug vs a feature
19:27bbloomoh he left :-P
19:28bbloomanyway, for on lookers: i'd rather design a component to have PRECISELY SPECIFIED styles and then abstract over time to relax constraints
19:28bbloomartists/designers work this way & it's impossible for things to just "look right" if you swap out random attributes, you need to explicitly parameterize and test
19:29SegFaultAXbbloom: What was the tl;dr of the conversation? I missed most of it.
19:29bbloomabstract over time == overtime, add abstraction... not literally abstract over some time T :-P
19:29bbloomSegFaultAX: that's what logs are for :-P
19:29SegFaultAXAnd also handy tl;drs. :)
19:32abpbbloom: What did you mean by top-level only in respect to grids? Basic layout and then only gridding deeper where appropriate?
19:33bbloomabp: http://aucklandlayout.sourceforge.net/ works great for the same kind of things that designers use grid lines for in photoshop
19:33bbloomabp: but many layouts are non-linear, hell... some are non-euclidean
19:33bbloomtrivial example: wrap panels
19:36abpbbloom: What's the difference between ALM and GSS?
19:36bbloomabp: i don't know a lot about GSS, but I know that it advertises cassowary on the tin
19:36bbloomabp: cassowary is a constraint solving algorithm
19:37bbloomabp: ALM is an abstraction over vertical, horizontal, and rectangular regions that can be implemented with any linear constraint solver
19:37bbloom(including cassowary, of course)
19:38bbloomabp: the mean idea behind ALM is that you define horizontal and vertical rules, define constraints between them, then define "areas" by a 4-tuple of x/x/y/y, and then assign components to areas
19:38bbloomclarifying words: rules == guidelines
19:39abpbbloom: yeah, looking at the ALM-examples briefly
19:39bbloomthink about how designers work. they don't create a grid line for EVERYTHING ON EVERY PAGE
19:39bbloomthat's what traditional solvers do
19:39bbloomauto layout in ios for example has examples that involve direct relationships between two components
19:39bbloomwhich is silly, designers don't think that way
19:44abpbbloom: I'm not sure of that. ;)
19:45brehautoh thank goodness they are _from_ auckland, not naming it after how auckland is layed out
19:45bbloomabp: even if they do, it's the wrong default. it's not the common case. the common case is what gets done in photoshop w/ guide rules
19:47seangrovebbloom: Blend for html looks pretty fantastic
19:47bbloomseangrove: was that announced today?
19:47bbloomlink?
19:47seangroveApparently not!
19:47seangrovehttp://channel9.msdn.com/Events/Build/2013/2-311
19:48bbloomseangrove: i'm sorry / you're welcome for me exposing you to msft dev tools :-P
19:48seangrovebbloom: If it works out in the end, you're forgiven
19:49seangroveIf I lose my way and go running back to backend-dev, well...
19:49abpseangrove: From VS-exerience I'd assume it looks great until you have to use it. :x
19:49seangroveAnyway, blend has some good ideas, but it does have some stuff mixed up that doesn't seem as fantastic - usual MS stuff
19:49bbloomseangrove: yeah, in true msft style
19:50bbloomi'm telling you man, they are the ultimate pyramid builders... i'm counting on this community to build some fucking cathedrals :-)
19:50seangrovebbloom: For example, they have cool layout tools, but everything still follows the page layout. So unless you have a position: fixed or absolute, it's going to get mangled
19:51bbloomseangrove: what does "follows the page layout" mean?
19:52seangrovebbloom: It's in a slightly strange middle-land. It's making components, etc., but it still keeps the 'page' idea from html
19:52seangrovebbloom: So you're still playing with document-flow page layout that the browsers do by default
19:52bbloomseangrove: i think that they are struggling with the wide variety of form factors for their devices & are trying to figure out how to bridge the app/page gap
19:52bbloomi suspect they will fuck it up 2.5 times before they get it right, modulo some legacy stuff
19:53seangroveI just don't see much benefit to keeping the page model and squeezing apps into it
19:53abpbbloom: Have you read the paradigms book by van roy?
19:53bbloomabp: nope, should i?
19:53seangroveIf you're working with components, have styling, layout, etc. separate, then throw html layout out
19:53bbloomseangrove: agreed
19:53abpbbloom: Where about to ask you what you think about it in comparison to other basic cs stuff you know
19:54bbloomno clue
19:54abpbbloom: I'm just doing an edx-course by him, based on a third of the book. Post-filling solid basics. :x
19:58abpbbloom: Besides putting up with the oz-language and its environment I learn quite a lot. Basically the decomposition of programming concepts I got from learning Clojure but formalized and beyond.
19:59bbloomabp: i programmed professionally for 10+ years before i took 6 months to myself to study and had a "i see the matrix" moment
19:59SegFaultAXbbloom: Side note: code.org is pretty damn sweet.
20:00bbloomSegFaultAX: glad you like it! :-) it's still evolving fast since i worked on the Hour of Code campaign until dec
20:02abpbbloom: About same here, nearly 10 years in, but only when discovering Scala, then learning Clojure I understood what felt wrong all the time in imperative oop-land.
20:02SegFaultAXI did the whole course last night, had a blast.
20:03SegFaultAXI especially enjoyed the later levels which focused on functions and composition.
20:03abpbbloom: Wasted a lot of time trying to mitigate via libs and frameworks before that. :/
20:04bbloomabp: for me, learning clojure, factor, and mathematica + implementing compilers/interpreters for small languages of various kinds
20:04bbloomimplementing a lisp made me understand haskell and scala better than... writing programs in haskell and scala :-P
20:05abplol
20:05bbloomseriously, everybody: go implement a toy lisp
20:05bbloomit's good for you :-)
20:05technomancybbloom: oh, did I tell you I started a forth?
20:05bbloomtechnomancy: YESSS
20:05bbloomnice.
20:06technomancyfun times
20:06SegFaultAXDoes it have to be a toy!?
20:06technomancySegFaultAX: everything starts as a toy
20:06bbloomSegFaultAX: nope! but once it stops being a toy you stop learning about computer science and start learning about software engineering ;-)
20:06bbloomtechnomancy: i've implemented maybe two dozen forth-likes by now. it's so easy you can almost do it by accident lol
20:07SegFaultAXWhat I mean is: when I have to write something in Python I usually implement a lisp to do whatever my actual work is.
20:07SegFaultAXOr Ruby. Or Java.
20:07SegFaultAXIsn't that how everyone writes code?
20:07technomancybbloom: awesome. mine is intended to run on the teensy ucontroller in my keyboard, so I need to make it fit in 2.5k of ram.
20:07bbloomtechnomancy: haha awesome
20:07technomancyno idea if I can actually fit a keyboard firmware into that. we shall see.
20:07bbloomtechnomancy: i'm certain you can
20:08bbloomtechnomancy: i'm certain you can... AND it can have a fucking debugger
20:08technomancyhehe
20:08technomancywell the fact that my board only has 42 keys should help
20:09bbloomhttp://nforth.berlios.de/docs/nf-intro.html
20:09bbloomthat's a complete forth with interactive sessions & all sorts of jazz... 4k
20:09technomancyhttps://github.com/technomancy/orestes
20:10technomancyit's not as self-hosting as is traditional just because I have gobs of flash space and very little ram, and only C code can live in flash
20:10bbloomyou implemented loops? booo. implement tail recursion :-)
20:11bbloomhttp://www.colorforth.com/forth.html
20:11technomancyheh
20:11justin_smithtechnomancy: only c code in flash? why?
20:11bbloomnote that the ";" symbol essentially means "turn the previous word in to a tail call"
20:11technomancyjustin_smith: https://en.wikipedia.org/wiki/Harvard_architecture
20:11technomancybecause code is not data
20:12bbloomboooo
20:12technomancyis dumb
20:12bbloom:-)
20:12justin_smiththe mind boggles
20:12technomancyit's
20:12justin_smithseems like there would be some "put some static data into RAM" shim possibility
20:12technomancythere is a forth that gets around it, but it does this by running the whole thing out of the bootloader
20:13bbloomtechnomancy: look at that page i linked you to, it's a table for a "minimal" forth with the corresponding pentium instructions
20:13technomancyjustin_smith: you can read from flash, but you can't store back into it during runtime
20:13technomancybbloom: thanks; I've actually got most of the basics working already; just need to expose USB functionality to the forth code
20:13technomancybut I should give it a look
20:14seangrovednolen_: It's probably worth you watching bits of that video too. They seem to have designers working off of data with live views as well. Probably going to be drifting more towards that ideal
20:14bbloomtechnomancy: some ideas like words that push pointers on to the stack were non-obvious to me, but make perfect sense in practice
20:14technomancybbloom: yeah, I've needed a few of those just to get the text interpreter going
20:14technomancyeven though it's all C so far, it's very forthy C
20:15bbloomheh, yeah, now that i've done some forth, C is painful
20:15technomancypractically zero use of arguments to pass things around
20:15seangrovetechnomancy: Just keeping things on the stack?
20:15bbloomyeah, you basically just program with dynamic variables everywhere
20:15technomancyseangrove: yup; void void void everywhere
20:15bbloomseangrove: you only use the stack to parameterize stuff
20:16seangrovebbloom: Ah, hence dynamic vars
20:16bbloomdynamic vars are a pain w/ laziness or otherwise in a functional style, but in a forht, all code executes left-to-right
20:16bbloomso side effects make perfect sense, there is no mental book keeping about evaluation order
20:16technomancythree functions that aren't void, and one of them is push =)
20:17bbloomdiffers wildly from factor too, which encourages more parameter passing
20:17bbloombut factor also has quotations, which are like the rpn version of lambdas, so factor can do higher order dataflow and whatnot
20:18bbloomso dynamic variables are less of a default there, prefering more stack passing & data flow combinators
20:18bbloomhttp://docs.factorcode.org/content/article-dataflow-combinators.html
20:18technomancyis that related to forth's '?
20:19bbloomtechnomancy: i'm not sure what '? you're referring to
20:19bbloomnames are highly incosistent and ungooglable in forth land
20:19bbloom:-P
20:20technomancyI think it's just pronounced quote
20:20technomancypushes the execution token of the parsed identifier that follows
20:20technomancykinda feels like @#'
20:21technomancyor maybe #' from CL would be a better analog
20:21bbloomtechnomancy: ah yea, much like #'
20:21bbloomhttp://docs.factorcode.org/content/word-__back__,syntax.html
20:22bbloomin factor, the lexer is a first-class object you can program, the \ word causes the next token to be read as a string, then it is put in to a "wrapper"
20:22bbloomwhich is sorta like a quote that doesn't go away
20:22technomancycool.
20:23bbloom,(defrecord Hold [value])
20:23clojurebotsandbox.Hold
20:23bbloom,(= ''x 'x)
20:23clojurebotfalse
20:23technomancygot a kick out of how comments and strings are just parsing words
20:23bbloom,(= (eval ''x) (eval 'x))
20:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:23bbloom,(= (eval '''x) (eval ''x))
20:23clojurebotfalse
20:23bbloom,(= (eval (Hold. 'x)) (eval 'x))
20:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:23bbloom,(= (eval (Hold. ''x)) (eval ''x))
20:23clojurebotfalse
20:23bbloomer hard to concoct an example
20:24bbloomanyway, the point is that quote prevents ONE evaluation
20:24bbloomthere is a notion of "Hold" in mathematica that stops all evaluation until ReleaseHold
20:25bbloomthat's a "Wrapper" for words, but there is a more general notion of wrappers for all data types. that's "literalize": http://docs.factorcode.org/content/word-literalize%2Cquotations.html
20:25bbloombasically coerces an object to a self-evaluating variant of that object
20:25bbloomit's idempotent too
20:25bbloomwe need something like that in clojure...
20:27technomancywell I just want to hack my keyboard without writing a bunch of C
20:27technomancywell
20:27technomancyI guess it's too late for that
20:27bbloomlol
20:27bbloomtruely you should have bootstrapped a new forth with an old forth, like a real forth-er
20:27technomancyI wrote a rough draft of the firmware in gforth
20:27bbloomsadly, there doesn't appear to be a good forth that has compile-to-C
20:28technomancyand I considered avr assembly, but the docs around that are just garbage
20:28bbloomah, the write one to throw away strategy, good plan
20:28technomancyplus the USB stack is C anyway
20:28technomancyhard to avoid that
20:29technomancyI am curious whether it's feasible to interact with the interpreter directly through keystrokes read from the switches, pre-usb
20:30bbloomi'm helpless in hardware land, i'm afraid
20:30technomancyyeah, I am still exploring it
20:30bbloomi've bricked more prototype devices in my career than i care to admit
20:30technomancyseems like below a certain size, forth is the only way to do that interactively
20:30bbloomi decided that if there is no undo button, i'm not interested
20:31technomancywell for boards that only run US$16 I'm less concerned
20:32bbloomif it were me, i'd order a few spares up front
20:33yediis there a version of reduce that takes a fn with an index? so i can use the index of the value in the list?
20:33yedior is that sort of thing a code smell
20:33technomancywell if I do brick this, I might upgrade to an arm
20:33bbloomyedi: reduce over (map vector (range) yourcoll
20:33technomancyI wanted to start with an avr because all the existing C firmwares use that
20:33technomancybut arm boards give me way more room to work if I'm starting from scratch
20:33technomancysixty four whole kilobytes. the luxury.
20:34yedibbloom: makes sense, thanks
20:34technomancyseangrove: you try and tell the young people these days; they won't believe you!
20:46yediis it pretty stupid to have a map with a mapping from integer to something else
20:47yedibecause you can just use a vector?
20:47bbloomyedi: does your key space start at zero?
20:47coventryyedi: Not necessarily. You might represent a sparse vector that way.
20:47bob2depends what the indexes are - if they're consecutive and start from zero, vector sounds like the way to go
20:47bbloomyedi: is to sparse? dense?
20:47bbloomis it*
20:47yedihm yea it will start from zero
20:48yediidk what sparse/dense means
20:48yediand many of the integers up till the last one will have a value, but not all of the integers (some will be nil)
20:48coventryFor instance, you can reasonably do something like {1000000000 'value}, and assume that everything else in the vector is zero. That's a sparse representation.
20:49yediso yes it'll be sparse, but how sparse it is will differ
20:49yedidepending on the data
20:50yediyea i think a map makes sense
21:09yedii feel like there is a more concise way to write this fn: https://gist.github.com/yedi/9946510
21:10amalloy(update-in m (:index stream) (fnil conj ()) to-add)
21:11amalloyalthough really that fnil can just be conj, since (conj () x) is the same as (conj nil x)
21:11amalloy(update-in m (:index stream) conj to-add)
21:11yedioh nice
21:11yedithanks
21:14bbloomamalloy: for some reason, the most common function i redefine in every project is (def conjs (fnil conj #{}))
21:25michaniskin(def trans (partial apply map vector))
21:25michaniskin(def indexed (partial map-indexed vector))
21:31n_bIs there a way to get the strack trace from an exception inside a future? Is clojure.stacktrace-api where I should be looking, or is that an internals thing?
21:35michaniskinn_b: https://github.com/dgrnbrg/spyscope#example-annotated-spyt-session <— i just found this
21:36michaniskinn_b: i haven't used it though, but it looks like it might help?
21:37n_bmichaniskin: I'll take a peek, cheers.
22:27coventryholo: If you can get a browser repl going, it gets hugely easier to develop tests.
22:33holocoventry, oh, but I mean to work at all.. I get that "can't find cemerick" stuff. i tried everything. but I know it's just a bad day
22:33amalloy"can't find cemerick"? that's a standard cljs bug?
22:33amalloyif i knew having cemerick around were a standard cljs feature i'd write some!
22:34holosure :D "ReferenceError: Can't find variable: cemerick" this one
22:34technomancyamalloy: relevant http://dev.clojure.org/jira/browse/NREPL-49
22:34coventrycemerick's immense productivity is just a trick for parallelizing his search for himself over the majority of clojure developers.
22:35holoheh I saw that one on twitter :D great stuff
22:37coventryholo: Post the test and I'll take a look if you like.
22:52holocoventry, I said the following after my connection was broken:
22:53holocoventry, I just shared my frustration with the hope someone would understand my feeling. actually i'm enraged and now it's a personal battle between me and this error message ಠ_ಠ
22:53holocoventry, thanks anyway. i must fight this battle alone, and laugh like a maniac after i win
23:06ghadishaybangozala: I can help you with a core.async question
23:21chare(defroutes handler (GET "/foo" [] (foo-handler))
23:21charehow do i get access to the request in foo-handler?
23:22jeremyheilerchare: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax
23:32charewhats in the request map, this book says :context — The context in which the application can be found when not deployed as root.
23:32charewhat does that mean
23:34brehautit means if you use the context route (compojure.routes/context from memory) you can embed one route inside another, and :context is the root
23:37charethat did not make sense to me
23:37charewhat are typical valuse for :context
23:40tmciverchare: have you seen this: https://github.com/weavejester/compojure/wiki/Nesting-routes?
23:41tmciverchare: I don't think you have to care what value :context has.
23:41chareso when the book says the following
23:41chareThe preceding code will work fine when the application runs standalone.
23:41chareHowever, if we ran our application on an application server, the Ajax request
23:41charewould fail because the full URL would need to have the application context
23:41chareprefixed.
23:41charewhat it means is the context macro?
23:42charethe context macro will mess up the path used by ajax requests
23:45zanedogWho knows something about clojure.data.zip.xml?
23:48Guest50943Specifically, looking for advice on the xml-> function
23:49charetmciver: so you could have a path /api/something and then wrap that in the context of a bigger app that changes the paths to /main/api/something and everything that was hardcoded to /api/something will break, is that the point??
23:51tmciverchare: that sounds right to me but I'm not sure as I've never used context in Compojure. And I'm not sure I understand the comment about it breaking an ajax request.
23:52Guest50943Hah, figured it out. Never mind.
23:52chareif you have an ajax request that posts to /api/something that will break if the app is wrapped into the "context" of /main/api/something where /api/something no longer exists????
23:53tmciverchare: I suppose so, but that's true of any request to that (non-contexted) path.
23:57amalloyRaynes: lazybot seems unable to send messages. related to the linode issue, presumably