#clojure log - Nov 17 2013

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

0:00 swarthy: grncdr: Again I'm no expert but I would think about your problem as: I have this data and some items need to be active. How do I check that data and find the things that must be active vs. inactive. Creating a new set of data with those flags set properly. Rather than changing in place.

0:02 grncdr: Sorry I don't have better answers. I'm still learning myself, I'm hoping if I keep talking you will have a Eureka! moment, lol.

0:02 grncdr: np I appreciate the discussion even if it doesn't come in the form of direct imperatives :)

0:03 coventry: grncdr: I don't see how you get away from having two modifications of some sort (the two assocs you complain about in the refheap in this case). Two operations seems pretty intrinsic to adding an item and making it the active item.

0:04 grncdr: coventry: hm, I suppose that's the part i need to accept… that I'm "adding" an item and not "updating" it

0:05 coventry: How would mutable data structures help you here?

0:05 grncdr: like from the outside, I am updating the active item, but from inside the function that viewpoint doesn't make sense

0:05 zeebrah: I'm finding i have to call my function (function-point #(Math/sin %) 1) instead of just Math/sin. Is there a better way?

0:05 grncdr: well if it was a JS object (for example) I would just have state.activeItem be the same object as what was stored in state.items

0:06 so state.items[1] === state.activeItem, and any modifications would be reflected in both places with no extra effort on my part

0:08 but the only way I can see to do the (exact) equivalent in clojure is by wrapping each item in it's own atom (which is crazy and I wouldn't have considered it)

0:09 I suppose I could've just wrapped active-item in an atom

0:09 coventry: grncdr: Oh, I see. Make :items a map with uuids, make :active-item refer via the uuid.

0:09 Or maybe there are more informative keys you could use than uuids.

0:10 grncdr: well, if I went that way, why not just vector indices?

0:10 coventry: grncdr: Because you might reorder the list.

0:11 grncdr: are maps ordered? or would the ordering be a separate vector of UUIDs in this scenario?

0:11 brainproxy: I thought these might be helpful to other ClojureScript devs, so I gist'd them for your coding pleasure: https://gist.github.com/michaelsbradleyjr/7509505

0:12 coventry: grncdr: Not sure what you mean. I have to turn in. Good luck.

0:12 dnolen: brainproxy: nice

0:13 grncdr: thanks coventry :)

0:16 brainproxy: dnolen: I was struggling with understanding what cljs.core.async.macros/go was doing to my expressions

0:17 dev'ing those helpers lets me see more easily how things are getting transformed

0:17 and they're good for debugging macros for use in cljs projects in general

0:20 coventry: grncdr: I was imprecise. In case it wasn't clear, I meant something like {:items {uuid1, {:title "Thingy" :description "etc etc"}} :active-item uuid1}

0:20 *poof*

0:27 paomian: how to user flash in web app

0:37 bitemyapp: paomian: this is #clojure

0:37 paomian: not #flash

0:43 paomian: bitemyapp: http://yogthos.github.io/lib-noir/noir.session.html#var-flash-get like this

0:45 bitemyapp: paomian: show the content in your web app.

0:49 paomian: bitemyapp: I try it ,but it is nothin

0:49 bitemyapp: SegFaultAX: you've got a stiffy for the types too eh?

0:57 paomian: bitemyapp: ?

1:12 (defn flash-suc [msg url]

1:12 (do (session/flash-put! :success msg)

1:12 (response/redirect url)))

1:12 (session/flash-get :success "test")

1:12 wyh I do not get the value of :success

1:16 bitemyapp: paomian: probably because you redirected.

1:16 paomian: you shouldn't use tools you don't understand, scale it back a bit and understand Ring, and then what this flash thing is doing for you.

1:20 paomian: bitemyapp: thanks

1:28 logic_prog: is there a "core.async internals" paper anywhere? I'm intrested in things like: 1) what happens with a go thread throws an exception 2) how to get a list of all existing go threads 3) what happens to internal state if I force-kill a go-thread (given that force-killing java threads is deprecated)

1:30 bitemyapp: logic_prog: not a paper, but tbaldridge has put up rather thorough youtube videos on how the Go macro works

1:30 logic_prog: http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/

1:30 logic_prog: just found it

1:30 studying deep walking first http://www.youtube.com/watch?v=HXfDK1OYpco

1:31 thanks!

2:35 omfg, this is so awesome

2:35 are there more resources like http://www.youtube.com/channel/UCLxWPHbkxjR-G-y6CVoEHOw/videos

2:35 I'm not looking for rich-hikey style high-level talks (though those are nice too); I want talks of people writing code in emacs/nrepl and showing internals of clojure / cool things

2:38 bitemyapp: logic_prog: I'm not aware of many, mostly tbaldridge's awesome stuff.

2:38 The only other material I know of is designed for people that are extremely new to Clojure.

2:39 bacon1989: what's a clojure?

2:39 logic_prog: that's unfortunate

2:39 imagien if every one who had a popular github clojure repo made a few videos about their project

2:40 I'd stop watching TV, cancel my netflix

2:40 and be smarter

2:41 bitemyapp: logic_prog: well, I could make a brief video about the asynchronous connection strategy I used in Revise.

2:41 It doesn't occur to me to make videos generally, because I actually hate A/V content

2:41 and prefer text to virtually everything else.

2:41 partly because I read quickly and like efficiently reviewing select mateiral.

2:41 logic_prog: http://github.com/bitemyapp/Revise/

2:42 logic_prog: just found it via google :-)

2:42 rethinkdb, interesting

