#clojure log - Apr 02 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:04 sritchie_: technomancy: hey, any idea what's up with that heroku issue I tweeted?

0:04 technomancy: seems like something's up with the Clojure buildpack

0:07 beamso: others are reporting that it's working again if you redeploy to heroku

0:07 sritchie_: ah, nice

0:07 will try now

0:07 beamso: the issue appears to have been with heroku

0:07 rootex: does heroku supports http-kit?

0:10 beamso: i believe the answer to that one is yes

0:15 sritchie_: rootex: yup, we've been working with it for a while

0:15 rootex: new relic had issues with it, if I recall

0:26 bjeanes: beamso: hey sorry about that there was a bug introduced in the Heroku API today that affected some buildpacks. It's since been reverted

0:27 beamso: bjeanes: no apology necessary

0:27 not currently using it :/

0:28 but thanks for the fix

0:31 bjeanes: sritchie_: do you have a link to that tweet?

0:31 sritchie_: bjeanes: this one? https://twitter.com/sritchie/status/451154520815312896

0:31 bjeanes: perfect, thanks

0:36 (just trying to track all the build packs it affected)

0:36 sritchie_: for sure

0:48 aedon: should clojurescript code in a namespace/file/module that isn't required execute when the js file is loaded?

0:53 technomancy: sritchie_: sorry, I'm not on twitter much these days; did you get it sorted out?

0:53 sritchie_: technomancy: no worries - looks like it started working again by the time I got back from dinner

0:53 technomancy: cool, glad to hear it

2:05 amalloy: aedon: cljs code in a namespace that isn't required shouldn't exist at all, google closure will eliminate all the dead code, right?

2:10 aedon: amalloy: I'm using simple mode for development purposes, so I assume that doesn't apply

2:54 sm0ke: tpop just killed it with timl

4:22 petron: why does the or macro need a let binding?

4:22 why can't (or x y) just expand to (if x x y) ?

4:22 instead of (let [or 158 x] (if or__158 or__158 y)) ?

4:23 Guest12324: I've been trying whole day to make google sign in work using oauth2 with no luck

4:24 I followed the tutorial on this page https://coderwall.com/p/y9w4-g but can't figure out what is *request*

4:24 can anyone please help?

4:24 sm0ke: oauth2 playground was helpful i remember once i was doing this

4:25 https://developers.google.com/oauthplayground/

4:25 Guest12324: I tried that too. at this link https://developers.google.com/oauthplayground/

4:26 sm0ke: Guest12324: i remeber just copying the access token from this ui into my code

4:26 Guest12324: this is the error I keep getting cannot find code parameter

4:26 sm0ke: it works pretty fine after that

4:26 Guest12324: I also looked at the source code over here https://github.com/DerGuteMoritz/clj-oauth2/blob/master/src/clj_oauth2/client.clj

4:27 but this (oauth2/get-access-token google-com-oauth2 (:params request) auth-req)

4:27 looks different from this

4:27 (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

4:27 i'll try it

4:32 clgv: petron: because then the expression "x" would be computed twice

4:32 petron: I see, so the let binding computes the form of x?

4:34 clgv: petron: 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"

4:35 petron: 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)

4:35 petron: cool, thanks.

6:47 CookedGryphon: Is clojuredocs ever going to be brought up to date?

6:48 It'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

7:06 mpenet: they 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

7:06 there were a few attempts to improve/update clojuredocs but I think it's all dormant

7:06 not to say dead

7:08 Foxboron: Should have been clojure april foolks

7:08 "clojuredocs update!"

7:08 clgv: Foxboron: you would have disappointed a lot of people badly ;)

7:09 Foxboron: clgv: i know :)

7:10 CookedGryphon: All I really want is a site which listens for clojars and clojure artifact uploads and runs codox over them

7:10 and then like you say, disqus or something for comments

7:11 augustl: as long as I have the cheat sheet I'm happy ;)

7:11 http://clojure.org/cheatsheet that is

7:13 CookedGryphon: there is a cool project one of my colleagues did called cloc

7:13 which scans your classpath and generates a documentation website for all the libraries you're using

7:13 with local search too

7:13 but I never think to run it

7:13 kras: clj-antlr question, my "actions" in the grammar file does not have any affect on the sequence produced as output. Any idea?

7:14 CookedGryphon: I wonder... could I make lein run that in the background whenever i set off a repl connection?

7:15 clgv: CookedGryphon: yes you can

7:15 CookedGryphon: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md#hooks

7:16 beamso: this cloc : https://github.com/jaley/cloc ?

7:17 CookedGryphon: yeah that one

7:18 beamso: the google for cloc lead me to gizmo, which i'd never heard of or seen before : https://github.com/clojurewerkz/gizmo

8:40 katox: CookedGryphon: 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 ;)

8:41 what's stopping the update of the current site? what features are that badly needed?

8:42 CookedGryphon: well, documentation for a version released in the last 3 years

8:42 I think they started a rewrite

8:42 it was all done in rails and then they started to rewrite it in clojure/script

8:42 and i don't know how that effort went/is going

8:54 pepijndevos: I 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.

8:55 katox: CookedGryphon: found some activity about 4-7 months ago (https://github.com/clojuredocs/web/commits/master, https://github.com/clojuredocs/doc-extractor/commits/master)

8:55 opqdonut: pepijndevos: String.substring

8:56 pepijndevos: oh, right, there's also clojure.core/subs

8:56 clgv: pepijndevos: clojure.core/subs

8:56 katox: CookedGryphon: old cdocs seems to be rails2, I wonder if it's the extractor what's blocking the progress

8:56 pepijndevos: (subs s (- (count s) 2))

8:57 good enough, but ot as nice as the maybe nonsens str[-2:] in Python

9:06 clgv: pepijndevos: write a wrapper fn that implements that behavior. should be pretty easy

9:08 pepijndevos: yea...

9:34 lgs32a: Is there a collection of useful om components already?

9:35 I saw an empty repository on swanodettes gh

9:45 dnolen_: 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

9:47 lgs32a: dnolen_: thank you.

9:47 gtrak: is there a scrolling table component yet, or an existing one that's easy to integrate with om?

9:48 lgs32a: thats what I was looking for too

9:48 gtrak: I might try to reinvent it, but I don't really know what I'm doing yet with regards to UI work :-)

9:48 dnolen_: 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

9:49 gtrak: ah, fixed cell would be fine by me.

9:50 would 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.

9:51 teslanick: You could delegate to an existing JS library. reify IWillMount, IWillUpdate and just step into JS interop.

9:52 And IWillUnmount to clean up correctly.

9:52 gtrak: yea, good, I also wanted to know if that sort of thing was doable :-)

9:52 dnolen_: 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

9:53 delegating to an existing library could work but not ideal IMO for many reasons.

9:54 gtrak: I'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.

9:55 dnolen_: gtrak: conceptually won't be much different

10:07 teslanick: Yeah, 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:09 dnolen_: 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:27 sm0ke: is it possible to :aot :all without evaluation of global definitions like (def conn (connect ..))

10:28 during compile only functions like lein compile, install etc

10:46 technomancy: sm0ke: you could do (when-not *compiling-files* ...) but it's pretty sketchy

10:50 sqldier: sm0ke: you may be looking for delay

10:50 http://clojuredocs.org/clojure_core/1.3.0/clojure.core/delay

10:52 gtrak: sm0ke: the use-case as presented is just a bad design :-)

10:53 don't do that, use like 'component' or something: https://github.com/stuartsierra/component

10:55 we've got a sizable application that just uses a simple hash-map for the same purpose.

11:11 deadghost: I can get data as csv, json, or xml

11:11 should I prefer any one of them

11:11 are or they all about the same

11:13 teslanick: csv is the easiest to parse, json is probably the most robust. xml is probably a waste of bytes. :)

11:14 sm0ke: yea delays and *compile-files* was what i was using till now.

11:14 delay just adds overhead of unnecessary derefrencing

11:14 *compile-file* is ok , but not very pretty

11:15 gtrak: you 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:16 and that was at the point where it was already a huge hassle to work with the var version.

11:16 for mocking and such

11:18 sm0ke: gtrak: how do you solve this with hash map?

11:19 gtrak: sm0ke: you just write the functions to take an extra argument, then pass around the connection, initializing it somewhere further up.

11:20 just push the problem somewhere else, basically is what I'm suggesting :-). Have a central thing that deals with lifecycles of shared resources.

11:21 that isn't a clojure namespace.

11:22 bodie_: gtrak, that demo you linked me about using mutexes to lock framerate to a tight precision

11:22 gtrak: yea

11:22 bodie_: I was looking over it, quil had some stuff removed so I wasn't able to try it out

11:22 gtrak: oh really? it worked for me a bit ago.

11:22 bodie_: hum

11:22 gtrak: just needs a lein run, I'll try it.

11:22 bodie_: quil.dynamic I think was taken out

11:22 okay, nice :)

11:23 gtrak: yea, but, it should be using an old artifact.

11:23 bodie_: I need to do more learning before I can piece things together on my own, sadly

11:23 ah

11:25 gtrak: bodie_: yea, I did a lein run and it worked just fine.

11:26 bodie_: ah, I see

11:26 gtrak: besides the bugs of course

11:26 sometimes the balls spin around each other b/c the collision detection's a bit wonky :-)

11:27 or they miss entirely

11:27 but you just wanted the timer part :-)

11:27 the simulation's running at 500fps and the drawing's at 60 here

11:27 bodie_: that's awesome

