#clojure log - Aug 06 2014

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

1:18 gazarsgo: i think my head is going to explode from IllegalStateException xxxx already refers to :(

1:18 Balveda: I think I get the joke about Emacs being an OS

1:18 gazarsgo: i am trying to follow the recommendation here: http://stackoverflow.com/questions/4648634/getting-illegalstateexception-when-reloading-a-namespace-in-the-repl but with no luck :(

1:18 Balveda: Weird that you can get in IRC with a text editor

1:31 visof: hi

1:32 what is the best way to set config for use in the code, as example: if i want to start a server from clojure code, i need to set port, URL, ..., in c as example i can define these config as #define or enum, what is the best habit to do this in clojure

1:32 ?

1:32 currently i'm using (def port "1234")

1:33 is this the best?

1:34 gazarsgo: should i have one test per deftest ?

1:42 mynomoto: visof: there is a lot of options. You can use something like https://github.com/weavejester/environ to use environment variables to configure your app.

1:44 visof: Or you could put those things on a map like (def config {:port 1234 :url "my-url"})

1:44 visof: and there is the component approach: https://github.com/stuartsierra/component

1:44 gazarsgo: anyone have a second to look at https://github.com/ralph-tice/riemann-jvm-profiler/blob/prefix_adjustment/test/riemann/jvm_profiler/core_test.clj and suggest how i might shadow clojure.test/report correctly ?

1:46 mynomoto: gazarsgo: You can have several assertions in a single deftest.

1:46 gazarsgo: mynomoto: i am still a little confused how deftest relates to testing

1:47 just a label for my block of assertions ?

1:47 Balveda: (map [1 2 3])

1:47 whoops

1:48 mynomoto: gazarsgo: You could call deftest that. Take a look at http://stackoverflow.com/questions/24970853/run-one-clojure-test-not-all-tests-in-a-namespace-with-fixtures-from-the-rep

1:50 gazarsgo: the namespace i'm testing has a method that already exists in clojure.test

1:53 mynomoto: gazarsgo: and? Are you using :refer :all or :use? You don't need to do that.

1:54 gazarsgo: trying to resolve my illegalstateexception for shadowing reports wrong ...

1:55 if ijust require clojure.test i get a unable to resolve symbol

1:56 if i require w/o :refer :all or :use on the namespace i'm testing i also get unable to resolve symbol ( for symbols in the namespace under test ... )

1:57 if i use both namepsace under test and clojure.test i get illegalstateexception on shadowing a core function...

1:59 mynomoto: gazarsgo: Can I see the namespace? Can you gist it? or refheap?

1:59 gazarsgo: i linked the github above, https://github.com/ralph-tice/riemann-jvm-profiler/blob/prefix_adjustment/test/riemann/jvm_profiler/core_test.clj

2:03 mynomoto: gazarsgo: Sorry, I don't have riemann installed.

2:03 gazarsgo: can you not run `lein test` without riemann installed ? that's unfortunate

2:04 mynomoto: I can't. I got java.io.FileNotFoundException: Could not locate riemann_jvm/core_test__init.class or riemann_jvm/core_test.clj on classpath

2:05 gazarsgo: gist the error then. Maybe I still could help...

2:05 gazarsgo: IllegalStateException: report already refers to: #'clojure.test/report in namespace: riemann.jvm-profiler.core-test

2:06 also that error is on master, prob have to checkout prefix_adjustment branch to see my stuff

2:06 (the error you posted, not mine above)

2:07 i have a project to reproduce the issue cleanly, let me push it up

2:08 https://github.com/ralph-tice/clojure-shadowing

2:08 mynomoto: gazarsgo: on your branch the tests run successfully.

2:09 gazarsgo: ah, yeah, but i have test/deftest in the test...

2:09 mynomoto: gazarsgo: But that's what you need.

2:10 gazarsgo: i should be able to include the namespace except for the function i want to shadow ?

2:10 mynomoto: If you gave an alias to a namespace you need to use that to refer the namespace.

2:11 gazarsgo: i would like to include the clojure.test namespace and shadow the clojure.test report function

2:16 mynomoto: gazarsgo: you may use (:use clojure.test :exclude [report])

2:17 gazarsgo: :exclude is not a valid option to use :(

2:17 java.lang.Exception: Unsupported option(s) supplied: :exclude

2:17 i'm going to sleep on it, thanks for the second pair of eyes

2:18 mynomoto: gazarsgo: it used to be, but I'm not sure about inside the ns macro.

2:18 gazarsgo: naming things still doing its best to rank up there on most difficult problems :)

2:20 mynomoto: gazarsgo: you can also :refer only what you are going to use.

2:20 gazarsgo: and that I'm sure it works.

2:23 gazarsgo: also I just tested and :use with :exclude just worked on your example.

2:46 EnglishGent: Hi! I seem to be struggling with nrepl

2:46 specifically it won't give me the option to jack-in

2:46 anyone able to help?

2:46 Thanks! :)

2:54 zeebrah: EnglishGent: try cider?

2:56 gazarsgo: mynomoto: must be past my bedtime, i got it working now too, thanks

2:57 oh, i didn't have exclude inside the [] of my :use before

2:57 EnglishGent: hi zeebrah

2:57 I thought Cider was something complimentary

2:57 I'm new to clojure - first I hear I wanted to go looking for something called Slime

2:58 and then I was told 'no - nrepl is more modern'

2:58 (this from googling)

2:58 zeebrah: EnglishGent: just try cider dont worry about nrepl, first remove it if you have installed it

2:58 EnglishGent: ok - thanks - I shall do that :)

4:58 lvh: tbaldridge: Hi! I was watching your core.async talk http://www.infoq.com/presentations/clojure-library-core-async ; at 20:07 (re: logging channel); why is that channel unbuffered?

4:59 IIUC that means stuff parks/blocks when that channel is busy

4:59 presumably you also don't want to throw data away, so that makes sense

4:59 but Ig uess println is usually fast enough?

5:43 visof: hi

5:44 this line (.createIndex graph "name" Vertex) is the right clojure equivalent to java graph.createKeyIndex("name", Vertex.class); right?

5:46 Bronsa: right

5:56 kstrempel: nearly.. graph.createIndex .. not graph.createKeyIndex..

6:03 michaelr525: hi

6:03 REPL server launch timed out.

6:04 How to debug this ^^^^?

6:07 oh

6:07 it was :jvm-opts ["-XX:-OmitStackTraceInFastThrow"]

6:07 removing it solved the problem

6:22 lvh: so, in emacs, when I do C-c C-e, the sexp gets evald in the running repl

6:22 however, I see the result in the minibuffer

6:22 is there a way to copy the expr into the repl window instead?

6:22 or at least not in the minibuffer

6:23 llasram: lvh: The result will be bound to the var `*1` in your repl

6:23 wagjo: ,(pop nil)

6:23 clojurebot: nil

6:23 wagjo: ,(pop [])

6:23 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>

6:24 llasram: lvh: You can also use the C-u universal prefix to cause CIDER to insert the evaluation result at point

6:26 lvh: llasram: yeah but I'm not really worried about being able to use the result

6:26 llasram: C-u C-c C-e?

6:26 llasram: I just want to be able to review the stuff I was doing

6:28 llasram: Well then there you go

6:28 And having it bound to `*1` means you can e.g. just print it again

6:46 lvh: llasram: ah, right, but I don't really want it at point. I want it to look like I killed the expression and moved it to the repl and pressed enter

7:09 alexanderkyte: How do I create a typecasted null in clojure?

7:09 The use case is this: http://stackoverflow.com/a/13186744/3745283

7:11 wagjo: alexanderkyte: how about this approach: (let [^java.lang.String null-string nil] ...)

7:12 Bronsa: alexanderkyte: ^String (identity nil) should work

7:12 or what wagjo said

7:13 alexanderkyte: Ah so it's the "^Type nil" literal that's thrown out but a created nil is fine?

7:18 scape_: how do I get the new cider? when i refresh package contents for melpa and reinstall cider it compiles and installs but is still an older version

7:19 wagjo: alexanderkyte: difference is where you put the hint. typehinting a constant mostly does not work as expected. Rule of thumb is to always typehint a symbol.

7:37 thesaskwatch: Hi, I'm trying to convert a hex string to java byte array. (I have 128 bit aes key represented as hex string). How would you do that? I got to the point where I have a seq of integers (0-255).

7:37 When I try to convert that to bytes I get an error, because java bytes is signed

7:38 well .. I could just subtract 128 from every int

7:58 scape_: try unchecked-byte

8:00 ,(unchecked-byte 255)

8:00 clojurebot: -1

8:15 krumholt: ,(java.util.Arrays/toString (.toByteArray (java.math.BigInteger. "756B60D" 16)))

8:15 clojurebot: "[7, 86, -74, 13]"

8:15 krumholt: thesaskwatch, that might work

8:16 SagiCZ1: ,(= (Integer. 3) 3)

8:16 clojurebot: true

8:16 SagiCZ1: ,(= (Double. 3.4) 3.4)

8:16 clojurebot: true

8:16 SagiCZ1: ,(= (Integer. 1) (new Integer 1))

8:16 clojurebot: true

8:17 thesaskwatch: krumholt: thanks

8:17 SagiCZ1: how does the dot operator work instead of new?

8:17 thesaskwatch: krumholt: but I did it like this https://gist.github.com/mateusz-fiolka/a9db9a4c16a8761fdd01 Quite long but seems to work

8:18 TEttinger: SagiCZ1, I believe a . after a java class name just translates to "new JavaClassWhatever"

8:18 krumholt: thesaskwatch, that'll work too. BigInteger constructor probably does the same thing

8:18 SagiCZ1: TEttinger: But its not a macro right? how did they implement that

8:18 TEttinger: . is a reader macro I think

8:19 part of the core language maybe.

8:19 SagiCZ1: defmacro is not a reader macro?

8:19 TEttinger: not sure. so ^ is a reader macro

8:19 I think defmacro is a regular macro

8:19 another example is #{}

8:20 that turns into a constructor for a set, using a reader macro

8:20 SagiCZ1: i see.. that does make sense

