#clojure log - Jan 06 2013

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

0:41 TimMc: Wow, who knew that the JavaMail API could be so terrible?

0:41 * technomancy raises his hand

0:41 technomancy: I knew.

0:42 TimMc: I mean, I can't say I'm *terribly* surprised.

0:42 technomancy: have you got to the part where you have to deal with multi-part messages that could be nested at an arbitrary depth yet?

0:42 TimMc: Oh, luckily I don't have to deal with that for this app.

0:42 Raynes: TimMc: Me.

0:43 TimMc: This is an autoresponder for SMS<->email gateways, and anyone whose provider makes multipart emails from that can go write their own app.

0:43 technomancy: if it weren't for bouncy castle, javamail would be the canonical "can't be arsed to write an API that provides what people actually want; just going to code against the RFC instead" example

0:43 TimMc: heh

0:44 It looks like there's no way to retain a permanent reference to a message without holding the folder open.

0:46 Hmm, might not be a problem, since the Message carries around a reference to the Folder...

0:46 Eh, I'll just go to bed.

0:56 Raynes: TimMc: I tried to write a wrapper around javamail once.

0:56 I have scars.

1:09 arrdem: ,(seq {:a 'b :c 'd})

1:09 clojurebot: ([:a b] [:c d])

1:10 * arrdem will get his own repl now

1:21 Raynes: arrdem: You can use mine!

1:22 djwonk: Am I the only one that thinks http://clojuredocs.org/clojure_core/clojure.core/declare (forward declarations) are strange to have in a high-level language?

1:22 arrdem: most kind of you Raynes!

1:22 Raynes: djwonk: Why?

1:22 djwonk: I'm loving Clojure, but the order of defining functions is a pain

1:23 arrdem: djwonk: no, not with the way clojure considers compilation..

1:23 djwonk: I'm no compiler writer, but with several passes, I wouldn't have to worry about it

1:24 I'm just saying, for a high-level language, it seems out of place. I don't have a lot to complain about otherwise

1:24 arrdem: idk. Raynes this is a foible I'm over. thoughts?

1:24 Raynes: I think chicken fingers taste good.

1:24 arrdem: that's a damn good thought for midnignt..

1:24 Raynes: I don't know how the Clojure compiler works.

1:25 Perhaps it would be significantly slower to do what is necessary for unordered definitions?

1:25 *shrug*

1:25 amalloy?

1:25 clojurebot: amalloy is <amalloy> just use juxt, it'll be great

1:25 Raynes: Well, yes, but not what I was after.

1:25 arrdem: ,(doc juxt)

1:25 bbloom: djwonk: it's completely intentional

1:25 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

1:25 bbloom: djwonk: it makes circular dependencies an explicit decision

1:25 Raynes: bbloom to the rescue, learning us stuff.

1:26 I very much liked unordered definitions in Haskell.

1:26 bbloom: Raynes: that's what i'm here for: learning you of stuffs

1:26 arrdem: bbloom: having taken a few stabs at compilers myself, why did rich see this as a behavior to be discouraged?

1:26 amalloy: clojure's compilation unit is the function, not the file. what if you typed (defn foo [] (bra 10)) into a repl, planning to define bar later? the compiler couldn't tell you about your spelling error until you ran foo

1:26 Raynes: I liked being able to put high level API at the top.

1:26 bbloom: what amalloy said too

1:27 djwonk: bbloom: I'm looking over http://news.ycombinator.com/item?id=2467359

1:27 Raynes: Ugh, don't look over hacker news.

1:27 Please.

1:27 arrdem: yay hipster news!

1:27 bbloom: heh

1:27 Raynes: you're way too young to be so cynical :-)

1:27 * arrdem is a closet HN adict

1:27 Raynes: Or at least please ignore everything anyone says on that place.

1:27 I've been burned far too many times in my youth by HN.

1:27 bbloom: heh

1:28 arrdem: Raynes: it's more inteligent than /r/programming at least...

1:28 bbloom: djwonk: so yeah, rich explains it pretty well there

1:28 you should listen to rich anywhere, even if it's HN :-)

1:28 djwonk: Raynes: re: "I very much liked unordered definitions in Haskell" me too

1:28 amalloy: ah, good point about the unit of compilation

1:29 bbloom: djwonk: you get used to not having them pretty quickly, and then you grow to appreciate the fact that you can read your code from bottom to top

1:29 you start at the top of the file, read the 'ns form, then you skim down the file making some mental notes of what functions are there

1:29 and then when you get to the bottom

1:29 you reverse direction and start reading up again

1:30 djwonk: bloom: haha, that sounds like a coping mechanism … but considering what I understand, I don't see any obvious way to satisfy all concerns

1:30 bbloom: you stop when you no longer care about the details

1:30 amalloy: top to bottom, man. my brain can't handle the UnsatisfiedLinkError

1:30 bbloom: amalloy: that's why you read top to bottom and then back to the top :-)

1:30 you don't need to read the bodies when reading top to bottom

1:30 you just skim the signatures

1:31 either way, the code is linear in terms of dependencies

1:31 modulo a few declare statments if you actually need mutual recusion

1:31 which, sometimes you do!

1:32 djwonk: bloom: thanks for explaining

1:32 * djwonk uses elevator eyes on his codes

1:34 bbloom: i just grepped all the clojure code i have ever written from scratch

1:34 exactly two uses of declare

1:34 and both of them are for tree expansion algorithms :-)

1:34 Raynes: I don't think I have any.

1:34 arrdem: I can remember three...

1:35 bbloom: Raynes: well then you clearly need to implement a macro expansion like system :-)

1:35 arrdem: two if which aren't called for

1:35 bbloom: both of mine are actually exactly this: (declare expand)

1:35 haha

1:35 djwonk: for fun, could I write a macro that flipped the ordering of subsequent forms? I know, I know. The horror.

1:36 I like big picture at the top.

1:36 bbloom: djwonk: no. top level forms can have side effects

1:36 may i suggest putting the big picture in a comment at the top? :-)

1:37 djwonk: maybe a doc string? heh

1:37 djwonk: yeow!

1:38 bbloom: i had a friend who was an expert C++ and C# developer at msft. he was doing javascript for the first time and was using the function NameHere() { } syntax pretty much for the sole reason that it let him write the big picture at the top

1:38 i taught him the basics of clojure and he played with a bit, then went back and changed all his javascript to be declare-before-use ord

1:38 order*

1:38 arrdem: haha

1:38 bbloom: you get used to it :-)

1:40 arrdem: could you do a traversal of (source) to generate a (declare) given a symbol?

1:40 bbloom: arrdem: if you're gonna learn clojure, you might as well learn idiomatic clojure

1:41 arrdem: bbloom: it's midnight here and I'm being silly

1:41 wow that came out snippy... T_T

1:42 bbloom: arrdem: don't worry, my ego is far too big to be harmed by a potentially snippy sounding comment from a stranger on IRC

1:43 Raynes: bbloom: Actually, 87 uses of declare in my code folder.

1:43 bbloom: just ask Raynes

1:43 Raynes: Looks like most of that is not my code though

1:43 tallyho is mine, so that's one use against me.

1:43 arrdem: .... does clojurebot have a roflcopter feature? because I could use one right now.

1:44 ,(use 'clj-http.client)

1:44 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clj_http/client__init.class or clj_http/client.clj on classpath: >

1:46 jonasen: kovas_: Thanks for the merge! Is everything working ok?

1:46 bbloom: Raynes: i used this bash snippet to figure out which projects were mine or my forks:

1:46 for proj in $(ls); do; (cd $proj; git remote -v 2>&1 | grep brandonbloom > /dev/null && echo $proj); done

1:46 er might be zsh

1:47 Raynes: bbloom: find . -name "*.clj" | xargs grep "(declare " | wc -l

1:47 Is what I did.

1:48 bbloom: Raynes: replace that with find $(my code snippet here)

1:48 and it will only check your own projects :-)