11:31 gtrak: bodie_: maybe you tried it when clojars was down :-)

11:33 jjl`: does clojars go down very often?

11:33 mdrogalis: Not really.

11:38 hyPiRion: what, Clojars down?

11:38 gtrak: couple days ago

11:41 bodie_: I made a vid a while back: https://www.youtube.com/watch?v=415OTzYEXsk

11:41 WASD applies constant acceleration

11:42 bodie_: sweet!

11:43 dnolen_: cemerick: btw this new thing that prevents using lein based on version ranges is insanely annoying

11:43 cemerick: is there a way to turn this off? it's basically hell for anyone that works on ClojureScript itself

11:43 s/lein/lein-cljsbuild

11:44 cemerick: dnolen_: you're referring to the NPE you mentioned in a recent ML post?

11:45 dnolen_: 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:46 cemerick: dnolen_: 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:47 dnolen_: cemerick: there needs to be a way to turn this off for anyone that works on the compiler

11:47 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:48 the current behavior is insane for library developers who contribute to ClojureScript

11:48 cemerick: dnolen_: 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:49 dnolen_: cemerick: ^ I asked for a way to disable that's all

11:49 I understand the utility for normal users

11:51 cemerick: dnolen_: 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:52 Doing otherwise will inevitably lead to API conflicts, or silent emission of strange/incorrect compilation output.

11:52 Expertise doesn't exempt anyone.

11:53 dnolen_: 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:54 cemerick: dnolen_: 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:54 dnolen_: cemerick: but it does work for *libraries* (not applications that use those options)

11:54 I'm sorry hand holding stuff needs flags IMO

12:08 technomancy: if only there were a way compatibility concerns could be communicated

12:08 perhaps by a series of numbers

12:09 one might even separate them using dots

12:09 llasram: technomancy: April Fool's Day was yesterday, man

12:09 technomancy: llasram: dang, can't even blame time zones

12:11 cemerick: dnolen_: hopefully this will be satisfactory? https://github.com/emezeske/lein-cljsbuild/issues/305

12:11 dnolen_: cemerick: thanks

12:12 hiredman: I thought core projects had to use maven, what is this lein-cljsbuild stuff?

12:12 * hiredman piles on

12:14 benmoss: what is the deal with versioning, what black magic is used to come up with something like

12:15 thats a core async version

12:15 clojurebot: I don't understand.

12:15 rasmusto: semver + sha1 + branch?

12:15 technomancy: clojurebot: neither do I, clojurebot. neither do I.

12:15 clojurebot: Pardon?

12:15 clgv: rasmusto: semver is a pretty wild guess here :P

12:16 benmoss: because releases have to be cut for every commit or something?

12:16 Bronsa: 0.1.<commit-count>.0-<commit-sha>-alpha

12:16 rasmusto: guess based on seeing numbers with dots only

12:16 oh, commit count makes more sense for that third number

12:17 clgv: hopefully there comes a "stable" time for both of these libraries with actual version numbers ;)

12:18 benmoss: and the lion will lay down with the lamb

12:18 rootex: benmoss: it means "we don't know if what we are doing is right"

12:18 coventry: What 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:21 clgv: rootex: that's what I thought as well

12:21 rootex: but you get told otherwise when you ask for the reason of the permanent alpha ;)

12:31 coventry: jstack 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:57 * Raynes switches to an Emacs nightly because #yoloswag

12:57 amalloy: (inc clojurebot)

12:57 lazybot: ⇒ 40

12:59 mdrogalis: Raynes: #= club, #yolo

13:00 Raynes: swaaaaag

13:01 amalloy: clojurebot: twitter is that way; this is #clojure

13:01 clojurebot: Roger.

13:01 llasram: TIL "swag" in the sense of "swagger" vs "random loot"

13:08 bodie_: llasram, there's also "swag" as in drapes :P

13:09 llasram: Whoa

13:10 bodie_: right

13:10 gfredericks: TimMc: https://github.com/Prismatic/plumbing/issues/24

13:14 maxthoursie: Nowadays I get an internal exception everytime I see a sentence in parens where the first word is not a function :)

13:15 rasmusto: maxthoursie: the :) looks like an unbalanced closing paren to me :(

13:15 justin_smith: maxthoursie: would a verb suffice?

13:15 maxthoursie: rasmusto: yes, that's another problem. it's almost a keyword though

13:16 justin_smith: sorry, that is to say: (suffice? (would verb))

13:16 maxthoursie: justin_smith: sometimes, then I continue trying to parse arguments

13:17 I'm also tempted to define a few functions that would make a sentence valid

13:19 from http://en.wikipedia.org/wiki/Clojure (pronounced like "closure") (called "syntax quote") (including hashmaps, sets and lists)

13:19 agree that it does look like function calls

13:20 rasmusto: ,:o

13:20 clojurebot: :o

13:24 justin_smith: ,:(

13:24 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :>

13:24 justin_smith: ahh

13:24 rasmusto: clojurebot seems happy about that exception

13:25 maxthoursie: :>

13:25 justin_smith: ,:﹙

13:25 clojurebot: :?

13:25 justin_smith: he is OK with a smaller frown, just not a big one

13:25 &:﹙

13:25 lazybot: ⇒ :﹙

13:25 rasmusto: ##:

13:26 is that one of those weird spaces again?

13:26 blake__: 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:26 CookedGryphon: ,:(

13:26 clojurebot: :?

13:26 blake__: Wait, those should all be vectors, not sets. =P

13:26 justin_smith: rasmusto: 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:26 rasmusto: justin_smith: hah, my font shows it as "?"

13:27 looks like a variant of :P

13:27 maxthoursie: blake__: use a for

13:27 justin_smith: rasmusto: in emacs, M-x describe-char is my "what the hell is this unicode" tool

13:27 CookedGryphon: '(= :❪ :❨)

13:28 ,(= :❪ :❨)

13:28 rasmusto: ,(for [c1 '[b w] c2 '[b w]] [c1 c2])

13:28 clojurebot: false

13:28 ([b b] [b w] [w b] [w w])

13:28 blake__: maxthoursie: I thought about for, but I guess I'm not seeing how to make it an arbitrary length.

13:28 amalloy: rasmusto: that doesn't scale to not knowing N

13:28 justin_smith: rasmusto: similarly M-x insert-char (C-x 8 <return>) allows inserting any unicode by name (with * for tab completion by glob)

13:28 maxthoursie: blake__: ah, sorry, missed that part

13:28 rasmusto: oh right

13:28 blake__: maxthoursie: np...

13:29 nested for?

13:29 maxthoursie: blake__: clojure.math.combinatorics?

13:30 amalloy: blake__: #{:black :black} isn't a legal set

13:30 so you probably want a list/seq

13:30 justin_smith: he mentioned above he actually meant two element vectors

13:31 amalloy: &((fn choices [items n] (if (zero? n) [[]] (for [choice (choices items (dec n)), item items] (conj choice item)))) '#{black white} 3)

13:31 lazybot: ⇒ ([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:31 amalloy: this is a pretty wasteful way to compute that, i think, but it works

13:33 dnolen_: 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:33 amalloy: no, i guess it's fine. not doing much unnecessary work

13:33 blake__: ^ is a solution, if you missed it

13:34 fro-: hi folks!

13:34 Is there a (preferably native) Clojure binding to OrientDB, that supports the latest version of binary API?

13:35 justin_smith: fro-: if there is a java binding, java interop in clojure is very easy to do

13:35 maxthoursie: dnolen_: I'd like to hear how you think hoplon relates to om

13:36 justin_smith: https://github.com/eduardoejp/clj-orient fro-: this is what you want I think

13:36 dnolen_: 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:36 s/there/they

13:36 justin_smith: found it on orientdb's web page

13:37 fro-: 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:37 maxthoursie: dnolen_: right. Do you think it's possible to get hoplon to the same speed as om?

13:38 dnolen_: 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:38 bodie_: justin_smith, fro- -- OrientDB has a native Java API by default, so maybe that's the way to go

13:39 justin_smith: bodie_: well, someone did go and make a clojure binding, that likely makes it easier

13:39 maxthoursie: dnolen_: Om's speed is thanks to (via react) minimizing the amount of mutations to the dom, right?

13:39 dnolen_: maxthoursie: the speed comes from faster equality checks via immutable data

13:40 sm0ke: i have a feeling than most of the 'clojure bindings' are more of a hurdle than a facility

13:40 maxthoursie: dnolen_: right, that's what om brings over pure react

13:40 dnolen_: maxthoursie: over the speed provided by React by minimizing and batching DOM updates

13:40 rasmusto: I 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:40 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

13:40 rasmusto: I 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:40 lazybot: ⇒ (clojure.core/for [v0 [:b :w] v1 [:b :w]] [v0 v1])

13:41 maxthoursie: dnolen_: I should probably read up more on hoplon, but I got the impression that they replace the dom a lot

13:41 fro-: I just found no good alternatives to orient db.. Sounds like I will do it myself (write a lib)

13:41 bbloom: maxthoursie: 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:41 justin_smith: fro-: wait, you saw the clojure binding and java binding right? you can use either directly

13:41 maxthoursie: bbloom: ah, that's why it's expensive to read from it?

13:41 justin_smith: what lib would you need to write?

13:42 maxthoursie: bbloom: and hoplon doesn't do that either, right

13:42 bbloom: maxthoursie: 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:42 maxthoursie: yup, got it

13:42 bbloom: maxthoursie: i don't know much about hoplon, i don't subscribe to the "spreadsheets == UIs" idea

13:42 i also generally dislike the "mini language" approach to defining reactive cells

13:43 fro-: justin_smith: yes, but I will have a temptation to write a lib, during work with, I guess

13:43 justin_smith: a wrapper lib

13:43 justin_smith: because the existing wrapper sucks?

13:44 maxthoursie: bbloom: true. I'm skeptical but I have a feeling I should learn more about it before judging to much

13:45 fro-: justin_smith: in particular

13:45 justin_smith: it just does'nt work

13:46 justin_smith: but maybe I'll tend to hack existing lib

13:47 amalloy: i 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:49 sveri: hi, 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:49 fro-: there is just no alternatives to orientdb.. My requirements is: ebbeddable, document-oriented/graph, popular..

13:51 rasmusto: sveri: you wrote your output as a single map, not a list of maps by the way

13:51 justin_smith: fro-: seconding amalloy, figure out how to do it with interop, once it all works, then consider a wrapper lib

13:51 *making your own wrapper lib

13:51 sveri: rasmusto: you are right, sorry, i meant a single map

13:51 michaniskin: maxthoursie: people have embedded angular in hoplon, so i don't see why react wouldn't work, too

13:52 sm0ke: ,(zipmap '(:key1 :key2) (map #(assoc {} :summary %) '(:sum1 :sum2)))

13:52 oops

13:52 ,(zipmap '(:key1 :key2) (map #(assoc {} :summary %) '(:sum1 :sum2))))

13:52 clojurebot: {:key2 {:summary :sum2}, :key1 {:summary :sum1}}

13:52 lgs32a: ,(zipmap '(:key1 :key2) (map (partial-hash-map :summary) '(:sum1 :sum2)))

13:52 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: partial-hash-map in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:52 rasmusto: sveri: you can use (into {} ...) on a list comprehension that produces vectors of keys and maps like what you want

13:52 maxthoursie: michaniskin: huh, what's left of hoplon then?

13:52 rasmusto: or do something like that

13:52 lgs32a: ,(zipmap '(:key1 :key2) (map (partial hash-map :summary) '(:sum1 :sum2)))

13:52 clojurebot: {:key2 {:summary :sum2}, :key1 {:summary :sum1}}

13:53 michaniskin: maxthoursie: i mean you can have both in the same application

13:53 maxthoursie: for example if you want to use something that's already written in angular

13:53 sveri: lgs32a: sm0ke rasmusto thank you all, that looks nice :-)

13:54 michaniskin: maxthoursie: or jquery plugins that are already written, or om components

13:54 rasmusto: in retrospect, I like zipmap more for your case

13:55 maxthoursie: michaniskin: right, yeah they should be possible to combine, sure

14:02 TimMc: gfredericks: Neato.

14:05 fro-: justin_smith: I'll follow exactly this way, if I don't find alternative

14:06 justin_smith: as mentioned before, interop in clojure is pretty seamless, and translating existing java examples is usually easy once you figure out a few rules

14:09 fro-: justin_smith: I now, already used interop

14:12 blake__: Would a macro make sense?

14:14 amalloy: blake__: for what? did you miss all the answers to your earlier question?

14:15 blake__: Hmmm. I missed cookgryphon's but it also requires me to know the number of elements.

14:15 Anyway, I think I can use clojure.math.combinatorics.

14:17 rasmusto: blake__: don't use my macro, I posted it as a joke :p

14:18 blake__: heheh

14:18 amalloy: blake__: did you see mine? it's a function that does everything you need

14:19 combinatorics is fine, and it does include exactly the function you need, calling it selections

14:19 blake__: No, I'm looking at combinations in combinatorics, and it's not that simple. I'm surprised.

14:19 amalloy: No!

14:19 Sorry--I didn't have "join" messages turned off on hexchat so I'm wading through a sea of noise.

14:20 amalloy: &((fn choices [items n] (if (zero? n) [[]] (for [choice (choices items (dec n)), item items] (conj choice item)))) '#{black white} 3)

14:20 lazybot: ⇒ ([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:20 amalloy: so 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:21 blake__: amalloy: Oh, I like that better.

14:21 I don't need efficiency. I'm doing this to learn.

14:21 So, I guess I should say, I don't need efficiency, until I do. =P

14:22 amalloy: blake__: 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:22 here, the tree is N levels deep, each of which has (count coll) identical choices

14:23 blake__: amalloy: Yeah, that's the thing I'm trying to get my head around.

14:23 amalloy: Thinking in terms of data structures.

14:23 amalloy: Is that & at the front a typo?

14:24 amalloy: no, that's asking lazybot to eval it

14:24 blake__: oh! cool.

14:24 &(+ 3 4)

14:24 lazybot: ⇒ 7

14:27 amalloy: i 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:28 blake__: tree-seq

14:34 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:35 amalloy: notice i quoted the set: '#{black white}

14:35 #{black white} would have failed because it tries to eval the symbols

14:36 blake__: Ah, okay... *phew*

14:52 mikerod: There are no special rules on arity-overloading macros right?

14:53 Seems like it'd evaluate as expected.

14:55 trptcolin: mikerod: whoa, i’d never seen one of those before, but i suspect sure you’re right

14:56 tos9: 0~/38

14:56 Bronsa: trptcolin: `or`?

14:57 trptcolin: Bronsa: heh, i stand corrected of course

14:57 Bronsa: :)

14:59 trptcolin: my memory is even shorter than i thought. i count 6 of them in my in-progress book on macros

14:59 welp

15:08 mikerod: trptcolin: :P

15:08 trptcolin: well, clojure.core/or and clojure.core/and

15:08 are examples

15:09 however, I was wondering if there is any sneaky stuff

15:09 like

15:10 (defmacro overloaded-mac ([x] (overloaded-mac 1 2)) ([x y] [x y]))

15:10 So, 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:10 I just didn't see the question pop up through a search, so was curious

15:10 Bronsa: mikerod: no, that doesn't work

15:10 mikerod: Bronsa: oh, just saw that you said `or` right away :P

15:11 hiredman: `(overloaded-mac ...) is the way to do it

