#clojure log - Aug 06 2013

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

0:03 diphtherial: hey, can i have leiningen installed for both windows and cygwin at the same time? it seems they both use the profile's .lein directory, and i'm concerned that they'll conflict

0:10 apparently not, thankfully; i ran lein in the ~/bin directory after adding it to the path and it seems like things worked out ok...

0:11 verified, lein is now usable both from cygwin and the standard windows command prompt

0:56 Foxboron: using vim-fireplace, trying to eval code but the only thing i get is "ClassCastException java.lang.Character cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:214)"

0:57 i can't seem to find any reasonable explenation why as it works in lein repl, but not inside vim

1:00 zeroem: offending code?

1:01 Foxboron: impossible, evaling (def test "hello world")

1:01 zeroem: oh

1:01 erm

1:02 one sec, installing fireplace

1:05 hrm

1:05 worked fine for me

1:05 everything up to date?

1:06 I'm using Lein 2.2, clojure 1.5.1

1:06 and I just grabbed fireplace from git

1:07 Foxboron: just pulled the latest changes, but no luck

1:07 i did however test with another project, and it works

1:08 so obviously something i have fucked up now

1:08 clj_newb_2345: fireplace is awesome

1:08 I like fireplace

1:09 Raynes: It's warm and cozy, ain't it?

1:11 Foxboron: zeroem: rmed the dir and made a new project.

1:11 suddenly it works

1:11 zeroem: when all else fails, start over, right?

1:12 Foxboron: or force push.

1:12 solved every problem possible

1:49 futile: crap

1:49 ive gone insane.

1:49 dangit

1:50 and on a day like this!

4:13 clgv: I have a problem with using data_readers.clj, the function specified for a tagged literal is initialized as Unbound but it remains Unbound even after requiring the implementation namespace

4:26 ro_st: is it possible to stop clojure's pr-str / println / pprint from including commas?

4:26 clgv: how is data_readers.clj supposed to work if it interns all specified functions as clojure.lang.Var$Unbound and requiring the implementation namespace does not replace Unbound with the actual implementation???

4:26 lazybot: clgv: How could that be wrong?

4:31 tomjack: clgv: /shrug works for me

4:31 clgv: tomjack: you got a minimal example?

4:31 I tried with plain leiningen

4:32 tomjack: gist is down :(

4:32 clgv: refheap?

4:32 clojurebot: refheap is gist

4:32 clgv: ~gist

4:32 clojurebot: gist is http://gist.github.com/

4:32 clgv: lol

4:32 refheap.com

4:33 tomjack: https://www.refheap.com/0695892d84b594cbea1e04ccd

4:34 you're not trying to use a tagged literal inside ns, are you? :>

4:35 clgv: no.

4:41 tomjack: well if I do not require the implementation namespace in the file it does not work when requiring it manually in repl

4:42 tomjack: before requiring the function symbol is set to Var$Unbound and after that as well

4:44 tomjack: you need to require it before starting the repl

4:44 if you want to test it in the repl you will have to read-string

4:44 clgv: why?

4:44 clojurebot: Why is why

4:44 tomjack: hmm

4:45 I'm full of shit

4:45 clgv: if that is really a requirement, it is even more impractical that the implementation namespaces are not loaded

4:45 tomjack: maybe that is true, maybe it isn't, I don't know

4:46 clgv: I should be able to redefine the function as any other function in the repl. but it seems not like it

4:47 tomjack: hmm

4:47 I just tested at the repl, seemed to work

4:47 clgv: I tested in a fresh project...

4:48 tomjack: I happened to have a data reader sitting around in this project that I forgot about

4:49 https://www.refheap.com/aa4c65ba3d60c7595dd09f9cb

4:50 I'm in swank /blush, no clue if that matters

4:51 clgv: damn I had a typo in the fresh project, so it did not work there but now works. so bug search in the real project... :(

4:53 oh found the typo in the real project... :/

5:02 cemerick: squidz: Thanks, glad it's working out for you. :-)

5:06 noidi: cemerick, thanks for doing the austin screencast. austin looks very promising, I can't wait to try it out!

5:06 cemerick: I hope it lives up to expectations :-)

5:13 shdwprince: oh, debuging macroses is completely horrible

5:14 maybe there is some useful tools, not only macroexpand?

5:14 ro_st: macroexpand-1 ? :-)

5:14 also, do as much of the work in normal functions as you can

5:15 shdwprince: ro_st: I'll bet there is solution for indenting macroexpand output :)

5:15 supersym: how do I remove the outside parens of a form? e.g ([a b c][d e f]) so I remain with the inner part?

5:15 ro_st: very often macros can be tiny wrappers around otherwise normal functional code

5:15 supersym: with code or in emacs?

5:15 supersym: newb question, can't for the love of god figure it out, must still be half sleeping

5:15 with code

5:15 flatten is for inner

5:15 ro_st: what do you want it to look like afterwards?

5:16 [a b c d e f] ?

5:16 supersym: (syntax-quote ...) from backtick only takes a single form so I have to wrap it

5:16 ofc I can do first, rest map over it

5:16 ro_st: ~@ unwraps seqs

5:16 clojurebot: seqs and colls is http://www.brainonfire.net/files/seqs-and-colls/main.html

5:16 shdwprince: ~@ in macroses should expand (a b c) into a b c

5:16 ro_st: in macros

5:16 supersym: was just wondering if there is a function for it

5:16 ah

5:16 its a defn atm still

5:16 explains

5:16 shdwprince: sypersym, that function should return 3 results, or,.. syntax?

5:17 ro_st: what data structure do you want to end up with?

5:17 ,(apply concat [[1 2] [3 4] [5 6]])

5:17 clojurebot: (1 2 3 4 5 ...)

5:18 supersym: ah

5:18 thnx

5:42 schmir: I need to import two classes with the same name from two different namespaces. can I somehow use :import with :as or something like that..?

5:43 clgv: schmir: that's a missing feature I guess

5:50 schmir: looks like I can use the fully qualified name for that...

6:02 muhoo: weird, why would friend/authenticate only work BEFORE compojure.handler/site, and not after it?

6:03 when using context in compojure, that is.

6:03 if i don't use context, i can stick wrap-authenticate way at the end of the chain, and wrap-authorize anywhere before it

6:04 but if i've got context up in the mix, then it has to be (-> app wrap-~authorize wrap-authenticate handler/site)

6:07 sorry (-> app handler/site (friend/wrap-authorize #{::stuff}) friend/authenticate) works, but if i've got context in there, handler/site must come after friend/authenticate

6:09 Raynes: muhoo: You be workin' the late shift homeboy.

6:09 muhoo: yeah, deadlines and committments

6:09 Raynes: Well, 'fraid my ability to help you ended as soon as you said 'friend'

6:09 ro_st: cemerick is around, muhoo

6:10 Raynes: I forgot that cemerick was a morning person.

6:10 muhoo: i'll try him in the am east coast time

6:10 Raynes: This is the AM east coast time, muhoo.

6:10 muhoo: means, like, in a few hours

6:10 cemerick: is this not AM?

6:10 Raynes: muhoo: It's 6AM. cemerick gets up this early.

6:10 muhoo: ah, there he is

6:10 Raynes: I know it's wild, but it happens.

6:10 cemerick: Raynes: dude, been cranking for 2 hours.

6:11 Raynes: I haven't even slept yet, man.

6:11 Albeit it's only 3AM here, but still.

6:11 muhoo: anyways, i'm baffled by something that maybe if i had sleep would make more sense

6:11 cemerick: muhoo: friend requires various ring middlewares; the order of application matters

6:12 Raynes: Sounds like I'm a solid 12 hours ahead of you, then ;-)

6:12 muhoo: i've noticed that. and it appears authenticate does not like being at the end of the chain, if context is uses at the beginnign of it.

6:13 cemerick: muhoo: authenticate establishes the scope of friend's control; if you put stuff outside of that scope, then friend can't do much about that :-)

6:13 muhoo: that's why i'm having heartburn over this

6:13 i want to put authenticate at the end, to secure the WHOLE app

6:13 but it hates that. it insists on being before handler/site.

6:13 ONLY if i have some context routes though. if i pull out context, then i can stick authenticate at the end.

6:13 cemerick: muhoo: handler/site isn't any part of your app

6:14 muhoo: handler/site is compojures stock wrappers

6:14 cemerick: yeah, I'm aware

6:14 muhoo: and i have other stuff like wrap-file-info, wrap-resource, etc, after handler/site

6:14 hmmm, maybe i can stick those before handler/site.

6:15 i dunno, what bothers me is the voodoo nature of this; just moving stuff around without understanding why it works or doesn't makes me.... uncomfortable

6:15 cemerick: muhoo: well, don't do that, then :-P Determine what each middleware requires, or not, and place them appropriately.

6:15 They're not meant to be shuffled willy-nilly.

6:16 muhoo: indeed. i vaguely remember someone working on some kind of dependency management for ring middlewares

6:16 cemerick: yeah, nREPL has a similar system for its middlewares that automates all this

6:16 muhoo: ah, that's right, it was nrepl not ring.

6:17 cemerick: muhoo: short rule of thumb: handler/site or handler/api is *always* last/outer, followed by friend, then contexts, then your actual bare ring handler/routes

6:18 muhoo: ok, it's coming back to me now. because handler/site has things like wrap-query-params that friend will need, i.e. for reading user/password info out of posts, etc

6:18 cemerick: If you have other middlewares that are strictly transformative (most are), then putting them between handler/site and friend generally makes sense

6:18 muhoo: thanks, i think i'm back in reality now.

6:19 btw that austin thing looks very cool, will play with it as time permits

6:20 cemerick: sounds good :-)

6:40 muhoo: ok, everything cool now with friend and compojure. next, i will have to integrate friend with https://github.com/cmiles74/bishop . after some sleep first though :-)

6:42 noidi: ambrosebs, is the new HMap syntax documented somewhere? (:mandatory, :optional, :complete?)

6:42 ambrosebs: noidi: maybe... :) I'll have a look.

6:44 noidi: doesn't look like it. I'll update the types wiki.

6:46 noidi: ambrosebs, thanks

6:47 ambrosebs: noidi: I was thinking of making a clojure.core.typed/HMap var with some doc metadata.

6:49 noidi: that's a good idea

6:50 ambrosebs, is there a way to tell core.typed that the map should not contain extra keys beyond the ones listed in the type definition?

6:51 ambrosebs: yes HMap takes a set of keywords with the :absent-keys option.

6:51 oh

6:51 :absent-keys is saying these particular keys don't occur, but :complete? true says "there are no more entries".

6:53 noidi: (t/cf {:foo 123, :bar 456} (HMap :mandatory {:foo Long}, :complete? true))

6:53 ;= (HMap :mandatory {:foo Long} :complete? true)

6:54 ambrosebs: that's a bug

6:54 noidi: ok

