#clojure log - Mar 17 2013

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

0:00 lynaghk: Rich_Morin: I don't think those directions are correct

0:00 Rich_Morin: Clojure/West is happening downtown, in NW Portland. Your directions point to a hotel on the East side of the river.

0:02 Rich_Morin: Yow - good catch!

0:03 lynaghk: Rich_Morin: taking the train is a good idea, though--just make sure you take it over the river =)

0:13 Rich_Morin: http://pastie.org/6578249 - this looks better...

0:26 bbloom: lynaghk: https://www.refheap.com/paste/12649

0:26 lynaghk: that's just one tiny example of some working rewrite combinators

0:27 lynaghk: basically, any function that returns nil "fails" and then any other function that returns a map "succeeds" and then there is a big library of combinators made out of composing those pieces. things like rewrite until a fixed point, rewrite from the bottom up, rewrite from the top down, stop rewriting when some condition is met, etc

0:42 lynaghk: decided to publish progress so far: https://github.com/brandonbloom/retree

0:46 tomoj: should be easy to write something that makes analyzer output less insanely huge?

0:46 technomancy: tomoj: smaller defns? =)

0:46 tomoj: (rewrite &env (everywhere #(when (:env %) (dissoc % :env))))

0:46 bbloom: tomoj: :-)

0:46 tomoj: except that's too naive..

0:47 bbloom: #(when (:op %) (dissoc % :env))

0:47 technomancy: if

0:47 * technomancy runs

0:47 technomancy: http://p.hagelb.org/9grin.gif

0:47 * tomoj blames bbloom's comments

0:47 bbloom: technomancy: nah, it should be very clear that nil is being returned otherwise :-)

0:48 anyway, there are conditional combinators too

0:48 Raynes: technomancy: Psh.

0:48 Linking to Christopher Eccleston.

0:48 That's Doctor Who heresy.

0:49 bbloom: something like: (everywhere (choice (contains? :env) #(dissoc % :env)))

0:49 ignoring the fact that clojure.core has contains?

0:49 Raynes: technomancy: http://24.media.tumblr.com/829ff0fe4c6edff85f3371f409a87f4a/tumblr_mguw0yxEaS1s3s9i1o1_500.gif

0:50 bbloom: tomoj: i'm still learning how to work w/ these combinators, but i think there is one that is like everywhere top-down but stops when it does a rewrite, but continues for all siblings

0:51 so it would eliminate :env from any AST form, but it wouldn't eliminate it from :info sub forms or anything like that

0:51 haven't wrapped my brain around all this yet :-P

0:51 tomoj: looks pretty cool

0:52 bbloom: tomoj: thanks :-)

0:52 notice the phase 2 of the master plan: https://github.com/brandonbloom/retree/blob/master/src/retree/core.clj#L6

0:52 instead of returning functional combinators, i want all the non-primitives to return AST nodes

0:52 and then i want an older version of retree to optimize the ASTs of newer versions of retree ;-)

0:52 mwahaha

0:53 tomoj: I understood phases 1 and 3

0:54 ambrosebs: bbloom: looks cool! Where does this fit with the ASTs? Would a consumer use this to generate :children etc, like you suggested previously?

0:54 john2x: how do I test ring sessions? I'm using lib-noir's noir.session with memory-store, and I can put!/get! in the handler, but I'm lost on how to get! the session atom in the test function.

0:54 tomoj: the AST would be your own invented AST?

0:54 bbloom: tomoj: basically: phase two produces an AST, which is just a tree of maps and then the "compile" function just produces a tree of function combinators. phase 3 would actually produce and compile code

0:54 tomoj: or jvm.tools.analyzer-like?

0:55 bbloom: ambrosebs: this is for any type of tree rewriting, especially ASTs :-) some examples include dead code elimination, deforestation, etc

0:55 ambrosebs: the kiama code base has some examples

0:56 ambrosebs: bbloom: Ahk sweet!

0:57 bbloom: ambrosebs: would be awesome if we could do deforestation of (->> coll (map ...) (map ...) (reduce ...)) :-)

0:57 inlining, etc too!

0:58 ambrosebs: *looks up deforestation*

0:59 bbloom: ambrosebs: short version: (-> (range 5) (map inc) (map dec)) is the same as (-> (range 5) (map (comp dec inc)))

0:59 can even go further and eliminate known pure functions like (comp dec inc) to identity

0:59 and then (map identity) to identity

1:00 ambrosebs: bbloom: ah. I remember reading a Haskell paper on something like this.