15:11 Bronsa: mikerod: it only compiles fine, but if you try to invoke (overloaded-mac 1) you'll see it doesn't work

15:11 Raynes: So Linode just had a heart attack.

15:12 mikerod: Bronsa: I thought it might not work due to the implicit args to a macro

15:12 Bronsa: very weird too. it fails when I call it at first, but if I re call `defmacro` it works... wat

15:13 Bronsa: mikerod: that's some weird behaviour with redefining a var and metadata

15:13 llasram: Oh haha, because the first time it's not a macro

15:13 Hilarity!

15:13 Bronsa: llasram: exactly

15:13 mikerod: yuck

15:13 so, the take away is; it is a bad idea?

15:14 Bronsa: if 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:14 by attaching :macro to the meta of the var*

15:14 mikerod: yes, don't do it. won't work.

15:15 mikerod: alternatives?

15:15 (defmacro overloaded-mac ([x] `(overloaded-mac ~x 2)) ([x y] [x y])) ?

15:15 Bronsa: mikerod: yes, what hiredman said

15:15 mikerod: Bronsa: ugh! I didn't see that

15:15 hiredman: thanks for the answer I missed...

15:17 Raynes: Refheap has returned from the bowels of Linode hell.

15:18 Bronsa: lazybot too

15:18 Raynes: Yep.

15:18 It was a restart.

15:18 We had nearly a year of uptime.

15:18 I'm angry.

15:18 Bronsa: :(

15:18 Raynes: But hey, hardware problems.

15:18 Can't live with them, can't live without them.

15:18 Now... 4clojure.

15:18 Can I even remember how to start that thing?

15:19 cbp: lein run eheheh

15:19 Raynes: cbp: 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:20 cbp: that's scary. Why does it crash so much?

15:20 Raynes: cbp: Because it allows people to execute code on it.

15:20 xeqi: if only there were processes on linux that would start and restart services..

15:20 Raynes: And people are assholes.

15:21 There is only so much sandboxing one can do.

15:21 xeqi: It isn't really that simple.

15:21 cbp: ah

15:21 Raynes: xeqi: 4Clojure doesn't just crash, it becomes unresponsive to http requests and keeps chugging.

15:21 So you have to be a little more clever and restart it.

15:22 xeqi: Raynes: true, I let my snark get out there. I'm not looking forward to when clojars's vps has a hardware failure

15:22 Raynes: But 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:22 Also, things are SUPPOSED to start at startup.

15:22 But the problem is testing our scripts to do that requires restarting :P

15:22 Nobody got time for that

15:23 This whole server needs to get scrapped and a new instance built, but... nobody got time for that.

15:23 xeqi: heh, I've become a bigger fan of devops stuff after running into these problems too

15:23 Raynes: Likewise.

15:24 xeqi: Raynes: I don't suppose the other person just used monit, and if you start that service it'll bring everything up?

15:25 Raynes: No.

15:25 It's a short shell script that doesn't appear to be working very well.

15:27 aedon: Raynes: sounds like a job for haproxy and some docker containers -- just make a new contiainer when one fails to respond

15:28 Raynes: Sure, but this also should just be workign

15:29 Like I said, there are a ton of things that need to be fixed with this server.

15:29 Things learned by making this server suck.

15:29 I just need to find a weekend to spend moving to a new vps.

15:33 There we go.

15:33 Mongo wasn't awake.

15:33 cbp: Also need to port it to rethinkdb =D

15:34 Raynes: The beauty of these projects is how open the source is :P

15:35 carson: Does 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:35 Raynes: cbp: Someone once ported refheap to datomic.

15:36 But I was extremely apprehensive about that.

15:36 I'd love to move to rethink, postgres, etc.

15:36 cbp: datomic would probably be pretty expensive

15:36 Raynes: But I wouldn't love it so much as to really be motivated to do it myself.

15:36 Well, I could run the free stuff.

15:36 But... like...

15:36 Open source and free plz

15:37 bodie_: If clojars is running on a vps, they better damn well have at least a good backup

15:38 I worked at DigitalOcean, the failure rate of SSDs gets ridiculous

15:38 if you're using vps, instances should be seen as disposable

15:41 ordnungswidrig1: why doesn't the emacs repl suppres exceptions from time to time

15:41 if have it in *e but i want it to popup in a buffer?!

15:43 * ordnungswidrig is confused

15:43 ordnungswidrig: I meant "why does emacs suppress exceptions in the REPL"

15:55 bodie_: how does the ssd failure show up for a typical linux process? io errors? are they silent?

15:58 bodie_: ordnungswidrig, everything was on raid5 so usually failures would be detected and taken care of

15:59 ordnungswidrig: bodie_: so a regular vps there is on raid5?

15:59 bodie_: 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:59 the blades are, yes

16:00 ordnungswidrig: so this is opaque for me as a DO user

16:01 bodie_: 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:02 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:02 ordnungswidrig: bodie_: you mean when the ssd failed, it failed complete?

16:02 bodie_: right

16:03 ordnungswidrig: i like to have multiple nodes anyways. in multiple datacenters. on multiple continents.

16:03 bodie_: 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:03 ordnungswidrig: still working on multiple planets and solar systems

16:03 bodie_: yes. that is good :)

16:03 cheap cloud = a great reason to have failovers

16:03 ordnungswidrig: latency hurts for the former two

16:03 bodie_: that's how digital ocean attracted me :)

16:04 * ordnungswidrig is still working on this docker thing.

16:04 bodie_: hardware failures can and do happen on all vps providers, so I think DO makes the most sense bang-per-buck :)

16:04 they have their faults, but they also have a great team

16:07 ordnungswidrig: to get on topic again, does anybody have experience on running clojure servers as docker containers?

16:08 I 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:21 technomancy: clojars does have offsite backup fwiw

16:25 ordnungswidrig: technomancy: +1

16:25 technomancy: not my doing =)

16:25 coventry: korma.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:28 amalloy: coventry: 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:30 coventry: What 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:30 Frozenlo`: 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:31 technomancy: Frozenlock: no, there's nothing special needed

16:31 coventry: amalloy: So if there's a way to get the query with the parameters substituted in, that would be perfect, actually.

16:31 Frozenlock: technomancy: ok, thanks

16:31 technomancy: Frozenlock: changing :test-paths could mess it up

16:33 Frozenlock: technomancy: ah! I changed test-paths to "test/clj" and now it works fine. Thank you very much :-)

16:34 coventry: There 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:36 cemerick: funny, the type returned by a data reader fn cannot contain fields whose names contain dashes, or bad things happen

16:40 hiredman: cemerick: do tell

16:40 cemerick: I would guess cider/reply bug

16:41 cemerick: hrm

16:41 trptcolin: oh?

16:41 cemerick: hiredman: why?

16:41 trptcolin: yeah details please

16:41 cemerick: eliminating the dashed field yields expected behaviour, so I assumed the usual not-munging bug

16:42 hiredman: cemerick: because I've had trouble round tripping stuff with data readers through an emacs nrepl connection for example

16:42 trptcolin: i wonder if the emacs client uses its own reader

16:42 hiredman: I 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:43 llasram: I've need to implement print-dup

16:43 cemerick: hiredman: 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:44 hiredman: cemerick: 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:44 cemerick: oh, you mean a reader for a defrecord? not a reader specified in data_readers.clj ?

16:45 Bronsa: cemerick: can you nopaste an example?

16:51 cemerick: Bronsa, hiredman, trptcolin: https://www.refheap.com/70731

16:51 seems pretty straightforward.

16:51 I 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:52 hiredman: except the data readers code never looks what is returned

16:53 cemerick: what happens for (do #foo "5" nil) ?

16:54 cemerick: hiredman: dunno, I've moved on; but the _compiler_ needs to look at what is returned, or at least that's what I remember

16:54 hiredman: Oh, sure, to embed it in the bytecode

16:55 llasram: But it should be looking at the `print-dup` result, which is undefined for that type, which causes an entirely different exception

16:55 cemerick: and there's where lack of munging would be a problem

16:55 llasram: So.... that's weird

16:55 Bronsa: meanwhile, I think I found a tools.reader bug testing this

16:55 arrdem: lolz

16:55 cemerick: llasram: I don't think compilation of tagged literals looks at print-dup output

16:56 trptcolin: yeah, fwiw it’s definitely in the language, not any nrepl tooling. just ran w/ clojure.main

16:56 llasram: We're talking JVM Clojure or ClojureScript?

16:56 cemerick: JVM

16:56 trptcolin: jvm

16:56 cemerick: anyway, I do have print-dup defined for that type; but again, removing the dash from the type yield expected behaviour

16:57 llasram: cemerick: 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:59 cemerick: llasram: yeah, I guess you're right. Anyway, it's clearly looking at fields at some point.

16:59 hiredman: yeah, getBasis doesn't have munging in the compiler

17:00 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L4579

17:00 cemerick: hiredman: feel free to file a ticket you're so motivated. I did enough ticket-chasing for one day already. :-)

17:00 trptcolin: honestly 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:00 hiredman: cemerick: sure

17:01 arrdem: trptcolin: it's normal to be able to use hypenated symbols elsewhere in Clojure, so the expectation is that it "just works"

17:02 as it has not been otherwise documeted to be a problem.

17:02 llasram: Neat. 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:03 coventry: This 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:03 cemerick: arrdem: hypenation has been _the_ persistent nuisance problem in Clojure :-)

17:04 arrdem: cemerick: :-P I didn't say it was a _good_ idea...

17:04 Bronsa: nevermind, no bug

17:07 .. but I'm not doing any munging for deftype fields in tools.emitter.jvm

17:09 hiredman: Bronsa: 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:10 seangrove: So this seems like a problem to me:

17:10 Bronsa: hiredman: except I'm munging on the other side :P

17:10 seangrove: ,(keyword "this is it")

17:10 clojurebot: :this is it

17:10 arrdem: seangrove: ouch....

17:11 seangrove: ,(read-string (pr-str (keyword "this is it")))

17:11 clojurebot: :this

17:11 rasmusto: ,(keyword "no problem")

17:11 clojurebot: :no problem

17:11 rasmusto: ,(symbol "no problem")

17:11 clojurebot: no problem

17:11 arrdem: ,(keyword "there is nothing to be upset about")

17:11 clojurebot: :there is nothing to be upset about

17:11 seangrove: arrdem: Doesn't round-trip though

17:11 rasmusto: ##(keyword "no problem")

17:11 arrdem: seangrove: exactly

17:12 seangrove: Doesn't serialize, essentially :P

17:12 hiredman: Bronsa: well, logically, you must be munging on both sides even if you don't think you are

17:12 rasmusto: &(keyword "no problem")

17:13 llasram: I wonder if it would work better if munging happened at the read/print boundary

17:13 Bronsa: hiredman: 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:13 llasram: So internally no symbols or keywords ever contained "-"

17:13 Bronsa: the class has a foo-bar field but (.foo-bar ..) looks up for a foo_bar one

17:13 * seangrove ponders moving to strings instead of keywords

17:14 hiredman: Bronsa: ah, welllll

17:15 llasram: Bronsa: Oh, the JVM allows '-' in such names?

17:15 Bronsa: llasram: I don't know if it's allowed on the spec, but it's not complaining

17:15 llasram: Interesting

17:16 Bronsa: llasram: even ASM's class checker doesn't complain about it

17:16 hiredman: it is not terribly consistent, different classes of identifiers allow different things

17:17 arrdem: seangrove: 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:17 hiredman: ,(Character/isJavaIdentifierPart \-)

17:17 clojurebot: false

17:17 hiredman: feh

17:18 ,(Character/isJavaIdentifierStart \-)

17:18 clojurebot: false

17:18 arrdem: hiredman: right, - is only Java legal as arithmetic. :c

17:18 technomancy: such a dumb design decision

17:18 llasram: What the JVM giveth, the Java taketh away

17:18 seangrove: arrdem: Yeah, non-serializable data makes me a sad panda though

17:18 technomancy: optimizing for obfuscation

17:19 arrdem: seangrove: ah... nonprintable data makes me sad panda, serialization I tend to care less about.

17:19 technomancy: "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:20 arrdem: technomancy: meh... it keeps the grammar nicer and whitespace insensitive... I understand it but I don't like it either.

17:21 seangrove: technomancy: I see your dumb statement, and raise you http://stackoverflow.com/a/14779648

17:21 technomancy: seangrove: http://p.hagelb.org/blam.gif

17:21 arrdem: seangrove: ... wow

17:22 http://arrdem.com/images/upset.gif

17:22 justin_smith: the fact that one person clicked the uparrow on that

17:22 Frozenlock: arrdem: 404 Not Found

17:22 coventry: Of all the things I saw yesterday, that was the one I laughed at hardest.

17:22 arrdem: Frozenlock: I wasn't fast enough on the git push :P

17:23 fixed :c

17:23 technomancy: http://achewood.com/index.php?date=05022003 but for mutable strings

17:23 arrdem: unlike technomancy I don't have an amazing infrastructure for getting reaction pics when I need them with a single keychord. yet.

17:24 AmandaC: M-x omg?

17:24 justin_smith: webcam -> facial recognition -> gif search -> url pasted to irc

17:24 AmandaC: Heh

17:24 rasmusto: justin_smith: https://github.com/mroth/lolcommits

17:24 most of the way there

17:25 arrdem: rasmusto: I think bitemyapp was doing a thing where all commits had gifs in the message for a while... results varied :P

17:25 michal1: Hi. Could you tell me what clojure web framework is the most mature with documentation and features?

17:25 rasmusto: :)