6:54 ambrosebs: I'll write up the docs then I'll fix that :)

6:54 noidi: great, thanks!

7:00 clgv: ambrosebs: how much of clojure.core can you cover with core.typed now (approximately)?

7:02 ambrosebs: clgv: do you mean unchecked types?

7:03 harja: In Fireplace's documents it says that it should autoconnect to nREPL when Leiningen is in use. In practice this never happens, I have to type in :Connect nrepl://localhost:<port> if I want to connect

7:03 What am I doing wrong?

7:03 clgv: ambrosebs: rephrased: what are the critical open problems atm?

7:04 ambrosebs: clgv: I don't think there are any gaping holes left.

7:04 clgv: ambrosebs: oh. interesting.

7:05 ambrosebs: clgv: perhaps metadata. There's half assed support there currently.

7:06 clgv: nothing crazy though.

7:06 clgv: ambrosebs: ok. so I probably should try it out on one of my projects...

7:07 ambrosebs: clgv: I'm sure there's many little issues waiting to be found, but no showstoppers. It's a good time to start using core.typed.

7:07 harja: never mind, I guess reinstalling leiningen did something to fix it. now it works.

7:08 andrewmcveigh|wo: harja: I'm no expert with fireplace, but I had the same issue. Ensure that the file $project-dir/target/repl-port is being created, and that it has the port number in it.

7:08 ... oops, too late.

7:08 ambrosebs: clgv: what kind of project are you thinking of checking?

7:08 clgv: ambrosebs: just private ones. I have a small website scraper which might be a good start

7:09 ambrosebs: clgv: cool

7:09 clgv: but interesting for the features around checking maps

7:09 ambrosebs: is there any (blog) article you'd suggest for starting?

7:11 ambrosebs: clgv: I don't think there's much out there. My fault.

7:12 There's the official docs, that gives a start

7:12 https://github.com/clojure/core.typed/wiki/User-Guide

7:12 clgv: ok. I just thought I ask since for other libs there are often several blog posts introducing them^^

7:13 noidi: ambrosebs, a feature request: when typechecking fails for a map's value, I'd like the error to be reported for the value (mentioning the value type's alias) and not the outermost map

7:13 (that might not make much sense so I'll give an example)

7:14 suppose I have an object like {:foo {:bar {:baz 123}}}, and corresponding type aliases Foo, Bar and Baz

7:14 and a type alias M for the whole map

7:14 if baz's value has an incorrect type, currently core.typed reports that {:foo {:bar {:baz 123}}} is not of type M

7:15 while I'd want it to tell me that 123 is not of type Baz

7:16 ambrosebs: noidi: hmm. I'll have to think about (how to do) that.

7:20 noidi: I don't think that would make sense if you had an expected type like (U M N O P). You'd have to just pick a random union member, and there might be multiple errors per member..

7:21 My suggested solution if you ever get stuck like this is to use ann-form to do some static debugging.

7:21 Keep annotating inner maps until something blows up that you recognise.

7:22 noidi: makes sense, thanks

7:22 ambrosebs: np

7:23 clgv: I'm very actively on the mailing list and developing core.typed, so don't hesitate to query.

7:24 clgv: ambrosebs: ok thanks. :)

9:00 Anderkent: heh, the error when you get docstring order wrong is very useful :P

9:00 ,(ns "docstring?" foobar)

9:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

9:00 Anderkent: no line information obvsly

9:00 clgv: they usually are^^

9:11 harja: argh "goog.require could not find: clojure.browser.repl"

9:12 does someone have ideas on how to fix that?

9:14 ro_st: nothing on the google?

9:14 chrisrossi: speaking of error output, is there an easy way to produce stack traces that leave out the java frames?

9:14 it can be kind of a pain searching the strack trace for the few clojure frames.

9:15 ro_st: chrisrossi: you might want to look at the source of https://github.com/jaycfields/expectations

9:15 it culls java and clojure lines from straces when presenting output

9:15 kmicu: https://github.com/mmcgrana/clj-stacktrace

9:15 ro_st: or that :-)

9:16 that still prints all the lines though

9:17 chrisrossi: the former functionality would be great if it were packaged independently from a unittest framework.

9:18 i suppose if i get ambitious i can steal that code and package it separately.

9:18 harja: ro_st: nope :(

9:19 kmicu: Do not use that word here.

9:19 harja: How you get it?

9:21 Refheap your project.clj

9:27 harja: kmicu: https://www.refheap.com/c1221b89bb65ec1b773e01524

9:27 wakeup: hi all

9:27 supersym: hello :)

9:28 wakeup: Whats clojures pendant to REMOVE-DUPLICATES?

9:28 clgv: wakeup: distinct

9:28 ro_st: or set

9:28 wakeup: but I cant pass it a test function?

9:28 clgv: ,(distinct [1 1 2 1 3 3 1 5])

9:28 clojurebot: (1 2 3 5)

9:29 clgv: no. it is based on sets not on comparison functions

9:31 hyPiRion: hm

9:31 ,(distinct [1.0 1 1.0 1])

9:31 clojurebot: (1.0 1)

9:31 harja: I solved that error by just requiring clojure.browser.repl in my cljs-script

9:31 however, now the error is "Cannot call method 'appendChild' of null "

9:31 in goog.net.xpc.CrossPageChannel

9:38 ah, that code needed to be at the body, it did not have a parent element when I included the script in head...

9:51 tbaldridge: wakeup: perhaps group-by?

9:51 ,(group-by pos? [0 1 2 3 4 5 6])

9:51 clojurebot: {false [0], true [1 2 3 4 5 ...]}

9:52 tbaldridge: ,(group-by even? [0 1 2 3 4 5 6])

9:52 clojurebot: {true [0 2 4 6], false [1 3 5]}

9:52 tbaldridge: that's better

9:53 ,(group-by (partial / 4) (range 10))

9:53 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

9:53 tbaldridge: ,(group-by (partial / 4) (range 1 10))

9:53 clojurebot: {1 [4], 4/5 [5], 2/3 [6], 2 [2], 4/7 [7], ...}

9:53 tbaldridge: okay, nevermind, I was trying to show more than one group

