#clojure log - Mar 30 2013

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

0:05 tjgillies: trying to ask ruby people if theres datalog/linq stuff in ruby and i can almost see them scratching their heads

0:05 gtrak: tjgillies: you mean like a dsl?

0:05 they love those

0:06 tjgillies: heh

0:06 [09:06:29pm] <lewis1711> tjgillies: "filter" is called "find_all" or "select" in ruby, mapping cons over two lists is the zip method. do you have a specific question?

0:07 i pasted some clojure example code in and someone asked me if i knew what blocks where

0:07 were*

0:10 im trying to use friend but when i reload-all on my main namespace all of a sudden i start getting No implementation of method: :read-session of protocol: #'ring.middleware.session.store/SessionStore found for class: ring.middleware.session.memory.MemoryStore

0:10 anyone ever run into that

0:17 `arrdem: is there a reason that lein 2.1.0 tests still use the (:use) semantics? I thought that #clojure had unofficially depricated use.

0:18 nonuby: hmm.. can you partial a defmulti?

0:18 `arrdem: you shouldn't...

0:18 I wouldn't think at any rate.

0:19 technomancy: `arrdem: just an oversight

0:19 hyPiRion: `arrdem: Like in the template, you mean?

0:19 `arrdem: technomancy: dibs on the patch!

0:19 XP

0:19 hyPiRion: so I guess :require :refer :all then

0:19 `arrdem: fire it up

0:20 `arrdem: hyPiRion: yup, idiotic but there.

0:20 technomancy: you got it

0:23 `arrdem: done.

0:23 * `arrdem has $5 that he broke lein somehow in a two line patch.

0:25 hyPiRion: `arrdem: Could you fix it for the other templates too?

0:26 `arrdem: hyPiRion: sure.. gimme 30 to try and turn this project in before the deadline

0:26 hyPiRion: App at least

0:26 ok, sweet

0:28 gtrak: I made a little runtime disassembler library and lein-plugin: https://github.com/gtrak/no.disassemble/

0:35 `arrdem: technomancy: I could hug you over lein packaging uberjar and the repl

0:39 technomancy: http://www.lakupo.com/qu/ghacks/userpics/philippe-hugs.jpg

0:40 `arrdem: lol

0:41 technomancy: http://www.lakupo.com/qu/ghacks/userpics/philippe-hugs.jpg

0:41 oops

0:41 http://www.lakupo.com/qu/ghacks/userpics/philippe-breakdance.gif

0:44 one more and then I'm gone: http://p.hagelb.org/two-timing.gif

0:45 good night everyone

1:09 ambrosebs: gtrak: cool!

1:11 tomoj: gtrak: I was just wishing for that recently

1:13 unfortunately I don't understand bytecode

1:14 but this would be the only way to tell whether you're getting boxing in a big composition that's supposed to transmit primitives, yes?

1:15 cvk_: hi all

1:17 ambrosebs: tomoj: jvm.tools.analyzer could give some hints. I think the compiler inserts calls to RT/box, you could use emit-form to inspect the AST.

1:17 tomoj: but gtrak's library is probably easier to digest.

1:17 tomoj: !!

1:17 I was thinking exactly the opposite

1:18 cvk_: hi all

1:18 i am just starting to learn clojure

1:18 any book recommendations?

1:18 ambrosebs: tomoj: well there's no disputing the bytecode :)

1:19 tomoj: maybe it's easier if you understand bytecode? :(

1:21 ambrosebs: tomoj: It seems easy enough to get the general idea of what's going on, especially if you're looking for whether boxed or primitive methods are being called. It looks like all types are explicit

1:21 tomoj: just speculating of course.

1:58 tjgillies: does trampoline slow down startup time?

2:03 jasonjckn: tjgillies: yes

2:03 tjgillies: https://github.com/flatland/drip

2:04 tjgillies: jasonjckn: thnx

2:04 jasonjckn: does it work with leiningen?

2:06 jasonjckn: tjgillies: i think so

2:07 not sure

2:09 tjgillies: anyone know if theres a link to the different clojure datastructures and what they're good for?

2:09 the docs just have what methods work with them

2:09 but for example, im interested in what kinda of data hashsets are good at

2:10 curious why datomic uses them for result set

2:10 s/kinda of/kind of/

2:11 tomoj: you mean java.util.HashSet in particular?

2:12 tjgillies: clojure.lang.PersistentHashSet

2:12 which im assuming is very similar

2:12 im not a ruby guy

2:12 java

2:12 freudian slip

2:12 * tjgillies reads the docs for clojure.lang.PersistentHashSet

2:13 tjgillies: doh

2:13 tomoj: well, a query result just is a set

2:13 tjgillies: my brain is shot, lonf week heh

2:14 tomoj: so my answer is "sets are good for sets" :(

2:14 tjgillies: whats the difference between hashset and set

2:14 thats my entire question

2:14 i realize sets are good for storing set data, i mean thats kinda obvious

2:14 why make an additional datastructure

2:16 from javadoc: This class offers constant time performance for the basic operations (add, remove, contains and size), assuming the hash function disperses the elements properly among the buckets.

2:16 maybe to have constant time on set operation?

2:16 tomoj: 'hash set' is just a class of implementations of sets

2:16 &(class (set [1 2 3]))

2:16 lazybot: ⇒ clojure.lang.PersistentHashSet

2:17 tomoj: s/class/kind/

2:17 tjgillies: ah

2:17 tomoj: it's sort of the default set, the other choice is a sorted one which has worse performance but the benefit of being sorted

2:17 tjgillies: so set and hashset are synonymous then essentially?

2:18 aaaah

2:18 gotcha

2:18 tomoj: 'set' _usually_ means a PersistentHashSet in clojure, yeah

2:18 xeqi: treeset?

2:18 tjgillies: ok so hashset is the default set which is unsorted

2:18 `arrdem: hyPiRion: other pull request in

2:18 tomoj: but anything that implements java.util.Set could be called a 'set' as well

