#clojure log - Apr 23 2014

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

0:04 cddr: It's an alternative approach to managing a big IT infrastructure

0:36 r00k: Does anyone have a link to a plugin that colorizes clojure.test output?

0:37 lein-difftest appears unmaintained an unworking.

0:49 jwm: is eval lazy?

0:50 amalloy: jwm: that's a pretty poorly-defined question

0:50 jwm: probably

0:50 amalloy: try constructing a sample call to eval, decide how it would behave if eval were lazy vs not lazy, and see which answer you actually get

0:51 jwm: I am trying to do an eval right after (use)

0:51 it works when I lein repl but the eval fails when I do lein run

1:04 expez: jwm: eval isn't lazy. Furthermore, eval isn't called directly very often, so if you're new to Clojure you're probably 'doing it wrong'.

1:05 jwm: I'm loading some code at runtime based on configuration using 'use' and then calling a init function from there

2:06 zanes: So, I have a sequence of data transformations during which I want to perform side effects based on the intermediate values. What’s the most idiomatic way to go about that?

2:07 Without the side effects this is very neatly expressed using the thread last macro.

2:09 Si_: any one here use caribou at all ?

2:13 jwm: so lein run leaves me in the "user" namespace?

2:14 noidi: zanes, synthread has ->/aside for that purpose https://github.com/LonoCloud/synthread

2:14 zanes: Aha.

2:15 noidi: or you could do (as-> x (side-effect-1 x) (side-effect-2 x) x)

2:15 within (-> ...)

2:16 zanes: noidi: Those are both really helpful, thanks!

2:17 noidi: and if your side-effecty functions take the topic as the first parameter, you could do (-> ... (doto side-effect-1 side-effect-2) ...) but that doesn't read very well IMO

2:17 zanes: I’m threading last, fwiw.

2:18 beamso: so, in my programming, i build up maps of information to process. is that what that library is for, in a way?

2:19 zanes: So it seems like as-> won’t work for me in here.

2:21 noidi: ah, I forgot that as-> doesn't just give a name to the topic but it does threading as well

2:22 zanes, this should work

2:22 ,(-> 2 (as-> x (do (println x) x)))

2:22 clojurebot: 2\n2

2:22 zanes: ,(-> [1 2] (as-> x (do (println x) x)))

2:22 clojurebot: [1 2]\n[1 2]

2:22 zanes: ,(->> [1 2] (as-> x (do (println x) x)))

2:22 clojurebot: #<Exception java.lang.Exception: Unsupported binding form: (do (println x) x)>

2:22 noidi: ah, right