9:56 hyPiRion: ,(group-by #(mod % 3) (range 10))

9:56 clojurebot: {0 [0 3 6 9], 1 [1 4 7], 2 [2 5 8]}

9:59 gavri: how do I reduce a map to get the map entry with the smallest number as its value?

10:01 tbaldridge: , (reduce #(min %1 (second %2)) {:a 1 :b 2 :c 3})

10:01 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to java.lang.Number>

10:02 tbaldridge: ack, scratch that

10:02 , (reduce min (vals {:a 1 :b 2 :c 3}))

10:02 clojurebot: 1

10:02 hyPiRion: ^

10:02 gavri: that just gives me the value, doesn't it?

10:02 I'd like the corresponding map entry

10:02 specifically, I'd like the key

10:03 hyPiRion: ,(reduce (partial min-key val) {:a 1 :b 2 :c 3})

10:03 clojurebot: [:a 1]

10:03 gavri: thanks, hyPiRion and tbaldridge

10:04 noncom: hi, is there any (time) function that returns simply a double of ms, without printing anything to the console?

10:04 kmicu: ,(reduce (partial min-key val) {:a 1 :b 2 :c 3 :d 1})

10:04 clojurebot: [:d 1]

10:16 stuartsierra: noncom: not built-in, but easy to write with System/currentTimeMillis

10:17 noncom: yeah, no problem

10:33 wakeup: what are the requirements for IS (clojure.test) to be not ignored?

10:33 gfredericks: ignored by what?

10:34 wakeup: I don't know

10:34 kmicu: ;]

10:34 wakeup: I have a function which loops over randomly generated test values and checks them with IS

10:34 so far so good, only they don't show up when I run lein test

10:34 tbaldridge: wakeup: code?

10:35 gfredericks: wakeup: are you using deftest?

10:35 wakeup: unless I wrap the function call with (is (= (distinct (test-func))

10:35 ...

10:36 The test is defined using deftes, but the test itself calls the function which uses IS repeatedly

10:36 tbaldridge: wakeup: that should be fine

10:36 wakeup: I can see how the architect of the test suite fucked this up, what I don't understand is why it works when I wrap the call with said code

10:36 tbaldridge: wakeup: are you sure you aren't returning a lazy seq that isn't getting relized?

10:36 wakeup: but for iunstance not if I just wrap it with an IS

10:37 tbaldridge: distinct would realize the lazy seq...

10:37 wakeup: ah

10:37 of course

10:37 ok

10:37 is there some idiom for ensuring stuff is evaluated?

10:37 tbaldridge: what you can do is wrap it in dorun or doall

10:38 wakeup: ah ok

10:38 tbaldridge: yeah, it's odd at first, but after a time, using lazy seqs in this way will start to give you a

10:38 wakeup: whats the difference between dorun and doall?

10:38 gfredericks: wakeup: doall returns the seq

10:39 tbaldridge: dorun returns nil

10:39 gfredericks: wakeup: my preferred method is to use doseq instead of map

10:39 tbaldridge: so doall keeps the entire seq in memory, dorun will throw parts of the seq away as it goes.

10:39 gfredericks: I don't like combining map with side effects, and clojure.test/is is a side effect

10:40 wakeup: I am mapping over (keys ...) now it complains its result isn't a vector and thus can't be used with doseq

10:40 gfredericks: doseq has different syntax

10:41 (doseq [k (keys ...)] ... do something with k)

10:41 tbaldridge: doseq is like a foreach

10:41 wakeup: ah

10:41 like CL's DOLIST

10:42 thanks for the help

10:42 TimMc: tbaldridge: I don't think doseq holds the head.

10:42 Sorry, misread.

10:42 tbaldridge: no

10:42 *np

11:29 ambrosebs: noidi: just pushed 0.1.22, with lots of fixes for HMap. Docs: https://github.com/clojure/core.typed/wiki/Types

11:32 noidi: 0.1.21 rather

11:40 wakeup: is there an easy way to use org.apache.commons.codec.binary.Base32 with leinigen?

11:41 llasram: wakeup: In what sense?

11:41 wakeup: I'd like to :import it and add it to :dependencies?

11:42 have leinigen figure out where to fetch the source?

11:42 gfredericks: if you can find its maven coordinates

11:43 TimMc: Find the Maven coordinates of the Apache Commons project on http://search.maven.org/

11:44 then put the [group/artifact "version"] in your project.clj's :dependencies vector.

11:45 gdev: I always try lein search first because then you can let that run while you get a cup of coffee and come back and there it is

11:47 noidi: ambrosebs, looks good!

11:47 ambrosebs: noidi: cool!

11:47 llasram: gdev: I think the most-recent (or next?) release of Leiningen includes significant improvements for `lein search`

11:47 noidi: ambrosebs, you're missing a question mark at the end of the keyword here: "Finally, :complete says that there are no further entries in this map."

11:47 ambrosebs: thx

11:48 gdev: llasram, aww so it's going to break my workflow?

11:49 llasram: gdev: Yep! You can always write your own `lein frobnicate` plugin which just spins the CPU for a bit though

11:57 gdev: lein goldbrick, prints random quotes from bladerunner in a format that looks like a dependency (i.e Downloading tell-me-about-your-mother "1.0.1 RC1" from feux-maven-central...)

11:59 llasram, seriously though that sounds exciting

12:00 with lein search and lein-try together you can ramp up an experimental repl in no time

12:02 zerokarmaleft: gdev: or just delete lein's index every time you want a cup of joe

12:03 but a plugin specifically for being lazy seems to be the more elegant solution

12:04 dnolen: tbaldridge: any chance of fixing the core.async set! bug, I think that's the last locals related thing that's really busted.

12:07 tbaldridge: dnolen: yeah, I have a fix in mind, I'm traveling later today, so I'll see if I can't whip it out while waiting on the plane

12:07 dnolen: tbaldridge: sweet!

12:28 ddellacosta: how do you reference instance properties of a Java object within a proxy call?

12:28 oh, seems like you can't maybe: "Note that while method fns can be provided to override protected methods, they have no other access to protected members, nor to super, as these capabilities cannot be proxied."

12:28 hmm

12:54 mikerod: ,(list? (cons 'a '(1 2)))

12:54 clojurebot: false

12:54 mikerod: This came somewhat a surprise to me.

12:55 ,(list? (list* 'a '(1 2)))

12:55 clojurebot: false

12:56 TimMc: Yeah. :-(

12:57 dnolen: mikerod: IPersistentLists have guarantees that Cons does not.

12:58 TimMc: dnolen: TRWTF is that list* does not return a list?.

12:59 dnolen: TimMc: who uses list*?

12:59 TimMc: *shrug*

12:59 It's a public fn in core.

13:00 mikerod: dnolen: I can accept that. I still can't say I expected that. However, list* not being a list?, that's a bit of a stretch. I know that list* isn't necessarily popular.

13:00 gfredericks: dnolen: I use it a lot

13:00 especially in any macro where I'm avoiding backtick for some reason

13:02 technomancy: list? is bad =(

13:02 dnolen: gfredericks: right, but then you'd probably use seq? anyway

13:02 technomancy: #(and (counted? %) (seq? %)) is much clearer

13:03 gfredericks: dnolen: sure, I'm not complaining about list? I'm just saying that I use list*, since you asked :)

13:04 I should add this to my nonexistent list of gotchas though

13:05 dnolen: technomancy: you would also need to check ISequential, IPersistentStack, ICollection etc

13:07 mikerod: Yes, I am going to avoid using list? anymore.

13:08 ,(list? (concat '(1 2) '(3 4)))

13:08 clojurebot: false

13:10 shdwprince: &(type (concat (list 1)))

13:10 lazybot: ⇒ clojure.lang.LazySeq

13:11 shdwprince: &(type (list 1))

13:11 lazybot: ⇒ clojure.lang.PersistentList

13:11 shdwprince: (seq? (concat (list 1)))

13:11 &(seq? (concat (list 1)))

13:11 lazybot: ⇒ true

13:13 shdwprince: Someone knew tools for debuging macroses? Something like indenting macroexpand output?

13:14 *knows

13:14 dnolen: shdwprince: some dev envrionments do this for you.

13:14 shdwprince: dnolen: currenly my dev environment is REPL

13:15 dnolen: shdwprince: you can use clojure.pprint

13:19 shdwprince: dnolen: thanks, forgot about it

13:20 ro_st: dnolen: how do you cope with raw javascript in your day job?

13:21 if i was you i'd be itching to use Cljs instead :-)

13:22 dnolen: ro_st: I don't mind raw JS for simple stuff, which is what I usually to write. Less fun as the problem scope grows.

13:24 ro_st: do you see Cljs making its way into your day job at some point?

13:40 callen: ro_st: that's like asking a grad student how their thesis is going. Kinda rude.

13:40 unless you're intentionally trying to produce a Hnnnnggggg reaction.

13:41 dnolen: ro_st: just depends on the project. I introduced CoffeeScript here 2 1/2 years ago, so it's not outside the realm of possibility.

13:44 ro_st: one things that's missing for me is a sensible CLJS templating solution. I'd like to see something innovative in this area - like something adaptive, string building for initial render, individual element update otherwise.

13:48 ro_st: callen: i'm merely curious. dnolen is doing phenomenally awesome things with cljs and i think it'd be a pity if he didn't get to use it on his day job, is all :-)

13:50 callen: dnolen: we're considering making Selmer CLJS compatible.

13:50 dnolen: http://github.com/yogthos/Selmer/

13:50 re: templating

13:51 dnolen: callen: I'm not interesting in a traditional templating system - I want a tunable rendering pipeline

13:51 template should produce some that leads toward that goal

13:51 callen: Selmer was designed around server-side rendering at scale, so you'll have that I suppose.

13:51 dnolen: s/some/something

13:52 callen: yeah not interested in that, client side rendering is what I'm talking about

13:52 callen: anything along the lines of an incremental templating system for the frontend that I've considered has led me to say "just use AngularJS"

13:52 or, two-way binding in the abstract.

13:52 dnolen: callen: AngularJS is busted in too many ways

13:52 callen: dnolen: such as?

13:53 ddellacosta: dnolen: super interested in a new CLJS templating solution. Have been talking with my boss about something that does partial evaluation of functions, ending up with simple str concat functions

13:53 dnolen: callen: no real notion of modularity or time

13:53 callen: ddellacosta: dommy is the vanilla choice.

13:53 tbaldridge: dnolen: have you taken a look at the custom template engine in Pedestal? It seems like it would be a bit closer to what you are looking for

13:53 callen: dnolen: that doesn't really prevent you implementing things with it. It's a philosophical objection not an engineering one with concrete implications.

13:53 dnolen: tbaldridge: but is it all client side?

13:53 callen: ddellacosta: dommy is nearly isomorphic with Hiccup AFAIK

13:53 tbaldridge: dnolen: yes

13:53 dnolen: callen: there's also nothing else I like about AngularJS

13:53 bhauman: i really like the solution proposed by webfui and pedsetal

13:53 cemerick: my tinkerings with react have been surprisingly pleasant; have gotten much further than I ever did with angular, FWIW

13:53 ddellacosta: callen: yeah, we're not even at the point where we are *using* CLJS templates, so not sure what we'll move to. We have to really think about optimization first, since we are supporting older browsers

13:54 callen: ddellacosta: gad help you.

13:54 ddellacosta: callen: yeah, when we get to that point I'll ping ya. ;-)

13:54 dnolen: tbaldridge: interesting I should take a look at, but I'm really interested in something highly tunable

13:54 tbaldridge: i.e. different render strategies should be simple to insert

13:55 tbaldridge: if there's a global render strategy then I'm not interested

13:55 callen: ddellacosta: you can ping me besides anyway. but sounds good.

13:55 ddellacosta: callen: haha, thanks.

13:55 bhauman: dnolen: there is no global render strategy only a global difference strategy

13:55 tbaldridge: dnolen: when I last worked with it there wasn't a strategy, it's more based on the idea of a kv store, when you render things they are given ids, you can the replace those items using templates and those same ids

13:56 dnolen: that being said, you're talking to the guy who hates UI design, and works on compilers for fun, so I could be making most of this up :-P

13:57 dnolen: tbaldridge: does it let you identify initial render vs. incremental updates? note I'm also not convinced about the diff stuff, for some applications you'll want need to work with faster data structures.

13:58 ro_st: dnolen: it dovetails with the app model's deltas, such as :node-create (initial) and :value/:attr (incremental)

13:58 tbaldridge: dnolen: the render engine of Pedestal is completely detached from the dataflow stuff. So it's possible to use one without the other.

13:59 dnolen: ro_st: ok I should look at it, I'm also turned off because I only care about client side - looking a Pedestal docs there a lot of other stuff to consider.

14:00 bhauman: dnolen: I played around with it for three weeks and never touched the backend

14:00 dnolen: bhauman: ok cool

14:00 bhauman: dnolen: didn't need a backend at all

14:01 ro_st: yeah. it's also very easy to simulate a backend if you'll need one later

14:01 bhauman: dnolen: even so I'm not sure I am advocating it

14:01 tbaldridge: dnolen: the thing I thought was cool, was that it allows you to mark up your html with extra attributes. That html then gets cut up into CLJS functions where the custom attributes are the arguments to the function

14:02 ro_st: yes. and those attribs are used both when rendering from template and when updating the live dom

14:02 tbaldridge: I don't know if it's the best way either, but I like it better than any of the other clojure template libs I've worked with.

14:02 Anyone here ever worked with XAML in .NET, now that's what I want. It had warts (tons of them), but it blows the clojure stuff out of the water.

14:03 bhauman: tbaldridge: i think the rendering part of pedestal is straight from clojurescript one

14:03 tbaldridge: bhauman: yeah, could be

14:13 `fogus: I think it re-purposes the CLJSOne rendering, but it's not tied to it right?

14:13 ro_st: correct. rendering is isolated to a place where you respond to 6 kinds of delta across whatever topics you define

14:14 :node-create :node-destroy :value :attr :transform-enable :transform-disable. last two govern when event handling is enabled/disabled, and what those events do

14:14 you could render ascii, swing, html, whatever you please

14:15 bhauman: `fogus: that's correct

14:16 dnolen: bhauman: would it be simple to coalesce render updates a la my 100,000 updates example?

14:16 that's the other bit I'm interested in which a a lot of JS MVC eff up

14:17 justin_smith: is there a straightforward way to plug an environment property into project.clj without using environ?

14:17 I mean java property, not shell environment var (though I guess I could use either)

14:17 bhauman: dnolen: I am assuming that you are thinking about different processes rendering into a render pipeline

14:18 dnolen; pedestal really doesn't do that

14:18 llasram: justin_smith: You can specify properties via the appropriate command-line arguments in :jvm-opts

14:19 justin_smith: yes, but lein-beanstalk wants properties to be in either .lein/init.clj or project.clj

14:19 we don't want passwords in the repo, so in project.clj is out

14:19 the same tool builds many projects, so init.clj is out

14:20 I want the var in the command line to end up in project.clj where lein-beanstalk wants it

14:21 or maybe I can make lein-beanstalk look at a jvm property instead of the project.clj / init.clj?

14:21 bhauman: dnolen: you could coordinate at an abstract application state level though quite easily {:button1 :disabled}

14:21 technomancy: justin_smith: you can have a profiles.clj file that you don't check in, or you can unquote.

14:21 justin_smith: unquote? as in start project.clj with `(defproject ...)

14:22 technomancy: justin_smith: defproject has an implicit ` already

14:22 justin_smith: or is there an implicit syntax quote and I qould just put ~

14:22 technomancy: or you can use read-eval

14:22 justin_smith: ahh

14:22 cool!

14:22 thanks

14:22 technomancy: #=(System/getenv "YEAH_WHATEVER")

14:24 callen: technomancy: the proper way to do app configuration :P

14:24 `fogus: dnolen: I don't think anything in Pedestal would prevent the kind of scenario that you want.

14:25 technomancy: callen: yeah, this plugin sounds a bit suspect

14:27 callen: technomancy: anything involving AWS is questionable.

14:29 technomancy: AWShucks

14:29 hiredman: software: the goal is not actively preventing people from doing what they want

14:30 justin_smith: is there a way to have a init-<app>.clj in ~/.lein that can be set up in project.clj?

14:31 technomancy: justin_smith: the goal of lein is to get out of the way during project execution

14:31 cemerick: justin_smith: use a profile?

14:31 futile: technomancy: thoughts on chicken scheme vs racket?

14:31 justin_smith: yeah, I probably want a profile

14:31 callen: futile: this is #clojure

14:32 futile: callen: and technomancy was talking about racket in here before, so why dont you direct your "shut up that's off topic" to him?

14:32 technomancy: futile: probably racket, unless you need to use a lot of C libs?

14:32 futile: technomancy: hmm good point

14:32 cemerick: justin_smith: just like the README says ;-)

14:32 futile: callen: /ignore'd, bye

14:32 technomancy: futile: it's pronounced "plonk"

14:33 futile: o, thx. never did /ignore before, dunno the ettiquette

14:33 *didnt know

14:33 squidz: cemerick: did you use react together with clojurescript?

14:33 justin_smith: cemerick: read a README? well I never! (in all seriousness, thanks)

14:33 dnolen: `fogus: yes, I was just trying to understand what pedestal contributes as far as tunable client side rendering pipeline - sounds like not too much :)

14:33 zenoli: It's been ages since I've seen a good, old-fashioned plonking.

14:33 nDuff: zenoli: you clearly don't spend much time in #bash

14:34 futile: anyone try out Nightcode seriously?

14:34 callen: http://en.wikipedia.org/wiki/Plonk_(Usenet)

14:34 technomancy: futile: I did finally write up an overview on my adventures with other lisps: http://technomancy.us/169

14:34 but the answer, as always, is "it depends"

14:34 futile: technomancy: I saw that a few days after you asked someone about racket in here, was a good read

14:34 zenoli: nDuff: I'll just keep hiding in #zsh.

14:35 futile: technomancy: although I think you were too gentle and forgiving to elisp

14:35 nDuff: zenoli: ...learning habits that get you in trouble as soon as you try writing POSIX-compliant scripts? Fair 'nuff, as long as you don't ever leave that corner of the world. :)

14:35 cemerick: squidz: Yeah, though I don't think that's notable. I wasn't using their wacky HTML-in-javascript preprocessor, if that's what you're after.

14:35 technomancy: futile: it's an interesting composition of the really terrible and unsurpassingly wonderful

14:36 squidz: yeah i was wondering what parts you used

14:36 futile: :D

14:36 technomancy: juxtaposition, I should say

14:36 zenoli: nDuff: My rule-of-thumb: if you think you've written a portable shell script, you haven't. I'll take my interactive improvements and suffer the consequences happily.

14:36 squidz: cemerick: why did it work better for you in the end in comparison to angularjs?

14:37 technomancy: zenoli: rule 7 of shell scripts: solaris users will yell at you.

14:37 there are no exceptions

14:37 futile: heh, comp and juxt used in English

14:37 nDuff: zenoli: Eh. There's "portable", and then there's "full of subtle bugs, as opposed to fail-fast ones".

14:37 cemerick: squidz: I dislike special semantics hiding in HTML's clothing. Just give me a data model, etc.

14:37 nDuff: zenoli: ...string-splitting during unquoted expansion will get you the former type.

14:38 cemerick: squidz: really, it's just the framework vs. library argument for the thousandth time. :-)

14:38 I've heard nothing but good things about angular from people that have embraced it. *shrug*

14:39 squidz: okay I see. I haven't seen it before until you mentioned it but was trying some stuff out with angularjs and was wondering what would be a better match with clojurescript. Maybe ill give it a try and see

14:40 ro_st: squidz: http://keminglabs.com/blog/angular-cljs-weather-app/

14:40 cemerick: squidz: lynaghk had a good post about angular + cljs a little while ago http://keminglabs.com/blog/angular-cljs-mobile-weather-app/

14:40 heh

14:42 muhoo: the single most annoying thing about hiccup, is that it seems un-possible to build up a vector and pass it to hiccup/html. i.e. (h/html [:p "foo] [:p "bar"]) works, but (h/html [[:p "foo"] [:p "bar"]]) does not, afaict

14:42 gdev: IMHO you should use whatever technology the business users are comfortable having their app written in

14:42 zenoli: technomancy: From my experience, I think they do that even if you haven't written a shell script.

14:43 ro_st: muhoo: what about (apply h/html [[] …])?

14:43 squidz: gdev: and if you are the only one in the project?

14:43 cemerick: I feel the phrase "business logic" coming on any second. ;-)

14:43 muhoo: ro_st: can you apply a macro?

14:43 technomancy: zenoli: hehe

14:43 ro_st: muhoo: oh. no.

14:43 gdev: squidz, i never have that problem

14:43 ToxicFrog: You can't? Ick

14:44 squidz: gdev: I wouldn't neccesarily call it a problem

14:44 muhoo: "business logic" reminds me of "military intelligence", etc

14:44 cemerick: "business logic" reminds me of PL/SQL and Oracle Reports.

14:44 muhoo: i think the word is "oxymoron"

14:45 hiredman: gdev: that is of ridiculous, right? letting problem space domain experts dictate choices to solution space domain experts?

14:45 zenoli: OK, at some point my emacs autocomplete started completing on Enter...it's horrible. I've unset C-m and \r in ac-completing-map and ac-menu-map. Where else do I need to stomp it?

14:45 hiredman: you don't tell your plubber what kind of pipes he should use

14:45 zenoli: Particularly annoying in nrepl.

14:45 hiredman: plumber

14:45 plubber

14:47 you are an expert on how much of a pain that leaky faucet is, so you should be able to tell your plumber what kind of gasket to use, right?

14:47 gdev: hiredman, well when your pipes are part of the porcelain you have to

14:47 cemerick: ,(apply #'dotimes nil nil '[[x 5] (println x)])

14:47 clojurebot: (clojure.core/let [n__4340__auto__ (clojure.core/long 5)] (clojure.core/loop [x 0] (clojure.core/when (clojure.core/< x n__4340__auto__) (println x) (recur (clojure.core/unchecked-inc x)))))

14:47 cemerick: ToxicFrog: ^^

14:48 gdev: enterprise politics, wish there was a library for dealing with that

14:48 Foxboron: So, i got a macro, and i want to assoc a value in the vector containing the args, what would be the propper way?

14:49 llasram: Foxboron: with `assoc`?

14:49 gfredericks: Foxboron: that's a little vague

14:50 Foxboron: llasram: i am unsure how to write it really. Example code would be awsome.

14:50 gfredericks: i know

14:50 gfredericks: Foxboron: I don't think it's obvious what you mean; could you provide an example macro call and expansion?

14:50 llasram: Foxboron: Well... how about you provide a gist showing the structure of what you want?

14:50 Yeah, what gfredericks said

14:53 hiredman: gdev: I am all for understanding the problem domain, but letting бизнес guys choose which technology they want is a horrible idea, and it is how you end up in a situation where someone can say "software is a fashion driven industry"

14:53 Foxboron: This isnt really that great of an explenation. I am just unsure how to really write the macro when i want to assoc anything into the vector before i return the list. http://hastebin.com/gakivohoqe.clj

14:53 i know how i want to write the bodt of the code, but it the args vector that bothers me

14:54 hiredman: the choice of software stack becomes not about solving problems but signalling in the market

14:54 Raynes: yogthos: I got a bone to pick with you.

14:54 hiredman: "we use rails, so we are cool"

14:55 llasram: Foxboron: ##(let [args '[some args]] `(defn any [~@(cons 'map args)] ))

14:55 lazybot: ⇒ (clojure.core/defn clojure.core/any [map some args])

14:55 llasram: Foxboron: Like that?

14:55 Foxboron: llasram: awsome, yes.

14:55 yogthos: Raynes: what's up :)

14:56 Raynes: what'd I do this time ;P

14:56 llasram: Or really: ##(let [args '[some args]] `(defn any [map ~@args] ))

14:56 lazybot: ⇒ (clojure.core/defn clojure.core/any [clojure.core/map some args])

14:56 llasram: Oh, right

14:56 hah

14:56 gdev: hiredman, agreed.

14:56 diphtherial: um, quick question about the clojure koans; do they assume that you're following some other reference, or are you just supposed to know/experiment enough to determine the syntax?

14:57 llasram: Foxboron: So that first symbol in that context should be gensym'd, unless you really want ti to be the literal name "map" (although that is unadvisable)

14:57 nDuff: diphtherial: they expect you to be using other references.

14:57 diphtherial: nDuff: ah, heh, great :) i got as far as sequence comprehensions and realized i didn't know enough about 'for' to proceed

14:57 thought i was being daft, thanks

14:57 fgh: a

14:57 Raynes: yogthos: Global atoms in selmer.

14:58 yogthos: I ought to pop you one, boy.

14:58 yogthos: Raynes: hehe oh that :)

14:58 muhoo: (map #(hiccup/html %)) ;; miserable hack

14:58 Foxboron: llasram: yes, i know. Was just unsure how to actually do the cons part :)

14:58 yogthos: mostly for configuration :)

14:58 justin_smith: technomancy: cemerick: yeah, creating a profile in my ~/.lein/profiles.clj did it cleanly, I had never really grokked profile usage before, thanks for the help

14:58 cemerick: np :-)