8:20 ,(= (set 1 2) #{1 2})

8:20 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/set>

8:20 SagiCZ1: ,(= (set [1 2]) #{1 2})

8:20 clojurebot: true

8:21 TEttinger: ,(= (vector 1 2) [1 2])

8:21 clojurebot: true

8:23 SagiCZ1: TEttinger: thank you.

8:23 ,(= [] vector)

8:23 clojurebot: false

8:24 SagiCZ1: so i cant use [] as a function

8:24 TEttinger: ,(= [] (vector))

8:24 clojurebot: true

8:24 SagiCZ1: darn.. so close

8:24 TEttinger: but yeah, there I am creating a vector on either side

8:24 justin_smith: SagiCZ1: regarding MyClass. and new - it technically does not translate into "new MyClass()", since clojure does not compile into java, it generates bytecode that is equivalent to what java would create for new though

8:25 SagiCZ1: justin_smith: so there is no real difference from my point in using .MyClass and new Class right? its just a matter of preference?

8:25 justin_smith: the "new" syntax in clojure is depricated

8:26 SagiCZ1: (doc new)

8:26 clojurebot: Titim gan éirí ort.

8:26 SagiCZ1: wow

8:26 TEttinger: comparing to vector with no parentheses is not calling the function vector, it is actually comparing to the function itself -- which is something like a clojure version of "new Vector()"

8:28 SagiCZ1: and how do i acess static members?

8:28 (.MAX_VALUE Double)

8:28 ,(.MAX_VALUE Double)

8:28 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: MAX_VALUE for class java.lang.Class>

8:29 hyPiRion: SagiCZ1: Double/MAX_VALUE

8:29 SagiCZ1: ,Double/MAX_VALUE

8:29 clojurebot: 1.7976931348623157E308

8:29 SagiCZ1: ok.. and non-static members with the dots.. ok i will remember it now.. thanks

8:30 Janiczek: Anybody knows how to get test.check to generate strings of less than 6 characters? (I see `resize` - but that makes them strictly 6 characters, and `such-that`, which fails later as it tries to increase the size)

8:31 TEttinger: Janiczek, resize to (inc (rand-int 5))

8:33 Janiczek: TEttinger: ah, clever! works, thanks :)

8:57 afhammad: Can anyone shed some light on this: https://github.com/michaelklishin/monger/issues/85#issuecomment-51324282

8:59 silasdavis: if I have a function of a protocol defined on a record

9:00 that does not make use of the record fields

9:00 i.e. it is essentially static

9:00 is there a way I can call it without instantiating the record

9:00 ?

9:01 justin_smith: silasdavis: sounds like someone should have defined it as a standalone function

9:03 silasdavis: well the function belongs to the type

9:03 so I'd have to mechanically link the standalone version to the record if I moved it out

9:18 lvh: Is it wrong of me to want core.logic to interpret nil as not-a-constraint == succeed?

9:18 it makes constraints that only occasionally apply that much easier

9:23 Bronsa: puredanger: are you by any chance familiar with the implementation of static invokes in the direct branch?

9:24 puredanger: some

9:24 Bronsa: well, do you happen to know why fns with an enclosing function cannot be eligible for the staticInvoke optimization?

9:25 I'm talking about the !fn.hashEnclosingMethod test here https://github.com/clojure/clojure/commit/7806e33eb6a68c528095a6afebf1076124b4ee5f#diff-f17f860d14163523f1e1308ece478ddbR3928

9:28 clgv: Bronsa: is that canBeDirect stuff a new feature for 1.7?

9:28 Bronsa: clgv: it's in a branch for now, no idea if it's going to make 1.7 but I think so

9:29 clgv: Bronsa: ok it's a feature experiment for now ^^

9:29 Bronsa: that ^:static metadata has no effect in current clojure right?

9:29 Bronsa: right

9:30 puredanger: clgv: it's experimental, release TBD

9:30 clgv: I saw it in core a while back and wondered what it was

9:30 puredanger: Bronsa: I believe that's for a defn enclosed in an enclosing form, right?

9:31 Bronsa: puredanger: should be for every fn inside another fn, not necessarily a defn

9:33 puredanger: I assume b/c it might need class state that's not static, but I don't actually know for sure

9:33 like other closed over things?

9:33 justin_smith: yeah, closed over stuff that would be attached to the wrapping instance, right?

9:34 and if it doesn't have those, why is it embedded in the first case

9:34 Bronsa: shouldn't be for closed overs, that's taken care by the other check

9:34 fn.closes.count() == 0

9:35 I guess I'l play around and see what fails when I remove that check

9:41 puredanger: right

9:41 reiddraper: Janiczek: or just take the first 5 characters of the string (fmap #(take 5 %) string)

9:41 puredanger: it's also possible that's just scoping work and is temporary. similarly, self calls are not currently handled but I think Rich had a plan for those too.

9:42 justin_smith: reiddraper: is fmap that utility function that is like map but it preserves the input type? where is it defined?

9:43 reiddraper: justin_smith: nah, it's a test.check specific thing. clojure.test.check.generators/fmap

9:43 justin_smith: oh, ok

9:43 Bronsa: puredanger: cool, I was thinking about that aswell. currently if the this local is referenced the fn is not eligible for staticInvoke when it should actually only be when the local is used as a value

9:44 puredanger: Bronsa: if you're looking at direct, there is also a missing check for dynamic vars in StaticInvokeExpr.parse(). Needs an "if(v.isDynamic()) return null;" near the top - I don't think that ever got committed.

9:47 Janiczek: reiddraper: nice, thanks!

9:52 thheller: puredanger: great to see progress on CLJS-27, any plans for clojure though? doesn't seem all that useful unless we have the same for clj

9:53 Bronsa: puredanger: ah right, thanks. I'm just looking at direct to get an idea on what needs to be done to port that to tools.analyzer.jvm

9:53 dnolen_: thheller: there's work in progress in all the necessary places for this

9:53 thheller: awesome

9:55 puredanger: I haven't done anything with tools.analyzer.jvm yet. patches for cli, cljs, and tools.reader are all linked from http://dev.clojure.org/display/design/Feature+Expressions at the bottom

9:55 s/cli/clj/

9:56 Bronsa: not sure I understand what tools.analyzer.jvm has to do with feature exprs

9:57 thheller: ah thx

10:06 puredanger: Bronsa: sorry, looks like I crossed the streams on direct and feature expressions there :)

10:39 modulus: hi there, when i start lein repl outside a project dir i get a lot of errors, they seem to be related to unknown source for clojure.tools.nrepl.StdoutBuffer.length ... any ideas?

10:40 trptcolin: modulus: yep, being fixed

10:40 hyPiRion: modulus: `lein downgrade 2.4.2` – it's a bug

10:40 modulus: ah many thanks!

10:40 hyPiRion: we're on it

10:40 well, trptcolin is at least :p

10:42 trptcolin: it's an nrepl version mismatch; lein master is patched now, but still need to sort what allowed/caused transitive deps to change from lein-source to lein-uberjarred

10:44 modulus: that's great then, if it's under control.

10:44 it seems to work ok inside projects, or at least inside some of them

10:44 trptcolin: yes

10:49 modulus: laters

10:54 tadni_: Is Clojure well suited for an introductory language?

10:54 justin_smith: tadni_: racket has many of the same benefits, but is much more beginner friendly

10:55 but clojure has benefits for large scale usage server side (because it compiles to the jvm and can easily call java code)

10:57 nlminhtl: Does some easy way exist to remove all xml tags from the string?

10:57 tadni_: So the lack thereof of teaching materials at the introductory level, does not make it compelling over Racket -- as-is now?

10:58 justin_smith: tadni_: not just teachning materials - it's just not designed to be beginner friendly

10:59 tadni_: Besides concurrency, what else may be inherently "more complicated" over other Lisps?

11:00 justin_smith: tadni_: many constructs and features of clojure are dependent on the underlying platform

11:00 tadni_: That being the JVM, or?

11:00 justin_smith: tadni_: or the clr or javascript or whatever

11:00 but usually that means the jvm

11:02 tadni_: Why would it being dependent on x,y,z be relevant to a new user?

11:03 justin_smith: tadni_ it's not just that it relies on the jvm, but parts of the language are driven not by the logic of the language, but that of the jvm

11:03 whereas ie. racket would be more abstract

11:03 (and conceptually simpler)

11:03 tadni_: Ah, well that stinks a bit.

11:03 justin_smith: tadni_: it means clojure can be more pragmatic, and perform better. And it means racket is easier to learn.

11:04 for example in jvm clojure it is a priority that you should be able to call clojure from java programs

11:04 tadni_: Ah.

11:05 justin_smith: so this limits the way certain things in clojure are designed (and makes clojure more powerful than it would be otherwise)

11:06 to go into more detail - clojure fn is a callable and runnable object

11:06 * tadni_ guesses he'll still plan on learning ELisp as more a or a less his first language. :-P

11:07 justin_smith: eww... elisp makes similar concessions - jut to c instead of the jvm

11:07 tadni_: Meh, it's not something you actively have to deal with though.

11:08 justin_smith: it's a limited and sloppily designed language compared to racket or clojure

11:09 I write elisp, because I like emacs and use it all the time, but I would not recommend it as a first language - if the choices are really elisp and clojure pick clojure, but I think racket scheme is an ideal first language

11:09 tadni_: Its still practical and relevant to my interests though. I use Emacs as my daily driver, and would love to be able to hack it.

11:10 justin_smith: it also lacks namespaces, and poorly written elisp will segfault and crash your emacs (be ready to have two emacs processes running- one for writing code and the other for testing it)

11:10 tadni_: By no means, is it even in the top 10 of "starter" friendly langs though, yeah.

11:12 justin_smith: elisp does have good tooling integration inside emacs though, including a nice step debugger

11:12 which is more than we can say for clojure

11:12 but racket has much more for learning support than either

11:12 tadni_: I was considering Guile, but until Guilemacs is a drop-in replacement, such a thing is not all too relevant to me yet. But at that point, I'd just go through SICP.

11:13 justin_smith: racket is much more similar to clojure than guile is

11:13 (in the good ways)

11:13 tadni_: Can I get a brief list of how-so?

11:14 justin_smith: immutible datatypes, reference types

11:14 direct support for immutible hash-maps and vectors

11:15 also, racket supports literal immutible hash-tables (but the syntax is much uglier than for clojure)

11:15 * tadni_ is a fairly big GNU fan, so he will likely find himself using Guile eventually regardless ... Especially as the official GNU distro is slated to release featuring two prominent Guile projects. :-P

11:16 tadni_: Racket is no-longer a "scheme" right?

11:16 justin_smith: it has scheme compatibility as an option, but is a superset

11:16 tadni_: Ah, okay.

11:17 justin_smith: I'm a gnu fan also, and have written much more guile code than racket code, but racket is much cleaner, and is directly designed for learning

11:18 it supports "dialects" that let you pick feature sets for a given program

11:18 tadni_: Yeah, I've noticed. If I already wasn't on such a guided path, thanks to Emacs... I'm sure I'd be doing Racket.

11:19 justin_smith: also, most elisp code is in no way functional

11:20 not to say you can't do fp in elisp, but I don't think immutible datatypes even exist in elisp

11:20 tadni_: Yeah, I've noticed. FP was one of the big appeals of Clojure that possibly would have swayed me off ELisp.

11:21 justin_smith: lol - my google search for "elisp immutible data structures" is mostly hits for the #clojure chat logs

11:21 tadni_: :-)

11:22 justin_smith: I'll reiterate though, if clojure and elisp are your final contenders, and you will consider no others, pick clojure first

11:22 (or ignore me and do whatever the hell you like, of course :))

11:25 tadni_: The issues there is, is there any introductory level books for clj? Emacs actually ships with a general intro using Elisp. That is obviously a big benefit to a language, when you have a very very rudimentary understanding of basic comp sci topics and a language has a solid introduction to it. :-P

11:26 justin_smith: http://www.braveclojure.com/

11:26 http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome

11:26 ~books

11:26 clojurebot: books is http://clojurebook.com/ http://joyofclojure.com/

11:28 technoma`: tadni_: elisp is kind of a rubbish language, but it's ridiculously practical; it's basically how I learned lisp.

11:28 in terms of keeping your interest, practicality beats purity any day

11:30 tadni_: That's pretty much my mindset. I actually want to feel like I'm doing something practical and not busy work while I learn. I have no delisuions that Elisp is a great lisp, but calculating how much I use Emacs, it certainly is the most practical.

11:30 technoma`: hm; that sounds harsher than I meant. it's rubbish compared to some other lisps, but it's a lot nicer than most mainstream languages.

11:32 tadni_: Justin_smith: Those texts all seem to assume prior programming experience though, to which I'm inept.

11:32 justin_smith: tadni_: oh, I thought clojure from the ground up was more introductory than all that

11:33 "Let’s write a simple program. The simplest, in fact. Type “nil”, and hit enter."

11:34 or did it lose you with the tooling stuff that precedes that?

11:34 tadni_: Ah, that was the only link of the 4 I missed.

11:34 I look into it, thanks.

11:38 Oh cool, clj has docstrings.

11:38 justin_smith: (doc doc)

11:38 clojurebot: "([name]); Prints documentation for a var or special form given its name"

11:39 TEttinger: (doc clojure.string/join)

11:39 clojurebot: "([coll] [separator coll]); Returns a string of all elements in coll, as returned by (seq coll), separated by an optional separator."

11:39 actionshrimp: ,(+ 99 98)

11:39 clojurebot: 197

11:40 TEttinger: ,(+ 20r99 20r98)

11:40 clojurebot: 377

12:03 puredanger: tadni_: a while back I collected some resources at http://clojure.org/getting_started

12:03 would be happy to add appropriate things there if others have suggestions

12:05 justin_smith: puredanger: maybe grimoir should be on there too

12:05 puredanger: was just adding that :)

12:05 justin_smith: http://grimoire.arrdem.com/ oh, good

12:07 josiah42: Ok, I was waiting around to make sure I wasn't interrupting any discussion.

12:08 I'm an experienced developer new to Clojure. I've been reading a lot but I think I just need to talk to an experienced developer.

12:08 justin_smith: josiah42: there's a number of us here, what's up?