1:48 Raynes: bbloom: That doesn't account for forks.

1:48 bbloom: sub your name for mine, of course

1:48 ah, you keep them separate?

1:48 Raynes: No, I mean forks are not my projects.

1:48 But this will think that they are.

1:48 bbloom: i just have 1 giant flat directory of projects including other peoples

1:49 Raynes: For example, lib-noir uses declare in several places but I did not write that particular code.

1:49 I do as well

1:49 bbloom: $ ls ~/Projects/ | wc -l # 205

1:49 w00t, i broke 200

1:49 Raynes: penumbra:code raynes$ ls | wc -l

1:49 225

1:49 bbloom: I win.

1:49 bbloom: dammit.

1:49 lol

1:50 i blame the fact that i worked for a living and had many many many other abandoned projects on company hardware :-)

1:50 get a job.

1:50 (says the unemployed guy)

1:51 Sgeo: What's wrong with declare?

1:51 bbloom: Sgeo: nothing

1:51 well, nothing in this discussion

1:52 * Sgeo can't help contrast with Racket again

1:53 arrdem: `find ~/doc/projects -maxdepth 2 -type d | wc -l` == 162 # I sort by language

1:53 bbloom: arrdem: what do you do with multi-language projects ?

1:54 arrdem: ~/doc/etc

1:54 clojurebot: I don't understand.

1:54 arrdem: ~/doc/projects/etc

1:54 bbloom: (dec clojurebot)

1:54 lazybot: ⇒ 14

1:54 Sgeo: If Racket didn't allow for arbitrary ordering of definitions, it could be comfortably added, because every module has an implicit redefinable (by changing the "language") macro surrounding the entire module called #%module-begin

1:55 bbloom: Sgeo: yeah, racket's implementation is significantly more mature than clojure's....

1:55 there's nothing inherent preventing clojure from having something like that

1:55 arrdem: MESSAGE arrdem hello!

1:59 Sgeo: bbloom, although I _think_ Racket might be a bit static for my taste

1:59 Trying to imagine Qoppa as a Racket language, and currently stumbling on whether it's possible to add new definitions to a module

2:42 arrdem: in case you haven't seen it, http://stackoverflow.com/a/1732454/615234

3:04 Raynes: arrdem: Mhm.

6:56 AimHere: Is there an obvious way of constructing records from arguments that aren't the underlying objects that the record wants to store? I want to feed a constructor a string, and have it be a record containing numbers (or other things) in that string?

6:56 It's not hard to do, but I'm just thinking there might be an idiom I've missed

6:57 bbloom: AimHere: I believe that's called a function.

6:58 AimHere: Well I could write a function that constructs the object from the different-looking thing I'm constructing it from, but then it's not bundled with the record itself

6:58 bbloom: why does it need to be?

6:59 AimHere: I thought that was kindof the point of managing complexity with all this OO (or pseudo-OO) stuff

6:59 Suddenly I've got to look in two places for functions that deal solely with one type of record

6:59 As I say, I can do it that way, I just get a hunch that it's a bit unidiomatic

7:00 bbloom: both deftype and defrecord produce dumb field assignment constructors

7:00 AimHere: I'd rather define a macro that replaces defrecord instead for that reason

7:00 bbloom: you'd have to gen your own class with your own constructors

7:00 the dumb field assignment constructors are intentional

7:01 records and types should be able to achieve the underlying platforms maximum allocation performance

7:01 AimHere: Fair enough. I know they're dumb, I was just wondering if there was an idiom I'd missed

7:01 bbloom: which means that you need to be able to just blast down fields without a constructor call

7:01 dumb constructors that assign all fields in order can be mem copies when jitted

7:02 AimHere: rolling my own defrecord it is, then!

7:02 bbloom: lol that seems like overkill for what can be solved with defn

7:03 AimHere: Your way I've got ten constructors where five will do

7:03 bbloom: do you just want a special reader behavior? b/c in that case you can use tagged literals

7:03 well constructors aren't functions

7:03 you can't do higher order ops with them, etc

7:04 not without wrapping them in a function first

7:04 which is why defrecord produces ->Foo functions

7:04 AimHere: Well that's kindof the idea

7:04 bbloom: and map->Foo

7:04 in theory, you could just call it Blah->Foo and then it would be pretty easy to find by searching for "->Foo"

7:04 (doc defrecord)

7:04 clojurebot: "([name [& fields] & opts+specs]); Alpha - subject to change (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args*] body)* Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the current namespace, the given fie

7:05 bbloom: ~(doc defrecord)

7:05 clojurebot: defmulti doc is "I think dropping filter() and map() is pretty uncontroversial…" — GvR

7:05 bbloom: ,(doc defrecord)

7:05 clojurebot: "([name [& fields] & opts+specs]); Alpha - subject to change (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args*] body)* Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the curr...

7:05 bbloom: dammit bots

7:05 $doc defrecord

7:05 "Given (defrecord TypeName ...), two factory functions will be defined: ->TypeName, taking positional parameters for the fields, and map->TypeName, taking a map of keywords to field values."

7:05 what harm does one more factory function do?

7:07 AimHere: It's not one more function though, it's one for each record I'm defining

7:07 bbloom: how many record types are you defining?

7:08 AimHere: Not quite sure. At least 5 or so

7:08 bbloom: and they are all similar in the same way that they can have an auto generated special factory function each?

7:09 a macro that delegates to defrecord and then defines an extra factory function wouldn't be unreasonable

7:09 AimHere: That's my plan

7:09 bbloom: that's a lot more sane than "roll my own defrecord" sounded like lol

7:09 AimHere: Heh, yeah

7:10 bbloom: anyway, it's way past my non-existent bed time

7:12 tomoj: just curious, why are you defining record types? :)

7:15 AimHere: I've a bunch of objects that I'm doing similar things on, in different ways

7:16 bbloom: AimHere: in my experience, a multimethod and a type-like key is more pleasant

7:16 AimHere: So I figure I want that record/protocol type stuff going on

7:17 bbloom: rather than have (defrecord Rectangle [left top right bottom]) just have {:shape :rectangle :left ... :right .......)

7:18 AimHere: That's definitely an option. I've already done a whole protocol-> multimethod change elsewhere in this program

7:18 I don't think I need quite that much polymorphism here though

7:20 tomoj: that sounds reasonable enough for me to stop interrogating you

8:41 klr: is clojure a lisp variant of java?

8:42 daimrod: no, it's a different language even though it runs on the JVM.

8:42 ejackson: no its a lisp on the jvm

8:42 klr: is jvm big download?

8:42 Sgeo: Yes, but there's a good chance you already have it

8:42 daimrod: yes, but why do you care?

8:42 klr: btw, is Clojure a lot like Scheme( i studied scheme recently)

8:43 I dont have it install, i dont use java software

8:43 Sgeo: (note: I believe klr is looking for a first language)

8:43 klr: daimrod: cause i considering learning Clojure since i want to learn programming and i got some basic knowledge of scheme so i thought it would be eaiser thatn for example starting with python

8:43 Sgeo: yes

8:44 daimrod: klr: why don't you learn Scheme first?

8:44 klr: daimrod: i cant seem to find a good scheme book, SICP isent intended for kids and HTDP is just annoying

8:45 Sgeo: klr, you did see that how lists display in BSL can be changed?

8:45 daimrod: SICP is for kids?

8:45 klr: no

8:45 it's for MIT students

8:46 too advanced math in the exercises and examples for me, and lots of new words

8:47 back to question, is JVM big download?

8:48 Sgeo: Around 30-50MB looking at the download page. That sounds small though

8:48 klr: indeed

8:48 gonna check if it's my distributions repo

8:48 arcatan: most likely