14:58 llasram: Foxboron: Cool beans

14:58 yogthos: I didn't really like it either, the other option would be to use a closure to initialize the renderer

14:59 Raynes: yogthos: In general though, you should really never have global atoms like this in a library. It can get bad real fast. Why not just pass in a configuration to the library? Let users give you the atoms. At that point your'e letting users have control of the state at least.

14:59 That's what I've always done with libraries that needed atoms/state/etc.

14:59 callen: a closure would be ugly and it'd still have to be a global.

14:59 yogthos: Raynes: that's actually not a bad idea

14:59 but I do like letting the user manage it

15:00 justin_smith: how do I programmatically access the value of a key in a profile? right now I am passing the credentials as a jvm system property while creating the uberwar, so that the uberwar can store the credentials for usage, and then providing the credentials via profiles.clj for deployment of that uberwar

15:00 diphtherial: ah, sorry for the excessive joins/parts...do people use lighttable as a main editor around here, or is it not quite there yet?

15:00 Raynes: yogthos: Perhaps you could store the atoms in metadata on something or something or something. Just some ideas.

15:00 diphtherial: if not, is there a preferred IDE?

15:00 callen: diphtherial: the most popular editor is Emacs

15:01 yogthos: Raynes: yeah for sure, I do agree it's kinda icky ;)

