#clojure log - Oct 25 2012

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

0:01 unnali: ambrosebs: looks fun!

0:01 ivan: ambrosebs: tell the mailing list

0:03 ambrosebs: ivan: ok

0:04 technomancy: ambrosebs: congratulations

0:04 ivan: very pleased to hear "We capture the Clojure idiom of using maps with known keyword fields by using heterogeneous map types."

0:05 technomancy: anyone care to fork the repo and add a .mobi? =)

0:05 ambrosebs: ivan: there's a wealth of research related to O'Caml records that take this even further.

0:05 technomancy: cheers :)

0:33 georgek: hi, I'm trying to read a #inst date from a map which I've def'd as 'foo' in the repl, so the data looks like :date #inst "2012-10...", however when I try (read-string (:date foo)) I get the error 'NullPointerException java.io.StringReader.<init> (StringReader.java:50)

0:34 anyone know what the problem might be? I'm using Clojure 1.4

0:39 muhoo: what is an #inst?

0:39 georgek: an instant literal

0:42 hmm, if I define a test #inst like (def test "#inst ....") it works fine

0:43 I guess the map is messed up somehow

0:44 unnali: hm

0:44 do you need to use READ-STRING if it's defined as #inst "2012-10…" in the map?

0:44 like, what do you get for just (:date foo)?

0:44 georgek: nil

0:45 and nil for the class and type as well

0:45 unnali: I guess it is a bit messed up then!

0:45 georgek: haha, yep

0:46 timewarrior: Hi Everyone. I was wondering if someone could help me with ring-sessions. I have a working implementation. But whenever I restart the server all the session data is lost. I am using a mongodb based session helper which works.. but am wondering if using a db backed data store is the best practise

0:50 muhoo: timewarrior: persist ring sessions, theere's a lib for that

0:51 timewarrior: something like this? https://github.com/timewarrior/mongodb-session

0:51 this is persisting sessions..

0:51 muhoo: yep. there's one for couch too, probably others

0:52 timewarrior: yea.. but I am just wondering that for every app which needs persistent logins (i.e. no need to login if server restarts) - do they persist the session or do they use some other strategy

0:52 muhoo: probably persist the sessions to disk/db

0:53 that's what i've done anyway

0:53 timewarrior: awesome.. appreciate your responses

0:53 did you build your own auth layer or did you use something like friend

1:00 I had another questions, is there any way to access request object at the route handling layer

1:02 Sgeo: I forget where exactly this syntax is used, but something like [a b :as r]

1:02 For Compojure and Noir (based on Compojure) I think

1:02 timewarrior: I am using compojure

1:02 Sgeo: Well, as in, for Compojure, and also for Noir (which uses Compojure)

1:03 timewarrior: great.. thanks..

1:03 I am still trying to wrap my head around compojure

1:04 Raynes: Your head will be all bent like.

1:05 timewarrior: :)

1:21 zackzackzack: In something like (defn a [&b] b), what does the & do? I know that (defn a [& b] b) would collect all arguments into b, but what happens when the space is left out?

1:22 Raynes: &((fn [&b] &b) 1 2 3)

1:22 lazybot: clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox7657$eval319527$fn

1:22 Raynes: &((fn [&b] &b) 1)

1:22 lazybot: ⇒ 1

1:22 amalloy: gives you a variable named &b

1:22 Raynes: It becomes a symbol.

1:24 zackzackzack: So &b is the same as b effectively?

1:24 unnali: zackzackzack: nope, it's a different symbol entirely.

1:24 but it "acts" like b, there's nothing special about it per se.

1:25 zackzackzack: Right, sorry that is the idea I meant to express

1:25 Thanks!

1:25 Sgeo: zackzackzack, note that in the body of a macro, &env and &form have special meaning.

1:25 amalloy: not a helpful thing to learn at this time, though

1:25 zackzackzack: Actually yes it is

1:25 I'm messing around with defn

1:26 Sgeo: zackzackzack, amalloy may have been referring to my mention of &env and &form

1:26 zackzackzack: And seeing if I can't get it to print out the types of the arguments

1:26 Whenever the function gets called

1:27 unnali: zackzackzack: e.g.?

1:27 zackzackzack: (defn-type-example typed [a b] [a b])

1:27 (typed 1 2)

1:27 ; Integer Integer

1:27 [1 2]

1:28 unnali: so how are you going about it?

1:29 zackzackzack: Not sure yet. I've been trying to understand how defn works as a macro

1:29 unnali: it's a lot more complicated than this, but a simplest definition for the simplest form of defn could be: (defmacro defn [name args & body] `(def ~name (fn ~args ~@body)))