8:48 klr: nope, guess i have to compile from source

8:49 Bronsa: what's your distribution?

8:49 klr: CRUX

8:49 is it the JDK or the JRE i want to install?

8:49 hyPiRion: jdk

8:50 to compile and build stuff, at least

8:50 klr: ok

8:54 clojure-newb: cemerick: Hi, I can't find a form login example for friend… is there one ?

9:32 thorwil: hi… I just found your tlog friend integration example… did you ever try plain old ring session for the authentication etc ?

9:53 magnars: what's better than (vec (concat v1 v2)) ?

9:55 thorwil: clojure-newb: no, i really couldn't be bothered to handle redirecting to/from a login page and stuff like that myself

9:56 clojure-newb: thorwil: I saw your question on getting the 'Sorry, you do not have access to this resource.', what was the fix in your case ?

9:57 thorwil: clojure-newb: i don't recall the full context or the precise question

9:58 clojure-newb: thorwil: I'm getting the same thing using middleware memory session

9:58 thorwil: clojure-newb: but i think it was all about using the right middleware (in the right nesting)

9:58 clojure-newb: thorwil: pretty brittle in some ways then ?

10:00 thorwil: clojure-newb: just a bit lacking regarding documentation on that

10:00 clojure-newb: https://github.com/thorwil/tlog/blob/master/src/immutant/init.clj#L15

10:00 clojure-newb: thorwil: I'm tempted to just pretty much clone your project (using immutant instead of ring-jetty etc) to see if I can get an in memory session authentication setup working

10:00 thorwil: thanks, thats what I was just looking at

10:01 thorwil: clojure-newb: it works in that order, but i had been told wrap-nested-params should also be there. it works without, for everything i tried so far

10:01 clojure-newb: losing too much time on the ring, jetty etc setup

10:01 thorwil: which is not much, as i have a single account and role

10:01 coffee break, bbl

10:01 TimMc: djwonk: Rich's HN explanation about compilation units doesn't satisfy me. We *do* have a compilation unit; it's called the namespace. All that discussion is about impl tradeoffs. The only *semantic* problem I can see with multi-pass compilation is what to do about macros.

10:12 djwonk: I think clojure/core.clj is the *one* source file that needs to be handled in a single-pass fashion, and that can be special-cased by the compiler, since it already is.

10:19 clojure-newb: its not going my way today… immutant install gives sha1 checksum validation failed… any ideas ?

10:32 thorwil: clojure-newb: known problem. though perhaps of interest to tcrawley that it still exists

10:33 dang

10:44 Sgeo: An implementation of Clojure in Racket wouldn't suffer from the single-pass issue :p

10:47 tcrawley: thorwil: thanks for passing along the report. it's probably time to move our artifacts to a new provider

10:49 jasonbray: silly question for paredit/nrepl users - if you have paredit on in the repl and want a soft break (i.e. move the closing paren down to the next line without executing the expression), how do you do it?

10:49 xeqi: tcrawley: that clojars thing is just no good

10:49 Sgeo: jasonbray, guessing C-j (Ctrl-J). Not sure though

10:50 jasonbray: thanks Sgeo, that seems to work

10:51 tcrawley: xeqi: heh - this is the immutant zip - it's hosted by cloudbees currently

11:00 milos_cohagen: hey guys/gals.. is there a clojure function which translates a java object graph to clojures map, seq abstractions? sort of like recursive clojure bean function?

11:13 seangrove: Damn, storm is lein1-only

11:13 Just wasted 10 minutes

11:31 TimMc: milos_cohagen: Not that I know of. How would you recognize which fields to bean-ify?

11:49 ,(* -1 0.0)

11:49 clojurebot: -0.0

11:52 milos_cohagen: thx tim, good q, will think about it

11:57 djwonk: TimMc: ah, you are still thinking about that! why is clojure/core.clj the one file that needs to be handled in a single pass?

12:02 seangrove: I'm going to be using storm soon and just found #storm-user

12:03 seangrove: djwonk: Thanks, will join it

12:07 tpope: bbloom: what, like, you want it to quickly error out if you attempt to evaluate something?

12:07 tomoj: &(.equals 0.0 -0.0)

12:07 lazybot: ⇒ false

12:10 tomoj: &(doto (java.util.HashMap.) (.put 0.0 1) (.put -0.0 2))

12:10 lazybot: ⇒ #<HashMap {-0.0=2, 0.0=1}>

12:10 tomoj: good thing clojure saves us from this..

12:11 &{0.0 1 -0.0 2}

12:11 lazybot: java.lang.IllegalArgumentException: Duplicate key: 0.0

12:11 TimMc: djwonk: Hmm, maybe it doesn't.

12:11 I wonder what's with this? (. (var defn) (setMacro))

12:11 tomoj: I guess doubles as hash map keys is always sorta weird anyway

12:12 TimMc: defmacro doesn't exist at that point

12:12 TimMc: tomoj: Sure, but you see ^{:macro true} on vars above it.

12:12 tomoj: note the defmacro's start right after (. (var defmacro) (setMacro))

12:13 interesting

12:13 only on let/loop/fn, which are redefined

12:14 TimMc: loop is declared that way and never has setMacro used on it.

12:14 I see. Most curious.

12:15 tomoj: setMacro just sets that metadata

12:16 TimMc: Must be a leftover.

12:16 tomoj: curious indeed

12:16 TimMc: Well, there's an easy way to check this...

12:17 Eh, I don't feel like rebuilding core.clj. I thought for a moment I could just edit the jar, but it's all AOT'd.

12:27 arrdem: morning all

12:40 antoineB: hello, can i have access to the current namespace from a clojurescript macro?

12:40 there is some hidden var in macro, if i remmember well

13:02 cjfrisz: Anybody run into "Unable to resolve symbol: with-redefs in this context" errors when using compojure and markdown-clj together?

13:03 Cuz I think I just ran into a load-order problem with them

13:04 TimMc: cjfrisz: That's a bad sign -- with-redefs isn't meant to be used in production code.

13:05 cjfrisz: TimMc: I didn't do it! I swear!

13:05 TimMc: But really, I was getting that exception until I switched the load order

13:07 TimMc: And I'm not using with-redefs in my own code

13:11 TimMc: Right, it's probably in one of those libraries.

13:12 cjfrisz: That was a really nasty bug to track down

13:12 Luckily it pretty much got me to find all the actual bugs in my code

13:13 TimMc: yogthos: Argh, you're using with-redefs in markdown-clj!

13:18 zilti: What could be the reason for "CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.Atom@69dc323b" ?

13:25 TimMc: zilti: Bad macro, maybe?

13:26 Sounds like a macro is returning an atom instead of the syntax for creating one.

13:28 zilti: TimMc: Hmm I don't have a macro that has anything to do with atoms.

13:41 pepijndevos: How is fair conjunction as explored by cgrand different from conde? Conde is interleaved, so if one goal is infinite, and the other fails, it will still fail, right?

13:50 * gfredericks /j #concatenative

13:50 gfredericks: pepijndevos: conde is disjunction

13:50 pepijndevos: ah shit...

13:50 ambrosebs: LOL just made the same mistake.

13:50 pepijndevos: ok, thanks

13:51 awww, this is complicated

13:52 gfredericks: computers?

13:52 pepijndevos: I keep thinking there are like 5 people in the entier world who understand relational programming well enough to implement it

13:53 I aspire to be the sixth, but I'm faaar from it, and not making a huge effort either....

13:53 ejackson: and maybe 6 good enough to program with it :)

13:53 gfredericks: I understand it well enough to find bugs for dnolen

13:54 pepijndevos: gfredericks: oh yea, me too :P

14:16 TimMc: technomancy: ISWYM now about javax.mail just implementing the RFC and no more. "The application is responsible for folding and unfolding headers as appropriate."