15:01 diphtherial: ok, makes some sense...closely followed by vim, i'm sure

15:01 callen: diphtherial: Eclipse + CounterClockWise is another popular choice as well as Vim + Fireplace.

15:01 justin_smith: it would be nice if project.clj could grab the value from the profiles.clj so that it could pass them to the aws environment config

15:01 nDuff: diphtherial: not that closely, no.

15:01 Raynes: Some people use Vim. I bounce around between Vim and Emacs when I get bored.

15:01 nDuff: Pretty closely.

15:01 callen: diphtherial: most people use Emacs, if you don't have any strong opinions, you should as well.

15:01 nDuff: diphtherial: I'm a vim user for every other language except Java, but emacs has a big enough advantage for Clojure that it's what I use here.

15:01 diphtherial: well, i don't mean to start a debate about it, heh

15:01 thanks for the information

15:01 nDuff: diphtherial: http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/

15:02 diphtherial: ah, that's helpful

15:02 llasram: Oh, time for cemerick to do another one :-)

15:02 Raynes: nDuff: That survey says that Vim is the second most used editor.

15:03 cemerick: llasram: that's what people keep saying :-|

15:03 nDuff: Raynes: ...with less than 1/3 the marketshare.

15:03 cemerick: I have no reason to believe that any of the results will be any different

15:03 Raynes: *shrug*

15:03 Vim has gotten a lot better for Clojure in recent memory thanks to tpope.

15:03 FWIW.

15:03 callen: but it's still a terrible editor.

15:03 Raynes: callen: Don't you use Vim?

15:04 callen: Raynes: occasionally.

15:04 nDuff: If it's getting close on nrepl and paredit support, it might be worth looking into again.

15:04 callen: Raynes: I use it for quick strikes against config files.

15:04 * cemerick can trace his vimming to Raynes' influence :-P

15:04 Raynes: nDuff: vim-fireplace uses nrepl and paredit has been there for a while now.

15:04 callen: Raynes: I check into the ecosystem occasionally and update my .vimrc as well.

15:04 nDuff: ...but I'm picky there -- couldn't tolerate the CCW or IntelliJ nrepl/paredit implementations either

15:04 callen: Raynes: that doesn't mean I think it's remotely close to Emacs in terms of usability or usefulness though.

15:04 nDuff: so not sure I want to try another not-all-there one.

15:04 Raynes: I mean, I like Emacs just as much as the next guy.

15:05 muhoo: subtle.

15:05 callen: muhoo: ?

15:05 ystael: I have a vague memory of people saying that extending protocols to interfaces is a bad idea. Can someone point me to an explanation?

15:05 technomancy: cemerick: the last State of Clojure survey still had huge slime numbers

15:06 callen: I'm still mad about losing slime/swank.

15:06 just because you landlubbers didn't get your Emacs legs.

15:06 technomancy: it's still there

15:06 * callen grump grump grump

15:06 callen: technomancy: sorta.

15:06 technomancy: use it

15:06 tbaldridge: * gets of callen's lawn *

15:07 callen: I'd rather improve nRepl even if I'm resentful about it.

15:07 clojurebot: Gabh mo leithscéal?

15:07 cemerick: technomancy: True. Maybe we can put the nail in the coffin.

15:07 nDuff: diphtherial: if you're looking for a curated editor configuration that has everything you need out-of-the-box, you might poke at Emacs Live. https://github.com/overtone/emacs-live

15:08 technomancy: cemerick: would be cool to measure the growth even if little else has changed =)

15:08 muhoo: personally, my life is massively pleasant with nrepl and i'm very glad it exists.

15:08 futile: So anyone tried Nightcode yet?

15:08 gdev: futile, yes, i like it a lot

15:08 futile: gdev: you don't miss paredit?

15:09 I thought I saw some mailing list post about a paredit plugin that fits in any editor.

15:09 It'd be cool if that integrates with Nightcode

15:10 technomancy: I heard nightcode is pretty modern

15:11 muhoo: fwiw, the brutal hack to make hiccup work was (->> [[:p "foo"] [:p "bar"]] (map #(hiccup/html %)) (apply str))

15:11 Raynes: God help you muhoo.

15:11 gdev: futile, yeah paredit and rainbow parens would be nice

15:11 Raynes: The problem with nightcode is that it's named nightcode.

15:11 gdev: futile, I'm sure that's something that could easily be added

15:11 futile: Raynes: while I don't usually care about names, I have found Nightcode difficult to type every single time I've had to.

15:11 No idea why.

15:12 gdev: :)

15:12 gdev: Raynes, yeah, pretty soon it'll be LightTable vs NightCode

15:12 Raynes: I highly doubt that. :)

15:12 futile: Is there something line lein-exec for clojurescript?

15:12 gdev: Light vs Night the great debate

15:12 futile: gdev: ha

15:12 mischov: Raynes: I just sing "Nightcoding nightcoding" to the tune of "Nighttiming"

15:12 technomancy: oss vs kickstarter monies

15:13 futile: maybe a better name would be "ClojureTextEditor"

15:13 gdev: technomancy, good point =o

15:13 muhoo: i stay as far away from IDE's as possible.

15:13 futile: https://github.com/sdegutis/ClojureTextEditor

15:13 technomancy: futile: that's stuartsierra's secret project, shhh

15:13 futile: ha

15:13 now i need to rename that repo

15:13 maybe "TextEditor4Clojure"

15:14 Raynes: Wolfhack.

15:14 stuartsierra: eh? wha?

15:14 callen: There are 143 text editors. There are no perfect text editors. I'll write a new one! There are now 144 text editors.

15:14 Raynes: Because everything cool has wolf at the beginning of it.

15:14 gdev: well my nieces are visiting next week to test out my "clojure4kidz" repl. will be interesting

15:14 futile: Owltext.

15:14 yazirian: clj-editjure

15:14 callen: stuartsierra: you were writing a text editor in Clojure.

15:14 Raynes: stuartsierra: Carry on. Nothing to see here.

15:14 stuartsierra: No I wasn't.

15:15 Raynes: yogthos: So, about that selmer. It looks pretty nice good work on it. Please don't put global atoms in lib-noir though. :P

15:15 technomancy: but if you were, that's what you'd call it, right?

15:15 callen: stuartsierra: you are now.

15:15 stuartsierra: YOU DUN BEEN VOLUNTEERED

15:16 stuartsierra: clojurebot: stuartsierra

15:16 clojurebot: stuartsierra is volunteering

15:16 stuartsierra: clojurebot: forget stuartsierra is volunteering

15:16 clojurebot: Ok.

15:17 bosie: why doesn't Reduce take more than one collection?

15:17 futile: clojurebot: futile

15:17 clojurebot: Pardon?

15:17 futile: clojurebot: futile is resistance is futile

15:17 clojurebot: You don't have to tell me twice.

15:17 futile: clojurebot: futile

15:17 clojurebot: futile is resistance is futile

15:17 futile: uhh

15:18 gdev: futile, circular reference

15:18 Raynes: Head explodes.

15:18 futile: :D

15:19 stuartsierra: bosie: Probably because reduce has different implementations for different collection types; it doesn't necessarily create a sequence.

15:19 bosie: stuartsierra: hm, wouldn't that still allow me to pass more than one of the same collection type?

15:20 stuartsierra: bosie: Theoretically, if it had been implemented that way. :)

15:20 bosie: stuartsierra: k thanks

15:30 hyPiRion: clojurebot: futile is <reply>resistance is futile

15:30 clojurebot: Roger.

15:30 hyPiRion: ~futile

15:30 clojurebot: resistance is futile

15:31 TimMc: clojurebot: forget futile |is| resistance is futile

15:31 clojurebot: I forgot that futile is resistance is futile

15:31 TimMc: ~futile

15:31 clojurebot: I don't understand.

15:31 TimMc: !

15:31 Oh, did hyPiRion's factoid overwrite futile's?

15:31 mattmoss: Resistance is a vegetable? Fruitless...

15:34 hyPiRion: TimMc: you made it forgot everything

15:35 ~futile

15:35 clojurebot: Huh?

15:35 futile: heh

15:35 mattmoss: ~derp

15:35 clojurebot: Gabh mo leithscéal?

15:35 hyPiRion: ~juxt

15:35 clojurebot: juxt is a little hard to grok but it's the best thing ever

15:36 gdev: should be able to give it a time instance so it will respond the way it knew to in that point in time

15:37 arcatan: 6

15:37 gdev: ~futile #inst "2013-08-06T13:00:00.666"

15:37 clojurebot: excusez-moi

15:40 konr: What cool clj/functional/programming podcasts are there besides the relevance one?

15:40 shdwprince: ~test

15:40 clojurebot: ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))

15:41 shdwprince: ~clojurebot

15:41 clojurebot: clojurebot is pretty cool

15:41 gdev: lol an square

15:41 shdwprince: ~shdwprince

15:41 clojurebot: I don't understand.

15:41 futile: wut

15:41 shdwprince: ~badass

15:41 clojurebot: excusez-moi

15:43 TimMc: clojurebot: futile is <reply>resistance is futile

15:43 clojurebot: 'Sea, mhuise.

15:43 TimMc: ~futile

15:43 clojurebot: resistance is futile

15:43 futile: hi

15:43 i see im mentioned quite a bit lately

15:43 TimMc: Don't mind me!

15:43 futile: am i suddenly popular?

15:43 TimMc: ~resistence

15:43 futile: its the hair, isnt it

15:43 clojurebot: Huh?

15:45 shdwprince: clojurebot: shdwprince is <reply>russky paren

15:45 clojurebot: Ik begrijp

15:45 shdwprince: ~shdwprince

15:45 clojurebot: russky paren

15:46 shdwprince: I use lazybot often, but now I'll change my mind

15:46 justin_smith: clojurebot: justin_smith is <reply>☃

15:46 clojurebot: 'Sea, mhuise.

15:47 justin_smith: ~justin_smith

15:47 clojurebot:

15:47 justin_smith: cool tricks

15:47 kmicu: -> /query BOT in private buffer

15:47 yogthos: Raynes: thanks, and yeah I actually want to pull out some globals from lib-noir :)

15:47 Raynes: yogthos: There are globals in lib-noir?

15:47 o.o

15:47 yogthos: Raynes: yeah sessions and cookies :)

15:47 Raynes: Oh, that's different.

15:48 They aren't global atoms. They get bound to atoms within a scope.

15:48 I'm okay with that for these purposes.