17:25 SegFaultAX: michal1: Luminus. Not really a framework, but a set of great default libraries.

17:26 cYmen_: 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:26 michal1: how about caribou? Looks prety well.

17:27 justin_smith: michal1: we have it well documented, but it is still alpha, has some rough edges

17:27 Frozenlock: cemerick: about friend, isn't there an `authenticated?' fn? Say for (if (auth...) logout-button login-button)

17:27 justin_smith: but I (and usually patchwork except when he is on vacation in new zealand) am around to field questions about it

17:28 arrdem: ,(- (int (inc (/ 25 2))) 6)

17:28 clojurebot: 7

17:28 arrdem: (/ 20 3.5)

17:28 ,(/ 20 3.5)

17:28 clojurebot: 5.714285714285714

17:29 trptcolin: Frozenlock: (if (cemerick.friend/current-authentication) logout-button login-button)

17:29 you could boolean-cast it if you really need a boolean

17:30 Frozenlock: trptcolin: Ah, makes sense, thanks

17:31 michal1: justin_smith: you are talking about caribou?

17:31 justin_smith: oh yeah, I am one of the caribou devs

17:32 sorry, I wasn't quite clear about that

17:36 michal1: justin_smith: It's...specyfical. I feel like with CherryPy(python) minimalism with nice features.