2:18 `arrdem: 'evening gents, I'm lisped out for the night.

2:18 tjgillies: night

2:18 im lisped out as well, yet here i am ;)

2:19 (inc tomoj)

2:19 lazybot: ⇒ 8

2:19 tomoj: e.g. I believe datomic actually returns java.util.HashSet results

2:19 tjgillies: you're right

2:20 with datomic we have persistent-persistent-datastructures ;)

2:23 tomoj: PHS has "effectively constant" (i.e. O(log n)..) operations while HashSet is really constant

2:25 I sort of wish you could get a reducer of query results

2:25 then let us choose whether we want to stick it in a HashSet or a PHS or don't stick it anywhere

2:26 amalloy: tomoj: well, j.u.HashSet is amortized-constant, not actual-constant, right?

2:27 tomoj: lazybot: karma amalloy

2:27 lazybot: amalloy has karma 47.

2:27 amalloy: it's weird because you can add in arbitrary objects which all hash-collide

2:28 tomoj: I dunno, but I'm assuming you're right :)

2:36 amalloy: i'm probably wrong about amortized-constant, but there are definitely weird corner cases somewhere

2:45 alex_baranosky: does robert.hooke work with protocol functions?

3:00 amalloy: alex_baranosky: probably not

3:01 extending a protocol function does funny stuff to the var

3:06 and technomancy hates protocols, so maybe he never tested it

3:07 tomoj: I can't imagine how it could possibly work

3:12 oh, actually, it should be able to work, huh?

3:15 looks like it only works for, uh, 'dynamic' implementors?

3:15 i.e. not (deftype Type [] Protocol)

3:15 https://www.refheap.com/paste/e7d587fdefa68621367eb0ad9

3:16 amalloy: tomoj: now try extending a new type to the protocol and see if the hooke is still in effect

3:16 tomoj: nope

3:16 amalloy: my money is on it not working

3:17 tomoj: I see, I thought you meant the protocol var

3:17 every time you extend-type all the protocol fn vars change

3:19 guess that's so the caches are cleared

3:25 hah: <p class="bdfl"><a name="11:33">11:33</a> <b>rhickey: </b>,((fn [[a b]] [b a]) [1 2])</p>

4:07 lnostdal: hi guys, the TIME macro is nice, but is there something more advanced around? .. say, something that lets me do something like: (dotimes [i 10000] (time :section-a (operation-a)) (time :section-b (operation-b))) which will print out totals for search section after all iterations – and similar?

4:07 totals for each*

4:07 Raynes: $google benchmarking clojure

4:07 lazybot: [How to benchmark functions in Clojure? - Stack Overflow] http://stackoverflow.com/questions/3041299/how-to-benchmark-functions-in-clojure

4:07 Raynes: Bah!

4:08 $google criterium clojure

4:08 lazybot: [hugoduncan/criterium · GitHub] https://github.com/hugoduncan/criterium

4:08 Raynes: lnostdal: ^ This is presumably the most popular tool for benchmarking Clojure.

4:08 Dunno if it does what you want in particular, but it might.

4:08 lnostdal: awesome; will check out, Raynes

4:32 finishingmove: $google real world haskell

4:32 lazybot: [Real World Haskell] http://book.realworldhaskell.org/

6:36 Glenjamin: xeqi: are you about? I've got a quick peridot question

6:37 currently the cookie jar only accepts one of the three date-time formats, noticable it doesn't support the one ring.cookies uses when you pass a clj-time object

6:57 i'm thinking i'll put together a patch to use clj-time like ring-core

8:00 gtrak: tomoj: ambrosebs: yes, checking for primitives was a main reason I made it

8:07 pyykkis_: hi, I'm trying to set nrepl not to pop up stack trace and added '(setq nrepl-popup-stacktraces nil)' to init.el

8:08 however, it doesn't to make any difference? Am I missing something? I also tried evaluating it with C-x-C-e, but stack traces are still popping up.

8:09 borkdude: Raynes what is your favorite web framework/lib for Haskell to build something simple?

8:14 papachan: hello

8:18 I am just trying to generate a jar from the book example Clojure Programming. but i cant load my class

8:18 http://paste.ubuntu.com/5661100/

8:50 gtrak: tomoj: you could always look at the bytecode with javap, but that requires AOT, this works fine at a REPL

8:54 it's good for convincing people of how eval works :-)

9:12 jemafeller: hello!

9:12 i have great news!

9:12 after I got really depressed over clojure vs scala vs java performance (each using its own typical Web framework)

9:13 I realized I was benchmarking Java and Scala each through running a jar, and clojure through 'lein run'

9:13 Pupnik: did that make clojures performance look really bad?

9:13 jemafeller: when I was about to ship the Clojure version to a different server I had to make an uberjar. then I thought to benchmark it one last time

9:14 and this time I was getting results the fastest! (fastest was Scala)

9:14 Pupnik, it made from 4700req/s to 6600req/s

9:15 Scala, using Scalatra did a 6200req/s

9:15 Java with drop wizard 5500req/s, and Node.js a pity 3090 req/s

9:16 Dropwizard is the heaviest of the lot, but I *am* trying to pick a standard for each platform (for clojure, I picked bare ring)

9:17 so its not really an apples to apples comparison - but I am picking what an average to intermediate developer would pick

9:17 Nodejs forced me to drop to a bare 'http' implementation too.

9:18 anyway, this is a great feeling. made the decision very easy right now.

9:18 weavejester: With regard to performance, Ring current piggybacks off Java servlets a fair bit for most adapters, so there's a fair amount of potential improvements to be made.

9:19 jemafeller: weavejester, what do you mean?

9:19 isn't everyone using Servlets in the Java world this way?

9:19 weavejester: Well, for instance, servlets parse cookies and parameters, and Ring parsing them with middleware, so there's some redundency going on there.

9:20 jemafeller: ah, I see

9:21 weavejester: Something that hooks into Ring more directly would be faster, although Ring+Servlets seem to be faster than a lot of things even with the redundency

9:21 Out of interest, how did the "lein run" vs jar affect the Clojure results?

9:21 jemafeller: weavejester, if you mean how it works internally - I have no idea

9:21 I was sure there wasn't any difference

9:22 but when I ran the benchmarks on a standalone jar, I went from 4700r/s to 6600r/s

9:22 squidz: In clojure I want a function that takes other functions optionally as parameters. How can I evalutate those functions then. Example (defn myfun [& fns] (evaluate? fns))? Is there anything like this?

9:23 I dont want to use macro stuff is possible

9:23 jemafeller: I'm running on a Sun JDK 1.6 if that matters

9:26 hyPiRion: squidz: huh? ##(let [f (fn [x] (x))] (f #(pr 'foo)))

9:26 lazybot: ⇒ foonil

9:27 squidz: okay I see I just have to pass the function names without surrounding parens in the parameters. Then in the body of myfn call by surrounding with parens

9:27 hyPiRion: yeah

9:28 squidz: (defn myfun [& fns] (for [f fns] (f))) then => (myfun someotherfn)

9:28 jemafeller: is there any advantage of using future-like constructs over things like pmap and spinning a thread?

9:29 borkdude: would this be worth looking into? http://http-kit.org/

9:30 jemafeller: borkdude, you mean in my case?

9:30 borkdude: jemafeller yes

9:30 jemafeller never tried it myself though

9:30 jemafeller: borkdude, I did, but I filed it as 'low level' and more for concurrent connections. I love that i'm using Ring here and not a much lower level construct

9:30 azkane: squidz: if you want those functions to perform side effects you could do (doseq [f fns] (fns)), you can pass any number of arguments to it

9:31 jemafeller: in the same way I could have just dealt with "raw" Servlets or "raw" Netty

9:31 squidz: azkane: yeah thats what im doing. Im wrapping the calls up in a do. I was overthinking the problem when actually clojure makes it very simple. God I love it

9:32 jemafeller: at first I thought it was a stunt to get a "1M connections with Clojure" on HackerNews

9:32 borkdude: I'm wondering why most of the http-kit code is written in java

9:32 jemafeller: but later I saw it was a real maintained project :)

9:32 rebcabin_: what is the difference between keywords :foo and ::foo? I'm in user namespace in repl; :foo prints as :foo and ::foo prints as :user/foo, and these seem "same only different"

9:33 borkdude: rebcabin_ those are namespace qualified keywords: http://kotka.de/blog/2010/05/Did_you_know_III.html

9:35 rebcabin_: borkdude: ty

9:36 jemafeller: borkdude, as I noted, I think it was an attempt to maximize performance in a way that appear low-levelish

9:49 borkdude: cemerick congrats on one year of clojurebook ;-)

9:50 rebcabin_: (= ::foo :user/foo ::user/foo)

9:51 jemafeller: If during a request, the server needs to download a file and run a C++ tool on it for analysis, every request, what would be the best way to do it?

9:52 on node.js it's clear since everything is async.. but on Clojure?

9:53 borkdude: rebcabin_ that's only true when evaluated from user

9:53 rebcabin_: right! i see that

9:56 (in-ns 'bar) (clojure.core/= :user/foo ::user/foo)

9:56 ::foo ~~> :bar/foo

10:06 cemerick: borkdude: heh, thanks

10:19 rebcabin_: I can write "identity" as "(fn [x] x)" but not as "#(%)" ... "#(%)" is something, but what is it? ((#(%) 42) fails with ~"can't cast to IFn"~

10:20 oops one too many open paren: i meant "(#(%) 42)"

10:22 hyPiRion: rebcabin_: Try macroexpanding it

10:22 ,'(macroexpand-1 '#(%))

10:22 clojurebot: (macroexpand-1 (quote (fn* [p1__35#] (p1__35#))))

10:22 hyPiRion: bleh

10:22 ,(macroexpand-1 '#(%))

10:22 clojurebot: (fn* [p1__70#] (p1__70#))

10:25 squidz: when I try to pass a function as a parameter to another function in clojurescript and then try to call that function by surrounding it with parens, i get a error telling me that the function passed in as a paremeter isn't a function

10:26 is this a bug?

10:28 randomenduser: can I send code to be evaluated to an nrepl server (that's active in another terminal) via curl/netcat/telnet/whatever and see the output in that active terminal?

10:34 squidz: here is what is giving me a problem https://www.refheap.com/paste/13115 I guess the javascript isnt recognizing the parameter(named withparameters) as a function

10:35 is there a way I can hint that a function argument is of the type function for clojurescript?

10:39 rebcabin_: hyPiRion: ty

10:51 pyykkis_: hi, I'm trying to set nrepl not to pop up stack trace and added '(setq nrepl-popup-stacktraces nil)' to init.el

10:51 however, it doesn't to make any difference. Am I missing something? I also tried evaluating it with C-x-C-e, but stack traces are still popping up. Any help?

11:02 `arrdem: mornin

