#clojure log - Sep 24 2013

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

0:01 yeoj___: tufflax: thanks.

0:01 tufflax: yeoj___: np

0:02 allenj12: hmmmm so my a-star function although messy is working except for a case where it seems to not be calling the else part of the if statement

0:03 if anyonr is interested https://www.refheap.com/18938

0:05 dee5: Hello, mind if I ask what the idiomatic way of handling errors is?

0:06 clj_newb_2345: anyone have recommendations of whether to use phonegap or titanium or ... for using clojurescript to do mobile web dev ?

0:18 tufflax: allenj12: I don't believe you. :p

0:20 allenj12: btw you can remove the (if ... true false) around the (= board *goal*) in at-end?

0:22 mgaare: dee5: what kind of errors

0:25 dee5: mgaare: I was thinking more of general error handling. One example would be a validation function. The nicest that I've seen so far is: http://adambard.com/blog/acceptable-error-handling-in-clojure/

0:27 allenj12: tufflax: ahhh kk

0:27 mgaare: dee5: incidentally for validation there's a pretty nice library for that https://github.com/michaelklishin/validateur

0:27 allenj12: tufflax: but why is it not filtering the list of it going backwords ahhh!!!

0:28 mgaare: dee5: but I don't know if there's really such a thing as 'general' error handling

0:31 tufflax: allenj12: I don't understand what you mean :P

0:32 dee5: mgaare: Thanks. Your initial question made me realize that my question wasn't well defined :). That's probably why searching for it didn't turn out too well. Other than that, are exceptions/throwables idiomatic? Or do people prefer error strings?

0:33 allenj12: tufflax: when i use the test case in the code it moves the 0 to the right then back left over and over again because its not filtering the way it should be in get-queue

0:33 mgaare: dee5: philosophically, I think exceptions are ok for exceptional cases, in particular when dealing with IO

0:33 allenj12: when its called in the first line of the second chunk of code in a-sar

0:33 mgaare: like if your database connection dies, I think that's an ok time for an exception

0:34 glosoli: hmm what the easiest way to turn all arguments into a vector ?

0:34 mgaare: glosoli: (fn [& args] (let [arg-v (vec args)])

0:35 dee5: mgaare: Awesome, thanks!

0:35 akurilin: Does anybody have a favorite folder layout for a rest-style ring app? Are any folks using yogthos' compojure-template?

0:36 glosoli: mgaare: thanks sir

0:41 tufflax: allenj12: Paste your code again. I don't think I'm seeing the lastest version. This could not possibly work

0:41 allenj12: tufflax: kk

0:42 https://www.refheap.com/18939 i commented where i thought the problem was

0:43 s4muel: ,(vec '((1 2 3)))

0:43 clojurebot: [(1 2 3)]

0:44 s4muel: ,(apply vec '((1 2 3)))

0:44 clojurebot: [1 2 3]

0:44 s4muel: glosoli: ^

0:45 tufflax: allenj12: How can this code work? The opening parens at line 79 and 83 are surely wrong, no?

0:47 allenj12: tufflax: no there right the 1st one is just daying if were not at the end (first part was to print the end) and the second is if the optional parameter was not passed

0:47 tufflax: sorry i do admit my coding style is atrocious and needs works

0:49 brehaut: ~style

0:49 clojurebot: style is http://mumble.net/~campbell/scheme/style.txt

0:49 tufflax: allenj12: I don't believe you, seriously

0:49 allenj12: tufflax: lol u can try to run it

0:49 tufflax: yeah maybe I have to

0:50 allenj12: tufflax: im rly sry btw ur looking at that mess

0:50 brehaut: allenj12: ^ style above. do not delay

0:50 tufflax: brehaut: look at the opening parens at 79 and 83 and tell me I'm not crazy

0:50 allenj12: tufflax:there good! lol

0:50 tufflax :P

0:50 brehaut: tufflax: i dont eve what

0:52 tufflax: "do not delay" actually loling

0:55 mgaare: allenj12: I did a little reformatting of that paste so it looks more like normally formatted clojure: https://www.refheap.com/75ac8176c680ddc2aee762947

0:56 brehaut: mgaare: good effort

0:57 allenj12: mgaare: ITS sO beautifuL!

0:59 scottj: allenj12: I think you can use case for most of your conds

1:00 mgaare: allenj12: a reasonably stock emacs with clojure mode and a few other things will make it easier to work with

1:00 allenj12: scottj: yea i realized that to but it works for now when i test in light table so i wanna get my logic straight

1:00 mgaare: ive been using light table lol

1:00 mgaare: i might try emacs again

1:01 s4muel: paredit will change your life

1:01 seancorfield: one way or another... :)

1:03 mgaare: I haven't really played with light table as an editor... kind of discouraged to do that now :D

1:04 `cbp: If I have functions foo and bar which have the same arguments [x & {:as opts}], is there a clearer way to apply foo from bar than (apply foo (apply concat [x] opts)) ?

1:04 allenj12: mgaare: if it helps i beleive it makes e learn alot faster

1:05 WTF!! lol i enter the code i think is failing and its outputing it correctly how i want it to

1:07 tufflax: allenj12: the filtering is working?

1:07 allenj12: tufflax: it seems so

1:08 might need to brb in for 10 min

1:08 scottj: allenj12: does LT show the arg list for functions as you're writing function calls? Does it have a built-in way of showing docstrings of those functions?

1:37 allenj12: back

1:37 u guys still there?

1:41 `cbp: hi

1:46 tufflax: allenj12: yes

1:47 allenj12: tufflax: o cool hey did u run that code :P lol

1:47 tufflax: yes

1:48 allenj12: ahh kk what happened? lol

1:51 tufflax: allenj12: i saw some prints then got a stackoverflow :P

1:52 allenj12: tufflax: yea the problem is that it keeps making the move back and forth although thats what the one filter is suppose to prevent

1:52 tufflax: allenj12: but you fixed that, or?

1:53 allenj12: tufflax: lol when i run the copied code in light table it seems to work im very confused aswell

1:53 tufflax: Confused about what?

1:54 I'm not confused :P

1:57 allenj12: its just me then... confused on how the code is not working but it works in light table when i give it examples

1:58 metellus: can you link the code again?

1:58 tufflax: not working when

1:59 OtherRaven: I've got a quick noob question... is there any way to import a java class's static fields/methods, like you can with clojure namespaces?

2:00 metellus: OtherRaven: there are examples here http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

2:01 allenj12: https://www.refheap.com/18942 marked the problem area ish with comments

2:02 scottj: allenj12: println's are missing their parens

2:02 allenj12: where?

2:02 clojurebot: where is amalloy to explain it

2:03 allenj12: scottj: which line?

2:03 scottj: allenj12: ; fix this later

2:03 55-57

2:03 amalloy: (inc clojurebot)

2:03 lazybot: ⇒ 32

2:03 allenj12: scottj: o yes

2:03 scottj: amalloy: that must be annoying

2:04 amalloy: eh. it's only happened once or twice, and it's funny

2:06 allenj12: I think i might be on to something is it possible that..

2:07 since prev-move is a sequence im not filtering correctly

2:07 and have ot pull the head out

2:07 scottj: allenj12: idk, but you can have multiple bindings in a let

2:08 allenj12: e.g. (let [a 1 b 2] ...)

2:08 right now you have (let [a 1] (let [b 2] ..))

2:08 allenj12: scottj: yea i remembered that from before ill fix that

2:08 scottj: now ty :)

2:09 scottj: allenj12: I'd highly recommend an editor that will format that stuff correctly for you, it will make your life much better. I'm surprised LT doesn't do that

2:11 allenj12: scottj: yea agreed im so close after this tho i will

2:11 i updated the lets and it dosnt like it for some reason

2:11 i will paste

2:12 https://www.refheap.com/18943

2:12 scottj: allenj12: only one set of []

2:13 allenj12: scottj: o thats weird ok

2:24 hmm whats the correct way to get an element out of a sequence if its the only elemnt

2:26 metellus: first works

2:26 scottj: allenj12: (first x) or destructuring [x]

2:27 (opps, x is two different things in those examples)

2:29 allenj12: i think its working now!!!

2:29 gotta give it some examples

2:45 this might be really dumb but how do i turn (def board (map (fn [^Character c] (Character/digit c 10)) (read-line))) into a vector instead of a list i keep getting stackoverflow when i try

2:46 callen: allenj12: mapv

2:46 allenj12: map is lazy

2:46 allenj12: you should get a book.

2:47 allenj12: I recommend http://clojurebook.com/ it will deal with a lot of these question marks for you much more efficiently than round-tripping questions like "how do I vector?" on IRC.

2:47 dobry-den: If you had a (db/get-forum forumid) fn and a /forums/:forumid endpoint, would you convert the forumid param into a Long in the Controller, Router, or in db/get-forum (i.e. let it handle strings)

2:47 s4muel: (inc callen)

2:47 lazybot: ⇒ 10

2:47 s4muel: "how do i vector"

2:47 allenj12: callen: THNX! and sorry lol

2:47 callen: allenj12: I also recommend learning to google programming questions. If you plan to do this for a career, googling questions will be at least 1/3 of your job.

2:48 zRecursive: lazybot: (Math/sqrt 1000000)

2:48 callen: allenj12: 90% of the time (your question is one exception) when I answer a question on IRC, I copy and paste their question (exactly, no modifications) into google, check the first link, see that it's the right answer, then paste it right back at them.

2:48 allenj12: callen: yea sorry

2:48 callen: allenj12: usually I do this uncomplainingly, but I'm explaining this to you because I've answered thousands...literally thousands of questions on IRC over the years. Nothing changes.

2:49 almost every question is a google away. Very very very very few are non-trivial.

2:49 allenj12: callen: kk ty ill do that

2:49 callen: and usually you know to whom you should be speaking if they are non-trivial questions.

2:49 like the bantering that happens between dnolen and bbloom.

2:49 allenj12: I'm not saying this to criticize you, I'm explaining the general pattern so that you can learn more efficiently.

2:50 allenj12: also is allen your first or last name?

2:50 dobry-den: callen's going nsa on you bro

2:50 allenj12: callen: no im taking it that way at all btw im happy your willing to teach me how to "fish" as the phrase goes

2:51 callen: ill bit on the nsa its last

2:51 callen: bite

2:51 callen: allenj12: we share a last name :)

2:51 allenj12: callen: lol cool!

2:51 callen: allenj12: my family is from Ohio and WV

2:51 (the Allen ones are anyway)

2:52 allenj12: callen: NJ here im in ny now in RPI

2:52 zRecursive: (+ 1 1)

2:52 clojurebot: 2

2:53 callen: when did clojurebot start evaluating undecorated code?

2:53 zRecursive: (sqrt 1000000)

2:54 callen: that's just mean.

2:54 and probably not going to work.

2:54 zRecursive: lazybot: why donot you eval (Math/sqrt 1000000) ?

2:56 callen: different bot.

2:56 zRecursive: callen: which bot will eval (Math/sqrt 1000000) ?

2:57 callen: find out by querying the bots, but do it in private chat, don't pollute the channel.

2:58 zRecursive: i know, i just test it

2:58 "/msg lazybot ..." doesnot work now

2:59 callen: I am sorry to hear that.

3:21 dobry-den: Spent the past 30 min debugging a problem only to realize I'd forgotten to save the file

3:26 amalloy: dobry-den: what barbaric editor/repl setup do you have where you're loading files by hand?

3:33 dobry-den: i'd emacs. i just forgot to C-x C-s

3:33 Pupnik_: zRecursive: maybe you are missing a trigger symbol for lazybot?

3:37 amalloy: dobry-den: but like...why not C-c C-k?

3:38 dobry-den: amalloy: oh, i was just debugging in the view

3:40 zRecursive: Pupnik_: what is the trigger symbol ?

3:40 ,(+ 1 2)

3:40 clojurebot: 3

3:40 zRecursive: it is "," ?

3:41 dobry-den: &(inc 1)

3:41 lazybot: ⇒ 2

3:42 rurumate: Has anyone worked with cassaforte? I can't figure out how to use create-keypace; there's a "with" function or macro that isn't documented or found in the source: http://reference.clojurecassandra.info/clojurewerkz.cassaforte.cql.html#var-create-keyspace

3:50 s4muel: rurumate: http://mpenet.github.io/hayt/codox/qbits.hayt.html#var-with

3:53 rurumate: s4muel: thanks a lot, I was about to give up..

3:54 s4muel: rurumate: Heh, yeah that dependency is a little opaque

4:05 * ucb waves

4:29 film42424: anyone currently around?

4:30 it's late, I guess

4:30 dang

4:31 ucb: film42424: what's up?

4:31 film42424: So im playing around with lein and repl

4:31 If I drop my code into the repl, I get the correct result back.. compiled.. I don't.

4:32 I'll make a gist really quick

4:32 ucb: ok

4:32 film42424: https://gist.github.com/film42/39738441956f579b0743

4:33 updated as well to show where the results differ

4:34 ucb: film42424: I'm no expert in all things compilation, but how are you calling your compiled code?

4:34 film42424: with lein

4:34 ucb: as in: lein run blah?

4:34 film42424: so I can put (+ 2 2) in -main and it works

4:34 yup

4:35 but for some reason, it's not stepping through the function

4:35 ucb: film42424: oh, you have a map in list-files

4:35 sorry, list-dir

4:36 which is lazy

4:36 so likely the repl is forcing evaluation by trying to print something

4:36 while your compiled code is not

4:36 film42424: hmm.. that makes sense. what should I use there instead?

4:36 * film42424 is still learning

4:37 ucb: film42424: try with doseq

4:37 film42424: doin in

4:40 ucb: You sir, are me freaking hero!!

4:40 ucb: :)

4:40 film42424: srs, thank you! I've been ripping my hair out for a solid hour on that one.

5:05 hhenkel: Hi all, I'm wondering if using nested "doseq" operations is considered evil for walking chosen parts of a tree?

5:09 amalloy: hhenkel: well, not really, although it seems more likely you want either tree-seq, for, or a multi-part doseq, rather than actually nested doseq

5:12 hhenkel: amalloy: okay I found the docs for tree-seq I will look at it. Would should I consider as a multi-part doseq? Do you got a link regarding that?

5:12 amalloy: (doseq [child parent, grandchild child, ...] ...)

5:13 hhenkel: amalloy: Ah, okay wasn't aware that this is possible.

5:14 amalloy: &(doc doseq)

5:14 lazybot: ⇒ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

5:14 amalloy: &(doc for)

5:14 lazybot: ⇒ "Macro ([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost f... https://www.refheap.com/18946

5:14 amalloy: hhenkel: doseq refers to the documentation of "for", but i can see how it would be easy to not notice that

5:18 hhenkel: amalloy: yes, you're right I almost only looked at the provided examples and didn't reconize that. Earlier on I was able to solve the nested doseq stuff with multiple uses of map, but that might also be not that neat?

5:18 amalloy: probably not, but i haven't seen your code

5:25 hhenkel: amalloy: yes, thought you would write that... :) Maybe I'll clean up the mess and post a link later on.

6:19 ddellacosta: can someone tell me what I'm not getting here? This is a lazy sequence, of course:

6:19 &(remove #(= 1 %) [2 3 4 1 5 7 1])

6:19 lazybot: ⇒ (2 3 4 5 7)

6:19 ddellacosta: but this, I thought, would make it into a vector:

6:20 &(doall (remove #(= 1 %) [2 3 4 1 5 7 1]))

6:20 lazybot: ⇒ (2 3 4 5 7)

6:20 ddellacosta: (type (doall (remove #(= 1 %) [2 3 4 1 5 7 1])))

6:20 d'oh

6:20 &(type (doall (remove #(= 1 %) [2 3 4 1 5 7 1])))

6:20 lazybot: ⇒ clojure.lang.LazySeq

6:20 ddellacosta: there we go. So, does doall not do what I thought it did?

6:20 &(doc doall)

6:21 lazybot: ⇒ "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the su... https://www.refheap.com/18948

6:21 ddellacosta: *vector -> collection

6:22 * ddellacosta listens to crickets chirping, cursed to be in the wrong timezone

6:35 s4muel: &(doall (apply vector (remove #(= 1 %) [1 2 1 2])))

6:35 lazybot: ⇒ [2 2]

6:35 seangrov`: &(doall (apply vector (remove #{1} [1 2 1 2])))

6:36 lazybot: ⇒ [2 2]

6:36 hyPiRion: ,(filterv #(not= 1 %) [1 2 1 2])

6:36 clojurebot: [2 2]

6:36 s4muel: TIL.

6:36 hyPiRion: `apply vector` is just `vec` though

6:36 and doall on a vec makes no sense

6:39 ddellacosta: `vec` makes its argument into a vector. All lazy sequences given as input will be realized.

6:39 ,(vec (range 10))

6:39 clojurebot: [0 1 2 3 4 ...]

6:39 s4muel: ,(vec (remove #{1} [1 2 1 2]))

6:39 clojurebot: [2 2]

6:41 ddellacosta: hyPiRion: gotcha, thank you. Yes, I realized my misconception was thinking that doall returns a collection--if I understand it correctly, it should seem that it returns another sequence, but the values will be realized and stored in memory.

6:41 should -> would

6:42 hyPiRion: ddellacosta: yeah. It will actually just return the original sequence, but it will force all values to be realized

6:42 ddellacosta: hyPiRion: ah, right, important distinction.

7:02 mercwithamouth: fds

7:02 oops.

7:02 is 'or' comparible to a ternary operator?

7:03 hyPiRion: `if` is the ternary operator :)

7:04 x ? y : z -> (if x y z)

7:04 mercwithamouth: o_O ;

7:04 i se i see

7:04 ,(or 1 2)

7:05 clojurebot: 1

7:05 mercwithamouth: or just returns the first thing true?

7:05 or?? http://clojuredocs.org/clojure_core/clojure.core/or well no i'm wrong there

7:05 hyPiRion: yeah, or nil if none are true

7:06 mercwithamouth: ahh i see.

7:06 hyPiRion: ,(or false false)

7:06 clojurebot: false

7:06 hyPiRion: well, some falsey value at least

7:06 mercwithamouth: i really should take my 'aspth' to bed... hrmm

7:06 ok..easy enough

7:46 alfborge: I want to do something like this: (ns ... (:require ... [clojure.string :refer [replace :as str-replace]]))

7:46 I know it should be possible, but I fail to find how.

7:47 sm0ke: Hello i have an agent which is a map where values are sets..how do i send a function which adds a new element to the set for a certain key ?

7:47 pyr: alfborge: any reason not to do (:require [clojure.string :as s]) and then calling s/replace ?

7:48 alfborge: pyr: Just that I've used s as a variable name. I can change that if that's how this should be done of course.

7:48 ambrosebs: alfborge: something like (:refer [clojure.string :rename {replace str-replace}). But prefer pyr's approach.

7:48 pyr: alfborge: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/refer mentions rename

7:48 alfborge: but it is no problem if a namespace overlaps with a var

7:49 alfborge: (let [s "foo"] (s/replace "foo" "bar")) will still work

7:49 alfborge: (let [s "foo"] (s/replace s "foo" "bar")) will still work

7:50 sm0ke: is that possible?

7:52 alfborge: pyr: nice, thanks.

7:52 mpenet: yes, some ppl used to do that with jayq to do ($/html ($ :some-id) "whatever")

7:53 ambrosebs: sm0ke: you probably want update-in.

7:54 sm0ke: (update-in {:a #{}} [:a] conj :bar)

7:54 sm0ke: guessing this is how you do it with agents: (send a update-in [:a] conj :bar)

7:55 sm0ke: ambrosebs: does that works if the key is not present?

7:55 ambrosebs: sm0ke: no.

7:56 sm0ke: (send a update-in [:a] #(conj (or % #{}) :bar))

7:56 sm0ke: I think fnil cleans that up too.

7:56 sm0ke: I forget how to use it.

7:57 pyr: ambrosebs: sm0ke: or (send a update-in [:a] (comp conj set) :bar)

7:57 sm0ke: guys what is :a what is :bar?

7:57 pyr: since (set nil) => #{}

7:57 ambrosebs: sm0ke: :a is the the key and :bar is the value you want to add to the set.

7:57 sm0ke: ok thanks let me check that

7:59 i got agent failed with pyr's code

7:59 ambrosebs: sm0ke: try this (send a update-in [:a] (fnil conj #{}) :a)

8:00 pyr: sm0ke: yup dimiss my proposal

8:01 sm0ke: eee

8:01 wrong arity error

8:01 am i defining agent right? (def a (agent {}))

8:02 ambrosebs: ,(send (agent {}) update-in [:a] (fnil conj #{}) :a)

8:02 clojurebot: #<Agent@50646c: {}>

8:02 ambrosebs: sm0ke: I think so. Just guessing TBH. Anyone know how to use agents?

8:02 hyPiRion: results won't show here due to no threads allowed, but yeah, it should work

8:03 works fine here

8:03 pyr: fnil is pretty sweet

8:04 sm0ke: Oh i got it...actually pyr code failed on agent..and i somewhere read you had to do clean-errors or someting?

8:04 i redefined and it passed

8:05 now i need to understand how you did that in one line

8:07 ambrosebs: sm0ke: this might help (send (agent {}) (fn [m] (update-in m [:a] (fn [val] ((fnil conj #{}) val :a))))

8:07 mercwithamouth: does anyone know of any good papers on anonymous functions...or well the philosophy behind them?

8:08 ambrosebs: sm0ke: it takes a bit of getting used to, but basically the first argument gets inserted implicitly for things like update-in and send.

8:08 AimHere: mercwithamouth, "The Lambda Papers"?

8:08 sm0ke: ambrosebs: thanks ...copied to repl :)

8:08 mercwithamouth: AimHere: thanks, taking a look

8:08 ambrosebs: sm0ke: we can take out the "m": (send (agent {}) update-in [:a] (fn [val] ((fnil conj #{}) val :a)))

8:09 sm0ke: and take out the "val": (send (agent {}) update-in [:a] (fnil conj #{}) :a)

8:09 sm0ke: hopefully I got the syntax right.

8:09 sm0ke: just one paren missing from end :D

8:10 ambrosebs: sm0ke: :)

8:11 sm0ke: ambrosebs: weird the first two forms didnt work

8:11 ambrosebs: sm0ke: give me a sec

8:13 sm0ke: atoms are more responsive.

8:13 ,(swap! (atom {}) (fn [m] (update-in m [:a] (fn [val] ((fnil conj #{}) val :b)))))

8:13 clojurebot: {:a #{:b}}

8:14 ambrosebs: ,(swap! (atom {}) update-in [:a] (fn [val] ((fnil conj #{}) val :a)))

8:14 clojurebot: {:a #{:a}}

8:14 ambrosebs: ,(swap! (atom {}) update-in [:a] (fnil conj #{}) :a)

8:14 clojurebot: {:a #{:a}}

8:15 sm0ke: ambrosebs: thanks much for breaking that down..

8:15 ambrosebs: sm0ke: also, don't hesitate to use the longer forms if it's clearer.

8:16 sm0ke: yup..one liners are overrated

8:16 ambrosebs: sm0ke: great for IRC.

8:19 bordatoue: hi could anyone please tell me if it is possible to get a string output from pprint so that I could display it in html format

8:20 ambrosebs: bordatoue: you might want with-out-str

8:20 bordatoue: For example when using pprint/print-table, I would like the output to be displayed in html

8:21 ambrosebs: bordatoue: oh, not sure.

8:21 pyr: ambrosebs: unrelated, but is runtime validation something you're looking into for core.typed

8:21 bordatoue: ambrosebs: thanks, let me try with-out-str

8:21 ambrosebs: pyr: yes.

8:21 pyr: ambrosebs: i'm using clj-schema to validate structures right now

8:21 ambrosebs: and it would be nice having a single definition for compile-time / runtime

8:22 ambrosebs: ok, i just wanted to make sure you considered this as part of core.typed's job as well

8:22 ambrosebs: pyr: it should be core.typed's job to provide runtime predicates for static types.

8:23 pyr: ack

8:23 glosoli: hmm is there something in Ring to convert new line chars from string to br ? or I am confusing the purpose of Ring ?

8:23 ambrosebs: pyr: it's not obvious what's the best way to do it.

8:23 pyr: right now, type checking is a separate phase.

8:24 pyr: something probably needs to be done at compilation/macroexpansion for validation stuff.

8:27 pyr: ah

8:28 ambrosebs: as-in (defn-typed [tag symbol tag symbol] ...)

8:30 ambrosebs: pyr: I think I want to generate top-level predicates based on static types. Then you can use the predicates to do validation, and core.typed will follow it.

8:30 pyr: also `assert-type` would be nice, which casts to a static type at runtime

8:31 pyr: (predicate-for '{:a Number, :b Symbol})

8:31 pyr: (predicate-for MyMap? '{:a Number, :b Symbol})

8:32 pyr: assert-type would definitely fit (and augment) what i'm using clj-schema for

8:33 ambrosebs: pyr: that would make core.typed a much more complete solution. Do want.

8:39 pyr: nice, indeed

8:39 alfborge: Why doesn't this work? (remove empty? [(java.net.URI. "http://example.com")])

8:40 mpenet: ,(doc empty?)

8:40 clojurebot: "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"

8:40 alfborge: *facepalm*

8:41 thanks mpenet

8:41 mpenet: np just acting as a rubber duck

8:52 glosoli: hmm is there something in Enlive I am missing, that could handle \n characters as breaks in paragraph ?

8:52 cgrand: glosoli: you want to convert each \n to <br>?

8:52 glosoli: cgrand: yeah

8:54 cgrand: (interpose {:tag :br} (str/split text #"\n"))

8:54 sm0ke: ,(swap! (atom {:k #{:v1 :v2}}) update-in [:k] disj :v1) ;i learned to do the opposite :D ambrosebs

8:54 clojurebot: {:k #{:v2}}

8:55 cgrand: and pass that to h/content

8:55 ambrosebs: sm0ke: :)

8:56 sm0ke: you probably want (fnil disj #{}) again, otherwise you'll get nil's in your values.

8:56 sm0ke: ambrosebs: but its weird that ##(swap! (atom {:k #{:v1 :v2}}) update-in [:j] disj :v1)

8:56 lazybot: ⇒ {:j nil, :k #{:v1 :v2}}

8:56 sm0ke: exactly thanks

8:58 glosoli: cgrand: thanks sir! :)

9:00 sm0ke: fnil is awesome

9:01 ambrosebs: sm0ke: I can't resist showing it's type. Just as cool https://gist.github.com/frenchy64/6254814

9:03 sm0ke: wow that is the most complex type i have ever seen

9:03 umm..but weird that the doc shows very simple definition

9:04 even the implementation is pretty sweet ...

9:04 lot of multivariate functions though

9:05 ambrosebs: ,(doc fnil)

9:05 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

9:06 sm0ke: ambrosebs: if you look at the source it seems it checks only upto the third argument?

9:06 ambrosebs: sm0ke: the type is complex, but IMO couldn't be simpler to capture the semantics.

9:06 sm0ke: yes that's right.

9:19 sm0ke: umm how do i cherry pick keys from a nested data.. e.g. how do i get :a keys into a seq ? ##(vals {:k1 {:a 1 :b 2} :k2 {:a 2 :b 3}})

9:19 lazybot: ⇒ ({:a 1, :b 2} {:a 2, :b 3})

9:21 sm0ke: aha ##(map :a (vals {:k1 {:a 1 :b 2} :k2 {:a 2 :b 3}})) ; got it

9:21 lazybot: ⇒ (1 2)

9:22 saml: lein search clojure downloads the whole internet

9:22 mdrogalis: sm0ke: Safer to use clojure.walk and pick the keys off.

9:22 Then you don't need to know anything about the nesting ahead of time.

9:23 sm0ke: mdrogalis: any e.g.? is clojure.walk a external lib?

9:23 mdrogalis: ,(use 'clojure.walk)

9:23 clojurebot: nil

9:23 mdrogalis: :)

9:24 sm0ke: ok thanks ill have a look

9:25 also i find myself using a lot of doseq? is that idiomatic way..or i am doing it wrong?

9:25 mdrogalis: sm0ke: Depends. Are you using it for side-effects?

9:25 hyPiRion: sounds very wrong, unless you're doing side-effecty things

9:26 sm0ke: mdrogalis: looking at the code i am doing agent sends .. sends on socket etc..?

9:27 mdrogalis: Side effecty indeed. It's probably fine.

9:27 xeqi: saml: lein search will download indexes from central and clojars, and the central indexes are 90+mbs

9:27 sm0ke: :) thanks

9:28 xeqi: saml: but after that it is faster

9:28 saml: ah i see

9:28 i thought it was downloading the whole internet

9:28 hyPiRion: saml: oh, but you are

9:29 ambrosebs: sm0ke: if you know about the shape of your data ahead of time, I'd get-in over clojure.walk.

9:29 clgv: saml: maven always downloads the whole internet ;)

9:29 sm0ke: ambrosebs: did you mean "dont know"?

9:30 ambrosebs: sm0ke: if you *do* know, use get-in

9:30 hyPiRion: Maven is a DSL for downloading the Internet.

9:31 sm0ke: aye..but if i know my data will contains key :k ...map will work 100% crectly? why would i need walk?

9:31 hyPiRion: I'm a bit surprised that torrent traffic is higher than the Maven downloading traffic.

9:31 ambrosebs: sm0ke: your map example is correct.

9:31 mdrogalis: sm0ke: ambrosebs's advice is good. Consider my suggestion an add-on for stickier situations.

9:32 ambrosebs: sm0ke: if it's nested deeper consider get-in.

9:32 sm0ke: noted..thanks.

9:34 mercwithamouth: clojures 'if' is sort of funky....I see if true it returns the immediate next line and that line only...anything else would fall under what would be an else block in an imperative language. is that just clojures way of saying that if multiple things should happen you need to put it in a function and return that if true?

9:35 mdrogalis: mercwithamouth: Don't think about lines, think about forms.

9:35 mknoszlig: mercwithamouth: you could wrap it in (do ...)

9:35 mdrogalis: mercwithamouth: With if, you get (if (expr) (then) (else))

9:35 One form for expr, then, and else. If you need more, like mknoszlig said, wrap it in a do.

9:36 clgv: hyPiRion: that's easy to explain - hollywood movies arent maven artifcats ;)

9:37 mercwithamouth: mknoszlig: ahh, ok!

9:37 TEttinger: mercwithamouth, there's also when, which executes multiple forms but has no else clause

9:37 hyPiRion: clgv: not yet at least

9:38 mercwithamouth: TEttinger: ok, i'll play with that next...

9:38 mknoszlig: mercwithamouth: usually, needing more than one form in such a place means side effects are happening - do makes it a bit more obvious

9:38 TEttinger: ,(when (> 10 1) 1 2 3 4 (print "yay"))

9:38 clojurebot: yay

9:38 jweiss: is there any straightforward way to write "try to calculate expression x, if it works, bind it to this local and return y, otherwise return z" seems like there's no way to combine try/catch and let this way.

9:38 clgv: ,(when (> 10 1) 1 2 3 4 (print "yay") 5)

9:38 clojurebot: yay5

9:39 TEttinger: jweiss, sounds like one of the when-let functions

9:39 mknoszlig: jweiss: if-let? won't work with exceptions though...

9:39 clgv: jweiss: you are looking for `if-let`

9:39 TEttinger: yeah that

9:39 mknoszlig: jweiss: you could wrap the calculation in try catch that returns nil in the catch

9:40 jweiss: clgv: you mean (if-let [x (try ... (catch Exception e nil))] z) ?

9:40 mknoszlig: jweiss: or roll your own try-let macro ;)

9:40 jweiss: yeah all those require that x can't return nil

9:40 because nil becomes the exception flag

9:40 clgv: jweiss: yep. if you need it often build a macro like mknoszlig suggested

9:40 mknoszlig: jweiss: true

9:41 jweiss: otoh, nil isn't really an extremely useful value?

9:41 jweiss: mknoszlig: of course it is

9:41 mknoszlig: jweiss: for further calculation? hmm...

9:42 jweiss: there's a big difference between "I didn't find the item in the list: nil" and some disk or network failure

9:42 bill610: Anyone have any ideas about this: I want to use clojure to build a web service with a RESTful API that exposes resources stored in a relational database (mysql in this case). I'd like to use a library that, given a specification of the db schema, would translate incoming requests to db queries, or korma constructs. Does that exist?

9:42 mercwithamouth: mknoszlig: hmm i'll keep that in mind

9:43 mknoszlig: jweiss: sure, there's a big difference. not necessarily in the context of the caller, though

9:43 mercwithamouth: ,(when (> 4 5) (print "yay") (print "ok))

9:43 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

9:43 jweiss: mknoszlig: in terms of the result of the if-let test expression i DO need to know the difference between the two

9:43 mercwithamouth: ,(when (> 4 5) (print "yay"))

9:43 clojurebot: nil

9:43 mknoszlig: jweiss: if you need to distinguish here, you're probably better off writing your own macro there

9:44 mercwithamouth: g00d

9:44 ,(when (< 4 5) (print "yay"))

9:44 clojurebot: yay

9:44 jweiss: mknoszlig: ok, was just hoping there was another way :)

9:44 mercwithamouth: ,(when (> 23 5) (print "yay") (print "ok))

9:44 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

9:44 hyPiRion: (defmacro try-let [[vname expr] success failure] (try (let [~vname ~expr] ~success) (catch Exception e# ~failure))) probably

9:45 jweiss: hyPiRion: thanks. this seems like a rather common construct, maybe it's just me :)

9:45 clgv: jweiss: build try-if-let with (try ~@body (catch Throwable t t)) and decide not on nil return but when the return value is a throwable

9:47 bill610: anyone?

9:47 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

9:47 gfredericks: clojurebot: he did ask

9:47 clojurebot: It's greek to me.

9:47 hyPiRion: clojurebot: go back to Greece

9:47 clojurebot: Excuse me?

9:48 mdrogalis: Hello bill610 :)

9:48 mknoszlig: bill610: not aware of a lib like that, sorry

9:48 bill610: mknoszlig: thanks

9:49 clojurebot: thanks for nothing

9:49 clojurebot: No entiendo

9:49 mknoszlig: bill610: sounds like something that'd be kinda fun to build, though ;)

9:49 bill610: mknoszlig: agreed, but my boss would prefer code reuse here :)

9:50 mknoszlig: bill610: yeah, bosses tend to want to leverage oss but not spend money on contributions ;)

9:50 (some of them)

9:51 doomlord_: tempted to try clojure again, but 2 doubts: performance(is it an inherent problem of dynamic-language+more garbage from functional-programming) 2: not a big fan of the jvm. but i'm tempted, i recall enjoying it alot when i tried it.

9:51 dobry-den: doomlord_: where ya coming from?

9:51 mdrogalis: doomlord_: Performance isn't a problem here.

9:52 doomlord_: C++ is what i've used most (asm->c->C++); i've meandered through other languges, settled on Rust for a long while recently. (very different, and a C++ replacement)...

9:52 mknoszlig: doomlord_: no significant issues with performance, but ymmv depending on what you want to do...

9:52 doomlord_: ... but now i'm thinking it would be nice to try and use something that complements c++

9:53 my goals are a bit vague.. but one goal is "a langauge that would make collaborative projects more enjoyable" - from experience in C++ , i despise any form of teamwork.

9:53 i kind of hope functional languages being more composable would lend themselves more to collaborative work.

9:54 I tried haskell, liked many things about it .. but the way you can just throw data together in clojure is very appealing. (haskell struggles with basic records it seems)

9:54 dobry-den: doomlord_: clojure has straight-forward methods for reducing allocation garbage like with http://clojure.org/transients

9:54 well, removing it

9:55 doomlord_: i tried CL - but much prefer the choices in clojure (lisp-1 etc)

9:57 rust is a great language for me but it's very fringe. i figured putting some time into something more established aswell might be nice.

9:58 dobry-den: sounds like you have the chutzpah to give a shot and see if you like it

10:00 doomlord_: hehe got this sort of 'catch22' thing. rust is great, it definitely eases some of the issues that make C++ bad for collaboration (eg not so class oriented, more biased toward referentially transparent code) - but its so fringe that the community of potential collaborators is tiny :)

10:01 TimMc: Is it even finished yet?

10:01 doomlord_: its not v1.0 yet , no

10:01 TimMc: (Another catch-22, of course.)

10:01 Or rather, not a catch-22 so much as a bootstrapping problem.

10:01 doomlord_: in some ways its a great time to be in it - you have a some chance of steering it with contributions

10:01 tbaldridge: doomlord_: I don't forget, Clojure is a 1/2 dynamic language. Vast portions of it are static enough that the JVM JIT optimizes them away or treats them as static. So it's actually very very fast.

10:03 doomlord_: learning a language is one thing. but finding your way around all the libraries & tools is another - I'm begining to think i'll never master anything else to the same extent as C++

10:03 dobry-den: clojure has such a small surface area

10:04 doomlord_: one big + for clojure is the macros. from C/C++ i do find myself wanting them. (rust too has a macro system , better than C, not as good as lisps)

10:05 do many people come to clojure *from java* ? (already familiar with that environment..) i've never used java - and intend to keep it that way.

10:05 jweiss: hyPiRion: the problem with your macro is that the try wraps the success expression when i only want it to wrap the calculation of the local value. this is really the major headache, not so much the error handling as trying to write this without some "magic" return value

10:06 clgv: jweiss: just change the macro then ;)

10:06 jweiss: yeah that's what i'm doing right now

10:06 clgv: return the exception object ^^

10:07 it is very unlikely that this is a valid return value

10:07 jweiss: that's the magic value then right? you have to check whether it's a throwable or not

10:07 clgv: yes

10:07 hyPiRion: jweiss: oh, I see

10:07 jweiss: don't get me wrong, i know it can be done. i was just looking for something "pretty"

10:07 clgv: jweiss: you could also just create a macro-local (Object.) as amgic object

10:08 jweiss: clgv: ah interesting

10:09 hyPiRion: yeah, usually just wrap (let [local# (Object.)] ... (catch Exception e# local#)) and then compare for local#

10:26 devth: seems nrepl does not look for cljs files when requiring a ns. anyone aware of a way to tell it to? google is failing me here.

10:32 xeqi: devth: are you using piggieback?

10:32 devth: xeqi: nope

10:32 checking it out. thanks

10:35 xeqi: devth: you might also look at https://github.com/cemerick/austin

10:35 thats what I've been using lately

10:35 devth: ok cool

10:39 awesome, can now require cljs namespaces from vim with piggieback

10:54 xeqi: anyone have any complaints about the current state of clojure tooling?

10:55 mdeboard: xeqi: I think it's a pretty common source of pain, but it has gotten quite a lot better in the past year or two

10:55 Really my only complaint is the error messages, but that's not Clojure's fault per se

10:55 xeqi: mdeboard: agreed, I'm working on gathering a list of things that could continue to improve

10:55 devth: what are some of those things that have gotten better?

10:56 mdeboard: devth: nrepl, for one. lein has improved (speed- and feature-wise) at a ridiculous pace

10:56 devth: nrepl + vim-fireplace was huge for me.

10:56 yeah

10:56 mdeboard: what's vim-fireplace

10:56 devth: equiv of nrepl.el for vim

10:56 https://github.com/tpope/vim-fireplace

10:56 mdeboard: ah I see

10:57 like nrepl-jack-in basically

10:57 ?

10:57 devth: yeah i guess. haven't tried the emacs setup so don't know exactly what it compares to.

10:57 xeqi: mdeboard: more equivalent to nrepl.el then a specific command

10:57 mdeboard: It's basically "open up clojure file, press alt-x, type `nrepl-jack-in`, hit enter" and it conects to an nrepl instance

10:57 I see

10:58 devth: yeah. it connects, allows eval of exprs, requires namespaces, looks up docs, ...

10:59 i still haven't figured out a good debugger. looked at ritz a bit

11:10 Bronsa: xeqi: no

11:22 silasdavis: Is it cheap to (into {} {:a 1 :b 2 ...})?

11:23 i.e. is it cheap to support sequences representing map treating all inputs the same way?

11:24 maps*

11:27 guns: silasdavis: into uses transients when it can, and I find it is the fastest way to convert between collection types

11:32 silasdavis: guns, yeah I'm just wondering if it is negligible enough to possibly use it redundantly (i.e. even when it's second argument is already a hash-map)?

11:33 guns: silasdavis: it will still run a reduce and so still O(n)

11:33 silasdavis: It's convenient for my function to treat ((:a 1) (:b 2) ...) the same as {:a 1 :b 2 ...}, but if doing so is a big performance hit I won't do it

11:33 guns: if n is small, no problem

11:33 silasdavis: hm I was hoping o(1)

11:35 hyPiRion: not sure if that's possible, actually

11:35 ,(into {} '((:a 1) (:b 2)))

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

11:35 hyPiRion: [:a 1] etc is possible though

11:51 chrisrossi: dumb noob question, if that's ok. perhaps this is lack of imagination on my part, but currently the only way i can figure out to scan a lazy seq without retaining head is to use a loop construct. is there some sexier, more elegant function i just haven't found yet?

11:52 hyPiRion: chrisrossi: What do you mean by "scan a lazy seq"?

11:52 chrisrossi: well, let's say i want to get the nth element of lazy sequence without hanging on to n-1 head elements.

11:53 cmajor7: @chrisrossi: you want

11:53 tbaldridge: ,(nth 40 (range))

11:53 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Number>

11:53 tbaldridge: bleh

11:53 (nth (range) 40)

11:53 chrisrossi: maybe nthrest

11:53 tbaldridge: ,(nth (range) 40)

11:53 clojurebot: 40

11:54 chrisrossi: maybe (first (nthrest the-lazy-seq))

11:54 maybe (first (nthrest n the-lazy-seq))

11:54 cmajor7: @chrisrossi: you will have to realize all the previous elements

11:54 tbaldridge: chrisrossi: why not just use nth?

11:54 cmajor7: @chrisrossi: is that is your question

11:54 @chrisrossi: *if

11:55 chrisrossi: i know i have to realize them, but i want to discard them after they are realized.

11:55 i'm feeling good about nthrest...

11:56 cmajor7: @chrisrossi: so you want to split a seq?

11:56 hyPiRion: just... drop?

11:56 ,(drop 39 (range))

11:56 clojurebot: (39 40 41 42 43 ...)

11:56 jweiss: seems like he just wants to discard some elements and just keep the head to the rest

11:56 sounds like drop :)

11:56 cmajor7: ,(drop 10 (range 20))

11:56 clojurebot: (10 11 12 13 14 ...)

11:56 cmajor7: @chrisrossi: ?

11:57 jweiss: i presume that will realize the elements as it foes

11:57 goes

11:57 chrisrossi: hmm, actually that looks promising too.

11:58 assuming (0 .. 9) are able to be garbage collected.

11:59 cmajor7: @chrisrossi: is your sequence in trillions? :)

11:59 hyPiRion: they are able to be GCed, yes.

11:59 ,(drop 1e7 (range))

12:00 clojurebot: (10000000 10000001 10000002 10000003 10000004 ...)

12:00 chrisrossi: cool, thanks.

12:00 sweeping cobwebs out of brain...

12:00 hyPiRion: In general, functions shouldn't retain heads unless it explicitly tells you it will

12:01 jweiss: on a related note, can you fast forward through a lazy seq *without* realizing the items

12:02 i guess you'd have to split it

12:02 gfredericks: jweiss: still wouldn't work

12:02 chrisrossi: that would be impossible, i'd think.

12:02 jweiss: can't be done?

12:02 chrisrossi: s/would/wouldn't/

12:02 hyPiRion: that's impossible, unless you have wrapped the elements in a delay or something that can defer the computation

12:03 jweiss: so once you realize you don't care about the first x items, it's too late

12:03 you have to have known that before you produce the seq?

12:04 scriptor: since it's a lazy sequence, you won't even know if it has x items in the first place unless you realize them

12:04 jweiss: good point

12:17 TimMc: jweiss: In the general case, lazy seqs require two things for realization: Computation of the basis for the next cell, and computation of the value of the next cell on that basis.

12:18 For instance, in a parallel universe, we might be able to skip the negation in (map - (range 20)), but you couldn't skip the incrementing.

12:20 hyPiRion: TimMc: Didn't amalloy_ work on something to provide that? Perhaps that was for the reducers.

12:30 mercwithamouth: why would one associate an anonymous function to a name?

12:31 bbloom: mercwithamouth: for recursion

12:31 ,((fn rec [x] (if (zero? x) :done (do (prn x) (rec (dec x))) 5)

12:31 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

12:31 bbloom: ,((fn rec [x] (if (zero? x) :done (do (prn x) (rec (dec x))) 5))

12:31 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

12:31 jweiss: local variables too

12:32 bbloom: i can't code in an irc window :-/

12:32 ,((fn rec [x] (if (zero? x) :done (do (pr x) (rec (dec x))))) 5)

12:32 clojurebot: 54321:done

12:32 bbloom: finally.

12:32 mercwithamouth: hmmm

12:33 does joy of clojure go into stuff like that?

12:34 jweiss: ,(let [f (fn [x] (- x 5))] (vector (f 5) (f 6)))

12:34 clojurebot: [0 1]

12:34 mercwithamouth: like the reasoning behind a lot of functional practice?

12:35 jweiss: but that is a different way of assigning a name than bbloom's example

12:36 dobry-den: mercwithamouth: iirc it helps get the idea across more deliberately than most

12:37 i've never even seen (fn name [...] ...) syntax in the wild.

12:38 hyPiRion: I do it when I need non-recur recursion

12:38 xeqi: I've had to do it very rarely

12:38 mercwithamouth: dobry-den: sweet....funny enough secrets of the javascript ninja gives some very decent insight on functional programming

12:40 dobry-den: mercwithamouth: i think the best way in is to just write clojure. compared to scala or ruby or javascript, i find that clojure makes it easiest to just arrive at the functional implementation.

12:41 mercwithamouth: i agree...after a few days of playing with clojure it's definitely replacing scala for me (a language i toyed with off/on for 2 years). it may very well replace ruby as well

12:42 AimHere: I use (fn name [wibble] ... ) syntax is almost necessary for 4clojure!

12:43 hyPiRion: huh, I don't think I've ever used that for 4clojure

12:43 dobry-den: mercwithamouth: cool, i come from ruby. i found things like Ring (https://github.com/ring-clojure/ring/wiki/Concepts) much simpler than Rack.

12:44 ambrosebs: dobry-den: fn names also show up in stack traces

12:44 dobry-den: ambrosebs: oh man. i'm sold

12:44 say no more

12:44 mercwithamouth: dobry-den: that's good to hear...i'm going to start playing with compojure soon

12:46 chris_: are there many jobs in Clojure? I see a lot of people on Hacker News comments saying they work in Clojure, but have never seen a Clojure job advertised

12:46 I'm guessing outside of startups there aren't many opportunities?

12:46 dobry-den: mercwithamouth: it's great. i started working on a forum yesterday to learn Datomic: http://198.58.119.43:3000/. maybe it can help if it doesn't scare you away.

12:46 mtp: find a java job and start writing clojure

12:47 justin_smith: there were many clojure folks at the last pjug meeting (portland or java users group)

12:47 clojure folks as in employed doing clojure

12:47 including me

12:47 chris_: justin_smith: that's good to hear

12:47 justin_smith: that is how we did it - got approved to use java, snuck some clojure in, and the higher ups liked the productivity boost

12:48 the way our tech lead tells it "we snuck clojure in the back end"

12:48 we don't have a strong sexual harrassment policy here

12:48 mercwithamouth: dobry-den: hah, cool! taking a look

12:48 chris_: ha

12:48 ToxicFrog: I wish we had lax enough controls over prod to do that here~

12:48 mercwithamouth: so datomic is a db or an orm?

12:49 chris_: I can't see that flying at my current place of work, not enough autonomy unfortunately

12:49 tbaldridge: mercwithamouth: DB, ORMs are of the devil :-P

12:49 chris_: but perhaps in future I'll be able to do that :-)

12:49 mercwithamouth: tbaldridge: lol

12:49 justin_smith: try a weekend project (on your own time) that fills a company need, see if they let you bring it in

12:49 mercwithamouth: tbaldridge: orms can be nice..but admittingly with clojure..it seems to be f'ing perfect when it comes to modeling and dealing with your data as is

12:50 xeqi: tbaldridge: but my objects are maps

12:50 chris_: sure, i'll have to try that

12:50 dobry-den: datomic's datalog has me hooked

12:52 all the implicit joins makes it sorta easy-mode compared to sql

12:52 hyPiRion: I feel ORMs are too complex. It's essentially just a map with key/values

12:53 adding the possibility to modify the data makes me confused.

12:53 tbaldridge: dobry-den: I love the fact that datalog is optional. Don't like it? You have raw access to the indexes. That is a major win.

12:53 bbloom: <3 datalog

12:53 mercwithamouth: dobry-den: heh it's my intention to go mongo....this is interesting though

12:53 bbloom: <3 raw indexes too

12:53 </3 mongo

12:53 tbaldridge: hyPiRion: right, they work well when both your DB and your language are statically typed. They are pretty much useless when one or the other is dynamic

12:53 bbloom: that's the unary "do not love" operator

12:54 mercwithamouth: looking into it now...

12:54 llasram: bbloom: What does (comp <3 </3) do ?

12:54 tbaldridge: mercwithamouth: after using a Datomic, I'd never go back to a DB like mongo. Datomic has all the good parts of SQL DBs without all the bad parts.

12:55 bbloom: llasram: depends on whether or not <3 is defined for booleans :-)

12:55 tbaldridge: llasram: create a confused girlfriend?

12:55 dobry-den: mercwithamouth: some essential datomic resources: https://github.com/Datomic/day-of-datomic, http://www.learndatalogtoday.org/

12:55 havenwood: tbaldridge: Is Datomic a sane choice for smaller-sized projects?

12:56 I've never used it but very curious.

12:56 tbaldridge: havenwood: I think so, I've used it purely as an in-memory system. If you use it like Clojure you can really look at it as an easy way of adding durability to Clojure collections.

12:56 bbloom: havenwood: depends on what "smaller-sized" means

12:56 dobry-den: havenwood: yeh that's what the free transactor is for

12:57 mercwithamouth: dobry-den: thanks...sigh just what i need. something new to start over with

12:57 tbaldridge: *use it with Clojure

12:57 dobry-den: mercwithamouth: also this dude's screencast is nice: https://groups.google.com/forum/#!topic/datomic/fizUX3dWBPU - shows you some basics. def check out the learn datalog site though. datalog is much cooler than sql

13:01 mercwithamouth: dobry-den: ok, saving

13:02 mdeboard: worst part about clojurescript is that now I'm trying to implement channels in coffeescript

13:02 what have I become

13:02 tbaldridge: mdeboard: does coffescript suport async/await or anything of that sort?

13:03 bbloom: tbaldridge: not main coffeescript, but one or two of the less popular forks do

13:03 mercwithamouth: ahh ok so datomic IS a layer over a number of different databases

13:03 interesting...

13:03 shoerain: technomancy, justin_smith, rasmusto: the reason tab-completion didn't work yesterday was because i was running lein 1.x, not lein 2.x . tab-completion is more narrow now, I guess. Working with .inputrc too. Thought I'd mention it.

13:03 tbaldridge: mdeboard: actually, icedcoffeescript supports async await, if you use one of those, porting core.async is rather trivial

13:03 technomancy: shoerain: aha; nice

13:03 justin_smith: shoerain: awesome, glad you worked it out

13:04 mdeboard: tbaldridge: :o

13:04 rasmusto: shoerain: I figured it might be something like that, since you mentioned a specific version of linux (which is why I asked about apt) :)

13:04 dobry-den: mercwithamouth: or i guess in other words datomic has adapters for various dbs.

13:05 allenj12: whats the best way to bind something in a for loop something like this? (for [pair move] (let [next-move (key pair)] i googled around and couldnt find anything specific for what i want

13:06 bbloom: tbaldridge: icedcoffeescript etc don't make a lot of sense to me. Part of the point of coffeescript is that it's got the same semantics at javascript. if you're going to go all out & change the language semantics & do a much larger transform during compilation, you might as well use cljs :-)

13:06 dnolen: mdeboard: also there's a CoffeeScript pull request to support ES6 yield http://github.com/jashkenas/coffee-script/pull/3078

13:06 dobry-den: like (for [pair move :let [next-move (key pair)] ...)?

13:07 tbaldridge: bbloom: true, I'm just saying, implementing core.async in any language with async/await is pretty simple.

13:07 mdeboard: dnolen: Damn, that's great.

13:07 tbaldridge: I'd be tempted to port it to F#/C# if I actually worked with those languages anymore

13:07 bbloom: tbaldridge: yup, especially without threads

13:07 allenj12: hmmm :let i gotta look what that is hold on

13:07 mdeboard: tbaldridge: But async/await semantics are so nice, I'm not sure what you'd actually gain

13:07 so nice in those languages*

13:08 rasmusto: allenj12: it's just sugar for the code that you had to drop a set of parens

13:08 bbloom: you wouldn't need to add much to C#/F# at all other than maybe a channel type w/ async methods on it

13:08 allenj12: rasmusto: ahh kk

13:09 bbloom: and like a Channel.Alts static method

13:09 tbaldridge: bbloom: yep, that's the beauty, if your system supports listenable promises, we can layer core.async on it.

13:11 mdeboard: dnolen: Co-worker just brought up a good point. Support for yield would violate one of coffeescript's main tenets of being backward compatible

13:11 allenj12: woah i think that for loop broke my light table lol

13:11 its not matching parens anymore

13:11 lol

13:12 dnolen: mdeboard: Ashkenas already chimed in about that pull, seems like he's down.

13:12 mdeboard: another approach is using Traceur which supports ES6 generator syntax, works well from what I've played around with

13:13 rasmusto: allenj12: kill and restart the repl connection, you might want to do a (take 10 (for ...)) to keep it from going infinitely

13:14 allenj12: rasmusto: kk restarting

13:16 rasmusto: hmm looks like its my fault here still yelling :X

13:16 dobry-den: If you had a (db/get-forum forumid) fn and a /forums/:forumid endpoint, would you convert the forumid param into a Long in the Controller, Router, or in db/get-forum (i.e. let it handle strings)

13:20 mdeboard: dnolen: Ultimately it's moot, we're committed to supporting IE9. But that's exciting. I didn't give two shits about front-end stuff before Saturday. Spent the day with CLJS, kind of opened my eyes.

13:22 Really want to use core.async with Clojure where you get actual multithreading out of it. CLJS core.async is nice for "cognitive easing" with highly async code, but you're still constrained to the limitations of your platform.

13:26 allenj12: https://www.refheap.com/18954

13:27 is that right?

13:27 dobry-den: allenj12: i dont see why not

13:28 allenj12: dobry-den: hmm kk it say wrong number of args for line 3 in that paste

13:28 dnolen: mdeboard: what limitations are you talking about beyond single threaded? (Also Traceur lets you use ES6 features by compiling to common denominator JS)

13:31 mdeboard: dnolen: That's pretty much it. Well, that and limited access to underlying OS via the browser APIs (if any)

13:31 But I meant multi-threading.

13:32 dnolen: mdeboard: right, I don't really see the single threaded bit being particularly troublesome when doing serious front end work though.

13:34 dobry-den: allenj12: oh yeah, key is actually a clojure function. i thought it was pseudocode when you first posted it.

13:35 rasmusto: ,(filter #{false} [1 2 false 3])

13:35 clojurebot: ()

13:35 allenj12: dobry-den: o lol does that make it different?

13:35 rasmusto: I probably shouldn't use a set here...

13:35 dobry-den: allenj12: i dont really know what you're trying to do or what you're asking. for instance, if pair is a tuple you can just do (first pair).

13:36 allenj12: dobry-den: i only want the key. im doing a-star and the key contains the action i wanna execute

13:37 dobry-den: it seems though u would day the syntax is the same no?

13:37 dobry-den: for the for loop?

13:39 dobry-den: allenj12: yeah, but didnt you say your prob was on L3

13:39 allenj12: dobry-den: i thought it was but i looked more carefully and its complaining about the for loop saying it has 5 arguments sry i forgot to mention that

13:40 dobry-den: allenj12: ohh yeah it's because of the println line

13:40 for loops can only have one expression in them unlike, say, the body of a `let`. so use `do`

13:40 (do (println ...) (a-star ...))

13:41 allenj12: dobry-den: o weird kk

13:42 mdrogalis: Do you think it's fair to say that RESTful interfaces suffer from the same problems that SQL does?

13:42 e.g. string building to communicate.

13:43 justin_smith: mdrogalis: well they aren't quite as human-operator oriented, IE a request map can be trivially translated to/from an array of arrays of length 2

13:43 sql has more syntax

13:44 mdrogalis: justin_smith: While that's true, REST requires you to know the ordering of the URL structure. /person/:name/:id, for example

13:44 It kind of forces positional URL building on you.

13:44 justin_smith: sure, but that is different from constructing a statement in a language syntax

13:45 in terms of error modes for example

13:45 mdrogalis: justin_smith: Go on.

13:45 justin_smith: I mean you can't call a clojure function without your args in the right order

13:45 that is different from having magic args that transform the function being called (including how other args are interpreted)

13:46 that does happen with special forms of course, but not with most functions

13:46 in sql the meaning of your tokens depends on the analysis of the whole statement

13:47 dobry-den: I'm so used to rest that I can't even think of what an alternative would look like.

13:47 justin_smith: with rest, you need to get the path right, but it is not as open ended as a language

13:47 mdrogalis: Some of those points hold true, but one not wholey so. Function args can be posiitonal, but you weren't munging strings to build it u

13:47 up*

13:47 justin_smith: strings are just an implementation detail

13:47 mdrogalis: I suppose so. Something profoundly bothers me about it the more I consider it.

13:48 justin_smith: the problem with sql is not the strings, it is the fact that it is a language where a small alteration in the form changes how the elements get interpreted

13:49 mdrogalis: justin_smith: Datomic disagrees with your first point.

13:50 Gotta brb

13:51 mlb-: Is there a XML library for clojure which doesn't strip comments when parsing a XML document?

13:52 mdrogalis: mlb-: Unlikely, not where where the comments would go.

13:53 not sure*

13:53 justin_smith: λ_λ

13:55 mlb-: mdrogalis: dependent upon the internal representation each library chooses to expose in clojure, naturally

13:56 mdrogalis: mlb-: I pictured it parsing into something like {x [x x x] etc}, but maybe you'll find something else.

13:57 mlb-: I'm not particularly stuck on how a library might choose to represent it. I'm more stuck on finding a library which *can*

14:01 justin_smith: mlb-: how much xml support do you need?

14:01 enlive will give you a data structure with the comment in it, but does not do xml namespaces etc.

14:02 mlb-: justin_smith: Trying to sell clojure at my $DAYJOB, so parsing with xmlns prefixes and comments would be ideal

14:02 justin_smith: or so the docs claim, haven't tried to do any advanced xml stuff with it, I just use it for page scraping when clients are too lazy to give us data

14:02 ahh

14:02 hmm

14:03 mlb-: I figure worse case, I'll find some enterprise-tastic Java library which does that kitchen sink bit and I'll just write a clojure wrapper for it

14:03 justin_smith: that stuff is a bit outside my experience, so I don't even know how hard it would be to add that onto enlive. But enlive will take an xml and give you a nested data structure, I can paste code showing that

14:03 mlb-: Just hopeful that someone else may have already done the legwork ;]

14:04 justin_smith: mlb-: http://sprunge.us/agSO?clojure example in a repl of using enlive to get a data structure out of some xml

14:06 mlb-: justin_smith: that looks lovely, I'll have to check it out!

14:07 justin_smith: enlive is mostly about the stream parsers that transform that representation (and then recostruct markup out of it again), but lazily I find I can take the initial broken down version, do a few standard manipulations, and reconstruct (with enlive/emit*)

14:21 munderwo: Hi all. I'm playing around with testing in clojure (actually all of clojure really, just learning) and also the clojure koans. When I run the koans using lein it keeps the jam up and watches the code for changes, and automatically re-runs the tests. How do I get my own code to do that?

14:22 Morgawr: hello... I'm trying to run some simple clojure function from java (eclipse project). I cannot, for the life of me, manage to get it to run... I'm following this example http://clojurefun.wordpress.com/2012/12/24/invoking-clojure-code-from-java/ and it keeps saying Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/RT

14:22 I have added the clojure-1.5.1.jar to the eclipse project

14:22 any idea how to do this?

14:24 cmajor7: Morgawr: if you have "import clojure.lang.RT", and you get "java.lang.NoClassDefFoundError" that means that jar is not in _runtime_ classpath

14:25 Morgawr: "clojure-1.5.1.jar" that is

14:25 Morgawr: cmajor7: I see

14:25 I'll try look

14:26 clgv: Morgawr: install Counterclockwise plugin for Eclipse and add the Clojure nature to the project or create a new clojure project

14:26 cmajor7: Morgawr: http://stackoverflow.com/questions/9282440/how-do-i-edit-the-runtime-classpath-in-eclipse

14:26 lynaghk: bbloom: ping

14:27 Morgawr: clgv: I have counterclockwise but I don't want to add a new project, I'll look at the classpath thing

14:27 bbloom: lynaghk: pong

14:27 lynaghk: bbloom: are you aware of anyone using your pretty printing library to make a gofmt sort of thing for Clojure?

14:27 clgv: Morgawr: feel free to shoot yourself in the foot then ;)

14:27 lynaghk: I found an IRC log of you talking about it last year

14:27 gofmt and Clojure, that is.

14:28 In particular, we're standing up a CI server and I'm thinking of some nice things to organize our Clojure projects with.

14:28 technomancy: just shell out to emacs

14:28 bbloom: lynaghk: nothing i know of

14:28 technomancy: =D

14:28 hiredman: lynaghk: lein-bikeshed?

14:28 lynaghk: technomancy: you jest, but...

14:29 hiredman: don't worry, I'm well aware = )

14:29 hiredman: ok :)

14:29 Morgawr: clgv: yeah I know, I appreciate the help :P This is just a quick braindead test.. anyhow doing as cmajor7 said worked, I just forgot to add the clojure jar to the actual classpath

14:29 lynaghk: hiredman: I just want the diffs to be less noisy, and that everyone's editor has a "helpfully 'fix' indentation by default" policy it's going to get out of hand.

14:30 hiredman: ah

14:30 lynaghk: Don't worry, though, I intend on having a nice submission for the "emerging editors" Strange Loop track next year.

14:39 nightshade427: Hi all :)

14:40 allenj12: clojure.lang.lazyseq cannot be cast to clojure.lang.IFn dows that mean im using a seq inplace of a funtion somewhere?

14:40 justin_smith: allenj12: yeah, it means a lazy seq is getting called

14:41 callen: ,((map identity (range 10)) 'blah)

14:41 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn>

14:41 scriptor: you might have the wrong argument order somewhere

14:41 callen: ,((map identity (range 10)) :it :does :not :matter :what :you :put :here)

14:41 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn>

14:42 indigo: Man, why does Pedestal exist

14:42 callen: indigo: god hates us all

14:42 indigo: callen: It feels like it goes against the Clojure philosophy

14:42 callen: it does.

14:42 indigo: the Relevance/Cognitect(?) guys wanted a somewhat...involved CLJ + CLJS framework that was very aggressively complicated in ways that are useful to the kinds of things they make.

14:43 I don't think they made it with the intention of it becoming the web stack of choice for Clojure, at least, I hope not. That would be crazy.

14:43 indigo: But isn't rhickey part of Cognitect now

14:43 callen: Hickey has always been part of Datomic and Relevance AFAIK

14:43 rkneufeld: indigo: yep, we're working to simplify things in pedestal-app as well, but it'll be a long process.

14:43 callen: rkneufeld: thanks for merging that PR btw. I'll be working on that today.

14:44 rkneufeld: callen: good stuff

14:44 callen: rkneufeld: I have to check in on a functional JS meetup talking about Clojure first, but then I'll crank out the improvements to the Korma chapter. These will include not only more involved/interesting examples, but I'll make it REPL friendly too.

14:44 scriptor: what happened to http://clojure.com/reading.html?

14:44 callen: rkneufeld: would you be amenable to a brief prelude at the beginning explaining how to get the sqlite database rolling for the examples?

14:44 (I'm switching it to SQLite so that readers don't have to get PG or MySQL installed)

14:45 indigo: rkneufeld: Cool :)

14:45 rkneufeld: callen: Yeah I think so. We have one or two other recipes that have a non-negligible amount of setup.

14:45 callen: the chapter is already REPL friendly, technically, but again, I don't think Postgres configuration is reasonable to ask of new people.

14:45 so off to the land of fake SQL it is.

14:45 technomancy: callen: don't do that

14:45 xeqi: callen: how about h2 so you can just include a dependency?

14:46 nightshade427: Let me preface with I'm not trolling I genuinely am curious. I saw this and was wondering how it is different than things already done in scheme and Common Lisp for example. Is it so we can have this sorta thing on clojure platform as well? Just curious since from the sound of things on twitter people are "salivating" over it was wondering if there was something new about it.. https://github.com/clojure-numerics/expresso

14:46 callen: xeqi: even better.

14:46 technomancy: use h2

14:46 callen: technomancy: okay. that's fine.

14:46 good idea guys, I forgot H2 existed :)

14:46 technomancy: the jdbc drivers for sqlite are sad face

14:46 callen: Not sure that matters for Korma.

14:46 but duly noted.

14:46 now I'm really glad I brought this up here :)

14:47 shaungilchrist: nightshade427: yes I think the draw is that it is in/plays nice with clojure

14:47 hiredman: technomancy: actually unless you pass a special option to h2 it explodes if you try to use it concurrently

14:47 callen: hiredman: errrr

14:47 hiredman: so derby

14:47 technomancy: hiredman: sqlite doesn't even have a special option tho

14:47 rkneufeld: I don't know that this will be an issue in the context of the recipe. The aim is to have something people can play with at the REPL.

14:47 technomancy: well, it does, but it doesn't work

14:47 nightshade427: shaungilchrist: Okay thanks was just checking :)

14:48 technomancy: but sure, derby =)

14:48 callen: rkneufeld: the initial suggestion of h2 was an improvement regardless. I'll let them finish bikeshedding if they want :P

14:48 does derby vs. H2 really matter for a small REPL example designed to teach a library?

14:49 rkneufeld: callen: I like it for this purpose, too. We're probably going to go with lein-try as a standard across the book. IMO as little setup code as possible is best.

14:49 callen: rkneufeld: oh I already planned on using your plugin for this.

14:49 no shim projects here :)

14:49 lein-try is perfect for this kind of book.

14:49 rkneufeld: callen: I made it specifically for it, actually ;)

14:49 callen: I'm grateful it exists either way.

14:49 rkneufeld: Fallout was that it was kind of useful in general.

14:50 nDuff: technomancy: sqlite doesn't so much explode as spend all its time waiting for locks when used concurrently out-of-the-box, unless the JDBC drivers _really_ break it.

14:50 rkneufeld: Thanks.

14:50 callen: rkneufeld: I use it to poke at libraries all the time.

14:50 nDuff: s/locks/filesystem-level locks/

14:50 indigo: callen: Wait, are you the author of Korma

14:50 callen: indigo: no no. that's Chris Granger.

14:50 I'm the "whip" for Korma.

14:51 indigo: Ahhh

14:51 allenj12: https://www.refheap.com/18958 at line 31 is there a sequence that shouldnt be? i dont think i like clojure errors

14:51 callen: indigo: If you abandon a PR on Korma's github I hunt your ass down and make you write the unit tests.

14:51 indigo: But I always write unit tests if I do a PR :P

14:52 callen: rkneufeld: also, I've been thinking about documenting formatting and the like - are you using asciidoc for the whole Clojure Cookbook?

14:52 indigo: well, not everybody is like you.

14:52 indigo: In fact my PRs are probably the best quality code that I write :P

14:52 callen: indigo: you can check my Twitter feed to see what I mean.

14:52 I don't doubt their PRs are probably some of their best code too, but people forget to write regression/unit tests.

14:52 rkneufeld: I'm actually working on that part of the front matter right now in the conventions branch. You're welcome to take over if you think you can do it this week. I just want to wrap it up before we start writing new recipes and fixing others.

14:52 callen: so...I go Dog the Bounty Hunter on them.

14:53 rkneufeld: hum, no just curious about how to do the authoring side because I might be starting something after Clojure Cup.

14:53 wanted to know if you had any recommendations or if asciidoc was working for you.

14:53 rkneufeld: Personally if I was not doing an O'Reilly book that required Asciidoc I would consider something else/.

14:53 borkdude: today I corrected a bug in a validation function… (let [val get m key] ..) -> (let [val (get m key)] ...

14:53 indigo: Haha nice

14:54 rkneufeld: Markdown if possible; it is less capable, but much easier to work with

14:54 indigo: Glad to see Clojure has such a vibrant community

14:54 callen: s4muel: are you ouvanous?

14:54 borkdude: I used org-mode to write this online 'book': http://michielborkent/clojurecursus

14:54 callen: borkdude: ...com?

14:54 borkdude: typo: http://michielborkent.nl/clojurecursus/

14:54 rkneufeld: indigo: Clojure's IRC is crazy active, but I'm always surprised how inactive the subreddit for it is (in terms of comments)

14:55 borkdude: the text is actually here http://michielborkent.nl/clojurecursus/dictaat.html

14:55 callen: rkneufeld: reddit is...not a nice place.

14:55 there are weird java people on there.

14:55 the java devs on Reddit are really defensive.

14:55 yogthos complains about it all the time :)

14:55 rkneufeld: callen: interesting, I hadn't heard that before.

14:55 indigo: rkneufeld: Probably because real development is done on IRC/github :P

14:55 Mailing lists, too

14:56 callen: that too ^^

14:56 vt100 or bust.

14:56 indigo: But just for kicks I subscribed to /r/clojure

14:56 TimMc: Who mods /r/clojure?

14:56 borkdude: I hardly use the mailing list for clojure - usually twitter and irc .. don't know why

14:56 rkneufeld: indigo: It's still my goto place to see what articles are in vogue at present.

14:56 TimMc: (I currently have reddit on Leechblock, so I can't check for myself.)

14:56 indigo: That usually HN for me

14:57 callen: TimMc: icey, hickey, chouser, cgrand, gnuvince, mac, fogus.

14:57 borkdude: I follow @newsycombinator on twitter which gives me the most important updates

14:57 TimMc: Whoa, lots of mods.

14:57 (thanks)

14:57 rkneufeld: I don't know that many of them actively mod it

14:57 callen: they don't

14:57 there's nothing to mod! (hee haw)

14:58 rkneufeld: callen: hehe. Well, if we ever want to change direction there I could reach out to Rich/Fogus/whomever.

14:58 indigo: I like reading the comments

14:58 There are some really dumb responses ;P

14:58 callen: posting to r/clojure right now :P

14:58 indigo: I should post clauth to /r/clojure

14:59 Maybe someone can figure out why it has what I think is a race condition

14:59 TimMc: I never think to announce new projects there.

14:59 callen: there, post made.

15:00 scriptor: even r/programming isn't as active as other large subs

15:01 callen: because cat pictures.

15:02 indigo: Not everyone's a programmer

15:02 callen: Prismatic + Twitter has replaced most of what I used Twitter for. Dev stuff is IRC + Twitter + mailing lists

15:02 munderwo: Hi all. I've got this snippet https://www.refheap.com/b3ac94bc7029d9f3d051a35ca its a ring handler. Im sending json in the body, and I think I understand that "foodtruck" is not a map that I can just add keys to. Ideally what I want is the body from the request (foodtruck) and add a map to it. How do I do this?

15:02 indigo: I think Reddit's demographic has shifted since it's become more mainstream

15:02 s/it's/its/

15:02 bosie: indigo: towards even whiter folks?

15:03 callen: how do you get Prismatic to not show so much nosie though?

15:03 callen: bosie: complaining at the Prismatic devs everytime their algorithm fails and shoves labia in my face instead of Clojure/dependent types posts.

15:03 twitter is amazing for tech support.

15:04 bosie: callen: i do that hehe

15:04 indigo: Bleh... I got on twitter too late so I couldn't take sparkhom

15:04 bosie: callen: it just seems to be so fluctuating to me

15:04 technomancy: twitter is great for tech support as a user

15:04 pretty rotten for it as a maintainer though =\

15:04 bosie: callen: sometimes i have like a top10 postlist that is superb all the way to the last post and then i have things (esp cycling related) that is just rubbish

15:05 callen: bosie: I watched the strange loop keynote from the prismatic employee, cool stuff.

15:05 she did a good job of emphasizing the importance of feature extraction.

15:05 bosie: sure

15:06 let me google for that

15:06 callen: bosie: you can't.

15:06 bosie: it

15:06 is locked up for 6 months because they partner with InfoQ

15:06 bosie: :(

15:06 callen: I watched it with a coworker who got to go to Strange Loop

15:06 (I didn't get to go)

15:06 she used the projector in a meeting room and is letting me catch up on the talks that way.

15:06 justin_smith: munderwo: there is a ring handler that detects json in the request body and turns it into a map

15:07 cmajor7: callen: what is the keynote about?

15:07 justin_smith: or you could do that processing manually with cheshire if you really wanted to

15:07 bosie: callen: great

15:07 callen: cmajor7: about making Prismatic.

15:07 cmajor7: mostly the data analysis parts.

15:07 fairly lightweight talk but fun.

15:07 bonus: cat gifs.

15:07 justin_smith: munderwo: ring.middleware.json/wrap-json-params

15:08 munderwo: justin_smith: right, I think that already happens, I think I have a middleware that does that. so when food truck comes in its the entire request in a map? or just the body (this is a post handler)

15:08 bosie: callen: we cant watch lambda-calculus-deriving maths all day long... ;)

15:08 cmajor7: callen: https://thestrangeloop.com/sessions/machine-learning-for-relevance-and-serendipity ?

15:08 bosie: callen: was it jenny finkel?

15:09 jbrechtel: She gave a keynote at StrangeLoop about making Prismatic

15:09 almost certainly her talk

15:10 justin_smith: munderwo: ah, I see. yeah, you get a bunch of info in the request. What I like to do is start a repl in the same process running ring, and in the ns with my controller: (defonce debug (atom nil)) (defn my-controller [request] (reset! debug request) ...) then I can just play with the request in the repl and see what I can do with what comes in

15:10 bosie: callen: any idea if there is an android app coming?

15:10 justin_smith: especailly when my frontend guy is simultaneously developing, and maybe deciding what he wants his request to look like, this helps us converge

15:10 tos9: !3

15:10 jbrechtel: bosie: Someone asked that question after her talk. She said they don't have specific plans for it right now (not on their schedule) but it's one of their most request features. :/

15:11 munderwo: justin_smith: oh I don't know how to do that. whats the debug lib? Im coming from Python so being able to break into a repl as some point and looking around would be really helpful.

15:11 justin_smith: munderwo: it is not a lib

15:11 I just create an atom and call it debug

15:11 then use it in a repl to see what I can do with it

15:12 bosie: jbrechtel: indeed ':/'

15:12 justin_smith: munderwo: you can use clojure.tools.nrepl to spawn a repl server from inside your app

15:12 then connect to it from your editor or with lein repl connect <port>

15:13 munderwo: justin_smith: ahh cool. I'll give that a go. Just struggling up the learning curve atm :)

15:13 justin_smith: munderwo: having everything in a repl where you can manipulate it definitely speeds learning

15:13 callen: bosie: no idea, I own an iPhone.

15:14 munderwo: justin_smith: Yeah, I think the issue is getting your head around how to get it all in the repl :)

15:14 justin_smith: munderwo: https://github.com/clojure/tools.nrepl that page describes how to pull in the dep and how to start an nrepl server from inside your code

15:14 callen: cmajor7: think so.

15:14 justin_smith: once you have the repl, you can then (require '[my.controller.namespace :as control]) @control/debug

15:15 to see the contents of that atom, which gets reset with each request

15:15 Jarda: ok, I need a very simple http-json-service. Is ring with compojure the way to go?

15:15 Bracki: Coming from python when I define [& :keys [foo bar]] how do I pass those elsewhere without (baz :foo foo :bar bar) but rather what `**kwargs` would do?

15:16 Jarda: I need to have authentication and serving of json

15:16 justin_smith: Bracki: [& keys [foo bar] :as baz]

15:16 callen: Bracki: kwargs type code isn't as idiomatic in Clojure as it is in Python, just so you know.

15:16 It's fine, there's nothing "wrong" with it, just be aware.

15:17 TimMc: Yes there is. o\__/o

15:17 hyPiRion: ~mapply

15:17 clojurebot: You have to do something like (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))), which just goes to show why unrolled keyword args are a bad idea

15:18 Bracki: ,paste

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

15:19 TimMc: Bracki: A better arglist looks like [a b {:keys [foo bar] :as opts}]. The :as opts is optional, and you can also do something like [a b & [{:keys [foo bar]}]] if you want to make the entire options map itself optional.

15:20 Jarda: about naming conventions should I have src/my_server or src/my-server or src/myserver or src/my/server ?

15:20 TimMc: Jarda: Definitely not src/my-server, since paths have to have underscores instead of hyphens. :-)

15:20 Bracki: http://pastebin.com/59JTLvvF is what I have now

15:21 callen: Bracki: I realizing humping the args/kwargs is the only way to do metaprogramming Python, but you can do better in Clojure.

15:21 Jarda: TimMc: ok

15:21 TimMc: but underscores are ok?

15:22 TimMc: Yes, they correspond to hyphens in namespace names.

15:22 Bracki: What I really want is, if JavaType take java thing, otherwise take a map and construct java thing.

15:22 Jarda: so I can say (:use [my-server]) ?

15:22 TimMc: Jarda: So namespace foo.bar-baz lives in foo/bar_baz.clj in your src dir.

15:22 Jarda: ok thanks

15:23 TimMc: Jarda: You generally want more than one segment in the name; single-segment namespaces can have classloader problems.

15:23 For that reason, my.server (src/my/server.clj) would be better.

15:23 justin_smith: Jarda: also, while use comes up in all the example code you find on the web, it leads to hard to maintain codebases in my experience, it is better to :require with an alias, so when you need to split or refactor namespaces you can see where each function called came from

15:24 Jarda: justin_smith: yes I'm doing it

15:24 justin_smith: ok, just figured I'd mention

15:24 Jarda: thanks all. This channel is a life saver

15:27 jtoy: i see that I can't do multiple line-seqs on a file, how would I do that? Im trying to do this: https://www.refheap.com/18961

15:27 i want to do several different counts on a file

15:28 `cbp: jtoy: make a local that holds the line-seq above p-count

15:29 Bracki: To rephrase it: (def foo(new Foo x y z)), (defn bar [foo]). If foo is a Foo cool, if foo is map construct Foo. Is that common practice?

15:29 nDuff: Huh. Somewhat disappointed to see that not many other folks are using clojure.osgi

15:29 jtoy: `cbp: im not exactly sure what that means, like my-lineseq (line-seq rdr) ,then i can use my-linesq and line-seq seperately?

15:29 nDuff: (or, at least, nobody else has updated it for 1.5.x yet)

15:30 rosster: Has anyone had any success with using rubygems in clojure projects by compiling them to jars using jruby?

15:31 I have manged to get my own ruby code compiled in to a jar and can call it from my clojure project, but I am struggling doing the same with a gem

15:31 Any help would really be appreciated

15:32 `cbp: jtoy: (let [ls (line-seq rdr) ... at the top

15:32 then just reuse ls

15:34 jtoy: line-seq creates a lazy seq of lines. Once you realize it (by using filter/count) the reader will be fully 'read' so you can't really do anything else with it. But you can reuse the seq you have

15:35 Bracki: that's what protocols are for

15:36 jtoy: I use, thank you `cbp

15:36 I see

15:36 `cbp: Bracki: doing stuff according to type i mean

15:37 nDuff: rosster: if you can show us how you call something from Java, we should be able to help you call it from Clojure.

15:40 rosster: nDuff: I am not actually using java (directly anyway), I basically want to take my ruby code and call it from clojure. I have managed to do this, but now that I have added a gem to the project, it seems to be causing problems

15:40 The steps I am doing are as follows:

15:41 jar -cf path/to/myjar.jar -C /path/to/the/gems/ .

15:41 that creates the jar file

15:41 nDuff: rosster: if that jar includes .gem files rather than .class files, it's not actually compiled.

15:41 rosster: and seems to be correct when i inspect it with "jar -tf myjar.jar | less"

15:41 ahh, i see

15:42 so I need to first compile the gem with jrubyc i guess

15:43 nDuff: The exact tooling/process would be a question for the JRuby folks, but something like that, yes.

15:43 callen: I need a life insurance beneficiary. What's a good organization?

15:43 nDuff: the EFF?

15:43 callen: Dunzo. Thanks.

15:45 llasram: rosster: What you probably actually want to do is use Clojure to call the Java API exposed for accessing the JRuby runtime

15:46 Last I checked, jrubyc is not a general-purpose tool. IIRC it basically wraps a ruby script in a class, so that the actual source is embedded in the class

15:46 rosster: nDuff: thanks, checking out jruby forums seeing if someone else has done it

15:46 llasram: rosster: This talk has some info: http://www.infoq.com/presentations/Good-Bad-Ugly-Clojure-JRuby

15:46 rosster: llasram: thanks I see, then I wouldnt need the ruby files compiled

15:47 thanks will check it out now

15:47 llasram: For the JRuby Java API, check out org.jruby.javasupport.JavaEmbedUtils

16:20 Bracki: How do I publish my project to clojars? And, how do I include a dependency on an artifact in a non public/self hosted maven repo?

16:20 Raynes: gf3: hi

16:21 jbrechtel: Bracki: Regarding the dependency you'd include it just like any other dependency. Whoever resolves the dependencies just needs to have a repository with the artifact in their list of repositories.

16:22 Bracki: Can't I fatjar and just include it?

16:22 jbrechtel: Bracki: Also, clojars has a 'dead easy' description of how to publish on their homepage: https://clojars.org/

16:23 Bracki: Haven't done that with a Clojure project but I can't imagine why it wouldn't work...the classes would end up in the classpath. The risk being that if someone else uses a different version of your dependency explicitly then you'll be in a difficult to debug state. But I suppose if the dependency is in a non-public repo to begin with then that's rather unlikely.

16:23 Bracki: jbrechtel: ok, cool.

16:25 trptcolin: trying to reason through some core.async (cljs) tests - i don't see any way to guarantee that assertions in a go block ever get run (https://github.com/clojure/core.async/blob/master/src/test/cljs/cljs/core/async/tests.cljs#L29-L49)

16:26 i.e. i can throw (is= 1 2) in there and that test passes too.

16:26 tbaldridge: trptcolin: there isn't really

16:27 trptcolin: tbaldridge: ok cool, glad i'm not going crazy.

16:30 actually i guess my real question underlying this: is there a way i can exercise & test what happens in some go block? aside from manually testing it?

16:30 or some crazy with-redefs voodoo

16:35 tbaldridge: trptcolin: yeah, give me a few minutes to finish this phone call

16:35 trptcolin: awesome, sure thing

16:36 amalloy: trptcolin: i guess all you can do is test what comes out of it, right?

16:37 trptcolin: amalloy: in clojure-jvm i could do a blocking take

16:40 tbaldridge: trptcolin: the things I did when right those tests that helped was use timeout channels and other go block to check the returns. Also have each test print out "testing...." so you can see if it started running.

16:41 And then realize that some browsers (like chrome) barf up errors into the console. so if you get an assertion failure you will see a console error.

16:41 but yeah, all those options stink, and I don't have a solid answer.

16:41 trptcolin: tbaldridge: hmm, but i think those other go blocks' assertions don't actually get run

16:43 ... since i added some obviously false assertions and the tests still passed. but i'm actually not seeing the "testing..." output via `lein test`, so maybe something else is wrong too...

16:44 tbaldridge: trptcolin: oh yeah, the cljs tests don't run via lein test

16:44 trptcolin: doh, just came to that same conclusion

16:47 ok, got it, and i guess when they run in the browser via script/runtests.html the failed results can happen async and everything's cool

16:47 this makes a lot more sense now, thanks

16:49 allenj12: hello peeps

16:51 Bracki: Hm, how do I deploy a uberjar to clojars?

16:53 TimMc: Bracki: Clojars has information on that, yeah?

16:54 technomancy: that's not really what clojars is for

16:54 it's meant for libraries

16:55 grav_: Is it possible (and idiomatic) to use macros for hiding a global variable?

16:55 Ops, sorry, I'll just change username and repeat the question :-)

16:56 klokbaske: Is it possible (and idiomatic) to use macros for hiding a global variable?

16:56 jweiss: this may of may not help you but i wrote a lein plugin where if you have the plugin you can execute any clojars project - https://github.com/weissjeffm/lein-runproject

16:56 klokbaske: I have an output device which has two buffers, and I have to keep track of the active buffer myself, so I was thinking about hiding it in a macro

16:56 callen: jweiss: https://github.com/rkneufeld/lein-try ?

16:57 jweiss: callen: that's what my plugin is based on

16:57 Bracki: technomancy: I know, but I have to workaround the problem that I depend on a Java lib that hasn't been published to MVN central...

16:57 jweiss: but lein try is more for starting a repl than running :main

16:57 Bracki: you could publish it to clojars

16:58 Bracki: how?

16:58 clojurebot: with style and grace

17:00 jweiss: Bracki: you'd write a short project.clj for it and specify its deps (if any) then deploy it.

17:00 gf3: Raynes: Hay friend

17:02 Bracki: Ah, I see. scp to the rescue...

17:04 TimMc: Bracki: And it is that dependency that you are pushing to clojars?

17:04 mikerod: if you have a var, such as (def myvar (Object.)), when would this (Object.) be eligible for garbage collection? (alter-var-root myvar (constantly nil)) ; would that do it?

17:04 TimMc: Oh, I see -- you're pushing an uberjar containing that dep along with your code. No, better to get just that dependency onto clojars by itself.

17:05 hyPiRion: mikerod: yes

17:05 mikerod: (despite alter-var-root being messy)

17:05 hyPiRion: is there a better way to signal you are done with the var's value and would like it garbage collected? (this is coming up in a series of test namespaces)

17:06 I was thinking

17:06 Bracki: TimMc: yes

17:06 hyPiRion: don't use it as a var if you want it garbage collected

17:07 Bracki: TimMc: just the dependency, no uberjar

17:07 mikerod: (def myvar (atom (Object.)) >> then >> (swap! myvar (constantly nil))

17:07 * Bracki is now in GPG hell

17:07 mikerod: the reference is shared across many testing functions

17:07 TEttinger: Bracki, heh I've been there

17:07 mikerod: then I'm done with it

17:08 I guess I could just do a fixture that dynamically binds it once for all tests or something like that

17:08 mdeboard: Are there any live repls out there for clojurescript?

17:08 Bracki: Should I even worry about GPG or just ignore it?

17:08 hyPiRion: why would you bother to clean up after tests? They aren't loaded when you're uberjaring or `lein run`ing etc

17:08 mikerod: hurting test performance...

17:08 var holds a resource that is expensive to load

17:09 and each test needs a different one of these expensive resources

17:09 TimMc: Bracki: I don't know if you can easily combine GPG with jars that lein didn't build itself.

17:09 seangrov`: mdeboard: austin?

17:09 hyPiRion: so you're benchmarking and testing? Well. I'd guess (alter-var-root ) and then (System/gc) would do it

17:09 mikerod: not benchmarking, it is just annoying to have slow tests

17:10 that sounds fine to me though. if it is any different to you, we are using clojure-maven-plugin (I know, I know; lein is superior)

17:12 allenj12: https://www.refheap.com/18965 anyone know why that for loop isnt getting called?

17:12 hyPiRion: well, you could also put the computation in a delay, and then deref it inside the tests

17:12 if you want to avoid loading it when you're not running those specific tests

17:13 mdeboard: seangrov`: Sorry?

17:14 seangrov`: I'm not in or named austin :P A coworker of mine is bitching about CLJS without ever having touched it, and is asking if there's a live "interpreter" like coffeescript.org has

17:14 mikerod: hyPiRion: I didn't think about that as far as delaying the load time actually (I even used `delay` in this sentence, ironic).

17:15 I'm still thinking we may benefit from having it able to be GC'ed after the test is done, but that is helpful

17:15 scriptor: mdeboard: http://himera.herokuapp.com/index.html

17:15 hyPiRion: mikerod: you can still alter-var-root it afterwards

17:15 (and gc)

17:16 mikerod: hyPiRion: Indeed. Thanks for the advice!

17:16 hyPiRion: np

17:16 mdeboard: scriptor: Awesome, thanks. Does this have the ability to output the javascript at all?

17:17 Bracki: Haha, success! Thanks for the help. Retrieving clj-nsca/clj-nsca/0.0.1/clj-nsca-0.0.1.pom from clojars

17:17 scriptor: hmm, not sure

17:17 dnolen: mdeboard: just wrap in (fn [] ...)

17:17 seangrov`: mdeboard: oh, I see, I was suggestion cemerick's austin, it's a great setup for cljs repl

17:17 scriptor: woah, I didn't know what was possible

17:17 dnolen: mdeboard: but CLJS ain't CoffeeScript we don't try to produce anything pretty - and source maps have landed (though needs some touching up)

17:18 seangrov`: But it's not a web-based repl, there's this though http://www.clojurescript.net/

17:18 scriptor: mdeboard: on top of what dnolen said, this page is pretty nice as a learning aid http://himera.herokuapp.com/synonym.html

17:19 * indigo wonders how long (range) is going to take to crash in cljs

17:20 mdeboard: dnolen: No, I get it. I told him about the 'prettyprint' option etc.

17:21 scriptor: mdeboard: what are his points, anyway?

17:23 mdeboard: scriptor: That he is leery of languages that hide the fact you're writing javascript, he cites GWT as example. That's a general concern of his, he doesn't know much/anything about cljs except what was in rhickey's talk last week. I've just been bleating about channels the psat couple days

17:23 scriptor: his strange loop talk?

17:23 mdeboard: yeah

17:23 scriptor: good talk, but I don't remember a lot of specific mentions of cljs

17:23 other than that async works in it

17:24 mdeboard: exactly :P

17:24 scriptor: other than that async works in it

17:24 er, disregard

17:25 nDuff: mdeboard: there's also clojurescript.net, which is running a self-hosting fork.

17:25 mdeboard: dnolen: Is the current maven artifact for clojurescript working with core.async now?

17:27 allenj12: you can have the else of a for loop just dove right into a (let...) right?

17:28 dnolen: mdeboard: don't think so

17:28 mdeboard: rhickey landed some new goodies, would like to see those ported and tested so perhaps soon?

17:31 mdeboard: dnolen: I see, the channel map/reduce deals? That looked great

17:31 dnolen: yes, happy to see those are to make into the lib

17:31 pbostrom: allenj12: for is lazy, you might want doseq instead

17:31 dnolen: instead of seeing them replicated everywhere

17:31 the mixing stuff looks cool, need to play w/ that.

17:31 noprompt: dnolen: looks like we figured out the bug the other day, it was mapcat.

17:32 dnolen: noprompt: sorry context is gone, mapcat?

17:32 allenj12: pbostrom: o ill try it

17:32 noprompt: dnolen: wrt our conversation yesterday about dynamic vars in cljs. it turns out they weren't the culprit.

17:32 allenj12: pbostrom: do i keep the (do...) with doseq?

17:32 dnolen: noprompt: good to hear, but a bug or not a bug?

17:33 pbostrom: allenj12: it won't hurt, but doseq should have an implicit do

17:33 noprompt: dnolen: i'm not sure if it's a bug or not, but according to the PR author the behavior of `mapcat` is different in cljs.

17:34 dnolen: noprompt: sounds like a bug - different how?

17:34 allenj12: pbostrom: ThNX!

17:35 noprompt: dnolen: i'm not exactly sure. i'll ask for some more details in the thread.

17:36 amalloy: noprompt, dnolen: a quick peek at the source makes me think mapcat is more lazy in cljs than in clj-jvm

17:36 allenj12: pbostrom: is there a way once i find an answer to stop and ouput cause it seems to solve but keeps going through the loop and laying out all configurations lol

17:38 amalloy: because jvm's versions of apply, concat, and mapcat dispatch on arities up to 4, it has to realize the first four-ish elements of each input collection; if this doesn't happen in cljs, it might expose the error in some code that incorrectly depends on it being realized earlier, eg by expecting a dynamic var to be bound

17:39 noprompt: amalloy: ha, i was just about to ask you if that would have any effect on realization.

17:40 dnolen: let me see if i can't replicate the issue.

17:52 squidz: [5~

17:52 rasmusto: squidz: gesundheit

18:12 allenj12: is there an idiomatic way to "break" when in a recursive funtion that tries to complete a doseq

18:14 noprompt: dnolen: here's the gist https://gist.github.com/noprompt/6691714

18:15 dnolen: i suppose i could simplify it abit.

18:16 rasmusto: allenj12: you can (doseq [blah someseq :while (somecondition)] (do foo), dunno if that helps

18:16 dnolen: noprompt: I don't know why people think that should work

18:16 noprompt: you need a doall around the mapcat

18:16 noprompt: which is what amalloy was alluding to

18:17 noprompt: dnolen: really? but why the difference between clj and cljs?

18:17 dnolen: noprompt: different implementation but the fact that it works in clj is sheer luck

18:17 amalloy: noprompt: yeah, that is rubbish. in a perfect world, (binding [foo bar] (mapcat ...)) is exactly identical to (mapcat ...)

18:17 allenj12: rasmusto: wait so could i make a global variable and set it to true when the condition is met. because even if one doseq break i have a whole recurive chain of doeqs left

18:18 noprompt: well ok. i feel like an idiot.

18:18 amalloy: clj-jvm does some optimizations that make things more eager, which means it sometimes works

18:18 rasmusto: allenj12: no, I'm not saying to make a global variable, are you saying that your doseqs are called recursively and could be infinite at any of those calls?

18:18 allenj12: rasmusto: im gonna try that but ill also show my code

18:18 dnolen: noprompt: nah, binding + laziness burns pretty everyone at least once

18:18 amalloy: at least twice, really

18:19 dnolen: haha

18:19 Bracki: This whole map,:keys as arguments keeps confusing me. Are (foo {:a 1 :b 1}) and (foo :a 1 :b 1} equivalent?

18:19 allenj12: rasmusto: not infinite but can check a whole search space... so close to infinite as far as memory is concerned

18:19 noprompt: wow, well that was an easy fix.

18:19 :P

18:19 allenj12: rasmusto: https://www.refheap.com/18968 it recurively call a-start towards the bottom

18:19 rasmusto: allenj12: do you use 'for' to make them lazy?

18:20 allenj12: rasmusto: no because it wouldnt print at all remember? :P

18:20 amalloy: Bracki: no

18:20 Bracki: amalloy: How do I convert the first into the second?

18:21 rasmusto: well, doseq'll realize them unless you give them a stop condition afaik

18:21 noprompt: i need to start a blog titled "Clojure Burns"

18:22 the good thing is i can delete some code now. :)

18:25 Glenjamin: is it better to use a binding over just passing the context into an inner function in the above example?

18:27 TEttinger: gah super noob question. I need to convert this line of java to clojure: atlas = new TextureAtlas(Gdx.files.internal("packedimages/pack"));

18:27 files is static, and I can't figure out how to do the . on a static public member

18:27 TimMc: noprompt: I would like that.

18:28 allenj12: rasmusto: so would a global variable be "taboo" i dont see how else to make the stop condition w/o one. im probably not being clever enough tho

18:29 Glenjamin: TEttinger maybe this? http://clojure.org/java_interop#Java%20Interop-Classname/staticField

18:29 TimMc: noprompt: It would make a good clojure-docs section as well.

18:29 cmajor7: TEttinger: (TextureAtlas. (.internal Gdx$files "packedimages/pack"))

18:30 TEttinger: cmajor7, really this is a use for $ ? I thought I wouldn't need it, thanks

18:30 noprompt: TimMc: if i could just find the time and motivation to blog though.

18:30 cmajor7: TEttinger: or if "internal" is static => (TextureAtlas. (Gdx$files/internal "packedimages/pack"))

18:30 TEttinger: I will check

18:31 (inc cmajor7)

18:31 lazybot: ⇒ 1

18:31 muhoo: wow, that's kinky

18:31 TimMc: noprompt: Would you like some motivation? I could threaten to throw a wolverine into your bed if you don't do it.

18:31 noprompt: ehf, this programming stuff is not for the faint of heart.

18:31 TimMc: that would probably kill me.

18:32 TEttinger: cmajor7, nope. Caused by: java.lang.RuntimeException: Unable to resolve symbol: Gdx$files in this context

18:32 Glenjamin: try Gdx/files

18:32 if it's a static member of Gdx

18:32 noprompt: *sigh* i was offered another front-end javascript job this week. they're not interested in cljs. :(

18:32 Glenjamin: so (.internal Gdx/files "packedimages/pack")

18:33 cmajor7: TEttinger: ok, I thought "files" is inner class. If it is static, then Gdx/files

18:33 TEttinger: cmajor7, Glenjamin, thanks, I'll keep at it

18:33 allenj12: Tettinger: o hey were u the one interested in my A*

18:33 TEttinger: yup

18:33 noprompt: dnolen: i need a good sales pitch. :)

18:33 muhoo: noprompt: do it on contract?

18:34 noprompt: muhoo: no it's a *job* job.

18:34 muhoo: i.e. "i'll deliver this thing adn you needn't worry about what language it's written in"

18:34 allenj12: Tettinger: if u wanna see progress its here https://www.refheap.com/18968 just need to make a breaking point somehow and i should be good to go

18:35 hyPiRion: muhoo: "But I want to hire some guy later if something goes wrong, and I need to ensure I can get a guy understanding said language"

18:35 dnolen: noprompt: heh, well I'm assuming that's because they have maintain it?

18:35 scriptor: noprompt: the vast majority of places aren't, unfortunately

18:35 muhoo: noprompt: oh, then the sales pitch is "you won't need another headcount". and if you think you can do it a lot faster/better in cljs than js, "it'll cost you a shit-ton less money and will ship faster if i do it turnkey in cljs"

18:35 noprompt: muhoo: contract js sure. but i get to write clj/cljs at my current job (cause i work alone and call the shots). asking me to give that up and write raw js, is eh, not the direction i want to move in.

18:36 dnolen: they're mostly afraid that if i left no one could maintain it.

18:36 dnolen: noprompt: right

18:36 noprompt: dnolen: but i assure them i was more than willing to explain it.

18:36 and that i wouldn't bail in like a year or something.

18:36 scriptor: getting a whole team to learn a new language takes time

18:37 muhoo: noprompt: there's nothing wrong with walking away from the offer.

18:37 Bracki: https://github.com/bracki/clj-nsca/blob/master/src/clj_nsca/core.clj#L8 <- I assume this isn't the best way of doing it. Should I just take a single argument instead?

18:37 hyPiRion: Getting a whole team to understand a codebase may take significantly much more time, actually.

18:37 That's the problem though, because people don't realize that.

18:37 noprompt: muhoo: i know. it's just funny cause i know these people and it's like um, have you heard a word i've said the past year?

18:37 technomancy: "Use Clojure; you will have an easier time retaining easily-bored empolyees."

18:38 practically sells itself

18:38 talios: "don't use hibernate, you'll not make them cry either" :)

18:39 noprompt: technomancy: that's a bumper sticker.

18:39 s4muel: noprompt: if they have not motivated themselves to not write "plain" javascript, it is doubtful you will be able to foist clojurescript on them as some sort of city on a hill, despite your admonitions to use cljs or clojure or god-please-just-no-more-js. Either it's political or they don't care

18:39 noprompt: I DON'T BELIEVE THE LIBERAL PROGRAMMING MEDIA.

18:40 mdeboard: ^

18:40 Bill O'Reilly is on to you guys.

18:40 muhoo: it's all a conspiracy.

18:41 * muhoo looks around nervously

18:41 talios: mmm, java code generated by the current frege compiler SO much nicer to deal with from java. nice.

18:41 noprompt: s4muel: similar thoughts had crossed my mind. essentially, i think they want me to turn a pile of jQuery/underscore code in to something more sophisticated and maintainable. by the sound of what they wanted to do, the thought of writing that soley in pure javascript was horrifying.

18:42 i'm not saying you can't write large code bases in raw js. certainly you can with a strong team of competent people.

18:42 but if you're looking for one person to maintain a large code base in javascript, i don't think raw js is the way to go. i've seen what that looks like and it's not pretty.

18:43 scriptor: noprompt: have you worked on a large codebase in clojurescript?

18:43 dnolen: writing a large pile of underscore.js and jQuery does not excite me

18:43 mdeboard: ^

18:43 noprompt: scriptor: i'm working on one now.

18:43 dnolen: noprompt: so are you going to use Backbone ?

18:43 mdeboard: Smashing the DOM with $ until it succumbs to your will

18:43 TEttinger: gahhh speaking of $

18:44 dnolen: noprompt: I don't really believe in MVC but it doesn't provide some modicum of structured thinking

18:44 noprompt: dnolen: no. i'd probably go with angularjs if there was absolutely no way i could convince them to think about letting me write clojurescript.

18:44 dnolen: noprompt: gotcha

18:44 TEttinger: can't seem to get this static mess of java interop to work

18:44 dnolen: er s/doesn't/does re: MVC

18:44 TEttinger: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/Files.java?source=c#L61 this is the line I need to call

18:45 I keep getting a NPE with different variants on calls

18:45 noprompt: dnolen: it's less the sheer number of available resources for js, than it is mutability, quirks, and the overall "insane" vibe i get programming in the language.

18:46 clj_less_newby: nrepl

18:46 TEttinger: it;s possible Gdx is null....

18:46 (def packed (TextureAtlas. (.internal (. Gdx files) "res/slashem-packed/pack"))) ;; my current line

18:46 clj_less_newby: when clojure.tools.namesapce.refresh gives an error, is there a way to see it in emacs rather than the terminal where lein was started?

18:47 noprompt: idk, maybe i'm just a whiny little baby who doesn't have the cojones to brogram in js.

18:47 Glenjamin: heh, it depends what you define as "raw js"

18:48 noprompt: dnolen: are you still at the times? is clojurescript in use there?

18:48 Glenjamin: splitting into proper modules and writing tests makes a big difference

18:48 vijaykiran: why does kibit suggest using (set ...) instead of (into {} ...) ?

18:48 dnolen: noprompt: yep, no CLJS as of yet, though someone presented it here and I wasn't involved at all so the word is getting out.

18:48 Bracki: Can somebody point me to a good multi arity, maps as arguments what not tutorial.

18:48 amalloy: TEttinger: i don't get it. that looks like the only possible way you could call it; if you get an NPE, then one of the following is null: Gdx, Gdx.files, or the result of calling .internal

18:49 and you can easily test which of those it is

18:49 TEttinger: yep, on it

18:50 noprompt: dnolen: that's really cool. the application i'm working on now is clj/cljs and i'm hoping that when i share it with the other papers in the company it will raise awareness and gain some interest.

18:50 TEttinger: amalloy, it's files. files is nil. gaaaah

18:50 noprompt: dnolen: most of the developers in the company use js/php/python, so i'm kind of excited to share a "real world" solution written in clojure w/ the company.

18:51 `cbp: more like a real language amirite

18:51 * `cbp hides

18:52 amalloy: `cbp: thanks man, what we really need in this channel is irrelevant bashing of other languages

18:52 `cbp: =P

18:53 sinsnare|awayyyy: TEttinger: libgdx!

18:54 TEttinger: hey sinsnare|awayyyy

18:54 sinsnare|awayyyy: hey, i have to go, but i saw a Gdx, and had to speak out!

18:54 TEttinger: what about it?

18:55 have you gotten it to work?

18:55 sinsnare|awayyyy: im working on doing libgdx in multiple languages https://github.com/libgdx/libgdx/wiki/Using-libgdx-with-other-jvm-languages gonna add sub articles

18:55 TEttinger: ah cool

18:55 well if you know why files could possibly be nil...

18:55 sinsnare|awayyyy: working on jython right now, and when i get frustrated with jython, clojure, then after i get frustrated...

18:55 TEttinger: Gdx/files

18:55 sinsnare|awayyyy: it shouldnt be

18:56 #libgdx might be helpful, but i do have to go!!!

18:57 (.internal (. Gdx files) isnt how its done

18:57 (.internal Gdx/files "assets/droplet.png")

18:57 but yeah....

18:59 rasmusto: allenj12: sorry, I'm distracted atm. I don't think a global would be "idiomatic", to say the least. You may want to explore generating lazy seqs, and printing them out as you traverse them, making sure you don't fully realize them

19:02 amalloy: TEttinger, sinsnare: Gdx/files would be the more typical way to write it, but it will macroexpand to the same thing

19:02 allenj12: rasmusto: hmmm kk

19:03 gfredericks: is it weird that aset expands to a call to RT? do we expect the jvm to optimize that away?

19:03 (rather than explicitely have a mechanism for doing a raw array set)

19:04 dnolen: gfredericks: calls to RT will get inlined so not sure it matters much

19:04 gfredericks: well calls like that anyway

19:05 gfredericks: dnolen: good to know, thx

19:08 amalloy: gfredericks: check out https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Intrinsics.java

19:10 basically whenever bytecode to call one of these methods would be generated, instead a call to the corresponding simple-instruction is generated. the RT methods are mostly there as placeholders for macros to expand into

19:11 (and so that reflection can solve it in cases where the types aren't known at compile time, of course)

19:12 gfredericks: hmm

19:12 I'm currently fighting with the type hints

19:13 dnolen: gfredericks: array type hints?

19:13 gfredericks: yeah

19:14 trying to use an int array

19:14 and my aset keeps reflecting

19:14 clojurebot: Cool story bro.

19:14 dnolen: using ^ints ?

19:14 gfredericks: yeah

19:14 Unable to resolve classname: clojure.core/ints

19:14 this is from a macro

19:14 so maybe it's expanding it

19:14 or something like that

19:14 I guess I don't do type hints from macros much :)

19:14 hiredman: the index also needs to be a known type

19:15 gfredericks: I'm gonna type-hint the symbol and unquote it in

19:15 rather than trusting syntax quote

19:15 dnolen: gfredericks: oh you're doing this in a macro?

19:15 amalloy: gfredericks: inside a macro you don't want to do it that way

19:16 `(aset ~(with-meta xs '{:tag ints}) ...), for example

19:16 gfredericks: yeah that's about what I ended up with

19:16 amalloy: the point is the macro needs to emit a symbol with a typehint, as opposed to containing a typehint for its own internals

19:17 gfredericks: yeah; I knew that once my attention was drawn to it

19:17 thx folks

19:17 * gfredericks reruns his (bench ...)

19:19 gfredericks: love it when things get 1000 times faster :)

19:19 reflection's great for making you feel like you know how to optimize code

19:22 now to try unchecked-math

19:29 over twice as fast :)

19:29 I'd forgotten computers could do things this fast

19:29 hiredman: gfredericks: did you see the ndarray thread on the ml?

19:29 hyPiRion: gfredericks: now do it in parallel on a GPU

19:30 gfredericks: hyPiRion: that is mystic stuff

19:30 hiredman: maybe not? clojure-dev?

19:30 hyPiRion: welcome to my world

19:30 hiredman: gfredericks: https://groups.google.com/d/msg/clojure/Mq0jsIS_Y-o/L1eFwF8ac60J

19:31 gfredericks: hiredman: thanks, this'll be interesting

19:41 muhoo: -funroll_loops

19:51 llasram: muhoo: http://funroll-loops.info/ ?

20:08 * indigo wishes PHP had macros :(

20:09 akurilin: Howdy. I'm trying to figure out how to keep my site's front-end resources outside of the uberjar so that they can be edited separately without the web app having to be restarted. I feel like this is something a lot of people must have dealt with before.

20:09 I'm not sure what the best practice in java for this is. Do you somehow just relative path to a separate folder from within your code?

20:10 technomancy: cdn?

20:11 akurilin: technomancy, let's keep it on the same box for now. I'm thinking templated html files etc as well.

20:11 In the real world CDN would probably be ideal.

20:12 technomancy: putting a dir on the classpath is easy enough

20:13 akurilin: technomancy, so if I'm understanding correctly, just add a dir to the classpath that's relative to the jar file? So for example have an uberjar and an assets/ folder in the same folder?

20:13 justin_smith: akurilin: we use s3 for that

20:13 there are decent clojure bindings for the service

20:14 technomancy: akurilin: doesn't have to be relative to the jar file

20:14 akurilin: justin_smith, is there an advantage to having these files hosted on s3 as opposed to being loadable from the same disk the service is running on?

20:15 justin_smith: akurilin: it can help page load time, theoretically, since two different servers' bandwidth is used (in reality that depends on the CDN's bandwidth of course)

20:16 akurilin: justin_smith, ok interesting

20:16 justin_smith: there is the typical cloud advantage of seamless scaling etc.

20:16 also for our app that lets us cache dynamically resized images, and serve them all (so only one server needs to resize one time, regardless of instance count / restart on the cloud)

20:17 ie. a request asks for a particular image size, that gets made once and served multiple times

20:18 akurilin: That's as lot of people dropping.

20:19 I was going to say is that I'm going to have to read up on the java io model, since I keep being redirected to the classpath all the time and I'm not nearly as familiar with it as I should be.

20:21 technomancy: clojure.java.io/resource will just get you an input-stream you can read from without having to care whether it's from a dir or in a jar

20:50 ToBeReplaced: i feel like i write (loop [] (when-not (.isInterrupted (Thread/currentThread)) ... (recur))) a lot

20:50 when people have services that run forever... how do they wrap it up in development mode for start/stop? is the above standard?

20:53 chord: callen i'm on chapter 13 of learn you a haskell

20:53 thats right i'm almost done

20:53 you thought that I would fail to finish

20:54 callen: so after i'm finished I need you to have that clojure book done so I can start reading it

20:54 callen are you even there?

20:54 wtf is callen doing

20:56 hyPiRion: reading that clojure book maybe

20:57 mdeboard: You guys have a weird bromance

20:57 chord/callen

20:59 dobry-den: ToBeReplaced: dang, should i be doing that? i just loop and have it return a channel

21:00 sandbags: I hope this question will make sense: when you're talking to a clojure nrepl (e.g. using Vim fireplace) is there some way of diverting it's stdin & stdout to the nrepl console session?

21:00 ToBeReplaced: dobry-den: idk how I would do it all with core.async -- good point

21:01 if i have a system that needs to launch a few dedicated threads, i usually create something like a "start" and "stop" fn that kick them off in futures

21:01 justin_smith: sandbags: maybe you could bind some var to *out* in the repl (that representing the output being used in the repl) then pass it in so it can be explicilty bind *out* in the code that is not yet printing to the right place

21:02 I have been thinking about how this could be fixed as well. It happens when you make new threads.

21:02 is it because *out* is thread local so you need to pass it in to other threads if you want it shared?

21:02 ToBeReplaced: dobry-den: if they are loops inside of core.async go blocks... i have no idea what i would do to signal "stop doing things"... i guess you would have them read off a poison channel on each iteration?

21:02 chord: mdeboard you know where callen is?

21:03 indigo: He's probably working; he has a job, you know :P

21:03 sandbags: justin_smith: i'm not really sure... this is all a bit above me at the moment and i am trying to muddle my way through it

21:03 i've been trying to read the code of nrepl

21:03 but not making much useful headway

21:03 justin_smith: hmm

21:04 sandbags: it is in things happening in threads that output goes to the wrong place, right?

21:05 sandbags: justin_smith: if you execute the clojure.main/repl function from vim fireplace you hang Vim because, i presume, the nrepl attempting to execute the repl function is hung waiting for input that will never come

21:05 justin_smith: hmm

21:05 sandbags: justin_smith: so i am wondering how i can have that nrepl process that is evaluating the code wire it's stdin & stdout to something you can interact with

21:05 justin_smith: yeah, I don't know, I haven't used fireplace at all

21:05 sandbags: justin_smith: fireplace is just talking to nrepl

21:06 using the "op" "eval" "code" "(clojure code)" protocol

21:06 justin_smith: the *out* and *in* vars always refer to the currently default out and in ports

21:06 sandbags: (at least, so far as i can tell that's all its doing)

21:06 justin_smith: so if you pass those in, you should be able to access them in your code

21:07 sandbags: well... pass in from where would be the issue

21:07 chord: indigo: can you tell callen to quit his job

21:07 sandbags: they would need to be prewired to something running in that local nrepl process

21:07 indigo: I sure can. I won't, though, because I'm sure he enjoys it :)

21:09 dobry-den: ToBeReplaced: yeah i don't know how you'd handle a tight loop

21:10 sandbags: interesting, it looks like nrepl uses clojure.main/repl under the hood

21:10 i'm not sure it helps me but interesting anyway :)

21:10 dobry-den: although having a start and stop fn translates directly to having a start and stop channel that sit in the process in their own blocks waiting for something to come out of their channel

21:12 ToBeReplaced: dobry-den: is there an equivalent of "offer" and "poll" in async?

21:13 justin_smith: ToBeReplaced: alts! is kind of like poll

21:13 serves the first channel to return a value out of varargs channels

21:14 ToBeReplaced: justin_smith: i see, with :default

21:15 so yeah... i guess if you want to start/stop consumers/producers you have them alts! for poison?

21:15 justin_smith: I think that is the pattern. I am still learning how to use core.async myself

21:16 chord: indigo: you going to help with starcraft clone written in clojure

21:16 justin_smith: well for starting you could have a channel with a go block looping on it, and for stopping it you could close that channel

21:16 dobry-den: taking/putting on an unbuffered channel also blocks.

21:17 indigo: chord: Nah, I have better things to do... like fixing up clauth

21:17 justin_smith: s/starting/triggering

21:17 indigo: Anyway I'm too noob at Clojure to even consider a starcraft clone

21:17 film42424: this be some cool stuff: http://blog.getprismatic.com/blog/2013/4/29/faster-better-dom-manipulation-with-dommy-and-clojurescript?utm_source=dlvr.it&utm_medium=twitter

21:17 chord: WTF GO LEARN CLOJURE

21:17 indigo: chord: I know, right?

21:18 film42424: Thought it was relevant for discussion

21:18 chord: wtf you doing in this channel if you're not even learning

21:18 * film42424 has no affiliation

21:18 indigo: I never said I wasn't learning ;)

21:18 chord: https://www.youtube.com/watch?v=NiCy5igO9-I&feature=player_embedded#t=0

21:19 ToBeReplaced: justin_smith: dobry-den: thinking more, it's definitely all about the channels... if you want to stop consuming, just close it off at the producer, and stop trying to take when you read nil

21:19 or if you are producing elsewhere, close that channel

21:20 justin_smith: ToBeReplaced: afaik if you try to read a closed channel in a go block, that will kill the go block

21:20 you could test that though

21:20 film42424: chord: that's insane!

21:21 ToBeReplaced: justin_smith: you just read nil iirc

21:23 chord: so film4242 you gonna make starcraft clone with clojure?

21:23 justin_smith: ToBeReplaced: oh, you are right, I just tested it

21:24 so I should be testing if I read nil from the channel, and bail when I do

21:25 ToBeReplaced: or just (when-let [value (<! channel)] ...)

21:25 dobry-den: the nil return is what enables semantics like a when-let in a loop

21:25 yeah

21:29 ToBeReplaced: if you need inspiration, rob pike's Go Concurrency Patterns talk (http://www.youtube.com/watch?v=f6kdp27TYZs) has some cool arrangements

21:30 ToBeReplaced: whoaaaaa major commit to async yesterday by rhickey -- pubsub, stream functions, etc

21:33 justin_smith: cool

21:34 `cbp: what's with this clojure starcraft clone? :-o

21:34 chord: Haskell > Go > Clojure

21:35 `cbp: flamebait!

21:35 indigo: `cbp: He's trolled #ruby, #python, and #haskell

21:35 chord: `cbp: why are you against clojure starcraft clone

21:35 indigo you making stuff up

21:36 indigo: chord: Nono, I have logs

21:36 chord: I call bullshit

21:36 indigo: Also you're on their banlists :\

21:36 chord: how can you see the banlists liar

21:36 indigo: You go /bans

21:36 chord: nothing happened in this channel

21:36 nice lie

21:37 film42424: Could someone look at some code for me and tell how I can write it better?

21:37 justin_smith: I can try

21:38 ddellacosta: film42424: give us a refheap

21:38 `cbp: film42424: sure in my limited capacity

21:38 film42424: https://github.com/film42/list-em-with-clojure/blob/master/src/list_em/core.clj

21:38 danielszmulewicz: anybody knows how to display the jetty log when working in emacs with nrepl

21:39 mtp: why does it feel like i'm reading java?

21:39 film42424: cause you kinda are :/

21:39 I'm learning though

21:39 mtp: okay

21:40 i would probably make list-dir build up a tree as it recurs, and try to eliminate the global

21:40 but i don't know clojure well enough to say much more than that

21:40 ddellacosta: film42424: I don't think it's so bad. But have you taken a look at https://github.com/Raynes/fs ?

21:40 film42424: ddellacosta: That's a great find!

21:41 ddellacosta: film42424: may save you a bit of trouble. ;-)

21:41 chord: who here wants to join starcraft clone clojure project

21:41 film42424: mtp: I totally agree.. just trying to make it work first.. but that's what i'm gonna do next

21:42 hyPiRion: film42424: yeah, if you're able to do as mtp said, you're good code-wise

21:42 lgs32a: has anyone figured out already why the new merge in core.async only takes two channels?

21:42 film42424: thanks :)

21:42 justin_smith: film42424: if you made the master-list a set rather than vec, you would pre-empt the eventuality of adding the same file to it twice.

21:43 but then it would be unordered

21:43 film42424: good thinking.. i think im gonna work on not overwriting a global var tho

21:43 hyPiRion: justin_smith: but that would never happen

21:43 film42424: you guys are awesome though!

21:43 srs thank you :)

21:44 justin_smith: hyPiRion: cyclical symlinked dirs

21:44 which would also make a stack overflow with the code as is

21:44 hyPiRion: if you are sane

21:44 film42424: I wonder how java.io.File handles sym links

21:46 justin_smith: film42424: easy enough to test in the repl, no?

21:46 I think this may be related to the .cannonicalPath method

21:47 film42424: ill check in a min.. first imma drop in this fs lib

21:47 justin_smith: * .getCanonicalPath

21:47 hyPiRion: film42424: This is what we do in Leiningen: https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/utils.clj#L31-L39

21:48 justin_smith: yeah, (.getCanonicalPath (java.io.File. "symlink")) returns "/path/to/original"

21:48 film42424: ahhh

21:48 hyPiRion: we generate the canonical file and check if it's equal to the absolute file

22:19 rlb: Is it possible to ask lein to run arbitrary commands before or after a given stage via the project file?

22:21 TimMc: rlb: You can add hooks and middleware.

22:21 It's not via the project file, precisely.

22:21 akurilin: Is there a list of macros out there that implicitly use a do?

22:22 There's let, fn, anything else major?

22:22 TimMc: akurilin: The only things that can *implicitly* use a do are special forms, not macros.

22:22 (So one could easily exhaustively search them.)

22:23 let* and fn* are the ones that come to mind

22:23 rlb: TimMc: ok, thanks -- I'm thinking of one-off bits -- say for example, that I need to compile a c file before the compile stage for clojurec so that I can extract the platform's errno symbols.

22:23 TimMc: can the hooks/middleware be local to the project?

22:24 justin_smith: akurilin: when

22:24 akurilin: binding

22:25 future

22:25 I think there are many

22:25 TimMc: akurilin: loop

22:26 try

22:26 akurilin: TimMc, so to make sure I grok this better, special forms are basic language logic building blocks that are then used by functions/macros to make interesting stuff that'd not be possible otherwise?

22:26 amalloy: TimMc: surely you mean loop*, not loop, if you're grouping it with let* and fn*

22:27 chord: i demand starcraft clone

22:27 TimMc: Oh yes, loop*

22:29 amalloy: but really i'd categorize the macros themselves as "implicitly" adding a do around your code; to say only special forms can do so is probably accurate but not very useful

22:29 TimMc: amalloy: Thanks, I didn't know that delegated as well. I suppose it would, what with the destructuring.

22:29 amalloy: I am technically correct!

22:29 (The best kind of correct.)

22:30 OtherRaven: Is there a way to require/use java objects such that they don't have to be qualified?

22:31 Like, with lwjgl, it gets annoying to always have to do GL11 or GL15 or what have you before each command

22:32 ToBeReplaced: OtherRaven: (import 'java.util.UUID) (UUID/randomUUID)

22:33 OtherRaven: ToBeReplaced: Right, is there any way to do it without having to put UUID/ in front of it though?

22:33 ToBeReplaced: OtherRaven: ah, not that i know of, but don't take that to mean not possible

22:34 TimMc: akurilin: Homework project: Programmatically find all macros in clojure.core that have a "body" section (a do form).

22:34 akurilin: amalloy, so as a language user my options for running multiple side-effects are special forms that explicitly claim to support that and the macros built on top of them?

22:34 amalloy: and the functions built on top of them, and...really any combination of such things

22:35 akurilin: amalloy, but the bottom building block is always a special form supporting that behavior, right?

22:35 asteve: party people, how do you serve static files through compojure?

22:35 like js files?

22:35 amalloy: akurilin: that describes every feature of the entire language

22:35 akurilin: amalloy, :)

22:35 TimMc, sounds fun, will do

22:35 OtherRaven: ToBeReplaced: blargh... do you know if there's any way to easily check which of a group of java classes has a given static method?

22:35 amalloy: but it's not like you *need* the special forms to add an explicit do; you could do it with a form of fn that doesn't have multiple body-exprs

22:35 clojurebot: Pardon?

22:36 ToBeReplaced: OtherRaven: clojure.reflect, maybe... wouldn't know the command off hand

22:36 amalloy: ((fn [ignore these things]) (print 1) (print 2) (print 3)), for example, akurilin

22:37 OtherRaven: ToBeReplaced: thanks, I'll have to look into that

22:40 akurilin: amalloy, what exactly does that expression achieve?

22:40 Not sure I'm following along.

22:41 amalloy: akurilin: it calls print 3 times, without using any implicit do

22:41 by creating a useless three-arg lambda to take the "values" of three print expressions, which are then evaluated in order

22:42 akurilin: amalloy, oh I follow now, got it.

22:42 amalloy: you can even curry it if you don't like depending on multi-argument functions, since that sounds a little bit like an implicit do in the function-call part of the compiler

22:42 ((fn [_] ((fn [_] (print 3)) (print 2))) (print 1))

22:49 akurilin: Anybody here using drawbridge with basic HTTP auth in production?

22:49 mtp: what is production?

22:50 (i mean this in an existential sense)

22:50 technomancy: it's like when a factory runs its assembly line

22:51 brehaut: technomancy: is this where hammers come from?

22:51 mtp: no, hammers come from php users

22:51 brehaut: or spice racks?

22:51 i never can remember

22:51 technomancy: brehaut: all products

22:51 including dot products

22:58 lynaghk: Any nice way to get clojure.pprint to print out hashmaps with the keys alphabetized?

22:58 akurilin: You guys.

22:59 mtp: try using a sorted data structure instead?

22:59 i'm sure there's a good crit-bit tree library for clojure

22:59 <;3

23:23 TEttinger: lynaghk: ##(clojure.pprint/pprint (into (sorted-map) {:b "bar" :c "attack" :a "alphabet"}))

23:23 lazybot: ⇒ {:a "alphabet", :b "bar", :c "attack"} nil

23:28 chord: clojure starcraft clone

23:29 come on guys

23:29 lets do it

23:30 SegFaultAX: chord: Dude, are you still going on about that.

23:30 chord: I never give up

23:31 you give up too early thats why you're failing college

23:31 akurilin: If I wanted to swap two versions of my ring app on the same box without service interruption, would nginx's upstream module be one tool I could use?

23:34 xeqi: akurilin: yes. thats what clojars uses

23:34 akurilin: xeqi, something like: start new version, once it's done update upstream directive, reload nginx, stop old version?

23:35 sounds a bit tricky to automate with CM, but probably doable.

23:41 SegFaultAX: akurilin: Nah, it's a breeze.

23:44 akurilin: SegFaultAX, is there anything specific you can wait for to determine when the app has successfully booted?

23:44 SegFaultAX, port availability?

23:45 I think that's the one thing ansible gives you.

23:45 SegFaultAX: akurilin: Base it on whatever criteria makes sense for your application.

23:52 marcopolo2: chord: Glad to see you are still going for the clojure game! :)

23:52 chord: marcopolo2: you going to help?

23:52 marcopolo2: chord: can't :/

23:53 chord: doing it in cljs or clj?

23:54 chord: you gonno help?

23:57 marcopolo2: just wonderin'

Logging service provided by n01se.net