17:38 coventry: Speaking 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:42 abp: coventry: look in the nrepl-server buffer

17:42 reiddraper: gfredericks: got a chance to look at the gist, :when is 'such-that', yeah?

17:44 coventry: abp: Yeah, when I say the error wasn't printed out, I mean in the emacs nrepl server buffer.

17:45 ...but the repl would report the assertion failure when I triggered the same code there.

17:45 hiredman: cemerick: 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:46 technomancy: still nothing on http://dev.clojure.org/jira/browse/CLJ-1297 =\

17:46 FelisCorax: coventry: 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:47 bbloom: is 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:48 justin_smith: in my experience emacs hosted process + heavy usage of threads (as one would see in ring request handling) = printouts lost to the ether

17:48 I start the process in an xterm and then start an nrepl server instance in the process which I then connect to

17:49 this is particularly bad with core.async too

17:50 gfredericks: reiddraper: exactly

17:50 reiddraper: I think for/doseq are kind of clojure's monad syntax, so this kind of thing seems to make sense to me

17:50 coventry: FelisCorax: I'm not causing it to execute in a future, but it's possible (but unlikely) that some ring middleware is.

17:50 reiddraper: gfredericks: does the body you provide return a generator or a value?

17:51 justin_smith: coventry: each request gets a thread in ring/jetty at least

17:51 gfredericks: reiddraper: the body returns a value; could go either way of course, but value felt less surprising

17:51 justin_smith: which should have the same issues that futures and core.async see with output disappearing

17:51 (really this is an emacs nrepl.el / cider issue)

17:52 coventry: justin_smith: Oh... that's possible. I'll play with it some more later.

17:52 reiddraper: gfredericks: neat. i'd be curious to get some feedback from some other users, but this seems reasonable. can you start a jira thread?

17:53 gfredericks: reiddraper: sure

17:53 reiddraper: gfredericks: much appreciated

17:58 gfredericks: I have a version that mostly works. The main thing missing is the ability to have a :let directly before a :when

17:58 supporting :when was tricksier than I expected

17:58 without :when it's a pretty basic recursive macro

17:59 stuartsierra1: coventry: 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:00 In general, you don't want to catch Throwable. Logging or displaying errors is the exception, no pun intended.

18:01 gfredericks: apparently ring.middleware.stacktrace does not know about this exception: https://github.com/mmcgrana/ring/blob/master/ring-devel/src/ring/middleware/stacktrace.clj

18:01 cemerick: hiredman: voted, though I'm not convinced of the utility of it

18:01 s/utility/effectiveness

18:02 hiredman: cemerick: :)

18:02 gfredericks: wait

18:02 that was an old ring

18:02 new ring catches Throwable

18:03 * gfredericks shakes fist at google and people who move github repos around

18:03 llasram: I guess always create a github org for any project you think both (a) will become popular, and (b) you will move on from?

18:04 gfredericks: :/

18:04 reiddraper: heh

18:04 gfredericks: what happens if your lib becomes a contrib lib? :P

18:05 llasram: Doesn't all further development cease, making the location of the official repo irrelevant?

18:05 bbloom: you can email github support to reparent the forked-from pointers

18:05 llasram: I kid, I kid

18:05 reiddraper: I missed the context here, but when i link to github, i always include a ref or sha in the url, better permalinks

18:05 michaniskin: is there a replacement for -?> (thread-first, like -> but short-circuits and returns nil when any threaded expr evals to nil)

18:05 gfredericks: reiddraper: context is googling for repos that have changed owners/orgs

18:05 llasram: michaniskin: some->

18:06 michaniskin: llasram: thanks!

18:06 rasmusto: some-> over the rainbow

18:06 reiddraper: gfredericks:ah, yeah the best workarund i know is just to link to the new location from the old one, in the readme

18:06 llasram: I pronounce that as "thread some over the rainbow," which my parser rejects

18:06 coventry: stuartsierra1, 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:07 gfredericks: coventry: what version of ring-devel are you using?

18:07 coventry: 1.2.0

18:08 gfredericks: ah ha

18:08 stuartsierra1: coventry: it's easy to write a middleware that catches all exceptions

18:08 gfredericks: well 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:08 brehaut: palindromic exclaimations for all

18:08 coventry: gfredericks: Thanks, I'll try upgrading.

18:09 gfredericks: coventry: looks like 1.2.2 still doesn't have it; the commit is https://github.com/ring-clojure/ring/commit/c86494086ce00c60b946c1c6321f48241cfb6cda

18:09 but I don't know if that's released

18:09 doesn't seem to be based on git tags

18:09 $latest ring/ring-devel

18:10 you could deploy master to clojars yourself :)

18:11 coventry: Thanks, gfredericks. I'll try that in a lein checkout.

18:12 llasram: Which utility library was which had a template/macro for fully implementing IFn in a deftype?

18:16 gfredericks: I did that somewhere by hand

18:16 AmandaC: Ok, 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:16 hiredman: ,(doc max-key)

18:16 clojurebot: "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."

18:16 justin_smith: AmandaC: (first (sort-by second vs))

18:16 rasmusto: ,(max-key second [['a 2] ['b 4]])

18:16 clojurebot: [[a 2] [b 4]]

18:16 gfredericks: llasram: it's a 10 line paste :) https://github.com/fredericksgary/lib-7607/blob/master/src/com/gfredericks/lib_7607/serialization.clj#L68

18:16 rasmusto: ,(apply max-key second [['a 2] ['b 4]])

18:16 clojurebot: [b 4]

18:17 rasmusto: I always miss that "apply"

18:17 AmandaC: ah, thanks rasmusto

18:17 llasram: gfredericks: Of course! lib-7607. Why couldn't I remember that

18:17 gfredericks: :-p

18:17 (that actually is in fact the one)

18:17 AmandaC: I saw max-key but I couldn’t figure it out, and it always was just returning the source data it seemed.

18:17 rasmusto: AmandaC: if you're counting in a separate step, you can simplify to this: ##(apply max-key count ["123" "1234" "12345"])

18:18 gfredericks: llasram: looks like that macro assumes you just want to delegate to one of the fields

18:18 justin_smith: yeah, max-key is better because it does not need to build up the list

18:19 * AmandaC is toying with pigpen, and is playing with the data that the word-count example spits out, she ran it over /The Adventures of Alice in Wonderland/ and that data output is rather bloated. :p

18:19 llasram: gfredericks: Yeah... I'm trying to decide if I want to do it that way. I think probably do anyway

18:19 amalloy_: 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:19 AmandaC: well, not bloated, I guess, for what it is. <.<

18:19 rasmusto: AmandaC: ok, my first example should work then :)

18:19 AmandaC: yeah, the apply max-key one did the trick

18:20 gfredericks: amalloy: but who on *earth* would have a def-map-type macro?

18:20 * AmandaC seems to have lost the doc function in her REPL somehow

18:21 * gfredericks waits for ztellman to descend from the sky

