#clojure log - Apr 08 2014

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

0:00 mercwithamouth: yeah i want my UI 100% outside of the server code

0:00 beamso: uses a templating language instead of hiccup.

0:00 oinksoft: bob2, (defn a nil) (defn b (+ 2 2)) (first-non-nil a b) => 4

0:01 amalloy: oinksoft: wat. (defn a nil) won't compile

0:01 mercwithamouth: beamso: i was trying to stay away from the larger frameworks...really i just want to write my api in clojure... and focus on clients as clients only

0:01 if that makes sense

0:01 amalloy: you want def in those samples

0:01 oinksoft: amalloy, a [] nil, i mean

0:01 beamso: mercwithamouth: http://clojure-liberator.github.io/liberator/ ?

0:02 amalloy: but then you're using a and b wrong

0:02 beamso: essentially a REST library for clojure.

0:02 mercwithamouth: beamso: yeah, liberator i'm familiar with. it's in my web programming in clojure book

0:02 oinksoft: amalloy, OK, i'm not actually using functions like a or b

0:02 amalloy, they're not too useful. but maybe a function that returned a database query result set. maybe a few of these functions, so only the first query returning something is returned to me

0:03 Jaood: mercwithamouth: so you want one that support cljs then right?

0:03 mercwithamouth: Jaood: yeah i'm definitely interested in cljs and om

0:03 amalloy: oinksoft: my point is that when giving examples to someone asking how to do something, your code should compile, or at least have a good excuse for not doing so

0:03 mercwithamouth: at the moment that's what i'd LIKE to learn

0:03 oinksoft: amalloy, well there you have it, i don't even have code for this.

0:03 amalloy: oh, you're the one asking for help. i got lost

0:03 oinksoft: amalloy, i am trying to write code for this and it isn't working

0:04 amalloy, it isn't even nearly working or nearly correct, it's a waste of time.

0:04 bob2: you just want the first non-nil value from applying a list of functions to a particular value?

0:04 oinksoft: amalloy, i am used to functional programming in erlang which is very to-the-point

0:04 bob2, yep ... i am new to this language and i don't know every bit of the stdlib, so i was trying to write this myself, and failing

0:05 Jaood: mercwithamouth: well using hiccup with cljs won't entangle your client side code with your server side code, the good thing about hiccup is that its supported by both clj and cljs but I migh me wrong

0:06 mercwithamouth: hmm...i just don't like the feel of it. I can't explain why =P

0:06 Jaood: s/migh/might/

0:08 `szx: ,(some #(% "arg") [(fn [_] nil) (fn [_] "success!")])

0:08 clojurebot: "success!"

0:09 `szx: ^ oinksoft?

0:10 mercwithamouth: hah...i think i recall seeing 'some' in clojure...also Box in liftweb

0:10 oinksoft: `szx, some returns the value?

0:10 `szx: ,(doc some)

0:10 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

0:10 mercwithamouth: some returns the first true

0:10 oinksoft: `szx, are you using this "common idiom"

0:11 `szx, no, that isn't a set ... hm .. oh i see

0:11 `szx: oinksoft: nope

0:11 oinksoft: `szx, so i don't need to write anything, some does this for me

0:11 `szx: oinksoft: looks like it

0:11 oinksoft: `szx, what is your predicate function doing? what is "arg" for?

0:12 `szx: oinksoft: that's just a placeholder for your argument

0:12 xsyn: what's the best way to get the duration of two dates with clj-time

0:12 oinksoft: i thought % was

0:12 or is % the function

0:12 `szx: % is the argument to the predicate, which in this case is the fn

0:13 xsyn: I want something like (duration 24/10/1014 26/10/2014)) => 2 days

0:13 `szx: ,(some (fn [f] (f "arg")) [(fn [_] nil) (fn [_] "success!")])

0:13 clojurebot: "success!"

0:13 `szx: oinksoft: maybe this is clearer?

0:14 oinksoft: `szx, yea, thanks

0:14 `szx: ,(some (fn [f] (f "arg")) [(fn [x] nil) (fn [x] (str "success, got " x))])

0:14 clojurebot: "success, got arg"

0:14 oinksoft: yea, that makes it much clearer :)

0:15 this is different from some() i am used to

0:15 `szx: yeah, the terminology is a little confusing

0:15 ~some

0:15 clojurebot: Cool story bro.

0:16 xsyn: ok, got it

0:17 oinksoft: hehe

0:17 xsyn, have you looked at https://github.com/clj-time/clj-time/blob/master/test/clj_time/core_test.clj i am using this to learn to do some things w/ the library now

0:18 xsyn: yeah, been looking at it now

0:19 got to

0:19 (c/in-days (c/interval (datemap "24/10/2014") (datemap "26/10/214")))

0:19 where datemap is a formatter I made

0:19 oinksoft: that does it?

0:19 xsyn: *nod*

0:22 trptcolin: amalloy / technomancy: reading channel history, actually nrepl (w/ `lein repl` as client, anyway) does allow prompting during an evaluation, via :need-input messages (https://github.com/clojure/tools.nrepl/blob/1072b773e2715d55eb5a50ff496714bb45a3707f/src/main/clojure/clojure/tools/nrepl/middleware/session.clj#L56-L59)

0:23 [possible i misread and you meant emacs’ nrepl client specifically though]

0:25 amalloy: trptcolin: it looks like that's bound to specifically *in*, right? that's not bad, i guess, and would work pretty well for use at the repl

0:26 trptcolin: yep. so you don’t have things like System/console, but it works ok. there was some implementation pain :)

0:26 amalloy: read-from-minibuffer is more fun, and i did like that i could include a default-value in there and let the user edit it

0:27 trptcolin: sound cool

0:27 amalloy: (read-from-minibuffer "Do you want eggs or bacon?" "eggs")

0:27 but it sounds like nrepl is ahead in terms of reading from *in*. with swank, you have to do extra work to get data from the user from stuff like read-line

0:31 trptcolin: yeah i have no idea how emacs works, just knew for sure that i’d gone through some fun stuff to get reply reading input “during” an evaluation

0:32 that sounds like a cool design throwing all those different GUIs on top of your backend though :)

0:49 amalloy: trptcolin: well, i'm far from a UI designer. it's really just three different ways to display text prompts and request test input

0:49 trptcolin: sure, i just like that kind of separation of concerns

0:50 amalloy: yeah, it's good for you to write stuff that way

0:58 johnmn3: hello

0:58 anyone have any experience with lamina?

1:04 amalloy: ~anyone

1:04 clojurebot: anyone is anybody

1:05 johnmn3: so I'm looking at the clojure aleph chat example: https://github.com/alexkehayias/clojure-aleph-chat/blob/master/project/src/clj/core/views.clj

1:06 and the meat and taters of it is:

1:06 (siphon chat ch)

1:06 (siphon ch chat)

1:07 amalloy: (siphon x y) => "everything read from x, write to y"

1:07 johnmn3: I'd like to read the data out of the channel first, though, manipulate the data, then send it along.

1:08 looking over the api, I didn't see what was applicable. Can't find many examples online either.

1:08 trying receive-all right now

1:08 hmm... that should do it

1:17 marcopolo`: Whats the standard way of debugging a logic program?

1:17 anyone debug anything decently big in core.logic?

1:18 noprompt: marcopolo`: you have to start by debugging yourself.

1:18 lol j/k

1:18 marcopolo`: noprompt: so deep

1:18 noprompt: marcopolo`: :)

1:23 dissipate: marcopolo`, can't core.logic reason about its own code?

1:24 marcopolo`: It can't know if it'll get stuck

1:25 ambrosebs: marcopolo`: check out http://minikanren.org/#screencasts

1:25 dissipate: marcopolo`, so how would a human know if it will get stuck?

1:26 marcopolo`: ambrosebs: anything in particular?

1:26 ambrosebs: sorry http://minikanren.org/#hangouts

1:26 look at Hangout #1 I think

1:26 marcopolo`: dissipate: e.g. If you put a println and you see the println repeating too often you know something's fishy

1:26 ambrosebs: I remember a hangout had a demo of a core.logic specific debugger

1:26 marcopolo`: ambrosebs: thanks

1:26 ambrosebs: a later one

1:26 marcopolo`: ooo

1:27 "Topic: Debugging miniKanren programs; " #4 sounds like exactly what I need

1:27 thanks

1:27 ambrosebs: aha!

1:28 dissipate: marcopolo`, is core.logic a precise implementation of minikanren?

1:28 marcopolo`: I think there are slight differences, but I don't really know a whole lot

1:28 There is no condi like in TRS

1:29 dissipate: https://github.com/clojure/core.logic/wiki/Differences-from-The-Reasoned-Schemer

1:30 dissipate: marcopolo`, i see. thanks. seems like SQL. there is a spec but no one implements it exactly.

1:39 oinksoft: does anybody know how to perform meaningful datetime arithmetic with clj-time

1:39 like finding the difference between two times

1:39 as a timedelta-ish object like in python

1:40 or to truncate datetimes, like remove minutes

1:40 because right now i am having a very hard time getting anything done with clj-time

1:40 besides parsing/unparsing datetimes

1:42 beamso: i use standard java date/time stuff. i was totally unaware of the library.

1:43 oinksoft: beamso, how do i do that??

1:43 lazybot: oinksoft: Definitely not.

1:43 oinksoft: beamso, apparently i am supposed to know the java ecosystem too to use clojure, wish i knew that before :(

1:43 beamso: i thought that held for all jvm-hosted languages

1:44 java.util.Calendar is the class you're probably looking for

1:44 and java.text.DateFormat for parsing/unparsing

1:46 oinksoft: ok, thanks

1:47 beamso: i think you have to refer to the joda-time api to get the difference between two dates

1:47 oinksoft: i think i made a big mistake by not studying jodatime sooner in this project and assuming clj-time was 1:1

1:48 beamso: it looks like you have to instantiate a java class to get the difference

1:48 oinksoft: yea, i'll try that out

1:48 thanks

1:50 beamso: http://joda-time.sourceforge.net/faq.html#datediff

1:51 miseria: "cuando la causa nos enloquece, el efecto nos destruye y el fin continuara siendo un sueño" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*

1:51 oinksoft: beamso, yea, the jodatime api is really good it looks like, for some reason i assumed clojure would have some library available for performing very simple datetime comparisons

1:51 beamso, so i underestimated how long this part would take me is all :)

1:52 beamso, *comparisons and calculations

1:52 beamso: the api looks horrible to me :/

1:52 oinksoft: well, i mean that it can do what i want

2:09 ambrosebs: how do I make use of instaparse's :optimize :memory