12:09 josiah42: Does someone have a simple <100 lines project that demonstrates something that Clojure is just really good at. The books claim it's expressive, but I come from Python, so I'm not actually seeing that much of a change in density of meaning

12:10 cbp: well there's the old ant simulation program..

12:10 puredanger: justin_smith: added Grimoire and CrossClj

12:10 josiah42: I think I understand the basic justification for prefix notation and parens and all, but I keep coming back to "So what?" Can you give me a really solid example of where this shines?

12:10 technoma`: https://github.com/technomancy/radagast/blob/master/src/radagast/coverage.clj I don't think you could do this in python in under a 100 lines

12:11 justin_smith: I like how straightforward svg maps to clojure in analemma https://github.com/liebke/analemma/blob/master/src/analemma/svg.clj

12:12 or, I should say, clojure maps to svg

12:13 https://github.com/liebke/analemma main repo page shows how straightforward that is to use

12:16 josiah42: cbp, could you link to the ant simulation?

12:16 dnolen_: josiah42: Python is pretty expressive at a basic level, there's not going to be a huge gain on just that axis

12:17 josiah42: dnolen_: then what would you consider Clojure's main gain over Python?

12:17 dnolen_: josiah42: big advantage of prefix notation is simple macros, core.async is a good example of the power of this - Clojure does not have yield but you can add it via macros

12:18 josiah42: concurrency is a huge one - once you have immutability going back is a bummer

12:18 but that takes some time to appreciate

12:18 josiah42: are macros specifically for DSL applications, or just in general... or is every Clojure a DSL?

12:18 cbp: $google clojure ants demo

12:18 lazybot: [Clojure ant sim from Rich Hickey - Gists - GitHub] https://gist.github.com/1093917

12:18 technoma`: most of the high-density examples you could look at require context to be appreciated

12:19 like lots of people love juxt, but from the perspective of python you just wouldn't know what to do with it

12:19 dnolen_: josiah42: macros are useful for DSLs yes but only relaly in well considered cases

12:19 justin_smith: golfscript can do the same thing as clojure or python in fewer characters, but is useless for anything other than being succinct

12:19 cbp: josiah42: there's a talk where that program was showed. it was clojure for java programmers or something

12:19 TEttinger: the seq abstraction takes time to "get," but it really saves time once you start treating all collections as seqs

12:22 justin_smith: also, laziness often makes code easier to read and write

12:22 josiah42: Okay, thanks for the examples I will return to meditating on the code.

12:40 dnolen_: Bronsa: the patch looks mostly good but note (js/console.log ...) is perfectly fine

12:40 same for (set! foo.bar.baz ...)

12:41 where foo is something (not a namespace of course)

12:44 CookedGryphon: I upgraded cider and now I'm having trouble getting it running again

12:44 says it can't find wrap-apropos

12:44 but lein pprint shows the dependency on cider/cider-nrepl

12:44 so I don't know why it can't find it

12:45 version 0.7.0

12:54 Bronsa: dnolen_: I know about js/console.log, but I figured since we already have a syntax for field access, we might aswell be consistent and use it where possible

12:55 dnolen_: Bronsa: just making sure it's clear what is legal, people are doing both of the above and it is perfectly legitimate CLJS

12:56 Bronsa: dnolen_: dnolen_: about (set! foo.bar.baz ..) does this also mean that foo.bar.baz is legal or only inside a set!?

12:56 dnolen_: Bronsa: foo.bar.baz is always legal

12:56 Bronsa: unless I hear otherwise from Rich, that logic has been in place since the very beginning

12:57 Bronsa: dnolen_: I'm not too excited about that TBH, we can write foo.bar.baz as (.. js/foo -bar -baz) without requiring different sym resolution rules than clojure

12:58 dnolen_: Bronsa: got nothing to do w/ being excited orn ot

12:58 or not

12:58 3 years it's been allowed

12:58 Bronsa: sure, I understand

13:02 dnolen_: btw additional benefit of using (.-EMPTY PersistentVector) over cljs.core.PersistentVector.EMPTY is that the former can warn you in case you've got a typo in the type name :)

13:03 dnolen_: yeah cljs.core.PersistentVector.EMPTY is def wrong

13:03 cljs.core/PersistentVector.EMPTY is fine

13:03 but yes that is a nice benefit

13:06 Bronsa: dnolen_: so, foo.bar is allowed, only with foo being a Var or can foo be undefined too?

13:07 dnolen_: Bronsa: no foo needs to be var/local

13:07 Bronsa: the current impl allows for the latter

13:07 ah ok

13:07 dnolen_: the later is a oversight

13:07 Bronsa: dnolen_: wrt foo being a local, I'm not sure if you're aware but it behaves in a funny way

13:07 one sec

13:07 probably a bug

13:07 dnolen_: likely

13:08 Bronsa: ClojureScript:cljs.user> (let [a 1 ab 2] a.b)

13:08 2

13:08 there might be a (symbol (str pre post)) that should have been (symbol pre post)

13:10 https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L339

13:11 uhm I guess it's actually https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L336

13:18 josiah42: how would you switch which function you were using based on a criteria? I was thinking (apply (which-function? criteria) (generate-data))

13:21 justin_smith: josiah42: you may want multimethods

13:32 dnolen_: Bronsa: can you make a ticket for that?

13:33 Bronsa: dnolen_: sure

13:38 dnolen_: Bronsa: thanks much

13:39 Bronsa: dnolen_: http://dev.clojure.org/jira/browse/CLJS-835

13:39 TEttinger: josiah42, another way is to just have a map of criteria for keys, functions for values

13:40 ,(map ({:yes inc :no dec :maybe identity} :yes) [1 2 3])

13:40 clojurebot: (2 3 4)

13:49 noncom|2: anyone using aleph? there is a great delay upon (require aleph.core) is there any workaround ?

13:52 justin_smith: noncom|2: ambrosebs may be able to advise you on that

13:53 ambrosebs: justin_smith: does aleph use core.typed?

13:53 justin_smith: ambrosebs: oh, I may have conflated you with someone else I think, sorry

13:53 ambrosebs: justin_smith: np

13:53 justin_smith: I meant ztellman (who seems not to be online)

13:56 noncom|2: at least in prod you can make an uberjar, which decreases the startup time of the new process. This doesn't help at dev time of course.

13:56 noncom|2: oh well..

13:57 yes, zach could probably shed some light.. but afaic this question was rised many times and there was some solution proposed..

13:57 well, i guess that this delay is unavoidable if i am to use aleph

13:57 afaik it comes from netty anyway

13:57 justin_smith: yeah, not much that can be done about that if that is the case

13:58 rlb: hmm, if I'm not just doing it wrong, I never noticed that you can't use :as with defn, i.e. (defn foo [x & rest :as all] ...)

13:58 amalloy: noncom|2: aleph and lamina are just gigantic. there's not much to be done

13:58 justin_smith: rlb: yeah, you can use :as in any destructuring

13:58 TEttinger: there's drip for repls if that's the issue

13:58 amalloy: ztellman is hoping to quit working on lamina in favor of his new thing "manifolds"

13:59 justin_smith: rlb: so you are doing it wrong

13:59 noncom|2: is manifolds a lib superior and substituting lamina ?

13:59 justin_smith: rlb (defn foo [x & [a b :as rest]] ...) would bind a and b as the first two values in rest

14:00 amalloy: noncom|2: he hopes for it to be simpler, and to be somewhere in between lamina and core.async

14:00 TEttinger: and of course you still can pass more in that coll

14:00 justin_smith: rlb: but :as at the top level is out of place, because the top level param declaration is not a destructuring, :as needs to be inside a destructuring

14:00 amalloy: it's not done, but you can read about it at https://github.com/ztellman/manifold if you're interested

14:00 rlb: justin_smith: ok, thanks -- was just reasoning from (let [[a & rest :as all] [1 2 3]] all)

14:01 which does work

14:01 justin_smith: rlb: yeah, but your first example is the equivalent of (let [a (first args) b (rest args) :as rest] ...) which is obviously wrong

14:02 noncom|2: amalloy: thank you, i will. it is good to know. i wish there was some digest for all clojure libs and their relationships. clojurewerkz does that a bit, but the concept could be improved

14:02 justin_smith: rlb: (defn foo [[a & b :as all-args]] ...) works

14:02 err

14:02 rlb: ok, right -- but so that does mean that you can't actually use :as with defn to bind the whole arglist

14:02 justin_smith: rlb: (defn foo [& [a & b :as all-args]] ...) I mean

14:02 rlb: (as you can with let)

14:02 oh ahh I see

14:03 I forgot about that.

14:03 thanks

14:04 amalloy: noncom|2: it's an insoluble problem: things change too fast

14:04 you can't automate it either, because who knows when things are actually ready for public consumption

14:05 noncom|2: amalloy: yes.. however authors could take care of updating their parts. github readmes are often fine, but relationships problem can take time to research

14:05 sure that's just an idea.. but that would be cool to have this sometimes

14:05 and a sole human-browsable digest/library of libraries

14:06 sounds a bit utopian though

14:06 at least today

14:06 amalloy: or dystopian, if you're a library author

14:07 mdrogalis: Transducer. That's an interesting word.

14:07 puredanger: http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming

14:07 mdrogalis: Context: http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming

14:07 puredanger: jinx!

14:07 mdrogalis: Ha.

14:08 Pretty neat stuff. I always an intuition that copying those transformation functions wasn't such a good idea.

14:08 rlb: justin_smith: ...and actually better for my particular context (defn foo [w x & [y z & rest]] ...). Thanks again.

14:10 justin_smith: rlb: np

14:10 puredanger: mdrogalis: bits and hitting clojure core and core.async repos now

14:10 s/and/are/

14:11 hiredman: our big project at work started in 2009, and deps rarely change on it, so I would think that making authors update some document about project relationships is optimizing for starting new projects, which would just make the problem of keeping track of all the new projects worse

14:12 mdrogalis: puredanger: I know Rich is kind of the face of Clojure, and I wonder how much of what's been going on with Cog lately is -mostly- him.. But from my perspective, the guy is on fire right now.

14:12 More than usual!

14:16 amalloy: transducers look nice; i'm glad it's less of a walled-garden kind of thing than happened with reducers, which are kinda separate from everything and most libraries don't support

14:16 even if rich gets bored of transducers, the additions they bring to the clojure.core api look fairly self-service

14:16 puredanger: ironically, reducers actually don't support transducers (yet) :)

14:17 mdrogalis: Heh

14:17 technomancy: I like how you can pretend map is curried

14:17 puredanger: but one of the big benefits of transducers is that they let us (the royal us) implement a transformation once, then use it in many ways

14:17 clojure 1.7.0-alpha1 is in the chute so there will be a hard release for people to try

14:18 mdrogalis: Sweet.

14:18 amalloy: technomancy: i'm going to miss the arity exceptions i get from attempting to transpose an empty vector

14:18 puredanger: async coming soon

14:19 Bronsa: uh so (conj) now returns []

14:20 that seems a bit off given the polymorphic nature of conj

14:20 puredanger: rich went back and forth on that

14:20 you can use into to have more choice

14:21 in the end, having conj do something mostly useful won out

14:21 amalloy: Bronsa: probably for something like (reduce conj nil)

14:22 that's a scenario where you might accidentally call conj with no args, and [] is as good a result as any

14:22 mdrogalis: amalloy: Yeah, true.

14:22 technomancy: I always thought of lists as being the most fundamental type

14:24 ToBeReplaced: my first guess would have been (conj) returns nil... ::shrug::

14:24 amalloy: i'm not sure that's relevant, technomancy?

14:25 hyPiRion: Hrm, (whatever, input -> whatever) looks rather ambiguous, no? I first thought it was a tuple with `whatever` and `input -> whatever`, but it's actually a 2-ary function

14:25 Or perhaps I'm just too used to the OCaml/Haskell notation.

14:25 cespare: when you define a record Foo, the generated function map->Foo calls Foo/create. Where is create defined? I've been unable to locate in clojure source

14:26 amalloy: hyPiRion: this looks a lot like the core.typed notation. doesn't seem too confusing, given that you're already attempting to write type signatures in a dynamically-typed language