14:18 yogthos: TimMc: yeah I need to overwrite stuff between clj and cljs

14:19 TimMc: well strictly I don't have to, but it makes sense to use the native .substring for java strings if it's running server side

14:23 TimMc: yogthos: Do macros know what runtime they're expanding for?

14:23 yogthos: TimMc: not sure

14:24 TimMc: so what is so bad about that particular redef? :)

14:25 TimMc: It's not thread-safe.

14:25 yogthos: TimMc: ah

14:25 TimMc: which may not matter here, but still...

14:26 yogthos: cjfrisz was getting some weird errors that might be related to it.

14:26 yogthos: TimMc: yeah it's highly unlikely that would be a problem in this case

14:26 TimMc: I'm imagining a macro that returns the appropriate syntax for your runtime.

14:26 yogthos: TimMc: I could just use the hand rolled substring which works in both, but then it's a performance penalty with little justification

14:27 TimMc: yeah if a macro could do it, that would be a bit cleaner

14:27 gfredericks: why does `lein repl` give me this long list of commands I can't use?

14:27 TimMc: ((->substring) foo bar baz) -> (substring-clj foo bar baz)

14:27 and the ->substring macro could check the environment.

14:27 I know there was some discussion recently about conditional compilation.

14:28 gfredericks: lein2?

14:28 gfredericks: TimMc: yeah

14:28 yogthos: TimMc: there might be a way around it with using a dynamic too

14:28 TimMc: I could declare substring and then inject the actual implementation at runtime

14:29 TimMc: That might not work so well with CLJS.

14:29 yogthos: TimMc: I'll take a look if I can come up with something :)

14:32 TimMc: gfredericks: clojure.repl isn't getting included, or what?

14:32 gfredericks: TimMc: that would explain it; I just don't know why the thing expects it to be included

14:49 yogthos: TimMc: switched to using binding instead

14:49 in v0.9.15

14:55 zilti: Is there a way to force spit to pprint its stuff into the file?

14:55 TimMc: I thought spit already worked with strings.

14:56 I guess not.

14:57 zilti: TimMc: It works with data structures as well, but I'd like it to pprint that stuff.

15:00 bpr: isn't there a var you can rebind with a pretty-printing writer to get pprinting behavior from spit, et. al.?

15:00 zilti: Oh pprint accepts a writer as second argument...

15:09 bpr: zilti: the vars i was thinking of exist in clojure.pprint, fyi

15:17 ravster: hello all

16:00 yedi: is overtone the go to library for all things music related

16:01 pepijndevos: yedi: for some kinds of music...

16:01 there is also some music stuff in Java and big libs like JFuge

16:02 is :arglists on functions a documentation thing, or a reliable source for argument count?

16:17 can a function have metadata, or only its var?

16:21 bpr: pepijndevos: any value can have meta-data

16:22 ToxicFrog: pepijndevos: metadata is tied to the value, not the name(s) bound to it. And yes, functions can have metadata.

16:23 bpr: pepijndevos: note: defn applies metadata to the var

16:23 ,(doc defn)

16:23 clojurebot: "([name doc-string? attr-map? [params*] prepost-map? ...] [name doc-string? attr-map? ([params*] prepost-map? body) + ...]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata. prepost-map defines a map with optional keys :pre and :post that contain collections of pre or post conditions."

16:26 djwonk: Is there a convention for naming params so that it is clear if an atom or ref is expected, as opposed to, say, something more primitive? I'm finding that my code (granted, an early project) has both and it feels messy.

16:30 gnarmis: Hi, I was looking for clojure-clr's 1.5 RC1 binary. Are all the available ones on github?

16:31 ghengis: i usually just append -atom or -ref

16:56 djwonk: ghengis: thanks

16:58 I want to apply a function over a seq. The function calls swap!. When Clojure docs talk about side-effects, does `swap!` count as a side effect? I'm searching around and learning which functions are appropriate.

17:00 AimHere: swap! changes whatever it is you're pointing it at, which is pretty hefty as far as clojure side-effects is concerned

17:02 ghengis: djwonk: "I want to apply a function over a seq".. swap! only works if the seq is in an atom.. it sounds like you're looking for 'apply' or 'map' or 'reduce'

17:03 magnars: concat'ing two vectors and getting a vector back - any better way than taking a detour to linked lists with (vec (concat v1 v2)) ?

17:04 AimHere: If you're doing a lot of concatenating, maybe you should be keeping your data in list form

17:05 Raynes: magnars: (into v1 v2)

17:07 magnars: AimHere: concatenating is more efficient for linked lists than vectors? does it not have to traverse the entirety of the list to find the end?

17:07 Raynes: thanks!

17:07 djwonk: ghengis: probably. I was doing something that didn't make sense now that I look at it again

17:08 AimHere: magnars > once it gets there, it only has to do one little change

17:08 magnars > and yes, more efficient, by a factor of about 10, if my quick experiment just now is to be believed

17:08 magnars: AimHere: nice, thanks for the info

17:09 AimHere: Well all I did was a few (time (def c (concat ...))) and similar to see which was faster

17:09 So don't take it as anything other than a quick handwave

17:09 djwonk: gnarmis: all I know are the downloads here: http://clojure.org/downloads -- I'm personally still using 1.4 via homebrew

17:12 Raynes: I didn't see `into` mentioned on http://clojure.org/data_structures -- how would one go about suggesting that it be added?

17:14 Raynes: I guess posting on the mailing list. Going to church and praying for a while probably wouldn't hurt.

17:15 djwonk: Raynes: I was hoping that https://github.com/clojure/clojure.github.com might be the place to suggest edits, but it is autogenerated

17:18 amalloy: AimHere: (time (def c (concat ...))) doesn't time anything at all

17:18 Raynes: Laziness.

17:18 AimHere: Damn you and your lazy data structures!

17:19 Raynes: amalloy is always around to make someone feel stupid

17:19 o/

17:21 ravster: Can I nest sexp-as-element calls (From clojure.data.xml)?

17:23 amalloy: uhhh, it's just a function, so you can do whatever you want; however i can't see that ending well

17:23 ravster: amalloy: :) hehe, yeah

17:23 *sigh*

17:24 amalloy: whatever problem you're trying to solve either isn't a real problem, or has a better solution than that

17:27 ravster: yeah, I'm trying to build up xml piece-by-piece ,and then put it into higher-level xml

17:27 I need to find the command that allows that. I'm sure there must be something like that provided by the lib

17:29 or I'll just have to start concatenating strings, which feels wrong on so many levels

17:31 djwonk: Is ending functions with a bang `!` recommended if they have side effects? I read somewhere that they are recommended for functions that should be called inside a transaction. (But the latter advice would seem to be already broken w.r.t. swap! -- it needs no transaction)

17:32 ravster: okay, I'm just going to use the 'element' command since that seems to be able to do what I want.

17:32 tmciver: djwonk: I believe that's the convention for functions that mutate one or more of their args.

17:33 zilti: tools.trace would be enormously awesome if it wouldn't break almost everything it touches...

17:34 tomoj: project.clj: https://www.refheap.com/paste/baddf9acdb9b5fd7184457697 , pom.xml: https://www.refheap.com/paste/cf6dde0462c77c73eda0c41d9 . bug?

17:34 note the stanford-corenlp dep is only listen once with no classifier in pom.xml

17:34 this seems to result in it not being included for transitive deps

17:34 (it being the dep with the classifier)

17:35 warning to anyone testing, that "models" jar is pretty big

17:37 djwonk: tmciver: thanks

17:39 bbloom: tpope: yeah, i want a "only do something useful if there is a repl-port file, otherwise immediately tell me there's an error"

17:39 tomoj: hmm https://github.com/technomancy/leiningen/issues/483

17:39 9 months ago? I hope my version isn't >9mo old

17:40 nope