2:10 I'm parsing TypeScript, so I assume it can be partitioned into smaller chunks automatically.

2:18 probably not the solution I want anyway.

2:18 my grammar is probably hopelessly inefficient

2:28 noprompt: ambrosebs: thanks for posting that link ealier. this is great. :)

2:28 ambrosebs: :)

2:32 sm0ke: can i exclude a particular folder under my source directory in lein

2:32 ambrosebs: noprompt: webyrd says "time to make some more"

2:34 noprompt: ambrosebs: well it's going to take some time to watch all of these! but it's just what i was looking for.

2:35 ambrosebs: i've been trying to get my feet wet with logic programming for a while so this really nice to have someone explaining code in a more "human" dialog than a dense text book alone.

3:00 noidi: sm0ke, I doubt it. the source folder is added to Clojure's classpath.

3:07 sm0ke: i guessed so

3:18 ambrosebs: how do I know if :optimize :memory worked in instaparse?

3:22 it's clearly working since my grammars are parsing :)

3:23 aha https://github.com/Engelberg/instaparse/blob/c2884b65ca853b6cbd10e05581e8cda831391da3/src/instaparse/repeat.clj#L213

3:28 nice, the full 9000 line base typescript annotations parse with :optimize :memory.

3:47 szymanowski: hello, i there a function that return the current namespace name?

3:47 is*

3:47 ambrosebs: ,(ns-name *ns*)

3:47 clojurebot: sandbox

3:48 szymanowski: thank you very much

5:34 I've got a function that takes a multimethod as argument, how can i get the var name of this multimethod from this function?

5:37 ambrosebs: szymanowski: there's a private field in MultiFn.

5:38 which hints that this isn't supported.

5:41 szymanowski: so there is no way to get it? how am I (not)supposed to access this field?

5:47 so there is no way to get it? how am I (not)supposed to access this field?

5:51 ambrosebs: szymanowski: use java reflection to make the field public

5:52 szymanowski: thank you, i will try that

5:52 ambrosebs: https://github.com/clojure/jvm.tools.analyzer/blob/master/src/main/clojure/clojure/jvm/tools/analyzer.clj#L68

6:14 Frozenlock: If I have multiple channels returned by a `for' loop, how may I transfer the results into a single collection that goes into another channel? (async/map identity chan-coll) ?

6:45 wagjo: ,(+ 1 1)

6:45 clojurebot: 2

6:56 ucb: I assume/hope the answer is no, but is _ special when used in keywords?

6:57 Bronsa: you assume right

6:57 ucb: long story short, I have a map with keywords like :_id or :_rev, and when I try either (:_id the-map) or (get the-map :_id) I always get nil

6:57 despite (keys the-map) returning something like (:_id :_rev ...)

6:57 Bronsa: ,(:_foo {:_foo 1})

6:57 clojurebot: 1

6:58 Bronsa: ucb: it might be the case that the value is nil then

6:58 ucb: yeah, I tried that too before asking but thought I'd ask anyway :)

6:58 oh, the value isn't nil

6:58 Bronsa: https://gist.github.com/10109498

6:58 something's up, but I don't know exactly what

6:59 Bronsa: ucb: (class (mudb.db/get-doc db "0b290c7b-01a5-46f8-b642-8a19862eeca8"))

6:59 ucb: clojure.lang.PersistentArrayMap

7:00 I would hope that didn't make a difference though

7:00 Bronsa: ucb: I thought maybe it returned a custom map type

7:00 ucb: ah, right, no it doesn't :)

7:00 Bronsa: so you could blame a broken lookup implementation

7:01 ucb: what does (filter #{:_id} the-db) return?

7:01 err (keys the-db)

7:02 ucb: ()

7:02 Bronsa: there you have it

7:02 ucb: well, sure

7:02 but this is extremely puzzling

7:02 perhaps there's some weird unicode non printable character in the keyword or something :/

7:04 Bronsa: ucb: (map #(-> % .sym name .getBytes seq) (keys the-db))

7:05 rather, (filter keyword? (keys the-db))

7:05 ucb: it might be an encoding problem

7:06 ucb: (95 114 101 118) (95 105 100)

7:06 that's for (:_rev and :_id)

7:07 ugh, without ( )

7:08 Bronsa: ucb: and if you do (seq (.getBytes (name (.sym :_db)))) do you still get (95 105 100)?

7:09 ucb: Bronsa: yeah, same stuff

7:09 Bronsa: no idea then

7:09 ucb: :)

7:09 me neither

7:29 sadly I sorted it out for now using strings as keys

7:29 because the maps that are failing to get :_id are fine returning "somestring"

7:33 Bronsa: ucb: really weird

7:33 ucb: something's up because if I (:_foo (assoc the-map :_foo "some stuff")) then I get "some stuff"

7:33 one thing worth mentioning is that I'm persisting these maps to disk using MapDB

7:34 though I have no problem writing them and retrieving them from disk

7:34 Bronsa: if you do (keys (assoc the-map :_id 1)) do you get two :_id or one?

7:34 ucb: only when I create one via an HTTP handler and then retrieve it via low-level fns that I run into trouble

7:34 ooh

7:34 good thinking

7:35 Bronsa: I still think it might be an enconding issue

7:36 another long shot but

7:36 ,(symbol ":foo")

7:36 clojurebot: :foo

7:36 Bronsa: try to make sure :_id is a keyword and not an invalid symbol

7:36 clojurebot: You don't have to tell me twice.

7:36 Bronsa: .

7:39 ucb: Bronsa: bingo: https://gist.github.com/10112462

7:40 Bronsa: ucb: good, now check if the original :_id is a keyword or a symbol

7:40 ucb: Bronsa: well, it's a keyword https://gist.github.com/10112576

7:40 Frozenlock: If I have multiple channels returned by a `for' loop, how may I transfer the results into a single collection that goes into another channel? I tried async/map, but it seems to just push the values one a the time in a new channel :-/

7:40

7:41 Bronsa: ucb: there might be something weird going on when you read it back, check on the in-memory strucutre (map class (keys the-db))

7:42 if it's a keyword, I don't know what to blame other than the encoding

7:43 ucb: mapping class gives me clojure.lang.Keyword everywhere

7:43 so it has to be encoding

7:44 Bronsa: https://gist.githubusercontent.com/ulises/10112830/raw/7d1e506b5e62e6ef5620424b5acfbc939cbd4418/%2Acider-repl+mudb%2A.txt

7:45 Bronsa: ok

7:45 Viesti: hum, looking into om-sync, seems that I could build an app that sends state changes to the server, but what about listening to changes from the server

7:47 Bronsa: ucb: well, you might do one last check, (map (fn [[k v]] [(.hashCode k) v]) (filter (fn [[k _]] (keyword? k)) (assoc the-db :_id "foo")))

7:47 it should return two different hashcodes I think

7:48 ucb: ([1020047062 :_id] [2942948 "_rev"] [1020047062 :_id] [3076010 "data"])

7:48 Bronsa: :/

7:50 ucb: :/ indeed

7:52 wagjo: ucb: what's the maps clasS?

7:53 ucb: clojure.lang.PersistentArrayMap