14:27 Bronsa: cespare: it's a generated in the compiler

14:27 hyPiRion: amalloy: I've never used core.typed notation, but sure. How would you visualise a tuple with `w` and `i -> w` in it on that form though?

14:27 amalloy: (w, (i -> w))

14:27 cespare: Bronsa: yes, where?

14:28 Bronsa: it's horrendously slow, trying to figure out why.

14:28 amalloy: it's lisp: parens fix everything

14:28 ambrosebs: cespare, Bronsa: here? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7686

14:29 Bronsa: ambrosebs: yeah

14:29 cespare: ambrosebs: thanks!

14:30 Bronsa: hah I read that as complecting at first sight https://github.com/clojure/clojure/compare/c9e70649d2...1280c5c2d2#diff-d951a5cd799ae841ffcc6b45598180dbR6440

14:30 hyPiRion: amalloy: ah. Well, it confused me at least, and I guess it'll confuse readers familiar with curried langs

14:31 amalloy: sure. i'm familiar with haskell, and i had to squint a bit

14:33 ambrosebs: I was confused for a bit at the function syntax too.

14:33 but I didn't really register what the types represented (first arg to reduce), so I didn't know what to expect.

14:36 SegFaultAX: Has/does anyone here work on an event sourcing/CQRS system?

14:42 ambrosebs: how do composed transducers manage to use 1 lazy seq in the (sequence xform data) example?

14:43 dnolen_: ambrosebs: because laziness is not part of the transformer

14:44 amalloy: ambrosebs: it's the difference between (map f (map g coll)) and (map (comp f g) coll)

14:44 dnolen_: transducer I suppose I mean

14:44 puredanger: each step of xform modifies a function but does not *do* anything. the lazy seq is only built when you call sequence. same story as clojure.core.reducers/reduce really

14:46 ambrosebs: amalloy's explanation is what I expected.

14:46 puredanger: I don't understand your first sentence

14:47 puredanger: "map" and "filter

14:47 " are building a recipe - they don't actually do anything wrt the data

14:48 sequence then applies the combined recipe lazily over the input

14:48 so there is no intermediate "mapped" sequence

14:49 I'm really trying to say the same thing as amalloy but probably not as well :)

14:50 amalloy: puredanger: practice makes pithy

14:50 hiredman: so who is going to rewrite for to use these things?

14:51 amalloy: shouldn't be too hard, right? it's just a macro that's larger than some basic webservers

14:51 hiredman: can we deprecate chunked seqs yet?

14:52 ambrosebs: puredanger: haha, "what amalloy said" works

14:52 puredanger: a couple of us were discussing whether chunking could also be added ala carte now :)

14:53 hiredman: what is the motivation for adding chunking ala carte?

14:53 puredanger: we were just musing that it could perhaps be done that way

14:55 hiredman: my understanding of the motivation for chunking was performance, transducers (even reducers) off a way to get rid of the seq overhead, so it would be nice to get intuitive behaviour for seqs back

14:55 ambrosebs: I was wondering how (comp (map inc) (filter even?)) can be intelligently combined, but I guess it's HOF trickery that I'll grok once I assign types to it.

14:57 amalloy: well, let's see. (map inc) -> (fn [f] (fn [acc x] (f acc (inc x)))), i think

14:58 and (filter even?) -> (fn [f] (fn [acc x] (if (even? x) (f acc x) acc)))

14:59 both of those take as input a reducing function (a -> b -> a) and return a new reducing function, so comping them should work fine

14:59 it's really just the same thing that makes reducers tick

15:00 puredanger: right

15:00 ambrosebs: so (map inc) isn't partial application

15:01 gfredericks: I can't tell if this is going to make clojure harder to explain or not

15:01 amalloy: right, it's different from (partial map inc)

15:01 technomancy: oh

15:01 mdrogalis: gfredericks: Yeah, heh

15:01 josiah42: I'm new to Clojure and I'm trying to find a prototyping workflow that's faster from problem to solution than working in IPython Notebook. Is Clojure with LightTable going to be the best match for that goal?

15:01 technomancy: gfredericks: well with protocols and defrecords, I just always say "ignore that stuff; you'll know when you need it"

15:02 I don't see this being much different

15:02 gfredericks: technomancy: harder to ignore when it's another arity on your normal functions ;-)

15:02 technomancy: hm; true

15:02 amalloy: technomancy: you're usually wrong, though: people "know" they need it the first time they write a program, because omg objects

15:02 technomancy: amalloy: argh. sad but true.

15:03 hiredman: transducers/reducers are also how we should be doing io

15:03 mdrogalis: hiredman: Explain?

15:03 hiredman: mdrogalis: http://ce2144dc-f7c9-4f54-8fb6-7321a4c318db.s3.amazonaws.com/reducers.html

15:04 Jaood: technomancy: but they need to know about them to know when they will need it

15:04 mdrogalis: hiredman: Ty

15:05 technomancy: Jaood: "One day, in the far future, you might find yourself in a position where you're thinking 'There is nothing in Clojure that will allow me to write this code with the performance I require'. On that day, remember my words, and turn your gaze to defprotocol. But only then."

15:05 bridgethillyer: josiah42: I’m not going to touch “best match”, but Light Table does give you some of what you are looking for in a nice package.

15:06 josiah42: have you looked at Gorilla REPL?

15:06 martintrojer: So... transducers

15:07 reducers taken to their logical conclusion?

15:07 gfredericks: technomancy: I still like how protocols group extensible functions together

15:07 so...there.

15:08 hiredman: snap

15:08 gfredericks: (defmacro defmultis ...)

15:08 (defmacro defmethods ...)

15:08 "Like a protocol but is a bunch of multimethods."

15:08 josiah42: bridgethillyer: I was just looking at the intro video for Gorilla REPL. But that doesn't really address if Clojure can be faster at expressing a complete solution than Python. I suppose a lot of that speed has to do with Libraries. So JVM is definitely a plus.

15:09 amalloy: technomancy: man, i would immediately look up defrecord. "oh sweet, it's the best-performing thing in all of clojure? gotta figure that out, stat"

15:09 Jaood: technomancy: we should put that somewhere :) but really, many libs use them no? so you need to know them to read others people code

15:10 ambrosebs: has the feature expressions conversation progressed lately?

15:10 gfredericks: ambrosebs: turns out transducers can do that too

15:10 amalloy: haha

15:11 arrdem: (inc gfredericks)

15:11 lazybot: ⇒ 79

15:11 Bronsa: lol

15:11 (inc gfredericks)

15:11 lazybot: ⇒ 80

15:11 amalloy: but can they see the taste of cinnamon toast crunch, gfredericks?

15:11 gfredericks: kid tested, rhickey approved

15:12 hiredman: ambrosebs: puredanger has been putting patches on related tickets, when I complained about the way it was done he said it is for evaluation only

15:12 Bronsa: ambrosebs: puredanger has updated the tickets for clj/cljs/tools.reader with patches for CL style conditional reading but AFAIK nothing has been decided yet

15:12 hiredman: I don't really know what that means

15:12 puredanger: ambrosebs: I have been working on it a bit. there is a trio of patches for clj, cljs, tools.reader that implements CL style feature expressions

15:12 ambrosebs: ok

15:13 Bronsa: the jinx is strong in here

15:13 hiredman: we need a random back off

15:13 technomancy: amalloy: I would imagine it like the Lion King.

15:14 amalloy: that's what i thought of too

15:14 puredanger: there has also been a lot of discussion about a way to support a more open style of platform-swappable namespaces

15:15 feature expressions solves some problems but not all (open system) or without tradeoffs

15:15 technomancy: amalloy: "One day, Simba, all of this will be yours." / "What about deftype?" / "That's beyond our borders. You must never call that, Simba."

15:16 puredanger: awww, deftype is where all the fun is :)

15:16 TimMc: says pure danger

15:16 arrdem: lol

15:16 puredanger: mwuahahaha

15:16 (see: all Alioth programs)

15:17 hiredman: puredanger: the compiler just needs some love

15:17 (to propograte types across nested loops)

15:17 puredanger: what doesn't? welcome to computers.

15:17 ;)

15:18 hiredman: I really appreciate the patch work too btw. it is … epic :)

15:18 hiredman: speaking of, I wanted to try andy's benchmark stuff with my patch applied, and woa boy

15:18 that repo is a pile of scary

15:18 puredanger: you mean test.benchmark or something else?

15:18 gfredericks: technomancy: the alternate-arities approach also means that the newbs can't read their docstrings without worrying about the thing

15:19 hiredman: puredanger: https://github.com/jafingerhut/clojure-benchmarks

15:19 puredanger: oh that :)

15:19 best just to ask Andy to run them for you :)

15:20 gfredericks: "clojure-benchmarks is a library for Andy to run benchmarking stuff"

15:20 trptcolin: lol @ option 1: "Download", option 2: "Download securely"

15:20 puredanger: :)

15:21 Bronsa: speaking of Andy, here comes the stream of mail for broken patches on JIRA because of the recent changes

15:22 hiredman: puredanger: I was hoping to get those in to 1.7 but I guess with an alpha landing it will have to wait to 1.8?

15:22 puredanger: he is a machine!

15:22 trptcolin: there's something i'm not getting about the order of execution of composed fns w/ transducers. i know there's got to be a good reason it seems backwards: https://gist.github.com/trptcolin/12f43c4b9c3cd51c9519

15:22 puredanger: hiredman: no, that was the intent of my note at the bottom of the release email

15:22 hiredman: oh, I should go read that then

15:23 puredanger: hiredman: it is truly undecided

15:23 we have many patches "done" and many more screenable and several other in-work features

15:24 some of that stuff will go into 1.7, just not sure what will and what will be pushed to next release yet

15:24 amalloy: trptcolin: (partial inc)??? you're a monster

15:24 trptcolin: lol whoops, that used to be something else

15:24 hiredman: puredanger: cool

15:24 puredanger: hiredman: there are many things in those lists I feel strongly should go in sooner rather than later

15:25 we thought it was important to cut an alpha1 now though so people could try transducers more easily

15:25 gfredericks: I just got an andy email

15:25 hiredman: puredanger: and thank you for responding to things :)

15:25 puredanger: trying...

15:25 I really do notice and appreciate the work

15:25 ambrosebs: puredanger: excited about the feature expression patches

15:25 look nice

15:26 Bronsa: ambrosebs: I feel like hiredman is going to slay out the next person that +1's those patches

15:27 ambrosebs: I am aware

15:27 hiredman: http://www.bestforfilm.com/wp-content/uploads/2010/11/Buffy-1.jpg

15:28 amalloy: trptcolin: it is weird, isn't it. it kinda has to be that way, though, given the signature of (map f): when you call (map square), you get a transducer that squares things; then you call (map inc) on that, and you get a transducer that adds one before delegating to its underlying (squaring) transducer

15:28 jonasen: Bronsa: "replaced all instances of (.foo js/Math ..) with (Math/foo ..)"... Is this correct? There is no namespace called Math?

15:28 TEttinger: ,(partial (partial inc))

15:28 clojurebot: #<core$inc clojure.core$inc@19666a>

15:28 puredanger: hiredman: I may ask to do a call with you to go over 701 (is it bad I have that memorized?), etc when I finally get to review them. probably far more efficient than me doing it alone

15:28 hiredman: puredanger: sure

15:29 Bronsa: jonasen: it's special cased in the cljs analyzer

15:29 jonasen: ah, ok

15:29 Bronsa: jonasen: also goog

15:30 trptcolin: amalloy: ok, i need to let this stew, but sounds similar to the same confusion i originally had using -> with ring middleware and trying to reason about what executes first

15:30 amalloy: (map inc) could be defined as (fn [f] (fn [acc x] (inc (f acc x)))), instead of as (fn [f] (fn [acc x] (f acc (inc x)))), but that would be pretty weird: you want to be mapping over the inputs, not over the results of the reducer function

15:30 jonasen: Bronsa: then it makes total sense! Carry on :)

15:32 arrdem: damnit andyf y u no on IRC

15:32 Bronsa: arrdem: he's busy doing his JIRA things ATM

