#clojure log - Oct 23 2012

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

0:04 Sgeo: ,(resolve 'resolve)

0:04 clojurebot: #'clojure.core/resolve

0:05 Sgeo: Hmm.

0:05 tryclj yells at resolve

1:52 tomoj: "extends java.lang.Object" makes me cry

1:53 muhoo: doesn't everything ultimately extend java.lang.Object?

1:59 Sgeo: Except primitives. Because hey, there's no reason to have a _completely_ universal subtype, is there?

2:05 Licenser: grrr

2:06 tomoj: muhoo: I mean the high frequency of directly extending object and not implementing any interfaces

2:09 * Sgeo wasn't aware that that's considered bad in the OO world

2:09 Sgeo: Then again, I guess I don't do much OO programming... or any programming...

2:10 antares_: Sgeo: that's not bad, just wasn't practical efficiency-wise in mid-to-late 90s

2:11 Sgeo: And something relevant to then bothers tomoj now?

2:19 amalloy: tomoj is objecting because it means all your application code has to be custom-built to deal with specifically the new "bespoke data holders" you made up

2:24 Licenser: antares_ I think that explains it, java is efficiency-wise in the mid-to-late 90s too ;)

2:31 amalloy: i can't think of any "efficiency-wise" concerns related to extending Object directly

2:36 alex_baranosky: do any of the JSON serialization libraries have default Object serializer that just toStrings the Object? I'm using Cheshire and if it doesn't know of a Class it throws an exception which is too strict for my needs

2:36 Raynes: alex_baranosky: Can't you extend its protocol?

2:36 alex_baranosky: Raynes: hmmm good question. Probably. Let me see

2:37 Raynes: I've done it before. Not sure if it was for cheshire, but I've done it for some json lib.

2:37 alex_baranosky: Raynes: not Cheshire. It doesn't use protocols

2:38 but in general I'll look for a Protocol-using library. Thanks

2:38 Raynes: wat

2:38 alex_baranosky: clojure.data.json is extensible.

2:38 alex_baranosky: Can you use this add-encoder stuff?

2:39 I see why it doesn't use protocols, duh, the JSON parser is Java.

2:39 alex_baranosky: https://github.com/dakrone/cheshire/blob/master/src/cheshire/custom.clj

2:40 There is too a protocol.

2:40 For the Clojure stuff.

2:40 alex_baranosky: Raynes: thanks for the help, I appreciate it

2:44 Raynes: it looks like the curom.clj is meant to be used separately from the standard Cheshire stuff, is that right?

2:45 Raynes: "In version 3.0.0 and above, custom encoding first attempts to encode the object using the core encoding (because it would be faster). If the encoding fails, it uses the custom encoding mechanics to encode the JSON. If this is undesirable, use the generate-string*, generate-stream* and generate-smile* methods to overwrite this."

2:45 alex_baranosky: ^

2:47 Well, that seemed more helpful when I read it the first time.

2:47 alex_baranosky: Strangely, yes, it appears the core stuff doesn't touch custom.

2:48 alex_baranosky: Raynes: I've just spent some time reading through it. Sounds like custom was added later

2:48 but it will work for me.

2:48 Raynes: alex_baranosky: It appears that you can just use custom instead of core. It's a drop-in replacement.

2:48 alex_baranosky: I'm just going to extend the JSONable protocol to Object

2:48 Raynes: I'm not sure why this isn't the default. I imagine because of performance.

2:54 amalloy: Raynes: because throwing an exception is better than silently serializing to garbage

2:54 Raynes: amalloy: I think you read that wrong.

2:55 amalloy: i see. i thought you were replaying to alex

2:55 Sgeo: I'm not sure how JSONifying arbitrary Objects is useful?

2:56 antares_: alex_baranosky: Cheshire is now extensible, too

2:56 Raynes: antares_: Backlog.

2:56 antares_: alex_baranosky: I switched clojurewerkz.org projects to use it, had to sacrifice no functionality, works great

2:56 Raynes: We just had a whole discussion about that.

2:56 antares_: Raynes: I know, just sharing my experience

2:56 alex_baranosky: Sgeo: is that a rhetorical question? :D

2:56 Raynes: Yeah, but you said "Cheshire is no extensible" even though we had already established this.

2:56 :p

2:56 antares_: Raynes: imma to busy writing clojah docs to read backlogs :P

2:56 *too

2:57 Raynes: Sgeo: In his case he wants to do something with objects that aren't by default serializable to json that isn't throw an exception.

2:57 antares_: You're going to the conj this year?

2:58 antares_: Raynes: nope

2:58 Raynes: Bah.

2:58 Nobody is.

2:58 Sgeo: Hmm, does serializable-fn use &env?

2:58 * Sgeo is vaguely curious

2:58 Raynes: Sgeo: Yes.

2:58 alex_baranosky: Sgeo, Raynes: at Runa we're experimenting with logging as JSON. The OPs guys prefer data because they can script over it easier

2:58 Raynes: alex_baranosky: Why not edn?

2:58 Sgeo: Raynes, cool

2:58 antares_: Raynes: I live too far away, hold the wrong citizenship and my international passport is expiring in less than 6 months (so, no US visa) :)

2:59 alex_baranosky: logs-as-data is a fantastic practice

2:59 Sgeo: What other uses are there for &env ?

2:59 alex_baranosky: Raynes: what is edn?

2:59 Sgeo: edn : clojure :: json : javascript

2:59 antares_: alex_baranosky: https://github.com/edn-format/edn

2:59 Raynes: alex_baranosky: https://github.com/edn-format/edn

3:00 alex_baranosky: Sgeo: macros that do crazy stuff with symbols, and want to be able to discern between ones that are locally bound

3:00 Raynes: ahhhh EDN, I knew of it, but forgot the acronym

3:01 Raynes: I think in general the answer to that question I always get is "JSON has better tool support"

3:01 Raynes: I can't imagine what tools you'd use.

3:01 But I don't know the set up.

3:01 alex_baranosky: I can't either, but talking to them, they preferred JSON

3:01 not a big deal.. it is in experimental mode now anyway

3:02 Raynes: Who needs those darn reasons anyhow!

3:02 alex_baranosky: easy to switch to printing Clojure data

3:30 muhoo: in the beginning, there were sexps. then, there was xml. now, there is json.

3:34 Raynes: And then there was muhoo...

3:36 brainproxy: datomic's aggregators are pretty cool :)

3:37 Sgeo: fml. Remind me to never tutor without documenting everything in 20 different places

3:37 *tutor for money

3:39 _ulises: only 20?

3:39 make that 50 and add some friendly reminders every 5 min to go and read those notes

3:55 tomoj: hah

3:55 user> (easy!)

3:55 :awesome

3:56 datomic.samples.repl/easy! to be precise

4:08 wingy: can anyone get this

4:08 actual: (not (= (["en-US" 1] ["en" 0.8] ["en-GB" 0.6]) (["en-US" 1] ["en" 0.8] ["en-GB" 0.6])))

4:08 its a clojure.test result .. they seem to be identical .. i can't get why the test fails

4:10 having quotes around them and running in repl: (not (= '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6]) '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6]))) ;; => false

4:10 so they should be identical

4:10 some hidden caveat of clojure i'm not aware of?

4:12 _ulises: wingy: ordering?

4:12 oh, sorry, didn't see they're identically ordered

4:12 wingy: _ulises: but they have the same ordering

4:12 _ulises: wingy: can I see the test?

4:13 hyPiRion: Ahh, numbers.

4:13 ,(not (= '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6]) '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6])))

4:13 clojurebot: false

4:13 hyPiRion: This seems to work quite well though. You have a not in front.

4:14 If you suspected them to not be equal, the result should be true.

4:14 _ulises: hyPiRion: the not is appended by the clojure.test lib. I think

4:14 hyPiRion: oh.

4:14 _ulises: hyPiRion: to tell you they're not =

4:14 hyPiRion: yeah, it's confusing

4:14 wingy: sure … wait

4:15 hyPiRion: wingy: Try to remove the floats with integers instead. Might be that.

4:15 _ulises: hyPiRion: +1 I was about to say

4:15 kral: namaste

4:16 alex_baranosky: is there standard community-supported bit of code for making Compojure routes ignore trailing slashes?

4:16 wingy: nope

4:16 (not (= (["en-GB" 1.0] ["en" 1.0] ["en-US" 1]) (["en-US" 1] ["en" 1] ["en-GB" 1])))

4:16 wait the ordering is wrong

4:17 alex_baranosky: wing, you are saying a list is equal to itself

4:17 wingy: you want, (not (= ["en-GB" 1.0] ["en" 1.0] ["en-US" 1]) (["en-US" 1] ["en" 1] ["en-GB" 1])) ;; right?

4:18 otherwise its like you're saying (= 1) ;; always true

4:19 hyPiRion: alex_baranosky: He's comparing two seemingly equal lists, and get false.

4:19 _ulises: wingy: a tangential comment: have you considered midje? it's got great matchers for collections

4:19 wingy: hyPiRion: i used ints and it works

4:19 alex_baranosky: ahhhh my fault, I see.

4:19 hyPiRion: wingy: ahh, floats. Those bastards!

4:19 wingy: putting 1.0 instead of 1 yield unexpected behaviour again

4:20 but on the repl when i run: (= '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6]) '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6]))

4:20 it yields true

4:20 so float is struggling just for clojure.repl?

4:20 i found a bug?

4:21 _ulises: perhaps there's some odd boxing going on?

4:22 hyPiRion: wingy: It's just floating point representation which is terminated early.

4:22 ,(= 0.80235 (+ 0.12345 0.67890))

4:22 clojurebot: false

4:23 _ulises: this is why I was suggesting midje, it's got good matchers for collections and floats/doubles

4:23 so you can say "is this number within the vicinity of this other one" when you want to check 0.8 against 0.8

4:23 wingy: is there any way to get that test passing in clojure.test?