2:23 zanes: ,(->> [1 2] #(as-> % (do (println x) x)))

2:23 clojurebot: #<CompilerException java.lang.Exception: Unsupported binding form: (do (println x) x), compiling:(NO_SOURCE_PATH:0:0)>

2:24 noidi: ,(-> [1 2 3] (as-> xs (map inc xs) (do (println xs) xs)))

2:24 clojurebot: (2 3 4)\n(2 3 4)

2:24 zanes: This seems relevant: http://missingfaktor.blogspot.com/2014/03/dead-simple-threading-with-functions-in.html

2:24 noidi: that's not as nice as ->> as you have to explicitly name the topic in each step, but it still does threading

2:25 zanes: Ah, I get it.

2:25 So as-> basically lets you choose your own position.

2:25 For each form.

2:25 noidi: yes

2:26 zanes: Okay. I was mistaken in my understanding of it. So I’d replace my use of ->> with as->.

2:26 Probably.

2:37 numberten: question

2:37 i was trying to write the shortest possible identity function

2:38 i thought #(%) might work but it doesn't seem to

2:38 i'm curious what makes that any different than (fn [x] x) which seems to work

2:44 dbasch: numberten: this answers your question http://stackoverflow.com/questions/13204993/anonymous-function-shorthand

2:44 numberten: thanks

2:44 i realized that it was the () around it

2:44 that was breaking it

2:44 i guess I don't fully understand the desugaring that happens

2:46 dbasch: numberten: #(%) tries to call % as a function, with no arguments

2:47 numberten: i see

2:58 noidi: ,'#(%)

2:58 clojurebot: (fn* [p1__25#] (p1__25#))

3:00 numberten: woah

3:00 zanes: ,(#(%) #(print “Hello”))

3:00 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “Hello” in this context, compiling:(NO_SOURCE_PATH:0:0)>

3:01 numberten: ,#(-> %)

3:01 clojurebot: #<sandbox$eval132$fn__133 sandbox$eval132$fn__133@ad08de>

3:01 numberten: ,(#(-> %) 5)

3:01 clojurebot: 5

3:09 zanes: noidi: Turns out prismatic.plumbing has as->>.

3:09 https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj#L300...L303

3:10 jwm: how do I use another namespace than "user" when executing -main from uberjar?

3:12 kelsey: hey I have a total newb question

3:15 kelseygi: i wanna map a function over a vector of maps

3:16 the function is select-keys, which takes the map as the first arg & a set of keys as the second arg

3:16 how do i get each member passed to select-keys in the map call?

3:16 amalloy: you have a fixed set of keys you want to select, across all maps?

3:17 kelseygi: yah

3:17 it's json--i probably should do something more robust for parsing but now i want to know the answer

3:17 amalloy: (map #(select-keys % [:x :y :z]) maps), although i would usually write that as (for [m maps] (select-keys m [:x :y :z]))

3:18 kelseygi: ah the placeholder % was what i couldn't google :)

3:18 amalloy: kelseygi: i mean, remember that #(f % x) is just shorthand for (fn [foo] (f foo x))

3:19 you don't ever need to use it

3:19 roelof: Hello, I have to make a script which checks if someone is older then 12 and younger then 20

3:19 amalloy: show them a picture of a VHS tape

3:19 roelof: So i did this:http://pastebin.com/06mfqLjh

3:20 but now I see this error message: cannot be cast to clojure.lang.id

3:20 how to solve this ?

3:21 ebaxt: roelof: (> age 12) not (age > 12)

3:22 and you don't need the if

3:22 kelseygi: thank you amalloy

3:23 roelof: oke, still have to think about this,

3:24 last question : Can I do the same with one comparison and three arguments

3:24 I now I can do ( < x y x )

3:24 amalloy: (< 12 age 20)

3:25 roelof: amalloy: does that not mean lesser then 12 ??

3:25 lazybot: roelof: What are you, crazy? Of course not!

3:25 roelof: lazybot: ????

3:27 amalloy: lazybot is right as always

3:27 roelof: I think lazybot is insulting me. I do not understand what he/she means

3:27 amalloy: he's a robot

3:28 he just knows that if you ask a question with two exclamation marks the right answer is usually, as here, "no"

3:28 er, question marks

3:29 roelof: oke, I refrase my question then

3:30 amalloy: does that not mean lesser then 12 ?

3:30 amalloy: why don't you try it on some sample values of x and see?

3:31 roelof: oke, I will do that

3:31 thanks for the help so far

3:56 martinklepsch: I'm using data.zip/data.xml and some other stuff and would like to parse a list of elements to a vector of strings: <parent><a>hello</a><b>you</b></parent> => ["hello" "you"]

3:59 nevermind, got it

4:08 jwm: that is nice

4:09 now I have two repls going at once, one from lighttable and one from lein :)

4:16 bars0: \quit

4:23 sveri: hi, why does this macro return a stack overflow error? http://pastebin.com/H1eHr6JZ I am wondering, cause it should stop recursion if i give it a map without the key :a

4:26 djcoin: sveri: as you are outputting

4:26 a code that contain a macro, it keeps growing

4:27 and macro expanding I guess - yet, I'm far from being a macro expert

4:27 sveri: djcoin: if I omit the (println there still is a stackoverflow error

4:29 djcoin: I think a println call has nothing to do with a stackoverflow error

4:29 Maybe you could paste your error

4:32 sveri: djcoin: this is the error: clojure.lang.Compiler$CompilerException: java.lang.StackOverflowError, compiling: it occurs at the line with the recursion step

4:33 the stackoverflow also happens if you call the macro with no map at all, like a string for instance

4:52 augustl: sveri: out of curiousity, why the let?

4:52 sveri: augustl: I will need the binding later, but left that out in the example because it just complicates things

4:53 augustl: do you get the stack overflow when the code runs, or when the macro expands?

4:53 I assume the former :)

4:54 also, why the ~@, wouldn't (mein (:a ~t)) do the trick?

4:55 I seldom write macros so I forget all the terms.. But doesn't ~@ mean "inline this form"?

4:55 pyrtsa: Correct.

4:56 augustl: perhaps that's where you get the overflow, at expansion time, since you try to inline something that isn't around at expansion time.. </wildguess>

4:56 sveri: augustl: sry, copy and paste error, its actually ~t jeez

4:56 augustl: ah :)

4:56 sveri: however, the error occurs when running the code

4:56 augustl: what is the value of t initially?

4:57 sveri: it is supposed to be a map, but can be anyhting

4:57 I dont want the parameter to be restricted

4:58 augustl: also just realized I'm not sure what happens when you recursively call a macro

4:58 perhaps that's the problem

4:58 the checks you do are run-time, the macro expands forever? Not sure why that doesn't give you an expansion time stack overflow, though

4:59 sveri: hm, you think you cannot call a macro recursively?

4:59 augustl: well, it is called expansion time, not run time

4:59 so you can do it, but you need to make sure your recursion check is done expansion time

5:00 sounds like a classic case of trying to do too much in a macro? :)

5:00 sveri: :D

5:01 augustl: the fact that you get the overflow run-time makes no sense to me, though

5:01 I can guess.. But I don't understand macro expansion, apparently :)

5:02 is the inner "mein" expanded expand-time, or when it's called the first time? If so, that explains the run-time stack overflow, at least

5:04 sveri: ok, it also appears during macroexpand-all

5:08 this macro: (defmacro rec-macro [x] `(when ~x (rec-macro (first ~x)))) suffers the same problem

5:09 the "and" macro should be doing the same

5:14 augustl: sveri: but the check happens before expansion

5:15 sveri: in your case, the check happens inside the quoted form

5:15 sveri: in the case of "and", the check happens when the macro is invoked expansion time

5:15 sveri: augustl: ok, I think I got a slight feeling what you are telling me (my first time writing a macro ;-))

5:19 augustl: sveri: stuff that happens inside `(+ 1 2) means + isn't invoked expansion-time

5:19 but if you do (if (= something 1) `(+ 1 2)), that if check before the ` form is actually evaluated expansion-time, not run-time

5:20 Kototama: hi, any idea how to get rid of this error when using timbre? http://paste2.org/tjDGvDPG

5:20 augustl: sveri: and vararg macros (which "and" is) are evaluated expansion time

5:21 sveri: augustl: ok, thank you

5:21 that sounds reasonable :-=

5:21 :-)

5:22 augustl: ~reasonable ;)

5:55 xsyn: Does Clojure have a spec?

5:57 clojurenoob: hey guys I'm getting a 'No such namespace' error with lein run which I am not getting with lein repl, any ideas ?

6:12 hmmm seems I need a specific function level require on the namespace before I call an eval on it

7:03 karls: yep

7:04 whoops! wrong window.

7:22 gfredericks: xsyn: no

7:25 xsyn: gfredericks: ta

7:55 octe: i seem to remember a quote in regards to clojure, something like "its better to have a few types which work with all functions instead of many types that work with a few functions"

7:57 katratxo: octe: chapter 5 of JoC book starts with "It’s better to have 100 functions operate on one data structure than 10 functions on

7:57 10 data structures.

7:57 -- Alan Perlis

7:57 octe: ah

7:57 thats where i got it from

7:57 thanks

7:59 katratxo: http://books.google.es/books?id=nZTvSa4KqfQC&pg=PA84#v=onepage&q&f=false

7:59 octe: also found the Clojure Programming

7:59 octe: can't see that page

7:59 katratxo: nope?

7:59 octe: but i bought JoC so i have it in pdf form somewhere

8:00 "You have either reached a page that is unavailable for viewing or reached your viewing limit for this book"

8:00 katratxo: ok

8:01 agarman: here's a good page of Alan Perlis quotes http://www.cs.yale.edu/homes/perlis-alan/quotes.html

8:01 quote 9 is what you're looking for

8:38 irctc: hello everyone i am beginner in clojure.I want to be do the unit testing of clojure functions with a new database where i define the new database in a application structure and how,

8:43 agarman: clojure has decent test package built in

8:43 irctc: hello everyone i am beginner in clojure.I want to be do the unit testing of clojure functions with a new database where i define the new database in a application structure and how,

8:44 beamso: https://github.com/clojure/java.jdbc

8:45 agarman: and an intro to clojure.test http://java.dzone.com/articles/clojuretest-introduction

8:45 gtrak: irctc: unit test library has little to say on how you expose your database.

8:45 keep it simple

9:05 boodle: hi, I'm learning clojurescript and want my ring server to determine if the current 'cljsbuild' build version is :dev or :production.. how do I access the current build version server-side (say using Selmer)

9:07 badlambda: does anyone know of any existing implementations in clojure of this algorithm? http://en.wikipedia.org/wiki/Knuth's_Algorithm_X

9:07 clgv: badlambda: not very likely. what is your problem with that one?

9:08 badlambda: clgv: I am having some problems coding it up

9:08 would help to have something to learn from

9:08 clgv: badlambda: can you narrow down your problem?

9:09 badlambda: yeah, inexperience :-|

9:10 clgv: badlambda: that's too general to give you good pointers.

9:11 badlambda: clgv: sure, but that's the root cause

9:12 clgv: badlambda: try to implement it bottom up. first solution encoding. second the operations on the data structure. third one recursion procedure. finally the complete recursion

9:12 badlambda: thanks, I will give it a go

9:12 btw, what is the best way to get feedback assuming I produce a solution?

9:13 I feel like writing elegant, ideomatic clojure is still a problem for me

9:13 clgv: badlambda: post a gist on refheap.com and ask here for "live feedback" or on the mailing list

9:14 badlambda: thanks for the advice clgv

9:14 clgv: badlambda: try to make your gist readable and include comments so that people understand what you are trying to do

9:15 badlambda: good idea, sometimes I have problems following myself, since my Clojure tends to be a mess of repeated "map":s

9:15 it's the spaghetti code equivalent in functional programming I guess

9:18 koalallama: can anybody reproduce this? running lein repl outside of a lein project causes java process to use 100% CPU, and continually grow in memory usage. running lein 2.3.4 on JRE 1.8.0_05

9:18 (on OS X)

9:19 clgv: koalallama: it's probably transmitting the contents of your hard drive to the NSA ;)

9:20 koalallama: NSA transfer only accounts for 0.1% due to their efficient syncing algorithm though

9:20 clgv: ah damn, well, .... no idea...

9:21 beamso: koalallama: not here. do you have a plugin configured that may be causing trouble?

9:27 koalallama: yes, lein-exec but tried with no profiles.clj and same thing

9:27 owl-v-: how do i create java class in clojure code? https://www.refheap.com/79100

9:29 koalallama: I narrowed it down to when I run lein repl from my home diretory, which has about 100GB+ worth of files

9:29 lein repl from an empty directory is perfectly fine.

9:29 beamso: weird

9:30 koalallama: I imagine lein is searching through all my files trying to gather project information

9:30 beamso: owl-v-: (mymethod (Myclass.))

9:34 owl-v-: beamso: thanks. ;;(.mymethod (Myclass.))

9:34 beamso: oops. yes, .mymethod.

9:35 pjstadig: ~source some-when

9:37 Bronsa: ~source when-some

9:37 well. pjstadig it's when-some anyway

9:42 hyPiRion: ~source when-first

9:44 owl-v-: o.O

9:45 java object is not copied. https://www.refheap.com/79106

9:46 Bronsa: owl-v-: that's the same as in java

9:46 tbaldridge: owl-v-: why would it be copied? everything is passed via reference

9:48 beamso: i'm trying to think of a language where the object would be copied and i can't.

9:48 Bronsa: beamso: C++

9:49 beamso: really?

9:49 teslanick: Only if you don't put the asterisk in front of everything. :)

9:49 Bronsa: if you don't explicitely references or pointers, sure

9:49 explicitely use*

9:49 teslanick: star-this equals star-that deref this. It's as if an entire programming language were written inside a clojure atom. :)

9:50 beamso: my c++ must be terrible because i can't think of a case when i wouldn't use references or pointers.

9:50 teslanick: It's syntax-compatible with C, where very often you *do* want to pass-by-value.

9:53 tbaldridge: beamso: yeah, proper C++ uses copy on argument passing with a bit of & (pass stack value by reference) to improve performance.

9:54 beamso: okay. i should probably jog my c++ memory one day.

10:05 owl-v-: does clojure pass reference when calling functions? ex) (function [:1 :2])

10:06 does clojure pass reference when calling functions? ex) (function 1)

10:07 mercwithamouth: my newbie little brain just popped o_O; http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/

10:07 seems like a very good tutorial though...i'm going to have to play with this a lot...

10:14 teslanick: Is there a version of update-in that "upserts" into a map?

10:14 ,(update-in {} :foo "HELLO WORLD")

10:14 clojurebot: #<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Keyword>

10:15 teslanick: nvm, I think I'm being foolish

10:17 `szx: teslanick: assoc-in?

10:19 teslanick: I was getting strange behavior because I didn't realize that update-in wants a vector as its second arguemnt.

10:20 ,(update-in {} [:foo] conj :upsert-key)

10:20 clojurebot: {:foo (:upsert-key)}

10:20 teslanick: ,(update-in {:foo [:existing-key]} [:foo] conj :upsert-key)

10:20 clojurebot: {:foo [:existing-key :upsert-key]}

10:28 stuartsierra: owl-v-_: Yes, Clojure always passes function arguments by reference, the same as Java. The only time you get pass-by-value is with primitive numbers, which are rarely used in Clojure.

10:32 Bronsa: stuartsierra: uhm, technically it's always pass by value, only that in case of Objects, the value is a pointer to the object

10:33 stuartsierra: Bronsa: yeah yeah :)

10:35 teslanick: http://i.qkme.me/3oc321.jpg

10:41 cbp: ,

10:41 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:46 solussd: Bronsa: stuartsierra: technically, it’s “pass by sharing”. :D

10:47 …with immutuable data though, it’s semantically equivilent to pass by reference

10:47 *immutable, even

10:47 egghead: huh?

10:48 isn't it pass by ref anyhow given the jvm and js underneath :p

10:48 owl-v-_: solussd: is number passed by reference?

10:48 egghead: I wouldn't imagine so owl-v-_

10:48 solussd: for all intents and purposes… yes.

10:49 owl-v-_: is list/vector passed by reference?

10:49 egghead: but like.. if you have a java obj and not a clojure datastruct... it matters

10:49 well a clojure datastruct is just a java obj but you know what I mean ;)

10:49 solussd: they’re boxed, so it’s pass by sharing (pass by value, but the value is a pointer)

10:49 egghead: if you have a reference to something that exposes a mutable api

10:49 solussd: right

10:49 egghead: then you'll have to worry about that even in clojure

10:50 jcromartie: pass by value is pretty unworkable with the amount of data most programs deal with anyway

10:50 egghead: hi everyone... i'm currently lamenting standalone jar startup times :(

10:50 1: i want to use clojure for command line apps because I love clj so much

10:50 2: clojure takes forever to start up

10:51 3: i am crying

10:51 cbp: you could try clojurescript with node

10:51 hyPiRion: egghead: As a lein contributor, I've felt the same pain

10:51 solussd: real pass by reference with mutable data is madness

10:52 owl-v-_: but, #clojure is faster to start up :)

10:52 egghead: ya solussd and yet is the default in langs like java ;)

10:52 llasram: jcromartie: There's optimizations. R is mostly past-by-value with copy-on-write and elided copying for single-reference values

10:52 hyPiRion: egghead: Currently, I just try to keep myself busy with other things until a solution pops up.

10:52 egghead: lol hyPiRion, ya

10:52 hyPiRion: Because it will happen at some point

10:53 solussd: no, pass by reference with mutable references means I can change the value referred to by the reference passed to the function, not just values inside, say, an object (that’s where the distinction between pass by reference and pass by sharing comes in)

10:53 but, mutability in OO langs is also madness.

10:54 egghead: ya, clojure doesn't have immutable refs does it?

10:54 defonce maybe?

10:54 owl-v-_: atom

10:54 technomancy: egghead: have you looked at racket?

10:54 teslanick: solussd: That would be the equivalent of passing pointers-of-pointers, yes?

10:54 jcromartie: egghead: different kind of ref

10:54 egghead: owl-v-_: that's the other side of the thing, the thing that is referenced is immutable

10:54 technomancy: it's really good for small, fast-starting programs

10:54 jcromartie: all Java objects are references

10:54 egghead: but the reference itself can be changed to point to any other thing

10:54 jcromartie: or treated as such

10:54 solussd: well, in clojure a “pointer” to the value is passed, not the var itself

10:55 owl-v-_: (fun 1) ??

10:55 lazybot: owl-v-_: Definitely not.

10:55 owl-v-_: lol lazybot~

10:55 egghead: ,(type 1)

10:55 clojurebot: java.lang.Long

10:55 egghead: ^ wrapper type

10:56 so ya, a ref

10:56 hm

10:57 solussd: what are you getting at btw

10:58 i've wondered if it would be better if clojure def[n]s were final declarations but not sure if it matters

10:58 jcromartie: it doesn't particularly matter

10:58 solussd: absolutely nothing. I just saw Bronsa correct stuartsierra and I figured I might as well be more “technically correct”. :P

10:58 egghead: ah :p

10:59 jcromartie: the JVM deals primarily in objects and those are always essentially references

11:00 solussd: yup

11:06 jcromartie: hell is watching other people use a computer

11:06 llasram: Not a fan of pair programaming?

11:20 seangrove: http://www.w3.org/TR/css3-layout/ ASCII art to define layout grids

11:22 technomancy: watching people who don't know keyboard shortcuts is the worst

11:23 seangrove: technomancy: Breath. You're going to crush their sense of confidence.

11:23 Ahem.

11:23 Breathe*

11:24 hyPiRion: technomancy: I quite enjoy it even more when any non-xmonad person attempt to use my computer.

11:24 esp. if they consider themselves techy

11:25 gfredericks: hyPiRion: my work machine is virtualbox + xmonad + dvorak; completely user-proof

11:25 hyPiRion: heh

11:26 technomancy: try an unlabeled dvorak 40% keyboard =)

11:26 gfredericks: 40%?

11:26 hyPiRion: gfredericks: 0.4

11:26 gfredericks: having the qwerty labeling makes it deceptive

11:26 hyPiRion: that didn't clear anything up

11:27 technomancy: gfredericks: 40% means no number keys, arrow keys, or function keys

11:27 hyPiRion: gfredericks: that was my intent

11:27 technomancy: just ~40 keys

11:27 given that 105 keys is "standard" and you can't have fractional keys

11:28 gfredericks: technomancy: a key that works some fraction of the time is like a fractional key

11:28 hyPiRion: gfredericks: none of my keys work when my computer is off

11:29 coventry: Wow. What do you do for numbers? http://geekhack.org/index.php?topic=47133

11:29 Guest34699: hi

11:30 hyPiRion: gfredericks: or perhaps they do. I'm not sure of the definition of "working" is.

11:30 coventry: Oh, they're a chord with the fn key.

11:30 gfredericks: oh man

11:30 I kind of want such a keyboard

11:31 coventry: I'm pretty skeptical about it improving my life.

11:31 Guest34699: can i use maven in intellij ide?

11:32 sqldier: yes

11:32 file>settings>maven

11:37 technomancy: coventry: fn for numbers means you can put a numpad under your hand even in the home row position

11:38 I actually like it better than having them across the top

11:49 pjstadig: #1

11:49 clojurebot: #1

11:49 clojurebot: 1. One man's constant is another man's variable. -- Alan J. Perlis

11:49 pjstadig: hmm

12:04 rasmusto: how much of paredit.el do people actually use?

12:05 owl-v-_: clojurebot: #2

12:05 clojurebot: 2. Functions delay binding; data structures induce binding. Moral: Structure data late in the programming process. -- Alan J. Perlis

12:05 llasram: rasmusto: In what sense? How many of the commands it provides?

12:06 rasmusto: llasram: I guess it's a pretty vague question. Maybe this: /what/ in paredit.el can people not live without?

12:07 llasram: rasmusto: Mostly the fundamental idea of structural editing :-)

12:07 rasmusto: hah, okay :)

12:07 gfredericks: there's probably like 10 basics

12:07 moving the cursor around, adding, deleting

12:08 rasmusto: surround element, slurp, barf, etc.?

12:08 gfredericks: anything that is a composition of other commands is less fundamental

12:08 those are all compositions I think

12:08 rasmusto: ah, alright.

12:08 gfredericks: I can slurp by cut/paste

12:08 I don't want to, but I could

12:08 seangrove: bbloom: When you get a chance, would be nice to hear your thoughts on Famo.us' approach to layout https://famo.us/guides/dev/layout.html. I was a bit confused about their Panel-types initially, but seeing that everything is a composition of transforms makes sense, but it's very, very low-level

12:09 bbloom: seangrove: transforms != layout

12:10 seangrove: bbloom: In the famous world, it seems to ;) The grid layouts, etc. are a collection of transforms

12:10 "In this section, we learned that all layout in Famo.us is directed by transforms."

12:11 bbloom: seangrove: transforms are clearly fundamental to positioning / rendering, but it's totally a lower level construct than layout management

12:11 seangrove: Anyway, that's just their lowest-level primitive that they build on to achieve actual layouts (grids, etc.), but they expose it as the way to approach layout

12:11 bbloom: seangrove: ok that makes more sense

12:12 mainContext.add(sizeMod).add(originMod).add(rotateMod).add(test);

12:12 *sigh*

12:12 when will the rest of the planet earth catch on to this whole immutability thing?

12:13 seangrove: there's not enough info about the grid stuff to say if it's any good

12:14 seangrove: bbloom: Or even declarative approach. No reason that's that's not {:name mainContext :expanders [{:sizeMod ...}]}

12:14 bbloom: nearly all layouts are axis aligned, so transforms as simple as offset & scale is totally fine. the full generality of affine matrices is a nice to have

12:15 you can also have two transforms: one applied before layout and one after layout, but before rendering

12:15 coventry: technomancy: Huh, interesting.

12:18 seangrove: bbloom: If a child requests more width/height than a parent offers, is a general strategy to clamp the width/height at the offered values, or to allow the child to overgrow the parent's offered boundaries?

12:20 bbloom: seangrove: depends

12:20 seangrove: CSS defaults overflow visible, right?

12:21 seangrove: bbloom: Yeah

12:21 bbloom: seangrove: i think i prefer overflow hidden by default

12:21 seangrove: WPF's overflow: http://msdn.microsoft.com/en-us/library/system.windows.uielement.cliptobounds(v=vs.110).aspx

12:22 note default: "metadata properties set to true"

12:22 you can set that to false, then provide arbitrary geometry for a clip region: http://msdn.microsoft.com/en-us/library/system.windows.uielement.clip(v=vs.110).aspx

12:22 gfredericks: are there any libs of utilities for use with java.jdbc?

12:22 and if I make one would anybody hate me if I called it java.jdbc++?

12:23 bbloom: seangrove: actually, i may be reading that wrong

12:23 seangrove: default might be overflow visible

12:23 hiredman: java.kecd

12:23 bbloom: *shrug*

12:23 gfredericks: hiredman: :)

12:24 java.jdbc++ would mean having "++" in the filename I think?

12:24 teslanick: bbloom: http://i.imgur.com/Be553NX.png

12:24 bbloom: teslanick: heh, indeed

12:25 llasram: gfredericks: I think it would mean having _PLUS__PLUS_ in the filename

12:25 hiredman: gfredericks: if I recall maven doesn't like + in the artifact name

12:25 llasram: ,(munge "++")

12:25 clojurebot: "_PLUS__PLUS_"

12:25 hiredman: I had a ring-jetty-adapter+ at one point

12:25 oh, no, it was ring-jetty+-adapter

12:26 maybe I am misremembering so other problem with it

12:26 seangrove: bbloom: Alright, probably have another question re: grid stuff in a bit, but good to go for now.

12:26 gfredericks: hiredman: fine I'll make the artifact name java.jdbc_PLUS__PLUS

12:26 just kidding I will not do that it was a joke.

12:26 alright I have been dissuaded

12:26 bbloom: seangrove: if you start selling any of that tooling of yours, i want royalties :-P

12:26 seangrove: bbloom: I will, however, let you know the good news that the universe has put together a conference perfectly fit for you http://2014.cssconf.com/

12:27 * bbloom instantly clicks view-source

12:27 bbloom: http://2014.cssconf.com/style.css

12:28 man, i forgot what CSS looks like. i haven't written anything but sass in a while ;-)

12:28 rasmusto: cssaas

12:39 gfredericks: in core.async, are timeout channels impossible to GC until they're closed by the timeout mechanism?

12:41 hiredman: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/timers.clj

12:42 BobSchack: Yep they are stored in a skiplist if memory serves me. You could close them manually

12:42 I think

12:42 gfredericks: so I probably don't want to create one for every row in my db query result

12:43 BobSchack: You can if they are created within about the same time ~ 10ms

12:44 if you make timeout channels within ~10ms they are actually the same channel

12:44 gfredericks: that will not generally be the case

12:44 llasram: Now that's an interesting optimization

12:44 danlamanna: it seems there are a ton of "ins and outs of clojure" series on the internet. do you guys have a default for recommending?

12:45 coventry: Does that mean timeout channels are only accurate to within 10ms?

12:46 technomancy: danlamanna: aphyr's is pretty good

12:46 hyPiRion: danlamanna: Is there anything in particular about Clojure's guts you're in learning?

12:46 *interested in learning

12:47 danlamanna: uh, generally just trying to get better at functional programming. i would eventually want to get into multithreading though.

12:47 coventry: 4clojure.org

12:47 clojurebot: Titim gan éirí ort.

12:47 BobSchack: coventry should be look at core async tests for timeout channels

12:50 hyPiRion: danlamanna: 4clojure.org is good, and if you're good at math, you could try out project euler

12:51 it's not reading/learning, more of a practice place though

12:51 coventry: Probably better to steer clear of project euler until you're reasonably fluent at functional programming. Trying to solve "how do I express this functionally" at the same time as "how do I do this calculation" tends to slow things down a fair bit.

12:52 danlamanna: yeah, not too worried, i did the first 50 or so problems in python before.

12:52 i think i'm gonna do a combination of aphyr + 4clojure

12:53 coventry: Oh, having the "how do I do this calculation" part solved ahead of the time would work, too. :-)

12:53 hyPiRion: coventry: when you pass the 100 mark, it's more about how you should represent the data, more than the calculations themselves

12:54 coventry: Oh, that sounds interesting.

12:54 hyPiRion: (Of course, you still have to do the calculation, but it's usually trivial to do, even in a new language)

13:01 syao: hello, I have a question, better explained in image http://www.gliffy.com/go/publish/image/5656201/L.png

13:04 data structure, immutability question

13:07 eraserhd: Today, I work on extracting my new threading macro to a library.

13:09 I just need a decent name for it. Powerthread? Semantic threading? :/

13:09 llasram: syao: It's really not clear (at least to me) what you're asking

13:09 syao: If you express your problem with Clojure's persistent data structures, the result is immutable and persistent

13:11 eraserhd: not already covered by 1.6 additions to clojure.core and/or https://github.com/rplevy/swiss-arrows ?

13:11 syao: llasram, ok, so lets say that the "Data 3" is a list. When I add items to a list, the whole "Virtual Group" should be created.

13:11 eraserhd: llasram: No.

13:12 coventry: syao: You don't add items to a persistent list, you create a brand new list.

13:12 syao: So you make a function which takes D4 and VG1, and returns a new VG1.

13:13 llasram: syao, coventry: Or maybe even just use `update-in`

13:13 eraserhd: llasram: It's a form of -> that threads through if/if-not/if-let/cond/case/etc.

13:13 coventry: llasram: Maybe, but I assume the edges in the graph represent some subcalculations based on new values for the vertices.

13:14 syao: coventry, by saying "add" I mean creating new list with all the old and new values.

13:15 coventry: syao: Then the way I suggested should get you what you want.

13:16 syao: coventry, wait, in your way the whole immutability I should create my self, it wont be seamless

13:17 P.S. why D4 needs to be an argument for the funtion?

13:17 coventry: In clojure you leave the seams in. :-)

13:18 llasram: syao: A concrete example of exactly what you're trying to do might help

13:20 eraserhd: Ah, clojuredocs.org is on 1.3.0?

13:20 llasram: eraserhd: Yes. It's a crufty rails app no one wants to work on. There was/is a re-write in Clojure, but seems to have stalled

13:21 syao: llasram, I can not give you a concrete example as it is global universal (theoretical) problem.

13:22 llasram: Then I will propose that this is not a problem you need to solve :-)

13:22 Or even really a "problem"

13:24 eraserhd: It is called 'packthread'.

13:24 Glenjamin: hi guys, does anyone know of an FRP library that is about data/computation rather than UIs?

13:24 eraserhd: Yay, a name. Now I can code.

13:25 Glenjamin: I have a fairly large amount of data, and I want to encode relationships and dependencies so that an update propagates throughout the system in a performant way

13:25 perhaps this isn't actually called FRP?

13:25 coventry: Glenjamin: There was one described at the clojure conj last year.

13:26 syao: llasram, in fact it is, with hierarchical virtual groups I can enforce constraints on data with immutability.

13:27 coventry: Glenjamin: https://github.com/tgk/propaganda. I think hoplon could also be used this way.

13:28 tpope: gtrak: first attempt: https://github.com/tpope/cider-nrepl/commit/84ad9fbe946b7245b38b40c1d82da294b8668524

13:28 Glenjamin: coventry: propagator sounds like what i'm after

13:28 thanks

13:28 gtrak: tpope: bbatsov will want a test-case.. though not sure how to generate one.. maybe a with-redefs hack?

13:29 Glenjamin: i'm hoping for performance gains over brute force re-calc, will be interesting to experiment

13:29 gtrak: otherwise looks good to me

13:29 owl-v-_: ,(prn 04)

13:29 clojurebot: 4\n

13:29 tpope: gtrak: yeah everything I could come up with was super contrived because (map str (cp/classpath)) is the entire implementation

13:30 owl-v-_: invalid number 09?

13:30 ,(println 09)

13:30 clojurebot: #<NumberFormatException java.lang.NumberFormatException: Invalid number: 09>

13:30 rasmusto: owl-v-_: octal

13:30 tpope: gtrak: thought I might take the currently unused https://github.com/clojure-emacs/cider-nrepl/blob/master/test/cider/nrepl/middleware/test_transport.clj for a spin

13:30 clojurebot: Cool story bro.

13:30 Glenjamin: assuming you didn't have this feature, what's the command you wanted to write but couldn't?

13:31 gtrak: tpope: ah, we might need that to test something else, actually. we need a better solution for exceptions.

13:31 was just thinking about it

13:31 dbasch: ,(prn 632)

13:31 clojurebot: 632\n

13:31 dbasch: ,(prn 0632)

13:32 clojurebot: 410\n

13:32 tpope: gtrak: also I'm weirded out by the fact that cp/classpath includes system jars and stuff that don't show up in the regular classpath

13:33 I mean it's not a big deal, but feels weird that using a middleware returns a different result

13:33 technomancy: what's the regular classpath?

13:33 system/getproperty?

13:33 tpope: yeah

13:33 or $(lein classpath)

13:33 every other way I've ever retrieved it

13:33 Glenjamin: is calling classpath an asserting that it contains some colons and ".jar" useful?

13:34 technomancy: I wouldn't treat the system/getproperty one as canonical

13:34 since it leaves out the bootclasspath

13:34 gtrak: tpope: probably has to do with the recursive classloader traversal.. it doesn't stop until it hits the top

13:34 technomancy: but you should be able to trust lein classpath

13:34 tpope: yeah I know the problems with getproperty

13:34 part of why I want this middleware

13:34 technomancy: ...unless you're playing pomegranate/classloader games

13:35 tpope: but lein classpath and cp/classpath differing is weird

13:35 they're both right in their own way

13:36 ToxicFrog: Is there a convenient/idiomatic way to have multiple output programs in the same lein project? E.g., say I have a program with CLI, GUI, and web interfaces, and I want them in separate jars - is there a good way to do that in lein?

13:36 Or should I just be making it one project per UI + one shared library project?

13:36 technomancy: ToxicFrog: you want separate uberjars or separate libs deployed?

13:36 tpope: Glenjamin: I see that as a pretty silly test. plus colons aren't even portable

13:37 gtrak: tpope: lein-specific information might be interesting in itself, but its classpath is just what's used in the java invocation.

13:37 whereas clojure.java.classpath gives you the reality

13:38 tpope: right. I think the reality is preferrable

13:38 what I'd really like is a way to get the boot classpath statically, I guess

13:38 Glenjamin: tpope: mm, was mainly thinking that faking it or spinning up a controlled JVM isn't worth it, so what's the smallest test that isn't completely useless

13:38 i guess assert non-empty string is better than nothing

13:39 tpope: Glenjamin: I was actually thinking of just checking that it matched the current running classpath

13:39 ToxicFrog: technomancy: separate uberjars. Ideally I want to be able to say 'lein all-uberjars' or something and get foo.jar, foo-gui.jar, and foo-http.jar out.

13:39 Glenjamin: tpope: wouldn't that be your implementation in reverse?

13:39 technomancy: ToxicFrog: an alias to with-profile ... uberjar should do that

13:39 tpope: it'd be identical to my implementation afaik

13:40 (map str classpath) on both sides

13:40 Glenjamin: heh

13:40 tpope: which yeah, sigh

13:40 hyPiRion: ToxicFrog: yeah, use something like `:alias {"uberjar" [["with-profile" "+gui" "uberjar"] ...]}`

13:40 ToxicFrog: technomancy: so, I define multiple profiles with different :mains, and then lein with-profile foo uberjar?

13:41 technomancy: ToxicFrog: different :main and different :uberjar-name, yeah

13:41 well

13:42 with-profile profile1,profile2,profile3 uberjar

13:42 justin_smith: technomancy: responding to deep scrollback - here I thought fn for numbers would mean (2 :a) => [:a :a]

13:42 ToxicFrog: technomancy: awesomeness.

13:42 Thank you.

13:42 justin_smith: that would almost make sense in a math / number theory oriented clj fork

13:43 technomancy: np

13:48 ToxicFrog: technomancy: bug report: 'lein help' inside a project directory downloads all dependencies before giving you the help text.

13:48 Glenjamin: thats a feature!

13:48 ToxicFrog: technomancy: question: is there a way I can ask 'lein new' to generate the project.clj for a given template but do nothing else, if, say, I wanted to look at the :deps for it but not actually create such a project?

13:48 technomancy: ToxicFrog: you can't see the docstrings of the plugins if you don't fetch them first

13:49 ToxicFrog: technomancy: no, I mean, all dependencies for the project you're in

13:49 e.g. if I'm in a project that depends on ring, 'lein help new' will download ring first

13:49 Glenjamin: well, downloading plugins is required for lein help anyway

13:49 ToxicFrog: Or do you mean...

13:49 Oh, I see what happened.

13:49 No, that makes sense.

13:49 Never mind.

13:50 The question stands though :P

13:51 technomancy: ToxicFrog: unfortunately templates are imperative, not declarative

13:51 so you pretty much have to run them

13:51 ToxicFrog: And then copy the bits I care about and throw away the rest.

13:51 Alright.

14:06 tpope: gtrak: with test: https://github.com/tpope/cider-nrepl/commit/59e6a64c2e5327b352dc255dc1a3b650d4a0d35d

14:08 justin_smith: it would be interesting if someone kept a static archive of the latest version of various lein templates

14:08 so you could browse what you would get if you created it locally

14:08 and point to them for reference, etc.

14:21 technomancy: well ... technically the halting problem.

14:26 llasram: Since templates can accept arbitrary arguments.... although do many?

14:27 technomancy: not just arbitrary args; they are fully turing-complete

14:27 justin_smith: yeah, a template could decide to output completely different files based on time of day...

14:27 technomancy: a template could wipe your home dir and send your private keys to the mafia or whatever

14:27 justin_smith: lein new jeckyll-hyde...

14:28 bbloom: technomancy: .... correct me if i'm wrong, but aren't templates just kinda automatically downloaded/installed upon use?

14:28 justin_smith: during the day it creates an unassuming REST API server, during the night it creates a proxy tunnel for blackhats

14:29 technomancy: bbloom: right; this is the one place where version ranges are arguably defensible

14:29 dbasch: lein new russianroulette app

14:33 koalallama: speaking of home directories.

14:33 amalloy: $mail irctc dude, please just ask your questions to #clojure. you won't get any responses if you just ask me via PM when i'm asleep

14:33 lazybot: Message saved.

14:33 gfredericks: I can only have cores+2 futures running at the same time amirite?

14:33 llasram: That should be enough for anyone

14:34 koalallama: technomancy: when I run lein repl from my home directory (about 100GB of files), java CPU usage climbs to 100, and memory usage grows constantly

14:34 amalloy: gfredericks: no, futures' pool is unbounded

14:34 koalallama: technomancy: lein 2.3.4 on 1.8.0_05 / os X.. should I just not do this? or is this a bug?

14:34 amalloy: pmap is the function that chooses to spin up only cores+2 futures

14:34 gfredericks: amalloy: ohhokayIsee

14:35 good to know

14:36 koalallama: technomancy: lein repl from an empty directory, or a "normal sized" project doesn't show same behavior

14:36 gtrak: tpope: cool!

14:36 i haven't heard any feedback about the op itself, but I don't foresee any pushback

14:37 here's where I opened it up: https://github.com/clojure-emacs/cider-nrepl/issues/36

14:37 technomancy: koalallama: is there a src/ dir in your home or something?

14:37 tpope: gtrak: guess I'll request a pull

14:38 amalloy: technomancy: i have src/ in my home, and lein repl starts like a flash

14:38 koalallama: technomancy: there is no ~/src, but there are "src" directories deep inside

14:39 eraserhd: Does anyone have an example of using tools.analyzer within a macro?

14:39 koalallama: curious if lein repl tries to walk my directories looking for something

14:39 coventry: Sounds like a good application for strace, or whatever the equivalent is on OS X.

14:40 eraserhd: tbaldridge: IIRC, you were using it for the core.async `go` macro when you gave the tools.analyzer talk, but I don't see that as a dep now.

14:40 justin_smith: coventry: or whatever the jvm equivalent is

14:40 amalloy: koalallama: it should only walk upwards, looking for project.clj. maybe you have some kind of circular symlink? i can't think of a way that's possible on the path from /, but you never know

14:40 tbaldridge: eraserhd: it's in a branch called "analyzer"

14:41 eraserhd: tbaldridge: Oh, hello, there it is. Suhweet!

14:43 koalallama: ok, 2 minutes later CPU is back to 0.3%

14:44 technomancy: koalallama: definitely a bug, yeah

14:45 justin_smith: coventry: koalallama: the ibm jvm has a trace option (others may also have something, will keep checking it out)

14:45 technomancy: koalallama: does it happen with `lein run -m clojure.main -e nil` too?

14:45 justin_smith: also check out jstack - if you run it enough times you should get a good idea what it is grinding on

14:46 koalallama: technomancy: nope, that runs and ends in about 2 seconds

14:47 amalloy: yeah, jstack is what i'd try (if i didn't have yourkit already set up)

14:47 ghadishayban: gfredericks: beware of bounding blocked takes on a channel/timeout to < 1024

14:48 coventry: justin_smith: Cool.

14:48 ghadishayban: s/beware/ensure bounding

14:49 technomancy: koalallama: how about `lein repl :start` and (in a different terminal) `lein repl :connect`?

14:50 gfredericks: ghadishayban: wat? you mean no more than 1024 consumers trying to read from a single channel?

14:50 koalallama: here's a jstack while it's spinning: https://gist.github.com/ctrlrsf/5f21ce7311158b58c1f9

14:51 ghadishayban: gfredericks: Yes it's intentionally bounding. It's ok to have a channel with whatever size buffer, but not more than 1024 "pending" or blocked takes

14:52 koalallama: technomancy: yup, CPU burns with just lein repl :start, before even :connect is ran

14:52 justin_smith: https://gist.github.com/ctrlrsf/5f21ce7311158b58c1f9#file-jstack-lein-repl-1-L241 this thread is suspicious

14:52 ghadishayban: gfredericks: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/channels.clj#L168-L171

14:52 gfredericks: ghadishayban: cool; I don't think that's remotely an issue for me

14:53 ghadishayban: use a mult + taps if it is

14:53 koalallama: note, the repl is responsive, just notice the CPU usage of the process is high and laptop starts smoking ;)

14:53 justin_smith: koalallama: at that point there are a bunch of frames locked on the same shit, and doing something with the fs

14:53 gfredericks: ghadishayban: looks like it would bark loudly if I had a problem?

14:54 justin_smith: koalallama: all the frames are locking on the same lazyseq object, and the trace is suspiciously deep

14:54 hiredman: reply pulls in clojure-complete

14:54 justin_smith: could be a bad recursion

14:54 ghadishayban: gfredericks: yup. but possibly in some async context somewhere

14:54 hiredman: clojure-complete scans files looking for completions

14:55 wink: code golf time. can anyone shorten that? :) https://gist.github.com/anonymous/11227866

14:55 justin_smith: oh yeah, there is a bunch of reply in that stack trace, good call

14:56 amalloy: (apply + (map read-string) (s/split x #","))

14:56 technomancy: weird; it should just be scanning the classpath

14:57 amalloy: er, mis-parenthesized that, but you get the idea

14:57 AimHere: ,((apply + (map read-string) (s/split x #",")) "")

14:57 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: s, compiling:(NO_SOURCE_PATH:0:0)>

14:57 amalloy: ,(clojure.string/split "" #",")

14:57 clojurebot: [""]

14:57 AimHere: ,((apply + (map read-string) (string/split x #",")) "")

14:57 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: string, compiling:(NO_SOURCE_PATH:0:0)>

14:57 amalloy: booo

14:57 tpope: gtrak: submitted

14:57 AimHere: ,((apply + (map read-string) (clojure.string/split x #",")) "")

14:57 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:57 amalloy: (apply + (map read-string (filter seq (s/split x #","))))

14:57 wink: hehe thanks

14:57 technomancy: koalallama: is it possible something got put on the classpath that shouldn't be there?

14:58 eraserhd: wink: (apply + (read-string x))

14:58 technomancy: in any case clojure-complete should have a (take 1024 ...) on its file-seq just to avoid going completely insane

14:58 koalallama: btw, find ~/ -type f | wc -l = 271897

14:58 AimHere: ,(#(read-string (str "(+" % ")")) "3,4,5,6")

14:58 clojurebot: (3 4 5 6)

14:58 justin_smith: ,(#(apply + (map read-string (filter seq (clojure.string/split % #",")))) "")

14:58 clojurebot: 0

14:59 gtrak: tpope: tpope, cool!

14:59 eraserhd: ,(let [x "5,3"] (apply + (read-string (str "0," x))))

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

15:00 eraserhd: ,(let [x "5,3"] (apply + (read-string (str \[ x \]))))

15:00 clojurebot: 8

15:00 justin_smith: oh, tricky

15:00 koalallama: technomancy: bingo! here was my CLASSPATH env: ".:/usr/local/lib/antlr-4.1-complete.jar:"

15:00 technomancy: youch

15:01 eraserhd: ,(def c #(apply + (read-string (str \[ % \]))))

15:01 clojurebot: #'sandbox/c

15:01 koalallama: how long has that been there?

15:01 eraserhd: ,(c "")

15:01 clojurebot: 0

15:01 llasram: Pulling ANTLR in will do it

15:01 eraserhd: ,(c "5,3")

15:01 clojurebot: 8

15:01 wink: eraserhd: horrible, but brilliant :)

15:01 AimHere: ,(def c #(eval (read-string (str \( \+ % \)))))

15:01 clojurebot: #'sandbox/c

15:01 AimHere: (c "3,4,5,5")

15:01 justin_smith: llasram: I would have thought . was the problem

15:02 AimHere: ,(c "3,4,5,5")

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

15:02 eraserhd: wink: I excel at "horrible". Brilliance is by accident..

15:02 llasram: justin_smith: My humor-jokes may need some work

15:02 justin_smith: heh

15:02 koalallama: justin_smith: thanks for the help

15:03 justin_smith: ,(do (def c #(eval (read-string (str \( \+ % \))))) (c "3,4,5,5"))

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

15:03 justin_smith: koalallama: np

15:03 wink: I think I am forever tainted too much from imperative languages though

15:03 koalallama: technomancy: thanks, sorry for wasting your time. I knew I liked you since I saw your name in my clojure book

15:03 wink: as I started with let [a (...) b (... a) c(... b)] c)

15:03 technomancy: heh; no worries

15:03 wink: and only then rearranged it to short form

15:04 technomancy: koalallama: I think it'd be reasonable to open an issue with clojure-complete fwiw

15:04 koalallama: btw, source of that classpath was: https://github.com/antlr/antlr4 step 3 has this: export CLASSPATH=".:/usr/local/lib/antlr-4.2.1-complete.jar:$CLASSPATH"

15:06 justin_smith: koalallama: I think that instead one could just put antlr-complete "4.2.1" in the dev profile in .lein/profiles.clj

15:06 for an even more thorough fix

15:07 llasram: justin_smith: Well, assuming you are only using leiningen. Well, and populating :dev in profiles.clj is probably bad

15:07 koalallama: yup, except I don't even need antlr anymore. this has been there from another project almost 1 year ago

15:08 eraserhd: tbaldridge: The :op :local is specific to the go macro, it's not what analyzer wants, right?

15:08 gtrak: technomancy: I yearn for the day when we can remove clojure-complete from leiningen.

15:08 justin_smith: llasram: if not using lein, then one could use a shell script or whatever your alternative tool uses to manage the path

15:08 llasram: justin_smith: totes

15:08 tbaldridge: eraserhd: no, in the form (let [x 42] x) the body of the let will be a :local node

15:09 eraserhd: locals can either be arguments or bindings from lets/loops

15:09 technomancy: gtrak: you can omit it if it causes trouble

15:09 eraserhd: tbaldridge: Oh, OK.

15:09 technomancy: but I guess you don't always realize it

15:09 gtrak: technomancy: I just want everyone else to stop depending on it.

15:10 implicit deps, bleh.

15:11 technomancy: at least there are no transitive implicit deps

15:11 that's where I draw the line

15:13 koalallama: technomancy: re: issue with clojure-complete, is there really an issue if I just happened to add a super huge directory to my classpath by mistake? looks like the code that's running eventually completes after 2+ minutes

15:15 technomancy: koalallama: I think it would be better if clojure-complete only bothered checking the first thousand or so files

15:16 koalallama: sounds reasonable

15:32 gtrak: technomancy: err well, [any elisp completion frontend plus god knows what else] -> lein -> clojure-complete, transitive in some sense.

15:34 come to think of it, I need an easy way to boot up cider-nrepl middlewares outside of lein

15:38 koalallama: I gotta get some rest, I will look into this further and open issue with clojure-complete

15:39 thanks again, all

15:41 rasmusto: ,(some (rest "zzzz"))

15:41 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/some>

15:41 justin_smith: ,(some rest (rest "zzzz"))

15:41 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>

15:42 justin_smith: ,(some #(do %) (rest "zzzz"))

15:42 clojurebot: \z

15:42 rasmusto: the whole string -> charseq always felt a bit strange to me

15:42 s/bit/byte

15:42 justin_smith: I think a string should become chars when treated as a seq, and by extension a char should be treated as bits

15:43 jcromartie: wat

15:43 no way

15:43 then integers should be too

15:43 rasmusto: ,(seq 1)

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

15:43 justin_smith: /s

15:43 right :)

15:43 jcromartie: OK

15:43 justin_smith: sorry, was a very dry joke

15:43 rasmusto: turtles all the way down

15:44 justin_smith: but it is the same logic - just taken a couple steps too far

15:44 llasram: And also is what Ruby does

15:44 justin_smith: (dec ruby)

15:44 lazybot: ⇒ -1

15:44 llasram: Sounds about right

15:44 jcromartie: llasram: how so?

15:44 rasmusto: (dec seq)

15:44 lazybot: ⇒ -1

15:44 * rasmusto is sorry

15:45 hfaafb: inc and dec are so stateful :3

15:45 hyPiRion: $karma rubby

15:45 llasram: jcromartie: Try `2[0]`, `2[1]` some time

15:45 lazybot: rubby has karma -1.

15:46 jcromartie: no...

15:46 that's..

15:46 well, OK then

15:47 if I can index it I should be able to get a sequence out of it

15:47 but I guess not necessarily… hashes, sets...

15:47 justin_smith: rubby is ruby's sketchy cousin who isn't allowed near schools or parks

15:47 TEttinger: with good reason. rubby on rails was a fiasco

15:48 justin_smith: lol

15:48 gfredericks: rubby in ruts

15:49 TEttinger: jcromartie, you want individual bytes out of the internal representation of objects, when you treat them as seqs, right?

15:50 gfredericks: I want a timeseries of voltage measurements from the wires

15:51 justin_smith: hah, try to loop on an array and get the sequence of bits in the pointer...

15:51 rasmusto: whoa, this right shift key is pretty efficient!

15:52 justin_smith: ,(bit-shift-right 42 1)

15:52 clojurebot: 21

15:52 jcromartie: https://gist.github.com/jcromartie/11229825

15:53 llasram: Perfect. Ruby takes PRs, right?

15:54 gfredericks: what's Integer in ruby?

15:54 I thought they had Fixnum and Bignum

15:54 jcromartie: Integer is the superclass of Fixnum

15:54 gfredericks: oh righto

15:55 devn: ,(doc add-watch)

15:55 clojurebot: "([reference key fn]); Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any registered watches will have their functions called. The watch fn will be called synchronously, on the agent's thread if an agent, before any pending sends if agent or re...

15:55 gfredericks: I am rubby rusty; rubsty

16:03 mdrogali`: Is there a way to pull up a repl from a jar that contains Clojure?

16:03 It's a prebuilt uberjar that behaviors differently with production dependencies rather than dev deps.

16:03 behaves, rather*

16:04 turbofail: java -cp <uberjar-name>.jar clojure.main

16:04 michaniskin: java -jar your-file.jar clojure.main

16:04 oh right

16:04 nevermind

16:05 mdrogali`: Thanks guys. I did that, but I wasn't able to require/use any of my namespaces.

16:05 turbofail: they must not be in your uberjar then

16:05 mdrogali`: Oh, hold up! Yeah, this was my mistake.

16:05 Thanks guys & gals

16:05 justin_smith: try unzipping the jar (it is a zip file) and seeing what is in it

16:06 rasmusto: .jar.gz

16:06 dbasch: jar tvf

16:06 rasmusto: tvvvf

16:07 justin_smith: well since it is a zip file you can just use whatever tool you would usually use to explore a zip (I open it in emacs for example)

16:09 kenrestivo: my god, the test coverage on bitcoinj is... impressive

16:09 compile takes 2 seconds, tests takes 2 minutes.

16:09 justin_smith: well consider that btc is meant to be computationally expensive

16:09 so I bet the tests spend a lot of time in CPU

16:10 kenrestivo: btw, https://www.refheap.com/79395

16:10 they also fail too :-(

16:11 guns: Is anyone aware of any popular Clojure libraries with underscores in the _namespace_ name?

16:11 kenrestivo: woops wrong chan

16:11 justin_smith: seems like a bad idea... but no I haven't seen it

16:13 dbasch: kenrestivo: are you doing something bitcoin-related?

16:14 kenrestivo: dbasch: i was. and might be again. always checking to see how things are progressing

16:14 dbasch: kenrestivo: I’m working on a cryptocurrency project in clojure

16:15 kenrestivo: dbasch: cool! an altcoin, or something totally different?

16:15 dbasch: kenrestivo: https://cointipping.com/

16:15 rasmusto: dojecoin

16:15 guns: justin_smith: thanks. You're a pretty good data point

16:16 dbasch: kenrestivo: but it’s not really about dogecoin, there’s more beyond it

16:16 kenrestivo: dbasch: looks like react, will have to try it on a js enabled browser

16:16 dbasch: kenrestivo: yes, it’s Om

16:16 kenrestivo: I optimized it for mobile

16:17 well, “optimized” meaning that it sucks less on mobile

16:17 justin_smith: guns: aww, shucks

16:18 kenrestivo: dbasch: neat. what are you using for a back end as a bitcoin network client?

16:18 dbasch: kenrestivo: dogecoind

16:18 kenrestivo: with REST from clojure, i suppose?

16:19 dbasch: kenrestivo: yes, https://github.com/aviad/clj-btc

16:19 kenrestivo: well done, glad to see someone doing that

16:23 dbasch: kenrestivo: that’s not mine btw

16:23 justin_smith: oooh - lein search gives a stack trace when you do "lein search _"

16:25 technomancy: lucene barfs on "lein search _" https://www.refheap.com/79444 worth a bug report or just a pointless corner case?

16:26 technomancy: justin_smith: how about a patch? =)

16:26 justin_smith: hah

16:26 I'll consider it

16:27 technomancy: bug report would be fine

16:27 gfredericks: justin_smith: you should whole-heartedly commit to intending to do it

16:27 justin_smith: is lein search part of the main lein repo?

16:28 gfredericks: I am setting aside the procrastination time in my calendar as we speak

16:28 answering my own question: yes

17:08 dbasch: technomancy: lein search works fine in a random directory, but if I run it inside a project of mine this happens: https://www.refheap.com/79475

17:09 technomancy: dbasch: do you have :repositories set in there?

17:09 dbasch: yes

17:09 technomancy: to a server that isn't returning proper response codes for not-found?

17:09 dbasch: technomancy: probably

17:09 if I remove repositories it works fine

17:10 technomancy: still would be better to get an error message instead of a stack trace

17:10 feel free to open an issue

17:10 dbasch: ok

17:18 eraserhd: tbaldridge: Is there something in tools.analyzer to pretty-print an AST (that terminates :). Also, is there a pre-existing function to reconstitute source forms from a modified AST?

17:24 tbaldridge: on the latter it something like emit-clj and it's in the analyzer codebase.

17:24 on the first, it pretty-prints if you do a pre/post walk and rip out all the :env values

17:25 eraserhd: tbaldridge: Cool. Thanks again.

17:29 Bronsa: eraserhd: if you're using t.a.j/analyze, it already strips the :ns key in :env so there's no problem in prining that

17:30 eraserhd: also what tbaldridge was talking about is https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/emit_form.clj

17:30 tbaldridge: ah there we go, it's in the jvm source

17:30 danlamanna: seems to be nothing out there with regards to comparing binary files in clojure

17:30 Bronsa: tbaldridge: it's in both, the jvm one simply adds support for the jvm specific ops

17:31 stompyj: kenrestivo: we never REST here in the clojure community!

17:31 * stompyj wants to ban himself now

17:33 dbasch: danlamanna: if they are not huge, you can just slurp them and compare them

17:34 Frozenlock: stompyj: That's why we are FIRST

17:34 dbasch: danlamanna: otherwise you’d have to read them lazily

17:34 * Frozenlock wants to join stompyj in his ban

17:34 stompyj: LOL

17:34 i regret nothing!

17:34 danlamanna: dbasch: may or may not be, i think i'm going to follow http://www.jguru.com/faq/view.jsp?EID=66830 as a guideline.

17:40 eraserhd: Bronsa: I didn't think to use t.a.j analyze, I'm just using t.a analyze. Hrmm... should I be?

17:40 Bronsa: eraserhd: if you want to analyze clojure source, yes

17:40 eraserhd: I guess supporting clojurescript is a future concern to not worry about now.

18:00 dbasch: danlamanna: you can optimize this for performance, but it works https://www.refheap.com/79493

18:00 rukor: hi please which unit testing framework would you recommend, ive seen clojure.test, midje and speclj and am leaning towards speclj

18:02 egghead: grr, fighting with jsch :(

18:03 technomancy: rukor: clojure.test would be my recommendation

18:04 rukor: technomancy: thanks, are you able to quickly indicate why

18:06 technomancy: rukor: midje is a lot more complicated and does fancy things that look neat but often cause difficult-to-debug error messages. I don't know much about speclj; it doesn't seem widely used.

18:06 rukor: technomancy: thanks, that makes a lot of sense based on what Ive seen so far.

18:06 technomancy: clojure.test is very obvious how it works

18:08 rukor: yes

18:10 seangrove: given {:x 10 :y {:z 20}}, how can I destructure x y and z in a single destructuring statement?

18:13 guns: seangrove: {x :x y :y {z :z} :y}

18:13 Bronsa: guns: does that really work?

18:13 Frozenlock: ,(let [a {:x 10 :y {:z 20}}] (let [{x :x y :y {z :z} :y} a] [x y z]))

18:13 amalloy: Bronsa: should, yeah

18:13 clojurebot: [10 {:z 20} 20]

18:13 justin_smith: guns - extraneous :y in there

18:13 amalloy: guns, well, {x :x {z :z :as y}} would be more normal though

18:14 Bronsa: uh.

18:14 amalloy: {x :x {z :z :as y} :y}

18:14 guns: TIL

18:14 seangrove: Ah, interesting, I always use {:keys [...]}, didn't know this syntax before

18:14 Frozenlock: seangrove: same here

18:14 amalloy: seangrove: :keys is shorthand for this

18:14 justin_smith: ,(let [{x :x y :y {z :z} :y} {:x 10 :y {:z 20}}] [x y z])

18:14 clojurebot: [10 {:z 20} 20]

18:14 turbofail: hm. is requiring the same namespace from multiple threads a Bad Idea™?

18:14 seangrove: amalloy: Good to know

18:14 amalloy: see also :syms, :strs

18:15 justin_smith: I totally would not have intuited that the above would work

18:15 gtrak: turbofail: this is clojure.

18:15 Frozenlock: Must have missed it in the official Clojure manual™

18:15 hiredman: turbofail: multithreaded code loading is a bad idea

18:15 justin_smith: given the usual map rules etc.

18:15 amalloy: justin_smith: actually, making this work is one of the reasons destructuring syntax looks the way it does

18:15 justin_smith: interesting

18:15 ahh the two :y instances are rhs, n/m

18:15 amalloy: {:y y, :y {:z z}} is the alternative syntax, right? but you can't write that because it has a duplicate key

18:16 turbofail: ok guess i'll stick a lock on it then

18:16 justin_smith: amalloy: oh yeah, makes much more sense now

18:16 amalloy: but you'll never want to give the same local name to two values, so the actual syntax has no such conflicts

18:16 gtrak: turbofail: transitive ns's won't get eval'd multiple times, if you're using require. probably best to keep it simple.

18:16 seangrove: amalloy: Can you then mix that and {:keys ..} ?

18:16 amalloy: naturally

18:17 {:keys [x y] {:keys [z]} :y} is another way to write it

18:17 seangrove: (fn [idx {layout :layout {:keys [offer-width offer-height row col row-span col-span]} :layout :as child}])

18:17 I'm not sure if that's a good idea or not. I think probably not.

18:18 turbofail: gtrak: well the problem is that the same namespace is getting loaded from multiple threads at the same time

18:18 justin_smith: seangrove: with some well spaced line breaks it is slightly better, but probably simpler to read if broken up a bit into let clauses

18:18 gtrak: yea, that's a risk until it's fully loaded, seems like

18:18 seangrove: justin_smith: Yeah, splitting it up

18:19 turbofail: it actually works OK right up until i have a macro-defining macro, and then it starts throwing "can't take a value of a macro" things around

18:19 oinksoft: how do i make a clojure macro refer to itself? i'm having trouble getting a macro to work that should expand itself with default parameters

18:20 Bronsa: oinksoft: (defmacro x ([] `(x ..)) ..)

18:20 justin_smith: the easy way is probably to make a recursive function invoked by the macro

18:20 Bronsa: oinksoft: you really don't want to do things like (defmacro x ([] (x ..)) ..)

18:21 oinksoft: Bronsa: why is that?

18:22 justin_smith: extra effort and complexity, with no added functionality

18:22 Bronsa: oinksoft: because x is not already a macro inside the defmacro body

18:22 justin_smith: plus it doesn't work :P

18:22 justin_smith: ahh, fair enough :) I would know that if I had seen fit to try I guess :)

18:23 amalloy: Bronsa: eh? x is a macro inside its body. it's just not one you typically want to use

18:23 Bronsa: amalloy: nope, defmacro expands to (do (defn x ..) (.setMacro #'x true))

18:23 oinksoft: yes, best practice. ok, so how *do* i do what i said i want to do?

18:23 Bronsa: it's still a function inside the body

18:24 justin_smith: oinksoft: macros are for special evaluation rules - do that and only that in the macro, and put all actual runtime logic in a function

18:24 Bronsa: oinksoft: I already told you how in my first reply

18:24 oinksoft: Bronsa: and said it was a bad idea?

18:24 amalloy: that's really interesting. i knew that, but i hadn't thought about what it meant for referring to x inside its own body

18:24 oinksoft: this is what i have now, it doesn't even run. http://www.bpaste.net/show/ykUCiove4b1TQNBDkSvx/

18:25 Bronsa: oinksoft: no, that was about my second reply. `(x) vs (x)

18:25 oinksoft: oh, ok

18:25 well i guess i was doing the right thing, but this results in a very informative error about not being able to make ISeq from symbol

18:26 justin_smith: ~@ should be ~

18:26 clojurebot: No entiendo

18:26 Bronsa: oinksoft: unless you actually want your macro to be invoked like (deflogger [something] ..), drop the @

18:26 justin_smith: `(~@(:a :b) :c)

18:26 ,`(~@(:a :b) :c)

18:26 clojurebot: (:c)

18:27 justin_smith: ,'`(~@(:a :b) :c)

18:27 clojurebot: (clojure.core/seq (clojure.core/concat (:a :b) (clojure.core/list :c)))

18:27 hyPiRion: justin_smith: what are you trying to do? (:a :b) returns nil

18:27 justin_smith: ahh of course :P

18:27 ,`(~@[:a :b] :c)

18:27 clojurebot: (:a :b :c)

18:27 justin_smith: got my quoting mixed up

18:28 ,`(~@:a :b :c) ; this is your error oinksoft

18:28 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>

18:28 oinksoft: Bronsa: which one? that's what i always ask clojure too.

18:28 Bronsa: oinksoft: read above what justin_smith told you

18:28 justin_smith: there shouldn't be any ~@ in that code, it should always be ~

18:30 oinksoft: got it, thanks

18:31 i don't understand this. i thought ~@ is when you want to include an variable inline, in a list

18:31 justin_smith: (defmacro deflogger [name & args] `(def ~name (apply new-logger ~args)))

18:31 then define new-logger with multiple arities

18:31 much cleaner

18:32 oinksoft: i see, thanks

18:33 clojure.core/name is defined. shouldn't i not define variables called "name"?

18:33 justin_smith: it's fine unless the same function needs the name function

18:33 fair point though, if something is clear and isn't in clojure.core that is likely better

18:34 oinksoft: ok, thanks, just brought it up because i keep wanting to name vars `name' but my editor hihglights it to remind me it's in core

18:34 justin_smith: I just felt like the name of the macro on the preceding line already tells you about deflogger, so putting that in the name is just noise

18:34 oinksoft: i agree

18:34 why did removing the @ fix the macro?

18:35 justin_smith: did you see my demo above of what @ does?

18:35 Bronsa: i wish locals shadowing vars would emit a warning. I've wasted quite some time one day debugging a macro that I wrote that shadowed `name` and then I used it a good amount of numbers above.

18:36 oinksoft: hm clojure core code doesn't seem shy about using `name'

18:36 i was looking for example code, what poeple call variable names :)

18:36 interesting Bronsa

18:36 TimMc: Bronsa: I think using a linter would probably be a better choice.

18:36 justin_smith: I also blatantly call things "count"

18:37 TimMc: count, name, class, type...

18:37 lemonodor: i liked the CL earmuff thing for globals/specials, which prevented collisions with local vars.

18:37 TimMc: come at me bro

18:37 amalloy: i give all my global functions one-letter names, so they don't conflict with my descriptive local-variable names

18:37 lemonodor: but it seems that clojure convenion is earmuffs only for vars that you expect users to want to rebind?

18:37 hyPiRion: TimMc: klass plz.

18:38 TimMc: clazz

18:38 justin_smith: cnt is delightfully ambiguous

18:38 oinksoft: um justin_smith your last example seems to leave out defaulting the first arg to a default value

18:38 was that intentional? did i miss something?

18:39 hyPiRion: justin_smith: oh my, you just made me realise this. My master thesis uses `cnt` as the size variable.

18:39 justin_smith: ahh, the function can't do that based on arg count?

18:39 better lawyer up before HR gets on your case

18:39 (or the academic equiv.)

18:40 hyPiRion: justin_smith: it's of no worry. If they want to wade through 6k lines of C code with worse #ifdef usage than OpenSSL, they are free to do so.

18:41 justin_smith: oinksoft: if the fn is already multi-arity I would be inclined to make the fn take one arg or two, and with a collection as the second arg - then take out apply

18:41 but I am very eager about taking any complexity out of macros that I possibly can, ymmv

18:42 oinksoft: justin_smith: i have no idea what you meant by that

18:42 justin_smith: your comments about lawyers/HR/academia

18:42 l1x: hi

18:42 justin_smith: oinksoft: cnt as an abbreviation for count is ambigous and to some readers may be seen as offensive / sexist

18:43 it was a joke, probably too subtle

18:43 l1x: i have a list (1 2 3 4 5) I need to get pairs from the list like (1 2) (2 3) (3 4) (4 5) what is the best function to do that

18:43 oinksoft: yea, maybe w/ more time using clojure i'll get it :)

18:44 thanks again

18:44 justin_smith: ,(partition 2 1 [1 2 3 4 5])

18:44 clojurebot: ((1 2) (2 3) (3 4) (4 5))

18:44 hyPiRion: oinksoft: It's not Clojure-related: If you accidentally forget the o in count, you know..

18:44 justin_smith: oinksoft: np

18:44 l1x: thanks justin

18:45 justin_smith: np

18:45 hyPiRion: I think rhickey seriously decided to name what now is named cond-> to cont->, but when someone in IRC read it out loud and his coworkers laughed, that name was quickly dismissed

18:46 yeah, http://clojure-log.n01se.net/date/2012-10-12.html#16:08a

18:46 justin_smith: it may sound like a Japanese name out loud Kontaro

18:53 rasmusto: (inc partition)

18:53 lazybot: ⇒ 1

18:55 rasmusto: (inc ergo->)

18:55 lazybot: ⇒ 1

18:56 justin_smith: ergo->?

18:56 rasmusto: justin_smith: was one of the names pitched in those irc logs, made me chuckle

18:56 justin_smith: ,(resolve 'ergo->)

18:56 clojurebot: nil

18:56 justin_smith: ahh

18:57 assuming->

18:57 rasmusto: hence->

19:40 egghead: huh

19:40 I've got some code that works in a clj repl but not in my main method... what gives

19:41 justin_smith: does it involve a call to for, or map?

19:42 amalloy: egghead: i'm with justin_smith on this. you're doing something lazy, which gets forced when the repl tries to print the result

19:43 egghead: uggu, I wish this problem didn't rear it's head in such a gnarly way

19:43 i'm not using map or anything like that, but I am using futures

19:44 joegallo: how about you gist your code?

19:45 seangrove: dnolen_: Heh, I was just talking with the Meteor guys about Mori yesterday, they seemed pretty excited about it

19:45 dnolen_: seangrove: yeah I got a pretty nice email from one of the devs, looks like they got a big performance boost out of it

19:51 gfredericks: streaming (jdbc) db query results from an http service takes a surprising amount of extra work

19:52 Frozenlock: eh.. I'm still in the 'anything' takes a surprising amount of extra work. :-p

19:52 pdurbin: dnolen_: you're the one who was on http://thinkrelevance.com/blog/2014/04/10/david-nolen-cognicast-episode-054 ? great episode

19:52 dnolen_: pdurbin: yep, thanks

19:53 pdurbin: dnolen_: you prompted me to listen to this: ▶ Pete Hunt: React: Rethinking best practices -- JSConf EU 2013 - YouTube - https://www.youtube.com/watch?v=x7cQ3mrcKaY

19:53 hiredman: gfredericks: is it really that surprising?

19:53 gfredericks: hiredman: in as much as I am surprised, yes

19:53 hiredman: gfredericks: are you paginating?

19:53 dnolen_: pdurbin: yep that's a pretty awesome talk

19:54 gfredericks: hiredman: no

19:54 egghead: derp

19:54 hiredman: gfredericks: using ring?

19:54 egghead: try finally, future value, close the connection the future is delivered on

19:54 gfredericks: hiredman: yep

19:54 egghead: WHOOPS

19:54 hiredman: gfredericks: ah, well, streaming with ring is tricky

19:55 gfredericks: ditto for java.jdbc/postgres

19:55 pdurbin: dnolen_: yeah. I enjoyed it. Next I'm thinking of checking out https://github.com/tastejs/todomvc/tree/gh-pages/architecture-examples/react

20:00 dnolen_: pdurbin: it's good stuff, #reactjs is great many of the core React devs and many friendly users hang out there

20:17 pdurbin: dnolen_: ah. thanks

20:19 bbloom: Bronsa: are there clj-in-clj ports of the data structures anywhere besides cljs?

20:19 Bronsa: and gvec

20:20 Bronsa: bbloom: uhm, not complete that I know of. There's https://github.com/mylesmegyesi/clojure.core/ but I don't think it's even remotely complete

20:21 TEttinger: clojurec

20:22 Bronsa: TEttinger that's really just cljs

20:23 bbloom: ok thanks guys, i'll just work off cljs

20:23 TEttinger: yeah, good point

20:23 https://github.com/schani/clojurec for reference

20:23 bbloom: it's really a shame we don't have a good cross-plat story that we need to repeat this work everywhere

20:24 i'm going to attempt to make eclj work such that the standard if statement works w/ class-plat thanks to partial evaluation

20:24 & abstract interpretation... ie don't barf if a symbol is undefined on a known not to run code path

20:24 lazybot: java.lang.RuntimeException: Unable to resolve symbol: abstract in this context

20:24 bbloom: going to take a crack at trying to boot up core under my metacircular interpreter tomorrow :-)

20:25 (after a weekish of no meaningful work done :-P)

20:26 TEttinger: bbloom: metacircular like maru?

20:26 there's a few small lisps I have seen that use metacircular runtimes. Maru and Tort are two of them, Maru does work on windows

20:27 bbloom: TEttinger: no compiler yet, but that's the goal

20:28 TEttinger: pretty sure bbloom is one of several people up to the task in here. myself not one of them

20:28 Bronsa: bbloom: good luck w/ loading core. IIRC if you don't get def metadata handling right it might choke when redefining `fn`

20:29 at least, that's what happened the first time I tried with t.e.j

20:29 bbloom: thanks guys :-)

20:33 gfredericks: clojurebot: t.e.j is tools.enterprise.java

20:33 oinksoft: OK, what does this combination of destructuring do? (defn f [& [a & {:keys [k]}] ...). I know what & and :keys mean in the basic case

20:33 clojurebot: In Ordnung

20:34 gfredericks: oinksoft: a is the first arg, the rest of them are collected into a map, and the :k key is destructured

20:34 oinksoft: gfredericks: what is the [& [a for?

20:34 gfredericks: rather than [a

20:34 amalloy: oinksoft: what gfredericks said, but i'd also add that that kind of & nonsense is pretty tacky imo

20:34 gfredericks: it allows calling with no args

20:34 ,(defn f [& [a & {:keys [k]}]] [a k])

20:34 clojurebot: #'sandbox/f

20:34 gfredericks: ,(f)

20:34 clojurebot: [nil nil]

20:35 gfredericks: ,(f 1 :foo 12 :k 39)

20:35 clojurebot: [1 39]

20:35 gfredericks: ,(f 42)

20:35 clojurebot: [42 nil]

20:35 oinksoft: so people do [& [a & [b & [c]]] to get a function with 0-3 params?

20:35 gfredericks: [& [a b c]] does the same thing

20:35 oinksoft: it would seem that form can't accept 1 or 2

20:35 gfredericks: ,(defn g [& [a b c]] [a b c])

20:35 clojurebot: #'sandbox/g

20:35 gfredericks: ,(g :one-arg)

20:35 clojurebot: [:one-arg nil nil]

20:35 Bronsa: ,(let [[a b c] [1]] [a b c])

20:36 clojurebot: [1 nil nil]

20:36 oinksoft: neat

20:36 Bronsa: ,(let [[a b c] [1 2 3 4]] [a b c])

20:36 clojurebot: [1 2 3]

20:36 gfredericks: that's just how destructuring works, not a specific feature of functions

20:36 any function that starts with [& ...] can take any number of args

20:37 I will join amalloy in grumping at you if you write functions like that

20:37 amalloy: i always write (fn [& [& [& [& [x]]]]] x) to make sure x is really optional

20:37 oinksoft: back to the original function signature, in which ways could this be called?

20:37 gfredericks: (inc amalloy)

20:37 lazybot: ⇒ 103

20:37 gfredericks: oinksoft: I gave a bunch of examples up there ^

20:39 oinksoft: gfredericks: oh, it's in your first example :)

20:39 * gfredericks is a veritable hogshead of examples

20:41 yedi: how would one do this sort of thing in clj (http://stackoverflow.com/questions/286921/efficiently-replace-all-accented-characters-in-a-string)

20:45 amalloy: yedi: why would you do that? instead, sort the strings according to the right locale

20:45 justin_smith: ,(apply str (replace {\a \z \b \y} "abba")) ; yedi:

20:45 clojurebot: "zyyz"

20:46 yedi: well i don't particularly care about the sorting, i just wanna convert strings into their closest ascii equivalent

20:46 since the app i'm building only makes sense for english words

20:46 justin_smith: there may be a way to do it with string ops only in one pass, which is better than the string / seq / string conversion sequence

20:46 amalloy: http://stackoverflow.com/a/12889868/625403

20:46 yedi: but sometimes ill get strings like Jesús

20:47 amalloy: and you're really set on 7-bit ascii? i have to say, allowing people to use whatever characters they want seems like a much nicer solution

20:47 yedi: the app i'm using literally requires english words, since it's based on an english rhyming dictionary

20:48 seangrove: bbloom: Part of the gripe of absolute vs fixed vs relative in css yesterday http://stackoverflow.com/questions/6794000/fixed-position-but-relative-to-container

20:49 amalloy: how sure are you there are no "funny characters" in english text? eg, coop is pronounced as one syllable, like a chicken coop; coöp is two syllables, like coöperative

20:50 plus english has incorpororated words like voilà

20:50 yedi: amalloy: you're definitely right, but it doesn't seem that this takes that into account: https://raw.githubusercontent.com/yedi/rhyme-finder/master/resources/cmudict.txt

20:51 i couldn't find a separate coöp

20:51 but that doesn't mean i shouldn't allow ppl to add their own pronunctiations to the dictionary that are missing

20:51 amalloy: so you have an input word that you want to look up in someone else's rudely-ascii rhyming dictionary

20:52 yedi: yea essentially (Carnegie Melon's Rhyming Dictionary, i think it's the most comprehensive one for the english language)

20:52 amalloy: i think the only realistic thing you can do is what justin_smith suggested: a manually-defined list of character substitutions you want to do

20:52 unicode is wide and weird, and an automated solution will do really surprising things

20:53 yedi: i think i agree with you though, i can always add new entries to that dictionary so it should support other characters. So i'll find an alternate way to fix that issue

20:54 justin_smith: ,{\☃ "snowman"}

20:54 clojurebot: {\☃ "snowman"}

20:54 amalloy: like there are stupid characters such as http://www.fileformat.info/info/unicode/char/2075/index.htm: SUPERSCRIPT FIVE

20:54 and java will tell you that's a digit whose value is 5

20:54 justin_smith: that is useful⁵

20:55 dbasch: one of the most abused features of unicode on twitter and facebook: uʍop-ǝpısdn

20:55 oinksoft: i am positively tickled that core has a function named lazy-cat.

20:56 justin_smith: sadly, stupid-hyper-dog was vetoed

20:58 stupid-hyper-dog was of course a pointless function that chased its own tailcall

20:58 yedi: amalloy justin_smith: it would be cool if there was a list of all those kinds of odd characters that are used in english words

20:58 then i could add them to my letter parsing regex

20:59 justin_smith: yedi: do you use emacs?

20:59 amalloy: i prefer to think of english as an infinite fractal of constantly fluctuating word-theft

20:59 anytime you think you can apply logic to english, you start down the wrong path

21:00 justin_smith: yedi: if so M-x insert-char <tab><tab> then go to the prompt buffer and save it and... - actually there is probably a better way to that

21:00 *to do that

21:01 gfredericks: hey where was that regex that matched english words

21:01 yedi: (dced, did i miss something?)

21:02 justin_smith: gfredericks: it had false positives

21:02 gfredericks: justin_smith: :P I think it was just generated from a word list, so your claim is *LITERALLY IMPOSSIBLE*

21:03 justin_smith: false positive as in it matched words not in the list

21:03 or was it really that specific?

21:03 yedi: funnily enough i came across this earlier today: https://github.com/noprompt/frak

21:03 amalloy: gfredericks: in the "not at all news" category, i heard on npr yesterday that someone had written a chrome extension to replace all occurrences of "literally" with "figuratively"

21:04 justin_smith: not as good as the classic cloud-to-butt extension

21:04 amalloy: i have had that installed for a few months

21:04 dbasch: (def lazy-cat (repeat "😺"))

21:04 amalloy: the occasional giggles are totally worth the confusion

21:05 dbasch: ,(take 10 (repeat "😺”))

21:05 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

21:05 justin_smith: amalloy: slightly less rofl, but still interesting, an old friend made a chrome extension that removes all numbers from the facebook UI

21:05 dbasch: ,(take 10 (repeat "😺"))

21:05 clojurebot: ("😺" "😺" "😺" "😺" "😺" ...)

21:05 amalloy: i don't use facebook, so the utility of this is not as obvious to me as it must have been to your friend

21:06 Platz: 1.5M regex, yep

21:06 gfredericks: somebody should make a generic chrome extension for word substitutions

21:06 would be great for pranks

21:06 justin_smith: facebook uses metrics to "gamify" the experience, so replacing numbers helps subvert that aspect

21:06 gfredericks: swap the names of the two major candidates during major election cycles, etc

21:09 seangrove: bbloom: Alright, grid, align, vertical/horizontal stack all ported over, and the debugger is laying itself out now http://dl.dropbox.com/u/412963/Screenshots/dx.png

21:10 yedi: woah what is that seangrove

21:10 amalloy: i don't understand that at all either, but it looks pretty cool

21:10 justin_smith: gfredericks: is this the one? https://gist.githubusercontent.com/noprompt/6106573/raw/fcb683834bb2e171618ca91bf0b234014b5b957d/word-re.clj

21:11 gfredericks: justin_smith: prollably

21:11 seangrove: yedi: It's our time-traveling debugger + layout manager + event simulator + state inspector

21:11 yedi: well them

21:11 then*

21:11 justin_smith: gfredericks: so far, slurping that file into clojure and making it an re, it matches cat but not cats

21:11 seangrove: yedi: To show an example https://dl.dropboxusercontent.com/u/412963/zensight/time_travel.mp4 /ht dnolen_

21:11 justin_smith: checking for false positives

21:12 amalloy: cats might not be a word

21:12 justin_smith: haha, it matches cond

21:12 yedi: seangrove: that is going to be killlllller

21:12 justin_smith: maybe because it was written using clojure :)

21:12 seangrove: yedi: That video was pre-layout manager. Just finished up porting a proper recursively-pluggable layout manager system

21:13 justin_smith: matches consolidate but not consolidating

21:13 seems it doesn't attempt to cover conjugations, makes sense

21:13 gfredericks: justin_smith: that's false negatives no?

21:13 seangrove: That was the last *big* piece before things could be really cleaned up. Pretty excited to clean up and start optimizing for speed, I think we can edge out the default Om strategy if React opens up the right hooks, plus building reusable components this way is just a thing of beauty

21:13 justin_smith: gfredericks: yeah

21:14 amalloy: makes sense??????? it should just cover whatever's in /usr/dict/words, which should include most conjugations

21:14 seangrove: Serializable state and time-traveling is just icing on the cake :)

21:14 justin_smith: gfredericks: first false positive: catting

21:14 * gfredericks jumps to a dictionary

21:14 gfredericks: justin_smith: http://en.wiktionary.org/wiki/catting#English

21:15 this regex speaks english better than you do :P

21:15 justin_smith: I guess so

21:15 cond is still an issue though

21:16 gfredericks: amalloy: somehow my computers never have /usr/dict/words

21:16 justin_smith: unless it also includes abbrevs

21:16 amalloy: gfredericks: i forgot where it's stored. it's actually in /usr/share/dict/words for me

21:16 gfredericks: ah there it is

21:16 I copied mine into a git repo a while ago

21:17 amalloy: http://www.merriam-webster.com/dictionary/cond

21:17 gfredericks: would be fun to get a corpus from different languages and search for the smallest regex that matches one language but not the other >95% of the time

21:17 justin_smith: it is inconsistent with conjugations - either having catting or lacking dogging is an error

21:18 amalloy: I explicitly mentioned abbrevs

21:18 it is an abbrev

21:18 yedi: seangrove: oh man, i can't wait till i can play with it

21:18 gfredericks: clojurebot: either having catting or lacking dogging is an error

21:18 clojurebot: Roger.

21:19 justin_smith: I am glad I finally thought to try this re out

21:19 err rather, was inspired

21:19 seangrove: yedi: To be honest, bbloom has done ~90% of the work on the layout stuff, I just want it more than him right this moment

21:19 dbasch: it doesn’t match antidisestablishmentarianism

21:19 amalloy: that's just antidisestablishmentarianism refusing to match

21:19 justin_smith: also does not match caked

21:20 dbasch: disestablishmentarianism doesn’t match either, they can’t both agree

21:20 bbloom: seangrove: were you able to basically copy paste my code in to om land and get it to work?

21:21 seangrove: or was there some mismatch you had to patch up?

21:21 dbasch: justin_smith: but it matches caker (?)

21:21 justin_smith: one of my favorite things is the unit test in gnu grep that tests an re that matches like 20 different spellings of muammar gaddafi's name

21:22 dbasch: caker is not a word

21:22 seangrove: bbloom: No major mismatches, just a few things to get it tied into our tree structure. Other than that, just grokking all the (admittedly simple) concepts was the major difficulty

21:22 justin_smith: (all of which used by some english language newspaper at some point)

21:22 bbloom: seangrove: took me months to make sense of it in my head :-)

21:23 justin_smith: dbasch: perhaps debatable https://www.google.com/search?q=regex+maumar+khadaffi&oq=regex+maumar+khadaffi&aqs=chrome..69i57.5680j0j4&sourceid=chrome&es_sm=93&amp;ie=UTF-8#q=define:caker&safe=off

21:23 seangrove: bbloom: It's not too horrendous, even though I'm still shakey. And I'm sure that *using* it is much simpler than implementing it all, especially with the right tools for immediate feedback

21:23 bbloom: seangrove: pretty cool that it just mapped over considering i had written that back when i had only hypothesized the design of react.js!

21:23 amalloy: huh. your previous search for define:caker snuck into that url, justin_smith

21:23 dbasch: google will define anything

21:23 justin_smith: amalloy: no, that is what I meant to share

21:24 amalloy: or for khadaffi, whatever

21:24 dbasch: including proper names

21:24 justin_smith: oh, ok, weird

21:24 seangrove: bbloom: Impressive stuff ;)

21:24 justin_smith: hah

21:24 bbloom: seangrove: the trickest part of using it is when things don't have a "natural" size, so they wind up being (0,0) or (inf,inf)

21:25 seangrove: but i think that the blend ppl ultimately addressed that with "design size" width/height properties on the standard controls

21:25 seangrove: bbloom: Virtualized scroll panels will be tricky, I expect. Some of the stuff winjs is doing is pretty fantastic in that regard

21:26 bbloom: seangrove: early versions of blend would default to align x/y both stretch

21:26 Frozenlock: seangrove: May I ask what you are talking about? It looks interesting

21:27 seangrove: Frozenlock: Layout managers for building apps in the browser (or anywhere, really)

21:27 justin_smith: my webapp library is not letting me return a synthesized document as application/rss+xml - it would be easier to take if I did not know I have commit access to whatever repo this bug is in

21:27 bbloom: seangrove: later versions defaulted to some fixed initial "design size" and then would force the margins to make that design size work... much nicer user experience b/c you'd get a fixed size thing and add layout behavior to it by other UI means, much better

21:27 Frozenlock: seangrove: Yes, but one bbloom did?

21:27 bbloom: Frozenlock: i shared it w/ him privately

21:28 Frozenlock: ah

21:28 bbloom: Frozenlock: it's part of a totally half baked UI framework i started on before react.js came out

21:29 seangrove: bbloom: I'll have to check out blend (or the old version at least). The grid layout was the last major piece before cleaning things up and pulling off some low-hanging optimizations, adding some linting tools, etc. After that, Going to be very interested in what Blend does :)

21:29 bbloom: seangrove: don't look at the old versions, they got lots of UX badly wrong

21:30 new versions have design issues, but they are like photoshop-level "this shit is too complicated" rather than "this shit is just plain stupid"

21:30 seangrove: bbloom: Didn't the new version get integrated into VS?

21:31 bbloom: seangrove: oh yeah, i'm just saying don't look at version < 3 for any msft product ever :-P

21:31 i think i have blend 3 on my windows vm

21:31 dunno what the new VS version is like

21:32 yedi: hah amalloy

21:32 arrdem: ooh. nice catch!

21:36 Bronsa: compared to LLVM t.a.jvm is a pleasure to read. thank you.

21:37 bbloom: arrdem: he's gone, but yes, yes it is a pleasure compared to basically anything else

21:40 kras: ,(reduce (partial merge-with vector) {} (#(for [x %2] {(% x) x}) #(> % 5) [1 3 6 8]))

21:40 clojurebot: {true [6 8], false [1 3]}

21:41 kras: ,(reduce (partial merge-with vector) {} (#(for [x %2] {(% x) x}) #(apply / %) [[1 2] [2 4] [4 6] [3 6]]))

21:41 clojurebot: {2/3 [4 6], 1/2 [[[1 2] [2 4]] [3 6]]}

21:41 amalloy: oh man. vector is not a good choice

21:41 kras: trying to solve a 4clojure problem

21:41 amalloy: yeah, for that reason

21:41 TEttinger: t.a.jvm ?

21:41 bbloom: TEttinger: clojure.tools.analyzer.jvm

21:41 TEttinger: ah thanks

21:41 arrdem: TEttinger: https://github.com/clojure/tools.analyzer.jvm/

21:42 kras: amalloy: vector anyways seems not right

21:42 amalloy: kras: you want to convert everything to singleton vectors first, and then combine them in your merge-with. then you won't be changing the data type once per merge

21:42 kras: it breaks for the second case

21:42 amalloy: or anyway that's one reasonable and common solution

21:43 bbloom: arrdem: amusing to me is how much more code there is in jvm than in the main analyzer

21:43 arrdem: most of the complexity in clojure comes from the JVM

21:43 perhaps unsurprising, but amusing all the same

21:43 arrdem: bbloom: shrug. If we didn't need hardware software would be easy.

21:43 bbloom: I happen to like that complexity, but that's my own crazy =D

21:44 bbloom: arrdem: hardware does not need to be as complex as it is either :-P

21:45 arrdem: bbloom: I'll be entertained to see how complex the final JS analyzer is in comparison. My $2 says they'll be close.

21:45 bbloom: hey man... I like my prefetched hardware with multiple caches and out of order processors

21:46 bbloom: arrdem: assuming he still relies on Google Closure, i expect it to be dramatically simpler b/c we can rely on google for source level optimizations during code gen

21:46 arrdem: bbloom: fair point.

21:47 bbloom: much simpler "type system" too

21:47 TEttinger: if we didn't have hardware who'd make keyboard pants https://www.flickr.com/photos/technomancy/4397554484/in/photolist-7GABJU-kivjUp-kix7eb-kiuGX6-kiuDbi-kiuC5k-kga9Xn-aiZCQ

21:47 arrdem: (inc TEttinger)

21:47 lazybot: ⇒ 16

21:47 TEttinger: I'm still amazed that people can make their own keyboards

21:47 jcromartie: nothing like tracking time to the 1/10 hours in three different places

21:48 arrdem: bbloom: type system. javascript. right.

21:48 jcromartie: and having to enter "reason codes" to adjust time on the same day


21:48 bbloom: arrdem: it's got one, but it deserves "quotes"

21:48 jcromartie: I'm just bitching

21:48 arrdem: jcromartie: #clojure-social is that way sir

21:48 * jcromartie is done

21:49 arrdem: jcromartie: it's almost as on topic as #emacs!

21:57 oinksoft: is there sometihng like erlnag's ETS in clojure?

21:59 arrdem: ,(true 1)

21:59 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>

21:59 arrdem: ,(true false)

21:59 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>

22:00 arrdem: ,(doc true)

22:00 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol>

22:05 kras: amalloy: thanks for the clue

22:05 ,(reduce (partial merge-with concat) {} (#(for [x %2] {(% x) [x]}) #(apply / %) [[1 2] [2 4] [4 6] [3 6]]))

22:05 clojurebot: {2/3 [[4 6]], 1/2 ([1 2] [2 4] [3 6])}

22:06 yedi: anything i should worry about / look out for when converting some of my maps to pmaps?

22:07 arrdem: yedi: benchmark everything and make sure it's actually a win

22:22 Frozenlock: yedi: There's a single case where I used pmap with a major win; when the function called was retrieving data from different endpoints over the network.

22:23 danneu: Frozenlock: did you use futures or something to hit the endpoints in parallel with pmap?

22:23 seangrove: Frozenlock: Wouldn't futures work better?

22:23 Frozenlock: danneu: no

22:24 seangrove: perhaps

22:24 * Frozenlock never used futures

22:25 seangrove: Frozenlock: No worries, if pmap works for you :)

22:25 dbasch: seangrove: pmap is implemented with futures

22:25 danneu: sometimes i yearn for a 'pmap for io' like (pooled-map send-request! all-urls {:threads 4})

22:26 seangrove: dbasch: But it's limited to cpu-cores + 2 or something, I believe

22:26 If you're not CPU-bound, might be better off managing your pool

22:26 Frozenlock: Stop complicating my code! :-p

22:30 dbasch: danneu, seangrove: that would be pretty easy to implement

22:31 all you have to do is take the pmap code and remove the restriction

22:42 amalloy: dbasch: don't forget to fix the OS scheduler so that spinning up a million threads isn't expensive

22:47 also, an unbounded version of pmap can potentially hold the head of the entire sequence at once, which currently pmap doesn't do

22:50 the point is that attempts to superficially fix pmap don't lead to a pmap that's more useful than the existing one, just to versions of pmap that are useless in novel ways

22:54 oinksoft: what is the idiom for some default reference? i see in korma the use of a @_default, which is being driven by the transaction macro. are macros the way to make this api? or bindings, or something else?

22:54 https://github.com/korma/Korma/blob/master/src/korma/db.clj#L7

22:57 dbasch: amalloy: my point is that you could create a pmap that is optimized for I/O instead of cpu. Sure, it wouldn’t be trivial.

23:01 oinksoft: i could see this being done w/ binding, and precondition to ensure *default-whatever* is not nil? i dunno

23:02 akhudek: oinksoft: are you asking about general api advice? If so I would use java.jdbc as a reference rather than korma

23:03 oinksoft: akhudek: no, i want my api to look like (defwhatever bizbaz ...), which sets some global value to bizbaz for convenience

23:04 akhudek: korma does this using macros but i think maybe korma is overusing macros? but this seems like it is a common thing in clojure code, i see other code with global atom refs shared by some functions

23:04 akhudek: i figured people who write APIs using this would know very quickly what the cleanest solution is

23:05 akhudek: oinksoft: where bizbaz is a var? yeah, you should use a macro to do that. But it is probably worth making a normal function too and then have the macro use that.

23:05 oinksoft: akhudek: yea, absolutely

23:06 akhudek: hm ok, actually there is another level to korma because it is storing the connection in jdbc too

23:06 akhudek: oinksoft: regarding binding, it’s often preferable to just pass values around rather than rely on thread local bindings

23:07 oinksoft: I haven’t looked at it in a while, but korma stored a fair number of global defaults in vars, such as the db connection map, and that pattern can often be annoying.

23:08 oinksoft: in contrast, jdbc requres a db map in every function, which seems more complicated but can often be much simpler e.g. if you have multiple dbs, or your are passing things around to different threads

23:10 danneu: seangrove: maybe this would work as a fix-pool map - https://www.refheap.com/79544

23:11 well it should be a lazy seq i guess

23:11 no it shouldnt

23:21 danlamanna: if anyone is interested, and wants to judge my first real attempt at functional programming (and clojure) - feel free https://gist.github.com/danlamanna/11240257

23:31 amalloy: danlamanna: i'd write #(<= 0 % 2), since that's apparently what you want to validate

23:31 the -1 and 3 are confusing

23:32 danlamanna: amalloy: yeah, they are, i knew that when i wrote it. not sure why i left it

23:32 amalloy: danlamanna: (let [x foo] (if (not x) nil y)) is (when-let [x foo] y)

23:33 (> (count x) 0) is (seq x)

23:33 also it's super-weird that you're putting whitespace on the inside of [] bindings

23:33 guns: danlamanna: And you are also using def for local bindings within functions

23:33 amalloy: (let [x foo]), not (let [ x foo ])

23:33 guns: but +1 for using tools.cli correctly!

23:34 danlamanna: guns: mostly copy/paste from the example :P

23:34 amalloy: are you referring to regex-filter for when-let?

23:34 amalloy: i was looking at size-str-to-bytes, but it's a general point

23:34 danlamanna: amalloy: still trying to figure out the coding standards. still trying to process that the if and else sexps are indented at the same level.

23:35 amalloy: yeah, i think guns is right that the most important issue here is using def for locals

23:35 i'm just pointing out minor stylistic issues, whereas his point is about functional programming, which you asked specifically about

23:35 danlamanna: amalloy guns - yeah i was unsure, not used to let blocks being immutable

23:38 guns: danlamanna: oh, the :default value in tools.cli is always nil, so you don't need to specify those

23:38 WRT let blocks, you can bind values sequentially, if that helps

23:39 danlamanna: guns: for example, in -main - i have to keep a running list of mentioned-files, how would you suggest i keep track of that variable?

23:40 amalloy: reduce, or loop

23:40 guns: danlamanna: you don't seem to be using that outside of its lexical scope; use a set #{} and conj/disj

23:40 or set/union or (into #{} …)

Logging service provided by n01se.net