17:41 TimMc: djwonk: should *not* be called inside a transaction

17:42 tpope: bbloom: I'm going to extract the classpath stuff to a separate plugin. if it's not installed, things will fail fast

17:42 bbloom: tpope: what is the class path used for right now?

17:43 tpope: bbloom: the one off runner is the main thing

17:43 bbloom: tpope: yeah, i don't need that :-)

17:43 tpope: bbloom: it's also used to find the current namespace, if a regex can't to the job

17:47 djwonk: TimMc: ok, I see that in the Library Coding Standards. Does the "functions named with a ! should not be called inside a transaction" advice agree / disagree / neither with what tmciver said ("the convention for functions that mutate one or more of their args")

17:48 TimMc: agree

17:48 Transactions may repeat.

17:48 It's not really about mutating args, though.

17:48 any sort of side effect

17:49 djwonk: ok, I think I've got it

17:49 tomoj: println! ?

17:50 :P

17:50 hyPiRion: pr!

17:51 I kind of disagree with one thing in the clojure style guide: "Limit the use of commas in collection literals."

17:51 Raynes: I disagree with the abuse of the word 'syntax'.

17:52 hyPiRion: obviously it depends, but [1 2 3 4] is not the same as [1 2, 3 4], which implies 1 and 2 is grouped together.

17:52 tpope: hyPiRion: he says "limit", but he clearly means "never ever ever ever use them" :/

17:52 he/she/they

17:53 tomoj: always found that kind of odd

17:53 oh, vectors at least don't print with commas

17:53 but &{1 2 3 4 5 6 7 8}

17:53 well, trust me, there are commas :)

17:53 hyPiRion: yeah: {foo x y zap bar gank frob} is more unreadable than {foo x, zap bar, gank frob}

17:54 Well, they're not equal, but you get my point.

17:54 Raynes: &{1 2 3 4 5 6 7 8}

17:54 lazybot: ⇒ {1 2, 3 4, 5 6, 7 8}

17:54 tomoj: which seems great, much more readable. so how come I never put commas in the maps I write..?

17:55 I guess maybe because I can use newlines instead

17:55 amalloy: tomoj: commas generally just get in the way if your keys are keywords; the pairing is then already obvious

17:55 tomoj: good point

17:55 djwonk: hyPiRion you think you have it bad with a syntax disagreement? I have it worse. I think semicolons are just hideous. Clojure had to pick ; and ;; for comments. Ug!

17:56 tpope: djwonk: lisp made that decision 50 years ago

17:56 djwonk: I think my loathing of ; now means I don't like writing comments. Maybe that is good, since I'd rather put everything in a docstring or markdown file.

17:57 tpope: hola. fair point. doesn't mean I have to like how they look. they haven't aged well.

17:57 hyPiRion: djwonk: use #! isntead

17:57 tpope: don't encourage him :)

17:57 hyPiRion: ,(+ 1 2) #! we will never see this

17:57 clojurebot: 3

17:58 tomoj: hmm, I suppose it would be rude to push a 212M jar which is already available in maven central to clojars?

17:58 djwonk: hyPiRion: thanks, now I can trade ugly for hideous

17:58 hyPiRion: djwonk: you're welcome

17:58 You could do #_ instead, that would be even better

17:59 tomoj: oh wait, I have to uberjar anyway, so no need to push to clojars. :'(

17:59 hyPiRion: ,(+ 1 2) #_ just #_ have #_ to #_ do #_ it #_ for #_ every #_ word

17:59 clojurebot: 3

18:01 djwonk: hyPiRion: a problem easily solved with a proper text editor, no doubt

18:01 * djwonk is going to shut up and be glad semicolons work at all

18:10 tpope: bbloom: try :let g:no_foreplay_classpath = 1 with the latest

18:41 ppppaul: lein ring server reloads on code changes, right?

18:41 weavejester: ppppaul: Yep.

18:41 ppppaul: At least, that's the idea :)

18:44 ppppaul: i have a (println) in core.clj, when i change and save the (println) it's not being logged

18:44 hyPiRion: ppppaul: might happen in another thread

18:44 ppppaul: hmm

18:44 weavejester: ppppaul: Which version are you using? Is core.clj under src?

18:45 ppppaul: core.clj is under src/

18:46 any ideas?

18:46 weavejester: It should reload it then… What happens when your restart it? Does the println show up then?

18:46 Also, which version?

18:46 ppppaul: yes

18:46 weavejester: There were bugs in previous versions

18:46 ppppaul: version of ring plugin?

18:46 weavejester: Might be a few still there, but certainly a lot less

18:46 Yep

18:47 ppppaul: [lein-ring "0.7.5"]

18:47 bbloom: tpope: oh so much better :-)

18:47 thanks!

18:47 weavejester: That's the latest version

18:47 What happens when you keep making changes?

18:48 bbloom: tpope: it felt like i was booting visual studio every time i wanted to look at a piece of clj code. i felt myself resist the urge to open vim and was like "WHOA! THAT IS WRONG", hence complaining to you :-) much better now

18:48 ppppaul: weavejester, nothing

18:49 weavejester: ppppaul: Odd. I don't think I've ever seen it fail completely before. I can't think what could cause that.

18:49 ppppaul: weavejester, i just tried without headless and i'm getting an NPE... so maybe that's the problem

18:50 weavejester: Certainly it wouldn't reload if the source file has a syntax error

18:50 Or some sort of error that occurs on load

18:53 brainproxy: ppppaul: what versino of clojure?

18:54 ppppaul: 1.4

18:54 i solved my problem (i think).... NPE was caused by datomic not being started

18:56 fixing the NPE error didn't solve my ring plugin issue, though

18:56 weavejester: ppppaul: Let me see if I can put together a short debug code snippet to try

18:59 ppppaul: https://gist.github.com/4471115

18:59 ppppaul: how do i get ring error/dehub output?

18:59 weavejester: ppppaul: The wrap-stacktrace middleware turned on by default in lein-ring should print exceptions to STDERR

19:01 ppppaul: tracker seems to be working

19:02 weavejester: ppppaul: Hm… I'm not sure what to suggest next. Wrap-reload just reloads all files returned by the ns tracker.

19:02 ppppaul: turned on by default... hmmm i'm not getting any stack traces

19:02 weavejester: ppppaul: Is this an open source project?

19:02 ppppaul: In the terminal?

19:02 ppppaul: it's not an OSS :(

19:02 yes in the terminal

19:02 weavejester: ppppaul: What OS are you using?

19:05 ppppaul: You could try a "lein clean" and then restarting. Maybe something's gone wrong somehow

19:06 It seems odd that wrap-stacktrace and wrap-reload are not working

19:06 Presumably you're executing this through "lein ring server"

19:06 And do not have ":stacktraces? false" and ":auto-reload? false" in your project.clj file

19:07 ppppaul: using ubuntu

19:07 i'm getting stacktraces

19:07 not getting reloading

19:07 i don't have params for ring and i'm doing 'lien ring server-headless'

19:08 weavejester: I thought you said the error wasn't showing up?

19:08 I guess you have a :ring {:handler blah} section at least

19:10 ppppaul: seems like it's reloading, but it's being lazy

19:10 i have to hit the server for it to reload

19:10 weavejester: Ohhhhh!

19:11 You were expecting it to reload instantly?

19:11 It only checks for reloads each request. It's not a continuous background process.

19:11 hyPiRion: heh

19:12 tpope: tufflax: someone added python support to foreplay. you should see if that fixes your second delay issue

19:12 weavejester: BTW, by adding a ":open-browser? false" in your :ring section, you can just use "lein ring server"

19:12 tufflax: tpope: ok

