#clojure log - Dec 09 2013

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

0:01 justin_smith: you should really be seeing the line numbers in your own namespace

0:01 are you explicitly loading the ns? is a tool doing it for you?

0:03 cljr: nothing out of the ordinary

0:03 coventry: Maybe it's one of those uninformative compiler errors. Can you post the repl interactio, cljr?

0:04 cljr: coventry: im able to grok what is going on, was just confued initially by why it doesn't direct me straight to the spot in my file

0:04 what is the "right" place to post it?

0:05 coventry: refheap.com is nice for clojure code.

0:05 cljr: nothing exotic, it is just basic lein new app or whatever, then cd into that directory and lein repl

0:06 coventry: Yeah, I meant paste the transcript of the repl input and output, up to the stacktrace.

0:11 bitemyapp: emaphis: meh.

0:11 coventry: it's true (Common Lisp, monads), but that really just highlights how powerful a type system can be.

0:12 coventry: also, I think there's a way to make what he wants work well in Common Lisp.

0:12 mysamdog: So I'm having more trouble with clojurescript (suprise suprise)...

0:12 bitemyapp: but it would require whole-program transformation like a compiler.

0:14 coventry: bitemyapp: Sounds interesting. Going to bed now, but I'll ask you about it / check IRC later.

0:17 mysamdog: The relevent part of my code is here: https://www.refheap.com/21613

0:19 It compiles without warnings/errors, and there are no errors in the console. However, when I click any part of the page that has the class topitem, nothing happens. What did I do wrong?

0:25 justin_smith: cljr: if that is all you did, your namespace should not even be available

0:34 Raynes: refheap is your thing right? Did you also do emacs refheap mode?

0:37 bitemyapp: justin_smith: yes and yes

0:39 justin_smith: OK. I was going to suggest doc strings because good emacs citizens use doc strings, but I just forked it and am writing them myself.

0:39 and will make a PR

0:47 andyf: I've just seen pprint, with *print-meta* bound to true, print an expression like this: (^^^{:key1 val1} {:key2 val2} {:key3 val3} val4). Does that look like a bug?

0:48 justin_smith: Raynes: pr sent

0:49 andyf: to my ignorant eyes, definitely

0:50 andyf: I'll have to see if I can figure out why this is happening. Very odd.

0:52 Wait, I think it might be metadata *on* other metadata.

0:52 amalloy: andyf: i mean, it's not technically a bug - that's a valid expression

0:52 justin_smith: amalloy: that would load all the metadata properly?

0:52 amalloy: &(meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4)

0:52 lazybot: ⇒ {:key3 val3}

0:53 andyf: Even stranger is that all the keys were the same in the example I actually saw.