18:21 gfredericks: AmandaC: (use 'clojure.repl)

18:21 hiredman: AmandaC: it is in clojure.repl namespace, and only refered in to the user namespace by default

18:21 AmandaC: ahhh

18:22 gfredericks: I have a repl-utils library that lets me just type (&bs) and the current namespace gets all convenientized

18:22 llasram: Is there any sort of existing `identity`-macro? So you can splicing unquote etc forms which then just get compiled

18:22 gfredericks: llasram: I think that's the backtick library

18:22 maybe?

18:22 llasram: Ehhhh, not quite

18:23 amalloy: llasram: i think you may mean something like https://github.com/flatland/useful/blob/develop/src/flatland/useful/macro.clj#L17?

18:23 llasram: I 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:24 gfredericks: amalloy: I'm going to posit that you wrote the docstring for that macro

18:24 * gfredericks posits it

18:24 amalloy: gfredericks: not a difficult leap to make, but i wonder what makes you say that

18:24 llasram: I think you are excellent at this positing

18:25 gfredericks: amalloy: the explanatory style at the end seemed your personality

18:25 llasram: Am I missing something which makes such a macro useless?

18:25 I'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:25 amalloy: llasram: you can't do that at anything but the top level

18:26 so it doesn't help at all for the IFn case

18:26 ztellman: amalloy: def-abstract-type, c'mon

18:26 amalloy: or maybe i misunderstood you

18:26 ztellman: this problem has been solved in a highly questionable way, let's all just use that

18:26 gfredericks: yay it worked it worked! ztellman is here with another macro!

18:27 llasram: amalloy: I'm thinking: (identity-macro `(deftype Blah [f] ~@(ifn-wrapper f)))

18:27 ztellman: llasram: https://github.com/ztellman/potemkin#def-abstract-type-and-deftype

18:27 this is how I add in IFn functionality to def-map-type in Potemkin

18:28 amalloy: llasram: that certainly seems appealing to me, and yet it also seems like it's not different from eval in any obvious way

18:28 llasram: ztellman: Ok, makes sense to have particular support for types. But this is something I've wanted for other situations too

18:29 amalloy: Yeah, I think the compiler could certainly handle `eval` exactly this way, except that we know the implementation doesn't :-)

18:29 ztellman: llasram: sure, what you really want is a macro version of syntax-quote

18:29 * gfredericks overflows his stack

18:29 ztellman: so that you could just do (magic-template-macro (deftype Blah [f] ~@(...)))

18:29 no need for eval

18:30 llasram: ztellman: good point

18:30 But alas on that note I must depart

18:30 amalloy: a macro that just returns its body isn't a solution, because the body here is (seq (concat '[deftype] '[Blah] '[[f]] ...)), and not (deftype ...)

18:30 ztellman: I'm working on something for this, a partial implementation is at https://github.com/ztellman/potemkin/blob/master/src/potemkin/template.clj

18:31 amalloy: if my aforementioned macro is a macro, that'll get worked out at compile-time

18:31 gtrak: didn't bbloom make that already?

18:31 https://github.com/brandonbloom/backtick

18:31 ztellman: gtrak: sorta, the version I linked to doesn't require gensyms or ~' or any of that other line noise

18:32 because it enforces hygiene at compile time rather than read time

18:32 bbloom: gfredericks: ztellman's version is a tad different

18:32 gtrak: ah

18:34 gfredericks: bbloom: I think that statement might be true independent of the context

18:34 Bronsa: ztellman: your deftype+/def-abstract-type look an awful lot like my deftrait/deftype from https://github.com/Bronsa/neurotic :)

18:35 ztellman: Bronsa: it's not a revolutionary idea, I'll admit

18:35 bbloom: gfredericks: rewrite to "has slightly different goals"

18:36 em-dash: when 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:37 justin_smith: em-dash: the correct term is kebab-case

18:37 gtrak: em-dash: I'd just stick to the json version :-)

18:37 :thisIsNotSoBad

18:38 justin_smith: https://github.com/qerub/camel-snake-kebab camel-snake-kebab should work in cljs I think

18:38 em-dash: gtrak: not *so* bad, but why settle? :)

18:38 justin_smith: thanks, I'll check that out!

18:38 gtrak: well.. I guess, I like less things in between my things.

18:38 justin_smith: em-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:41 bbloom: em-dash: i'd go further: just use strings as keys

18:41 em-dash: the keyword-ization thing is fragile and pointless

18:43 em-dash: bbloom: 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:43 maybe not a meaningful place to apply effort, but it sorta offends my sensibilities :/

18:44 bbloom: i guess it's a reasonable thing to do if you're also converting objs to maps and arrays to vectors

18:45 i just see lots of simple/small usages of js->clj that could easily be addressed with an aget or two

18:45 dnolen_: em-dash: you could implement IEncodeClojure for Keyword in your application to get the behavior you need from js->clj

18:46 abp: wow, 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:47 em-dash: bbloom: 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:48 dnolen_: thanks, that seems like a (potentially) cleaner approach

18:48 bbloom: em-dash: aget will work fine on data loaded from JSON.parse etc

18:48 dnolen_: em-dash: hrm, actually looking at the js->clj - the needed hook is missing ...

18:49 em-dash: dnolen_: 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:50 bbloom: 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:50 er, specifically a no-no w/r/t advanced compilation mode

18:50 bbloom: em-dash: search for "Using string names to refer to object properties" on this page: https://developers.google.com/closure/compiler/docs/limitations

18:52 em-dash: bbloom: thanks!

18:52 lynaghk: dnolen_: ping

18:54 dnolen_: lynaghk: pong

18:55 lynaghk: dnolen_: I had a conceptual question about om if you have a sec

18:55 dnolen_: lynaghk: go for it

18:55 lynaghk: in particular, is it necessary for there to be a distinction between user-defined components and html tags

18:56 I can throw around (dom/div ...) constructions, but when I have my own widgets I need to do this (build-all) stuff

18:56 bbloom: lynaghk: there isn't such a distinction in React itself beyond the implementation details

18:56 lynaghk: one of my favorite things from Angular is being able to define new tags and then not think about 'em any more

18:57 so I was wondering if there's some reason such a scheme wouldn't work in reacot

18:57 *react

18:58 dnolen_: lynaghk: it's a tradeoff, React in fact works that way

18:58 lynaghk: https://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:58 dnolen_: lynaghk: Om does not because I want component construction to be interceptable

18:58 lynaghk: ah, got it.

18:58 bbloom: dnolen_: can you intercept div construction?

18:58 dnolen_: lynaghk: yeah I think uniformity here is valued over adaptability, I don't really care that much about uniformity

18:58 lynaghk: if 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:59 dnolen_: lynaghk: there isn't a compilation process really

18:59 lynaghk: when React is a little more pluggable in the future we may be able to recover uniformity

18:59 bbloom: cannot

19:00 bbloom: dnolen_: random idea: could you just define a higher-order html-element component that takes the tag as a parameter?

19:00 noonian: you 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:00 dnolen_: bbloom: could, don't really care that much about it though

19:00 benmoss: hmm. in Om it’s not possible to use strings as cursors?

19:00 bbloom: dnolen_: yeah, but for intercepting textareas or whatever, it would be cool

19:00 lynaghk: Right 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:01 dnolen_: benmoss: it is but you're on your own. very gross because of JavaScript String Object native distinction

19:01 bbloom: dnolen_: 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:02 dnolen_: but it looks like you already have a "tags" collection to go off of

19:02 dnolen_: 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:02 benmoss: dnolen_: 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:02 dnolen_: benmoss: read the first tutorial please

19:02 lynaghk: dnolen_: 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:03 coventry: lynaghk: You might be able to extend sablono with custom elements.

19:03 mvzink: benmoss: the bit about implementing ICloneable for String

19:03 benmoss: ah mvzink thanks

19:03 dnolen_: 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:03 lynaghk: when React loosens up these things, we have more flexibility as well

19:04 lynaghk: dnolen_: 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:04 dnolen_: lynaghk: sadly a lot of this knowledge comes from talking directly with the React devs in person, specifically Pete Hunt and Sebatien Markbage

19:05 lynaghk: corner these guys and buy them a drink ;)

19:05 s/Sebatien/Sebastien

19:05 lynaghk: dnolen_: that is the only way I know how to learn software things = )

19:06 dnolen_: thanks for the info, I'll dig 'round a bit more

19:06 dnolen_: lynaghk: Sebastien is the main full time dev - he does most of the internals

19:06 lynaghk: the conversation I had w/ him at Clojure/West was very good - React is going in the right direction

19:06 on the road map is splitting out the OO stuff so we have a better interface

19:06 gozala: anyone able to help me out with core.async question ?

19:06 dnolen_: as well making the rendering more pluggable (WebGL/Canvas etc)

19:06 Objective-C too

19:07 lynaghk: dnolen_: damn, I didn't know he was there. I would've loved to talk with the react guys

19:08 dnolen_: lynaghk: actually he wasn't there, just met for beers on Wednesday night, he works at FB and lives in SF

19:08 amalloy: ~anyone

19:08 clojurebot: Just 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:08 bbloom: lynaghk: dnolen_ invited him out for drinks one night. i agree: that guy definitely has strong sense of the problem & solution

19:09 tpope: vim indenting question for you, but this might be a question for guns / vim-static

19:10 lynaghk: bbloom:, dnolen_: have either of you seen interesting solutions for where styling fits into all of this?

19:10 bbloom: tpope: 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:11 lynaghk: we discussed it a bit, i have ideas but i haven't worked out details yet

19:12 lynaghk: bbloom: I'd be interested to see what you come up with.

