#clojure log - Sep 10 2013

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

0:00 ddellacosta: callen: is there a way to link to a session in himera?

0:02 callen: zanes: not really. I'm very sick, my throat hurts, and I'm cringing and shaking at just swallowing food.

0:03 zanes: callen: Oh no!

0:03 callen: ddellacosta: screenie

0:04 ddellacosta: callen: naw, I won't make you deal with my IE8 woes. I'm going to poke at it and see if I can reproduce it in an isolated environment with the latest version of CLJS, and if so I'll file a bug report.

0:04 TEttinger: callen, kittens make sick times better http://imgur.com/gallery/iYfbrwb . just adopt all the cats at the local humane society in a fevered daze

0:05 callen: TEttinger: don't say that. I love dogs and cats.

0:12 TEttinger: thank you for the therapeutic kitty

0:12 TEttinger: get well soon

0:12 callen: TEttinger: thank you ;_;

0:13 TEttinger: we need you back and having to repeat yourself to people who ask poor questions in 24 hours

0:15 callen: I can't tell if that's genuine sympathy or a characterization.

0:16 TEttinger: callen, you fill a role here. if you're sick, #clojure has no bouncer for poorly asked questions.

0:17 callen: well don't that just warm the cockles. :)

0:17 TEttinger: and we do seem to get a lot lately

0:17 callen: TEttinger: I'm more worried about the bad answers than I am the bad questions these days ;)

0:18 coventry`: How can I tell lein to run clojure built from source, in such a way that I will end up with clojure/test-closure on my classpath?

0:18 TEttinger: when I'm here I'm probably too forgiving with people who really should get the advice "read a book/tutorial" and I try to solve their problems when they won't learn from it. and I also usually fail to solve their problems.

0:18 rhg: checkouts

0:18 callen: coventry`: ^^ what rhg said.

0:18 coventry`: Great. I assumed that wasn't going to work, because it's not a lein project.

0:19 callen: oh wait

0:19 source?

0:19 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

0:19 rhg: oh

0:19 callen: coventry`: is it a single file?

0:19 rhg: ehm

0:20 add it to the cclasspath manually?

0:21 callen: it sounds like it should either be made into a lein project, symlinked, or copied.

0:21 akurilin: Does ring by default turn on the stacktrace middleware in dev profile? I've never seen the ring stacktrace for 500s until now, and I never enabled it explicitly.

0:22 callen: akurilin: lein ring

0:22 ring doesn't "do" anything

0:23 rhg: callen be right ofc

0:23 akurilin: I guess this is the first time I'm doing an html content type GET, which explains why I haven't seen it before.

0:23 coventry`: Thanks, guys. I'll make clojure-test into a project, and symlink to that from checkouts/

0:24 callen: coventry`: good choice.

0:24 I need to start charging y'all.

0:24 surcharge for "sick and dying" support.

0:25 akurilin: callen, thanks for pointing that out, found out that stacktraces are on by default from the docs.

0:26 Not that anybody can read those things until a couple of months in.

0:26 stacktraces, not docs.

0:26 :)

0:26 coventry`: callen: If I succeed with this, it might reduce the number of stupid questions. I hope that's sufficient reward. :-) Anyway, off to bed. Hope your recovery is swift and painless.

0:29 callen: coventry`: your questions aren't crazy.

0:36 fkey: Hey there, trying to solve a issue the clojure way, and can't decide the best route. Bascially given a list of coordinates, i want to draw lines connecting each coordinate. For the last pair of coordinates, i want to determine the direction in which the line was drawn and then draw a arrow head at the end.

0:37 currently i got a bunch of procedural code and want to do away with it

0:38 so, for the connecting of arrows, using reduce does sound like a nice solution

0:39 but theres no way to determine if you are currently on the last item being evaluated, and i rather now calculate the direction vector every time reduced is called...seems wasteful

0:41 ambrosebs: fkey: map-indexed is often useful.

0:41 fkey: so , you think its fair to do something like

0:41 ah

0:42 meh still..i rather not do a if statement in each function map call..seems wastefulk

0:42 was planning on doing something like

0:43 (defn drawConnectionWithArrow [canvas points] (reduce drawLines ...) (drawArrow points ...))

0:43 ambrosebs: seems like you need a branch somewhere though?

0:43 ah

0:43 see butlast.

0:44 probably what you want

0:44 you can then feed the everything except the last thing into one fn, then the (last ..) into the other one.

0:44 fkey: hmm

0:45 as far as functional programming goes though, in clojure is it alright do do the above what i have posted? Seems a little procedural... but works

0:46 ambrosebs: with reduce?

0:46 nothing wrong with that.

0:46 unless it's too slow.

0:47 fkey: ambrosebs: well just function call right after the other... i mean i can probably do something like have drawLines return the last 2 points it operated on, then i can do (drawArrowAtTail (drawLines ... ))

0:47 ambrosebs: oh. yes that's fine.

0:47 fkey: not sure what is more succinct though

0:48 i just like the idea of have a function operate on the return value of another function

0:48 ambrosebs: fkey: seems better to separate them

0:49 fkey: oh yeah?

0:49 ambrosebs: you can then run whichever you want in any order.

0:49 or at the same time

0:49 fkey: hmmmm true true

0:50 i think back in common lisp, you had to use let or do to perform multiple forms in a function

0:50 mtp: progn

0:50 and no

0:50 fkey: or w/e you want to call it..still getting use to that being alright in clojure

0:51 ambrosebs: fkey: a `do` can still be readable. Says "side effects!" to me.

0:51 MisterSinister: Could someone teach me how to use if-let?

0:51 ambrosebs: so don't be afraid of putting extra ones.

0:52 fkey: ambrosebs: alright. i watched a talk on monads, i forgot who gave it but was talking about haskell and how they dealt with ouput and whatnot..i liked the idea

0:52 although my previous code isn't following monadic design at all heh

0:53 wasn't sure if it was something to strive for in clojure

0:53 francis_wolke: MisterSinister: clojuredocs.org

0:53 ambrosebs: fkey: not often.

0:53 MisterSinister: francis_wolke: I've looked at it, and I still don't really get the idea. I also suspect I might be thinking of the wrong tool to refactor my particular code pattern

0:53 Could I gist it to you and see if you can suggest anything?

0:54 I've seen that pattern before, and I dunno how to refactor it away.

0:54 francis_wolke: yea

0:54 ambrosebs: MisterSinister: put it here if you want.

0:54 MisterSinister: ambrosebs: It'll be tidier in a gist than me pasting it in here.

0:54 Gimme a moment.

0:54 ambrosebs: sorry I meant the link :)

0:55 I figured you were pming.

0:56 MisterSinister: ambrosebs: PMed.

0:57 https://gist.github.com/mrsinister13/6504991 if anyone else wants to help me refactor away this pattern I keep seeing.

0:59 fkey: ambrosebs:: ty for help

0:59 ambrosebs: fkey: np

1:01 francis_wolke: MisterSinister: I fail to see what you'd like to factor out - though prehaps I'm missing something?