0:53 amalloy: &(binding [*print-meta* true] (pr-str '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4))

0:53 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

0:53 amalloy: ,(binding [*print-meta* true] (pr-str '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4))

0:53 clojurebot: "^{:key3 val3} val4"

0:53 amalloy: wait, really?

0:54 andyf: yes, but if metadata maps can have their own metadata, then I don't see why it would be illegal

0:54 amalloy: right

0:54 and of course they can; they're maps

0:56 hyPiRion: That's just like the expressions `#_#_#_ hello my friend`

0:56 ,#_#_#_ hello my friend

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

0:56 amalloy: andyf: i'm actually not sure that's a correct syntax for putting meta on the meta-maps, though; it doesn't seem to work

0:56 &(meta (meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4)))

0:56 lazybot: ⇒ nil

0:56 andyf: Well it is printed out from pprint, and I'm not sure I have options set to make it print readably.

0:57 justin_smith: ,(take 4 (iterate meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} a))

0:57 clojurebot: (a {:key3 val3} nil nil)

0:57 justin_smith: one would expect a reverse stack of metadata

1:00 andyf: That syntax does not make the reader complain, but it doesn't seem to set the metadata in a nested fashion. You can do it with nested with-meta calls, of course.

1:01 hyPiRion: yeah, doesn't seem like the reader literals stack, they just merge together. Which is to be expected, considering ^:foo expands to ^{:foo true} etc.

1:02 ,(meta ^:foo ^:bar {})

1:02 clojurebot: {:foo true, :bar true}

1:02 andyf: I don't think they are merging. I think only one is being kept and the rest are being lost.

1:03 hyPiRion: andyf: oh, I mean the ^expr ^expr syntax, the ^^^ one just discards

1:03 TimMc: Freakish.

1:03 amalloy: andyf: i agree that seems to be what's happening; i don't quite see what in the reader is making that happen

1:06 hyPiRion: ,(binding [*print-meta* true] (pr-str (with-meta {1 2} (with-meta {3 4} {5 6}))))

1:06 clojurebot: "^^{5 6} {3 4} {1 2}"

1:08 hyPiRion: I wonder if this is a bug in the reader or printer

1:08 andyf: I would guess reader.

1:09 I mean, not that it allows reading this syntax, but that it doesn't set the nested metadata properly.

1:10 amalloy: hyPiRion: it has to be the reader, right? that expression must have some printed form, and it can't be "^{5 6} ^{3 4} {1 2}", because that's defined to be the same as "^{3 4, 5 6} {1 2}"

1:11 mysamdog: The dommy selection macros do not appear to work for me.

1:14 hyPiRion: amalloy: must it? I was under the impression that it was only required when *print-dup* was set to true

1:14 ,(binding [*print-dup* true *print-meta* true] (pr-str (with-meta {1 2} (with-meta {3 4} {5 6}))))

1:14 clojurebot: "^^#=(clojure.lang.PersistentArrayMap/create {5 6}) #=(clojure.lang.PersistentArrayMap/create {3 4}) #=(clojure.lang.PersistentArrayMap/create {1 2})"

1:15 hyPiRion: hrm, yeah, that's not going to work

1:36 tufflax: If I have Java code in my lein project, can I recompile and reload that while lein repl is running?

1:48 bitemyapp: tufflax: who's recompiling?

1:48 tufflax: I am

1:49 bitemyapp: tufflax: no, is lein repl recompiling or is somebody else?

1:49 tufflax: I dunno, whatever works

1:49 bitemyapp: tufflax: alright, so try that.

1:49 tufflax: Excuse me, how?

1:52 bitemyapp: tufflax: try the simplest thing that could possibly work.

2:22 arrdem: you're lucky I check twitter.

2:22 lazy arse.

2:23 arrdem: bitemyapp: br0. I'm sleeplessly twittering.

2:23 I don't lurk on IRC 24/7...

2:24 bitemyapp: also thank you for $googling for me

2:24 bitemyapp: arrdem: np.

2:24 I was curious too.

2:25 arrdem: dear sleep, why do I need you

2:25 bitemyapp: arrdem: http://www.haskell.org/haskellwiki/Typeclassopedia should put you right to sleep.

2:26 arrdem: I should patch irssinotifier... I get a push notification to my phone whenever you ping me. It's mildly entertaining to hear the latency change over the course of a day.

2:28 bitemyapp: arrdem: memory leak?

2:29 arrdem: bitemyapp: no I think it's something in google's push service. right now I'm seeing sub-second, but I've seen it go as high as four or ten minutes.

2:35 bitemyapp: arrdem: the mistake is in relying on Google to do anything

2:36 arrdem: bitemyapp: well there's that

2:39 clojurebot: ping

2:39 clojurebot: PONG!

3:52 tufflax: bitemyapp: I don't know what that is

3:55 bitemyapp: tufflax: how do you load Java code in Clojure?

3:56 tufflax: however you accomplish that, do it.

3:56 tufflax: change the code, then do it again.

3:56 gg gl hf wp fo

3:56 tufflax: import? i tried just that, did not seem to work

3:57 bitemyapp: tried what?

3:58 tufflax: using import

3:58 bitemyapp: tried what though?

3:59 tufflax: Importing my class, using it. Then lein javac to recompile, importing again, tried new feature of class, did not work

4:00 bitemyapp: lein javac has nothing to do with it

4:00 tufflax: Ok, can you elaborate please?

4:01 bitemyapp: tufflax: https://groups.google.com/forum/#!topic/clojure/dt1PTIJsiRY

4:06 * ucb waves

4:09 tufflax: bitemyapp: I don't use those IDEs so that did not help me much

4:19 ucb: bitemyapp: http://www.youtube.com/watch?v=Ay7_5Qq5WCc

4:19 rurumate: I need to do some (left inner) joins in hadoop; it's too tedious with clojure-hadoop, so I will give cascalog a try. Is there an intro that goes beyond the in-memory hello world jobs and shows the configuration details to run jobs on a real hadoop cluster?

4:25 nonuby: how does one ideally access arbitary config data in project.clj e.g. { :profiles { : dev { :my-name "nonuby" } } }

4:28 clgv: nonuby: the project code itself usually (without additional plugins or such) can only access project.clj via reading the file

4:28 bitemyapp: ucb: wat

4:29 clgv: nonuby: leiningen plugins are called with the project map as parameter

4:29 ucb: bitemyapp: heh

4:30 nonuby: so all the magic of compositing, merging https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md of profiles isn't available at runtime to me? maybe Im approaching this wrong, so if I want to get :redis-server-hostname (a different one for :dev and :production) I have a open the file, and parse it myself/

4:42 bitemyapp: ucb: http://i.imgur.com/1nIpODq.jpg

4:43 arrdem: http://i.imgur.com/1nIpODq.jpg

4:43 ucb: heh

4:43 much humour

4:43 clgv: nonuby: I am not sure whether there is a leiningen plugin that helps you with that.

4:44 nonuby: usually you'd have (Clojure) config files or environment variables to configure your application

4:45 nonuby: falling back to environment variables

4:46 clgv: but you could deploy with leiningen and let it inject the config from project.clj into your application (via a leiningen plugin).

5:33 G0SUB: memes on #clojure. hmm.

5:37 deadghost: can anyone point me to how file organization works?

6:10 clgv: deadghost: sourcefiles?

6:12 deadghost: clgv, yes

6:12 right now I just want to split a file into two

6:14 not sure if I need to tell project.clj what files depend on what

6:14 or if and what I need to cram into files

6:15 also a little confused by default file structure

6:15 project-name/src/project-name/project-name

6:16 clgv: deadghost: ah ok. no you do not need to tell project.clj about the single namespace files

6:18 deadghost: say you want to use functions from src/bla/blubb.clj in another namespace then you just used (:require [bla.blubb :as bb]) in the other namespace and can acces all functions, e.g. (bb/my-fun 42)

6:19 deadghost: I take it :use is bad practice

6:20 clgv: deadghost: in source files, yes. on repl it's just more convenient in some cases ;)

6:20 deadghost: http://clojure-doc.org/articles/language/namespaces.html

6:22 deadghost: alright more straight-forward than expected

6:22 though default lein project structure leaves me confused

6:22 clgv: deadghost: what's confusing?

6:23 deadghost: default is project-name/src/project-name

6:24 what goes into src/project-name

6:24 and what deserves its own folder

6:24 or just free-floating files in src/

6:27 oh I'm not sure, but is src/project-name just for namespace?

6:28 so it's :require [project-name.core]

6:28 instead of :require [core]

6:30 vijaykiran: deadghost: if you have src/core.clj -> your namespace will be core and you can :require [core] in other projects/namespaces

6:31 deadghost: but it is not recommended to use the "default" one - so the practice is src/project/core.clj => (ns project.core) => (require [project.core]

6:32 clgv: top level namespaces are directly under "src/". hierarchic namespaces e.g. "my.project.core" is placed in "src/my/project/core.clj"

6:34 deadghost: do most projects typically have everything under src/project-name?

6:34 what are reasons to create a new folder in src/

6:36 clgv: deadghost: hierarchic (I guess not too deep) namespaces are important to avoid collisions when using different libraries in the same project

6:37 vijaykiran: deadghost: if you create src/core.clj and another project uses same approach src/core.clj - then using them together will cause conflicts

6:38 deadghost: vijaykiran, I got that so for that reason is it typical for all project files to stay in src/project-name/?

6:38 and not have src/something-else/?

6:39 vijaykiran: deadghost: well, src/project-name is more intutive. If your project is "amazing-lib" I'd assume that *most* of the stuff is under src/amazing-lib than src/zing-bang

6:40 Apage43: agh

6:40 programming in C++

6:40 all i want is a random number and I'm going on a yak shaving safari

6:40 clgv: deadghost: yeah. the name of the lib is usually the prefix of all namespaces

6:41 Apage43: lol. there are at least two choices for that

6:41 clojurebot: Huh?

6:41 deadghost: hmm ok I think that answered everything

6:42 Apage43: caveat: 64-bits long, and actually uniformly distributed in that space

6:43 clgv: Apage43: C++11?

6:44 Apage43: nope :/

6:44 trying to get there but I still think we support some platforms that make it problematic

6:47 deadghost: I take it once you go lisp you don't (want) to go back

6:47 well I screwed that sentence up

6:49 I was looking over a friend's go code and pointed out a block of code that can be simplified with a map function

6:49 and he told me he doesn't think go has a map function

6:49 and I just got confused

6:49 Apage43: go doesn't have much abstraction power

6:50 stuff I touch at work is C(++), Erlang, and Go

6:51 each of which is fantastically frustrating in its own way

6:51 amalloy: deadghost: well, to be fair lisp is hardly the only language with map

6:51 Apage43: the C++ stuff would be less so if we could use C++11

6:51 also yeah, map is most everywhere

6:52 vijaykiran: Apage43: I've been looking into Erlang a bit - what's the main PITA in it ?

6:53 Apage43: similarly to go, very little capability to do abstraction

6:54 deadghost: people are using go for production stuff?

6:54 vijaykiran: deadghost: yup - at least google is :)

6:54 Apage43: and very little richness of data structures. The built-ins are tuples and lists, and the stdlib builds stuff out of them, but to manipulate any of those you have to use the functions that operate on them (or peek at their guts, since, they're all built out of tuples and lists)

6:55 deadghost: I've been wanting to learn erlang

6:55 then again I want to learn lots of stuff

6:56 Apage43: it's good at what we use it for, which is kind of managing tasks and state in a cluster

6:56 deadghost: my friends say I have a thing for esoteric languages

6:56 but they like their python and javascript

6:56 so lisp counts as esoteric

6:56 Apage43: but for actually mucking about with lots of data it's kind of awkward

6:57 deadghost: prolog and smalltalk are also on my todo list

6:57 will hit prolog when I get around to reading PAIP

6:58 vijaykiran: Apage43: hmm - I was mostly interested in process modeling - but I'm sure that data-processing is much better done with clojure

6:58 Apage43: did you try Elixir ?

6:59 deadghost: also that's why I was surprised

6:59 map is everywhere

6:59 so I assumed a new language like go would have it

6:59 Apage43: vijaykiran: I have looked at it. It helps some of the awkwardness of the language (the prolog-ish syntax is a bit of a hangups for some folks, and the single-assignment thing probably throws off even *more* of them, though I actually prefer it)

7:00 mostly though it's a much nicer shell around the same guts

7:00 more of a coffeescript :: javascript rather than a clojure :: java

7:00 vijaykiran: Apage43: indeed.

7:02 Apage43: actually last time I had to debug an erlang issue I wrote tooling to do it in Clojure with the erlang Java interface library >>

7:03 vijaykiran: :) sounds like a real multi-VM shop - with Go/Beam and JVM

7:03 Apage43: we don't ship any JVM code

7:04 deadghost: when do you get the chance to use clojure

7:04 or do you just sneak it in sometimes

7:04 Apage43: but when *I* build something that doesn't actually go in the product (and therefore can be anything) it winds up being in Clojure

7:04 deadghost: I see

7:04 Apage43: usually that's stuff like internal tools

7:05 vijaykiran: deadghost: usually it starts as a small tool, library

7:05 deadghost: but I worked on two pure clojure projects so far

7:05 deadghost: clojure has been the best programming experience so far

7:06 Apage43: yeah, for me it tends to be the quickest path from idea to working thing

7:06 deadghost: I gave CL a try and might marginally prefer it as a language

7:06 but experience was poor

7:07 Apage43: if I'm not using it its because of some external constraint (like the end program has to be run somewhere without a jvm or interface with some C library)

7:07 or that it's a small command line tool and jvm startup time :/

7:08 hyPiRion: it's a pain, eh

7:10 deadghost: Apage43, what do you use for command line tools then

7:11 Apage43: python

7:12 which is itself really awkward because I always write it with argparse first and then have to fix it to use optparse because it needs to run on old python versions >>

7:15 sveri: Hi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp

7:22 sm0ke: in core.logic, why does forms after conde has to be double paranthesized? like (conde ((== q 1)))

7:24 CookedGryphon: sm0ke: because conde is an or type operation, and things inside that inner expression are an and type expression

7:25 sm0ke: for example (conde ((== q 1) (== x q)) ((== x 4)))

7:25 sm0ke: ah! is and implicit?

7:26 CookedGryphon: means unify q with one and then x with q to succeed, or alternatively just unify x with 4 to succeed, yeah and is implicit

7:26 sm0ke: ok thanks

7:31 xificurC: anyone using smartparens instead of paredit?

7:52 sm0ke: i wonder why pypy didnt catch up like clr or jvm for clojure

7:53 heck even the clojure-py project is dead

7:54 isnt python an awesome platform too?

8:01 clgv: sm0ke: clojure-py is dead?

8:04 sm0ke: hm ok, from the github page and the last dev ML entry, one could say so.

8:14 aesav: Any recommendations for an opensource clojure webapp that I can learn from? Something with a nice REST api is a plus...

8:24 sveri: Hi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp

8:45 luxbock: what is the benefit of having a :inline function definition in the function metadata?

8:45 I tried to Google about what it is used for but I don't quite grasp the whole thing

8:46 gfredericks: luxbock: it basically treats it like a macro when possible

8:46 ...for inlining

8:47 luxbock: are they used for speed optimization or what is the benefit?

8:47 Cr8: e.g. if you actually use it somewhere (myfun stuff) it'll get expanded at compile time, but you can *also* use it as a function (map myfun [list of stuff])

8:47 luxbock: usually for speed yeah

8:48 luxbock: alright, thanks

8:49 gfredericks: speed is the only reason I know of

8:49 Cr8: yeah, probably shouldn't have said usually there

8:49 saolsen: Anybody have some experience finding memory leaks in clojurescript code? I wrote this in what I feel is pretty idiomatic clojure but the memory useage just keeps going up and up the longer it runs. http://cljsfiddle.net/fiddle/saolsen.particles-simulate

8:49 gfredericks: try (with-redefs [+ *] (+ 2 3)) versus (with-redefs [+ *] (apply + [2 3]))

8:49 shows how confusing inlining can make things

8:50 luxbock: heh

8:50 Cr8: and it doesn't show up in call stacks if it throws an exception from inside

8:50 gfredericks: ah that too

8:51 luxbock: sounds like I should stay far away from them

8:51 Cr8: one of those things that isn't worth bothering with until you're really trying to squeeze performance out of something

8:52 luxbock: I ran into them while browsing core.matrix source code

8:53 gfredericks: yeah that sounds plausible

8:53 Cr8: in that case core.matrix is bothering with that so you don't have to :). But yeah, core.matrix is one of those places where it actually is quite useful

8:54 internally

8:54 for stuff like avoiding boxing

8:55 gfredericks: and you get to skip the var indirection

8:56 basically it's macros + flexibility and the associated confusion

9:19 danenania: question for y'all: in general is it better style to use a closure or a partial? (defn f [arg1 arg2] ...) (map (partial f 10) c) --or-- (defn f [arg1] (fn [arg2] ..)) (map (f 10) c)

9:21 philandstuff: or (map #(f 10 %) c)

9:21 in general I'd prefer (defn f [arg1 arg2] ...) but it all depends on context

9:22 clgv: danenania: not really answerable in general

9:22 gfredericks: $google github currj

9:22 lazybot: [fredericksgary/currj · GitHub] https://github.com/fredericksgary/currj

9:23 gfredericks: ^ do both! :)

9:24 clgv: danenania: if the partial statement gets too complicated use the closure

9:24 danenania: ok, i've been using the partial method as a default as it seems possibly a bit more obvious

9:25 that makes sense

9:49 logic_prog: anyone have a good tutorial on implementing append-only log file in clojure?

9:54 luxbock: still browsing through core.matrix source... what is the difference between using `double` and `.doubleValue`?

9:55 gfredericks: ,(double 3)

9:55 clojurebot: 3.0

9:55 gfredericks: ,(double 3N)

9:55 clojurebot: 3.0

9:55 * gfredericks has no idea

9:56 gfredericks: looks like double does exactly that, via RT

9:57 luxbock: I'm just confused because of this: https://gist.github.com/7873465

9:57 if they do pretty much the same thing, then why are we using one for m when it's a number, but then .doubleValue for exponent

10:04 eLobato: is it a good practice to do 'clojure.string :as str' since (str) is already a function defined in clojure?

10:04 i get Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration str should be a vector

10:05 gfredericks: eLobato: it shoudl work fine

10:05 eLobato: when running the tests of this project, likely because of that https://github.com/Raynes/tentacles/blob/master/src/tentacles/core.clj

10:05 gfredericks: eLobato: you're running `lein test` on a clone of that project?

10:05 eLobato: gfredericks: exactly

10:05 * gfredericks tries

10:06 clgv: eLobato: it should work fine since it is only an alias for a namespace and not var

10:06 gfredericks: eLobato: tests pass fine for me

10:06 chouser: anyone know of any reason that a core.logic pldb would have any problem being run through fressian? It seems to write out ok, but running queries on the db once it's been read back in always returns empty results.

10:06 eLobato: gfredericks: clojure 1.4.0?

10:07 clgv: eLobato: namespaces are not resolve from symbols directly. for that you need (the-ns 'clojure.core)

10:07 gfredericks: eLobato: leiningen should bring in the correct version of clojure; 1.5.1 in this case

10:08 eLobato: gfredericks: how odd..

10:09 amalloy: eLobato: "Parameter declaration str should be a vector" is what the compiler says when you write a function like (defn foo (str x y))

10:10 usually because you forgot the arglist

10:10 gfredericks: ,(fn a b c)

10:10 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Parameter declaration b should be a vector>

10:28 sveri: Hi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp

10:46 jtoy: why do protocols not provide a default interface? what is bad about that?

10:46 gfredericks: does Object not do what you want?

10:47 jtoy: i dont havee Object, that is a java thing? I am writing pure clojure

10:47 gfredericks: you can (extend-type Object MyProtocol ...) and it should act as a default impl

10:47 justin_smith: jtoy: the example I showed you yesterday had that in there, just commented out

10:48 gfredericks: the problem is if you define any method of the protocol on another type, you need to implement all of them

10:48 jtoy: justin_smith: yeah, Im testing them now

10:48 justin_smith: so the defaults are all or nothing

10:48 gfredericks: justin_smith: good point

10:49 justin_smith: jtoy: this is why I had that "default-impl" map to merge the new impls into

10:50 basically a minimal hand-rolling of the one piece of inheritence logic I actually wanted

10:52 gfredericks: oh man java is awesome. if you have a map and you get its entrySet and remove something from that set it gets removed from the map too

10:52 by design

10:52 that's in the Map interface, not some random implementation

10:52 * nDuff would tend to expect that behavior.

10:53 gfredericks: I'm just spoiled

10:55 jtoy: justin_smith: can protocols still be used if my code is currently stup like this: https://www.refheap.com/21621 I've read those links you sent and I'm not sure I can use them giventhe way I structured my code

10:56 because of the macro I have

10:59 dabd: I am going to work with matrices with 1 million entries. Anyone knows which is better vectorz-clj or clatrix?

10:59 jtoy: the layout is the piece I want to change, but I want my new layout I use to also change the layout used in the library

10:59 justin_smith: jtoy: separate the definition into a var from the elaboration of what it does

10:59 the latter can be a protocol

11:00 dabd: have you considered hip-hip?

11:01 https://github.com/prismatic/hiphip

11:01 dabd: justin_smith: i didn't. Is it faster than vectorz-clj?

11:02 hmm should be quite fast since the prismatic guys are using a lot of machine learning

11:02 eagleflo: dabd: did you try core.matrix?

11:02 justin_smith: don't know, it is just the one I have heard of. It is the one recommended in the "high performance clojure programming" book.

11:02 clgv: dabd: afaik it is just a set of tools for java arrays, probably you expect more from a "matrix library"

11:02 dabd: core.matrix is the backbone of vectorz-clj

11:02 eagleflo: It wraps vectorz among others afaik

11:02 jtoy: justin_smith: I dont follow, is it possible to show me a very simple example?

11:02 eagleflo: Ah, right.

11:03 clgv: dabd: hiphip I mean ;)

11:03 eagleflo: I thought it was the other way around.

11:03 coventry: dnolen: Your nyt project comes up blank for me with ghostery on.

11:06 clgv: dabd: core.matrix readme says that both vectorz-clj and Clatrix are implementation and thus you can easily switch between them. so you can just implement on top of core.matrix and then benchmark which one of the two gives you the best performance

11:10 justin_smith: and then hiphip if you need mutability I guess

11:10 (though that is not likely)

11:14 jtoy: can I store source code in a resource file?

11:15 gfredericks: I don't think the jvm/clojure knows the difference between src and resources, if they're both on the classpath

11:16 coventry: You certainly can, but it's hard to find a good use for it.

11:16 wedr: you don't want it

11:16 jtoy: im not sure how to fix my crappy code

11:16 wedr: do it uncrappy

11:16 clojurebot: No entiendo

11:17 coventry: What problem are you trying to solve by using a resource file?

11:17 jtoy: i think i can do it with the resources folder and have my code look for a file there, ifthere, use that definition, and if its not there, then use the default definition for a function

11:18 coventry: What problem does that solve?

11:19 jtoy: i can have a library and then in my userland code i can overwrite a couple of functions

11:20 can I have a library that expects code in the userland project? it seems like i cant

11:20 so i want to try with resources

11:21 CookedGryphon: jtoy, 2 things - you can redefine functions within libraries without the need for resources folder, but secondly it sounds like what you actually want to do is pass a function into your library rather than redefine some pre-arranged function

11:22 or some sort of protocol/multimethod which you expect the userland code to extend for their usecase

11:22 but we'd need to know the usecase to advise on that

11:23 oh, sorry, I wasn't paying attention, didn't see that you already told us the use case

11:24 justin_smith: sounds like a clear case for using a protocol and passing in something implementing the protocol to me

11:24 jtoy: CookedGryphon: how can i redefine? here is a clearer example: https://www.refheap.com/21621

11:25 i want both the methods home-page and page-that-uses-non-default-layout to use the layout i have defined in userland code

11:25 justin_smith: jtoy: why not add a layout argument to defpage?

11:25 that seems simplest actually

11:25 it's just one function

11:25 (defmacro defpage [name layout & body] ...)

11:25 nkozo: why (chunked-seq? (range 16)) is false but if you do (take 2 (map println (range 16))) the sequence is treated in a chunked fashion?

11:25 jtoy: justin_smith: I could do that, i just didnt want to pass layout a million times, and i dont think that would solve the problem of the functions in the library that already rely on layout

11:26 justin_smith: OK, in that case define a protocol with layout as one method

11:26 so you still call layout, and you pass in an object that implements layout

11:26 probably a record made with defrecord

11:27 regardless, the defpage needs some argument that decides the behavior

11:27 also separate the definition part of defpage from the part that does the functionality

11:28 pulling most of defpage out of defpage into a helper function will make everything much easier

11:28 coventry: nkozo: Have a look at the source code for chunked-seq? and range. range returns a lazy seq. chunked-seq just checks whether the object returned is an instance of IChunkedSeq.

11:28 $source chunked-seq?

11:28 jtoy: justin_smith: i will always override the layout function though, and the other pages in the library already expect a layout,

11:28 lazybot: chunked-seq? is http://is.gd/Iytq3A

11:28 coventry: source range

11:28 $source range

11:28 jtoy: and they must use that new layout

11:28 lazybot: range is http://is.gd/DZSIhK

11:29 justin_smith: jtoy: then, like I said, pass in something implementing layout. And make that object part of the stored page object so they can call its method

11:29 coventry: nkozo: the <type>? predicates in clojure.core are generally pretty misleading.

11:29 justin_smith: yet another argument for separating the definition from the data ops

11:30 jtoy: justin_smith: I am goig to do what you said, im just not sure how to do that

11:30 nkozo: coventry: I'm seeing the seq1 function for dechunking sequences (from Joy of Clojure), it seems to work by wrapping a sequence in another not implementing IChunkedSeq. I don't understand why it works, given that range doesnt return an IChunkedSeq but is used in a chunked fashion

11:30 clgv: coventry: huh why? it is indeed a consistency error with range that chunked-seq? returns false

11:30 justin_smith: jtoy: one second, I will try to stub it out in your paste

11:31 clgv: ,(chunked-seq? (rest (range)))

11:31 clojurebot: true

11:32 clgv: it is just the first `lazy-seq` which prevents `chunked-seq?` to return true on the result of range

11:32 sveri: Hi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp

11:33 clgv: sveri: I guess pasting the same message regularly wont help that much. maybe you should specify your problem more precisely ;)

11:33 sveri: clgv: sorry, i dont want to spam, just trying to catch the guys that are new in the IRC channel

11:35 clgv: sveri: I guess some of the people present here maybe could answer your question if they knew what you want to do precisely...

11:36 sveri: clgv: you are right, i am still trying to figure out myself what i want to do exactly, i come back with a better question later, hopefully when the dark clouds disappear

11:36 justin_smith: jtoy: in your code is body meant to be a macro body, or the body of the html?

11:36 same word, very different meanings

11:37 is the body of the macro something that finally returns the body of the html?

11:51 jtoy: https://www.refheap.com/21624 did it as an exercise. Not perfect, may not even run as is, but it is a step forward and shows the overal design

11:53 ucb: what's the naming convention for constants? Uppercase like C? or?

11:53 justin_smith: jtoy: found a bug in how I was calling extend, updated

11:53 ucb: constants are only possible for numbers, you know that right? I don't think there is any convention

11:54 ucb: justin_smith: I need them for numbers :)

