#clojure log - Oct 04 2013

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

0:06 technomancy: rousing round of torus pong at seajure tonight

0:22 ddellacosta: technomancy: jealous, sounds fun

0:22 tho I have no idea what torus pong is.

0:23 uvtc: I think it may be a 3D version of concentric circle pong...

0:23 :)

0:23 technomancy: ddellacosta: http://pong.clojurecup.com

0:24 ddellacosta: ah, cool. :-)

0:24 technomancy: thanks!

0:26 dobry-den: ddellacosta: i just ended up adding 'myfun = myproj.myns.myfun;'

0:26 ddellacosta: dobry-den: haha, there ya go. :-)

0:26 dobry-den: (reduce + (flatten coll)) works in clj but doesnt seem to work in js

0:26 uvtc: Wow. Didn't realize there were so many games created. Haven't been following the Clojure Cup. Neat.

0:27 Lots listed at http://clojurecup.com/apps.html .

0:28 Foxboron: lol

0:28 i beat the pong game

0:28 i managed to get it in a perfect orbit

0:29 mullr: @dobry-den in cljs you mean? works for me…

0:29 ClojureScript:cljs.user> (reduce + (flatten [1 2 [3 4]]))

0:29 10

0:29 uvtc: agh! It's multiplayer!!

0:29 And I stink! :)

0:30 technomancy: ahaha

0:30 uvtc: Was alone the first time I tried it. :)

0:31 dobry-den: mullr: yeah, it works in my repl but not when i pass the compiled function an array

0:31 mullr: dorby-den: a JS array?

0:32 I'm not super good at cljs yet, but I'd be surprised if that wored

0:32 s/wored/worked/

0:33 CaptainLex: Is there a way I can ensure a string only contains ASCII characters?

0:33 ddellacosta: dobry-den: if you run it through js->cli?

0:34 mullr: ClojureScript:cljs.user> (seqable? (clj->js []))

0:34 false

0:34 ddellacosta: dobry-den: I'm not sure you're going to be do much with a vanilla JS array

0:34 uvtc: Argh! Veritas01! You've bested me for the last time!

0:34 ddellacosta: yah, exactly--it has to have that interface to use it with those functions in clojure.

0:35 frozenlock: uvtc: Everyone left :(

0:35 uvtc: :)

0:35 Sorry. I wanted to get back to Dave Ray's speakerdeck slides. :)

0:42 technomancy: heh https://github.com/uswitch/torus-pong/graphs/punch-card

0:42 looks about right

0:47 Raynes: Man, screw that asylum game.

0:47 You can't win unless you're an asshole. :(

0:47 coventry: CaptainLex: ##(every? #(> 256 (int %)) "noй-ascii string") ##(every? #(> 256 (int %)) "ascii string")

0:47 lazybot: (every? (fn* [p1__16772#] (> 256 (in... ⇒ false

0:47 (every? (fn* [p1__16773#] (> 256 (in... ⇒ true

0:47 Raynes: asylum.clojurecup.com

1:00 TEttinger: coventry, that still allows stuff like §

1:00 try 128?

1:00 ^ CaptainLex

1:01 coventry: TEttinger: Oops. Thanks.

1:05 dobry-den: ddellacosta: duh, didn't even know about js->clj

1:05 ddellacosta: awesome

1:06 ddellacosta: i writing my own transformer with clojure.walk until i realized you were referring to a function

1:06 ddellacosta: dobry-den: yah, there is a lot there to help you out. But I'm sure you'd learn something by writing your own transformer. :-)

1:07 uvtc: More than meets the eye.

2:03 sm0ke: hello i have a function named join in one of the ns which also includes [clojure.string :as s] ..but still get conflict that join already belongs to clojure.string?

2:04 oh crap my fault

2:04 i put that in :use instead of :require

2:19 frozenlock: Is there a way to get a printable representation for a [B (byte?) object? I don't really care if I need to convert, I just want to print it...

2:23 `cbp: frozenlock: seq

2:24 frozenlock: Thanks!

2:27 yedi: that pong core.async post was sex

2:32 devn: hello all

2:32 yedi: link?

2:37 frozenlock: If I want to add a method to a java class, is it with reify? (I'm trying to goole it, but I get mixed results with proxy, reify, defmethod, gen-class..)

2:37 yedi: devn: http://ragnard.github.io/2013/10/01/clojurecup-pong-async.html

2:37 Acio: counterclockwise cant seem to import jaqy.core because its defined a cljs

2:37 any ideas?

2:39 logic_prog: is there a way in clojure to smit out jvm bytecode directly?

2:39 i need to write some high performance clde in clojure; so I want toj ust straight target the jvm

2:40 frozenlock: Hmm... actually I might need to add an entire class.. nevermind

2:42 devn: What's that new clojure lib that uses core.logic for solving symbolic equations?

2:42 nevermind, expresso

2:43 `cbp: logic_prog: wat

2:45 logic_prog: you can choose to compile 'ahead of time' but clojure already compiles directly to bytecode

2:46 logic_prog: I want to write a DSl for writing java bytecode

2:46 for doing high perfomrnace numerics in java

2:47 I want to output http://en.wikipedia.org/wiki/Java_bytecode_instruction_listings

2:47 and have it run on the JVM

2:47 glosoli: Anyone had problems with nrepl server buffer not appearing in Emacs ?

2:48 logic_prog: does *nrepl* show up in ibuffer?

2:49 glosoli: logic_prog yes

2:49 logic_prog: nrepl and error buffers are visible

2:49 logic_prog: (1) can you not open them or (2) when you open them there's no promjpt?

2:50 glosoli: logic_prog: They all work just fine

2:50 except there is no server buffer

2:50 :)

2:50 logic_prog: err, I type stuff into *nrepl*

2:50 if you can open *nrepl* buffer, what is the problem?

2:51 glosoli: logic_prog: Server logs were appearing in server buffer before :)

2:51 I don't get to see any logs now..

2:51 logic_prog: what does server logs have to do with nrepl ?

2:51 devn: I don't suppose we have any expresso afficionados in the room, do we?

2:52 glosoli: logic_prog: NREPL SERVER logs :)

2:52 devn: I'd like to write something which, given [1, 2, 99, 98, 50, 12, 50], can find all of the pairs of numbers which are equal to 100

2:52 glosoli: logic_prog: There always was a separate buffer called *nrepl-server*

2:54 logic_prog: nvm :) hide special buffers option messed up, so I just disabled it

2:57 logic_prog: rubber duck debugging for the win

3:06 hvesalai: devn: use partition to get the pairs

3:13 glosoli: how to trim all white space in a string ?

3:14 uvtc: glosoli: clojure.string/trim

3:15 glosoli: uvtc: it does not do that

3:16 damn ;/

3:21 Apage43: glosoli, what exactly are you trying to do? Give a sample input/output

3:21 glosoli: Apage43: "370 626 8 9 7 5 5" should remove all spaces, currently I did replace on it

3:21 to replace " " with ""

3:22 Apage43: (clojure.string/replace "370 626 8 9 7 5 5" #"\s+" "")

3:22 ,(clojure.string/replace "370 626 8 9 7 5 5" #"\s+" "")

3:22 clojurebot: "37062689755"

3:22 glosoli: Apage43: is it bad that I used " "

3:22 instead of #"\s+"

3:22 ?

3:23 Apage43: actually " " should work fine there too

3:23 ,(clojure.string/replace "370 626 8 9 7 5 5" #" " "")

3:23 clojurebot: "37062689755"

3:23 rurumate: I just realized that Datomic is not FOSS software. I'm sure rms would not approve. What happened?

3:24 glosoli: Apage43 thanks

3:30 vmarcinko: hi, noob question - how to create (hash) map from sequence of 2-element vectors ?

3:30 Apage43: ,(into {} [[:a 1] [:b 2]])

3:30 clojurebot: {:a 1, :b 2}

3:32 vmarcinko: hmm, thanx, and even better ,since I have a function that creates map entries in form of 2-element vector, is there some way to skip that, and directly create map entries ?

3:33 Apage43: you *can*, but most folks just use 2-element vectors, since they're pretty much interchangeable

3:34 what may more may not make sense depending on your situation is to refactor it as building up a map with assoc

3:35 vmarcinko: thanx...actually my problem is that i'm trying to iterate over existing map, and transform it to a new map that has same keys but values are results of applying function on them, so I have (map my-transform-fn original-map), and this transform-fn takes original map entry and transforms it into vector, and I get seq of 2-tuples

3:35 Apage43: that is, instead of (into {} (map (fn [input] (stuff here to generate a kv pair)) some-collection))

3:35 write

3:36 (reduce (fn [m input] (assoc m key value)) {} input-collection))

3:36 ah

3:37 vmarcinko: yeah, thanx, i got it...exactly my problem

4:51 chare: ok norm device coordinates make no sense in opengl, why does opengl switch from right hand to left hand coordinates when going to norm device coordinates

4:51 devn: hvesalai: partition is not the answer.

4:51 chare: need opengl expert to explain to me wtf is going on

4:51 devn: chare: ./join #opengl

4:51 chare: assholes won't explain

4:51 so had to come here

4:52 devn: oh, yeah, that sounds about right

4:52 chare: devn just answer the question

4:52 devn: :)

4:52 chare: well, where to begin? first: I don't know the answer to your question. second: that's a rude way to ask a question.

4:56 hvesalai: devn: how is it not the answer, (partition 2 1 foo), then just filter the ones where (reduce + ) is 10

4:57 devn: hvesalai: write out all of the integers from 0 to 10 which, when combined with one another sum to 10

4:57 [5 5] for instance.

4:57 partition 2 1 is not what i was asking for at all. im talking about using core.logic here for fun

4:58 clgv: devn: you can use `for`

4:58 devn: heh, you folks seem to be missing the point

4:58 this problem is solved many ways, all of them pretty boring

4:58 clgv: devn: or `doseq` if you only want to print those numbers

4:58 devn: i want to do it using expresso

4:58 clgv: oh, I didnt see that since I just joined ;)

4:58 devn: oh, i didn't see that because i parts and joins turned off in my client :)

4:59 i have*

4:59 clgv: but are you sure expresso is the right hammer for that nail?

4:59 devn: absolutely not

4:59 it's just a fun problem

4:59 an opportunity to play with expresso more than anything else

5:00 i was thinking about using some combination of substitute, solve, and ex

5:00 clgv: you could do it with core.logic and its support for finite domains

5:00 devn: clgv: yeah, you might be right that i should just do it in core.logic, but sets in expresso could be cool

5:01 again, just looking for an excuse to mess with expresso this evening :)

5:01 clgv: just parsing its readme for the first time ;)

5:02 summarizingly, it's for algebraic manipulation, solving equations and optimization?

5:02 devn: *nod* sounds about right

5:02 clgv: but your problem at hand does not really fit those topics

5:03 devn: no, it doesn't

5:03 doesn't change the fact that it could be used to solve it :)

5:04 practicality is of no concern to me right now

5:04 clgv: I'd be curious to see the solution if you manage to get a simple one, which I doubt with my current knowledge

5:05 devn: i imagine substituting values for an expression, mapping those substitutions across a range of values

5:06 clgv: ah ok substituting x with values in a suitable domain and then solving for y? it's debatable to call that "simple" ;)

5:06 devn: yeah, something like that

5:06 there are also rewrite rules in expresso

5:06 i bet those could be leveraged to good effect

5:08 hvesalai: devn: ah... you don't want adjacent pairs of list (what you get with partition) but combinations of size 2

5:08 devn: (map #(rule (ex (+ % ?&*)) :=> target-sum)

5:08 or something like that clgv

5:08 clgv: oh who did include perl into this lib? :P

5:08 devn: haha

5:09 hvesalai: check again. combinations does not include [5 5]

5:10 hvesalai: so what is it that you exactly want?

5:10 devn: hvesalai: i already have it :)

5:10 hvesalai: ok

5:10 clgv: hvesalai: the clojure way to solve it would be ##(for [i (range 11) j (range 11) :when (= (+ i j) 10)] [i j])

5:10 lazybot: ⇒ ([0 10] [1 9] [2 8] [3 7] [4 6] [5 5] [6 4] [7 3] [8 2] [9 1] [10 0])

5:11 devn: ,(let [coll (range 1 25), target 12, cnt (count coll)] (->> (for [a (range 0 cnt) b (range 1 cnt)] [(nth coll a) (nth coll b)]) (filter (fn [[x y]] (= target (+ x y))))))

5:11 clojurebot: ([1 11] [2 10] [3 9] [4 8] [5 7] ...)

5:12 devn: which excludes [10 0], but yeah, clgv -- that's basically it

5:12 there's another clever way

5:13 ,(let [sorted-coll (-> (range 25) sort), target 18] (loop [vs (range (count sorted-coll)) res {}] (let [v (first vs)] (if (get res (- v target)) res (recur (next vs) (assoc res v (- target v)))))))

5:13 clojurebot: {0 18, 1 17, 2 16, 3 15, 4 14, ...}

5:14 devn: could be written cleaner, but that's faster

5:15 obviously no need for the sort there since im just using range, but if it were in a fn def and the inputs were in an unknown order it needs to be sorted

5:16 hvesalai: are you still talking about: "I'd like to write something which, given [1, 2, 99, 98, 50, 12, 50], can find all of the pairs of numbers which are equal to 100"

5:16 or some other thing?

5:17 devn: same thing

5:17 i believe the above needs to be sorted, but i could be wrong on that now that i think about it

5:18 hvesalai: clgv: so how does your solution work for that input example

5:18 devn: in the above case i am trying to find all pairs of nums < 25 which = 18

5:18 clgv: hvesalai: place the given collection where the ranges are

5:18 hvesalai: but that's a completely different thing

5:19 devn: hvesalai: are you talking to me?

5:19 clgv: are you jonathan?

5:19 (sorry if i spelled that wrong)

5:20 clgv: devn: no

5:20 devn: k

5:20 well, hi anyway! :)