1:02 MisterSinister: `if-let' is an anaphoric macro, there is no 'it' in either of those examples.

1:02 ambrosebs: I think MisterSinister want something like `if-every`.

1:03 Does that exist?

1:03 clj_newb_2345: how does swank/nrepl relate? is nrepl a repalcmenet for swank?

1:03 MisterSinister: I've never seen an 'if-every' in Clojure.

1:03 s4muel: clj_newb_2345: Yes.

1:03 ambrosebs: well it would be if-every-let :P

1:04 MisterSinister: Because what I'm trying to avoid is having to retype the same destructure and the same method call to the same let binding.

1:04 clj_newb_2345: so I should not use the lein-swank [plugin?

1:04 francis_wolke: MisterSinister: macros....

1:04 MisterSinister: francis_wolke: This is why I'm asking for help - I suck at them and wouldn't even know where to begin.

1:04 ambrosebs: MisterSinister: what do you want to write instead?

1:05 MisterSinister: Something like this:

1:05 francis_wolke: MisterSinister: aplogies, but I don't answer questions for people who won't read.

1:06 xeqi: clj_newb_2345: if you are used to swank it continues to work, but is unmaintained. nrepl is the prefered mechanism moving forward

1:06 MisterSinister: francis_wolke: What do you mean? It's not like I haven't read about macros - I just haven't ever written one and am unsure how to proceed.

1:06 ambrosebs: The best place to start with a macro is what you want the output to be.

1:07 MisterSinister: Yeah - I'm trying to think that through right now.

1:07 francis_wolke: MisterSinister: If you need some material on them, buy or pirate a book. Sit down with it, and read the chapter on macros - look at the examples, write the code, experiment, write some more code, experiment...

1:08 MisterSinister: francis_wolke: And I've tried that, and haven't gotten very far. Which is why I thought I could come to a channel full of people obviously better than I am at this to ask for some help with something I've tried to solve in the past but failed horribly, as I'm not even sure where to begin.

1:09 ambrosebs: francis_wolke: please, newbie questions are more than welcome here.

1:09 writing your first macro is not easy.

1:11 fkey: ambrosebs: can you take a quick look at my coding style? For some html5 canvas stuff i usually end up writing code like so http://pastebin.com/iTYMVVXs

1:11 oh, i messed up the parenthesis ...but the overall style..is it alright? or am i still thinking to procedurally?

1:12 francis_wolke: ambrosebs: acknowledged.

1:14 fkey: i probably can get away with the (first Points) and (restPoints) with parameter deconsturction

1:14 i think thats the name...

1:15 ambrosebs: fkey: yes, [p & ps]

1:15 clj_newb_2345: in nrepl

1:15 how do I get the last command?

1:15 i.e. UPARROW in bash/zsh

1:16 so basiclaly, I want the last expression I valuated to be thrown back into the current line

1:16 so I can edit it and rerun it

1:16 xeqi: clj_newb_2345: it depends on what nrepl client you are using

1:16 clj_newb_2345: what emacs command can I run to report this info to you?

1:17 ambrosebs: ,(drop 2 [1 2 3 4 5])

1:17 clojurebot: (3 4 5)

1:17 xeqi: clj_newb_2345: emacs was sufficent. then you are using nrepl.el. Try M-p

1:17 ambrosebs: what's the function for [1 2 3 4 5] => [4 5]?

1:17 xeqi: for reference, there are also nrepl clients for vim, eclipse, and a standalone one

1:18 clj_newb_2345: ah, M-p works, thanks

1:18 xeqi: $findfn [1 2 3 4 5] [4 5]

1:18 clj_newb_2345: I was trying C-p but it was sending me to preivous line

1:18 lazybot: []

1:19 xeqi: $findfn 2 [1 2 3 4 5] [4 5]

1:19 ambrosebs: ,(take-last 2 [1 2 3 4 5])

1:19 clojurebot: (4 5)

1:19 lazybot: [clojure.core/take-last]

1:19 ambrosebs: wow.

1:19 that's epic.

1:21 srruby: $findfn 2 [1 2 3 4 5] [4 5]

1:21 heath: ohai bear #clojure

1:21 lazybot: [clojure.core/take-last]

1:21 * heath is watching https://www.youtube.com/watch?v=-6BsiVyC1kM

1:21 ambrosebs: fkey: ^^ use take-last 2

1:21 heath: "the value of values" by ye ole rick

1:21 srruby: $findfn first [1 2 3 4 5] 4

1:21 heath: rich, rather

1:22 lazybot: []

1:22 heath: he's saying values should be immutable, just wondering why everyone seems to agree with him and not pipe up :)

1:23 fkey: ambrosebs: it amazes me how theres always a function in clojure for opearting on a data set..but then again

1:23 ambrosebs: heath: cos he's right?

1:23 fkey: i think rich hickey said few data types, many functions

1:23 srruby: $findfn [1 2 3 4 5] 1

1:23 heath: ambrosebs: why is he right?

1:23 lazybot: [clojure.core/first]

1:23 ambrosebs: heath: I can't explain it better than rich.

1:24 heath: he didn't explain it

1:24 "do we want to go back, no"

1:24 that's about it

1:24 s/it/all\ he\ said

1:24 fkey: ambrosebs: ty ty ty once again, i really appreciate the input

1:25 clj_newb_2345: is there a way to have "(use '[clojure.tools.namespace.repl :only (refresh)])" auto executed at the start of every "lein repl" ?

1:26 heath: he mentions comparibility and equality around the 10 minute mark

1:26 but you can compare values even if they aren't immutable

1:26 ambrosebs: heath: so the biggest thing for me that immutable values just never change.

1:27 xeqi: clj_newb_2345: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L296

1:27 ambrosebs: heath: if you have a language that facilitates that like Clojure, you have to think less about "will this change here"?

1:27 clj_newb_2345: is this a hint to read the rest of the file? :-)

1:27 ambrosebs: heath: transforms the way you program.

1:27 well, if you weren't programming in a "functional" style already.

1:27 francis_wolke: clj_newb_2345: look for :injections

1:28 MisterSinister: Immutability is awesome.

1:28 It's what actually drew me to Clojure.

1:28 xeqi: clj_newb_2345: I woudln't wory about it, maybe just :repl-options 's :init and :init-ns

1:29 ambrosebs: that's a local view however. bigger things like concurrency and databases like datomic use immutability to their advantage.

1:29 datomic can easily give you an immutable snapshot of you database, that never changes.

1:29 francis_wolke: clj_newb_2345: ignore me xeqi is correct.

1:29 clj_newb_2345: noted

1:29 /ignore ...

1:30 ambrosebs: and Clojure's atoms and refs show that you can have managed mutability holding immutable values without deadlocks or concurrency problems.

1:30 and it's fast!

1:30 and efficient!

1:31 how shit I love immutability! ;)

1:31 *holy

1:31 haha

1:32 heath: ah, if i would have just shut up and listened, he does explain a little later :)

1:33 ambrosebs: heath: is your background heavy with mutability?

1:33 heath: mostly

1:34 ambrosebs: heath: it's a different world out here, it may take some rubbing off.

1:34 heath: why dynamic and not static

1:35 ambrosebs: types?

1:35 heath: i thought he was referring to static typing :P

1:35 turns out clojure is dynamic :)

1:35 ambrosebs: I think Rich often says dynamic to mean types and runtime.

1:35 MisterSinister: heath: I came from Java. Mutability was burned into my brain too.

1:35 ambrosebs: at least that's my take on it

1:37 heath: most of my functional programming comes from my excursions with haskell

1:37 MisterSinister: Yay, I've used if-let correctly.

1:37 \me does a happy dance.

1:37 FFF

1:37 * MisterSinister does a happy dance.

1:37 MisterSinister: Better.

1:37 ambrosebs: heath: nice. immutable haven there.

1:37 heath: yerp

1:37 ambrosebs: MisterSinister: yay!

1:38 heath: most of my professional work is javascript and soon to be python

1:38 MisterSinister: Brb

1:38 heath: erlang has the same typing as clojure

1:39 anyway, at this point i'm just picking a fight for no reason, i should listen to the guy while transfer pdfs to the kindle

1:39 ambrosebs: heath: they're both strong dynamically typed langs.

1:39 heath: right

1:40 when i think of immutability, i think of strong and static

1:40 ambrosebs: right, fair enough.

1:40 they tend to have good support for immutability.

1:41 the functional ones, that is.

1:42 immutability also makes it much nicer to build a type system on top of Clojure.

1:44 gvickers: Made this as part of a plugin system to load .clj files dynamically and make sure they have the required function. It seems messy and a very un-clojure way of doing things. Prehaps dynamically loading the jar's would be better? Anyone have any experience with this sort of thing? https://www.refheap.com/b18653541d9bb3409904b3a51

1:46 ambrosebs: gvickers: you have to roll your own solution to that often.

1:46 gvickers: I don't think there's a particular accepted way to do it.

1:47 gvickers: FWIW it looks about right to me.

1:48 sdegutis: gvickers: another option is to use read-string on the file's contents and look for a list starting with (defn the-required-function ...)

1:48 Probably not 100% foolproof, but probably good enough.

1:49 ambrosebs: sdegutis: if you want to go that ^ route, use jvm.tools.analyzer.

1:49 gvickers: ^ rather

1:49 It seems any other solution would be more complicated than your current one.

1:52 gvickers: Hmmm thank you. I assumed this sort of thing would be more common with established design patterns. Thanks for your help!

1:53 ambrosebs: Racket is way ahead of Clojure in that regard unfortunately.

1:54 xeqi: gvickers: lein does something similar with https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/utils.clj#L53

1:55 sdegutis: ambrosebs: now's our time to copy whatever they're doing and catch up

1:56 ambrosebs: sdegutis: I have no idea how to write lazy-require :)

1:56 sdegutis: What's it do?

1:56 xeqi: gvickers: are you using the ref somewhere else?

1:56 ambrosebs: only load a namespace when a var is used.

1:57 sdegutis: Ooooh. Yeah.

1:57 ambrosebs: do want.

1:57 sdegutis: That's probably not even a good idea.

1:57 Because namespaces could have side effects upon loading that you want happening early. Maybe.

1:57 And other stuff.

1:57 gvickers: xeqi: yea

1:58 ambrosebs: sdegutis: yes, turns out Racket handles all of this.

1:58 sdegutis: See Flatt's keynote at Clojure/West

1:59 gvickers: I gotta check out Racket

1:59 sdegutis: ambrosebs: ok thx

2:01 * sdegutis wonders why Google doesn't have decent results for "why is my mac so slow and also i know what im doing" ?

2:03 heath: i guess this is my real question: how can one consider a value immutable if it's there's dynamic typing?

2:03 s/it\'s//

2:03 sdegutis: heath: can you change the value of 3?

2:04 3 = 2

2:04 heath: a = 3

2:04 sdegutis: (now 3 + 3 = 4)

2:04 heath: a = 2

2:04 a + b

2:04 ambrosebs: they are unrelated. The type system helps you reason about your code, immutable values just never change.

2:04 sdegutis: heath: a represents a value, a is not a value

2:04 ambrosebs: heath: can you explain what you think links static typing and immutability?

2:05 heath: isn't a representation simply a variable?

2:05 collections, numbers, i guess these are the things considered values within clojure

2:06 sdegutis: heath: what is your strongest language besides Clojure?

2:06 heath: clojure isn't my strongest :)

2:06 sdegutis: heath: what is your strongest language?

2:07 heath: javascript -> python -> haskell || agda -> erlang || c++

2:08 sdegutis: heath: in Python, you can create a list like X = [1, 2, 3], and then you can actually delete 3 out of X, and anyone who has access to X now sees [1, 2] right?

2:08 heath: sure

2:08 sdegutis: heath: in Clojure what we mean by "immutable" is that if I have X pointing to [1 2 3], and I "remove" 3 from it which gives me [1 2], anyone else who had access to X before I did that still has [1 2 3]

2:09 heath: ambrosebs: a = 1; a cannot equal anything else, that's how i see the link between immutability and static typing

2:09 sdegutis: heath: All I did was create a new copy of [1 2 3] that doesn't have 3 in it. I didn't "mutate" the list.

2:09 ambrosebs: nice tangent :P

2:10 heath: functions reference older copies of values, hm.

2:10 sdegutis: heath: No, not that.

2:11 heath: Even inside the same function, I can create X = [1 2 3] and create Y = X, and "remove" 3 from X, and Y is still [1 2 3] even though X is now [1 2]

2:11 xeqi: and becareful of the ""remove" 3 from X" part

2:11 sdegutis: heath: because when we say we're "removing" an element from a list in Clojure, we really mean something more like X = X.copy, X.remove_last

2:12 heath: that's what i was getting at sdegutis

2:12 s/getting\ at/said :)

2:12 ambrosebs: heath: there is nothing fundamental about immutable data structure or immutable variables that requires a static type system.

2:12 sdegutis: heath: This is all discussed in the Programming Clojure book. Please read it.

2:13 heath: but let's say you have a function that which will reference a variable each time it is called, if that variable is changed to represent an entirely different type, you will get a different result everytime the function is invoked

2:13 s/which//

2:14 sdegutis: heath: that's lexical scoping. Values are distinct from from variables.

2:15 heath: that's why this works ##(for [x [1 2 3]] (inc x))

2:15 lazybot: ⇒ (2 3 4)

2:15 sdegutis: heath: it's not that 1 is being mutated, but that "x" changes to hold a different value each time

2:15 heath: the 'vary' part of 'variable'

2:15 ambrosebs: try "local binding"

2:16 it's an immutable link from a name to a value.

2:18 andyfingerhut: I hope I'm not simply muddying the water by giving a similar example like (for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))

2:18 Each time through the for, x is bound to a different value. In my example, each of those values has a different type. So the name x names a value with a different type in different iterations. Each of those values is immutable, though.

2:20 ambrosebs: A static type system might type `x` as (Vector Any), but either way, it's still immutable.

2:21 sdegutis: andyfingerhut: add # before it and it evals like magic :)

2:21 No matter where it is in your message.

2:22 andyfingerhut: sdegutis: Thanks. I haven't kept up with all the bot-magic available.

2:22 #(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))

2:22 sdegutis: Wait let me test it. #(+ 1 2)

2:22 Maybe it's two.

2:22 Testing ##(+ 1 2)

2:22 lazybot: ⇒ 3

2:22 sdegutis: Okay yeah two.

2:22 andyfingerhut: ##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))

2:22 lazybot: ⇒ (3 3 2)

2:23 andyfingerhut: ##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (type x))

2:23 lazybot: ⇒ (java.lang.String clojure.lang.PersistentHashSet clojure.lang.PersistentVector)

2:23 sdegutis: Heh for a second I misread that as an exception and was wondering what was wrong with the code which seemed fine.

2:29 zRecursive: ##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))

2:29 lazybot: ⇒ (3 3 2)

2:32 rhg: Heh

2:38 clj_newb_2345: what does defroutes return, and how do I "intercept it" ? So for example, I'm runing my ring/compojure server via : (run-server (site #'all-routes) {:port 3000})) ---- now, suppose I wnat to update my routes; how can I setup it up so that I can dynamically update the routes?

2:40 SegFaultAX: clj_newb_2345: It just returns a function.

2:46 mange: clj_newb_2345: If you use that line to start your server then you should be able to re-evaluate your (defroutes all-routes ...) form and the server will automatically pick up the new version.

2:47 The trick is that your #' introduces another level of indirection that looks up the function in the all-routes var when it's invoked.

2:49 MisterSinister: Does anyone know if there's some function that takes a collection and returns every ith item in it?

2:49 I don't wanna have to write it if it exists already.

2:50 mange: take-nth, I think?

2:50 clojurebot: Huh?

2:50 MisterSinister: Lol@clojurebot.

2:51 Thanks mange, you're absolutely right.

2:51 I swear, Clojure's thought of everythign you could ever want from sequences.

2:52 ,(doc take-nth)

2:52 clojurebot: "([n coll]); Returns a lazy seq of every nth item in coll."

2:55 akurilin: Quick question about function purity in Clojure. Say I have this map with config settings for my Ring app somewhere in a configs.clj. If I wanted to be completely pure I'd just pass this map along to every call that might need it. On the other end of the spectrum I could read it from anywhere in the codebase as immutable global state. What is the sweet spot in Clojure for this kind of tradeoffs?

2:55 Should I have a convention where, for example, I never reference that var outside of say, the top level functions in my controllers.

2:56 ambrosebs: akurilin: if it never changes I think a def is fine.

2:57 akurilin: ambrosebs, is the idea then that for testing I just override the def with appropriate settings?

2:58 ambrosebs: akurilin: ah, good point

2:59 akurilin: The prob is that I'd have to either load a test-only config file for lein test runs, which is I believe what Rails does, or I could wrap all tests in with-redefs fixtures.

3:01 ambrosebs: akurilin: maybe a top-level atom might be useful.

3:05 MisterSinister: Also, holy shit source code for if-let.

3:06 ambrosebs: MisterSinister: *mind blown*

3:06 it's if... and let

3:07 MisterSinister: If I actually had to write if-every, I'd probably have some trouble.

3:11 ,(doc drop-nth)

3:11 clojurebot: Titim gan éirí ort.

3:11 MisterSinister: Dafuq.

3:12 Why is clojurebot telling me to get down and stay down in Gaelic?

3:12 ambrosebs: ##(doc drop-nth)

3:12 lazybot: java.lang.RuntimeException: Unable to resolve var: drop-nth in this context

3:12 ambrosebs: haha

3:12 these bots..

3:12 MisterSinister: OK, looks like I'll have to write it.

3:14 Maybe I'll have to bite the bullet and actually learn for.

3:14 ,(doc for)

3:14 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ...

3:16 ambrosebs: MisterSinister: something like this: https://gist.github.com/frenchy64/6505818

3:16 MisterSinister: That is a very nice macro you got there.

3:16 \me borrows it for his utilities.

3:17 * MisterSinister borrows it for his utilities.

3:18 ambrosebs: MisterSinister: haven't tested it.

3:18 actually just updated it too.

3:18 forgot an unquote

3:18 MisterSinister: I'll do a few macroexpands with it.

3:19 In the let?

3:19 For rhs?

3:19 ambrosebs: yes, should be fixed.

3:20 you might want to steal if-let's error reporting too.

3:20 MisterSinister: Probably.

3:21 I need to figure out how to call this thing.

3:21 I get it in theory.

3:21 ambrosebs: like if-let

3:21 there's an example on the gist now

3:21 MisterSinister: OK.

3:22 Ah, I see now.

3:22 Awesome.

3:23 Thanks!

3:27 Is there a macro that automatically destructures a map whose only keys are symbols (i.e. a record) and binds to the non-symbol equivalents of each key?

3:28 For instance, if I had {:foo "a" :bar "b}

3:28 callen: MisterSinister: bravo on coming up with something I haven't seen requested before

3:28 MisterSinister: It would expand into {:keys [foo bar]}

3:28 callen: seriously, bravo.

3:28 MisterSinister: callen: Are you being sarcastic?

3:28 callen: MisterSinister: do you want this for fn arg destructuring?

3:28 no, very sincere. initially.

3:28 the initial problem statement was unique

3:28 the final request sounds like it won't be

3:29 MisterSinister: Yeah, I did want it for function arg destructuring.

3:29 But ordinary let destructuring would be nice also.

3:29 callen: MisterSinister: a few points of order: don't do that. Just pass a map around

3:29 MisterSinister: you do *not* want implicit symbol injection like that. it makes it impossible to know where the fuck they came from.

3:29 MisterSinister: I see.

3:29 callen: also, the macro can't possibly know what keys are in the map

3:29 the map doesn't exist at compile-time, ya dig?

3:30 MisterSinister: Yeah, I dig.

3:30 Oh well.

3:30 callen: instead, I will (apply hash-map rest) where the fn restructuring is [arg1 arg2 & rest]

3:30 and rest is something like [:a 1 :b 2]

3:31 MisterSinister: avoid unnecessary/low-productivity sources of magic. Save the brainpower for solving your actual problem.

3:31 MisterSinister: callen: Still something I'm learning about, admittedly.

3:31 maxthoursie: Hi. The style guide says use (:kw object-like-map) for objects and (collection-like-map :kw) for collections. Whats the difference between objects and collections?

3:31 ambrosebs: [arg1 arg2 & {:as rest}] might be clearer.

3:32 callen: ahhhh fuck.

3:32 ambrosebs: just outclassed me. Thanks.

3:32 ambrosebs: sniped.

3:32 * callen feigns death

3:33 ambrosebs: xD

3:33 callen: is there any better drug than happy users?

3:33 MisterSinister: None whatsoever.

3:33 :D

3:33 callen: I have like 3 users and making them happy is FUNNNNNN

3:33 MisterSinister: People on here are so nice.

3:33 callen: MisterSinister: I'm not. the rest are. mostly.

3:33 ambrosebs: haha

3:33 maxthoursie: "The style guide" might be vauge, I was refering to http://dev.clojure.org/display/community/Library+Coding+Standards

3:34 callen: for any who run into it, do not listen to batsov's style guide.

3:35 maxthoursie: callen: that guide differ on that point

3:35 but since I don't understand the library coding stadards, it makes no differnce to me right now

3:35 :)

3:35 MisterSinister: callen: Actually, that was a very nice response.

3:35 I never expected that.

3:36 maxthoursie: (= nice (rest ppl))

3:36 MisterSinister: So that makes callen (first ppl).

3:37 Also, maxthoursie, wouldn't it be (every? nice? (rest ppl))

3:37 ?

3:37 maxthoursie: MisterSinister: indeed, was just thinking about it

3:38 Ember-: I prefer (-> ppl (make-nice) (throw-a-party-with))

3:38 callen: Ember-: looks kinda side-effecty

3:38 MisterSinister: They make new people.

3:38 callen: Ember-: wouldn't the throw-a-party-with fn create a lot of garbage to collect?

3:38 MisterSinister: It's referentially transparent.

3:38 * callen do ho hos at his terrible joke

3:38 maxthoursie: no fun to party with only new ppl

3:38 Ember-: callen: sure it would. Good that we have an efficient gc

3:38 I'd like one into my apartment too

3:39 callen: Ember-: and HotSpot (TM ORACLE TOUCH IT AND WE KILL YOU)

3:39 Ember-: my wife is doing a decent work but there's always room for improvement

3:39 callen: my landlord actually pays for cleaners. I have no wife :(

3:39 I started out that sentence bragging, then saw your comment about your wife :P

3:39 Ember-: I own the flat I live in and I have a wife

3:39 I have no landlord

3:39 MisterSinister: Ember-: Some of us are lucky like that.

3:40 callen: Ember-: I'm young and live in the bay area. I'm not sore about being a renter. Nobody expects me to own land.

3:40 or a flat.

3:40 Ember-: hehe

3:40 I live in Helsinki Finland

3:40 maxthoursie: I think I use a generational gc, I only clean up the young collection, I never get to cleaning it all

3:40 MisterSinister: I think my brain needs better gc.

3:40 Ember-: and I'm youngish (31)

3:40 callen: maxthoursie: I used to have that problem, but I started collecting more often and it fixed the problem.

3:41 Ember-: I've been a working-coder for 7 years but I'm younger than you.

3:41 maxthoursie: callen: That's probably exactly what I would need

3:42 Ember-: callen: I've founded a software company, ran it and sold it

3:42 had 11 ppl working in it when we sold it

3:43 bragging contest(tm)

3:43 callen: Ember-: I've worked for 3 startups, started one, and joined one as a CTO. No exits/surviving successes yet. Last one was a near miss though. :(

3:43 MisterSinister: CTO?

3:43 Ember-: chief technology officer

3:43 callen: for which the responsibilities vary *wildly* depending on how mature the company is.

3:44 Ember-: indeed

3:44 MisterSinister: Ah.

3:44 I'm just a grad student.

3:44 Ember-: in a bit larger company that feller would actually be responsible of technology choices being used in the company

3:44 MisterSinister: I use Clojure for implementing algorithms I'm working on.

3:45 Ember-: in a small startup that is just a title

3:45 callen: a CTO at a startup can be anything from a glorified code monkey, to a PM, to a strategist, to a futurist.

3:45 Ember-: that guy *will* do *anything*

3:45 CTO in a startup will do sales too

3:45 and maybe even marketing

3:45 callen: Ember-: I was half PM/cheerleader, half hacker. I implemented the 2nd version of the core algorithm our product was based around, a neuroscientist did the first version.

3:45 MisterSinister: So CTO = Chief Trouble-solving Officer?

3:46 callen: Ember-: I've done sales before, but not for that company, only for the company I founded.

3:46 Ember-: MisterSinister: ha :)

3:46 callen: MisterSinister: to be fair, the CEO does plenty of problem solving too, just of a different sort typically :)

3:46 Ember-: callen: oh, you're still continuing on the bragging contest? :)

3:46 MisterSinister: Or possibly Chief Trick-turning Officer, by the sounds of it.

3:46 callen: Ember-: more just catharsis. Like I said, last one was a near-miss. Kinda need to talk about it.

3:46 MisterSinister: Also, holy shit, this code.

3:46 Ember-: I created a SPA framework back when SPA was pretty much unheard of which gave our product a competetive edge

3:46 callen: Haven't really had a chance to sit down and talk it out with anybody who would understand.

3:46 MisterSinister: (if ((comp contains?) (set (keys vertex-map)) u)

3:46 yeah....

3:47 Ember-: that product had a distributed versioning data model

3:47 callen: most people who haven't done startups aren't sympathetic at all.

3:47 Ember-: but lol, this is so stupid

3:47 I actually have some work to do :)

3:47 MisterSinister: callen: Try me.

3:47 callen: nah. I need sleep. meeting at 10 am.

3:48 MisterSinister: This is why I love being at GMT+12.

3:48 I exist in everyone else's bedtimes.

3:49 seancofield: MisterSinister: bedtime is a movable concept :)

3:51 MisterSinister: seancofield: Depends on your line of work.

3:51 What kind of music do you guys like to code to?

3:51 I need some.

3:51 seancofield: I work from home full time and my team is spread across several timezones...

3:51 MisterSinister: seancofield: So your concept of 'bedtime' is 'whenever i can find an hour'.

3:52 seancofield: if i had my way, i'd sleep 'til noon and work 'til midnight :)

3:53 MisterSinister: Likewise. Unfortunately, I have to teach classes, and they start rather too early for my liking.

3:53 callen: seancofield: I have psychotic coworkers who think meetings before lunch time is anything other than torture, so I can't do that :(

3:53 (I exaggerate for dramatic effect, I love my coworkers. Srsly.)

3:53 seancofield: I did some traning today... fortunately the client was in Australia so it was 8-10pm for me :)

3:54 callen: seancofield: I taught some Clojure today! also where's your r?

3:54 did you change from corfield to a mathematical topology?

3:54 MisterSinister: callen: Yay for you teaching Clojure! I wish I could.

3:54 seancofield: lol... i clearly couldn't type when i signed in on my other machine!

3:55 callen: seancorfield`: you should just use a persistent IRC session.