1:00 bbloom: or to `seq i guess

1:00 :-P

1:01 callenbot: anyone here work on message-passing stuff before?

1:01 bbloom: i was addressing lynaghk with this though b/c i think it will also be useful for his grammar of graphics

1:02 and i have top secret evil schemes too ;-)

1:02 tomoj: I see some semantic editor combinators in there, but not many paths

1:02 bbloom: huh?

1:04 (btw, clojure is sooo much less verbose than scala... ::hug::)

1:08 tomoj: I mean, the (*-in [...]) style is only there in the leaf editors

1:10 bbloom: tomoj: still not 100% sure what you're saying... trying to say that there are some assoc, update-in, assoc-in, etc type functions that are missing? yes :-) phase ZERO is to reach feature parity with the kiama library... then i'll clojure-ize it more fully

1:11 tomoj: no, I mean it just looks like a completely different manner of composition

1:16 bbloom: tomoj: you mean how it uses the #() syntax for the actual changes? yeah. that's sorta the point: clean interop with normal clojure code. shouldn't need to have a totally different standard library for transformations. although, there will be the most common stuff in there to simplify common patterns

1:17 could for example do (:require [retree :as rt]) then (rt/everywhere (rt/dissoc :env))

1:17 tomoj: I just mean.. operations with semantic editor combinators tend to look like (op-in [lots of composition] #(some simple f %))

1:18 er, with SECs the op is always update

1:18 but rewrite just takes a function

1:18 maybe the application order is just different

1:19 (I mean (op-in t ...) of course)

1:21 bbloom: tomoj: ooooh, you're talking about your lib...

1:21 haha dude, we were totally talking past each other

1:21 what's the link to your lib again?

1:22 tomoj: I think I refheap'd something once, I don't actually have a lib

1:24 I think I like building up a single rewrite strategy like you do better

1:28 bbloom: tomoj: not my idea :-P stollen shamelessly from the fine folks who work on kiama

1:30 entertainingly enough, i stumbled across kiama when i was working on fipp, since they implement the same pretty pritner algorithm. however, they went with a lazy implementation, which is very awkward in an eager language like scala. i presume that kiama implemented the algo before the paper on the strict/generators approach was published

1:30 re-stumbled upon it again this weekend while i was looking for a better way to do some rewriting

1:31 and, even more entertainingly, they have attribute grammars too! which i was just talking about in here... but i didn't study their implementation yet: https://code.google.com/p/kiama/wiki/Attribution

1:32 tomoj: hmm, #(rewrite (all (all inc)) %) == (update-in* % [all all] inc)

1:32 (all (all inc)) solves one problem I posed today

1:34 * bbloom had two beers, so thinking is hard.

1:34 bbloom: him so what does (all (all f)) do ?

1:34 hmm*

1:34 i guess it does all children of all children?

1:34 so rewrites down skipping a level?

1:34 tomoj: (= [[2 3 4] [5 6 7]] (rewrite (all (all inc)) [[1 2 3] [4 5 6]]))

1:34 (if you add a vector? clause)

1:35 bbloom: yeah, the vector? clause is planned :-P haha

1:35 tomoj: https://www.refheap.com/paste/5cec0e559e2d3519f5b7160ef

1:35 some other problems I wrote down so far

1:36 bbloom: hmm, wanna think through them?

1:36 by line number:

1:36 #10 is just pass

1:36 tomoj: does zipping have any place in retree?

1:36 bbloom: #13 is (all #(inc 3))

1:36 tomoj: if not most of those will be irrelevant

1:36 bbloom: zipping as in zippers or as in (map x y) ?

1:37 tomoj: (map x y)

1:37 bbloom: you could use down-up to zip and unzip

1:37 muhoo: is there some way in clojurescript to introspect objects to find their methods/etc ?

1:38 tomoj: OH, down-up?!

1:38 bbloom: https://github.com/brandonbloom/retree/blob/master/src/retree/core.clj#L191

1:38 muhoo: it's really handy in clojure to be able to look in the repl to see wtf a java object actually is and what methods it has. it'd be great to have it in clojurescript for javascript

1:38 tomoj: I was reading something about down/up recently

1:38 didn't recognize it when I saw down-up

1:38 bbloom: tomoj: ?

1:38 lol i have no idea that down/up was a thing, lol

1:38 down-up is basically pre AND post fix

1:39 er pre and post traversal

1:39 tomoj: "continuations and transducer composition"

1:39 maybe it's just a coincidence

1:40 bbloom: *gulp* heady title right there, haha

1:40 WHAT HAVE I GOTTEN MYSELF INTO!?

1:40 :-P

1:40 tomoj: probably not the same thing

1:40 well shit everything is the same thing

1:40 bbloom: haha

1:40 well, transducers are like reducers with state

1:41 in theory, you can store state in the tree via down/up

1:41 ie you add a state accumulator and then remove it when you're done

1:41 but i'm sure there is a better/different way

1:42 i also want to have every combinator automatically record rewrites into metadata

1:42 maybe optionally

1:43 this way, you could have an after-the-fact debugger

1:43 you could step-backwards through the rewrites :-)

1:43 could have an undo combinator too!

1:44 tomoj: hmm

1:45 bbloom: i'm also thinking about how to handle dynamic restarts of rewrites. ie if something external changes the tree, can you cause the rewrites to restart from wherever they depended on the data that changed

1:45 no idea if that is feasible or not

1:46 tomoj: if that works, almost fully compiled down to raw DOM, with this thing optimizing itself..

1:46 :)

1:47 bbloom: tomoj: hahaha shhhh you're extrapolating from my other projects

1:48 my secret evil master plans must stay secret for a bit longer!

1:49 tomoj: I wouldn't be surprised if we wind up faster than some popular bare-metal-optimized js libs

1:52 bbloom: yeah, it's actually quite amazing how much persistent data structures buys you

1:52 kiama does an absurd amount of copying to do it's rewriting

1:53 and then it has this weird "same" function that attempts to do reasonable equality, but without immutability, there is no reasonable equality

1:53 tomoj: have you read any of the generic programming literature around folds/traversals?

1:54 bbloom: no

1:54 tomoj: oh, well, it passed before my eyes, not sure I can say I read it. feels very related to kiama though

1:57 which protocol will be the basis for all/one?

1:57 bbloom: huh?

1:57 oh, you mean for identifying "children"?

1:57 tomoj: I mean, will it just be a closed dispatch like clojure.walk? or will there be a protocol?

1:57 yeah

1:58 bbloom: i dunno yet

1:58 tomoj: and rebuilding

1:58 ?

1:58 I think that might be the same protocol I've been trying to think of lately

1:59 bbloom: here's the kiama Rewritable trait: https://code.google.com/p/kiama/source/browse/src/org/kiama/rewriting/Rewritable.scala

1:59 it basically is closed dispatch for standard case classes, tuples, maps, seqs, etc

1:59 and then if you have a custom type & want it to be rewritable, you inherit that trait

2:00 it's basically count/seq/into

2:00 tomoj: IReduce and IEmptyableCollection aren't enough?

2:00 bbloom: dunno yet, i punted on even the vector case for tonight

2:01 will revisit after clojure/west

2:02 one other thing to consider is that you may have a tree of maps where each map has a :children key and you might want to somehow override (ie dynamic var) the tree navigation

2:02 for example, consider Raynes' laser

2:02 it operates on XML nodes which have attrs and content

2:03 but i think it might be sufficient to say "OK, just don't use the everywhere combinator inappropriately" and not allow customization of children relationships

2:03 dunno yet

2:04 tomoj: (partial fixed-point (comp all (at :content))) ?

2:04 bbloom: something like that

2:04 i'm past the point of thinking though, so i'm gonna go to bed. you gonna be at the conference?

2:05 tomoj: no :(

2:05 next year

2:05 bbloom: bummer :-/ oh well, then we'll chat about this next week sometime when i get back to it

2:05 gnight all

2:09 tomoj: thanks for releasing retree

2:10 not bblöom: is the rate at which a dynamic value (!) will be sampled a reasonable use of metadata?

2:10 I hardly use metadata except for vars and type-hints since I usually decide that it should really just be data

2:44 hiredman: bbloom: kiama looks a lot like zippers

2:47 at least the traversal and tree rewriting bits, the main thing lacking when using zippers for rewriting is the sort of repeated pattern matching

3:43 drorbemet:

3:49 Raynes:

5:18 holo: hi

5:20 mzelinka: hello

5:21 holo: how do i find which lib uses x dependency? i know x, but i can't use lein deps :tree, because x artifact cannot be downloaded

6:08 carlocci: should I use openjdk or oracle?

6:09 I don't care for the license, but I actively dislike the prince of darkness

6:33 NeedMoreDesu: Can I get future's thread?

6:34 Hali_303: hi! is there a function similar to eclipse's "organize imports" in emacs?

6:36 scottj: Hali_303: I don't think so, but maybe checkout slamhound

6:37 carlocci: most things work fine on both

6:38 Hali_303: scottj: looks interesting,t hx!

6:40 NeedMoreDesu: I want a way to check if some future is current thread.

7:15 pdmct: Hi, can someone help me understand what is happening with the following?

7:15 a_run: hi, a newbie to clojure

7:15 do i need JDK to use clojure or is JRE enough ?

7:16 pdmct: I am trying to map a map into a function but I can't understand what is happening to my data structures'

7:17 Here is the code: (let [data (get @events (first (keys @events)))] (log/info "draw1" (apply str (concat "events:" @events))) (log/info "draw1" (apply str (concat "key: " (first (keys @events))))) (log/info "draw1" (apply str (concat "data: " data))) (unify data (fn [{:keys [host service metric ranges measures markers]}] (log/info "draw2" (apply str (concat "host: " host "service: " service "

7:17 xeqi: pdmct: can you use refheap.com or make a gist?

7:17 pdmct: hmm, sorry that doens't look do good

7:17 ok

7:18 xeqi: a_run: I believe you only need a jre for clojure itself

7:18 a_run: xeqi: thanks

7:19 pdmct: ok, here is the code and the output https://www.refheap.com/paste/12654

7:20 I don't understand why data is the way that it is -- it looks like a list of vectors

7:22 I should add this is actually clojurescript

7:23 xeqi: &(concat "data: " {:x 1 :y 2})

7:23 lazybot: ⇒ (\d \a \t \a \: \space [:y 2] [:x 1])

7:23 xeqi: &(apply str (concat "data: " {:x 1 :y 2}))

7:23 lazybot: ⇒ "data: [:y 2][:x 1]"

7:23 xeqi: when you do the concat to print it out it converts from a map to a seq of key value pairs

7:24 &(apply str "data: " {:x 1 :y 2})

7:24 lazybot: ⇒ "data: [:y 2][:x 1]"

7:24 xeqi: &(str "data: " {:x 1 :y 2})

7:24 lazybot: ⇒ "data: {:y 2, :x 1}"

7:24 xeqi: there we go

7:24 pdmct: ^

7:25 pdmct: xeqi: ok, thanks ... this has sidetracked me -- I'm not getting any value for host and service -- which is why I have the logs -- and I am not sure why

7:26 xeqi: I don't really understand what (fn [{:keys [host service ...]}]) is doing -- and it doesn't seem to work

7:27 xeqi: where does `unify` come from?

7:27 core.logic?

7:27 clojurebot: idiomatic clojure uses dashes to separate words

7:27 xeqi: clojurebot: thanks, you're awesome

7:27 clojurebot: I'm no man, and she's no lady!

7:27 pdmct: xeqi: no a visualisation framework C2 (clojurescript) -- I think it is basically does (unify data f) -> (map f data)

7:29 xeqi: I don't fully grok how the functions arguments are extract from the map (data)

7:30 xeqi: you don't need unify/map here

7:30 you could just call the function directly

7:31 &((fn [{keys [x y]}] [x y]) {:x 1 :y 2})

7:31 lazybot: java.lang.RuntimeException: Unable to resolve symbol: x in this context

7:31 pdmct: xeqi: I know it only has one element in the map -- once I get it working the map will have many

7:31 xeqi: &((fn [{:keys [x y]}] [x y]) {:x 1 :y 2})

7:31 lazybot: ⇒ [1 2]

7:33 xeqi: the :keys destructuring looks at the keys in the map argument and binds the symbol of those keys to the corresponding value in the map

7:33 pdmct: xeqi: I don't undertstand how that works, is it positonal or does :x map to x ?

7:33 xeqi: :x maps to the x symbol

7:33 .. the value of :x in the map get bound to the x symbol

7:33 pdmct: ok, thanks

7:34 so looking at the code -- if (unify data d) is actually (map f data) -- can you see why the values for host and service are nil?

7:35 xeqi: but right now with the (unify data ...) it tries to (map ... data), which converts the data map datastructure into a seq of k/v pairs

7:35 pdmct: *d f

7:36 xeqi: .. simplified examples of whats its doing:

7:36 (map (fn [x] x) {:x 1 :y 2})

7:36 &(map (fn [x] x) {:x 1 :y 2})

7:36 lazybot: ⇒ ([:y 2] [:x 1])

7:36 xeqi: vs

7:36 &((fn [x] x) {:x 1 :y 2})

7:36 lazybot: ⇒ {:y 2, :x 1}

7:38 xeqi: pdmct: you could either remove the unify/map and call it directly, or make (get @events (first (keys @events))) return a vector of maps

7:38 pdmct: ok, got it ... map applies the fn to each element of the map

7:38 Glenjamin: hi everyone, i'm using a lib that uses clj-http for oauth, and it's not quite working - is there a way to get debug output from a library i'm calling?

7:38 xeqi: pdmct: each key value pair

7:38 pdmct: so I could just wrap it in vec?

7:38 xeqi: yes, thats what I mean by element a K,v pair

7:39 xeqi: I'd do what makes sense for the data model, does an event have multiple data points?

7:40 pdmct: yes @events will be a map of "name" : {event data} pairs

7:43 xeqi: I'd prolly do something like https://www.refheap.com/paste/12655

7:44 Glenjamin: thats going to be specific to the library

7:45 Glenjamin: it doesn't look like it's got anything built-in

7:45 in other dynamic languages i'd probably usually open it up and hack in a debug output line

7:45 or monkey-patch something

7:45 or use a stepping debugger

7:46 any of those doable in clojure?

7:47 xeqi: hacking debug output difficulty will depend on your setup, not too difficult using nrepl.el and a repl, but would be harder for others

7:47 pdmct: xeqi: k thanks ... will give it a try

7:47 xeqi: monkey-patching is doable with &(doc with-redefs)

7:48 or the robert.hooke library

7:48 &(doc with-redefs)

7:48 lazybot: ⇒ "Macro ([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed... https://www.refheap.com/paste/12656

7:48 xeqi: ritz or eclipse has a stepping debugger, but I've not used them yet

7:51 Glenjamin: could you give me some pointers on hacking debug output in with the repo?

7:51 repl even

7:53 xeqi: Glenjamin: with nrepl.el you can M-. into the source of what you're calling, edit it, and C-c C-k to compile that file and use the debug version. In a pure repl I think you'd have to manually (in-ns ...) and then you should be able to (defn ..) the function you want to change, though could require a lot of copy paste

7:54 Glenjamin: ah, i see

8:04 xeqi: managed to get somewhere with in-ns and def on the repo, cheers!

8:04 damn autocorrect s/repo/repl/

8:06 ticking: any thoughts on how to idiomatically update multiple subpaths of a nested datastructure at once? say (update-in {:a [{:b 1}, {:b 2}]} [:a n :b] inc) -> {:a [{:b 2}, {:b 3}]}, problem is zippers don't work with maps, update-in only works on one path, tree walkers don't have the appropriate information at walk time, and deconstructing an entirely new datastructure while updating at the same time is tedious and error prone ^^

8:08 ambrosebs: ticking: you mean update them simultaneously with the same function?

8:08 ticking: ambrosebs yeah

8:09 ambrosebs: ticking: I often use the (-> map (update-in [:a] fn1) (update-in [:b] fn2)) idiom, but it's not "simultaneous".

8:11 ticking: ambrosebs, the above would also only work on a flat non nested map if I see this correctly

8:12 ambrosebs: ticking: not sure what you mean.

8:14 ticking: ambrosebs the code updates two elements of the map on the top level, say on a structure like {:a 1:b 2}, while the above data structure is nested {:a [{:b 1}, {:b 2}]}

8:16 mpenet: you can use for + reduce with an update in fn

8:16 ex: (reduce (fn [path] (update-in map path) )(for [x xs y x ...] [x y]) map)

8:17 not quite, my example is a bit wrong (the trailing map), but you get the idea

8:17 cgrand wrote something about that a couple of years ago

8:21 banisterfiend: hi, does anyone here know about lighttable? i know it's written in js/html5 but it's in a webview, what's the framework? cocoa? qt?

8:23 mpenet: ambrosebs: I managed to get check-ns to hang for a very long time (minutes, with jumps to 100% cpu), I tried to quickly annotate a very small project with few deps to isolate the issue, but same result. Could you have a look? https://github.com/mpenet/knit/tree/typed

8:24 ticking: mpenet, so you're basically iterating all paths at once?

8:25 mpenet: you construct a vector of path with for, then use it with reduce to apply update-in to your original map

8:26 ticking: mpenet, I see thanks, sounds like an interresting approach

8:26 mpenet: well my example work with assoc-in, not update in, you would need to construct vectors or args to update-in, but same thing

8:26 [[:foo :bar :baz] inc 1] etc

8:26 carlocci: scottj: thanks

8:27 mpenet: cgrand post was "flattening reduce", same approach for a different problem

8:27 http://clj-me.cgrand.net/2010/01/19/clojure-refactoring-flattening-reduces/

8:30 ambrosebs: mpenet: are you on master?

8:30 mpenet: ambrosebs: "0.1.7"

8:30 ambrosebs: I've probably fixed this, try 0.1.8-SNAPSHOT.

8:31 mpenet: I'll give it a try

8:31 ambrosebs: You'll need to lein install it.

8:31 mpenet: np, I have a local copy for greping around :)

8:31 ambrosebs: mpenet: It's a bit unsatisfying. What's actually happening is that jvm.tools.analyzer evals each form after analysing it, and it evals check-ns infinitely.

8:32 mpenet: quite funny

8:32 ambrosebs: mpenet: It sucks, but that's the only way I can figure out to make sure require's and use's are actually run at the right time during analysis.

8:33 mpenet: right

8:33 ambrosebs: mpenet: I've added a flag that tracks which namespaces are currently being checked, and to just return if already in progress.

8:33 mpenet: it seems to work now, thank

8:33 s

8:33 ambrosebs: mpenet: great

8:34 mpenet: I'll release 0.1.8, that's a pretty critical fix.

8:34 mpenet: yep, good idea

8:34 ambrosebs: mpenet: I'm in the middle of adding fn keyword argument support :)

8:34 ticking: mpenet, ah I see, thanks that should do the trick ^^, I wonder why noone has wraped that in a macro

8:36 banisterfiend, what do you wanna do? It doesn't seem written in qt the dylibs normally associated with qt are missing

8:36 ambrosebs: mpenet: does core.typed noticeably increase startup time for your app?

8:36 mpenet: ambrosebs: I noticed about kw args, I am waiting for it.

8:37 about startup time, mostly the reflection warnings slow things a little, but no big deal

8:37 ticking: banisterfiend, it looks like they use https://github.com/rogerwang/node-webkit

8:37 mpenet: ambrosebs: other than that, I don't really care since this happens at compile time anyway. As long as it is not incredibely slow

8:38 ambrosebs: mpenet: I'm really not too sure how slow it is. I don't know how to AOT compile core.typed either.

8:38 mpenet: good to hear anyway.

8:39 mpenet: ambrosebs: on knit, it's barely noticable, on hayt or alia it could be different, but I havent managed to successfully run check-ns on them yet, I am just using the repl and dummy fns until recently

8:39 carlocci: I would like to try out clojure: what is a web framework I can dabble in?

8:41 I was reading about noir, only to discover it as somehow deprecated

8:42 jonasac: carlocci: there is something called http://www.luminusweb.net/

8:42 it uses lib-noir i think

8:43 but just mixing and matching the libraries you need is pretty straightforward compared to other languages :)

8:45 carlocci: thanks, I'll check it out

8:45 mpenet: ambrosebs: I just realized I made a tons of error with HMap, and should use APersistentMap instead most of the time, again ann.clj is really helpfull to understand how things work.

8:45 carlocci: jonasac: what do you mean, compared with other languages?

8:46 the problem is that I would like to learn the language as I go, so I think a little bit more constriction would be helpful in the beginning

8:51 ambrosebs: mpenet: There's also a common misunderstanding with Seq*, Vector* vs. ISeq and IPersistentVector. You almost always want the latter.

8:51 mpenet: ambrosebs: yup, took me a while to get that too

8:52 ambrosebs: It's not really documented anywhere unfortunately.

8:53 clojure-new: Hello, i have to files: proj.core and proj.util, how can i use proj.util from proj.core?

8:53 proj.util defined like that (ns proj.util) (defn...)

8:54 thm_prover: is there a language, embedded inside of clojure, that (1) does not have access to Java, (2) is similar to Clojure, and (3) has lightweight coroutines? (i.e. does not require an entire java thread)?

8:54 clojure-new: When i trying to (ns proj.core (:use proj.util)) i'm getting file not found exception.

8:56 markmcconachie: Hey, any recommendations for learning materials for clojure?

8:57 mpenet: ambrosebs: am I missing the obvious here? https://gist.github.com/mpenet/854ebc2a644fd68f77a7

8:58 ambrosebs: mpenet: that's core.typed being a bit too strict.

8:58 clojure-new: It's a leiningen genrated project.

8:58 ambrosebs: mpenet: Perhaps casing :a to a Keyword might help?

8:58 mpenet: ambrosebs: but even if I use an union of values, it seems to fail

8:58 keyword returns the same error

8:58 ambrosebs: ok I'll have a look.

8:59 mpenet: ambrosebs: I was trying it here: https://github.com/mpenet/knit/blob/typed/src/qbits/knit.clj#L18

9:00 ahhh, maybe I need to namespace qualify it? since it's declared in another ns?

9:00 well, no it would work on my short example :/

9:01 ambrosebs: mpenet: is it important to know that looking up :ns gives you a NANOSECOND, rather than a TimeUnit?

9:01 mpenet: ambrosebs: I want to restrict the possible values, and I would have to reuse this on kw args later

9:01 ambrosebs: restrict which values?

9:01 mpenet: that's why I didn't go for HMap (if I understand)

9:01 keywords

9:02 no I don't want to check that :ns = TimeUnit/NS, just that the user doesnt use nanosec

9:02 :nanosec

9:03 ambrosebs: Right, you probably want '{:ns TimeUnit, :us TimeUnit, ...}

9:03 mpenet: ambrosebs: that's what I tried to say earlier, I will need this alias on kw args in another function later

9:04 that is why it is not a HMap

9:04 clojure-new: Oh, i see. I can't use '-' in filenames. (ns bla-bla) => bla_bla.clj

9:04 mpenet: in the schedule fn

9:05 clojure-new: Is there workaround for that? Sinc it's ugly to have underscores in anything.

9:05 ambrosebs: mpenet: you've lost me. :/

9:07 corecode: clojure-new: i think that is related to the jvm

9:08 clojure-new: corecode: Yeah, i think so too, but i don't know how to fix it.

9:08 corecode: don't

9:08 accept it

9:08 move on

9:09 john2x: how do I test a Ring handler that requires authentication?

9:10 gfredericks: authenticate with it? or use (with-redefs ...) to stub your auth function if you don't want to test that.

9:10 (with-redefs [authentic? (constantly true)] ...test the other stuff...)

9:11 * gfredericks runs off to the airport

9:11 Glenjamin: does anyone know of an easy way to generate an absolute url from a ring request map?

9:14 aha, full url is in ring.util.request-url

9:15 ticking: mpenet, looks like this approach only works properly with statically known indices, not when they are calculated from the size of a vector for example

9:26 jimkcar: where does the contrib zip-filter library now live?

9:30 ticking: jimkcar, clojure.data.zip?

9:32 jimkcar, https://github.com/clojure/data.zip/ and in case of doupbt http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go it contains a list of what migrated where ^^

9:56 _torn: hi - question about sequential destructuring

9:56 why would you want to use ":as foo" when you can just refer to the thing you're destructuring from?

9:57 I mean, :as creates a local binding -- but why is that useful?

9:57 jjttjj: if the thing you're binding is a longish expression?

9:58 _torn: ah right

9:59 jjttjj: and to not repeat yourself in general i guess. Like, the same reasons you would be binding the thing in the first place, but not you can do that and more in one compact line

9:59 xeqi: john2x: it sounds like you might want a cookie jar, I'd recommend looking at https://github.com/xeqi/peridot or https://github.com/xeqi/kerodon

10:00 _torn: does :as always grab the whole thing?

10:00 jjttjj: yup

10:01 _torn: this always was extremely useful for me getting used to destructuring: http://blog.jayfields.com/2010/07/clojure-destructuring.html

10:02 _torn: thanks for the link

10:03 john2x: xeqi: cool, thanks! curious, why make the 2 of them? at a quick glance, they seem to be very similar. (I think I'll go with peridot)

10:04 xeqi: john2x: peridot adds a cookie jar and a couple other nicities on top of ring-mock

10:04 kerodon adds html parsing and interaction like a human

10:04 peridot is better for api level stuff, like a edn or json api

10:04 since its not html based

10:06 john2x: ah got it. it seems peridot is exactly what I'm looking for.

10:06 Glenjamin: is there a guide to "idiomatic" indentation for clojure somewhere?

10:07 borkdude: Glenjamin yes: https://github.com/bbatsov/clojure-style-guide

10:07 Glenjamin: excellent, thanks

10:07 borkdude: how do you add an entry like ~style ?

10:08 ~anyone

10:08 clojurebot: anyone is anybody

10:08 borkdude: ~anybody

10:08 clojurebot: anybody is anyone

10:08 borkdude: lol

10:08 :)

10:08 xeqi: clojurebot: style is https://github.com/bbatsov/clojure-style-guide

10:08 clojurebot: In Ordnung

10:08 xeqi: ~style

10:08 clojurebot: style is https://github.com/bbatsov/clojure-style-guide

10:09 borkdude: xeqi tnx

10:09 xeqi: hmm... not sure if thats the right way, but it seemed to do something

10:10 jonasen: dnolen: ping

10:17 jimkcar: @ticking thanks. that was it.

10:21 ticking: jimkcar, np ^^

10:21 Scorchin: What's the recommended way to create functions that take optional parameters? e.g. (get-users) and (get-users 12)

10:23 skelternet: (get-users [] (blah blah ) [numusers] (blah blah blah)) ?

10:23 ticking: Scorchin I'd probably go with a multibody function (fn ([] 0) ([n] n))

10:24 Scorchin: thanks

10:24 dnolen: jonasen: pong

10:25 jonasen: dnolen: anything that I need to do to get the core.logic.unifier patches applied?

10:26 or have you not had time to look at them yet?

10:26 dnolen: jonasen: nope, they look good. Just want to cut 0.8.0 first

10:27 then I'll apply it, and see if there are other similar fixes that should go into 0.8.1

10:27 jonasen: dnolen: ok. I tought you released that already

10:27 dnolen: jonasen: no not yet.

10:28 Glenjamin: could someone help me out with laying out this macro? I can't figure out how to make it readable! https://gist.github.com/glenjamin/548670fe5855c7943d81

10:28 jonasen: dnolen: I'd like to release my new lib to clojars but I'll wait for 0.8.1 as it depends heavily on the unifier

10:31 dnolen: jonasen: new lib looks cool

10:33 skelternet: Glenjamin: I got nuttin' for the formatting.

10:33 jonasen: dnolen: I'm very happy with how it turned out. It'll replace the kibit rules as it is much more powerful. No more need to write monstrosities like https://github.com/jonase/kibit/blob/master/src/kibit/rules/misc.clj#L65

10:33 skelternet: Glenjamin: I think it is as readable as is

10:34 Glenjamin: unless we can break that function out some how.

10:36 Glenjamin: skelternet: that's what i'm wondering, it feels like i'm doing too much in the let binding

10:38 edw: Glenjamin: I just commented. It seems like the code that is supposed to simplifies things just makes things more complicated.

10:39 Glenjamin: does the binding resolve to the original function?

10:39 i just assumed doing that would recurse and break >.<

10:40 edw: The value is evaluated beforehand.

10:42 I just commented again. In general you should do as little work in the macro proper.

10:42 dnolen: jonasen: hehe, that's good to hear :)

10:43 edw: Glenjamin: You could even put the LET over the LAMBDA, er, DEFMACRO.

10:44 Glenjamin: thats much clearer!

10:45 edw: Glenjamin, thanks, but you should also make sure it works.

10:46 Glenjamin: i can follow what's going on nwow - so should be able to sort it

10:46 will probably pull the map out as its going to get more complex when i change insecure to a custom truststore

10:48 hrm, thats infinitely recursing

10:52 edw: Glenjamin: One more try in your comments.

10:59 Glenjamin: edw: getting issues when using the macro now, i've updated the gist to something that'll run the the repl

10:59 Scorchin: Anyone used betamax to mock clj-http requests? If so, do you know how you're supposed to handle 'accept' headers? e.g. my clj-http request looks like this: (client/get url {:accept :json})

10:59 Glenjamin: it says this: IllegalArgumentException No matching ctor found for class http$eval332$f__333 clojure.lang.Reflector.invokeConstructor (Reflector.java:163)

11:00 Scorchin: My betamax mock works fine without the {:accept :json}, but I'd like to provide the accept header

11:02 edw: Glenjamin: your original post function takes zero arguments.

11:03 Also, with your http-extras, the ^:private is annotating the value and not the var.

11:21 Glenjamin: edw: sorry to keep bugging you, but i don't really understand what the No matching ctor error is trying to say - i've fixed the things you mentioned, but still getting that error when calling the macro

11:22 are the vars in the let binding available in the scope of the expanded macro when used this way?

11:23 edw: Let me check something out…

11:27 Glenjamin: yeah, seems to work when i move the let back inside the macro expansion

11:32 edw: Glenjamin: please consult my latest comment.

11:33 Glenjamin: edw: awesome, makes sense

11:34 any idea why it can capture orig-http, but not f?

11:36 edw: Glenjamin: I updated it yet again, just to show it in action.

11:40 jjido: jjttjj: I saw this link you sent earlier about destructuring

11:40 (let [{the-x :x the-y :y} point]

11:40 (println "x:" the-x "y:" the-y))

11:43 I like how it reads. Makes me think the syntax I use in my language may not be as readable. Are there downsides to the syntax?

11:54 Glenjamin: edw: weirdly, when i tried that latest version, it didn't work with the real http/post - works with the let inside the macro and is still pretty readable, so going to stick with that

11:55 cheers for all the help!

12:08 bbloom: hiredman: kiama relies on scala's pattern matching by type. my plan with retree is to omit pattern matching entirely from the base library, so that a pluggable pattern matching system can be used

12:09 hence my questions about the nth exceptions with destructuring.... i kinda wish it didn't do that, so that there was a cheap free when-let style pattern matching baked in... *shrug* oh well

12:10 my thought is that there are other useful syntaxes for patterns, such as CSS selectors or XPath queries that can be encoded as EDN and plugged into retree

12:10 depending on the type of tree you're rewriting

12:12 ravster: hello all

12:32 clojure-new: Does clojure.jdbc provide sql injections protection?

12:33 with-query-results results ["select * from bla where ?" evil-code]

12:33 Is it secure?

12:37 tomoj: clojure-mode's indentation of hiccup bugs me

12:48 augustl: anyone got a favorite "getting started with Clojure repls in emacs" article? :)

12:51 ticking: augustl, the nrepl.el github page has a list of all the commands^^https://github.com/kingtim/nrepl.el

12:51 augustl, also if you are a newcomer to emacs I highly recommend emacs-live it's a pretty good emacs starter kit

12:52 https://github.com/overtone/emacs-live all you do then is go to your project do an M-x nrepl-jack-in

12:54 and then you get your regular repl, like your used to know, or you can evaluate forms in files via C-M-x and other various commands ^^

13:03 augustl: ticking: thanks :)

13:04 swank is the old one, and nrepl is new and shiny, right?

13:05 * Bronsa still uses swank

13:07 tomoj: bbloom: it occurs to me that the parts of the one/all protocol I was thinking about are basically the children/make-node arguments to zipper

13:09 I wonder if it's a coincidence that both things are called "zipping" -- given zippers a b you can implement (map f a b)-style zipping?

13:12 ticking: augustl, yes, nrepl.el uses clojures nrepl facility directly

13:17 augustl: inside a -main function invoked via "lein run", is it possible to read out the leiningen environment somehow?

13:17 what I really want to do: start a nrepl server in that main function when I'm starting with "lein run" and the development profile, but not when running it with java -jar

13:18 ticking: augustl you could simply run it by lein repl

13:18 and then M-x connect-nrepl

13:20 tomoj: another workaround would be to have two -mains in two namespaces and set :main to the repl one in the dev profile?

13:22 ticking: yeah right repl won't start the main

13:22 sorry, wait a sec

13:23 augustl: ticking: I want to connect to a repl that lives inside an existing process, not a "lein repl" process

13:23 tomoj: trying to figure out how to call a -main from another -main :)

13:23 ticking: augustl yeah right

13:24 augustl: I guess it's easier to put the actual call to a separate function and call that from both -main functions

13:24 tomoj: :injections [(require 'com.example.foo)] :repl-options {:init (com.example.foo/-main)} ?

13:25 why care whether it's a "repl" or "run" process, as long as it's running your -main?

13:25 augustl: yay, epheremal ports works

13:26 tomoj: the problem was that my current -main contains lots of logic, that I would need to invoke from the other -main for dev. But putting the logic elsewhere makes more sense

13:26 ticking: you could also use clojure.main with the --repl flag and a --main provided

13:27 http://clojure.org/repl_and_main

13:27 tomoj: hmm, is that how you use :injections?

13:27 or would you just do {:repl-options {:init-ns com.example.foo :init (-main)}}

13:27 ticking: *but I don't know how that would work out ^^

13:29 augustl: I think it's better to just have two different mains with no logic other than dispatch

13:29 where the "main" main only starts the system, and my dev main starts a repl, the system, and whatever

13:35 is it possible to have nrepl in emacs automatically reconnect?

13:38 ticking: augustl, as in disconnect then reconnect?

13:38 for your case I don't think so

13:38 you could though write an elisp function that polls that for you ^^

13:39 https://github.com/kingtim/nrepl.el/pull/56

13:39 hrm

13:49 augustl: I guess I'll rarely stop the repl process when doing actual dev

14:01 how can it be that simply importing something causes side effects? Importing org.lwjgl.opengl.Display causes a box to appear in the OS X dock, even if I don't call anything.

14:03 and no, I don't have any (def foo 123) that could cause side effects when compiling :) All my calls are inside a function

14:25 bpr: augustl: i don't know what's necessarily going on in your particular case, but I've found that importing anything that depends on java.awt.* will cause the dock (app switcher) to show a generic application icon

14:28 augustl: for cli apps (or libraries) i've found that putting ["-Djava.awt.headless=true"] into your :jvm-opts in your project file can fix that

14:28 augustl: if your app does need a GUI, i'm not sure if that will work. I've nvr tried it

14:32 augustl: bpr: ah, that's probably it then. I guess lwjgl uses awt to draw the window

14:32 bpr: the gui will load even if I just start a "lein repl" :)

14:32 so it's a bit annoying..

14:32 bpr: yup

14:33 i've had it pop up during a build (ie. lein uberjar).

14:38 augustl: on a slightly related note, anyone got a opengl library for the JVM to recommend? lwjgl is good enough, but much larger than what I need (I only need OpenGL itself)

14:50 refs lets you do coordinated writes to multiple refs. Is there also a way to do coordinated reads from refs? If I sequentially read @foo, @bar, @baz, I might values from different transactions/writes, right?

14:50 s/sequentially read/sequentially deref

14:51 jjjddd0: Hi all, what is the recommended session middleware for a luminus app? There are lots of middlewares avail. out there but I don't really understand what is different about them ?

14:53 Eg. ring/wrap-session, noir.session, sandbar/wrap-stateful-session... etc

14:53 augustl: what's a luminus app?

14:54 ravster: what do they mean by "post-order traversal of form" in the docs for a post-walk?

14:55 augustl: jjjddd0: I use the build-in session stuff in ring, if that helps ;)

14:56 jjjddd0: augustl: thanks! http://www.luminusweb.net/

14:59 augustl: jjjddd0: I use cookies for session storage, too

15:09 edtsech: jjjddd0: luminus uses lib-noir internally, you can use noir.session http://yogthos.github.com/lib-noir/noir.session.html#var-get-in

15:10 jjjddd0: edtsech: thanks! I just realized that the luminus site had a lot more documentation that I though

15:14 tyler__: i just had the realization that url query string are a lot like logic programming e.g. http://example.com/some/resource/where?a=1&b=2

15:14 looks a lot like [:find ?a ?b :where [1 ?a] [2 ?b]]

15:14 wonder if i can take that somewhere

15:18 tomoj: how do you represent [?a :foo ?b]?

15:26 smnirven: anybody out there use crypto-password?

15:28 dnolen: jonasen: ping

15:30 smnirven: anybody else trying to get crypto-password 0.1.0, and finding that there's only a snapshot version on clojars?

15:33 jonasen: dnolen: hi

15:37 dnolen: jonasen: patch applied! as far as LOGIC-118 I think prep* should be fixed.

15:40 jonasen: dnolen: I thought prep* should only handle ?x and (foo bar . ?y) and relying on walk-term to do the actual tree walking

15:51 dnolen: jonasen: prep* takes any expression, so I think it should handle it

15:51 Glenjamin: hi guys, i'm trying to figure out a nice way of handling errors in a compojure app without cluttering my routes - are there any good examples of open source sites I can look at?

15:52 smnirven: Glenjamin: do you mean exceptions or errors?

15:52 Glenjamin: any error conditions i guess, but specifically exceptions at the moment

15:53 for example, i'm making an http request inside a let binding, if it fails i'd want to show a friendly page specific to that route - but putting a try..catch inside the binding is ugly, and putting one around the whole route seems a bit heavy handed

15:53 smnirven: I use a wrap-exceptions middleware

15:53 in my "controller" code, I validate parameters, for example

15:54 and if there's a problem, throw an ex-info with a specific response code and message

15:54 Glenjamin: and have the middleware decode that into a specific method?

15:55 my exact example is calling request-token in an oath workflow - if it fails I'd rather show a "sorry, we can't connect" than the generic "unexpected error" page

15:55 smnirven: have the middleware catch any exception, and check for any ex-data that was specified when the exception was thrown

15:55 jonasen: dnolen: I'll take a second look

15:56 jtoy_: hi all!

15:56 smnirven: Glenjamin: https://github.com/clojure/clojure/blob/master/changes.md#24-clojurecoreex-info-and-clojurecoreex-data

15:58 Glenjamin: so i'd have my oauth/authorise function catch the raw http error and turn it into something my app can handle, but doesn't that lead to binding the app to the various exception types?

15:58 binding in the coupling sense, i mean

16:01 smnirven: Glenjamin: you mean binding the app to the specific kinds of exceptions that could get thrown by the http client?

16:02 Glenjamin: yeah, it might just be the way i'm looking at it

16:02 smnirven: I would have the code that calls oauth/authorize wrapped in try catch (make sure you catch Throwable, not Exception)

16:02 in the catch throw a ex-info

16:03 with specific instructions for the middleware

16:04 Glenjamin: smnirven: ok, cool - that makes sense

16:04 the other case that comes to mind is if on a "save" action, theres a database connection failure

16:05 you'd usually want to preserve the context, and redisplay the form to try again - i guess in that case just wrap the route in try..catch?

16:06 i suppose i could do some sort of let-catch macro if i run into that

16:07 smnirven: Glenjamin: https://gist.github.com/smnirven/5183366

16:07 Glenjamin: that's akin to what I do

16:11 amalloy: Glenjamin: if you're using a reasonable http client, you can tell it to return an error-map instead of throwing an exception

16:12 Raynes: clj-http can make this happen.

16:12 Glenjamin: clj-http is what i'm using

16:12 it's the translation of http code -> application error with context that i'm trying to piece together

16:13 i'll gist an example, it's quite plausible i'm over-thinking it

16:14 https://gist.github.com/glenjamin/81983d5a18a96e022196

16:15 multiple bindings in let with complex failure conditions, in general i've always tried to keep try..catch scoped as tightly as possible

16:16 so an exception on the DB call would want to be handled differently to failures on external http calls, but still specific to the route

16:17 i guess the idea is to wrap up those calls behind something that captures the domain, and turn them into exceptions with context for the domain that the controller can decide what to deal with?

16:23 smnirven: Glenjamin: here's what I would do, combined with that middleware thing I showed you earlier https://gist.github.com/smnirven/986ffd6ef66010df9d79

16:24 Glenjamin: right, that makes a lot of sense

16:24 thanks!

16:24 smnirven: no prob

16:25 Frozenlock: Is there an 'official' tool to make logs with ring/compojure?

16:25 smnirven: clojure.tools.logging

16:25 Frozenlock: https://github.com/clojure/tools.logging

16:26 Frozenlock: smnirven: Thanks!

16:46 clojure-new: Hello.

16:47 brehaut: clojure-new: hi

16:47 Frozenlock: Welcome.

16:48 clojure-new: Guys, can you try to guess why this happening? I have string, and i'm trying to insert it in h2 db, rowtype is varchar, println prints string just ok but when it inserts string in db, string becames like this:

16:48 tyler__: can you add tagged literals after cloure has already started?

16:48 clojure-new: aced000573720020636c6f6a7572652e6c616e672e50657273697374656e745374727563744d6170da82a8a2fdf1ac2f0200044c00055f6d65746174001d4c6

16:48 I'm just don't know how to debug it...

16:49 When i'm switch type from varchar to carchar(1024) i'm getting this:

16:50 Exception in thread "main" org.h2.jdbc.JdbcSQLException: Value too long for column "DESCRIPTION VARCHAR(1024)": "'aced000573720020636c6f6a7572652e6c616e672e50657273697374656e745374727563744d6170da82a8a2fdf1ac2f0200044c00055f6d65746174001d4c6... (10060)";

16:50 brehaut: ~helpme

16:50 clojurebot: A bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.

16:50 brehaut: clojure-new: guessing doesnt help anyone

16:50 clojure-new: your best bet is to put a snippet on refheap or gist and link to that.

16:51 clojure-new: however, it is nearly clojure west so a lot of people who might be able to answer your question may not be here atm

16:53 tyler__: why would i use a tagged literal instead of just calling a function and passing in args?

16:53 im not grokking their utility

16:53 dnolen: tyler__: tagged literals are about data exchange

16:53 tyler__: ....

16:53 * tyler__ tries to understand what that means

16:54 tyler__: like over the wire data exchange?

16:54 brehaut: tyler__: say i send you a blob of edn data, and i ahve tagged something as an #inst. your code might use java.util.Date etc, but mine uses jodatime. tagged literals mean that you dont have to worry about my implementation decisions, and we can still agree on a format for a specific datatype that wasnt originally in the transfer format specification

16:55 tyler__: brehaut: ah brilliant

16:55 so its for people using my data who aren't me

16:55 brehaut: alternatively future you in a different project

16:56 tyler__: brehaut: future me is not me ;)

16:56 brehaut: or the same project when you internal implementation changes

16:56 hyPiRion: Essentially it means that it's "boxing" and "unboxing" for you, so that you don't have to handle it yourself.

16:56 ivaraasen: tagged literals is the best thing since smoked bacon

16:56 clojure-new: Oh, i've figured it out, my string wasn't string at all, sorry for desturbance. :)

16:56 tyler__: everytime someone says "box" now i think of monads heh

16:56 brehaut: clojure-new: lol. not a problem

16:57 tyler__: shake that!! monads are not boxes

16:57 tyler__: brehaut: i know i never said it was voluntary

16:57 brehaut: lol fair

16:57 ivaraasen: brehaut: yeah, they're burritos

16:57 brehaut: in this community they are writing desks

16:59 tyler__: speaking of joda time, why doesn't #inst natively use joda it seems everyone uses it. maybe its complecting rather than composing

16:59 but you could just add it to clojure.core and that fixes that ;)

17:00 brehaut: tyler__: big long mailing list thread about exactly the that exists :P

17:00 * tyler__ searches for link

17:01 tomoj: add a dependency on joda time to clojure.core??

17:01 lazybot: tomoj: Definitely not.

17:01 tomoj: (inc lazybot)

17:01 lazybot: ⇒ 15

17:02 tomoj: heh, lazybot always has your back on incredulous stares

17:03 hyPiRion: really??

17:03 lazybot: hyPiRion: Definitely not.

17:03 tyler__: is this a predicate function?

17:04 doh

17:04 is this a predicate function??

17:04 lazybot: tyler__: Uh, no. Why would you even ask?

17:04 clojurebot: I don't understand.

17:05 tyler__: do the bots use core.logic to do the nlp?

17:05 brehaut: no

17:05 hyPiRion: no

17:05 Bodil: tyler__: Nothing but core.logic would be powerful enough to match #"\?\?$"

17:06 tyler__: heh

17:06 brehaut: #"\?{2,}$" ;)

17:06 * chetoo www.zonalatina.org enten Chat Gratis - Chatea con gente y has amigos en nuestro chat online, liga con gente de todo el mundowww.zonalatina.org Chat gratis con chicos y chicas de tu ciudad. Conoce amigos y liga en nuestro chat gratuito conoce gente de todo el mundo y diviertete chateando irc.zonalatina.org /server irc.zonalatina.org /server -m irc.zonalatina.org gracias

17:06 brehaut: question???

17:06 clojurebot: tufflax: there was a question somewhere in there, the answer is no

17:06 lazybot: brehaut: Oh, absolutely.

17:06 Bodil: brehaut: Whatever, showoff. :)

17:06 brehaut: Bodil: im pretty sure it has different answers for different numbers of questionmarks

17:07 (negative and positive)

17:07 tyler__: does it????

17:07 brehaut: foo!!

17:07 huh, maybe its only 2 and 3 now

17:07 tyler__: are you sure???

17:07 lazybot: tyler__: Yes, 100% for sure.

17:07 tyler__: ok

17:08 Bodil: who is best pony???

17:08 lazybot: Bodil: Oh, absolutely.

17:08 brehaut: a??

17:08 lazybot: brehaut: Definitely not.

17:08 Bodil: That wasn't very exciting. :)

17:08 amalloy: Bodil, brehaut: just 2 or 3

17:08 brehaut: sorry

17:19 technomancy: tyler__: #inst not using joda was a horrible mistake IMO

17:21 ivaraasen: Bodil: loving Catnip btw

17:23 Bodil: ivaraasen: Thanks!

17:23 brehaut: technomancy: an extension of java.util.Date being a horrible mistake?

17:33 ravster: what does "No acceptable resource available" mean when trying to use liberator? I have my route as " (GET "/" [] (l/resource :handle-ok {:body "hello world"}))"

17:33 manud: #sml

17:35 ravster: I'm trying to move my project to using liberator, and I don't understand why in the docs it says to use resource at some points and defresource at others.

17:45 tieTYT2: i'm just getting started with clojure. Sometimes in my repl the prompt becomes " #_=>" and seems to stop responding. How do I get rid of this?

17:46 hiredman: that is a feature of the repl library lein uses, not of clojure proper

17:46 brehaut: tieTYT2: that means that you have an incomplete s experession

17:46 eg if you open a list, vector, map, set or string and dont close it

17:46 hiredman: basically it means you hit enter on a incomplete expression

17:47 tieTYT2: how do I get back to the user prompt?

17:47 i don't care if this errors

17:47 brehaut: close the expresssion

17:47 hiredman: most likely a missing quote or missing bracket

17:47 brehaut: ^C may also get you back in reply

17:47 tieTYT2: i typed ) like 5 times and ' a few times

17:47 metellus: there's also ] and } and "

17:47 hiredman: it will never be '

17:47 brehaut: and }

17:47 tieTYT2: ^C exits out and it take a few seconds to startup again which is kind of annoying

17:48 hiredman: clojure does use ' in matched pairs for anything

17:48 doesn't

17:48 smnirven: anybody use rotary for dynamodb?

17:50 tieTYT2: this seems to happen when I paste multi-line code into the repl

17:50 even if it's valid

17:50 i'm following this example: http://java.ociweb.com/mark/clojure/article.html#Vars

17:50 the first defn is causing it

17:51 hiredman: I doubt it

17:52 tieTYT2: i can paste it in at any time and get it to change my prompt

17:53 hiredman: tieTYT2: do you hit enter after that?

17:53 tieTYT2: no

17:53 hiredman: well do that

17:53 tieTYT2: ah ok that fixes it

17:53 hiredman: because it is mutliline input

17:53 the first line is not a complete expression

17:53 tieTYT2: i guess it needs a blank line

17:53 oh i get it

17:53 the weird thing is that it gives me the prompt before I hit enter

17:54 so it made me think that it processed that line

17:55 ravster: gah, even the most basic hello world isn't working with liberator for me. I'm doing "(GET "/" [] (l/resource :handle-ok "hello world"))", which is basically what the example is. Any ideas?

17:58 thm_prover: does ":when" in domonad (in contrib.moands) require a monad that supports m-zero and m-plus?

17:59 brehaut: thm_prover: im pretty sure it required m-zero

18:00 thm_prover: m-zero represents the failure state / implicit else branch of the :when

18:01 thm_prover: brehaut: awesome! that explains alot, I was wondering wtf happened when ":when (...)" failed

18:01 brehaut: ha yes

18:02 thm_prover: brehaut: "When he heard this, he left very sad, because he was a man of great wealth." <-- is this because in clojure, it's not clear who owns what?

18:02 brehaut: thm_prover: thats a quote from the bible

18:03 thm_prover: yes, but I was trying to make sense of it in the context of concurrency

18:03 and didn't realize there were two followsup lines

18:04 brehaut: the wealth is mutable state in technomancy's version

18:04 tyler__: i was playing with a bot and my buddy who knows about edn but didn't realize it was as subset of clojure. he was like "how do you get your output to convert to edn" and i suddenly had pity for everyone who's code isn't data

18:06 thm_prover: is m-seq just "(reduce >>= ...) " ?

18:07 brehaut: its been a long time since i used it but yes i think so

18:08 thm_prover: (source m-seq) ;)

18:08 thats clojure.repl/source

18:10 thm_prover: brehaut: nice, thanks!

18:12 tyler__: im 4clojure i think we should rename the diffculty from easy-hard to simple-difficult because this one is supposedly "easy" but i have no clue how to do it

18:12 s/im/on/

18:12 s/simple-difficult/simple-complicated/

18:24 tgoossens: paredit sometimes really screws up (probably me)

18:27 tieTYT2: i don't know what I'm doing yet, but if I type "lein classpath", it includes clojure-1.4.0 instead of 1.5.1 which I just downloaded. Is this something to be concerned about?

18:28 it's using a clojure-1.4.0 from my local maven repository. I assume it downloaded that on its own

18:31 tomoj: suppose you have a bunch of integers in some known bounds, but the distribution of the integers within the bounds is not known. you have a function which takes an integer k and returns a seq of the integers greater than or equal to k. can you draw approximately uniform samples (with and/or without replacement)?

18:31 ryanf: does emacs paredit have a command for "move the current form to the left/right in its containing list"?

18:31 vim paredit doesn't seem to, and that's like the main thing I was expecting it to do

18:31 tomoj: uh, without just going and counting everywhere

18:31 brehaut: tieTYT2: you dont download clojure versions yourself, you specify them in your dependancies. if an older version is being used its because a lib you depend on is forcing it

18:31 tomoj: ..or pulling in the whole seq into a vec and using rand-nth

18:33 tieTYT2: brehaut: i see. So the project.clj is using 1.4.0. Why does it do that by default? Shouldn't it use the latest by default?

18:33 brehaut: because the default is based on a template that ships with lein; a newer lein will use a newer template, but 1.5 is only a couple of weeks old

18:34 tieTYT2: its a fairly safe assumption that if you dont know how to change the project.clj dependancies to a newer version of clojure, you probably dont know enough clojure to need the newer version

18:35 tieTYT2: brehaut: i see. Well i've been learning clojure for 2 hours now. Should I concern myself with this? I created a clj script that puts a manually downloaded clojure-1.5.1.jar file in the classpath when it runs. But lein seems to be using 1.4.0. I don't knwo what trouble i could get myself into by doing this

18:35 st3fan: i'm having problems with println .. when i run code from the nrepl, println works fine, *except* when I println from a map or for .. not sure what is happening

18:36 brehaut: tieTYT2: well thats wrong. lein manages it for you

18:36 it being the classpath

18:36 tieTYT2: brehaut: I'm just following this tutorial: http://java.ociweb.com/mark/clojure/article.html#Vars

18:37 it told me to use the clj script, but it didn't tell me how to make the clj script. I googled separately and found a version on the web but it asks for the path to the clojure.jar

18:37 st3fan: maybe i should use a real logging framework

18:37 brehaut: tieTYT2: a clj script is a very old way of using clojure. use lein as the front end and stop using the script

18:38 tieTYT2: ok i'll delete that, thanks

18:38 amalloy: ryanf: sorta, although "the current form" is too vague to act on. in (foo (bar (|baz) (blah)) (bam)), what is the current form? baz, (baz), (bar (baz (blah))), and (foo (bar (baz) (blah)) (bam)) are all "current"

18:39 xeqi: tieTYT2: theres some more current attempts at guides to clojure at http://clojure-doc.org/articles/content.html

18:39 amalloy: the command you probably want to look at is transpose-sexps

18:40 tieTYT2: xeqi: should I read this instead?

18:41 this does seem to be a better tutorial

18:41 thm_prover_: is there a way to get lightweight clojure threads / coroutines via algo.monads in clojure?

18:42 ryanf: amalloy: I guess that's true. I wouldn't mind having to have the cursor on the outermost paren though

18:42 but yeah that sounds promising, I'll look into it, thanks

18:42 brehaut: thm_prover: im suspicious that monadic coroutines would not be what you want in clojure; the lack of tail call removal impedes that kind of thing

18:43 tgoossens: can someone think of useful clojure constructs / libraries for what i'm trying to do: simulator for robot. It must be able to execute a command which must be interruptable at any point.

18:43 thm_prover_: is there no way to combine it with trampolines ? :-)

18:43 companion_cube: thm_prover_: in which logic do you prove theorems? :]

18:43 thm_prover_: Coq

18:43 companion_cube: I see

18:46 thm_prover_: brehaut: how about http://www.intensivesystems.net/tutorials/cont_m.html ?

18:46 brehaut: thm_prover_: you'd want to ask jimduey or pehaps hiredman whether they blow stack or not

18:47 thm_prover_: hiredman: ^

18:50 brehaut: holy sh** the article I was reading is by jim duey

18:50 brehaut: yes

18:51 thats why i said to ask him :P

18:51 he's also the single most enthused about monads person in the clojure community

18:52 xeqi: tieTYT2: I haven't kept up with the documentation project, but I'm sure antares_ would enjoy hearing any feedback since you're in the target demographic (new to clojure)

18:53 st3fan: grr i now switched to logging .. when i simply (myfunction) then I see my info logging go to *nrepl-server* but when i (def foo (myfunction)) nothing is logged

18:53 what. is. going. on.

18:54 thm_prover_: brehaut: I think the only thing I can do to make my work mmore black magic, is to use continuation monad together with minikaren

18:59 tyler__: how do i make a for unlazy?

18:59 or eval all results

18:59 brehaut: tyler__: use doseq

18:59 Glenjamin: does anyone know of a library that provides a macro for catching exceptions based on matched ex-data?

19:00 tyler__: ah looks like i have to wrap it in a vector

19:01 ryanf: using midje, is there an idiomatic way to store intermediate results so I don't have to include all of the setup in each fact?

19:01 xeqi: Glenjamin: slingshot ?

19:01 https://github.com/scgilardi/slingshot

19:02 Glenjamin: i'm using clj-http, which throws an (ex-info), afaict slingshot needs me to be using try+/throw+

19:02 brehaut: thm_prover_: fwiw, i recall that algo.monads' state-m has a couple of things that would be functions in haskell implemented as macros to get around the stack frame limits

19:03 ryanf: oh, I can use def inside the (fact) call. that helps.

19:03 tyler__: brehaut: my function returns a value though, it looks like doseq is ignoring return value

19:03 brehaut: tyler__: is the value a sequence?

19:03 xeqi: I though try+ worked with normal throw

19:04 tyler__: brehaut: yes

19:04 xeqi: also, clj-http mentions compatibility with slingshot https://github.com/dakrone/clj-http#exceptions

19:04 brehaut: tyler__: doall then

19:04 Glenjamin: xeqi: ah, you're right

19:05 thm_prover_: brehaut: does continuation passing style transforms give me co-routines?

19:05 if so, this soudns like the type of thing that should already be available as a mcro

19:05 *macro*

19:05 brehaut: thm_prover_: CPS gives you everything ever

19:05 thm_prover_: as coroutines are a subset of everything ever, yes they can

19:05 thm_prover_: I heard it solves the halting problem in O(1) time

19:06 brehaut: everythign ever was implicitly within the scope of computable things

19:07 Glenjamin: xeqi: in fact, i was completely wrong - it's using throw+

19:10 benedikt: i'm missing "clojure-jack-in" from emacs

19:10 i have clojure-mode

19:11 thm_prover_: brehaut: have you played with https://github.com/swannodette/delimc ?

19:12 scottj: benedikt: deprecated I believe in favor of nrepl-jack-in

19:12 benedikt: scottj: i dont have that either :P how do i get it?

19:12 scottj: benedikt: gogole nrepl.el

19:13 hyPiRion: $google nrepl.el

19:13 lazybot: [kingtim/nrepl.el · GitHub] https://github.com/kingtim/nrepl.el

19:13 hyPiRion: ^

19:13 brehaut: thm_prover_: not in a very long time

19:13 benedikt: scottj: pulling it from the marmelade repo

19:15 ryanf: if I have a structure like (def foo {:a [{:b 1} {:b 2}]}), is there a function s.t. (____ foo [:a :b]) returns [1 2]

19:15 or similar

19:18 benedikt: scottj: thanks

19:19 thm_prover_: https://github.com/swannodette/delimc <-- why is (@cont3 10) 15 rather than 13 ?

19:25 dnolen: thm_prover_: I should probably just get rid of delimc, mostly was an experiment porting Common Lisp to Clojure

19:26 thm_prover_: dnolen: what would you recommend?

19:26 I just want lightweight threads / coroutines in Clojure :-)

19:31 dnolen: thm_prover_: probably not going to happen. I think most of the coroutine stuff built on top of delimited continuations in Lisp ended up performing terribly.

19:31 thm_prover_: I looked into that stuff quite a bit when I was writing delimc

19:32 thm_prover_: so I want to simulate lots of micro threads

19:32 and for agents, I end up writing "state machines"

19:32 when I'd really prefer to write litle threads that block

19:32 does Clojure basicaly not suppor the actor model?

19:32 scottj: ryanf: not built-in afaik, for that specific case (((fn [m [a b]] (map b (a m))) foo [:a :b])

19:32 thm_prover_: dnolen: ^

19:33 SegFaultAX: dnolen: Don't get rid of it. Just make sure the documentation (README, wiki, whatever) reflects what it is accurately.

19:33 Bodil: thm_prover_: You can use Akka from Clojure.

19:33 thm_prover_: Just saying. :)

19:33 ryanf: scottj: oh, ok, thanks. I ended up just doing (map :b (foo :a)) and not worrying about generalizing it

19:33 dnolen: SegFaultAX: sure

19:34 SegFaultAX: dnolen: I say this as someone who has dumpster dived through quite a lot of your code. :) Currently working through core.match

19:35 dnolen: SegFaultAX: heh, cool!

19:35 thm_prover_: Bodil: please excuse my ignorance: how does Akka work with Clojure? how does Akka avoid clojure code from being full java threads?

19:35 SegFaultAX: Dumpster dived had the wrong connotation there. I just mean reading deeply through lots of your projects.

19:35 No offense meant :)

19:35 Bodil: thm_prover_: I don't know much about Akka, only that it's got Clojure bindings. :)

19:40 thm_prover_: dnolen: what was your final conclusion on clojure / coroutines?

19:40 dnolen: thm_prover_: sounds like a fun experiment, I don't see how it could really be practical or usable

19:41 thm_prover_: I could be wrong tho, I didn't really pursue, I kind of stopped after I read the results of various papers.

19:48 egghead: hey clj/west guys -- do we need to do anything special for the ground kontrol stuff tonight or just show up?

19:48 Raynes: Given the word 'kontrol' in the name I assume you need to be using KDE.

19:49 Bodil: Raynes: http://25.media.tumblr.com/tumblr_m9xw9cYPmK1rbg79no1_500.gif

19:49 dnolen: egghead: I imagine just show up

19:50 Bodil: Raynes: You coming, btw?

19:50 egghead: cool :)

19:51 Raynes: No.

19:51 Bodil: Raynes: :(

19:51 egghead: alright, headed to the st paddys day stuff over at kells then ground kontrol, cya around #clojure

19:51 hyPiRion: Raynes: Oh, good! We can make some Clojure app or library while everyone else is attending ClojureWest

19:52 Because, you know, I suspect we may be the only ones not attending =|

19:53 Raynes: hyPiRion: Sure. I was thinking of doing a Space Alert mission generator. amalloy can consult.

19:53 You start, I'll hop in with bug fixes.

19:55 seancljwest: see some of you in portland tonight i expect... just heading out to the airport...

19:56 hyPiRion: Bug #1: Implement the Space Alert mission generator.

19:56 (Enhancement)

19:56 Raynes: You've won this battle hyPiRion, but you shall not win my war.

19:56 clojurebot: hyPiRion: Probably because it is using the IRC protocol directly -- the equivalent of you putting /say in front of your messages.

19:57 hyPiRion: heh

19:57 Thank you clojurebot, that cleared everything up.

20:02 xeqi: <- also missing c/w

20:04 Raynes: It's interesting how the people missing c/w are coincidentally the coolest in the community.

20:04 SegFaultAX: It's also interesting that the organizers would decide to schedule it concurrently with an even bigger conference.

20:05 seancljwest: what conference is that SegFaultAX ?

20:05 SegFaultAX: seancljwest: PyCon

20:05 Raynes: I don't think we have much overlap there.

20:05 seancljwest: well, the conference proper ended today

20:05 what's left are the sprints

20:06 xeqi: .. is pycon really a whole week?

20:06 seancljwest: and i bumped into a couple of clojurians at pycon

20:06 13-21 are the official dates xeqi

20:06 SegFaultAX: xeqi: It's a huge community. Lots of stuff going on.

20:06 seancljwest: but that includes tutorials, workshops, sprints

20:06 the conference itself was friday-sunday

20:06 and today was mostly "poster sessions" rather than a full day of sessions

20:07 tavis rudd gave an awesome talk today - and he'll be speaking at c/w too

20:08 pycon was awesome :)

20:08 2,500 people - it sold out

20:09 ok, airport bound... laters :)

20:10 SegFaultAX: Raynes: In what way do you mean?

20:10 Raynes: In the way I said.

20:10 :p

20:11 I doubt there is a huge amount of overlap of people going to pycon who want to go to clojure/west and vice versa.

20:12 SegFaultAX: Perhaps.

20:20 TimMc: Is there a way I can mock or intercept System/getenv for testing purposes?

20:21 SegFaultAX: TimMc: Is wrapping System/getenv an option?

20:21 TimMc: I suppose.

20:22 jonasac: hmm no matter what i put into (javadoc) i just get the api for String, strange

20:22 scottj: jonasac: maybe you're passing a string, and it takes a class?

20:23 jonasac: yeah http://clojuredocs.org/clojure_core/clojure.java.javadoc/javadoc

20:25 jonasac: oh right :p

20:32 should have figured

20:32 probably an indication that i should take a break :p

20:48 * dnolen is so much more productive on flights

20:49 dnolen: recursive featurec http://github.com/clojure/core.logic/commit/d5eda7d7f89443b449d7955a76e72828561082f6, re: hiredman

20:54 TimMc: dnolen: Because there's no internet?

20:56 dnolen: TimMc: heh no, just few distractions (for me)

21:14 technomancy: erlang factory is this week too

21:14 hiredman: dnolen: exciting

21:16 scottj: no distractions like glare from other passengers open windows, announcements by pilot/flight crew, electronic turn-off mandates, getting up for someone else to go to the restroom, drink/food/snack service, skymall offers, babies, turbulence, ? :)

21:19 for me its more a matter of few options than no distractions.

21:20 hyPiRion: yeah, I should've been at erlang factory, because I need it to learn it within the next 5 days

21:21 dnolen: scottj: heh, well put

21:25 ambrosebs: dnolen: massive congrats on 0.8.0! Really exciting :)

21:26 dnolen: ambrosebs: thanks!

21:27 ambrosebs: dnolen: what's on the menu for for 0.9.0?

21:28 dnolen: ambrosebs: hrm, figuring out how to do polymorphic constraints. Bunch of performance stuff, and hopefully another constraint domain(s) CLP(Set|HashMap)

21:29 ambrosebs: dnolen: nice

21:33 dnolen: ambrosebs: yeah I don't think I'd be happy nearing 1.0 w/o a polymorphic constraint story. it's seems pretty tricky to me at the moment.

21:34 dpwright: Hello.. I'm a bit confused about clojure and Java booleans

21:35 brehaut: dpwright: how so?

21:35 dpwright: I am getting a java.lang.Boolean back from korma, and I'm given to understand that they always evaluate to true in if statements and that I should use "boolean" to coerce it to a clojure boolean

21:36 but (type (boolean (java.lang.Boolean. true))) returns java.lang.Boolean

21:37 ambrosebs: dnolen: what is a polymorphic constraint?

21:37 dpwright: (I think it was a stack overflow thread on "common mistakes for clojure programmers to avoid" or something where I read that java booleans evaluate to true)

21:38 dnolen: ambrosebs: we don't want to get into a situation where we have things like (fd/!= ...) and (!= ...) etc.

21:39 ambrosebs: it would be nice to dispatch to the right constraint implementations once a parameter becomes instantiated.

21:40 ambrosebs: but because we might "run" backwards it kind of complicates things. It's no longer the case that just dispatching on the type of the first argument is all that useful.

21:41 ambrosebs: I don't understand what you mean by trying to avoid fd/!= and !=?

21:41 dnolen: ambrosebs: if (!= x 1) where x is assigned to some interval should dispatch to fd/!= instead of inefficient disequality

21:42 ambrosebs: dnolen: ah makes sense. So it's multiple dispatch on a volatile runtime type :/

21:43 dnolen: ambrosebs: this is something I toyed around with when I started cKanren work but it just seemed like too much work at the time.

21:43 dpwright: ...actually, there's a comment on that stackoverflow thread saying that it's working in clojure 1.4, so maybe it's just an old version thing. Turns out the problem that led me to wondering about bools was caused by something unrelated

21:43 dnolen: ambrosebs: it kinds of seems like you would need predicate dispatch for it to work ...

21:44 ambrosebs: since you would want the system to be open, but very efficient based on type of and the level of instantiation of the constraint parameters.

21:44 dpwright: since (type true) returns java.lang.Boolean, I guess there's no such thing as a "clojure boolean", and they are just java.lang.Booleans?

21:44 ambrosebs: dnolen: yea...

21:47 amalloy: dpwright: indeed

21:47 hyPiRion: Oh, the booleans

21:47 ,(false? (Boolean. false))

21:47 clojurebot: false

21:49 dpwright: right, and yet

21:49 ,(false? (boolean (Boolean. false)))

21:49 clojurebot: true

21:50 hyPiRion: I think it's because

21:50 ,(identical? false (Boolean. false))

21:50 clojurebot: false

21:50 hyPiRion: ,(identical? false (boolean (Boolean. false)))

21:50 clojurebot: true

21:50 dnolen: ambrosebs: we may be able to get away with a much lighter version of core.match in core.logic since it really doesn't need to be general - just types and level of instantiation - this only about constraint parameters.

21:51 ambrosebs: dnolen: interesting.

21:51 dpwright: so the type is the same, but the value representing false is different

21:52 dnolen: ambrosebs: the core.match algo really isn't that much code, most of that code is crazy stuff like extending the matcher and optimized matching for all the different datatypes. I don't think we need to do that at all here.

21:52 dpwright: is there a reason for that? pretty sure this conversation has been had many times before, but maybe I just haven't found the right blog post for it or something

21:54 ambrosebs: dnolen: are you implying building a more specific predicate dispatch system on top of a stripped down core.match?

21:54 dnolen: ambrosebs: yeah

21:55 ambrosebs: dnolen: is the core.match algorithm still relevant for pred disp?

21:55 dnolen: ambrosebs: oh, should be clear we don't need full pred dispatch here.

21:55 ambrosebs: it's really just optimized pattern matching that allows future extension.

21:55 ambrosebs: ok

21:55 muhoo: U+1F4A9 pile of poo: https://www.refheap.com/paste/12674

21:56 dpwright: oh wait, clojure "false" represents the java constant java.lang.Boolean/FALSE, whereas (Boolean. false) is just the value false of type boolean

21:56 dnolen: ambrosebs: I think for core.logic we just assume the matches are disjoint - I think we can get away with that ...

21:56 dpwright: ,(identical? false java.lang.Boolean/FALSE)

21:56 clojurebot: true

21:57 dpwright: think I get it now -- thanks hyPiRion for pointing me in the right direction

21:57 hyPiRion: dpwright: That's essentially what it boils down to.

21:57 dnolen: ambrosebs: heh good discussion, this has clarified how I think I might want to tackle this ...

21:58 ambrosebs: dnolen: haha nice

21:58 tomoj: lattice-kanren looks intriguing

21:59 dnolen: tomoj: it does ... don't really understand it yet though :)

22:01 tomoj: it looks like the time type in conal's reactive is an example of a domain in their sense

22:02 I guess any sensible time type would look like that

22:19 muhoo: any idea how i can turn a BufferedImage into something that i can feed to a ring response :body?

22:20 antares_: muhoo: converting it to bytes or a stream should work, not sure what's the best way, though

22:21 muhoo: antares_: sounds reasonable, but i don't see any way to do that. alas, my java-fu is lacking

22:22 antares_: muhoo: http://stackoverflow.com/questions/649186/how-to-get-an-inputstream-from-a-bufferedimage

22:22 muhoo: disco, thanks!

22:22 antares_: muhoo: so, ByteArrayOutputStream sounds like what you need

22:22 muhoo: OkThankYouForThat

22:55 done https://www.refheap.com/paste/12675

23:09 mye: Since handling bytes in clojurescript doesn't seem to be directly supported, the best alternative is probably a vector with ints, right?

23:10 brehaut: mye: how do you mean? primative bytes are handled fine. its only unsigned bytes that are problematic

23:11 ,(byte 100)

23:11 clojurebot: 100

23:11 brehaut: ,(map byte [127 128 129])

23:11 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 128>

23:12 mye: brehaut: trying that in my clojure*script* repl: is tells me (byte) isn't defined

23:12 brehaut: oh, clojurescript is different

23:12 theres only numbers

23:12 (in javascript)

23:12 except where there arent

23:12 depending on the browser you are targetting you can get typed arrays

23:12 and i think you can get real bytes there

23:13 mye: hm, yeah, for portability of code that runs in clojure and cljs having a fallback for bytes would be nice, if that's possible

23:14 the clojure code could be more efficient probably, but I'll have to do with whats in cljs then. (I want that code to generate URLs in both the browser and server side)

23:15 muhoo: iirc in javascript all numbers are floats (!)

23:15 brehaut: muhoo, not exactly

23:16 muhoo: modern runtimes treat them as ints if you perform certain operations on them, converting to float only when necessary

23:16 and you can convert them back with some bitwise ops

23:17 (this is the premise of emscripten and asm.js i believe)

Logging service provided by n01se.net