11:54 justin_smith: I didn't know that though.

11:55 amalloy: justin_smith: huh? immutable values are basically all constants? like...(def empty-list ()), (def directions #{:left :right})...

11:55 CookedGryphon: ucb, almost everything is constant and immutable in clojure so there's no special notation ;)

11:55 indigo: justin_smith: A struct, not a record?

11:56 ucb: amalloy, justin_smith, CookedGryphon: my question was more aimed at assigning names to magic numbers :)

11:56 bbloom: http://www.youtube.com/watch?v=TS1lpKBMkgg <- former biggest contributor to scalac -- talk is basically just this guy freaking out. it's entertaining and cringeworthy at once

11:57 tim_: epic intro music!

11:57 justin_smith: indigo: that is probably an error

11:57 I think I meant a record

11:58 amalloy: constant as in fully embedded in the bytecode, not a lookup at runtime

11:59 amalloy as in what ^:const does

12:01 which it can only do for numbers

12:04 indigo: thanks for pointing that out, I fixed that paste

12:05 indigo: justin_smith: No prob... I think this is the first time I heard of defstruct :P

12:07 justin_smith: probably some cross-talk between my clojure code and some other language I don't use anymore :)

12:09 jtoy: the problem that remains (even in the version using protocols that I pasted) is that the implementing structure is hidden in the defpage/do-page, and not something carried by the page definition. It could be you want a "render" method and have defpage just definite the record instance

12:10 it could be a render function that gets the record as an argument, or it could be a render method on the protocol, depending on how much flexibility you need on that side

12:13 coventry: bbloom: Wow, that is some sustained industrial-grade self deprecation.

12:13 bbloom: coventry: seriously.

12:16 justin_smith: is this like a sibling-rivalry thing we have with scala?

12:18 bbloom: justin_smith: *shrug* i don't wanna be all us vs them or anything, but it's just interesting to see how they've had some high profile burnouts, converts, etc

12:18 i'm more interested in what's causing it & what to do about it if anything

12:19 it's interesting to see him complain about sacraficing type-correctness to play nice with the JVM host in one breath, then in the next breath suggest we need more independent "machines" processing ASTs of data

12:19 those are like to antithetical ideas

12:20 s/to/two

12:21 justin_smith: when he talks about modifiability, I think he is talking about what I call brittleness

12:22 *unmodifiability

12:22 indigo: Ah, Scala...

12:22 The worst case of C++ syndrome ;P

12:22 coventry: I didn't follow the slide on universal equality at all. What is it, and why is it painful?

12:23 bbloom: coventry: so universal equality is basically Object.equals

12:23 coventry: in haskell, you can't compare something of type A to something of type B and that's enforced statically at compile time

12:24 if you want to compare two different types, you need to convert between one or the other

12:24 danielszmulewicz: Classpath problems when deploying. Why oh why is deploying such a pain (venting).

12:24 bbloom: except numbers, which have some magic coercion hackery in the spec that has since been turned in to slightly more real thing you can rely on

12:25 universal equality works (relatively) great for us in clojure b/c we have so few data types

12:25 deadghost: http://pastebin.com/kUZ7UqKk

12:25 tuddman: anyone have experience with classpath finding files one time; not another ... not sure if a LightTable issue...

12:25 deadghost: I don't even know where to begin debugging this

12:25 danielszmulewicz: oh, seems I'm not alone with classpath woes

12:25 bbloom: coventry: worth reading about EGAL: http://www.pipeline.com/~hbaker1/ObjectIdentity.html

12:25 tuddman: java.io.FileNotFoundException: Could not locate ...

12:26 coventry: bbloom: Thanks. Will take a look.

12:26 indigo: deadghost: You should probably start by deleting the paste and creating a new one with an anonymized address :P

12:26 deadghost: that's just a random address

12:27 tuddman: @daniel: I can have a look..

12:27 danielszmulewicz: tuddman: thanks, I'll explain, it's kinda simple.

12:27 indigo: deadghost: Also you have :postal_code and :postal-code

12:27 danielszmulewicz: I have resource-paths in my project.clj

12:27 In my code I do a slurp on a resource

12:28 Works locally, no problem

12:28 tuddman: repo link?

12:28 deadghost: indigo, that's deliberate

12:28 danielszmulewicz: But when doing an uberjar, it won't work

12:28 deadghost: sql doesn't like hypens

12:28 justin_smith: danielszmulewicz: are you using io/resource to access the resource to slurp?

12:28 danielszmulewicz: yes

12:28 deadghost: so the lib converts to underscore

12:28 justin_smith: if not you should

12:28 danielszmulewicz: I do

12:28 coventry: bbloom: Thanks, I get it now.

12:28 danielszmulewicz: it *should work* in a jar

12:29 bbloom: coventry: you read that whole page that fast? :-P

12:29 danielszmulewicz: and yet it doesn't

12:29 deadghost: actually not even relevant, just I'm just getting the value

12:29 coventry: bbloom: No, I replayed his discussion of that slide. :-)

12:29 justin_smith: danielis the resource not found, or is it shadowed?

12:29 danielszmulewicz: I don't know. I get No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

12:29 justin_smith: io/resource returns nil when it doesn't find the resource asked for

12:30 likely

12:30 danielszmulewicz: justin_smith: exactly.

12:30 dabd: is anyone using unicode chars in their clj source? I was watching this presentation about core.matrix http://www.slideshare.net/mikeranderson/2013-1114-enter-thematrix

12:30 r4vi: anyone know a good algorithm for serializing web application state in the url/querystring

12:30 i don't need security