19:12 dnolen_: 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:12 lynaghk: I 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:12 bbloom: lynaghk: 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:13 rasmusto: bbloom: you want something on the line after the [ to be lined up with the first blah (after the "(") ?

19:14 lynaghk: dnolen_: 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:14 bbloom: dnolen_: lynaghk: i'm not a huge believer in constraint-based layout outside of top-level grids

19:14 lynaghk: dnolen_ i think it's good to have two distinct sets of abstractions, but those two subsystems need to communicate *very closely*

19:15 lynaghk: bbloom: two sets = aesthetic styling, layout?

19:15 bbloom: rasmusto: if i type an ( or a [ or whatever without anything after it, i want 2-space indent, instead of alignment

19:15 dnolen_: 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:15 bbloom: lynaghk: yeah, styling and layout

19:15 dnolen_: lynaghk: the more I think about Shadow DOM the more I get scared

19:16 bbloom: lynaghk: 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:16 lynaghk: dnolen_: when you say "which styles" you mean a pre-specified mapping of domain properties (e.g., invalid input) to visual aeshetics (red text)?

19:17 dnolen_: lynaghk: I'm not really concerned about visual aesthetics vs. domain properties - too high level of concern

19:17 rasmusto: bbloom: 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:18 dnolen_: more concerned about getting a sensible approach period for efficiently styling components w/o interference

19:18 w/o the complexity of Shadow DOM

19:18 lynaghk: dnolen_: oh, you mean you are thinking of an alternative to CSS selectors when deciding how to apply rules?

19:18 bbloom: dnolen_: yeah, there's two halfs of hte problem: styling/layout at it's core... and making a damn browser behave itself

19:18 dnolen_: lynaghk: yes something that delivers the good parts of CSS w/o the issues that performs well in modern browsers for components

19:19 lynaghk: dnolen_: you think shadow DOM is analogous to private classes/methods? Treating the symptoms and not the problem?

19:19 dnolen_: lynaghk: yes treats the symptoms, and then has to pile on complex hacks to make it work

19:20 bbloom: rasmusto: not quite.... close though, so i know it's possible somehow

19:20 agreed fully on shadow dom nonsense

19:20 more OOP silliness

19:20 lynaghk: dnolen_: what are the biggest issues you have with CSS now?

19:21 dnolen_: lynaghk: interference

19:21 lynaghk: so I want what Shadow DOM delivers w/o the complexity and cognitive load.

19:22 lynaghk: dnolen_: interference = it's too easy to write over-general rules?

19:23 dnolen_: lynaghk: no I can't give you widget that you can just drop into a page that works because styles unrelated affect it

19:23 lynaghk: there's a fine line between that being a bug and a feature (e.g., your widget matches the typeface on my website)

19:24 dnolen_: lynaghk: having worked on website for years w/ draconian styling rules - still not worth it

19:24 lynaghk: yeah, totally fair. it's something Ryan and I have been discussing as well

19:25 well, I'm going to take all of this over to my hammock and ideate for a few weeks. thanks dnolen_, bbloom.

19:27 bbloom: lynaghk: i've got a kinda nebulous thought about transclusion of styling being a bug vs a feature

19:27 oh he left :-P

19:28 anyway, for on lookers: i'd rather design a component to have PRECISELY SPECIFIED styles and then abstract over time to relax constraints

19:28 artists/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:29 SegFaultAX: bbloom: What was the tl;dr of the conversation? I missed most of it.

19:29 bbloom: abstract over time == overtime, add abstraction... not literally abstract over some time T :-P

19:29 SegFaultAX: that's what logs are for :-P

19:29 SegFaultAX: And also handy tl;drs. :)

19:32 abp: bbloom: What did you mean by top-level only in respect to grids? Basic layout and then only gridding deeper where appropriate?

19:33 bbloom: abp: http://aucklandlayout.sourceforge.net/ works great for the same kind of things that designers use grid lines for in photoshop

19:33 abp: but many layouts are non-linear, hell... some are non-euclidean

19:33 trivial example: wrap panels

19:36 abp: bbloom: What's the difference between ALM and GSS?

19:36 bbloom: abp: i don't know a lot about GSS, but I know that it advertises cassowary on the tin

19:36 abp: cassowary is a constraint solving algorithm

19:37 abp: ALM is an abstraction over vertical, horizontal, and rectangular regions that can be implemented with any linear constraint solver

19:37 (including cassowary, of course)

19:38 abp: 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:38 clarifying words: rules == guidelines

19:39 abp: bbloom: yeah, looking at the ALM-examples briefly

19:39 bbloom: think about how designers work. they don't create a grid line for EVERYTHING ON EVERY PAGE

19:39 that's what traditional solvers do

19:39 auto layout in ios for example has examples that involve direct relationships between two components

19:39 which is silly, designers don't think that way

19:44 abp: bbloom: I'm not sure of that. ;)

19:45 brehaut: oh thank goodness they are _from_ auckland, not naming it after how auckland is layed out

19:45 bbloom: abp: 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:47 seangrove: bbloom: Blend for html looks pretty fantastic

19:47 bbloom: seangrove: was that announced today?

19:47 link?

19:47 seangrove: Apparently not!

19:47 http://channel9.msdn.com/Events/Build/2013/2-311

19:48 bbloom: seangrove: i'm sorry / you're welcome for me exposing you to msft dev tools :-P

19:48 seangrove: bbloom: If it works out in the end, you're forgiven

19:49 If I lose my way and go running back to backend-dev, well...

19:49 abp: seangrove: From VS-exerience I'd assume it looks great until you have to use it. :x

19:49 seangrove: Anyway, blend has some good ideas, but it does have some stuff mixed up that doesn't seem as fantastic - usual MS stuff

19:49 bbloom: seangrove: yeah, in true msft style

19:50 i'm telling you man, they are the ultimate pyramid builders... i'm counting on this community to build some fucking cathedrals :-)

19:50 seangrove: bbloom: 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:51 bbloom: seangrove: what does "follows the page layout" mean?

19:52 seangrove: bbloom: It's in a slightly strange middle-land. It's making components, etc., but it still keeps the 'page' idea from html

19:52 bbloom: So you're still playing with document-flow page layout that the browsers do by default

19:52 bbloom: seangrove: 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:52 i suspect they will fuck it up 2.5 times before they get it right, modulo some legacy stuff

19:53 seangrove: I just don't see much benefit to keeping the page model and squeezing apps into it

19:53 abp: bbloom: Have you read the paradigms book by van roy?

19:53 bbloom: abp: nope, should i?

19:53 seangrove: If you're working with components, have styling, layout, etc. separate, then throw html layout out

19:53 bbloom: seangrove: agreed

19:53 abp: bbloom: Where about to ask you what you think about it in comparison to other basic cs stuff you know

19:54 bbloom: no clue

19:54 abp: bbloom: I'm just doing an edx-course by him, based on a third of the book. Post-filling solid basics. :x

19:58 bbloom: 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:59 bbloom: abp: i programmed professionally for 10+ years before i took 6 months to myself to study and had a "i see the matrix" moment

19:59 SegFaultAX: bbloom: Side note: code.org is pretty damn sweet.

20:00 bbloom: SegFaultAX: glad you like it! :-) it's still evolving fast since i worked on the Hour of Code campaign until dec

20:02 abp: bbloom: 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:02 SegFaultAX: I did the whole course last night, had a blast.

20:03 I especially enjoyed the later levels which focused on functions and composition.

20:03 abp: bbloom: Wasted a lot of time trying to mitigate via libs and frameworks before that. :/

20:04 bbloom: abp: for me, learning clojure, factor, and mathematica + implementing compilers/interpreters for small languages of various kinds

20:04 implementing a lisp made me understand haskell and scala better than... writing programs in haskell and scala :-P

20:05 abp: lol

20:05 bbloom: seriously, everybody: go implement a toy lisp

20:05 it's good for you :-)

20:05 technomancy: bbloom: oh, did I tell you I started a forth?

20:05 bbloom: technomancy: YESSS

20:05 nice.

20:06 technomancy: fun times

20:06 SegFaultAX: Does it have to be a toy!?

20:06 technomancy: SegFaultAX: everything starts as a toy

20:06 bbloom: SegFaultAX: nope! but once it stops being a toy you stop learning about computer science and start learning about software engineering ;-)

20:06 technomancy: i've implemented maybe two dozen forth-likes by now. it's so easy you can almost do it by accident lol

20:07 SegFaultAX: What I mean is: when I have to write something in Python I usually implement a lisp to do whatever my actual work is.

20:07 Or Ruby. Or Java.

20:07 Isn't that how everyone writes code?

20:07 technomancy: bbloom: 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:07 bbloom: technomancy: haha awesome

20:07 technomancy: no idea if I can actually fit a keyboard firmware into that. we shall see.

20:07 bbloom: technomancy: i'm certain you can

20:08 technomancy: i'm certain you can... AND it can have a fucking debugger

20:08 technomancy: hehe

20:08 well the fact that my board only has 42 keys should help

20:09 bbloom: http://nforth.berlios.de/docs/nf-intro.html

20:09 that's a complete forth with interactive sessions & all sorts of jazz... 4k

20:09 technomancy: https://github.com/technomancy/orestes

20:10 it'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:10 bbloom: you implemented loops? booo. implement tail recursion :-)

20:11 http://www.colorforth.com/forth.html

20:11 technomancy: heh

20:11 justin_smith: technomancy: only c code in flash? why?

20:11 bbloom: note that the ";" symbol essentially means "turn the previous word in to a tail call"

20:11 technomancy: justin_smith: https://en.wikipedia.org/wiki/Harvard_architecture

20:11 because code is not data

20:12 bbloom: boooo

20:12 technomancy: is dumb

20:12 bbloom: :-)

20:12 justin_smith: the mind boggles

20:12 technomancy: it's

20:12 justin_smith: seems like there would be some "put some static data into RAM" shim possibility