2:42 bitemyapp: this is mostly `cbp's baby, but I was brought in to make a thread-safe connection management strategy.

2:42 logic_prog: I've been looking at datomic, mnesia, riak, and hbase recently

2:42 bitemyapp: rethinkdb is nice for certain kinds of projects, vastly superior to MongoDB too.

2:42 well those data stores all serve different needs.

2:42 RethinkDB and MongoDB are pretty comparable - and I favor the former.

2:43 logic_prog: ehg, looks overly complicated to me

2:44 I like the simplicity of riak/hbase

2:44 with other databases, I have a hard time "counting" how many "fundamental ops" are being processesd

2:44 I'm almost convinced the approach I want is {mnesia / datomic } + {riak / hbase}, where the metadata is in a database with tranasctions, and the actual data is in a k/v store

2:45 bitemyapp: logic_prog: Riak is a Dynamo based data store and Datomic supports DynamoDB as a storage backend.

2:45 logic_prog: no way

2:45 bitemyapp: logic_prog: the real reason to use something like Riak isn't for "actual data", it's for when you need availability rather than consistency.

2:45 that is an edge case.

2:46 99% of applications need consistency, and that's where Datomic, SQL databases, RethinkDB, etc. shine

2:46 HBase is CP as well.

2:46 logic_prog: yes, of the CAP theorem

2:46 however, I think riak is the right approach

2:46 it forces me to think about how to handle "conflicts"

2:46 bitemyapp: there is no single approach to anything

2:46 and I was offering to explain Revise's connection management strategy for reasons that are utterly separated from the database itself

2:47 logic_prog: conection management strategy?

2:47 what are those and why do they matter?

2:47 bitemyapp: it's a semi-novel way of managing socket resources tied to a database connection

2:47 sigh. never mind.

2:47 logic_prog: suppose you made a youtube video

2:47 what would be the blurb you put into the "description" field?

2:47 I'm so clueless I do't even understand why this is important.

2:48 bitemyapp: logic_prog: "async methods for using connection resources more efficiently"

2:48 substantially more efficiently.

2:48 logic_prog: bitemyapp: is this how you feel right now? http://www.youtube.com/watch?v=FL7yD-0pqZg

2:51 bitemyapp: a little bit.

3:05 logic_prog_: http://www.youtube.com/watch?v=cUxYoNRW3VM <-- where is the actual code used in this demo?

3:57 nonuby: enlive/scraping given a node <p class="c1"> <a href="#">infoA</a>infoB</p> what selector should i use just to extract infoB it seems [:.c1 text-node] returns nothing

4:07 echo-area: Is it possible to overlay two line charts together?

4:07 (In incanter)

4:08 bitemyapp: echo-area: http://data-sorcery.org/2009/06/04/linear-regression-with-higher-order-terms/ there's an overlay of two different kinds of charts here

4:09 echo-area: Let me see

4:29 metactus: how does one go about mapping apply?

4:29 bitemyapp: metactus: just map it? sounds like an anti-pattern though. refheap it?

4:30 metactus: map expects a seq, apply expects a function and a seq

4:31 bitemyapp: seq of vector of function and args

4:31 metactus: when I map apply I need a sequence of function and seq pairs

4:31 bitemyapp: so do that

4:32 metactus: I did do that

4:32 but apply takes a function and args

4:32 *seq of args

4:32 not a seq

4:32 so how do I break the vector? it's like I need to apply apply twice, which doesn't really answer my question about how to apply it once

4:34 bitemyapp: do you suggest something like: (map apply [[+ [args]]) ?

4:35 bitemyapp: ,(map (fn [[fn args]] (apply fn args)) [[+ [1 2 3]] [+ [4 5 6]]])

4:35 clojurebot: (6 15)

4:35 bitemyapp: I wouldn't be very happy if my code looked like that, but it appears to work just fine.

4:42 metactus: Thank you!

4:43 How would you do that in general though? Like, map a fn w/ arity > 1?

4:43 I mean, w/o using your supposed messy solution. Is there an easier way?

4:44 bitemyapp: metactus: try to restructure my code such that it wasn't necessary.

4:44 Not trying to be difficult, that's the real answer here.

4:45 I do use apply from time to time, but I try to be conservative about it.

4:45 ((nested data structures + HOFs + apply) - type system) == pain

5:08 metactus: bitemyapp: Got it, thanks!

6:27 logic_prog: is there any "guidelines for structuring a large clojure application" ?

6:27 I feel taht with my code, as I hit the 10K loc range, I have problem managing my clojure codebase

6:27 I'd love to read a "heavily opiniated way on structuring lcojure codebases"

6:27 thanks

10:15 gfredericks: is it intentional that the edn spec doesn't allow < etc.?

10:16 I was grumping about this haskell edn parser not parsing them and then noticed the spec didn't mention them

10:16 I think by "etc" I just meant >

10:22 glosoli: Is there some most used templating engine for Clojure ?

10:27 joegallo: templating what?

10:27 cause, like, the answer might be different if you're templating HTML versus just plain text, or i dunno, fabric swatches

10:28 glosoli: joegallo: html templating, I have heard of clostache and i know there are many others

10:28 Kinda curious for some opinions

10:29 joegallo: enlive and hiccup are popular things

10:29 glosoli: enlive is more of a transformation framework, or am I wrong ?

10:29 joegallo: clabango is also a thing

10:31 samrat: glosoli: if you want something like Django's templates you should check out Selmer

10:32 glosoli: yeah Selmer is probably what i have been looking for, thanks

10:32 samrat: glosoli: its the same deal as clabango but better maintained and more performant

10:33 glosoli: that said, I myself prefer hiccup. You should check that out too

10:34 glosoli: samrat: I did use hiccup before, just wanted to check my options, I did enjoy it

10:36 xcthulhu: Hello, I have two RESTful APIs: one in classic ASP and one in Compojure. People POST to them using a form, and otherwise they don't reply with anything interesting. We are trying to sunset the classic ASP API and replace it with Compojure, so we need to duplicate all of the traffic to it so that Compojure also gets it. Anybody have any idea how to do this?

10:44 Kowboy: they at least have to reply with a status code, no?

10:45 you could do it 3 ways as I see it

10:45 1) In the browser with JavaScript

10:46 just submit the form data to both URLs

10:46 2) In the ASP by sending the params in an Async HTTP request to the compjure service

10:47 3) By creating a proxy service that forwards the request to any number of backend or "downstream" servers and uses an "official" one for sending the response back to the client

10:49 justin_smith: another option would be using the asp.net but serializing all requests in a reliable way, then running those against the clojure service to ensure that it gives the same responses

10:52 rurumate: Why is core.typed not using core.logic (yet)?

11:00 jcromartie: that's a good question

11:10 rurumate: jcromartie: maybe there's another project?

11:24 the-anome: hi

11:27 danenania: hey all, i've got a ring-compojure-http-kit web app that's been running fine, but after a 'lein do clean' i'm now getting 'java.lang.ClassNotFoundException: clojure.tools.reader.reader_types.Reader' with anything involving compojure or middleware. any ideas what this could be? have been struggling for awhile

11:31 seangrove: danenania: Are you using austin?

11:32 danenania: seangrove: yes i am

11:33 seangrove: danenania: Take it out and try again

11:33 danenania: seangrove: trying now, thanks

11:36 seangrove: yep that did it... removing references (which i tried) wasn't enough. had to take it out of plugins

11:36 seangrove: danenania: Probably worth noting it here https://github.com/cemerick/austin/issues/23

11:37 I'm not sure why it would happen, but I lost a day or so to it

11:37 danenania: yeah, had me totally puzzled as well

11:38 wish i'd come here sooner

11:38 thanks!

11:38 seangrove: No problem, just add your case to the issue to help cemerick pinpoint the issue, please

11:38 danenania: will do

11:41 danneu: wow

11:42 gotta love a shot in the dark that works out like that

11:42 respect that seangrove hustle

11:42 seangrove: danneu: Spread the love.

11:48 the-anome: anybody would have a piece of advice to me on what would be the correct way to validate function arguments in clojure? I mean, complex function arguments like maps that need to match some structure. Yeah, I know I can use validation libraries but what is the correct way to do it? Even more when the validation code and the function code seem to need to be maintained separately. Ideas?

11:48 seangrove: the-anome: core.typed ?

11:49 Almost certainly the best route. Alternatively, there's prismatic's schema.

11:49 the-anome: seangrove: I would go scala :D, then

11:49 seangrove: the-anome: Sure, sounds like fun.

11:49 the-anome: just kidding but you are right, for these kind of things it seems to be the right way

11:50 just wondering if there was some alternative way I had not thought about

11:51 seangrove: the-anome: Yeah, I think it's best for complex maps especially to have some static verification (core.typed) which will help you not hurt yourself, or at least run-time verification (prismatic's schema) that can tell you when/where you've done it

11:51 the-anome: thanks seangrove. Much appreciated. I will have a look in depth

11:54 seangrove: Uhg, dealing with imap, such a pain

11:54 I feel for bbloom and what he did, and also feel jealous that he's free of it :P

12:04 danneu: My app works with data that can be represented in many different ways like binary, hex, binary-compressed, hex-compressed, asn.1, asn.1-compressed. I tried to use meta-data to come up with an abstraction for converting between them

12:04 https://www.refheap.com/20974

12:04 is this an abuse of meta-data?

12:07 the goal is to, without having to (compressed? priv) logic, I can just do (transcode-priv priv :binary) and it will convert it to binary or compressed-binary depending on if priv is already compressed or not

12:07 with multimethods dispatching on ^{:compression _} priv.

12:08 i.e. i read a blog-post about clojure meta-data last night

12:15 justin_smith: the-anome: there is also pre-conditions

12:21 the-anome: hi justin_smith

12:21 you are right

12:22 at the end, sometimes is useful to have types

12:22 :)

12:22 despite of this, I felt in love with clojure because of the flexibility

12:23 danneu: i don't think there's anything inflexible about typese

12:24 after all, it turns out that there's a difference between Seqable bytes and an Array of bytes, so it makes sense to annotate what you need

12:25 i mean, the cost of annotating of not inflexibility because you were already coupled with [B

12:25 is not*

12:33 the-anome: danneu: good point.

12:53 dee5: Would anyone know how to connect to an nrepl server with sublime text or change where sublimeREPL starts from? I bascially want to load a project with sublimeREPL, and to my understanding, I'd have to start the repl in the project's directory, which sublimeREPL doesn't seem to do

12:56 technomancy: not a lot of people using proprietary editors on freenode

12:57 dee5: thought it would be worth a shot, thanks anyway though (:

13:02 the-kenny: Is there a cljsbuild configuration which allows me to use source-maps with :optimizations :whitespace (so that I don't have to include every single generated .js file in index.html)? All combinations I tried either generate absolute paths (which are useless when the stuff is served via ring) or relative paths which include the "resources/public" part.

13:11 dnolen: the-kenny: i suppose what we need is a :source-map-path option

13:12 the-kenny: dnolen: That would be a solution.

13:15 Okay, let's see if I can get leiningen's checkout feature to work with cljsbuild+clojurescript. Might be a worthy quest to get back into clojure(script)

13:17 seangrove: technomancy: That include LightTable?

13:19 srruby: I tried using defrecord instead of maps and my code now fails in clojure.walk Any thoughts?

13:21 dnolen: the-kenny: no need, ./script/build if all you want to do is use master

13:22 i-blis: dee5: ST cannot connect to a given port (no telnet support anymore) ; why not use emacs + cider/nrepl?

13:22 the-kenny: dnolen: I want to add :source-map-path ;)

13:22 dnolen: the-kenny: adding it now

13:23 the-kenny: aww you don't even give me the chance to do it!

13:23 dnolen: the-kenny: :)

13:23 the-kenny: Anyway: Thanks :)

13:26 dnolen: the-kenny: available in master

13:29 the-kenny: Wohoo awesome :)

13:30 Works nice

13:30 dnolen: the-kenny: excellent

13:36 fakedrake: hello, i am trying to do `(-> 1 inc #(* % 2))' but if i do `(defn mul2 [x] (* x 2)) (-> 1 inc mul2)' it works, can someone explain this to me?

13:37 ah it just hit me what the documentation means by making it a list if it is not already

13:37 rubber duck debugging

13:39 the-kenny: fakedrake: -> is just a simple list manipulation. Your -> is equal to #( 1 * % s (inc 1))

13:39 eww no. Brain failure. It's equal to #((inc 1) * %)

13:59 Raynes: seangrove: Well, I don't think a lot of people are using light table, but not necessarily because it is proprietary.

13:59 IIRC, Chris intends to open source it, potentially only keeping certain plugins closed source.

14:37 francis_wolke: dnolen: Occasionally, when working with CLJS, I'll get an error like this: https://www.refheap.com/20960

14:37 If I undo the changes 'responsible' and restart the cljsbuild process, the error persists.

14:37 To fix this issue I am forced to comment out everything in the project excluding the ns forms and resart the cljsbuild process, which will begin to work again.

14:37 Thoughts?

14:38 technomancy: seangrove: as far as I can tell there aren't many. maybe they are quiet.

14:38 seangrove: technomancy: I imagine there would be more of them in #clojure

14:38 But still, not many. Probably most interest comes from other, non-freenode devs

14:38 dnolen: francis_wolke: looks like a circular dependency issue to me

14:42 francis_wolke: dnolen: Thanks.

14:42 dnolen: francis_wolke: http://dev.clojure.org/jira/browse/CLJS-684

14:43 francis_wolke: dnolen: How do you deal with brepl instability when developing?

14:44 dnolen: francis_wolke: do you mean how it exits on errors?

14:45 francis_wolke: dnolen: that and sometimes you cannot reconnect, even after restarting the application

14:45 dnolen: francis_wolke: haven't seen reconnection issues myself

14:45 francis_wolke: you might want to take a look at cemerick's austin as well

14:46 francis_wolke: patches also welcome, I've got plenty of things on my plate

14:47 francis_wolke: dnolen: Adknowledged

14:52 benedikt: I'm using lein droid and it has started a REPL on a certain port of my computer. How do i use Emacs to connect to the repl?

14:52 i've just used M-x nrepl-jack-in so far

14:53 francis_wolke: benedikt: M-x nrepl

14:53 benedikt: francis_wolke: well, that was simple

14:54 mercwithamouth: hi i'm trying to get clojurescript to work but for the last few days i've been stumped by this error https://www.refheap.com/03da750eb6e6a139b08b790b0

14:54 Reflection warning, clojure/tools/reader/reader_types.clj:34:1 - reference to field get_file_name can't be resolved.

14:58 benedikt: How do i write this "(require '[clojure.data.json :as json])" in the namespace format?

14:58 (ns projecte.core :require [ord.clojure/data.json "0.2.3" :as json]) doesn't work

14:59 francis_wolke: benedikt: (ns projecte.core (:require [ord.clojure/data.json "0.2.3"

14:59 :as json]))

15:00 benedikt: francis_wolke: i just missed a parenthesis?

15:00 francis_wolke: benedikt: Correct. You may find this tutorial: https://github.com/magomimmo/modern-cljs useful

15:00 benedikt: "java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.Named"

15:03 francis_wolke: benedikt: Sorry, wasn't paying attention last time, but you don't include things that way in clojure. Your ns form should look like this: (ns projecte.core (:require [clojure.data.json :as json]))

15:03 benedikt: francis_wolke: i had just figured that out :) this page is helpful http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