11:03 hyPiRion: thanks for the rebase help, that's the one git command I haven't mastered yet

11:04 hyPiRion: `arrdem: oh no problem, thanks for the fix :)

11:15 klang: pyykkis_: you need to M-x customize-variable and type in nrepl-popup-stacktraces to modify the value of the variable, I think.

11:18 pyykkis_: Then, toggle the variable and save the state for future sessions (that will use the right notation in the file you have set custom-file to point at)

11:27 borkdude: redinger #(-> %)

11:28 sorry I meant rebcabin_

11:29 hyPiRion: or #(do %) too

11:29 I with there were more succinct and evident names for stuff, really

11:29 rebcabin_: borkdude & hyPiRion: nice!

11:30 hyPiRion: identity and partial in particular

11:30 borkdude: hyPiRion just id

11:31 hyPiRion partial application, special reader macro for it?

11:31 hyPiRion: borkdude: nope, not in Clojure

11:32 borkdude: #$(+ 2) for example?

11:32 hyPiRion: I think Haskell implicitly do partial application, but Raynes would know more about that than I do

11:32 borkdude: hyPiRion Haskell has currying

11:32 hyPiRion: hm

11:32 borkdude: hyPiRion one reason this is not possible in clojure is the possibilty of varargs, if I remember correctly

11:33 rebcabin_: in Haskell sometimes called sectioning: "+ 2" same as clojure (partial (+ 2))

11:33 hyPiRion: borkdude: yeah, I know

11:33 borkdude: yes, what about having partial as: $(+ 2) would that work?

11:34 rebcabin_: would work for me if just reader syntax for partial

11:34 $ i mean

11:35 pyykkis_: klang: thanks, I'll try that

11:35 hyPiRion: Theoretically you could just make such one right now with tagged literals

11:35 borkdude: (map $(+ 2) (range 10)) instead of (map (partial + 2) (range 10))

11:35 hyPiRion: Well, with #$ that is.

11:36 `arrdem: uergh custom readers...

11:37 hyPiRion: are #-prefixed readers less evil? I remeber looking at this a while ago and there are crobars involved for non-prefixed readers.

11:38 hyPiRion: `arrdem: I wouldn't say less evil. It just has the standard # before it.

11:38 They were designed to represent data though, not shorten production code

11:40 `arrdem: yeah.. I get why custom readers make code less maintainable and the reader less stable but I for one would appreciate being able to do such a thing on occasion.

11:41 borkdude: well, we could always (def $ partial) and write ($ + 2) instead of $(+ 2)

11:42 hyPiRion: yeah, that's even better

11:42 xeqi: but I want my clojure to look like jquery

11:42 `arrdem: wat

11:43 hyPiRion: xeqi: and I want my Clojure to look like brainfuck

11:43 xeqi: aren't you succeeding?

11:43 hyPiRion: Can't satisfy everyone, eh

11:43 jouiswalker: lol

11:43 `arrdem: (nc hyPiRion)

11:44 hyPiRion: Here, let me inc myself

11:44 ,'(inc hyPiRion)

11:44 clojurebot: (inc hyPiRion)

11:44 hyPiRion: oh dangit, he actually made lazybot ignore clojurebot.

11:44 `arrdem: bots ignore each other and themselves...

11:45 borkdude: are ibooks readable on anything other than an iOs device (which I don't own)?

11:45 `arrdem: if you want bf*ck in clojure it should be pretty doable..

11:45 hyPiRion: xeqi: well yeah, I'm getting surprisingly close. Now I only need to figure out how to replace ns-map, and I have a working hello world without a single alphanum

11:46 `arrdem: https://github.com/hyPiRion/hello-swearjure

11:46 Even the project.clj is like that.

11:47 `arrdem: hyPiRion: oh I was talking about a literal brainf*ck implementation