19:16 bbloom: ,(clojure.string/split "x|y|" #"\|")

19:16 clojurebot: ["x" "y"]

19:16 bbloom: :-(

19:16 ,(clojure.string/split "x|y|" #"\|" -1)

19:16 clojurebot: ["x" "y" ""]

19:16 bbloom: stupid java split function.

19:17 that introduced a crazy subtle bug

19:20 a|i: which clojure ide has the best support for the language? something like what eclipse is to java.

19:20 weavejester: The Java regex functions have all sorts of subtle gotchas :/

19:20 a|i: Does emacs could as an IDE? ;)

19:20 a|i: weavejester: NO.

19:20 weavejester: Haha

19:21 bbloom: i hear that eclipse people use counter-clockwise

19:21 cshell: a|i: I use IntelliJ - the La Clojure plugin is nice

19:21 mrowe: a|i: what do you expect an IDE to do for you that emacs doesn't?

19:21 hyPiRion: mrowe: I suppose the keybindings would be a bit different.

19:22 a|i: mrowe: passing the emacs learning curve. I'm already trying to market clojure to my team, they asked if it comes with an ide helping newbies. now you want me to also ask them to learn emacs?

19:22 mrowe: a|i: fair enough. then what cshell said. :)

19:23 but fwiw, learning emacs is totally worth it

19:23 a|i: cshell: is it well maintained, or is it like a hobby project? is it buggy?

19:23 cshell: a|i: JetBrains maintains it and I haven't come across a bug

19:24 a|i it also has a Leiningen plugin if you use that as your build/dependency manager

19:25 seancorfield: FWIW, my team used a mix of Eclipse and Sublime Text 2 so I let them work that way with Clojure for a while and then showed them what my workflow with Emacs looked like... One has switched already, the other is switching soon...

19:25 hyPiRion: seancorfield: Yeah, I think that's nice. Try to learn them one thing at a time. Clojure first, then let them see how you'd work in emacs

19:26 if a|i uses emacs of course.

19:26 seancorfield: So my recommendation is to continue using whatever they're comfortable with today, add a Clojure plugin, teach them the REPL-driven approach and once they're happy with Clojure but frustrated by IDE + REPL limitations, show them Emacs :)

19:26 a|i: cshell: I don't know why chas elerick recommended cc over la clojure in his video: http://www.youtube.com/watch?v=VVd4ow-ZcX0

19:26 seancorfield: ali because chas is a contributor to CCW?

19:27 a|i: I didn't know that :)

19:27 seancorfield: and my understanding is CCW is more actively maintained than La Clojure and more feature rich at this point

19:27 so it really depends whether you're already using Eclipse or IntelliJ

19:28 a|i: seancorfield: which ccw feature is important that la clojure lacks?

19:28 bosie: are private functions really used?

19:28 seancorfield: personally I can't stand IntelliJ... I've tried it several times... JetBrains even comp'd me a license, and then an upgrade, but I still couldn't get used to it...

19:28 ali: i don't really know, i haven't use La Clojure enough...

19:29 hyPiRion: bosie: Private functions is nice if you have some utility function within a namespace you don't want to show to people using the library

19:29 seancorfield: bosie: i use private functions a lot - so my public functions don't get too big

19:29 bosie: seancorfield: ok

19:29 seancorfield: i'll often refactor a public function into several private functions if i feel it is too complex

19:29 bosie: hyPiRion: sure, i know why one would use a private function (in an oop language), just wondering how clojurians look at them

19:29 seancorfield: i find that easier to read than a let with local functions

19:31 bosie: seancorfield: thats a given, even for a newbie like me ;)

19:31 djwonk: am I doing this wrong? (using @ inside swap!) https://gist.github.com/4471273

19:31 hyPiRion: bosie: well, as seancorfield said: To provide a nice face to the outside world, and to provide a nice face internally as well

19:31 bosie: ok

19:32 hyPiRion: djwonk: You might want to have a look at update-in

19:32 bosie: another question that bothered me today. is it possible that midje's provided only works for functions called on the last line?

19:33 djwonk: hyPiRion: thanks, will do

19:33 hyPiRion: (swap! game-atom assoc :players (kill-players (:players @game-atom))) could be written as (swap! game-atom update-in [:players] kill-players)

19:34 seancorfield: bosie: about half our functions are private in our production code base

19:34 djwonk: hyPiRion: that is much cleaner thanks. but is it *wrong* to use the deref (@) inside the swap? does that break rules of atoms? I mean, it seems to work fine when i tried it

19:34 seancorfield: Clojure source 53 files 8300 total loc, 664 fns, 368 of which are private, 97 vars, 2 macros

19:34 bosie: seancorfield: you are using clojure in production?

19:35 seancorfield: yes, since 1.3.0-alpha7 in spring 2011

19:35 bosie: seancorfield: want to share your company? ;)

19:35 seancorfield: World Singles

19:36 in addition to the 8,300 lines of production code, we have ~1,800 lines of unit tests (Expectations) and ~400 lines of WebDriver Clojure code (using clojure.test)

19:36 bosie: interesting

19:36 hyPiRion: djwonk: With multiple threading, it may once a blue moon give you wrong answer. However, with single threading, this should be fine.

19:37 djwonk: hyPiRion: oh fun, I like those kinds of errors. I'll stick to update-in!!

19:38 hyPiRion: heh, smart

20:03 xeqi: Raynes: why laser no have dependency info in readme?

20:03 brehaut: the only dependancy raynes believes in is monster energy drink

20:04 Raynes: xeqi: Because the same info is in the project.clj and it I'll just forget to update it in the README.

20:04 xeqi: how bout a link to the clojars page at the top?

20:04 Raynes: But whyyyyyyyy?

20:05 xeqi: I suppose if you don't bump to a -SNAPSHOT immediatly after release then reading the project.clj is sufficent

20:05 Raynes: I don't do snapshots.

20:05 TimMc: xeqi: You mean the lein dep string for laser.

20:06 xeqi: TimMc: correct

20:06 TimMc: k

20:06 For a moment I thought you wanted Raynes to list out all the dependencies.

20:06 Raynes: xeqi: I'd like for clojars to give me a image or something I can include in my README that always shows the latest version.

20:07 TimMc: Hey Raynes, you're working on that CSS selector syntax for Laser, right? :-P

20:07 xeqi: Raynes: I was just thinking about if there was a good way to do that

20:07 TimMc: ah, like Travis does

20:07 Raynes: TimMc: I am not, but it is something that could happen in the future.

20:07 TimMc: Oh, I thought you were morally opposed to it.

20:07 Raynes: I'm morally opposed to faux css selector vector keyword nonsense.

20:07 TimMc: OK

20:07 Raynes: If I implement CSS selectors, I'll implement CSS selectors.

20:08 Not the weird keyword vector version of it

20:08 bosie: another question that bothered me today. is it possible that midje's provided only works for functions called on the last line?

20:08 xeqi: I also notice the "don't use the global namespace" crowd got to you

20:08 Raynes: xeqi: No, I just really like my name.

20:08 xeqi: oooh, and no .core

20:12 TimMc: xeqi: I'm proud to say that I contributed a patch to lein-newnew that eliminates core.clj when you specify a multi-segment namespace.

20:12 amalloy: i had to stop him from using raynes.raynes.laser.by.raynes.core

20:12 brehaut: TimMc: high five

20:12 (inc timmc)

20:12 lazybot: ⇒ 31

20:13 TimMc: I don't know when or how it will make it into a shell near you, though.

20:14 Raynes: Whenever you add it to your :plugins

20:14 TimMc: Ah, and that overrides whatever version leiningen itself brings along, or what?

20:14 Raynes: Yep.

20:24 muhoo: it looks like it's already merged in? https://github.com/Raynes/lein-newnew/commit/4fe7a9011c8466fabf9e6708291b06b659a89483

20:30 TimMc: muhoo: Merged, but not released.

20:31 hyPiRion: And lein uses an older version