15:06 francis_wolke: "java.lang.Exception: lib names inside prefix lists must not contain periods" this happens when i git C-c C-c in emacs

15:07 dnolen: francis_wolke: circular dependencies now throw a sensible error in master instead of stack overflow

15:09 mercwithamouth: has anyone gotten this error when trying to compile clojurescript? I seem to be the rare case Reflection warning, clojure/tools/reader/reader_types.clj:34:1 - reference to field get_file_name can't be resolved.

15:10 francis_wolke: dnolen: You rock.

15:12 benedikt: francis_wolke: solved it. i'm still wrpainng my head around the way you refer to other namespaces and import code

15:34 the-kenny: Is it me, or has the compilation speed of ClojureScript dropped massively since a few weeks/months ago?

15:34 francis_wolke: the-kenny: Not just you.

15:36 bbloom: the-kenny: i think dnolen improved incremetnal compilation at the cost of full recompilation

15:36 dnolen: bbloom: the-kenny: I have seen this at all

15:36 compilation time is more or less unchanged

15:36 "haven't seen"

15:37 the-kenny: dnolen: Every change of a small test application takes about 12 seconds here

15:37 with :optimizations :whitespace

15:37 dnolen: the-kenny: make sure you are using lein-cljsbuild 1.0.0-alpha2, also disable :source-maps, that'll never be fast with simple