15:48 But by all means, if you can get rid of them then...

15:48 yogthos: Raynes: I haven't thought of a good way around that yet :)

15:53 gdev: how many template libraries are there now?

15:54 srruby: How do I turn [:key1 "val1" :key2 "val2"] into a hash map ?

15:54 nDuff: ,(into {} (partition 2 [:key1 "val1" :key2 "val2"])

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

15:54 nDuff: ,(into {} (partition 2 [:key1 "val1" :key2 "val2"]))

15:54 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>

15:54 * nDuff grumbles.

15:55 srruby: Thanks!!

15:55 akhudek: ,(apply hash-map [:key1 "val1" :key2 "val2"])

15:55 clojurebot: {:key2 "val2", :key1 "val1"}

15:56 arohner: ,(into {} (map vec (partition 2 [:key1 "val1" :key2 "val2"])))

15:56 clojurebot: {:key1 "val1", :key2 "val2"}

15:56 arohner: I'd use apply hash-map

15:57 srruby: arohner: Thanks

16:21 wei: how would you write this fn summarize: (summarize [{:from "A" :to "B" :amount 3} {:from "B" :to "A" :amount 1}]) => {:from "A" :to "B" :amount 2}

16:21 i came up with an ugly solution but #clojure is always full of elegant ones

16:25 Raynes: I can't really tell what that function is doing.

16:26 My preliminary example is (fn [& _] {:from "A" :to "B" :amount 2}) given my current information.

16:26 noprompt: :)

16:26 Raynes: noprompt: Hi!

16:26 noprompt: Wanna go to a concert in Santa Barbara on the 18th?

16:26 noprompt: it looks like he's trying to do something with a graph afaict

16:26 yogthos: so something like this?

16:27 hyPiRion: wei: how do you end up with 2

16:27 yogthos: (let [[[from x] [to y]]

16:27 (->> [{:from "A" :to "B" :amount 3} {:from "B" :to "A" :amount 1}]

16:27 (group-by :from)

16:27 (map (fn [[k v]] [k (reduce + (map :amount v))])))]

16:27 {:from from :to to :amount (- x y)})

16:27 mischov: refffheap

16:27 noprompt: Raynes: a concert?

16:27 Raynes: noprompt: http://www.stubhub.com/panic-at-the-disco-tickets/panic--at-the-disco-santa-barbara-velvet-jones-8-20-2013-4323247/

16:27 Huh, the 20th.

16:27 yogthos: hehe yeah should've :P

16:27 Raynes: Okay, the 20th noprompt, not the 18th.

16:28 shdwprince: I thought santa barbara was a tv series from 90x

16:28 noprompt: Raynes: i'm moving in to my new house on the 19th :(

16:28 Raynes: Where at?

16:28 shdwprince: oh, in

16:28 lol

16:28 noprompt: Raynes: still here in sunny fresno.

16:28 Raynes: noprompt: Well you suck etc etc.

16:28 hyPiRion: noprompt: that's great, isn't it? Then you can celebrate with Raynes the 20th :D

16:29 noprompt: Raynes: i got me a orange and a lime tree on a 1/3 of acre lot.

16:29 chrisrossi: where does leiningen download jars to?

16:29 Raynes: ~/.m2

16:29 hyPiRion: chrisrossi: ~/.m2

16:29 clojurebot: I don't understand.

16:29 Raynes: noprompt: Live a little man.

16:29 It's only a holy shit that's a long drive.

16:29 chrisrossi: that explains why i couldn't find it. ;) never woulda guessed. thanks!

16:29 Raynes: Still shorter than visiting me in LA.

16:29 noprompt: Raynes: i know dude. this summer did not go the way i planned. buying a home is such a pita.

16:30 Raynes: chrisrossi: Leiningen doesn't put them there though, the underlying maven stuff does.

16:30 chrisrossi: ah, gotcha.

16:30 Raynes: noprompt: That's why you shouldn't have bought a house.

16:30 chrisrossi: onion.

16:30 Raynes: Silly.

16:30 chrisrossi: Bell pepper.

16:30 wei: hiPiRion: A pays B 3, B pays A 1, so the equivalent transaction is A pays B 2

16:30 noprompt: Raynes: lol, i know!

16:31 chrisrossi: I was referring to layers. (lein -> maven -> turtles ...) ;)

16:31 Raynes: noprompt: Well, I forgive you.

16:31 noprompt: Raynes: i'm planning to take some time off soon though, i still wanna come down and visit.

16:31 hyPiRion: clojurebot: /.m2 is <reply>~/.m2 is where Leiningen puts its local repository.

16:31 clojurebot: Ack. Ack.

16:31 wei: bonus points if you can keep the amount positive in the summary

16:31 hyPiRion: And yes Raynes, it's technically wrong as it is maven which does that

16:32 technomancy: ahem... aether

16:32 Raynes: hyPiRion: It's okay.

16:32 technomancy: Gtfo hipster.

16:33 xeqi: eh, theres a flag to override it in pomegranate, so its lein's fault

16:33 aaelony: what do people recommend when you need a function that takes variadic arguments but needs a let statement that is almost identical regardless of whether it is invoked with 2 args or 3 args… example: (defn foo ([a b c] (let […] …)) ([a b] (let […] …)) ) ?

16:33 noprompt: Raynes: just fyi, the reason i haven't been here the past couple months is that i was working with an intern everyday during that time.

16:33 wei: (inc yogthos)

16:33 lazybot: ⇒ 1

16:33 Raynes: noprompt: Nice.

16:33 noprompt: i had #clojure withdrawals for a while.

16:33 yogthos: w00t

16:33 hyPiRion: aaelony: I just do (foo a b default-value-for-c) ?

16:34 but it depends on the work done within the function I guess.

16:34 aaelony: hyPiRion: I could do that. The let statement is a couple lines long, but not too unwieldy...

16:34 Raynes: noprompt: http://www.youtube.com/watch?v=LUc_jXBD9DU What you're missing by not going to this concert though.

16:35 noprompt: Raynes: the most living i've done this summer is watching battlestar galactica from start to finish lol.

16:35 aaelony: hyPiRion: actually, I like that approach.. thanks :)

16:36 hyPiRion: aaelony: np

16:38 noprompt: Raynes: if you and callen can't decide who drives up/down you guys could always meet in the middle at my house now haha.

16:38 Raynes: noprompt: callen already visited me.

16:39 You're the odd man out now.

16:39 :p

16:39 noprompt: Raynes: i was thinking i might've been able to come down this week since my family is visiting my sister in the OC, but i can't find a dog sitter.

16:40 Raynes: Awww doggie.

16:40 Now I want to drive to Fresno and pet the dog.

