#clojure log - Feb 06 2013

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

0:04 tomoj: so is (let [a 3] #{a}) bad?

0:04 it should be (let [a 3] (hash-set a)) ?

0:05 xeqi: &(let [a 3] #{a 3})

0:05 lazybot: java.lang.IllegalArgumentException: Duplicate key: 3

0:05 tomoj: but for singletons, no problem or bad style?

0:05 xeqi: seems fine to me

0:06 its part of the idomatic ##(some #{1} [1 2 3])

0:06 lazybot: ⇒ 1

0:06 tomoj: oh right

0:06 except in the canonical example (and that example) the thing inside is a literal

0:16 jyu: hello

0:47 mattkruse: ,

0:47 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

0:47 mattkruse: ,(&)

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

0:48 mattkruse: ,,

0:48 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

0:48 nightfly: ,,2

0:48 clojurebot: 2

0:48 nightfly: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2

0:48 clojurebot: 2

0:53 xumingmingv: anyone familiar with typed-clojure?

0:53 what's the All comes from in its code base?

0:54 e.g. (ann test1 (All [x y] [x y -> x]))


2:11 tomoj: hmm.. leading commas

2:12 amalloy: tomoj: did you see the post about using leading commas to address cond's indentation problem?

2:13 tomoj: no, that's exactly what I was thinking

2:13 also let, maps, ...

2:13 unfortunately clojure-mode isn't happy about it

2:13 amalloy: fogus (i think) mentioned it a few days ago, i forget where. maybe the paren-less lisp thread?

2:13 tomoj: at least with ", ..."

2:14 amalloy: huh?

2:19 tomoj: amalloy: https://www.refheap.com/paste/d3f62411813ff046869796bec

2:19 amalloy: that's a crazy way to do it

2:20 what are the commas there even saying?

2:20 tomoj: "a let binding pair starts here"

2:21 amalloy: tomoj: fogus's recommendation was to use ,, to "indent" meaning "this is the second half of a two-part clause"

2:22 thus you don't need them most of the time, only to clarify when you actually need to put a confusing newline in

2:22 tomoj: like this https://www.refheap.com/paste/f38a06c45cc15183ed5dde59b ?

2:22 amalloy: yes, although i think he was using ,,(transact...)

2:22 tomoj: hmm

2:23 is that not just a hack around fixing your editor's indentation of cond?

2:23 amalloy: yes

2:23 that is, yes it's exactly that

2:23 tomoj: I see

2:24 well, I'll adopt it rather than dig into clojure-mode :)

2:24 ",,(" actually fixes the problem with C-i on each line

2:25 amalloy: what problem?

2:25 tomoj: the third example in my last paste

2:26 the line after ",, (" gets indented too much if you C-i it directly

2:26 amalloy: oh, right. yeah, clojure-mode doesn't like it when two sexps start on the same line and the first is indented but the second "shouldn't be"

2:28 tomoj: sucks cus the reason you end up with confusing newlines is often that you're short on columns, but ,, steals 2 from you

2:29 amalloy: you could make do with just one

2:36 Phonatacid: hello. I've juste "leon clean"'ed my project which contains a "clojure-made" class using :gen-class. I need to compile this class before compiling the rest of the project. I used to do this via the repl using the compile function — unfortunately the repl won't launch because … that specific class is not found, since not compiled. How can i tell leiningen to compile that file ? I tried "lein compile mynamespace.MyClass

2:36 to no avail

2:37 ChongLi: wow juxt is really cool

2:37 Phonatacid: (for some reason I have autocorrect enabled on my osx, sorry for "typos")

2:39 Raynes: technomancy: I'm telling you dude, we need to auto-alias lein to leon.

2:40 Phonatacid: (that's what happen when you type in keybinding *that do nothing* (fixed))

3:01 "lein compile [my.name.space]" seems to be understood as "lein compile". Is that normal ? Or am I missing something ?

3:04 Foxboron: Raynes: why not auto-alias every wrod starting with "le" just to be sure?

3:05 word*

3:09 Phonatacid: http://25.media.tumblr.com/tumblr_m9u419VzNW1qen6qlo1_500.gif

4:18 OscarZ_: I've started experimenting with Clojure... I tried (class 1).. yay, its a long.. then I tried (class (1 2 3)).. fail! ;) I realize that it expects first element to be function.. but on the other hand I read parentheses create a LinkedList type of thing and brackets an ArrayList type of thing

4:20 thheller: OscarZ_: (1 2 3) will read to (1 2 3) but also try to eval (1 2 3), so to skip the eval and just get the list either (list 1 2 3) or quote it to prevent interpretation like '(1 2 3)

4:22 OscarZ_: thanks

4:23 marianoguerra: hi, which is the most up to date and complete website to search for clojure and related projects APIs?

4:23 clojurebot: Master Blaster runs 4Clojure!

4:23 ejackson: OscarZ_: also usually for sequential data structures you want to use a vector: [1 2 3]

4:26 OscarZ_: now I'm confused of the output of "list 1 2 3" in REPL :)

4:27 ejackson: '(list 1 2 3)

4:27 ,(list 1 2 3)

4:27 clojurebot: (1 2 3)

4:27 pimeys: the lisp rule is that the first item in a list is the name of the function you want to apply to the cdr

4:27 quote prevents this

4:27 ejackson: so the reader get (list 1 2 3), takes the first element, being list, applies it as a function which returns a list (1 2 3)

4:29 OscarZ_: ok.. but writing list 1 2 3 in REPL.. is that also a list ? without parentheses?

4:30 thheller: its just tokenized

4:30 so it reads 1, evals it to 1

4:31 eh first it reads list evals it to the function of list

4:31 and so on

4:31 basically the same as if you'd enter "list" <enter> "1" <enter> ….

4:31 pimeys: first is returning a list function with no params

4:31 you can set that to some variable and use the variable with params to do a list

4:32 OscarZ_: right ok

4:32 pimeys: cause functions are data

5:11 clojure-newb: hey guys… I've got my store connection in a def, and several of my lein tasks always hang, I'm trying to figure out a way to do things a little better and enable lein tasks to complete normally, any advice ?

5:13 mpenet: clojure-newb: you could use delay

5:13 ,(doc delay)

5:13 clojurebot: "([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?"

5:13 clojure-newb: mpenet: I will take a look into it, thanks

5:15 clgv: clojure-newb: better do not put it in a def. put it in a function. if you have a standalone application you can call that function from your main

5:16 clojure-newb: clgv: is the def making it evaluate when just running lein compile for example ?

5:16 clgv: it seems that might be what is happening

5:18 clgv: clojure-newb: yeah I think so

5:19 clojure-newb: compiling means loading the namespace with *compile-files* enabled

5:20 clojure-newb: clgv: hmmm, if its in a defn it is going to create the connection every time unless I guard against it somehow though ?

5:21 clgv: clojure-newb: I meant to call the function only once and either pass the store as parameter or bind it to a thread-local binding

5:21 mpenet: clojure-newb: that's what delay is good for imo. (defonce (delay ...))

5:21 clojure-newb: clgv: I see call function once in top level function, pass result across program afterwards

5:22 mpenet: well more like: (defonce conn (delay ...))

5:23 clojure-newb: mpenet: does the 'delay' part of that mean lein compile will ignore it ?

5:23 clgv: mpenet: it is still a global value then which is usually not that favorable

5:23 mpenet: the body wont be executed until you dereference it so yes, it shouldn't hang

5:26 clgv: clojure-newb: but you will be tied to that global value which makes testing pretty difficult and using the code for multiple stores impossible

5:27 mpenet: clgv: true

5:27 clgv: clojure-newb: with thread-local bindings you could omit that with almost no effort.

5:27 clojure-newb: clgv: I must admit I don't know much about thread-local, particularly in terms of concrete example of dealing with store connection etc

5:27 clgv: any good reference material (examples etc) ?

5:28 clgv: clojure-newb: most books have a chapter on it

5:28 clojure-newb: http://clojure.org/vars

5:29 clojure-newb: clgv: looking now, thanks

5:29 clgv: but there is only minimal info at clojure.org

5:37 clojure-newb: clgv: are we talking about something like - 'The clojure/java.jdbc library uses a dynamic var *db* so that you don’t have to pass in a database connection to every function call. You can just use the with-connection macro to bind *db* to the database you want to use, and then perform any database queries within the body of the macro.' ?

5:47 hmm, wondering about the overhead of closing the connection each time with this method…..

6:04 clgv: clojure-newb: yeah, that's the idea. you might keep the connection open for your whole program if you want to - you can bind the connection in you main function for example

6:21 abp: First day using emacs-live instead of ccw. Wow.

6:22 pimeys: hmm, I should play around with emacs again

6:22 with evil mode

6:23 danieroux: garak> pimeys: Evil works very well for me

6:23 arkx: I ended up discarding evil-mode after a while

6:23 pimeys: I'm using vim a lot, like the full scale of it's features

6:23 so I'm a bit afraid that will evil mode be enough

6:23 arkx: Crutches for full transition. ;)

6:24 pimeys: evil is very complete.

6:24 pimeys: I don't like to dismiss my command mode

6:24 arkx: There was this Vim book recently

6:24 One of the reviewers went through it with evil-mode and everything worked.

6:24 http://pragprog.com/book/dnvim/practical-vim

6:28 babilen: pimeys: I didn't really like evil mode. It was good, but I never felt quite at home. And vim + foreplay + paredit + vim-clojure-static + classpath is working just fine.

6:29 arkx: babilen: did you encounter something that didn

6:29 't work

6:31 babilen: arkx: I did, but I can't quite recall what it was :) (I would have mentioned it otherwise) -- I was also missing a bunch of plugins. And I don't see the point of switching to Emacs while trying to make it work exactly like vim while I could use vim in the first place.

6:31 arkx: babilen: well, the point is in emacs' extensibility & existing ecosystem

6:33 babilen: arkx: The same could be said about vim. Granted, people in the Clojure ecosystem might have a slight bias towards emacs, but I am /very/ happy with the tooling on vim right now. (apart from maybe midje mode integration)

6:33 arkx: It seems almost unfair to compare elisp and vimscript :) Then again, if you don't need to extend your editor it probably makes no difference

6:33 babilen: arkx: But in the end: Just use what you feel most comfortable with.

6:33 Hodapp: meh, the vim tooling didn't work well for me.

6:33 babilen: arkx: I would just write Python, but meh.

6:33 deg: Does Clojure arg destructuring support collecting a subset of keywords? Something like the following (illegal) attempt: (defn f [& {:keys [a b] :as a-and-b} {:keys [c]}] (list a b c a-and-b))

6:33 babilen: Hodapp: What was the problem? Did you use vim-foreplay?

6:34 Hodapp: babilen: No; I don't know what that is.

6:34 babilen: Hodapp: https://github.com/tpope/vim-foreplay

6:35 Hodapp: babilen: I had been following some instructions for VimClojure and Nailgun, and experienced frequent issues with the sessions just crashing or becoming unresponsive.

6:37 babilen: Hodapp: Yeah, one reason why the syntax, indentation, ... and other static bits of VimClojure have been moved to vim-clojure-static and REPL interaction (just the normal "lein repl" one) is done via vim-foreplay

6:37 goracio: hi there - how to check if char exists in string ? like if "w" exists in "world" ?

6:37 Hodapp: babilen: I don't have a whole lot of interest in attempting to switch back.

6:38 babilen: Hodapp: Sure, nobody says that you have to if you are happy with your environment right now :-D

6:39 As I said earlier: Use whatever you are happy with.

6:39 Hodapp: babilen: It's more that I see no reason to believe that the tooling has improved substantially since several months ago.

6:39 babilen: It did

6:39 Hodapp: babilen: I don't believe you.

6:39 goracio: any guess ?

6:40 aroemers: goracio: (some? #{\w} "world")

6:40 babilen: Hodapp: Fair enough and there is nothing I can do to convince you otherwise short of forcing you to try it. I see no point (nor a way) in doing so anyway ;)

6:40 goracio: aroemers: thanks

6:40 aroemers: goracio: (some #{\w} "world"), sorry

6:40 Hodapp: babilen: If it's merely things being 'moved' as you told me - I don't see how this would miraculously solve stability issues.

6:40 arkx: I'm inclined to believe babilen, tpope has a golden touch when it comes to vim-related stuff

6:40 aroemers: goracio: whithout the question mark

6:41 goracio: aroemers: jr

6:41 aroemers: ok

6:41 babilen: Hodapp: If you would take a look at foreplay you would realise that the /entire/ non-static bit (nailgun, REPL integration, ...) has changed. You now simply use a "normal" nrepl session and make whatever code you want to available in it.

6:41 And tpope is IMHO quite gifted vim plugin writer and it shows.

6:42 *a

6:43 Hodapp: babilen: I don't see how this is a substantial departure from what I started with.

6:44 arkx: Hodapp: are you familiar with nREPL?

6:44 Hodapp: arkx: Yes.

6:45 babilen: Hodapp: Why is that? The entire way in which you communicate with the REPL/JVM has changed. I would call that quite a significant departure, but then I wouldn't know what your perception of important changes are.

6:46 Hodapp: babilen: In what way has this entire method of communication changed?

6:47 babilen: goracio: I would simply use (.contains "foo" "o")

6:48 goracio: ,(some #{\w} "world")

6:48 clojurebot: \w

6:49 babilen: Hodapp: Before communication was done via nailgun and the REPL was implemented in vim, now it uses nrepl and communicates directly with the nrepl server

6:49 goracio: ,(.contains "foo" "o")

6:49 clojurebot: true

6:49 goracio: uses java i guess ?

6:49 babilen: yes

6:50 goracio: any similar in clojure ?

6:50 clgv: goracio: write a clojure wrapper function if you need it often. but it is the fastest method

6:50 goracio: ok

6:52 Hodapp: babilen: But there were acknowledged stability issues in Nailgun and the prior tooling?

6:53 babilen: goracio: Java interop is /so/ easy in Clojure that you don't really need to wrap something as trivial as this. (IMHO) Just use whatever is appropriate and in this case it is (.contains STRING CHAR)

6:54 goracio: babilen: yea it seams yeasy enough but how this works ? (some #{\w} "world")

6:54 babilen: we use sets

6:54 babilen: Hodapp: Yes, as I said: That was one of the reasons why Meikel decided to endorse vim-foreplay/vim-clojure-static and tpope decided to develop it. But I mentioned that at the very beginning. And it also wasn't /that/ bad, but yeah problems were seen :)

6:55 goracio: The idiom (some SET-OF-THINGS COLLECTION) is a common one if you want to test if some elements in one collection are contained in another.

6:56 goracio: babilen: ok thanks

6:56 babilen: ,(some #{1 2 3} [0 1)

6:56 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

6:56 babilen: ,(some #{1 2 3} [0 1])

6:56 clojurebot: 1

6:56 babilen: ,(some #{1 2 3} [0])

6:56 clojurebot: nil

6:56 aroemers: clgv: indeed! I tested it in a REPL, and is about 4 times faster in this case. Nice, and makes sense.

6:57 babilen: aroemers: It is just the appropriate thing :)

6:57 clgv: aroemers: any clojure sequence based function will convert it to a sequence which causes the overhead

6:57 Hodapp: babilen: It was completely preventing me from working. I would call that quite a significant problem, but then I wouldn't know what your perception of important problems is.

6:58 babilen: It's the same reason why I gave up on Counterclockwise, though I had better luck there.

6:58 babilen: Hodapp: Yeah, I am happier that these problems have been solved. People are working on nice nrepl integration and a lot of progress is being made.

6:59 clgv: Hodapp: CCW did prevent you from working? I am working with it since more than 2 years.

6:59 Hodapp: clgv: I ran into a repeated set of issues with what appeared to be the plugin itself getting a NullPointerException, from what I remember.

6:59 clgv: I asked quite a bit in the channel and no one had a clue what was going on.

7:00 clgv: Hodapp: approximately when did that happen?

7:00 Hodapp: clgv: 4 or 5 months ago.

7:00 clgv: I will see if I took any notes on the precise symptoms I had.

7:00 clgv: Hodapp: CCW development speed has significantly increased since laurent got the funding

7:01 Hodapp: clgv: When did laurent get the funding?

7:01 clgv: Hodapp: if you are interested in it, just try a current version. CCW was the first to use nrepl

7:01 january 2013

7:02 currently, there is built-in basic leiningen support

7:02 Hodapp: oh yes, here's the other issue I'd run into: just typing in CCW would regularly get it into states where Eclipse was unbearably slow

7:02 opening a quote or a paren would do it

7:03 clgv: interesting, I never encountered something similar on the stable releases...

7:03 Hodapp: I could reproduce it quite readily in my own configuration months back

7:04 clgv: well if you have spare time to play, you can give it a try now.

7:05 now = current version ;)

7:05 abp: Can I move binding-pairs up and down in a let in emacs?

8:05 samrat: is there a way to stop a server started from ring-server(https://github.com/weavejester/ring-server)?

8:10 clgv: samrat: very likely you get a return value from the `serve` function which you can use to stop the server

8:17 samrat: clgv: ok, seems like using defonce works here

8:30 Sgeo: You know what could make my blog post more convincing?

8:30 Writing some code to go along with it

8:30 But then I stumble upon one of the hard computer science problems -- naming things

9:04 xumingmingv: Sgeo: how about 'x'?

9:05 Sgeo: heh

9:20 OscarZ_: trying to undestand sequences... are they like something like Haskell lists where you can use pattern (x:xs) to break up things so that they can be processed one by one ?

9:25 matthavener: OscarZ_: not really

9:26 OscarZ_: you typically use (first s) and (rest s)

9:26 which would return x and xs equivalent in haskell

9:26 arkx: Well, doesn't that fall under "something like"?

9:26 matthavener: yeah, sorry, its something like lists

9:26 but its an abstraction instead of a data structure

9:27 OscarZ_: ok.. so there are many functions that understand sequences.. and they usually do something with the first and then recursively call themselves for the "rest" part ?

9:27 matthavener: afaik, in haskell a list is concrete and not a typeclass

9:27 OscarZ_: I dont know much Haskell though but that part I remember

9:28 matthavener: OscarZ_: yeah or they just use a list comprehension (for ...), or some higher order function

9:28 OscarZ_: unlike haskell, clojure recursive calls are not tail-recursive, so you have to use 'recur' to avoid stack overflow

9:29 but, like haskell, you can produce a lazy sequence. unlike haskell, clojure is not lazy by default

9:29 OscarZ_: this is a great way to learn clojure, especially some of the core abstractions like seq http://www.4clojure.com/

9:32 OscarZ_: matthavener: that seems interesting.. thanks!

9:33 I remember asking once if there was JVM based Haskell, but there was some tail-recursion related limitation in JVM why it cant be done..

9:33 matthavener: OscarZ_: no problem. i'm definitely not an expert, so take what i say with a huge grain of salt :)

9:42 ToBeReplaced: is there an "interleave-longest" in stdlib somewhere? what is the idiomatic way to split a string and keep the separators? so... (my-partition "foo,bar,baz") => ("foo" "," "bar" "," "baz")

9:44 augustl: I have a list like [{:id 123 ...} {:id 456 ...} ...]. What's a good way to get the map where :id is 456?

9:45 noidi: (some #(= (:id %) 456) the-list)

9:46 oops, that won't work

9:46 I forgot that some returns the return value of the predicate

9:47 ToBeReplaced: (filter (comp (partial = 456) :id) your-maps)

9:49 augustl: filter is annoying, I also need to wrap it in "first"

9:50 tbaldridge: Does anyone know how many processor threads Ring will use if I use the Jetty adapter?

9:54 alexnixon: augustl: there's (find-first pred coll) in flatland/useful, which reads better than (first (filter pred coll))

9:57 augustl: alexnixon: I wonder why there isn't a find-first in core

9:57 there's probably a good reason for it that I'm not aware of :)

9:59 ToBeReplaced: it's too specific; no real pain in (first (filter pred coll)), and if you're doing it all the time, writing it yourself is fine

10:02 augustl: lets say you have an infinite lazy sequence, how do you get the first item matching a pred out of that?

10:02 since (first (some-iteration..)) won't do because it'd go on forever

10:03 I can't imagine any cases where you'd actually need something like that though, and in the rare cases that you do a recursive first/rest type thing would do

10:05 alexnixon: augustl: (first (filter p c)) still works, with the caveat that if it'll realise the entire lazy seq so if you're holding onto the head elsewhere you'll run out of memory, and if there isn't an element which matches it'll keep searching forever

10:07 s/realise the entire lazy seq/realise the seq until a match is found/

10:08 snake-john: i'm using live-emacs with nrepl and as soon as I type something in brackets nrepl starts evaluation which causes of cause classnotfound exceptions. anybody experienced this before?

10:09 ejackson: snake-john: i had a similar thing with java objects which I solved by including clojure-complete

10:09 augustl: hmm, I have a map-indexed that I now need to become a mapcat-indexed, which doesn't exist.. What's a good way to get a i++ type counter for this kind of thing? The use case is to iterate a set of maps and create datomic transactions, whose fact needs to include a "position" attribute to state its, well, position

10:09 ejackson: just put it into your project.clj

10:10 snake-john: oh i see that's my problem I not using leiningen I started a nrepl server from my application

10:11 ejackson: yeah, that's it... you need clojure-complete if you're going to do that

10:12 snake-john: @ejackson thank you very much!

10:16 ToBeReplaced: alexnixon: augustl: why will it realize the entire lazy seq? filter is lazy

10:17 augustl: ToBeReplaced: ah :)

10:18 alexnixon: ToBeReplaced: yeah you're right, I corrected myself afterwards: s/realise the entire lazy seq/realise the seq until a match is found/

10:24 abp: augustl: You can use some, as noidi said, but the predicate gets quirky ie ,(some #(when (-> % :id #{456}) %) [{:id 456}])

11:09 rboyd: quiet today

11:09 all the codes must be working

11:10 ejackson: or not...

11:10 hence the coders are :)

11:16 ToBeReplaced: alternative to something like (cond (keyword? s) foo (associative? s) bar) ?

11:16 it needs to work in both cljs and clojure... so i don't think i can do the protocol dispatch thing... or can i?

11:18 nDuff: ToBeReplaced: protocols are a thing that exist in cljs.

11:22 ToBeReplaced: nDuff: the types don't line up between the two languages though, do they? like if i wanted to have a protocol for a hash-map, in clojure it would be clojure.lang.PersistentArrayMap, in cljs it would be cljs.core/ObjMap

11:23 nDuff: *nod*; indeed, they don't.

11:23 * nDuff would like to see reader support for "interpret this only on clojurescript" / "interpret this only on the JVM" show up already.

11:24 nDuff: ...not that such macros haven't been written / can't be used.

11:24 ToBeReplaced: do you have a link to one in use?

11:27 nDuff: Not handy.

11:29 ToBeReplaced: https://github.com/lynaghk/cljx

11:30 pbostrom: ToBeReplaced: what's your question exactly? is it about whether your 'cond' code snippet will work in both? I believe it would

11:30 gfredericks: (alter-var-root #'*read-eval* #([true false] (rand-int 2)))

11:31 nDuff: ToBeReplaced: ...by the way, also see also http://dev.clojure.org/display/design/Feature+Expressions and CLJS-27 for the reader approach.

11:31 hyPiRion: gfredericks: use ##(rand-nth [true false]) instead

11:31 lazybot: ⇒ false

11:31 ToBeReplaced: pbostrom: cond works... just looks ugly and would be slow(er) on the java side

11:31 nduff: Thanks

11:32 gfredericks: hyPiRion: man I knew there was an easier way; though both will crash on arity

11:33 (pos? (rand-int 2)) is maybe the shortest

11:33 hyPiRion: gfredericks: crash on arity?

11:33 pbostrom: ToBeReplaced: but you were asking something about protocols

11:33 gfredericks: hyPiRion: when using it with alter-var-root, yeah

11:34 hyPiRion: gfredericks: Oh shoot.

11:34 is it unbound by default now, or is it true?

11:35 ToBeReplaced: pbostrom: right... because an alternative would be to use protocols and extend it to each type. however, that would not work across both platforms because the types are not the same -> instead of using "string?" i'd be using "java.lang.String"

11:35 gfredericks: hyPiRion: true I thought

11:36 I think rhickey's latest commit does nothing but add read-edn

11:37 hyPiRion: gfredericks: #(rand-nth [(not %) %]) ?

11:37 That's probably the safest.

11:37 Or, uh, "most random".

11:38 gfredericks: doesn't return a boolean though

11:38 #(rand-nth [(not %) (not (not %))])

11:38 hyPiRion: (comp rand-nth (juxt not boolean))

11:40 hiredman: ,(take 2 (iterate complement boolean))

11:40 clojurebot: (#<core$boolean clojure.core$boolean@5373166a> #<core$complement$fn__2348 clojure.core$complement$fn__2348@58bf6255>)

11:41 hyPiRion: ,(rand-nth (iterate complement true))

11:41 Oh, okay. Just die then

11:41 hiredman: you generate functions there. Hmm.

11:42 clojurebot: Execution Timed Out

11:42 hiredman: *shrug*

11:49 hyPiRion: Oh, hey

11:49 ,(->> (range) (map vector) (reductions (comp vec concat)) (map #(% (peek %))))

11:49 clojurebot: (0 1 2 3 4 ...)

11:52 Frozenlock: I remember trying a noir example where there was kind of a minimum db wrapper over a map; something to do a quick proof-of-concept without needing a database. Could someone point me towards something similar?

11:52 (For noir or compojure, if possible)

11:53 hyPiRion: https://github.com/ibdknox/Noir-blog ?

11:53 It uses simpledb

11:54 Frozenlock: hyPiRion: Yes exactly that! Thanks :D

11:55 hyPiRion: Frozenlock: You're welcome :)

11:59 Wow, silent here now.

11:59 Frozenlock: hyPiRion: Let me change that.. "Wow, I would really like to have `read' fn that doesn't `eval' at the same time."

11:59 TimMc: __@~··___@~··_____

11:59 ^ tumbleweed

12:00 hyPiRion: TimMc: I was thinking you got some swearjure up and running

12:00 babilen: Frozenlock: not again! :)

12:00 TimMc: Frozenlock: Silly, today's topic is the CA.

12:00 Frozenlock: TimMc: Didn't receive the memo.

12:01 Oh wait there it is. I was too busy doing my TPS report.

12:01 gfredericks: does clojure really have to have all those parentheses?

12:01 hyPiRion: TimMc: I realized that finding the nth prime number should be trivial in Swearjure.

12:01 Frozenlock: *shameless Office Space reference*

12:01 hyPiRion: Though I should consider quitting writing those programs. It's not good for my sanity.

12:02 gfredericks: hyPiRion: prime numbers are not important to mathematics

12:02 hyPiRion: gfredericks: Aren't the numerical atoms important? :o

12:03 craigbro: really we can just have 1,2,infinite and be good

12:03 hyPiRion: Oh right, there was probably some HN thread on it.

12:03 craigbro: if you wanna do theoretical computr science, add 0

12:04 I wanna find me a language that undertands simplicity, and gets rid of this complexcted numeric range, and number type stack

12:05 technomancy: maybe a slide rule?

12:05 hyPiRion: craigbro: Tried common lisp? Ratios, complex numbers, arbitrary length of floating points, etc.

12:06 babilen: How would you go about a variation on with-open in that I can specify additional actions (not just close) to be performed in the finally block? I can surely just write it down, but there might be something a little nicer. Any pointers? (/me is tires and needs inspiration now)

12:06 * nDuff tries to reconcile the history of Common LISP with the ideal of "simplicity"

12:06 craigbro: hyPiRion: yah, years of it. I was being sarcastic above, just in case it wasn't obvious 8)

12:07 hyPiRion: craigbro: Oh dangit, I totally didn't read your username. You mentioned that yesterday

12:07 cmajor7: what is the current way to do observables in clojurescript? (e.g. integrating with angular or knockout is no all that good)

12:07 craigbro: nDuff: they didnd't complect namespaces! symbols can have vars and fn values!

12:07 hehe

12:07 technomancy: babilen: I think you'd have to reify Closeable and define your own .close

12:07 if you want to use with-open itself

12:08 hyPiRion: craigbro: Yeah, it's kind of less complect than Clojure, having separate namespaces for functions and other values.

12:08 It comes at the cost of readability though, I think.

12:08 technomancy: hyPiRion: not at all, now you have to think about whether a function is a value or not

12:08 nDuff: cmajor7: I'm not entirely clear on "observables", but the usual way to trigger when values shift is to have atoms with watches on them.

12:09 babilen: technomancy: I would be fine /not/ using with-open but reify'ing close /is/ a tempting solution. I am rather looking for a solution that allows me to specify "with-foo" where with-foo is essentially with-open just with additional teardown. I've been hacking for hours and just need an idea as .. well .. too tired. :)

12:10 craigbro: err, not sure why just writing (try ...(finally ..)) it too much andneeds a macro?

12:11 running that inside the body of a with-open would still work

12:11 cmajor7: nDuff: I see.. watchers that alter DOM every time the state changes?

12:12 hyPiRion: technomancy: Valid argument. I still don't really know the difference between (mapcar (lambda (x) .. and (mapcar #'(lambda (x) ..

12:12 nDuff: cmajor7: ...so, when I've done it in the past, I've used atoms on both sides -- one to represent the state of the UI, one to represent the state of the model, and watches to display model's outputs in the UI and represent changes the user makes in the UI to the model's inputs.

12:12 technomancy: hyPiRion: it's analogous to the distinction between statements and expressions. more to think about, but no actual benefits.

12:12 craigbro: as schemer and CLer, gotta agree there

12:13 nDuff: cmajor7: that said, I'm not a JavaScript person, so I may not be the ideal person to be talking here.

12:13 craigbro: it means that you can use more obvious names sometimes without shadowing your fns

12:13 but that is not that big of a win, considering a little imagination gets you around that

12:14 hyPiRion: Speaking of #', that's actually complect in Clojure. When is #'fn the var, and when is it the value it refers to?

12:15 hiredman: it is always the var

12:15 but vars implement ifn by calling through to their value

12:16 hyPiRion: Well, my knowledge about #' in Clojure is thus revealed.

12:17 (inc hiredman)

12:17 lazybot: ⇒ 15

12:21 hyPiRion: Question: Do you consider conditionals (i.e. that only parts of a function is evaluated) as a critical component for a language to be turing complete?

12:21 technomancy: hyPiRion: you can make an if function which takes fns for its branches

12:22 pbostrom: cmajor7: you might want to check out https://github.com/drcode/webfui, it's a framework that lets you declare something similar to what nDuff described

12:22 hyPiRion: technomancy: Yeah, that's what I was gonna tell you after you got that one wrong :(

12:22 technomancy: heh

12:23 besides, for turing completeness you can get away with something like JNZ

12:23 (jump not zero)

12:25 hyPiRion: Along with some other small subset of machine instructions, I suppose.

12:25 goracio: how to replace all chars in string- say "world" with "_" ?

12:27 Hodapp: whether a language is Turing complete is more a theoretical matter than a practical one

12:28 nDuff: goracio: that's not a very well-specified problem. I mean, you could construct a new string with the exact same length and only "_" characters, and it would meet your spec.

12:28 goracio: ok that's replace function )

12:28 nDuff: goracio: ...but I suspect that it's not what you actually want.

12:29 goracio: ,(clojure.string/replace "red" #"\w" "_")

12:29 clojurebot: "___"

12:29 Hodapp: the bar is fairly low for Turing-completeness, really.

12:29 goracio: ,(clojure.string/replace "red" #"\w" "_ ")

12:29 clojurebot: "_ _ _ "

12:29 hyPiRion: ,(clojure.string/replace "There are 2 apples" #"\w" "_")

12:30 clojurebot: "_____ ___ _ ______"

12:30 hyPiRion: Just so you know that it eats digits as well.

12:30 rasmusto: goracio: building a hangman game?

12:30 goracio: rasmusto: not really ) guess a word actually )

12:31 hyPiRion: If you keep a set of guessed characters, you can do (comp not the-set)

12:31 Say for instance you've guessed a and b, then the set contains #{\a \b}.

12:31 goracio: well it appears not functional

12:31 i use while for example

12:32 and atoms

12:32 nDuff: goracio: I mean, this meets your spec as well: (apply str (take (.length "red") (cycle "_")))

12:32 goracio: nDuff: huuge

12:33 nDuff: (?)

12:33 goracio: replace better

12:33 nDuff: goracio: Point wasn't to argue that it was a good implementation. Point was to demonstrate that there's no need for an implementation to "replace" anything at all.

12:33 goracio: ok

12:33 nDuff: goracio: I objected (and do object) to posing the question in a way that suggested an implementation as a conclusion.

12:35 OscarZ_: I'm already stuck with this: http://www.4clojure.com/problem/19#prob-title, I tried something like (fn me [x] (if (rest x) (me (rest x)) (first x)))

12:35 getting StackOverflow... dont understand why

12:36 hyPiRion: OscarZ_: replace rest with next. Also take a look at recur

12:37 ,[(rest ()) (next ())]

12:37 clojurebot: [() nil]

12:37 hyPiRion: ,(if () true false)

12:37 clojurebot: true

12:37 hyPiRion: (therein lies your problem)

12:39 OscarZ_: thanks I'll read up on those

12:39 dnolen: thheller: did you submit a CLJS patch yesterday?

12:40 tomoj: webfui looks rather interesting

12:42 OscarZ_: hyPiRion: I suspected it may not evaluate to false when rest x is empty list and I tried (= (seq ()) true) and it evaluates to false

12:43 so I got confused

12:44 Frozenlock: How does one start a ring/compojure server from within the repl? (in noir I used to just do server/start)

12:45 hyPiRion: OscarZ_: Yes. rest returns the empty list, and seq converts empty lists into nil.

12:45 technomancy: Frozenlock: here's what I use: https://github.com/ato/clojars-web/blob/master/src/clojars/main.clj#L31

12:45 Frozenlock: technomancy: Ah thanks! I would have forgotten the :join? false for sure.

12:46 OscarZ_: hyPiRion: I read from docs on seq rest that: Returns a sequence of the items after the first. Calls seq on its argument. If there are no more items, returns a logical sequence for which seq returns nil.

12:46 hyPiRion: (next x) can be thought of as (seq (rest x)), I may suspect that it's actually implemented as such.

12:46 OscarZ_: ok I think I got it... that "calls seq on its argument" got me off track

12:46 craigbro: well, trying to track down a memory leak

12:46 hyPiRion: OscarZ_: Hmm, yeah, that sounds a bit messy.

12:46 craigbro: it only really shows up after tens of thousands of runs of our core.logic system

12:47 hyPiRion: Well, ##(seq? nil) should be false.

12:47 lazybot: ⇒ false

12:47 hiredman: hyPiRion: nope

12:48 nil accepted everywhere a "seq" is, it is a seq

12:48 TimMc: ,(seq? nil)

12:48 clojurebot: false

12:48 TimMc: Oh, I'm being an echo again.

12:49 hiredman: nil is not a seq, but it participates in the sequence abstraction.

12:49 Or rather, code that participates in the seq abstraction may use nil as a seq.

12:50 hiredman: ,(seq ())

12:50 clojurebot: nil

12:50 hiredman: ,(seq nil)

12:50 clojurebot: nil

12:50 TimMc: &(assoc nil :a :b)

12:50 lazybot: ⇒ {:a :b}

12:50 TimMc: I guess nil is also a map?

12:52 OscarZ_: why is rest calling seq on its argument? isnt it already a seq ?

12:52 rasmusto: OscarZ_: to get that nil case if its empty

12:53 tomoj: &[(rest [1 2 3]) (seq? [1 2 3])]

12:53 lazybot: ⇒ [(2 3) false]

12:53 rasmusto: OscarZ_: and it doesn't have to be a seq already

12:53 TimMc: &(rest "abcdef")

12:53 lazybot: ⇒ (\b \c \d \e \f)

12:53 rasmusto: &(rest {:1 1 :2 2 :3 3})

12:53 lazybot: ⇒ ([:3 3] [:2 2])

12:54 hiredman: TimMc: nil was for a long time the only representation of an empty seq

12:55 TimMc: I understand, but I think it's crazy to call it a seq.

12:55 If seq were a protocol, that protocol would be extended to nil... but that's different than saying nil-the-value is a seq.

12:56 hyPiRion: OscarZ_: It's a bit complicated, as you see.

12:56 clojurebot: forget chouser: it's tougher with guards (arbitrary tests), where grouping is less clear. I need to work that out still.

12:56 hiredman: seq produces seqs, seq can produce nil

12:56 TimMc: seq's output participates in the seq abstraction

12:56 That's as low as I'll go, I'm cutting my own hand off here.

12:57 dnolen: hiredman: TimMc: in Typed Clojure I believe nil doesn't really belong to types but is unioned with the types that fns accept.

12:57 the story is a bit different in CLJS where nil is extend-type'd to many abstractions

12:57 tomoj: and (satisfies? ISeq nil) is true?

12:57 dnolen: I played around with removing that - but it does mean you have to explicitly handle lit everywhere.

12:57 tomoj: it should

12:57 OscarZ_: you can call seq on certain types that implements ISeqable interface?

12:58 dnolen: "explicitly handle nil everywhere" I mean

12:58 tomoj: and I mean it should based on the current implementation in CLJS - not that it always should.

12:58 TimMc: Disclosure: I'm a bit biased here; I don't think nil *should* participate.

12:59 nil-punning is an attractive nuisance

12:59 zackzackzack: Any bright ideas about how to get bash output streaming into clojure?

12:59 TimMc: zackzackzack: Pipe it into your Clojure program and read from System/in?

12:59 dnolen: TimMc: from a performance perspective, handling nil explicitly in CLJS would be better, same way RT.Java explicitly handle null

12:59 craigbro: clojure.java.shell/sh?

13:00 clojurebot: clojure is the best

13:00 craigbro: zackzackzack: clojure.java.shell ?

13:00 zackzackzack: craigbro: clojure.java.shell/sh is what I'm using now.

13:00 hyPiRion: zackzackzack: I use "#! /bin/env clojure" in files, make them executable and pipe around

13:00 TimMc: zackzackzack: Are you trying to shell out and read the output, or have a Clojure program participate in a bash pipeline?

13:00 hyPiRion: Not sure if that works for you of course.

13:01 zackzackzack: I'm trying to use `git log` to read in the entire history of the linux kernel

13:01 I've gotten something that works with clojure.java.shell/sh

13:01 TimMc: zackzackzack: https://github.com/Raynes/conch might work better for you?

13:02 zackzackzack: But I'm trying to figure out if there is a better way than waiting on git to finish reading the entire thing into memory

13:02 craigbro: zackzackzack: but you want streams and not strings...

13:02 TimMc: zackzackzack: conch's proc fn is probably what you want.

13:02 tomoj: dnolen: right

13:02 magnars: When I reload a file in the repl, I'd like for this atom not to be reset to nil: (def adventure (atom nil)) ... any ideas?

13:03 Sgeo: ,(doc defonce)

13:03 craigbro: magnars: defonce

13:03 clojurebot: "([name expr]); defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated"

13:03 magnars: excellent, thanks

13:03 Sgeo: yw

13:03 zackzackzack: TimMc: that sounds about right

13:03 Thanks!

13:06 tomoj: I see webfui sort of wants maps with no nil values too

13:07 will except you need Maybe too :)

13:07 or just (= (assoc m k nil) (dissoc m k)) ?

13:08 hyPiRion: tomoj: (assoc m k nil) != (dissoc m k), except if you're only using the two-arity get

13:09 I'd do dissoc for safety.

13:09 Or well, durr, it depends on the use case.

13:09 tomoj: I'm considering a hypothetical m

13:10 (= (get m) (get m nil))

13:11 hyPiRion: ,(= (assoc {:a :b} :a nil} (dissoc {:a :b} :a))

13:11 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>

13:11 tomoj: er

13:11 you know

13:11 hyPiRion: ,(= (assoc {:a :b} :a nil) (dissoc {:a :b} :a))

13:11 clojurebot: false

13:11 OscarZ_: ok.. so seq is actually using Java Iterator (which is stateful) on the collections but is hiding the state from user?

13:11 tomoj: that m is not hypothetical :)

13:13 dnolen: OscarZ_: no

13:13 OscarZ_: :D

13:18 Sgeo: Can I make protocol names and type names private?

13:18 They're an implementation detail

13:18 Maybe I should just use a different namespace

13:23 tomoj: should (fn not= ... ([x y & more] (not (apply = x y more))))

13:23 I guess what I expected would be weird

13:24 I expected (false? (not= 1 2 1))

13:25 cbp: OH! is (System/exit 0) how you're supposed to exit nrepl?

13:27 technomancy: cbp: it's how you exit the JVM in general

13:28 cbp: well I know I just hoped it would do that on its own

13:32 callenbot: I need a faster feedback cycle, does anyone here use jrebe;?

13:33 jrebel*

13:35 jrebel users, anybody?

13:41 technomancy: do you anybody that uses jrebel with Clojure?

13:41 technomancy: callenbot: I have a vague understanding of what jrebel is but no idea of how it would be useful to clojure users

13:42 jweiss: i think there is a bug in lazybot's karma system (at least on my server)

13:42 (inc lazybot 500)

13:42 lazybot: ⇒ 1

13:42 jweiss: karma is reset to 1 ^

13:44 callenbot: technomancy: ring reloads/restarts are slow and annoying.

13:44 jweiss: (inc lazybot)

13:44 lazybot: ⇒ 13

13:44 jweiss: (inc lazybot 1)

13:44 lazybot: ⇒ 1

13:44 jweiss: (inc lazybot)

13:44 lazybot: ⇒ 14

13:44 jweiss: oh maybe not

13:45 callenbot: technomancy: the built-in re-eval functionality is buggy and doesn't always work.

13:45 hiredman: callenbot: just start a repl inside ring and reload via the repl

13:46 technomancy: callenbot: you mean the reload stuff in ring?

13:46 yeah, I'm not a fan. use a repl.

13:46 hiredman: firing up jetty, then editing text files and having ring reload is dumb, what is this php? use the repl

13:47 callenbot: hiredman: technomancy - okay okay, you guys are right. Thanks.

13:49 https://github.com/cemerick/drawbridge this is fucking cool.

13:49 technomancy: inc

13:50 nDuff: Aren't there issues with nrepl.el not knowing how to route messages correctly when using drawbridge to communicate to both clj and cljs runtimes?

13:52 technomancy: nDuff: probably; never used cljs

13:58 calis: Anyone know why my Emacs Live doesn't show documentation with autocomplete?

13:59 rasmusto: is target-path something I should set for non-jar files that my clojure code creates? I'd like to use `lein clean` to clean up everything in the project

14:00 technomancy: rasmusto: yeah, placing artifacts inside :target-path would let you do that.

14:00 not sure what you mean by setting it

14:01 rasmusto: technomancy: can't you put :target-path "something" in project.clj? oh... That would affect where jar files go too.

14:01 technomancy: I guess that putting everything into target/ is my solution, and is probably the cleanest

14:02 technomancy: right

14:09 gfredericks: jweiss: it's just incing a name with whitespace in it

14:26 cmajor7: nDuff: "atoms on both sides -- one to represent the state of the UI, one to represent the state of the model, and watches to display model's outputs in the UI and represent changes the user makes in the UI to the model's inputs" => you mean save UI atoms periodically to sync them with the backend atoms?

14:26 nDuff: cmajor7: ...err. No.

14:27 AtKaaZ: &"\@all"

14:27 lazybot: java.lang.RuntimeException: Unsupported escape character: \@

14:27 nDuff: cmajor7: DOM event -> call into clojurescript -> immediate update of UI-tracking atom -> immediate trigger of watchers on that atom -> immediate backend code invocation -> ...

14:28 cmajor7: nothing periodic about it.

14:29 yedi: is there a d.get('key', default) equivalent for lists?

14:29 AtKaaZ: &"\@1"

14:29 lazybot: java.lang.RuntimeException: Unsupported escape character: \@

14:29 yedi: wrong channgel, y b

14:29 AtKaaZ: what am I missing here

14:30 cmajor7: nDuff: thank you. "immediate backend code invocation" I am trying to avoid that, that is why I was thinking on a some kind of periodic sync. Otherwise it creates quite a load on the backend (there are also cases the data does not yet need to be persisted)

14:30 AtKaaZ: &\~\@all

14:30 lazybot: ⇒ \~

14:31 nDuff: cmajor7: *nod*. Sounds like you'll want to do something yourself with timers, then.

14:31 cmajor7: Might have your watchers set flags or maintain a changelist for the timed events.

14:32 cmajor7: ...also, the library pbostrom_ pointed at _does_ look interesting.

14:32 cmajor7: nDuff: I see, thx. yea, that's the current approach, keeping the dirty on and a change list.

14:33 gfredericks: hmm

14:33 cmajor7: yep, I am looking at webfui, just wanted to see there is nothing I can use cleanly directly provided by the language.. all the libs are deps, and deps are relying on something.. (e.g. like noir that can be depricated :) )

14:33 gfredericks: so if I (require 'clj-time.core) in my user.clj, then a compiled uberjar crashes saying it can't find the "class" for a clj-time protocol

14:33 if I don't require it, it's fine

14:34 hiredman: don't use a user.clj

14:34 it will undermine the repeatability of your builds

14:34 gfredericks: why not?

14:34 cmajor7: nDuff: "immediate trigger of watchers on that atom". do you mean that you would update corresponding DOM elemens within these watchers as well? e.g. an user changed something in one place and the other place that displays a summary of that also changes

14:35 gfredericks: so if I want to use data readers in source files I'll have to require not-directly-used namespaces to make sure they work?

14:35 nDuff: cmajor7: well -- the way I did that was to abstract things coming from the model to the view through a second atom.

14:35 hiredman: gfredericks: yes

14:35 gfredericks: hiredman: that is not a giant ball of happy-times.

14:36 hiredman: gfredericks: user.clj is not a "project" scale feature

14:36 nDuff: cmajor7: so, user triggers DOM change -> js callback -> set input-atom -> model change -> logic happens -> set output-atom -> listener does a DOM update -> displays output to the user

14:36 Frozenlock: Compojure question: I'm trying to load some files (css, js) using the hiccup functions as I would in Noir, but it doesn't seem to point my public directory. Am I missing a step?

14:36 gfredericks: hiredman: what sort of feature is it?

14:36 hiredman: for example if you have multiple user.clj files on the classpath only one is loaded

14:36 nDuff: cmajor7: the advantage of that is that your application logic is completely isolated from the view code

14:36 cmajor7: so you can unit-test it in complete isolation.

14:36 hiredman: gfredericks: it is a little hack that you can use for customizing your personal environment

14:37 gfredericks: there certainly aren't multiple user.clj files involved... :/

14:37 hiredman: gfredericks: if you start using it in projects and then want to mix and match projects

14:38 gfredericks: sure; but I'm having issues with it now and that's not the cause

14:38 just wondering what is

14:38 cmajor7: nDuff: yep, I use "fetch" that relies on "defremotes" (just routes over "host/_fetch/whatever"), so my model is also isolated. as to the output it comes back from the "remote call" async and also picked up by the listener then..

14:39 hiredman: gfredericks: depending on how you are using user.clj it may be on the classpath for compilation, but then not for the uberjar

14:39 gfredericks: hiredman: that also wouldn't explain it; I've wittled the project down so that it's no longer dependent on the user.clj

14:39 there's one namespace (main) and it has the same require (clj-time.core) as in the user.clj

14:39 cmajor7: nDuff: where I am still unsure is: 1. Syncing "other"/"all related" DOM elements on a change (without necessary going over the wire). 2. Periodic sync with the backend to spare the load

14:40 hiredman: gfredericks: could be lein cleaning out non-project class files

14:40 gfredericks: first thing is open the jar and see if the class is in there or not

14:40 gfredericks: hiredman: yeah I was just trying that; it's not in the case when it fails

14:40 and it is otherwise

14:40 so somehow it corrupts the build :/

14:41 nDuff: cmajor7: so, when I've been saying "backend", I didn't mean over-the-wire

14:41 cmajor7: I meant the clojurescript bits that didn't directly deal with the DOM.

14:41 hiredman: what corrupts what?

14:41 gfredericks: hiredman: the existence of the user.clj apparently causes the .class file to not get included

14:41 hiredman: yeah

14:41 gfredericks: well, the existence of user.clj and it calling require

14:42 hiredman: well the user.clj file is loaded before the compilation happens

14:42 gfredericks: if it's commented then it's okay

14:42 hiredman: so stuff loaded due to user.clj will not end up being transitively aot compiler

14:42 aot compiled

14:42 so class files assumed to be there will not be there

14:42 nDuff: cmajor7: ...anyhow -- I mostly don't do much frontend work, so as you're getting towards more interesting/advanced questions, I should probably bow out.

14:42 hiredman: "don't use user.clj"

14:43 gfredericks: yeah :( I just hate all the silly requires for data readers

14:44 ppppaul: i am stumped on a xml-> problem

14:44 anyone interested in helping me?

14:44 gfredericks: hiredman: thanks

14:44 ppppaul: i want to extract multiple values from an xml zipper in 1 go. i am able to do so using (juxt (attr :Id) (attr :Source))

14:45 however i want to go deeper into my object and pull out some more info

14:45 Frozenlock: Eh... turns out I just needed to use the route/resources function.

14:45 matthavener: ppppaul: maybe get-in ?

14:45 cmajor7: nDuff: thx for the perspective anyway. will keep looking.

14:45 ppppaul: doing (xml-> some-path (juxt (attr :Id) (attr :Source) (seq-test [:Size (attr :Width)) throws errors

14:47 matthavener, in all the examples i've seen with zippers, get-in hasn't been used...

14:47 i'll see what i can get out of it

14:47 matthavener: ppppaul: i think i'm wrong

14:48 ppppaul: zippers are arrays of objects of arrays...

14:48 not simply a nested map

14:49 kalizga: ,(+ 40 2)

14:49 clojurebot: 42

14:49 kalizga: ,(with-local-vars [lv 0] (let [a (atom 0)] (time (dotimes [i 10000000] (var-get lv))) (time (dotimes [i 1000000] @a))))

14:49 clojurebot: "Elapsed time: 696.485357 msecs"\n"Elapsed time: 17.247703 msecs"\n

14:49 kalizga: odd how w-l-v is way slower?

14:50 i thought it'd be faster

14:50 wait .. i missed a 0 i think .. jeeez

14:50 tomoj: (xml-> some-path (juxt (attr :Id) (attr :Source) #(xml1-> % :Size (attr :Width)))) ?

14:50 * gfredericks was about to say

14:51 kalizga: but still:

14:51 Bronsa: with-local-vars and var-get? I've never heard of those before

14:51 kalizga: ,(with-local-vars [lv 0] (let [a (atom 0) n 10000000] (time (dotimes [i n] (var-get lv))) (time (dotimes [i n] @a))))

14:51 clojurebot: "Elapsed time: 746.52648 msecs"\n"Elapsed time: 55.51752 msecs"\n

14:52 Bronsa: how is var-get any different than deref?

14:53 technomancy: Bronsa: deref is polymorphic

14:53 kalizga: var-get is to with-local-vars as deref is to atoms (and others)

14:53 technomancy: deref on vars is var-get

14:53 kalizga: ah, it works for those too

14:53 Bronsa: technomancy: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L200-L211

14:53 actually var-get is .get, deref is .deref

14:54 I'm missing how they would behave differently

14:54 technomancy: they don't

14:54 Bronsa: right.

14:55 hiredman: a deref of a var is a locking operation, deref of an atom is not

14:55 tomoj: so why are they different?

14:55 kalizga: hiredman: that would explain the difference in performance .. hmm

14:55 hiredman: atoms use CAS for setting the value, vars are just lock and set

14:55 kalizga: i guess

14:56 makes me wonder what the point of w-l-v is then .. it has, seemingly, zero benefits

14:56 hiredman: yep

14:56 Bronsa: technomancy: so the double implementation is just historic rubbish or.. ?

14:56 technomancy: kalizga: I asked rich that at the last conj

14:56 or two conjes ago?

14:56 kalizga: his answer was ... opaque

14:56 gfredericks: many many conjes ago

14:56 hiredman: vestigial

14:56 technomancy: Bronsa: yeah, implementation detail I'd say

14:56 gfredericks: technomancy: the fact that you asked him indicates that you obviously don't understand the purpose of vars and shouldn't be suggesting changes.

14:57 Bronsa: heh

14:57 technomancy: I shall not question further

14:57 kalizga: opaque? .. like, it illustrates intent? .. self-documenting code? .. or am i reading too much into this .

14:58 (i'm not a native english speaker, either)

14:58 gfredericks: man this would be a good time for @fakerichhickey to say something

14:58 technomancy: kalizga: I just mean unclear

14:58 gfredericks: kalizga: rich's answer to technomancy was not clear

14:58 hiredman: unamed vars (like you get with with-local-vars) predate the existence of atoms as mutable cells

14:58 kalizga: ok, technomancy

14:59 hiredman: but vars are not exactly the same, because you still kind the nested stack of bindings for unamed vars which you do not get for atoms

14:59 TimMc: For a data reader to be available, can it simply be on the classpath some place?

14:59 technomancy: hiredman: right but if you actually write code that way everyone will hate you

14:59 hiredman: no

14:59 TimMc: I'm guessing from gfredericks' complaints that there's more to it than that.

15:00 gfredericks: TimMc: yeah somebody has to require the code

15:00 hiredman: you need an entry in the data-readers map and you need the code to be loaded

15:00 TimMc: Somebody, but not necessarily the current ns.

15:00 gfredericks: TimMc: which is fine if you're reading data at runtime, but lame if you want literals in your code

15:01 TimMc: Aha.

15:01 And wow, that's a lot of opportunity for breakage during refactoring.

15:01 gfredericks: how so?

15:02 it'd break slamhound I bet :)

15:02 TimMc: ns A requires ns B which loads data reader C; A sometimes reads data using C; program is refactored to remove A->B dependency; A sometimes breaks

15:02 hiredman: the alternative is data_readers.clj causes arbitrary code to run

15:02 TimMc: Right, and no one wants that. :-/

15:04 gfredericks: I was hoping wrapping user.clj with (when-not *compile-files*) would help but it's apparently not set at that point

15:04 hiredman: "don't use user.clj"

15:04 gfredericks: :)

15:04 hiredman: speaking of data literals https://github.com/hiredman/bytes

15:04 gfredericks: yeah I was thinking of using that

15:04 also it caused me to view thelastcitadel.com

15:05 hiredman: D:

15:06 gfredericks: I mostly left confused

15:08 hiredman: I can see how that might happen

15:21 Sgeo: https://gist.github.com/Sgeo/de8180f895ff7aed15ea

15:22 Why can't I seem to access the safer-trampoline.private.TrampolineDone class?

15:26 technomancy: hello folks; just deployed a new clojars with fixes to the index; search is now lucene-backed and tweaked to show the latest version properly

15:28 craigbro: oh so much fun

15:28 jhat on 4g heap

15:28 pegging 43 cores

15:28 gfredericks: technomancy: hello.

15:29 craigbro: i want instant answers!

15:32 callenbot: technomancy: "search is now precariously stored in manually managed lucene indices on the filesystem" fixt.

15:33 ;)

15:34 Frozenlock: technomancy: it's weird to see you write "hello", as you never enter or leave the channel :P

15:37 wink: hey language fans, find any errors? any suggestions? http://stuff.art-core.org/Languages3.png

15:38 Sgeo: wink, uh, what does arrow mean?

15:38 gfredericks: Sgeo: "points to"

15:38 Sgeo: Because you have C going to Chicken Scheme and Racket

15:38 wink: implementation language of the compilers :)

15:39 gfredericks: also box means "box" and triangles mean "are triangle with regard to"

15:39 Sgeo: Ah

15:39 hiredman: the javac is written in java

15:39 wink: ok, thanks.

15:39 Sgeo: Where's Pharo and Squeak Smalltalk?

15:40 They're written in Smalltalk and a subset of Smalltalk which gets compiled to C

15:40 hiredman: and them jvm spec does not require a jvm to be written in any particular language

15:40 Sgeo: iiuc

15:40 wink: ok, smalltalk left out for now, noted

15:41 hiredman: and most jvm langs run on other jvms besides openjdk and oracle's

15:41 Sgeo: Also where's Factor? And Forth? And Ada? And COBOL? And ...

15:41 wink: hiredman: are there so many more?

15:41 hiredman: jikes, ibm's

15:41 jam

15:41 * Sgeo is somewhat surprised by the inclusion of Chicken Scheme and Racket

15:42 wink: it's 1h old

15:42 hiredman: cacaojvm?

15:42 apache harmony

15:42 wink: ok..

15:42 Sgeo: I don't see Common Lisp on there

15:42 SBCL is in CL I think?

15:43 TimMc: wink: You might want separate relationships for "compiles to" and "is implemented in".

15:43 hiredman: dunno what kind of jvm is on blackberry phones, but it is some kind of stripped down pre 1.5 jvm so I don't think any langs target it

15:43 Frozenlock: Emacs-lisp?

15:43 wink: TimMc: yeah, true

15:43 TimMc: Also, I'm offended that you didn't include Piet.

15:43 Sgeo: Where's BancSTAR?

15:43 TimMc: Absolutely offended.

15:43 wink: the thing is...

15:43 not sure if trolling :P

15:43 hiredman: the whole point of a vm is to break that chart

15:43 TimMc: :-P

15:44 Sgeo: You have not a chance of including every language of interest

15:44 If you're listing specific implementations, you have even less of a non-chance. How about all the Scheme implementations?

15:45 ljos: TimMc: https://github.com/ljos/clj-piet

15:45 Sgeo: I need to get some sleep

15:48 wink: hiredman: we got to the idea when reading about topaz, ruby in rpython

15:49 .net is also missing completely

15:51 gfredericks: what hath turing completeness wrought

15:51 callenbot: ljos: that's pretty awesome

15:54 ljos: callenbot: :) I made it a while ago over two weeks. Some funky code in there. Still want to do a proper interface for it tough.

15:54 callenbot: ljos: positively obscene :D

15:54 amalloy: we should put together a list of esolangs implemented in clojure

15:55 callenbot: ljos: I'd like a bi-directional interface that generates bit arrays for peit to interpet.

15:55 interpret*

15:55 then I could write my code in clojure, generate the image, then only execute from that

15:56 obfuscation from hell :)

15:56 ljos: callenbot: that would be awsome!

15:57 ppppaul: i'm using compojure and i want to match the "13" on "13_files" in this route "documents/510de753-d1fa-4998-bf9e-f52e999f284a/13_files" is this possible?

15:58 callenbot: ppppaul: Not to be an asshole but: https://github.com/weavejester/compojure/wiki/Routes-In-Detail

15:58 ppppaul: thank you callahad

15:58 callenbot: I'm not an Authurian night.

15:58 knight*

15:58 ppppaul: things just got crazy

15:58 callenbot: ppppaul: I'm a bot, don't talk to me.

15:59 TimMc: ljos: Nice. So now I can run my Brainfuck in a Piet interpreter written in Clojure, which is compiled by Java which is implemented in C or whatever.

16:00 ppppaul: i should have been directed to https://github.com/weavejester/clout

16:01 callenbot: ppppaul: clout is fine too

16:03 ljos: TimMc: It is my goal to offer the maximum amount of language indirection.

16:04 TimMc: And then implement llvm in bf...

16:05 ljos: Don't you just need to implement a llvm backend that compiles to bf and then compile llvm to that backend to do that?

16:11 TimMc: Well, I was just adding more to the top of the stack.

16:12 gmanika: j #riemann

16:14 gfredericks: I have a friend who kept talking about using datomic backed by cassandra backed by datomic

16:15 wink: dat inception

16:18 TimMc: gfredericks: Datomic should cut out the middleman and provide a datomic backing for datomic.

16:18 It's ridiculous that we'd have to interpose Cassandra.

16:19 matthavener: TimMc: isn't that because you only need a backup of the datastore?

16:19 not really a need to get the transcation/query system involved with data storage

16:29 TimMc: Oooh, the next time I have to interview someone, maybe I'll make them discuss various solutions to the *read-eval* problem.

16:29 ...or maybe they'll just run away screaming.

16:30 amalloy: TimMc: you deserve to find someone who solves it by using a language with no reader

16:33 TimMc: :-P

16:35 shaunxcode: at the repl - how can I pretty print a dict containing a tagged literal e.g. I want to pprint {:db/id #db/id [:db/part.db]} w/o the reader trying to actually interp #db/id

16:35 matthavener: it'd be cool to see a read that could ensure only purely functional code with some kind of cpu/memory bound on reading

16:35 so you could have a very flexible reader, bound it with resources, and then accept any user input

16:35 overkill and probably overcomplicated for 99% of use cases, but i agree its a cool interview question TimMc :)

16:38 Frozenlock: TimMc: I would just answer make a function 'read', and a function 'eval'. :p

16:39 Could anyone give me a link to an example using `with-goup' in the hiccup library?

16:41 amalloy: $google hiccup with-group

16:41 lazybot: [Grouping fields in Hiccup - Weavejester's Blog] http://weavejester.com/grouping-fields-in-hiccup

16:42 Frozenlock: ouch

16:43 $duckduckgo hiccup with-group

16:44 amalloy: note that google even gets it right if you try with-goup

16:45 i was actually rather hopeful weavejester had come up with something clever named goup

16:45 grossly offensive user principle?

16:45 borkdude: this style guide got mentioned a lot lately: https://github.com/bbatsov/clojure-style-guide

16:45 is there a leiningen plugin which could check conformance to this style in a project?

16:46 kencausey: Hi. I've been using guile lately for some system scripting stuff as an anodyne to bash. I was wondering if we were anywhere near using clojurescript, say with node, for something near the immediacy of shebang scripts.

16:46 borkdude: and would it be useful to have?

16:46 technomancy: borkdude: closest thing is kibit, but it gives some bad advice too

16:46 amalloy: kencausey: well, i learned a new word today

16:47 kencausey: Sorry for my archaisms. ;)

16:47 tmciver: me too!

16:47 amalloy: kencausey: drip can often get you reasonable startup time for jvm-clojure programs, without having to use cljs/node instead

16:47 TimMc: I learned that one from the Superior Person's Book of Words. :-P

16:48 borkdude: technomancy is there anything like this at all? java has several, like checkstyle, pmd etc?

16:48 kencausey: Well, there is still that annoying compile/build step

16:48 It's not uncommon with hackish scripting to modify the script for some slight variation of a task.

16:48 borkdude: technomancy I'm asking, because maybe it would be a nice assignment for a student

16:48 technomancy: kencausey: I have reached for ocaml when I need that

16:49 kencausey: OK, I'm too addicted to s-exps maybe

16:49 Frozenlock: "Do not place blank lines in the middle of a function or macro definition." I'm guilty on this one. I like to space out things.

16:49 technomancy: borkdude: oh, there is also https://github.com/dakrone/lein-bikeshed

16:49 TimMc: Frozenlock: In cond forms, yeah?

16:49 technomancy: Frozenlock: IMO that only applies when not using cond

16:49 which is part of why I don't use cond very much

16:50 kencausey: If I need vertical whitespace in a proper language I now consider that a smell that suggest refactoring.

16:50 borkdude: a blank line in cond, why?

16:50 kencausey: Clear separations of cases

16:51 TimMc: borkdude: Consider what happens when predicate and consequent add up to more than a line.

16:51 borkdude: I'm still hoping for org-table format cond

16:51 TimMc ok, yes got it

16:51 Frozenlock: technomancy: a recent example. Really long function https://www.refheap.com/paste/9563

16:52 Damnit refheap.el, y u no set clojure as a language!

16:52 technomancy: Frozenlock: needs to become multiple functions

16:53 * technomancy cringes a bit when he commits defns of 20+ lines

16:53 borkdude: hmm, refheap.el, got to check that out

16:54 Frozenlock: technomancy: Yeah I do to, in this case I just translated a js function. I'll look at how I could divide it.

16:55 abp: technomancy: mm then you sure love these: https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/core.clj#L351

16:55 Frozenlock: Still, no blank lines?

16:55 borkdude: yeah, it works, https://www.refheap.com/paste/9565 :-)

16:55 technomancy: abp: my eyes

16:56 Frozenlock: borkdude: a real time-saver

16:57 borkdude: Frozenlock yeh, and it set clojure as a language https://www.refheap.com/paste/9567

16:57 Frozenlock: Hmm I need to look at my .emacs then.

16:58 borkdude: Frozenlock I just installed refheap.el from marmalade

16:58 Frozenlock and didn't customize anything

16:59 Frozenlock I did set the buffer to clojure-mode

16:59 Frozenlock: Ahhh I see, it was a clojurescript buffer.

17:01 There we go: (add-to-list 'refheap-supported-modes '(clojurescript-mode . "Clojure"))

17:02 "Use not= instead of (not (= ...))." Wow this is nice, I'm learning new functions.

17:02 borkdude: I wonder if you can also post non-anonymous posts from emacs?

17:02 Frozenlock: Sure

17:03 (setq refheap-user "Bob Moran")

17:03 (setq refheap-token "zzzzz-xxxxx-xxxx-xxxx-xxxxxx")

17:05 borkdude: Frozenlock yeah! :)https://www.refheap.com/paste/9571

17:09 it would be cool to have smth like http://tryclj.com/ and refheap interact

17:10 or being able to make a clojure snippet a link which posts it to tryclj.com so people could use that in blogs

17:10 Frozenlock: borkdude: Might want to look at `session'

17:10 borkdude: Frozenlock what's that?

17:10 Frozenlock: https://www.youtube.com/watch?v=sSQ1dqqINrQ

17:11 borkdude: Frozenlock is this in public production somewhere?

17:12 Frozenlock: Don't know...

17:12 * nDuff tries to remember the name of the pastebin-with-evaluation he uses

17:12 nDuff: ahh, ideone.com

17:12 matthavener: there's also codepad.org

17:13 nDuff: matthavener: Doesn't look like it supports Clojure

17:13 matthavener: ah yeah, ideone.com has much better lang support

17:14 Frozenlock: how does ideone support clojure?

17:14 I don't see any result...

17:14 borkdude: does ideone also support posting clojure code a query string?

17:14 +as

17:15 nDuff: Frozenlock: You selected "Clojure" from the list, entered your code, clicked "Submit", and don't have output?

17:16 Frozenlock: Yeah... "(+ 1 2)

17:16 nDuff: Frozenlock: http://ideone.com/Sr8jar

17:16 Frozenlock: well, you should have your code print something.

17:16 Frozenlock: Just doing math doesn't emit output.

17:17 borkdude: nDuff I see a style guide thing there ;)

17:17 Frozenlock: I've been spoiled by my repl...

17:24 callenbot: technomancy: sometimes the best way to clean up a large function is to read code that isn't the large function.

17:24 octagon: hi! is there a comprehensive list of clj special forms? i saw the docs page, but i noticed that fn* is missing

17:25 dnolen: octagon: fn* is an implementation detail really.

17:26 octagon: dnolen: i'm writing a macro that is rewriting expressions, and it needs to know to leave special forms alone. fn* may be an implementation detail, but when you do macroexpand-all it shows up

17:26 Frozenlock: octagon: You saw the documentation page? Then you're good to master the language. Godspeed my friend!

17:26 Niak niak niak

17:27 octagon: like is there a clj file in the clojure source where the special forms at the lowest level are defined?

17:29 llasram: octagon: clojure.tools.macro does some of exactly that. Check it out for an existing approach: https://github.com/clojure/tools.macro/blob/master/src/main/clojure/clojure/tools/macro.clj#L31

17:30 (where "exactly-that" -> rewriting expressions, leaving special forms alone)

17:30 octagon: llasram: thanks! that looks very promising

17:30 i knew it must be in there somewhere, and clojure.lang.Compiler/specials certainly makes sense

17:50 Frozenlock: Is there a clojure function to get the current time?

17:50 (other than the java interop java.util.Date.)

17:51 callenbot: Frozenlock: use clj-time.

17:51 Frozenlock: clojure doesn't have a built-in for this just in case it gets ported to a cross-dimensional quantum computer

17:52 Frozenlock: :)

17:52 I would have prefered to not add a dependency just for having time, but thanks!

17:53 callenbot: Frozenlock: just use clj-time.

17:54 Frozenlock: I had a similar thought once. It fucked me with a rake. Just do it.

17:57 llasram: +1, alas

18:01 technomancy: Frozenlock: java.util.Date is mind-blowingly bad

18:01 there is also (System/currentTimeInMillis) or something if you just need a number

18:01 patchwork: Can I set a jvm system property on my system as a whole? I see I can put it in my project.clj (using lein), but I need to set it in a way that won't get pushed into my git repo.

18:01 Any ideas?

18:01 Frozenlock: Don't worry, I do use clj-time for any serious app. This time however I just needed a timestamp.

18:02 technomancy: Ah! Thanks

18:03 hyPiRion: patchwork: You can put it in $LEIN/profiles.clj

18:03 nDuff: I thought the aspect of java.util.Date that spawned the question was that it was Java interop, no? (System/currentTimeInMillis also being a Java thing, after all...)

18:03 hyPiRion: "echo '{:user {:jvm-opts [...]}}' > ~/.lein/profiles.clj"

18:05 patchwork: hyPiRion: Thanks!

18:05 I've only ever used my profiles.clj for plugins

18:05 Did not know it had other functions

18:05 So are all options available in a project.clj settable system-wide in profiles.clj?

18:05 This is the first I've put that together

18:06 technomancy: yup

18:06 well, not system-wide

18:06 user-wide

18:12 hyPiRion: patchwork: Within projects, yes. Outside of projects, unfortunately not

18:12 I'll try and patch that for 2.1.0, though no promises.

18:16 callenbot: oh yes, I am suddenly reminded why I don't use SQL databases.

18:16 * callenbot taps fingers and waits for a migration on a million row table

18:17 durka421: hey, I'm running into this bug, anyone have ideas? https://groups.google.com/forum/?fromgroups=#!topic/clojuredev-users/eh1pjfI_iHQ

18:17 durka42: (cemerick perhaps?)

18:18 hiredman: don't try to read *in* in nrepl or swank, they suck at it

18:19 durka42: yeah, apparently :)

18:19 okay, is there a less stupid way to do this, then

18:19 I have a really long loop

18:19 and I want to press enter between each iteration

18:19 I was just using (read-line) but as discussed that's a bad idea :P

18:20 hiredman: don't loop?

18:20 have a singel step as a function f, and just type (f) for each step

18:21 durka42: maybe...

18:21 it's a fairly complicated loop/recur

18:21 could maybe be refactored that way

18:30 cemerick: durka42: yeah, there's an nREPL issue for it

18:31 Raynes: cemerick: I have no idea how nrepl works, but how does it send error messages to clients?

18:31 cemerick: *in* isn't used much in general, even less given swank/nREPL and the limitations of tools like SLIME, ccw, etc.

18:33 hyPiRion: REPL-y is also funny to work with when it comes to input.

18:33 cemerick: Raynes: The contents of *err* are always streamed in responses; when an error occurs evaluating an expression, a separate response message with a status of :eval-error is sent, containing the classname of the exception and the root exception

18:33 Raynes: grep interruptible_eval.clj for :eval-error

18:34 pushing clj-stacktrace-style data back would be interesting

18:34 Raynes: cemerick: I've noticed in both `lein repl` which is an nREPL backed REPLy and in nrepl.el which is… an nREPL backed… repl, sometimes if I make the same exception happen 3 or more times, I start getting useless exceptions that have no trace.

18:34 I assume this is an nREPL bug, but I don't know where to begin to reliably reproduce it.

18:35 cemerick: Nothing comes to mind as to what would produce that.

18:35 Raynes: It has happened over the past 4 months or so on at least 5 separate occasions in two different projects with random exceptions.

18:36 cemerick: Mostly just telling you so that if anyone else has similar issues you know I did too.

18:36 cemerick: If you can come up with a set of steps to repeat (via `lein repl` ideally), do let me know

18:36 sure :-)

18:36 durka42: I've been getting exceptions with no trace, but I assumed it was a problem with the library...

18:36 Raynes: And will do.

18:36 cemerick: durka42: the REPL won't dump a trace without you asking for it

18:37 durka42: I know

18:37 but occasionally the exception says [no trace] and (e) throws a NPE

18:38 cemerick: there are deranged cases where exceptions won't have traces

18:38 technomancy: some of those could be due to an old clj-stacktrace bug

18:38 cemerick: but, *e should always be bound; if it's not, something bad has definitely happened

18:39 OutOfMemoryErrors can lead to all sorts of nastiness, also

18:39 esp if the OOME is caused in the process of building up a totally unrelated root exception :-P

18:40 durka42: yeah, OOME's are bad...

18:40 I've only gotten it with ClassCastExceptions I think

18:40 anyway, need to relocate

19:22 pppaul: hey guys

19:23 i'm having issues with cheshire again. getting 'add-encoder' does not exist errors again

19:23 updated my gist from last time

19:23 https://gist.github.com/boxxxie/4687633

19:23 on and mac + on ubuntu via vagrant

19:25 hiredman: the first is a lein error, means it cannot find your dependencies, do you have internet?

19:26 pppaul: i do have internets

19:26 i deleted and redownloaded my deps

19:26 technomancy: check the label; they may have sold you arpanets by accident

19:27 pppaul: i posted my lein deps :tree in the gist too

19:28 my internet is fully working

19:29 hiredman: remove dependencies until "lein deps" runs successfully

19:29 take the offending dep out back and shoot it

19:29 pppaul: hmm

19:29 but i need my json

19:30 hiredman: you have multiple problems

19:30 solve one at a time

19:30 first get your build in order, then get your code in order

19:31 if your build is not in order you unable to reproduce code problems reliably and unable to distinguish problems with the build and problems with the code

19:32 technomancy: it's too late to make a joke about PPP and dialup, right?

19:33 hiredman: +++ATH0

19:33 pppaul: hmmm

19:33 ug

19:33 i have this code working on 2 ubuntu 12.10 systems

19:33 matt_d: technomancy: go for it.

19:34 pppaul: i am able to reproduce this error i have on 3 systesms

19:34 technomancy: matt_d: I feel like the moment has passed.

19:34 matt_d: technomancy: yeah, i agree

19:36 Frozenlock: Raynes: So, Firefly?

19:40 pppaul: i updated my gist, i don't have the DEBUG=y lein deps errors anymore, all other snippets are up to date

19:40 rasmusto: technomancy: do you intend for `lein clean` to follow symlinks?

19:40 technomancy: rasmusto: no choice really on JDK6

19:41 that JDK is literally incapable of telling the difference

19:41 rasmusto: technomancy: is that an issue with .isDirectory?

19:41 technomancy: I don't think so

19:41 well, I don't know. been a while since I looked into it.

19:41 I'd take a patch to be more careful if we're running under JDK7, but it didn't exist at the time that was written

19:42 feel free to open an issue

19:42 rasmusto: gotcha. I might have to find another solution/make an issue, I just blew away a few directories :)

19:43 xeqi: pppaul: are you sure that `lein :deps tree` belongs to that project.clj? I don't see chesire in the :dependencies, but its top level in the tree

19:43 technomancy: rasmusto: yeah, it's not ideal

19:46 pppaul: let me check

19:47 xeqi: pppaul: yeah, when I use that project.clj I get libnoir -> chesire 0.4.0

19:47 TimMc: technomancy: So java.nio is the bit that Java 7 adds?

19:48 amalloy: TimMc: java.nio is from java 4

19:48 but i haven't been watching the whole conversation so this may not be relevant

19:48 pppaul: cheshire was in my project deps, but not in the one posted on gist, i updated the gist

19:48 TimMc: amalloy: Ah, it's java.nio.file then.

19:48 pppaul: sorry, posting the project.clj is harder than the other snippets

19:49 technomancy: TimMc: nio2 maybe?

19:49 amalloy: TimMc: yes. at least, some of the stuff there is certainly new, and as far as i know all of it is new

19:49 technomancy: TimMc: only reason I know is that delete-file-recursively didn't get promoted from contrib along with delete-file for this reason

19:49 pppaul: the lein deps :tree is accurate

19:50 amalloy: lord, nio2? whose awful idea of a name was that

19:50 xeqi: new-nio

19:50 TimMc: I don't see a nio2.

19:50 At least, not in the JDK.

19:50 pppaul: lein classpath | tr : \n | grep cheshire -> 5.0.1

19:51 TimMc: pppaul: Dammit, I completely forgot about tr. That would have been useful about 100 times recently.

19:51 pppaul: :)

19:52 amalloy: yeah, i usually use a hacky-looking perl script when i know i should really learn awk, sed, and tr

19:52 technomancy: http://www.baptiste-wicht.com/2010/03/nio-2-path-api-java-7/

19:52 loliveira: what am I doing wrong? https://www.refheap.com/paste/9576

19:53 hiredman: TimMc: there is no nio2, nio2 refers to things added under java.nio.

19:53 pppaul: tr is simple

19:53 i find it works better in fish than in bash

19:53 i don't think bash understands \n

19:53 TimMc: pppaul: Yeah, there's some escape character you have to use first...

19:54 amalloy: $'\n' works, iirc

19:54 TimMc: yeah, that's the one

19:54 rasmusto: technomancy: is it possible to have clojure code with that kind of java interop work with both java 6 and 7? I'm curious how you would make it backwards compatible

19:56 xeqi: &(->> [(true) (false true false false false false true false false)] (group-by identity) (map vals)))

19:56 lazybot: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn

19:56 xeqi: &(->> [true false true false false false false true false false] (group-by identity) (map vals)))

19:56 lazybot: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.Map$Entry

19:56 xeqi: blah

19:57 pppaul: i think i found my cheshire issue… :use / :refer :all isn't working with the lib

19:57 when i namespace via :require :as things seem to work

19:57 wtf?

19:58 xeqi: loliveira: ##(->> [true false true false false false false true false false] (group-by identity) vals)

19:58 lazybot: ⇒ ([true true true] [false false false false false false false])

19:58 xeqi: or you could just (sort) first

19:58 brehaut: pppaul: checked that you are using clojure 1.4? i had a lib pull in 1.3 overriding hte projects dep, resulting in confusing :refer related errors

19:58 pppaul: i was wrong, namespace/add-encoder doesn't exist either

19:59 brehaut how do i check? clojure --version?

19:59 brehaut: ,*clojure-version*

19:59 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

19:59 technomancy: rasmusto: you can check (System/getProperty "java.specification.version")

20:00 loliveira: xeqi: i couldn't sort because the seq returned by foo is very *big*, it wont fit in memory. =(

20:01 pppaul: clojure version {:major 1, :minor 4, :incremental 0, :qualifier nil}

20:01 seems ok

20:01 loliveira: xeqi: or group

20:02 rasmusto: technomancy: are you saying that .isDirectory will return false for symlinks on 1.7? My version is 1.6 now

20:03 technomancy: rasmusto: I think you have to use the Path API to detect symlinks: http://www.baptiste-wicht.com/2010/03/nio-2-path-api-java-7/

20:04 rasmusto: technomancy: ah, okay. So I probably shouldn't use 'lein clean' for the time being

20:08 technomancy: yeah, perhaps a warning in the docstring of lein clean in the mean time?

20:09 rasmusto: technomancy: yes, that would be a good idea. I'm wondering if .isFile could be used with .isDirectory to detect a symlink? maybe not

20:11 hyPiRion: $google java detect symlink

20:11 lazybot: [Java 1.6 - determine symbolic links - Stack Overflow] http://stackoverflow.com/questions/813710/java-1-6-determine-symbolic-links

20:13 hyPiRion: Doesn't sound like the worst thing to implement.

20:15 rasmusto: hyPiRion: ah, that looks like it could work.

20:18 hyPiRion: But well, working on top of a platform-agnostic virtual machine isn't as easy as we would hope it were sometimes.

20:19 technomancy: hyPiRion: the embarrassing side of Java's Smalltalk roots show through

20:22 pppaul: i think my issue was that i was using the ring namespace

20:24 hyPiRion: Oh, someone has named a library after me. How generous of them.

20:24 pppaul: would that cause dep clashes?

20:25 hyPiRion: https://github.com/8thlight/hyperion

20:27 pppaul: i hope that one day someone will name their library after me

20:27 Raynes: amalloy: Pretend that https://github.com/Raynes/lein-pdo's p stands for pppaul.

20:28 amalloy: why are you telling me?

20:29 Raynes: I have no idea.

20:29 hyPiRion: You were clearly interested.

20:29 Raynes: pppaul: ^

20:29 pppaul: :D

20:29 amalloy: i have a job if anyone's interested: highlight me to let me know that Raynes's highlights are relevant

20:29 Raynes: My fingers automatically type your name because I do it so often.

20:30 I've woken up with your name written all over the walls.

20:30 hyPiRion: I hate when that happens.

20:30 amalloy: /part /abort /quit

20:30 /help

20:40 pppaul: in what ways is it possible for a lib a dep requires clash with the same lib, but diff version, that my project depends on?

20:41 Raynes: In every ways.

20:41 pppaul: woah

20:41 Raynes: You can't have two versions at once.

20:41 pppaul: i don't want them

20:41 Raynes: One will be preferred over the other.

20:41 pppaul: hmmm

20:41 how does that work?

20:41 and does that make sense?

20:41 Raynes: Maven should resolve to the newest version, I think.

20:41 pppaul: what if a lib i use needs an older version?

20:42 Raynes: Then you can exclude the newer version from whatever depends on it and the older version will be pulled in. Whether or not it will work for the thing that wanted the newer version is another thing entirely.

20:43 pppaul: my situation is that my project wants v5 of a lib, and a dep wants v4. my project is getting v4, even thought v5 is on the classpath

20:43 at least that's what i believe is happening

20:44 amalloy: if you are getting v4, then v5 is not on the classpath

20:44 or at any rate v4 is on there first

20:45 Raynes: But either way, this is a bad situation.

20:45 pppaul: i only see v5 on the classpath

20:45 i understand that this is a bad situation

20:46 Raynes: `lein deps tree`

20:46 That's a good way to see how things are being resolved.

20:46 pppaul: i have used it

20:46 been on this problem for a day now

20:47 Raynes: So you did `lein classpath` and v4 isn't on there?

20:47 pppaul: ein deps :tree | grep chesh

20:47 [cheshire "5.0.1"]

20:47 devn: Raynes: do you do "TDD"?

20:48 pppaul: when i attempt to use symbols from it's namespace they are not found. when i add my own to the jar they are not found either

20:48 Raynes: devn: No.

20:48 devn: Raynes: i thought that would be the answer, and I am pleased.

20:48 Raynes: devn: What made you ask that?

20:49 devn: Raynes: i was ranting in another channel about how i took testing methodologies to their logical extreme once upon a time and ultimately felt like it was like SEO, an industry invented to sell books.

20:50 Raynes: Heh.

20:50 devn: the dogmatic: "stub this! mock that!" people who always have a book for sale

20:50 "oh! let's do a kata! you know! like we're japanese!"

20:52 pppaul: taking anything to the extreme is usually not practical

20:52 devn: pppaul: taking anything to the extreme is how you figure out how far to take it

20:54 there is value in trying to overdo testing, I just loathe the industry of self-helpish folks who make a living off of telling other people that all they need to be better at programming is a ridiculous amount of verification.

20:54 not trying to parrot rich here at all, but the whole "guard rails" programming thing is apt

20:54 technomancy: devn: luckily it's often easy to smell when people are selling something

20:54 devn: hey! you're 12! just write tests for it!

20:55 technomancy: maybe im doing a bit of that right now

20:55 :\

20:55 the unsell is still a sales technique, yknow?

20:55 pppaul: i just started doing lots of tests for the program i'm writing… it forces complexity down

20:56 it's a bit hard to write tests for complex code

20:57 brehaut: i struggle to understand the reasoning behind being AR about tests, but using a language without expressive static types

20:57 devn: brehaut: it seems pretty reasonable, no?

20:57 pppaul: AR?

20:58 clojurebot: stuartsierra is awesome

20:58 devn: you threw away some verification, so you seek verification elsewhere

20:58 amalloy: (inc clojurebot)

20:58 lazybot: ⇒ 18

20:58 devn: lol

20:58 (inc amalloy)

20:58 lazybot: ⇒ 43

20:58 brehaut: Anal Retentive

20:58 devn: crap, sorry

20:58 didn't mean to push you over the meaning of the universe

20:59 brehaut: don't you think it makes sense to seek verification if your background is in a statically typed language?

20:59 i feel like that's where most of the testing mavens and "classic" testing books came from

21:00 a lot of the "must read" books were written by guys and girls who spent their first 20 years programming in static languages

21:01 brehaut: devn: if their static langauges were C++ and Java, then they dont count

21:01 devn: C? fortran?

21:01 what qualifies?

21:01 and why don't you think that counts?

21:01 brehaut: Haskell, ML, AGDA

21:01 because those langauges dont prove much about your code

21:01 devn: the big push for "test fucking everything" seems to mostly come from java programmers

21:02 brehaut: devn: right. so the first sensible step would be: move to scala

21:02 devn: maybe because you can get away with wasting a lot of time in big companies

21:02 "i'm writing tests..."

21:02 manager: "oh, yes, i've read about that on usenet. carry on."

21:03 "tests aren't finished" is the new "code is compiling"

21:04 blech, whatever, it's too easy to bash on this stuff in this channel

21:04 * devn goes to find a hostile environment where everyone believes that tests are the One True Secret To Programming

21:16 marty_mcfly: devn let me know which channel you end up, id like to read the discussion :]

21:22 xeqi: I <3 my guard rails

21:23 ivan: generative guard rails

21:23 xeqi: even better

21:24 I just lack the skills to apply it to web dev

21:29 amalloy: echo "echo Prevented you from compiling a buggy program" > /usr/bin/cc

21:29 lazybot: "echo Prevented you from compiling a buggy program" > /usr/bin/cc

23:08 tmciver: Hey McFly... I thought I told you never to come in here.

23:19 technomancy: does he know doc_brown is looking for him?

Logging service provided by n01se.net