15:38 er :source-map

15:38 francis_wolke: the-kenny: What. I have .11 sec on a change w/whitespace

15:38 also, using source maps

15:38 the-kenny: francis_wolke: Ok, something is very wrong here

15:38 francis_wolke: the-kenny: are you restarting the JVM each time?

15:39 the-kenny: No, it's lein cljsbuild auto

15:39 dnolen: No difference with or without source maps

15:39 francis_wolke: the-kenny: Proof. https://www.refheap.com/20979

15:39 dnolen: the-kenny: this sounds weird to me, and you are using alpha2 cljsbuild?

15:39 the-kenny: Ah wait, successive compilations go down to about 7 seconds or so

15:40 Damn. I thought I was using alpha2

15:40 Copy/Paste Fail

15:40 dnolen: the-kenny: ok good

15:40 the-kenny: Okay, please forget what I said. Trying again

15:41 benedikt: if i declare a variable with def outside of all functions in core.clj

15:41 how do i refer to it inside a function in the same namespace (and .clj file)

15:41 ?

15:41 francis_wolke: benedikt: it's name.

15:42 benedikt: i get a runtime exception when i do that

15:42 oh

15:42 nevermind, i never evaluated that line..

15:42 i'll go stand in the corner now.,

15:42 the-kenny: dnolen: Okay, much better with alpa2, but I had to add an :exclusions entry for clojurescript