12:30 `cbp: damn it lambdatheultimate why are you down!

12:30 dabd: He uses tau in the code on slide 33

12:30 r4vi: i could urlencode json but I'd prefer something more compatct

12:30 danielszmulewicz: justin_smith: the :resource-paths gets merged when I do a lein with-profile production, right?

12:31 indigo: deadghost: Weird...

12:31 Also are you sure Korma works with (insert "tableinquotes"

12:31 r4vi: so like if my app state was {:name "foo", :clicked-widget-times 30}

12:31 indigo: Don't you have to (defentity) first

12:31 danielszmulewicz: Because that might be the problem...

12:31 justin_smith: danielszmulewicz: yeah

12:31 maybe try unzipping the uberjar, seeing what is where?

12:31 r4vi: i want to put that in foo.com/{:name "foo" ...

12:32 danielszmulewicz: justin_smith: yeah, I'll do that

12:32 deadghost: indigo, seems to work fine for my other insert

12:32 justin_smith: also you can run it locally with java -jar (or run it in tomcat locally), start a repl inside the server process, and do some more invasive runtime investigation

12:32 indigo: Hmm

12:35 danielszmulewicz: justin_smith: Excellent idea. Thanks a bunch.

12:35 jtoy: justin_smith: i was away, thanks for that reference implementation, i will study it and try to use it

12:37 justin_smith: jtoy: np, I am finally learning how to use these corners of the language, so it was a good exercise for me

12:38 I typically stick to let / fn / etc. and avoid the OO stuff, but this could be a place where the OO stuff simplifies things

12:39 tuddman: how does one investigate where / how dependencies are loaded? (classpath not found error..)

12:40 ran 'lein clean' then 'lein deps' says they're loaded...

12:41 yet: java.io.FileNotFoundException: Could not locate clj_dde/core__init.class or clj_dde/core.clj on classpath:

12:41 gfredericks: bbloom: what is his complaint in the Int.maxValue slide?

12:42 bbloom: gfredericks: i forget, what's the timestamp?

12:42 gfredericks: about 23:30

12:42 seems a generic classic floating point limitation

12:42 justin_smith: tuddman: try lein classpath

12:43 tbaldridge: gfredericks: it's the implicit conversion. It produces wrong code, but never complains. At least C++ says "implicit cast to float, possible loss of precision"

12:43 justin_smith: if clj-dde is in that, you can check in that jar to see if there is a clj-dde.core ns

12:44 bbloom: gfredericks: the complaint is this:

12:44 ,(= (float (- Long/MAX_VALUE Integer/MAX_VALUE)) (float Long/MAX_VALUE))

12:44 clojurebot: true

12:44 gfredericks: tbaldridge: I guess that makes sense; it didn't seem so implicit since he had to write Float on each line, but I suppose so

12:44 bbloom: yeah, which is just how floating point precision works

12:45 bbloom: gfredericks: sure, but if you're a typed language guy, you want an error msg

12:45 tbaldridge: gfredericks: the issue is that (float)(large_num - large_num) == (float)(large_num - small_num)

12:45 coventry: Is there any language which gets this right by his standard?

12:45 bbloom: tbaldridge: at the end of the talk, he proceeds to say he's building a VM within the VM :-P

12:45 gfredericks: coventry: any language that warns I guess

12:45 justin_smith: basically we wants to not use floats?

12:46 bbloom: floats are almost never what you want anyway :-P

12:46 tbaldridge: justin_smith: even that doesn't matter, doubles have the same sort of issues.

12:46 technomancy: coventry: racket's "beginner" dialects read 0.1 as a precise decimal IIRC

12:46 too bad the main #lang racket doesn't do the same

12:46 tbaldridge: justin_smith: http://stackoverflow.com/questions/316727/is-a-double-really-unsuitable-for-money

12:46 technomancy: no one wants to make the decision that's going to make the language get trounced when microbenchmarked by people who don't know what they're doing

12:46 gfredericks: technomancy: are you trying to explain floats to your kindergartner?

12:47 technomancy: (which is the vast majority of microbenchmarkers)

12:47 justin_smith: tbaldridge: I was using "float" in the generic sense

12:47 bbloom: technomancy: fuck the benchmarkers

12:47 technomancy: gfredericks: that's why I'm choosing racket, dude!

12:47 justin_smith: as in floating point

12:47 technomancy: bbloom: preaching to the choir =)

12:47 tuddman: clj-dde is in classpath..

12:47 justin_smith: tbaldridge: just saying the problems are implicit in the definition of floating point

12:47 *standard ieee floating point as usually implemented

12:47 bbloom: technomancy: floats are good for pretty much one thing: errors relative to the observer

12:48 tbaldridge: justin_smith: I agree there.

12:48 bbloom: ie display code: percentages show in the UI, distances relative to a 3d avatar, etc

12:48 you stick your origin at 0.0f and do all your actual math with useful number types :-)

12:48 then you through a bunch of floats at a GPU

12:48 tbaldridge: bbloom: representing color as well

12:49 goraci: who familiar with datomic here ?

12:49 gfredericks: floats are great for implementing JS :P

12:49 bbloom: weee

12:49 nDuff: goraci: there's a separate #datomic channel

12:49 bbloom: oh, 1 other use case for floats: probablistic systems

12:49 goraci: it's almost dead no answers

12:49 tbaldridge: goraci: but many here (myself included) are familiar with datomic

12:49 bbloom: "eh, it's kinda wrong, but it's kinda wrong by design. so fuck it!"

12:50 tbaldridge: goraci: I've been on #datomic all morning, and haven't seen any of your questions?

12:50 justin_smith: bbloom: or in domains where the measurements are lossy anyway, where implying more precision than you have can actually lead to errors, the data type truncation of a double is not much of a hinderance

12:50 coventry: In the "generality is not OK" slide around 28 min, he seems to be saying that in-place mutation is conceptually incompatible with high-level typing semantics. I don't really understand that.

12:50 goraci: tbaldridge: i asked yesterday .... maybe make something like schedule for talks there

12:51 tbaldridge: goraci: yesterday was Sunday, most people probably weren't on the channel. There's normally quite a few people from Cognitect on that channel during working hours.

12:52 goraci: tbaldridge: i asked this - is there something like update in datomic )? we store facts usually, so update is the new fact it appears

12:52 tbaldridge: goraci: ask the question on #datomic, and I'll answer it there :-)

12:52 goraci: tbaldridge: so i guess there is no such a thing like update in usual case

12:52 bbloom: justin_smith: but there are better things there

12:52 goraci: tbaldridge: ok

12:52 bbloom: justin_smith: you can/should thread a pair of value & error along

12:53 justin_smith: sure, but just saying that is not incompatible with doubles

12:54 also: does lein-cljsbuild do anything weird with dependencies?

12:54 i get the wrong version of tools.reader on my classpath, but it doesn't show up in `lein classpath`

12:55 tuddman: justin_smith: use tools.namespace to explore what's in jar ... or is there some other way

12:55 justin_smith: tuddman: unzip the jar, it is a zip file

12:55 also: tuddman: jar tf <jar filename>

12:56 justin_smith: or that

12:56 and see if there is a file for that namespace in there

12:56 lein classpath will show you the jar location

13:02 also: are there any cases where a transitive dependency won't show up in `lein deps :tree`?

13:03 technomancy: also: if a plugin merges dependencies in inside the plugin function itself, it's totally opaque and can lead to really nasty situations like this

13:05 tuddman: justin_smith & also: thanks. yep. core.clj is definitely there...

13:06 also: technomancy: that's what i'm assuming. strangely, adding `:exclusions [[org.clojure/tools.reader]]` to `[ring/ring-core "1.2.1"]` seems to fix it, even though it isn't a dependency

13:07 technomancy: also: aha; it's a lein-cljsbuild bug: https://github.com/emezeske/lein-cljsbuild/issues/268

13:09 tuddman: damn thing was working earlier. not sure which -probably- asinine change broke it.

13:10 justin_smith: if there is an error in the code, the namespace won't be successfully defined I don't hink

13:10 that's a long shot I guess

13:11 also: technomancy: oh, thanks

13:13 logic_prog: is there a way to tell edn/read-string to also record white space? i.e. I want (+ a\n b) to be (list (symbol +) (space 1) (symbol a) (space \n) (symbol b)) ?

13:13 also: technomancy: changing the order of the dependencies could cause a version that isn't shown in `lein deps :tree` to show up?

13:13 tuddman: justin_smith: probably ;-( ' looks' fine, though.

13:14 coventry: logic_prog: ztellman's sleight tries to bolt newline tracking on top of the regular reader. https://github.com/ztellman/sleight/blob/master/src/sleight/reader.clj#L92

13:15 logic_prog: coventry: whoa, someone else also ran into this problem? yay!

13:15 Cr8: logic_prog: oh

13:15 you could also pull the trick that source-fn pulls

13:15 .. actually that's not what you want, nvm

13:15 coventry: logic_prog: It's a slightly different problem, but there may be some useful ideas there.

13:16 tuddman: justin_smith: its just a simple wrapper to get/push 'real-time' updates from/into excel (& various finance apps)

13:17 Cr8: logic_prog: https://github.com/xsc/rewrite-clj

13:17 see that also

13:17 tuddman: https://github.com/tuddman/clj-dde/blob/master/src/clojure/core.clj

13:17 logic_prog: coventry: actually, I don't understand how sleight works

13:17 Bronsa: logic_prog: no, but if you need to preserve the original source, tools.reader >= 0.8.0 has a source-logging reader

13:18 tuddman: works if you load the java files directly... not so much if you abstract it into a dependency

13:19 logic_prog: Cr8: rewrite-clj is exactly what I want, however, looking at it, this whole thing is more cmplicated than I had in mind

13:19 coventry: logic_prog: It reads the original code in, transforms the resulting structure as specified by whatever is calling it, then tries to readably print out the transformed structure for re-reading.

13:21 justin_smith: tuddman: I think if it is in src/clojure/core the tool would expect you to look for it as core or maybe clojure.core

13:21 try adding a clj-dde directory

13:22 so the filesystem matches the naming

13:22 when you require, it looks for the clj file based on the directory structure that should match the ns structure

13:29 tuddman: ok, since the source-path in your project.clj is "src/clojure" you should make a clj-dde directory and put core.clj in there

13:29 and then require will actually be able to find it

13:30 sadly (io/resource core.clj) is very likely to find something else that conflicts, given the ubiquity of that name

13:30 dnolen: CLJS enhancement regarding macros - it would be nice for libs to write inlining macros like CLJS does with needing to :require-macros :require

13:31 any opinions about (:require [foo.bar :require-macros true]), or some such :require modifier?

13:34 this would load foo/bar.clj

13:34 sritchie: anyone here using clutch / couchdb in clojure?

13:34 dnolen: in addition to requiring foo/bar.cljs

13:34 sritchie: I was thinking of converting it to async, via core.async

13:34 goraci: sritchie: start using datomic with couchdb )

13:35 sritchie:started

13:35 sritchie: yeah? nice

13:35 I didn't know that was a thing

13:36 dnolen: vague, library design question for you, sir

13:36 dnolen: sritchie: what's up?

13:36 goraci: sritchie: couchbase db is for a storage in this case

13:37 sritchie: dnolen: I'm thinking of taking over cemerick's old clutch library for couchdb interaction, which is all synchronous, swapping in http-kit, and making it async via channels -

13:37 dnolen: since sync is a special case of async,

13:37 one option is to just make async default, and have users deal with it (with blocking calls)

13:37 or, add async as a new module and keep things separate

13:37 in the scala world, user friendliness loses

13:38 dnolen: any opinions on whether the async overhead is meaningful / worth it for synchronous users, if the sync client is just async + blocking?

13:41 hiredman: it doesn't seem like it would be worth the effort

13:42 the jvm has fairly cheap threads, and good abstractions for threadpools, and core.async has the thread macro, so if you want to make your io async, you just drop it in a (thread ...)

13:43 sritchie: hiredman: vs actually using an async http client at the bottom?

13:43 dnolen: sritchie: hrm, haven't used couch or clutch in a long time - not sure if I can formulate a strong opinion about how it should be done. but I think I kind of agree w/ hiredman.

13:43 hiredman: sritchie: to what end?

13:44 sritchie: to make it easier to fan out and sequence multiple db operations

13:44 tuddman: justin_smith: thanks a ton!! for your help... I blew out dir structure... added back in /src/clj_dde folder. removed :source line from project.clj (so now it defaults to looking for src/clj_dde/core.clj

13:44 hiredman: generally you use an "async" io based thing because you are already doing stuff async and you basically need to interoperate, have io that won't block the event loop

13:45 sritchie: yeah, exactly - I'm hitting S3 async,

13:45 and then based on the response, updating couchdb, then returning other couchdb data

13:45 so I do want to inject this into an async workflow

13:45 hiredman: sure, and for that use case, I think (thread ...) should serve you well

13:45 tuddman: comes back to sssschtupid underscore vs. dash in ns names and directories it looks in.

13:47 sritchie: hiredman: so what's a case where the underlying library should be async?

13:47 bitemyapp: sritchie: you know posco?

13:48 sritchie: haha, yes

13:48 we built summingbird together

13:48 bitemyapp: sritchie: cool guy, talked to him in #haskell.

13:48 Really nice people there.

13:48 sritchie: clojure and haskell have such a good vibe

13:50 technomancy: tuddman: vote for http://dev.clojure.org/jira/browse/CLJ-1297

13:50 hiredman: sritchie: well sometimes you want to interleave two io operations together to minimize what you hold in memory (I am not sure if core.async is good for that), but in my mind it is typically about control

13:50 technomancy: there's no reason humans should ever waste time on that problem ever; it's borderline offensive

13:51 hiredman: sritchie: you have what is logically a single thread of control, but without core.async would end up being chopped up bits of logic

13:52 bitemyapp: seangrove: are you looking for a shikibuton or something else?

13:52 seangrove: I sleep on one.

13:52 seangrove: if you're looking for something specifically korean, you want south bay.

13:53 tuddman: technomancy: done ;-)

13:53 sritchie: hiredman: so, if the underlying DB required a couple of concurrent lookups to satisfy some logical request;

13:53 otherwise, no need to bake it in at the bottom

13:53 seangrove: bitemyapp: Yeah, a korean version of shikibuton. Willing to go to South Bay, but can't find a specific place. I still use mine from ~8 years ago, btu it's probably time to get a new set.

13:53 tuddman: justin_smith: thanks again!

13:54 justin_smith: np

13:54 seangrove: bitemyapp: But maybe I should just go Japanese for the next decade...

13:54 hiredman: well, baking it in at the bottom is fine, it is sort of a cost/benefit analysis when looking at existing libraries, so maybe rewriting the couchdb thing would be cheap, in which case why not try it out

13:56 sritchie: hiredman: the place where it actually makes sense to start is the _changes feed

13:56 the feed of updates you get from couch

13:56 hiredman: makes sense, though

13:59 S3thc0n: Sorry, lost connection rigth after posting my message. :(

13:59 It currently returns all of the values; I#d be grateful for a little hint.

14:02 dabd: what is the @@ operator?

14:03 hyPiRion: just (deref (deref ..))

14:04 tbaldridge: also known as the "you probably shouldn't be doing this" operator.

14:05 bbloom: tbaldridge: c'mon now, double-indirections are fun!

14:05 hyPiRion: I think gfredericks actually had a valid use case for @@?

14:05 gfredericks: O_O

14:05 tbaldridge: ,@@(atom (delay 42))

14:05 clojurebot: 42

14:06 hyPiRion: maybe it was TimMc

14:06 gfredericks: @_@

14:06 S3thc0n: Again... Hope I have that fixed now. If anyone answered yet, I did not get the message, unfortunately.

14:07 dabd: I found it being used here https://github.com/ztellman/pushkin/blob/master/src/pushkin/tree.clj

14:07 coventry: S3thc0n: Don't think your original question came through at my end.

14:07 dabd: in the Node defrecord

14:08 gfredericks: ,(-> 42 ((apply comp (repeat 10000 atom))) ((apply comp (repeat 10000 deref))))

14:08 clojurebot: 42

14:09 S3thc0n: coventry: I am stuck at the 4clojure problem #25 (filtering the odd numbers), and the code I tried is http://pastebin.com/GnGrR0b2 - for some reason it does return all numbers, not only the odd ones. I would be grateful for any hint on why that is so, as I could nto find the cause after 15+ minutes alone.

14:10 gfredericks: S3thc0n: you're testing o for truthiness

14:10 presumably it is either 0 or 1

14:10 justin_smith: ,(if 0 :true :false) ; S3thc0n:

14:10 clojurebot: :true

14:10 gfredericks: but both of those are thruthy

14:10 S3thc0n: Oh...

14:10 I see.

14:10 justin_smith: ,(if (zero? 0) :true :false) ; S3thc0n:

14:10 clojurebot: :true

14:10 justin_smith: ,(if-not (zero? 0) :true :false) ; S3thc0n:

14:10 clojurebot: :false

14:11 S3thc0n: Thank you for showing me the obvious.

14:11 bbloom: dnolen: another fan of space, i see :-)

14:11 seangrove: S3thc0n: Are you trying to do it without using the built-in functions?

14:11 dnolen: bbloom: heh

14:11 gfredericks: hah RT defines first, second, third, and fourth

14:11 S3thc0n: seangrove: exactly.

14:12 I tested if 1 was true, and automatically assumed that 0 would be false. ^^

14:12 jtoy: justin_smith: i am working with the code you wrote, I think i have the same problem as I originally had though, which is that I want home-page to use OtherLayout: https://www.refheap.com/21624 I want verything to end up using OtherLayout, the problem is that I cant edit the pages that are inside of the library as I dont have access to the source code

14:12 am I just understanding this wrong?

14:13 justin_smith: jtoy: then you want the layout to be used to be something that is dereferenced/accessed at runtime

14:13 so you don't want a protocol, you want a global updatable state

14:13 (def layout (atom ...))

14:13 jtoy: justin_smith: is a global updateable state bad or ok in this situation?

14:15 justin_smith: I think it is bad design, but it will work

14:15 bbloom: i much prefer global state to local state :-P

14:15 jtoy: justin_smith: I agree, but I will use it until I learn a better way for now, thanks

14:16 dnolen: CLJS devs might find this useful - http://www.html5rocks.com/en/tutorials/developertools/devtools-terminal/

14:25 bitemyapp: seangrove: what's the difference between the japanese and korean versions?

14:25 seangrove: well I know a good place for japanese stuff. I sleep on the buton with a makura.

14:25 and a comforter.

14:27 seangrove: bitemyapp: Usually firmness and materials, especially towards the north in Korea where it's very cold so you try to capture as much heat from the floor as possible

14:27 bitemyapp: About to pair for a bit, but definitely want to hear about the Japanese place. Think I may make the switch.

14:31 bitemyapp: seangrove: incidentally, I just started pairing too.

14:31 seangrove: http://www.yelp.com/biz/neat-asian-things-san-francisco delightful place.

14:32 they carried the stuff out to my car while I double parked. Very friendly.

14:32 indigo: bitemyapp: Oh, that's cool

14:32 bitemyapp: seangrove: the futon I got from there has helped my back quite a bit.

14:32 the makura has helped with my sleep and back problems too.

14:35 luft: so, what restrictions can you set upon nullability with core.typed?

14:36 bitemyapp: luft: well you can elide Option and make nulls unallowed.

14:37 nDuff: luft: if something is (U nil SomeType), it can store nils. If strictly SomeType, it's non-nullable.

14:40 dnolen: http://dev.clojure.org/jira/browse/CLJS-721, ok thinking :include-macros :require modifier is alright - if you disagree let me know.

14:41 luft: nDuff: that's cool, I've been able to get something similar up and running in scala, but since the default is always (U nil SomeType) when you write SomeType it added a lot of boilerplate

14:42 jtoy: why doesnt this work: (defn atom-test [x] (atom(+ x 5))); (swap! atom-test (fn[x] (println x))) ?

14:42 luft: nDuff: i was also curious if clojure can implement the y-combinator

14:43 or if it can only use the z-combinator like scala.

14:43 shoky: jtoy: atom-test is a fn, not an atom

14:43 technomancy: jtoy: think for a minute about what that means

14:44 nDuff: luft: well, my off-the-cuff answer would be "yes, you can, but it's not something you'd need in practice", but I didn't quite grok your assertion that it couldn't be implemented in Scala, so I'm concerned that I might be missing some finer points.

14:44 jtoy: ah, i am generating functions that have atoms

14:45 technomancy: jtoy: you need to use more precise terms. what does "having an atom" mean?

14:45 nDuff: luft: if the distinction is support for functions with multiple-arity argument lists (where you can have a reference that isn't specific to an arity), yes, you can do that in Clojure.

14:48 stompyj: is anyone here using clojure with dropbox? There's a number of clojure libs out there, but curious if anyone recommends one in particular

14:48 jtoy: technomancy: I think I need this: (def atom-test (atom (fn[x] (+ 5 x)))) , it seems to work in the repl, i will tset it from actual code now

14:48 luft: nDuff: this http://stackoverflow.com/a/5886279 goes over why the y-combinator cannot be implemented in haskell (it would require an infinite type). The same reason makes scala unable to implement the y-combinator. Both haskell and scala can implement the z-combinator, which does the same thing,

14:50 nDuff: luft: Ahh. That's a definite yes.

14:51 luft: nDuff: ah ok, I was curious if the jvm hamstringed clojure's dynamic typing at all

14:53 nDuff: luft: Gotcha. The short form is that Clojure's functions all implement a very generic interface (IFn, which in turn extends Callable and Runnable). More specific signatures are mostly reserved for interop cases.

15:00 gfredericks: haha y combinator in haskell: https://github.com/fredericksgary/ridge/blob/master/Ridge/Eval.hs#L93

15:00 (I had no idea what I was doing there I just eventually got it to work)

15:19 TimMc: hyPiRion: Yes, I've used @@ from time to time. Usually it's in tests: @@#'foo/bar/baz

15:20 err, foo.bar/baz

15:21 gfredericks: ,'~@@~~@@~~@@x

15:21 clojurebot: (clojure.core/unquote-splicing (clojure.core/deref (clojure.core/unquote (clojure.core/unquote-splicing (clojure.core/deref (clojure.core/unquote (clojure.core/unquote-splicing (clojure.core/deref x))))))))

15:22 gfredericks: '~#'@~@'x

15:22 ,'~#'@~@'x

15:22 clojurebot: (clojure.core/unquote (var (clojure.core/deref (clojure.core/unquote-splicing (quote x)))))

15:22 gfredericks: are those all of the modifiers in the reader? besides backtick

15:24 hiredman: yes

15:24 coventry: They are in tools.reader, which is a pretty faithful clone of LispReader.

15:25 hiredman: all the "reader macros" are in the reader :)

15:25 gfredericks: I wasn't asking whether they were in the reader or not, I was asking if I forgot any :)

15:26 hiredman: that sort of depends

15:27 coventry: There's a list at the start of LispReader.java, in the "macros" array.

15:27 hiredman: the reader has a macro array, and that contains the readers for everything including lists, vectors, maps and strings

15:27 gfredericks: ,[1 2 #!3 4]

15:27 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

15:28 hiredman: if you means some kind of prefix that expands out to some kind of s-expression, I think that might be all of them

15:28 #! is for shebangs at the top of files

15:28 gfredericks: ,[1 2 3] #! a comment

15:28 clojurebot: [1 2 3]

15:28 coventry: What was the intended use of the "|" symbol (commented out in the macros list)?

15:29 hiredman: so you can make executable clojure scripts

15:29 gfredericks: coventry: obviously for reading arg vectors

15:29 #(|a b| (+ a b)) maybe?

15:30 jtoy: can anyone tell me what is wrong with this usage of atoms? I can get this syntax to work on the command line but this doesnt work: https://www.refheap.com/21630

15:30 coventry: If that's the case, I can see why he left it out.

15:31 jtoy: I tested on the repl with: (def atom-test (atom (fn[x] (+ 5 x)))) (@atom-test 5)

15:32 gfredericks: jtoy: I can't reproduce that error message

15:34 jtoy: gfredericks: weird, my code is almost exactly the same, I will try to narrow it down more

15:34 gfredericks: coventry: looking at the ArgVectorReader it makes me think there used to be something called an ArgVector; a data structure or something; this is like digging up dinosaur bones

15:35 jtoy: when I replace html and app-config with trivial things, the code runs and landing is bound to a function

15:35 coventry: gfredericks: Yeah, probably the most direct approach is to look at the git history for those lines. Maybe I'll poke around in it this evening.

15:35 gfredericks: coventry: oh good idea here I go

15:35 hiredman: at some point pre public anouncement of clojure I think | was considered for vector syntax instead of []

15:37 but I could be mistaken, and thinking about it, how would that even work with nesting?

15:37 gfredericks: hiredman: obviously clojure was going to be whitespace sensitive

15:39 oh I am totally going to compile this ancient clojure and see what it does

15:39 what the heck is a CPL.TXT file

15:39 is that an old version of leiningen

15:40 coventry: What's the date on the commit?

15:40 gfredericks: I'm looking at a sort of arbitrary commit from 2007-09-07

15:41 there's a clojure.iml file

15:41 * gfredericks tries to remember how to compile a pile of .java classes

15:42 hiredman: ant

15:42 gfredericks: there's no build.xml

15:42 hiredman: Oh

15:42 OH

15:43 yeah, good luck

15:43 coventry: http://books.google.com/books?id=GUUvxumMf6kC&pg=PA225

15:43 * gfredericks man javac

15:43 stuartsierra: javac

15:46 * gfredericks fights with javac

15:46 jtoy: gfredericks: I'm at a loss for what the erro could be, do you see anything in the stack trace that looks suspicious? https://www.refheap.com/21631

15:47 gfredericks: jtoy: nope; staring at a stacktrace is a difficult way to debug; why are you sticking functions in atoms anyways?

15:47 jtoy: gfredericks: its a temp hack until i find a better solution for my code

15:48 tolitius1: just wanted to share, in case anybody finds it helpful: https://github.com/tolitius/auqlue

15:48 gfredericks: jtoy: you use reset! to redefine the functions?

15:48 jtoy: i need my library to reference a function that is defined at runtime

15:48 gfredericks: I plan to, but i cant even get the basic atom to work yet

15:49 gfredericks: jtoy: the error message suggests you're not dereffing enough; you're trying to call an atom as if it were a function

15:50 mdrogalis: tolitius1: Great stuff! Well done.

15:52 tolitius1: mdrogalis: thanks, just something I always lacked during meetings/conference talks.. it is still young though, relies on in memory db. but anyone can just "lein ring server" and use it..

15:52 coventry: jtoy: Macroexpand the (defpage landing) form and paste that in. You may get a more specific line number that way.

15:52 jtoy: gfredericks: I've checked everywhere, the only place in that trace I can find where I call layout is with (@layout arg1 arg2)

15:52 ok, ill try that

15:52 gfredericks: I give up I cannot make this compile

15:52 mdrogalis: tolitius1: Cool, grow it ^^

15:54 jtoy: coventry: the error is totally different in a different area of code, but that seems like a good thing

15:55 S3thc0n: Hello people of #clojure, I would love to hear your opionions about my newbie code (ignoring that it uses tail calls and not recur), so I don't get used to any bad practices from the beginning (it's a simple fibonacci function): http://pastebin.com/RRaQPGyY

15:56 coventry: Huh, that stacktrace you posted suggests otherwise. Anyway, gotta go. Good luck!

15:56 gfredericks: S3thc0n: I would start with some destructuring

15:57 tolitius1: S3thc0n, take a look at iterate: (def fib (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))

15:58 S3thc0n: http://clojuredocs.org/clojure_core/clojure.core/iterate

16:01 varlog: hi all, quick question about the "early cuts" cl

16:01 ...clojure book. are there more chapters than these 5?

16:02 (this was botched.) I am looking at the O'Reilly book, Clojure Cookbook. Does anyone know if this is it, or if there are more chapters coming?

16:04 newblue: S3thc0n: you can do sums with reduce

16:04 ,(reduce + [1 2 3 4])

16:04 clojurebot: 10

16:05 newblue: not sure if that helps

16:05 nDuff: varlog: That's not really one of the more widely-read texts.

16:05 gfredericks: nDuff: I don't think it's even finished so I wouldn't expect so

16:05 S3thc0n: This is outrageous. I disconnected again. Last thing I got was the hint about destructuring :\

16:05 varlog: nDuff: right, it's not even released yet :-)

16:05 gfredericks: S3thc0n: then there was a one-liner

16:06 S3thc0n: http://clojure-log.n01se.net/#15:56a

16:07 nDuff: varlog: ...but https://github.com/clojure-cookbook/clojure-cookbook/graphs/contributors appears to show actively ongoing development.

16:07 S3thc0n: gfredericks: Oh, thanks! Nice feature.

16:07 newblue: S3thc0n: you can do sums with reduce (in case you don't know)

16:07 ,(reduce + [1 2 3 4])

16:07 clojurebot: 10

16:08 S3thc0n: Yes, since I am at the very beginning I only did simple and direct sequence manipulation yet. It was more about general style.

16:08 varlog: nDuff: thanks, this is very helpful

16:09 S3thc0n: But still thanks, I love how easy everything gets with CLojure :)

16:10 jtoy: gfredericks: I fixed the issue by reverting back to my bad macro, im not sure what the difference is though: https://www.refheap.com/21630

16:11 S3thc0n: But I guess there aren't a lot of general style mistakes you can do in LISP^^

16:11 jtoy: coventry: fyi https://www.refheap.com/21630

16:13 nDuff: S3thc0n: depends on where you draw the line between style and design.

16:13 S3thc0n: there's certainly a lot that matters around making the right judgment calls on how to decompose your problem.

16:14 S3thc0n: nDuff: True - but I would think you can also make less mistakes there in fucntional languages?

16:15 nDuff: *shrug*. They're different mistakes, anyhow. :)

16:24 guns: Does anyone know how long :pre and :post conditions have been supported in CLJS?

16:24 Was pleasantly surprised while porting a lib

16:25 stuartsierra: Anybody know if you can specify a target JDK version when AOT-compiling?

16:25 bitemyapp: jtoy: you are consistently obstinate about writing bad code. Stop abusing atoms.

16:25 seangrove: stuartsierra: Walk2 is great, any ideas if it's feasible to port to cljs?

16:25 bitemyapp: jtoy: you keep using Clojure as a cudgel for writing imperative, mutable code with parentheses and you are suffering on your own behalf and wasting other peoples' time in attempts to save you from your misguided approach.

16:25 jtoy: get a book and learn how to write Clojure idiomatically.

16:25 jtoy: I see you do this week in, week out,.

16:26 jtoy: bitemyapp: all my code is idomatic except for that piece

16:26 hiredman: I doubt it? I think the compile hard codes the calls to asm to use the 1.5 class file format

16:26 bitemyapp: jtoy: don't lie to me, I've seen everything you post on here.

16:26 stuartsierra: seangrove: Thanks. I believe clojure.walk2 could be ported to CLJS.

16:26 bitemyapp: seangrove: why would you? I thought the point was protocols performance.

16:26 there's no distinction to be made there in CLJS so far as I'm aware.

16:26 jtoy: bitemyapp: it was the same issue, anyway, you dont need to be hostile

16:26 bitemyapp: unless there was an API improvement I missed.

16:26 jtoy: you come up with a new terrible idea every week.

16:26 seangrove: bitemyapp: Just a slightly nicer distinction when walking through clojure.lang.MapEntry

16:27 bitemyapp: seangrove: seems reasonable.

16:27 seangrove: I think most people use postwalk on maps though.

16:27 I don't, because I'm awesome, but most do.

16:27 seangrove: I'm using it on hiccup-style structures, personally

16:27 jtoy: bitemyapp: whatever, be bitter all you want,you have said the exact same hostile things, you are not being helpful

16:28 stuartsierra: FYI, I have submitted a patch to update clojure.walk in Clojure: http://dev.clojure.org/jira/browse/CLJ-1239

16:28 bitemyapp: jtoy: I'm trying to save you pain and the channel members' time.

16:28 stuartsierra: hiredman: thanks, trying to find this in the compiler

16:28 jtoy: i implemented a solution that others on the channel recommended

16:28 hiredman: stuartsierra: I think it is at 1126

16:28 bitemyapp: after you'd already gone off on some hare-brained quixotic crusade to make mutation of a function generated atom work

16:29 seangrove: stuartsierra: Thank you, watching it now.

16:29 bitemyapp: jtoy: which is a symptom that you don't really understand what's going on

16:29 hiredman: stuartsierra: V1_5 is the string to grep for

16:29 bitemyapp: jtoy: that you're cargo-culting your way through yuor code

16:29 jtoy: and that you need to read a freakin' book

16:29 dnolen: guns: huh didn't realize they worked myself

16:29 stuartsierra: hiredman: thanks, found it

16:29 guns: dnolen: :)

16:29 jtoy: bitemyapp: you havent seen any of my code, you have no idea, its all functionaly excepy for that one piece, im going to ignore you now

16:29 guns: Maybe they don't then? Seem to work for me

16:29 dnolen: guns: no they appear to work

16:29 bitemyapp: jtoy: I've seen everything you post here.

16:30 jtoy: stop being defensive and just read a book.

16:30 guns: dnolen: Well that's awesome.

16:30 dnolen: guns: but that fact was never updated on the wiki

16:30 bitemyapp: jtoy: http://www.clojurebook.com

16:30 dnolen: guns: on github about the language differences

16:30 hiredman: stuartsierra: I think for 1.7 you need a newer version of asm, and there are some bytecode related changes that I think mean you need to track some extra information (stack maps?)

16:30 jtoy: i have them all , stop bothering me

16:31 bitemyapp: jtoy: yes but owning a book doesn't transfer knowledge

16:31 jtoy: otherwise yuppies would be less retarded. You need to read the book and do the exercises so that you understand the actual semantics.

16:31 jtoy: bitemyapp: are we getting into name calling now?

16:31 bitemyapp: not unless you're a yuppie, no.

16:32 jtoy: you just need to go through the actual book, at least the first 3-4 chapters/units.

16:32 jtoy: bitemyapp: if you want to talk about this in person, sure lets go, but i have no interest to hear you attack me with your bs here

16:33 bitemyapp: jtoy: http://www.youtube.com/watch?v=GlKL_EpnSp8

16:37 seangrove: bbloom: How's the launch going, outside of hn?

16:38 bbloom: seangrove: killer. thanks for asking!

16:38 we're about to top 100M lines of code written :-)

16:38 or i guess blocks dragged together :-P

16:38 seangrove: Wow, that's awesome!

16:38 I showed it to a few friends last night, had a good debate about it

16:39 bbloom: last count was over 3M students

16:39 what's there to debate?

16:39 musicalchair: wow, that's amazing. you must feel great =)

16:39 seangrove: Utility, place, etc.

16:39 bbloom: which side were you on? :-P

16:40 b/c i don't see how we could possibly justify teaching any science, if we can't justify spending a few hours learning about what code is and what it can do

16:40 seangrove: Heh, I think it's a good tool for making programming accessible, makes it less arcane/foreign, limits the amount of mistakes possible (via blocks), and gives immediate feedback. All good things.

16:41 bbloom: i've been teaching scratch in harlem once a week & just 2 weeks ago we let the class beta this

16:41 was NIGHT AND DAY

16:41 seangrove: bbloom: Oh, the other side was whether those were the difficulties in learning to program. But there was widespared agreement that especially for children, this was a huge win.

16:41 bbloom: the kids frickin loved the puzzles instead of the freeform nature

16:41 and those who finished the first hour went back to scratch and were killing it

16:41 and all the ppl on hacker news saying that this is a conspiracy or some political bullshit are insane

16:42 seangrove: bbloom: Hah, you're coming as pretty paranoid now

16:42 nDuff: ...what's this?

16:42 bbloom: sorry, i'm just annoyed reading this HN thread b/c i know for a fact that we've got bipartisan support and havent' donated a dime :-P

16:42 seangrove: Careful about median vs average here - I think your view might be slightly distorted by hn now

16:43 bbloom: anyway, fuck HN. everything else is going super well :-)

16:43 amazingly... *drum roll*

16:43 seangrove: The questions were more about this vs codecademy vs books vs cousera vs lectures

16:43 indigo: bbloom: What's your startup name?

16:43 bbloom: ~60% of ppl who complete the hour of code are female!

16:43 clojurebot: Gabh mo leithscéal?

16:43 bbloom: indigo: i work for code.org

16:43 indigo: Ohhh

16:45 bbloom: https://twitter.com/search?q=%23HourOfCode&src=hash&mode=photos

16:46 indigo: Cool :)

16:48 bitemyapp: trolling on twitter might be my favorite thing.

16:49 technomancy: bbloom: congrats on the launch

16:49 bbloom: technomancy: thanks :-)

16:50 jtoy: trolling in general :)

16:51 technomancy: bbloom: I'm amazed with the progress I've seen so far; had him debugging a tricky bug in a function last night where he was passing a hard-coded number into another function instead of passing the argument on through. it was a blast.

16:51 bbloom: technomancy: ah, the ol' do what i thought i wrote not what i actually wrote bug

16:51 bitemyapp: technomancy: teaching the kiddle?

16:51 bbloom: really glad you're enjoying it!

16:51 bitemyapp: or one of them, anyway.

16:52 technomancy: bitemyapp: always

16:52 bitemyapp: I was hacking Haskell with a friend yesterday, t'was a ton of fun. He learned quickly.

16:52 technomancy: (almost literally)

16:52 bbloom: I'm having some difficulty reconciling my observations with what I've read in Mindstorms about curriculum vs ambient learning

16:52 bbloom: technomancy: i haven't read it, so you'll have to elaborate

16:52 musicalchair: bbloom: have you read any John Holt? "How Children Fail"?

16:52 bbloom: musicalchair: nope

16:53 technomancy: musicalchair: I just finished "Instead of Education" like two days ago; definitely related

16:53 musicalchair: bbloom: http://www.amazon.com/Children-Fail-Classics-Child-Development/dp/0201484021

16:53 danneu: Can anyone recommend a lib for url-slugifying strings?

16:53 musicalchair: technomancy: I'll have to check that out

16:53 bbloom: "John Holt states his belief that children love to learn, but hate to be taught"

16:53 yeah, pretty much

16:53 technomancy: musicalchair: it's a bit dated since it was written before homeschooling was legal, but very good otherwise

16:53 bbloom: i'm like "but mark zuckerberg is gonna teach you loops! that video is awesome! you should watch it"

16:54 NOPE. click. start dragging shit around. "hey, i got it!"

16:54 :-P

16:54 musicalchair: technomancy: I see

16:54 technomancy: bbloom: Papert was a pupil of Jean Piaget, who argues for ambient learning being the ideal model for education. children should learn other subjects the same way they learn to talk, walk, etc: by trying and doing, not by being told what to do

16:55 bbloom: technomancy: that makes sense to me, but w/o knowing if this is for or against that worldview, i'll point out:

16:55 technomancy: so the free-form model feels a bit closer to that ideal

16:55 tim__: okay, I just loaded up my irc client and saw technomancy's comment. What's the context behind the homeschooling discussion?

16:55 bitemyapp: technomancy: I learned programming by being tossed a manual, told that I wasn't going to get anymore PC games so I had to find something else fun to do, and sitting there by myself and figuring it out.

16:55 danneu: Re: myself - https://github.com/pelle/slugger is cool

16:55 bbloom: technomancy: parents who talk to their babies more raise kids who are smarter :-P

16:56 technomancy: bbloom: right, but kids learn words because they want to *do* something: participate in conversation

16:56 bbloom: yeah

16:56 technomancy: kids learn reading best when they want to figure out the world, not from a phonics curriculum

16:57 but empirically the guided approach seems to be more effective in my experience =)

16:57 progo: danneu: that *is* cool :o

16:57 technomancy: maybe gamification plays into that to a degree

16:57 bbloom: but you're doing the guided approach with speaking anyway

16:57 you baby talk to a baby

16:57 and then the baby starts talking back

16:58 rubber-duck: How can I do something like this more concise : (let [foo {} foo (if x (assoc :x x) foo) foo (if y (assoc :z z) foo)] ... use foo)

16:58 bbloom: and over time, you have to explain fewer and fewer vocabulary words & you discuss more and more complex topics

16:58 technomancy: bbloom: right; you have to set the context and difficulty appropriately. but the goals are the child's.

16:58 bbloom: it's just that humans already know how to talk to other people of varying levels of knowledge, experience, intellect, language, etc

16:58 bitemyapp: I'd heard baby talk retards linguistic development.

16:59 technomancy: tim__: educational philosophy and http://learn.code.org

16:59 ieure: bbloom, I never baby-talked to my kids. Always talk to them like, uh, people.

16:59 bitemyapp: ieure: because they are!

16:59 (people)

16:59 ieure: bitemyapp, Yeah, exactly.

16:59 TimMc: Sort of.

16:59 rubber-duck: it just feels there should be a better way to do this because it would come up so often

16:59 bbloom: ieure: yeah, i don't have any kids, but i talk to OTHER PEOPLE'S kids like adults, but we're pretty abnormal compared to most parents, i'd imagine :-P

16:59 TimMc: They're like... becoming-people.

16:59 hfaafb: tiny drunk suicidal people

16:59 bbloom: anyway, that wasn't my point. it was that the sophistication of discussions with a baby vs a teenager evolve

17:00 :-P

17:00 tbaldridge: technomancy: ah, cool. I'm a product of homeschooling so I find the subject interesting.

17:00 ieure: Anyway, talked to them the way I hoped they'd talk to me, seems to be working okay so far.

17:00 bitemyapp: TimMc: all kids are sociopaths at first.

17:00 hfaafb: lol

17:00 bbloom: technomancy: there are some innate goals, like eating that i think educational games should capitalize on

17:00 TimMc: bitemyapp: I'd be skeptical of that claim. What I remember from linguistics class is that language acquisition pretty much proceeds apace as long as there are people talking around them.

17:00 bbloom: everybody GETS pacman

17:00 that dude is hungry. he eats dots.

17:00 technomancy: bbloom: actually I don't find the "limited toolbox" approach confilcts at all with papert

17:00 bbloom: go eat the dots

17:00 mmm dots.

17:01 you don't need to tell anyone what the goal of pacman is

17:01 eat, don't get eaten.

17:01 ieure: bbloom, Have you watched a young child play Pac-Man?

17:01 They have no concept that it is a thing they interact with.

17:02 bbloom: depends on what "young" means

17:02 technomancy: I like how code.org drops a few "now just do something cool" stages in here and there

17:02 bbloom: 5 year olds are finishing the hour of code w/ little to no parental guidance, that's far away from "no concept"

17:02 technomancy: tbaldridge: have you read Papert's Mindstorms?

17:03 TimMc: bitemyapp: I guess there might be a slight delay, but my recollection is that it's not substantial.

17:03 tbaldridge: bboom: Although my personal experience with pac-man as a child was less of "eat and survive" and more of "get power-up pill, and then kill, kill, KILL!!" :-P

17:03 pbostrom: http://www.webmd.com/parenting/news/20050316/baby-talk-may-help-infants-learn-faster

17:03 tbaldridge: technomancy: no I haven't

17:03 bbloom: tbaldridge: as long as you're eating something, you're winning at pacman in my book

17:03 tbaldridge: :-)

17:04 technomancy: tbaldridge: absolutely recommended

17:04 ieure: "Tutorials that teach JavaScript"

17:04 Child abuse.

17:04 dnolen: tbaldridge: technomancy: seconded

17:04 tbaldridge: technomancy: from reading the description it sounds like a book I'd agree with. I'll put it on the list.

17:04 bbloom: ieure: stick to the beginner section for children :-)

17:05 there were just so many javascript tutorials out there

17:05 technomancy: tbaldridge: just started my second read through it last night and realizing it probably is going to take a third for all the goodness to really be extracted =)

17:05 bbloom: "hey, i wanna teach someone to program on the web... i just need an interpreter.... DONE."

17:05 tbaldridge: "sounds like a book i'd agree with" lol filter bubble at work :-)

17:06 tbaldridge: bbloom: lol, I'm not saying that's the only kind of book I read

17:06 bbloom: :-D

17:06 technomancy: I found it helped me put to words a lot of ideas I'd held implicitly but didn't know why

17:06 dnolen: technomancy: tbaldridge: related Alan Kay's reading list on Learning & Education is pretty killer - http://www.squeakland.org/resources/books/readingList.jsp, I've only read Jerome Bruner, Papert, but from what I can tell nearly everything there is golden or insightful.

17:07 technomancy: dnolen: nice; thanks

17:07 <3 Postman too

17:07 I'd been wondering where a good place to start with Piaget was

17:08 bitemyapp: technomancy: would you be willing to consult with me on a write-up comparison of grom and grenchman when the former is done? I'd just like ideas/feedback from you make certain I don't mischaracterize OCaml.

17:08 technomancy: bitemyapp: sure thing

17:08 justin_smith: technomancy: the best teacher I ever had (math / systems science guy) was a huge Piaget fan

17:09 technomancy: justin_smith: I only know him through Papert and Wikipedia so far =)

17:09 bitemyapp: technomancy: much appreciated.

17:10 justin_smith: technomancy: I guess I was just supplying my anecdotal experience that knowledge of Piaget's ideas and ability to help people learn go together

17:10 technomancy: justin_smith: haha nice

17:19 mikerod_: is there anyway to get `lein test` to skip an entire ns in the testing dir?

17:19 technomancy: mikerod_: sure; that's what test selectors do

17:19 you can define a :test-selectors map of keywords to functions in project.clj

17:19 mikerod_: it is recompiling a ns under my test directory, that I have some defrecord's in that multiple test namespaces us. This is causing me to have multiple definitions of the same test helper records, messing things up for me.

17:20 I've read about :test-selectors. I didn't see how to get them to work in the at the namespace level.

17:20 technomancy: it's a relatively new feature

17:20 mikerod_: I don't even have any deftest in this namespace, I just want to reuse some common defrecord types.

17:20 technomancy: hm... actually I don't know if you can avoid loading the namespace

17:21 mikerod_: the :reload flag is hurting me

17:21 technomancy: the test selector works based on the ns's metadata, so it has to load

17:21 mikerod_: making it order dependent on the way the tests are ran.

17:21 hmm

17:21 that makes sense

17:21 sounds like I'm in a tricky situation then.

17:22 technomancy: you could put the test in a different directory

17:22 and only include that dir in :test-paths of a given profile

17:23 mikerod_: That would be available on the classpath during running the other test?

17:23 tests*

17:23 technomancy: it would be on the classpath when that profile was active

17:24 `lein with-profile +extra-tests test`

17:25 mikerod_: Hmm, it seems like that would cause me to still get redefinition of my defrecords, when I ran under that profile

17:25 I thought it would just run all the tests in all the :test-paths

17:25 technomancy: oh right; I thought you just wanted to be able to run other tests without it

17:26 mikerod_: ah I see

17:26 technomancy: can you put the record in a defonce or something?

17:26 * technomancy knows nothing about defrecord

17:26 mikerod_: Yeah I have 2 shared namespaces A and B. B is just defrecord's and A uses B for those records. Then I have a *real* testing namespace C that uses A and B. What happens is, if the tests load in the wrong order, A and B have different definitions of those defrecords

17:27 I'm not sure of a defonce function for a defrecord :(

17:27 technomancy: I mean something like (defonce _ (defrecord ...))

17:27 mikerod_: I can run lein test B A C and I pass

17:27 technomancy: does that even work?

17:27 mikerod_: ah, that would be interesting to try

17:28 technomancy: (when-not (contains? @@#'clojure.core/loaded-libs 'my.test.ns) (defrecord ...)) ; mwahahaha

17:29 bitemyapp: defonce makes me hella uncomfortable sometimes.

17:30 technomancy: so do records though

17:30 so it even sout

17:30 evens out

17:31 cljr: if anyone here has used gloss, can you verify if you can nest codecs within other codecs, specifically frames defined using maps within other maps?

17:32 ztellman: cljr: that is verified

17:32 clojurebot: You don't have to tell me twice.

17:35 cljr: ztellman:Okay, i found an example which nested vectors, but wasn't sure with maps, was trying to figure out if i was using it in a way it wasnt supposed to

17:36 ztellman: does this error immeditately suggest anything to you? "java.lang.IllegalArgumentException: No implementation of method: :sizeof of protocol: #'gloss.core.protocols/Writer found for class: clojure.lang.Keyword"

17:37 mikerod: I keep getitng kicked out of freenode

17:37 technomancy: I'll try out some approaches with this for fun, even though I think I'll have to come up with something a bit better to not recompile my defrecord's.

17:38 defonce did something mysterious and I started having even more failures. So that one was a bit confusing. :)

17:38 I appreciate the feedback though.

17:38 technomancy: sure

17:38 note that it's a :reload and not a :reload-all

17:39 so indirect requires shouldn't reload

17:39 oh... ok.

17:39 you want something that's on the test classpath but has no deftest forms in it

17:40 ztellman: cljr: it seems like you're passing in a keyword when it expects a codec

17:40 technomancy: :profiles {:dev {:source-paths ["test-src"]}} ; is what you want

17:40 ztellman: without knowing more about what you're doing, I can't say

17:44 bitemyapp: mikerod: defonce isn't a terribly great idea.

17:44 mikerod: unless you really understand the implications.

17:45 mikerod: I mean, it's handy if you plan to reload vars and have non-trivial input data to the def, but then the question arises as to why you're init'ing a def in that manner.

17:45 cljr: ztellman: ive gotten as far as having two codecs defined along the lines of (defcodec a (ordered-map :a 1 :b 2)), ..., then have another codec which nestes them (defcodec c (ordered-map :a a :b b :c :int32)), when i try to encode actual data i get that error and if i comment out the nested codecs in c and only have the simple :int32, it seems okay, to confirm, that kind of nesting should work, correct?

17:45 bitemyapp: mikerod: I just got done using defonce and it makes me queasy.

17:46 ztellman: cljr: correct

17:46 cljr: this doesn't mean anything: (ordered-map :a 1 :b 2)

17:46 I assume you're putting real types there?

17:47 bitemyapp: mikerod: defonce only won't overwrite itself, anybody else can plus a refresh will nuke it.

17:47 cljr: ztellman: you are right, i mixed up frames and actual data

17:48 ztellman: just knowing it should work and im not poking around in the dark helps a lot, though, thanks

17:57 mikerod: technomancy: yes, it is a little confusing

17:57 A requires B

17:57 B has defrecords

17:57 C requires A and B

17:57 If lein test goes A B C

17:57 C ends up with 2 definitions of the defrecords

17:57 since A loaded first, it causes the B to load, since it hasn't before

17:58 and then lein test does a require :reload on B

17:58 if the order went B A C, the defrecords are not redefined, and everything is fine

17:58 but ideally I'd just like to never explicitly :reload B (the one wiht the defrecords), since it has no test anyways, it is just a shared namespace for testing types

17:59 bitemyapp: yes defonce has not been something I have seen much use of before

18:01 magnars: I just added thread and unwind refactorings to clj-refactor https://github.com/magnars/clj-refactor.el#thread--unwind-example - in case you're as tired of doing that manually as I am.

18:01 justin_smith: mikerod: maybe a separate source-path, for things auxilarry to tests that are not themselves test definitions, such that they will be found by the testing functions if required, but not auto-reloaded?

18:01 magnars: And it feels good to finally have at least one useful feature in the package :P

18:03 mikerod: justin_smith: yes indeed, I just saw that technomancy mentioned :source-pathes on the :dev :profiles, I have not realized that this is what that was for before

18:03 it does fix my issue, and goo to know!

18:03 good*

18:09 justin_smith: mikerod: well, this is one use for it :)

18:09 mikerod: hah, yes I meant that

18:10 justin_smith: oh yeah, backscroll shows that technomancy did suggest exactly that (but more laconically)

18:20 akurilin: [

18:20 ops.

18:20 Random question for you guys, totally unrelated to clojure, but you people are really savvy. What frame

18:20 work to UTs do you use for testing js?

18:20 qunit?

18:27 magnars: akurilin: Browser automation is required for sanity preservation ... hammering f5 in a browser is all kinds of dull. So I would suggest something that runs on the command line. I prefer busterjs.org - but Karma+mocha or jasmine has wider adoption.

18:27 technomancy: magnars: supposedly you don't need a wrapper around minor modes for hooks anymore

18:28 run-hook will just DTRT if it is pointed at a minor mode

18:28 magnars: technomancy: oh, isn't that nice

18:28 technomancy: also: M-x ucs-insert COPYRIGHT SIGN =)

18:29 magnars: I'm gonna add it to C-x 8 (c)

18:29 technomancy: nice

18:29 akurilin: magnars: sounds good, I'll need to investigate buster then

18:29 magnars: Already have C-x 8 t m ^^

18:30 bitemyapp: ~zergling

18:30 clojurebot: zergling is https://github.com/prismofeverything/schmetterling

18:42 arrdem: 1zzzzzzzzzzzzzzzzzzz

18:42 oops. forgot an s.

18:42 bitemyapp: okay. xorg wins this round.

18:51 sorenmacbeth: anybody know if `alter-var-root is thread local or not?