3:56 seancorfield: better? :)

3:56 teaching clojure is good :)

3:56 callen: yes but you should eliminate the schelp altogether with a persistent IRC session.

3:56 schlep*

3:56 seancorfield: callen: it's complicated :)

3:57 callen: persistent IRC sessions aren't complicated :(

3:57 you use ZNC or GNU Screen.

4:04 seancorfield: windows...

4:04 callen: seancorfield: you can still do it.

4:05 seancorfield: i will even halp :)

4:05 * ucb waves

4:05 seancorfield: i like the setup i have... i use erc in emacs for IRC

4:05 ucb: seancorfield: you could bounce via znc

4:06 callen: which is my point

4:06 ucb: oh, it's been suggested already :)

4:06 callen: seancorfield: you can use any client you want :)

4:07 ucb: hi!

4:07 ucb: callen: !

4:07 callen: colloquy doesn't play nice with ZNC mind you

4:07 there's a znc thing for ERC though

4:07 I used it for a while

4:10 callen: how you?

4:11 callen: been absurdly ill and fighting to meet a deadline

4:12 ucb: not a great combination

4:12 callen: never taken as good care of myself while sick as I have at this job while sick.

4:12 ucb: so that's a good thing then

4:12 callen: I have to basically defend the use of Clojure and Datomic for a project in front of most of the engineers at my company in two days and I can barely speak.

4:13 ucb: do it mime style with plenty memes on every slide -_-

4:13 callen: I'm probably going to set some ground-rules before beginning the talk.

4:13 ucb: considering that option :P

4:13 ucb: heh

5:29 glosoli: hmm how can one do OR in query using clojure.jdbc

5:29 ?

5:29 clojure.java.jdbc"

6:00 TEttinger: congrats Clojure! You're the #1 Lisp dialect since january 1st 2013 in terms of projects created on github. Unless you have an odd definition of what is lisp.

6:01 https://dl.dropboxusercontent.com/u/11914692/LanguageStats.txt got this off the Github API today

6:01 behind prolog because github thinks PDF files are prolog source

6:04 ambrosebs: kaw: did you figure out how to provide arguments to reduce with core.typed?

6:06 kaw: ambrosebs: No, I think I could still use some help with it.. but I looked at the example project and got a little further

6:07 ambrosebs: kaw: FYI there's also #typed-clojure

6:07 kaw: I can't look at it in detail now because I'm at work and it wasn't a work project, but is there a simple solution?

6:07 Aha, might look into that

6:08 ambrosebs: kaw: what was the problem again?

6:08 kaw: Well, when you pass a non-empty sequence to map you get a non-empty sequence back out

6:08 ambrosebs: and you're passing that to reduce?

6:08 as the 3rd arg?

6:08 kaw: Yeah

6:09 Which I don't think should be a type error if I can guarantee that the original sequence isn't empty?

6:10 ambrosebs: You should be hitting this funciton type of reduce: [[a c -> a] a (Option (Seqable c)) -> a]

6:10 that's the most general one.

6:10 it doesn't expect a non-empty seqable.

6:11 So I suspect the error is somewhere else in the call to reduce.

6:11 Did you get a big polymorphic error from reduce?

6:12 kaw: Hmm

6:12 Well, can't remember the details now, but it was the two-argument reduce, not the three-argument one (was mistaken saying it was the third arg, sorry)

6:12 ambrosebs: ah ok.

6:12 kaw: Not sure if that would influence anything

6:13 But my core problem was that map didn't seem to preserve nonemptiness

6:13 My code would have broken if the sequence was empty, but I could guarantee that it wasn't empty

6:14 ambrosebs: a quick way to cast to nonempty is (let [s (map ...) _ (assert (seq s))] (reduce ... s))

6:14 map isn't accurate enough yet to figure that out.

6:15 kaw: Hm, okay

6:15 I guess I'd like to keep the typed stuff at the top level as much as possible

6:16 ambrosebs: kaw: as in, you don't mind the assertion?

6:16 or you'll skip checking that function?

6:17 kaw: Well, maybe I'll add it if it's the only way.. depends on how many such things I have to change all over my project

6:18 Maybe skipping the tricky functions would be an option, I haven't really looked into skipping yet

6:18 ambrosebs: kaw: map could be made more accurate. I'll have a look.

6:19 kaw: But I guess I can see that just preserving nonemptiness would be a bit hackish

6:19 Since there's actually much more that it preserves

6:19 ambrosebs: kaw: Maybe not, because a lot of functions have different behaviour based on emptiness.

6:20 it may be worth adding.

6:20 kaw: True

6:20 But I mean, I can see how it would be a challenging function to type

6:21 ambrosebs: kaw: it would have to be hard-coded in general, but I think an arity [[a -> b] (NonEmptySeqable a) -> (NonEmptyLazySeq a)] would be useful.

6:21 that wouldn't need hard coding.

6:21 perhaps even for variable arguments of non-empty seqables.

6:30 kaw: (cf (map inc [1 2 3])) => (NonEmptyLazySeq AnyInteger)

6:30 works well

6:31 shall push a release for you to play with.

6:32 kaw: Wow, thanks, I'll look into it when I get home

6:33 Good to have the project dev so easily accessible

6:38 ambrosebs: kaw: Try 0.2.5-20130910.101144-9

6:38 repository info for snapshots is in README

6:59 Fender: hi there, I have a question: I deploy my JAR (created with lein jar) manually to a server and I want to fetch all the dependencies over there, what is the program I need?

7:00 I suppose it is maven / leiningen, however, the question seems so basic that it's hard to find something about it

7:02 of course I dont want to pull all my source on the cloud server and run "lein deps" over there

7:03 hyPiRion: Fender: would it be viable to do `lein uberjar` instead, and deploy that jar?

7:03 Fender: hmm, this is how I do it right now

7:04 but I hate to upload all the complete uberjar after just fixing a minor error in my source

7:05 hyPiRion: Then I'd just use git and push the source code up, and pull it from the server

7:05 *on the server

7:05 Fender: hmm, this is also not the "clean solution"

7:06 I thought the whole thing about maven is to just run one command and it automatically fetches all JAR dependencies

7:06 hyPiRion: yes?

7:07 clojurebot: yes isn't is

7:07 Fender: I mean if lein does such a great job why shouldnt there be something as simple as a jar dependency fetcher

7:08 however, it is hard to find anything useful if you google for "maven jar fetch dependencies"

7:08 and lein in the query doesnt really help either

7:08 justin_smith: mvn deps?

7:09 Fender: hmm, let me check

7:11 justin_smith: well there is no mvn deps command, I wonder what 'lein deps' runs

7:11 Fender: hmm, didnt find anything either

7:11 supersym: :refer-clojure excludes from the core namespace, but how to exclude the other ns functions? :exclude on the required coords doesn't seem to work (anymore)?

7:12 Fender: I'd like "X deps myjar.jar" that downloads myjars deps, the question is "what is X?"

7:13 why is project.clj and pom.xml in the jar if not for this very purpose?

7:13 justin_smith: mvn dependency:get

7:14 figures the java version is more verbose

7:15 supersym: ok nvm, this is definitly due to LT

7:17 Fender: alternatively, a "lein deps" on a jar would be even nicer

7:17 supersym, I dont understand what you mean with coords

7:18 supersym: (require '[some.lib :excludes [some-func])

7:18 I guess not coordinates,...those are the vectors in :dependencies

7:19 justin_smith: is it :exclude or :excludes?

7:19 Fender: do you need this when you require it? this IMO makes much more sense when you 'use the dependency

7:19 ok, afk

7:19 supersym: Fender: yeah I've been hardly using 'use but for a few of those cases perhaps :)

7:19 ambrosebs: ,refer

7:19 clojurebot: #<core$refer clojure.core$refer@1dfe879>

7:20 ambrosebs: ,(doc refer)

7:20 clojurebot: "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to somethin...

7:20 clgv: vision for JDK 10+: "No more primitives, make everything objects"

7:20 ambrosebs: supersym: (:refer some.lib :exclude [some-func]) I think

7:20 supersym: my mistake, I had it correct here

7:21 clgv: interesting statement. since I do not think they want to sacrifice performance for numerical computations, the goal is probably to have efficient numeric objects

7:21 supersym: ambrosebs: right, thanks

7:22 justin_smith: clgv: maybe packed up numerics, all ready for simd

7:22 standardized groups of 128 or whatever

7:23 clgv: well wont happen before 2017 anyway and most likely later...

7:48 Fender: if efficient "primitive objects" were possible, I think they would have gone in that direction a long time ago

8:19 ivan: JVMLS 2013 for your youtube-dl needs https://www.refheap.com/66950723e1aa930701728f696/raw

8:34 clgv: Fender: well, but do you think they will sacrifice performance for numerical computation?

8:53 Fender: clgv: No, that would be also "stupid" :) Then again, Oracle isnt exactly known for its wise decisions wrt Java in the last years

8:53 frankly, I have no clue why they'd do that