4:24 the real test looks like: (is (= (util/parse-accept-lang "en-US,en;q=0.8,en-GB;q=0.6") '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6]))))

4:24 _ulises: wingy: can't think of anything other than manually checking each pair and checking for (< (abs (- n1 n2)) delta)

4:24 tgoossens: ,(= 1.0 (+ 0.9 0.1))

4:24 clojurebot: true

4:24 hyPiRion: A nasty hack could be, like.

4:24 ,(= (str '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6])) (str '(["en-US" 1] ["en" 0.8] ["en-GB" 0.6])))

4:24 clojurebot: true

4:25 hyPiRion: Though I wouldn't exactly recommend it, heh.

4:25 _ulises: wingy: I'd first break the check into individual contains? checks

4:25 wingy: _ulises: yeah i wanted to use midje but: https://github.com/marick/Midje/issues/152

4:25 _ulises: wingy: is that a showstopper? you can have lazytest watch code changes for you

4:26 wingy: _ulises: im not a fan of watchers .. that would run yet another jvm instance

4:26 im more a fan of repl based dev

4:27 also the lazytest thing is so buggy!

4:27 yield duplication of output

4:27 amalloy: wingy: what does ##(= (Long. 1) (Integer. 1)) say for your clojure version?

4:27 lazybot: ⇒ true

4:28 wingy: amalloy: it says true

4:30 hyPiRion: i did that .. it worked .. i'll stick with that

4:30 at least its more accurate then having a delta like midje

4:30 clojure was not flawless!

4:30 clgv: "delta like midje"?

4:31 wingy: clgv: _ulises: so you can say "is this number within the vicinity of this other one" when you want to check 0.8 against 0.8

4:31 clgv: ah ok. delta distance for equality check on floats..

4:32 amalloy: hyPiRion, wingy: str is an especially bad measure, because lazy-seqs print as LazySeq@hashcode; at least use pr-str

4:34 wingy: amalloy: done

4:34 thx for the help all

5:17 i need to rebind System/currentTimeMillis but it says unable to resolve var

5:17 (with-redefs [System/currentTimeMillis #(do 1350981302764)]

5:17 do i need to import it first?

5:17 _ulises: wingy: not sure that's a var

5:18 jaley: wingy: it's not a far, that's a java static function

5:18 wingy: ok

5:18 _ulises: wingy: can you not depend on a wrapper to currentTimeMillis and then rebind that?

5:18 wingy: is there a way to mock it?

5:18 jaley: wingy: a var, sorry

5:18 _ulises: wingy: wrap it with an fn then mock that

5:18 wingy: ok

5:18 jaley: wingy: you'd need to change the code calling it to use some wrapper, afaik

5:18 clgv: wingy: no thats a static function call

5:19 wingy: yeah .. :(

5:23 _ulises: did as you said .. everything for testability

5:23 then i made the wrapper a private fn .. private fns dont need tests (its untestable anyway)

5:24 clgv: wingy: btw. do is not the idiomatic choice there. use (constantly 1350981302764)

5:24 wingy: ok thx for pointing out

5:24 clgv: wingy: `constantly` works also for functions with arguments

5:24 _ulises: wingy: yeah, +1 on constantly and wrapping :)

5:24 wingy: yeah do should be for side effects?

5:25 _ulises: wingy: no side effects ever ;)

5:25 wingy: _ulises: im sure (do) is used for side effects, but perhaps you thought i meant constantly

5:26 _ulises: wingy: I meant you shouldn't have side effect ever

5:26 wingy: do is generally used for side effects, yes

5:27 wingy: you always need some side effects eg. printing out things

5:27 _ulises: potentially yes

5:27 wingy: but yeah i hate side effects

5:28 having hard time to test them .. especially http requests

5:28 _ulises: I mean, if by side effects you mean sending a response over the wire (in the case of a web app) then sure

5:29 wingy: how are you trying to test them?

5:30 wingy: _ulises: im not sure yet, that will be the next thing i do, to test some service libraries using http to communicate with the services .. i think i'll just mock the requests/responses

5:30 _ulises: if you have suggestions for testing please share though

5:30 especially for side effects

5:31 _ulises: wingy: well, it depends on what libs you're using; I think ring has helpers for this, noir does too

5:31 wingy: but in principle, it should be enough to test your handlers, and if you're handlers are simple function calls, then testing those function calls it another thing you can test

5:32 wingy: it also depends on what type of testing you want to do, at what level, etc.

5:32 wingy: i think that mocking/stubbing is good for: 1. execution speed 2. you see clearly what you send and receive, and only the http header values you return

5:32 _ulises: wingy: again, it depends on what you're wanting to test. If you only care about http headers, then sure.

5:33 wingy: 3. good documentation as well .. i wasn't a big fan of TDD before but it got too uncontrolled without a good understanding for the code

5:33 _ulises: wingy: midge is great for tdd

5:34 Licenser: this is a bit confusing: (list? (map inc [1 2 3])) => false

5:34 lucian: Licenser: it returns a seq, i think

5:34 _ulises: ,(doc map)

5:34 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

5:34 wingy: can't start another jvm for it … imagine when Light Table is out .. i wanna programmatically run things from that process

5:34 _ulises: Licenser: see the doc; it returns a lazy seq

5:35 Licenser: isn't a lazy squ a list too

5:35 lucian: no

5:35 _ulises: Licenser: I think it's the other way around

5:35 lucian: they're both collections though, i think

5:35 wingy: the more jvm instances are up the more RAM is eaten up and slower my laptop gets .. also just bad style altogether .. i hated to start watchers on node.js as well

5:35 _ulises: Licenser: actually, no, what lucian said methinks

5:36 lucian: so if you do (coll? (map ...)) it should be true

5:36 just like (coll? []) or (coll? '())

5:36 _ulises: wingy: not sure what you're on about? I generally have a small JVM for my slime/nrepl and another small one for midje and I don't have a stunning laptop really

5:37 Licenser: but isn't a lazy seq behaving like a list

5:38 _ulises: Licenser: not necessarily; seq is an abstraction over several collections

5:38 Licenser: the fact that it has (first ...) etc. which are common list operations doesn't mean it's a list

5:38 although duck-typers would say otherwise

5:39 hyPiRion: a list and a lazy-seq are both seqs, but a list is not a lazy-seq and vice versa.

5:39 lucian: you can do (seq [1 2 3]), which returns a seq that is certainly not a list

5:39 Licenser: _ulises what I mean is, aside from the way how it's stored it behaves like a list, the performance characteristics etc are all listy or do I misunderstand it

5:39 Sgeo: _ulises, operations on a lazy seq can cause side effects, whereas operations on a list cannot. Is that sufficiently different for a duck-typer to say they're different?

5:57 _ulises: Sgeo: potentially :)

5:58 * _ulises is only sometimes a duck-typer

6:06 Raynes: I sometimes duck when I type,

6:07 _ulises: heh

6:08 michaelr525: i never dype when i'm tuck

6:10 ejackson: i'm more of the duck 'n cover type, myself.

6:27 alex_baranosky: what's the modern way to handler trailing slashes in routes in composure these days?

6:39 clgv: Licenser: you can use sequential? for that purpose

6:39 goracio: hi if i use :production profile how i can reference this in my -main func to use prod db and if profile :dev which is default i use devdb

7:07 so no one using profiles :)?

7:09 Raynes: More that it's 4-7AM in the US and everybody is asleep.

7:14 goracio: Raynes: but you don't )

7:15 Raynes: goracio: And my life suffers for it.

7:15 goracio: Raynes: so can you suggest the answer ?

7:16 Raynes: Profiles aren't visible in code. You can probably use https://github.com/davidsantiago/configleaf or project middleware for it, but I don't know the specifics.

7:20 goracio: Raynes: heh ok i just did this ( if (= (first args) ":dev")) ( connect to dev db) ( connect to prod db)

7:21 Raynes: it seems like heroku launch proj with something like - lein run :production

7:24 tgoossens: i have a function called format-string. What is currently does is

7:24 (clojure.string/replace string "\"" "==")

7:25 i also want a function deformat-string

7:25 that does the inverse

7:25 ljos: Hello, I was just wondering, does anyone have an example of how to use definline properly. I am not exactly sure if I understand the documentation.

7:25 xeqi: goracio: I've started using https://github.com/weavejester/environ for profile specific config

7:25 tgoossens: but I prefer not to duplicate all the differenct replaces i'm going to do

7:25 ljos: Should have been a questionmark in there as well.

7:27 goracio: xeqi: ok wiil look at that but my hack works ok so far :)

7:36 tgoossens: if have a collection

7:37 (a b c d e f g)

7:37 and i want to make it into a string

7:37 a | b | c | d

7:37 what is a good way to do this?

7:38 hyPiRion: string/join

7:38 clgv: goracio: you could add the info via jvm parameters like describer in 2.14 *compiler-options* Var in https://github.com/clojure/clojure/blob/master/changes.md

7:38 hyPiRion: ,(clojure.string/join " | " [1 2 3 4 5 6 7])

7:38 clojurebot: "1 | 2 | 3 | 4 | 5 | 6 | 7"

7:38 tgoossens: hmm

7:39 ok that works but

7:39 i get this

7:39 "clojure.lang.LazySeq@9e3ad37c | clojure.lang.LazySeq@9e3ad37c | clojure.lang.LazySeq@c78525b7"

7:39 a b c d e f g are lazy sequences

7:39 and guaranteed to be finite

7:42 hyPiRion: tgoossens: (seq a) (seq b) etc.

7:42 tgoossens: ok cool

7:42 it worked :p

7:42 (clojure.string/join " | " (map seq coll))

7:42 thanks

7:44 hldfr: On http://www.4clojure.com/problem/22 , I'm trying to use for, this works in REPL, but fails on 4clojure -

7:44 5:07 PM

7:44 (#(apply + (for [x %] '1)) "Hello World")

7:44 5:07 PM

7:44 -> 11

7:44 tgoossens: not quite there yet :) now it prints

7:44 hldfr: how does this trip alarm on 4clojure -> "You tripped the alarm! count is bad!"

7:45 tgoossens: (a0 a1 a2 ..) | (b0 b1 b2 ..) | ...

7:45 must become

7:45 a0 a1 a2 | b0 b1 b2 | ...

7:46 hldfr: Why should use of 'for' on http://www.4clojure.com/problem/22 trip the alarm meant for use of 'count' ?

7:48 tgoossens: (clojure.string/join " | " (map #(clojure.string/join " " (seq %)) s)

7:48 that did it

7:49 clgv: ,(macroexpand-1 '(for [x (range 5)] 1))

7:49 clojurebot: (clojure.core/let [iter__2887__auto__ (clojure.core/fn iter__33 [s__34] (clojure.core/lazy-seq (clojure.core/loop [s__34 s__34] (clojure.core/when-let [s__34 (clojure.core/seq s__34)] (if (clojure.core/chunked-seq? s__34) (clojure.core/let [c__2885__auto__ (clojure.core/chunk-first s__34) size__2886__auto__ (clojure.core/int #) b__36 ...] (if (clojure.core/loop # #) (clojure.core/chunk-cons # #) (...

7:49 clgv: &(macroexpand-1 '(for [x (range 5)] 1))

7:49 lazybot: ⇒ (clojure.core/let [iter__4468__auto__ (clojure.core/fn iter__318475 [s__318476] (clojure.core/lazy-seq (clojure.core/loop [s__318476 s__318476] (clojure.core/when-let [s__318476 (clojure.core/seq s__318476)] (if (clojure.core/chunked-seq? s__318476) (clojure.cor... https://www.refheap.com/paste/6052

7:49 clgv: hldfr: the expansion contains a `count`

7:50 hldfr: Ah! so 4clojure restricts internal use of count too :) nice

7:51 Chousuke: how would you use for to solve that anyway?

7:51 hldfr: like this - #(apply + (for [x %] '1))

7:51 clgv: hldfr: it's the chunked buffer implementation that bites you there

7:51 Chousuke: hldfr: :P sounds like a complicated way to avoid reduce

7:52 clgv: Chousuke: thats what I thought^^

7:52 * hldfr thinks more on the problem

7:52 Chousuke: you have a seq and you want to produce a single value -> use reduce

7:55 if clojure had an "ignore second argument" HOF you wouldn't even need anonymous functions.

7:57 hldfr: oh, and it's not necessary to quote literal numbers. it's a no-op.

7:57 wingy: why do we even mock http requests responses .. isn't it much better just to run the live test code?

7:57 so it will be real data returned

7:58 wrong channel nvm

7:59 hldfr: yes, quoting wont be needed

8:00 Chousuke why would (map #(1) [1 2 3 4]) not work, where by #(1) I mean a function that returns 1 for anything passed into it

8:00 I get an ArityException on this

8:00 If I explicitly state it in fn form with one arg it works (map (fn [x] 1) [1 2 3 4])

8:01 what would be anonymous equivalent fo (fn [x] 1)

8:01 Chousuke: hldfr: #(1) expands to (fn [] (1))

8:02 you can do #(do 1) to circumvent that

8:04 hldfr: #(do 1) still gives back ArityException

8:05 Chousuke: hldfr: use a fn form then

8:05 hldfr: yeah

8:06 Chousuke: but you don't need to create a seq of 1s to solve this problem

8:06 (there's also the "constantly" function

8:06 * hldfr looks into it

8:07 Chousuke: but reducing over the parameter once is all you need, if you can figure out which function to reduce with

8:07 hldfr: ah nice, I could map (constantly 1) over the seq

8:08 that too, that sounds more better

8:10 Okay, I figured out this with reduce - #(reduce (fn [x y] (+ x 1)) 0 %)

8:11 Chousuke: you can actually remove the #() wrapping the whole thing and just write "reduce (fn ...) 0" as the answer

8:11 hldfr: yes

8:12 Chousuke: also there's a way to simplify your anonymous function just a bit even though it's correct :)

8:12 you could use inc :P

8:12 hldfr: damn yes :)

8:22 Cubic: ,(doc .)

8:22 clojurebot: Cool story bro.

8:59 clgv: Chousuke: inc increases the golf score ;)

8:59 "+ x 1" => 3 chars, "inc x" => 4 chars ^^

9:01 Chousuke: clgv: they're both 5 characters

9:02 space counts too

9:07 clgv: Chousuke: I dont think so. I checked that some time ago

9:10 Chousuke: just checked - whitespace does not count

9:13 wingy: _ulises: you get duplicate output using lein midje --lazytest as well?

9:13 _ulises: wingy: I don't think I do. I don't use lazytest much though, I use midje-mode to run my tests

9:14 wingy: _ulises: that is for emacs?

9:14 _ulises: wingy: yeah

9:16 wingy: _ulises: https://github.com/marick/Midje/issues/149

9:16 :/

9:16 this is what i hate with midje

9:16 so buggy

9:17 and the creator is not taking it seriously

9:17 has been there forever

9:17 _ulises: wingy: :/

9:18 yeah, well brian's a bit tied up, perhaps some delegation is in order

9:18 or even forking midje

9:30 clgv: wingy: he is currently writing a book.

9:30 wingy: clgv: i noticed that

9:30 perhaps i'll buy it

9:30 clgv: wingy: I cannot say that midje is very buggy. but I do not use lazytest mode

9:31 wingy: https://www.refheap.com/paste/6055

9:32 clgv: wingy: does the symbol "animal" exist?

9:32 wingy: clgv: no i thought that was what provided did

9:32 clgv: it has to. thats a design choice I guess.

9:32 wingy: so declare

9:32 clgv: you can "declare" it or define an empty function

9:33 wingy: clgv: ok thx it works now

9:33 clgv: using facts about something non-existent doesnt sound very reasonable. I'd like to get an error there since it might be a typo

9:34 wingy: right

9:34 duck1123: provided has to have something to mock, the macro doesn't convert code at that level. IIRC

9:51 wingy: a comparison between midje and clojure.test

9:51 https://gist.github.com/3938823

9:54 _ulises: wingy: if you're going the midje way then you don't need the pr-str type of testing

9:55 wingy: _ulises: removing them caused failure

9:55 _ulises: wingy: see (roughly ...) in https://github.com/marick/Midje/wiki/Checkers

9:55 wingy: you'd check something like 1.0 => (roughly 0.000001) or something silly like that

9:56 wingy: _ulises: i dont get how to use that one in my test

9:56 _ulises: wingy: I'm wondering now whether the collection checkers will use roughly for you already

9:57 wingy: i wrapped the right form within (contains)

9:57 still error

9:57 _ulises: :/

9:57 wingy: i'll use pr-str til i figure out how to use roughly with my test

9:57 _ulises: sounds like something one would want to do often enough to have predefined checkers

9:57 sounds good

9:58 wingy: _ulises: but i dont like it checks for roughly

9:58 then its not accurate

9:58 so perhaps pr-str is a better solution .. ugly but it is correct

9:59 clgv: wingy: pr-str is semantically wrong there

10:05 _ulises: wingy: again on roughly, you use it like 1.0 => (roughly 1.0), as for checkers that use it I guess you'd have to write your own

10:06 wingy: roughly takes 2 args: number and delta, if delta is omitted then it's taken to be 1/1000 of the number given

10:08 wingy: _ulises: yeah but i dont get how to make it work in my test:

10:08 (util/parse-accept-lang "en-US,en;q=0.8,en-GB;q=0.6") => '(["en-US" (rougly 1)] ["en" (rougly 0.8)] ["en-GB" (rougly 0.6)])

10:08 didnt cut it .. am i doing something wrong

10:09 _ulises: wingy: no you're not; I mean, you need your own checker along the lines of the contains checker. Something like (contains-languages ["en-US" 1] ...)

10:09 wingy: then in (contains-languages ...) you'd use (roughly...)

10:09 wingy: okay

10:09 _ulises: wingy: thing is, your test would be a lot more readable too

10:09 wingy: yeah

10:10 _ulises: wingy: because (contains-languages ...) reads better than any other combination of contains, fns, roughly and any other magic you might put in place

10:10 IMHO

10:20 wingy: the reason i stick with midje is that i rather read midje tests when reading other devs code

10:20 can understand their code faster

10:20 rather than acting like a compiler in my mind

10:23 clgv: wingy: yeah they are more declarative than clojure test which is almost as programming tests in java ;)

10:24 wingy: yepp

11:21 hammer: i don't suppose midje plays nice with maven sites?

11:22 i know i know, how enterprisey :)

11:45 lynaghk`: Is there a nice way I can run a string of code in a certain namespace as if it were just pasted into that namespace? (i.e., it can refer to vars that have been imported into that ns by :use)

11:46 And before anyone gets crazy about read-string + eval, this is for getting clj code from within markdown and replace it with the result, so I'm open to better ideas if there are any...

11:48 wingy: what does this do: (fact (function-generator 3) => (exactly odd?)

11:48 i cant get it

11:48 from https://github.com/marick/Midje/wiki/Checkers

11:52 noidi: wingy, it checks that function-generator returns the function `odd?`

11:53 without the `exactly` it would check that calling `odd?` on the return value of `function-generator` returns a truthy value

11:54 hcumberdale: Hi

11:54 wingy: noidi: i see .. but that was a weird way to describe what function-generator does

11:54 hcumberdale: how to pass the wrap-file-info from ring custom mime types ? (wrap-file-info {"woff" "application/x-font-woff"})

11:54 wingy: why would passing 3 as arg return a odd? function

11:55 noidi: wingy, maybe the body of function-generator is (if (= arg 3) odd? even?)

11:55 :)

11:55 hcumberdale: when (wrap.... is included in -> macro: (-> my-routes ....

11:56 wingy: hehe yeah weird

11:57 kinda cool that you can compare functions

11:57 ,(= '(fn [] 1) '(fn [] 1))

11:57 clojurebot: true

12:01 amalloy: wingy: those aren't functions

12:01 wingy: amalloy: isn't that how midje is comparing

12:02 amalloy: i don't know anything about that. but you just compared two lists

12:02 scriptor: wingy: got a link to the code? Either way, what amalloy said

12:02 wingy: yeah

12:02 scriptor: clojure has no clue that those are functions

12:03 wingy: so to compare two functions you can make a list out of them and compare them

12:03 : ,(= (list (fn [] 1)) (list (fn [] 1)))

12:03 scriptor: as in comparing the code of the functions or the function objects themselves?

12:03 tomoj`: you get functions from lists, not lists from functions

12:03 amalloy: wingy: given the impossible step 1, yes, your step 2 would work

12:03 tomoj`: &(= (list (fn [] 1)) (list (fn [] 1)))

12:03 lazybot: ⇒ false

12:04 wingy: scriptor: the code of the fns

12:04 tomoj`: I suppose you can get lists from many functions, but unless the function is a quine..

12:05 wingy: something that just came into my mind since midje is comparing fns .. if i didn't mistake

12:05 tomoj: by identity?

12:05 &(= odd? odd?)

12:05 lazybot: ⇒ true

12:06 scriptor: wouldn't it be possible to create your own macro like fn that saves the function as a list in the fn's metadata?

12:06 and by "like fn" I mean wrapping around defn

12:07 TimMc: scriptor: serializable-fn

12:07 scriptor: sweet

12:07 TimMc: Another product of the HagelBorg.

12:08 I think it came out of some caffeinated code swarm in Seattle.

12:08 scriptor: is it possible to rebind macros?

12:09 TimMc: I... I don't see why not...

12:09 duck1123: you'll have to re-eval where that macro is used

12:09 jamii: Is there a way to locally 'use a namespace? Like (using 'my-ns (do ...)). I don't want to pollute the whole ns with imports but I have one fn that could really do with them...

12:09 TimMc: scriptor: You mean dynamic binding?

12:10 jamii: I wrote something for use in tests.

12:10 scriptor: TimMc: right, but just wondering how different it'd be since the bindings are created in compile time

12:11 TimMc: jamii: https://github.com/timmc/handy/blob/master/src/org/timmc/handy.clj#L53

12:12 jamii: In use: https://github.com/timmc/handy/blob/master/test/org/timmc/test/handy.clj#L56

12:13 The downside is that vars from the "containing" ns aren't visible.

12:14 jamii: TimMc: I think that will work. I'm just building a huge AST to boostrap this compiler and I don't want the compiler namespace to be full of AST forms. Thanks :)

12:15 TimMc: Why not use an actual separate namespace, then?

12:16 technomancy: you can easily create throwaway namespaces with gensym; see slamhound for an example

12:18 TimMc: That's what with-temp-ns does, except it has to do some extra stuff since it doesn't know what ns it will be called from. :-)

12:19 technomancy: cool

12:19 TimMc: This is probably the one time I have committed eval.

12:41 Cubic: What does some-name# mean in macros?

12:42 tomoj: `foo#

12:42 er, ##`foo#

12:42 lazybot: ⇒ foo__318513__auto__

12:43 Cubic: So it's like a gensym?

12:43 dakrone: Cubic: it's shorthand for a gensym

12:43 Cubic: dakrone: I see

12:44 egghead: hi #clojure, does anyone here have experience with defining a 'catch-all' route for compojure?

12:44 clgv: ,(read-string "`foo#")

12:44 clojurebot: (quote foo__29__auto__)

12:44 clgv: ,(read-string "foo#")

12:44 clojurebot: foo#

12:45 egghead: ah, didn't know I could use * as the route url

12:45 clgv: it's not really a shortcut literally. the reader already does something

12:47 amalloy: TimMc, jamii: if you wanted something less like temp-ns and more specifically a "local" 'use, you could write https://gist.github.com/3939975

12:48 jamii: amalloy: thats perfect :)

12:50 amalloy: macrolet solves so many problems in interesting ways

12:54 tgoossens: in leiningen when i do read-line

12:54 i can type something

12:54 but how do i "enter" something

12:55 pressing enter doesn't seem to work

12:55 technomancy: tgoossens: try lein trampoline repl

12:56 tgoossens: sorry making it clearer

12:56 it is when doing

12:56 lein run

12:56 technomancy: lein trampoline run then

12:56 tgoossens: the main function expects user input

12:56 ah

12:56 ok

12:56 i need to look wat what trampoline is then. never heard of it

12:57 cool that worked :p

12:59 technomancy: though it occurs to me this could be fixed in lein itself

13:03 tgoossens: hmm?

13:04 technomancy: for a while we couldn't support it, but I think we can now

13:05 tgoossens: do you work on the leiningen project

13:05 ?

13:05 technomancy: yeah

13:05 I just pushed a fix

13:05 tgoossens: nice :)

13:07 lein uberjar also gives problems: can't find main class

13:08 do i have to add something to project.clj file?

13:08 technomancy: yeah, have you read `lein help tutorial`?

13:08 oskarth: Trying to write more readable tests for macros. How do I trim of clojure.core namespace qualifications in macroexpand? That is, turn clojure.core/defn into defn, or something to that effect

13:08 tgoossens: Nope. thanks for the tip

13:13 emezeske: oskarth: It seems like if the macro is supposed to produce clojure.core/defn, that's what you should check for in your test

13:13 oskarth: If it's just producing the raw symbol defn, it's not actually working correctly, right?

13:13 oskarth: emezeske: right, that is true - it just gives very unreadable tests when it is just standard clojure.core functions being used

13:14 oh, it does other things too

13:15 emezeske: here's the test https://www.refheap.com/paste/6059

13:15 (changed macroexpand to macroexpand-1 tho)

13:18 emezeske: Well, you could use syntax quote in the compared expression, but then you'd need to unquote-quote the symbols like not* in* and out*

13:19 clgv: oskarth: doesnt a test with macroexpand just repeat the macro implementation and is thus useless?

13:19 emezeske: Which would likely be uglier: `(~'not* (fn [~'in ~'out] ...

13:20 oskarth: you are both right

13:21 just trying to add tests to a macro which isn't working the way I expect it to, but I think I'm approaching it the wrong way

13:22 emezeske: oskarth: One problem with the macro is that it emits (fn ([...] ...)) instead of (fn [...] ...)

13:23 oskarth: Also, I disagree with clgv, that test is perfectly useful

13:23 oskarth: emezeske: so the use case is to have two arguments, representing a vector of inputs and a vector of supposed outputs

13:23 so it's a non-standard in having two params vectors

13:23 emezeske: Ah, gotcha

13:24 I was being silly calling that a problem anyway

13:24 oskarth: and then there's some threading going on which binds outputs to other inputs

13:24 emezeske: do you have any examples of good tests for macros?

13:24 emezeske: clgv: The test doesn't just repeat the macro implementation; it ensures that the name (not*) and params ([in], [out]) are put in the right places, etc

13:24 oskarth: I'm afraid I don't

13:25 nightfly_: How can I do something like: `(fn [example#] (when ~(contrived example#))) expect that works?

13:25 emezeske: oskarth: I don't see anything bad about your test

13:25 oskarth: (although I'm not an expert in testing macros)

13:26 clgv: nightfly_: (fn [example#] (when (~contrived example#))) but if `contrived` is a function you do not need the unquote

13:26 `(fn [example#] (when (~contrived example#)))

13:26 oskarth: I see, thanks for your help!

13:27 and I guess the ns qualification is better than doing unquoting and stuff, too complex

13:27 clgv: oskarth: you can use clojure.walk/postwalk with `name` to replace namespaced symbols by their names only

13:28 emezeske: oskarth: I don't think the qualified names look bad, but that's just IMHO.

13:28 clgv: or you could use ##`defn

13:28 lazybot: ⇒ clojure.core/defn

13:28 Sgeo: Wait, what's the problem?

13:28 oskarth: hm, that seems doable, will play around with that, thanks

13:28 it's supposed to map the other way around though

13:28 Sgeo: ##`~'bla

13:28 lazybot: ⇒ bla

13:28 oskarth: clojure.core/defn to defn

13:29 or that I misunderstand you?

13:29 Sgeo: ##`(~'defn foo [bar#] baz)

13:29 lazybot: ⇒ (defn clojure.core/foo [bar__318544__auto__] clojure.core/baz)

13:29 oskarth: emezeske: in general I agree, but with clojure.core it feels odd somehow, not used to seeing it that way

13:29 Sgeo: But what's wrong with

13:29 ##`(defn foo [bar#] baz)

13:29 lazybot: ⇒ (clojure.core/defn clojure.core/foo [bar__318555__auto__] clojure.core/baz)

13:29 Sgeo: exactly?

13:30 clgv: ,(= `(defn ~'bla []) (`defn 'bla []))

13:30 clojurebot: false

13:30 nightfly_: contrived is function I want to evaluate at in a macro at compile time that also takes another argument that isn't a generated symbol. I want to pass the generated symbol into the function untouched so the generated code can use it by name.

13:30 clgv: lol k

13:30 nightfly_: you have to manually create a gensym outside the syntax-quote and use that one

13:30 Sgeo: clgv, symbols are literally just a name string with an optional namespace string

13:31 oskarth: bbl

13:31 clgv: Sgeo: I know

13:31 Sgeo: It's different from Common Lisp symbols

13:33 :(

13:33 Clojure doesn't like opaque objects being embedded in code

13:33 This makes me uneasy

13:33 Or maybe ideone is just really really weird

13:34 http://ideone.com/8i92E3

13:34 amalloy: Sgeo: you can't do it in any other language afaik

13:34 Sgeo: Not exactly the sort of exception I'd expect to get

13:34 amalloy, Common Lisp I think

13:34 clgv: ,(read-string "#=(java.lang.Object.)")

13:34 clojurebot: #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>

13:35 Sgeo: clgv, oh hey that works http://ideone.com/Z9Drik

13:35 So why does this not work http://ideone.com/o2u3PT

13:36 (doc print-dup)

13:36 clojurebot: "; "

13:36 Sgeo: ...

13:36 ,(print-dup 5)

13:36 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$fn--2718$fn>

13:37 Sgeo: Oh hey I guessed the name of a class and got it right

13:37 (StringWriter)

13:38 ,(with-open [w (java.io.StringWriter.)] (print-dup w 5) (.toString w))

13:38 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No method in multimethod 'print-dup' for dispatch value: class java.io.StringWriter>

13:39 TimMc: It doesn't make sense to serialize a writer.

13:40 nightfly_: clgv: Thanks, trying that now

13:40 TimMc: Maybe someone can figure out how to do that in some crazy language, but I don't think Clojure can support it meaningfully.

13:40 clgv: SGeo: you want (defmacro env [] (let [symbols (keys &env)] (zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols))) ?

13:40 Sgeo: ^^

13:41 Sgeo: clgv, I wrote a simpler version of that macro a while back I think

13:41 Or... depends if you prefer for and into over map and zipmap

13:41 clgv: Sgeo: it looked like you wanted that in http://ideone.com/o2u3PT

13:41 Sgeo: clgv, I wanted to learn more about those weird values

13:42 clgv, seriously, I was giddy with glea after writing https://www.refheap.com/paste/5886

13:42 TimMc: You might be better off reading the compiler.

13:45 Sgeo: ,(with-open [w (java.io.StringWriter.)] (print-dup 5 w) (.toString w))

13:45 clojurebot: "5"

13:45 Sgeo: ,(with-open [w (java.io.StringWriter.)] (print-dup (Object.) w) (.toString w))

13:45 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No method in multimethod 'print-dup' for dispatch value: class java.lang.Object>

13:46 Sgeo: Hmm, so how come #=(Object.) is acceptable?

13:47 amalloy: Sgeo: one is printing and the other is reading...?

13:47 Sgeo: Oh, I just realized a cheap trick to ... wait, no.

13:47 Hey, is there anything terribly gross about def'ing to a gensym... oh, that doesn't even help me

13:48 Because I can't def to a gensym from the macro itself without using eval

13:51 Hmm. Maybe all my problems are because I was attempting to print the &env and I got that confused with it disliking the &env being in code

13:51 alex_baranosky: : what's the modern way to handler trailing slashes in routes in composure these days?

13:52 Sgeo: I blame Clojure's horrible stack traces.

13:52 Wait, it actually does say "Can't embed object in code"

13:52 Oh, hmm, that time I surrounded it by quote

13:53 ,(quote (Object.))

13:53 clojurebot: (Object.)

13:54 Sgeo: Yeah, it's because of the quote

13:55 I don't entirely get it, why it shouldn't work

13:58 (doc special-symbol?)

13:58 technomancy: emezeske: just a heads-up; pushed a change to leiningen that may interfere with cljsbuild's repl

13:58 clojurebot: "([s]); Returns true if s names a special form"

13:58 Sgeo: ,(special-symbol? with-meta)

13:58 clojurebot: false

13:58 Sgeo: ,(special-symbol? 'with-meta)

13:58 clojurebot: false

13:58 Sgeo: Hmm.

13:58 It's mentioned in LispReader.java

13:58 technomancy: eval-in-project will now hook up *in* to the subprocess's stdin unless you bind leiningen.core.eval/*pump-in* to false

13:59 xeqi: alex_baranosky: rewrite :uri or return a redirect with middleware

14:00 emezeske: technomancy: Okay, thanks for the heads-up

14:00 technomancy: I'll try to give it a test tonight

14:00 technomancy: emezeske: I think your plugin is probably the only one that uses *in*

14:00 alex_baranosky: xeqi: such a common feature has to be rewritten by every web app writer ?? :\

14:00 technomancy: but if anyone knows of any others, let me know

14:00 emezeske: technomancy: So if it is a problem, I can just bind *pump-in*?

14:01 amalloy: alex_baranosky: you can be the hero who saves us all from our drudgery. write it once in a library, and heavily advertise your solution so everyone uses it

14:01 xeqi: alex_baranosky: could use the one in lib-noir if desired ; https://github.com/noir-clojure/lib-noir/blob/master/src/noir/util/middleware.clj#L28

14:01 technomancy: emezeske: yeah, if you don't bind it to false you'll have race conditions reading from *in*

14:01 xeqi: (inc amalloy)

14:01 lazybot: ⇒ 33

14:01 technomancy: emezeske: for reference: https://github.com/technomancy/leiningen/commit/ecdc783f2da25b8c8fd1c0af051d7c1f6af7a09a

14:01 emezeske: technomancy: Thanks

14:02 alex_baranosky: amalloy: I'm hearing a Peter Cetera song now in my head. I think I can be that hero!

14:02 amalloy: http://www.youtube.com/watch?v=69hglPNOiTI

14:03 xeqi: thanks for the noir link.

14:03 amalloy: Raynes: is that function in lib-noir borrowed from 4clojure? i know i told you and chris to take whatever you wanted, but i didn't realize you had

14:04 (obviously you could have written that yourself, but it's identical down to the character, so i'm curious)

14:08 Sgeo: So much for embedding atoms into code.

14:08 Namespace polluting gunk with eval, here I come!

14:14 I am an absolutely terrible person http://ideone.com/BTJxYN

14:15 nDuff: *shudder*.

14:16 * Sgeo doesn't particularly see a better way to do that though

14:17 nDuff: Sgeo: I've pulled LocalBindings out of the thread-local space before, after doing a bunch of reflection to make them accessible.

14:17 Sgeo: ...it's also dirty, but at least it leaves the namespace as it found it.

14:17 amalloy: Sgeo: no, but that's a useless thing to do anyway. what are you going to do with a LocalBinding object?

14:18 the only thing you can usefully do is get its value, which you could do without eval, and can't do the way you've written it

14:18 Sgeo: Is there any way to undef?

14:20 nDuff, I'm curious what that looks like

14:22 I was going to ask, doesn't eval accept an env, but apparently it doesn't

14:22 nDuff: Sgeo: https://gist.github.com/2912188

14:23 Sgeo: I don't think I can begin to comprehend that

14:24 Urth|School: girl next to me in English left the sleeve tag on her overcoat

14:24 woops

14:24 wrong channel ><

14:24 Bronsa: lol

14:24 Urth|School: Too many irssi windows open, sigh

14:24 nDuff: ...actually, I think the clojure-frame-vars function in there would have been a good answer to the person in here yesterday asking when you'd ever have a use case for for as opposed to fn+map. :)

14:24 pandeiro: how can i get nrepl.el 0.1.5 from marmalade? when i package-install it only seems to find 0.1.4

14:25 technomancy: pandeiro: M-x package-refresh-contents?

14:25 Iceland_jack: Urth|School: Solution, turn off IRC client; go outside

14:25 scriptor: presumably he's in class

14:25 Sgeo: I think anytime you're drawing from more than one list is a good use case

14:25 erm, more than one seq

14:26 Urth|School: The English major affords plenty of opportunity to go outside, thankfully

14:27 pandeiro: technomancy: doh thks

14:29 wingy: im reading about identity/states in JoY .. it says that an identity has a notion of time so you can go back and forth between different states .. how is this done in clj?

14:30 seancorfield: each state is immutable and has its own identity

14:30 wingy: i know values are immutable, but how does one have an identity with different values over time, allowing us to time travel (like in Datomic)

14:31 nDuff: wingy: You have to actually deref at an older time to have an instance of it.

14:31 Sgeo: wingy, you can store the old values somewhere and look at them again later

14:31 nDuff: wingy: ...instances that aren't referenced anywhere get GC'd.

14:31 seancorfield: what they said (more coherently than me)

14:31 Sgeo: Although I imagine it can't be that difficult to make sort of atom-like thing with time travel capability

14:32 nDuff: s/have an instance of it/have a reference to that prior time's instance/

14:32 * nDuff ponders Sgeo's suggestion.

14:32 wingy: Sgeo nDuff seancorfield : okay i thought you could have one identity (reference type) to hold different values over time

14:32 nDuff: ...you could almost start from an atom with a listener.

14:33 wingy: Not to give you a single point of access for all those values, no, unless you build that yourself. But Clojure _does_ give you the tools to build that yourself, if you want to.

14:34 wingy: good that datomic did it for us then :)

14:35 reading the book one think you can time travel (the flip book example with a runner)

14:35 Sgeo: wingy, you want time travel, try Scheme

14:36 wingy: they have time travel? :)

14:36 seancorfield: wingy: in datomic it uses an identity for a series of values, i believe, so you use identity + time to retrieve an entity at a given point in time

14:36 wingy: seancorfield: yeah

14:36 Sgeo: wingy, call/cc is nuts

14:36 * seancorfield kicks himself for conflating identity and time :(

14:36 Sgeo: Although apparently not as good as shift/reset, but whatever

14:37 http://en.wikipedia.org/wiki/Call-with-current-continuation

14:47 Cheiron: Hi, assoc-in is going to create array-map, correct? is it possible to create sorted-map?

14:48 * nDuff tries to figure out how to pass keyword arguments from gradle's ClojureExec (particularly, to pass a :port argument to clojure.tools.nrepl.server/start-server)

14:50 hcumberdale: Is there a better way to write: (filter #(and (= "example" (:category %)) (= true (:active %))) (read-posts))

14:50 scriptor: Cheiron: it's not possible to assoc onto a sorted-map in the first place, right?

14:50 nDuff: ...ahh, need to go through nrepl.cmdline/-main

14:50 scriptor: Cheiron: sorry, disregad that

14:51 Cheiron: scriptor: not sure actually. assoc is going to add entry according to map implementation , i guess?

14:51 scriptor: right

14:51 nDuff: hrm; getting "java.lang.ClassNotFoundException: complete.core" on attempts to use tab completion in nrepl.el...

14:52 ...separate dependency? Ahh.

14:52 Sgeo: Why are you comparing with true rather than just using truthiness? (There are reasons that that might make sense, but good to think about)

14:53 scriptor: Cheiron: you'll still get a sorted map back, specifically a PersistentTreeMap, if you assoc-in onto a sorted map, it seems

14:54 ,(class (assoc-in (sorted-map 1 :foo 2 (sorted-map 10 20)) [1] 4))

14:54 clojurebot: clojure.lang.PersistentTreeMap

14:54 scriptor: ,(class (assoc-in (sorted-map 1 :foo 2 (sorted-map 10 20)) [2 10] 4))

14:54 clojurebot: clojure.lang.PersistentTreeMap

14:54 scriptor: Cheiron: ^

14:55 Cheiron: scriptor: thanks!

14:56 hcumberdale: mhh!

14:58 pelismo: so i've written a clojure based API (mostly handing out json), but i'm unsure at how to implement gracefull errors (other than just exploding 406 and 500 at the client's face)

14:59 would love a pointer to any examples/idea of projects on github I could learn from

14:59 nightfly_: Have pretty 406's and 500's?

15:00 pelismo: well somewhat. my code either throws exception (when clients submit invalid params, such as malformed uris), or just fails because it has no results in DB (applicative errors)

15:00 nDuff: pelismo: If what you want is better exception handling tools, have you looked at Slingshot?

15:02 wingy: which one is better if i wanna make a concat a string: using protocol and extend the String class with it (cat "foo" "bar") .. or just defining a fn taking strings as args (cat-str "foo" "bar")

15:02 Sgeo: I still wish I knew what was so terrible about embedding opaque objects into code

15:03 wingy: i am curious if protocol/class is worth the trouble with thinking about classes and interfaces which reminds me about oop

15:03 pelismo: nDuff: so wrapping my head over functional programming, and the fact that i'm returning data structures doesn't help mee

15:03 wingy: or should we stay simple and just have a simple fn taking expected args

15:03 nightfly_: (str "this" "that") not good enough?

15:04 Sgeo: wingy, the typical thing is to just make a fn, I think

15:04 nDuff: wingy: Look at where/how/why Clojure itself uses protocols.

15:04 wingy: nightfly_: yeah im talking about an imaginary fn we need to make ourselves

15:04 Sgeo: Unless you want the function to work with different types in different ways that you might not anticipate

15:04 nDuff: wingy: If you don't need one, don't use one -- but if you're writing something for which extension points make sense, they're often perfect.

15:05 Sgeo: nDuff, except they work based on classes which are leakage from Javaness :(

15:05 wingy: i guess it boils down to: writing an abstraction (for implemetations) or implementation directly

15:05 * Sgeo thinks multimethods make more sense

15:05 nDuff: Sgeo: ...which makes them fast. If you care about performance, letting underlying implementation leak through makes sense sometimes.

15:06 Sgeo: nDuff, which might be a good reason to hate the fact that Clojure is on the JVM

15:06 nDuff: Sgeo: At least for me, I work in an environment where performance _does_ matter, quite a lot; I'm barely able to justify Clojure as it is, on those grounds -- if it didn't take advantage of things the JVM is good at, it'd be flat out.

15:06 Sgeo: Heh. I wouldn't be able to use it at all if it weren't.

15:06 Sgeo: Ah

15:07 wingy: nDuff: what are you working with if I may ask?

15:08 nDuff: wingy: The employer is a search engine. The individual project involves event stream processing -- at present, using Esper as backend.

15:09 wingy: okay

15:14 nDuff: I searched for "defprotocol" in the clojure git repo without matches .. how does it use protocols?

15:15 nDuff: wingy: well, the biggest one is ISeq :)

15:16 wingy: ...yes, they're implemented as Java interfaces there, but they're the whole reason the standard library functions work across more than one datatype each.

15:23 wingy: JoY says numbers, strings and keywords evals to themselves .. it didn't mention character, boolean and collections. don't they evaluate to themselves as well?

15:24 Sgeo: Lists don

15:24 Lists don't evaluate to themselves

15:25 wingy: ,'(1)

15:25 clojurebot: (1)

15:25 wingy: why doesn't it?

15:25 Bronsa: ,(1)

15:25 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

15:25 Sgeo: wingy, quote prevents the usual evaluation rules

15:25 Bronsa: it does not

15:25 wingy: ok

15:25 Sgeo: (1) is a list containing 1

15:26 '(1) is (quote (1)) which is a list containing the symbol quote and the list (1)

15:26 wingy: yeah, quote means dont eval

15:26 ttimvisher: any way to pass a `-D` property through to leiningen?

15:28 andrewmcveigh: ttimvisher: you can use a :jvm-opts ["-Dany.prop=true"] in project.clj

15:28 ttimvisher: andrewmcveigh: thanks!

15:28 anyone had to deal with jvm dns cacheing before? might have some insight into how to flush it or set it to never on jvm start up?

15:29 preferably looking to flush it in a running jvm

15:30 hiredman: ttimvisher: never heard of such a thing, are you sure it isn't your os?

15:30 ttimvisher: hiredman: absolutely

15:30 TimMc: Bronsa: You're lagging: https://www.refheap.com/paste/6067 :-P

15:31 Bronsa: lol

15:31 ttimvisher: hiredman: http://javaeesupportpatterns.blogspot.com/2011/03/java-dns-cache-reference-guide.html if you're interested

15:31 Bronsa: no wait.

15:31 hiredman: ttimvisher: http://docs.oracle.com/javase/6/docs/technotes/guides/net/properties.html#nct

15:31 ttimvisher: not that it's helpming me much :)

15:31 hiredman: interesting

15:32 TimMc: That's a strange default.

15:32 ttimvisher: hiredman: it's looking like the only way to successfully set that property is to actually edit the `java.security` file in the jvm

15:33 and then restart the server

15:33 hiredman: ttimvisher: it is a -D property

15:36 ttimvisher: hiredman: setting it via -D takes no effect

15:36 hiredman: ttimvisher: *shrug* seems unlikely, are you really setting it?

15:40 llasram: ttimvisher: How are you checking for effect? By asking sun.net.InetAddressCachePolicy/get ?

15:40 ttimvisher: yep

15:40 llasram: yes

15:40 and by getting google.com

15:40 via InetAddress

15:40 hiredman: yes. System/getProperty returns the right value when we set it

15:40 tomoj: I want emacs commands for folding/unfolding arrows

15:41 ttimvisher: but sun.net.InetAddressCachePolicy/get returns 30

15:41 unless you set it in java.security, and then it returns the right thing

15:41 as does the system property

15:41 gf3: Hey #clojure, I'm off in #scala land and… I miss you guys

15:41 llasram: ttimvisher: Looks like InetAddressCachePolicy sets things in a static initializer

15:41 http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/sun/net/InetAddressCachePolicy.java

15:41 hiredman: but how did you set in the other way?

15:41 wingy: symbols are referring to vars and not values?

15:41 ttimvisher: llasram: yep

15:42 llasram: So if something (bootstrap classes?) causes that class to be loaded prior to the value getting set, then the property has no effect

15:42 hiredman: yeah, a lot of -D stuff is static, so you cannot set in via setProperty

15:42 ttimvisher: Now you can call sun.net.InetAddressCachePolicy/setIfNotSet but you can only increase the strictness

15:42 if you try to decrease it you get a Security exception

15:42 hiredman: you could just reflectively fiddle the field

15:43 have you checked propertySet ?

15:44 llasram: Man, this is why I always seem to end up writing my own IP address type

15:44 ttimvisher: hiredman: reflection is a possibility we haven't tried yet. not going to burn any more time on this now but thanks for the ideas!

15:47 hiredman: reflection is a must

15:48 wingy: do you call 1 a form?

15:51 now i get why collections don't eval to themselves .. they can contain a list

15:52 emezeske: wingy: Some collections do evaluate to themselves. ##[1 2 3 4] does, for instance

15:52 lazybot: ⇒ [1 2 3 4]

15:53 wingy: yeah

15:53 amalloy: wingy: containing a list isn't really the point. a vector [x y z] evaluates to [(x evaled) (y evaled) (z evaled)]

15:54 emezeske: amalloy: That is a good point, I guess I kind of lied

15:54 amalloy: emezeske: nah, you said something true but misleading

15:55 wingy: so it depends what they contain .. if they contain self-evaling data structures, they are self evaling

15:57 Sgeo: Suppose my code has a map like {(quote a) a, (quote b) b}

15:57 Raynes: emezeske: I updated lein-cljsbuild last night and ohmahgawd, I compiled my two-file node.js cljs test program and it worked. New cljs release ftw.

15:58 Sgeo: The first key is a list which will be evaled to a symbol, the value for that key is a symbol which gets evaled to whatever a is in that context, and similarly for the other entry

15:58 emezeske: Raynes: Haha, awesome! Did that project work with the naked clojurescript compiler before?

15:58 dnolen: Raynes: that's good to hear tho it still doesn't seem to to work for some people.

15:58 Raynes: dnolen: Really? Who says it doesn't work?

15:59 emezeske: I don't know. Never tried it. I don't really know how to use the naked clojurescript compiler.

15:59 dnolen: Raynes: http://dev.clojure.org/jira/browse/CLJS-395

15:59 Raynes: it's not fun, using the compiler by itself :)

15:59 emezeske: Raynes: I don't blame you :)

16:00 Raynes: I just wondered if whatever started working was lein-cljsbuild or the compiler itself -- probably the compiler.

16:00 Raynes: dnolen: Well, to be fair, at least it's broken properly this time and not insanely.

16:00 emezeske: It was the compiler for sure, because I reproduced without lein-cljsbuild before.

16:01 emezeske: Raynes: Okay, cool

16:02 Raynes: dnolen: That's pretty weird. :(

16:03 dnolen: Raynes: what the ticket?

16:03 Raynes: dnolen: My code probably works because I require cljs.nodejs.

16:03 dnolen: Raynes: I'm assuming from the ticket that the idea is to make it implicit

16:04 Raynes: Yeah, doesn't break for me at all, even without the require.

16:04 dnolen: Raynes: interesting ...

16:05 Raynes: Ah, yes it does. There was another in another file.

16:05 dnolen: I can reproduce that guy's error

16:05 tomoj is right, the workaround is to require cljs.nodejs manually somewhere in code.

16:05 dnolen: Raynes: so does making it implicit seem like a good approach?

16:06 tomoj: makes sense to me

16:06 not much you're pulling in, and who cares on node.js anyway

16:06 dnolen: Raynes: implicit does seem preferred to me

16:06 tomoj: yeah

16:07 tomoj: hopefully cljs.nodejscli is unlikely to change (or at least to change deps)

16:07 Raynes: dnolen: Makes sense, I think.

16:08 tomoj: maybe the bigger problem is that the dependency order sort is unstable?

16:09 dnolen: tomoj: the whole dependency order needs to work a la carte. source mapping needs it to provide accurate line number.

16:10 tomoj: not sure what you mean. that special injections like this disturb source mapping?

16:11 dnolen: tomoj: without knowing the final total order I'm not sure how we can know what lines map to what lines.

16:11 tomoj: files are compiled individually by CLJS compiler, then ordered, then put through Closure compilation

16:12 or ... that's what seems to happen far as I can tell.

16:12 tomoj: a stable sort won't hurt

16:13 dnolen: tomoj: oh yeah, I'm agreeing w/ that too.

16:13 tomoj: so what about the way things are is unsuitable for source mapping?

16:15 dnolen: tomoj: you need to know what line number to start at for each CLJS file - user might include GClosure libs, externals libs, etc. There are no hook currently to extract this information to produce accurate mappings.

16:15 and I mean the generated line number of course, we know the original line / col easily.

16:19 tomoj: is that the major missing piece on source maps?

16:19 that seems doable after a cursory look at cljs.closure

16:23 dnolen: tomoj: it's *a* major missing piece. the other piece - 1) merging in-memory CLJS compiler source map w/ GClosure source map and writing that out

16:24 tomoj: I stalled a bit because I need the other piece before the merge can be done

16:25 tomoj: the source-map branch already generates decent info for ever var occurrence (which means locals as well). soon as Clojure 1.5.0 goes out would like to move CLJS to use it and incorporate reader column information.

16:25 tomoj: get the feeling that will be soon

16:25 dnolen: yeah

16:25 tomoj: I think source maps could really help push coworkers over the line

16:26 dnolen: tomoj: it would help everyone :)

16:27 not being able to sensibly debug / benchmark advanced compiled code in browsers is flying blind.

16:27 Raynes: It would fix global warming.

16:27 Cheiron: Hi, I would like to know how much memory a datastructure occupy during the runtime . is is possible?

16:28 nDuff: Cheiron: I've been able to figure that out using YourKit, though it's very much not free software (though there are zero-cost licenses available for OSS development).

16:29 Cheiron: possible with VisualVM ? I would like to have something that dump the size of a data structure during the runtime to the log

16:39 sritchie: alex_baranosky: hey dude

16:39 you around?

16:39 alex_baranosky: AoE… talk after :)

16:42 sritchie: alex_baranosky: cool

16:45 alex_baranosky: sritchie: what's up?

16:45 sritchie: was just taking a look at clj-schema, good stuff

16:45 I'm writing a thrift parser in clojure --

16:45 wingy: It says that (fn) is a special form .. looking at the source I see it's using (defmacro) .. so special forms can be macros?

16:45 sritchie: was going to ask if you thought it made sense to build the clojure AST for thrift as a clj-schema

16:46 alex_baranosky: that'd be useful because we could go directly from a clj-schema (with some limitations) to thrift, without the whole idl parsing stage

16:46 or clj-schema -> protobuf

16:47 alex_baranosky: sritchie: neat. Let's talk about that

16:47 sritchie: sounds good

16:47 alex_baranosky: not this second though, busy

16:47 sritchie: AoE, get 'er done

16:48 Raynes: alex_baranosky: You asked about stripping trailing slashes in Compojure last night.

16:48 alex_baranosky: There is a piece of middleware in lib-noir for that.

16:48 alex_baranosky: rayes: yep. I stole it from there :), thanks for looking out for me though

16:49 Raynes: Ew.

16:49 I wish people wouldn't 'steal' small pieces of middleware. Just depend on the darn library.

16:49 You'd think Clojure was javascript or something!

16:50 dnolen: if anyone has some free cycle could someone confirm that println doesn't work w/ browser-repl anymore?

16:51 cemerick: speaking of which, making sure we don't break browser-repl is a good candidate for browser automation ;)

16:51 S11001001: Raynes: "no dependencies" is a virtue for some reason

16:53 cemerick: dnolen: Quite. I've been building automated tests that run browser-side and are driven through a browser-repl. The bits under that could probably be factored out into something that could be used to verify browser-repl generally.

16:53 dnolen: cemerick: that would be awesome to get that into CLJS

16:54 cemerick: er, well, nREPL over piggieback and browser-repl, so perhaps that's not suitable

16:54 s/over/with

16:55 dnolen: cemerick: honestly the most minimal thing would be sweet - I don't know selenium well enough to know to tackle this myself quickly. but our command line tests aren't enough, it's easy to break browser-repl and we don't test it at all.

16:55 cemerick: oh, I'm not using selenium

16:55 dnolen: cemerick: what do you use? phantomjs?

16:56 cemerick: goodness no; clojure.test assertions on values returned by evaluating expressions browser-side with nREPL

16:56 All the JS-oriented testing libs/frameworks looked absolutely horrific.

16:57 emezeske: cemerick: All phantomjs is is a headless webkit browser

16:57 brehaut: “All the JS-oriented libs/frameworks looked absolutely horrific.” FTFY

16:57 tomoj: :D

16:58 dnolen: cemerick: so you wrote some scripts to launch the browser and all that?

16:58 emezeske: cemerick: E.g. phantomjs is nice for running browser-side tests without launching a big GUI, etc

16:59 cemerick: dnolen: well, the JVM can open a url in a browser.

17:00 emezeske: Sure; I don't remember all the project names. At the moment, I don't mind closing the test browser tab that gets popped up when my tests finish.

17:01 emezeske: cemerick: Yeah, I wouldn't say phantomjs offers a huge advantage, developing on your workstation. It can be handy for running on CI servers and stuff, though.

17:01 cemerick: Sure. Someday soon.

17:03 It's actually been quite handy to have the option to twiddle away at the js state halfway through a test suite sometimes.

17:03 emezeske: For sure -- when a test fails, you almost certainly want access to the JS console

17:03 cemerick: brehaut: good catch, goof on my part

17:04 bugger the JS console, I want my REPL. :-)

17:04 emezeske: Well, phantomjs will run your REPL just fine!

17:04 :)

17:05 cemerick: I like to see those DOM nodes a-twinkling

17:06 emezeske: The other features of modern browser dev tools are pretty un-live-withoutable too

17:06 tomoj: is there an easy way to get from "2.5" to 5/2 ?

17:06 cemerick: ,(rationalize 2.5)

17:06 clojurebot: 5/2

17:06 tomoj: eh, nvm, datomic doesn't have ratios (surprising)

17:06 wow

17:07 &(map (comp class rationalize) [5 5.0 5.5])

17:07 lazybot: ⇒ (java.lang.Long clojure.lang.BigInt clojure.lang.Ratio)

17:09 tomoj: &(rationalize (/ 1.0 3))

17:09 lazybot: ⇒ 3333333333333333/10000000000000000

17:10 tomoj: expected, but I guess (rationalize (Double. s)) should never do that?

17:28 Baldanders: So I'm trying to use Leiningen 2 with noir. Leiningen can't seem to find a couple of jars- the org.mortbay.jetty jars. I'm not that familiar with Maven or Leiningen, but I'm wondering if there is something else I should be doing.

17:35 jsabeaudry: Baldanders, can you pastebin your project.clj?

17:35 Baldanders, many people are using noir with lein2 so we know it can work

17:40 Cheiron: clojurebot: if you can make a God bleed, people will cease to believe in him

17:40 clojurebot: hello? in vacation?

17:41 emezeske: Hmm, Jesus bled, and people still believe the heck out of him

17:42 Baldanders: http://pastebin.com/XaKK0MBR

17:42 Raynes: emezeske: AFAIK he wasn't considered a God.

17:43 Baldanders: It's just what was create by running "lein new noir pman"

17:43 emezeske: Raynes: Depends on the flavor of Christianity.

17:44 Baldanders: Also, it often takes hours for lein to get things from the maven repos. I started getting noir last night, and wound up leaving it running overnight in the office... same thing happened this morning when trying to do lein run.

17:44 Can I just find the two jars it is looking for and put them in the cache directory?

17:44 emezeske: Baldanders: Looks like noir 1.3.0-beta10 is the latest

17:45 Baldanders: Yes- seems like 1.2.1 won't run with leiningen 2, or at least with older Clojures, because of a change in the way dynamic variables are handled.

17:45 Ah, I see...

17:46 OK, this is what leiningen created when doing lein new noir- should I edit it to use 1.3.0-beta10?

17:47 I tried that and it is currently trying to get a later version of jetty from the maven repos. Will probably take a while.

17:47 emezeske: Baldanders: I don't know if it will help, but given that it's a beta, you probably want the latest one (bugfixes, etc)

17:47 Baldanders: Not a magic bullet, but a place to start.

17:49 Baldanders: OK, thanks. Since it seems to take hours to get jars from maven even when they are found, is there something else I can do? Like figure out the dependencies on my own and go looking for the jars myself, and put them in Leiningen's cache directory?

17:49 hiredman: http://www.infomercialcentral.com/store/files/images/d_77.jpg

17:49 clojurebot: magic bullet is http://www.infomercialcentral.com/store/files/images/d_77.jpg

17:49 emezeske: Baldanders: For reference, "lein deps" on my machine, with a ton of deps, usually takes at most under a minute

17:49 hiredman: clojurebot: ping

17:50 emezeske: hiredman: :P

17:50 Baldanders: Are you on a satellite link or something?

17:50 Baldanders: Aha. Well it has been taking hours every time leiningen has needed to get jars from the maven repos on my machine.

17:50 No, the connection is fast. But the amount of time I am seeing would be very, very slow even over a 14.4k modem.

17:51 emezeske: Baldanders: Unfortunately I don't know much about maven, etc. But I can say that what you're experiencing is not normal.

17:53 Baldanders: Thee is this issue on Leiningen: https://github.com/technomancy/leiningen/issues/534

17:53 But it seems as if at the time it was resolved by adding mirror support.

17:54 emezeske: Huh..

17:56 wingy: i can tell now that JoY should _not_ be the first book of clojure :)

17:57 it's a great source when you know the basics from other books

17:57 emezeske: wingy: JoC*

17:57 wingy: yeah

17:57 emezeske: For the record, I thought it was an excellent first book of clojure

17:57 wingy: lol

17:57 emezeske: To each his own, though

17:58 wingy: emezeske: did you have lisp knowledge before that book?

17:58 emezeske: wingy: Not a bit.

17:58 thorbjornDX: I want to pmap a function that includes a 'spit to file', I'm going to hit an I/O cap pretty quickly, right?

17:59 emezeske: wingy: I had a tiny bit of haskell knowledge (basically just working through Learn you a Haskell for Great Good)

18:00 thorbjornDX: map/pmap are not really meant for I/O operations

18:00 wingy: emezeske: i think i read this one as the first book .. someone here told me to drop it and read programming clojure programming instead

18:01 thorbjornDX: emezeske: understood. Am I better off doing the writes sequentially, or are they both going to be slow? The file output is the final thing I do in the code, so doing it in a pmap doesn't really affect me

18:02 emezeske: wingy: More reading can only help! :)

18:03 thorbjornDX: Writing to disk is a fairly serial thing, particularly with rotating media you probably will hurt performance by doing a bunch of scattered writes in parallel

18:03 thorbjornDX: I guess things may be different with flash, though

18:05 thorbjornDX: emezeske: gotcha, I'm pretty sure there's a few spinning platters somewhere down the layers

18:07 wingy: emezeske: agreed

18:07 emezeske: thorbjornDX: YMMV, of course -- I can only give general hints. The proof is in the profiling :)

18:10 jamii: Is this expected behaviour?

18:10 strucjure.test> (defrecord Foo [])

18:10 strucjure.test.Foo

18:10 strucjure.test> (class #strucjure.test.Foo{})

18:10 clojure.lang.PersistentArrayMap

18:11 Bronsa: looks like a bug to me

18:11 user=> (defrecord a [])

18:11 user.a

18:11 user=> (a.)

18:11 #user.a{}

18:11 user=> #user.a{}

18:11 {}

18:17 devth: if i have a macro in one namesapce: (defmacro ensure-config [body] `(when (every? identity *config*) ~@body)) ;;; how do i ensure that *config* is eval'd in the namespace that the macro is used (not defined)?

18:28 emezeske: devth: What you want to do is called "unhygienic", and is generally frowned upon. However, you can probably make it happen with ~'*config*

18:28 devth: ah, i was trying #'*config

18:29 yeah, familiar with hygienic macros, just experimenting

18:29 emezeske: Cool, I just felt like it needed a disclaimer :)

18:29 devth: i *always* forget the correct quote/unquote/splice usage

18:29 cool. thanks.

18:29 emezeske: Experiment away!

18:35 unnali: devth: you can see why it happens like that here: http://clojure.org/reader (search for "Syntax-quote" in the body)

18:38 devth: unnali: makes sense. thanks.

18:41 Sgeo: "A shorthand version allows the metadata to be a simple symbol or keyword, in which case it is treated as a single entry map with a key of :tag and a value of the symbol provided, e.g.:"

18:41 I don't think that's accurate

18:41 ,(meta ^:foo :bar)

18:41 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>

18:41 Sgeo: ,(meta ^:foo 'bar)

18:41 clojurebot: nil

18:41 Sgeo: hrm

18:42 unnali: ,(meta ^:xyz {})

18:42 clojurebot: {:xyz true}

18:43 Sgeo: ,(meta ^:abc ^:xyz {})

18:43 clojurebot: {:abc true, :xyz true}

18:43 unnali: ,(meta ^String {})

18:43 clojurebot: {:tag java.lang.String}

18:44 Apage43: lei

18:44 ack

18:44 wrong window =P

18:46 tgoossens: clojure.core/destructure what is it fore exactly?

18:47 dnolen: tgoossens: not meant to be used directly really.

18:47 Raynes: It is used internally for destructuring.

18:47 tgoossens: ok

18:47 i was just wondering how internally let and loop did their bindings

18:48 dnolen: tgoossens: yes, they do use clojure.core/destructuring

18:48 tgoossens: what is a good way to do the following

18:48 i have a string

18:49 unnali: Sgeo: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L724

18:49 * Sgeo should start reading that file again, it's fun

18:50 tgoossens: and i want to define a collection with "replacements" for characters. For example: a must be mapped on b, c must be mapped on d.

18:50 eventually this will happen with clojure.string/replace

18:50 Sgeo: ,(meta ^'blah {})

18:50 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map>

18:50 Sgeo: ,(meta ^blah {})

18:50 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: blah in this context, compiling:(NO_SOURCE_PATH:0)>

18:50 tgoossens: now the one way mapping is not really the problem

18:50 Sgeo: Oh

18:50 ,(meta ^"blah" {})

18:50 clojurebot: {:tag "blah"}

18:50 tgoossens: i want it to happen in both ways

18:50 unnali: ,(let [x 'x] (meta ^x {}))

18:50 clojurebot: {:tag x}

18:51 tgoossens: so that i can do the reverse replacements

18:51 unnali: reader has trouble with ^'x

18:51 i guess because you're really saying ^(quote x), and it doesn't like that.

18:51 Sgeo: ,(meta ^{:honk "honk"} ^{:honk "HONK"} {})

18:51 clojurebot: {:honk "honk"}

18:51 unnali: associativity!

18:53 tgoossens: i don't understand what you did

18:55 emezeske: tgoossens: ##(apply str (map {\a \b \b \c} "aaabbb"))

18:55 lazybot: ⇒ "bbbccc"

18:55 emezeske: ##(require 'clojure.set)

18:55 lazybot: ⇒ nil

18:55 emezeske: tgoossens: ##(apply str (map (clojure.set/map-invert {\a \b \b \c}) "bbbccc"))

18:55 lazybot: ⇒ "aaabbb"

18:55 tgoossens: wow

18:56 emezeske: tgoossens: Is that sort of what you're talking about?

18:56 tgoossens: i'm digesting what you typed one sec :D

18:57 i don't understand what happens here (why does it what it does?)

18:57 ,(map {\a \b \b \c} "aaabbb")

18:57 clojurebot: (\b \b \b \c \c ...)

18:58 emezeske: tgoossens: A map is a function of it's keys

18:58 tgoossens: ##({:foo "bar"} :foo)

18:58 lazybot: ⇒ "bar"

18:59 tgoossens: yes correct

18:59 oooh

18:59 i get it :D

18:59 emezeske: :)

18:59 tgoossens: cool

18:59 emezeske: Of course you don't have to use a map, that was just my example

18:59 tgoossens: but i'm not quite sure that will do what i want

18:59 the problem is

19:00 i'm using (read-string

19:00 to read data like

19:00 "(grep (ls -la))" (more info here: http://tgoossens.wordpress.com/2012/10/20/funix-enhancing-the-linux-terminal-by-thinking-functional/)

19:01 (note that the code on my blogpost is already outdated, will update it tomorrow)

19:01 the problem is

19:01 sometimes i get a string like this:

19:01 (ls ~)

19:01 (ls Documents/)

19:01 and clojure doesn't accept those symbols

19:01 so i "encode" them

19:02 \" -> $quot

19:02 ~ -> $tilde

19:02 clojurebot: Titim gan ?ir? ort.

19:02 tgoossens: which are valid symbols for the reader

19:02 unnali: clojurebot: wow.

19:02 clojurebot: Cool story bro.

19:02 tgoossens: and at the end

19:02 i decode

19:03 wingy: are (next) and (rest) the same except that the former returns nil and the latter '() when there are no more elements?

19:03 tgoossens: but currently the decode and encode functions must be specified apart

19:03 i want them to use a single collection/mapping which can be used in both ways

19:04 emezeske: I see

19:04 unnali: wingy: there's a difference in forcing the tail seq, I think.

19:05 emezeske: tgoossens: FWIW: ##(apply str (map #({\" "$quot" \~ "$tilde"} % %) "hello\"world~"))

19:05 lazybot: ⇒ "hello$quotworld$tilde"

19:05 emezeske: tgoossens: But that won't work in reverse, because $quot and $tilde are not single characters

19:05 unnali: wingy: (let [x (next (cons 1 (lazy-seq (do (print "hi") '(5)))))] 'ok)

19:05 => hiok

19:05 emezeske: tgoossens: You'd have to do something more fancy to reverse it.

19:05 unnali: (let [x (rest (cons 1 (lazy-seq (do (print "hi") '(5)))))] 'ok) => ok

19:05 tgoossens: :p

19:06 unnali: wingy: to be more precise, (rest (cons 1 (lazy-seq …))) returns a clojure.lang.LazySeq; (next …) forces the seq into a PersistentList (or whatever)

19:06 tgoossens: I have to go now (unfortunately). if you suddenly have a great idea on how to do it. Please post it as a comment so I can still read it :)

19:07 emezeske: tgoossens: Sure

19:07 tgoossens: Good luck with it.

19:07 wingy: unnali: a bit too hard for me to get atm .. ill think about it

19:07 tgoossens: thanks! It's not that important project, but nevertheless a good exercise for myself. I really am starting to like clojure

19:07 unnali: wingy: the question is if you want to force the potentially lazy seq or not.

19:08 * Sgeo is unsure, but decode/encode as a single function sounds Prolog-ish

19:19 nonrecursive: hi all - I'm using cemerick's friend and trying to hash a password but it returns a different result every time

19:19 if I do (cemerick.friend.credentials/hash-bcrypt "password") then I get a different string every time the function is called

19:19 it seems like that just started happening… is that expected?

19:19 unnali: nonrecursive: I'd imagine so.

19:20 it'd be using a random salt each time.

19:20 nonrecursive: https://github.com/cemerick/friend/blob/master/src/cemerick/friend/credentials.clj

19:21 it generates a salt, so it changes each time.

19:21 creds/bcrypt-credential-fn does a check, apparently used with cemerick.friend/authenticate.

19:21 so I guess there's some builtin mechanism to do authentication

19:22 Iceland_jack: > Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power.

19:22 nonrecursive: unnali: thanks. it looks like for some reason the authentication is failing

19:22 unnali: nonrecursive: I suspect something else is afoul, then.

19:22 Iceland_jack: nonrecursive: you should read up a bit on bcrypt before using it, that was from the Wikipedia page

19:23 nonrecursive: Iceland_jack: cool. I really don't know anything about these hashing algorithms

19:23 Iceland_jack: very good suggestion :)

19:23 unnali: thanks for the help

19:23 Sgeo: Does helping out in #clojure count as résumé-able?

19:23 Iceland_jack: Cryptography is notoriously tricky to get right

19:24 unnali: Sgeo: I'd say sure.

19:24 Sgeo: ##1 ##2 ##3 just want to see if bot does these in order

19:25 brehaut: ##(identity 1) ##(identity 2) ##(identity 3)

19:25 lazybot: (identity 1) ⇒ 1

19:25 (identity 3) ⇒ 3

19:25 xeqi: nonrecursive: are you using bcrypt-credential-fn as part of :credential-fn ?

19:25 unnali: "sometimes, if at all"

19:25 brehaut: i think the paren is part of the syntax

19:25 nonrecursive: xeqi: I am

19:26 Sgeo: What happened to 2?

19:26 brehaut: Raynes: your bot is weird

19:26 if i were to guess, i would blame regexps

19:27 xeqi: is your user finding part in it returning a map with {:username .. :password .. } ?

19:27 * Sgeo realizes that #(do %) is a nice short way to spell identity

19:27 Sgeo: Still better to actually use identity of course, clearer etc.

19:27 brehaut: in this case do wins

19:28 but do is a macro / special form

19:28 you cant pass it to something

19:28 nonrecursive: xeqi: yep it is

19:28 amalloy: brehaut: good guess

19:28 Sgeo: brehaut, but #(do %) is lambda syntax, so that form is a function, which you can pass to things

19:28 ,(map #(do %) [1 2 3])

19:28 clojurebot: (1 2 3)

19:28 nonrecursive: I wonder if the salt is changed every time the server is restarted?

19:29 brehaut: ah sorry , i misread

19:29 seancorfield: having a weird problem with lein-expectations - it seems to be running all the expectations twice (in concurrent threads) - not sure what recent library change has caused this... :(

19:29 Sgeo: Erm, inaccurate to say that the form is a function, I guess, but it evaluates to a function

19:30 unnali: nonrecursive: it's a new salt on every execution!

19:30 nonrecursive: unnali: ah right, right

19:31 unnali: heh yeah I realized that as soon as I wrote that :P

19:31 unnali: :D

19:31 nonrecursive: the password checking works in a repl so something else must be the problem

19:32 yehohanan7: Hello, I am a new to clojure, I am trying to learn clojure by writing a clojure wrapper for mongodb java driver. here is the code -https://github.com/yehohanan7/tikvah/blob/master/src/com/tikvah/info/mongo/core.clj can anyone have a quick look at it and let me know if its idiomatic?

19:32 xeqi: nonrecursive: are you including session middleware?

19:32 nonrecursive: xeqi: I am - this was working earlier in fact

19:33 oh man

19:33 I think I will need to slap my head

19:33 d'oh

19:34 I changed the :login-uri so authentication wasn't even being attempted

19:34 thanks xeqi unnali and Iceland_jack!

19:36 yehohanan7: Basically my query would look like : (-> (store "dbname") (collection :products) (scan :having [[:_id :eq "12345"]]))

19:36 nonrecursive: sorry for your trouble!

19:42 dnolen: ohpauleez: http://dev.clojure.org/jira/browse/CLJS-359, I think you're simple patch is OK

19:43 ohpauleez: dnolen: ok, excellent - glad to see that fix getting through

19:43 dnolen: ohpauleez: metadata on top level defs are always stored in cljs.analyzer/namespaces - your patch would address runtime metadat

19:43 ohpauleez: we can't optimize that case really since we won't have that information at runtime.

19:45 ohpauleez: dnolen: I can make a formal patch out of it for you

19:45 dnolen: ohpauleez: excellent

19:49 ohpauleez: dnolen: I also have some core.logic cljs patches for you in the pipeline

19:49 dnolen: ohpauleez: SWEET

19:50 ohpauleez: core.logic on node.js for scripting apps has been both amazing and a struggle :)

19:51 gfredericks: how much code-sharing is there between core.logic on jvm vs js?

19:56 dnolen: this should knock down CLJS compile sizes a bit http://github.com/clojure/clojurescript/commit/97e5fbd1e1597d58be35fd8320c8044ccc9d3a3d :) thanks to bendlas``

19:57 gfredericks: none

19:57 gfredericks: would love to fix that - esp now that core.logic is significantly larger than it was

19:57 gfredericks: feature expression can't come soon enough in my opinion

19:58 ohpauleez: whoa :) COOL

19:58 emezeske: bendlas``, dnolen: grazie!

20:07 SegFaultAX: What are some good Clojure message queues?

20:10 technomancy: SegFaultAX: rabbitmq, hornetmq, redis

20:10 redis if you want simplest, hornet if you want the option to run it inside the jvm, rabbit if you want all kinds of crazy knobs

20:10 SegFaultAX: technomancy: I'm thinking of a specific one. It was actually a job queue. The jobs were just clojure forms.

20:11 metellus: agents?

20:11 SegFaultAX: Basically Resque for clojure.

20:11 technomancy: die roboter is built on top of rabbit

20:11 dnolen: ohpauleez: so what's pushing you to leverage Node.js in this case?

20:11 SegFaultAX: technomancy: That's the one.

20:12 ohpauleez: dnolen: I'm trying to build up ClojureScript's scripting story

20:12 I have a git-backed text-based ticket tracker - only requirement is node, written in CLJS

20:13 and supports a datalog-like search query

20:13 dnolen: ohpauleez: nice, so just trying to see what does and doesn't work from Node.js point of view?

20:13 ohpauleez: using githooks, all your ticket operations are automated - everything happens in-band

20:13 dnolen: ohpauleez: sounds cool

20:14 ohpauleez: dnolen: Exactly - just want to get it to a place that I can confidently pick it up and write a quick scripted app

20:15 I'm also trying to unify core.contracts, test.generative and Alloy - but we'll see how far I get ;)

20:15 (alloy is - http://alloy.mit.edu/alloy/index.html)

20:17 dnolen: ohpauleez: I encountered Alloy a while back - seems interesting though I never dug enough to really understand what it was about.

20:17 SegFaultAX: Regarding nginx -> tomcat, why does this example use a location for different filetypes instead of just routing all requests via `location /`?

20:17 dnolen: ohpauleez: I recall some folks mentioning KodKod on the Clojure ML 2-3 years ago?

20:17 SegFaultAX: http://serverfault.com/questions/293348/configure-nginx-for-jboss-tomcat

20:18 ohpauleez: Eiffel uses its contracts to perform "auto test" - I want to use the specs to drive test.generative automatically. I want to then enhance the contracts to support more relational assertions, and make use of Alloy to say, "No, there's a flaw or hole in the collections of 'specs' "

20:19 So if you use core.contracts you get test.generative for free; You get system/spec checking for free

20:19 dnolen: Ah, thanks for the hint, I'll go digging around for it

20:19 tomoj: whoa, I hadn't heard of core.contracts

20:20 dnolen: ohpauleez: interesting seems related to some of the abstract interpretation of contracts work that people are working oe?

20:20 on

20:20 ohpauleez: definitely

20:21 tomoj: wonder why not "with-contracts"

20:22 gfredericks: tomoj: it has some sort of (apply-contracts! ...) function?

20:22 tomoj: I mean why "with-constraints"

20:22 gfredericks: oh nm

20:22 * gfredericks looks up core.contracts

20:23 gfredericks: yeah that's pretty weird

20:24 tomoj: it makes me think contracts are a subset of constraints

20:24 which may be true?

20:24 dnolen: ohpauleez: AutoTest literature looks pretty interesting

20:25 ohpauleez: dnolen: For sure, I've been spending a couple of weeks now with Alloy, DynAlloy, Behavioral Programming, and Eiffel literature - AutoTest is a cool piece I'd love to steal ideas from

20:26 Sgeo: Oh cool there's a contracts system for Clojure?

20:26 ohpauleez: Sgeo: Clojure functions be default support pre and post conditions

20:26 dnolen: ohpauleez: CiaoProlog literature is pretty relevant - perhaps not the Prolog aspect, but how much power they get of abstract interpretation of assertions

20:26 ohpauleez: but Fogus' Trammel contracts system, moved to core.contracts a little while ago (and merged in some updates from a smaller contracts lib)

20:27 Sgeo: ,((fn [] {:pre false} 5) nil)

20:27 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval27$fn>

20:27 ohpauleez: dnolen: Thanks for the tip, I'm looking now

20:27 Sgeo: ,((fn [] {:pre false} 5))

20:27 clojurebot: 5

20:27 Sgeo: :(

20:27 ,((fn [] {:pre false :post false} 5))

20:27 clojurebot: 5

20:27 Sgeo: :(

20:28 dnolen: ohpauleez: there's a lot to wade through, lemme see if I can find the interesting slide set

20:30 ohpauleez: http://clip.dia.fi.upm.es/papers/RuleML11_slides.pdf, the dynamic vs. static slides are relevant

20:30 ohpauleez: Sgeo:

20:30 ,((fn [] {:pre [false]} 5))

20:30 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.AssertionError: Assert failed: false>

20:30 Sgeo: aha

20:30 ohpauleez: dnolen: Awesome! thanks!

20:31 Sgeo: Needs to be a vector of assertions

20:32 dnolen: ohpauleez: yeah cool stuff, rich assertion language - assertion based verification & automatic testing

20:32 ohpauleez: the kind of thing that I would love to have in Clojure

20:33 ohpauleez: that's exactly what I'm going for

20:33 me too

20:34 I would love to bundle my assertions into contracts, and then just say, "go" - getting test.generative and an Alloy verification for free (or some form of verification)

20:34 And it certainly seems possible, but I'm still surveying the literature

20:35 Sgeo: Oh great, now I have a new programming language to be interested in

20:37 Then again, having a community is important to me..

20:40 doomlord: join #lisp

20:42 Sgeo: doomlord, uh... oh, you intended to /join #lisp I guess?

20:42 gfredericks: I read it that he was recommending the #lisp community

20:42 Sgeo: gfredericks, me too at first

20:42 doomlord: hah both

20:43 clojure is my favourite lisp so far

20:43 i just tried writing some schme (gimp plugins) and sorely missed [..]

20:44 Sgeo: Ciao doesn't look like a lisp

20:44 It looks like a variant on Prolog, I think

20:44 doomlord: i can head over to #lisp to troll them about how good { } and [ ] are

20:44 Sgeo: heh

20:44 doomlord: the reaction is quite severe:)

20:44 Sgeo: "This produces an executable called hello in Un*x-like systems and hello.cpx under Win32 systems."

20:44 ...I .... wat.

20:45 doomlord: i was just trying to write some gimp plugins.. i think the world needs an embedded superset of scheme with [] and {} and clojures' other sugars

20:45 to drop into that project

20:46 Sgeo: How about Scheme with Clojure data structures and functions?

20:46 Nice functional-style programming

20:46 I think I can live without the sugar, but nice functions are nice

20:46 doomlord: functional programming for image manipulation , it would suit gimp

20:47 dnolen: Sgeo: Ciao is not a Lisp. It's kind of a PL laboratory created by some Prolog people.

20:47 doomlord: i find clojures' fun-callable objects and [],{} and destructuring make it a lot more tolerable than other lisps

20:48 Sgeo: dnolen, how usable is it for .. real world stuff

20:48 dnolen: Sgeo: what does "real world" stuff mean? web apps?

20:48 Sgeo: dnolen, hmm, I guess. Also RIC bots

20:48 IRC

20:49 SrPx: Is clojurescript compiled to readable js? Like coffeescript?

20:49 dnolen: SrPx: no

20:49 SrPx: dnolen: thanks. It is interpreted?

20:49 dnolen: SrPx: no

20:50 SrPx: dnolen: hmm how then? Is it fast?

20:50 dnolen: Sgeo: it's an academic project so I'm sure you'll run into more issues than a more mainstream language for that kind of thing. But I don't really think that's the point anyhow.

20:50 SrPx: it provides facilities to achieve the performance of the host yes.

20:50 emezeske: SrPx: It's compiled to JS, but the readability of that JS is not optimized for

20:51 SrPx: dnolen: I see, so it's better not to trust in clojurescript for production yet?

20:51 dnolen: SrPx: if you compare a computationally intensive JS code w/ idiomatic ClojureScript code - ClojureScript will be considerably slower. But if you're touching the DOM - doesn't matter much. That's slow anyhow.

20:52 emezeske: SrPx: I run a production website built in ClojureScript, FWIW

20:52 dnolen: SrPx: plenty of people using it production. But yes it still has lots of rough edges. But everday we get more and more patches from more and more people.

20:53 SrPx: I see. Is it much different from Clojure? Can I build up a personal library of utilities that will work in both the browser/clojurescript and on clojure itself? At the same time

20:53 dnolen: SrPx: people have various hacks / workaround for that. I'm hopeful for a move on Feature Expressions (Clojure 1.6?)

20:54 SrPx: Feature Expressions?

20:54 dnolen: SrPx: conditional compilation based on whether you're targeting CLJS or CLJ

20:55 SrPx: http://dev.clojure.org/display/design/Feature+Expressions

20:56 SrPx: Hmm I'm not sure I like that. Is not it simpler just to implement every function working the same way on both sides?

20:56 dnolen: SrPx: most functions will be the same yes

20:57 SrPx: you don't need Feature Expressions for that

20:57 Sgeo: dnolen, I was recently interested in Prolog, so this might interest me

20:57 SrPx: dnolen: where exactly does the code have to change, then?

20:58 emezeske: SrPx: For instance, the (ns) form supports different features between CLJ and CLJS

20:58 dnolen: SrPx: it just depends, host-y interop, macros - difference in namespace format

20:59 SrPx: the point of Feature Expressions to account for the minor annoying differences.

20:59 is to account

21:01 wingy: why isn't this true

21:01 ,(every? #(= % " ") " ")

21:01 clojurebot: false

21:01 pandeiro: there is no html->hiccup tool is there?

21:01 dnolen: ,(seq " ")

21:01 clojurebot: (\space)

21:01 dnolen: ,(every? #(= % \space) " ")

21:01 clojurebot: true

21:02 dnolen: ,(seq " a ")

21:02 clojurebot: (\space \a \space)

21:02 wingy: was an error on a presentation then

21:02 thx

21:02 unnali: wingy: not really; " " is a sequence consisting of one space, \space is just the space

21:03 wingy: it's like asking if every element of the list [3] is the list [3]; not quite

21:03 dnolen: wingy: that's actually true in CLJS since there's no real Character type there.

21:04 wingy: got it

21:04 dnolen: SrPx: annoying differences like what I just said

21:05 wingy: unnali: i meant there was a slideshare presentation that used my original one

21:05 unnali: wingy: oh! I see. mea culpa; misunderstood "presentation"

21:06 Sgeo: dnolen, the Ciao docs are only going to go over stuff in Ciao and not Prolog, I assume?

21:06 SrPx: dnolen: hmm

21:06 dnolen: gotta run

21:15 hyPiRion: Heh.

21:15 ,(= \ \space)

21:15 clojurebot: true

21:17 jcromartie: is there any way to recover from (read-line) in SLIME?

21:18 oh I see

21:18 swank.core/with-read-line-support

21:19 ivan: http://www.advogato.org/article/1067.html RedHat is doing an ARM64 OpenJDK port

21:21 Sgeo: ,\0

21:21 clojurebot: \0

21:21 Sgeo: ,\)

21:21 clojurebot: \)

21:22 Urthwhyte: pandeiro: I believe I saw one over on r/clojure last weekend, but I may be misremembering

21:24 amalloy: pandeiro, Urthwhyte: the H2H library that was on /r/clojure is the worst project i've ever seen. strongly recommend not using it

21:24 Urthwhyte: pandeiro: https://github.com/runexec/H2H

21:25 amalloy: I wouldn't touch it, just mentioning it's out there

21:25 amalloy: also, hiccup forms aren't actually easy to work with except for emitting html directly. parsing html to hiccup won't make you happy

21:25 Urthwhyte: It didn't seem very robust. Too close to the code I understand ;)

21:26 I don't really understand the appeal of it for exactly that reason

21:26 jcromartie: is there a way to read a single character from stdin in the REPL?

21:26 in "lein repl"

21:29 java -jar $(lein classpath) clojure.main

21:29 yay

21:29 no BS

21:30 Girls_Escort: Porn SEx Girls http://fredfilms.blogspot.com

21:30 jcromartie: not that I don't appreciate the stuff lein does for the REPL

21:30 but lein repl tends to make for some odd behavior around stdin/stdout

21:31 s/-jar/-cp/

21:34 amalloy: jcromartie: lein trampoline repl

21:37 jcromartie: amalloy: thanks

21:45 TimMc: hyPiRion: All the long-name characters: ##(filter #(< 2 (->> % pr-str count)) (map char (range 0 256)))

21:45 lazybot: ⇒ (\backspace \tab \newline \formfeed \return \space)

21:48 gfredericks: ,(->> 256 range (map char) (filter #(->> % pr-str count (< 2)))) ;; all threading all the time

21:48 clojurebot: (\backspace \tab \newline \formfeed \return ...)

21:51 gfredericks: &(map char (range 8))

21:51 lazybot: ⇒ (\

21:51 gfredericks: ha

21:52 ,(map char (range 8))

21:52 clojurebot: (\

21:52 gfredericks: fascinating; my repl prints (\ \ \ \ \ \ \ \)

21:54 hyPiRion: TimMc: heh, fascinating.

22:03 amalloy: gfredericks: when something funky display-wise comes up like that, i'm always tempted to say "gosh, what do you mean, what you just pasted looks the same as what clojurebot said a minute ago on MY terminal"

22:06 gfredericks: hunter2

22:11 jcromartie: :)

22:11 Urthwhyte: ls

22:11 lazybot: bin boot data lib lost+found media proc sbin selinux src sys tmp

22:12 TimMc: haha

22:12 Urthwhyte: hah

22:12 I think that's a bug ;)

22:12 amalloy: feature!

22:13 lazybot likes to make fun of you for thinking #clojure is your repl

22:13 er, your shell

22:14 Urthwhyte: I seem to be making a habit of gaffs like that today in #clojure

22:14 xeqi: pwd

22:14 lazybot: #clojure

22:14 gfredericks: sudo su

22:14 hostname

22:14 unnali: gfredericks: `sudo su' considered broken; consider `sudo -i' or `sudo -s'

22:15 considered harmful*, damnit. i can't even troll properly.

22:15 jcromartie: lazy-seq is guaranteed to only evaluate the body once when it is needed, right?

22:15 not ahead of time

22:15 gfredericks: yeps

22:15 jcromartie: and not more than once

22:15 unnali: jcromartie: correct?

22:15 gfredericks: jcromartie: probably almost certainly

22:15 jcromartie: :)

22:16 combining blocking I/O with lazy-seq

22:16 gfredericks: I don't think that's too radical

22:18 Urthwhyte: oh, I had a laziness question - is slurp?

22:18 gfredericks: slurp returns a string

22:18 Urthwhyte: I assume it's a wrapper around reader and the answer is no

22:18 gfredericks: strings can't be lazy

22:19 Urthwhyte: ah, that would make sense

22:19 gfredericks: ~haskell

22:19 clojurebot: "you have to see features like that in the context of Haskell's community, which is something like Perl's community in the garden of Eden: detached from all shame or need to do any work." -- ayrnieu

22:20 Urthwhyte: Also makes me realise a few other misconceptions, on further reflection

22:20 (inc reasons-to-love-irc)

22:20 lazybot: ⇒ 1

22:21 gfredericks: ~haskell

22:21 clojurebot: "you have to see features like that in the context of Haskell's community, which is something like Perl's community in the garden of Eden: detached from all shame or need to do any work." -- ayrnieu

22:21 gfredericks: :(

22:21 clojurebot: you need more variety

22:21 clojurebot: Excuse me?

22:21 Urthwhyte: clojurebot: He said you need more variety

22:21 clojurebot: No entiendo

22:22 gfredericks: ~botsmack

22:22 clojurebot: botsmack is headdesk

22:23 * gfredericks shakes his fist at clojureql

22:27 amalloy: ~monads

22:27 clojurebot: monads are http://okmij.org/ftp/Scheme/monad-in-Scheme.html

22:27 amalloy: aw, i was hoping for a shrimp- or endoburrito-themed joke

22:27 shachaf: monads moproblems

22:30 technomancy: jcromartie: latest lein master should fix most issues around stdin

22:56 TimMc: clojurebot is the destroyer of hope

22:57 gfredericks: TimMc: don't tell him that

23:07 jcromartie: I'm trying to figure out how to separate a state machine output on transition from actual i/o

23:08 it's not really a FSM

23:08 but FSM+metadata, I guess not really finite then

23:08 vilonis: clojurebot destoys hope?

23:14 Sgeo: Hmm.

23:14 Work on some bindings to a Java library in Clojure that in all liklihood, I will be the only use of?

23:14 Or work on code for my Senior Project?

23:16 jcromartie: Sgeo: I have a hard time doing anything but writing Clojure :|

23:16 even when it's completely pointless

23:16 maybe it's a sign

23:16 I need to do "real work" in Clojure now

23:16 or else I'll never get anything done again

Logging service provided by n01se.net