18:52 hiredman: not

18:52 sorenmacbeth: hiredman: thanks

18:53 hiredman: generally you only use it in tests for mocking/stubbing

18:56 sorenmacbeth: this is the usage which prompted my question

18:56 https://github.com/clojurewerkz/elastisch/blob/master/src/clojurewerkz/elastisch/native.clj#L69

18:56 i've a compojure app making calls to an ES cluster and I wanted to make sure that I can just call connect! once when the handler is started

18:57 hiredman: ah, sorry, I was thinking of with-redefs, but alter-var-root is also not thread local

18:57 sorenmacbeth: and the other threads will use the altered var root

18:57 ah, right

18:57 cool, this should work fine then

18:58 hiredman: ugh

18:58 just because you are using clojure doesn't mean global connection objects are suddenly a good idea

19:03 sorenmacbeth: I don't know what you situation is, but I would recommend looking at talking to elasticsearch's rest api using clj-http instead of using this and the node api (or whatever it is called)

19:04 justin_smith: hiredman: is there a good paper / book / article / resource / blog post of some sort about replacing global resources with a more functional and reentrant binding?

19:04 because this stuff seems to come up a lot

19:04 sorenmacbeth: hiredman: I'm actually using both the native and rest clients

19:10 hiredman: I have some very large queries where the native client performs markedly better