8:53 afaik, the Java "deciders" are as efficient as a committee", i.e. not

9:57 ljos: Anyone know of any resources on using clojurescript in phantomjs?

10:03 I am especially wondering how to do the /require/ part as it seems like from the examples that phantomjs uses requirejs to do that that.

10:12 jjttjj`: Hmm not sure where I should even ask this, but how do I properly escape a string that contains quotes that's being sent within clojure code to nrepl in elisp

10:12 https://www.refheap.com/18505

10:13 Where the string being upper-cased has a quote in it

10:14 (just using upper-case as an example fn here, that's not what i'm trying to accomplish)

10:15 wakeup: hi all

10:16 jjttjj`: hello wakeup

10:17 wakeup: Am I right to assume that [org.clojure/java.jdbc "0.3.0-alpha4"] is what is currently recommended to work with SQL databases?

10:17 and further more what do I have to do to get the SQLite driver loaded?

10:17 I get a SQLException No suitable driver found for jdbc:sqlite:...

10:18 jjttjj`: Have you seen the githup page? https://github.com/clojure/java.jdbc

10:18 coventry`: jjttjj: String manipulation is a pain in elisp. This may get you started. Not sure it's the best way, given that you'll be looking for multiple quotes, some of which may already be escaped. (let ((target "bar \"foo\"")) (string-match "\"" target) (replace-match "\\\\\"" nil nil target))

10:18 ljos: wakeup: I used https://github.com/korma/Korma the last time I was doing sqlite work in clojure.

10:18 wakeup: jjttjj`: thanks I should have scroleld down more

10:19 ljos: I will go with plain param. queries since my use case is very simple

10:20 jjttjj`: coventry`: cool thanks gonna stare at that until it makes sense :)

10:22 coventry`: C-h i d m elisp <RET> i string-match <RET>

10:24 jjttjj`: coventry`: cool

10:26 wakeup: "SQLException query does not return results" Why would it I do a CREATE?

10:28 is there a version of jdbc/query that doesn't expect a result?

10:35 jkkramer: wakeup: clojure.java.jdbc/execute!

10:39 wakeup: jkkramer: using DB-DO-COMMANDS now, thank you anyways

10:49 ambrosebs: ,(doc *file*)

10:49 clojurebot: "; The path of the file being evaluated, as a String. Evaluates to nil when there is no file, eg. in the REPL."

10:49 ambrosebs: is *file* usually relative or absolute?

10:50 wakeup: Oh yes this is fun...

10:50 pepijndevos: ,*file*

10:50 clojurebot: "NO_SOURCE_PATH"

10:51 wakeup: SIGSEGV (0xb) at pc=0xb6f0abed, pid=6859, tid=2675309376

10:51 My JRE segfaults when I do a jdbc/query

10:51 while doing some kind of get unicode char thing

10:51 ToxicFrog: Awesome

10:54 wakeup: (jdbc/query spec "INSERT INTO store(key, value) VALUES(?, ?)" key value)

10:54 squidz: cemerick: I'm trying to use clojurescript.test, but I keep running into the following error: TypeError: Undefined is not an Object (evaluating 'Function.prototype.bind.apply')

10:54 wakeup: any ideas what I am doing wrong? (key and value are strings)

10:55 squidz: has anybody come across this before? here is my project.clj, plus the full error --> https://www.refheap.com/18507

10:56 Bronsa: ambrosebs: *file* should be absolute

10:56 ambrosebs: Bronsa: thanks.

10:56 cemerick: squidz: no idea what that is. Looks more like an app- or library-level problem?

10:57 or maybe you're trying to use some JS API that phantom doesn't support?

10:57 jkkramer: wakeup: what db? are you using the latest driver? are you sure the JRE and db are set up for utf-8 correctly?

10:57 squidz: cemerick: yeah, I get the same problem with specljs, and when I was playing around with that, starting a new project seemed work fine. Just when I'm trying to use phantomjs with my already existing code seems to freak it out

10:58 cemerick: squidz: have you gone and looked to see what's going on at the specified line number in the generated js?

10:59 justin_smith: wakeup: what db? a coworker discoverd utf8 table name bugs in postgres that are still outstanding

10:59 wakeup: jkkramer: sqlite, org.xerial/sqlite-jdbc "3.7.2", how do I check?

10:59 squidz: cemerick: yeah this is being called: (js/Function.prototype.bind.apply orig-fn nargs)

11:00 ciphergoth: is this the right place to talk about ring? I have an idea on how ring could be extended to make my life better :)

11:00 wei_: how do you test compojure routes with sessions? specifically with sandbar stateful sessions, if anyone's using that

11:01 ciphergoth: I'm looking at the method "set-body" in ring-servlet. It tests if :body is a string, a seq, an InputStream or a File, and writes the body to the servlet output stream in each case

11:01 wakeup: jkkramer: could you try to reproduce if I gave you a minimal gist?

11:01 jkkramer: wakeup: does (System/getProperty "file.encoding") say utf8?

11:02 ciphergoth: https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L81

11:02 jkkramer: wakeup: not at the moment, have to get back to work. guessing it's a problem with sqlite driver or something. google shows some results for "java sqlite segfault"

11:02 ciphergoth: it would be neat if it had a clause that read (fn? body) (body (.getOutputStream response))

11:02 wakeup: jkkramer: yes it does

11:02 squidz: cemerick: I tried setting it up on windows and linux and I get the same error. Phantomjs may be to blame

11:03 cemerick: squidz: do the tests in question work under e.g. chrome or firefox?

11:05 gfredericks: I think I am opposed to macros that just wrap things in (var)

11:05 squidz: cemerick: I haven't tried. Can I call one of clojurescript.tests run functions from the console? if so which one?

11:07 cemerick: squidz: all of the test-* fns work under any suitable cljs REPL

11:10 squidz: cemerick: it seems to work. It returns cljs.core.PersistentArrayMap {} after running run-all-tests in the console. I think it may be related to this: https://github.com/ariya/phantomjs/issues/10522

11:10 sm0ke: Hello why is this giving stream closed error? (with-open [rdr (reader "src/examples/utils.clj")] (take 2 (line-seq rdr)))

11:11 llasram: sm0ke: Lazy evaluation

11:11 sm0ke: Well, lazy sequences

11:11 sm0ke: aha

11:11 cemerick: squidz: heh, yeah, that'll do it

11:11 sm0ke: doall?

11:12 llasram: sm0ke: That's what it's there for :-)

11:13 cemerick: squidz: you could try getting slimerjs to work with clojurescript.test? Looks like it's easy to do, and might give you relief from the phantom issue? https://github.com/cemerick/clojurescript.test/issues/10

11:13 'course, slimerjs might have the same problem (or a whole different set of them)

11:13 sm0ke: hmm ... hey are you the one with abracad repo?

11:13 i am using it..thanks for open sourcing

11:13 llasram: sm0ke: Oh, yep. That's me.

11:13 sm0ke: Oh! Awesome

11:14 squidz: hm yeah it may. I read that adding this function seems to do the job, but i'm not sure where would be a good place to put it https://github.com/c9/smith/blob/master/tests/public/test.js#L2-L7

11:15 maybe in my runner.js

11:16 adding it seemed to change nothing :/ maybe I just have to give slimerjs another shot, but IIRC it didn't work/had the same problem when I tried last time

11:18 cemerick: squidz: that code would need to be added to your generated test js, not in the runner. You can just transliterate it to ClojureScript if you want, and include it in your codebase (with suitable guards to not overwrite an existing bind impl.)

11:18 sm0ke: hello i am new to clojure , is actor based concurrency encouraged in clojure? If yes what libraries are most common ?

11:19 dnolen: sm0ke: not encouraged, though I'm sure there are proponents, also there's core.async which gives you CSP.

11:20 squidz: cemerick: is there an easy way of adding it to my compiled js without translating it to clojurescript to compile it?

11:20 cemerick: squidz: :libs or :foreign-libs...but, it's only 5 lines...

11:20 sm0ke: thanks

11:21 squidz: cemerick: after pasting it into the head of my compiled js it seems to be working now. Thanks

11:22 tbaldridge: sm0ke: actors couple concurrency, state management, and processes all together in a single "thing" that can't be decoupled. In core.async, we have queues for concurrency, go blocks for processes, and atoms/refs for state management.

11:22 sm0ke: this allows you to create stateless queue processors, or processes that share a single mutable state for instance

11:23 sm0ke: tbaldridge: isnt single mutable instance bad?

11:23 state*

11:23 tbaldridge: sm0ke: "power through pulling things apart" is probably a motto of the Clojure community.

11:24 sm0ke: Clojure provides primitives for allowing safe mutating of shared references, but yes, in general we should avoid state, but no matter what you do, you'll always have "mutable state".

11:24 sm0ke: notice how Erlang users like to say "no mutable state". They still have it, it's just hidden as the arguments to the function that processes the next message.

11:24 mdrogalis: I'd get a kick if you guys renamed core.async to "actresses".

11:25 sm0ke: ok one more thing? actors libraries if propery designed run several thousand actors on a sigle thread? how is this in clojure core.async?

11:25 mdrogalis: sm0ke: go blocks are extremely light weight.

11:26 sm0ke: is go blocks something similar to golang channels? sorry i am very new to the scene!

11:26 tbaldridge: sm0ke: we can do that as well, go processes can be as light as a few hundred bytes (or less). And they do not map 1:1 to threads.

11:27 sm0ke: yes, core.async is basically a implementation of many of Go's channel features on Clojure (and the JVM).

11:27 sm0ke: good way to get started, https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj

11:28 sm0ke: thanks guys! i am enjoying learning clojure!

11:28 tbaldridge: sm0ke: awesome!

11:28 mdrogalis: :)

11:29 sm0ke: also since we are at it? do we have a high performance rest server already written?

11:29 fredyr: go blocks are similar to goroutines, isn't it?

11:29 sm0ke: :)

11:30 tbaldridge: fredyr: close, I'm not exactly sure how Go's goroutines are implemented, but they should be similar

11:30 fredyr: right

11:30 mdrogalis: tbaldridge: You recall the code review I sent you about buffered, spatial aware queues?

11:31 tbaldridge: mdrogalis: yes

11:31 mdrogalis: tbaldridge: I took your approach through the entire simulation. It's getting close to finished. That bit of code is 1/4 it's original size, 1x times faster, and testable.

11:32 1 thousand x faster* ^

11:32 tbaldridge: mdrogalis: nice!

11:32 mdrogalis: Blew my mind man.

11:33 sm0ke: hmm http-kit and compjure seemsto be doing pretty well http://www.techempower.com/benchmarks/#section=data-r6&hw=i7&test=json

11:34 mdrogalis: Is there any reason to use reducers over pmap when the latter works okay?

11:34 tbaldridge: sm0ke: yes, look into compojure and ring, and then those two run on a bunch of JVM servers.

11:35 mdrogalis: it really depends on the task, pmap will convert a vector to a seq. Reducers will keep it as a vector, and since the structure of vectors is basically a tree, reducers will allocate a thread to each branch.

11:36 mdrogalis: so pmap will try to allocate a thread to each item (up to a max number of threads). reducers will allocate a thread to each branch (up to a max). pmap processes in order, reducers will process in whatever order offers the best performance.

11:36 mdrogalis: so reducers can be faster when you don't have side effects in the code.

11:39 rkneufeld: mdrogalis: reducers do also let you compose transformations in a pretty nifty way (completely separate from how it is executed)

11:40 mdrogalis: tbaldridge: Ahh, thanks. That's a useful bit of knowledge. :)

11:40 rkneufeld: Yeah, you know I've been using reducers since it came out and I still don't *really* understand how it does that.

11:44 tbaldridge: mdrogalis: so there are two aspects of this. What rkneufeld mentioned is that you can chain a bunch of functions together that won't end up creating tons of LazySeq allocations that are simply thrown away.

11:45 mdrogalis: consider this (-> (range 1000) (map inc) (map dec)), here we have to create cons cells in between each map. With reducers these allocations don't happen. Read Rich's reducers blogs for more info there.

11:45 mdrogalis: the other side is the fork/join stuff I was talking about. This talk goes into details on that: http://www.youtube.com/watch?v=ZampUP6PdQA

11:46 wakeup: Can someone try to run (segv) from this paste http://paste.lisp.org/display/138889 ? On my machine it segfaults the jre!

11:46 tbaldridge: Not about reducers, but these ideas are the same ones that reducers use

11:46 wakeup: I want to know if others can reproduce this?

11:46 You need clojure.java.jdbc and an jdbc sqlite backend

11:47 Oh and this will touch /tmp/sqlite-seegv !

11:48 All help would be much appreciated!

11:48 nDuff: wakeup: Including a project.clj for the dependencies you used wouldn't hurt.

11:49 tbaldridge: wakeup: looking at the clojure jdbc docs I'm not sure that your query syntax is right: "Given a database connection and a vector containing SQL and optional parameters,"

11:49 Your query and params are not in a vector

11:50 wakeup: hmm

11:50 you're right

11:50 still shouldn't segfault but I'll try

11:52 mdrogalis: tbaldridge: I've read the reducers post a bunch of times. It's still hard for me to understand.

11:53 Fortunately, I guess I dont have to in this case. Using it is very easy

11:58 tbaldridge: wakeup: agreed, but I don't think that input is being validated, so it's probably crashing something deep down in the jdbc drivers

12:22 sdegutis: Phew.

12:29 Hey guys wanna see my new Clojure website?

12:29 Just deployed.

12:30 ambrosebs: sdegutis: sure!