15:42 About 3 seconds now

15:42 (with source maps)

15:43 dnolen: the-kenny: sounds more like it :)

16:03 hrm, thinking about shortening the experimental ^not-native type-hint to ^clj and adding a ^clj-or-nil typehint

16:03 and making it work on protocols

16:07 this would allow us to eliminate protocol overhead in many cases

17:15 Raynes: Lazybot appears to have vanished.

17:16 seangrove: clojurebot: find lazybot

17:16 clojurebot: No entiendo

17:16 seangrove: The bots really need to be setup in a robin hood + john condition

17:17 Friar tuck, actually, after looking it up

17:17 http://www.netfunny.com/rhf/jokes/88q4/nonbook/secure.126.html

17:20 birryree: Hi everyone, I'm learning clojure and doing some exercises from Joy Of Clojure - I tried an example with anonymous functions and seeing different behavior if I use #() vs (fn), so I'm wondering if I'm just doing it wrong. Don't really know what I should be googling for: https://gist.github.com/birryree/7518985

17:21 justin_s`: (#()) is the equivalent of ((fn []))

17:21 you have them in different levels of nesting

17:22 so remove the extra () around (fn...) and your code will be fine

17:22 llasram: I don't think that's true..

17:22 I mean, that's some true, just not the last part :-)

17:22 justin_s`: wait

17:22 that wasn't the problem, you are right

17:22 birryree: If I do that, the arguments aren't passed, are they?

17:22 justin_s`: the problem is (x)

17:22 llasram: I don't see how this can match code -> exception

17:23 The `fn` version is calling a function of 1 arg w/ 2 args

17:23 birryree: Sorry, I updated the gist, as I changed the example so that they both did the same thing.

17:23 llasram: birryree: But if you did call w/ one arg, you'd get the exception you show, because

17:23 You're passing it a number, then trying to call that number as a function

17:24 justin_s`: also you are passing two numbers, when it expects one callable

17:24 so the arity is wrong

17:24 birryree: they still don't do the same thing

17:25 one is only declaring a function

17:25 the other calls it

17:25 birryree: justin_s`: So the #(/ 1 2) form doesn't actually call it yet?

17:25 justin_s`: nope, it just returns a function that will divide one by two when called with no args

17:25 coventry: ,#(/ 1 2)

17:25 clojurebot: #<sandbox$eval29$fn__30 sandbox$eval29$fn__30@1930e3d>

17:26 coventry: ,#((/ 1 2))

17:26 clojurebot: #<sandbox$eval59$fn__60 sandbox$eval59$fn__60@a03522>

17:26 justin_s`: ,(#(/ 1 2))

17:26 clojurebot: 1/2

17:26 llasram: birryree: Exactly. In fact: ##`#(/ 1 2)