19:12 hiredman: but I'd echo justin_smith's comment. any pointers to a better approach would be interesting to me

19:22 hiredman: justin_smith: I dunnno

19:23 sorenmacbeth: ah, well

19:24 arkh: Is there a canonical cljs->js function out there for converting cljs data structures to js? I've found a couple but haven't found any official ones

19:25 john2x: arkh: clj->js :)

19:25 jtoy: justin_smith: is that question related to what I was asking about earlier?

19:25 arkh: : ( really? ...

19:26 sorry for the obvious question : ) Thanks for the help

19:27 justin_smith: jtoy: and questions I have had

19:27 and many others :)

19:27 also applies to what sorenmacbeth was dealing with

19:29 it is a general and persistent problem where we have strong feelings about what is wrong but no good straightforward canonical resource describing what is right. As far as I know. I am looking for that resource now (and finding good things to read accidentally as I do so), and may consider writing the blog post if I don't find it.

19:29 but I don't feel like I have the expertise to be the authoritative resource on this

19:29 hiredman: it depends a lot on the resource and how you have it configured

19:30 jtoy: justin_smith: I bet yor blog post will be very informative

19:31 hiredman: for example some (most?) message queue clients have an auto reconnect, so if that auto reconnect is ok for your particular use case (depending on what happens on auto reconnect, does it throw an error when someone tries to publish on a closed connection, then tries to reconnect, will you get a thundering herd of reconnections? etc etc) then fine, have a auto reconnecting global connection