12:36 gfredericks: (defmacro as->>> [args] `(as->> ~(last args) ~@(butlast args)))

12:46 sdegutis: gfredericks: Do you mean as->>> in the definition?

12:56 gfredericks: sdegutis: no

12:58 sdegutis: gfredericks: Oh you must be using C 1.6

12:58 Clojure 1.6

12:59 TimMc: sdegutis: Such a tease.

13:00 lgs32a: is anybody here going to hack through the clojure cup?

13:00 sdegutis: lgs32a: I'm terrible at those.

13:01 jjttjj`: I'm gonna try it, I'm also probably going to do terrible and never submit anything though

13:01 sdegutis: Also some Rubyists are on the judge panel and I'm not super comfortable with them judging my Clojure code.

13:02 lgs32a: I consider doing a chess-web-app

13:02 but i think it would be nice to work on it as two people

13:03 client-side could be done using something like raphel on js and pedestal

13:03 server side clojure

13:04 also pedestal service

13:07 sdegutis: I'm not sure I understand what Pedestal offers.

13:08 lgs32a: its basically a bunch of libraries like domina, enlive packed together

13:08 partly offering wrappers, mainly to enhance functionality

13:08 then it gives you this "development server"

13:08 nDuff: ...well, the dataflow model is the big thing.

13:08 tbaldridge: sdegutis: and a very opinionated view of how state should be handled when it comes to a UI

13:08 sdegutis: nDuff: Oh?

13:08 lgs32a: yes the dataflow model

13:09 sdegutis: tbaldridge: Yeah the one thing that stuck out to me was it constantly swapped a giant ref at each event received.

13:09 lgs32a: whats wrong with that?

13:09 tbaldridge: sdegutis: the gist is this, implement your app state as a database, then run a dataflow over that to generate a list of changes to the ui.

13:09 sdegutis: yep, transactional UIs

13:09 sdegutis: tbaldridge: Hmm.

13:14 lgs32a: but its not just the ui

13:14 also the complete state of the client is in that dataflow model

13:15 i recently wrote a small chat-app with that and i must say that it ends up in very little code at all

13:15 tbaldridge: lgs32a: well yes, client side apps are mostly UI, but I get your point.

13:15 sdegutis: Sounds like Rails.

13:15 lgs32a: the events can be recorded and replayed

13:15 tbaldridge: sdegutis: how on earth is that?

13:15 sdegutis: tbaldridge: in that I don't fully understand it :)

13:16 And that it sounds very scary.

13:18 xeqi: tbaldridge: can you reprogram the dataflow in the repl?

13:18 tbaldridge: xeqi: that I'm not sure, I do know that it's data-driven, so maybe?

13:19 xeqi: heh, gotta find the hooks into the system implementing the dataflow

13:21 loliveira: hi folks! can somebody please tell me why I can't get the whole body's text? If I change from [:body] to [:p] works, but I can't do that. https://www.refheap.com/18508 I'm using enlive and clj-http.

13:21 llambda: with clojure.test, what's the best way to test if a certain input causes an expected assertion error?

13:22 dakrone: loliveira: do you perhaps need to use `:body` to pull the body out after the http/get?

13:22 xeqi: llambda: (is (thrown? ErrorType ...))

13:22 llambda: thank you :)

13:23 xeqi: llambda: or (is (thrown-with-msg? Type regex ...)) if you want to get more specific

13:25 loliveira: dakrone: You nailed it. thank you! =)

13:26 dakrone: loliveira: :)

13:28 tbaldridge: bbloom: more bedside reading: http://www.cs.indiana.edu/~sabry/papers/exteff.pdf

13:29 bbloom: tbaldridge: yeah, read that one too. I was greatly amused by the use of Typable

13:29 Typeable*

13:33 mdrogalis: bbloom & tbaldridge: Looks dense

13:34 (to me)

13:35 bbloom: mdrogalis: it is.

13:35 mdrogalis: http://math.andrej.com/wp-content/uploads/2012/03/eff.pdf is much more approachable

13:35 tbaldridge: mdrogalis: but it's on my favorite subject, killing monads >:-)

13:36 mdrogalis: tbaldridge: Can you sum up your objection in 1-2 sentences?

13:36 Thanks bbloom :)

13:36 bbloom: mdrogalis: they don't compose.

13:36 mdrogalis: Heh, palatable statement. Got'cha.

13:36 xeqi: but, but, monad tranformers :p

13:37 bbloom: xeqi: ok, they compose poorly

13:37 tbaldridge: mdrogalis: memory allocation, poor composition

13:37 xeqi: oh, oh, how bout those error messages

13:39 bbloom: tbaldridge: so about types & optimizing effects....

13:39 tbaldridge: my understanding is that you basically have to do abstract interpretation instead of traditional type checking (ie logic solving)

13:40 boblarrick: I'm working on adding type hints to my program and wondering how to fix something like "Reflection warning, syncro/core.clj:77:16 - call to com.aerospike.client.Bin ctor can't be resolved." ?

13:40 bbloom: tbaldridge: what you do is you sub out top-level resources w/ non-resourceful handlers & then record all effect operations

13:40 tbaldridge: you can then basically do algebra on that log

13:40 mdrogalis: boblarrick: http://clojuredocs.org/clojure_core/clojure.core/*warn-on-reflection*

13:41 pierre1: oreos

13:42 bbloom: tbaldridge: so for example if you have a mutable cell and you see 3 sets in a row, you can throw out 2 :-)

13:43 tbaldridge: bbloom: as long as the mutable cell isn't being read by another thread :-)

13:45 bbloom: tbaldridge: but you can prove it isn't if it's bound by a handler in the dynamic extent

13:48 mdrogalis: I know ZooKeeper versions data on the znodes.. Does anyone know how to actually see the data changes across versions of a znode? Can't find it in the docs anywhere.

13:49 Oh, lovely. They have a channel.

13:53 boblarrick: mdrogalis: Yeah I have warn-on-reflection on, but I don't know what kind of type hint to add to my program to resolve the warning pasted above. How to add a type hint to a call to a java interop constructor?

13:54 coventry`: What should I do to make clojure a lein project so that I can put it under another directory's checkouts/ dir? I want to access clojure's unit tests in clojure-test, and make sure that I am using the same version of clojure that the tests are coming from.

13:55 mdrogalis: boblarrick: Ah, I understand. Sorry, I'm not sure how to help. :/

13:59 sdegutis: For my next magic trick, I'll be making this website way faster by replacing MongoDB with Datomic.

13:59 * sdegutis takes off his top-hat and reaches in, pulling out a bunch of datoms

14:00 xeqi: sdegutis: can you make if faster by making it static?

14:00 sdegutis: xeqi: Nope.

14:01 xeqi: I already used up that trick on the github-wiki version of clojuredocs.org

14:01 re https://github.com/sdegutis/clojuredocs/wiki

14:05 scriptor: quick and dumb question, but it's not possible to modify existing protocols by adding new functions, right?

14:06 SegFaultAX: sdegutis: The source for your clojuredocs thing is insane.

14:06 sdegutis: SegFaultAX: sorry :(

14:07 SegFaultAX: Wait, what do you mean by insane?

14:07 SegFaultAX: sdegutis: A nightmare.

14:07 sdegutis: SegFaultAX: ok yeah, sorry :(

14:07 SegFaultAX: sdegutis: I think it's a neat project, but you should definitely clean it up.

14:07 llasram: ~gentleman

14:07 sdegutis: SegFaultAX: I hacked it up as a proof-of-concept the other night.

14:07 clojurebot: Huh?

14:08 llasram: Ahh

14:08 ~gentlemen

14:08 clojurebot: You can't fight in here. This is the war room.

14:08 llasram: There we go

14:08 SegFaultAX: Heh

14:08 sdegutis: You can easily improve it.

14:08 sdegutis: SegFaultAX: It doesn't make sense to clean it up until the community generally agrees that it's a good direction to move in.

14:08 SegFaultAX: sdegutis: That's not really how it works.

14:09 llasram: scriptor: No, but you don't need to, and probably wouldn't be that helpful if you could. You can always just provide a new parallel protocol. Which as a side-benefit you can actually implement separately

14:09 sdegutis: SegFaultAX: It's kind of dumb to have 2 versions of clojuredocs running about, because the examples will be spread between two places. So if the community prefers the original, then this one should die.

14:09 scriptor: yeah, that's what I assumed

14:09 SegFaultAX: sdegutis: You need to put some effort behind it to show that your thing is actually viable before people will even consider adopting it.

14:09 scriptor: it'd probably be a nightmare to retroactively add the implementation for all types and records that support the protocol

14:09 SegFaultAX: sdegutis: Naw, I think the root idea is pretty cool.

14:09 sdegutis: SegFaultAX: Oh I think I see the confusion. That source file is only the initial seeder, and it isn't necessary anymore since it was used.

14:10 coventry`: SegFaultAX, sdegutis: Are you talking about main.clj? It's a one-off script for pulling in the data from the old website, isn't it? So how much benefit would there be to cleaning it up?

14:10 sdegutis: coventry`: Right, that's what I'm saying.

14:11 SegFaultAX: The real meat is in the actual wiki files, and that part's already done. So I could just as easily delete main.clj and the githib wiki would still be a valid proposal to the community.

14:11 SegFaultAX: coventry`: A lot, I think. It would be better if it emitted data and also had a formatter that could create the wiki or whatever.

14:12 sdegutis: SegFaultAX: But that's just a variation of YAGNI.

14:12 SegFaultAX: sdegutis: If you don't care about making it useful, maybe.

14:12 sdegutis: SegFaultAX: It already *was* useful. It's no longer needed.

14:12 SegFaultAX: What else does it need to be used for?

14:12 SegFaultAX: Unless you need to entirely reformat it.

14:12 In which case you have to re-write it, because you don't have the /data/ anymore.

14:13 sdegutis: SegFaultAX: Reformatting the existing wiki requires an entirely different script that would do HTML scraping on the existing wiki files.

14:13 SegFaultAX: sdegutis: Okay.

14:13 sdegutis: SegFaultAX: (Well actually just Markdown scraping)

14:13 SegFaultAX: Nevermind.

14:14 sdegutis: SegFaultAX: I'm just confused about your rationale. It seems like you're suggesting it be cleaned up in preparation for some abstract vague future feature.

14:15 SegFaultAX: sdegutis: Okay.

14:15 * sdegutis doesn't understand

14:16 sdegutis: SegFaultAX: But you're right, if someone says "hey can you generate wikidocs for clojure-ring using this thing?" then I'll certainly clean it up in preparation for that.

14:17 SegFaultAX: I thought you were trying to create a migration path away from the utterly outdated clojuredocs site. That's clearly not the plan, you just wanted to reformat their data.

14:17 * SegFaultAX doesn't care anymore

14:17 coventry`: What's an example of a lein project with .java files?

14:17 sdegutis: SegFaultAX: Oh, I see the misunderstanding.

14:17 technomancy: coventry`: reply, I guess?

14:17 sdegutis: SegFaultAX: No, this wasn't to create a migration path away from it. It was to write an experimental static wiki-based replacement for it. And that's already done.

14:18 coventry`: technomancy: thanks.

14:18 SegFaultAX: sdegutis: Thanks for the clarification.

14:18 sdegutis: SegFaultAX: I'm glad that's cleared up :)

14:20 It's hard being so confused so often.

14:20 So, I had this really weird idea that's kind of related to Clojure...

14:22 I want to write a simple Lisp interpreter in ObjC, where symbols starting with a period turn into a function that calls the given method on the receiver with args. So you could do (.length my-str) and it calls [my-str length]. But you could also do (map .length my-strs) because .length is just a function.

14:22 But every time I write a Lisp interpreter, I get really confused as to how '() and (rest ()) should work, and how they're related to nil.

14:23 So I basically want to copy Clojure in this regard.

14:23 ,(rest ())

14:23 clojurebot: ()

14:23 sdegutis: Weird.

14:23 SegFaultAX: That's why we have next

14:23 ,(next ())

14:23 clojurebot: nil

14:24 SegFaultAX: But in most lisps, () is just another name for nil.

14:24 sdegutis: Right, because they focus on list-based recursion which favors that relationship.

14:24 scriptor: ,((just [first rest next]) '())

14:24 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: just in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:24 scriptor: ,((juxt [first rest next]) '())

14:24 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>

14:24 scriptor: fuck it

14:24 sdegutis: LOL

14:24 :)

14:25 TimMc: scriptor: Drop those brackets.

14:25 SegFaultAX: It doesn't really have anything to do with list-based recursion.

14:25 sdegutis: ,((juxt first rest next) '())

14:25 clojurebot: [nil () nil]

14:25 scriptor: ah

14:25 SegFaultAX: It's more to do with how cons are structured.

14:25 technomancy: first vs next is a laziness distinction

14:25 sdegutis: SegFaultAX: Really? I thought the purpose was to make truthy comparisons see () as false so they know when to branch out in recursive functions.

14:25 technomancy: rest vs next rather

14:26 SegFaultAX: sdegutis: Again, () is just an alias for nil traditionally.

14:26 And it has to do with cons cells, not list recursion.

14:26 sdegutis: Okay.

14:27 technomancy: the reason rest returns a seq is that it avoids forcing anything

14:27 coventry`: If I want to make a project file for clojure, should test/java go in both :java-source-paths and :test-paths?

14:27 technomancy: coventry`: lein doesn't support tests written in java

14:27 SegFaultAX: sdegutis: It happens that it's convenient to stop recursion when the cdr is nil.

14:28 sdegutis: I see.

14:28 coventry`: Thanks, technomancy.

14:28 sdegutis: ,((juxt first rest next) ())

14:28 clojurebot: [nil () nil]

14:29 sdegutis: I think I'll have to skip the whole lazy sequences thing in my interpreter. It's really confusing to me from an implementation stand-point.

14:29 scriptor: sdegutis: check out http://clojure.org/sequences

14:29 sdegutis: Thanks.

14:29 SegFaultAX: ,(cons 1 ())

14:29 clojurebot: (1)

14:29 SegFaultAX: ,(cons 1 nil)

14:29 clojurebot: (1)

14:29 scriptor: it's actually not too bad once you get your head around it

14:30 sdegutis: I get lazy sequences when actually using Clojure, like I understand that (map prn [1 2 3]) won't print them until it's asked for that number of elements, and that it caches whatever elements have been consumed so far (so it won't repeat side-effects).

14:31 coventry`: sdegutis: Why not write an Objective-C backend to clojurescript's compiler? Could be huge.

14:31 SegFaultAX: Clojure hides these details from us with higher level abstractions (or just differently named functions). We very often don't think about cars and cdrs like you might in traditional lisps.

14:31 sdegutis: coventry`: (1) There's already one in Chicken Scheme that probably works with ObjC, (2) I'm not smart enough nor do I have enough time to become smart enough, (3) I don't see the practical application of that

14:32 coventry`: Rather I just want this so I can script my window manager from in-process without having to resort to heavy-hitters like MacRuby/RubyCocoa/PyObjC or lame languages like F-Script or Lua.

14:32 scriptor: sdegutis: skim the java sources for lazy-seq some day, it's actually fairly straightforward

14:32 dnolen: coventry`: clojurec already supporting ObjC

14:32 scriptor: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java

14:33 sdegutis: scriptor: cool, thanks :)