1:29 Sgeo: ,(macroexpand-1 '(defn my-fn [arg1 arg2] some code here))

1:29 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

1:29 unnali: grossly understated.

1:30 Sgeo: &(macroexpand-1 '(defn my-fn [arg1 arg2] some code here))

1:30 lazybot: ⇒ (def my-fn (clojure.core/fn ([arg1 arg2] some code here)))

1:30 unnali: hmm.

1:31 zackzackzack: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L266

1:31 unnali: &(meta (first (next (macroexpand-1 '(defn my-fn [a1 a2] blah)))))

1:31 lazybot: ⇒ {:arglists (quote ([a1 a2]))}

1:31 unnali: huh!

1:31 zackzackzack: yeah, that's it.

1:32 "fdecl" is consumed throughout that LET starting line 280, and the meta hash "m" is builtup by pieces.

1:32 that's kinda the scariest bit.

1:32 Sgeo: I don't entirely understand the &form and &env actually being in the arglist

1:32 zackzackzack: Right, that's why I asked originally

1:32 It isn't actually a macro at first

1:32 unnali: zackzackzack: try https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L422 defmacro.

1:32 zackzackzack: defn becomes a macro after it is defined

1:33 unnali: yeah, which is equivalent, more or less.

1:33 just 'cause defmacro has yet to be defined!

1:33 note that defmacro itself just calls defn (line 464), then calls setMacro on it and then returns the var.

1:33 zackzackzack: Which makes sense.

1:33 unnali: yup, so it's as much a macro as you're going to get.

1:34 so &form and &env are magic, anyway.

1:34 not that that showed that, sorry.

1:35 Sgeo: Where is the magic?

1:35 unnali: good question.

1:35 (searching)

1:36 AtKaaZ: is ideone down? I need this code: http://ideone.com/z6MTLx

1:36 * Sgeo suspects in whatever processes fn or whatever that expands to

1:36 Sgeo: AtKaaZ, is that my code by any chance?

1:36 http://webcache.googleusercontent.com/search?q=cache:http://ideone.com/z6MTLx

1:36 AtKaaZ: Sgeo it is

1:36 Sgeo: Oh hey it is :)

1:37 AtKaaZ: thanks

1:37 Sgeo: yw

1:37 I'm curious what you need it for

1:38 AtKaaZ: the same thing that I wanted to do, basically I want to be able to return the symbol(value) if the symbol exists, or throw otherwise, but not the CompilerException

1:40 Sgeo: Hmm. Symbol known at runtime or compiletime?

1:40 AtKaaZ: runtime

1:40 unnali: zackzackzack: getting closer I think.

1:40 zackzackzack: https://github.com/clojure/clojure/commit/277f023

1:41 AtKaaZ: Sgeo, last time you said something about &env and resolve, I'm attempting that, as soon as I understand how to use &env xD

1:41 unnali: zackzackzack: https://github.com/clojure/clojure/commit/277f023#diff-1 I think this is the important bit. macroexpansion always calls with the form cons'd onto the LOCAL_ENV.get() cons'd onto the rest of the form proper.

1:42 so all macros get &form and &env whether they like it or not. this means any macro defined manually (not with defmacro) must have &form and &env specified; defmacro adds them in itself with "add-implicit-args" as seen here: https://github.com/clojure/clojure/commit/277f023#L0R342

1:42 Sgeo: AtKaaZ, it's easy. In a macro, &env refers to the lexical environment map of where the call occurs. Remember, all macros are done long before runtime.

1:42 Almost wrote runetime

1:43 This map's keys are each symbol that exists lexically, that is, where the macro call is within some scope that defines some lexical variable

1:43 (let [a 1] ...) the ... is within a lexical scope of the a

1:44 AtKaaZ: yep I got that

1:44 so that is why I also need resolve to see others that are maybe def-ed

1:44 zackzackzack: AHHHH okay

1:44 So setMacro is not exactlyyyy defmacro

1:45 unnali: zackzackzack: not close, it just tells the compiler to treat it as a macro

1:45 AtKaaZ: Sgeo, but that &env is not available at runtime right? something like ~&env

1:45 unnali: zackzackzack: e.g.

1:45 &(defn x [& args] `(print ~(count args)))

1:45 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

1:45 unnali: bah.

1:45 this would be difficult to demonstrate.

1:46 zackzackzack: haha gist?

1:46 unnali: sure.

1:46 Sgeo: That ~&env tells a quasiquote to splice in the &env, the only being avaibale at macroexpand shouldn't matter

1:46 I'm not entirely sure why it breaks

1:46 But yeah, only macros have &env

1:46 unnali: zackzackzack: https://gist.github.com/3950619

1:47 AtKaaZ: Sgeo, I just wanted to know how can I refer it inside a ` block hmm

1:47 unnali: note we get 3 as the result; &form and &env are always there in macroexpansion.

1:47 AtKaaZ: try `(... blah ... ~'&env ... bah ...)

1:47 Sgeo: You could do something like `(println ~(keys &env))

1:47 zackzackzack: Hmmm

1:48 Sgeo: unnali, not sure how that's of use unless AtKaaZ is writing a macro that writes macros?

1:48 unnali: Sgeo: neither really.

1:50 AtKaaZ: hmm they both err

1:51 alex_baranosky: sounds like some exciting macro talk tonight

1:52 I've never seen .setMacro

1:52 Sgeo: ,(let [b 2] `(let [a 1] `(blah blah ~a blah ~~b blah)))

1:52 clojurebot: (clojure.core/let [sandbox/a 1] (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/blah)) (clojure.core/list (quote sandbox/blah)) (clojure.core/list sandbox/a) (clojure.core/list (quote sandbox/blah)) ...)))

1:52 unnali: just an implementation detail, really

1:52 Sgeo: Oh come on

1:53 ,(let [b 2] `(let [a 1] `(~a ~~b)))

1:53 clojurebot: (clojure.core/let [sandbox/a 1] (clojure.core/seq (clojure.core/concat (clojure.core/list sandbox/a) (clojure.core/list 2))))

1:53 alex_baranosky: Sgeo: what are you attempting to do there?

1:53 Sgeo: alex_baranosky, learn about nested quasiquoting

1:53 (is what I'm attempting to do)

1:53 That sandbox/a is a problem, but I know how to fix it

1:53 AtKaaZ: wow that ~~b 's return

1:55 Sgeo: Oh, I only know how to fix that first sandbox/a

1:55 unnali: Sgeo: if you use a# and ~a# it should do the trick?

1:55 AtKaaZ: Sgeo, i see I can't simply return &env -> Can't embed object in code,

1:55 unnali: ,(let [b 2] `(let [a# 1] `(~a# ~~b)))

1:55 clojurebot: (clojure.core/let [a__27__auto__ 1] (clojure.core/seq (clojure.core/concat (clojure.core/list a__27__auto__) (clojure.core/list 2))))

1:55 Sgeo: unnali, ooh, right, I should do that

1:56 AtKaaZ, yeah, I don't know why that occurs

1:56 unnali: Sgeo: this is the "sensible" way to use lexicals in macros. you could just ~' everything, which leads you into the territory of non-hygenic macros

1:56 Sgeo: unnali, I guess I wasn't thinking in those terms

1:57 ,(let [b 2] `(let [a# 1] `(a# ~~b)))

1:57 clojurebot: (clojure.core/let [a__55__auto__ 1] (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/a__54__auto__)) (clojure.core/list 2))))

1:57 unnali: note that that's done something subtly different

1:57 Sgeo: I want to write a macro to write macros that write macros

1:58 No particular examples in mind, sadly

1:58 unnali: there's no problem with that. I'd start by working out what you want it to produce.

1:59 AtKaaZ: a macro that produces it's own source code

2:10 Sgeo: AtKaaZ, completely possible, I believe.

2:10 AtKaaZ: I don't doubt it, but too tough to compute

2:11 Sgeo: It's a quine

2:11 AtKaaZ: is there another way to find out if a symbol is defined lexically?

2:11 Sgeo: http://esolangs.org/wiki/Quine

2:12 AtKaaZ: I remember that for a pascal program

2:12 Sgeo: Should be able to modify this to make it macro-y

2:13 AtKaaZ: ,((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))

2:13 clojurebot: ((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))

2:13 AtKaaZ: lol , amazing if you ask me

2:14 Sgeo: Hmm, why not ' like in the original

2:14 ,((fn (x) (list x (list 'quote x))) '(fn (x) (list x (list 'quote x))))

2:14 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

2:15 Sgeo: ,((fn [x] (list x (list 'quote x))) '(fn [x] (list x (list 'quote x))))

2:15 clojurebot: ((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))

2:15 Sgeo: oh

2:16 zackzackzack: unnali: this is what I've had in mind

2:16 https://github.com/zmaril/pssst/blob/master/src/psssst/core.clj

2:16 AtKaaZ: ,(let [b 1] (eval b))

2:16 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

2:17 unnali: zackzackzack: I see!

2:17 zackzackzack: If you use defn-recorded, it captures the types of all your function calls and then spits them out to a file automatically

2:17 So, it's a tool for type-hinting and also seeing what is going on with your functions

2:18 Sgeo: zackzackzack, want to make body a rest argument and use unquote-splice?

2:18 zackzackzack: Good idea, done. There is still a fair amount of work to be done

2:18 AtKaaZ: how can I cause (eval b) to complain that b doesn't exist only after calling eval (ie. inside eval) or something

2:18 unnali: AtKaaZ: (eval "b")?

2:19 zackzackzack: At this point, I am just hard coding all the different ways to use defn into there

2:19 AtKaaZ: that's a string?

2:19 unnali: no, that was dumb.

2:19 Sgeo: unnali, eval takes forms, not strings

2:19 unnali: AtKaaZ: so it is.

2:19 AtKaaZ: ok

2:19 unnali: Sgeo: my bad.

2:19 AtKaaZ: maybe something similar to eval?

2:19 unnali: AtKaaZ: how could something just come into existence if it didn't already exist?

2:19 AtKaaZ: (eval 'b) ?

2:19 zackzackzack: And then working through how to record types of destructured maps and seqs

2:20 AtKaaZ: oh yeah that might work also this (try (eval (symbol "b")) (catch Throwable t t))

2:20 unnali, that works too thanks

2:20 unnali, like, it can encounter a def later on i guess

2:21 Sgeo: zackzackzack, https://github.com/Sgeo/pssst/commit/1eb029e3598dc5e13fe4a9a6221ab7dd05668af8

2:21 unnali: I guess.

2:21 Sgeo: Also, why are you splicing in record, lemme look at that

2:21 Oh woah, I thought it was just a gist

2:22 zackzackzack: Nah, I see this being something that people import and then specifically state they want to record the parameters for a certain function

2:23 Sgeo: Hmm

2:23 ,`(~resolve 'blah)

2:23 clojurebot: (#<core$resolve clojure.core$resolve@601c9cb9> (quote sandbox/blah))

2:23 Sgeo: huh.

2:23 So actually splicing in record would work

2:24 Well, maybe

2:24 I wouldn't rely on it though, doesn't seem good stylistically

2:24 * Sgeo needs to go make food

2:43 zackzackzack: I'm still looking at splicing in record

2:44 I'm not sure which way to do it such that it is stuff. I think splicing it in as the function will make sure it doesn't clober anything later on

2:49 AtKaaZ: can I have some sugestions on how to prevent a certain key to be read from a map? ie. I want it to throw ie. (:value {:a 1}) would throw

2:51 alex_baranosky: what are you favorite libraries for java object/class introspection?

2:58 Sgeo: AtKaaZ, more clarification on what exactly you're looking for?

2:58 Oh, removing a key?

2:59 ,(dissoc {:a 1 :b 2} :a)

2:59 clojurebot: {:b 2}

3:01 AtKaaZ: Sgeo, I was thinking to return the state of a symbol and its value in a map like {:state :bound :value 100} but in case of :state unbound I would want to catch attempts(calls) to get the :value so that I could track down possible bugs

3:02 Sgeo: Just don't make maps that look like {:state :unbound :value :blah}

3:02 _ulises: AtKaaZ: can you wrap :value using a function like (value ...); then you can log there

3:02 Sgeo: Can make a consistency checker that throws on an inconsistent map

3:02 In Haskell you'd use an or type

3:03 data Whatever = Unbound | Bound Int

3:03 Statically checked

3:03 That you don't have inconsistent whatever

3:04 AtKaaZ: _ulises: do you mean they should use (value map) to get (:value map) ? but can I prevent them from using the latter? or do you mean I should return the function inside the map {:value #fnwhichreturnsvalue}

3:05 _ulises: AtKaaZ: the latter is also possible. You can't really prevent them using :value, but then again, you can't stop a person if they have enough will to try and break your system :)

3:06 * Sgeo abruptly decides on moral principle never to use (:this form) again

3:07 AtKaaZ: xD

3:07 _ulises: heh

3:07 AtKaaZ: ,(get {:a 1} :a)

3:07 clojurebot: 1

3:07 AtKaaZ: you'd use that?

3:07 Sgeo: ,({:a 1 :b 2} :a)

3:07 clojurebot: 1

3:07 AtKaaZ: ,(get nil :a)

3:07 clojurebot: nil

3:07 Sgeo: ,(find {:a 1 :b 2} :a)

3:07 clojurebot: [:a 1]

3:07 Sgeo: ,(find {:a 1 :b 2} :c)

3:07 clojurebot: nil

3:08 AtKaaZ: what's the diff ?

3:08 oh i see, i can provide default with get

3:08 Sgeo: find allows you to always determine whether the key is present along with getting the value

3:08 ,({:a 1} :b :nothere)

3:08 clojurebot: :nothere

3:09 AtKaaZ: (find [:a nil :b 1] :a)

3:09 ,(find [:a nil :b 1] :a)

3:09 clojurebot: nil

3:09 AtKaaZ: ,(find {:a nil :b 1} :a)

3:09 clojurebot: [:a nil]

3:09 AtKaaZ: oh that's good , now i notice

3:16 can I call a macro based on the type? ie. if param is a var or a symbol

3:17 I'd syphon it through a function except that the param could be undefined hmm

3:17 Sgeo: ,(if (== (+ 1 1) 2) (-> 5 inc) (->4 dec))

3:17 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ->4 in this context, compiling:(NO_SOURCE_PATH:0)>

3:17 Sgeo: ,(if (== (+ 1 1) 2) (-> 5 inc) (-> 4 dec))

3:17 clojurebot: 6

3:18 Sgeo: Not sure exactly what you want to do

3:19 AtKaaZ: I have a macro like (macro? sym) but I want it to also accept vars like #'defn but als o defn, so far I'm splitting it into two named macros

3:20 PuercoPop: hi, quick questión where can I find the postgres jdbc versión drivers (I'm looking for 9.2, 9.2-1000.jdbc4 is not found by leininggein

3:24 alex_baranosky: is .bindRoot thread-local?

3:40 john2x: how do I get the key/s of a map given a value?

3:44 alex_baranosky: Nice: "The ability to specify types that explicitly include or exclude

3:44 nil is one of the strengths of Typed Clojure, and an aspect where it is more

3:44 expressive than standard type systems like that for Java."

3:44 _ulises: john2x: there's a function to reverse a map which I don't remember now; I also seem to recall it being in clojure.set for some reason

3:44 john2x: if you find that fn, then it's trivial

3:45 ,(doc map-invert)

3:45 clojurebot: I don't understand.

3:45 john2x: _ulises: clojure.set/map-invert :) thanks!

3:45 _ulises: john2x: yay!

3:46 ro_st: anyone running in production on EC2 willing to answer some noob questions?

3:48 vijaykiran: ro_st: "don't ask to ask, just ask :P"

3:51 ro_st: when do you get billed for ec2; when you process request or from the time you spin a node up to the time you switch it off?

3:51 vijaykiran: based on time it is up

3:52 bill is as long as you keep the node up

3:52 ro_st: thought so. how quickly do nodes come up?

3:52 vijaykiran: pretty quick in my experience - but depends on what you run on the node as well.

3:52 ro_st: could you spawn staging clouds on demand, for a couple hours here and a couple hours there?

3:53 1 datomic + 1 ring, basically

3:54 vijaykiran: should be pretty quick to boot up, I don't think I understood your "staging clouds" question

3:54 ro_st: well, we want a staging environment for our system. trying to determine the best way to have one without paying full production costs

3:55 vijaykiran: hmm - you can spin up as many instances as you want and as long as you want

3:55 ro_st: so we could stage inside production, through the use of feature flags to hide new code

3:55 but that doesn't give us as much freedom as a completely separate stack

3:56 yeah. it seems like starting up new nodes as we need them and switching them off again when we're done is the way

3:56 vijaykiran: yes

3:57 ro_st: are you using pallet, vijay?

3:57 vijaykiran: no, just raw git pull and shell scripts - not automated.

3:58 ro_st: brave man :-)

3:58 vijaykiran: and provisioning is manual :)

3:59 ro_st: how many nodes are you using?

3:59 vijaykiran: right now 2 for "failover" and 1 testing/staging/breaking stuff

4:00 still undercover for a small app - so nothing "webscale" :)

4:00 ro_st: awesome, and you have your entire stack on each node? db/web/etc?

4:00 vijaykiran: no DB is on RDS

4:01 ro_st: ah of course

4:01 vijaykiran: I guess it depends on the app - how you want to distribute - there are high i/o instances and other choices

4:03 ro_st: yeah

4:05 thanks vijay. i return you to your regularly scheduled coffee and parenthesis

4:06 vijaykiran: yw

4:11 AtKaaZ: in a test unit what's the way to test for an expected exception?

4:12 ro_st: in midje it's =throws=>

4:12 not sure about clojure.test

4:13 AtKaaZ: thanks I'll check that too

4:13 ro_st: #not-so-subtle-hint-to-check-midje-out

4:13 AtKaaZ: lol

4:14 Fossi: what he said :)

4:14 ro_st: using lein2 AtKaaZ?

4:15 AtKaaZ: yes

4:15 ro_st: here's my profiles.clj

4:15 https://www.refheap.com/paste/6128

4:16 AtKaaZ: that means, in one of your projects?

4:16 ohh nvm i get it now

4:16 ro_st: :repositories, lazytest, midje lines are what you'll want to add to your own ~/.lein/profiles.clj

4:16 then you can run lein midje —lazytest in any lein project and it'll run any clojure.test and/or midje facts you have

4:17 and re-run affected namespaces whenever you update a file

4:18 https://github.com/marick/Midje/wiki/Midje-mode is indispensible if you use emacs

4:18 AtKaaZ: i use eclipse/ccw/lein

4:18 ro_st: we use both lazytest and midje-mode extensively

4:19 that's also fine. lazytest by itself is plenty

4:24 AtKaaZ: I will probably have to use the midje lein plugin inside project.clj just in case whoever's using the project doesn't have it

4:39 bbeans: vm2k3-cfm5.mgt.hosting.dc2.netsol.com (205.178.152.214)

4:40 Wow, I was passed testing.

4:58 tomoj: I typed `pkill emacs`, hesitated a moment, then it woke up :)

4:59 AtKaaZ: what's the repl equivalent for lein midje?

5:01 ro_st: that's why midje-mode, AtKaaZ

5:02 you can just evaluate a midje facts file into your repl, and re-evaluate individual facts as you need to

5:03 midje-mode makes this simpler by providing keybinds for sending a fact and printing the result directly into the source file as comments

5:03 but you could just as easily watch your repl for output

5:34 AtKaaZ: maybe I should switch to emacs

5:35 but I am afraid of new things :D so much to learn

5:35 fear of the unknown

5:35 can emacs find the definition of some function?

5:35 or can refactor? (not that you can in ccw)

5:36 ro_st: no refactoring. swank does support goto definition

5:36 not sure about nrepl

5:37 it's a massive learn curve. worth it, though.

5:37 problem with emacs is it's *very* easy to burn time tinkering

5:37 AtKaaZ: tinkering within emacs or with clojure code?

5:37 mpenet: there is a project that allows refactoring, but sure how good it is though

5:38 AtKaaZ: mpenet, what's its name?

5:38 Raynes: nrepl does goto definition as well, IIRC. Better than SLIME if I remember right.

5:38 mpenet: AtKaaZ: clojure-refactoring, surprisingly

5:38 AtKaaZ: slime is swank?

5:38 mpenet: Raynes: better how?

5:38 Raynes: ido-mode integration.

5:38 mpenet: oh nice

5:39 AtKaaZ: what's that? ido-mode?

5:39 nvm I'll google it

5:39 oh yes “Interactively DO things” sounds good :D

5:40 ro_st: Raynes: what about breakpoint support? i lean quite heavily on (swank.core/break)

5:40 i'm still using swank

5:40 have't made the switch to nrepl.el yet

5:40 Raynes: ro_st: I don't think it has breakpoint support yet.

5:41 AtKaaZ: is nrepl.el supposed to be better?

5:41 ro_st: newer

5:41 built on top of nrepl, which is quite awesome

5:41 Raynes: ro_st: https://github.com/pallet/ritz/tree/develop/nrepl

5:42 AtKaaZ: It is the successor to SLIME for Clojure and it is generally recommended that you use it if you're using Emacs. swank-clojure (the server part written in Clojure) is no longer being maintained.

5:42 nrepl.el misses a few things from SLIME, but it is evolving.

5:42 ro_st: ah, ritz. another tool i've not had time to muck with

5:43 thanks for the link, Raynes

5:44 AtKaaZ: mpenet: this seems to be the most recent one https://github.com/joodie/clojure-refactoring

5:45 i'll try look into emacs even though I am on windows

5:46 this seems to be a good start: http://clojure-doc.org/articles/tutorials/emacs.html

5:46 ro_st: highly recommend the peepcode 'cast on emacs, too.

5:47 but not the clojure one(s). they're quite out of date now

5:47 AtKaaZ: ro_st this one? https://peepcode.com/products/meet-emacs

5:47 ro_st: dats der bunny

5:48 AtKaaZ: must be good since it's $12 :)

5:48 mpenet: Would that make sense to allow every-pred and some-fn take 0 arguments? I find myself doing this a lot: ((apply some-fn coll) :something)

5:49 well, wishing I could do this

5:52 Probably not.

5:54 AtKaaZ: ro_st: are you using Magit? seen the preview for that cast it's very appealing so far

5:55 ro_st: yes

5:55 love it

5:55 i open emacs just to use magit, sometimes

5:55 AtKaaZ: awesome

5:58 alex_baranosky: That one last Clojure/Conj ticket on the site is eating at my soul

6:02 mpenet: in general I think most general purpose functions should work sensibly for no args… ilke you said it makes them easier/safer to use

6:02 mpenet: yep, or take collections

6:05 I can't post on clj-dev, but I'll try to see what others think on the clojure ML. It is a trivial change, but maybe there is a good reason why it is like this.

6:05 ,(comp)

6:05 clojurebot: #<core$identity clojure.core$identity@566f653b>

6:06 mpenet: (partial)

6:06 ,(partial)

6:06 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$partial>

6:06 mpenet: well for partial I can understand why, but if it works for comp, it should for others maybe

6:08 john2x: how do I declare bindings in fixtures (clojure.test)? the doc didn't have any examples..

6:20 here's what I'm trying to do (but it's wrong) http://pastie.org/5113784

6:27 mpenet: ,((every-pred (fn [_])))

6:27 clojurebot: true

6:30 mpenet: ,((some-fn (fn [_])))

6:30 clojurebot: nil

6:54 mpenet: ,(every? identity [])

6:54 clojurebot: true

6:56 Islaminati: ,(identity)

6:56 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$identity>

6:56 Islaminati: Ohh

6:56 Yeah

6:56 ,(every? #(false) [])

6:56 clojurebot: true

6:59 black_joe: I'm trying to make a function that checks to see if a list and all of its nested lists is completely empty.

7:00 How could I check that? Because a list like (()) is not equal to () or nil.

7:00 Current source is on https://github.com/dymatic/spell-package-manager/blob/master/spell/src/lib/libClj.clj line 143, but not really relevant since this will probably have to be its own function.

7:00 shachaf: Do you mean "or"?

7:00 _ulises: black_joe: something like (apply and (map empty? your-lists-here))

7:01 shachaf: I assume black_joe meant something recursive.

7:01 I.e. a tree made of only conses and empty lists.

7:01 Islaminati: black_joe, so you basically want () to be true, (() () ()) to be true and (((() ()) ())) to be true etc.

7:01 _ulises: ah, gotcha

7:01 black_joe: Right. Just to check if they're empty.

7:02 And I really haven't done enough work with trees to do this effectively with them.

7:02 shachaf: black_joe: That's a bit of a strange operation.

7:02 AtKaaZ: ,(empty? (flatten '(() ())) )

7:02 clojurebot: true

7:02 Cheiron: Hi, what is the recommended way to define a const in Clojure ? yes def but what the naming convention?

7:02 AtKaaZ: ,(empty? (flatten '(() (()))) )

7:02 clojurebot: true

7:02 AtKaaZ: ,(empty? (flatten '(() ((2)))) )

7:02 clojurebot: false

7:03 shachaf: Hah, AtKaaZ++'s solution should work.

7:03 black_joe: Okay. Well, I didn't know about either function. Thanks.

7:03 Islaminati: Flatten flattens to infinite depth?

7:04 shachaf: black_joe: If you're learning, you should be able to write this function yourself. :-)

7:04 black_joe: I've spent too much time on the data types and other specifics of Clojure and not enough about the core libraries.

7:04 I'll look into what's out there.

7:04 shachaf: You don't need to know about the libraries.

7:04 Just write it using the primitives.

7:05 black_joe: Well, I tried to use recursion, but that didn't work. It would only go 2 levels deep.

7:05 shachaf: Sounds like you didn't use very much recursion. :-)

7:05 black_joe: Using a loop that checked to see if the (first) of the list was a list, and then checking that one. But if that contains a list it didn't work.

7:06 shachaf: It seems to me like you don't need to treat car any differently from cdr.

7:07 black_joe: You don't. The problem was getting to those cars and cdr's once they were nested and being able to return to the head position.

7:07 shachaf: You have a tree, and you want every node of it to be either the empty list or (cons x y), where x and y are trees satisfying this property.

7:08 (defn foo? [a] (or (null? l) (and (cons? l) (foo? (car l)) (foo? (cdr l)))))

7:08 Something like that, I don't know Clojure.

7:08 black_joe: Trees in general give me a pain. Our class starts covering them soon though, so that should clear a lot up.

7:08 Islaminati: shachaf, first and rest, clojure doesn't have car and cdr.

7:08 shachaf: Get a head start, write some recursive functions!

7:08 Islaminati: Or cons cells.

7:08 And list?

7:09 shachaf: Islaminati: Oh. I saw the word "car" in that link black_joe linked to.

7:09 black_joe: I still refer to first and rest as cars and cdrs in my documentation.

7:09 shachaf: Islaminati: It doesn't have cons cells? What are lists?

7:09 Islaminati: ,car

7:09 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: car in this context, compiling:(NO_SOURCE_PATH:0)>

7:09 shachaf: ,(cons 1 2)

7:09 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

7:09 shachaf: OK, Clojure /= Scheme.

7:09 Islaminati: ,(car '("Ahh", "girl" "look" "at" "that" "list"))

7:09 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: car in this context, compiling:(NO_SOURCE_PATH:0)>

7:09 black_joe: It still has cons, but it's for sequences.

7:09 shachaf: So you can simplify what I said a bit. :-)

7:10 Islaminati: shachaf, yeah well, there are no true 'cons pairs', there are list nodes, whichbdemands its cdr are lists

7:10 black_joe: And usually recursion is achieved with the (recur) macro since the JVM has poor tail-call optimization.

7:10 shachaf: ,(null? '())

7:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: null? in this context, compiling:(NO_SOURCE_PATH:0)>

7:10 Islaminati: Which honestly is pretty sweet and solves a lot of issues, especially with mutable conses.

7:10 shachaf: ,(empty? '())

7:10 clojurebot: true

7:10 Islaminati: that'd be empty?

7:10 empty? also works on vectors and hashes an dwhat not.

7:10 shachaf: ,(all? empty? '())

7:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: all? in this context, compiling:(NO_SOURCE_PATH:0)>

7:10 Islaminati: Also, it doesn't have TCO.

7:10 shachaf: ,(all empty? '())

7:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: all in this context, compiling:(NO_SOURCE_PATH:0)>

7:11 * shachaf sighs.

7:11 Islaminati: shachaf, every

7:11 (every? empty '())

7:11 shachaf: ,(every? empty? '())

7:11 clojurebot: true

7:11 Islaminati: (every? empty? '())

7:11 Like that

7:12 shachaf: Anyway, you get the idea.

7:13 black_joe: It would just be nice is () was equal to nil.

7:13 That was a convenience in Lisp.

7:13 shachaf: That seems un-nice to me.

7:14 * shachaf does not have Lisp Nature, though.

7:14 ro_st: what's the best way to map over a seq, but stop early? like break; in js loops

7:14 shachaf: Why do you want to stop?

7:14 ro_st: list of regexen to attempt until one matches, then do some work and return the result

7:14 clojurebot: http://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png

7:15 black_joe: Probably loop and recur with a collector and counter.

7:15 * shachaf doesn't know to what degree seqs behave like lazy lists.

7:15 mpenet: ro_st: for with :while, or reduce

7:16 Islaminati: black_joe, it's good that it keeps them separate honestly.

7:16 mpenet: nm not reduce

7:16 Islaminati: CLojure actually has lists as a datatype

7:16 CL does not.

7:16 It has cons as a datatype and nill, which is basically null.

7:16 list? in clojure runs in constant tyime for instance.

7:17 You also can't have the awkward thing that astructure is a list in one instance and not any more in another where it has been mutated to not be so any more.

7:17 black_joe: I suppose that's good, but a lot of functions that operate on lists return nil if the list is empty.

7:17 So checking for (or (= list nil) (= list ()) is required.

7:17 Islaminati: This is pretty much such a problem in scheme where the spec says that things like map don't even have to verify that the structures passed are lists, in which case they are not, anything can happen.

7:18 mpenet: black_joe: you can use seq for that

7:18 shachaf: Islaminati: In Haskell, you can run list? at compile time! :-)

7:18 mpenet: , (seq [])

7:18 clojurebot: nil

7:18 ro_st: with for, can you test something from :let in :while ?

7:18 ah i see that you can

7:18 Islaminati: shachaf, so about unsafeCoerce :: a -> b again.

7:19 shachaf: Great function!

7:19 Islaminati: But nil in clojure is basically null, as in 'no meaningful value here'

7:19 shachaf: @let isJust :: Maybe a -> Bool; isJust = unsafeCoerce

7:19 Islaminati: best function ever, it can implement unsafeperformio which is also fabulous

7:19 shachaf: Islaminati: unsafePerformIO is part of the Haskell spec, unlike unsafeCoerce.

7:20 And you can use unsafePerformIO to write unsafeCoerce, too.

7:20 Islaminati: I know, which is what makes both fabulous.

7:20 can types still be inferred by the way if you you replace every function x with unsavecoerce . x?

7:21 My intuition says me that type inference in that case would fail.

7:21 shachaf: Well, no it would be a huge crashing mess.

7:21 Everything would have every type.

7:21 Islaminati: Yeah, but assume that you take a type checking progrmingt

7:21 and just do that.

7:22 After you already know it checks.

7:22 shachaf: Oh, you're wondering whether it'll always compile?

7:22 Hmm, there'll be some ambiguities with type classes.

7:22 Oh, you're Lajla.

7:23 Islaminati: Of course.

7:23 shachaf: You should just take one nick and stick with it.

7:23 Islaminati: I beg to differ, we should in fact all constantly change nicknames.

7:25 ro_st: that sounds like something a Culture Mind would say

7:25 Islaminati: What's a culture mind?

7:26 ro_st: http://en.wikipedia.org/wiki/Culture_series

7:27 Islaminati: Ah, and they are against established identity?

7:29 ro_st: i've no idea. i simply meant what i said :-)

7:31 Islaminati: Ah

7:31 you should be too though

7:31 established identity is a posion to thought.

7:31 It influences the way peolpe think and lets them make faulty decisions.

7:32 ro_st: it's also an incredibly handy tool. communication would be tedious beyond usefulness without established identity

7:33 Islaminati: No, it's only useful exactly because people use establish identity and think in it.

7:33 ro_st: pass me the salt. salt? i see no salt. could you describe what you seek without labelling it, please, so that i may know what you mean?

7:33 Islaminati: THey need to know who people 'are' to be comfortable.

7:33 EXACTLY, that is the point

7:33 you do not need salt, what you want is 'something that alters the taste of your food in that way'

7:33 This needn't be salt

7:34 it needn't be a specific identified object, it can be an indeterminate anything that achieves that goal.

7:34 ro_st: but, in this case, it is salt, because the requestor had already decided this

7:34 hence using the word 'salt' in the request

7:34 Islaminati: What if language worked that you didn't ask for salt but asked for something that could do that?

7:34 But in a quicker way

7:34 Surely it would lead to more efficient communication and more utitlity since when salt is not available you would get something else that does the same rather than a 'no'

7:34 ro_st: i look forward to finding out how that would work

7:35 Cheiron: Hi, why the result of (concat [1 2] [3 4]) is (1 2 3 4) . isn't that the task of faltten? why the result isn't ((1 2) (3 4)) ?

7:35 Islaminati: You can more efficiently communicate your actual need, you don't want the thing identified as salt, you want anything that can fulfill that purpose.

7:35 mklappstuhl: hey

7:36 ro_st: what if my need is actually 'salt', and not your arbitrarily chosen assumption on my reason for needing it?

7:36 i might want to put some in my ear

7:36 mklappstuhl: I'm looking for some library to work with historical stock data... The ones I was able to find where not on clojars... do you may have other places where I could look?

7:37 Islaminati: ro_st, that's the point, that can never happen and with this system you can communicate that in a superior way.

7:37 You always want to put it in your ear to achieve a particular reason. There tends to be another object which fulfills that purpose as well.

7:37 So you can communicate that easily and efficiently.

7:38 ro_st: except when the object i've asked for is the object that best fulfils that purpose, of course

7:38 Islaminati: Identities are basically a poison to thought and force people to think in such weird ways

7:38 perhaps there is another object which fulfills that purpose as well that you overlooked, which is exactly the flaw in human thought that keeps recurring?

7:39 ro_st: please tell me you don't work in medicine

7:39 or child care

7:39 or operate any heavy machinery

7:39 -grin-

7:40 "hand me the number 5 scalpel". "here's a screwdriver".

7:40 Islaminati: That doesn't fulfill that purpose

7:40 ...

7:40 mklappstuhl: anyone an idea regarding financial data stuff?

7:40 Islaminati: Clearly whjat you want is any intstrument that can savely cut to curgical praecision.

7:40 ro_st: who is best equipped to make the decision on need?

7:40 Islaminati: Clearly a screwdriver does not fulfill that.

7:40 ro_st: the requestor, or the requested-of?

7:41 Islaminati: One assumes a fellow surgeon in the room is well equipped.

7:41 Who is equipped to correctly 'identify' the object that you mean?

7:41 Same story that is just displaced.

7:41 ro_st: i should think the person asking the question

7:41 mklappstuhl: or whats a good place to look for libraries in the current clojure ecosystem

7:41 ro_st: you seem to posit the person being asked the question is better equipped

7:42 mklappstuhl: I know http://clojuresphere.herokuapp.com/ and clojure toolbox

7:42 ro_st: which can be the case, but most of the time, it isn't

7:42 anyway. i have non-specific effort to perform. this was fun to think about

8:25 cmdrdats: for library projects, is there an implementation agnostic clojure logging library?

8:26 mklappstuhl: (use 'org.clojars.bmabey/csvlib)

8:26 I use this in the beginning of my file and it has been installed fine by leiningen...

8:26 no the less I get this

8:26 Exception namespace 'org.clojars.bmabey/csvlib' not found after loading '/csvlib' clojure.core/load-one (core.clj:5203)

8:27 message after (load-file)ling the file with the use statement from the repl

8:32 ro_st: cmdrdats: datomic uses logback, if that helps

8:33 cmdrdats: ro_st: cool, i'll look into it

8:35 ro_st: we're using it too, speak to V for code

8:38 clgv: mklappstuhl: a namespace must not contain "/"

8:39 mklappstuhl: you probably want to do (use 'csvlib) if that is a namespace in that lib

8:39 mklappstuhl: clgv, I just used require after reading that use is kind of outdated and that solved the problem... I guess use only takes namespaces and require also parts of namespaces

8:39 ro_st: i have a map as an argument, to which i expect several keys. i pass that map into internal fns which, based on which fn it is, will use some subset of those keys. how do i ensure the keys are there in the parent fn, without destructuring it?

8:40 clgv: mklappstuhl: that sounds wrong. before you mixed upp "group-id/artifact-id" with a namespace. leiningen needs the id format to get the lib. but in clojure you always use/require namespaces

8:45 mklappstuhl: but you seem to be right, that require worked. but only because it discards what you have written before "/"

8:45 mklappstuhl: fact is, you were using require/use wrongly

8:46 mklappstuhl: clgv, I'm using (require 'csvlib) now

8:46 clgv: mklappstuhl: good. :)

8:47 mklappstuhl: btw there is also a german irc channel #clojure.de ;)

8:50 mklappstuhl: clgv, oh cool

8:50 I actually prefer english when it gets technical but I'll stop by for sure :)

8:51 clgv: just mentioned it since it has not much advertisement elsewhere and you seemed to be in the target group ;)

8:52 edlich: Can someone help me

8:52 (filter #(re-find #"findstr" %) mystrcoll)

8:52 how to correctly replace #"pattern" by a val?

8:53 I want to filter every string in a string collection that matches the pattern

8:53 Is there an easier way to find if strings match in a string collection.

8:54 ?

8:54 zoldar: in case of a nested vector like [[1 2] [3 4]] , how to concisely conj element to the last vector in collection? something like (??? [[1 2] [3 4]] 5) => [[1 2] [3 4 5]]

8:55 ro_st: edlich: "a" in "a" "b" "c" ?

8:56 edlich: no, lets say we have a collection of sentences

8:56 I want to get a collection of every sentences that contain the word "beer". But beer is a var.

8:56 ro_st: ah

8:56 re-pattern

8:57 mpenet: or (filter #(.contains % "thing") sentences) ?

8:57 ro_st: ,(re-pattern "beer")

8:57 clojurebot: #"beer"

8:57 edlich: aah Thanks!

8:57 clgv: zoldar: you can use update-in as in ##(let [v [[1 2] [3 4]]] (update-in v [(dec (count v))] conj 5))

8:57 lazybot: ⇒ [[1 2] [3 4 5]]

8:58 ro_st: ah, didn't know update-in worked on vectors!

8:58 clgv: vectors are associative as well

8:58 ro_st: what about sets and lists and seqs? any of those, too?

8:58 clgv: ,(-> [] class ancestors)

8:58 clojurebot: #{java.lang.Runnable java.util.List clojure.lang.Associative clojure.lang.ILookup java.lang.Iterable ...}

8:58 clgv: ro_st: no

8:59 ro_st: ,(-> #{} class ancestors)

8:59 clojurebot: #{java.lang.Runnable java.lang.Iterable java.util.Collection clojure.lang.IObj java.util.concurrent.Callable ...}

8:59 ro_st: neat!

8:59 clgv: sets do only have values, no keys

8:59 zoldar: clgv: thanks

9:00 mklappstuhl: I want to write a file. everything I can find is the advice to use java io... is that still true?

9:00 mpenet: you can use spit

9:00 mklappstuhl: mpenet, It might be a long long file

9:00 mpenet: oh well better not then

9:01 there is clojure.java.io

9:02 uvtc: mklappstuhl: some i/o examples at http://clojure-doc.org/articles/cookbooks/files_and_directories.html .

9:03 babilen: mklappstuhl: You can easily use a writer (http://clojuredocs.org/clojure_core/clojure.java.io/writer) but also take a look at https://github.com/Raynes/fs and the aforementioned page

9:29 mklappstuhl: is (doseq) the idiomatic way to iterate over lists?

9:29 joegallo: yes, quite so

9:30 you might think of it as being the equivalent of java's for loop (but don't think of clojure's for in the same way!).

9:30 uvtc: mklappstuhl: `doseq` is for side-effects.

9:34 clgv: mklappstuhl: for side effects like printing something to stdout, yes. if you want to transform the list there is `map` or `for`

9:37 * Hodapp reads the backlog to regain some faith in humanity after seeing a horrid this-C++-compiler-handles-some-template-but-not-GCC issue

9:38 * jcromartie hugs Hodapp

9:38 jcromartie: it's going to be OK

9:38 here, have a REPL

9:40 Hodapp: :)

9:53 mklappstuhl: having (:a :b) and (1 2) how would I get to {:a 1 :b 2} ?

9:54 dnolen: ,(zipmap '(:a :b) '(1 2))

9:54 clojurebot: {:b 2, :a 1}

9:54 dnolen: mklappstuhl: ^

9:54 mklappstuhl: dnolen, thanks

9:54 I knew it was something with zip :P

9:56 dnolen: if you've got some spare cycles upvote Ambrose's sweet Typed Clojure paper on HN http://news.ycombinator.com/newest

9:58 djcoin: dnolen: awesome !

9:58 :)

9:59 hyPiRion: dnolen: Sweet. I usually tend to upvote stuff after I've read through it though.

10:01 Looks like a well done work.

10:02 ambrosebs: dnolen: cheers :)

10:02 djcoin: congrats :)

10:03 ambrosebs: djcoin: thanks!

10:06 mklappstuhl: how would I get the values of a hash-map in a list? {:a 1 :b 2} => (1 2)

10:08 dnolen: ,(vals {:a 1 :b 2})

10:08 clojurebot: (1 2)

10:08 dnolen: mklappstuhl: ^

10:08 Islaminati: shachaf, I think I need better dental hygiene.

10:08 dnolen: ambrosebs: this is a fantastic read :) seems like you've spent a considerable amount of time on this :D

10:10 ambrosebs: dnolen: lovely of you to say!

10:11 dnolen: yes, it's basically been my year :)

10:22 dnolen: ambrosebs: well looky there #2 on HN, refreshing to see actual science at the top.

10:22 ambrosebs: dnolen: pity it's not a flashy webpage with browser repl ;)

10:24 dnolen: ambrosebs: what?! I have to read 74 pages of well written, well formatted, well referenced text!

10:24 ambrosebs: dnolen: but it's PDF!

10:24 :D

10:41 mklappstuhl: another question :P

10:44 I have a list like (1 3 2 4 6) and I want to have a new list that contains the difference between the first and the second, the second and the third and so on

10:45 (2 -1 +2 +2) would be the wished outcome in the above example

10:46 ToBeReplaced: ,(let [coll '(1 3 2 4 6)]

10:46 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

10:46 ToBeReplaced: (map - coll (rest coll)))

10:47 i don't know how to use the clojurebot!

10:47 Mr_Bond: ,(let [coll '(1 3 2 4 6)])

10:47 clojurebot: nil

10:48 Mr_Bond: ,(let [coll '(1 3 2 4 6)] (map - coll (rest coll)))

10:48 clojurebot: (-2 1 -2 -2)

10:48 ToBeReplaced: i guess the carriage return was no good?

10:48 S11001001: ToBeReplaced: true

10:49 ToBeReplaced: ,(let [coll '(1 3 2 4 6)] (map - coll (rest coll)))

10:49 clojurebot: (-2 1 -2 -2)

10:49 tmarsh: flipping the - gives the output requested

10:49 S11001001: ToBeReplaced: more precisely, the intervening \r\nPRIVMSG #clojure :

10:49 tmarsh: ,(let [coll '(1 3 2 4 6)] (map - (rest coll) coll)))

10:49 clojurebot: (2 -1 2 2)

10:56 ohpauleez: dnolen: All done - http://dev.clojure.org/jira/browse/LOGIC-60

10:56 dnolen: ohpauleez: sweet gotta run but will apply in a bit!

10:57 ohpauleez: Awesome

11:02 ambrosebs: Typed Clojure no.1 on HN :)

11:03 zerokarmaleft: ambrosebs: well-deserved, i'm 10 pages in

11:08 chronno: ambrosebs: congrats! :-)

11:12 ambrosebs: damn it, I have a big essay due tomorrow, but this is too exciting!

11:16 gfredericks: what are "functions accepting an even number of variable arguments"? like the mappy varargs?

11:18 ambrosebs: assoc, hash-map

11:19 gfredericks: that is quite fundamental.

11:20 ambrosebs: I cannot type check higher order usages

11:20 but (assoc m k v k v) is easy

11:20 In other words, they're hard coded primitives

11:21 Are you reading the dissertation? Which part? Could I be clearer?

11:24 gfredericks: a general solution would be quite interesting, and I think possible.

11:27 nDuff: ambrosebs: One minor nitpick -- it looks like there's some missing punctuation at the beginning of page 10.

11:28 ambrosebs: personally, I'd add a semicolon and a comma, as such: "...for many uses; where other languages might use objects, Clojure ..."

11:28 ambrosebs: ...but either way, the sentence seems like it's expressing two ideas without as much syntactic separation as should be there.

11:31 scriptor: nDuff: not sure about that, it's the same idea

11:31 clojure uses maps where others use objects

11:32 the 'where' binds the two phrases together

11:33 nDuff: scriptor: that piece I could take or leave; it's the second one, without the "where", that stands out most for me.

11:33 (between "objects" and "Clojure")

11:33 scriptor: ah, right

11:33 probably just missed a period there

11:35 hyPiRion: ambrosebs: Is your master thesis, or is it some other work?

11:36 Well, look at that, I just completely skipped the bottom of page one. Disregard.

11:38 AdmiralBumbleBee: I just started reading about typed racket, and now this paper shows up

11:38 what excellent timing :)

11:41 antoineB: hello, does anyone has a project.clj working with lein-cljsbuild, noir and clojure 1.4 as dependancy ?

11:42 mine don't

11:43 duck11231: antoineB: What kind of issue are you seeing?

11:43 antoineB: java.io.FileNotFoundException: Could not locate clojure/instant__init.class or clojure/instant.clj on classpath: (tagged_literals.clj:1)

11:43 ambrosebs: hyPiRion: undergraduate honours dissertation

11:44 nDuff: thanks, keep the nitpicks coming!

11:44 nDuff: or any other suggestions

11:44 nDuff: ambrosebs: Not yet. That said -- I'm starting page 21 right now, so a ways from through.

11:44 ambrosebs: nDuff: this is my first paper, still have a lot to learn.

11:51 nDuff: my email is abonnairesergeant at gmail dot com if you want to send any other suggestions

11:51 nDuff: *nod*. So far, I'm thoroughly impressed.

11:52 ambrosebs: Glad to hear.

11:54 antoineB: duck11231: the project.clj https://gist.github.com/3953538

11:55 duck11231: if i remove noir and fetch (that depends on noir), this will work

12:03 duck11231: antoineB: I know I've seen that issue before, but can't remember what I did to fix it. I don't use noir.

12:14 antoineB: it looks like your noir dep is setting clojure to 1.3, try adding :exclusions [org.clojure/clojure]

12:15 to the noir dep, not globally

12:18 dnolen: ohpauleez: thanks for the patch, could we get the tests for simple unification and partial map unification copied over?

12:18 ohpauleez: dnolen: No problem, i have them in a codebase already - I'll have it done by the end of the day

12:19 dnolen: Any thoughts about the weird discrepancy with partial-maps? https://github.com/clojure/core.logic/pull/10

12:20 I'm not sure why x doesn't unify (or potentially is just printing out like that)

12:20 antoineB: duck11231: nice that works, but i need to displace noir dependencie to "dev-dependencies", i don't know the difference

12:22 dnolen: ohpauleez: definitely a bug and probably a simple one. Open a separate ticket for that and I'll look into it. Thanks much.

12:22 ohpauleez: np

12:22 thank you

12:23 duck11231: antoineB: are you only using noir for tests? Chances are it won't work properly there.

12:24 also, unless you have a good reason to stay, it's probably best to get ahead of the curve and update your project to lein 2.

12:24 antoineB: yes for a little project

12:31 ynniv: has anyone written a KVO lib for clojurescript?

12:35 antoineB: duck11231: what do you mean by tests, do you mean unit tests or little project?

12:35 and i use lein 1.7, what does 2.0 gives?

12:35 thorbjornDX: gfredericks: I messed with syntax quote a bit to try to get my macro going, and this is what I have so far: http://pastebin.com/kwhXyFzd any suggestions? (I'mm going to dig into Joy to try to understand it a bit better

12:37 nDuff: thorbjornDX: In the future, would you mind using gist.github.com, refheap, or otherwise something not full of ads?

12:38 thorbjornDX: nDuff: sure thing, adblock confused me

12:39 nDuff: thorbjornDX: ...so, re: that macro, the big thing that jumps out at me is that you should probably be using gensyms

12:39 duck11231: antoineB: by tests, I meant unit tests. Dev dependencies is for dependencies used by your plugins and by lein itself.

12:40 thorbjornDX: nDuff: those are the # suffixes, correct? And I would use them in the let binding?

12:40 amalloy: nDuff, thorbjornDX: gensyms aren't the (main) issue. the issue is you're expanding to a doseq, which tries to do stuff at runtime, when really you want to expand into multiple defmacros at compile time

12:41 er, defmethods, i guess

12:42 thorbjornDX: amalloy: yes, I'd like to end up with a single defmulti, and multiple defmethods. I guess I just jumped to doseq since I figured I was looping and causing side-effects (method definitions)

12:42 amalloy: you want something like https://gist.github.com/3953894

12:43 Raynes: https://github.com/Raynes/refheap.el says it's not useful to the general public; i think that's out of date?

12:44 duck11231: antoineB: lein2 has a number of improvements, but it also changes the was some of the project options are laid out. Since lein2 will be "the thing" eventually all over, you'll save yourself a bit of a headache if you're mindful of those changes now.

12:44 thorbjornDX: amalloy: can you give me a quick explanation of ~@ vs ~? (or point me to a reference)

12:44 antoineB: ok

12:45 i have another problem, but this time with macro in clojurescript

12:45 duck11231: antoineB: This should help. https://github.com/technomancy/lein-precate

12:45 amalloy: &(let [x '(a b c)] (vector `(1 2 ~x 3) `(1 2 ~@x 3)))

12:45 lazybot: ⇒ [(1 2 (a b c) 3) (1 2 a b c 3)]

12:45 antoineB: i have go this two requiring (:require [fetch.remotes :as remotes]) (:require-macros [fetch.macros :as fm])

12:46 jamii: Woah - strucjure.walk> (macroexpand-1 '(parser/view a #(= 1 %) 'ok))

12:46 StackOverflowError java.util.regex.Pattern$CharProperty.match (Pattern.java:3362)

12:46 technomancy: antoineB: see also https://github.com/technomancy/leiningen/wiki/Upgrading

12:46 amalloy: jamii: parser/view probably expands to another call to parser/view

12:47 lispnik: if I have a file that contains "()

12:48 gfredericks: then he'll want some milk as well

12:49 antoineB: duck11231: my new problem :) https://gist.github.com/3953940 any ideas?

12:50 thorbjornDX: amalloy: perfect, thanks for that :)

12:52 duck11231: antoineB: could you post your updated project.clj?

12:54 antoineB: https://gist.github.com/3953972

12:57 arrdem: tool design question for you guys

12:58 duck11231: I would try copying those 2 deps to :dependencies IIRC, cljsbuild uses your main classpath to look for cljs files.

12:58 arrdem: I'm wiriting a tool that reads BNF and generates the equivalent fnparse code, the problem is how to let users hook their code in.

12:58 duck11231: but it's been a while since I've done anything with lein1

12:59 arrdem: right now I just generate function stubs, I was hoping someone else had a better way.

12:59 antoineB: duck11231: the cljs file is found as well

12:59 but the clj (the macro) is not

12:59 hiredman: arrdem: fnparse is kind of dead, no?

13:00 arrdem: hiredman: heh yeah as of several years ago. still works a treat tho.

13:00 hiredman: arrdem: last I checked it doesn't load in newer clojure versions

13:01 arrdem: hiredman: really? I've been using it in 1.4.0 projects with no problems...

13:01 hiredman: hmmmm

13:01 antoineB: duck11231: copying "fetch" dep to "dependencies" make it works

13:01 duck11231: so defenitly i need docs on lein

13:01 hiredman: arrdem: not possible

13:02 arrdem: I would recommend checking to make sure you are really using clojure 1.4

13:02 duck11231: lein2 cleaned upp a lot of the mess surrounding plugins

13:02 arrdem: hiredman: do tell

13:02 hiredman: arrdem: it pulls in some aot compiled bits of old contrib, and the abi for clojrue has changed since then

13:02 antoineB: i will take lein2 in account seriously

13:02 thorbjornDX: amalloy: here's my solution: https://gist.github.com/3954024

13:03 duck11231: antoineB: probably won't take any longer than 5 min or so. Just look at the guide technomancy linked

13:04 antoineB: i am currently on

13:04 arrdem: hiredman: herm. that squares whith what I'm seeing... is there a reason I should really care? looks like most of the code I'm writing is STDLIB only and good back to 1.1 or so

13:05 hiredman: arrdem: who do you expect to use this?

13:05 jamii: amalloy: turned out to be much more interesting - there was a cyclic datastructure in the metadata. it was well behaved until I had both *print-meta* set to true and had a compiler pass that forced the delay

13:05 arrdem: hiredman: me. anyone else is a bonus.

13:05 it's just a question of software engineering "best practices" in Clojure.

13:06 hiredman: arrdem: if you care about bug fixes and new features, if not then using a old (2 year old?) version of clojure is fine

13:07 clojurebot is locked on 1.2 at the moment because of fnparse, which is lame

13:08 arrdem: herm... TBH I really like fnparse's API so I may take it on myself to rewrite it for not 1.2 but no promises.

13:08 after all there are other parser libs

13:09 amalloy: hah, that's great, jamii. to be fair i'd have spotted that if you'd pasted a whole stacktrace

13:09 i thought someone had written an update to fnparse to get off of old-contrib

13:10 arrdem: amalloy: https://github.com/Cyrik/fnparse/commit/6009b69b60594bb357e28229d95ea75e03649fba

13:10 (not me)

13:10 but a 1.4 update

13:11 amalloy: arrdem: are you using that version? i think hiredman assumed you were using the canonical one, and thus stuck on clojure 1.2.x

13:12 arrdem: amalloy: hiredman has my number, I am guilty of the old build

13:14 I just wanted to ask what the nicest way for someone else to hook into generated code would be

13:15 amalloy: arrdem: i think the usual way to use a combinator-based parser library is not to generate code, but to let the parser generate a data structure for you, and then manipulate/interrogate that structure however you need to

13:19 arrdem: amalloy: that make sense... the idea with this was that I ran into all kinds of transcription errors translating correct BNF to a fnparse code so I wanted something to do the parser generation for me.

13:19 duck11231: arrdem: If you're looking for ways to hook code, you could check out https://github.com/technomancy/robert-hooke or https://github.com/francoisdevlin/Decorate

13:19 Hodapp: This is indeed how I used combinators when I wrote a parser in Scala.

13:19 It was kind of awesome.

13:21 arrdem: duck11231: that is epic

13:21 jkkramer: multimethods can be a nice way to provide hooks/extensibility

13:22 without mucking about with vars

13:26 ohpauleez: Additionally, depending on the types of hooks, protocols could be as far as you need to go

13:40 Cheiron_: Hi, I want to translate this to clojure https://github.com/nathanmarz/storm/blob/master/src/jvm/backtype/storm/serialization/DefaultKryoFactory.java

13:40 I will use proxy to extend the class and reify to implement the interface, correct?

13:42 joegallo: sounds right to me

13:47 Cheiron_: extending should go to its own file and implementing goes to its own file ? so I can use gen-class ?

13:52 timewarrior: ,(+ 1 2)

13:52 clojurebot: 3

13:53 Cheiron_: clojurebot: do you run on Shen?

13:53 clojurebot: Pardon?

13:56 ohpauleez: Cheiron_: That's a good idea

13:56 we should add Shen and core.logic to clojurebot

13:57 technomancy: ugh

13:57 no

13:58 ohpauleez: ok ok ok, but how about just core.logic

13:58 I think there is a growing curiosity of, "does this unify?"

13:58 Cheiron_: how to tackle this? https://github.com/nathanmarz/storm/blob/master/src/jvm/backtype/storm/serialization/DefaultKryoFactory.java#L12

13:58 technomancy: running a helpful channel bot that's not OSS would be silly

13:58 Cheiron_: how to declare an instance var when using proxy?

13:58 hiredman: write a core.logic rest service

14:01 dnolen: ohpauleez: maybe you can get Raynes to add it to lazybot? ;)

14:01 ohpauleez: hiredman: I just bought "unifythislogic.com" - I accept your challenge

14:01 hiredman: ohpauleez: lemme know when you have an api, and I'll see about having clojurebot fiddle it

14:01 * technomancy was specifically objecting to shen's batshit insane licensing terms; nothing against core.logic

14:05 ohpauleez: dnolen: I know you've been swamped lately, but I might have some general questions for you regarding generic data querying using unification

14:06 I'm trying to make my datalog-like query more generic as a learning example for others

14:08 dnolen: ohpauleez: it's actually pretty tricky to do fully generic queries w/ core.logic since's it really more like an embedding programming language - similar challenges with Prolog.

14:08 ohpauleez: well, that makes me feel a lot better

14:09 I have a weird mix of cond, filter, binding-map, and the unifier right now

14:09 dnolen: ohpauleez: one approach might be something like [:or g0 g1 [:and g2 g3]] - I've been thinking about supporting something like that.

14:09 ohpauleez: I know the ekeko guys just use eval

14:10 ohpauleez: right now my queries are in this form:

14:10 git ttt '[(?x :id :summary) :where [?x :current-state :open :summary "ticket"]]'

14:10 the first turns into a select-keys, but alternate forms are allowed

14:10 each thing in latter []'s are and's

14:11 you do or's with multiple []'s

14:11 dnolen: if you have a link to your work I can give you some feedback when I have more free cycles.

14:11 ohpauleez: cool, thanks

14:13 Cheiron_: how to call super method inside proxy macro? https://github.com/nathanmarz/storm/blob/master/src/jvm/backtype/storm/serialization/DefaultKryoFactory.java#L23

14:13 S11001001: Cheiron_: proxy-super, *be warned*, *not*thread*safe*!!**!

14:14 sorry, I don't mean not thread safe, I mean *not reentrant*.

14:15 Cheiron_: in other words, prefer composition over class extension.

14:15 Cheiron_: I don't hava I choice (I think). i have to translate this to Clojure https://github.com/nathanmarz/storm/blob/master/src/jvm/backtype/storm/serialization/DefaultKryoFactory.java

14:17 Apage43: Cheiron_: you actually want to reimplement DefaultKryoFactory, or are you just implementing the same interface?

14:17 at any rate, is it possible for you to use (reify) instead of (proxy) ?

14:17 Cheiron_: I need to extend Kryo class and implement the interface IKryoFactory

14:17 should I pass this to proxy-super ?

14:19 Apage43: proxy-super captures this for you

14:19 it's a macro

14:20 Cheiron_: (proxy-super method) or (proxy-super .method) ? I guess the latter

14:20 Apage43: former

14:21 Cheiron_: .method?

14:21 Apage43: no dot.

14:21 Cheiron_: oh

14:24 Apage43: anyway, just be aware that during method call you cannot call a method of the same name on the proxy object, as you'll get the super method instead of the proxied version

14:25 tgoossens: What is a good and short talk about datomic

14:25 I want to know what it is about

14:30 Cheiron_: It is an immutable database :)

14:31 datomic website has a nice interview

14:32 hiredman: infoq has 5-6 videos (some of them are dups) of talks rich or stu have given on datomic

14:34 tgoossens: Ok

14:34 On clojure rationale

14:34 cmajor7: since the approach for clojurescript is to compile everything in a single bootstrap.js, what is the recommended way to ensure the order? e.g. I have some listeners in one cljs file that need to be executed after another cljs file is done altering the DOM.

14:34 tgoossens: "OOP Born of simulation, now used for everything,"

14:34 What does it mean

14:35 Born of simulation

14:35 technomancy: "when an Alan Kay loves a Simula very much ..."

14:37 tgoossens: ?

14:39 bhenry: need some help with korma. i have 2 tables tMessage and tMessageType. how can i structure the tMessage entity so that it has a field called messageType which is the tMessageType.messageType where tMessageType.id = tMessage.messageTypeID

14:39 Cheiron_: hi, how to map this to clojure ? ((KryoSerializableDefault)k).overrideDefault(true); (how to cast) ?

14:40 S11001001: Cheiron_: (.overrideDefault k true)

14:40 Cheiron_: no need to type cast?

14:40 S11001001: Cheiron_: no need

14:40 Cheiron_: may I ask why?

14:40 muhoo: one of the great joys in clojure

14:40 S11001001: Cheiron_: because it's more fun than requiring the cast

14:41 muhoo: not having to deal with java BDSM

14:41 Cheiron_: i see :)

14:41 antares_: Langohr 1.0.0-beta10 is released: http://blog.clojurewerkz.org/blog/2012/10/25/langohr-1-dot-0-beta10-is-released/

14:57 ynniv: ibdknox: I'm looking for a backbone-like (data observing) library in clojurescript. are you using waltz this way?

14:59 ohpauleez: ynniv: You might want to checkout https://github.com/lynaghk/reflex

15:00 fbru02: Hi all I'm trying to use with-derefs-fn to do mocking but i get an error like this : lemur_utils.sqs$get_message_from_queue cannot be cast to clojure.lang.IDeref ? anyone can help ?

15:00 ohpauleez: if what you want to do is data observation

15:01 ynniv: ah, that's a useful link.

15:03 gfredericks: (inc lynaghk)

15:03 lazybot: ⇒ 1

15:06 ynniv: (= lynaghk)

15:07 looks like reflex is used in the grander data vis system c2

15:08 innnnteresting

15:10 Sgeo: http://www.reddit.com/r/Clojure/comments/122ll8/free_clojure_course/ this might be good for some lolz. Will have to check it out later.

15:10 Same person who didn't understand doseq vs. for a while ago

15:10 Guess what? There course goes over doseq and for

15:11 *They're

15:11 gfredericks: *their

15:11 ohpauleez: ynniv: FWIW, kevin and I have been sketching out a new system for CLJS in this area - that handles two-way binding and full-binding-resolution-before-redraw

15:11 Sgeo: gfredericks, derp.

15:11 I need sleep.

15:12 ynniv: ohpauleez: oh yes. I was a happy sproutcorer for that exact reason, until the SC community went sideways

15:13 what's up with the mix of cljs and coffeescript?

15:13 (singult for instance)

15:13 ohpauleez: yes - while I think a lot of approaches in the general area are half-baked or naive implementations, there is a serious need to combine two-way-bind and bind-resolution-before-redraw

15:14 TimMc: Sgeo: "Clojure Lisp Programming"

15:14 ohpauleez: ynniv: singult's goals are to allow platform interop as well - so that you can use it from JS as well as in CLJS

15:14 personally, I use enfocus and raw html partials

15:15 ynniv: sproutcore had a fairly mature data binding implementation, but it was a small part of a much larger system that was pulled in many directions and eventually fell apart

15:15 augustl: is there an "assoc if not already present" for maps?

15:15 TimMc: Sgeo: "The apply function" Oh god this does not bode well.

15:15 ohpauleez: but some people love the crap out of the other stuff

15:15 augustl: (merge {:foo bar} my-map) comes to mind

15:15 TimMc: augustl: update-in is close...

15:15 Sgeo: TimMc, I wish I could stick around, but I have to get to class. A _real_ class, I mean.

15:15 ohpauleez: augustl: like python's set-default?

15:16 Sgeo: No matter how boring I find my school, it's not likely to be utterly attrociously wrong

15:16 augustl: ohpauleez: like (if (not (contains? my-map :key) (assoc my-map :key some-value)) :)

15:16 could just write my own real quick of course

15:17 Sgeo: TimMc, apply isn't a function? Hmm, didn't realize that, to be honest

15:17 ohpauleez: make sure you put `my-map` in the else clause

15:17 Sgeo: ,(-> (meta #'apply) :macro)

15:17 ohpauleez: augustl: ^

15:17 clojurebot: nil

15:17 Sgeo: ,(meta #'apply)

15:17 clojurebot: {:ns #<Namespace clojure.core>, :name apply, :arglists ([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]), :added "1.0", :static true, ...}

15:18 TimMc: Hmm? Oh, apply is weird in a different way, nvm.

15:18 but he calls doseq, for, & loop functions

15:18 Sgeo: It does Java interop

15:19 TimMc: I think it's usually a compiler special in other lisps.

15:19 Sgeo: I really need to get going now

15:19 ynniv: ,(let [x { :foo 1 :bar 2 }] (conj x { :bar (or (:bar x) 3) :baz (or (:baz x) 4) })) ?

15:19 clojurebot: {:baz 4, :foo 1, :bar 2}

15:19 TimMc: Go!

15:19 konr_trab: do you recommend any article or book on programming with contracts or anything better on Clojure? 'The joy of clojure' is very brief on the issue

15:21 technomancy: konr_trab: afaict nothing exists around that because no one's really used those techniques in nontrivial systems yet

15:21 and lived to tell the tale

15:24 mklappstuhl: I have a very general question about "putting files together"

15:24 I have a few files that use functions that might be defined in another file

15:25 I currently (load-file) these but I'm pretty sure that this is not the ideal way as it forces me to load files in a specific order...

15:25 gfredericks: ~leiningen

15:25 clojurebot: http://github.com/technomancy/leiningen

15:27 mklappstuhl: gfredericks, I'm not loading files from libraries... I load files I wrote myself ... is leiningen also useful for that?

15:27 gfredericks: quite

15:27 you should have 1 namespace per file, and the files should have filenames and be in directories corresponding to the namespace

15:28 then you declare dependencies between namespaces with (:require ...) clauses in the ns declaration

15:28 half to all of that is not particular to leiningen

15:29 but lein can do additional things like let you run arbitrary functions in your project from the command line, compile your project into a jar, etc

15:30 also leiningen is a lot easier for people (like in IRC) to help with, compared to doing stuff by hand

15:30 hiredman: http://clojure.org/namespaces

15:31 gfredericks: I knew there must be some docs somewhere :)

15:33 antares_: gfredericks: there is also http://clojure-doc.org/articles/language/namespaces.html now

15:34 gfredericks: (inc docs)

15:34 lazybot: ⇒ 1

16:00 mklappstuhl: gfredericks, using namespaces, do I need to load clojure.core itself? because it says I dont have (def ) anymore

16:01 amalloy: it's not possible for you to no longer have def

16:01 mklappstuhl: amalloy,

16:01 CompilerException java.lang.RuntimeException: No such var: clojure.core/def, compiling:(mklappstuhl/stock_utils/analyze.clj:1)

16:02 AtKaaZ: i think that happened to me once with the master branch, or it was something else but it fixed when I (use 'clojure.repl)

16:02 i think maybe it was just doc and source

16:02 mklappstuhl: my description might have been incorrect but I think its a similar effect

16:02 AtKaaZ, I'm loading it from the repl

16:03 AtKaaZ: do you have doc and source?

16:03 amalloy: mklappstuhl: (ns foo (:require ...)) (more-code...), not (ns foo (:require ...) (more-code...))

16:04 AtKaaZ: amalloy, that was exactly my problem haha you rock

16:04 (inc amalloy)

16:04 ynniv: yes, (ns …) is non-functional. you don't put your code in the form

16:04 lazybot: ⇒ 34

16:06 mklappstuhl: amalloy, this also solved my problem

16:09 AtKaaZ: hmm, I might've spoke too soon :D I actually had the ns/code like in the first variant hmm, in my case then something else happened that caused clojure.repl to get unloaded or something

16:15 mklappstuhl: I'm now getting this error:

16:15 Exception lib names inside prefix lists must not contain periods

16:16 with a core.clj like this:

16:16 (ns mklappstuhl.stock-utils.core

16:16 (:require [mklappstuhl.stock-utils.analyze :as analyze]

16:16 [mklappstuhl.stock-utils.metrics :as metrics]

16:16 [mklappstuhl.stock-utils.simulate :as simulate]

16:16 [mklappstuhl.stock-utils.utilities :as utilities]))

16:16 sorry for the long paste ;)

16:19 ynniv: mklappstuhl: https://gist.github.com/ is nice for long pastes, and it highlights syntax

16:19 AtKaaZ: what *clojure-version*?

16:20 mklappstuhl: ynniv, I know but yeah... 5 simple lines... :P

16:20 technomancy: 10 lines actually, since they wrapped

16:21 ynniv: didn't wrap for me...

16:21 ,*clojure-version*

16:21 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

16:22 AtKaaZ: mklappstuhl what's the full error and clojure version?

16:23 mklappstuhl: full message:

16:23 Exception lib names inside prefix lists must not contain periods clojure.core/load-lib (core.clj:5223)

16:24 how do I get the version I'm using? o.O

16:24 technomancy: I wonder if ambrose wants bug reports on his paper via github issues

16:24 mklappstuhl: 1.3

16:25 brehaut: technomancy: on HN he was asking for them via email i think

16:25 gfredericks: the vararg section (with the not= example) seemed wrong

16:25 AtKaaZ: mklappstuhl, how do you know to which file the error applies?

16:26 brehaut: technomancy http://news.ycombinator.com/item?id=4698310

16:27 technomancy: "O'Caml" is bugging me =)

16:27 mklappstuhl: AtKaaZ, I don't know it for sure to be honest. it just happens when I require .core ..

16:27 brehaut: technomancy: its the irish fork

16:27 ohpauleez: brehaut: haha

16:27 technomancy: did he explain why he uses a separate form for annotations rather than metadata?

16:28 brehaut: not that i saw

16:28 technomancy: weird

16:28 brehaut: but i havent got all the way through yet

16:28 technomancy: typed clojure wins as the best-documented clojure library of all time

16:28 amalloy: technomancy: because you can annotate functions you didn't write

16:28 technomancy: 74 pages of immaculately-typeset docs

16:29 gfredericks: how usable is typed-clojure currently?

16:29 technomancy: amalloy: vary-meta?

16:29 amalloy: i assume you mean alter-meta!

16:29 since i doubt if it's metadata on the functions

16:29 technomancy: yeah, I spose so, stupid fns-not-having-metadata =P

16:29 mklappstuhl: where does leiningen pull its version of clojure from? I have 1.4 installed on my system but running lein repl => *clojure-version* returns 1.3

16:30 technomancy: I was kind of hoping for more inference =\

16:30 hiredman: technomancy: the annotation form my just be a short cut for putting metadata on vars

16:30 may

16:30 technomancy: hiredman: yeah, maybe it's just using ann uniformly for pedagogical purposes

16:31 less to explain to his thesis advisors =)

16:33 S11001001: mklappstuhl: make a project and run lein repl within it

16:34 mklappstuhl: then lein repl will use whatever clojure version is in your project file, and also provide 3rd party libraries and your project's sources in right places in classpath

16:34 technomancy: mklappstuhl: system-wide installs are ignored by leiningen (and any sane library management system really)

16:37 mklappstuhl: technomancy, you did/do a really good job with leiningen... ;)

16:37 mmitchell: is there anything like Ruby's rake for Clojure?

16:38 antares_: mmitchell: leiningen.org?

16:38 wunki: can someone recommend a fn which is well suited to "humanize" numbers. E.g., 100000 -> 100.000

16:38 TimMc: wunki: I believe the Java standard libraries have NumberFormat or something.

16:38 Frozenlo`: you mean 100 000 ?

16:38 TimMc: No no, 100,000. :-P

16:39 wunki: It's for download size, so I want to keep it '.' :)

16:39 I'm going from bytes to kb/mb/gb etc. Now I just want the dots

16:39 TimMc: The right thing to do is use a locale-based formatter.

16:41 mmitchell: antares_: oh yeah! i kinda forgot that it supports that sort of thing

16:41 Frozenlo`: IMO dots and commas should never be used in numbers except for the decimal separator.

16:41 TimMc: ,(.format (java.text.NumberFormat/getInstance java.util.Locale/GERMAN) 1e5)

16:41 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.ExceptionInInitializerError>

16:41 wunki: it's to make it human readable, not for calculation

16:42 TimMc: &(.format (java.text.NumberFormat/getInstance java.util.Locale/GERMAN) 1e5)

16:42 lazybot: ⇒ "100.000"

16:42 AtKaaZ: mmitchell: https://twitter.com/qertoip/statuses/20449282180

16:42 Frozenlo`: wunki: It makes it human readable for a very local population

16:42 wunki: TimMc: thanks!

16:42 TimMc: wunki: Use the system locale, if possible.

16:42 antares_: AtKaaZ: cake is no longer developed

16:42 AtKaaZ: cake developers now work on leiningen. I think it has been going for almost one year now.

16:43 AtKaaZ: antares_: I see, I'd ofc use leiningen,but he asked :)

16:43 * Frozenlo` remembers when he put a bid of 100 000$ for a palm pilot on ebay because the stupid site interpreted "," as the thousands separator.

16:43 wunki: Frozenlo`: this is only about byte size, not money luckily

16:43 mmitchell: AtKaaZ: are people still using cake? For some reason I thought it and leiningen were merged?

16:44 TimMc: &(.. (java.text.NumberFormat/getInstance (java.util.Locale/getDefault)) (format 1e5)) ;; wunki

16:44 lazybot: ⇒ "100,000"

16:44 antares_: mmitchell: that is correct

16:44 AtKaaZ: mmitchell: that was my interpretation of your question: <mmitchell> is there anything like Ruby's rake for Clojure?

16:44 antares_: mmitchell: cake is no longer developed

16:44 TimMc: wunki: Is this to be run on a server or the user's own computer?

16:44 mmitchell: AtKaaZ: ok gotcha, thanks

16:45 wunki: TimMc: going to be run on a server

16:45 TimMc: wunki: OK, then grab the user's locale from their browser's request headers.

16:45 mmitchell: antares_: do you need leiningen 2 to run tasks? My team and I are all stuck on 1 :(

16:45 (definitely time to upgrade)

16:46 antares_: wunki: take a look at https://github.com/ptaoussanis/tower, maybe it has something for your case

16:46 TimMc: otherwise they may be extremely surprised

16:46 antares_: mmitchell: lein 1 can do that, too, but it is a good idea to upgrade. See lein-precate that will generate (mostly) updated project.clj for you.

16:47 mmitchell: antares_: cool thanks

16:48 antares_: mmitchell: see https://github.com/technomancy/leiningen/wiki/Upgrading and https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md (if you have Java code in your projects)

16:48 wunki: TimMc: that's to much for now. Thanks for showing me how it's done.

16:50 AtKaaZ: antares_: do you have any pointers on how to aot compile leiningen and have the classes inside the .jar ?

16:50 TimMc: AtKaaZ: You want to AOT lein itself?

16:50 antares_: AtKaaZ: leiningen itself?

16:50 AtKaaZ: timmc, yes something like what preview10 .jar has

16:51 both classes and .clj inside it

16:51 antares_: AtKaaZ: https://github.com/technomancy/leiningen#building and then ./bin/lein uberjar

16:52 https://github.com/technomancy/leiningen/blob/master/bin/release demonstrates what is done before release

16:52 AtKaaZ: I did both but they both give me no classes inside, esp. if I use preview10 lein to do it

16:53 muhoo: :aot :all in project?

16:53 AtKaaZ: :all too? hmm

16:54 TimMc: AtKaaZ: Why are you AOT'ing?

16:55 AtKaaZ: timmc, maybe for speed? I notice that the snapshot is 9.4mb jar and the preview10 is 11.1mb because the class files are missing

16:56 antares_: full AOT does help with startup time and for leiningen that is important

16:56 AtKaaZ: but I am failing to do it for lein, if I use the 9.4mb .jar then I get this: http://pastebin.com/remhhXPR

16:56 technomancy: mklappstuhl: heh; thanks =)

16:58 mmitchell: what's keeping you on lein1 if you don't mind my asking?

16:58 AtKaaZ: if I use pre10 lein.bat and its .jar it gives no errors but it won't aot http://pastebin.com/x6KQU5e3

16:58 technomancy: trying to make sure the upgrade process is as smooth as possible, so I always want to heard from those who are blocked on it

16:58 nDuff: AtKaaZ: Could you please consider gist.github.com, refheap, or another pastebin not full of ads in the future?

16:59 AtKaaZ: nDuff, pastebin has ads? sorry, didn't know, I'll do gist I think

16:59 technomancy: AtKaaZ: ugh; it's a problem with AOT/protocols

17:00 AtKaaZ: though if you already have a jar created I'm not sure why you're running through the release process again?

17:00 AtKaaZ: you should build with bin/lein rather than a self-installed build

17:01 AtKaaZ: technomancy: the created .jar has only source code, I was hoping to get the .class files inside it too, somehow

17:01 mmitchell: technomancy: well, we have too many things to do :) and... I think we have a few in-house plugins that are needing an upgrade

17:01 amalloy: we should add a lazybot trigger for when someone says pastebin: "nDuff wishes you would stop using pastebin"

17:02 aphyr: mmmmm refheap.

17:02 * aphyr basks in its calming glow

17:02 technomancy: mmitchell: sure, fair enough. it's always those internal plugins that get ya

17:02 AtKaaZ: technomancy: I'll try with bin/lein too, but it's probably the same thing(?)

17:02 technomancy: AtKaaZ: if you clear out target/ first you shouldn't get hit by AOT issues

17:02 mmitchell: technomancy: yeah, other than that, we're all really looking forward to it

17:02 AtKaaZ: nDuff: didn't see the ads due to adblock plus+firefox

17:03 ynniv: there are ads in pastebin? not with adblock+flashblock+ghostery ...

17:03 technomancy: mmitchell: on the other hand the plugin ecosystem is big enough now that there are very few legitimate needs for custom one-off plugins anymore

17:03 but existing code that works has inertia

17:04 Frozenlo`: Wait what... ads in pastebin?

17:04 nDuff: ynniv: sure, but why would you use something when you're disobeying the (implied if not effective/legal) terms of service, when something else exists that is both (1) a better service, and (2) expressly free for use (without the cost of providing ad views)?

17:04 Frozenlo`: Yes, it's full of them. Big, animated ones, often.

17:04 Frozenlo`: Or rather "wait what, people without an ad-blocker?"

17:04 technomancy: AtKaaZ: TBH I don't understand exactly what's going on in this case other than "uuuuugh someone is using protocols; I hate it when they do that"

17:04 mmitchell: technomancy: true yep, we have one that shows, and dynamically creates the project version from the git commit sha.

17:04 technomancy: mmitchell: that's already done by lein jar actually

17:04 it's in the pom

17:04 Frozenlo`: I'm all for using refheap, just surprised by the ad-blocker-lessness

17:05 technomancy: Frozenlo`: depends on the sites you frequent

17:05 AtKaaZ: technomancy: no idea what that means, I'm certainly not using them :)

17:05 technomancy: I don't make a habit of visiting annoying sites, so I don't bother

17:05 nDuff: Frozenlo`: I've worked for too many web startups where having adblockers prevented me from seeing bugs in my own employer's code (when embedded/whatnot on 3rd-party sites; can't whitelist _every_ partner))

17:05 mmitchell: technomancy: really? so, how can i learn more about that feature (the version thingy)?

17:05 nDuff: Frozenlo`: ...also, I have moral issues with them.

17:05 technomancy: AtKaaZ: yeah unfortunately it's hard to avoid pulling them in transitively. in this case nrepl is the culprit; not your fault, it just makes for error-prone builds.

17:05 amalloy: there's just something about adblock that makes users of it really smug and feel they need to mention it anytime someone remarks that there are ads on the web

17:06 technomancy: AtKaaZ: especially self-hosting builds

17:06 also: not having flash installed does wonders for reducing ad-based annoyance

17:06 amalloy: it's in the ablock TOS I'm sure =)

17:07 mmitchell: take a look inside your jar; you should see a pom.xml file for your project

17:07 Frozenlock: amalloy: if I told you I wasn't using a version control system, wouldn't you be surprised?

17:07 ynniv: nDuff: gist is only free because it's an implicit ad for github. as for the moral issue, websites rarely ask if I'm okay being tracked, so I'm okay not asking if they mind I don't view their ads

17:07 technomancy: mmitchell: under <scm> there should be a <tag> containing the rev under which your jar was generated

17:07 AtKaaZ: Frozenlock, I'd think less of you :D

17:07 Frozenlock: :D

17:08 mmitchell: technomancy: so actually, it's the other way around. The version is not read from project.clj, instead, it's injected into the project map by our version "middleware" plugin.

17:08 brehaut: Frozenlock: i wouldnt be; a lot of people still use SVN

17:08 nDuff: ynniv: Sure. I don't have a problem with _all_ ads. I have a problem with big, flashy, animated ads.

17:08 technomancy: mmitchell: oh, I see what you mean. yeah that's different.

17:08 nDuff: remove flash; problem solved

17:08 nDuff: technomancy: "flashy" was maybe the wrong word.

17:08 amalloy: Frozenlock: if your job were software development, yes. but nDuff's job isn't web browsing, and there's a difference between adblock and git anyway, in that some folks are morally opposed to adblock (folks morally opposed to git are just dumb)

17:08 AtKaaZ: nDuff: flashblock plugin, you can turn on only flash that you want via 1 click

17:09 Frozenlock: brehaut: Which is a version control...

17:09 nDuff: AtKaaZ: Already described why that doesn't work for me.

17:09 technomancy: "flash you want" I don't understand

17:09 ynniv: technomancy: large animated images are pretty annoying, and don't require flash. as do animated DOM elements

17:09 Frozenlock: amalloy: Oh please say that in #emacs :D

17:09 muhoo: never had a problem with adblocker, but i do turn off flash and i use noscript

17:09 nDuff: AtKaaZ: If my company's code is embedded on a 3rd-party site, and that 3rd party runs some random flash or javascript thing that breaks our code, I need to see it in context.

17:09 brehaut: Frozenlock: that was a joke, son

17:09 Frozenlock: Sorry dad, need coffee I think.

17:09 technomancy: ynniv: sure, neither of which are present on pastebin

17:09 or any reasonable site really

17:09 brehaut: </foghorn>

17:09 muhoo: Frozenlock: there's only one user in #emacs, IIRC who really hates git and is vocal about it.

17:10 Frozenlock: muhoo: yup, and I was thinking about him ;)

17:10 amalloy: oh shoot, i forget who that guy is. git destroys his data, right?

17:10 AtKaaZ: nDuff, got it, either way, I'll be using gist in the future, btw does http://ideone.com/ also have ads? cause that one seemed good

17:10 muhoo: amalloy: jordi something

17:10 nDuff: AtKaaZ: Not annoying ones.

17:11 (and yes, it's pretty awesome)

17:12 ynniv: it's not like I'm browsing the web via email... http://stallman.org/stallman-computing.html

17:12 muhoo: so what'd be a good way in clojure to wrap a json service, much like the python ServiceProxy?

17:12 mklappstuhl: hey guys...

17:12 Raynes: AtKaaZ: https://www.refheap.com <3

17:12 muhoo: or would that be so trivial that it's not even a thing

17:12 mklappstuhl: I'm kind of stuck with this https://gist.github.com/7d3443719b0d50463c93

17:13 AtKaaZ: but technomancy, don't you want to know why preview10 doesn't aot leiningen even though there are no errors?

17:13 actually, that is likely fixed in master

17:13 Raynes, no ads?

17:13 Raynes: No way.

17:13 Raynes don't do ads.

17:14 ynniv: mklappstuhl: require doesn't import symbols. use "use" instead

17:14 technomancy: Raynes has lucrative behind-the-scenes sponsors =)

17:14 Raynes: I wish.

17:14 mklappstuhl: ynniv, there are so many different ways to load other files/ns ... which is the best then?

17:15 Raynes: Though my fundraiser went really well for refheap funds.

17:15 AtKaaZ: Raynes, looks good, any idea why No is red ? as if private: No is bad? :D

17:15 technomancy: Raynes: yeah I was referring to Keming labs

17:15 clojurebot: if it's not one thing it's another

17:15 Raynes: technomancy: Yeah, That is pretty sick. He covered the whole darn thing.

17:15 ynniv: mklappstuhl: usually you (ns mynamespace (:require [library :as l] [otherlib :as ol]))

17:15 technomancy: and Heroku too in a way; free dyno-hours wooo =)

17:16 mklappstuhl: ynniv, It is highly recommended to use (:require ... :refer [...]) on Clojure 1.4 and later releases. (:use ...) is a thing of the past and now that (:require ...) with :refer is capable of doing the same thing when you need it, it is a good idea to let (:use ...) go.

17:16 http://clojure-doc.org/articles/language/namespaces.html

17:16 Raynes: AtKaaZ: No particular reason. Just because no is negative and yes is positive.

17:16 mklappstuhl: ynniv, so if I use :as when requiring it should work?

17:16 ynniv: then you'll have to prefix symbols in them with the specified prefix, which improves readability

17:16 yeah

17:16 i'm not familiar with the new :refer in 1.4.

17:17 Raynes: AtKaaZ: It's also important that you remember that your paste is going to be public if you don't explicitly make it private. People sometimes accidentally paste credentials and stuff without making it private.

17:17 ynniv: but use require in the ns form as much as possible. when using prefixes gets out of hand, use use (or this new refer)

17:17 AtKaaZ: Raynes: understood

17:19 Raynes: is not indexed by google?

17:20 Raynes: It's indexed.

17:21 AtKaaZ: I failed to find 150118 site:www.refheap.com ie. https://www.refheap.com/paste/6112

17:21 ynniv: silly python requires commas in array literals…

17:21 Raynes: I just searched for 'refheap slurp" and got some results.

17:22 AtKaaZ: Raynes, ok it works then, might take some time for the recent ones to get indexes

17:22 Raynes: Perhaps it hasn't been crawled recently enough or something.

17:22 AtKaaZ: it's good stuff, thanks

17:23 brehaut: ynniv: yeah, and its got its colons at the wrong end of map keys

17:23 thorbjornDX: brehaut: the colons are syntax, as are the commas :(

17:25 ynniv: thorbjornDX: separating identifiers with whitespace seems like enough syntax to me

17:25 brehaut: thorbjornDX: i dont understand the distinction you are making

17:25 ynniv: i certainly try all the time. parse disagrees :(

17:26 thorbjornDX: ynniv: agreed. brehaut: having a colon in a :key is more of a naming restriction, having it after {key: value} as in python is syntax. I don't know if there's any point to making that distinction though

17:27 ynniv: agreed, but again k v k v k v seems like enough syntax to me

17:29 thorbjornDX: ynniv: I think python's reasoning behind the {key: value, key: value} thing is to force a certain (restrictive) code formatting style

17:29 * brehaut wonders if some jokes have been taken to literally

17:29 ynniv: certainly. having been doing well enough without it, it's irritating to return

17:30 brehaut: pun intended? ;-)

17:30 brehaut: intended :)

17:30 thorbjornDX: ynniv: I find python's list comprehension syntax to be pretty hard to look at after 'for

17:31 ynniv: I've written my fair share of incomprehensible list comprehensions, and not enough for's to erase the memory

17:31 but when editing someone else's code, you don't get to pick the language

17:47 callen: does anyone else here find the act of trying to make practical things with CSS intensely frustrating?

17:47 I didn't want to ask ##css because that would be trolling.

17:47 stankley: callen: Hah

17:47 callen: Yes, it's absurd and broken

17:48 callen: Firedebug and a lot of patience

17:48 callen: I mean, I get the concept fine, but in practice there are so many interactions and overlapping possibilities that it's almost impossible to reason about the result of something.

17:48 stankley: *Firebug

17:48 callen: stankley: yeah, we use firebug and chrome (webkit inspector)

17:49 stankley: callen: That part is at least slightly rational. Then you have internet explorer to think about...

17:49 callen: stankley: I've never worked with anybody who likes CSS, even frontend people.

17:49 stankley: callen: Yeah, potential product right there

17:49 ynniv: it's better than specifying every style attribute for each element

17:49 stankley: callen: Abstract away the pain and brokenness of CSS

17:50 ynniv: less does that a little

17:50 stankley: ynniv: Yeah, but not all the way

17:50 callen: ynniv: it's not really about CSS alone, it's about the layout.

17:51 ynniv: the layout model is obscene.

17:51 it takes herculean effort just to make something that mostly works, let alone is responsive.

17:51 ynniv: ah, yes. my best layouts are all absolute

17:51 callen: :\

17:52 ynniv: an ideal framework might only use the canvas element, doing all layout and eventing in JS

17:53 callen: that's obscene.

17:53 stankley: ynniv: hah

17:53 * callen makes a note to never take ynniv's advice about frontend work

17:53 ynniv: there are issues rendering text like that, and accessibility, but relying on the DOM to be consistent across browsers is a mistake

17:53 stankley: ynniv: But also a potential solution

17:53 ynniv: callen: why is that obscene?

17:54 do you not want the browser to draw your pixels accurately?

17:54 stankley: ynniv: Break all accessibility

17:54 callen: ynniv: because I'm an engineer and I care about simplicity and transparency.

17:54 stankley: ynniv: For one

17:54 brehaut: actually, with modernizr fixing ie8, and discounting anything older, the dom is surprisingly consistent across browsers

17:54 ynniv: relying on the DOM's inconsistencies is more simple or transparent?

17:54 callen: ynniv: I do not create stygian horrors out of distaste for a layout model.

17:54 stankley: ynniv: Both.

17:55 callen: brehaut: CSS is more consistently awful than it used to be.

17:55 ynniv: and what about events? have you not had to deal with event handling across browsers?

17:55 i don't think that you give canvas a fair shake

17:55 yes, accessibility requires some work

17:57 brehaut: have you worked with touch events before?

17:57 stankley: ynniv: Agreed, but breaking out of HTML structure into raw canvas isn't the solution for the problems of CSS

17:57 brehaut: ynniv: yes

17:58 ynniv: the only sane way to work with touch events is to prevent them immediately, before the browser does something "intelligent" with them

17:58 stankley: ynniv: Hah

17:59 ynniv: but, I am a proponent of applications in browsers. those look a lot different than fancy web pages

18:12 TimMc: I hate app-in-a-page.

18:13 Slow, breaks bookmarks/history/automation, hard to customize, inaccessible...

18:14 * technomancy hates not having URLs or conkeror nav targets

18:14 nDuff: TimMc: ...to be fair, bookmark/history/automation support _can_ be done, using the hash part of the URL.

18:14 brehaut: nDuff: god no. history API

18:14 do it properly or dont do it at all

18:15 nightfly_: I've got two versions of this function, one is cleaner looking and one is more efficent? Which is the better more Clojurey choice? https://gist.github.com/3955752

18:17 emezeske: nightfly_: The comp one is kind of weird

18:18 TimMc: nDuff: Hash navigation should only be used for IE fallback.

18:18 emezeske: nightfly_: Maybe you'd be interested in the thrush macro? ->

18:18 TimMc: Even the history API is still... young?

18:18 ynniv: TimMc: depends on if it's supposed to be a web page or not

18:18 brehaut: TimMc: the history api works fine

18:18 TimMc: I haven't seen any site get it right yet.

18:18 * nDuff shrugs. <- not a web developer (thank $DEITY)

18:18 TimMc: GitHub still gets out of sync a bunch.

18:18 brehaut: TimMc: the hard part is not the history api, its everything else you have to do to actually use it gracefully

18:19 TimMc: Yeah, it might not be the API's fault exactly... anyway, sync is HARD.

18:19 nDuff: ...well, been pressed into service as web dev before, but only held that position as a last-resort.

18:19 ynniv: TimMc: do you use native apps on mobile devices?

18:19 TimMc: Nope.

18:19 I don't have a "mobile device", I have a cell phone.

18:19 ynniv: you're not the market then :)

18:19 TimMc: Oh, and a laptop -- that's a mobile device, right? :-P

18:19 nightfly_: emezeske: That is exactly what I wanted! Thanks!

18:20 technomancy: I have a server that's mounted on a rack with wheels on it; that counts right?

18:20 mo-bile computoring

18:20 TimMc: ynniv: In the case of cell apps, there's no existing usage model to break -- it's a clean slate. I'm not really concerned about that.

18:21 amalloy: nightfly_: the comp version doesn't even work

18:21 TimMc: technomancy: Back at Crutchfield we had a desktop with a UPS on a cart and wheeled it around for surprise usability testing.

18:21 ynniv: apps are characterized by offline rich interaction, which is not the web, but can use web technologies

18:21 TimMc: I don't know how they silenced the UPS.

18:21 * nDuff tries to remember where he knows Crutchfield from.

18:21 emezeske: nightfly_: I pasted something into the comments that I liked

18:21 technomancy: "surprise usability testing" sounds like something you could make a reality show about

18:21 TimMc: It was pretty great.

18:22 ynniv: it might have been more exciting with the UPS beeping

18:22 adds to the "surprise"

18:24 amalloy: emezeske: -> isn't thrush: thrush is a function that operates on functions; -> is a macro that operates on forms

18:25 technomancy: eh

18:25 emezeske: amalloy: I've only ever heard -> called thrush. I'm willing to believe that's technically wrong, but I don't know what else to google for.

18:25 technomancy: it's not "The Thrush Combinator" but it partakes of thrushiness

18:25 amalloy: emezeske: thread and arrow are both popular names

18:26 emezeske: amalloy: "Threading macro," that's right, I've heard that, thanks

18:26 technomancy: "thread" by itself is a terrible name. "thread macro" is OK.

18:26 "thrush macro" is fine too

18:26 brehaut: reclaiming arrow from its catagorical crazies is approved of though

18:26 technomancy: just don't call it a combinator and you'll be fine

18:27 amalloy: agreed thrush macro is at least clear what you're referring to

18:27 emezeske: I like "thread macro" -- threading really paints a visual picture in my head of what it does

18:27 callen: emezeske: I tried to get hickey to call it the winchester macro.

18:27 brehaut: emezeske: but its a horribly overloaded term.

18:27 emezeske: callen: Haha, as in it looks like a gun?

18:27 nDuff: Hmm. I'm right now doing (count (for [item expensive-sequence] :when (some-test? item) 1)) to count the number of items in a sequence for which the test is true. I now have a few more tests I want to run against the same sequence, each incrementing their own counters, with only a single pass.

18:27 callen: emezeske: more or less.

18:27 emezeske: brehaut: Good point. :)

18:28 callen: emezeske: I liked to think of it as shooting data through the list of functions.

18:28 emezeske: callen: hahaha, I like it

18:28 technomancy: railgun macro

18:28 callen: emezeske: http://clojure-log.n01se.net/date/2010-08-05.html

18:28 emezeske: ctrl-f "callen-nyc"

18:28 emezeske: or "winchester"

18:28 that wasn't even the first time I'd said it was called the winchester :P

18:29 brehaut: callen: you can point to the space beside the nick of a message an a link appears

18:29 callen: oh bother.

18:29 brehaut: thanks.

18:29 http://clojure-log.n01se.net/date/2010-08-05.html#17:36a there.

18:29 emezeske: ^^

18:29 technomancy: you and I talked a bit about contrib after that.

18:29 emezeske: haha

18:30 * technomancy reminisces

18:30 amalloy: nDuff: (map (juxt test1 test2 test3) coll)?

18:30 zerokarmaleft: heh, pagerank as the go-to curator of libs

18:31 technomancy: remember that one time when there was that patch that didn't get applied; oh man, good times

18:31 callen: technomancy: LOL

18:32 nDuff: amalloy: desired output is the count of items for which each test returned true, so there's still a piece missing there.

18:32 amalloy: oh dang, the guy at riddell.us used to hang out in #clojure? before my time, i guess

18:32 lazybot: The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.guess

18:32 brehaut: unapplied patches are a form of potential. by not applying them you can say 'oh man, you should check out clojure, it has a lot of potential'

18:32 amalloy: nDuff: sure, but it's a simple piece, and not one that will be expensive, which sounded like your primary question

18:33 zerokarmaleft: i got bit by that guy's blog when i first started out

18:33 TimMc: technomancy: "stitching macro", bro

18:33 bdesham: I'm looking for a way to encapsulate a value in a way similar to future or promise, but the value is not evaluated until the thing is deref'd. is this a built-in capability of clojure?

18:33 callen: TimMc: winchester.

18:33 brehaut: bdesham: delay ?

18:33 TimMc: Looks more like a harpoon than a gun.

18:34 callen: TimMc: I'm alright with calling something "the poon", are you?

18:34 bdesham: brehaut: yep. *sigh* it's always something built into the damn language... ;-)

18:34 thanks

18:35 TimMc: callen: Deal.

18:40 * nDuff comes up with (map #(reduce + %) (apply map list (...)), and wonders if he's due to get more sleep / review the sequence library / get more coffee before trying to code.

18:48 antoineB: hello, is there some ring-server pro here?

18:48 Raynes: ~anyone

18:48 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

18:50 antoineB: ok, is it possible to handle a request, terminate the thread (no send back response), and in another Thread forge a few responses?

18:50 nDuff: "forge a few responses"?

18:51 antoineB: forge responses, with request elements saved from requests

18:52 https://github.com/weavejester/ring-serve when you look at the example you see (request -> response) pattern

18:52 nDuff: "forge" is pretty ambiguous here. I don't see any reason why you _couldn't_ do what you're asking about, I'm just unclear on the details.

18:52 hiredman: antoineB: I would recommend looking at the various async adaptations of ring

18:52 nDuff: What do you do with those "forged" responses? Cache them? Throw them away?

18:52 hiredman: aleph has one

18:52 antoineB: send them to client back

18:52 for long polling ajax

18:52 nDuff: Ahhh.

18:52 antoineB: currently i do an infinite loop

18:53 which use a thread for nothing

19:07 thanks, aleph is the stuff i need

19:07 expected i use noir as web framework

19:08 but i don't realy need a web framework for serving 3 pages

19:35 * nDuff is pretty darned impressed by clojure-complete -- was expecting a step down in functionality coming to nrepl.el from swank, and that's not been the case.

19:36 technomancy: it's the same code

19:36 for completion

19:36 still no inspector though

19:36 nDuff: I'm getting completion now on items I've added to my code but not eval'd into the repl yet

19:36 didn't see that with swank

19:37 technomancy: oh, well that's just dabbrev

19:37 nDuff: if it's nrepl.el's doing instead (looking at the source), it's still win. :)

19:37 technomancy: you can do that with slime, it just doesn't use it out of the box

19:37 nDuff: Ahh.

20:15 TimMc: nDuff: You're summing the 0-index elements, then the 1-index elements, etc.?

20:17 nDuff: TimMc: Yup.

20:19 brehaut: so ##(map + [1 2 3] [2 3 4] [3 4 5]) ?

20:19 lazybot: ⇒ (6 9 12)

20:20 brehaut: (map = zip and zip = transpose)

20:48 amalloy: brehaut: you're a closet infix heretic, aren't you

20:48 brehaut: amalloy: yes. i like static types too

20:49 amalloy: that's okay, they're semi-hip

20:51 brehaut: haskell and F# has corrupted me to liking crazy incantaitons of infix

20:51 honestly, english is my first language

20:54 arrdem: gods haskell..

20:54 "we're gonna use prefix... and what you are reading is probably an s expression with no parens"

20:54 "but don't count on it, and infix is cool to"

20:55 muhoo: heh

20:55 arrdem: </rant> </troll>

20:55 brehaut: it would be funnier if that sometimes infix notation werent incredibly useful

20:56 ha

20:56 arrdem: really?

20:57 I'm failing to think of anything where an infix assignment or operator is not semantically equivalent to a let or some other expression

20:57 emezeske: arrdem: There are other things than semantici equivalence, e.g. readability

20:57 brehaut: = is an abberation and doesnt count when people talk about haskell having infix

20:57 emezeske: arrdem: A lot of people like their math formulas to read like math formulas

20:58 arrdem: emezeske: totally understood

20:58 pthon's inline if as example 1 A

20:58 brehaut: its worth keeping in mind that haskell/ml and lisp both have syntax that is heavily optimised for the style of programming that occurs in each.

20:58 emezeske: arrdem: (I tend to not mind prefix for everything, on a personal note)

20:59 arrdem: emezeske: nor do I. While I can't bash on let, usually it would be easier to read an equality operator

21:00 brehaut: emezeske, arrdem its unsurprising that a channel for a lisp would be full of people who like that particular syntactic trade off :)

21:00 emezeske: brehaut: ;)

21:00 arrdem: brehaut: I know...

21:01 brehaut: i also like lisp / prefix notation, i just happen to also like the haskell way too

21:02 emezeske: brehaut: I definitely like the ability to do infix, if only to give DSLs more freedom

21:02 arrdem: the Haskell type system is a thing of beauty... I just don't find that I need it. also as noted I have not made myself learn to read haskell yet so my comments are entirely academic as I do not "know" haskell per se

21:02 emezeske: yeah. I was just pondering if an infix DSL would be possible in Clojure... I don't think so.

21:03 brehaut: you could really hurt yourself with some macro fu

21:03 arrdem: brehaut: I don't deny what I'm investigating is risky.

21:03 just curious

21:04 brehaut: i think fogus or chouser has a function actually

21:04 that does infix

21:04 arrdem: when it blows up in my face I'll crawl back here to say "I should have known" with my last breath..

21:04 brehaut: (infix [1 + [2 * 3]]) ;=> 7

21:05 arrdem: brehaut: nah man.. that's thinking small.

21:05 that has been done many times..

21:05 I want a full inline a = (+ 1 2)

21:06 brehaut: im sure if clojure had reader macros, greate evil could be created

21:06 arrdem: clojure does have reader macros..

21:06 brehaut: not user definable ones

21:06 arrdem: nope.

21:06 they are user definable

21:06 with the disclamar that they are evil

21:07 and that bad things will happen to anyone who uses them

21:07 brehaut: i have no idea what you are talking about

21:09 TimMc: brehaut: It's true, you can hack into the reader.

21:09 brehaut: TimMc: are we talking actual crow bar and java jam some extra evil in?

21:10 TimMc: I don't know what it entails.

21:10 * arrdem departs to learn of this deep evil

21:12 TimMc: brehaut: http://briancarper.net/blog/449/clojure-reader-macros

21:12 brehaut: TimMc: thanks (i think)

21:13 TimMc: (.setAccessible true) and you know shit's goin' down

21:13 brehaut: haha

21:13 thats crowbars for sure

21:14 arrdem: that needs a giant "here be draggons" comment...

21:14 TimMc: arrdem: The blog post does have a "Oh sweet Jesus don't use this in real code" comment.

21:14 brainproxy: thoughts on jim duey's "protocol monads" library? anyone using it to great success? problems with it?

21:14 arrdem: TimMc: O know... read it last night

21:15 *I

21:15 TimMc: brainproxy: I remember someone fussing about breakage of the monad laws, but I'm not position to confirm or deny that claim...

21:17 brainproxy: I know Sgeo was fussing about breakage of monad laws w.r.t. algo.monads

21:17 he filed a ticket in cloju're jira to that effect; but thought I remembered him saying the protocol monads were better

21:25 Sgeo: brainproxy, I may have complained about jimduey's protocol monads breaking the monad laws too, but I have withdrawn my complain, as far as I can tell, they don't.

21:29 brainproxy: Sgeo: have you spent any time with them? I'm starting to explore a use case for monads in one of my projects, but I feel unqualified to determine how seriously I should take the protocol-monads library

21:29 oskarth: is there anything in clojure which embraces FRP?

21:30 brainproxy: oskarth: that's been discussed in here from time to time; for the moment, the project to look at is lamina/aleph

21:30 oskarth: brainproxy: thanks :)

21:30 brainproxy: https://github.com/ztellman/lamina

21:31 oskarth: brainproxy: do you know if there has been any attempts to make it work in clojurescript?

21:31 Sgeo: brainproxy, haven't spent any significant amount of time. I think the use of do as a macro name is problematic, and more importantly/problematically, ... hmm. bind dispatches on the class of its first argument, so you can't have two monads that have one class as a monadic value. And there's no return function, rather, every defined monad has its own such function

21:31 At least, to the best of my memory

21:31 It's been a while

21:34 amalloy: someone used do as a macro name? i doubt if that works ever, in any case

21:35 brainproxy: Sgeo: okay, thanks; I may follow-up w/ you on some of those points as I dig further in

21:35 Sgeo: https://github.com/jduey/protocol-monads/blob/master/src/monads/core.clj#L16

21:35 amalloy, ^

21:36 brainproxy: oskarth: I don't think it works with clojurescript at present; there is the flapjax library

21:36 it's a nice, reactive library for js developed a few years ago

21:36 Sgeo: brainproxy, oh, do-result is sort of a return where you pass in a dummy instance of the type, I think

21:37 amalloy: Sgeo: i see him defining that macro, but not using it. i don't think it will work

21:37 TimMc: Every time I see "FRP" I think Relational, not Reactive. >_<

21:38 Sgeo: ,(special-symbol 'blah/do)

21:38 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: special-symbol in this context, compiling:(NO_SOURCE_PATH:0)>

21:38 Sgeo: ,(special-symbol? 'blah/do)

21:38 clojurebot: false

21:38 amalloy: oh sure, if it's qualified

21:38 Sgeo: I think I've actually tried it, lemme try it again

21:38 oskarth: thanks brainproxy :)

21:39 brainproxy: oskarth: sorry, follow-up point.. flapjax is nice, but hasn't advanced too much since a few years ago

21:39 oskarth: I see

21:39 TimMc: (def do 5) user/do ;; => 5

21:39 brainproxy: i tried starting from scratch and writing a more advanced versino of the library using coffeescript

21:39 but got stuck... and then got diverted to clojure/clojurescript

21:40 oskarth: where did you get stuck? do you know what makes it hard to port lamina to cljs?

21:40 amalloy: TimMc: works fine as a value

21:40 brainproxy: stuck dealing with the inner plumbing given my lofty goals

21:40 as for porting lamina to cljs, I'm not sure

21:40 Sgeo: http://ideone.com/IOMCVY

21:41 TimMc: Sgeo: http://ideone.com/yTsNSS

21:42 brainproxy: amalloy: he uses it in this test

21:42 https://github.com/jduey/protocol-monads/blob/master/test/monads/test/core.clj#L255

21:42 amalloy: yeah, m/do will work fine. i just assumed users would try to (do ...), which will break unexpectedly

21:43 ivan: is there a working data binding thing anywhere that captures the operations/diffs?

21:43 TimMc: I wonder if the compiler should treat foo/do as do.

21:43 ivan: looks like C2 has something

21:44 amalloy: TimMc: i wonder what `(do foo) will read as, in a namespace with do use/refer/defined

21:44 hiredman: there is a todo in the wiki about namespacing special forms like do

21:44 Sgeo: Why would anyone ever write (vec [1 2 3])

21:44 hiredman: they currently are not

21:44 gfredericks: Sgeo: no reason I know of

21:44 amalloy: Sgeo: temporary insanity

21:44 well

21:44 #(vec [1 2 %]) is something i could imagine seeing

21:45 (in that case the reason would be laziness/rudeness)

21:45 gfredericks: being slightly shorter than #(vector 1 2 %)?

21:45 not to mention (partial vector 1 2)

21:45 amalloy: well, also the people who try to make every lambda a #() form typically don't know about the function vector

21:46 TimMc: (fn [x] [1 2 x])

21:46 Hmm, a little longer.

21:47 brainproxy: Sgeo: can you comment further on the point you made about dispatch?

21:48 Sgeo: There is a way to define a monad where the monadic values are lists. Protocol monads would have me define the monad by making all lists behave as if by that monad, when used in bind.

21:49 If there's a second way to use lists as monadic values, I can't use that too.

21:49 gfredericks: TimMc: #(do[1 2 %])

21:49 Sgeo: I can only have one monad that uses lists as monadic values defined.

21:49 amalloy: isn't that true of haskell too?

21:49 it's just less upsetting, because it's easy/normal to make up new data types in haskell

21:50 gfredericks: TimMc: oh oh oh #(do[1 2%]) even

21:50 Sgeo: hmmm..... actually, yes.

21:50 My bad

21:50 * gfredericks doesn't golf very often

21:51 Sgeo: Although actually....

21:51 You could define different Monad instances, and ... can't mix them at all in the same file probably, need to be careful to only import one instance....

21:52 Or.. I don't know how extreme it goes in Haskell v Clojure

21:52 brainproxy: Sgeo: couldn't you just use deftype (or maybe defrecord) and then implement the variant monads on those derived types?

21:52 amalloy: of course, brainproxy. which is what you have to do in haskell too

21:52 brainproxy: if you use extend-type, then sure, I think you could only do one per file

21:53 Sgeo: The context in which I saw (vec [1 2 3]) was

21:54 (doseq [v (vec [1 2 3])] ... )

21:54 ChongLi: can you dispatch on the return type?

21:54 like the way haskell does for return :: a -> m a

21:55 doesn't seem like you can

21:55 arrdem: ChongLi: you can..

21:55 using multimethods

21:55 ChongLi: how is the return type determined?

21:56 amalloy: you can't

21:56 Sgeo: best to treat that as some kind of performance art

21:57 ChongLi: I guess you need static typing to do it?

21:57 amalloy: yes

21:58 ChongLi: I wonder if Ambrose's static type checker would work for this

21:58 I should read this paper

21:59 amalloy: it's a type-checker, not a recompiler :P

21:59 gfredericks: well that would involve the type annotations effecting the semantics of the code

21:59 which sounds out of scope for a type checker

21:59 and I can't think of any way you could make that work using the existing dispatch mechanisms in clojure

21:59 Sgeo: amalloy, this is the same person who did not understand doseq vs for

21:59 ChongLi: oh yeah, good point

22:00 Sgeo: Now offering an online class on Clojure

22:00 amalloy: who is?

22:00 Sgeo: http://www.reddit.com/r/Clojure/comments/122ll8/free_clojure_course/

22:00 frio: the clojure vs. haskell decision tears me up

22:00 ChongLi: that's one area where haskell is really cool

22:00 frio: on the one hand, i love haskell's static typing, monadic control etc.

22:00 on the other hand, everything in clojure feels so new, and easy to use

22:00 clj-http is beautiful

22:00 ChongLi: yeah I feel the exact same way

22:01 Sgeo: How important are macros to you

22:01 ChongLi: haskell is a great language but a lot of its standard prelude doesn't make use of it

22:01 Sgeo: You can do macros with Template Haskell, but it's not as nice as in Clojure

22:01 ChongLi: too many concrete lists

22:01 frio: i try to avoid template haskell; it makes my recompiles painfully slow

22:02 ChongLi: yeah, you just can't beat lisp macros

22:02 frio: macros were never important to me, until i started using them. now, they're useful, but not something i can't do without

22:02 duck1123: I tried to learn haskell, but I have a strong aversion to languages with significant whitespace

22:02 frio: haha duck1123

22:02 my background is python, so that's less of a concern for me :)

22:02 amalloy: duck1123: i do too, but it's a silly complaint. if either of us were serious about learning haskell we'd get over it

22:02 gfredericks: duck1123: I don't mind the whitespace as much as all the invisible precedence

22:02 ChongLi: you can use braces and semicolons if you want

22:03 frio: (and java, but the only reason whitespace is significant there is the amount of pain it inflicts on me when people ignore it)

22:03 ChongLi: a lot of stuff is pretty annoying though

22:03 Sgeo: I imagine any Lisp is unreadable when people don't indent correctly

22:03 brainproxy: thank goodness for paredit :D

22:04 arrdem: gg=g

22:04 *gg=G

22:04 ChongLi: some stuff that makes haskell look quite bad is zip zip3 zip4 zip5 zip6

22:04 :(

22:04 frio: i have a laundry list now of things the "perfect language" (and runtime) would provide me

22:04 ChongLi: and the corresponding zipWith versions

22:04 brainproxy: Sgeo: spent any time with the Clean language?

22:04 amalloy: Sgeo: so much so that the first response to "i'm new at lisp ant my function doesn't work" is always "holy jesus i can't read that, let me reindent"

22:04 ChongLi: clojure's map is so much cooler

22:05 duck1123: frio: How many can't you acomplish with Clojure?

22:05 Sgeo: brainproxy, not really, no :/

22:05 arrdem: (inc duck1123)

22:05 lazybot: ⇒ 4

22:05 frio: duck1123: enforced static typing, enforced functional purity are the big two for me (i'm a software paranoid)

22:05 brainproxy: Sgeo: okay, just wondered; I started looking at it the other night, claims to be popular in academic circles

22:05 Sgeo: Not needing to leave the REPL

22:06 frio: im hoping more work goes into clojure-on-OSGi too; the more we can steal from erlang, the better

22:06 ChongLi: unsafePerformIO

22:06 frio: (erlang the platform/BEAM, anyway; not so much erlang the language)

22:07 duck1123: As an update from last night. My app now has pretty little graphs for some of the events that happen via statsd/graphite

22:07 arrdem: I don't think I want static typing... so much as I want a compiler or vim plugin which can predict types and highlight where the type of a var isn't constant

22:08 amalloy: sounds like static typing, bro

22:08 arrdem: amalloy: yes, w/o the runtime enforcement

22:08 frio: arrdem: it's a tough call, for sure; i still think we're a long way from peak-type-system

22:08 amalloy: no such thing as runtime enforcement for static typing. that's the point

22:09 arrdem: s/runtime/compile time/g

22:09 duck1123: how hard would it be to get flymake to identify functions that would cause reflection?

22:09 arrdem: it's all bits at the end of thd day

22:10 ChongLi: hmmm

22:10 arrdem: my point is that I could get a lot of the value one could derive from a staticly checked language out of having type hinting visible to the programmer

22:10 /embedded in the editing env.

22:11 I mean.. how much type insensitive code do most of us write in a day?

22:11 almos all of it has assumptions, so making those more visible would be nice

22:11 * arrdem will shut up and let his elders talk

22:11 gfredericks: I don't think most of those assumptions are reified in the compiler at the moment

22:12 just types for interop would be my guess

22:12 frio: what do you mean by "type insensitive code"? a depressing amount of my day job usually boils back to java sucking at dealing with null pointers

22:12 arrdem: frio: macros... map based functions... sequence manipulation without regards to the type of the elements etc.

22:13 frio: but, yes, i absolutely agree that much better type inference engines would help in a big way

22:14 ChongLi: the more complex your type system gets, the greater the cognitive load involved in understanding your code

22:14 frio: but those are still essentially typed, right? you might rely on a key being in a map etc., which, for whatever reason, might not be there -- maybe another dev doesn't read your documentation, and occasionally passes your function a map without that key

22:14 Sgeo: ,(#{:a} :b)

22:14 clojurebot: nil

22:14 frio: a strong+static type system helps to stop you from doing dumb things

22:15 ChongLi: and of course, if your type system is too simple it may prevent you from expressing your program in a specific way

22:15 I see a lot of people screwing around wishing they had dependent types in haskell

22:16 though that would bring its own problems

22:16 frio: yeah ChongLi, dependent types would be nice

22:16 and yes, it does :)

22:16 shrug. computer science is still a very very young science, and we're a long way from getting this stuff right

22:16 arrdem: The point is that the type system is there when I want it to do a quick static check on a subsection of my code with respect to some preconditions, but I don't want to deal with it all the time.

22:17 frio: yeah arrdem. that sounds like having a much stronger type inference system, which would be absolutely awesome :)

22:17 arrdem: I like that for the most part Clojure and Python silently do the right thing

22:17 frio: i think Go's typing is supposed to be a good mix of static/dynamic, but i've not yet had a chance to give it a go

22:17 * arrdem likes what you did there

22:21 uroborus_labs: ibdknox: When using jayq, how can you pass clojurescript functions to bind?

22:23 amalloy: aren't clojurescript functions just javascript functions?

22:25 * gfredericks believes so

22:25 uroborus_labs: Yeah, I think I am running into an unrelated issue that I assumed was the problem

22:25 Particularly, not exactly knowing what I am doing yet ;)

22:46 amalloy: that's probably the most common cause of software defects

22:46 "dear diary, today i added another bug because, while i don't realize it, i didn't know what i was doing"

22:47 ynniv: it's sort of amazing that any useful software ever gets written

22:47 mont453: ,(+ 1 2)

22:47 clojurebot: 3

22:47 mont453: Nice

22:48 xeqi: proofs are hard

22:49 brehaut: lets go shopping

22:49 TimMc: *shipping

22:49 xeqi: lets go monkey patching

22:49 Sgeo: There's Typed Clojure, paper released recently

22:50 xeqi: though shipping does have a nice ring at the end

22:52 brehaut: i tried to write a set monad implementation in haskell once, without the internet handy. brain asplode

22:53 im not smart enough for a real static language

22:53 amalloy: brehaut: it would basically just be like List, but use sets?

22:53 brehaut: amalloy: yeah, thats what i thought

22:53 i couldnt appease the typechecker though

22:54 soemthing about ord

22:54 amalloy: huh. doesn't sound that hard, but maybe "conj" needs ord for sets?

22:54 brehaut: maybe? its entirely possible that im a dimwit

22:56 amalloy: Data.Set unions :: Ord a => [Set a] -> Set a is the only thing that jumps out at me

22:56 but i dunno how to use haskell so help yourself to a grain of salt

22:56 brehaut: heh

22:57 amalloy: ah! you can't have a Set a be a Monad a, because you can't infer Ord from Monad

22:57 brehaut: amalloy: i googled and found this http://www.randomhacks.net/articles/2007/03/15/data-set-monad-haskell-macros

22:57 amalloy: so the signature for bind will be wrong

22:57 brehaut: yeah

22:57 amalloy: i worked it out though! don't take away from my ebullience with a link

22:57 brehaut: well done. i couldnt

22:58 i just threw my hands in the air and ragequit

22:58 amalloy: yeah. haskell just needs a Hashable typeclass so all the dang collections don't have to be sorted

22:58 (i'm aware there is one, but it's in some weird library and seems little-used)

22:59 brehaut: the language does suffer a bit from ad hoc academic style growth over a long period of time. a lot of the older libraries are bit weird

23:00 one of split or join on strings is surprisingly hard to fathom using the prelude string type (the list of chars type)

23:01 amalloy: the implementation of it, you mean?

23:02 brehaut: what to use to do it

23:02 again, i might just be a muppet

23:02 amalloy: no worries. i can't tell, cause i can't understand your complaint

23:03 so your reputation is safe

23:04 brehaut: i think i wanted to do (.split "abc,de,f,g,hij" ",")

23:05 im pretty sure that function is inexplicably absent

23:10 amalloy: brehaut: is it just me, or is hoogle awful for this? i tried looking for [a]->a->[[a]] and [a]->[a]->[[a]] and i just get piles of irrelevant functions

23:10 brehaut: its not just you

23:12 amalloy: hoogle is the one tool the haskell community has that we lack (aside from a type-checker). how can it be rubbish?

23:12 brehaut: ha

23:13 they also have monad towers that looks like jenga games that they call web frameworks

23:13 amalloy: so i've heard

23:14 one of these days i should go back to RWH with an understanding of monads

23:14 last time i just gave up at about chapter twelve

23:14 brehaut: probably wouldnt hurt

23:14 amalloy: "he's run out of things to say that make any sense to me"

23:14 brehaut: i cant remember where i gave up

23:14 i think 18 did my head in

23:15 chapter 16 was wonderfully enlightening

23:15 TimMc: brehaut: "i did 18 in my head" <-- how I read that at first

23:16 brehaut: haha

23:16 only oleg does that

23:16 The other thing that they do have over there in haskell land that would be nice (seriously this time) is rewrite rules in the compiler (which i guess flows from the static types)

23:18 Sgeo: Please tell me that Typed Clojure does not use clojure.walk/macroexpand-all

23:18 amalloy: Sgeo: please read the paper yourself

23:19 or tell ambrose you're worried he's an idiot

23:19 (i have no idea what his macroexpansion plan is)

23:21 dnolen: Sgeo: it uses the Clojure analyzer which does fully macroexpand, it's not clear to me how else it should work.

23:22 amalloy: dnolen: he's objecting specifically to macroexpand-all, which is awful and broken

23:23 (from clojure.walk)

23:30 ynniv: even broken optional typing is useful, as long as it only produces false positive warnings

23:30 not sure this is the case, but that's my humble opinion

23:32 amalloy: http://en.wikipedia.org/wiki/False_positive_paradox

23:33 bfabry: can you tell leiningen which version of nrepl to use when you run lein repl? I've set the dependency in the project to 0.2.0-beta10 but it's running 0.1.0-beta10

23:33 ynniv: I can manually check a false positive. not so with a false negative

23:34 amalloy: so? if only 0.1% of your code has type errors, and 5% of it gets flagged, the typechecker is not helping you

23:34 ynniv: 80% of statistics are made up

23:35 I agree to your point, but if the false positive rate is constant, I can verify and diff from commit to commit

23:35 "is this new false positive important"?

23:35 err, "is this new positive false"?

23:36 in optional type systems (and linting systems), it's okay to be false positive, but not false negative

23:37 bfabry: alternatively, is there any way to get nrepl to reload files that are aot compiled?

23:38 ynniv: bfabry: i just learned of lein-pedantic

23:38 it might reveal an unexpected higher priority dependency

23:38 [lein-pedantic "0.0.5"]

23:39 amalloy: nrepl runs in the lein classloader, not yours. so your dependency version is probably irrelevant

23:39 though i may be confusing some of lein's details with some of cake's

23:39 ynniv: amalloy: https://github.com/clojure/tools.nrepl "Installation" suggests otherwise

23:40 not saying that you're wrong

23:40 bfabry: ynniv: that looks like a very cool project... but my project only has like 1 dependency other than clojure. the aot files are in the project itself

23:41 ynniv: doesn't hurt to try, but your problem does not sound like the one I fixed with lein-pedantic

23:42 bfabry: so.. is there any way to get lein to run the old repl if I can't get nrepl to reload anything?

23:44 amalloy: lein trampoline repl might do it

23:44 but in general AOTed classes don't get reloaded afaik

23:45 bfabry: amalloy: which makes perfect sense.. except when you're trying to do development on aot'd classes :)

23:48 Sgeo: ynniv, want a type-checker that gives only false positives?

23:48 (constantly "This form has a type error!")

23:48 ynniv: not "only"… I'm just more concerned about false negatives than false positives

23:49 I can ignore false positives

23:49 Sgeo: Too many false positives makes your type checker useless

23:49 ynniv: seriously… what's with taking this to the extreme?

23:49 Sgeo: With my little type checker, how do you find only the interesting positives

23:49 ynniv: i said that positives are less bad than negatives

23:49 practically, you have a source base that

23:50 that's mostly working. you run the type checker and get errors

23:50 xeqi: ynniv: out of curiousity, where did you hear of lein-pedantic from?

23:50 ynniv: then an intern adds a bunch of features. you run the type checker, and discard what was previously flagged

23:50 now you have interesting data on what the intern might have broken

23:51 Sgeo: ynniv, the intern might have broken something in a way that's not statically checked.

23:51 ynniv: erm… someone well known in #clojure. i could check the logs...

23:51 absolutely true, but that's already a problem

23:51 xeqi: ah, thats good enough

23:51 ynniv: anything better than the status quo is in fact better

23:54 Sgeo: see http://www.altdevblogaday.com/2011/12/24/static-code-analysis/

23:58 * Sgeo wants an environment where a highly dynamic environment and static checking coexist

23:58 Sgeo: Something like Strongtalk, although I haven't seen Strongtalk in action.

23:59 egghead: Sgeo: have you looked at dart?

Logging service provided by n01se.net