5:20 clgv: hi :)

5:21 devn: algorithms are boring when they aren't written with love

5:21 read, eval, print, love

5:29 yogthos: how goes luminus?

6:27 dublindan: Hey, I'm trying to rewrite some code without using loop. Been away from clojure for a bit and am shaky on my sequences.

6:27 Can someone help me rewrite this code in a more idiomatic form? http://paste2.org/tZdEh3hJ

6:31 lgs32a: i wonder what would be a small example problem/project to demonstrate the powers of my library state-node. https://github.com/lgrapenthin/state-node

6:34 ro_st: dublindan: http://paste2.org/ehHz47Ak

6:34 (untested)

6:34 clgv: dublindan: ou can do that with `reduce-kv`

6:34 ro_st: … or just use reduce-kv

6:34 AimHere: dublindan howabout (defn foo [x y & args] (reduce (fn [r [a b]] (assoc r (x a) (y b))) {} (partition 2 args)))

6:34 clgv: or `reduce` if you do not build an initial map

6:34 AimHere: ro_st, args is a list, reduce-kv won't work well on that, it's list in, map out

6:35 clgv: oh well how about zipmap ^^

6:35 ro_st: that's the thing. foo is doing two things, qualifying a map and then using x y on the k v

6:35 if instead the map was created separately, it's much simpler

6:36 clgv: (zipmap (->> args (take-nth 2) (map x)) (->> args rest (take-nth 2) (map y)))

6:36 ro_st: so many ways :-)

6:37 dublindan: ro_st: clgv: AimHere: thanks, I'll give those a look :)

6:41 so.. which way would be the suggested way?

6:41 TEttinger: ##((fn [a b & args] (into {} (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3)

6:41 lazybot: ⇒ {:a 2, :b 3, :c 4}

6:41 TEttinger: I don't think it _needs_ needs reduce

6:42 dublindan, whatever one makes sense to you

6:42 clgv: TEttinger: without redcue I'd prefer zipmap ;)

6:43 TEttinger: indeed, I just can't read zipmap yet

6:43 dublindan: Wel, the reduce way, the zipmap way and ro_st's way all make sense to me :)