19:34 justin_smith: hiredman: a recent instance of this I was dealing with - replacing the config info in the db config with a c3p0 connection pool (in order to reuse jdbc connections in a pool instead of repeatedly creating them). This makes it important that the same pool object is being used (as opposed to the connection info, which is jsut static data, only needs to be structuarally equal)

19:35 and then dealing with the fact that I want to be able to override that connection for certain operations relating to migration

19:35 and a codebase that was not written for everything using the db taking a db argument

19:35 (from the old (sql/with-connection db ...) macro days)

19:37 hiredman: justin_smith: it is also slightly different if you are writing an app or a library, if you are writing an app, sort of whatever, but if you are writing a library for reuse, you can't make those decisions for other projects

19:38 justin_smith: right

19:39 I am one of the authors of a set of libraries, so making the right decision has higher stakes

19:39 and having a good design has a high priority, not forcing shitty decisions on others

19:39 dbasch: I'm trying to translate some python code into clojure, and I can't figure out an efficient / elegant way to generate a map of maps on the fly, in a scalable way

19:39 here's the python code https://gist.github.com/dbasch/99451ac5646e9cf0e2a7

19:41 here's the atrocity I have https://www.refheap.com/21641

19:42 justin_smith: ,(reduce (fn [occurances [a b]] (update-in occurances [a b] (fnil inc 0))) {} (partition 2 1 ["a" "b" "c" "d" "b" "a"])) ; dbasch

19:42 clojurebot: {"d" {"b" 1}, "c" {"d" 1}, "b" {"a" 1, "c" 1}, "a" {"b" 1}}

19:43 dbasch: justin_smith: what if the array doesn't fit in memory?

19:43 justin_smith: that code will work on a lazy input

19:43 it does not hold onto the head anywhere

19:43 dbasch: ok, I'll try it. Thanks

19:43 justin_smith: as long as all keys fit in memory

19:44 reduce is eager, but can take a lazy seq as input

19:44 gfredericks: is laser the goodest thing for haxily extracting data from html?

19:44 justin_smith: dbasch: the trick will be ensuring that you do not bind the head of the incoming lazy seq

19:45 because if you do you will run out of memory

19:50 http://i.imgur.com/3sg75mW.png

19:50 technomancy: clojurebot: fault tolerance?

19:50 clojurebot: Pardon?

19:51 technomancy: clojurebot: fault tolerance is http://i.imgur.com/3sg75mW.png

19:51 clojurebot: Roger.

19:53 lgs32a: dbasch: also have a look at this http://stackoverflow.com/questions/20203883/clojure-simple-markov-data-transform

19:54 dbasch: lgs32a: thanks, that's basically the same as my question

19:54 justin_smith: lgs32a: woah, I just now rewrote the exact function in the SO answer

19:55 lgs32a: justin_smit: it was mine, i just looked over the chat and thought i know that implementation from somewhere

19:55 justin_smith: it was mine, i just looked over the chat and thought i know that implementation from somewhere

19:55 justin_smith: a coincidence I swear :)

19:56 lgs32a: ;)

19:56 notice how the other answer gathers higher performance using merge-with

19:56 justin_smith: hell, I probably learned the idioms from examples you shared other places

19:59 lgs32a: justin_smith: are you working on caribou?

19:59 justin_smith: indeed I am

19:59 looking at generalizing the db integration for k/v stores, nosql, datomic, etc.

19:59 akhudek: is there any way to get clojurescript to give a hint as to where symbols come from in advanced mode?

19:59 justin_smith: more pragmatically working on a plugin protocol for injected features

20:00 lgs32a: justin_smith: are you also hiring?

20:01 justin_smith: I can get you in touch with the tech lead, and can vouch for your expertise

20:02 lgs32a: justin_smith: that would be super awesome. what would I have to do?

20:17 akhudek: oh great, so I have a callback that works in advanced compilation mode if I put a console log statement in it, but does not work otherwise

20:18 has anyone experienced that before?

20:25 justin_smith: akhudek: do you use for or map in the callback?

20:25 could be a laziness thing

20:26 akhudek: justin_smith: https://www.refheap.com/051abfd88602427e3ac2017d0

20:26 if I delete that log, it stops working

20:28 justin_smith: weird

20:28 yeah, I don't see any suspicious laziness there

20:29 hiredman: akhudek: are you sure it is working with the log statement?

20:29 could r there always be falsey?

20:30 could the value of the "response" key be nil?

20:30 how are you including cljs.reader/read-string? seeing it fully qualified like that makes me suspicious

20:31 akhudek: ah, I think you are right, it's the reader not being required

20:36 hiredman: yep, that was it, thanks!

21:18 arrdem: if I have N predicates and a single input, is there a nice way to count how many of them evaluate to true? I can't think of a non-macro one.

21:21 Bronsa: ,(let [i 2] (reduce (fn [c p] (if (p i) (inc c) c)) 0 [odd? even? pos?]))

21:21 clojurebot: 2

21:21 dsrx: ,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10)]))

21:21 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

21:22 dsrx: ,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10)])))

21:22 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

21:22 dsrx: ,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10))]))

21:22 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

21:22 dsrx: ugh..

21:22 ,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10))])))

21:22 clojurebot: 2

21:23 arrdem: hum... I'll keep my macro. refheap.com/21644

21:24 dsrx: all the more reason i should start using ERC + paredit-mode