11:47 not your arithmetic evil

11:47 hyPiRion: oh :(

11:47 borkdude: hyPiRion what is the rationale behind swearjure?

11:48 jouiswalker: that is so beautiful

11:48 hyPiRion: borkdude: Well, using many different characters is complecting your workflow. My goal is to reduce the amount of characters to decomplect work and make it simple.

11:48 different characters.

11:49 `arrdem: that is the WORST rational I've heard in months

11:49 well done

11:49 hyPiRion: thank you

11:49 borkdude: hyPiRion are there any plans for a special keyboard (layout) to support swearjure

11:49 hyPiRion: I made it up just now. Seriously though, it's just for fun, there's no value behind it.

11:50 borkdude: Don't give me ideas, man.

11:50 `arrdem: oh please forget ideas I can deliver on that one.

11:51 http://www.ergodex.com/mainpage.htm

11:51 do some statistics on the swearjure source and arrange keys appropriately

11:51 you're probably gonna want arrow keys, ( ) + and *

11:52 maybe [ ] ~ ` and @

11:52 % can't forget %

11:52 hyPiRion: and #

11:53 `arrdem: that's like 80% less keyboard! think of all the time you'll save on hunting and pecking!

11:53 xeqi: ohh, it might even make a cell phone a decent dev environment

11:53 jouiswalker: we need to start translating shakespeare into this more efficient language

11:54 pyykkis_: klang: d'oh, it turned out I was running an old version of nrepl.el. Thanks, your help led me eventually to the right direction.

11:54 jouiswalker: rhymes can probably be handled by emacs indentation

11:57 `arrdem: jouiswalker: as long as we're doing terible things with emacs lisp, lets impliment clojure on top of it!

11:57 then we get the best of the One True Editor and the better Lisp!

11:58 * `arrdem will see himself out now

11:58 jouiswalker: lol

12:12 klang: pyykkis_: you are welcome :-) (my stacktraces are now turned off too, nice)

12:35 `arrdem: I love when libraries get abandoned...

12:35 jeremyheiler: `arrdem: It's the best.

12:36 What library are you looking at right now?

12:36 `arrdem: https://github.com/jkk/loom

12:37 I need some sort of directed graph structure for my compiler and that seems to be the only toolkit to fit the bill.

12:37 squidz: does anybody know why I cant use an optional parameter with (defn fn [fst & rest] ...) when rest is a function? When it isnt an optional parameter it works fine. Im using clojurescript btw

12:38 jeremyheiler: squidz: Don't name the varargs rest then?

12:38 `arrdem: Is there anything wrong with the lib?

12:39 `arrdem: jeremyheiler: probably not just laughing that there's a feature add pull request sitting unattended for two months

12:39 jeremyheiler: `arrdem: heh yeah

12:39 squidz: jeremyheiler: thats not the actual name of the parameter. That was just an example. My func signature looks like this (defn switch-view [content & withlisteners] ...)

12:40 jeremyheiler: squidz: How are you using withlisteners? That points to a seq.

12:41 squidz: jeremyheiler: I was just tryint to pass one function to it, with the plan that I could tack on further function if needed. Do I need to wrap the function into some kind of collection?