16:40 :(

16:40 noprompt: yeah. here name is ruby lol.

16:40 *her

16:40 Jasoncof: Hello, is there a function that will rename keys of a map by the return value of a function that accepts the key as an argument?

16:41 noprompt: funny thing is i didn't name her that.

16:41 Raynes: Jasoncof: clojure.set/rename-keys

16:41 Kind of.

16:41 dnolen: Jasoncof: you can combine Raynes' suggestion with reify

16:42 Jasoncof: Raynes: does that accept a function? It seems like it only accepts another map.

16:42 hyPiRion: Jasoncof: Closest would be (into {} (for [[k v] the-map] [(f k) v])) where f is the function

16:42 Raynes: dnolen: Whoa, you be talking magic.

16:42 noprompt: Raynes: oh what? i didn't know that was there.

16:42 Raynes: noprompt: I'm an encyclopedia of shit you didn't know Clojure had, bro.

16:42 noprompt: i actually wrote that function by hand :(

16:42 dnolen: (defn foo [f] (reify ILookup ...))

16:42 noprompt: time for some ------ action

16:42 Jasoncof: hyPiRion: thank you, I will give that a shot

16:43 Raynes: dnolen: I'd have never thought of that.

16:43 That's pretty darn cool.

16:43 yogthos: yeah that's slick

16:44 hyPiRion: Hmm, it would be interesting to see if you could make a function which takes a function and returns an ILookup.

16:44 gfredericks: clojurebot: Raynes is an encyclopedia of shit you didn't know Clojure had, bro

16:44 clojurebot: Ack. Ack.

16:44 ztellman: unfortunately that doesn't implement the whole host of other things that a map needs to be a map

16:45 that would have a different hash, probably not equal an equivalent map, etc. etc.

16:45 you'd need to make sure you don't pass that into code where people are actually expecting a map

16:45 hyPiRion: ztellman: And iterating over/seqing it is not going to work.

16:45 ztellman: and invoking it as a function won't work

16:45 you need to use get

16:46 bare minimum you need to create a map-like object: https://github.com/ztellman/potemkin/blob/master/src/potemkin/collections.clj#L21-L164

16:46 dnolen: ztellman: implement IFn, ILookup is usually good enough in IME for many use cases no need to bother with all the other crap

16:47 ztellman: dnolen: not disagreeing, but that's only true if only your code touches it

16:47 who knows what other people are expecting

16:47 non-equal hash codes, for instance, could cause insanely hard to debug situations

16:47 supersym: strap on yer armor

16:47 defensive programming ftw :P

16:48 dnolen: ztellman: no argument, this is a bit of code golf :)

16:48 ztellman: dnolen: understood, and it's an undeniably nice round of golf :)

16:48 tbaldridge: more correctly, people should just stop calling things maps that aren't IPersistentHashMaps, we should be using "will return a fn that implements ILookup" or something of that nature

16:49 noprompt: code horse.

16:49 :P

16:49 dnolen: fn->ILookup

16:50 ztellman: tbaldridge: that would have been a great standard to have instituted years ago, I think most people conflate being able to call 'get' with all other IPersistentCollection stuff

16:50 or IPersistentMap/Set, at least

16:50 I certainly do, anwyay

16:51 tbaldridge: yeah, I did as well, until I implemented my first ILookup then I changed :-P

16:51 ztellman: haha, I just wrote this: https://github.com/ztellman/potemkin/blob/master/src/potemkin/collections.clj#L214

16:52 and all the other borderline awful stuff in that namespace

16:52 Raynes: ztellman is the encyclopedia of doing horrible things with map interfaces. :p

16:52 tbaldridge: To be honest though, we can't rail against the gigantic Java interfaces, and then go and say "a map must implement these 20 things...." </rant>

16:52 nDuff: ztellman: nitpick: "be have" -> "behave"

16:52 Raynes: Not that it's his fault it's so convoluted to map something that looks and tastes like a map, but is more like a GPS device.

16:52 ztellman: nDuff: ha, thanks, I'll fix that

16:53 tbaldrige: I dunno, it's pretty easy to distill maps down to get/assoc/dissoc/keys

16:53 tbaldridge, rather

16:53 futile: Who has interesting Clojure blogs these days?

16:53 stompyj: planetclojure

16:53 ztellman: it would also be way easier if we could use APersistentMap

16:53 rather than having to reimplement it each time

16:53 stompyj: sorry http://planet.clojure.in/

16:54 super solid aggregation

16:58 dnolen: ztellman: yeah I think the Java interfaces muddy the waters - in CLJS it's much clearer that protocols like ILookup are meant to be a la carte.

16:59 hiredman: ztellman: apm should be broken up in to static methods (functions) as a library for concrete implementations to use

17:00 ztellman: hiredman: then you still need to implement the umpteen different functions yourself

17:00 hiredman: ztellman: fortunately we have macros that make that sort of thing easy

17:00 ztellman: in the code I linked I use macroexpansion to handle the 21 different arities of IFn and the case statement in applyTo

17:00 hiredman: sure

17:00 ztellman: hiredman: agreed, but some sort of abstract type would be nice all the same

17:01 dnolen: ztellman: IFn is the definitely the place where it feels like an abomination, I've contemplating monkey patching JS Function native more than once

17:01 ztellman: I mean, I wrote my own, so that scratches my itch, but something that has the official imprimatur would be way better

17:02 hiredman: reusing implementation doesn't and shouldn't require inheritance

17:03 ztellman: hiredman: under the covers it's just merging maps of functions

17:03 hiredman: sure

17:03 ztellman: so there's no diamond anything to worry about

17:04 hiredman: but in the java code base you end up using abstract classes like apm for that

17:17 solussd: does clojurescript not have defstruct?

17:18 dnolen: solussd: it does not

17:18 shdwprince: solussd: humm.. clojure on jvm have not too

17:18 dnolen: solussd: but defstruct has been deprecated for some time now

17:18 solussd: dnolen: i wasnt aware that it was actually deprecated. thanks

17:19 hrm.. if it's deprecated, shouldnt that be in the metadata or docstring?

17:20 sometimes I want something that really is a persistentmap and has its keys declared somewhere

17:20 hyPiRion: solussd: records??

17:20 lazybot: hyPiRion: Uh, no. Why would you even ask?

17:20 hyPiRion: ugh, double question marks

17:21 solussd: hyPiRion: records arent persistentmaps and don't play well with walk

17:22 stuartsierra: solussd: I have a fix for walk, see github.com/stuartsierra/clojure.walk2 and tickets on JIRA.

17:22 futile: I bet Clojure is great for static analysis.

17:22 solussd: stuartsierra: I've been watching that ticket for awhile now, thanks

17:23 shdwprince: How to handle cyclic dependency in clojure? require or in-ns && declare seems to work properly only in repl

17:23 nDuff: futile: played with Typed Clojure?

17:23 futile: Never.

17:23 is it great?

17:23 nDuff: hey weren't you in #python?

17:23 solussd: I 'patched up' the cond in walk, but still, i liked having create-struct/defstruct because of what it is

17:23 nDuff: futile: Were and am.

17:23 futile: oh

17:23 hyPiRion: I've done some static analysis, but I'm tempted to jump that stuff over to OCaml actually.

17:24 futile: ocaml? i heard something was written in that.. maybe E

17:24 yeah E lang

17:24 hyPiRion: But it's heavily dependent on the problem domain, to be fair.

17:25 FFTW uses it for analysis and code generation as well

17:25 stuartsierra: shdwprince: You can't have cyclic dependencies between 2 namespaces in Clojure.

17:25 onr: futile: haxe

17:26 and probably much more

17:27 shdwprince: stuartsierra: not with ns's, but in function

17:27 (resolve) do the job

17:28 but i'll think about project architecture

17:28 hyPiRion: shdwprince: (declare func-2) (defn func-1 (something with func-2)) (defn func-2 (something with func-1))

17:29 shdwprince: hyPiRion: dont work with vars in another namespace

17:29 stuartsierra: shdwprince: That implies a cyclic dependency between namespaces.

17:30 hiredman: ,(doc intern)

17:30 clojurebot: "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."

17:30 hiredman: ,(doc create-ns)

17:30 clojurebot: "([sym]); Create a new namespace named by the symbol if one doesn't already exist, returns it or the already-existing namespace of the same name."

17:31 shdwprince: hiredman: thanks, but i'll stay with (resolve)

17:31 hiredman: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6884-6917 go nuts

17:33 resolve (the name is a big hint) involves the cost of var resultion everytime, if you are going to do something kind of gross, at least do it in a performant way

17:40 futile: What do you do when your trusted colleague mentions that he finds it frustrating that the Mac OS X menu bar (and OS X in general) has so many processes running all the time, and that he thinks a good solution would be to have a background job start and stop them every few seconds instead?

17:40 eckse: you can't get much 'simpler' than a mac

17:40 technomancy: futile: recommend gentoo

17:41 eckse: perhaps he should write his own os?

17:41 *mac user

17:41 :3

17:42 sadbox: :|

17:42 futile: I think I said it wrong. He says he's bothered that he has so many processes running (citing all the ones with a task bar icon, presumably like Dropbox and Gmail) and wants them spun up 'on demand'. Is this a reasonable thing to be bothered by?

17:43 eckse: but then they're not collecting your data

17:44 isn't that the true purpose of processes?

17:44 :|

17:44 bts-: is it still generally advised not to use core.async in production yet? or is it just that the interface is going to change a bit

17:44 solussd: futile: well, if the app isn't doing anything it'll get 'swapped out' and is effectively not using any memory or cpu resources. starting and stopping an app every few seconds just to see if it needs to do anything is ridiculous.

17:45 bts-: just do it. :D

17:45 futile: solussd: okay that's what I thought too

17:45 Thanks for the sanity check.

17:45 bts-: solussd: that's what I'm leaning towards :)

17:45 solussd: it's too much fun not to

18:03 zilti: What are the currently available clojurescript testing frameworks? I tried specljs (seems to be uncompleted and broken) and cemerick/clojurescript.test (outdated?).

18:05 dnolen: zilti: that's it really I think, I don't think cemerick's lib is outdated

18:18 timvisher: anyone know if it's possible to control the canvas size of a chart in incanter?

18:19 (view :width … :height …) isn't quite what I want as it seems to scale things almost exactly like it would if I had started with as smaller chart and simply expanded the window

18:19 I'm trying to actually make the chart larger

18:21 zilti: Argh, that whole cljs testing stuff is totally broken...

18:21 xicubed: zilti: kerodon?

18:22 zilti: kerodon?

18:22 xicubed: https://github.com/xequ/kerodon

18:22 zilti: That does not even exist

18:22 xicubed: whoops https://github.com/xeqi/kerodon

18:23 zilti: No, I mean clojurescript testing, not ring testing

18:24 I now spent almost 2 hours trying to set up either clojurescript.test or specljs together with cljsbuild test, and all I get are error messages

18:25 atyz: I'm trying to do an integration test of some routes in pedestal using: (response-for service :post "/accounts" :json-params {"account" {"name" "sonata00"}}), it is not allowing me to post this. any ideas?

18:27 zilti: I mean, aren't people testing their clojurescript code?

18:41 dnolen: zilti: I think people probably were testing the same way the CLJS tests were done, just a function w/ many asserts

18:50 clojure-newb: hi if I wanted to ping 30 something ips in parallel so that I know the results of all the pings in roughly the timeout time (5 secs). How would I do it in clojure? Do I need to use an atom?

18:51 justin_smith: clojure-newb: https://github.com/neotyk/http.async.client

18:51 I think - maybe not for pings come to think of it

18:52 you could create an agent or future for each ping, and test all the status after the timeout passes

18:52 noonian: you could do something that returns a sequence of futures, and then deref the futures for the individual values

18:53 justin_smith: yeah, futures