20:12 technomancy: there is a forth that gets around it, but it does this by running the whole thing out of the bootloader

20:13 bbloom: technomancy: look at that page i linked you to, it's a table for a "minimal" forth with the corresponding pentium instructions

20:13 technomancy: justin_smith: you can read from flash, but you can't store back into it during runtime

20:13 bbloom: thanks; I've actually got most of the basics working already; just need to expose USB functionality to the forth code

20:13 but I should give it a look

20:14 seangrove: dnolen_: 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:14 bbloom: technomancy: some ideas like words that push pointers on to the stack were non-obvious to me, but make perfect sense in practice

20:14 technomancy: bbloom: yeah, I've needed a few of those just to get the text interpreter going

20:14 even though it's all C so far, it's very forthy C

20:15 bbloom: heh, yeah, now that i've done some forth, C is painful

20:15 technomancy: practically zero use of arguments to pass things around

20:15 seangrove: technomancy: Just keeping things on the stack?

20:15 bbloom: yeah, you basically just program with dynamic variables everywhere

20:15 technomancy: seangrove: yup; void void void everywhere

20:15 bbloom: seangrove: you only use the stack to parameterize stuff

20:16 seangrove: bbloom: Ah, hence dynamic vars

20:16 bbloom: dynamic vars are a pain w/ laziness or otherwise in a functional style, but in a forht, all code executes left-to-right

20:16 so side effects make perfect sense, there is no mental book keeping about evaluation order

20:16 technomancy: three functions that aren't void, and one of them is push =)

20:17 bbloom: differs wildly from factor too, which encourages more parameter passing

20:17 but factor also has quotations, which are like the rpn version of lambdas, so factor can do higher order dataflow and whatnot

20:18 so dynamic variables are less of a default there, prefering more stack passing & data flow combinators

20:18 http://docs.factorcode.org/content/article-dataflow-combinators.html

20:18 technomancy: is that related to forth's '?

20:19 bbloom: technomancy: i'm not sure what '? you're referring to

20:19 names are highly incosistent and ungooglable in forth land

20:19 :-P

20:20 technomancy: I think it's just pronounced quote

20:20 pushes the execution token of the parsed identifier that follows

20:20 kinda feels like @#'

20:21 or maybe #' from CL would be a better analog

20:21 bbloom: technomancy: ah yea, much like #'

20:21 http://docs.factorcode.org/content/word-__back__,syntax.html

20:22 in 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:22 which is sorta like a quote that doesn't go away

20:22 technomancy: cool.

20:23 bbloom: ,(defrecord Hold [value])

20:23 clojurebot: sandbox.Hold

20:23 bbloom: ,(= ''x 'x)

20:23 clojurebot: false

20:23 technomancy: got a kick out of how comments and strings are just parsing words

20:23 bbloom: ,(= (eval ''x) (eval 'x))

20:23 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

20:23 bbloom: ,(= (eval '''x) (eval ''x))

20:23 clojurebot: false

20:23 bbloom: ,(= (eval (Hold. 'x)) (eval 'x))

20:23 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

20:23 bbloom: ,(= (eval (Hold. ''x)) (eval ''x))

20:23 clojurebot: false

20:23 bbloom: er hard to concoct an example

20:24 anyway, the point is that quote prevents ONE evaluation

20:24 there is a notion of "Hold" in mathematica that stops all evaluation until ReleaseHold

20:25 that'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:25 basically coerces an object to a self-evaluating variant of that object

20:25 it's idempotent too

20:25 we need something like that in clojure...

20:27 technomancy: well I just want to hack my keyboard without writing a bunch of C

20:27 well

20:27 I guess it's too late for that

20:27 bbloom: lol

20:27 truely you should have bootstrapped a new forth with an old forth, like a real forth-er

20:27 technomancy: I wrote a rough draft of the firmware in gforth

20:27 bbloom: sadly, there doesn't appear to be a good forth that has compile-to-C

20:28 technomancy: and I considered avr assembly, but the docs around that are just garbage

20:28 bbloom: ah, the write one to throw away strategy, good plan

20:28 technomancy: plus the USB stack is C anyway

20:28 hard to avoid that

20:29 I am curious whether it's feasible to interact with the interpreter directly through keystrokes read from the switches, pre-usb

20:30 bbloom: i'm helpless in hardware land, i'm afraid

20:30 technomancy: yeah, I am still exploring it

20:30 bbloom: i've bricked more prototype devices in my career than i care to admit

20:30 technomancy: seems like below a certain size, forth is the only way to do that interactively

20:30 bbloom: i decided that if there is no undo button, i'm not interested

20:31 technomancy: well for boards that only run US$16 I'm less concerned

20:32 bbloom: if it were me, i'd order a few spares up front

20:33 yedi: is 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:33 or is that sort of thing a code smell

20:33 technomancy: well if I do brick this, I might upgrade to an arm

20:33 bbloom: yedi: reduce over (map vector (range) yourcoll

20:33 technomancy: I wanted to start with an avr because all the existing C firmwares use that

20:33 but arm boards give me way more room to work if I'm starting from scratch

20:33 sixty four whole kilobytes. the luxury.

20:34 yedi: bbloom: makes sense, thanks

20:34 * seangrove heard that in a northen English accent

20:34 technomancy: seangrove: you try and tell the young people these days; they won't believe you!

20:35 * seangrove images an alternate universe where aphyr hacks on distributed 64k systems

20:46 yedi: is it pretty stupid to have a map with a mapping from integer to something else

20:47 because you can just use a vector?

20:47 bbloom: yedi: does your key space start at zero?

20:47 coventry: yedi: Not necessarily. You might represent a sparse vector that way.

20:47 bob2: depends what the indexes are - if they're consecutive and start from zero, vector sounds like the way to go

20:47 bbloom: yedi: is to sparse? dense?

20:47 is it*

20:47 yedi: hm yea it will start from zero

20:48 idk what sparse/dense means

20:48 and many of the integers up till the last one will have a value, but not all of the integers (some will be nil)

20:48 coventry: For 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:49 yedi: so yes it'll be sparse, but how sparse it is will differ

20:49 depending on the data

20:50 yea i think a map makes sense

21:09 i feel like there is a more concise way to write this fn: https://gist.github.com/yedi/9946510

21:10 amalloy: (update-in m (:index stream) (fnil conj ()) to-add)

21:11 although really that fnil can just be conj, since (conj () x) is the same as (conj nil x)

21:11 (update-in m (:index stream) conj to-add)

21:11 yedi: oh nice

21:11 thanks

21:14 bbloom: amalloy: for some reason, the most common function i redefine in every project is (def conjs (fnil conj #{}))

21:25 michaniskin: (def trans (partial apply map vector))

21:25 (def indexed (partial map-indexed vector))

21:31 n_b: Is 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:35 michaniskin: n_b: https://github.com/dgrnbrg/spyscope#example-annotated-spyt-session <— i just found this

21:36 n_b: i haven't used it though, but it looks like it might help?

21:37 n_b: michaniskin: I'll take a peek, cheers.

21:45 * holo feels like (╯ಠ_ಠ)╯︵ ┻━┻ trying to make clojurescript tests work

22:27 coventry: holo: If you can get a browser repl going, it gets hugely easier to develop tests.

22:33 holo: coventry, 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:33 amalloy: "can't find cemerick"? that's a standard cljs bug?

22:33 if i knew having cemerick around were a standard cljs feature i'd write some!

22:34 holo: sure :D "ReferenceError: Can't find variable: cemerick" this one

22:34 technomancy: amalloy: relevant http://dev.clojure.org/jira/browse/NREPL-49

22:34 coventry: cemerick's immense productivity is just a trick for parallelizing his search for himself over the majority of clojure developers.

22:35 holo: heh I saw that one on twitter :D great stuff

22:37 coventry: holo: Post the test and I'll take a look if you like.

22:52 holo: coventry, I said the following after my connection was broken:

22:53 coventry, 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:53 coventry, thanks anyway. i must fight this battle alone, and laugh like a maniac after i win

23:06 ghadishayban: gozala: I can help you with a core.async question

23:21 chare: (defroutes handler (GET "/foo" [] (foo-handler))

23:21 how do i get access to the request in foo-handler?

23:22 jeremyheiler: chare: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax

23:32 chare: whats in the request map, this book says :context — The context in which the application can be found when not deployed as root.

23:32 what does that mean

23:34 brehaut: it 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:37 chare: that did not make sense to me

23:37 what are typical valuse for :context

23:40 tmciver: chare: have you seen this: https://github.com/weavejester/compojure/wiki/Nesting-routes?

23:41 chare: I don't think you have to care what value :context has.

23:41 chare: so when the book says the following

23:41 The preceding code will work fine when the application runs standalone.

23:41 However, if we ran our application on an application server, the Ajax request

23:41 would fail because the full URL would need to have the application context

23:41 prefixed.

23:41 what it means is the context macro?

23:42 the context macro will mess up the path used by ajax requests

23:45 zanedog: Who knows something about clojure.data.zip.xml?

23:48 Guest50943: Specifically, looking for advice on the xml-> function

23:49 chare: tmciver: 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:51 tmciver: chare: 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:52 Guest50943: Hah, figured it out. Never mind.

23:52 chare: if 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:53 tmciver: chare: I suppose so, but that's true of any request to that (non-contexted) path.

23:57 amalloy: Raynes: lazybot seems unable to send messages. related to the linode issue, presumably

Logging service provided by n01se.net