14:33 coventry`: dnolen: Thanks.

14:33 scriptor: the hardest part is the naming (sv, s, etc.)

14:33 dnolen: coventry`: personally I think it makes more sense to just script your ObjC applications with ClojureScript directly given JavaScriptCore.framework support around the corner

14:36 coventry`: dnolen: interesting.

14:44 sdegutis: dnolen: That was actually the plan with the first Zephyros release, which was scripted using embedded JS via JSCocoa (basically the same as JavaScriptCore.framework, just not made by Apple).

14:45 dnolen: But embedding JS into ObjC and trying to interface with *all* of C and ObjC turns out to be actually really ugly and have some insidious caveats, especially around struct params/returns and out-params.

14:46 SegFaultAX: Fortunately you probably don't need *all* of ObjC.

14:46 sdegutis: dnolen: That's why I moved it to a unix-socket-based protocol that communicates via a simple JSON-based Ruby-like message-passing protocol. Sure, it's not as easy, but it's cleaner.

14:47 SegFaultAX: Right, that's why I'm going to write my own lisp interpreter in it. The intentional limitation of it will be that it can *only* handle ObjC types for params/returns. That simplifies it a *ton*. And it means I also don't need to pull in libffi either.

14:48 I think it'll be straight-forward to mimic a minimalist vision of Clojure in it. It won't have everything, but that's okay too, since it's just for in-process scripting.

14:50 dnolen: sdegutis: I don't know too much about JSCocoa, but its looks appears permeated with scope creep. From my basic poking around at what's coming down the pipe with JSC.framework looks simpler/nicer.

14:51 sdegutis: dnolen: yeah, I had to turn off a lot of features of JSCocoa to get it working like JSC. Although right before I abandoned the embedding-scripting idea, I was about to take on writing a JSC-like framework that would be simpler than JSCocoa and do a lot less (and be a little less buggy as a side-effect).

14:52 dnolen: good thing I didn't, since Apple's doing it themselves :)

14:52 dnolen: Also have you been looking into integrating CljS with JSC.f?

14:53 If done right, it could be really neat, although I'm not sure what for yet.

14:53 dnolen: sdegutis: I don't know what there really is to "integrate". It works. Ejecta is a good model and the next JSC.f enables that style of integration.

14:54 sdegutis: i.e. not trying to transparently bridge - just protocols that enable communication between the parts - and you provide them.

14:54 "not trying to transparently bridge everthing" is what I mean.

14:57 sdegutis: Ah.

14:59 Shameless plug: I just deployed a new version of www.cleancoders.com, go buy stuff from it :)

14:59 It's a Clojure web app so it's kind of on-topic ;)

15:04 coventry`: What's the "right" way to grovel pom.xml to get the version of the main application out? The following gives me the answer at the head of the returned list, but it would be nice to know make sure I'm getting it from the right place in the tree. (->> "/home/coventry/clojure/alien/clojure/pom.xml" java.io.File. parse xml-seq (filter #(= (:tag %) :version)))

15:05 (That's after (use 'clojure.xml)).

15:07 Oh, maybe I want to use clojure.data.zip.xml instead.

15:13 muhoo: for serializing access to an i/o resource... agents?

15:14 i was using a homemade work queue, but now i think that was overkill.

15:14 gfredericks: I've used agents for serialization before

15:14 the locking macro looks straightforward, I'm not sure why nobody seems to use it

15:15 TimMc: gfredericks: A coworker is using it in some current work.

15:15 bbloom: gfredericks: b/c locks don't compose? :-)

15:17 TimMc: Specifically, there are two loops that both wake up and run the same action under different conditions, but they shouldn't run at the same time.

15:18 gfredericks: bbloom: that's prollably it

15:23 asteve: how do I call function "run-local" inside of core.clj under the namespace name.space?

15:23 name.space.core.run-local?

15:23 gfredericks: so you're intentionally not associating files with namespaces?

15:24 asteve: no

15:24 callen: muhoo: could use core.async too.

15:24 asteve: at the top of core.clj is (ns name.space.core

15:25 gfredericks: asteve: okay so the namespace is called name.space.core then, not name.space

15:25 asteve: and the function could be called from clojure code by (name.space.core/run-local)

15:25 asteve: gfredericks: I see that now, thank you for the clarification

15:25 tbaldridge: muhoo: yeah, that's like 10 lines of core.async code

15:25 callen: tbaldridge: if that.

15:26 tbaldridge: I like how learning to use core.async feels like I've acquired super powers.

15:26 "I can do this! I know core.async!"

15:26 "PICK MEEE PICK MEEE, I KNOW THE ANSWERRRRRR" *waves hand frantically in the air*

15:28 fredyr: trying to understand the state machine stuff feels far from super powers tho

15:29 prolly me being thick

15:29 gfredericks: callen: xkcd/208?

15:30 fredyr: hah

15:31 sdegutis: Ha.

15:31 Oh man I thought today's xkcd was gonna be about Lisp.

15:31 tbaldridge: fredyr: no, it can be hard to understand if you don't have someone explaining it to you. I hope to go over some of that stuff at the Conj

15:32 sdegutis: tbaldridge: Do those get recorded and put online?

15:32 callen: gfredericks: actually, I'm far more powerful than that, I have Instaparse.

15:32 sdegutis: tbaldridge: I'd love to see your talk eventually but I can't go this year.

15:32 callen: gfredericks: GLL based parser combinators for CFG and context sensitive parsing FTWWWWWWWWW

15:32 tbaldridge: sdegutis: yeah, they end up on youtube after a few weeks. Or they did last year

15:32 sdegutis: Cool.

15:33 fredyr: tbaldridge: oh, looking forward to that then

15:44 danielszmulewicz: Good people, what's your preferred way to host private libraries? I did `lein install`on some project that is not on clojars or maven, but I have yet to organize a private repo. What's your recommendations?

15:44 mdrogalis: danielszmulewicz: Archiva is working out alright for my place.

15:45 danielszmulewicz: mdrogalis: is it lightweight?

15:45 callen: it's an apache project.

15:45 mdrogalis: danielszmulewicz: What do you mean?

15:45 technomancy: danielszmulewicz: a private repo can just be a directory you rsync to an nginx server

15:46 danielszmulewicz: technomancy: that's what I mean by lightweight. Cool solution. That's my style.

15:46 callen: I'm a fan of using things like Unison and a private server for this.

15:46 technomancy: which is written in OCaml, by the by.

15:46 danielszmulewicz: Thanks.

15:46 technomancy: callen: sweet. what's the advantage over rsync?

15:47 I thought it was mostly about being 2-way, which isn't as relevant here

15:47 callen: technomancy: 2 way, not requiring any real active thought.

15:48 it just "goes"

15:48 I recommend it when people ask me how to migrate away from Dropbox/GDrive.

15:48 I used to use Unison years and years ago. It's gotten better since too.

15:48 technomancy: heh; I just use rsync for that =)

15:48 callen: not every likes draining volition to transport state.

15:48 everyone*

15:48 but I get your meaning.

15:49 technomancy: oh, so unison is a daemon?

15:49 sdegutis: Why do people migrate away from Dropbox?

15:49 I just got Dropbox and am super happy with it.

15:49 technomancy: proprietary gunk

15:49 nDuff: ...why would anyone trust Dropbox in the first place?

15:49 mtp: because you don't control the dropbox infra

15:49 and they don't care about your data

15:49 sdegutis: nDuff: what's not to trust?

15:50 mtp: what IS there to trust

15:50 if they take a shredder to your data, their responsibility ends with "SORRY"

15:50 rlb: technomancy: unison just a bidirectional sync program -- haven't messed with it in a while, but wasn't using a daemon back when I was.

15:50 "unision's just"

15:50 technomancy: it tries to keep track of state, etc.

15:50 sdegutis: mtp: I'm as likely to lose my data with them as I am by hosting it on my own personal backup hard drives.

15:50 rlb: (to handle conflicts, etc.)

15:50 iirc

15:51 nDuff: sdegutis: ...well, for an example...there was a bug mid-2011 when they disabled password authentication by mistake for a 4-hour period

15:51 sdegutis: ...so anyone could impact the target users' files without their credentials.

15:51 s/impact/interact with/

15:51 sdegutis: nDuff: Sounds like they won't be making that mistake again any time soon (nor have they apparently).

15:51 mtp: sdegutis: why yes, you are, but then it's at least YOUR FAULT

15:52 nDuff: sdegutis: sure, but it answers the question re: trust.

15:52 mtp: that is not a selling point to dropbox

15:52 it's more of a warning to take salient backups

15:52 sdegutis: nDuff: They've earned my trust so far by doing one job and doing it well for as long as I've had an account with them.

15:52 _________: can anyone give me an example where one would actually use a set of vectors and a vector of sets?

15:52 nDuff: sdegutis: I'm not telling you not to trust them. I'm only saying that I don't.

15:52 mtp: yes, but it'd be contrived

15:52 technomancy: my main gripe with dropbox is how they encourage their users to spam their friends in order to get higher quotas

15:53 so. annoying.

15:53 sdegutis: technomancy: Hey btw...

15:53 mtp: _________: a more helpful question would be for me to ask "what do you represent using vectors" and (separately) what do you represent using sets

15:53 sdegutis: Oh never mind, you'll probably say no.

15:53 * sdegutis "just wants more Dropbox space!"

15:53 mtp: and once we've agreed on an understanding, going from there

15:54 sdegutis: mtp: what? make sentient backups?

15:54 mtp: salient

15:54 "backups that not only back up, but that you can restore from"

15:54 sdegutis: oh man, my imagination just went crazy for a second

15:55 mtp: good. stay with that. :)

15:55 callen: sentient people know what sentient means.

15:55 _________: mtp i was looking for where a combination of them could be used but me being a clojure rookie i think i put the question wrong. like you said, what can vectors be used to represent and what can sets be used to represent?

15:55 callen: _________: what's with the nick :|

15:55 mtp: well, you were the one who wanted an example

15:55 also, this has nothing to do with clojure specifically

15:56 sdegutis: I usually use vectors to represent param lists.

15:56 mtp: _________: the only examples i can come up with are utterly contrived and wouldn't make any sense. i want you to help me com eup with a concrete example from those two questions

15:57 sdegutis: _________: your nick makes me uneasy for some reason :)

15:57 _________: callen i've Textual as my IRC client don't really know how to set a nick and it gave me this default, utterly absurd nick

15:57 sdegutis: Like I'm talking to The Invisible Man.

15:57 mtp: maybe you should learn how to operate the tools you're using before you jump in. :)

15:57 TEttinger: or webchat

15:57 _________, sets are often used in checks for whether something has a value that equals one taken from a certain set of values

15:57 sdegutis: _________: use LimeChat, it's great on Mac.