12:42 jeremyheiler: `arrdem: GitHub shows jkk hasn't had any activity on GitHub in the past 2 months, who knows. I know him personally, so I hope he's doing ok.

12:43 squidz: No, the varargs come in a seq, so if the function is the first optional arg, then you can grab it by saying (first withlisteners).

12:43 Raynes: borkdude: I was never fond of any of the Haskell web frameworks, but Yesod seems to be the most popular.

12:44 dnolen: ,((fn [x & r] [x r]) [1 (fn [])])

12:44 clojurebot: [[1 #<sandbox$eval35$fn__38 sandbox$eval35$fn__38@18e865b>] nil]

12:44 dnolen: ,((fn [x & r] [x r]) 1 (fn []))

12:44 clojurebot: [1 (#<sandbox$eval73$fn__76 sandbox$eval73$fn__76@74a506>)]

12:44 dnolen: squidz: ^

12:44 squidz: note that r is a seq containing the extra parameter

12:46 squidz: dnolen: jeremyheiler: this is what it looks like https://www.refheap.com/paste/13119

12:48 dnolen: squidz: the problem is the for, for is *lazy*, you probably want doseq

12:49 squidz: dnolen: thanks dnolen that was exactly the problem

12:49 dnolen: squidz: np

13:18 borkdude: Raynes thanks

13:18 supersym: is there a good reference for clojure packages without all the personal forks?

13:19 borkdude: supersym there is clojuresphere and clojure toolkit (just google)

13:19 supersym: thnx :)

13:21 borkdude: supersym I meant http://www.clojure-toolbox.com/

13:31 dean: Hey guys, just having a go at learning clojure. I'm trying to use core.logic to solve the irregularity of distributions problem (http://en.wikipedia.org/wiki/Irregularity_of_distributions). So far I have: http://pastebin.com/QJnNQ2Gr but when I try to run it I get:

13:31 ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn clojure.core.logic.Substitutions (logic.clj:410)

13:31 And i'm not really sure what it's referring to.

13:34 supersym: its expecting a function but you pass it a sequence?

13:50 jeremyheiler: Anybody here familiar with Kern, or parser combinators in general? I haven't been able to figure out how to repeatedly parse input with a single parser until the end. https://www.refheap.com/paste/13120

14:31 thalassios_xelon: helo :)) i used to use (pst) to print stack trace,i updated in clojure 1.5.1 i think it doesnt work..

14:31 gow to print stack trace in clojure 1.5.1?

14:32 it says CompilerException java.lang.RuntimeException: Unable to resolve symbol: pst in this context, compiling:(NO_SOURCE_PATH:1:1)

14:33 jeremyheiler: thalassios_xelon: (pst) is part of the clojure.repl namespace. Are you sure that it is loaded?

14:34 thalassios_xelon: i use counterclockwise

14:35 (clojure.repl/pst)

14:35 ClassNotFoundException clojure.repl java.net.URLClassLoader$1.run (:-1)

14:35 dnolen: thalassios_xelon: you need to require it first

14:36 thalassios_xelon: in the past it did it automatically

14:36 they changed that?

14:37 (:require clojure.repl/pst)

14:37 CompilerException java.lang.ClassNotFoundException: clojure.repl, compiling:(NO_SOURCE_PATH:1:1)

14:39 dnolen: thalassios_xelon: (require 'clojure.repl) doesn't work at the REPL?

14:40 thalassios_xelon: what to write in my repl to see the stack trace? i used to just print (pst)

14:40 (require 'clojure.repl/pst)

14:40 FileNotFoundException Could not locate pst__init.class or pst.clj on classpath: clojure.lang.RT.load (RT.java:443)

14:41 i just updated the counterclockwise,i dont know what happened

14:43 ivan: thalassios_xelon: 1.5 fixed a bug that dumped `pst` into every namespace

14:44 thalassios_xelon: ivan how to use it,in 1.5?

14:45 what to write in my repl to see the stack trace?

14:45 hyPiRion: ,(require '[clojure.repl :refer [pst]))

14:45 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

14:45 hyPiRion: ,(require '[clojure.repl :refer [pst]])

14:45 clojurebot: nil

14:45 hyPiRion: ,(pst)

14:45 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable>

14:45 hyPiRion: like that, I suppose

14:46 thalassios_xelon: thx thx :)

14:46 hyPiRion: np

15:28 edbond: enlive question: how to select tag with text? [:title (html/text-pred #(re-matches #"2012" %))] returns ()

15:28 please help

15:29 [:title] returns {:tag ... :content (".....2012....") }

15:29 tomoj: &(re-matches #"2012" "foo bar 2012")

15:29 lazybot: ⇒ nil

15:31 tomoj: perhaps use re-find instead?

15:32 re-matches checks for a match to the whole string

15:41 edbond: tomoj: Yes, thanks a lot

15:42 docstring not helpful for non-java person

15:45 tomoj: always confuses me too

15:49 why does nth work on Matchers?

15:49 can't seem to make it useful

15:50 oh

15:50 clojurebot: excusez-moi

15:51 tomoj: nope, still don't get it

15:53 amalloy: tomoj: so that you can destructure them

15:53 tomoj: but how?

15:53 amalloy: (not that i recommend actually doing this)

15:53 tomoj: &(let [[x] (re-matcher #"(foo)" "foo")] x)

15:53 lazybot: java.lang.IllegalStateException: No match found

15:54 tomoj: I guess you have to call some java method first?

15:55 &(let [[x] (doto (re-matcher #"(foo)" "foo") .matches)] x)

15:55 lazybot: ⇒ "foo"

15:55 tomoj: I see..

15:55 amalloy: &(let [[x y] (doto (re-matcher #"(foo)" "foo") .find))] [x y])

15:55 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

15:55 amalloy: &(let [[x y] (doto (re-matcher #"(foo)" "foo") .find)] [x y])

15:55 lazybot: ⇒ ["foo" nil]

15:56 tomoj: huh, I swear I tried ##(let [[x] (doto (re-matcher #"(foo)" "foo") re-find)] x)

15:56 lazybot: ⇒ "foo"

16:14 tomoj: gotta be a better way than this: https://www.refheap.com/paste/63a23eacdb4094df6ca3a6ed2 ?

16:14 that doesn't make sense actually..

16:15 https://www.refheap.com/paste/0f28e38bf36a36f22b8ad09f4

16:15 problem is to try (bar), and then 1) if no error was thrown, call foo with the result, otherwise call bar with the error

16:16 ..baz

16:16 (try* (foo (bar)) (catch err (baz err))) sort of works

16:16 except that foo might itself throw an exception

16:17 guess this works https://www.refheap.com/paste/30804cfdcb8bdb4d0cdc942fa

16:18 er, https://www.refheap.com/paste/91a4595205d72c37e133f3970

16:36 tieTYT2: is there something like case that doesn't work on constants? I'd like one that works on regexes

16:36 ah, cond maybe

16:36 bbloom: tieTYT2: condp =

16:37 ,(condp = 10 "foo" :string (* 2 5) :ten)

16:37 clojurebot: :ten

16:39 tieTYT2: nice

16:40 ,(condp = "foo" "foo" :string (* 2 5) :ten)

16:40 clojurebot: :string

16:41 bbloom: ,(condp = :x (do (prn 1) :x) "x" (do (prn 2) :y) "y")

16:41 clojurebot: 1\n"x"

16:41 hyPiRion: er

16:41 Raynes: hyPiRion: Jesus.

16:41 tieTYT2: is there a predicate that sees if a regex matches a string?

16:41 Raynes: hyPiRion: That package was at my doorstep today when I moved in.

16:41 Didn't you literally send it last night?

16:41 hyPiRion: Raynes: Hi, I know.

16:41 I did

16:42 Raynes: Like, it got here in like 12 hours.

16:42 tieTYT2: i always have to do a (not? (nil ... and I don't like that nesting

16:42 Raynes: That's completely insane.

16:42 hyPiRion: Amazon's fast

16:42 bbloom: hyPiRion: (find-doc "regex")

16:42 er i mean tieTYT2

16:42 tieTYT2: (find-doc "regex")

16:42 Raynes: Oooh, you bought it on amazon? I thought you shipped it from Norway.

16:42 Okay, that makes more sense since the Amazon warehouse is right here.

16:42 hyPiRion: I said I would surprise you

16:43 tieTYT2: CompilerException java.lang.RuntimeException: Unable to resolve symbol: regex in this context, compiling:(NO_SOURCE_PATH:1)

16:43 oops

16:43 bbloom: tieTYT2: c'mon now, you can solve that one on your own

16:43 this is me trying to teach a man to fish :-P

16:43 Raynes: I haven't had a chance to really look at the stuff yet because I'm unpacking.

16:43 But I will.

16:43 hyPiRion: hah, no worries

16:44 tieTYT2: i don't see anything in this list that's a predicate

16:44 bbloom: tieTYT2: what makes something a predicate?

16:45 tieTYT2: it returns a boolean

16:45 bbloom: tieTYT2: what about if it returns a truthy value or nil ?

16:46 tieTYT2: then I've gotta nest more parens which isn't ideal

16:46 bbloom: ,(if :not-a-boolean true false)

16:46 clojurebot: true

16:46 tieTYT2: i'll just turn one of these into a predicate

16:47 tjgillies: anyone familiar with shoreleave know how to get a request object inside the remote function, it looks the only args it has are the args passed explicitly from the client

16:48 bbloom: ,(condp re-matches "xyz" #"a.*" :foo #"x.*" :bar)

16:48 clojurebot: :bar

16:48 bbloom: tieTYT2: is that not what what you want?

16:49 tieTYT2: oh yeah that'll work

16:49 I was going to do this:

16:49 re-pred #(not (nil? (re-find %1 %2)))

16:49 hyPiRion: oh dear what

16:49 tieTYT2: and then use re-pred in the condp as the pred

16:49 thanks

16:49 bbloom: tieTYT2: hence my question about what makes a predicate.... just because it doesn't end in a question mark doesn't mean it's not a useful as a predicate :-)

16:50 tieTYT2: Yeah I thought those rules only applied to if, I didn't know they work everywhere that wants a predicate

16:51 tomoj: ,(macroexpand-1 '(condp re-matches "foo" #"f.*" 42))

16:51 clojurebot: (clojure.core/let [pred__80 re-matches expr__81 "foo"] (if (pred__80 #"f.*" expr__81) 42 (throw (java.lang.IllegalArgumentException. (clojure.core/str "No matching clause: " expr__81)))))

16:52 tieTYT2: ah

16:52 tomoj: if someone does (if (true? (pred x)) ...) or something in their macro, they failed

16:53 borkdude: In C# a Predicate is a function that expects 1 argument and returns a boolean. In Clojure I think any pure function of one argument can be a predicate

16:54 tomoj: (doc condp)

16:54 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which m

16:54 tomoj: "binary predicate" hmm

16:55 I think "predicate" is more about connotation

16:55 hyPiRion: =, <, >, >=, <=, etc

16:55 tomoj: if I call "f" a predicate it just means I'm going to do (if (f ...) ...)

16:56 hyPiRion: There's no semantics within Clojure which defines a "predicate", though they use to end with ?

16:57 condp is probably the only one which has the suffix-p from CL

16:57 borkdude: ,(doc some)

16:57 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

16:57 tomoj: I never know whether to name my predicate-sets with question marks or not

16:58 borkdude: tomoj ? means: returns a boolean, I think

16:58 tomoj: (def special-form? (into #{} (keys clojure.lang.Compiler/specials)))

16:58 tjgillies: anyone know where i can find docs on what options are available to function args e.g. (defn foo [:keys blah :as bar])

16:58 borkdude: this is why it's some and not some?

16:59 tomoj: but who cares whether it actually returns a boolean?

17:00 I mean, is there a problem having a question-marked fn _not_ return booleans?

17:00 I guess if you're going to (frequencies (map special-form? syms)) or something you care..

17:01 tjgillies: tomoj: it not very idiomatic ;)

17:01 it's*

17:02 hyPiRion: tomoj: Well, there's actually one place where it would fail pretty hard

17:02 ,(keep #{:foo :bar} [:foo :baz :bar])

17:02 clojurebot: (:foo :bar)

17:02 hyPiRion: ,(keep (comp boolean #{:foo :bar}) [:foo :baz :bar])

17:02 clojurebot: (true false true)

17:03 tomoj: yeah, OK, (def special-forms ...) :)

17:04 hyPiRion: It's not insanely hard to punch in a `boolean` here or there though, that's all to it

17:07 bbloom: tomoj: you can think of a "binary predicate" as a normal predicate that takes a tuple of two values ;-) all functions can technically be thought of as having arity 1. hell, ignoring optimizaitons, clojurescript basically defines every function as (fn [& args]) and then switches on arguments.length

17:07 borkdude: I changed some functions to (boolean (some .. )) instead of (some ..) just to satisfy unit tests (is (…) true)

17:08 but maybe I could have written (is (…)) or something?

17:08 Raynes: hyPiRion: Nice, you even sent me Hyperion.

17:08 bbloom: borkdude: some is an interesting special case

17:09 (doc some)

17:09 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

17:09 bbloom: in theory, some is not foldable

17:09 but some? is

17:09 borkdude: oh wait, I wrote (is (= … true)), but I could have written (is (true? ...))

17:09 or maybe even (is ...)

17:10 no

17:10 bbloom: i've done (boolean (some xyz)) myself in a few cases so that my public API doesn't mandate the linear algorithmic complexity

17:10 tomoj: how is it not foldable?

17:10 mthvedt: do clojure closures capture var bindings?

17:10 bbloom: tomoj: it's LEFT foldable. it's not foldable in the reducers sense

17:11 tomoj: how not?

17:11 bbloom: b/c some returns the first value to return true from left to right on sequences

17:11 tomoj: I guess I'll try to provide a counter-example :)

17:12 bbloom: i guess some works on maps & in theory that would be foldable

17:12 and sets too

17:12 borkdude: yes, I could have gotten rid of (boolean ..) by just writing (is …) in the tests

17:13 tomoj: https://www.refheap.com/paste/92633b5cf1a178e1e47a7422f ?

17:13 bbloom: ok i retract my statement :-P however, some still returns an element when you may want a public interface to return a boolean, so coercing isn't always a bad thing there

17:13 tomoj: actually, it should be (if ret (reduced ret) ret') or something?

17:14 oh and I forgot the predicate, whatever..

17:14 borkdude: bbloom agree, especially when I write some-test? I expect a boolean

17:16 tomoj: hmm, will vector folding stop on reduced?

17:17 no

17:17 combinef can't return a Reduced

17:18 so you have to crank through the whole vector even if you find a truthy value in the first partition

17:19 of course..

17:19 would need weird magic to do otherwise I guess

17:20 borkdude: unless the threads in which the partitioned work is done could notify when one truthy value had been found ;)

17:21 tomoj: I guess your reducef could check an atom that your combinef resets?

17:21 checking for Reduced on every reducef is bad enough.. :(

17:30 I wonder how high the cost of instantiating a closure every time you hit a Reduced might go

17:54 moominpapa: Hi, I was hoping someone could give me some advice. I'm getting a name conflict and I'm trying to figure out what's causing it.

17:54 The funny thing is a) I know what libraries are the problem (hiccup and clostache)

17:55 b) I don't seem to be able to replicate it outside of my project

17:55 Any advice on how to trace the issue?

17:57 hyPiRion: moominpapa: do you use any `use` or `require ... :refer [...]` within the code?

17:58 moominpapa: I've been through trying to remove every last one, and I thought I'd managed it.

17:58 hyPiRion: hum

17:58 moominpapa: The annoying thing is, it seems to be buried deep.

17:59 It seems to be something to do with wrap-stacktrace

17:59 hyPiRion: what's the error msg?

18:02 moominpapa: http://pastebin.com/8bqv8xmM

18:04 Semele is the name of my project.

18:05 hyPiRion: Well, clostache has a private escape-html (https://github.com/fhd/clostache/blob/master/src/clostache/parser.clj#L30), and hiccup has one

18:06 I have no idea how they manage to clash though

18:08 moominpapa: Yeah, it's driving me nuts.

18:08 hyPiRion: moominpapa: https://github.com/noir-clojure/noir/issues/101 may lead you the right way

18:08 Oooh, ooh.

18:10 hm, moominpapa, try out lein clean first

18:12 tomoj: nice, hiccup is second google result for "hiccup" now?

18:12 moominpapa: Trying...

18:15 jeremyheiler: tomoj: I wonder how much of that is influence by search history.

18:15 bosie: 

18:16 rebcabin: looking for idiomatic way to convert list of key-value vectors into map, e.g. not (reduce (fn [m [k v]] (merge m {k v})) {} '([:a 1] [:b 2]))

18:17 ... which did actually roll off the tongue, but yucch

18:17 tomoj: jeremyheiler: I have an alias that launches chrome with a brand new profile

18:17 so unless they're looking at my IP or something..

18:17 #'hiccup.core/escape-html ?

18:17 jeremyheiler: ,(into {} [:a 1 :b 2 :c 3])

18:17 tomoj: what the hell is that?

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

18:17 tomoj: there shouldn't be a #'hiccup.core/escape-html

18:17 jeremyheiler: tomoj: nice

18:18 hmm, that was a guess

18:18 hyPiRion: jeremyheiler: not a bad one

18:18 rebcabin: jeremyheiler: into doesn't look right because it takes a vector of an even number of elements, not a list of 2-element vectors

18:18 jeremyheiler: (apply hash-map [:a 1 :b 2 :c 3])

18:18 ,(apply hash-map [:a 1 :b 2 :c 3])

18:18 clojurebot: {:a 1, :c 3, :b 2}

18:18 jeremyheiler: rebcabin: oops! i should probably read!

18:19 rebcabin: jeremyheiler: my input is a list of 2-element vectors, like '([:a 1] [:b 2])

18:19 hyPiRion: ,(into {} '([:a 1] [:b 2]))

18:19 clojurebot: {:a 1, :b 2}

18:19 hyPiRion: so jeremyheiler is right, just read it incorrectly

18:19 rebcabin: ok lemme try

18:20 lovely, ty jeremyheiler and hyPiRion

18:21 tomoj: "Unable to resolve var: hiccup.core/escape-html in this context" hmm

18:21 jeremyheiler: np. next time i'll try to be less confused

18:22 hyPiRion: jeremyheiler: oh, don't you worry. Once I read a read a question which was like this "Is there a more idiomatic way to do (foo (bar x))?"

18:22 And I answered "Why not just do (foo (bar x))?"

18:22 jeremyheiler: hyPiRion: hah

18:22 rebcabin: good one

18:23 my fancy-schmancy used destructuring and merge and reduce, boffo

18:23 triple overkill

18:24 jeremyheiler: rebcabin: Sometimes it takes overkill to realize there's a simpler solution.

18:24 hyPiRion: rebcabin: reduce-kv is a new one which is cool though, and would've been a "nice" fit for this case

18:24 rebcabin: i will take a look

18:24 hyPiRion: Well, not "nice fit", but it is a reduce over a map

18:25 rebcabin: nod

18:27 jeremyheiler: "invent then simplify"

18:27 jeremyheiler: rebcabin: def

18:28 moominpapa: Thankyou guys, lein clean was what I needed *doh*. Took a while to confirm it had fixed the problem. Now I can get back to the original problem :)

18:29 hyPiRion: moominpapa: ok, glad to know it worked! Happy hacking

18:29 moominpapa: Now I need to go and learn what, exactly, lein clean does now that there isn't a deps folder...

18:30 jeremyheiler: moominpapa: It just removes target/ I think.

18:30 hyPiRion: moominpapa: oh, what leiningen version do you use?

18:30 We place stuff within ~/.m2/ these days

18:30 moominpapa: 2.0.0

18:35 chessguy: hi all. i'm kind of a newbie to clojure, playing around with pedestal. can someone help me understand how to make a change in the library code and build it for my application?

18:36 gfredericks: just for testing, or would you want to push it up to clojars as well?

18:36 chessguy: just for testing for now

18:40 gfredericks: I can't remember if the lein checkouts feature is supposed to still work or not

18:40 moominpapa: It works

18:40 gfredericks: that's the classic way to do it at least

18:40 moominpapa: Used ittoday

18:41 chessguy: oh, i remember reading something about that. i'll go find that, thanks

18:42 moominpapa: It's in the readme. (As someone else told me a few years back.)

18:42 Actually, more embarrasingly, it was technomancy

18:42 kmicu: Or my env is evil or 'lein new pedestal-service helloworld' (v1.3.0-SNAPSHOT) gives me 'forbidden' instead of 'hello world'.

18:48 chessguy: kmicu: interesting. i've been playing with 0.1.2 and it's ok

18:49 kmicu: how did you even get 1.3.0-snapshot?

18:52 kmicu: chessguy: examples from 'samples' like chat, helloworld-app which use pedestal 0.1.0 works good

18:53 chessguy: kmicu: ok...

18:54 kmicu: Can sbd with lein 2.1.2 try 'lein new pedestal-service helloworld', lein repl, (use 'dev), (start) and checkout localhost:8080?

18:57 chessguy: kmicu: that works for me

18:58 kmicu: chessguy: Do you have 0.1.3-SNAPSHOT in project.clj?

18:59 chessguy: kmicu: you mean like this? [io.pedestal/pedestal.service "0.1.3-SNAPSHOT"]

18:59 kmicu: yes

19:00 chessguy: kmicu: when i do that, 'lein deps' fails, saying it can't find the artifact

19:06 johnmn3: g'day

19:07 I figured this out once before, but I lost my code for it... how to get at the bytes of a file in clojurescript (javascript)

19:07 I have the file object but I can't do a seq on it

19:09 kmicu: chessguy: 0.1.2 works for me, in that case latest pedestal version/HEAD is not ready ;] Good to know. Thx for response.

19:15 danneu: sup team

19:21 chessguy: kmicu: how did you get 0.1.3 ?

19:23 hi danneu

19:24 kmicu: chessguy: from pedestal's github repo, they started 0.1.3 dev yesterday

19:24 but it's not ready ;]

19:24 chessguy: ok

19:28 callenbot: just got done looking at Riemann

19:28 this is some really cool stuff.

19:28 is anybody using it for anything?

19:33 muhoo: hyPiRion: (-> x bar foo), is how i'd instinctively write that

19:35 i got addicted to -> and ->> after watching ztellman over his shoulder as he worked on a problem.

19:37 hyPiRion: well, it really depends on the foo and bar

19:43 johnmn3: Shouldn't this work? (.readAsText (js/FileReader.) my-file)

19:43 as per: http://www.w3.org/TR/file-upload/#dfn-readAsText

19:45 I'm trying to get to the byte level contents of the file

19:48 tomoj: that works

19:49 well, except, doing it that way is useless :)

19:50 but your problem isn't your cljs

19:51 johnmn3: where am I going wrong?

19:52 tomoj: readAsText is void

19:52 you have to attach event listeners to the FileReader

19:53 see step 6+ in your link

19:53 johnmn3: Then maybe I shouldn't be using a FileReader

19:53 because I already have the file

19:54 and I used a FileReader with the event listener to get to it before.

19:59 tomoj: dunno.. https://www.refheap.com/paste/8c683acc173571df9cd604d54

20:01 johnmn3: that works

20:01 but just 3 weeks ago I had a way I could just get at the bytes of a file

20:03 (something (slice. (make-file "asdfgh") 0 5))

20:03 -> "asdfg"

20:03 something like that

20:08 tomoj: Blob.prototype only contains 'slice', which returns another Blob, so I don't see how that could be possible

20:09 johnmn3: so there is no syncronous access to the contents of a blob?

20:10 tomoj: afaik, no

20:10 dunno who you should ask, ##javascript?

20:13 squidz: what are clojures opinions on when it is best to use NoSQL instead of SQL Databases

20:14 Glenjamin: why is it that, this works:

20:14 &(map #(Exception. %) ["a" "b" "c"])

20:14 lazybot: ⇒ (#<Exception java.lang.Exception: a> #<Exception java.lang.Exception: b> #<Exception java.lang.Exception: c>)

20:14 Glenjamin: but this doesnt:

20:14 &(map Exception. ["a" "b" "c"])

20:14 lazybot: java.lang.ClassNotFoundException: Exception.

20:15 hyPiRion: Glenjamin: Same reason as this:

20:15 Glenjamin: squidz: do you have a problem that YesSQL isn't solving?

20:15 hyPiRion: ,#(Exception. %)

20:15 clojurebot: #<sandbox$eval36$fn__37 sandbox$eval36$fn__37@14fa4de>

20:15 hyPiRion: ,Exception.

20:15 clojurebot: #<CompilerException java.lang.ClassNotFoundException: Exception., compiling:(NO_SOURCE_PATH:0:0)>

20:15 Glenjamin: so Exception. isn't a function?

20:15 hyPiRion: Exactly

20:15 squidz: Glenjamin: so just going YesSQL until you hit a rough patch is when you should start looking at NoSQL=?

20:16 hyPiRion: It's a special form, therefore you have to wrap it

20:16 Glenjamin: if you have experience with SQL, and you don't have a pressing need - i'd say stick to what you know

20:17 muhoo: (Foo.) is sugar for (new Foo), right?

20:17 squidz: Glenjamin: alright, I guess I was hoping to be oohd and aahd , but what you say seems unsurprisingly reasonable

20:17 Glenjamin: but where possible, dont tie your core application logic to your choice of data storage

20:18 hyPiRion: muhoo: you can check

20:18 Glenjamin: redis is pretty cool for mixing alongside more traditional storage

20:18 hyPiRion: ,(macroexpand-1 '(Exception. foo))

20:18 clojurebot: (new Exception foo)

20:18 squidz: Glenjamin: how would you suggest keeping the data storage from leaking into the application?

20:19 Glenjamin: model your domain entities as plain objects/records

20:19 tomoj: apparently noone on the internet has yet suggested the connection between nosql and nonapples O_o

20:19 Glenjamin: and have a set of functions for sending them to and from the data store

20:19 squidz: for sending maps to the datastore?

20:20 Glenjamin: the logic for how the record translates to storage, and vice versa all lives in one module

20:20 squidz: okay but by plain objects and records, do you mean clojure maps?

20:21 Glenjamin: probably defrecord

20:21 which gives you a map-like thing with a type

20:22 squidz: so the additional type is worth abandoning the simplicity of plain maps?

20:22 Glenjamin: it's still a plain map

20:23 http://clojure.org/datatypes

20:23 it's basically a map, but slightly faster and you can extend protocols and things with it

20:24 squidz: okay. So I should shove all the converting/deconverting to either protocols/maps into one icky layer between the DB and the application?

20:26 Glenjamin: pretty much

20:26 but write it from the application's POV

20:27 so data/latest-posts, rather than data/posts {:order :date}

20:27 etc

20:28 squidz: okay thanks for the pointers

20:39 muhoo: why use domina instead of jayq?

20:40 if i alreafy have to use jquery anyway (for bootstrap, jui, etc)

20:49 augustl: what's the easiest way to get a byte array from a File in Cloure? Any built-in stuff for that?

20:51 tomoj: (.getBytes (slurp f)) ?

20:51 augustl: I'd rather not stringify it first

20:52 sounds like encoding errors waiting to happen..

20:52 tomoj: (let [o (java.io.ByteArrayOutputStream.)] (io/copy f o) (.toByteArray o))

20:53 you're right about encoding errors

21:09 john2x: how do I add a local project as a dependency in project.clj?

21:11 hughfdjackson: at what point do PersistentHashTries become more effecient (timewise) than full-copies of Java Hashmaps?

21:12 i'm asking because i'm making a js equivalent (although i know mori is a thing ;) )

21:12 and i want to know what state-of-the-art looks like in clojure-land

21:28 chessguy: so am i understanding correctly that clojure's ring is roughly equivalent to ruby's rack?

21:34 hyPiRion: Wow, Clojure 1.0.0 is like super duper fast

21:40 danneu: gee, Ring wiki on github is so good

22:17 gfredericks: hyPiRion: try using binding on random vars

22:17 just because you can

22:18 hyPiRion: oh, why?

22:18 gfredericks: hyPiRion: also you could try ##(apply * (repeat 400 2))

22:18 lazybot: java.lang.ArithmeticException: integer overflow

22:18 gfredericks: hyPiRion: because it's fun?

22:19 chessguy: yes.

22:19 hyPiRion: huh, binding plus to minus works

22:19 but it's just plussing though

22:19 sad.

22:19 chessguy: gfredericks: thanks

22:20 hyPiRion: oh wait, not if I deref the var. gfredericks, have you worked with 1.0 before?

22:20 gfredericks: hyPiRion: + and - are probably inlined

22:20 danlarkin: ah 1.0, those heady times

22:20 gfredericks: I can't even remember if I worked with 1.0 or not

22:22 hyPiRion: gfredericks: Well, there's this super neat feature with 1.0, the ^ literal means `meta` if you have a space after it

22:23 So with that abusement, I've shortened the Swearjure bootstrapping to this: https://www.refheap.com/paste/13135

22:31 locks: that looks almost like brainfuck

22:31 * locks rimshot

22:31 hyPiRion: yeah, it is

22:36 gfredericks: hyPiRion: so I guess the change we need to sneak in is basically just a git-reset?

22:37 yo rhickey whaddayasay for old time's sake we make 1.6 == 1.0

22:37 hyPiRion: heheh

23:06 Raynes: gfredericks: NaNNaNNaNNaNNaNNaNNaNNaN

23:10 hyPiRion: oh, the js/ruby talk

23:11 Raynes: Not bad hyPiRion, only took you 4 minutes.

23:11 uvtc: How can I get every element of a seq but the nth one? (I think I want a "`but-nth`" function...)

23:12 I want to remove just the nth item, and have what's left.

23:12 hyPiRion: uvtc: use a combination of concat, take and drop

23:13 uvtc: hyPiRion: tanks!

23:13 hyPiRion: like, (concat (take Xs (dec n)) (drop Xs n)) should do, I think

23:13 np

23:22 tieTYT2: i'm writing a test and I'm with-redef'ing a function that uses an http client and returns a url. My test would be better if this function could return a different thing each time it's called. How can I do this?

23:26 even tho there's no threading involved. I'm wondering if I should use an atom that I increment each time i call it

Logging service provided by n01se.net