17:26 lazybot: ⇒ (fn* [] (clojure.core// 1 2))

17:26 coventry: ,(#(/ 1 2))

17:26 clojurebot: 1/2

17:26 llasram: birryree: What I wrote and coventry is (I think) trying to do shows what the #() syntax expands to

17:26 fn* is an internal thing, and there's the ns-expansion

17:27 But it boils down to #(/ 1 2) <=> (fn [] (/ 1 2))

17:27 coventry: BTW, nice meeting you at the Conj :-)

17:27 justin_s`: (fn [] (/ 1 2)) ~= #(/ 1 2)

17:27 coventry: Yeah, you too, llasram.

17:28 justin_s`: or what llasram said

17:28 birryree: llasram: thanks, I was trying to figure out how to expand the @() when I ran into the problem. (fn [] (/ 1 2)) works as I expect it.

17:28 THanks too, justin_s`

17:29 coventry: birryree: A typical way to get what you want in the second case is to do (defn throw-catch [f & args]) in the signature, then (apply f args) in place of (f), and (throw-catch (fn funcname [x y] (/ x y)) 1 2)

17:30 birryree: coventry: thanks for that, I was also trying to determine how to do that. Guess I should definitely read more into the book rather than jump off rails. :)

17:59 Janiczek: Is there a way to hook (write-exception) from https://github.com/AvisoNovate/pretty (see the last image on that page) to lein repl?

18:10 the-kenny: Heh, some part of my code makes Clojurescript emit cljs.core.async.put_BANG_.call(null, dchan, java.util.Arrays.copyOf.call(null, rets, cnt));

18:20 seangrove: the-kenny: Maybe old copy of core.async?

18:20 coventry: Janiczek: :repl-options can contain a :caught entry, which should be a function which takes an exception. That entry is passed to reply, which passes it to clojure.main/repl. I haven't experimented with this, just seen the source code for it.

18:21 Janiczek: coventry: nice, I've read through sample.project.clj, but the :caught entry is not mentioned. I will try, thanks!

18:22 the-kenny: seangrove: yeah, seems like the bug was fixed on Oct. 09

18:23 cYmen: What happens if I try to call a function that has side effects from a function which I call with map?

18:24 Because I messed something up and now my side effects aren't happening.

18:24 ksikka: hey all - i'm starting to learn clojure mainly for the purposes of learning clojurescript. any tips on how i should start learning? i'm currently learning clojure and once i have a good handle on it i'll just switch to the clojurescript compiler. does this sound reasonable or do i have the wrong idea?

18:24 the-kenny: cYmen: map returns a lazy seq. The returned sequence will be evaluated as needed (and maybe in chunks)

18:25 cYmen: you likely want to wrap your map in a 'doall', or use doseq from the beginning (if you don't care about the results of the function calls)

18:25 andyf: cYmen: map is lazy, so the time when your side effects will occur is not in general easy to predict, unless you force it with something like doall

18:25 cYmen: the-kenny: That would explain it. Is there something like an "(eager stuff)"? :)

18:25 ah doall...

18:25 sweet

18:26 Damn, still doesn't work.

18:26 andyf: cYmen: Perhaps there are still problems in the rest of the "messed something up" actions you took :)

18:27 cYmen: possibly :)

18:28 ah...everything was fine but apparently window coordinates include the title bar or something...just couldn't see where I am drawing

18:31 logic_prog: datomic and riak seem to be very different databases. why is mixing them a good idea? http://www.youtube.com/watch?v=FOQVWdG5e2s

18:32 shaunxcode: it was implied on the mailing list there would be some pedestal ui related revelations at the conj... anyone have a synopsis?

18:36 Janiczek: coventry: hmm, infinite wall of ArityException Wrong number of args (0) passed to: core$eval9107$fn ... I have :repl-options {:caught (fn [e] (io.aviso.exception/write-exception e))}. Maybe it wants it to be (fn [] ...) and for me to use the *e which holds the last exception? I don't really know, because I can't find :caught anywhere in leiningen repo on

18:36 github

18:38 danneu: I feel like we should have to either always ^{:doc _}, or always have a docstring? arg from clojure.core defs

18:38 Janiczek: Self-answer: Yes it does (the (fn [] ...) solution)

18:38 coventry: Janiczek: No, it's not mentioned in leiningen, but :repl-options is passed to reply. See leiningen.repl/options-for-reply and reply.main.

18:40 Janiczek: mhm, [reply "0.3.0"] ... I see now

18:44 so, the way this works is http://cl.ly/image/0t2A0L0F1v1T ... maybe I could make lein plugin out of it?

18:45 coventry: Nice!

18:46 fakedrake: hello

18:47 Is there a better way to do the opposite of `some' than `(or (fn1 x) (fn2 x) (fn3 x) ...)'?

18:49 metellus: I can't think of a single command but (not (some ..)) would work, right?

18:49 fakedrake: hmm, my phrasing was bad i gue

18:50 Janiczek: "some other way to do `some`"? :)

18:50 fakedrake: Is there a more elegant way to do (or (fn1 x) (fn2 x) ...)?

18:51 metellus: oh, that.

18:51 every-pred

18:51 coventry: (doc some-fn)

18:51 clojurebot: "([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical true result against the original predicates."

18:51 metellus: not every-pred either. that would be for and instead of or

18:52 Janiczek: so that would be ((some-fn fn1 fn2 ...) x)

18:53 fakedrake: yay some-fn was it!

18:53 thanx

19:00 ksikka: hey all - i'm starting to learn clojure mainly for the purposes of learning clojurescript. any tips on how i should start learning? i'm currently learning clojure and once i have a good handle on it i'll just switch to the clojurescript compiler. does this sound reasonable or do i have the wrong idea?

19:03 logic_prog_: if I am using datomic pro starter, I am limited to 2 transactors. Am I allowed to fire up _multiple datomic instances, which do not comunicate with each other -- each with 2 transactors_ ? (I.e. imagine that I have a system that embrassingly paralllelizes into 50 "nodes" -- and I need a datomic instance for each node, but I don't need any transactions across nodes)

19:06 bitemyapp: logic_prog_: presumably.

19:06 you can't make that work the way you're thinking though.

19:06 datomic doesn't have cross-database replication.

19:15 coventry: What's the latest and greatest in clojure test-coverage measurement tools?

19:23 Janiczek: When I develop leiningen plugin, how do I test it? (It's just middleware, no tasks or hooks.) lein repl doesn't seem to put it into action.

19:24 amalloy: Janiczek: i think lein pprint shows you the post-middleware project map

19:26 * seangrove needs to figure out how to use org-todo

19:26 seangrove: Ah, this looks perfect https://github.com/emacsmirror/org-sync

19:27 scottj: ksikka: clojurebook.com

19:29 bitemyapp: seangrove: that looks pretty cool @ org-sync.

19:29 coventry: all I'm aware of is cloverage. There are lists for such things.

19:29 scottj: logic_prog_: the limit is 2 peers, not transactors (only one).

19:29 bitemyapp: coventry: I need a coverage tester that breaks your code and lets you know when none of your tests break as a result of the broken code.

19:29 Janiczek: amalloy: does that actually try to *use* the plugin? or should I be in other project having this one as in :plugins? (if yes, how is it going to find it if it's not on clojars etc? I don't have local maven and I'm bad at classpaths ... :) )

19:30 bitemyapp: scottj: he understands that, he's trying, misguidedly, to sidestep the limit.

19:30 coventry: this existed for Ruby, but I don't know of an equivalent for Clojure.

19:30 coventry: bitemyapp: What do you mean by "breaks your code"?

19:30 `cbp: i was considering that as a project but it sounded scary

19:31 like heckle for ruby

19:31 bitemyapp: coventry: it breaks your shit and lets you know when your test coverage sucks.

19:32 I don't know what you're asking here, it can do anything it wants, like (assert false) or (throw (Exception. "Fuck yo code son"))

19:32 `cbp: I don't think it'd be that hard, only reason I haven't implemented it is because I was sure it already existed.

19:32 `cbp: I think it'd be easier than Revise was.

19:32 easier and less laborious.

19:33 coventry: bitemyapp: Gotcha. Wow. Sounds computationally intensive if you want to check coverage of your entire codebase.

19:33 `cbp: i meant scary in the sense that it sounds dangerous

19:33 bitemyapp: some tricky parts maybe, but I don't think it'd be that bad.

19:33 coventry: meh. I don't really think your code has been tested properly until it's been put through one of those at least once :P

19:33 coventry: I've been looking at cloverage. I think its macroexpansion is inaccurate. It appears to have the same problem as clojure.walk/macroexpand-all's.

19:34 bitemyapp: I don't really believe in 1:1 test coverage for all functions, but something like Heckle is fuckin' awesome.

19:35 coventry: bitemyapp: Isn't it the same thing as checking whether every line of code gets exercised, except you have to run your entire suite for each line of code to get full information?

19:42 bitemyapp: coventry: the problem is things that check it statically don't cover everything

19:43 coventry: No, but invasive instrumentation like cloverage's ought to.

19:43 Janiczek: How do I create the directory structure the :repositories in Leiningen needs? Doing :repositories [["my-local" "file:///Users/test/Localhost/lein-prettyex"]], where that URL is to a project directory, doesn't fool the Leiningen. Do I need to somehow "deploy" it?

19:45 (I don't have maven installed, hoping to manage without it)

19:51 Evelynn: anyone wanna see my cam? http://instaflurt.com/evelyne92/

20:11 logic_prog: I have a public announcement. sourcemaps = fucking awesome

20:23 seangrove: Cool to hear, things are coming together for cljs, bit by bit

20:25 Source maps don't work for incremental compiliation, right?

20:30 xuser: seangrove: can you get away with no JS?

20:31 seangrove: xuser: ? In what send?

20:31 sense*

20:32 xuser: seangrove: Like are you being able to write your projects in full cljs or do you need to get down to JS in some parts?

20:32 seangrove: xuser: Haven't had to write any native js for awhile, but it's extremely important to have a good grasp of js first

20:33 Like the early day for compilers for other languages, I suppose

20:34 xuser: seangrove: you don't find yourself reinventing the wheel much?

20:35 seangrove: xuser: Not really these days. I make heavy use of the closure lib obviously, and a few foreigh-libs

20:35 xuser: Any area you're concerned about re-inventing specifically?

20:35 xuser: seangrove: the closure lib handles browser incompabilities?

20:36 seangrove: xuser: Yes, very well. It is google's main js library after all

20:36 I imagine some other frameworks could be difficult to interop with, see lynaghk's (successful) experience with angular, and maybe something like react.js

20:37 hammerandtongs: any experiences with three.js so far?

20:38 xuser: seangrove: do you simulate angular's two way data-binding in cljs?

20:39 seangrove: xuser: No, I would have to think of the right way to do that. I haven't given it enough thought on how to do it smoothly.

20:42 xuser: seangrove: cool, I heard google is lowering resources on closure because of dart, you know if that's true?

20:43 seangrove: xuser: Nope, I've no idea. Would make sense either way. ClojureScript isn't permanently stuck to google's closure, but it's tied very closed to it right now

20:43 xuser: google is not listing it here anymore: https://developers.google.com/chrome/

20:43 seangrove: I wonder how they bootstrap the runtime for dartjs

20:43 xuser: like is hard to find through menus

20:44 seangrove: Was it ever there?

20:44 It's not really related to chrome

20:44 xuser: well, that's not really chrome but google web dev tools

20:44 seangrove: That said, I could uderstand them moving away from closure

20:44 xuser: https://developers.google.com/products/

20:47 seangrove: yeah, it would make sense for them to move on I guess

20:48 seangrove: do you make heavy use of core.async in cljs?

20:48 seangrove: xuser: I don't know about 'heavy', but it's certainly prevalent

20:49 xuser: ok, no more annoying questions ;) thanks

20:50 seangrove: xuser: No worries, questions are certainly welcome

20:50 xuser: ;)

21:29 * seangrove shakes his fist at the js-runtime showing through cljs

21:29 seangrove: ,(keyword nil)

21:29 clojurebot: nil

21:29 seangrove: in cljs: (keyword nil)

21:29 :

21:29 nil

21:30 ,(type (keyword nil))

21:30 clojurebot: nil

21:30 seangrove: dnolen: Looks like (type (keyword nil)) in cljs is cljs.core/Keyword. Worth opening a bug?

21:31 logic_prog: what is the difference between xyz and #'xyz ?

21:32 seangrove: var?

21:32 Got to teach clojurebot that, it's a pretty common question...

21:33 logic_prog: Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around

21:33 Whenever a reference is dereferenced, the current value is returned

21:34 logic_prog: given that clojure values are immutable, why does this matter?

21:34 seangrove: It allows you do do things like dynamically updating code in the repl, etc.

21:34 Not everything is immutable, of course

21:34 (def x 10) (def x 20)

21:34 logic_prog: ah, this is stuffed in ring

21:34 so I can redefine my routes

21:34 this makes sense now :-)

21:34 seangrove: Yeah, and you see it other places, but that's a common one

21:34 Good stuff

21:34 logic_prog: (ring/blahblahblah/site #'all-routes)

21:35 seangrove: Yup, see that a lot

21:35 logic_prog: thus, if I redefine all-routes, ring "auto updates to use the latest all-routes" right?

21:35 cool, thanks :-)

21:35 seangrove: Exactly

21:36 clojurebot: var is Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around. Whenever a reference is dereferenced, the current value is returned. It allows you do do things like dynamically updating code in the repl, change your ring routes, etc.

21:36 clojurebot: You don't have to tell me twice.

21:36 seangrove: var?

21:36 clojurebot: var is Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around. Whenever a reference is dereferenced, the current value is returned. It allows you do do things like dynamically updating code in the repl, change your ring routes, etc.

21:36 seangrove: botsnack

21:36 clojurebot: botsnack

21:36 clojurebot: thanks; that was delicious. (nom nom nom)

21:38 xuser: seangrove: looks like the closure library doesn't have much to envy from jquery

21:39 seangrove: xuser: No, especially with dommy. It handles the jquery-basics stuff brilliantly

21:40 For jquery-ui and whatnot, probably best to go with closure, but dommy is a wonderfully sane and polished dom manipulation and templating library

21:41 xuser: cool

21:42 seangrove: so using the closure library api is pretty straightforward from cljs right?

21:43 seangrove: xuser: Well... what area are you thinking about specifically?

21:43 It's a ridiculously imperative design, and that causes frustration sometimes, but overall once you get used to their patterns, it's very nice to use

21:43 Eventually libraries will more or less replace it, I think

21:44 xuser: was of thinking of this http://docs.closure-library.googlecode.com/git/index.html

21:44 I see, doesn't sound that bad ;)

21:47 seangrove: xuser: The ui elements are atrociously difficult to get started with, and again, ridiculously imperative

21:47 But everything else is pretty straightforward and nice

22:24 abaranosky: has anyone noticed nrepl not being able to connect to the local nrepl server?

22:24 it seems to start the server fine, but then hangs on "conencting to local ... server at localhost:12345"

22:27 bitemyapp: abaranosky: are you using nrepl-jack-in?

22:30 abaranosky: bitemyapp: yeah...I just spent a bunch of time changing my emacs configuration to work across multiple machines (via Dropbox) and I might have borked something... *or* the package manager pulled down a newer buggy version of the nrepl package

22:31 I was avoiding upgrading to CIDER for the moment, becuase I heard it wasn't 100% ready for prime time

22:31 bitemyapp: abaranosky: don't do that via Dropbox :(

22:32 abaranosky: you need version control yo.

22:32 abaranosky: https://github.com/bitemyapp/dotfiles I use my dotfiles across multiple macs and linux machines.

22:32 abaranosky: bitemyapp: I push a version to github periodicly, but like the autosyncing

22:32 * bitemyapp cringes

22:33 abaranosky: its a lisp... ergo, can't be any bugs

22:33 bitemyapp: well regardless, I have a setup that works on Mac and Linux for a variety of programming languages + Emacs

22:33 abaranosky: let me see urs... checking for any discrepancies

22:34 bitemyapp: nrepl is having this problem on both machines I run on one OSX one Linux

22:36 bitemyapp: abaranosky: git diff

22:37 abaranosky: bitemyapp: yep... it may come to that... because when I think about it, there's not alot of good reasons that this would occur other than a bug

22:41 aaelony: does Cheshire's parsed-seq support keywordizing the resulting keys? Looking for the option that would ensure {"a" "1"} becomes {:a 1} instead of {"a" 1}

22:42 abaranosky: aaelony: when in doubt M-. in and see

22:44 aaelony: 19:44 abaranosky: didn't know about M-. will check that out

22:45 abaranosky: aaelony: if ur connected to an NRepl server in Emacs... C-c M-j

22:45 compile with C-c C-k and then you can click-through any symbol with M-.

22:45 then pop the stack with M-,

22:47 aaelony: abaranosky: I'm using nrepl. M-. presents me with prompt Symbol:

22:47 abaranosky: weird. :(

22:48 aaelony: abaranosky: yeah, not sure how to answer that...

22:48 abaranosky: it isn't normal .. I' used M-. all the time, and never have I seen that

22:50 aaelony: abaranosky: I must be doing something wrong. Nevertheless, the Cheshire doc suggests keywordizing is supported, but I don't see it say how... ;; parse a stream lazily (keywords option also supported)

22:52 abaranosky: aaelony: (cheshire.core/decode "{\"foo\": 1}" keyword)

22:53 aaelony: abaranosky: wow, thanks!! I must have tried everything but :)

22:54 abaranosky: aaelony: np :)

23:04 justin_smith: I think with chesire/decode true means create a keyword and anything else is a function to call on keys

23:05 iirc

23:27 abaranosky: bitemyapp: I upgraded to CIDER and its working now. seems like some bug was hiding in the ewer nrepl

23:27 or at least in how it interacted with my other packages

23:28 Platz: anyone read the 'functional programming for the object oriented developer' book?

23:39 SeanCorfield: marick's book? i've read bits of it... i think it's a good approach (and it's a reasonable price)

23:43 Platz: yeah - great price. I'm using it to introduce clojure to myself, beyond just understanding the syntax

23:44 will see how it goes

Logging service provided by n01se.net