20:48 technomancy: hyPiRion: fwiw the "clojure style guide" is just the opinions of one guy who hasn't even published any code, so don't take it too seriously

20:49 lsdafjklsd_: Hey all!

20:49 I'm doing clojure koans, and this recursive function is blowing my mind

20:49 (defn is-even? [n]

20:49 (if (= n 0)

20:49 true

20:49 (not (is-even? (dec n)))))

20:49 technomancy: lsdafjklsd_: you should see the version with pattern matching

20:49 lsdafjklsd_: how does it get to false? if it isn't true wouldn't it be nil?

20:49 xeqi: paste

20:50 lsdafjklsd_: technomancy: where is that version? btw your clojure contributions are amazing, thank you!

20:50 TimMc: lsdafjklsd_: Walk through it (by hand, or just by looking at it) with 0, and then with 1.

20:51 Also read up on proof by induction. :-)

20:51 lsdafjklsd_: TimMc: yea I get lost when it goes from (not (is-even? dec 5)

20:51 technomancy: lsdafjklsd_: thanks. I don't have any particular implementation in mind; just pointing out that it's much shorter that way

20:52 brainproxy: lsdafjklsd_: the trick is all the "nots" piling up

20:53 TimMc: lsdafjklsd_: If I tell you that is-even? is correct for n from 1..x, then you don't need to recurse past x. I then ask you how to find out if x+1 is even. What's a way of finding out using the tools at hand?

20:56 lsdafjklsd_: brainproxy: ahhh so it ends up being like (not (not (not (not true))))

20:57 hyPiRion: exactly :)

20:57 lsdafjklsd_: that is amazing

20:59 hyPiRion: ,(let [even? (partial nth (iterate not true))] (map even? (range)))

20:59 clojurebot: (true false true false true ...)

21:11 dcb: tpope: I asked you a couple days ago about getting an ABRT signal in VIM with foreplay. I am reasonably sure I narrowed it down to https://github.com/kien/ctrlp.vim, the weird thing is that plugin doesn't have any ruby

21:12 tpope: dcb: I only vaguely remember. is this a consistently reproducible problem?

21:12 dcb: Kind of. It only happens rarely, I

21:12 tpope: I'd estimate once in about 25 :Eval

21:12 tpope: I have ctrlp installed don't really use it

21:13 a|i: how fast is clojure xml parser, compared to other jvm xml libs?