15:58 TEttinger: ,(#{:a :b :c} :c)

15:58 sdegutis: Least buggy and most sane client I've ever used.

15:58 clojurebot: :c

15:58 TEttinger: ,(#{:a :b :c} :d

15:58 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

15:58 TEttinger: ,(#{:a :b :c} :d)

15:58 clojurebot: nil

15:58 TEttinger: useful for filter and stuff

15:58 sdegutis: (some #{:simple :easy} java.Swing) ;=> nil

15:59 tbaldridge: sdegutis: (inc limechat)

16:01 sdegutis: If you were going to implement a really minimalist subset of clojure.core in a simple Lisp that doesn't have lazy sequences and is also hosted, what primary functions would you have?

16:03 callen: (inc irssi) ; which works everywhere.

16:03 lazybot: ⇒ 1

16:05 sdegutis: As long as you're okay with text-based clients.

16:06 ^_^: callen: Dunno what you're complaining about. :-P

16:06 coventry`: What's the right way to point lein at a local build of clojure, in the defproject :dependencies? Just putting [org.clojure/clojure "1.6.0-master-SNAPSHOT"] in there doesn't work. Putting a symlink in checkouts/ doesn't work, because it's not a lein project.

16:06 callen: coventry`: clojure is just a jar.

16:06 coventry`: repeat that three times to yourself.

16:07 Guest99251: coventry`: mvn install your build of Clojure

16:08 muhoo: tbaldrid_: to be fair, it was also like 10 lines of lamina. but i'm still wondering if it's not the correct thing to use a queue for this. will play with agents instead in a bit

16:10 callen: muhoo: it's just critical section serialization, no?

16:10 coventry`: Guest99251: Thanks, mvn install DWIW.

16:12 kovas: looks like a partial lineup of clojure conj talks has been released

16:12 http://lanyrd.com/2013/clojureconj/schedule/

16:13 hhenkel: Hi all, I got a question regarding http://www.luminusweb.net/docs#guestbook_application (CRUD Applications with Clojure). When I do test the example application "guestbook" I get a non empty textarea resulting in a failing check. Anyone aware of what is causing this?

16:15 callen: this conj is looking pretty awesome.

16:15 hhenkel: The textarea is described as <textarea rows="4" cols="50" name="message"> in the home.html

16:16 kovas: looks like there something for everyone

16:16 i sure it will be great but wasn't blown away by the lineup

16:17 dnolen: nice Andy Keep talking about compilers

16:18 kovas: that will be cool

16:18 dnolen: did u submit a talk?

16:18 dnolen: kovas: I did not

16:18 kovas: yeah me neither

16:19 kaw: I'm getting a "No such var: comp/namespaces, compiling:(cljs/closure.clj:318:8)" when trying to "lein cljsbuild once", does anyone have any idea what might cause that?

16:20 Just to be clear, cljs/closure.clj isn't part of my code, I assume it's part of ClojureScript -- some sort of version mismatch between two components in my project setup, maybe?

16:22 dnolen: kaw: what version of ClojureScript?

16:22 kaw: are you specifying a version?

16:23 kaw: if not, you should - I recommend 1859, 1877 is a little buggy and we need patch it up a bit - plus projects need to catch up with the breaking change around keyword identical anyhow.

16:24 dissipate__: other than clojure, what are the top picks for FP languages in industry? Haskell and OCaml?

16:24 dnolen: dissipate__: Scala

16:25 dissipate__: dnolen: so, haskell, ocaml, clojure, scala

16:25 dnolen: dissipate__: which is more a hybrid, but more likely users use it in an FPish way

16:25 dissipate__: dnolen: and non OOP languages? haskell and clojure?

16:29 dnolen: is the fact that the playing field of non-OOP FP languages is down to 2 choices a good thing or a bad thing?

16:30 dnolen: dissipate__: I don't really see how it matters much.

16:30 dissipate__: dnolen: well, it matters in the sense that i only have to learn 2 languages to cover the space.

16:31 hhenkel: Okay solved the problem by myself. Seems like the indentation in the example file results in a textarea with blanks...

16:32 * kmicu detects CorpoTrolls covering space...

16:33 dissipate__: kmicu: do you reeketh of the cube farm?

16:36 armadillo: ;

16:38 (+ 1 2)

16:38 clojurebot: 3

16:40 sheldonh: does core have a non-short-circuiting (and)?

16:41 nDuff: sheldonh: well, you can always get that behavior with a let doing your evaluation early.

16:41 sheldonh: ...might I ask the circumstance?

16:41 sheldonh: nDuff: hmmm... okay, i'll try again

16:42 kaw: dnolen: Thanks, setting [org.clojure/clojurescript "0.0-1859"] seemed to fix it

16:42 dissipate__: nDuff: what about lazy let?

16:42 kaw: Well, it's still failing really, but it looks like it's failing at my code now

16:43 coventry`: sheldonh: It is short-circuiting. E.g., ##(and nil (do (println \.) 1))

16:43 lazybot: ⇒ nil

16:43 sheldonh: nDuff: like, say you were using midje, and didn't know you could make prerequisites optional, and then found out, but were still curious :)

16:43 nDuff: ,(let [n (do (println "hello") nil)] 10)

16:43 clojurebot: hello\n10

16:43 coventry`: (It's worth looking at the source, which does as nDuff suggests.)

16:44 nDuff: ...or, to be a little more explicit...

16:44 kurtis: Hey guys, sorry for asking here but #leiningen seems idle. Has anyone had problems running 'lein repl' in OSX?

16:44 nDuff: ,(let [n (do (println "hello") nil)] (and false n))

16:44 clojurebot: hello\nfalse

16:44 sheldonh: cool. i must have screwed it up when i tried. thanks

16:46 llasram: kurtis: host firewall?

16:46 justin_smith: kurtis: I think most lein users are on osx actually, it worked last I tried it (main maching is linux but I have an osx machine)

16:46 what error are you getting?

16:47 coventry`: sheldonh: Sorry I misread your question.

16:48 llasram: justin_smith: This is what they posted in #leiningen: https://dpaste.de/0GI28/

16:48 kurtis: llambda, My firewall is disabled and I'm just trying to run it locally. (literally just executing 'lein repl')

16:48 llasram: kurtis: Wrong `ll` user :-)

16:48 kurtis: whoops, that was meant for llasram sorry :)

16:48 llasram: kurtis: The lein repl tasks works is by launching an `nrepl` server then attaching a local client to it

16:49 kurtis: llasram, Yeah, I saw that after further reading. I went ahead and launched a "headless" nrepl server. At that point, there were no problems. I tried to connect to it but then it refused my connection and I believe ended up crashing

16:49 llasram: kurtis: Hmm. That really is suggestive of a host firewall, or potentially network configuration issues

16:50 kurtis: Sorry, no other ideas here

16:50 kurtis: llasram, haha no problem! I'll keep investigating. I wonder if it has anything to do with OSX's weird application-level security? Although I run Django and all sorts of other apps without problems

16:51 coventry`: kurtis: If you do "python -m SimpleHTTPServer" and browse to localhost:8000 does it show your directory listing?

16:52 kurtis: coventry`, Yep, and just to check on the hostname resolution -- both 127.0.0.1:8000 and localhost:8000 work

16:53 Here's my output from 'lein repl' in case anyone might have a better idea than myself: https://dpaste.de/0GI28/

16:54 llambda: heh poor llasram...you had the `ll` first :(

16:55 kurtis: Other than ~/.lein -- are there files stored anywhere else? Maybe I had a bad initial install and something corrupt has persisted?

16:55 justin_smith: kurtis: all the jars are under ~/.m2

16:55 coventry`: kurtis: Presumably you saw this, and checked that non-HTTP traffic is working, too? https://github.com/heroku/heroku-buildpack-clojure/issues/19#issuecomment-9366427

16:57 TimMc: sheldonh: What's your use-case for non-short-circuiting and?

16:58 kurtis: coventry`, Thanks, I'll read into that more. It might be a good work-around although I think (unless it's just ignorance on my part) this should work fine? -- justin_smith I appreciate it! I'll wipe that directory as well

17:01 coventry`: kurtis: I meant that you might have a firewall which is only allowing HTTP through, as all of the traffic you've mentioned so far is HTTP. Does "nc -l -v 1234" let you "telnet localhost 1234"?

17:04 asteve: was .getLong replaced with something from 1.2->1.4?

17:06 kurtis: coventry`, Makes sense! I just ran that command and from another terminal tried to telnet to localhost. Received connection refused from 'localhost' but it automatically retried at 127.0.0.1 which worked

17:06 I take that back

17:06 Let me copy + paste the copy to dpaste

17:07 coventry`, Here's my output: https://dpaste.de/UpOHq/

17:08 coventry`: OK, and if you type into the telnet window and hit return, does the input show up in the nc window?

17:08 kurtis: coventry`, Yep

17:08 coventry`: OK, it's not that, then.

17:09 kurtis: Should I try wiping ~/.lein and ~/.m2 and reinstall lein?

17:10 llasram: kurtis: It certainly can't make things worse :-)

17:10 kurtis: haha cool. I'll give it a shot

17:12 Hmm, the problem is still there :/ https://dpaste.de/IOnHD/

17:13 I guess Leiningen doesn't like my Mac haha. It works fine on my linux boxes but -- that's not ideal for work

17:15 justin_smith: kurtis: what about specifying a port?

17:16 kurtis: justin_smith, I'll give it a shot. I think I've done that once before but I can't hurt

17:16 llasram: You know, there was a recent change in Leinigen to change how the repl-port is communicated

17:16 kurtis: Are you trying to do this w/in a project?

17:17 kurtis: justin_smith, Tried 8080. Same error

17:18 llasram, Interesting. And no -- not at this moment. Although I have tried both from within a projeect and just from my home directory

17:18 llasram: kurtis: Hmm. Well, that blows one theory. But you can try downgrading a version

17:19 kurtis: llasram, True! Any suggestion on how to do that? Just grab the appropriate script from github? (different tag/release I'm assuming)

17:19 llasram: Try: lein upgrade 2.3.1

17:19 kurtis: The `upgrade` command actually lets you hit arbitrary versions

17:20 Actually, you might try even older. I've found 2.1.2 to be very stable

17:21 kurtis: Yeah, 2.3.1 didn't do the trick. Let me try that

17:22 llasram, 2.1.2 worked.

17:22 justin_smith: yeah, 2.1.2 is golden (using it here myself)

17:22 kurtis: Am I missing out on anything important by down-grading? I'm not a clojure expert -- trying to replace a Django API w/ Clojure (learning on the job haha)

17:23 llasram: kurtis: Nothing super-major. 2.2 turned on profile separation, but then 2.3 turned it off again :-)

17:23 technomancy: it could at least help you find the root cause

17:23 kurtis: haha cool. Well I will use this to get started and maybe file a bug report to see if the core lein developers might have some ideas. Thanks guys!

17:23 technomancy: hopefully you don't stay on the old version once you figure out what's going on

17:24 llasram: kurtis: Anyway, several nice improvements, and you don't want to stay old forever

17:24 kurtis: ^^ core lein developers == #{technomancy, ...}, btw

17:25 kurtis: oh haha

17:25 Well I'm in the right place :)

17:26 technomancy, Should I file a Github Ticket?

17:26 technomancy: kurtis: not sure what can be done there if you can't provide a repro case

17:27 kurtis: technomancy, hmm. True. Maybe cycle through all versions from 2.1.2 to 2.3.1 and see where the breakage occurs?

17:27 coventry`: Sounds like a good application for git bisect, though. (Not that I've ever done one of those.)

17:27 kurtis: Although if I can't help anyone reproduce the problem since I don't know what it is myself

17:27 Are you guys using Java 6 or 7 with OSX?

17:28 technomancy: oh, did you find a version that works?

17:28 kurtis: technomancy, Yeah the 2.1.2 worked

17:28 technomancy: oh, I missed that

17:29 in that case maybe a ticket would be warranted

17:32 kurtis: technomancy, Thanks. I went ahead and created one. https://github.com/technomancy/leiningen/issues/1321 -- Let me know if you guys need anymore information or want me to test anything. I appreciate the help and awesome project!

17:32 coventry`, Thanks for the suggestion on switching versions too. Hopefully not a permanent solution but at least I can get started :)

17:33 coventry`: kurtis: That was llasram, I think.

17:34 llasram: Without lazybot to keep track of karma everyone is confused about who gets credit

17:35 kurtis: haha sorry, thank you llasram

17:57 dissipate__: does the partial function return a closure?

17:57 sheldonh: TimMc: it was just curiosity. the use case was bogus (not knowing how to make midje prerequisites optional)

17:58 coventry`: ,(do (use 'clojure.repl) (source partial))

17:58 clojurebot: Source not found\n

17:59 justin_smith: dissipate_> if passed a locally bound fn, it will wrap that in a closure, if that is what you mean

17:59 noprompt: if i'm using lein ring server with an :init option and an exception occurs during somewhere in the :init fn, how do i safely terminate the application?

18:00 justin_smith: noprompt: (System/exit numeric-code)

18:00 dissipate__: justin_smith: i'm reading a warning about 'partial' in 'clojure programming'.

18:01 justin_smith: 0 is success, by convention, anything else indicates an error

18:01 dissipate_> yes, since it calls fn, that fn creates a closure, which has performance implications since it is created at runtime

18:02 dissipate__: justin_smith: is the use of 'partial' discouraged for any argument arity over 4?

18:02 noprompt: justin_smith: i tried that with (System/exit 1) and it just hangs.

18:02 ie. i still need to use C-c to stop it.

18:02 justin_smith: no, all core functions special case below 4 or so args if they are vararg

18:02 noprompt: maybe some thread is hanging? I have never seen that issue

18:03 dissipate__: justin_smith: i don't understand.

18:03 noprompt: justin_smith: actually no that did the trick. i must have forgotten to save the file the first time.

18:03 justin_smith: the reason it has seperate versions for each arg count below 5 is because that is how things are written in core

18:03 for efficiency reasons

18:04 dissipate__: justin_smith: and functions that have a fixed arity?

18:04 justin_smith: well you wouldn't special case those, would you

18:05 dissipate__: justin_smith: so if i have a function of a fixed arity of 50, what happens?

18:05 justin_smith: as opposed to? the function would be annoying to use for one

18:06 I may not understand your question

18:06 dissipate__: justin_smith: just trying to figure out these efficiency issues.

18:06 noprompt: ughh, actually scratch that (System/exit 1) does not work. :-(

18:07 justin_smith: the efficiency issue with varargs is that it creates a sequence to hold the args, when generally the first thing your function does is break it back down again

18:07 so you have a small gain by not having to create it if short arg counts are more common

18:07 the issue with partial is the calls to fn at runtime need to create a lexical closure, which can't be optimized ahead of time

18:08 dissipate__: justin_smith: interesting. makes sense, thanks for the info.

18:08 justin_smith: similar issues with allocating a bunch of data, with likely a short lifespan

18:08 np

18:08 noprompt: maybe it has something to do with nrepl

18:10 dissipate__: justin_smith: well, now i see much better by looking at the source: https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L2388

18:11 justin_smith: strange that the book didn't just point to the source, it's much less confusing.

18:11 justin_smith: ,(source partial)

18:11 clojurebot: Source not found\n

18:12 justin_smith: weird

18:12 in a real repl that would work

18:12 dissipate__: justin_smith: perhaps clojurebot doesn't have the core loaded up

18:13 justin_smith: ,((partial + 1) 1)

18:13 clojurebot: 2

18:15 amalloy: ~def partial

18:15 justin_smith: source is in clojure.repl, which is not loaded by default *except* in repls

18:16 callen: lancepantz: herro :)

18:16 amalloy: me gusta.

18:16 justin_smith: amalloy: it found the source function, it just didn't find source code

18:16 dissipate__: amalloy: thanks

18:17 justin_smith: amalloy: oh, you mean as a caveat to suggesting using that function, good point

18:19 ,#'source

18:19 clojurebot: #'clojure.repl/source

18:22 TEttinger: ,(source source)

18:22 clojurebot: Source not found\n

18:24 Apage43: https://github.com/clojure/clojure/blob/4004d267e124f12b65b0d7fb6522f32a75e3c4fb/src/clj/clojure/repl.clj#L156-L163

18:24 see also https://github.com/clojure/clojure/blob/4004d267e124f12b65b0d7fb6522f32a75e3c4fb/src/clj/clojure/repl.clj#L134-L154

18:25 expects the var to have a :file and :line on its metadata, then prints the first form on that line

18:26 (which means if you do something like (comment 'blah) (defn foo []) in a file on the same line, and (source foo), you'll see (comment 'blah), I think

18:27 interesting thing it does though

18:28 bbloom: is there a shorthand for integer (not long) literals?

18:28 Apage43: it reads all the lines before the line the function starts on, then has the reader read a single form, but through a *proxy* that is also dumping each character it reads into a stringbuilder

18:28 that's how it gets the comments and such

18:29 Bronsa: bbloom: nope

18:29 bbloom: booo ok thanks

18:30 amalloy: bbloom: integer literals are amazingly difficult to construct

18:30 bbloom: amalloy: ?

18:30 amalloy: well, (int 10) isn't an integer literal. it's a literal list containing a symbol and a long

18:31 how can you create an actual integer literal, eg for some poorly-written macro that demands to be given an int?

18:31 bbloom: it's for some java interop

18:31 amazing i can't do 10I or something

18:31 10i

18:31 or whatever

18:32 amalloy: i know. i was just saying it's very hard

18:32 bbloom: it's not hard, it's impossible :-P

18:32 amalloy: (if you need an actual literal. which in this case you don't)

18:32 bbloom: yeah, i don't need an actual literal, but it would certainly be nice :-)

18:32 Bronsa: amalloy: you can "create" an integer literal during macro-expansion

18:32 amalloy: Bronsa: yes, i was about to link to http://stackoverflow.com/questions/18280626/clojure-annotations-and-integers/18296618#18296618

18:32 bbloom: heh, #long 5

18:33 er i mean #int 5

18:33 amalloy: bbloom: that's a good idea, actually

18:33 Bronsa: bbloom: hmm, not sure if that's going to work though

18:33 Apage43: you can get an Integer =P

18:33 sort of

18:33 Bronsa: there's not an invokePrim that returns an int

18:34 amalloy: Bronsa: right, it could only actually return Integer

18:34 Bronsa: I think that the tagged literal function would box the int returning it

18:34 Apage43: yep

18:34 bbloom: numerics suck in all languages ever :-/

18:34 clojurebot: I don't understand.

18:35 Apage43: #java.lang.Integer[5]

18:35 bbloom: rather than goofy hacks… could we just fix for realzies please?

18:38 Bronsa: I wonder, if the problem with supporting int and the other primitives in invokePrim is only the (very) large number of interfaces that would need to be generated -- can't we generate those interfaces dynamically as we need them instead of generating all the possible interfaces?

18:42 dissipate__: bbloom: are you saying the numeric values in clojure are a hack?

18:43 bbloom: dissipate__: why is your perspective always so negative?

18:44 dissipate__: bbloom: consider it a side effect of dealing with OOP and imperative languages for years

18:44 callen: dissipate__: more accurate to consider it an aspect of having a bad attitude.

18:45 dissipate__: callen: i have a good enough attitude to learn clojure, right?

18:53 TimMc: dissipate__: Clojure's host, the JVM, has iffy numerics. It's a compromise.

19:09 clj_newb_2345: does nrepl have an equiv of "C-c" ? i.e. I want to cancel /kill my last command

19:10 amalloy: clj_newb_2345: C-c C-c works in slime, dunno about nrepl

19:11 clj_newb_2345: java still seems hung

19:11 I think I will just kill the nrepl buffer

19:15 given a java.io.OutputStream

19:15 is there a clojure builtin for writing a string to said OutputStream?

19:15 (rahter than writing single chars at a time)

19:27 dissipate__: TimMc: how are the numerics on .NET?

19:29 ThatOneGuy: clj_newb_2345: check out this namespace http://clojure.github.io/clojure/clojure.java.io-api.html

19:30 s4muel: clj_newb_2345: Take a look at java.io.writer -- OutputStream by nature writes byte by byte, you probably want to send encoded characters to that stream (via a writer). Also, what ThatOneGuy said ;)

19:32 ThatOneGuy: clj_newb_2345: a really simple function in clojure.core for writing strings and other simple data is 'spit' http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/spit

19:32 clj_newb_2345: sample code would relaly help :-)

19:32 ThatOneGuy: its the opposite of 'slurp' if you've used that one before

19:34 if you can go all the way back to the file abstraction that is probably a good function to use, but if you are given an OutputStream then just using the 'writer' and 'with-open' from clojure.java.io should be easy

19:35 xeqi: clj_newb_2345: C-c C-b will interrupt, there is a list of keybindings at https://github.com/clojure-emacs/nrepl.el#clojure-buffer-commands

19:35 mrcheeks: clj_newb_2345: I don't do any clojure coding yet, but this looks straightforward, especially with an internet connection to lookup docs and example: http://stackoverflow.com/questions/7756909/in-clojure-1-3-how-to-read-and-write-a-file

19:35 clj_newb_2345: ThatOneGuy: noted, thanks!

19:36 s4muel: clj_newb_2345: look at the source for 'spit' -- it's likely exactly what you want, except you replace the file with the OutputStream.

19:37 ThatOneGuy: (with-open [w (writer clj_newb_2345_s_OutputStream)] (.write w "super awesome string I want to write"))

19:39 Apage43: also clojure.java.io/copy is quite handy

19:40 clj_newb_2345: got my file IO working :-)

19:44 TimMc: dissipate__: I haven't used .NET.

19:58 clj_newb_2345: does clojure's "while" not have a correponding "beak" ?

19:59 technomancy: clj_newb_2345: no, but reduce has the equivalent

19:59 clj_newb_2345: technomancy: how so?

20:00 can you explain it for mortals

20:00 who have not written their own clojure project manager?

20:00 :-)

20:01 technomancy: you can return (reduced x) from your reducer fn and it will short-circuit the rest of the collection

20:01 ,(doc reduced)

20:01 clojurebot: "([x]); Wraps x in a way such that a reduce will terminate with the value x"

20:01 bja: clojure.core.reducers/reduce fwiw

20:02 technomancy: ,(reduce (fn [acc x] (if (zero? x) (reduced acc) (conj x acc))) [] [2 3 4 0 3 2 1])

20:02 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>

20:02 technomancy: ,(reduce (fn [acc x] (if (zero? x) (reduced acc) (conj acc x))) [] [2 3 4 0 3 2 1])

20:02 clojurebot: [2 3 4]

20:03 clj_newb_2345: noted

20:03 thanks

20:03 technomancy: np

20:09 noprompt: has anyone used the cljs-http library

20:09 that was a question :-|

20:10 callen: noprompt: https://github.com/yogthos/cljs-ajax

20:10 noprompt: callen: i was looking at this one https://github.com/r0man/inflections-clj

20:11 callen: viri for virus is actually wrong.

20:12 virus in software plural is viruses, virus in biology plural is virii

20:15 viruses is the safer option.

20:15 noprompt: whoops

20:16 callen: sorry i meant https://github.com/r0man/cljs-http

20:17 grabbed the wrong url

20:29 serycjon: Hello! Is there any way to temporarily remap Caps-lock for /leave

20:30 (oh sorry

22:20 cjfrisz: ambrosebs: I'm trying to follow up on that JIRA, but I forgot how to get run the type checker on a cljs namespace

22:20 ambrosebs: (cljs.core.typed/check-ns 'my.ns) in a CLJ REPL

22:21 * cjfrisz must be good at JIRA because he referred to a JIRA ticket as "that JIRA"

22:21 cjfrisz: ambrosebs: ah, there's my problem: I was trying to use clojure.core.typed

22:23 ambrosebs: ok, I got 5 type errors from stuff in cljs.core: vector, first, fnext, and 2 for assoc

22:24 Is this expected and the JIRA is resolved, or did I encounter an unexpected problem

22:24 ambrosebs: cjfrisz: could you past them?

22:24 *paste

22:25 cjfrisz: ?

22:26 ambrosebs: what are the errors?

22:26 cjfrisz: ambrosebs: Yes, sorry, should have been more specific

22:26 ambrosebs: here's the paste https://gist.github.com/cjfrisz/09c7359d22987378478f

22:27 ambrosebs: They're all "found untyped var"

22:27 ambrosebs: that sounds about right.

22:27 I don't think they have types yet

22:28 cjfrisz: ambrosebs: That's what I figured

22:28 ambrosebs: so that's a good thing :)

22:28 cjfrisz: But at least the type checker seems to run

22:28 ambrosebs: yes

22:29 cjfrisz: you can use (ann ^:no-check v t) to skip any functions that are missing annotations.

22:29 cjfrisz: or you can add them by using a fully qualified `ann`.

22:30 cjfrisz: ambrosebs: then I'd have to think about the types of those things! :-)

22:30 ambrosebs: cjfrisz: steal them! https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj#L663

22:30 cjfrisz: don't bother trying assoc, it needs to be hard coded.

22:30 cjfrisz: ambrosebs: sweeeeeeet

22:31 ambrosebs: I think I remember you talking about trying to work out the type for that

22:32 ambrosebs: cjfrisz: still dreaming :)

22:32 cjfrisz: ambrosebs: it struck me as a thing I probably wouldn't knock out with my brain turned off and youtube videos on

22:33 ambrosebs: :)

22:37 ddellacosta: I'm having a heck of a time figuring out how to understand where this exception is originating

22:37 https://www.refheap.com/18526

22:38 Apage43: me too

22:38 ddellacosta: to complicate things, I'm using a patched version of https://github.com/thegeez/clj-browserchannel (jetty-adapter). Any tips on how to figure it out?

22:39 Apage43: it looks to me like a socket is getting closed before you finish writing to it

22:40 in this context, I expect that's something like a long-polling HTTP request

22:40 cjfrisz: ambrosebs: I stole the types from base_env.clj got "Cannot parse type: (APersistentVector x)"

22:40 Added ^:no-check to all the annotations and got the same thing

22:41 ddellacosta: Apage43: yeah, that's about as much as I can figure out as well. It seems to happen after a session is established, and when the first bind message is sent (in browser channel, the protocol seems to be like "test, then bind"

22:41 )

22:41 ambrosebs: cjfrisz: try cljs.core/IVector instead of APersistentVector

22:41 Apage43: it's already something that jetty is only printing to the DEBUG level log. I wouldn't worry about it.

22:41 ddellacosta: Apage43: yeah, I guess you're right, I could just leave it well enough alone--it works otherwise--but feels "dirty" not knowing where this is coming from or why. Don't like it.

22:42 Apage43: ddellacosta: you could confirm by watching the chrome network inspector something

22:42 or even using that inspector's "copy request as cURL" command feature and see if you can start a longpoll request and cause the exception when you ctrl-c curl

22:43 ddellacosta: Apage43: interesting idea--I'll give that a shot. Hadn't thought to look in the chrome network inspector, but I see a canceled test call already--so that seems like a good lead. Thanks, I'll see what I can figure out from this!

22:45 clj_newb_2345: [02:15:55.899] TypeError: cljs.core.async.impl.dispatch.exists_QMARK_ is undefined @ http://crfx:3000/static/main.js:27781

22:45 this is what I get from use cljs.core.async

22:45 use [cljs.core.async :only [chan <! >! put!]]

22:45 in particular -- what is this bug, and how do I get rid of it?

22:53 cjfrisz: ambrosebs: Now I'm getting "Cannot parse type: (Option (EmptySeqable x))"

22:53 I assume it has to do with that EmptySeqable, but perusing cljs.core didn't turn up anything immediately obvious to me

22:53 ambrosebs: do you know where EmptySeqable is coming from?

22:54 oh it might be Option.

22:54 try (U nil (EmptySeqable x))

22:56 cjfrisz: ambrosebs: That got me to "Cannot parse type: (EmptySeqable x)"

22:56 ambrosebs: try (I (cljs.core/ISeqable x) (ExactCount 0))

22:56 which type are you copying?

22:58 maybe this is more useful :) (def-alias EmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (ExactCount 0)))