6:44 TEttinger: I kinda thought mine was clear... :(

6:44 noncom: did anyone use serial-port library from Sam Aaron to communicate over the serial port?

6:44 TEttinger: splits the arglist into pairs, calls a function over each pair that calls a on the first, b on the second, turns each pair into a key-value entry in a map

6:45 dublindan: TEttinger I think I need to look up 'into', think thats what threw me from yours

6:45 TEttinger: ah, into is super useful

6:45 (fn [a b & args] (into {} (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) is the function. you could also do... ##((fn [a b & args] (into (sorted-map) (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3)

6:45 lazybot: ⇒ {:a 2, :b 3, :c 4}

6:47 TEttinger: the trick with into is, (into {} [[1 2][3 4]]) will turn each pair into a map

6:47 dublindan: Ok, so looked up into, your way actually looks pretty good now :P Might just use that

6:47 TEttinger: err map entry

6:47 haha thanks

6:47 dublindan: Yeah, just looked it up

6:47 thanks for the help!

6:47 TEttinger: if zipmap is legible though, it's shortest I think

6:47 np

6:49 clgv: for must performance you have to use `reduce` and transients anyway ;)

6:49 *most

6:50 TEttinger: does map use transients internally?

6:51 clgv: no.

6:52 transients exist only for (hash-)map, sets, vectors

6:53 all the lazy sequence functions are built on lazy sequences ;)

6:56 lgs32a: ,((fn foo [x y & args]

6:56 (apply hash-map (map #(%1 %2)

6:56 (cycle [x y]) args)))

6:56 identity inc :a 1 :b 2 :c 3)

6:56 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

6:56 lgs32a: ,((fn foo [x y & args](apply hash-map (map #(%1 %2)(cycle [x y]) args))) identity inc :a 1 :b 2 :c 3)

6:56 clojurebot: {:a 2, :c 4, :b 3}

6:58 * ucb considers memoizing rand

7:10 * clgv rolls on the floor laughing

7:34 TEttinger: clgv, you sure about reduce being faster?

7:34 ,(time (dotimes [i 1000] ((fn [x y & args] (reduce (fn [r [a b]] (assoc r (x a) (y b))) {} (partition 2 args))) identity inc :a 1 :b 2 :c 3) ))

7:34 clojurebot: "Elapsed time: 41.949574 msecs"\n

7:35 TEttinger: ,(time (dotimes [i 1000] ((fn [a b & args] (into {} (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3) ))

7:35 clojurebot: "Elapsed time: 30.852198 msecs"\n

7:35 TEttinger: this surprised me

7:35 clgv: TEttinger: reduce+transient was the statement

7:35 TEttinger: I thought reduce used transients internally

7:36 thought you meant that

7:36 clgv: nope

7:36 TEttinger: so if I turned the {} into (transient {})

7:37 * mullr is experimenting with the liberal use of dynamic scoping. Don't drink and code, kids!

7:37 TEttinger: err no, that won't do it

7:38 yes, it is a bit faster

7:38 ,(time (dotimes [i 1000] ((fn [x y & args] (reduce (fn [r [a b]] (assoc! r (x a) (y b))) (transient {}) (partition 2 args))) identity inc :a 1 :b 2 :c 3) ))

7:38 clojurebot: "Elapsed time: 12.533211 msecs"\n

7:39 TEttinger: woah very different here

7:39 nice, I will keep it in mind

7:39 transients must be faster on clojure 1.5?

7:39 ,(clojure-version)

7:39 clojurebot: "1.6.0-master-SNAPSHOT"

7:40 TEttinger: dublindan, there's your answer :D (fn [x y & args] (reduce (fn [r [a b]] (assoc! r (x a) (y b))) (transient {}) (partition 2 args))) <-- thanks clgv

7:41 hyPiRion: transients are actually a tiny bit slower for collections where you do relatively few conj/assocs

7:41 clgv: hyPiRion: but the threshold is pretty low

7:42 TEttinger: yeah, this is 3 pairs.

7:42 hyPiRion: yeah, just be aware of it

8:59 sm0ke: hello sometimes i get exception in a clojure code with weird stac trace like

8:59 $eval1643.invoke(form-init2748065842052729346.clj:1)

8:59 Foxboron: sm0ke: welcome to clojure debugging. Any questions?

9:00 sm0ke: now in the stack trace that is the onlyline with my codes namespace

9:00 but looking at that its hard to figure out which line caused it

9:01 does that happens for anyone else?

9:01 Foxboron: sm0ke: please post the whole stacktrace

9:01 (in a pastebin)

9:02 llasram: sm0ke: That particular line of the stacktrace just refers to a form in your REPL

9:02 sm0ke: but how do i figure out which form!

9:03 there are so many

9:03 llasram: The one you just evaluated...?

9:03 sm0ke: AHA

9:04 llasram: did you mean that happened becuase i evaluated a form only via repl?

9:04 llasram: Yes

9:04 sm0ke: if i run it normally from java -jar..it will give me the exact location

9:04 let me try

9:04 llasram: no no

9:04 sm0ke: no?

9:04 llasram: You need to post the full stacktrace

9:04 clojurebot: no is tufflax: there was a question somewhere in there, the answer

9:04 llasram: That *line* just refers to the form in the REPL

9:05 Foxboron: sm0ke: clojure debugging involves a lot of guessing and stacktrace reading sadly :/

9:05 llasram: The rest of the stacktrace will show where the exception actually came from

9:05 Foxboron: It gets easier over time

9:05 TEttinger: definitely.

9:06 sm0ke: llasram: i assure you i am very sure none of it is from my code except that very line

9:06 still let me paste it

9:06 llasram: yes, please

9:07 TEttinger: the full trace may have a line or two from your code deeper in it

9:09 sm0ke: here http://pastebin.com/pmtwGcwp

9:09 its pretty useless

9:09 my code is comp_channel*

9:10 so guys i see a lot of clojure code with much exception handling..i dont understand how can clojure hide all that ugly exception handling

9:10 without*

9:11 or do people just shrug it off in clojure?

9:11 gfredericks: sm0ke: are you comparing to Java code?

9:11 sm0ke: yes

9:11 i just want to know whats the take of clojure on exception handling?

9:11 llasram: sm0ke: Um, "Connection refused"

9:12 gfredericks: a lot of exception handling in java is forced by the language, not something the programmer actually wanted to do

9:12 llasram: I'm not sure how you get much more clear than that :-)

9:12 gfredericks: ("checked" exceptions)

9:12 sm0ke: llasram: yes i know what went wrong...but i want to know from which line

9:12 llasram: if you see rabbitmq java api you wont really not be sure with all that ugly abstraction which line is reponsible for it

9:13 gfredericks: what do you mean by that? any examples?

9:14 gfredericks: sm0ke: I mean that the java type system forces you to handle lots of exceptions, while that's not the case in clojure or other dynamically typed languages

9:14 TEttinger: sm0ke, the problem is with the connection

9:14 what are you connecting to?

9:14 gfredericks: I expect you'd see a similar style of exception handling in ruby/python/etc

9:15 TEttinger: might be a blocked port

9:15 sm0ke: gfredericks: sorry but thats not very concrete point..your sockets can still throw errors which is out of your control be it python java or clojure

9:15 and you have to handle it

9:16 TEttinger: eee i am connection to a rmq which i havent started

9:16 but you miss the point i wanted to know why isnt the stacktrace informative

9:16 TEttinger: oh, because you're in a repl

9:17 sm0ke: yea i also think so

9:17 TEttinger: I think there may be a way, but I don't use nrepl in emacs or anything

9:17 lein repl might have similar issues

9:17 sm0ke: hmm i think i should put a bunch of printlns

9:18 llasram: sm0ke: OOC, what was the exact line you evaluated in your REPL?

9:18 sm0ke: wait

9:20 https://www.refheap.com/19396

9:21 llasram: You tossed all of that into the prompt at your REPL?

9:21 sm0ke: :D

9:21 whats wrong with that?

9:21 thats what i like about clojure..quick check you functions

9:21 llasram: Because you won't get useful line numbers

9:22 Put the function definitions in a file in a real namespaces

9:22 Then call them from the REPL

9:22 sm0ke: llasram: hey wait

9:22 llasram: If you do that, you'll get a much better experience

9:22 sm0ke: llasram: its already in a file but i am using fireplace..

9:22 oh i think its same as tossing it on repl

9:24 i just realized how easy it has been to check my clojure code which i develop one small bit at a time

9:27 gfredericks: sm0ke: "have to handle it" is more concrete in java than in clojure/ruby/python -- your java code won't compile unless you at least nominally handle the exception

9:27 oh well

9:33 mullr: delay + extend-protocol yields some unexpected delight: https://www.refheap.com/19397

9:43 TEttinger: mullr, is the typo intentional?

9:43 (do-it lazy-intance)

9:43 mullr: *ninja-edit* what typo?

9:45 TEttinger: I don't have any idea what's going on there, can you explain?

9:46 mullr: There's a random protocol and an implementation.

9:46 I'd like to be able to delay the creation of said implementation, but still be able to treat it as though it were real.

9:47 Normally if you do (delay (->Impl 1 2)) you need to deref the value with @lazy-instance before you use it

9:47 This makes it transparent w.r.t. the methods in that protocol

9:47 TEttinger: nice!

9:47 I think I get that

9:47 mullr: i.e. instead of having to do (do-it @lazy-instance) you can do (do-it lazy-instance)

9:48 TEttinger: I've only used delay once anyway

9:48 I should probably use it more

9:48 mullr: which is nice when you have other code that you don't want to know about the laziness

9:48 This is the first time I've needed it too

9:53 lunk: how can I test for multiple types for input, like a vector, a double arrray or an Object? (fn f [name input & options])

9:55 gfredericks: lunk: vector? is a function

9:55 double arrays are trickier

9:55 instance? is probably helpful

9:55 mullr: lunk: The other answer is that maybe f should be protocol method, if you need to decide what to do based on the type

9:56 gfredericks: or a multimethod

9:56 mullr: aye

9:57 Both approaches (manual testing with vector?, instance?, etc and protocols/multimethods) have their place

10:14 wakeup: Hi

10:16 mdrogalis: Morning.

10:17 TEttinger: lunk, for double arrays, I don't know of any way other than ##(let [check (fn [arr] (= (type (double-array 1)) (type arr)))] (check (double-array 3)))

10:17 lazybot: ⇒ true

10:18 clgv: ,(.getCanonicalName (Class/forName "[D"))

10:18 clojurebot: "double[]"

10:18 lunk: mullr: ahh, let me investigate protocols, haven't actually run into a need for them yet

10:19 TEttinger: aha, i think with type and cond i can get the behavior i want

10:19 TEttinger: maybe store the types as defs with nicer names.

10:20 lunk: yes

10:22 gfredericks: also condp instance? might be succinct

10:25 noncom: if i have two part of the program that run independently, can i use core.async to organize messaging between them? i need the messaging to not be blocking. if there is message, the program should respond, otherwise, simply continue

10:25 ?

10:28 lunk: ,(let [x (double-array 3)] (instance x)

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

10:28 lunk: ,(let [x (double-array 3)] (instance x))

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

10:28 xeqi: noncom: it sounds to me like a normal queue would work fine

10:28 lunk: meh

10:28 mullr: ,(doc instance?)

10:29 clojurebot: "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"

10:29 noncom: xeqi : you mean java queue, no core.async?

10:30 xeqi: noncom: probably an atom with a clojure.lang.PersistentQueue/EMPTY

10:30 use peek to see if there is a message and handle it

10:31 use pop to update the queue

10:31 noncom: xeqi: i see, thanks! was thinking something along such lines, but asked to see if it could be core.async.. but i am interested: core.async would do if i would need blocking right?

10:33 xeqi: noncom: yep

10:34 noncom: cool! that clarifies the usage case for me!

10:35 mullr: lunk: A version with protocols: https://www.refheap.com/19399

10:36 Interestingly, doing extend-protocol like that only works when the dynamic call is the first one

10:36 As noted at http://stackoverflow.com/questions/13924842/extend-clojure-protocol-to-a-primitive-array

10:41 sm0ke: is there possibility for clojure having an inbuild debugger?

10:45 seangrov`: phew, refheap can continue on, mongodb got its investment

10:46 sm0ke: wtf is it with mongodb getting all the the fundings in the world

10:48 i dont see what value it provides by storing a bunch of nested bson..with no meaningful api to query it comprehensively

10:48 indigo: sm0ke: It's good enough

10:48 sm0ke: id rather go with elasticsearch than mongo

10:48 seangrov`: sm0ke: Who cares, traction

10:49 sm0ke: db for cool kids

10:51 and btw i hate this "nosql" shit..i mean sql is not a fucking database for god sake its just a language..

10:52 you can have scalable shardable database with sql query language too

10:53 meh i better do something productive and read joy of clojure..who cares

10:54 indigo: sm0ke: Yeah, but what if you want to have an object database

10:54 Mongo has its uses

10:54 oholiab: mongo is alright for transient data that might change in schema, but I think that's the thing that people don't really get - a scalable key value store has specific applications but it doesn't necessarily mean it's a good replacement for a proper rdbms

10:55 there are certainly usage cases for it when higher persistence is involved but I think if you're talking scale and persistence then maybe having a hard and fast, well designed schema is something you want to start off with

10:55 sm0ke: indigo: i dont understand what objects?

10:56 if storing objects is what you want rather go with jpa

10:56 arkh: what's the simplest way to get the next or prev item in a sorted map relative to a known key?

10:57 sm0ke: agree with oholiab

10:59 oholiab: mongo is a really easy db to decide to use and so easy to develop against because you don't really need to architect anything in order to prototype

10:59 which is fine as long as you stop and look at your requirements once you've finished prototyping

11:00 tl;dr, mongo has a bad rep because it's easy to develop against and set up so people use it in preference of what is suitable to their needs and then cry when they loose all their data

11:00 sm0ke: oholiab: exactly

11:00 ok this is from a real scenario in my company

11:01 a company working on data realted to hotel bookings and stuff had their whole data store in mongo

11:01 i mean everything ..even used feedback was deeply nested

11:02 they were just stuck..because they just couldnt find meaningfull way to query inforamtion out of it

11:02 wakeup: Why does this work: (:a {:a 2 :b 1}) ?

11:03 nathanic: wakeup: keywords can be used as functions to look themselves up in a map

11:03 wakeup: Is it pretty smart-ass syntax for (get ... :a) ?

11:03 oholiab: I love that behaviour

11:03 well, do be fair, it's just a replacement for [] syntax in other languages I suppose

11:03 sm0ke: i mean you would not write mongo contrived map reduce for real time dashboards right?

11:03 llasram: wakeup: Kind of. There's actually some internal JVM glue which makes it more efficient, especially for Record types

11:04 oholiab: I just like it though, it looks nice

11:04 wakeup: (map :a (list {:a 1} {:a 2} {:a 3}))

11:04 ridiculous

11:04 nathanic: ,(map :a (list {:a 1} {:a 2} {:a 3}))

11:04 clojurebot: (1 2 3)

11:04 llasram: wakeup: Because a Clojure function is just a JVM object which implements the IFn interface, any object can also be used as a function just by implementing that interface

11:05 wakeup: ,(type (fn []))

11:05 clojurebot: sandbox$eval57$fn__58

11:05 wakeup: ,(type :a)

11:05 clojurebot: clojure.lang.Keyword

11:05 wakeup: This will haunt you a long time.

11:05 llasram: ?

11:05 What will

11:06 lunk: mullr: that looks like it would definitely work. overkill for this particular case, but thanks for the info regardless.

11:06 llasram: ,(map ifn? [(fn []) {} :a 'a])

11:06 clojurebot: (true true true true)

11:07 lunk: mullr: think i'll try instance/cond approach in a function first

11:07 mullr: lunk: n/p, good luck!

11:07 wakeup: llasram: Well type doesn't seem to work on functions.

11:07 assuming it is the analogue to CL's TYPE-OF

11:08 The more I get into clojure the more I realize the chaos

11:08 lunk: mullr: any idea how to test a type that's an inter-op with a java class, that doesn't have an empty constructor?

11:08 llasram: wakeup: It isn't. `type` returns the concrete type of an object, which for functions is a different concrete type for each function

11:08 TimMc: wakeup: Side note: You usually want class, not type.

11:08 lunk: mullr: i guess object would work, but it's not as correct

11:09 wakeup: ,(class (fn []))

11:09 clojurebot: sandbox$eval145$fn__146

11:09 llasram: TimMc, wakeup: Eh, `type` gives you a bit more flexibility.

11:09 mullr: lunk: You mean a java type? just write it down. java.lang.String, etc.

11:09 llasram: wakeup: `type` gives the same results as `class`, unless the object has `:type` metadata

11:09 nathanic: ,(doc ifn?)

11:09 clojurebot: "([x]); Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn"

11:10 wakeup: So there is no function type? just a function interface?

11:10 llasram: wakeup: Because so many things on the JVM and in Clojure depend on interfaces, having a single "type" for something isn't that useful

11:10 For example, vectors are functions, indexed, and associative, among many other things

11:10 wakeup: hmm

11:10 pretty frankenstein if you ask me

11:11 llasram: Once you get used to it, it's pretty powerful, especially with the addition of protocols

11:11 arkh: duh - re: my previous question, subseq is what's needed

11:11 TimMc: wakeup: Interfaces *are* a "type".

11:11 devn: anyone use zephyros?

11:12 TimMc: s/a type/types/

11:13 devn: You *know* which factoid I'm going to have to pull up now, right?

11:13 cark: I've been trying to test core.async with clojurescript and cljs-build, but i get this error : "

11:13 > I've been trying to test core.async with clojurescript and cljs-build, but i get this error : "

11:13 > I've been trying to test core.async with clojurescript and cljs-build, but i get this error : "WARNING: Use of undeclared Var cljs.core.async.impl.ioc-helpers/keyword-identical?...."

11:13 hum oops

11:14 anyways... it obviously doesn't work, maybe i'm not usiing the correct version of clojurescriptp ?

11:14 lunk: mullr: derp, making it way too hard

11:15 llasram: wakeup: My current favorite trick is extending a protocol to Fn

11:16 cark: i'm using core.async 0.1.242 and lein-cljsbuild 0.3.3

11:16 devn: TimMc: Madison Square Clabango?

11:16 clabango?

11:16 clojurebot: clabango is madison

11:18 indigo: sm0ke: ORMs are a faulty abstraction

11:20 mullr: wakeup: It's worth noting that result is different for clojurescript:

11:20 ClojureScript:cljs.user> (type (fn []))

11:20 #<function Function() { [native code for Function.Function, arity=1] }

11:20 >

11:20 The JVM doesn't have a function type, while javascript does.

11:20 TimMc: devn: ~anyone :-P

11:21 jonasen: cark: you'll need to explicitly add the latest cljs release to project.clj

11:21 * mullr may be wrong about the JVM right there

11:21 noncom: is java 8 gonna have functional type?

11:21 cark: jonasen: ah I thought it was something like that, i'm currently trying to find a place to see which one is the last

11:21 noncom: s/functional/function

11:22 i remember them talking about lambda support for java 7 but delayed for java 8. will it affect clojure somehow?

11:22 mullr: noncom: afaik, it won't; it'll just let you reify a single-method interface in a way that looks like a function literal.

11:23 * mullr could be VERY wrong

11:23 TEttinger: clojure fns will probably still be better

11:23 noncom: sounds similar to what scala and clojrue already do

11:23 TEttinger: yeah. it might provide more backend at the JVM level though

11:25 jonasen: cark: http://search.maven.org/#search%7Cga%7C1%7Cclojurescript

11:25 0.0-1909

11:25 cark: jonasen: thanks !

11:26 mullr: looks like it is indeed different: http://zeroturnaround.com/rebellabs/java-8-the-first-taste-of-lambdas/

11:27 though I'm not sure what a lambda's *type* would be

11:29 ToxicFrog: mullr: it says right in that article

11:29 gfredericks: any interface with a single abstract method?

11:29 ToxicFrog: It has the type of the SAM interface it implements

11:30 So if your lambda is implementing Runnable.run(), it has type Runnable

11:30 mullr: But surely it has a concrete type as well

11:31 gfredericks: an anonymous class?

11:31 java has had those for a while, just syntactically clunky

11:31 cark: jonasen: hum not too great tho, now the warning about cljs.core.keyword-identical? disapeared, but it's still not defined !

11:31 noncom: one more link http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html

11:32 TEttinger: maybe lambda is the implicit parent of sam interfaces, like object for all objects?

11:32 mullr: From what this article says, the lambda turns into a method in the same class it's used in

11:32 noncom: and http://cr.openjdk.java.net/~briangoetz/lambda/lambda-translation.html

11:34 so they are very different from clojure

11:35 mullr: That last link seems to have it… and the answer is "it depends"

11:35 different indeed

11:36 cark: jonasen: or your info, i only had to delete (clean if you will) the pre-compiled stuff from old clojurescript

11:36 for*

11:37 jonasen: so now it's working, thanks again

11:38 noncom: that implementation of lambdas does not seem good to me. sure i am not a compiler designer, but it just looks like they're trying to play around the existing jvm paradigm.. sure they have to..

11:39 but it does not look.. ummm... healthy..

11:40 jonasen: cark: great!

11:47 seangrov`: Ah, damnit, you can't really update cookies with a redirect.

11:59 TimMc: seangrov`: Really? :-(

12:02 rodnaph: anyone able to help with getting started in core.typed?

12:03 while attmepting to check a namespace i'm getting an error about an interop call - " Call to instance field getBytes requires type hints."

12:03 but finding the docs on the wiki a bit dense...

12:06 gfredericks: rodnaph: do you call .getBytes somewhere?

12:06 rodnaph: yes, in a function - but i'm not sure how to go about type hinting it. here's the fn...

12:07 (ann string->stream [String -> ByteArrayInputStream])

12:07 (defn string->stream [string]

12:07 (ByteArrayInputStream.

12:07 (.getBytes (.trim string))))

12:07 gfredericks: hm

12:08 presumably core.typed knows it's a string

12:08 so naively it doesn't seem necessary

12:08 but you could try (.getBytes ^String (.trim string))

12:11 perhaps core.typed is trying to help you avoid reflective code for some reason

12:13 TimMc: Or put the ^String in the arglist.

12:14 rodnaph: Oh, and remember to specify your encoding with getBytes (almost certainly UTF-8)

12:18 * gfredericks imagines pronouncing TimMc as "Timosee" rhyming with "Timothy"

12:18 mullr: "(almost certainly UTF-8)" Isn't it nice to be able to say that?

12:20 mtp: almost

12:20 :)


12:25 TimMc: Ugh, UTF-EBCDIC.

12:25 (Sadly, this is a thing: <https://en.wikipedia.org/wiki/UTF-EBCDIC>)

12:25 gfredericks: More like Tim'msee

12:28 * llasram has just had his mind boggled

12:35 gfredericks: llasram: what is it that has boggled your mind.

12:43 maris`: has anyone use leiningen to publish artifacts to a remote maven repo ? where should I specify password ?

12:43 mdrogalis: maris`: It depends which you're trying to publish to.

12:44 maris`: private repo, we are using artifactory

12:44 mdrogalis: maris`: Specify it in your .profile as a GPG key.

12:45 maris`: lein complains about password "No credentials found for snapshots"

12:46 rodnaph: gfredericks: TimMc: that worked, thanks a lot!

12:47 maris`: do I have to use GPG ? plain strings won't work ?

12:47 mdrogalis: maris`: Have you seen the Leinigen Wiki page about setting up keys?

12:47 maris`: {"snapshots" {:url ""

12:47 :username "xxx"

12:47 :passphrase "xxx"}}

12:47 mdrogalis: Unless it's a CI machine, it's kind of a pain to do without keys.

12:47 technomancy: mdrogalis: signing artifacts before publishing is different from authenticating to deploy

12:48 maris`: if you use full-disk encryption you can place your credentials in an unencrypted file

12:48 mdrogalis: technomancy: Ahh. Brb, lunch.

12:48 nDuff: technomancy: only worried about offline attacks?

12:48 maris`: it is CI machine, we are trying to make it work from CI server

12:49 technomancy: maris`: oh, gotcha. see the "full-disk encryption" section under `lein help deploying`

12:49 nDuff: maris`: I do that with SSH forwarding -- trigger the CI build over SSH into a restricted account that runs the build in the sandbox with the user's agent forwarded.

12:49 technomancy: nDuff: not "only", but I can't in good conscience recommend storing plaintext creds on a developer's laptop

12:50 nDuff: maris`: ...that way the CI server can SFTP into the artifact repository as the user, connect to source control as the user, &c., but not be able to use that user's credentials beyond the duration of their connection.

12:50 technomancy: nDuff: we have a security berserker at work who threatens summary decapitations for less

12:50 nDuff: technomancy: I don't see a need for plaintext creds. Store your keys encrypted and use the {ssh,gnupg}-agent interface to store unlocked versions in non-pageable memory.

12:51 technomancy: nDuff: yeah, that's what the lein docs recommend

12:51 TimMc: I want to be a security berserker.

12:51 nDuff: ...granted, root can still get into that, but *shrug*.

12:53 * nDuff has had a decade or so to calm down and get pessimistic and jaded since last time he wore the security beserker hat.

12:54 technomancy: hat and beard, hopefully?

12:55 nDuff: technomancy: ...well, yah, that's the other part of it -- fiancee has insisted that I ditch most of the beard.

12:55 gfredericks: the lefternmost 3/4 presumably

12:59 goracio: hi, can someone advise what to use for realtime backend for web site ? something similar to tornado and socket.io - core.async ?

13:00 nDuff: goracio: have a look at http://http-kit.org/

13:01 goracio: core.async is great, but it doesn't give you a complete, usable web stack.

13:01 sm0ke: hello anyone using https://github.com/MichaelDrogalis/dire ?

13:01 goracio: nDuff: great i will look at it

13:01 mdrogalis: sm0ke: Me. ;)

13:02 sm0ke: mdrogalis: any thoughts?

13:02 mdrogalis: sm0ke: Well, I like it.

13:02 nDuff: goracio: ...you might find http://shenfeng.me/600k-concurrent-connection-http-kit.html interesting, by the way.

13:03 sm0ke: i just looked at it imagined how fu**ing awesome it would be to have all error handling for the whole code in a seperate namespace?

13:04 mdrogalis: i have one doubt though, how do you propogate errors using dire?

13:04 mdrogalis: sm0ke: Indeed, it's pretty awesome. https://bitbucket.org/jotspec/server/src/4e12292560c66e03a9066f595457f4e2069a595a/src/jotspec/handlers.clj?at=refactor

13:04 sm0ke: throw

13:05 sm0ke: mdrogalis: awesome! what i thought

13:05 goracio: nDuff: ok ) used to work with rails usually but rails really bad with it (

13:05 bbloom: guys…. i miss sexprs...

13:05 sm0ke: i am going with dire for sure

13:05 bbloom: i'm doing various js/ruby/html stuff now

13:05 and all this string templating sucks :-/

13:06 mdrogalis: sm0ke: Happy trails.

13:06 I'm off again for a bit. Be back later.

13:08 sm0ke: have a good one

13:09 oh i just realize i was talking to the author of the library

13:12 yedi: man, uberjar is pretty sexy, esp coming from someone with no sysops experience

13:14 sm0ke: yedi: its a double edge sword

13:14 yedi: how so

13:14 jacobm: j/

13:15 sm0ke: it just unjars everying thing into a single jar..which can be nightmare for multiple dependencies with common ackage structure

13:16 especially the log nuisance in java worls

13:16 world*

13:17 gfredericks: ,(Math/nextAfter 3.0 4.0)

13:17 clojurebot: 3.0000000000000004

13:19 gfredericks: huh. presumably you could use that to make a list of all the doubles in order

13:21 hyPiRion: ah, just what I need

13:25 coventry: For code wrapping purposes, I'd like to be able to access a macro from an arbitrary ns, the way you can with functions. Is there any way to do this without dropping a reference to the macro or its containing ns into the target ns? It appears that a form like (#'clojure.core/when 1 2 3 4) is treated as a function call, with [1 2] replacing [&form &env].

13:26 gfredericks: coventry: I do not quite understand what problem you're trying to solve

13:26 you can use macros from any namespace...

13:28 what are "code wrapping purposes"?

13:33 coventry: I've run into some problems with riddley which I think are difficult to solve in full generality (https://github.com/ztellman/riddley/issues/9). I have an idea for an alternative approach which does the same sort of walking as riddley, but does it at macroexpansion time. I.e., I would wrap every form in a macro which upon expansion wraps every form in its body in a macro, etc. But I need a way to refer to this wrapping macro in the

13:33 target source file/namespace. I could drop it in with an (intern), or by tampering with the (ns) form. I'm wondering if there's a more elegant way.

13:34 gfredericks: you want a macro A that expands to calls to macro B and don't know how to do that?

13:35 coventry: No, I have a file file.clj which I want to read in, wrapping every top-level form with a macro A, and I want a clean way to refer to A in file.clj's namespace(s).

13:36 gfredericks: if you know that A's namespace will be loaded, all you need is to use the fully qualified symbol that refers to A

13:36 syntax-quote normally takes care of this for you

13:36 ,`when

13:36 clojurebot: clojure.core/when

13:38 coventry: That means some way of dropping a reference to A's namespace on file.clj during the read process. I was looking for a way to avoid that. For instance, I can do a (#clojure.string/replace) call without having a reference to clojure.string in the current ns. It would be nice to have a way to do that with macros.

13:39 (Nice for this particular application.)

13:39 gfredericks: that's the same though

13:39 because that requires somebody to have loaded clojure.string

13:39 what do you mean by "dropping a reference to A's namespace on file.clj"?

13:40 * seangrov` is paying for every sin ever committed in past lives with ruby

13:40 seangrov`: I've learned a valuable lesson, now please make the pain stop...

13:40 technomancy: last night I found myself wondering if it would be possible to write a macro that could losslessly collapse nested `loop`s into a single loop containing each of the loop locals

13:41 for something like http://paste.lisp.org/display/139288

13:42 coventry: (Oops, meant #'clojure.string.) gfredericks, wrt loading of clojure.string: Yes, my code analysis library will be administering the reading and transformation of file.clj's form, so it will have loaded the ns containing macro A.

13:42 technomancy: an inner recur would just recur with the outer locals unchanged, but an outer recur would reset the inner locals to their initial value

13:42 does that make any sense?

13:43 TimMc: coventry: So just use name.space/my-macro, done.

13:43 gfredericks: coventry: so I'm not sure why something like (cons `my-A-macro some-form) will not suffice

13:43 TimMc: technomancy: How would this be different from non-anaphoric loop/recur?

13:43 rasmusto: technomancy: it would be cool if list comprehensions could do something similar

13:43 TimMc: Or is that the goal?

13:44 technomancy: TimMc: you can't "outer-recur" with nested loops

13:44 TimMc: I know.

13:44 I think that's what I said. :-P

13:44 coventry: gfredericks: wrt "dropping a reference", I mean either (intern file.clj-namespace 'A A-macro) from the outside, or injecting something like (require 'A-macro-ns) into file.clj.

13:45 technomancy: TimMc: that's the only difference I had in mind. I'm not totally sure it works.

13:45 TimMc: coventry: Just try what gfredericks is suggesting, please.

13:45 technomancy: totally sure it's feasible, I mean

13:45 gfredericks: technomancy: do you think the bytecode optimizes for when some of the locals don't change?

13:46 technomancy: gfredericks: no idea

13:47 coventry: TimMc: The trouble is that my-A-macro is not in the context where that cons will be evaluated. There are multiple feasible ways to get it in there, but I was asking about a way to avoid having to do that.

13:48 If I have to inject it explicitly, I probably have to do so for every form, in case the last form changed the namespace. Not onerous, just ugly.

13:49 gfredericks: coventry: in what sense is it "not in the context"? if it's been loaded into the jvm _at all_ then it is enough "in the context" to refer to it via a fully qualified symbol

13:50 logic_prog: I need to use a sql database as part of my Clojure app. Is there a standard quite of benchmarks that both MySQL and Postgresql run on?

13:51 nDuff: logic_prog: (?)

13:51 * nDuff doesn't grok the connection between those two sentences.

13:51 coventry: gfredericks: Oh, I understand now. Thanks.

13:51 technomancy: logic_prog: don't choose based on benchmarks

13:51 nDuff: logic_prog: if I were trying to decide between those two datastores, benchmarks wouldn't come into it.

13:52 technomancy: mysql always wins at benchmarking because they just turn off all the "actually store your data consistently and safely" features

13:52 nDuff: logic_prog: benchmark results, in general, are all about the tuning. MySQL, out-of-the-box, has historically been tuned for performance over safety, and PostgreSQL, out-of-the-box, has historically been tuned for safety over performance (and to run on very resource-constrained systems)

13:52 logic_prog: ...but you can tune either one either way.

13:54 hiredman: fun fact, if you google "mysql fast migration" a large chunk of the front page is results for how to quickly migrate off of mysql

13:55 logic_prog: technomancy: oh, mysql wins = via "we'll store shit in ram and never write to disk" ?

13:55 nDuff: logic_prog: nope.

13:55 logic_prog: they write to disk, but do it poorly.

13:55 hiredman: or, I should say, that was the case last time I checked

13:56 logic_prog: hiredman: lol

13:56 technomancy: logic_prog: iirc it's more like acknowledging writes before the disk buffers have flushed; stuff like that

13:57 nDuff: ...which, if done poorly enough, can be worse than just losing the last few committed writes; if your metadata and your data are inconsistent with each other...

13:57 s/committed/"committed"/

13:57 technomancy: but yeah, unless you're distributing software for people to run in settings you don't control, I can't imagine a very solid case being made for mysql over postgres.

13:57 mtp: but nobody knows postgres!!1one

13:58 mysql is industry standard and comes with my expensive pay-for enterprise linux distribution

13:58 i am a marketing fool, let me wipe my face with my own poo

13:58 dnolen: technomancy: are you thinking about something like recur-to proposed by Michal Marcyk on clojure-dev a while back?

13:59 technomancy: dnolen: hm; no, I missed that, but it sounds like the same idea

14:02 logic_prog: dnolen: !!!

14:02 dnolen: I've been studying core.logic:

14:02 dnolen: at it's core, is it juat an unification algorithm ?

14:03 dnolen: besides unification algorithm + optimizations, what is there to core.logic / miniKanren? I feel like I'm missing something fundamental.

14:03 dnolen: logic_prog: mK is unification + interleaving search

14:03 logic_prog: interleaving seach = condi, but not conde ?

14:04 dnolen: actually, ignore what I just said. Can you explain to me why interleaving search is important?

14:04 dnolen: logic_prog: yeah mK doesn't include condi anymore, but the version in TRS does

14:04 logic_prog: dnolen: I fail to grasp this fundamental decision

14:04 dnolen: logic_prog: rather I mean condi is the only one - there's no conde, that is condi *became* conde

14:04 logic_prog: dnolen: I know that in core.logic, there is condi and there is no conde.

14:05 dnolen: I don't understand why "interleaving search" is important/interesting

14:05 dnolen: logic_prog: but this is true for mK now

14:05 logic_prog: more programs produce results

14:05 logic_prog: {core.logic, mK} both has condi; neither has conde

14:05 dnolen: oh, there are certain things wher conde will infinite loop, but condi produces results?

14:05 okay, I can believe that.

14:06 dnolen: logic_prog: depth first so yes

14:06 logic_prog: I see, so if I have something like (cond [infinite loop] [produce result] )

14:06 conde hangs, while condi hits the [produce result] part

14:06 dnolen: logic_prog: yep

14:06 logic_prog: dnolen: besides unification + interleaving search, are there any other main ideas behind core.logic ?

14:07 dnolen: logic_prog: constraint solving

14:07 logic_prog: dnolen: how is that not just unification?

14:07 dnolen: logic_prog: specifically finite domains and nominal logic

14:07 mdrogalis: dnolen: Just gave your Lambda Jam talk a watch. Fun stuff. :)

14:07 logic_prog: (in particular, isn't constriant solving = unificatino saying "fuck, I can't unify this, backtrack" ?)

14:07 dnolen: mdrogalis: thx

14:07 rasmusto: logic_prog: unificatino, heh

14:07 dnolen: logic_prog: yes, except ... performance

14:10 coventry: Regarding logic programming, etc., I've been reading Out of the Tarpit, and it would be great to have an example of app which comes close to its ideal of specifying its own requirements independently of implementation details. It all feels a little utopian, although a great ideal to strive for. (Just finished chapter 7, though. Maybe he gets more concrete later.)

14:10 *section 7

14:10 mtp: coventry how about urbit

14:11 http://www.urbit.org/2013/08/22/Chapter-2-nock.html it basically specifies some axioms of software

14:11 coventry: mtp: Thanks, I'll take a look.

14:13 logic_prog: dnolen: thanks, this was a fantastically insightful 5 minutes

14:13 dnolen: logic_prog: np

14:13 logic_prog: coventry: also, Coq -- it's all about specs and proving theorems, efficienty be damned. Natural numbers are defined as: nat := 0 | forall (n: nat), S n

14:13 numbers are _unary_ :-)

14:14 mtp: "church numerals"

14:16 aaelony: hmm, the following works (clj-time.core/date-time 2012 01 30 12 34 56) ;; #<DateTime 2012-01-30T12:34:56.000Z>, but when I parse from a string I get a ClassCastException... (clj-time.core/date-time (into [] (map #(Integer/parseInt %) (clojure.string/split "2012-01-30 12:34:56" #"(-| |:)")) )) ;; ClassCastException clojure.lang.PersistentVector cannot be cast to java.lang.Number clj-time.core/date-time (core.clj:196) I'm probably

14:16 making another silly mistake...

14:18 nathanic: aaelony: into is producing a vector, which you are passing to date-time. perhaps you want to use apply.

14:18 aaelony: nathanic: cool, I'll try that

14:19 rasmusto: aaelony: don't you want to be using clj-time.format/parse?

14:20 aaelony: rasmusto: you're right. Maybe that's better. What I'm really getting at is a function that takes in a date-string and tells me if it's in daylight savings time or not, going both forward and back in time...

14:22 rasmusto: oh hm, not sure how you'd do that, but I think using "parse" and getting a date is the first step

14:22 nathanic: aaelony: in general i would mention that clojure.core/mapv will directly produce a vector (non-lazily), and give you the same result as (into [] (map ...)) but more efficiently. and you probably didn't need a vector there anyway. :-)

14:22 aaelony: I'm thinking to just convert the date-string to a datetime, then use within? and interval together

14:23 mikerod: Is there a good/efficient way to check before calling a method that it won't result in java.lang.AbstractMethodError?

14:24 sm0ke: why is it that ##(:a {:k 1}); doesnt thow exception?

14:24 lazybot: ⇒ nil

14:25 sm0ke: should one just check for nil and throw exception?

14:25 hiredman: mikerod: abstractmethoderrors are normally sort of a correctness problem, not something you would deal with at runtime

14:26 rasmusto: ##(contains? {:k 1} :a)

14:26 lazybot: ⇒ false

14:26 hiredman: it means something isn't lining up correctly

14:26 mikerod: hiredman: Yeah, I can see your point there.

14:26 hiredman: you are calling methods on a class that claims to implment a particular interface, but doesn't really, or something similar

14:27 aaelony: I think the reason I shy away from clj-time.format/parse is that I find formatters confusing

14:28 bts-: for dev work, i have my app configured using lein's :env in project.clj. i am trying to move the app to prod. do most people use lein in production to help with config/environment stuff like this, or is there some common pattern? it would be nice if i could keep dev and prod configuration in the same place (like project.clj)

14:29 i'm currently using environ for development

14:32 sm0ke: even java map would return null i guess

14:35 i think i am thinking too much about exceptions after heated argument with friend about me saying exceptions are overrated and he would need exception handling for his exception handling code

14:35 blah

14:36 rasmusto: I find exceptions hard to reason about, but there are always exceptions...

14:37 sm0ke: nice one

14:37 uvtc: rasmusto, I take exception to that.

14:38 sm0ke: you had a problem and tried to use exception , now NullPointerException

14:38 gfredericks: (when-not (nil? x) (throw (NonNullPointerException. "should be null")))

14:39 sm0ke: eh not as nice..i liked "You had a problem and tried to use parallelism, now problems two have you"

14:40 uvtc: hehe

14:42 jenny1986: http://Fun4Days.com/sms/sms.php?share=178616

14:43 sm0ke: wtf bots posting porn video links? so it has come to this

14:43 uvtc: hit and run spam on #clojure? Hm. First time I've seen that.

14:43 indigo: We must be getting popular ;D

14:43 havenwood: same bot just hit #ruby

14:49 rurumate: euroclojure anyone?

14:51 mdrogalis: Someone here was saying that gen-class isn't the way to do it anymore - that its recommended to use a Java shim to call into the Clojure code. Did I remember that bit correctly?

14:51 devn: (:require [clojure.core.async :exclude [map into reduce merge] :as async :refer :all] :reload-all)

14:51 is there a better way to do this?

14:51 err, sans reload-all

14:54 rasmusto: devn: better in what way? What about ":as async" or something so you don't get the collisions

14:55 jonasen: devn: or you can (:refer-clojure :exclude [...])

14:57 devn: rasmusto: i find the need to prefix everything with async as really chatty

14:58 jonasen: i think i prefer to exclude from async so I need to be explicit when I want to use async/into, async/merge etc. rather than clojure.core/into

14:58 jonasen: devn: I agree

14:58 devn: anyway, it's not a big deal, i just noticed that since i last played with async the namespace declaration is getting to be kind of unwieldy

15:00 jonasen: devn: why don't you just :refer the vars you actually use?

15:00 instead of :refer :all

15:11 cmajor7: why would lein not resolve transitive dependencies for jars that were deployed to a local maven repo?

15:12 hiredman: because when you mvn installed those jars the poms you created didn't have the correct dependencies

15:13 cmajor7: that is a logical conclusion, but they do :)

15:13 have correct dependencies

15:13 I used "lein localrepo install" and -p for a pom that "lein pom" produced

15:14 just curious what could have gone wrong

15:14 at the same time I understand that with maven anything can go wrong.. :)

15:15 hiredman: did you actually set up you project from the "local repo" you are publishing to?

15:17 cmajor7: ok, false alarm.. there is something wrong with the box.. I see some other apps throwing "Caused by: java.io.IOException: No space left on device".. thx for responses though

15:44 bitemyapp: ianeslick: hi

15:44 ianeslick: bitemyapp: hi

15:45 bitemyapp: ianeslick: how's the startup?

15:45 ianeslick: Cranking away!

15:45 bitemyapp: strangemonad: I like the nick, having a hard time envisioning what a strange monad would be though.

15:45 strangemonad: Cont of Conts?

15:45 mtp: it's like a top quark

15:45 bitemyapp: ianeslick: good luck :)

15:49 ianeslick: bitemyapp: May be fruitful to have an offline conversation about what I'm up to.

15:50 bitemyapp: ianeslick: I'd like that. Are you in the Yay?

15:50 ianeslick: bitemyapp: Yay?

15:50 bitemyapp: ianeslick: Yay! Area - bay area.

15:50 SF Bay Area. It's in California. You should check it out sometime. I hear startups are big here.

15:51 ianeslick: bitemyapp: Totally outta the loop on vernacular I see. The office is at 1st and Market!

15:51 bitemyapp: That's downtown SF to you.

15:51 rurumate: Cascalog hello-world question incoming. I have the jobtracker running on port 50030, now (?- (stdout) sentence) apparently runs some hadoop job, but there are no retired hadoop jobs listed on localhost:50030/jobtracker.jsp. How to configure cascalog to connect to an actual jobtracker, instead of running things in memory?

15:51 bitemyapp: ianeslick: I'm at 3rd and Brannan. :)

15:51 llasram: rurumate: The stdout sink only works in local mode

15:52 ianeslick: bitemyapp: "It's a small world…"

15:52 rurumate: llasram: hmm, good to know

15:52 ianeslick: bitemyapp: Lunch next week? Tue or Wed?

15:52 konr: is there a way to redefine a function using its old version in the redefinition, and not the redefined one? The following causes a stack overflow: (let [wrap #(str "[" %)] (with-redefs [wrap #(str (wrap %) "]")] (wrap "a")))

15:52 bitemyapp: ianeslick: Tuesday would work well.

15:53 llasram: rurumate: For actually running from a REPL against a cluster, you need to run an nREPL server w/ the correct Hadoop classpath to pick up the Hadoop JARs and config

15:53 rurumate: You can either use `hadoop jar ...` to launch something which starts an nREPL server

15:53 rurumate: Or use leiningen and add the exact version of hadoop on your cluster to your deps and your hadoop config dir to the :resource-paths

15:54 rurumate: llasram: hadoop jar or java jar?

15:54 llasram: The `hadoop jar` subcommand. That launches a class from a JAR with the environment configured for Hadoop, including Hadoop dependency JARs and config on classpath

15:54 ianeslick: bitemyapp: Taking this offline (see email:)

15:55 rurumate: llasram: can the repl server be launched as an hadoop job?

15:55 llasram: No

15:55 I mean, you could

15:55 But it wouldn't make much senes

15:55 ~sense

15:55 clojurebot: excusez-moi

15:56 rurumate: llasram: ok, the second options looks good idea

15:56 dobry-den: technomancy: i got this syntax to work in elisp. (let. [x 1 add (fn. [a b] (+ a b)) y 2] (add x y))

15:57 a feat for the noob

16:05 nycs: user=> (seq? [[1 2]])

16:05 false ;; why?

16:05 coventry: ,(sequential? [[1 2]])

16:05 clojurebot: true

16:06 coventry: ,(doc seq?)

16:06 clojurebot: "([x]); Return true if x implements ISeq"

16:06 nycs: oh

16:07 bitemyapp: ,(seq? '())

16:07 clojurebot: true

16:14 noonian: ,(doc sequential?)

16:14 clojurebot: "([coll]); Returns true if coll implements Sequential"

16:14 noonian: ,(doc Sequential)

16:14 clojurebot: I don't understand.

16:19 tbaldridge: ,clojure.lang.Sequential

16:19 clojurebot: clojure.lang.Sequential

16:20 tbaldridge: noonian: it's an interface

16:20 coventry: http://www.brainonfire.net/files/seqs-and-colls/main.html

16:32 dobry-den: this is a slow afternoon for me. how can i turn [\0 \1 \1 \0] into [0 1 1 0].

16:33 mdrogalis: dobry-den: (map #(Integer/parseInt (str %)) coll)

16:33 dobry-den: of course. thanks

16:34 mdrogalis: Sure.

16:35 rasmusto: why do function call signatures pop up in my *nrepl* buffer but not in my .clj file buffer in emacs?

16:36 dobry-den: rasmusto: in what context? when i hover over a function, it displays the sig in the minibuffer. when i'm autocompleting, it shows the sig in the autocompletion popup.

16:37 (clojure.repl/doc myfunc) is only way i see sigs in *nrepl*

16:38 rasmusto: dobry-den: I can hover over prn in *nrepl* and see the sig, but in a normal file buffer it doesn't show it

16:38 gfredericks: ,(->> (repeatedly 5 #(rand-int 500)) (map char))

16:38 clojurebot: eval service is offline

16:38 gfredericks: &(->> (repeatedly 5 #(rand-int 500)) (map char))

16:38 lazybot: ⇒ (\Ǎ \( \_ \Ƅ \Ä)

16:39 rasmusto: dobry-den: er what? now it's showing call signatures for some other lisp in my clj buffer :o

16:39 oh, I manually turned on ElDoc

16:46 technomancy: dobry-den: wow, faking out lisp-1 in a lisp-2? very cool.

16:46 uvtc: Regarding seesaw, can anyone tell me what "actions" are, or what the difference is between actions and listeners?

16:47 rurumate: llasram: tried with hfs-seqfile instead of stdout, and added the hadoop-1.2.1 dir to the classpath with :resource-paths. But apparently the job still runs in-memory. Maybe I overlooked something?

16:49 nDuff: uvtc: Seesaw's actions wrap Swing actions, so it'd probably make sense to start with Swing's docs there.

16:49 llasram: rurumate: Your cluster configuration on the lasspath?

16:51 nDuff: uvtc: ...actions complect a bunch of additional things together -- keystrokes, mnemonics, handlers, etc., while listeners are just listeners.

16:51 uvtc: nDuff, yes... though, the Java docs tend to jam terms together, such as ActionListener and ActionEvent...

16:52 nDuff, ok.

16:52 rurumate: llasram: oh you mean, I need the conf/ folder in classpath root? no

16:53 llasram: Yep. That's how it finds those files once the JVM starts

16:55 rurumate: llasram: oh yeah it works, thank u

16:56 llasram: np

17:00 rasmusto: dobry-den: I was missing a hook for 'nrepl-turn-on-eldoc-mode, found it

17:17 aaelony: For those interested, here's a refheap to my daylight-savings-time? function. https://www.refheap.com/19417 Internally there is a vector of daylight savings time ranges for 2012 and 2013. The function returns true or false for an input date string.

17:21 gws: aaelony: interesting, what about wrapping http://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html ?

17:24 aaelony: gws: maybe but this suits my purpose better and I find it less confusing.

17:29 nathanic: aaelony: I think you can factor out some redundancy by simply using `or` instead of that `if` and `true` and `some` business. something like:

17:29 aaelony: (defn dst? [date-string] (let [date (to-datetime date-string)] (or (within (interval ...) date) (within (interval ...) date) ...))

17:32 aaelony: nathanic: I need it to return false instead of nil for the non-true case though

17:32 nathanic: aaelony: `or` returns true if any of its arguments is truthy. else it returns false.

17:33 aaelony: nathanic: that's correct, but some returns nil when not true

17:34 tbaldridge: nathanic: correction, it returns truthy

17:34 ,(or false nil 42)

17:34 clojurebot: 42

17:34 talos: helo is this a sex room?

17:34 mtp: yes

17:34 talos: i am nude

17:34 nathanic: aaelony: you don't need `some` as far as i can tell

17:34 mtp: we have sexpressions

17:34 (oh 'baby)

17:34 llasram: *snort*

17:34 mtp: (defn fuck [partner] (let [pants off

17:35 nathanic: tbaldridge: I stand corrected :-)

17:35 llasram: I have been told that the correct pronunciation of s-exp is "sex-p"

17:35 uvtc: hehehehe

17:35 Gah. Crude humor catching me off guard here.

17:36 talos: you boring i am going to scala sex room

17:37 #scala

17:37 aaelony: nathanic: probably right. I only added it when (time/date-time 2014 11 02 02) was bombing and became (time/date-time 2014 11 2 02)

17:37 clojurebot: excusez-moi

17:37 nathanic: and regarding `or` returning truthy, I suppose I did know that, because I have done a lot of (let [x (or some-arg-that-might-be-nil default-value-if-that-arg-was-nill)])

17:38 talos: buy room :)

17:50 technomancy: talos: sod off

17:51 oh, he left

17:51 mtp: technomancy "i chased him out" :)

17:55 technomancy: mtp: gotta put on your robe and wizard hat

17:56 mtp: or i can just take out my sexpressions

17:58 * ucb waves

18:07 yeoj___: is there anyway to use a not= and compare the results to multiple items... it's already embedded in a map so i'm not sure.

18:08 It's a beginner question, sorry. pastebin'd here: http://pastebin.com/FBiPtrk8

18:09 i don't think i should be "nesting my filter" because i want to filter on the not= to a coll

18:09 rasmusto: yeoj___: and?

18:10 ucb: yeoj___: you can filter with a set and not

18:10 yeoj___: like (filter (comp not #{:this :that}) collection)

18:10 wait

18:10 `cbp: remove? :P

18:10 ucb: ,(filter (comp not {:foo :bar}) '(:foo :bar :baz))

18:10 rasmusto: ucb: (remove #{:a :b} coll)

18:10 clojurebot: (:bar :baz)

18:11 ucb: that's probably nicer :)

18:11 rasmusto: you have to be careful about falsey values in the set though

18:11 ucb: and correct

18:11 yeah, that's what I was thinking

18:11 rasmusto: ,(remove #{nil false :a} [nil false true :a :b])

18:11 clojurebot: (nil false true :b)

18:11 yeoj___: geez. lisps bend my brain. in a good way.

18:12 rasmusto: ,(remove #{nil false :a} [nil false true :a :b])

18:12 clojurebot: (nil false true :b)

18:12 rasmusto: ,(map #{nil false :a} [nil false true :a :b])

18:12 clojurebot: (nil false nil :a nil)

18:12 yeoj___: ucb: the problem

18:12 ucb: the prob is there are two collections

18:13 ucb: i want to filter all results (coll) to make sure it's not any of another collection

18:14 rasmusto: wait a second, now I'm confused about the "set containing falsey values as a predicate" thingy

18:14 how do nil and false get through?

18:15 coventry: yeoj___: Where is the other collection in your pastebin?

18:15 yeoj___: coventry: it's in the comment

18:15 rasmusto: oh, nm, was thinking of filter

18:15 jonasac: i've bumped into this a couple of times now and figured i should ask here in case there is a good way to do this

18:15 yeoj___: coventry: so, i want to filter the results to make sure the schema is not in '("pg_catalog" "information_schema")

18:15 jonasac: i have a function like [x & y]

18:15 and i wanto recur on it

18:16 yeoj___: coventry: i'm trying to look at postgres, and return all tables that are interesting. i.e. not system tables. I want to build a database automapper sorta thing, to generate ddl for othre systems based on lookups. (i.e. postgres timestamp -> mssql datetime ) for data migration stuff.

18:16 joegallo: jonasac: and have you run into a problem doing that?

18:17 rasmusto: jonasac: are you wondering about the termination condition?

18:17 (because I am too)

18:17 jonasac: no but i want to do something like (recur ~@y)

18:17 if that makes sense

18:17 coventry: yeoj___: Try (remove #(#{"pg_catalog" "information_schema"} (:table_schem %)) (get-sql-metadata...))

18:17 jonasac: since clojure packs y into a vector

18:18 yeoj___: coventry: ok thanks. i'll try to understand that statement. so much to learn. too bad it's not my day job. :/

18:19 coventry: yeoj___: ##(#{0 1} 2)

18:19 lazybot: ⇒ nil

18:19 yeoj___: coventry: that works... but i don't exactly understand it yet. But cool beans. thanks.

18:19 coventry: yeoj___: ##(#{0 1} 1)

18:19 lazybot: ⇒ 1

18:19 rasmusto: jonasac: would it work to have the second argument be a collection? Do you need the multi-arity thing?

18:20 jonasac: rasmusto: thats the way i usally solve it, but it encouter this quite alot of figured i should see if there is some 'idimatic' way to do this that i just missed or something

18:20 rasmusto: jonasac: that way you can terminate on (empty? coll)

18:20 jonasac: i think it gets weird checking for that condition if you have, say, a nil last element

18:20 so you'd have a [x nil, y '()]

18:21 which means you skip one loop

18:21 jonasac: yeah the last binding will be nil

18:21 looks like i'll have to change my ways :p

18:22 rasmusto: i've tried to do fancy vector destructuring with loop/recur, and that termination thing has always felt clunky

18:22 jonasac: yah

18:22 working on 4clojure golfing

18:22 rasmusto: ah, that's why you don't use a let :p

18:22 jonasac: yep

18:23 rasmusto: ,(filter #{nil false :a} [nil false true :a :b])

18:23 clojurebot: (:a)

18:23 rasmusto: ah, that's what I remember about set-as-a-predicate-with-falsey-elements

18:23 technomancy: ztellman: you don't work with icylisper any more, do you?

18:30 frozenlock: Is there a function to check if a string 'looks like' a date time?

18:30 The closest I got was to use clj-time and try to unparse using pretty much all formatters :-/

18:31 Parse even

18:32 jonasac: frozenlock: regex ;p

18:48 mdeboard: Man I would love something like clojure's threading macros in javascript. Maybe cljs has this but like (->done (->then promise f1 f2 f3 f4) finalFunc)

18:50 of course cljs uses channels for that sort of logic.

19:07 ztellman: technomancy: sorry for the late reply, but no

19:07 haven't talked to him in more than a year

19:08 technomancy: ztellman: oh, he's (was?) at runa, right

19:08 do you know if he has plans to pick back up with jark?

19:09 ztellman: was, Runa shut down the Bangalore office a while back

19:09 technomancy: oh, gotcha

19:09 ztellman: and I'm not sure

19:09 technomancy: grenchman kinda overlaps a lot with jark, but it looks like jark has basically stalled

19:10 ztellman: as far as I know, it was more an exercise in curiosity than scratching any particular itch

19:10 so I wouldn't be surprised if it's been abandoned

19:10 technomancy: yeah, that's what I figured. the nREPL protocol totally changed since it was written, which probably made it difficult to justify putting more work into it.

19:25 coventry: Weird that both jark and grenchman are written in OCaml. Does it have some specifically useful features for this problem?

19:26 bitemyapp: coventry: handy-dandy binaries

19:34 technomancy: FP, fast startup and (originally) small binaries, but the latter actually doesn't pan out once you use the Jane Street libs

19:35 could have used racket just as well, but wouldn't have learned as much

19:35 racket doesn't compile to native code, but it can still be very small and starts just as quickly

19:36 coventry: bitemyapp: technomancy: Thanks.

20:14 logic_prog: nrepl question ==> I am aware of nrepl-send-string-sync. It is not what I want. I want a command which simulates typing a given string into my *repl* buffer and hitting enter. In particular, I want this command run right in the *nrepl* buffer -- and I want it's output sent to the *nrepl* buffer.

20:15 How do I do the above?

20:20 coventry: You could do it with a macro, which can be bound to function names and keys. http://www.emacswiki.org/emacs/KeyboardMacros

20:36 holo: hi

20:42 http://clojure.org/java_interop <- mentions: "Once a type hint has been placed on an identifier or expression, the compiler will try to resolve any calls to methods thereupon at compile time." and https://github.com/clojure/core.typed/wiki/User-Guide mentions: "We use the term "type" to mean static type and "tag" for runtime tags. Types only exist at compile time and are used by the static type system to model runtime invariants and properties….

20:47 Gnosis-: hi holo

20:47 frozenlock: Is there a way, using an embbeded nrepl in a project, to send a message to the user when he connects to the repl?

20:47 holo: i'm planning to use type hints, or core.typed, or schema for more useful documentation.. often i find myself using types in names like something-str

20:47 hi Gnosis-

20:49 probably i'm going to start with type hints and evolve to schema when necessary

20:49 technomancy: frozenlock: you could do it with an nrepl middleware that watches for op=clone, I think

20:50 frozenlock: technomancy: hmm, I take a look at that, thanks!

20:54 Another totally unrelated question... is there a way to reboot a 'lein run' from inside a repl? I'm thinking of maybe using the System/exit with some kind of shell script that checks if there a java app running, but it feels dirty :-/

20:55 (I said 'lein run', but it might as well be a running uberjar)

21:02 technomancy: you should be using runit or something to keep the server up anyway

21:02 so System/exit is fine

21:02 mtp: runit is the best <3

21:04 bitemyapp: or upstart.

21:04 if you hate yourself like I do.

21:04 mtp: upshart does stupid things with stderr

21:04 like "throws it away"

21:05 bitemyapp: don't get me started.

21:05 you have to manually dump 2 somewhere in initramfs

21:05 frozenlock: Ahhhh so many things to read about :)

21:05 mtp: that's why i call it upshart

21:05 technomancy: upstart is infuriating in that it refuses to check updated job config upon restarts; you have to explicitly reload

21:05 I have lost several hours to that, and I hardly use upstart

21:06 bitemyapp: ditto.

21:06 technomancy: that said, at least it's not systemd

21:06 bitemyapp: technomancy: been fighting monsters lately?

21:06 mtp: i bet you can't guess the unflattering euphemism i have for systemturd

21:06 i mean systemd

21:06 technomancy: bitemyapp: just boring rubby

21:06 bitemyapp: technomancy: I was referring to the cowboy hat, but that works too. :)

21:06 mtp: that's a dysphemism.

21:07 technomancy: cowboy ... hat?

21:07 oh oops

21:07 mtp: bitemyapp‘ you are, of course, correct :)

21:07 technomancy: yeah, there was a #scala tcroll

21:07 bitemyapp: really?

21:07 Scala trolls have been trolling me at work.

21:07 They're trying to rope me into some kind of retarded "show down" at a meeting

21:08 It has taken immense amounts of self-control to just ignore them.

21:09 technomancy: he actually left before I realized he had joined, but I have join/parts hidden

21:10 bitemyapp: if I have to go back to deploying Python apps after only having to concern myself with firing up a jar and a database I am going to cry.

21:10 technomancy: a jar and a database and upstart

21:11 bitemyapp: okay, yes

21:11 but upstart is a given even with Python.

21:11 OlegYch8: technomancy: what makes you think he was a "scala" troll

21:12 technomancy: OlegYch8: he seemed to imply he preferred the company of the #scala channel

21:12 maybe he just meant he thought he'd get more of a rise out of them

21:12 TimMc: That was my interpretation.

21:13 mtp: i assume he wanted sex

21:14 but we only had sexp

21:14 does scala have sex?

21:14 bitemyapp: mtp: Scala only has SEXML DSLs.

21:14 OlegYch8: heh

21:14 TimMc: No, I believe it, too is a genderless construct.

21:15 OlegYch8: jfyi he has no relation to #scala

21:18 gfredericks: so if you make a lib that has some specialty types and wants to make them serializable via data readers, the best approach is to just recommend an entry for data_readers.clj in the README?

21:18 i.e., make it not work by default?

21:21 rlb: So I have a program that only includes cheshire and clj-http and then retrieves a url, parses the json body, and prints it, and it takes about 2.5s (as compared to 1.0s for a no-op clojure program). Is that expected, or is there something I might be doing wrong? (running via "java -jar uberjar").

21:24 technomancy: OlegYch8: sorry for besmirching that channel =)

21:25 dnolen: rlb: did you AOT?

21:27 rlb: dnolen: hmm, not sure, possibly not -- lein is complaining about AOT (needing :aot :all in the :uberjar profile), but "lein new app" did put this in the project: ":profiles {:uberjar {:aot :all}}", which looked somwhat like what lein was asking for.


21:27 I'll need to learn a bit more about AOT.

21:27 dnolen: rlb: but also what are you trying to test here, writing shell scripts w/ Clojure?

21:28 rlb: dnolen: yep -- in some cases, clojure's fast enough, so I use it, but in others, I have to revert to python.

21:28 Since I hadn't used this lib combination yet, just wondered if I might be doing something wrong.

21:28 (python or whatever)

21:28 frozenlock: Last time I needed to make a quick and dirty graph from a timeseries, the easiest way was with incanter. Is it still the case?

21:28 dnolen: rlb: yeah startup is going to dominate for trivial things unless you AOT, even then you're still going to lose a second or so

21:29 rlb: well startup + compile time

21:29 OlegYch8: technomancy: no worries

21:29 rlb: I'm ok in some cases with runtimes close to 1.0s (and of course longer if it's a long running program), but in this case, a base of 2.5s may be too high.

21:29 technomancy: rlb: you could try grenchman if you don't mind keeping a daemon running

21:29 rlb: technomancy: right

21:30 technomancy: I also saw someone post unixdomain nrepl (re previous discussion)

21:31 Does the fact that lein's complaining about AOT during "lein uberjar" mean that I probably don't have all the right bits set?

21:32 frozenlock: Wtf... I just realized we are Friday. I must have lost a day somewhere in the week... o_O

21:36 holo: heh.. :) programmers always think weeks are too short

21:36 ruzu: do you feel... probed?

21:37 victims of... probing... sometimes describe a loss of time.

21:37 technomancy: rlb: there's a bug in the warning criteria; should be fixed in a release tomorrow

21:37 mtp: ruzu‘ haha

21:37 frozenlock: Hmm... I should check for new scars...

21:37 rlb: technomancy: oh, ok thanks.

21:39 technomancy: rlb: just check the jar file for .class files

21:40 holo: this image came to my mind: http://farm6.static.flickr.com/5202/5255814637_274168a8dd_z.jpg

21:40 rlb: technomancy: yep, the main namespace has class files.

21:57 dnolen: being able to step debug CLJS is a pretty freaking amazing time saver

21:58 gf3: :D

21:59 dnolen: if you just use whitespace optimization, you get sensible locals and everything

21:59 muhoo: wat, did source maps happen to cljs while i wasn't looking?

21:59 dnolen: muhoo: yeah a couple of weeks now

22:01 gf3: dnolen: Although I couldn't get them working the other day

22:01 akurilin: bitemyapp, ping. How do you prefer people to filter by method with bulwark? As in, do you want users to wrap the middleware in their own middleware that checks for method, or is there something in the lib that can do it for you?

22:02 dnolen: gf3: use Canary it just works, don't need browser REPL

22:02 gf3: dnolen: That being said, I didn't try very hard because I was in a rush for the ClojureCup

22:02 bitemyapp: akurilin: the functions you're passing to bulwark can do that or you can do it at the middleware application level

22:03 akurilin: we discussed basically this exact same thing with pathing and the answer was the same then.

22:03 either make the fn handler for the whitelist/blacklist check the content of the request or selectively apply the closed over middleware.

22:04 there's nothing in the lib to do this because the lib shouldn't concern itself with those kinds of details. It's just functions.

22:06 ruzu: anyone use La Clojure? i'm a total newb but it's been seeming pretty nice

22:06 bobwilliams: user=> (take 4 (iterate #(map + [0 -1] %) [5 5]))

22:06 ([5 5] (5 4) (5 3) (5 2))

22:06 why is only 1st item a vector?

22:07 thanks for any help

22:07 bitemyapp: Kinda caremad cljs has a step debugger before we do.

22:07 I mean, anything for the greater glory of Clojure, but god damn.

22:09 TimMc: "caremad"?

22:11 TEttinger: bobwilliams, that's the type of the first arg, map later returns seqs.

22:12 ##(take 4 (iterate #(mapv + [0 -1] %) [5 5]))

22:12 lazybot: ⇒ ([5 5] [5 4] [5 3] [5 2])

22:12 ruzu: what is lazybot running?

22:13 TEttinger: ##(clojure-version)

22:13 lazybot: ⇒ "1.4.0"

22:13 bobwilliams: TEttinger: big thanks!!

22:13 TEttinger: np

22:13 gotta go

22:13 bobwilliams: later

22:15 akurilin: bitemyapp, so if I wanted to only check for say POSTs and want to use the list of rules inside of blackwater, I could whitelist everything but POST, right?

22:16 bitemyapp: akurilin: you've moved to a different library methinks

22:16 akurilin: do you mean bulwark?

22:16 akurilin: shoot, bulwark.

22:17 bitemyapp: akurilin: the function you pass to bulwark can whitelist anything you want. You can make an anonymous function generator that works against a spec of allowed path and HTTP method combos if you want.

22:17 akurilin: I don't think there's another way without a separate middleware wrapper of getting "only check % of hits on this set of request conditions"

22:17 *#

22:18 blacklist/whitelist tests are hit # agnostic, correct?

22:18 *hit count

22:19 bitemyapp: akurilin: aye.

22:19 akurilin: that's getting into throttling behavior.

22:20 akurilin: you realize you can generate an arbitrary number of "protect-middlewares" right?

22:20 akurilin: and apply them selectively to routes or groups of routes at will

22:20 that's the whole point of the closures, they're more powerful than a single "protect-middleware" with the muggle-mode atom config

22:21 akurilin: also do you *really* need to be this persnickety with bulwark? What are you protecting?

22:22 akurilin: bitemyapp, that's fair with the multiple protect-middleware, just wrap handlers inside of POST with them, then you don't have to bother right checking for method, eh?

22:23 bitemyapp: Right.

22:23 akurilin: that's part of the whole point of Ring's design. Just wrap whatever you want.

22:23 It's very general and powerful once you realize what it's offering you.

22:34 akurilin: bitemyapp, I hear ya.

22:34 also reminds me how I need to nuke liberator from this one page so that I can actually use that approach :)

22:35 coventry: Anyone gotten jswat working with clojure, as described here? http://dev.clojure.org/display/doc/Debugging Does it work with a "lein repl" session? "lein repl" with the given jvm-opts does allow you to connect to jswat and set a breakpoint, but I can't figure out how to hit that breakpoint. Just (require)ing a file which hits it from the repl doesn't seem to work.

22:39 Holy shit, I got it to hit the breakpoint.

22:42 Is there some way to evaluate clojure forms in the evaluator window? I guess it's not hugely useful without that.

22:42 gf3: bitemyapp: How do you typically deploy your composure apps?

22:47 coventry: How do you say (eval (read-string "clojure code")) in java?

22:49 Foxboron: I just saw rich posting "tools.analyze" on github. Is that a possible solution for messy stacktraces?

22:54 dnolen: Foxboron: unrelated, that's for Bronsa's Clojure-in-Clojure work

22:54 bitemyapp: gf3: http-kit, uberjar, lein-otf or :aot :all, a script.

22:54 gf3: if you get more specific I can be more helpful. I actually deployed a Compojure application a few hours ago at work.

22:55 coventry: jswat hung a few seconds after complaining about an exception from evaluation of clojure.lang.Compiler.eval(clojure.lang.RT.readString("wrapped-internals")). The hanging might be a coincidence. The internal call to readString ran without errors.

22:55 gf3: bitemyapp: Are you using nginx?

22:56 bitemyapp: gf3: I do with public apps that have static assets.

22:56 gf3: this one is an internal API server - no point.

22:57 I make a point of copying the static assets to the nginx servers so they can serve that content directly.

22:57 gf3: bitemyapp: Ahh—do you know of any decent/current articles re: proxying from nginx?

22:58 bitemyapp: gf3: I end up googling it every single with reasonable amounts of success in finding something about reverse proxying in nginx. I don't have anything on-hand, sorry./

22:58 gf3: bitemyapp: np <3

23:06 Foxboron: dnolen: that explains it. Dosnt dim the interesting part tho

23:29 holo: ,(str \n)

23:29 clojurebot: "n"

23:29 holo: howto => "\n"?

23:30 xeqi: ,"\\n"

23:30 clojurebot: "\\n"

23:30 holo: xeqi, thanks, but char input is mandatory

23:31 xeqi: ,\newline

23:31 clojurebot: \newline

23:31 xeqi: ,(str \newline)

23:31 clojurebot: "\n"

23:31 holo: (inc xeqi) ; awesomeness!

23:31 lazybot: ⇒ 9

23:37 TimMc: &(filter #(< 2 (->> % pr-str count)) (map char (range 0 256)))

23:37 lazybot: ⇒ (\backspace \tab \newline \formfeed \return \space)

23:40 holo: (inc TimMc) ; thanks, you saved me further inevitable bugs

23:40 lazybot: ⇒ 48

23:53 muhoo: ~primitive

23:53 clojurebot: Gabh mo leithscéal?

23:54 muhoo: in this document, they talk about "primitive support". https://github.com/Prismatic/eng-practices/blob/master/20130926-data-representation.md . what do they mean by "primitive"?

23:56 coventry: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

23:56 xeqi: muhoo: primitive support refers to values that are not objects. like ints, longs, doubles, etc

23:57 muhoo: ah, thanks

Logging service provided by n01se.net