15:32 cespare: how can you 'forward declare' a record? I want to do this: (defrecord A [^B b]) (defrecord B [^A a])

15:33 arrdem: Bronsa: right which is why I wish he was on IRC :P

15:33 amalloy: cespare: don't. the hinting there doesn't even matter anyway

15:33 cespare: amalloy: it does

15:33 for us

15:33 llasram: cespare: If it's just documentation, could you not just use a comment?

15:34 cespare: llasram: it's not; we have macros that use that information

15:35 amalloy: cespare: if it's for your macros, and not for the clojure compiler, put it in a different place in the metadata: (defrecord A [^{:type 'B}] ...) or something

15:37 ^:tag is for the compiler to figure out what bytecode to emit

15:39 Bronsa: puredanger: FYI re: CLJ-701 I've indipendently implemented a similar approach to the one used by hiredman's patch for t.e.j and I can confirm I haven't seen any issue with hoisting the loop bodies

15:40 puredanger: cool

15:41 Bronsa: if anything, it's not clear to me why the hoisting doesn't happen for loops in statement context

15:44 hiredman: Bronsa: I dunno either, I tried to extend the existing logic

15:45 Bronsa: hiredman: if I understood correctly, the fn* wrapping doesn't happen in return context because otherwise it would continue to loop, but I really don't understand why it's not done for expr context

15:47 hiredman: maybe I am mistunderstanding, I think it does happen for exprs?

15:47 Bronsa: yeah sorry, meant statement

15:47 hiredman: right

15:48 I suspect doing the loop as a statement is simple enough bytecode to just generate inline

15:48 just a label and jumps

15:48 BobSchack: puredanger I'm writing up a blog post on ClojureScript performance optimizations I've found while working on a Fressian port. Would it be possible to get it reviewed before I post it? I want to make sure the information I'm putting out there is accurate.

15:49 Bronsa: hiredman: it's the same for all other contexts though, modulo nil insertions/stack popping

15:49 hiredman: Bronsa: ok, I have no idea

15:50 puredanger: BobSchack: I'm sure dnolen_ could take a look at it

15:51 andyf_: arrdem: I have been summoned!

15:51 arrdem: andyf_: lol

15:51 * arrdem snaps his grimoire closed with satisfaction

15:51 andyf_: (That will almost never work, btw)

15:52 arrdem: andyf_: gonna look at the horked patch in a minute... is there something else/special I need to do to ensure that your build scripts pulled in the depended on ticket?

15:52 andyf_: I guess I should put scary ratings on my repos for people that like cleanliness

15:53 arrdem: Oh, yours depends on another? My scripts aren't that fancy

15:53 arrdem: andyf_: yeah. CLJ-1489 assumes that CLJ-1488 is applied.

15:55 andyf_: Most of the time a patch no longer applies cleanly it is because 'git am' command checks that all context lines in diff are unchanged, and fails if they are. Annoying, but true

15:56 gfredericks: yeah mine rebased with no trouble

15:56 andyf_: arrdem: But yours is probably the depends-on-another-patch thing

15:57 dnolen_: BobSchack: I can take a look

15:57 arrdem: andyf_: I'll update the patches in any case, just thought I'd ask 'cause I made a point to test and both were clean when submitted last.

15:58 andyf_: arrdem: I could try implementing dependent patch testing, bit I would need to be very bored first

15:58 arrdem: andyf_: lolz

15:58 rlb: is there an idomatic way to always flush before exit? I've been just wrapping the main function with finally, but then tests won't necessarily flush, which can be confusing when you don't see error messages (for example).

15:59 (say from a command line tool)

15:59 Bronsa: core async release versions always crack me up

15:59 justin_smith: rlb: maybe define a test fixture that calls (flush)

16:00 BobSchack: dnolen_ Thanks I'm still working on it, what is the best way to send it to you?

16:00 dnolen_: BobSchack: you can pm me or email me at my lists email

16:01 rlb: justin_smith: ok, right, suppose that should work -- (I nearly always want stdout/stderr flushed)

16:01 AeroNotix: rlb: command line applications with clojure?

16:01 puredanger: Bronsa: I have on my list to get to a saner version :)

16:01 AeroNotix: are you mad

16:01 puredanger: Bronsa: don't even ask

16:02 rlb: AeroNotix: yes -- though of course nothing that needs fast startup

16:02 AeroNotix: oh ok

16:02 Bronsa: just when you think the version is going to end, there's another qualifier

16:03 arrdem: andyf_: if you're just using bash I'd be happy to implement an @andyf{ @requires{}} syntax :P

16:06 andyf_: arrdem: My clj-prescreen repo that implements this stuff probably should have a scariness rating of 4 out of 10. You have been warned.

16:06 Clojure-benchmarks is up around 8

16:09 numberten: is there a resource that just lists all the things in clojure that have ifn implementations?

16:10 technomancy: doesn't clojure flush on newlines by default?

16:10 devn: hello transducers

16:11 i wondered when someone was going to bring up rich's core.async commits

16:11 (recent commits that is)

16:11 andyf_: technomancy: On println, not on new lines

16:11 technomancy: andyf_: ah, gotcha

16:12 rlb: perhaps "use println" is the simplest answer

16:12 Bronsa: andyf_: FYI I'm working on a "solution" for TANAL-24, https://github.com/clojure/tools.analyzer.jvm/commit/94fd8e1759819d5547870bde14950d7ecd842f40

16:12 hyPiRion: and only if *flush-on-newline

16:12 is set.

16:12 rlb: not on prn either

16:13 hmm, wait -- what was I using in this case...

16:13 devn: What if like... clojure.pprint were rewritten...

16:13 technomancy: prn seems like an odd choice for error messages =)

16:13 devn: *mind explodes*

16:13 hyPiRion: devn: like fipp?

16:13 rlb: ok, I was using print, not println

16:13 devn: hyPiRion: yeah, except get it into core

16:13 Bronsa: andyf_: hopefully eastwood will benefit from this, default t.a.j behaviour will be to throw, tools like eastwood could bind the handler to ignore the wrong tag & just repor it as a warning

16:14 rlb: in any case, most of the time, I think I probably want *all* output flushed on exit

16:14 * bbloom uses fipp every single day :-)

16:14 devn: cl-format is some pretty crazy clojure code

16:14 rlb: to stdout/stderr

16:15 hyPiRion: devn: just a bit of macros here and there

16:15 rlb: well -- actually -- suppose I'm really just talking about "normal stdio console behavior", so that's perhaps not "all"

16:15 hyPiRion: it's the best thing when you write it, and the worst thing when you attempt to read it

16:15 devn: hyPiRion: it seems kind of... i dont know... coupled...

16:15 hyPiRion: devn: it's just the common lisp format function?

16:16 "just"

16:16 devn: haha

16:16 rlb: anyway, putting a finally on main and adding a per-ns test fixture is fine for now

16:16 technomancy: rlb: yeah, exiting with unflushed stdio buffers is just plain wrong behaviour

16:17 justin_smith: rlb: you could even have a your-project.test ns where you define that fixture, and declare its usage in each test ns

16:17 devn: hyPiRion: yeah i suppose you're right. i mean, i know you're right, but it doesn't change the fact that i want to rewrite it

16:17 rlb: technomancy: it certainly confused me back when I hit it the first time.

16:17 hyPiRion: devn: the cl-format function? Yeah, I would guess there are better ways to implement it

16:17 technomancy: rlb: that's an openjdk bug though, not a clojure one

16:17 not that it's any consolation =)

16:21 andyf_: Using java's PrintWriter beneath Clojure's *out* with auto flushing might be a general auto-flush solution, but I haven't tried it

16:21 hyPiRion: I digged into the java source code, and it actually flushes for any newline it sees by default. However, it's buffered with 128 chars, soo

16:21 *out* just wraps System/out with an outputstreamwriter

16:22 andyf_: Bronsa: Sounds good. Thanks for your persistence there

16:22 gfredericks: ASYNC-76 confuses me

16:22 does (go (/ 42 0)) not hit the default exception handler currently?

16:22 it seems to in my repl

16:22 do I need a less trivial go block?

16:24 stuartsierra: gfredericks: I think `go` blocks that don't park can execute immediately on the calling thread.

16:25 tbaldridge: the console output you see there is from the println currently in core.async. If you don't want println (and want your own exception code), you can't currently

16:25 gfredericks: kay I'll go try something better

16:25 tbaldridge: ASYNC-76 fixes that

16:25 gfredericks: tbaldridge: no this really did hit the exception handler

16:25 I have a custom one that logs

16:25 puredanger: stuartsierra: that shouldn't happen with thread though right?

16:25 tbaldridge: stuartsierra: that's not true in CLJ, CLJS it is, CLJ it isn't

16:26 stuartsierra: puredanger: Yes, `thread` will always run on a new thread, just like `future`.

16:31 gfredericks: (go (/ 1 0)) hits my default uncaught exception handler with latest core.async

16:32 gfredericks: stuartsierra: I get the same with old core.async

16:32 but I just confirmed a non-trivial go block does not hit the handler

16:32 so I oughta upgrade

16:33 stuartsierra: There are even tests for this in core.async https://github.com/clojure/core.async/blob/b4cbabf2fdf5f9470f3dbdff46d6cb72a1f0915e/src/test/clojure/clojure/core/async/exceptions_test.clj

16:33 gfredericks: the version string "0.1.319.0-6b1aca-alpha" at first glance seems to contain two phonetic components

16:33 trptcolin: just realized that the clojure.core namespace's line count (including separate files for types, protocols, reducers, etc) is literally over 9000!

16:33 yessss

16:33 gfredericks: trptcolin: is that a special number?

16:34 arrdem: $google its over 9000

16:34 lazybot: [It's Over 9000! | Know Your Meme] http://knowyourmeme.com/memes/its-over-9000

16:36 stuartsierra: gfredericks: The exception-handling behavior of core.asnyc has changed before, so you may have been using a version that did not catch exceptions in `go` blocks. I hope that ASYNC-76 will be the default going forward. But it does say "alpha" :)

16:39 gfredericks: we had a production issue that was half-caused by the not-propogating behavior

16:40 noonian: ouch

16:41 gfredericks: I think we'd screwed up enough that the not-propogating behavior wasn't actually the cause

16:42 but it makes our fix not work :)

16:43 does anybody know where the version format 0.1.319.0-6b1aca-alpha comes from?

16:43 dnolen_: gfredericks: git commit # + git sha

16:43 tbaldridge: the hash part is based off the sha of the commit it's based off of

16:43 gfredericks: what about the "0-"?

16:44 puredanger: actually, I just bash the keyword and tell people it's a sha

16:45 it's created by a script at script/build/revision in the repo - <major>.<minor>.<trunk-basis>.<patch-or-0>-<sha>[-qualifier] is the format

16:46 gfredericks: I can kind of see how that might have come about

16:49 hm

16:49 latest core.async doesn't seem to propagate

16:49 * gfredericks tries one more thing

16:49 tbaldridge: example code might be helpful

16:50 gfredericks: for sure

16:51 oh yeah nevermind my fault everything works it's all perfect

16:51 thanks tbaldridge & stuartsierra

16:51 * tbaldridge saves the quote "it's all perfect"

16:51 boxed: is there some badge or something that you can put on a project to show that it’s both clojurescript and clojure? it’d be nice to have something more compact than writing that in text...

16:52 stuartsierra: gfredericks: you're welcome, glad to hear it works

16:53 hoverbear: So, I'm finding some documents with Monger, then doing some computation, and sending them over the wire with Chesire... However I can't figure out how to go from `monger.collection/find-maps` to `chesire/generate-string`.

16:58 bbloom: https://github.com/clojure/clojure/commit/2a09172e0c3285ccdf79d1dc4d399d190678b670#diff-d951a5cd799ae841ffcc6b45598180dbR82

16:58 wagjo: I'm really super excited about this transducers thing :) Many thanks!

16:58 bbloom: glorious glorious new overloads!

16:59 * Fare finds that what code to generate depends on the effect analysis of your continuation.

17:00 gfredericks: I did not know clojure.core/sequence was even there

17:00 puredanger: bbloom: I chuckled at your irc comment last week about being able to abstract map from the sequence machinery :)