22:58 cjfrisz: ambrosebs: let me know if you don't have time to deal with my pestering right now; I feel like I'm throwing a lot of whining your way

22:58 clj_newb_2345: alright

22:59 in ptojrect.clj, how do I specify what version of clojurescript ot use

22:59 ambrosebs: cjfrisz: will do :)

23:00 cjfrisz: just hanging out at home today.

23:03 cjfrisz: ambrosebs: it seems happy with the def-alias for EmptySeqable, now I'm trying to figure out NonEmptySeqable

23:04 ambrosebs: (def-alias EmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (CountRange 1)))

23:04 (def-alias NonEmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (CountRange 1)))

23:04 cjfrisz: come to #typed-clojure

23:04 cjfrisz: Ah, didn't know about CountRange

23:04 ambrosebs: good call

23:22 ddellacosta: I have a proxy. I need to call the protected member of a parent class on the instance, outside the definition of the proxy. Is this possible, or do I need a different mechanism (gen-class...?) to do this?

23:40 amalloy: &(doc proxy-super)

23:40 Raynes: lazybot is gone again. any idea why?

23:43 ddellacosta: ^

23:43 if you need to do it from a scope that is not inside the definition of the proxy, you are probably out of luck, but also crazy

23:44 ddellacosta: amalloy: the problem is that the method I have to call is protected, and I have to call it outside of the proxy--after I've created an instance. Not sure how to do this without adding a new method which is public, and therefore seems like I have to use gen-class

23:44 amalloy: hmm why crazy?

23:49 amalloy: ddellacosta: i mean, i could be wrong. if it's a protected method for a reason, then accessing it willy-nilly from anywhere doesn't sound like a good plan

23:50 but i suppose people sometimes make things protected for no reason

23:50 seangrove: amalloy: I think especially in the Java world

23:50 amalloy: you can just define your own version of it that's public and delegates to the protected one

23:51 ddellacosta: amalloy: that's what I intend to do. I was hoping I could do that with proxy, but seems pretty clear I have to use hen-class. :-(

23:51 *gen-class

23:52 amalloy: wow, is proxy-super not thread-safe? the source looks that way

23:52 clj_newb_2345: when communicating data back and forth clojure and clojurescript over a websocket, is json the ideal way to serialize?

23:53 xeqi: clj_newb_2345: I'd consider edn

23:53 clj_newb_2345: wait, can't I just use "read" ?

23:53 ddellacosta: amalloy, seangrove: why I'm calling a protected method: I'm extending Apache Shiro, and need to invalidate the cache. I'm only using authorization capabilities of Shiro so I don't rely on their framework to manage the overall flow--I using bits and pieces as suits me. As such, I'm doing stuff like what "framework implementers" (according to their docs) do, more or less, so I have some reasonable use-cases for calling protected

23:53 methods.

23:53 *I am using bits and pieces

23:53 clj_newb_2345: xeqi: http://clojure.github.io/clojure/clojure.edn-api.html ?

23:54 ddellacosta: clj_newb_2345: yep, edn is nice if you have a clojure <-> cljs thing going

23:54 clj_newb_2345: ddellacosta: is there an example?

23:54 dissipate_: clj_newb_2345, ideally you wouldn't have to worry about it at all. see web frameworks like opa and mojito.

23:54 clj_newb_2345: well

23:54 xeqi: clj_newb_2345: yep, those are the read functions on the clojure side

23:54 clj_newb_2345: I'm going sorta minimal

23:55 dissipate_: clj_newb_2345, but i've been told that running clojurescript on the back end is blasphemy

23:55 ddellacosta: clj_newb_2345: er, I mean, it's just calling str/ read-string on either side, more or less

23:55 clj_newb_2345: well

23:55 there are security issues no?

23:55 xeqi: not with the edn readers

23:55 with clojure.core/read, possibly

23:58 ddellacosta: clj_newb_2345: yes, use clojure.edn/read-string, not clojure.core/read-string

23:58 clj_newb_2345: noted; was confused; but undersand the difference now

23:58 thanks

23:59 ddellacosta: np

Logging service provided by n01se.net