21:14 tpope: dcb: someone sent in a patch today to add support for the python interface. you could try that (you'll have to delete the if has('ruby') stuff from the nrepl adapter in order for it to kick in)

21:16 dcb: tpope: OK, I'll try that. Thanks

21:16 tpope: dcb: report back after you've put it through its paces. I'm willing to consider giving it priority over the ruby one

21:17 dcb: just to be clear your talking about the block starting line 198 here: https://github.com/tpope/vim-foreplay/blob/master/autoload/nrepl/foreplay_connection.vim

21:18 tpope: dcb: yeah, delete from that through the endif

21:18 dcb: tpope: OK, will do

21:21 a|i: why would clojur ebe 10x slower than java? http://benchmarksgame.alioth.debian.org/u64q/clojure.php

21:23 technomancy: a|i: because the alioth benchmarks are not accurate?

21:23 it's just a game

21:23 a|i: technomancy: what do you mean not accurate? the code is there, you can run it on your machine.

21:23 technomancy: they measure who has had the most time to waste playing the game and are completely unrelated to real-world issues

21:24 a|i: "which language is faster?" is a stupid question

21:24 speed is not a property of a language but of a program

21:24 a|i: technomancy: well, the charts say c is the fastest, and it's true in most of applications.

21:24 technomancy: "which program makes it easier to write fast programs" is a more interesting question, but it's not the question that the alioth benchmarks ask

21:24 a|i: it doesn't have to be 100% accurate, but it gives to the big picture.

21:25 technomancy: it gives *a* big picture

21:25 but not one that is helpful in making actual decisions

21:25 a|i: back to my question, clojure compiles to jvm bytecode, why would it be slower than java?

21:26 technomancy: because clojure people have better things to do with their time than waste it on games?

21:26 or if they do, they'll waste it on games that are actually fun =)

21:26 mjc: if you spent several hours expanding out what exactly "it" means in that question, you might be able to answer it

21:27 technomancy: maybe if Alioth added boss battles and experience points they'd get better submissions =)

21:27 clojurebot: excusez-moi

21:27 a|i: technomancy: would you say the same as what you just sais, if clojure results were faster than java in shootout?

21:28 technomancy: I don't care about the shootout

21:28 OCaml is my second-favourite language, and it usually beats nearly everything but C

21:28 all that means is it's possible to write fast code in it

21:29 doesn't mean it's easy or worthwhile

21:29 and the lack of a fast alioth entry has nothing to do with whether it's possible

21:51 bpr: a|i: fyi, i have looked at some of the alioth clojure code... much of it is *horrendous* from a perf point of view

21:51 a|i: bpr: aren't those codes maintained by community? don't people submit changes?

21:52 bpr: a|i: and, as technomancy was saying, i have no interest in write code that's "better" for alioth

21:52 writing*

21:53 a|i: why not.

21:53 xeqi: nothing wrong with games, keep meaning to pickup xenoblade again since I paused halfway through it

21:53 bpr: I can make $$ doing other things is one reason. I'm not interested is another.

21:54 Further, technomancy's point that performance is a property of a program and not a language is valid

21:58 djwonk: performance is a combination of expectations, program, language, hardware, and space-time.

21:58 i was joking about space-time but there is the usual space vs. time tradeoff

22:04 bbloom: is there a trick to getting reduced to produce a lazy sequence? is it just cons and lazy-seq ?

22:05 s/reduced/reduce

22:12 TimMc: bbloom: I'm trying to imagine what that would look like.

22:12 You don't mean reductions, do you?

22:12 bbloom: TimMc: i'm staring at reductions right now trying to see if that makes any sense to me :-P

22:13 i know what the reductions function does, but it's not what i need precisely

22:13 consider implementing filter in terms of reduce

22:14 i think i just want manual recursion with lazy-seq instead of reduce

22:14 TimMc: Yes.

22:14 Definitely.

22:14 Put down the stick and back slowly away from reduce.

22:14 bbloom: haha

22:22 TimMc: Oh dammit, "°" doesn't transmit well over SMS...

22:34 djwonk: are macros generally required (instead of functions) if I have behavior that involves not evaluating an expression based on a condition? currently, I'm doing a lot of if … throw that feels like boilerplate.

22:34 muhoo: reducers are pretty cool

22:35 TimMc: djwonk: Control flow, delayed eval, etc. Yeah.

22:35 Boilerplate.

22:36 djwonk: TimMc ok, I was trying to put off writing my own macros until I felt the pain . now I do

22:36 TimMc: Do you have experience with them in some other lisp?

22:37 djwonk: TimMc nope. I've read the O'Reilly book and the PragProg book, so I think I'll do ok

22:37 TimMc: Just repeat this mantra: "Macros are syntax transformers; they do not see runtime values." and you'll be OK. :-P

22:38 It's surprisingly hard to keep that in mind.

22:38 djwonk: thanks

22:40 hmm, I may not need one yet after all. though I look forward to

22:40 bja: this happens to me at least once a day: "that seems stupid, why doesn't core just do [partial solution to problem]?" *goes to ask in IRC* .... maybe I should think this through one more time ... *enlightenment*

22:43 TimMc: ~#19

22:43 clojurebot: 19. A language that doesn't affect the way you think about programming, is not worth knowing. -- Alan J. Perlis

22:44 djwonk: ~#42

22:44 clojurebot: 42. You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN. -- Alan J. Perlis

22:55 djwonk: ,(->> "FORTRAN" (map int) (map str) (clojure.string/join) read-string)

22:55 clojurebot: 70798284826578

22:55 djwonk: ~#70798284826578

22:55 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "70798284826578">

22:56 gtrak: re cljs: is there a better way to inspect js objects than the js console log?

22:57 ibdknox: gtrak: browser or node?

22:57 gtrak: browser

22:57 ibdknox: no

22:57 bja: alert?

22:58 gtrak: just finally playing around with it :-D, I feel a bit naked without code-follow and introspection.

22:58 but browser-repl is mostly fun

23:00 muhoo: wasnt' a new version of fortram what guy steele was working on?

23:00 *fortran

23:01 the project got shut down, iirc, but not before he made that presentation that inspired rhickey to write reducers

23:01 brehaut: fortress

23:01 http://en.wikipedia.org/wiki/Fortress_(programming_language)

23:06 gtrak: muhoo: from what I gather, fortran sucks as a language, but there was a lot of work later on into parallelizing it. It's used for heavy numerical code.

23:09 djwonk: I'm glad to see http://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway mentioning Clojure's unintuitive compilation units

23:10 gtrak: what's unintuitive about it?

23:10 TimMc: I don't find it unintuitive, per se... just overly restrictive.

23:11 djwonk: ok, well, most programmers 'intuitively' read top to bottom.

23:11 as do most people

23:11 gtrak: ah, yea. I guess so. I learned on C first, so it made sense to me.

23:12 TimMc: Hmm, my program has either learned Chinese or has a bug.

23:12 I'm going with the former. :-D

23:12 ppppaul: hey guys, i'm having issues with ring responses

23:12 djwonk: not to start another round (we chatted yesterday about it) but it is cool to see someone with way more experience than I still admitting that it is painful. many people just bury the pain and/or rationalize it away

23:13 and there are some cool ideas in that section; for example, transactional code loading

23:13 ppppaul: (-> (response {:conflict key})(status ,, :409)) is returning a body that contains :body :status :headers...

23:13 gtrak: djwonk: I find it more weird to deal with watching the error count go down from 1000's to zero when java compiles in eclipse, then sometimes it just gives up and trashes your project.

23:14 I think most folks just complain about the early-binding aspect of it.

23:14 jonasen: kovas: {:op :interrupt} is broken, but I'm working on it :)

23:15 djwonk: gtrak: what do you mean by complaints about early binding?

23:16 gtrak: I think python's got a similar top-to-bottom read strategy, but you can call functions defined below without an error, because the names are resolved at runtime

23:16 clojure opts to be fast and doesn't do that

23:17 I don't mind so much, because I think it adds some consistency

23:17 tmciver: ppppaul: (-> (response {:conflict :key}) (status 409)) works for me.

23:18 ppppaul: gives: {:status 409, :headers {}, :body {:conflict :key}}

23:18 djwonk: gtrak: yeah, I think there are good reasons for the way compilation happens. still, when it comes to reading a library (with my eyes) I want the high level at the top

23:18 with more experience, I might have some ideas on how to do both, but as of now, I got nothing

23:19 ppppaul: oh, i misunderstood how try/catch was working and i was doing (response (response))

23:21 kovas: jonasen: cool

23:22 jonasen: I'm also thinking of writing the UI in some form of AngularJS

23:22 jonasen: kovas: that would be interesting

23:22 kovas: jonasen: seems like a good way of representing components

23:22 gtrak: (defmacro erujolc [& body] `(do ~@(reverse body)))

23:23 jonasen: kovas: would we switch to JSON on the wire?

23:23 or still use EDN

23:23 kovas: jonasen: edn still

23:24 jonasen: kovas: cool

23:24 kovas: jonasen: but it should be possible to simplify the loading and communications process

23:26 jonasen: kovas: Would you still be using ClojureScript?

23:26 kovas: jonasen: definitely

23:27 jonasen: cool, I haven't seen any AngularJS/ClojureScript examples.. Have you tried anything yet?

23:27 kovas: I've found 2 examples

23:27 but none of them introduce any higher level abstractions

23:27 just js interop

23:27 i think introducing a custom reference type will get the job done

23:28 djwonk: gtrak: my 'ideal' macro would extract all def's and pre-declare them so order did not matter

23:29 kovas: jonasen: https://gist.github.com/3856153

23:29 TimMc: djwonk: You could probably do that with little effort.

23:29 djwonk: TimMc: that would be cool. I will try.

23:29 kovas: some macros can also help clean things up

23:30 tomoj: (defmacro foo [] `(def ~'foo 3)) (foo)

23:30 ?

23:30 TimMc: It could bail out if it sees any non-defn top-level forms.

23:30 jonasen: kovas: Could you give a quick overview of session terminology, specifically the difference between Session/Subsession/Loop?

23:30 djwonk: TimMc: is there any way to keep current indentation -- everything would need to be nested, right?

23:31 kovas: jonasen: the subsession was intended to accommodate multiple evaluators, for instance both clj and cljs at the same time

23:31 gtrak: djwonk: doubtful without some sort of mutable stack on a reader

23:31 jonasen: kovas: I'd like to know which of these map closest to a nrepl session (unfortunate clash of terminology)

23:31 TimMc: djwonk: Oh, you want to print out a new version of the source? That's not going to do what you want.

23:32 kovas: jonasen: we are gonna get rid of the subsession

23:32 TimMc: You'd need a reader-sugar-preserving syntax transformer.

23:32 jonasen: kovas: ok.

23:32 kovas: jonasen: its just a historical artifact, from porting my original document-based session to datomic

23:32 jonasen: kovas: Maybe we could make Session Session == Nrepl Session?

23:32 djwonk: TimMc: that would be cool, but Clojure doesn't allow that, does it?

23:33 TimMc: Nope. Some folks are working on libs for tha, I think.

23:33 kovas: jonasen: yeah thats an issue also on my mind

23:33 jonasen: the way i look at it now

23:33 jonasen: session is a computational model currently with 3 interfaces

23:34 jonasen: datomic, nrepl, and human UI

23:34 jonasen: if you speak any of those things, you can participate in session

23:34 jonasen: but I don't want to close the door on other APIs

23:35 jonasen: the main question right now is, should nrepl be hidden behind a more general interface/schema, or exist on its own as a top-level thing

23:35 jonasen: and I'm not sure yet

23:36 jonasen: kovas: ok.

23:36 kovas: jonasen: it would be interesting to see what other interfaces would look like. For instance to S3, or a seesaw UI

23:37 jonasen: in any case, positioning session as a kind of nrepl serialization middleware would be appealing to a lot of people i think

23:38 jonasen: they can just continue using emacs for now, and have stuff logged in the background, and then later graduate to the web UI for plotting etc

23:39 jonasen: kovas: yes, I think a solid web interface to nrepl would be useful thing

23:40 kovas: jonasen: I'm pretty close to being able to use session at my job

23:40 jonasen: which would be great since then i'll have more time to work on it :)

23:40 jonasen: kovas: awesome!

23:41 tomoj: "session"...?

23:41 kovas: tomoj: https://github.com/kovasb/session

23:41 tomoj: that was a complaint, but an unjustified one, since google found that repo for "clojure session"

23:41 surprisingly..

23:41 kovas: haha

23:42 yeah jonasen and i have been hacking the last couple of weeks

23:43 jonasen: kovas: I gotta run... christmas vacation is now officially over :(

23:43 kovas: jonasen: same here :/

23:43 adios!

23:58 TimMc: Hey, I can't find -?> in 1.4.0 -- did it get removed?

23:58 gtrak: in incubator?

23:59 TimMc: I don't see incubator.

23:59 Oh, it's a contrib? Bleh.

23:59 tpope: you mean 1.5.0?

23:59 oh

23:59 dog_cat11: &(reduce + [1 2 3 4 5])

23:59 lazybot: ⇒ 15

Logging service provided by n01se.net