7:55 sveri1: hi, i would like to alter the binding of a (html/deftemplate... def, but I just don't know if it even works at all, all that came to my mind did not work, here is some example code to illustrate the problem: http://pastebin.com/TvbbDG3i

7:55 wagjo: usb: try (set (keys m))

7:55 ucb: try (set (keys m))

7:56 ucb: wagjo: https://gist.github.com/10113829

7:56 wagjo: heh

7:57 ucb: even more amusing: https://gist.github.com/10113916

7:57 wagjo: ucb: maybe it has something to do with classloaders, try is the keywords are identical

8:00 ucb: try (map #(.getClassLoader (class %)) (keys assoced-map))

8:04 ucb: if it is not the encoding than it may be issue in keywords interning.

8:13 Frozenlock: I must be missing something.... where `chans' is a bunch of channels: https://www.refheap.com/73258 doesn't return o_O

8:26 tbaldridge: Frozenlock: never returns, or return-channel never gets a result?

8:27 Frozenlock: tbaldridge: Well the rest of my code still runs, so I suppose it just never gets a result.

8:28 tbaldridge: into will never return until it has consumed all data from the input channel and that input channel is closed

8:28 likewise merge will never close its output until all inputs are closed

8:29 so it could be the case where one of the items in `chans` is never closing and thus signaling that it is finished.

8:29 Frozenlock: I doubt it, it works fine with just async/merge.

8:30 tbaldridge: Frozenlock: and it will, merge puts items into the output channel as it gets them. Into does not

8:30 Into waits until the end, merge (and most other core.async functions) don't

8:34 Frozenlock: tbaldridge: It's waiting for the channels to close?

8:35 tbaldridge: Yes, as I said above: "into will never return until it has consumed all data from the input channel and that input channel is closed"

8:35 *never return data

8:35 is what I should have put

8:35 so it returns a channel, but that channel is never given any data until the input channel to into closes

8:35 Guest79451: Hi, I'm trying to deploy my luminus app on heroku, after pushing the code when I'm trying to use heroku open, I get this: An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.

8:35 Frozenlock: Hmm... maybe I'm doing it wrong and should close them then.

8:36 Guest79451: I've checked for logs and everything went fine without any error

8:36 tbaldridge: Frozenlock: that's what I'm thinking (having not seen the rest of the app)

8:36 Guest79451: Procfile has: web: lein with-profile production trampoline ring server

8:36 Frozenlock: In short, what I have is this ---> [c1 async-request1 c2 async-request2]. What I want to have is a channel with both results.

8:37 (in a collection)

8:37 Guest79451: Hi, I'm trying to deploy my luminus app on heroku, after pushing the code when I'm trying to use heroku open, I get this: An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details. I've checked for logs and everything went fine without any error. Procfile has: web: lein with-profile production trampoline ring server.

8:37 Frozenlock: I want to consume them simultaneously.

8:38 tbaldridge: Frozenlock: one item from each chan ?

8:38 Frozenlock: yup

8:39 tbaldridge: Frozenlock: then you probably want to replace merge/into with (async/map vector chans)

8:39 ,(doc clojure.core.async/map)

8:39 clojurebot: No entiendo

8:39 tbaldridge: Frozenlock: http://clojure.github.io/core.async/#clojure.core.async/map

8:39 Frozenlock: Interesting... I tried (async/map identity chans) earlier. Let me try that...

8:40 tbaldridge: Frozenlock: yeah, the function gets applied to the items, so you were in effect doing this:

8:40 ,(apply identity [1 2 3])

8:40 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/identity>

8:40 Frozenlock: Oh!

8:40 I guess I was just expecting map to return a collection, like clojure.core/map

8:41 tbaldridge: Frozenlock: yeah, this will end up returning a channel since core.async operates in a land where everything has to be push based

8:42 Frozenlock: Guest79451: The port is specified in your with-profile?

8:42 tbaldridge: Makes sense. Thank you very much!

8:43 Guest79451: What I mean is... this doesn't look like the basic Heroku Procfile with $PORT and all.

8:43 tbaldridge: Frozenlock: not a problme

8:43 *problem

8:44 Guest79451: Nope, that was included by default in the luminus template

8:44 I haven't edited it

8:44 what should I change it to?

8:45 Frozenlock: Ehhh I don't really know. I just made it once and just followed the instructions on Heroku. This is what I got:

8:45 web: java $JVM_OPTS -cp target/hvacio-standalone.jar clojure.main -m hvacio.server $PORT

8:47 Guest79451: okay, i'll try it and see if it works

8:48 Frozenlock: Guest79451 https://devcenter.heroku.com/articles/getting-started-with-clojure

8:48 Guest79451: Frozenlock_ should this: clojure.main -m hvacio.server, be same or I'll have to change it?

8:49 I mean, clojure.main?

8:49 Frozenlock: Depends on how you made your project.

8:49 Guest79451: I don't have anything like that in my project

8:49 beamso: Guest79451: have you tried running your heroku app locally using foreman?

8:50 Guest79451: yup. it's running

8:50 clojurebot: Cool story bro.

8:50 beamso: foreman start from the command line worked?

8:50 Guest79451: I've been following the instruction on this link:https://devcenter.heroku.com/articles/getting-started-with-clojure

8:50 yes, it worked

8:51 and at this link: http://www.luminusweb.net/docs/deployment.md

8:51 On http://www.luminusweb.net/docs/deployment.md, they haven't made any changes in Procfile

8:52 beamso: have you tried simply redeploying to heroku?

8:52 i know that is a stupid question but status.heroku.com tells me that they are still doing maintenance for heartbleed.

8:52 Guest79451: beamso, yes, I tried it 4-5 times

8:52 with same result

9:04 ucb: wagjo: apologies for delay; class loader is the same for the sane :_id and the broken :_id

9:08 Guest79451: beamso, okay, so it won't deploy until they are done with maintinance

9:08 ?

9:08 beamso: no idea.

9:09 it was just a suggestion based on someone else's heroku issues

10:45 * si14 is there any particular reason why we can't have primitive arrays as return types in Clojure?

10:45 * si14 woops, erroneous /me, sorry

10:46 si14: (and again)

10:51 ok, we have a lot of interfaces here already https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java , but will it hurt to expand this list 4-fold with long[] and double[] at least?

10:54 stuartsierra: Aren't java arrays already Objects? What would be the benefit?

10:57 si14: stuartsierra: elimination of additional "checkcasts", I believe.

10:58 stuartsierra: JVM optimizations should eliminate most of those already.

11:00 si14: I see, thank you.

11:00 tbaldridge: even if it didn't you could always cast once and be done with it.

11:02 si14: I'm currently playing with some simplex stuff and thinking if writing math-heavy code in Clojure instead of Java with Clojure interface is a good idea.

11:03 * si14 it's a nice case for JVM, because all mature simplex implementations use sparse representaitons and SIMD can't help C/C++ much.

11:04 llasram: si14: It definitely possible, but can be tricky to avoid unintentional boxing. Check out https://github.com/ztellman/primitive-math and https://github.com/prismatic/hiphip for some helpers

11:05 si14: llasram: yeah, thank you.

11:07 * si14 I worked on core.matrix during last year's GSoC and Clojure isn't that better syntax-wise in good old matrix algorithms than Java. Not sure if Clojure's much better syntax will help enough to pay off additional carefulness needed for math in Clojure.

11:07 si14: argh, I hate this ctrl+enter feature of IRCCloud.

11:07 "feature"

11:25 arrdem: $lfmassoc arrdem

11:25 $lfmuser Raynes

11:26 lazybot is down again I see...

11:27 ambrosebs: arrdem: did Daniel Gomez reply to your decision with GSoC?

11:27 arrdem: I assume he's cool with it

11:27 arrdem: ambrosebs: I haven't heard anything from him, so I assume he's cool with the proposal as it stands.

11:28 ambrosebs: arrdem: ok

11:29 arrdem: ambrosebs: after talking to TB it looks like there are some reverted patches that implement a reasonable amount of what I'm proposing to do atop t.a for the existing compiler. Stuff rich added circa 1.3 and promptly reverted. On my todo list to do some research and figure out how to get those back on the mainline, and if that's something I could do in the spare two weeks my GSoC proposal has.

11:30 ambrosebs: arrdem: sounds good

11:33 arrdem: ,(type (Long/SIZE))

11:33 clojurebot: java.lang.Integer

12:03 doky: hello does anybody know how to detect scrollbar when reach the top ? maybe with jayq ?

12:04 gtrak: I just noticed.. aren't return type-hints supposed to go on the arglist vector? clojure.string has them on the var name.

12:05 teslanick: You could do it with (.-scrollTop js/document.body), I think.

12:05 (@doky)

12:05 doky: teslanick: thanks i will try it

12:05 amalloy: gtrak: hints on the arglist were added only in 1.3, to support functions returning primitives

12:06 i don't think hinting the arglist with a non-primitive class actually does anything, but i could be wrong on that

12:06 gtrak: ah, hmm.

12:06 there's examples of it in core.clj

12:07 but it's also got a String :tag on the metadata.. soo.. not sure what's happening there :-). looking at str.

12:08 amalloy: hinting the var name, which is equivalent to :tag String, does indeed hint the return type

12:12 dnolen_: doky: https://api.jquery.com/scrollTop/ with jQuery, or goog.style.getViewportPageOffset

12:13 as usual I recommend the later

12:13 doky: teslanick: and when i want to detect scroll in div.box it would be (.-scrollTop js/document.body.div.box) ?

12:16 teslanick: Yeah, use the google library if you can, if you're in clojurescript. I'm not super-familiar with the closure library yet.

12:17 But, in JS, if you want to detect a scroll in a box (modern browsers): https://gist.github.com/anonymous/e98a96eda16bf18abd69

12:20 (working example) http://jsbin.com/gegojada/1/edit

12:29 kenrestivo: noprompt: were you having a problem with a weird \@ character in some json output?

12:31 i was able to duplicate something similar by inadvertently doing (map first) on a list of things not all of which were sequences. one was a string, and i got that same odd output of a seemingly random char.

12:33 justin_smith: given that

12:34 if js were using C style null terminated strings for example

12:52 doky: teslanick: thanks :)

13:16 justin_smith: http://cljsfiddle.net/fiddle/jonase.async is giving a 502 error, is there another "fiddle with clojurescript" site up?

13:20 noprompt: dnolen_: how do we get api documentation a la clojure, core.async, etc. for core.logic?

13:20 dnolen_: my mistake. the README just needs the link.

13:24 jonasen: justin_smith: it's back up now

13:25 justin_smith: cool, thanks

13:33 lynaghk: bbloom: ping

13:33 bbloom: lynaghk: pong

13:34 rasmusto: digitalocean ok for an irc vps?

13:34 lynaghk: bbloom: I'm building a tool for traversing graphs, and I'm not sure the best way to track the depth of a node

13:36 bbloom: in particular, I'm not sure if it should be a property of the nodes themselves (they get instantiated with a "level" attribute)

13:36 bbloom: lynaghk: depends on a lot of things

13:36 lynaghk: bbloom: or if things are easier when the level is tracked implicitly---especially w.r.t. changing the "root" of the graph

13:37 bbloom: lynaghk: root == start node of a traversal?

13:37 depth == shortest path from root?

13:37 lynaghk: bbloom: yes, exactly.

13:37 yep.

13:38 right now my concrete toy example is a structured editor for prose

13:38 bbloom: presumably the graphs are immutable, right?

13:38 lynaghk: prose == a thing, or like english prose?

13:38 lynaghk: so you start with a single document node, then you can "zoom in" to seeing all of the sections, then to the paragraphs, sentences, words, letters

13:38 justin_smith: lynaghk: grammatical structure?

13:39 bbloom: lynaghk: and the non-tree/graph part of it is cross references?

13:39 Bronsa: gtrak, amalloy: I'm reading the backlog -- hinting the arg vector does hint the return type and I'd argue it should be the preferred way to go

13:39 lynaghk: bbloom: in my toy example it's a tree but in the future there will be cross-references

13:40 bbloom: lynaghk: don't try to build general graph tools, it's fucking hard :-P just start w/ a tree & add cross references later as names

13:40 lynaghk: bbloom: okay to pm?

13:40 bbloom: lynaghk: for example, when you create a new paragraph node, you can just inc a counter and store an ID on that tree node and then implement cross references as just the id to there + a context object built up from a post-order traversal

13:41 lynaghk: always

13:41 gtrak: Bronsa: easy to forget the details. I remember working through the edge-cases like a year ago.

13:41 hopefully one day we can make this behavior consistent :-).

13:42 Bronsa: gtrak: the only gotcha is that metadata on vars is evaluated while on arglists is not

13:42 gtrak: once we have an analyzer we can do something like python's 2to3 :-)

13:42 and a new compiler.

13:42 hrm..

13:43 Bronsa: gtrak: well turns out I'm working on exactly that :P https://github.com/clojure/tools.analyzer.jvm https://github.com/clojure/tools.emitter.jvm

13:43 gtrak: right :-)

13:43 just speculating what the future might hold.

13:44 maxthoursie: Hi, I'm using sqlkorma w a legacy db, and all fields have spaces in them. My code is cripled with (keyword "company id") et.al. How would you go about titying that?

13:44 Bronsa: gtrak: I'd love to get clojure be consistent wrt :tag handling, I've had a discussion on the clojure-dev ml a while ago about that

13:45 got no response from Rich so I went my way and did what I thought was right in tools.analyzer: :tag always resolves to a class or it's a compile time error

13:45 gtrak: I managed to actually use my cljs tooling (auto-complete/jump-to-def) to build an app, aside from weird compiler crashes, it worked quite well. I'd love for this to work on the jvm analyzer impl whenever that comes around instead of the java namespace implementing classes.

13:45 maxthoursie: there's a function in korma, field-identifier, which if I could hook into would solve my problems

13:45 but how do I do that? monkey-patch?

13:46 gtrak: Bronsa: I want to implement a 'enumerate all protocol implementations' cider middleware, among other things.

13:46 can't do that on the JVM now, I think I could in cljs.

13:46 maxthoursie: can I wrap it somehow to for instance replace :company-id with "company id"

13:46 ?

13:47 gtrak: Bronsa: that sounds sensible to me, I guess the concern is, when is it time to make a clean break, and how hard will it be for existing code?

13:47 but we need a working toolchain first :-)

13:47 whodidthis: yesql is always on option if dsls are bad

13:49 Bronsa: gtrak: well it's surprisingly close to be working

13:49 maxthoursie: whodidthis: ah, havn't heard of it

13:50 gtrak: oh really, nice :-)

13:50 can it do a repl?

13:50 Bronsa: gtrak: it compiles fine all of clojure.core, and my testing showed that it's mostly working except for a few known differences

13:51 gtrak: the only place it chokes right now is compiling core_genclass, where the jdk validator complains about a missing stackmap frame, I still have no idea what's going on there but I'm investigating

13:52 gtrak: next step is trying to improve performances, right now it's something like 15x slower at compiling than Compiler.java

13:53 gtrak: oh yea? that's not too bad.

13:53 Bronsa: which, everything considered, is not that bad.

13:53 gtrak: given how little the current compiler does, and overhead of clojure data.

13:53 arrdem: Bronsa: just at performing the translation or the output?

13:53 tbaldridge: Bronsa: that being said, what are the actual numbers there?

13:53 15x slower than 1ms is something I could live with

13:53 Clojure compilation isn't that slow to begin with

13:53 gtrak: I wonder how much of our compilation time is classloading.

13:54 Bronsa: tbaldridge: 2s to compiler clojure.core with Compiler.java, 25s with t.e

13:54 tbaldridge: esh, yeah, that's a bit worse...still that's what...10k lines of code?

13:54 hiredman: tbaldridge: loading enough code and it takes forever

13:54 gtrak: that would differ app to app. we load up all of hadoop and hive and ...

13:54 Bronsa: arrdem: cumulative

13:55 tbaldridge: my goal is to get that close to ~10s, less than that is going to be a bit difficult

13:56 S3thc0n: Hello everyone, I spent the last few weeks pondering syntax basics of programming languages and wondered: How (except for forward reference) would a global let differ from using defs? Since (IMHO) everything should be an expression and not a statement I think this would be cleaner. But the problem of other libraries / namespaces with their own let arises, as well as accessing declared

13:56 values/functions from outside (a REPL for example). What do you think? [Sorry for the wall of text]

13:56 llasram: Bronsa: Why do you think so?

13:57 arrdem: S3thc0n: defs emit vars and metadata whereas lets don't.. but many research and toy PLs implement defs as something equivalent to top level lets.

13:58 gtrak: S3thc0n: yea.. no chance for forward declarations if you use lets, unless you use something mutable.

13:58 Bronsa: tbaldridge: there's definitely room for improvement on the tools.emitter side, all the splicing happens in runtime there and it adds quite the overhead

13:58 S3thc0n: arrdem: Thank you, is there a specific (search) term for this technique or a few languages of those?

13:58 gtrak: S3thc0n: so you'd essentially get your code as a tree. Vars enable a DAG if I'm thinking about it correctly.

13:58 justin_smith: S3thc0n: also consider that in clojure let is actually an imperative sequencing construct explicitly used to chain side effects, and defs in an ns should not be

13:59 jcromartie1: *cough*monad*cough*

13:59 justin_smith: gtrak: at least with clojure the A part is enforced by the compiler

13:59 * rasmusto chokes on his burrito

13:59 Bronsa: llasram: doing multiple passes using multimethods over ast represented as maps is never going to be as fast as a single pass on classes with direct fields like Compiler.java currently does

14:00 S3thc0n: justin_smith: I was not aware of that. Thought let was only for destructuring, but now that I think of it you do want to prevent reading the same input twice instead of reusing.

14:00 justin_smith: S3thc0n: let in clojure is explicitly ordered, and people use it to sequence side effects in idiomatic code

14:02 S3thc0n: justin_smith: So the clojure compiler does optimizations by shifting calculations which do not call to Java mutable state or why is the additional ordering necessary?

14:04 justin_smith: S3thc0n: not sure I understand your question. let is guaranteed to be evaluated in order (both the binding forms and the body), and the top level of an ns should not contain side effects, this is a difference between a let body and an ns binding vars currently

14:04 Sethcon: Sorry, disconnected.

14:04 Anythign wrote something in the last minute, please repeat :/ S3thC0n is a ghost

14:05 justin_smith: Sethcon: not sure I understand your question. let is guaranteed to be evaluated in order (both the binding forms and the body), and the top level of an ns should not contain side effects, this is a difference between a let body and an ns binding vars currently

14:05 llasram: Bronsa: Could always switch to a faster dispatch mechanism?

14:05 mikeyg6754: What is the best way to access the resources folder from one of your applications dependencies? I'm creating a UI library that other applications will utilize, I'd like the store the site wide css and assets in the UI library and let the applications access them.

14:05 justin_smith: mikeyg6754: clojure.java.io/resource

14:06 mikeyg6754: I've looked a that, how would I go about using it?

14:06 justin_smith: give it a path relative to the classpath

14:06 seangrove: bbloom: You around?

14:06 bbloom: seangrove: what's up?

14:06 justin_smith: so you will want to make sure each resource has a unique substructure to prevent shadowing

14:06 tbaldridge: llasram: it's kindof a well known problem, and one of the reasons golang doesn't use LLVM. LLVM has awesome modularity at the cost of longer compile times

14:07 Sethcon: justin_smith: SOrry, I think I misunderstood you then.

14:07 justin_smith: OK

14:07 mikeyg6754: justin_smith: Basically I just want to keep the css that will be used a lot in this library without requiring it to be copied to the applications that will use them. The applications themselves will end up serving them.

14:09 justin_smith: mikeyg6754: in the lib, put ["resources"] in the resources path, and put the css in resources/public/css/, then an end user can do (io/resource "public/css/screen.css") or whatever to find that resource

14:09 RickInAtlanta: I am playing with core.async in clojurescript. I am trying to read from a channel that contains 10 items. if I put <! within a dotimes [n 10],it works. If I have it within while true, I get caught in a loop and nothing prints. Ihttps://www.refheap.com/73522

14:09 Bronsa: llasram: eh, we could move to defrecords+protocols which should give some performance benefits but I'd rather do that only if in the end using maps+multimethods turns out to be the bottleneck

14:10 RickInAtlanta: I thought while true inside of a go block would pull things off the channel, and then suspend when the channel closes

14:10 mikeyg6754: justin_smith: Oh, I think I was misunderstanding how clojure.java.io/resource worked, thanks!

14:10 justin_smith: rasmusto: according to my digital ocean using IRC using friend, yes, digital ocean is fine for using as an IRC vps

14:11 seangrove: bbloom: Curious to hear your thoughts on components and events/keyboard input in general. Say I have an textarea component that takes `esc` to blur, but that it's in a popup modal that takes `esc` to close. I'm wondering what the existing approaches (outside the browser) are for coordinating who gets what events, without the components themselves being concerned

14:11 rasmusto: justin_smith: k, thanks. Linode is a bit $ hungry

14:12 dnolen_: RickInAtlanta: not going to work, you will get caught in a loop reading nil. You need to check for nil and exit.

14:12 RickInAtlanta: channels just return nil on reads when closed

14:12 RickInAtlanta: ok, thanks. Still surprised I don't get the 10 items to print out before I get hung, but I understand why I get stuck now

14:13 I supose that could be a function of how light table talks to the browser

14:13 coventry: Is there a way for a go-loop in an om/did-mount method to know whether it's being executed during render phase? (Can it be running during render phase?)

14:14 bbloom: seangrove: that's a big can of worms too :-)

14:14 seangrove: i don't have any good answers (yet) but have some places you can look. i'll ping you in a little while, busy now

14:14 seangrove: bbloom: I figured. I have a quote to prove it.

14:14 bbloom: seangrove: ?

14:14 seangrove: bbloom: Sure, thanks

14:15 RickInAtlanta: ah, actually, I bet I do no. because nil is always an avilable value, the go never needs to yield

14:15 know

14:18 dnolen_: followup question, why doesn't this crash my browser https://www.refheap.com/73524

14:18 By closing the channel inside of my event listener, shouldn't it start firing constantly, once it fires the first time?

14:18 dnolen_: coventry: go loops can never run during render

14:19 coventry: except for when they are first established

14:19 coventry: dnolen_: Great, thanks.

14:20 cYmen: I am trying to draw stuff with clojurescript on an html5 canvas. Does anybody know how to create nice graphics?

14:21 llasram: First, develop a good sense of visual design

14:21 cYmen: wait....

14:21 Not done. ;)

14:21 I know, too vague.

14:21 llasram: Bronsa: Well, you seemed to be implying you expected it to be the bottleneck, so... :-p

14:21 cYmen: I wrote a simple function that draws a grid but not all the lines are the same thickness.

14:22 llasram: But obvs profiling will reveal

14:23 cYmen: Is there a better way to make things scale well and look nice with antialiasing?

14:23 dnolen_: RickInAtlanta: how can that crash you browser the alert will pause the execution of the JS

14:23 cYmen: I guess this isn't really the right place for asking but if you have any ideas where to look...

14:25 llasram: cYmen: I read this a while ago, may be relevant: http://diveintohtml5.info/canvas.html

14:25 cYmen: Part w/ "Q: Why did you start x and y at 0.5? Why not 0?"

14:25 RickInAtlanta: dnolen_: I was thinking that once I dismiss the alert, and then close the channel, it will go back to the top of the loop, where my closed channel will now return nil

14:25 dnolen_: RickInAtlanta: and trigger another alert

14:25 RickInAtlanta: right, but it doesn't do that

14:25 justin_smith: cYmen: vector data scales best, but it really depends on whether the content you have in mind *can* effectively be vector

14:27 RickInAtlanta: I am able to continue executing everything else just fine.

14:41 nbeloglazov: Is there a way in lein to have separate resource folder for tests? Say I have text files that are needed only by tests and should be included via lein uberjar

14:42 cYmen: justin_smith: vector data? I don't even know how to use the canvas with vector data. :)

14:42 llasram: thanks, looking at it

14:42 technomancy: nbeloglazov: you mean should *not* be included in the uberjar?

14:43 nbeloglazov: technomancy: are, yes, *not* be included

14:43 technomancy: nbeloglazov: just use dev-resources for that

14:44 nbeloglazov: technomancy: thanks, will try it

14:47 dnolen_: RickInAtlanta: no idea then

14:48 RickInAtlanta: dnolen_ thanks for the help. I think I will file that example under "seems to work, but is probably not a good idea"

14:48 dnolen_: RickInAtlanta: what I mean is that I don't know that isn't working for you

14:48 I've written code like that works just fine, and I don't have time to trouble shoot at the moment

14:49 RickInAtlanta: if somebody else can replicate then it seems like a bug you should file

14:55 milinda: I have a macro which returns an object, when I used that inside deftest I am getting "Can't embed object in code, maybe print-dup not defined". Please let me know if anyone has any idea about this?

14:57 amalloy: milinda: macros shouldn't return objects: they should return code which, if evaluated, would produce an object

14:58 llasram: Well, unless the objects are value objects which should be embedable in code :-)

15:13 milinda: I think what I said was wrong, macro returns a function which returns a object when called

15:13 that's why I am confused about from where this code see an object

15:15 amalloy: milinda: paste your macro definition to refheap or gist or something. you're probably returning a function object, rather than code that produces a function

15:16 milinda: here is my macro

15:16 https://gist.github.com/milinda/10173848

15:18 here is how I tried to embed in a test

15:18 https://gist.github.com/milinda/10174032

15:20 amalloy: milinda: well, at first glance that looks reasonable. try (macroexpand-1 '(streamit/filter ...))), and see where the #<...> is - that'll be the part you're making into an object

15:20 milinda: thanks amalloy , I'll try it

15:21 have to go now, will let you know if I figure out whats going on

15:31 gwz: hey I have a tree defined in Cons ds, is there anyway I could iterate through it or convert it to zip and perform some functions on it

15:32 tbaldridge: this is what I want in the JVM: http://blogs.msdn.com/b/dotnet/archive/2014/04/07/the-jit-finally-proposed-jit-and-simd-are-getting-married.aspx

15:34 seangrove: tbaldridge: MS is certainly impressive in many ways

15:34 Platz: tail call optimization, thats all

15:35 tbaldridge: seangrove: mono has had this for 4+ years, but it's cool to see it come to .NET as well.

15:36 seangrove: tbaldridge: Well, interesting that Mono had it first

15:36 mono => .NET => JVM ?

15:36 It's understandable given Mono basically has unlimited resources :P

15:42 nDuff: Given a vector, what's an idiomatic and efficient way to get all but the first and last element? I'm currently using (-> pieces (rest) (reverse) (rest) (reverse)), but, well, efficient it's not.

15:43 amalloy: nDuff: you can't do that and get a vector back; if you want a seq it's easy

15:43 nDuff: a seq is fine.

15:44 amalloy: (rest (pop pieces))

15:44 Bronsa: amalloy: huh? ##(let [vec [1 2 3 4]] (subvec vec 1 (dec (count vec))))

15:44 nDuff: Oooh.

15:44 amalloy: oh, of course, Bronsa

15:44 it's not a vector he can efficiently modify still, but he can continue slicing it efficiently

15:50 noprompt: dnolen_: ping.

15:57 dnolen_: noprompt: pong

15:57 aphyr: Raynes: Think lazybot died; don't see her in #riemann

15:58 Raynes: aphyr: Aye, his server died and he's a tad too dumb to figure out what to do in that situation.

15:58 He's on his way back.

15:59 aphyr: cool :)

15:59 Thanks Raynes

16:10 gtrak: lazybot is female?

16:12 yea, I wonder why we didn't have SIMD for the last 16 years it's existed.

16:12 though I read somewhere the JIT uses it for some stuff.

16:22 tbaldridge: gtrak: it uses SIMD registers, but last I checked (a year or so ago) it still didn't use SIMD instructions

16:22 gtrak: ah, man.

16:23 yotsov: this is not about Clojure, and by now probably everybody here has heard about Heartbleed, but just in case: http://www.pcworld.com/article/2140920/heartbleed-bug-in-openssl-puts-encrypted-communications-at-risk.html

16:23 tbaldridge: gtrak: that's kindof the .NET vs JVM thing though. The JVM targets the lowest common feature set of all platforms. While .NET is a much more accepting of small things that may make some software non-portable

16:24 for example, this .NET SIMD stuff only works on x64

16:24 gtrak: hrm. seems like in my naivety that you could simulate it without much of a slowdown. I guess that's all complexity, though.

16:27 cYmen: how do I use an event driven system like clojurescript mouse events functionally?

16:27 Is there anything clever or do I just create vars to store states and make a huge mess?

16:27 gtrak: oddly enough, I was taught a course in concurrent game-programming by one of the folks who helped define SSE :-), in C#..

16:27 like 6 years ago.

16:28 the course was in C#, the SSE was in intel.

16:28 jcromartie1: cYmen: you can use a single atom and update it when the event happens, i.e. on keypress just say (swap! app-state handle-event event)

16:28 or something like that

16:30 cYmen: jcromartie1: thanks I'll check out atoms

16:31 clojurenewb: Raynes: hi, I’m getting ‘IllegalStateException: var: #'me.raynes.laser.zip/edit is not public, compiling:(me/raynes/laser.clj:352:7’ now I’ve upgraded to laser 2.0.0-SNAPSHOT, any ideas ?

16:33 gwz: hey, for sequence is it possible for me to get the next value in iteration

16:35 bbloom: dnolen_: i want specify on the jvm :-P

16:35 rasmusto: gwz: ##(for [[a b] (partition 2 1 (range 10))] [a b]) ;?

16:35 cYmen: (swap! mousestate #(true))) <- true.call is not a function

16:35 lazybot: ⇒ ([0 1] [1 2] [2 3] [3 4] [4 5] [5 6] [6 7] [7 8] [8 9])

16:35 cYmen: shouldn't wrapping it in #() help with that?

16:35 dnolen_: bbloom: yep

16:35 hiredman: ,(macroexpand '#(true))

16:35 clojurebot: (fn* [] (true))

16:36 bbloom: dnolen_: also, i want all the damn clojure.lang interfaces to be protocols dammit

16:36 hiredman: ,(doc constantly)

16:36 clojurebot: "([x]); Returns a function that takes any number of arguments and returns x."

16:36 hiredman: ,(doc reset!)

16:36 clojurebot: "([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."

16:36 cYmen: hiredman: okay, thanks

16:36 gwz: rasmusto: i am using deseq

16:36 cYmen: but I would still like to know why it doesn't work

16:37 rasmusto: gwz: same thing should apply for doseq

16:37 hiredman: cYmen: the macro expansion is very clear

16:37 cYmen: Sorry, I don't get it.

16:38 It looks like what I want.

16:38 Although I do not know what the * means.

16:38 pjstadig: bbloom: https://github.com/pjstadig/clojure/tree/clinc

16:39 hiredman: 1. it is a no arg function, how is that going to work with swap! 2. it has (true) in the body, and true isn't a function, how is that going to work?

16:39 pjstadig: some of the clojure.lang interfaces return primitives (like Counted specifically) which can't be done and/or could have performance consequences if done to return Object i guess

16:39 bbloom: pjstadig: hmm interesting

16:40 pjstadig: but it worked suprisingly well to kind of slipstream the AOT interface from a defprotocol into clojure (for the simple case that I tested with IMeta)

16:41 i generated an AOT interface as clojure.core.protocols.IMeta then made clojure.lang.Meta extend that inferface

16:42 bbloom: pjstadig: interesting...

16:42 pjstadig: cool stuff

16:42 pjstadig: doesn't help me right now, but worth looking at. thanks!

16:42 pjstadig: there are maybe still some issues with bootstrapping the whole thing when loading clojure, but it was interesting to work on

16:43 bbloom: i'd imagine. bootstrapping always has issues and is always interesting ;-)

16:46 justin_smith: cYmen: oh wait, I did not see the entirety of what you were saying. Basically I meant use something like dom+svg instead of canvas. But you could also use canvas and calculate the right pixel values with antialiasing, I am sure someone has written an antialiasing image resizing function in js

16:47 pjstadig: bbloom: i've been tempted to submit a conference talk called "Experiments in Extending Clojure: A Menagerie of Half Finished Projects"

16:47 bbloom: pjstadig: haha, awesome. i'd watch that

16:47 pjstadig: what are the other highlights?

16:48 pjstadig: rewriting clojure.lang interfaces as protocols, making ISeq extend java.lang.CharSequenc, implementing invokedynamic support

16:48 and also my half-assed attempt to target the clojurescript compiler at elisp

16:48 bbloom: pjstadig: and what have you learned? :-)

16:49 gwz: how would I iterate a tree defined in cons?

16:49 hiredman: "all is suffering"

16:49 gtrak: gwz: tree-seq

16:50 pjstadig: bbloom: rewriting clojure.lang interfaces as protocols has some potential, making ISeq extend java.lang.CharSequence was a bad idea, invokedynamic could be interesting but i don't have the patience, and i want to script emacs with clojure

16:50 cYmen: justin_smith: is there something for dom+svg you can recommend?

16:50 pjstadig: there might be some other interesting lessions, but i'd have to think about it

16:50 cYmen: basically I have no clue and just started looking around

16:51 hiredman: pjstadig: your invokedynamic stuff was replacing clojure's reflector right?

16:51 gwz: so if I have something like (:Root [5] (:Left [5] [:Value 3])), I can just call tree-seq on it?

16:51 justin_smith: cYmen: well, svg vs. canvas is a big choice and has to do with what you are trying to display, but om can manipulate svg contents the same way it would any other dom element

16:51 bbloom: pjstadig: i want interfaces as protocols b/c i want extend for mixins so i don't need to reimpl trivial methods for maps, etc. why is charseq a bad idea? (i have not thought about it), faster is always welcome, and *shrug* i can script vim with clojure now so nah nah poo poo

16:51 pjstadig: bbloom: also this was an interesting experiment in writing a new persistent data structure and trying to make it as fast as java https://github.com/pjstadig/deque-clojure

16:52 hiredman: yeah it caches reflection results at callsites

16:52 justin_smith: cYmen: if your image is better represented by a raster of pixels, use canvas definitely. If your image is better represented by scalable vectors, consider using svg (but you still may end up being better off using canvas or 3.js, depending)

16:53 gtrak: I fixed the bencode impl in cider this morning.. it's a recursive algorithm over a temporary emacs buffer.. I miss data.

16:53 justin_smith: cYmen: I personally have always like svg because it is a higher level representation of a shape (more declarative), but browser support is only recently at a reasonable point with it I think

16:53 pjstadig: bbloom: there ended up being some incompatibilities in the interfaces where a char sequence should print as a string, but an ISeq should print as (\a \b \c) which has some weird results

16:54 gtrak: that said, the elisp debugger is great.

16:54 pjstadig: bbloom: i think there was also an issue with how charAt and nth lined up or something

16:55 bbloom: pjstadig: yeah, strings are not really collections....

16:55 tbaldridge: unless you're writing code in erlang

16:55 :-P

16:55 bbloom: pjstadig: i think paul graham was like "if computers were faster, then strings would just be arrays or whatever"

16:55 hiredman: gotta link vars using invokedynamic

16:55 bbloom: but that turns out, that no... that makes no sense at all

16:55 runs of glyphs are seqs, that makes sense

16:56 but they are far away from random access....

16:56 pjstadig: but with ISeq implementing CharSequence you could match regexes against sequences of characters, but yeah it turns out to be kind of weird

16:56 justin_smith: bbloom: if computers were slower, arrays would basically be strings (see C)

16:56 pjstadig: it would bring strings and seqs a little closer together

16:57 gwz: anyone?

16:57 clojurebot: anyone is anybody

16:58 edw: In core.async, a `<!' must be lexically "inside" a `go` to avoid an assertion error. This seems...unnecessary. Is there a discussion of this somewhere?

16:58 justin_smith: gwz: have you tried that in the repl?

16:58 amalloy: gwz: you can use tree-seq, but really trees are pretty easy to handle yourself by writing a recursive function

17:00 blake__: What would " (:refer-clojure :exclude [==]) " do?

17:01 bbloom: blake__: see (doc ns) in your repl

17:01 blake__: bbloom: I've read it. I still don't get it. Does it just suppress a warning message?

17:02 bbloom: blake__: it prevents == from being referable from the current ns... which means that if you define == again later, there will be no warning to suppress

17:02 justin_smith: blake__: when you exclude, then the clojure.core version of the function is not imported

17:02 blake__: Wait, those two explanations seem contradictory.

17:03 justin_smith: blake__: in what way? :exclude [==] means no error or warning if you define a function called == yourself

17:03 or import one from a different ns

17:03 bob2: edw, ? go is a macro, so <! must be lexically inside it

17:04 pjstadig: or actually go is a compiler that compiles its body, so <! must be in its body

17:04 amalloy: edw: <! doesn't exist as a real thing, it's just a "marker" to control how the go macro behaves

17:04 blake__: justin_smith: So, if I had that, then tried to use "==", it would fail, unless I'd already defined "==" in that ns?

17:04 amalloy: in the same way that you can't have a catch that's not inside a try

17:05 justin_smith: blake__: right, it means you don't want to use clojure.core/==

17:06 blake__: Interesting. The code I'm looking at neither uses nor defines "==". It does define and use "*==".

17:06 justin_smith: well no need to exclude the function if you don't want to override it

17:06 pjstadig: blake__: the exclude may be vestigial; perhaps at one time '*==' was called '==' but the author changed opinion and then forgot to remove the exclude

17:07 edw: amalloy: But a `<!` does exist for use by thread. So these are two different `<!`s?

17:07 amalloy: that's <!!

17:07 blake__: pjstadig: Entirely possible. Interesting that only "==" is in the exclude when there are operators like "*<=" "*>" and so on. But perhaps those came later.

17:08 amalloy: right?

17:08 bbloom: amalloy: is that <! dammit! or <!! dammit. ?

17:08 edw: Well there's def a `<!!`...

17:08 pjstadig: <!!!!!!111

17:08 edw: Getting some line noise here...

17:08 +++

17:09 pjstadig: edw: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html this explains the difference between <! and <!!

17:09 gwz: (:Root [5] (:Left [5] [:Value 3])) how would I convert that to zipper if thats even possible?

17:10 edw: pjstadig: Thanks. (Though I thought I did know the difference, namely <! is async, <!! is synchronous. But I'll go read that.)

17:12 justin_smith: gwz: it is similar to tree-seq, but you also give it instructions on how to make a node

17:12 gwz: the function clojure.zip/zipper that is http://clojuredocs.org/clojure_core/clojure.zip/zipper

17:14 gwz: so you basically state what part of sequence/list is what part in tree?

17:14 justin_smith: you tell it how to derive the children of each node, and how to add children to a node

17:14 then you get a zipper back

17:15 edw: amalloy and pjstadig : I guess I had dreams of being free to use <! and >! inside a `go`, dynamically speaking.

17:16 gwz: in my case, I just need to iterate through tree so don't need any additions, the thing is though that I need to know the root value from children while iterating

17:16 edw: (And not just lexically.)

17:17 justin_smith: gwz: I think what you really need is as amalloy hinted above a recursize function that knows how to map over each node of the tree and then a function to call on each node on the way down

17:17 gwz: also, it may be you just want clojure.walk/postwalk or similar

17:17 gwz: the thing with postwalk/walk is that you cant really know the root node when you are in child I think

17:18 so if I am at Left, I want to know that the Root value was 5

17:18 justin_smith: in that case you probably want your own custom recursive walking function

17:18 amalloy: gwz: so just write a recursive function. really. then the value you want to save is a parameter, and that's it

17:18 justin_smith: that carries state from parents as needed

17:19 amalloy: (or, possibly, a closed-over value - close enough)

17:24 coventry: Any clues as to why clojure might be complaining "PSQLException The server requested password-based authentication, but no password was provided." when psql <db name> as the same user works without any password challenge at the shell prompt?

17:26 bob2: env | grep PG ?

17:26 justin_smith: http://www.postgresql.org/docs/8.2/static/auth-pg-hba-conf.html coventry: maybe the method the jbdc driver is using is configured differently in pg-hba.conf?

17:27 coventry: This had the answer: http://stackoverflow.com/a/4562599/1941213 Just needed to paste the actual error message into the browser, rather than "turn off postgres authentication" or the like. :-)

17:27 justin_smith: coventry: aha! I was write, it was pg-hba.conf

17:27 *right

17:28 bob2: it's always pg_hba.conf :/

17:28 coventry: Yep, thanks guys.

17:28 technomancy: pg_hba.conf is the worst

17:40 gwz: is there a function to check if something is persistent vector equivalement of keyword?

17:41 justin_smith: ,(vector? [])

17:41 clojurebot: true

17:41 justin_smith: gwz: if you had tried the first intuitive thing, you would have had your answer :)

17:41 gwz: also http://clojure.org/cheatsheet

17:41 gwz: lol thanks

17:42 is something like this valid, (if (= vector? (last input))

17:43 justin_smith: (if (vector? (last input)) ...)

17:47 gvickers: I have alts! in a let statement, inside a loop, inside a go block but after either of the channels alts! is watching are updated, the action is only fired once. Is there a way to keep using alts! to continuously call functions when a channel is updated?

17:48 dnolen_: gvickers: paste please

17:49 gvickers: https://www.refheap.com/73561

17:52 hiredman: gvickers: if you don't recur loop does nothing

17:54 gvickers: hiredman: thanks

17:56 miseria: "en la vieja butaca, dos viejitos sentados, amigos por siempre, hoy no tienen de que hablar, todo esta consumado" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*

18:28 ticking_: http://congresoingegraf.es/PDF/25768.pdf

18:28 uhrg, sorry, I'm writing a 3d printing tool in clojure, wrong channel though ^^

18:33 danielszmulewicz: Hi, macro noob here, I want something very simple, please don't laugh. The first macro argument is a function and the rest are arguments to that function. All it has to do is call the fn with the arguments. So if the macro is called x, I should be able to write (x + 5 5) and it would return (+ 5 5). (x + 5 5 5) would return (+ 5 5 5).

18:34 justin_smith: danielszmulewicz: I

18:34 'm not sure how to help you without just writing it

18:34 it is very simple

18:35 danielszmulewicz: justin_smith: yes, please don't hesitate to just write it. I'll learn from reading it. :-)

18:35 justin_smith: (defmacro call-fn [f & args] `(~f ~@args))

18:36 danielszmulewicz: justin_smith: thanks a bunch.

18:36 justin_smith: ` is syntax quote, ~ is unquote, ~@ is unquote-splicing

18:36 danielszmulewicz: (inc justin_smith)

18:36 lazybot: ⇒ 32

18:37 justin_smith: and the & in the args vector is the same as it would be in an fn

18:37 danielszmulewicz: justin_smith: I've read some tutorials, but I'm rusty. I get it now. Thanks.

18:38 justin_smith: also doable as a function actually: (defn call-f [f & args] (apply f args))

18:39 hyPiRion: wat

18:40 I would just use apply and get over with it

18:41 then again, I don't read the log and notice that someone explicitly wanted to learn about macros

18:41 justin_smith: also he asked us not to laugh, you meanie

18:41 :)

18:43 hyPiRion: I just read the last sentence, the call-f definition.

18:44 justin_smith: yeah, I was just joking anyway

18:46 hyPiRion: humour is hard on the interwebs

18:46 justin_smith: yes it is

18:47 akurilin: Uhm, random non-clj question: does anybody know of examples of nginx user-agent-based redirections that work?

18:51 justin_smith: akurilin: this looks right - http://stackoverflow.com/questions/10627596/nginx-proxy-or-rewrite-depending-on-user-agent

18:53 akurilin: justin_smith: apparently there's a difference between rewrite ^ to another location and rewrite to a specific .html file

18:53 because the former would continuously throw me into an infinite redirect loop

18:53 where it'd check the UA string and redirect

18:54 but rewriting to a file seems to work because that seems to be the final action that requires no further processing

18:54 I'd run this reasoning by the #nginx people but Russians don't talk to me apparently

18:57 justin_smith: well if it rewrites to a different location, that location shouldn't also rewrite?

18:57 maybe define the target as a separate site with its own rules

19:01 akurilin: Yeah in my head I figured that it'd interpret a rewrite to /foo as a rewrite to /foo/index.html based on the server config, which it does, but it stil repeats the rewrite

19:01 as opposed to stopping

19:01 which makes sense I guess

19:07 technomancy: http://howistart.org/about

19:14 arrdem: in case anyone needs an absurdly sized wallpaper: https://pbs.twimg.com/profile_background_images/453670984650747904/NoRJ-shl.png

19:14 akurilin: technomancy: what's that?

19:15 technomancy: akurilin: project from a co-worker of mine

19:15 hyPiRion: technomancy: seems interesting, really hope there will be more information up later

19:15 Jaood: arrdem: did you made it?

19:16 Bronsa: arrdem: ugh that brightness

19:16 arrdem: Bronsa: someone else who runs dark displays goood goooooood

19:16 Jaood: I photoshopped it to huge scale from someone else's post from years gone by

19:17 Jaood: I have a couple versions floating around, one of which is actually sized for my displays and that one which was sized for Twitter.

19:18 Bronsa: arrdem: my background is almost entirely solid Grey15

19:18 arrdem: Bronsa: I run monokai and molokai for emacs.. which typically turns about 80% of my display that color :P

19:20 amalloy: arrdem: my emacs background is #000000. get on my level

19:20 arrdem: amalloy: one day I'll make your level... I think I've given up on reaching technomancy's :P

19:20 hiredman: (same as his foreground)

19:21 Bronsa: amalloy: I used to have #000000 too, but found out that dark grey is more relaxing to my eyes

19:21 amalloy: Bronsa: oh, probably so. the high contrast helps me see, so i lose out on some comfort

19:21 technomancy: I think it depends on the lighting surrounding your screen

19:22 you always want to go with whatever results in the lowest eye strain afaik

19:22 hyPiRion: Oh that explains everything

19:23 I'm comfortable with #FFFFFF during winter, but not in the summer

19:23 amalloy: time for someone to plug f.lux now, right?

19:23 arrdem: (inc flux)

19:23 lazybot: ⇒ 1

19:23 technomancy: f.lux is time-based

19:23 what you really want is a light sensor

19:24 hyPiRion: right

19:24 arrdem: nah man, just maximum redshift all the time

19:24 we don't really need color now do we..

19:24 amalloy: arrdem: that's probably not an unreasonable choice at home

19:24 Bronsa: I've actually tried using redshift/f.lux and found the experience awful :/

19:25 arrdem: f.lux behaves like crap with multiple displays and no RandR

19:25 my leftmost screen will redshift and the others won't

19:25 looks absurd

19:29 blake__: Is there a cross-ref tool that will analyze a bunch of cljs and produce a list (or interactive tool) saying where the identifiers are defined and where they're used?

19:31 arrdem: blake__: you could probably build such a thing using namespace introspection or tools.analyzer, but out of the box I don't think so.

19:33 blake__: 'k. Would "blind" play into this?

19:34 arrdem: blake__: blind is an empty repo...

19:34 blake__: sorry, tools.reader

19:35 arrdem: blake__: but yes tools.reader is probably involved here...

19:35 if you don't want to go the "load and introspect" route.

19:36 blake__: Don't know what route I wanna go yet. I'm used to being able to just click and say "Hey, where is this used?" =P

19:37 arrdem: I mean.. you could probably knock something together using just regexes or emacs tag search...

19:37 both of the above would be full blown compiler introspection implementations of that

19:37 blake__: Heh, maybe YOU could...

19:37 arrdem: and cider/nrepl probably has a way to do symbol finding, I just don't know of it.

19:37 $google emacs tags clojure

19:37 lazybot: [clojure-mode/clojure-mode.el at master · clojure-emacs ... - GitHub] https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el

19:38 justin_smith: arrdem: there is always the caveman way I do it (m-x rgrep)

19:38 amalloy: cider has "look up this symbol", but i'm pretty sure it doesn't have "where is this used"

19:38 arrdem: justin_smith: I mean.. _I_ know that...

19:38 M-x git-grep is worth mentioning too :P

19:38 hiredman: clojure mode did have something like that I think, and it was a real hack

19:39 technomancy: swank clojure had it, but yeah, it was terrible

19:39 basically just a wrapper around grep

19:39 hiredman: ah

19:39 something something who calls

19:40 arrdem: "\(def.*\s*$1"

19:40 blake__: Yeah, I'm tentatively approach emacs. It seems enough to tackle Clojure without also trying to tackle that.

19:40 justin_smith: blake__: there is grep -R / ack / whathaveyou, which are OK but just don't have the "click here to go to the location" featuer m-x rgrep has

19:40 technomancy: I tried to convince danielglauser to port it to nrepl

19:41 nudge nudge

19:42 blake__: ack?

19:42 arrdem: $google grep ack code search

19:42 lazybot: [Beyond grep: ack 2.12, a source code search tool for programmers] http://beyondgrep.com/

19:42 justin_smith: an alternative / improvement to grep, especially good for finding variable references in a source tree

19:43 blake__: Gotcha. Hmmm.

19:46 justin_smith: https://github.com/technomancy/swank-clojure/blob/master/src/swank/commands/xref.clj#L42

19:46 technomancy: it actually used the reader to create a data structure to plumb

19:46 also that ns looks fairly self-contained

19:46 at a glance at least

19:47 arrdem: clojure.walk and swank.util..

19:47 justin_smith: also that code is very slow because of the amount of reading it does on each call

19:47 technomancy: justin_smith: ah, well... the reader really still isn't good enough for that

19:47 it can't tell the difference between locals and vars

19:47 justin_smith: arrdem: swank.util is pretty small actually

19:48 hiredman: aphyr has some dependency thing

19:48 justin_smith: https://github.com/technomancy/swank-clojure/blob/master/src/swank/util.clj

19:48 arrdem: Bronsa: I assume that t.r doesn't do var vs. local symbol qualification, and that's left to t.a or some other client?

19:49 hiredman: https://github.com/aphyr/meitner

19:49 arrdem: oh damn

19:49 Bronsa: arrdem: yeah, the reader doesn't know anything about that

19:49 hiredman: if you have all the var names you can examine var metadata for locations

19:49 arrdem: justin_smith: check out hiredman's link

19:49 justin_smith: arrdem: yeah, checking it out now, looks cool

19:50 arrdem: Bronsa: as it should be. thanks

19:50 !

19:50 justin_smith: arrdem: that seems reverse of what we want though - callees rather than callers

19:50 technomancy: hiredman: looks like just the ticket

19:50 justin_smith: though of course it could be used to make a better version of the swank thing

19:51 arrdem: justin_smith: sure, but calers is a closure over the entire program anyway

19:51 justin_smith: yeah

19:51 arrdem: justin_smith: so run this on the whole damn thing, then your answer is the subset which have the target for a dep.

19:51 hiredman: or, you know, use codeq

19:52 technomancy: hiredman: actually it kind of boggles me why this isn't already turned into a who-calls impl

19:52 justin_smith: yeah, which is pretty much a replacement for what swank was doing

19:52 technomancy: like... why go to all this trouble and then not finish the last 30 minutes to do that? =)

19:53 justin_smith: https://github.com/aphyr/meitner/blob/master/src/meitner/core.clj#L48 ????

19:53 hiredman: actually, I always forget, does codeq actually do a call graph?

19:53 arrdem: has anyone actually used codeq as a primary version control system?

19:55 justin_smith: solid implementation of foo

19:56 justin_smith: arrdem: the busywait is a lost art

20:07 gfredericks: hiredman: it doesn't; I was poking around with adding that at clojure/west

20:07 using tools.analyzer.jvm

20:08 hiredman: gfredericks: :/

20:09 gfredericks: all it does is haxily look for def-like things and grab their name

20:11 blake__: ack is pretty cool.

20:11 Bronsa: gfredericks: so, Compiler.java evaluates differently expression whose first element is a symbol starting with def which I find really ugly

20:11 gfredericks: Bronsa: ooh my

20:11 Bronsa: it's a goal of mine to try and find a way to break the compiler using this, but I've been failing at it for the last couple of months

20:11 i'll keep trying though.

20:12 gfredericks: Bronsa: because that's the only way to justify patching it? :)

20:12 Bronsa: gfredericks: exactly

20:12 gfredericks: fun strategy for code cleanup

20:12 Bronsa: is the treatment difference easy to summarize?

20:12 danielglauser: technomancy: That guy's a slacker

20:13 arrdem: danielglauser: takes half an hour to respond to IRC... dang what a slacker

20:13 danielglauser: inc

20:14 Bronsa: gfredericks: easier to show you the code

20:14 amalloy: Bronsa: wow, do you have a link? i don't remember seeing that

20:14 Bronsa: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6696-L6703

20:14 nodename: anybody out there to answer an Om/HTML layout question? Swannodette etc?

20:14 dnolen_: nodename: what's up?

20:14 nodename: ahh

20:15 Bronsa: amalloy: gfredericks the tl;dr is that (def..) won't get wrapped in a ^:once fn*

20:15 nodename: ok I am using om-autocomplete and I need three of them but the default imll of a single one puts the input-view and results-view contiguously in a div.

20:16 Bronsa: this implies that (defn def* []) (def*) <- this invoke will get interpreted rather than JIT compiled

20:16 dnolen_: nodename: oh hmm, never actually used om-autocomplete - might want to ask if that can be made more flexible via an issue if it's really a problem

20:16 nodename: I want three input fields and their respective results-views should be drop-downs (only one active at a time)

20:17 gfredericks: Bronsa: oh interesting

20:17 nodename: More generally, can a div have non-contiguous elements?

20:18 maybe I can template the desired layout and when building an autocomplete pass in the existing components

20:18 Bronsa: amalloy: I did some git blaming and it looks like that change was introduced with deftype* IIRC

20:19 hiredman: Bronsa: right, but that is only for eval

20:19 so it only happens at the repl

20:19 oh, I guess load calls eval

20:20 Bronsa: hiredman: uh?

20:20 yeah

20:21 hiredman: and compile also calls eval (but also calls emit)

20:21 Bronsa: sure, but what you get in memory is the result of the call from eval

20:22 hiredman: right

20:22 Bronsa: hiredman: anyway, I really don't think there's any way where this might cause an issue

20:23 hiredman: Bronsa: sure, well, I mean, it is an optimization some compilers purposefully do, replacing ((fn [] x)) with x

20:23 Bronsa: it just really hurt my eyes everytime I see that line (which luckly doesn't happen much often anymore)

20:23 hiredman: welll in clojure it's not always that case that x == ((fn [] x))

20:23 hiredman: sure

20:24 dnolen_: nodename: it just sounds like the autocompleter needs to be more flexible

20:26 nodename: maybe so. the default implementation of container-view is in the example usage, not in the autocomplete component itself...

20:26 Have a link to sgrove's claimed Om drop down component?

20:26 dnolen_: nodename: if container-view is the entire cell for a particular item, you be able to do what you want

20:27 nodename: I don't

20:27 nodename: my html-fu is not up to it… spacing?

20:28 dnolen_: nodename: i'm just clear what you're issue is "non-continguous"

20:29 or you want to have them be split

20:29 on 2 lines

20:29 display: block;

20:29 is the CSS for that

20:31 nodename: 3 input-fields stacked vertically. With each one is to be associated a drop down that appears just below it when its contents change. Each input-dropdown pair constitutes a autocomplete. Only 1 drop down visible at a time.

20:32 Of course selection from a drop down fills the corresponding entry field

20:32 maybe this can be done with a single drop down for all three, and it appears in the right position for each?

20:42 bob2: so, I have a compojure webapp, and I'd like to add a thing to it that asynchronously and periodically fetches some data from another app, and updates a map (safely, of course). what's a good way to have that task run?

20:46 justin_smith: bob2: if it's that simple how about a thread the repeatedly sleeps and then updates the map?

20:47 if you want to do things like checking the error state you could use an agent that invokes itself after sleeping

20:48 brunov: bob2: you can also use https://github.com/james-henderson/chime to create a channel that sends a message on a periodic basis

20:48 if you don't want to dedicate a whole thread to the task

20:49 but justin_smith's approach is better I think

20:50 justin_smith: brunov: well that's another vote for the agent version too, since agents use a pool and not a thread per agent

20:51 brunov: justin_smith: right. But it's still a dedicated thread that will be sleeping most of the time. With channels you just use a "lightweight thread". Most of the time it doesn't matter though.

20:51 justin_smith: brunov: the agent threads are there whether you use them or not

20:52 and core.async uses a pool just the same as agents do

20:52 brunov: Yes, but sleeping on a threads blocks it, while the channel approach simply "parks" the lightweight thread. Again, sublte and won't matter, but it's a difference nonetheless.

20:53 justin_smith: ahh, yeah, the sleep part

20:53 brunov: yeah it's only relevant if you want to have thousands of schedules and you can't afford to sleep on thousands of threads

20:53 *schedulers

20:59 bbloom: ,(meta #'inc)

20:59 clojurebot: {:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :column 1, :line 881, ...}

20:59 bbloom: ,(meta (eval #'inc))

20:59 clojurebot: {:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :column 1, :line 881, ...}

20:59 bbloom: ok nevermind, i'm crazy

21:02 bob2: brunov, justin_smith ah thanks - it's just the one thing, and it's every ~10s for ~20ms, so a thread should be fine

21:03 brunov: bob2: cool

21:03 tuft: anyone familiar with clojure.test.check or property based testing in general?

21:04 trying to write a generator for some datomic triples

21:04 .. need ids to be unique, though, not random =\

21:05 reiddraper: tuft: can you just use incremental ids after the rest of the data is generated?

21:06 maybe generate a vector of random triples, then use map-indexed to give them incremental ids

21:06 akurilin: Do you guys have a strong preference between bitbucket and github? I hear people swear that github is a vastly better experience

21:07 tuft: reiddraper: trouble is, some entities have one attribute, others two

21:08 reiddraper: tuft: I don't know your specific problem, but does the general idea of generating ids after not work then?

21:09 tuft: reiddraper: well, i could dig around more. from the outset it looks like test.check's property checking functions expect a generator vs any old lazy sequence

21:09 reiddraper: wonder if i could write my own generator using range

21:10 probably would break some invariant to make a non-random generator...

21:10 reiddraper: tuft: you'll write your own generator uses the combinators in the gen namespace

21:10 Have you read the generator writing guide in the doc folder of the repo?

21:11 beamso: akurilin: i use bitbucket for private repos and github for public repos

21:12 tuft: reiddraper: indeed no. thanks i'll check it out

21:12 reiddraper: tuft: np

21:14 tuft: reiddraper: oh if you mean this then yes =) https://github.com/clojure/test.check/blob/master/doc/intro.md

21:14 reiddraper: tuft: I do, yes

21:17 tuft: perhaps another way of thinking about it: generate vectors of vectors of your entities. The inner vectors will represent one entity. Then use fmap to apply the incremental ids and flatten the list of tuples

21:19 Some of the inner vectors can have one attribute, some two

21:20 tuft: reiddraper: ah perfect, that should work

21:20 thanks =)

21:20 i'll report back

21:20 reiddraper: tuft: np

21:38 bbloom: ,(locking :foo)

21:38 clojurebot: nil

21:38 bbloom: ,(do (monitor-enter :foo) (monitor-exit :foo))

21:38 clojurebot: #<IllegalMonitorStateException java.lang.IllegalMonitorStateException>

21:38 bbloom: ^^ what's up with that?

21:39 akurilin: beamso: ok cool thank you

21:42 bbloom: ,(let [x :foo] (monitor-enter x) (monitor-exit x))

21:42 clojurebot: nil

21:42 bbloom: hmm seems like they only work on names, heh, odd.

21:48 oh hmm it's not locals

21:48 it seems that it's actually the jvm ensuring that a lock/unlock appears in a try/finally pair

21:48 crazy

22:03 shriphani: hi does anyone here know how I can make hiccup spit out pretty-printed html ?

22:17 aka: So twitter makes it clear I'm not the only one stoked for dnolen_ + Cognitect

22:18 arrdem: cognitect has a ridiculous team already

22:18 adding dnolen_ is just overkill, but totally osum

22:18 aka: now they're just being ridiculous

22:18 arrdem: count me stoked :P

22:25 aka: Anyone aware of a clojure lib that provides oauth based authentication for the major social sites like facebook/github/twitter/linkedin/etc... ?

22:27 tuft: reiddraper: fmap approach worked great

22:28 arrdem: aka: http://hydra-media.cursecdn.com/dota2.gamepedia.com/7/7f/Sven_item_05.mp3

22:28 reiddraper: tuft: happy to hear

22:36 aka: arrdem: we get it they can write the best f'ing apps ever :D

22:37 What is the current state of ClojureCLR? Is it pretty much feature complete and/or usable?

22:39 n00by_2: I have a question: by transposing an array I can treat the columns like rows. Is there an analogous operation that allows me to treat the diagonals as rows?

22:39 nDuff: aka, ClojureCLR had feature parity with Clojure/JVM way back in the Clojure 1.0 days.

22:40 aka, ...it might have fallen behind a little since then -- being under different maintainership -- but expecting it to be usable is very safe.

22:40 aka: I actually have no intention of using ClojureCLR.... was just curious.

22:41 thanks for the info

22:47 ddellacosta: aka: tooting my own horn here, but you can check out friend + friend-oauth2: https://github.com/ddellacosta/friend-oauth2 (examples: https://github.com/ddellacosta/friend-oauth2-examples)

23:09 aka: ddellacosta: awesome thanks

23:12 ddellacosta: any reason you didn't do a twitter example? Without more than a quick skim this looks great

23:12 ddellacosta: aka: twitter doesn't use oauth2 I don't believe

23:12 aka: could be wrong, haven't checked in a while

23:12 aka: oh I just assumed

23:13 ddellacosta: aka: other than that, just a lack of time. :-)

23:13 aka: yeah well I'm working purely off assumption here

23:13 so I'm likely wrong

23:13 ddellacosta: aka: oh, no, looks like they do

23:14 aka: or...do they? confused...

23:15 aka: maybe still not--I see some oauth2 endpoints, which is confusing, but this is all they have on their main page: https://dev.twitter.com/docs/auth/oauth

23:15 aka: I'm likely going to implement it (hopefully in the same fashion you are) and if that's the case I'll hit you with a pull request

23:15 yeah their docs seemed vague

23:16 specicially "based off of OAuth"

23:16 ddellacosta: aka: that'd be great--if you figure out if/how they support it, I'd love to add an example

23:16 aka: that makes me wonder

23:16 figuring out if they really use oauth could be more difficult than actually authenticating through twitter

23:18 ddellacosta: aka: they definitely use oauth 1.1, but doesn't seem like they support oauth2

23:20 bob2: is there a neat idiom for taking a list of maps that have an 'id' key, and converting it to a map of maps, keyed off 'id'?

23:25 arrdem: bob2: map?

23:25 bob2: well. reduce.

23:25 xeqi: I'd probably write ##(into {} (for [{:keys [id] :as x} [{:id 1} {:id 2} {:id 3}]] [id x]))

23:25 lazybot: ⇒ {1 {:id 1}, 2 {:id 2}, 3 {:id 3}}

23:25 xeqi: though a reduce works too

23:26 arrdem: ,(reduce (fn [a {:keys [id] :as v}] (assoc a id)) {} [{:id 1 :a :b} {:id 2 :b :a}])

23:26 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/assoc>

23:26 arrdem: ,(reduce (fn [a {:keys [id] :as v}] (assoc a id v)) {} [{:id 1 :a :b} {:id 2 :b :a}])

23:26 clojurebot: {2 {:id 2, :b :a}, 1 {:id 1, :a :b}}

23:26 bob2: ah, I was unclear: {:id 1 :somekey "somevalue"} -> {1 {:somekey "somevalue}}

23:28 xeqi: &(doc dissoc)

23:28 lazybot: ⇒ "([map] [map key] [map key & ks]); dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s)."

23:29 verma: hmmm

23:29 ddellacosta: &(group-by [{:id 1} {:id 2}])

23:29 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$group-by

23:29 verma: ,(dissoc {:a 1 :b 2})

23:29 ddellacosta: &(group-by :id [{:id 1} {:id 2}])

23:29 clojurebot: {:b 2, :a 1}

23:29 lazybot: ⇒ {1 [{:id 1}], 2 [{:id 2}]}

23:29 verma: ,(dissoc {:a 1 :b 2})

23:29 clojurebot: {:b 2, :a 1}

23:30 verma: ,(dissoc {:a 1 :b 2} :a :b)

23:30 clojurebot: {}

23:30 ddellacosta: bob2 ^ you can get most of the way there with group-by

23:30 verma: wonder why there's a dissoc which just takes a map and no keys

23:30 seangrove: Watching the Alan Kay Future video, wasn't expecting this at all

23:34 bob2: ah cool, group-by is nearly exactly what I wanted

23:34 (aside from putting the val in a vector, which is suboptimal in my case since :id is unique)

23:34 hiredman: ,(apply dissoc {} ())

23:34 clojurebot: {}

23:41 `szx: seangrove: in what sense?

23:45 seangrove: `szx: Much higher-level than I expected. Very compelling.

23:45 `szx: i feel like his talks are usually like that

23:46 seangrove: Good point, I should probably start raising my expectations for his talks :)

23:46 `szx: i've seen a couple of his talks and i don't think any of them were technical

23:47 yeah, i don't know about that - i feel like i've heard this one before :)

23:49 kenrestivo: is there some way to exclude from :aot a specific list of namespaces?

23:49 in lein's :aot key?

23:51 ah, nevermind. :aot :all in clojure-android does the trick

23:51 and :aot-exclude-ns

Logging service provided by n01se.net