18:53 lgs32a: is there a certain guideline when i should use reducers? most of my performance test (especially with collections where i don't need order) favor the clasical map or pmap

18:53 noonian: hmm, could return a single future that derefs all the other futures :P

18:54 clojure-newb: Could i have an agent or something that kept the status of all the ips and modify it in parallel?

18:55 justin_smith: clojure-newb: with futures, it would execute them in parallel, giving you a handle, when you deref the handle it hands you the result (if the future is ready - there is a function that tests if a future is realized)

18:56 noonian: could have an atom like (atom {"ip1" "status1", "ip2" "status2" ...}) and have each future update the atom associng the returned status

18:56 clojure-newb: I will try that thank you both

18:57 gtrak: or a map of futures..

18:57 justin_smith: or (map #(future (ping %)) (ip-list))

18:57 gtrak: why make it more complicated with an atom?

18:58 cemerick: zilti: outdated?

18:58 noonian: derefing the atom will never block, so its easier to query the current statuses without worrying about blocking, idk it probably depends on your use case

18:58 justin_smith: noonian: (map deref (filter realized? futures))

18:59 zilti: cemerick: I noticed that there were some new commits. Well, I won't touch any clojurescript testing frameworks for the next weeks, I wasted too much time on it already.

18:59 clojure-newb: could i have futures that conj to an atom then add a watch to the atom that checks for the count or is mapping deref better?

18:59 noonian: justin_smith: thanks, I haven't used futures much

19:00 clojure-newb: mapping realized?*

19:00 gtrak: you could.. but why not just treat futures as values instead of side-effects?

19:00 cemerick: zilti: is it that the last release was 3 months ago that's throwing you off?

19:00 clojure-newb: ok ty all

19:00 zilti: cemerick: I had that issue that it used an older clojurescript version, but I solved that using :exclusions

19:01 cemerick: oh my

19:01 zilti: 3 months isn't unusual at all, I'm using libs here which are much "older"

19:01 justin_smith: clojure-newb: mapping deref - deref gets the value from the future, realized? checks if the process is done calculating

19:02 clojure-newb: kk

19:02 justin_smith: you often don't want to deref a future that is not done yet

19:02 noonian: clojure-newb: yeah if you forced evaluation on mapping deref it would block on the values that hadn't been realized yet

19:02 gtrak: you could loop the seq in passes, separating realized futures from unrealized ones

19:02 justin_smith: also, there is future-cancel "cancels the future if possible" which is a beautiful concept if you forget the context

19:04 clojure-newb: could i have a (while (not (every? realized? futures)).. ?

19:04 justin_smith: sure

19:05 but if you just want to wait for all of them, just (map deref futures)

19:05 that will block on each unrealized one until it is realized

19:05 clojure-newb: ok

19:05 ztellman: or use http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorCompletionService.html

19:06 clojure-newb: :-o

19:06 noonian: (map deref futures) should return a lazy seq so it shouldn't actually block until you look at it

19:06 justin_smith: noonian: good point

19:06 ztellman: unless you really, really care about doing it in order of completion, though, use (doall (map deref futures))

19:08 clojure-newb: I don't care about order

19:20 technomancy: anarchist?

19:21 Raynes: technomancy: An antisocial anarchist that sounds like so and so. They say I'm just a stupid kid. Another crazy radical. Rock n roll is dead, I probably should have stayed in school. Another generation x who somehow fell in through the cracks. They'd love to see me fall but I'm already on my back.

19:21 technomancy: Raynes: what, so you don't care about order either?

19:22 I have proof that could ruin your street cred: https://github.com/flatland/ordered/graphs/contributors

19:22 Raynes: Bahahaha

19:23 technomancy: there you have it. Raynes is "pretty okay" with the establishment.

19:25 hyPiRion: Raynes: The school/college/university system over in the US of A sounds expensive

19:25 Raynes: hyPiRion: I wouldn't know.

19:26 Foxboron: So, i wrote a clojure version of the hackernews hated VerbalExpressions lib: https://github.com/Foxboron/ClojureVerbalExpressions writing tests atm and comments on the code would be awsome.

19:28 justin_smith: Foxboron: first example, where is the www coming from in the source of the tester? is that a typo?

19:28 Foxboron: justin_smith: that is actually a typo.

19:29 well, yes and no. I copied the example from the python version and i somehow left out 2 functions

19:29 hyPiRion: Raynes: I just felt like responding to "I probably should have stayed in school" by hinting to the fact that it's expensive in the US. Don't mind me.

19:29 Raynes: hyPiRion: You know that those are song lyrics, right?

19:29 I've got song lyrics for everything.

19:30 hyPiRion: Raynes: No, I thought you were awesome and made it up on the fly.

19:30 Thanks for crushing my dreams.

19:30 :(

19:30 Raynes: hyPiRion: http://www.youtube.com/watch?v=DPgWNuUkuA8

19:30 Foxboron: justin_smith: fixed.

19:31 hyPiRion: Raynes: "This video is unavailable." ahah, region blocks

19:31 Raynes: Evil.

19:31 hyPiRion: I'll look it up on Spotify instead

19:38 Raynes: hyPiRion: I was gonna mirror it for you, but they've changed bloody encryption signatures 6 bazillion times in the last two months.

19:38 So yeah, spotify may be your best bet.

19:42 hyPiRion: Raynes: I just found another vid, so no worries anyway

20:00 Ugh, so I need to reify a class with a single method: meta. To make matters worse, that method takes one argument. How would I handle that?

20:01 (http://docs.oracle.com/javase/7/docs/api/javax/sound/midi/MetaEventListener.html for reference)

20:01 hiredman: use deftype

20:02 I think, I'm not sure what deftype implements "for you", but I think it may be nothing

20:02 hyPiRion: hiredman: I'll have a stab at it anyway

20:03 Bronsa: deftype doesn't implement IObj, only reify/defrecord do

20:04 justin_smith: hyPiRion: helpful flow chart I saw on this channel from cemerick about deciding on interop style http://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png

20:04 gfredericks: afaik the main restrictions are some munged reserved field names?

20:09 hyPiRion: Well, it seems like I just forgot to add in `this` in the call.

20:31 futile: Is it insane to say my next project will be "my perfect text editor"?

20:31 Okay scratch that, perfect is a moving target.

20:32 Is it insane to say my next project will be "a usable text editor"?

20:36 robink: I have a hashmap (generated from JSON) that is still using strings as keys. The keys are static and the string contents are keyword-compatible. Is there a single-call way to turn all string keys into keywords w/o having to reassociate the values as well?

20:37 hiredman: most clojure json libraries will do that for you

20:37 robink: I'm happy even to feed in a {"stringkey" :stringkey "stringotherkey" :stringotherkey} map as a hint.

20:37 hiredman: Ah, OK, I'm probably just misusing data.json.

20:38 hiredman: consider cheshire https://github.com/dakrone/cheshire

20:40 robink: hiredman: It looks like you pass clojure.data.json/read-str a function that gets mapped over all of the keys, so you can transform them to keywords via clojure.core/keyword.

20:40 hiredman: but yeah, I'll look at Cheshire.

20:45 Heh, you just pass 'true' to Cheshire (it accepts a key transform function too, but true is synonymous for 'keyword', apparently).

20:54 muhoo: another friend question: default-unauthentcated-handler, which is supposed to redirect to unauthorized-url, isn't.

20:54 it always goes back to /

20:54 afaict it's never getting added to the :session

20:54 (this with login form workflow)

20:59 robink: Is there a Clojure HTTP client that will negotiate for a certificate with the same CN as the HTTP Host: when connecting via https?

21:00 clj-http just asks for whatever the default certificate is, and since I'm serving multiple certs, it ends up being given the wrong one and throws a certificate mismatch error.

21:00 muhoo: robink: i'm pretty sure you can customize clj-http to do that

21:00 it's apache under the hood IIRC

21:01 robink: muhoo: and I started in on the Apache HTTP client docs and still couldn't find an easy way of having it try to request a cert with the same CN as the host you're connecting to, or at least override it manually.

21:08 patchwork: Using pantomime to get a content type given a file extension… how do I go in reverse?

21:08 Get a file extension given a content type

21:13 noto2: patchwork: you mean jpg/jpeg for a photo, for example?

21:14 TEttinger: there isn't always the same nice mapping of file extensions to mime types, I would think

21:15 muhoo: robink: i've done it, in java, on android. it sucked, but it was possible

21:15 robink: muhoo: Hm :(

21:16 muhoo: clj-http uses the same underlying apache lib, again, memory is hazy

21:16 justin_smith: TEttinger this is the reverse mapping

21:16 so given image/jpeg he wants .jpg

21:16 TEttinger: or .jpeg I mean

21:17 there is a range of possibilities for each mime type

21:17 justin_smith: yeah

21:17 muhoo: robink: it was some stupid FactoryHelperSingleton thing

21:17 justin_smith: but one of them should suffice

21:17 robink: muhoo: Aha

21:18 muhoo: and you pass it in, and you have your custom logic in there to do client side verificafion

21:19 futile: technomancy: partly inspired by your lispology post, I wrote this: https://gist.github.com/sdegutis/6168999

21:22 robink: muhoo: Seems like it also might be possible to fix in :client-params.

21:35 Heck, I can't figure out how to make Java's SSL support request a particular CN for a SSL/TLS connection.

21:46 callen: "aphyr: @ztellman @cemerick @planetclojure DECOMPLECT YOUR CODE, DECOMPLECT YOUR LIFE. http://t.co/DEWDVx63nC"

21:54 cemerick: robink: if you're doing HTTP, you're almost surely better off using clj-http (a.k.a. apache http clients)

21:55 kristof: Hi! Quick question: in typed clojure, there is no type inference, right? What's to stop someone from doing type inference on only a single block of code or a function?

22:20 muhoo: nb, fixed friend. one may not put wrap-anti-forgery after friend/authenticate, otherwise Bad Things Happen

22:21 so (-> routes wrap-resource wrap-file-info wrap-anti-forgery handler/site) appears to be the win

22:22 sorry (-> routes wrap-resource wrap-file-info wrap-anti-forgery authenticate handler/site)

22:22 one goat sacrificed.

22:22 poor goat.

22:25 justin_smith: I wonder if deploys to production will ever stop feeling like I am walking on the edge of a very steep drop

22:37 hlprmnky: justin_smith: In my experience, no. There's always that chance, no matter how slim, that it will end up all on fire. :|

22:43 so here's a question: I'm trying to teach myself Luminus, and I got to the default test/project/test/handler.clj which tests the routes. Is it really the case that the best practice for testing a route's content is (is (= (:body response) [a ginormous blob of hand-coded HTML]))?

22:44 I mean, I can see how I might go about building an object that had the desired response content for a given route input and then asking (is (= (:body response) (:expected response)) but I'm surprised that isn't always already the way to do it, and so I dimly suspect that I might have Missed Something™

22:45 justin_smith: hlprmnky: I usually check the status is of the response, the headers, and maybe a regex on the body

22:45 pandeiro: i am trying to realize a lazyseq for spitting purposes and having no luck with the obvious doall solution... what else can i do?

22:45 justin_smith: which is enough to catch 500 / 404 / random controller problems mostly

22:45 hlprmnky: right

22:46 pandeiro: i want to do (spit file (clojure.string/join "\n" lazy-lines-seq))

22:46 hlprmnky: hm - I wonder if what I really want to be doing is something more like build a DOM object from the response and then ask it if it has all the parts I expect the response to have

22:47 I just see that pile of HTML and think "hey, there's a test failure I will not see until 3am some Wednesday, just waiting for me"

22:47 justin_smith: you could destructure the html into a datastructure and check for some of the basic shape / features you want

22:48 better yet, make the controller take a "render" argument, which is the rendering function, and then pass in identity when testing

22:49 pandeiro: how are you using doall to force it?

22:49 TEttinger: pandeiro: (spit file (clojure.string/join "\n" (vec lazy-lines-seq)))

22:50 justin_smith: yeah, that is what I would try if doall was being used properly and did not make it fully realize

22:50 pandeiro: TEttinger: i'm sure i tried that but i think somewhere my lazyseq is getting cast to string before

22:51 justin_smith: string/join does not expect a string, it expects a collection

22:51 TEttinger: strings are kinda collections

22:51 but not how you'd prefer

22:53 pandeiro: oh damn. ok nvm.

22:53 thanks

22:53 TEttinger: pandeiro, there's a way to do it though

22:54 what kind of string is it becoming?

22:54 pandeiro: TEttinger: my code was fine, i was calling the processing fn twice

22:54 :-/

22:54 it's late

22:54 TEttinger: oh heh

22:54 pandeiro: yyyeah

22:54 TEttinger: yeah, I'm actually having a similar issue myself

22:55 except in reverse :|

22:55 pandeiro: i think i really need to learn awk for this stuff

22:55 TEttinger: I have a function that operates on arrays, and repeated applications don't do anything

22:55 clojure's great for string processing

22:56 java has potent regexes

22:56 pandeiro: yeah, it is... but it's not great for one-off scripts imo

22:56 i end up writing this stuff over and over again

22:56 TEttinger: hm, that's my main usage for clojure tbh

22:56 one-off large scripts

22:57 like this fake greek generator https://www.refheap.com/15489

22:57 (fits in a small enough space to be run by lazybot over IRC)

22:58 pandeiro: TEttinger: cool

22:59 TEttinger: since then I've written fake english generators that slurp a wordlist and find the most common consonant combinations

22:59 pandeiro: yeah there is a ton you can do with so many function combinations, you are right

23:02 justin_smith: so markov chains on the letter rather than word level

23:05 TEttinger: justin_smith, I used the function frequencies a fair bit in that one

23:06 not sure if it's a markov chain

23:13 justin_smith: a markov chain uses the statistical likelihood of x followed by y within some set of tokens to construct a sequence superfically resembling the input set

23:24 https://github.com/prismofeverything/gort irc bot, in clojure, that does markov chain restructuring of channel activity

23:54 Raynes: callen: You should write rap lyrics with me.

Logging service provided by n01se.net