17:00 wagjo: gfredericks: its for cases when you need seq returned no matter what

17:01 puredanger: gfredericks: I said the exact same thing :)

17:01 bbloom: puredanger: i'm just so excited about 1 arity conj, where's my 1 arity assoc!?

17:01 puredanger: no one's ever happy

17:01 bbloom: :-)

17:02 gfredericks: wagjo: that's almost seq

17:02 bbloom: haha, just kidding. puredanger: this is all good stuff

17:02 boxed: 1 arity conj is ok, but update-in with an empty path, that’d be crazy! >_<

17:02 puredanger: is rolling his eyes

17:03 bbloom: puredanger: last week was i rambling about traversable in scala?

17:03 SagiCZ11: hey guys.. whats your favorite rich hickey talk? ive seen just a couple.. (simple made easy and clojure for java programmers)

17:04 puredanger: are we there yet?, value of values, language of the system

17:04 you gotta get the box set

17:04 the extras are killer

17:04 arrdem: lol

17:04 puredanger: I might be getting a little punchy

17:04 arrdem: andyf_: so... more munge function changes incomming

17:05 bbloom: puredanger: while i'm predicting the future: does rich want generators to aid with defining transformer functions?

17:05 puredanger: I don't know what that means

17:06 bbloom: puredanger: there was some mention from euro clojure of using core.async internals for python-like generators inside the main clj compiler

17:06 puredanger: oh, I know what you're talking about

17:06 bbloom: which is a much nicer way to write things like mapcatting, etc

17:06 andyf_: arrdem: Sounds good. You make them easy to take

17:06 puredanger: I don't think that's imminent or anything

17:07 SagiCZ11: puredanger: i just only now realized that you have answered my question :D

17:07 arrdem: andyf_: :D

17:07 bbloom: would be quite nice to replace the awkward (f1 result ...) with (yield ...)

17:07 puredanger: SagiCZ11: sorry, should have named you in the reply :)

17:08 SagiCZ11: puredanger: no problem ;)

17:08 puredanger: SagiCZ11: also, Design, Composition, and Performance

17:08 SagiCZ11: http://thechangelog.com/rich-hickeys-greatest-hits/ :)

17:11 SagiCZ11: greatest hits.. jesus.. ok thanks :)

17:12 devn: andyf_: patch bumped.

17:12 puredanger: ha! i wrote that.

17:13 the only article i ever wrote for the changelog, and their most successful post of 2013.

17:13 andyf_: devn: Thanks. One less reason to reject a patch :-)

17:13 puredanger: SagiCZ11: well I wouldn't put him up there with jesus

17:14 devn: yeah, more like a philip glass than a jesus

17:15 quizme: how do you get the value of an interned variable programmatically? e.g. if i'm in ns 'user and i want to get the value of x as defined in myns, how do i do that?

17:16 puredanger: myns.x ?

17:16 quizme: i want to get it from strings

17:16 technomancy: quizme: ns-resolve

17:16 quizme: (ns-resolve (symbol "myns") (symbol "x"))

17:16 technomancy: and then deref the var

17:17 quizme: that does return the value at the repl

17:17 puredanger: sorry myns/x above yeesh

17:17 devn: i was going to say... :)

17:17 quizme: it returns #'myns/x

17:17 then how do u get the value of that?

17:17 technomancy: quizme: deref it

17:17 quizme: oh..

17:18 puredanger: or if it's a function, you can invoke it

17:18 quizme: let me try that

17:18 Fare: what's the standard way of throwing a structured expression in clojure, i.e. not just a string?

17:18 Bronsa: ex-info

17:18 ,(doc ex-info)

17:18 clojurebot: "([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."

17:18 devn: quizme: (deref (ns-resolve (symbol "myns") (symbol "x"))) or @(ns-resolve (symbol "myns") (symbol "x"))

17:18 gfredericks: $google catch-data

17:18 lazybot: [Catch Data Systems – Experts at Making the Pieces Fit | Catch Data ...] http://www.catchdata.com/

17:18 gfredericks: haha

17:18 puredanger: and if you want more, look at slingshot library (which works with that)

17:18 Fare: thanks

17:18 Bronsa: then you can extract the data with ex-data

17:19 gfredericks: $google github catch-data

17:19 lazybot: [gfredericks/catch-data · GitHub] https://github.com/gfredericks/catch-data

17:19 gfredericks: there we go