21:25 coventry: (->> [predicates] (filter #(% input)) count)

21:25 Bronsa: arrdem: there's no need for your macro to be a macro

21:25 , ((fn [vals & preds] (reduce + (for [p preds] (if (apply p vals) 1 0)))) [2] odd? even? pos?)

21:25 clojurebot: 2

21:26 arrdem: Bronsa: this is entirely true

21:26 dsrx: coventry with the slam dunk

21:26 arrdem: dsrx: basically

21:28 Raynes: arrdem: (defn count-true [input & preds] (->> input ((apply juxt preds)) (filter true?) (count)))

21:29 Bronsa: dsrx: I switched to ERC for paredit, turns out it's annoying to have paredit in ERC.

21:29 Raynes: coventry's is smaller, so he wins. <3

21:29 Bronsa: Raynes: but yours uses juxt.

21:29 Raynes: Mine also makes sure that the predicates are actually returning true.

21:29 And not some other truthy value.

21:29 If that matters.

21:29 dsrx: Bronsa: yeah but i could at least conditionally edit it

21:29 arrdem: I should write an M-x clojure-refactor that pastes to channel...

21:30 dsrx: i mean enable it

21:30 arrdem: thanks guys.

21:30 justin_smith: arrdem: am I missing something, or is thre nothing in that pred-count definition you pasted that requires it to be a macro

21:30 Bronsa: dsrx: now I just write snippets in *scratch* and paste it here if I need to

21:30 arrdem: justin_smith: no you aren't. I was just being silly.

21:40 cljr: does the client part of aleph's tcp require an aleph tcp server on the other side or can I ccommuinicate with any tcp server with it?

21:42 justin_smith: cljr: you should be able to connect to any server implementing the required protocol

21:43 ie. if you need http web-sockets the other server should support http web-socket connections etc.

21:43 the example on the aleph github page prints out tweets, and I am sure twitter is not running aleph

21:49 cljr: https://github.com/ztellman/aleph/wiki/TCP#tcp-clients

21:50 justin_smith: so if i have a tcp server on the other side, sending it dat is as simple as using (enqueue ...)?

21:51 bitemyapp: arrdem: you don't need a macro.

21:51 justin_smith: cljr: for enque you need a websocket to communicate with

21:52 cljr: it is not a standard http send/response cycle, but a websocket that stays open with a stream going each way

21:52 cljr: justin_smith: in that link i gave, the tcp example uses enqueue, i dont think it is specific to websockets

21:53 justin_smith: websockets are implemented on top of tcp

21:54 http does the handshake, but you need a server that understands websockets to communicate in that way (and a handler on the server that actually interacts with you via a websocket of course)

21:55 or you could use some other protocol - aleph abstracts over that stuff, you may need to set it up on the lamina level, regardless each end needs to be expecting the same protocol

21:56 cljr: justin_smith: i only need raw tcp, it had seemed as though alpeh could do that. i dont need http or websockets currenctly

21:57 wiki page made it seem like that anywqqay

21:58 bitemyapp: justin_smith: HTTP is implemented on TCP.

21:58 cljr: i can tell that my server is accepting the connection

21:58 justin_smith: bitemyapp: yes it is

21:58 bitemyapp: but web sockets are not implemented in http, that was the distinction I was making

21:59 bitemyapp: justin_smith: just mentioning the symmetry.

21:59 justin_smith: ahh, yeah

21:59 bitemyapp: some people think websockets are magical because they've never written a TCP socket server.

21:59 justin_smith: right

21:59 bitemyapp: and those people are...*puts on his nice person hat*...silly.

22:00 hyPiRion: people who haven't written a TCP socket server?

22:00 justin_smith: bitemyapp: but websockets aren't just raw tcp

22:00 bitemyapp: hyPiRion: people who think anything that isn't HTTP is incomprehensible.

22:00 hyPiRion: oh, yeah

22:01 justin_smith: and then you can bring up UDP or serial comms and really blow their minds

22:01 bitemyapp: although I can't say I entirely enjoyed figuring out the nrepl protocol given how sparse and terrible the documentation was.

22:01 cljr: justin_smith: just to confirm with you, you are saying the tcp client on the wiki is not actually for raw tcp communications but requires a server to support websockets?

22:01 bitemyapp: cljr: websockets are upgraded to from an HTTP connection.

22:01 justin_smith: cljr: actually I don't know that, I just suspected it

22:01 cljr: it could be raw tcp

22:02 https://github.com/ztellman/aleph/blob/perf/src/aleph/tcp.clj I was wrong, it is actually raw tcp

22:02 mea culpa

22:07 cljr: a good way to test out the tcp functionality would be to use ncat -l 2000 -k -c 'xargs -n1 echo'

22:07 it will just print whatever it gets

22:07 of course adjust -l as needed

22:11 arrdem: bitemyapp: das dotas?

22:13 and yes I am now well aware that I did not need a macro there

22:14 xpe: I'd appreciate an eye on my core.async question http://stackoverflow.com/questions/20485188/gracefully-exit-a-clojure-core-async-go-loop-on-kill

22:36 yedi_: you can make two-way channels with core.async?

22:37 xpe: yedi_ what do you mean? when you define a channel you aren't saying who can put and who can take

22:37 a channel is just a queue. many writers. many readers.

22:38 but it has one direction

22:38 Raynes: yedi_: Stargate SG1

22:38 yedi_: https://gist.github.com/eggsby/6102537#file-net-cljs-L14

22:39 xpe: yedi_: ok... and... ?

22:40 justin_smith: yedi_: that is not a two way channel, it is a channel with a put and take method, where would the data come from or go to if you did not have both?

22:40 for true two-way comms you need two of those

22:40 yedi_: i was just confused about how chord works ps://github.com/james-henderson/chord

22:41 and how you could send to a channel and then take from the same channel, but not just get what you just sent to that channel

22:41 but yea, nvm me

22:42 xpe: yedi_: I think the clearest rephrasing to "are channels two-way?" is "are channels bi-directional?" and the answer is no.

22:43 danielszmulewicz: justin_smith: Thanks for helping, pal. So it turned out to be a filename issue which doesn't make sense.

22:43 justin_smith: oh, what was it?

22:44 and underscore versus dash issue?

22:44 danielszmulewicz: So here it goes: on my local development machine, I have two files.

22:44 One is named imagiLena.md, the other imagiLena-about.md

22:44 io/resource can access them both

22:45 On my production machine, Debian system, it barfs on imagiLena-about.md

22:45 xpe: i'll ask my core.async question in a simpler way: I want to make a Clojure daemon that has a go loop at the top level. currently, when I do that, it exits right away.

22:45 danielszmulewicz: Why? No idea.

22:45 I just changed the filename to about-imagiLena.md, and then it's OK.

22:46 justin_smith: what is the barf? just a nil return from the resource?

22:46 danielszmulewicz: yes

22:46 justin_smith: very weird, yeah

22:46 danielszmulewicz: Beats me.

22:46 xpe: yedi_: did you get it figured out?

22:48 coventry: xpe: A go loop returns a channel. I think you have to do something with that channel for the go body to execute. http://clojure.github.io/core.async/#clojure.core.async/go

22:48 danielszmulewicz: justin_smith: It's really nice to be able to fire a repl on a running production system, though.

22:49 xpe: coventry: in my understanding, the caller only get the go loop return value when the go loop finishes "Returns a channel which will receive the result of the body when completed"

22:50 in the examples I'm looking at, just evaluating the go loop is enough to start it

22:50 coventry: You're right.

22:50 xpe: coventry: in the REPL, my go loop definitely starts and pegs the CPU too

22:51 coventry: I think I just should start a normal thread for my top-level event loop, at least with Java as a host

22:51 I looked at a CLJS example that used a go loop at the top level, which makes sense in that context

22:52 and INSIDE that top-level loop, then I should use go blocks (maybe)

22:53 coventry: Try hanging on to to the return value and doing a blocking read on it.

22:54 xpe: coventry: ah, maybe to avoid GC?

22:54 nice idea

22:54 coventry: That's what I'm thinking. Don't know, though.

22:55 xpe: in any case, i'm doing `lein run` so some thread will have to just spin its wheels to keep the whole JVM from shutting down

22:57 justin_smith: ,(Thread/sleep Integer/MAX_VALUE)

22:57 clojurebot: Execution Timed Out

22:57 xpe: justin_smith: you read my mind

22:59 hyPiRion: (.start (Thread. #(deref (promise)))) ?

22:59 xpe: ,(do (Thread/sleep 5000) (println "foo"))

22:59 clojurebot: foo\n

23:00 justin_smith: ,(pr-str (/ 1.0 0.0))

23:00 clojurebot: "Infinity"

23:00 justin_smith: ,Infinity

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

23:00 justin_smith: that is weird

23:00 xpe: ,(do (Thread/sleep 60000) (print "hello clojurebot"))

23:00 justin_smith: why can't it read the thing pr-str returns?

23:00 clojurebot: Execution Timed Out

23:00 gfredericks: justin_smith: there are lots of cases like that

23:00 ,(pr-str (Object.))

23:00 clojurebot: "#<Object java.lang.Object@1fb26b6>"

23:00 justin_smith: oh, ok

23:01 but I know #< stands for "unreadable"

23:01 coventry: justin_smith: No one's really committed to making print-dup readable.

23:01 hyPiRion: guys, guys

23:01 ,(binding [*print-dup* true] (pr-str (/ 1.0 0.0)))

23:01 clojurebot: "Infinity"

23:01 hyPiRion: prints Double/POSITIVE_INFINITY here

23:01 &(binding [*print-dup* true] (pr-str (/ 1.0 0.0)))

23:01 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

23:01 coventry: http://dev.clojure.org/jira/browse/CLJ-1275

23:01 hyPiRion: bleh

23:02 xpe: &(do (Thread/sleep 20000) (print "hello lazybot"))

23:02 lazybot: Execution Timed Out!

23:02 xpe: &(do (Thread/sleep 10000) (print "hello lazybot"))

23:02 lazybot: Execution Timed Out!

23:03 gfredericks: xpe: binary search?

23:03 hyPiRion: /msg lazybot &(your command here)

23:03 xpe: gfredericks oooh! fun

23:03 gfredericks: hyPiRion: just be patient there's only O(log(20000)) tries left

23:04 lazybot: we will know your secrets

23:04 coventry: I can't find it, but there's another similar bug where Stuart Halloway says that fixing print-dup so that its output is fully readable is not a priority.

23:04 xpe: &(puts ",(puts \"haha\"")

23:04 lazybot: java.lang.RuntimeException: Unable to resolve symbol: puts in this context

23:04 echo-area: Isn't that dangerous? Will flood this channel with "hello lazybot"s

23:04 xpe: &(print ",(puts \"haha\"")

23:04 lazybot: ⇒ ,(puts "haha"nil

23:05 hyPiRion: those secrets are quite open, you know

23:05 justin_smith: someone made a botquine had the bots pingponging one another, I think they ignore one another now

23:05 hyPiRion: &(do (Thread/sleep 9500) (pr 'hello 'lazybot))

23:05 gfredericks: ~botstack

23:06 clojurebot: /me puts lazybot on his head and gropes blindly for a third bot to complete the stack.

23:06 lazybot: ⇒ hello lazybotnil

23:06 hyPiRion: justin_smith: http://clojure-log.n01se.net/date/2012-12-17.html#22:30

23:06 oh hey, soon anniversary

23:07 justin_smith: it happened around the time I first started hanging out here

23:08 gfredericks: (inc lazybotnil)

23:08 lazybot: ⇒ 1

23:08 * gfredericks tries to figure out what language "Laz Ybotnil" sounds like a plausible name in

23:10 xpe: ,(print ",(print \"1\")")

23:10 clojurebot: ,(print "1")

23:10 xpe: hyPiRion: hence the trick above I suppose :)

23:11 hyPiRion: yeah

23:11 justin_smith: &(pr 'linnauS Suan)

23:11 lazybot: java.lang.RuntimeException: Unable to resolve symbol: Suan in this context

23:11 justin_smith: &(pr 'linnauS 'Suan)

23:11 lazybot: ⇒ linnauS Suannil

23:12 justin_smith: spelled it wrong, and capitalized it wrong

23:15 sritchie: how are you guys using timbre?

23:18 gdev: i'm not =(

23:21 sritchie: haha

23:21 I'm looking at the nice "appender" abstraction,

23:21 and realizing that I just don't know how to write log statements well

23:22 fakedrake: hello

23:24 Is there an easy way to do (apply -> x list-of-eval-lists)?

23:24 gdev: sritchie, me too, thats why I just punt on logging and store all application events into datomic

23:24 sritchie: gdev: so you have some data structure format for everything that happens, and just dump it for later/

23:25 gdev: I'm trying to do better logging via Riemann

23:25 coventry: fakedrake: Can you give a more specific example?

23:25 sritchie: gdev: and just trying to figure out whether to fire to riemann directly via a stats-d like interface, or hit it via a timbre logging appender,

23:25 or just send absolutely everything and index into datomic, for example

23:26 gdev: but yeah, it suddenly became clear that even after years of "log processing" in the big data world, what-to-log-and-when-to-log best practices are really rusty for me

23:27 fakedrake: coventry: i have a list of strings and I want them to be replaced by themselves surrounded by spaces

23:27 https://github.com/bitsai/lisp-in-clojure/blob/master/reader.clj

23:27 like the tokenize fun here, only I want my list to be variable

23:28 gdev: sritchie, yeah and then you have to figure out what level to log everything

23:31 sritchie: gdev: so datomic

23:31 gdev: can you get very far with their "pro starter"?

23:32 gdev: sritchie, dunno yet, ask me in a month

23:34 coventry: fakedrake: You should make them fns and use reduce.

23:34 gdev: sritchie, but yeah, probably so

23:36 fakedrake: coventry: reduce! yes! thank you

23:40 danielszmulewicz: so lein trampoline won't work when cljsbuild is used in the project?

Logging service provided by n01se.net