17:19 devn: quizme: or as puredanger said: ((ns-resolve (symbol "myns") (symbol "x")) 'some 'arguments 'to 'the 'x' 'function)

17:19 Bronsa: gfredericks: neat

17:20 SagiCZ11: is there a way to implement rolling moving average without mutable type?

17:20 quizme: well hot damn: (deref (ns-resolve (symbol "myns") (symbol "x"))) did the trick. Thank you.

17:21 hiredman: SagiCZ11: it depends what you mean by that

17:21 Fare: in ex-info msg map cause what's cause?

17:22 hiredman: but you can certainly implement a rolling average as a function that takes state and new value and returns new state and a new value

17:22 Bronsa: Fare: it can be another exception if you're rethrowing

17:22 SagiCZ11: hiredman: but for calculating each next value i need the history of all values

17:22 hiredman: SagiCZ11: http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average

17:22 Bronsa: Fare: e.g. (catch Exception root-exception (throw (ex-info "msg" {} root-exception)))

17:23 hiredman: it really depends

17:23 Fare: what's the standard way to merge two maps? into?

17:23 hiredman: but the only "state" you need is the previous mean

17:23 Fare: (inc Bronsa)

17:23 lazybot: ⇒ 37

17:23 SagiCZ11: hiredman: and if i need the Simple moving average?

17:23 Bronsa: Fare: yeah

17:23 SagiCZ11: hiredman: would i also only need the previous mean?

17:23 puredanger: Fare: merge?

17:24 quizme: SagiCZ11 use partition

17:24 Fare: is the standard way to match a list with core.match to use [([x y &z] :seq)] ? That's somewhat verbose.

17:24 amalloy: Fare: not much else you can do, no. also, you mean & z, not &z

17:24 Bronsa: puredanger: into might be faster than merge, merge is implemented with reduce1

17:25 zenoli: ,(conj {:a 1 :b 2} {:b 3 :c 4})

17:25 clojurebot: {:c 4, :b 3, :a 1}

17:25 devn: SagiCZ11: wouldn't reduce do what you need?

17:25 Fare: and to display an error, is println the standard utility?

17:25 puredanger: Bronsa: merge is more meaningful so I would use that unless I was in code where I thought it made any difference

17:25 hiredman: SagiCZ11: I think so, but I've never done that, the cases where I have done averages over a stream where I don't have all the values upfront have been for metrics where I care more about recent values

17:26 SagiCZ11: hiredman: i see.. well i will try to come up with something

17:27 Bronsa: puredanger: fair point, I still prefer into since it also works for vectors and sets

17:27 SagiCZ11: devn: reduce would might work here but i am still trying to wrap my head around that one

17:27 Fare: does merge make the last map win?

17:27 puredanger: yes

17:27 takes N maps

17:27 hiredman: it looks like the simple moving average formula on the wikipedia page there requires the previous average, the last value, and a count of values

17:28 puredanger: Fare: also merge-with

17:28 Fare: nice

17:28 SagiCZ11: hiredman: in which case it could be implemented with some kind of recurring function right?

17:29 Fare: clojure usually impresses me with how well it does the things it is designed to do. You can tell it's quality design. The opposite of what python does.

17:29 hiredman: SagiCZ11: well, that depends

17:29 Fare: then there are things it doesn't do... but in those cases, you can either fall back to Java, or build it with monads or higher-order functions.

17:30 hiredman: SagiCZ11: generally these kind of algorithms assuming you are summarizing parts of sort of infinite streams of data, a recuring function procssing an infinite stream of data like that won't return an answer

17:39 SagiCZ11: i have implemented stream of data as a lazy sequence.. if i call (take 10 stream) i would expect clojure to first wait for the 10 elements.. but it returns immediately with less than 10 of them

17:39 devn: SagiCZ11: have code you could paste?

17:39 (https://www.refheap.com/)

17:39 gfredericks: ,(take 10 '(1 2 3))

17:39 clojurebot: (1 2 3)

17:40 devn: heh

17:40 well there's that too, obviously

17:41 SagiCZ11: well the lazy seq calls a function which should generate the next element.. the next element is created by blocking and reading data from the internet.. so it can take some time

17:41 this works for consuming of the stream

17:41 (defn consume [seq]

17:41 (doseq [element seq]

17:41 (println element)))

17:41 devn: ,(realized? (doall [1 2 3]))

17:41 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPending>

17:42 devn: derp

17:42 ,(doall [1 2 3])

17:42 clojurebot: [1 2 3]

17:42 SagiCZ11: waait i got it.. found my mistake

17:42 gfredericks: huh

17:42 * SegFaultAX is excited for transducers to drop

17:42 devn: same

17:42 looking forward to tinkering with them in a bit

17:43 although ive been following the commits in core.async i didn't know where things were at

17:43 SegFaultAX: Transducers + core.async is basically Rx.

17:43 devn: puredanger: is the authors list the list of people who worked on transducers?

17:43 puredanger: SegFaultAX: they have dropped - clojure 1.7.0-alpha1 and a new core.async went out today

17:44 SegFaultAX: puredanger: Nice.

17:45 Maybe I should submit a talk for conj on transducers...

17:45 When does that close again?

17:45 puredanger: SegFaultAX: I think Rich would not agree with that - I believe he sees them as being more reusable than anything in rx. you could implement rx in terms of existing transducers I think. (that would be cool if someone went and did that btw with RxJava :)

17:46 SegFaultAX: it closed last week. I suspect Rich will be doing that talk ;)

17:46 SegFaultAX: Ah, great.

17:46 puredanger: devn: not sure what you're referring to. Rich has done all of the work on transducers other than bouncing things off people.

17:46 SegFaultAX: puredanger: I disagree in the sense that Rx has a much more complete DSL.

17:47 The core components are there, but it hasn't been unified into a single fluent DSL like Rx has.

17:47 hiredman: ,*clojure-version*

17:47 clojurebot: {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}

17:47 puredanger: SegFaultAX: I am not knowledgable enough to discuss

17:47 hiredman: nice

17:47 ,(conj)

17:47 clojurebot: []

17:47 puredanger: :)

17:47 gfredericks: ,(map inc)

17:48 clojurebot: #<core$map$fn__4338 clojure.core$map$fn__4338@44ac6a>

17:48 gfredericks: ,(doc sequence)

17:48 clojurebot: "([coll] [xform coll] [xform coll & colls]); Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the co...

17:48 gfredericks: ,(sequence (map inc) '(1 2 3))

17:48 clojurebot: (2 3 4)

17:48 gfredericks: ,(sequence (map +) [1 2 3] [9 10 11])

17:48 clojurebot: (10 12 14)

17:49 amalloy: what is flatmap for? it's like reduce+mapcat glued together?

17:49 gfredericks: ,(doc flatmap)

17:49 clojurebot: "([f] [f coll]); maps f over coll and concatenates the results. Thus function f should return a collection. Returns a transducer when no collection is provided."

17:49 puredanger: yes - mapcat did not have an arity amenable to shortening like the others

17:49 gfredericks: ,(sequence (flatmap #(list % %)) [1 2 3])

17:49 clojurebot: (1 1 2 2 3 ...)

17:50 amalloy: oh, really? i didn't realize (mapcat f) existed already

17:50 gfredericks: ,(mapcat +)

17:50 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338>

17:50 gfredericks: ,(mapcat [])

17:50 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338>

17:50 gfredericks: wat

17:50 ,(doc mapcat)

17:50 clojurebot: "([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."

17:50 amalloy: &(mapcat [])

17:50 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$map

17:50 Bronsa: 1-arity mapcat is useless

17:51 gfredericks: Bronsa: what if you want to throw an exception in an interesting way

17:52 amalloy: Bronsa: why is it useless?

17:52 Bronsa: amalloy: pre transducers it would have called (map f) which is an arity error

17:52 scape_: how do I get the new cider? when i refresh package contents for melpa and reinstall cider it compiles and installs but is still an older version

17:53 Bronsa: post transducers it calls (map f) which returns a function, but tries to use it as a collection

17:53 which is a type error

17:53 gfredericks: fair enough.

17:53 mdeboard: `lein help new` says "The list of built-in templates can be shown with `lein help new`." but it does not in fact

17:53 so how do I see list of templates

17:54 amalloy: Bronsa: yes, it was useless before, but i don't see why adding a one-arity overload to mapcat wasn't possible; what it does now is useless, so making it do something better seems fine

17:55 trptcolin: mdeboard: look at the bottom of the `lein help new` output? under "Subtasks available"

17:55 Bronsa: amalloy: not sure I understand you, all I'm saying is that the current impl is nonsensical for 1-arity

17:55 mdeboard: trptcolin: yeah

17:55 Oh, those are the templates? ok

17:56 gfredericks: amalloy: I think you and Bronsa agree

17:56 amalloy: Bronsa: right, but that doesn't seem to be the question anyone asked

17:56 i see. yes, gfredericks is probably right that we're agreeing without (me) realizing it

17:56 gfredericks: amalloy: puredanger said that arity 1 wasn't available for mapcat, and Bronsa argues it may as well have been

17:57 Bronsa: gfredericks: yes, thanks <3

17:57 amalloy: yeah, which is what i was trying to say too. i didn't realize Bronsa was saying it

17:57 gfredericks: allow me to summarize one more time

17:57 amalloy: gfredericks: tldr: kittens

17:58 gfredericks: kittens was the first nonsense name I used for an application as a "professional"

17:58 scape_: how do I get the new cider? when i refresh package contents for melpa and reinstall cider it compiles and installs but is still an older version

17:59 gfredericks: actually might have been my first professional clojure

18:05 SagiCZ11: how do i get the n-th from last element?

18:05 gfredericks: cid

18:06 that is me trying to switch to my cider buffer so I can answer your question

18:06 scape_: :)

18:06 amalloy: SagiCZ11: take-last is probably useful

18:07 SagiCZ11: gfredericks: i wish i used emacs

18:07 amalloy: but it's not super-easy, because usually you'd rather not work with sequences from the end; rather, sequences from the front, or vectors from the end

18:07 * gfredericks had typed "nth-tail", "nth-rest", and "nth-next" looking for "take-last"

18:07 stuartsierra: SagiCZ11: `reverse` and `nth`

18:07 SagiCZ11: thanks for suggestions.. :)

18:07 amalloy: stuartsierra: barf. first/take-last

18:07 reiddraper: are we talking about transducers yet?

18:08 amalloy: you missed it. we were all into transducers before they were cool, reiddraper

18:08 technomancy: transducers are great for generating sci-fi technobabble

18:08 reiddraper: :( :(

18:08 technomancy: "Captain, the primary transducer vector is out of alignment; the reactor containment is at risk!"

18:09 reiddraper: technomancy: i think I understand what transducers are now!

18:09 amalloy: btw, stuartsierra, my objection to reverse/nth is that you re-traverse the sequence needlessly for N elements. if N is large, that's a lot of wasted effort

18:09 trptcolin: this should shed some more light on it: http://en.wikipedia.org/wiki/Finite_state_transducer

18:10 technomancy: reiddraper: as long as you can still reverse the polarity of the neutron flow you should be in good shape.

18:10 otherwise you might end up stuck with a tachyon leak in your jeffries tubes

18:10 reiddraper: technomancy: hmm, will need to look into that

18:11 brehaut: seriously though, why does the polarity always need reversing? does someone sneak in before an episode and just press the polarity button? and why is it not the first thing they check

18:11 * stuartsierra goes back into hiding

18:11 scape_: relational relations..

18:11 holy crap i'm not smart enough for transducers

18:11 SegFaultAX: scape_: Nah, you are. They just have a scary name.

18:12 trptcolin: scape_: ignore my link i'm just being difficult

18:12 scape_: :D

18:12 amalloy: a transducer is just a reductor combinator in the ______ of ______. what's the problem? <blanks left as an excercise for the reader>

18:13 SegFaultAX: Haha, nice.

18:13 scape_: rich's post was interesting, he focused on , I felt, non-laziness of transducers. meanwhile, so much effort seems to have gone in to lazyness before this

18:13 SegFaultAX: scape_: It's not that they're lazy or strict, it's that they're *completely decoupled from the evaluation semantics*

18:14 hyPiRion: amalloy: it's just function composition over foldables

18:14 SegFaultAX: Whereas eg 2+ arity map /does/ have specific knowledge of the evaluation strategy.

18:14 hyPiRion: Can't talk about foldables without traversables.

18:15 mdrogalis: "What's he sick with?" "I'm afraid, he's caught.. Transduceritis."

18:15 hyPiRion: SegFaultAX: A foldable must by definition be traversable though

18:15 reiddraper: dnolen_ favorited my tweet about transducers, so it must be true

18:17 SegFaultAX: hyPiRion: Exactly! So really you should talk about traversables since foldMap can be implemented in terms of the traversable typeclass.

18:17 Duh.

18:17 SagiCZ11: ,(Float. 3)

18:17 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Float>

18:17 SagiCZ11: why not

18:17 amalloy: because why

18:17 scape_: float is boxed right?

18:17 SagiCZ11: ,(Float 3.3)

18:18 clojurebot: #<RuntimeException java.lang.RuntimeException: Expecting var, but Float is mapped to class java.lang.Float>

18:18 ztellman: ,(Float. 3.3)

18:18 clojurebot: 3.3

18:18 hyPiRion: SegFaultAX: whoops, I mixed them actually. A traversable must be foldable, bit not vice versa.

18:18 SegFaultAX: SagiCZ11: http://docs.oracle.com/javase/7/docs/api/java/lang/Float.html

18:18 hiredman: ,(type 3)

18:18 clojurebot: java.lang.Long

18:18 SagiCZ11: well thats dumb

18:18 SegFaultAX: There is no long constructor for Float.

18:19 SagiCZ11: SegFaultAX: i see

18:19 amalloy: i find it hard to imagine you'd want to call the Float constructor with an integer literal anyway

18:19 SegFaultAX: scape_: float are not boxed, no. They are one of few primitives types. But Java will happily autobox/autounbox them as necessary.

18:20 scape_: ah

18:20 SagiCZ11: amalloy: i am trying to force clojure to use decimal numbers as a result of division

18:20 amalloy: so use ##(doc float)

18:20 lazybot: ⇒ "([x]); Coerce to float"

18:20 amalloy: java.lang.Float is awful

18:21 SegFaultAX: ,(type (float 3))

18:21 clojurebot: java.lang.Float

18:21 hyPiRion: amalloy: or even better, double!

18:21 amalloy: hyPiRion: weirdly, in the aftermath of this whole discussion, i forgot double existed. i figured float must coerce to double, because why would you ever want a float

18:21 hyPiRion: when you want to do money transfers

18:22 SegFaultAX: :(

18:22 scape_: 3d games

18:22 technomancy: ~guards

18:22 clojurebot: SEIZE HIM!

18:22 technomancy: =)

18:22 scape_: hah

18:23 SegFaultAX: ,(type 100M)

18:23 clojurebot: java.math.BigDecimal

18:23 SegFaultAX: ,(type 100N)

18:23 clojurebot: clojure.lang.BigInt

18:23 SagiCZ11: why are you hating on float?

18:23 i mean.. at least it floats right?

18:23 * SegFaultAX shows SagiCZ11 the door

18:24 SagiCZ11: :(

18:24 SegFaultAX: hyPiRion: The sad thing is, I get the joke. More than you'll ever known. :'(

18:25 * SegFaultAX has worked at 3 companies that did their own payments processing

18:26 hyPiRion: SegFaultAX: I'm sorry =(

18:26 SagiCZ11: everyone knows you may never use floating point number representation for money

18:26 SegFaultAX: "Everyone"

18:26 SagiCZ11: then again.. my boss regulary represents booleans as BigDecimals (0, 1) .. :(

18:27 hyPiRion: tinyint 1 please

18:30 sveri: Hi, what is the best way to execute a function at a given time only once? I was thinking about using quartzite...but it seems like one can only define cronjob like repeating events...

18:34 csd_: Why does filter #{set1} #{set2} take the intersection of the two?

18:35 amalloy: csd_: what else might it do?

18:35 hiredman: a set is a function that returns the element you pass it if it contains it

18:35 ,(#{:a} :a)

18:35 clojurebot: :a

18:35 hiredman: ,(#{} :a)

18:35 clojurebot: nil

18:35 hiredman: ,(boolean (#{:a} :a))

18:35 clojurebot: true

18:35 hiredman: ,(boolean (#{} :a))

18:35 clojurebot: false

18:35 hiredman: so there you go

18:36 SegFaultAX: It doesn't exactly take the intersection.

18:36 ,(filter #{1 2 3} (set (range 10)))

18:36 clojurebot: (1 3 2)

18:36 csd_: thanks thats helpful

18:36 SegFaultAX: Note the result is a list, not a set.

18:36 Fare: oh, there is a function boolean that booleanizes its arguments?

18:36 that's cool

18:36 amalloy: its one argument, yes

18:37 SegFaultAX: ,(map boolean [nil false [] {} #{} "" "" '() 0])

18:37 clojurebot: (false false true true true ...)

18:37 SegFaultAX: ,(doall (map boolean [nil false [] {} #{} "" "" '() 0]))

18:37 clojurebot: (false false true true true ...)

18:38 SegFaultAX: Fare: One feature I like about Clojure is its very simple notion of true and false: nil and false are false, everything else is true.

18:40 amalloy: SegFaultAX: you're preaching to the wrong guy: he'd probably rather a simpler-still notion: nil false and everything else true (as a common lisper)

18:40 Fare: SegFaultAX, yes, it's a great relief from Python, Javascript, etc.

18:41 SegFaultAX: amalloy: How is that different from what I said?

18:41 Fare: Indeed.

18:41 hiredman: nil (false and everything else true (as a common lisper))

18:41 Fare: I find that two false values is already too much, but oh well

18:41 hiredman: parens added for clarity

18:41 er

18:41 I guess that didn't work

18:41 SegFaultAX: Clarityer?

18:41 amalloy: oh, i see. i did punctuate that quite badly

18:41 technomancy: SegFaultAX: nil and false is redundant

18:42 hiredman: he means no distinct value 'false'

18:42 amalloy: (nil is falsey), everything else is truthy

18:42 SegFaultAX: Yes, that.

18:42 Fare: yes, I'm not sure about this nil being falsey thing

18:42 but oh well, it's not too bad.

18:43 technomancy: having nil in the first place is pretty unfortunate

18:43 but when life gives you JVM lemons, make clojureade.

18:43 SegFaultAX: Yea, this is a little odd coming from other lisps: ##(= (boolean ()) (boolean nil))

18:43 lazybot: ⇒ false

18:50 Fare: when filtering ex-info, do you do it based on message or based on some tag in the ex-data ?

18:50 technomancy: I'd avoid using the message if you can

18:51 Fare: yeah, I don't like using the message. But then is there a convention regarding discriminating the kind of map?

18:51 can I make the map a record or something?

18:52 technomancy: Fare: no, just put whatever you need to make the decision into the map

18:52 Fare: is the ex-data guaranteed to be a map?

18:52 technomancy: hard to give advice that's more specific than that

18:52 yeah

18:52 well, or nil if the exception isn't an ex-info

18:52 Fare: well, I want to distinguish between my exceptions and exceptions from other part of the code

18:53 DomKM: Anyone know why pre/post conditions don't work in protocol method implementations? Is this intentional?

18:54 I found this report (http://dev.clojure.org/jira/browse/CLJ-1141) from Jan 2013 with no resolution.

19:00 Fare: ok, I'll use ::tag as the key in my ex-data to detect that the exception is for me

19:07 shinka: I download the lein script, launched it with "lein", it installed clojure and after "lein repl" I get a very long error message that starts with "Exception in thread "nREPL-worker-0" java.lang.NoSuchMethodError: clojure.tools.nrepl.StdOutBuffer.length()I". I'm on Linux x86 with the latest stable lein script and openjdk-7 installed.

19:08 technomancy: shinka: sounds like an issue with the latest version that I've been unable to reproduce. you can fall back to the previous version with `lein downgrade 2.4.2`

19:08 but I'm super curious as to why it happens on your machine and not mine =\

19:08 hiredman: https://github.com/clojure/core.async/commit/3abbd105ded7e5ccc9425b40514e841dcb5eb747#diff-5c087e8e400be45f4d03e0a618ef9d46R501 nice

19:08 technomancy: (I'm also on openjdk7 and linux)

19:09 Fare: is there a way to tell clojure / java how to print my special kind of ex-info ?

19:10 hiredman: shinka: what plugins are you using?

19:11 shinka: I'm on Ubuntu 14.04 and I have openjdk-7 installed... everything is updated.

19:12 hiredman: none, I just downloaded the lein script, did "lein" and "lein repl" (after putting it in /bin/).

19:12 hiredman: shinka: but what plugins?

19:12 huh

19:12 shinka: I know what's happening, Clojure senses that I'm a vim user.

19:12 technomancy: haha

19:13 shinka: you can try downgrading as per above or running a repl inside a project, which supposedly fixes it

19:15 shinka: Here's the error message: http://pastebin.com/hcGdVxLv

19:15 technomancy: al right, I'll try running inside a project.

19:15 hiredman: shinka: https://github.com/technomancy/leiningen/issues/1625

19:17 shinka: ...and it works. Thanks!

19:19 technomancy: shinka: still trying to understand what's happening there, but I hope to have a fix soon

19:20 shinka: I just installed it on another computer (Ubuntu 14.04 x86 again) and I get the same error.

19:21 * Fare will just explicitly call (my-ex-string ex) to decode one of my exceptions.

19:25 hiredman: https://github.com/clojure/core.async/commit/3abbd105ded7e5ccc9425b40514e841dcb5eb747#diff-5c087e8e400be45f4d03e0a618ef9d46R470 the lack of an explicit (loop) here makes me sad

19:26 I mean, I guess it doesn't really matter, but it just seems like bad form

19:42 juliobar_: I've been working on an app with Om and Kioo and just tried to upgrade to Om 0.7.1. I'm not getting the error Uncaught Error: Assert failed: Invalid Om component fn, my_view does not return valid instance (or (satisfies? IRender x) (satisfies? IRenderState x)) ... any ideas?

19:45 tsantos: In Clojure regular expressions, do you have to escape forward slashes?

19:45 amalloy: try it and see, tsantos

19:45 hiredman: like five times

19:46 tsantos: I figured not… Just trying to see why my port of a tiny Node js app won’t work.

19:48 danielcompton: I'm trying to pull in a plugin from a private nexus repo, how do I set up my user profile to add this as a source? I've added the nexus repos as a :deploy-repositories key but is there another one?

19:51 llasram: danielcompton: :plugin-repositories in the :user profile

19:52 danielcompton: llasram: perfect!

19:53 llasram: Do I set :repositories in the user profile to use it for everything?

19:57 (inc llasram)

19:57 lazybot: ⇒ 31

20:16 jumblemuddle: Leiningen seems to be creating a .m2 folder in my home directory. Is there anyway to wrangle this into an XDG folder? (.config, .cache, or .local)

20:17 hiredman: .m2 is the standard place where maven/lein keeps that stuff

20:19 jumblemuddle: So, any pretty way of moving it?

20:19 hiredman: I dunno if lein exposes a way to change that, if you really need it to be somewhere else you can just add a link

20:19 jumblemuddle: Alright, thanks anyways.

20:20 hiredman: so lein looks for config in .lein, which is also not a XDG folder, but you can put settings in there that can change I guess

20:20 http://stackoverflow.com/questions/12579335/leiningen-how-to-customize-the-location-of-the-m2-folder

20:20 jumblemuddle: Ya, I saw that I could do that, but then I'd still have the .lein folder. :/

20:21 technomancy: I think you can set LEIN_HOME

20:21 jumblemuddle: Ah, I'll try that.

20:22 hiredman: what is the benefit of putting stuff in the xdg folders?

20:22 jumblemuddle: Not much, I'm just OCD about everything not using the same location.

20:22 I wouldn't mind if everything made dot folders, but because most of my stuff uses xdg folders, I want everything to use it.

20:23 hiredman: fair enough

20:23 technomancy: at least it's not virtualbox

20:23 which creates a ~/Virtualbox VMs directory upon launch

20:23 * technomancy froths

20:23 jumblemuddle: Ya... I'm glad I don't use vbox often.

20:24 It's really hard to wrangle dot folders elsewhere sometimes...

20:29 gfredericks: technomancy: what's the problem? hard coded dir? a space in the name? not a dot folder?

20:30 capital letters?

20:30 jumblemuddle: All of the above...

20:30 lol

20:30 technomancy: yeah pretty much

20:31 primarily creating a non-dotfile dir without asking though

20:31 clojurebot: It's greek to me.

20:33 gfredericks: thanks Obama I guess?

20:36 catern: hiredman: if you really follow the spec, the XDG folders can be moved with environment variables

20:36 hiredman: also, .cache can be a mounted tmpfs, and you can backup .config easily

20:38 hiredman: and .local follows the convention of /usr/ so for whatever program, you can just ./configure --prefix=~/.local && make install , and it will cohabitate nicely with everything else and you only have to add one bin directory (.local/bin) to your path, and that bin directory is even added by default in Fedora I think

20:40 * Jaood listens to catern

20:40 * Jaood is using ~/usr

21:01 awwaiid: I prefer just ~/local myself, hiding where binaries are confuses me I guess

21:02 * awwaiid realizes that this is a conversation more about ~/.m2 and that it is already over

21:02 * awwaiid ... er ... just realized

21:23 paxan: Sooo… I have Leiningen 2.4.3 and I noticed that when I invoke "hadoop jar cooluber.jar foo.MainClass …" I get an FileNotFoundException from clojure.lang.Compiler.loadFile because instead of treating the argument after jar path as fully qual class name, it treats it as file. I think this is because leiningen added "Main-Class: clojure.main" to the jar manifest. Basically clojure.main is doing it's "main options" processing. When I remove Main-Class from the

21:28 aha! our CI server uses lein 2.3.1, but local machine is upgraded to 2.4.3, which explains why our deployed stuff continues to work (it lacks Main-Class) in manifest of the jar.

21:28 hiredman: paxan: you got cut off

21:28 paxan: sorry… IRC novice.

21:28 hiredman: any hint at what point it got cut off?

21:29 xeqi: "When I remove Main-Class from the"

21:29 paxan: "When I remove Main-Class from the manifest, the class loads correctly. Which leads me to think that somehow lein started to add Main-Class be default…"

21:29 "… It was clearly not the case before I upgraded to the newest lein. My older jars have no such Main-Class attribute in the manifest. Any suggestions on how to prevent Main-Class from being added to manifest?"

21:30 xeqi: thanks!

21:30 hiredman: https://github.com/technomancy/leiningen/blob/master/NEWS.md

21:30 it is in 2.4.0

21:31 paxan: my uberjar has like 5 mains :(

21:32 hiredman: thanks for the pointer.

21:32 hiredman: it doesn't look there is anything in the sample project.clj to disable that

21:34 paxan: yeah i am grepping the source now :)

21:36 amalloy: "Use clojure.main for uberjars that don't declare their own :main"? what's that for?

21:37 paxan: amalloy: from FAQ…

21:37 **Q:** Is there a way to use an uberjar without AOT?

21:37 **A:** As of Leiningen 2.4.0, if you omit `:main` in `project.clj`,

21:37 your uberjars will use `clojure.main` as their entry point. You can

21:37 launch with `java -jar my-app-standalone.jar -m my.entry.namespace

21:37 arg1 arg2 [...]` without any AOT, but it will take longer to launch.

21:38 https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md

21:38 amalloy: mmmm, i don't really see the point. it's a little more convenient than `java -cp my-app-standalone.jar clojure-main -m my.entry.namespace`, but not really adding much

21:38 paxan: see the last one

21:39 so in my case my container is not "java" but "hadoop jar …" which seems to pay attention to manifest.mf which now has Main-Class :(

21:49 mdeboard: So is there a "right" way to start a clj web project with planned cljs front-end? I mean I know about `lein new compojure-app foo`, what's the right way to do the clojurescript bootstrap? Or is it even necessarY/

21:50 I'm kind of murky on how it all fits together :(

22:00 paxan: hiredman: I've started an issue: https://github.com/technomancy/leiningen/issues/1627

22:00 cc technomancy :)

22:11 technomancy: paxan: we added the ability to skip the default main-class for this

22:11 paxan: :main nil ?

22:11 i just got it figured out

22:11 i think

22:12 bingo!

22:12 Manifest-Version: 1.0

22:12 Built-By: pavel

22:12 Created-By: Leiningen 2.4.3

22:12 Build-Jdk: 1.8.0_05

22:20 technomancy: amalloy_: modulo weird things like hadoop, a jar with no main is strictly less useful than a jar with a repl as a main

22:21 certainly not a big difference

22:22 TimMc: technomancy: At some point, lein-otf broke. Might be related.

22:22 gfredericks: clojurebot: weird things |like| hadoop

22:22 clojurebot: In Ordnung

22:29 paxan: boom! https://github.com/technomancy/leiningen/pull/1628 :)

22:37 zeebrah: are there any good projects in need of newbie helpers?

22:49 TimMc: zeebrah: Yeah, you could help figure out why lein-otf isn't working anymore. :-P

22:50 That would actually be a pretty good task if you want to learn more about Leiningen, Clojure, and Java.

23:11 zeebrah: TimMc: no promises but i'll try not be a big girl about it and give up too easily :)

23:42 trptcolin: ambrosebs: probably easier here than twitter: got any particularly drastically different output-type examples you can throw me?

23:45 ambrosebs: trptcolin: well "drastic" is relative :)

23:45 trptcolin: hehe

23:45 ambrosebs: trptcolin: let me rephrase

23:46 trptcolin: i guess til now i've see the main characteristic of sequence fns as being "returns an ISeq"

23:47 ambrosebs: right, I'll admit the transducer changes are "drastic" compared to the rest of clojure core

23:48 trptcolin: gotcha

23:48 ambrosebs: but clojure programmers are used to relying on certain output for certain input.. sounds like a silly statement but maybe the types will speak for themselves https://github.com/clojure/core.typed/blob/master/module-check/src/main/clojure/clojure/core/typed/base_env.clj#L904

23:48 there are lots of things going on in any function call usually

23:48 but my real point was my second tweet

23:49 if we can communicate these differences better than "watever" -> "foo", we will kickstart the learning process

23:49 trptcolin: yeah, i was trying to figure out what was bothering me and i realized maybe it's a types thing

23:49 well, "bothering"

23:50 ambrosebs: the concept of functions doing weird things that don't make sense in other typed langs is not foreign in Clojure

23:50 trptcolin: i'm sitting here w/ a scotch playing around & learning stuff

23:53 ambrosebs: everything's getting higher and higher order these days. we can learn a lot from racket's higher-order contracts + blame to debug this kind of thing.

23:53 and that means: expect to see something like racket's contracts pop up at some point.

23:54 once something goes wrong passing a transducer to a higher-order channel.. if the error message actually tells you the source of the error you'd save a lot of time

23:54 it's very cool stuff

23:55 and of course there's typed clojure for the braver

23:55 but we all know that we can add a contract and immediately reap benefits

23:56 trptcolin: eh, immediately depends on the situation

23:56 i've definitely seen it pay off

23:56 but also sunk time into writing contracts and never seen it pay off

23:57 ambrosebs: trptcolin: what kind of contracts?

23:57 trptcolin: same deal w/ tests, though i'm more experienced w/ those so they go faster ;)

23:57 ambrosebs: I mean, something like what racket provides?

23:57 trptcolin: oh no

23:57 just stuff like schema, preconditions

23:58 well actually, i assume not. i have no idea what racket provides other than what you just wrote :)

23:58 seqex

23:59 ambrosebs: yes I agree those only go so far

Logging service provided by n01se.net