#clojure log - Feb 28 2013

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

0:27 pocho: How do I use map on a seq with access to the index in that seq?

0:28 Raynes: &(doc keep-indexed)

0:28 lazybot: ⇒ "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."

0:28 amalloy: ITYM map-indexed, Raynes

0:28 Raynes: &(doc map-indexed)

0:28 lazybot: ⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."

0:28 Raynes: amalloy: Dude, I'm not on my das. Give me a second to type.

0:29 amalloy: although, pocho, you might consider writing such a function yourself - it's really not hard as a recursive function

0:29 just for education

0:30 Raynes: You could do it with reduce.

0:30 pocho: I feel like I could write it, but it be really bad clojure. I would basically be writing C in clojure.

0:30 amalloy: yeah, but not lazily

0:30 Raynes: Well, stop writing C in Clojure.

0:30 :p

0:32 jeremyheiler: Lojure?

0:32 clojurebot: clojure is the best way to learn java

0:48 muhoo: clojurebot: lol, you so silly

0:48 clojurebot: I don't understand.

1:02 l1x: hi

1:03 i havent been programming in clojure for 3 months and i forgot everything

1:03 noprompt: l1x: cool

1:04 l1x: how can redirect to dev/null the nils when a function is returning (nil nil nil) ?

1:17 SegFaultAX: l1x: Don't use a function meant for its side-effects in a map?

1:26 Frozenlock: I notice that some clojure libraries aren't required by default in clojure 1.5. Is this only for the RC time, or is really for the release?

1:26 jeremyheiler: Which ones?

1:26 Frozenlock: clojure.walk

1:26 I had another one too yesterday

1:27 ..but my memory is failing me :(

1:27 jeremyheiler: What do you mean by "required by default"?

1:28 Frozenlock: Well in 1.4 I can do clojure.walk/postwalk. However in 1.5 I need to do (require 'clojure.walk) beforehand.

1:32 jeremyheiler: Frozenlock, It seems to work fine for me :-/

1:33 I pulled down 1.5.0-RC17 just now.

1:34 Frozenlock: Weird... I have RC16, but I'm too lazy to check now that I've required it in my namespace -_-

1:47 l1x: guys could you recommend a good yaml library for clojure?

1:51 noprompt: l1x: i don't know of one but if your application doesn't *need* yaml, maps can do the job

1:52 l1x: you could even use edn

1:52 pocho: Is there a built in list data structure where I can easily pop off both ends?

1:54 l1x: https://github.com/lancepantz/clj-yaml

1:54 seems good

1:54 what is edn?

1:55 akhudek: pocho: https://github.com/clojure/data.finger-tree

1:56 noprompt: l1x: https://github.com/edn-format/edn

2:37 michaelr525: hello

3:11 WokenFury: hey everyone. I'm looking for a way to decorate a datomic EntityMap. the behaviour I need is that when I do a (find) on the new object, it will look for the key in a bundled map, and if it doesn't find it, then it will hit the lazy EntityMap

3:12 e.g. I want to bundle :db/txInstant from the result into the entity, but since I can't assoc on the entity I can't use (:db/txInstant entity)

3:12 and without that the code gets very ugly

3:27 yunfan: can clojurescript compiled on brownser?

4:19 MrHus: Is it possible to define a protocol (defprotocol) that works on defrecord classes not instances

4:19 So instead of responding to (Person. "Bert" 12) it responds to Person.

4:19 Or is this only possible in multimethods

4:34 clgv: MrHus: can make a more detailed example. I am still wondering what you mean exactly

4:35 *can you make a more detailed example?

4:35 MrHus: I'm making a 2d game and for that game I'm making a map editor in clojure

4:36 the 2d game has a grid of squares when clicking on the squares things need to get added to the "level"

4:36 for instance when you click the grid and "Wall" is the active GameObject a wall should appear on that square in the grid

4:37 clgv: ok. so how do you model that so far?

4:37 MrHus: So I have a protocol called GameObject

4:37 clgv: ok

4:37 MrHus: Which Wall, Enemy and other stuff extend

4:37 No I want to set an atom

4:37 which contains the current selected game object type

4:37 and based on that type

4:38 I want a clicked / dragged mouse event to add that particular type

4:38 I could always write a gigantic cond statement ofcourse

4:38 clgv: MrHus: ah so you could set a factory function in the atom instead of the object type

4:39 MrHus: but i already have the protocol so i was wondering if I could dispatch purely on type

4:39 not an instance

4:39 clgv: no not like that

4:39 MrHus: but you could encode the game object types as keywords and use a multimethod to construct the instances

4:39 MrHus: Yeah I'm doing that now as we speak

4:40 but i was wondering if it were possible with defrecords

4:40 clgv: afaik you cannot add static methods to defrecords

4:43 even if you could you could not define a java interface that enforces a static method.

4:45 MrHus: I knew it was a long shot, but it was worth asking thanks clgv

5:00 ljos: Is -?> and -?>> still in some library somewhere?

5:04 Found them in incubator.

5:06 Or I could just upgrade to 1.5 and use some->

5:19 mpenet: ot

5:19 err.. wront channel

5:19 wrong*

5:20 ljos: this is in core.incubator

5:51 ljos: Is there an oposite threader? That returns the result of the first function that does not return nil? (or nil if all functions return nil).

5:59 bruceadams: ljos: clojure 1.5 introduces some-> which sounds like what you are asking for https://github.com/clojure/clojure/blob/master/changes.md#24-new-threading-macros

6:00 (opps, just saw that you mentioned that earlier... nevermind)

6:00 ljos: bruceadams: no. It does not do the same. some-> short-circuits the evaluation when one of the functions return nil.

6:01 bruceadams: I want to return the first result of the function application that returns non-nil.

6:01 bruceadams: ljos: ah, i mid read what you were asking for. i must not be awake yet.

6:02 cemerick: ljos: there's probably something like that in swiss-arrows, but that way lies madness :-)

6:07 ljos: cemerick: oh god. What have they done? This is beyond awesome though. What is it that they say? "There is a fine line between genius and insanity."

6:07 cemerick: yup

6:08 ljos: the lonocloud folks have put out their own threading library that might be less...outlandish? :-)

6:11 ljos: cemerick: lonocloud/synthread doesn't seem to do what I want, though.

6:13 cemerick: them's the breaks

6:15 ljos: swiss-arrows doesn't look like it either...

6:32 Oh god. What have I done? Another threading macro is born.

7:10 kittylyst: Anyone have a good example of using Monger operators with JodaTime dates?

7:11 antares_: kittylyst: http://clojuremongodb.info/articles/integration.html#cljtime_joda_time

7:12 kittylyst: because MongoDB Java driver is unaware of JodaTime types, Monger converts them to j.u.Date at the end of the day

7:13 kittylyst: so, just use DateTime and friends as if they were j.u.Date instances. If you have more specific questions, I'd be happy to find or add a test in the Monger test suite that demonstrates how to do what you want.

7:14 kittylyst: antares_: Thanks. I'll also make a note to remind Trish to backlog an issue for JSR 310 dates for the Java driver for later in the year…

7:15 antares_: I can't wait for j.u.Date to start disappearing

7:16 antares_: kittylyst: I'm afraid that's a few years away :)

7:16 kittylyst: anyway, let me know if you need specific examples, I am the author of Monger and clojurewerkz.org

7:17 kittylyst: antares_: Thank you, I will. I also have another question :) - How do I get Monger to connect to a remote repset which requires a username & password?

7:18 antares_: Tried both connect! & connect using URI. Neither seemed to work

7:19 antares_: kittylyst: this example is from the API reference: https://gist.github.com/michaelklishin/507d91cd33eacd2de107

7:19 kittylyst: it was contributed by someone a while ago so I think authentication was added later. Let me take a look.

7:21 kittylyst: ok, so you have to combine the example above that uses seeds and https://github.com/michaelklishin/monger/blob/master/test/monger/test/authentication_test.clj#L41, which takes a database and credentials

7:22 kittylyst: unfortunately, that's how mongodb java driver works: you first connect, then authenticate on a DB instance before performing any other operations

7:22 kittylyst: I will update the docs and think about how to make it suck less

7:26 kittylyst: antares_: Thanks. I'll get it going as-is, and if you want feedback on a new API, buzz me here or on Twitter or Github

7:27 antares_: kittylyst: a new Monger API or the Java driver?

7:28 kittylyst: antares_: Just a better way of handling auth for rep sets.

7:28 antares_: I know the new author of the Java driver, so will have a word with her too :)

7:29 antares_: kittylyst: feel free to tweet @ClojureWerkz if you have anything to say about Monger :)

7:29 kittylyst: thanks. 10gen previously got in touch with us about the Java driver changes. It was before Trisha joined them, though

7:57 madsy: Any suggestions how I can implement the partition formula without recursion? http://upload.wikimedia.org/math/8/5/d/85d2425090db971709020599b2e5ff0e.png

7:57 Then I mean without recursion, not tail-recursion/recur

8:02 clgv: madsy: consider implementing it as "dynamic programming" algorithm

8:50 tsdh: When running a test function defined with clojure.test/deftest, is there a way to know if the test succeeded? (programatically, of course)

8:54 Ah, (successful? (run-tests)) does the job.

9:04 Hm, in clojure.test, is the something like JUnit's Assert.fail()? E.g., I want to state that if the program low reaches that form, something has gone wrong.

9:05 I can write (is false "Something's wrong!"), but that will tell "expected: false, actual: false" which is somewhat weird...

9:14 kaoD: ,(boolean 123)

9:14 clojurebot: true

9:14 kaoD: tsdh:

9:14 that will do the trick

9:15 ?

9:15 *will that

9:15 tsdh: kaoD: No, I don't even get how that fits my question. ;-)

9:16 antares_: tsdh: (is false) or throw an IllegalStateException

9:16 kaoD: tsdh: oh sorry, I just woke up got your message mixed up badly

9:16 *and got

9:16 I can't even write lol

9:17 tsdh: antares_: (is false) prints that false was expected where's false was actual. That doesn't look like a failure: you got what you expected.

9:22 antares_, kaoD: Ok, this gives halfway sane output:

9:22 (let [aHyperEdge 'aHyperEdge]

9:22 (is (= aHyperEdge nil)

9:22 (format "ERROR: There's no HyperEdge with name \"%s\"." hen)))

9:22 ;; Produces:

9:22 ;FAIL in (validate-model) (core.clj:215)

9:22 ;Testing the rnext/next references of HyperEdges

9:22 ;ERROR: There's no HyperEdge with name "E17".

9:22 ;expected: (= aHyperEdge nil)

9:22 ; actual: (not (= aHyperEdge nil))

9:22 Quite some dance to fail with a sane message in case something's missing, though.

9:36 whilo: cemerick: ping

9:36 cemerick: hi

9:36 whilo: cemerick: i stumbled upon your piggieback nrepl-middleware yesterday

9:37 works fine with lein-cljsbuild so far, but in emacs i hit an endless loop with nrepl.el

9:37 http://pastebin.com/CAiMTmCw

9:38 in nrepl.el repl i have evaluated: (require 'cljs.repl.browser)

9:39 (cemerick.piggieback/cljs-repl :repl-env (doto (cljs.repl.browser/repl-env :port 9000) cljs.repl/-setup))

9:39 (load-namespace 'example.hello) ; from lein-cljsbuild advanced example

9:40 and then just entering (and probably hitting auto-completion) "(sa)" is enough to trigger the endless loop

9:41 in a plain shell repl i can control the browser and don't hit that problem

9:41 cemerick: whilo: try repeating the workflow from `lein repl`. It will likely work. I've never seen that particular error, so I'd suspect nrepl.el.

9:42 whilo: cemerick: have done so, work from lein repl in plain shell

9:42 cemerick: ah

9:42 whilo: can you do e.g. (js/alert "hi") once the browser-repl is set up, and see the dialog pop up in your browser?

9:42 whilo: with plain lein repl, yes

9:43 * whilo is trying again in emacs

9:43 cemerick: ok; well, code completion sent by nrepl.el will always fail on in a cljs repl

9:43 the question is just how loudly it ends up complaining

9:43 and where, I guess

9:47 whilo: M-x ac-stop before evaluating, allowed me to execute (js/alert "hello") in emacs repl

9:47 cemerick: sounds good, then

9:48 nrepl.el should try to shunt autocomplete errors to some other buffer or something

9:48 whilo: cemerick: ok, so i guess i need to configure emacs to disable auto-completion for cljs files (?)

9:48 ok

9:48 cemerick: yeah, that'd be a sane thing to do

9:48 at least until autocomplete uses a middleware instead of just pushing code around

9:49 whilo: you mean emacs autocomplete modes or clojure side code?

9:49 cemerick: the latter

9:49 whilo: ok

9:49 cemerick: whilo: if you want to write up the result of this into a topic in the piggieback README, that'd be cool

9:49 whilo: thx for your work btw. clojurescript still seems to be a lot like a moving target...

9:50 cemerick: ok, will have a look, not sure if i can give proper info, but will try. will ping you with a pull request then...

9:52 tsdh: Hm, is there something like clojure.walk/postwalk that I can use to remove elements from a deeply nested vector?

9:57 cemerick: tsdh: ##(clojure.walk/postwalk #(if (and (vector? %) (< 2 (count %))) (subvec % 2) %) {:a {:b #{[1 2 3 4]}}})

9:57 lazybot: ⇒ {:a {:b #{[3 4]}}}

9:58 cemerick: You'll have to watch out to avoid modifying map entries though.

9:59 whilo: cemerick: wow, evaluating from an emacs buffer in the browser feels even more vivid than in a clojure repl... bling bling :-P

9:59 tsdh: cemerick: No, my structure is more like [[:A 1] [:B [[:C 1] [:D 1] [:C 2]]]] and I want to throw out the [:C ...] vectors, no matter where they are contained.

10:00 cemerick: tsdh: so just filter out vectors from other vectors that start with :C

10:00 tsdh: But I think I got the idea.

10:00 Yes, yes, that's what I've thought right now. :-)

10:04 That does the trick:

10:04 (clojure.walk/postwalk (fn [x]

10:04 (if (and (vector? x) (vector? (first x)))

10:04 (vec (remove #(= :HyperEdge (first %)) x))

10:04 x))

10:04 form)

10:14 thalassios_xelon: hello room :)) i want to represent a graph,i thought to use maps,what data structure do you normally use for graphs?

10:15 pepijndevos: thalassios_xelon: maps seem fine to me

10:16 thalassios_xelon: ok thx

10:18 pepijndevos: This is not strictly a clojure question, but here it is: I have messages coming in from multiple places, some of which might be the same message. I'm trying to store them in a database without duplicates.

10:19 Since people might say the same things mutliple times, I can;t just make the message unique.

10:20 I made timestamp+message unique now, but due to latency, this doesn't really work either.

10:39 drorbemet: Hi, I want to partition a list A of strings by a list B of strings which accure in A. How do I do that in Clojure?

10:39 I have to keep the order in list A.

10:40 bendlas: drorbemet: can you give an example with expected result?

10:41 drorbemet: yes

10:44 application: (partition ("a" "b" "c" "d" "e" "f" "g" "h") ("a" "d" "g"))

10:45 result: (("a" "b" "c")("d" "e" "f")("g" "h"))

10:46 Maybe I nee another datatype but that whould be no problem.

10:50 mpenet: pepijndevos: what about uuids?

10:51 nevermind, I didn't read the part about avoiding duplicates

10:51 pepijndevos: mpenet: the thing is, the messages are not unique. I just sorotf vaguely not the same at a point in time.

10:51 right

10:52 What I need to do is somehow, if I get three times "hi" from 3 clients, insert one, but if an hour later, I get"hi" again, it's probably fine.

10:52 drorbemet: bendlas: I think I have to write a map with a predicate function which I feed the key list.

10:53 mpenet: pepijndevos: hash of the content + some timestamp (with some precision that allows you to avoid duplicate per interval you choose)

10:54 znDuff: pepijndevos: Heh. This actually sounds like something I might use Esper for.

10:54 (at least, if you had a lot of similar questions/problems in terms of doing temporal stream processing).

10:55 pepijndevos: mpenet: yea, something like that, but at the transition from one timestamp to the other you are again in trouble.

10:55 znDuff: esper?

10:56 znDuff: pepijndevos: Stream-processing tool for Java. Has a rather extensive language for writing temporal pattern-matching rules.

10:56 bendlas: drorbemet: partition-by with a set almost does it, hold on

10:57 pepijndevos: znDuff: sound like the thing. except maybe overkill, don't know

10:57 drorbemet: bendlas: ok

10:59 bendlas: drorbemet: got a quick and really dirty solution

10:59 ,(map (partial apply concat) (partition 2 (partition-by '#{a e h} '[a b c d e f g h i j])))

10:59 clojurebot: ((a b c d) (e f g) (h i j))

11:01 bendlas: drorbemet: wait, it's buggy

11:01 drorbemet: bendlas: thanks :-) I try it und take it as a starting point

11:01 bendlas: sorry, fails for

11:01 (map (partial apply concat) (partition 2 (partition-by '#{a b e h} '[a b c d e f g h i j])))

11:01 clgv: drorbemet: write your own `partition-at`. you can steal from partition-by ;)

11:02 bendlas: fails if two consecutive elements are in the set

11:02 drorbemet: clgv: ah that's an idea thanks

11:04 bendlas: thanks, I will spend some time on that one

11:06 bendlas: I think I will have to use state or recursion with a value

11:07 bendlas: no I dont't need to I just have to eat the key list

11:08 pepijndevos: znDuff: I think I might try cooking something up with queues and set or something like that

11:11 dobladez: hey, anybody here using github.com/8thlight/hyperion by any chance?

11:12 in my current application I put together something similar (though much less sophisticated)... and was wondering if switching to it would be a good idea

11:12 piranha: alandipert: are you by any chance here? :)

11:13 alandipert: piranha: yo

11:13 piranha: alandipert: oh wow, that's cool. :) I'm sorry for nagging, but I've got another issue yesterday and still not sure how to deal with it

11:13 alandipert: piranha: np whats up

11:14 piranha: alandipert: so the thing is that I want to render a list of items somehow, and each of those items has it's own template. So basically like parent template and a list of children templates. My thought was to get a cell of count of items (so I could re-create list when amount of items changes) and a cell for each item (so that it can track its own changes).

11:15 but then... I couldn't invent how should I do that. I can show code which I used for flapjax for that

11:15 it probably should be a bit different, since you can't create cells in cell it seems %)

11:15 maybe I'm missing some simpler way to do that?

11:18 pepijndevos: Does every fn implement comparator? https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L2681

11:19 bbloom: pepijndevos: yes

11:20 pepijndevos: What would be the nicest way to make an object that compares by one property but equals based on another property? Metadata, or a new type?

11:21 Too bad I can;t add metadata to a string :(

11:21 alandipert: piranha: ah, micha does something similar to that in his todofrp w/ hlisp thing

11:21 bbloom: pepijndevos: is your object immutable?

11:22 pepijndevos: bbloom: it's a string

11:22 and a timestamp

11:22 piranha: alandipert: I'm sorry, if you've answered, I haven't seen it - connection problems :\

11:22 bbloom: pepijndevos: use a map: {:string "abc" :timestamp 123} with metadata

11:22 alandipert: piranha: np, the thing to look at is micha's todofrp/hlisp thing

11:22 piranha: he makes a cell per UL

11:22 piranha: ah rihgt

11:23 aha

11:23 pepijndevos: bbloom: the timestamp is the metadata, so it would just be a map with one string which seems weird.

11:23 alandipert: alandipert: he actually makes only a fixed # of cells, (50), and those w/ no value are hidden

11:23 piranha: eh, I'll blame this on long flight, I should've checked it first :)

11:23 alandipert: alandipert: so he never dynamically adds stuff

11:23 err, piranha ^

11:24 bbloom: pepijndevos: ah, yes, that's sucks because strings are a java primitive which are often interned by the runtime, so there is no way to guarentee that they are unique instances with unique metadata

11:24 piranha: alandipert: hm, well, I'll check, but dynamically adding stuff is interesting, predicting amount of cells is a tough process :)

11:24 bbloom: pepijndevos: are your strings known to be unique?

11:24 pepijndevos: right, so I'll have to wrap them in something

11:24 no, they are know not to be unique even

11:24 bbloom: pepijndevos: ok, then yeah, you need to wrap them

11:25 pepijndevos: you may or may not need the wrapper to be equatable

11:25 pepijndevos: alright…. (with-meta ["foo"] {:timestamp 123})

11:26 bbloom: pepijndevos: yeah, that's a pretty simple way to do it

11:26 now ["foo"] will equal any other ["foo"] regardless of timestamp

11:26 pepijndevos: but, yuk….

11:26 bbloom: alternatively, you can just make a blah= binary predicate and test with that

11:26 pepijndevos: hmhm

11:26 bbloom: unless you need to use these things as keys or something

11:26 pepijndevos: bbloom: qriority queue

11:27 bbloom: *shrug* it's not THAT yucky :-P

11:28 pepijndevos: yea, i'll survive the uglyness if it works

11:28 bbloom: where do these strings come from? what are in them?

11:28 symbols can have metadata

11:28 pbuckley: is there a known issue with nrepl.el and C-c-C-d not bringing up the docs for Clojure 1.5? I've tried RC16 and RC17.

11:29 pepijndevos: bbloom: chat messages. I'm trying to sort out the duplicates that roughly have the same timestamp.

11:29 bbloom: pepijndevos: ah, i see hm

11:29 is there some known algorithm you're using?

11:30 pepijndevos: bbloom: so the plan is to put them in a priority queue sorted by timestamp and then I don't know yet. I can use contains on the queue or something….

11:31 bbloom: pepijndevos: hm, might be a simpler way, but i ggotta run & can't think about it ATM

11:31 good luck!

11:31 pepijndevos: thanks

11:32 casion: is there any sort of 'intro to web dev' in clojure anywhere?

11:32 TimMc_: kittylyst: Did you figure out the JDK 8 crash yet?

11:32 casion: as in something for someone who's never done any web development at all other than basic html/css

11:32 znDuff: casion: Hmm. Depends, to some extent, on what approach you want to take.

11:33 casion: ...for instance, there are some tutorials/presentations focusing on end-to-end ClojureScript (using node.js or such on the server)...

11:33 casion: znDuff: you're already above my head

11:33 znDuff: casion: ...whereas the more popular Clojure-for-Java servers are based on Ring and Compojure.

11:34 pbuckley: casion: there isn't much for someone who hasn't done any web dev at all

11:34 znDuff: casion: Hmm. Maybe you might start at http://clojurescriptone.com/

11:34 DaReaper5: Hi, what is the best way to build a vector of results within a loop?

11:34 I know map and for can do it but i need to use a loop

11:34 casion: I've been trying to read stuff for other languages, but translating concepts across is quite difficult when I'm not _at all_ knowledgable of ruby (or whatever language I find info with)

11:35 pbuckley: casion: much like rails, there is a lot of assumed knowledge - and clojure gives you some really big, powerful tools that assume you have that knowledge

11:35 casion: pbuckley: and where would I find this assumed knowledge? everyone keeps pointing me to ruby stuff, and that is not working

11:35 thank you znDuff

11:35 DaReaper5: would the best approach be to use "into"

11:35 pbuckley: casion: this is a recent somewhat end-to-end post, http://clojure-lab.tumblr.com/

11:36 hashbang1: DaReaper5: that was my first thought, but I'm new to learning clojure, so there may be a better way

11:36 pbuckley: casion: but not necessarily where you would find the assumed knowledge - by assumed knowledge I mean stuff like HTTP requests, routing, MVC architecture, talking to a database, session stores and cookies, javascript, etc

11:36 casion: I'm certainly not new to programming, or clojure... but lots of terminology in the web world that seems to be ethereal in definition

11:37 pbuckley: casion: these are vast areas in their own respect - you end up bumping into them because they are great ways to not reinvent the wheel, but they have their own learning curves

11:38 alandipert: DaReaper5: conj?

11:38 hashbang1: casion: what languages are you most comfortable with outside of clojure?

11:38 casion: hashbang1: c, asm mostly

11:38 objc and c++ when needed

11:39 DaReaper5: alandipert lol i googled that and got the conference

11:40 alandipert i think that is better than into because i am not trying to add an array to an array

11:40 vector*

11:40 alandipert: DaReaper5: haha. but yes, clojure.core/conj - it adds things to collections

11:40 DaReaper5: yupp

11:40 ill try it out. Seems to be what i need

11:41 on a side note, loop was so confusing until i realized recur is initating recursion starting from the start of the loop and just replacing the args

11:42 hated the docs for it :P

11:43 gfredericks: I'm seeing a memory leak in code (that does no DB interaction) only if I wrap it in clojure.java.jdbc/transaction

11:44 brianwong: someone point out what im doing wrong?

11:44 #(take-while #(and (even? %) (< % 1000)) [1 2 3 4 5 1001])

11:44 ,(take-while #(and (even? %) (< % 1000)) [1 2 3 4 5 1001])

11:44 clojurebot: ()

11:44 brianwong: im expecting (2 4)

11:44 llasram: &(even? 1)

11:44 lazybot: ⇒ false

11:44 alandipert: brianwong: 1 isn't even

11:44 gfredericks: brianwong: you probably want filter instead of take-while?

11:45 brianwong: well this is just a test

11:45 DaReaper5: gfredricks, i am not familiar with transaction but could it be tryng to open a transaction and then not closing it later?

11:45 brianwong: because im actually passing it an infinite lazy sequence instead of that test list

11:45 alandipert: ,(filter #(and (even? %) (< % 1000)) [1 2 3 4 5 1001])

11:45 clojurebot: (2 4)

11:45 gfredericks: DaReaper5: it should be closing it; I believe the memory leak is the head of a seq being held on to. I have no idea how the transaction code would be able to do that

11:46 DaReaper5: hmm weird

11:46 i use korma

11:46 gfredericks: DaReaper5: yeah I'm digging further; been on this for a day now

11:46 DaReaper5: dam

11:46 gfredericks: I wasn't debugging very effectively at first

11:47 frenchyp: brianwong: filter is lazy

11:48 brianwong: im not using filter

11:48 let me rephrase

11:48 why does this return ()

11:48 ,(take-while #(and (even? %) (< % 1000)) (iterate inc 1))

11:48 clojurebot: ()

11:50 frenchyp: because the very first time it gets evaluated (on 1), the predicate returns false

11:50 pisketti: yup, it's never even

11:50 pbuckley: brianwong: take-while will return results until the pred returns false

11:50 frenchyp: (take-while #(and (even? %) (< % 1000)) [2 4 6 1001])

11:50 ,(take-while #(and (even? %) (< % 1000)) [2 4 6 1001])

11:50 clojurebot: (2 4 6)

11:51 pbuckley: since it initially returns false, there's no "while" period for it to take during

11:52 frenchyp: do you need this behavior where the evaluation stops as soon as the predicate returns false?

11:53 if not, you can use filter, which is lazy and will work with infinite collection

12:00 brianwong: ok thank you for the explanation of take-while. I should have read the doc string more closely

12:00 dnolen: ibdknox: hmm, d/l'ed LT 0.3, when trying to open a file I get a maximum call stack size exceeded error

12:01 ibdknox: actually not a file, a folder

12:02 znDuff: Is Light Table able to work with non-lein-based projects now?

12:02 Ember-: new lighttable really looks good, can't wait to test it

12:07 Frozenlock: ,(partition 4 (range 3))

12:07 clojurebot: ()

12:07 Frozenlock: Ah... partition-all

12:14 gfredericks: do jdbc transactions do something weird involving the JVM and GC?

12:17 seangrove: heh, "Everytime I update LT the syntax highlighting is reducing by the number of colors used. I expect the color theme in the final to be grayscale."

12:17 Worth a chuckle

12:18 pepijndevos: huh… When doing reify on java.util.Queue I get CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: offer

12:18 seangrove: *chuckles*

12:19 seangrove: Good ol' hn trolls

12:19 * arrdem resume lurking under the bridge

12:20 arrdem: oh LT made it to the front page again.

12:22 gfredericks: I'm starting to think that inside a JDBC transaction nothing created outside of it can be GC'd

12:22 pepijndevos: nm, I forgot this.

12:26 hiredman: gfredericks: if you look at the impl of the transaction macro, it creates a function from your code (which causes thing sto be closed over) and then executes it in a non-tail position

12:26 although I am not sure if tail position still matters for locals clearing

12:26 gfredericks: hiredman: oh that's an interesting point

12:27 hiredman: my current perspective is that if the lazy seq is created inside the transaction then it gets GC'd but not if created outside

12:28 hiredman: gfredericks: thunk it

12:29 (fn [] (make-lazy-seq))

12:29 gfredericks: I'll try that in a minute

12:31 hiredman: delay should work just as well, right?

12:31 hiredman: no

12:31 delays are effectively memoized thunks

12:31 gfredericks: oh poop of course

12:31 that's why that didn't help yesterday :D

12:32 * gfredericks doesn't know clojure

12:32 gfredericks: last step is to try to reproduce this without JDBC

12:36 this is harder than I thought o_O

12:36 the thunk does fix it though

13:00 ohpauleez: There are a few clojure configuration systems - environ is one - what's the other popular one?

13:00 configuration?

13:00 does clojurebot know configuration?

13:01 joegallo: carica is a thing https://github.com/sonian/carica

13:01 ohpauleez: THANK YOU!

13:01 that's what I was looking for

13:01 joegallo: good choice ;)

13:02 danlarkin: aw yeah

13:16 pepijndevos: Is there a nicer way to do (future (Thread/sleep 5000) blah)?

13:17 llasram: pepijndevos: What are you trying to do? Schedule something for the future?

13:17 joegallo: perhaps https://github.com/overtone/at-at

13:18 pepijndevos: llasram: yea

13:18 joegallo: that sounds like the thing.

13:19 or maybe I should just use ScheduledThreadPoolExecutor directly...

13:23 gfredericks: does a try with no catch or finally have significance to the jvm?

13:27 * gfredericks is trying to find a more specific moral than "Don't do basic things with lazy seqs"

13:28 dnolen: hmm

13:29 it would be kind of convenient if CLJS tracked protocols like ISequential so if you extend it, it extends to all implementers so you don't have enumerate them all, or put them all into default ...

13:30 but I guess that also doesn't really jive w/ the way protocols were meant to be used ... since protocols doesn't support extending to protocols ...

13:30 type unions?

13:32 gfredericks: I've wanted to extend one protocol to another before. But I assumed I was supposed to feel dirty about that.

13:33 llasram: gfredericks: You should cut out a scarlet "OO" and pin it to yourself!

13:37 pepijndevos: I have constructed a fifo-set :D

13:39 Licenser: man I should never have named my project fifo and put a highlight on it

13:39 pepijndevos: Licenser: ?

13:39 seangrove: Any naming suggestions for a clojure firebase wrapper?

13:40 Licenser: pepijndevos I always get exited when my IRC client tell me someone said 'fifo' bercause I think they are talking about my project ^^

13:40 frenchyp: anti-suggestion: firebaje

13:40 dnolen: hrm, re: optimizing invoke in CLJS

13:41 ... we could actually just modify Function prototype w/ namespaced property ...

13:41 kind of dirty, but from the looks of it, zero overhead?

13:41 pepijndevos: Licenser: this one? http://project-fifo.net/display/PF/Project+FiFo+Home

13:41 seangrove: dnolen: I've been thinking a bit about the naming convention cljs uses, adding .call and .apply to the String prototype - couldn't they be namespaced to avoid collisions, e.g. String.$cljs.call/apply?

13:42 This would at least avoid some collisions with other libraries where cljs has to play nice

13:42 Licenser: pepijndevos yup

13:43 Raynes: ibdknox: Oooh, light table updatez.

13:43 dnolen: seangrove: probably, there's a ticket would take a patch. or somebody could do compiler constant literal optimization w/ keywords

13:43 seangrove: I assume it'd cause problems with the way actual functions are invoked (relying on Function.call/apply, but those could be aliased under the same namespace)

13:43 Sounds good, I was wondering if there was an inherent problem with the approach. Will try to take a look at it

13:44 pepijndevos: seangrove: bajure? :P

13:44 seangrove: I think I'll just use our normal random-japanese-word naming convention

13:45 pepijndevos: seangrove: why japanese? Okay, they have nice words, but french sounds more clojure-u IMO.

13:45 seangrove: Most of our stuff is already Japanese, just because

13:50 dnolen: hum

13:51 it also means we can stop testing JS fns

13:52 they can also go through invoke

13:54 Raynes: ibdknox: How is the paredit contracting coming along?

13:55 scottj: dnolen: does your twitter client format with newlines and indentation your latest tweet? (bc I was surprised that bitlbee did)

13:55 dnolen: scottj: I just use the OS X Twitter client, and it does format w/ newlines & indentation

13:56 Raynes: dnolen, scottj: I'm fond of tweetdeck in Chrome.

13:57 scottj: dnolen: ahh, my only other exposure is with the website which doesn't.

13:57 dnolen: higher order RestFn case still tricky tho ...

13:57 scottj: Raynes: yeah that client is pretty cool looking.

14:15 gfredericks: minimal examples is (let [xs (range)] (#(dorun xs)))

14:16 I guess the moral is don't close over lazy seqs

14:16 explicitely (with a function) or implicitely (with a macro that creates a function)

14:20 &(let [xs (range)] (#(nth xs 10000000)))

14:20 lazybot: Execution Timed Out!

14:22 jcromartie: so I have a few kinks to work out, but I think this text-to-speech doc reader in nrepl.el is going to be handy :)

14:23 need a function to "explain" clojure code in English text

14:23 like translate [x, y, z] to "a vector of x, y, and z"

14:23 gfredericks: as long as you don't mind ambiguities

14:23 jcromartie: yeah

14:24 so far it's understandable

14:24 depends on the quality of the docs

14:29 amalloy: jcromartie: i can't find a link to it now, but there's an algorithm that does a good job of translating C function signatures to english (and back, if you're careful)

14:30 jcromartie: yeah, I've seen that

14:30 cdecl

14:30 nickmbailey: any tips for finding the offending 'try' when getting 'cannot recur across try'?

14:30 gfredericks: uhm

14:31 how many tries do you have?

14:31 amalloy: ah yes, that's the one. also relevant seems to be that you'll never really do a very good job of "explaining" the type of a function, since functions don't have type signatures like in (eg) haskell

14:31 nickmbailey: well i had a few but i've re organized things so that it seems there aren't any 'try's wrapping this particular recur

14:32 but not according to the compiler

14:32 gfredericks: nickmbailey: maybe you have a macro that you're recur'ing from inside of?

14:32 nickmbailey: i have a try in the let

14:32 perhaps thats causing it

14:32 gfredericks: ,(fn [] (binding [*out* *out*] (recur)))

14:33 clojurebot: #<CompilerException java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:0:0)>

14:33 gfredericks: haha that's an even more confusing message

14:33 nickmbailey: yeah i tried finding a macro with a try in it but didn't see anything

14:33 mechazoidal: anyone have any experience with clj-native?

14:33 nickmbailey: this well teach me to wait so long to upgrade from 1.2

14:33 *will

14:36 tyler_: what do variables that look like *this* mean in clojure?

14:36 jcromartie: tyler_: they are intended to be dynamically rebound with (binding ...)

14:37 nickmbailey: oh so 'binding' uses a try block?

14:37 tyler_: jcromartie: im not familiar with binding function yet so that doesn't really make sense to me ;)

14:38 jcromartie: tyler_: OK, well it's not too terribly complicated

14:38 amalloy: nickmbailey: yes, so that it can put the "pop" or "unbind" into a finally

14:38 nickmbailey: so doing a recur inside a macro is generally not going to work?

14:38 got it

14:38 amalloy: that's sorta an implementation detail, but if you think about what binding and recur *do* you'll see that it's not possible to recur across a binding

14:39 no, that's a poor conclusion to draw. you're more or less always inside some macro or other

14:39 nickmbailey: fair enough, i'm thinking about the macros we've written which tend to use binding

14:39 that makes sense though

14:40 jcromartie: tyler_: for example, to send all stderr to stdout, you'd do (binding [*err* *out*] …) so that any function call inside the body that uses *err* will get the value of *out* instead

14:41 tyler_: it's like let (sort of), but for vars in calls deeper than the immediate scope

14:41 nickmbailey: thanks amalloy, gfredericks

14:41 tyler_: jcromartie: just looked it up on clojuredoc. thnx :)

14:42 ironically th example doesn't use *var* convention

14:42 nickmbailey: i wonder if we could special case the compiler to say "can't recur across binding" in that case

14:42 jcromartie: tyler_: and any var that you do rebind must be marked with :dynamic

14:43 tyler_: jcromartie: i saw that :)

14:44 jcromartie: cool

14:52 wopple: I'm trying to make use of vim-foreplay and when I cpp to send code to the repl I get this error: https://www.refheap.com/paste/11938

14:52 everything was working fine yesterday so I'm not sure why it's not working today

14:53 I started the repl with "lein repl" in the project's root directory in another terminal

14:57 hashbang1: wopple: did you connect to the nrepl inside vim?

14:58 wopple: I've tried using :Connect nrepl://localhost:[port] to connect and it looks like it works, but then still gives the same error

14:59 it used to work w/o having to enter the connect command

15:05 pepijndevos: Is it possible to do an INSERT … SELECT in korma?

15:06 gfredericks: probably not

15:14 amalloy: i think i'll set my irc client to s/korma/korean, just to keep things interesting

15:16 clizzin: i'm having an issue with leiningen where my java files import a class written using clojure (the namespace uses :gen-class) but when i try to build using lein, the java file complains about not finding the clojure class. it seems like the java is being compiled before the clojure gets compiled. any tips on how to fix this?

15:17 i do have the clojure class in question listed in :aot in the project.clj

15:17 technomancy: clizzin: leiningen assumes the java code is legacy and the clojure code depends on it rather than the other way around

15:17 you can change the order with :prep-tasks, which I think is covered here: https://github.com/technomancy/leiningen/issues/847#issuecomment-14072652

15:17 hm; guess not

15:17 :prep-tasks ^:replace ["compile" "javac"] ; should do it

15:18 flipping the order is easier than arbitrary interdependencies

15:19 clizzin: technomancy: let me give that a shot

15:19 technomancy: it's pretty rare to have java code that depends on clojure code, much less to keep the two in the same project

15:19 but it should be possible

15:19 clizzin: technomancy: my use case is that there's a bunch of java code that runs a servlet, and the servlet is written in clojure. so the java code needs to import the servlet class.

15:20 okay, great, it worked for `lein run`. `lein compile` still fails though — i guess compile is still trying to run javac first

15:21 SegFaultAX: clizzin: Would it be hard to replace the Java part of your application with Clojure?

15:21 clizzin: SegFaultAX: yes

15:21 it uses guice quite extensively

15:21 SegFaultAX: clizzin: Bummer.

15:21 clizzin: and i have no idea how to make clojure and guide cooperate nicely

15:21 guice*

15:26 SegFaultAX: clizzin: Yea, no idea. Do people even use DI in Clojure?

15:27 clizzin: SegFaultAX: this looks like the best discussion: http://stackoverflow.com/questions/13085370/what-is-the-clojure-equivalent-to-google-guice

15:27 hiredman: everytime you def something you create a di point

15:28 SegFaultAX: hiredman: Exactly. It seems to me that HOF+vars alleviates much of the need for DI.

15:29 ... which is basically what the linked article from clizzin says.

15:33 tomoj: so why might javascript need DI?

15:33 no vars?

15:34 or maybe it doesn't?

15:38 SegFaultAX: tomoj: Isn't DI in js pretty much a big hack?

15:38 tomoj: Eg coercing the function to a string and inspecting the arg list?

15:39 tomoj: or angular does like ['$foo', '$bar', function(f, b) { ...}]

15:40 SegFaultAX: tomoj: Well that's perferable I guess, because at least then the programmer can control exactly which types of dependencies are injected.

15:41 wopple: now vim-foreplay is working again... not sure why

15:41 tomoj: angular actually does both and cheats by showing the hack version in demos, then there's a side-note like "oh, yeah, by the way, you really shouldn't do that, you have to have this nasty array.

15:41 SegFaultAX: tomoj: But I thought Angular just used wonky names for parameters, eg `function foo($foo, $bar) {...}` (which can be easily yanked out if you toString the function, for example)

15:41 tomoj: yeah

15:41 Apage43: angular actually even has a third way, which is to stick the list on the function object

15:41 pepijndevos: I seem to remember someone wrote a lisp in core.logic. any ideas?

15:43 Apage43: SegFaultAX: sort of, it actually tries DI on -all- the params, $ in front just signifies the service is built in to angular. if you see function foo($foo, $bar, baz, Blah) {} baz and Blah are also DI'd

15:43 but are probably services provided by the user or a library

15:43 SegFaultAX: Apage43: TIL. Thanks.

15:43 Still, it's a hack.

15:43 Apage43: quite

15:44 *shrug*

15:44 hashbang1: wopple: haha, that describes my experience with it so far. real nice when it works, though.

15:44 SegFaultAX: At least in Clojure you could use metadata. But DI probably just isn't necessary in Clojure, anyway.

15:44 Apage43: I feel the same way about method_missing

15:44 SegFaultAX: Apage43: Ahhh, method_missing, feels good man.

15:44 Apage43: SegFaultAX: in Angular it's mostly used for swapping out those guys with different stuff when you run tests

15:46 SegFaultAX: Apage43: That goes without saying. Testing is a big motivating factor behind DI to begin with.

15:46 Apage43: and to some extent a less ugly way to share stuff between components

15:47 tomoj: I read an explanation that it was to avoid demeter violations

15:47 scottj: Rich Hickey's Clojure/conj presentation just posted http://www.youtube.com/watch?v=ROor6_NGIWU

15:47 tomoj: which struck me as odd, the DI system there seems to make demeter violations easier, not harder? but I don't understand DI or demeter anyway

15:48 SegFaultAX: tomoj: Testing is a *big* motivating factor, not the *only* motivating factor. :)

15:48 dnolen_: pepijndevos: you're probably thinking of symbol, it's not written in core.logic, just the type checker

15:48 pepijndevos: it compiles to C++, http://github.com/timowest/symbol

15:49 pepijndevos: dnolen_: ohwait, maybe I meant the thing at the conj unconference. They had a lisp right?

15:49 dnolen_: pepijndevos: hrm, I can't think of anything like that

15:50 pepijndevos: hmmmm, I'll have to rewatch the video. I'm pretty sure

15:50 SegFaultAX: pepijndevos: There was a demonstration of using miniKanren to generate lisp programs [that evaluate to 6], was that it?

15:50 ravster: hey all

15:51 pepijndevos: SegFaultAX: exactly!

15:53 enquora: need a library that runs on server, in web browser and in iOS app - has anyone compiled to C via Scheme (Gambit or Chicken?) with production code?

15:53 SegFaultAX: pepijndevos: That's a great talk. I've seen two versions of it though, one at a Clojure conference and one elsewhere. The latter was better, IMHO.

15:53 hashbang1: has anyone given the latest lighttable release a try? Looks like another big UI overhaul.

15:54 SegFaultAX: enquora: You might have more luck in #lisp if you're looking for general lisp help. I think gambit and chicken have their own rooms, too.

15:54 dnolen_: pepijndevos: oh yeah Will & Dan's talk

15:55 SegFaultAX: dnolen_: They certainly have an interesting presentation style, don't they?

15:55 dnolen_: pepijndevos: relational interpreter stuff

15:55 pepijndevos: dnolen_: yea. I was thinking it could maybe generate quines

15:55 dnolen_: SegFaultAX: they

15:55 enquora: SegFaultAX: referring to clojure/clojurescript in this instance

15:55 dnolen_: pepijndevos: yeah they wrote a whole paper about it

15:55 znDuff: enquora: The Clojure way to be portable to server, browser and iOS would be to compile to JavaScript, not to C.

15:55 dnolen_: pepijndevos: and Nada Amin has a alphaKanren based version now in core.logic

15:56 znDuff: Eh? There's a Scheme backend for ClojureScript?

15:56 * znDuff hadn't heard of that one.

15:56 pepijndevos: dnolen_: they have a paper on the interpreter? what do i google for?

15:56 enquora: znDuff: have considered running Javascript in the iOS app - would prefer a C lib, though

15:56 SegFaultAX: pepijndevos: They use Chez scheme in their talks.

15:56 enquora: https://github.com/takeoutweight/clojure-scheme

15:56 SegFaultAX: pepijndevos: And you can find the reference implementation of miniKanren on their site.

15:57 ravster: enquora: woaaaahhh! Thats cool.

15:57 SegFaultAX: Chez: http://www.scheme.com/ miniKanren: http://kanren.sourceforge.net/

15:57 dnolen_: pepijndevos: code, http://github.com/webyrd/2012-scheme-workshop-quines-paper-code

15:57 enquora: znDuff: it's one of the attractions of Clojure - would like to hear from someone who's gone this route with production code, though

15:57 dnolen_: pepijndevos: latest version of the paper online I could find http://users-cs.au.dk/danvy/sfp12/papers/byrd-holk-friedman-paper-sfp12.pdf

15:57 pepijndevos: dnolen_: thanks :)

15:58 * znDuff eyes https://github.com/takeoutweight/clojure-scheme

15:58 dnolen_: pepijndevos: core.logic translation http://github.com/namin/TAPL-in-miniKanren-cKanren-core.logic

15:59 requires core.logic master

16:00 enquora: ClojureScript is nearly there, server, web, iOS - maybe later this year

16:00 enquora: dnolen_: not certain what you mean wrt iOS?

16:00 dnolen_: enquora: JavaScriptCore

16:01 enquora: ah, k. run a Javascript library using JavascriptCore in its own context. but that can be done now, afaik

16:01 SegFaultAX: They always have the strangest names for JS engines. "SquirrelFish"

16:02 enquora: SegFaultAX: perhaps started at Moz with their dumb-ass references to Ghostbusters

16:03 dnolen_: enquora: yep Kevin Lynagh has already done something like this and has an on the App Store

16:03 has an app on

16:03 SegFaultAX: dnolen_: A clojurescript iOS app?

16:03 dnolen_: SegFaultAX: yes

16:04 enquora: dnolen_: haven't looked at performance implications, but I suspect JavascriptCore doesn't do jit - still prefer a C lib

16:04 nightfly: Does clojurescript still depend upon Clojure for macroexpansion?

16:05 dnolen_: enquora: it may not JIT in a WebView, but I think it might if you use it directly. I have a friend doing OpenGL stuff w/ it and he's been surprised with the perf.

16:05 SegFaultAX: dnolen_: How does that work, exactly? Can you build native iOS in JS?

16:05 enquora: SegFaultAX: yes

16:05 dnolen_: SegFaultAX: JavaScriptCore bridge to Cocoa

16:05 enquora: no need to tie it to html, can run in its own context

16:05 mrb_bk: dnolen_: have you seen https://github.com/phoboslab/Ejecta ?

16:05 we're playing with that at work

16:06 SegFaultAX: That's pretty cool. Is it stable?

16:06 dnolen_: mrb_bk: yeah that's what Amit Pitaru my studio mate has been using.

16:06 mrb_bk: dnolen_: oh no way

16:07 dnolen_: you can see commits from PP people in here :) https://github.com/phoboslab/Ejecta/commits/master

16:07 i'll have to tell tyler and sal that amit is working with it too

16:07 dnolen_: mrb_bk: haha cool

16:07 mrb_bk: they've done some amazing stuff with it so far

16:07 dnolen_: mrb_bk: yeah Amit's been psyched about the framerates

16:08 mrb_bk: it's pretty impressive

16:08 dnolen_: what's he working on?

16:10 ttimvisher: is there a way to rename keys in a destructuring bind of a map?

16:10 dnolen_: mrb_bk: hmm, I don't remember ... a game maybe?

16:10 mrb_bk: dnolen_: sounds about right

16:11 ttimvisher: something like (let [{:keys [body :as x]} {:body "stahou"}] ...)

16:12 i guess you can just mix the keys and regular destructuring. that works

16:12 noprompt: (let [{:keys [a b] :or {a "a" b "b"}} m])

16:13 SegFaultAX: ttimvisher: This always seems easier to me for those cases: ##(let [{foo :name} {:name "SegFaultAX"}] foo)

16:13 lazybot: ⇒ "SegFaultAX"

16:13 noprompt: ,(let [{:keys [a] :or {a "bar"}} {}] a)

16:13 clojurebot: "bar"

16:14 noprompt: forgot you could do it that way

16:15 SegFaultAX: noprompt: :keys is just a shorthand for that syntax.

16:15 noprompt: SegFaultAX: yeah, i just remembered after your example

16:16 ttimvisher: SegFaultAX: yep. it's nice that the :keys bind mixes with the verbose form well

16:16 noprompt: is there a difference between lazybot and clojurebot?

16:18 SegFaultAX: noprompt: Yes.

16:18 noprompt: what's the difference?

16:19 SegFaultAX: noprompt: They are different.

16:19 llasram: noprompt: They have entirely different codebases

16:20 SegFaultAX: llasram: I wished you would have said "They have entirely different codebases, altogether". Then everyone in the room echos "They have entirely different codebases" /airplane reference

16:21 llasram: Well, next time

16:21 ivan: clojurebot can be used to flood the channel with thousands of lines, lazybot cannot

16:21 noprompt: haha.

16:27 SegFaultAX: llasram: Sorry, I'm really tired. :)

16:35 Raynes: You can probably do it with lazybot if you try hard enough.

16:35 noprompt: ha!

16:36 (do it)

16:36 haha

16:37 (with lazybot…) oh dear

16:37 ivan: that would be a reasonable idea if #clojure had any ops

16:38 noprompt: i think i misinterpreted that.

16:39 being ill has a funny way of tampering with your mind.

16:44 enquora: dnolen_: Just ran across infoq-hosted talk by yourself - at least I presume it's you. Have been wondering for some time how stuff ends up on InfoQ - it's the most unfriendly page design I've come across, especially for my primary personal computer. Do individuals choose to publish things there?

16:45 dnolen_: enquora: no, certain conferences publish there

16:45 enquora: hmmm. do they know that 1994 called and wants its html back?

16:46 ivan: I would have no problems with infoq if they let me watch at 1.3-1.5x or download a video that includes the slides

16:46 noprompt: enquora: yeah it's pretty bad. it's sites like that which make me wish there were vigilante ux developers.

16:46 ivan: maybe I should ask for my money back

16:47 https://github.com/cykl/infoqscraper still doesn't quite work

16:47 enquora: what's this 'flash' thing they talk about, for instance. can't seem to find anything like that for my iPad

16:47 rhg135: Hello, I have this code http://pastebin.com/BpRFc7CL but strangely it seem that add-modules is not called, but calling it manually works just fine? any ideas?

16:47 ivan: enquora: iOS gets a <video> with no slides

16:48 TimMc: ivan: clojurebot does not flood (as readily?) now that it concatenates output lines.

16:48 ,(repeatedly #(println "foo"))

16:48 clojurebot: (foo\nfoo\nnil foo\nnil foo\nnil foo\nnil foo\nnil foo\n...)

16:49 ivan: ah

16:53 amalloy: laziness, rhg135. for is not a loop, as they say

16:53 znDuff: rhg135: would you consider pasting your code somewhere without the flashy, animated ads? A local favorite happens to be Refheap (written in Clojure)

16:53 rhg135: yep, I will,

16:53 * znDuff does not have amalloy's fortitute (or, as the case may be, moral comfort with ad blockers)

16:54 rhg135: so map?

16:55 noprompt: rhg135: i think you may want doseq.

16:55 rhg135: ok, thank you

16:58 gfredericks: the lein base profile wants lein-pprint?

16:58 ravster: Am I correct in saying that putting an '@' before a regular function call is going to force the execution of that function (As opposed to it being lazy)?

16:58 llasram: ravster: Alas, no

16:59 znDuff: ravster: I think you want doall

16:59 noprompt: rhg135: also you could substitute -> with .. (.. pbx getListManager (addListener m))

16:59 llasram: ravster: If we ask lazybot what @ means ##(quote @example)

16:59 lazybot: ⇒ (clojure.core/deref example)

17:00 znDuff: ravster: _functions_, though, aren't lazy as such (and aren't forced by doall); _sequences_ can be.

17:00 ravster: oh, so its just an alias to deref.

17:00 znDuff: A reader macro for deref, yes.

17:00 solussd: Could someone tell me why what is passed as "func" isn't namespace qualified in the macro's macro expansion? : https://www.refheap.com/paste/56084cf40ec9fbabb8e9e6544

17:01 ravster: weird. I'm trying to figure out why its in the datomic-simple codebase.

17:01 for their transaction functions.

17:03 or datomico now, after the rename

17:03 rhg135: ok, it works, thank you.

17:04 llasram: ravster: Well, you can make something `deref`able just by `reify`ing `clojure.lang.IDeref`. If they aren't using one of the standard reference types, probably have a custom IDeref to wrap up transaction results

17:08 akhudek: I'm trying to debug a ring performance problem (I think). A request is waiting on average 1.5 -2s (it returns an image from a database). The database query and forming of the response takes under 30msec. Connection is https to localhost. Where is the extra time coming from here?

17:08 hcumberdale: Hi there :)

17:08 ravster: llasram: okay, will look into that. Thanks.

17:08 hcumberdale: akhudek: tested with image as a slurped file?

17:09 databases are a horrible place for images

17:09 noprompt: i thought the first rule of database club was don't store images in the database.

17:09 hcumberdale: especially big images :D

17:09 rhg135: ok, another question, i used .. in add-modules and got a method not found, but with -> it worked, what is the difference?

17:10 hcumberdale: rhg135: -> is just a macro

17:10 (,doc ->)

17:10 hmpf

17:10 noprompt: ,(doc ->)

17:10 clojurebot: "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

17:10 bendlas: noprompt: not so sure about that, isn't that what BLOB types are for?

17:10 mechazoidal: Anyone dealt with clj-native? Trying to figure out how to correctly pass strings for a char* parameter: https://www.refheap.com/paste/11948

17:11 noprompt: bendlas: me neither, i just blindly do what i'm told with regard to databases.

17:11 :)

17:11 rhg135: yeah I understand, but why does it work with -> and not ..

17:11 noprompt: bendlas: a few books i've read mention that it's a bad idea.

17:12 akhudek: hm, wait time is only 9ms as a static resource, the extra time must be coming from the middleware

17:12 hcumberdale: noprompt: blobs are the 'yes we can also store ... if we must' feature

17:12 akhudek: do you mean ring middleware?

17:13 akhudek: yes, the static file test was via a ring standard ring resource request

17:13 noprompt: i guess i'd be curious to know what you gain by storing an image in the db vs somewhere else.

17:13 bendlas: noprompt: OK, I'll have to agree, but not because of storage space, but because DB read capacity is a very scarce resource

17:13 with those legacy dbs that are not datomic ;-)

17:14 hcumberdale: Database & Images. What kind of data is an image? Binary not kind of reference-integrity dataset

17:14 akhudek: noprompt: it's for user uploaded content, so security basically

17:14 bendlas: s/not/only/

17:14 hcumberdale: File systems are there for a reason :)

17:15 Argument for images in a database: Single point of backup

17:15 bendlas: hcumberdale: +1

17:15 noprompt: hcumberdale: now that i will agree with. +1

17:15 hcumberdale: But the tradeoff is performance. Seen databases with thousands of big images. Unload takes 6 hours.

17:16 ->leads to bad user experience -> lower turnover

17:16 akhudek: in this case, backup + having all the data in a single place is very important

17:17 I'm not too concerned about the database latency at this point

17:17 znDuff: bendlas: ...Eh. Lots of ways to get read capacity if you don't need consistency guarantees.

17:17 hcumberdale: akhudek: Big problem is that databases are not made for such things

17:17 pimeys: well, at that point when you have 60 GB of data (text and numbers only) per day, you kind of appreciate that you're not storing images there

17:17 hcumberdale: big blob data may have a big influence on the overall performance

17:18 znDuff: with DB2/ORACLE? no way

17:18 bendlas: but I like my cosntinescy

17:18 <-- ;-)

17:18 hcumberdale: big argument :)

17:18 OE: ,(* 1 1)

17:18 clojurebot: 1

17:18 akhudek: hcumberdale: they typically have binary storage, though the serialization can be bad in large volume cases

17:19 OE: &(* 1 1)

17:19 lazybot: ⇒ 1

17:19 OE: what's the difference between clojurebot and lazybot?

17:19 bendlas: OE: creator

17:19 hcumberdale: akhudek: you're filling up the IO

17:19 bendlas: and , vs &

17:19 probably security

17:19 OE: i see

17:19 hcumberdale: so IO issues are a major prolbem

17:19 llasram: They're different codebases, altogether

17:20 noprompt: rhg135: can you repaste?

17:20 rhg135: yeah

17:20 kovas: hmm

17:20 hiredman: https://gist.github.com/hiredman/53f548674f05f007ee04 missing a port

17:20 znDuff: hcumberdale: Sure, there are asynchronous replication tools available for Oracle.

17:20 hiredman: whoops

17:21 rhg135: https://www.refheap.com/paste/11949

17:21 hcumberdale: If you have a pooled java connection and everything is read via, lets say "hibernate",... you'll live the dream of "IO-Big-Pain-In-The-Ass"

17:21 znDuff: hcumberdale: ...and read-heavy loads are actually a pretty good fit for RAC, if you've got that kind of budget.

17:21 noprompt: rhg135: i meant with the usage of ..

17:21 hcumberdale: znDuff: RAC :)

17:21 GridControl. RAC is buggy, too complex and so on

17:22 bendlas: See http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay

17:22 rhg135: just substitute the -> /w .. on line12

17:22 bendlas: for me sendfile() to offload to nic is the best argument for FS

17:22 kovas: hiredman: whachu working on?

17:22 znDuff: hcumberdale: I know RAC well -- once ran a RAC cluster on Gentoo, so had to deal with figuring out how to make everything work on an "unsupported" platform.

17:22 hcumberdale: ...but _did_ make it work in the end.

17:22 hcumberdale: +1 storing file paths in the database to be best

17:22 akhudek: hcumberdale: yes, there are scaling concerns, though in our case the security takes priority. All the data is in one place with clear backup/retention policies, and when a user deletes things the database will make sure that all owned data will be deleted.

17:23 hcumberdale: wow gentoo & RAC. never seen this before

17:23 akhudek: managing a multitude of files isn't without it's problems either

17:23 hcumberdale: managers won't sleep without their gold/silver support agreements

17:23 bendlas: well, I did a webservice that needs to store a couple of 100K jpgs now and then

17:23 I'm glad I stuck to DB for that

17:23 hiredman: kovas: I am working on work?

17:24 akhudek: you need to worry about the filesystem at some point, and tracking the files, and making sure that your database permission model is mapped over to the files correctly

17:24 hcumberdale: I do not like the requirement of using databases.

17:24 N1 for every JEE project: let's setup JPA and hammer against a database

17:25 akhudek: like the FS permission model thx to POSIX

17:25 Think about every linux tool needs a DB connection to run ;(

17:25 akhudek: hcumberdale: so you will create an actual unix user for every user record you have? And matain those across machines? And have the web processes using the right unix user?

17:26 sounds complicated :D

17:26 kovas: ah

17:26 bendlas: ... or create a PAM module for your app

17:26 akhudek: or that

17:26 hcumberdale: akhudek: depends on the needs and what your application/auth/authoriz concepts look like

17:26 PAM module :) nice try

17:27 akhudek: in any event, the database is fine for our needs at the moment

17:27 the 26ms is partly because it's going over a network to another machine in the test setup

17:27 I'm not too concerned with that, more the extra 1s coming from somewhere

17:27 hcumberdale: JDBC latency should be around 10 to 20ms

17:27 znDuff: hcumberdale: *nod*. I'm not a fan of using SQL databases where they aren't called for; just object to claim that async replication and load balancing based on same aren't available.

17:28 noprompt: anyone ever played with the shen language?

17:28 hcumberdale: znDuff: +1 ya

17:28 never heard of shen!

17:29 noprompt: http://shenlanguage.org/

17:29 hcumberdale: integrated prolog? runds 'under' clojure

17:29 Frozenlock: If I put a .png in the resources/public/img of a library, will it be available to compojure as a normal resource file?

17:30 hcumberdale: Frozenlock: depends

17:30 SegFaultAX: hcumberdale: Is your name a reference to Salad Fingers?

17:30 noprompt: someone mentioned it on twitter in response to a "i wish there was a clojure + haskell language"

17:30 hcumberdale: yes SegFaultAX

17:30 SegFaultAX: hcumberdale: Well done. Carry on. :)

17:30 Frozenlock: hcumberdale: ... on what?

17:31 hcumberdale: resources should be available in the classpath of your application

17:31 weavejester: Frozenlock: Yes, if they have the default resources route, although usually you want to "namespace" your library's resources.

17:31 hcumberdale: that shouldn't be a problem

17:31 so what do you mean by 'available'

17:31 weavejester: Like… resources/your/app/public/img

17:31 And then you could have a route or middleware to add them in

17:31 solussd: how do I pass a function to a macro and splice in its namespace-qualified symbol? e.g. (mymacro str) => (mymacroexpansion (clojure.core/str …))

17:31 hcumberdale: avaiable from the "public web" ? ;)

17:31 weavejester: See hiccup-bootstrap

17:32 bloop: I have little web development experience, but am trying to make a game on the web using Noir. I'm looking at html5 canvases. It seems like I would write the Jscript in a string in hiccup, like [:script "some javascript code"]. Is there a nicer way than this? Has clojurescript already been integrated in some way into Noir and I just haven't stumbled upon it?

17:32 Frozenlock: I'll take a look immediately.

17:32 thanks hcumberdale and weavejester :)

17:35 bloop: Don't use noir, it's deprecated. However you can use compojure with lib-noir.

17:36 hcumberdale: Frozenlock: +1

17:37 bloop: a better way: render JSON and write a js-client

17:37 maybe in clojurescript

17:37 Frozenlock: bloop: And the `javascript' part could be written in clojurescript, but be warned that getting used to the cljs environment can take a while.

17:37 * Frozenlock points towards #clojurescript

17:38 kaoD: and the cljs workflow is not too clean

17:39 Frozenlock: Let's be honest here. Goddamn awful.

17:39 bloop: Frozenlock: will you explain in more detail why it's preferable to use compojure + lib-noir than to use noir?

17:39 Frozenlock: But I prefer it to writing js :p

17:40 bloop: Noir is no longer maintained, so no more bug/security fixes, nor new features.

17:40 noprompt: bloop: because noir is deprecated.

17:40 kaoD: Frozenlock: hahaha

17:40 yeah, it's awful

17:40 bloop: Frozenlock: ok, thanks

17:40 Frozenlock: And unless I'm mistaken, the lastest version of Noir still have a security problem regarding *read-eval*.

17:40 arrdem: bloop: blog.raynes.me/blog/2012/12/13/moving-away-from-noir/

17:40 kaoD: I moved to CoffeeScript as a JS alternative and... oh wow!

17:41 hcumberdale: Frozenlock: JQuery, JQueryUI are nice for 'business applications'

17:41 others for games :

17:41 kaoD: I think Google Closure is the culprit of Cljs' awkwardness

17:41 hcumberdale: kaoD: share your exp

17:42 bloop: and if you use compojure you'll see that you just don't need noir

17:42 kaoD: hcumberdale: Coffee is fast enough to be compiled on the fly

17:42 so changes to .coffee files reflect immediately in JS

17:42 hcumberdale: syntax -> clean ?

17:42 works-on-every-browser-orama ?

17:43 bloop: hcumberdale: I see. that blog post is quite enlightening. I hadn't realized that Noir was just some glue and extra stuff that sometimes got in the way.

17:43 kaoD: Coffee's syntax ?

17:43 supersym: oh me 3 .. i am very fresh but comming from a coffee/node.js workflow, I find lisp so much more beautiful

17:43 kaoD: yeah, works in every browser, it's just a preprocessor

17:43 supersym: but some stuff seems a bit "awkward" indeed

17:43 hcumberdale: how's node.js?

17:43 kaoD: and syntax is like Python had a son with JS' and Ruby's semen

17:44 hcumberdale: never written stuff in it feels like having only one leg

17:44 kaoD: hcumberdale: well, I LOVE Node

17:44 the async paradigm is cool

17:44 supersym: Node is great.. its the JS verbosity I detest

17:44 kaoD: and the whole single-threaded thing is cool too

17:45 I mean, why care about threading ?

17:45 supersym: I totally agree, try CoffeeScript

17:45 supersym: but the significant whitespace gets boring too and always been fascinated by beauty of lisp..

17:45 kaoD: ahh

17:45 hehe

17:45 yeah

17:45 hcumberdale: is node.js only ss? or also available for cs?

17:45 kaoD: that's spot on

17:45 supersym: yesterday I did some ClojureScript with Node.js libs tho

17:45 kaoD: hcumberdale: ss cs ?

17:45 supersym: http://mmcgrana.github.com/2011/09/clojurescript-nodejs.html

17:45 hcumberdale: server side client side

17:45 kaoD: ah

17:46 node is just server-side

17:46 but JS is inherently client-side

17:46 it's JS, you know

17:46 supersym: its just a functional language

17:46 hcumberdale: remembering RINO,... what happened to RINO? ;)

17:46 kaoD: Rhino ?

17:46 hcumberdale: yap

17:46 supersym: browserify can also be used to port stuff from server -> client :)

17:46 kaoD: Rhino runs on JVM

17:46 THAT killed Rhino :)

17:47 hcumberdale: I <3

17:47 kaoD: supersym: I don't care about significant whitespace myself (in fact I like it to some extent) but I don't really like CS syntax

17:47 it's not very composable

17:47 hcumberdale: oOo clojure runs on JVM

17:47 kaoD: I might give CS forks a try, Coco looks GREAT

17:47 and LiveScript looks good to

17:48 hcumberdale: I'm a bit confused about all the JS stuff

17:48 brehaut: Roy is taking an interesting direction 

17:48 noprompt: kaoD: i've tried all three of those seriously. i liked live script the most.

17:49 roy is cool too.

17:49 kaoD: Roy ?

17:49 (googling...)

17:49 brehaut: http://roy.brianmckenna.org

17:49 hcumberdale: Yeah since .net isn't the favourite tool of M$ after all and javascript is the juice in windows 8 new js libs are growing everywhere

17:49 supersym: hcumberdale: they are all dialects that transcompile to JS

17:49 brehaut: staticly typed ML style language that compiles to js

17:49 supersym: but slightly different

17:49 kaoD: supersym: anyways, I think the main problem is the JS ecosystem itself, applying functions is awkward and it's very OOP-y

17:49 supersym: coffeescript is conservative compared to coco i guess

17:50 kaoD: yeah, coffee is VERY conservative

17:50 hcumberdale: kaoD: people said the same 'ecosystem' problem about java

17:50 supersym: I personally love that coffee has default .litcoffee support tho

17:50 kaoD: hcumberdale: yeah, and it still mixes bad

17:51 supersym: i like writing literate programs but it still has some caveats

17:51 hcumberdale: from coco github repo: "aims to be more radical"

17:51 supersym: KaoD: agrees

17:51 hcumberdale: like it from the first line on

17:51 brehaut: re:transpilers: https://twitter.com/PLT_Hulk/status/303858111939231744 https://twitter.com/PLT_Hulk/status/303859795306373120 https://twitter.com/PLT_Hulk/status/305331471768498177

17:51 kaoD: clojure works around that fact implementing its own functions

17:52 hcumberdale: kaoD: I wish I can get rid of the jvm :(

17:52 kaoD: hcumberdale: me too

17:52 I like it in some ways

17:52 but Lisp-like JS alternatives are not very good

17:52 hcumberdale: not only the startup time, also the uncontrollable gc

17:52 kaoD: cljs is awkward

17:52 supersym: they say its fast but i always tried to stay away from PHP and Java

17:52 hcumberdale: maybe cljs needs more time

17:52 supersym: yeah

17:53 kaoD: nah hcumberdale it's a basic problem... Google Closure sucks

17:53 hcumberdale: PHP is super awesome

17:53 supersym: so whats up with noir then? and lighttable

17:53 noprompt: hcumberdale: +1

17:53 PHP4ever

17:53 supersym: that raised like 300k at kickstarter

17:53 kaoD: if Cljs was more like a preprocessor...

17:53 and less like a compiler

17:53 brehaut: what the hell channel have i logged into by mistake

17:53 mrb_bk: brehaut: seconded

17:54 hcumberdale: PHP introduced the bad stateless web pattern

17:54 with the bad inconsistence loving mysql (myisam)

17:54 now everybody is declaring this as the best practices

17:54 dnolen_: kaoD: I don't think you understand the challenges a ClojureScript has compared to other compile to JS langs

17:54 supersym: you got it

17:54 hcumberdale: eventual consistent fast storage for web applications

17:54 dnolen_: comparing CLJS to CoffeeScript barely makes any sense

17:54 hcumberdale: stateless apps

17:55 noprompt: dnolen_: +1

17:55 supersym: http://www.paulgraham.com/icad.html

17:55 kaoD: dnolen_: no, don't get me wrong, I'm aware

17:55 mrb_bk: dnolen_: I would say it literally makes no sense

17:55 hcumberdale: PHP finishes after each execution (expt fastcgi modules)

17:55 kaoD: but understanding a problem

17:55 doens't make it less of a problem

17:55 right ?

17:55 brehaut: dnolen_: barely is charitable

17:55 dnolen_: kaoD: w/o Closure CLJS is a funny joke

17:55 noprompt: hcumberdale: "PHP is the Winchester Mystery House of programming languages."

17:55 hcumberdale: :) :)

17:55 kaoD: dnolen_: why ?

17:56 hcumberdale: I started with C and PHP for web applications

17:56 dnolen_: kaoD: 7000 lines of standard library plus a culture of macros

17:56 hcumberdale: It feels like nothing happened in years of software architecture

17:56 kaoD: ah, yeah, that's what I mean with "a base problem"

17:56 hcumberdale: Things that work are fast and easy to understand

17:57 EJB2, JPA, JSF and so on are a big pain-in-the-ass

17:57 dnolen_: kaoD: but there's no such things a preprocessor version of CLJS, the data structures alone represent 50% of the codebase

17:57 hcumberdale: They introduce unneeded overall complexity

17:58 kaoD: dnolen_: that's if I wanted Clojure-to-JS

17:58 I DON'T want it

17:58 because it brings that kind of problems

17:58 dnolen_: kaoD: yes a problem for *you* :) which is OK

17:58 Frozenlock: kaoD: let's hope for a clojure in clojure :p

17:58 kaoD: okay

17:58 you got all butthurt

17:58 hcumberdale: why is google closure used in cljs?

17:58 brehaut: kaoD: just use CPP then :P

17:58 dnolen_: kaoD: no feelings damaged here

17:59 kaoD: I hope so :P

17:59 noprompt: i'm sorry but coffeescript has lots of wacky grammar.

17:59 hcumberdale: Is there a public statement about why cljs is build the way it is?

17:59 kaoD: noprompt: yes it does

17:59 brehaut: hcumberdale: it does sophisticated code walking to determine what is or is not actually used and eliminates dead code from libraries

17:59 enquora: hcumberdale: it provides an existing optimization function that pre-exists clojure on the jvm.

18:00 mrb_bk: i think the guiding principles behind CLJS is confounding people, you know, to promote conversation

18:00 hcumberdale: brehaut: but it can be used optionally

18:00 brehaut: hcumberdale: it lets you use a massive standard library withut encessarily having a massive download

18:00 hcumberdale: ahh!

18:00 enquora: hcumberdale: because no-one wanted to rewrite it in clojure ;-)

18:00 Frozenlock: That could be useful for Clojure too...

18:00 mrb_bk: finally watched fogus's datalog talk, that was awesome

18:01 dnolen_: good stuff

18:01 hcumberdale: coco looks nice

18:01 mrb_bk: a good perspective on unify --> prolog --> datalog

18:02 rabbit_airstrike: mrb_bk: video link?

18:02 mrb_bk: cemerick: trying to get a buddy who lives in hadley to go to your meetup

18:02 rabbit_airstrike: http://www.infoq.com/presentations/Datalog

18:02 cemerick: mrb_bk: who?

18:02 hi, BTW :-)

18:02 mrb_bk: cemerick: hi! @akahn on twitter

18:02 oh no, he's in holyoke, same difference

18:02 noprompt: perhaps i'm becoming a smug lisp weenie, but syntax has slowly begun to annoy me.

18:02 cemerick: mrb_bk: there's good beer, cheese, decent salami, etc

18:03 mrb_bk: cemerick: yeah i'll try to push him to the next one

18:03 hcumberdale: but coco syntax looks like perll

18:04 last = -> it[*-1] function equals @@0 == @@1

18:04 :)

18:04 noprompt: like a lot of these new languages don't do anything but add cute short hand syntax without actually solving any real problems.

18:04 rabbit_airstrike: mrb_bk: thanks :)

18:04 noprompt: in fact, i'd be willing to argue they're just making more of a mess.

18:04 kaoD: noprompt: it's not that you're a Lisp weenie (you're, probably :P), Coffee took some really bad decisions (how it treats newlines, the only-nested-comprehensions, no object comprehensions, etc.)

18:04 and they're not willing to change at all

18:05 mrb_bk: sure thing rabbit_airstrike

18:05 Frozenlock: Hmmm.. not wanting to change a language?

18:05 noprompt: kaoD: yep. which is why i ended up using live script.

18:05 cemerick: mrb_bk: how much clojuring do you do, anyway?

18:05 supersym: noprompt: depends... a lot of progress is made with node.js/js client/server side

18:05 Frozenlock: *cough* #= *cough*

18:05 noprompt: kaoD: the guy working on the new cs compiler, in fact, told me to use livescrip.

18:05 kaoD: the CoffeeScriptRedux guy ?

18:05 mrb_bk: cemerick: i'm just a hobbyist. i've contributed to a couple OSS libs but haven't built much from scratch.

18:06 noprompt: kaoD: yeah. i got a chance to talk with him last year.

18:06 hcumberdale: livescript mhh!

18:06 brehaut: Frozenlock: readeval is bad

18:06 supersym: so many problems already solved: a lot of it is just require 'something' :P

18:06 noprompt: kaoD: he may have a different viewpoint now though.

18:06 hcumberdale: wow livescript syntax looks nice from the first view

18:07 mrb_bk: cemerick: i like it a lot though, it's the lisp i've used more than any other and it's helped me understand quite a bit of other stuff - mostly in it for the people though

18:07 noprompt: supersym: i was referring more to the compile-to-js langs.

18:08 kaoD: I want to try LiveScript but the Haskell-y syntax is taking me back from trying... and it inherits many CS flaws

18:08 noprompt: kaoD: just use cljs.

18:08 supersym: well.. my point would be that readability trumps here

18:08 noprompt: ha!

18:08 hcumberdale: I'll go to bed

18:08 good n9

18:08 noprompt: supersym: readability is a matter of opinion.

18:08 cemerick: mrb_bk: e.g. all the right reasons :-)

18:08 supersym: i guess so, if you put it like that :)

18:09 noprompt: supersym: i find lisp to be *very* readable. other just see line noise.

18:09 mrb_bk: cemerick: no doubt!

18:09 supersym: log = (args...) -> require('winston').Log 'info', args...

18:09 mrb_bk: cemerick: my turn! what's your main gig?

18:09 kaoD: noprompt: what about http://sibilantjs.info/ ? did you try it ?

18:10 supersym: yeah well im a newb to lisp/clojure/jvm but got about half-way koans now and have some nice stuff running already + piping vim clojure -> tmux

18:10 cemerick: mrb_bk: gotta run, meetup setup time :-)

18:10 mrb_bk: okay next time cemerick!

18:10 noprompt: kaoD: i've never seen that. i'll check it out.

18:11 enquora: what is advantage of LiveScript over Elm, if that isn't stretching the channel too far?

18:11 noprompt: i mean the cljs/clj combo has made me *extremely* happy.

18:12 and i've tried out so many of these damn things i just wanna settle on something.

18:13 enquora: noprompt: am flailing in the callback pit of hell which is raw/standard javascript at the moment and am hoping the cljs/clj will provide a ladder out ;-)

18:13 supersym: yeah...for me lisp is the crown jewel to master so this does feel like my path to take

18:13 noprompt: enquora: i've heard of something called a monad for that. but i, like so many, am eluded by monads.

18:13 auser: hey all

18:14 kaoD: enquora: why don't you try async-flow libraries ?

18:14 (though, TBH, I like the callback pattern)

18:15 noprompt: at the end of the day i want to be able to write code in a sane language that doesn't piss me off and make me want to give up on life.

18:15 enquora: kaoD: am moving to a reactive programming model asap, might as well do it all in cljs. Will need a wrapper for indexedDB, which is my current bugbear.

18:15 noprompt: clj pretty much gives me that hands down.

18:16 :)

18:16 enquora: kaoD: callback === goto. my cpu likes it, but I don't

18:16 kaoD: callback != goto

18:16 enquora: close enough

18:16 auser: I have a string I'm using split-lines on… I only want the first n lines, any ideas? (clojure noob)

18:16 kaoD: auser: (take n ...) ?

18:17 auser: yeah

18:17 that's what I'm looking for I think

18:17 noprompt: *steps off the soapbox*

18:17 kaoD: enquora: what's the difference between events + callbacks and reactive programming ?

18:18 enquora: under the hood, probably not much. On the surface, composability

18:18 brehaut: kaoD: roughly the same as iteration and comprehensions

18:18 same as the difference between

18:18 noprompt: it looks like i should be able to make it to clojure west.

18:19 could someone help learn me some monads.

18:19 seangrove: How does one use clojure.contrib map-utils?

18:19 Want to recursively merge maps

18:19 Seems like it's from 1.2 before things were split up, having a hard time tracking down contrib libraries

18:20 brehaut: noprompt: jimduey has a lot of stuff on clojure.net

18:20 noprompt: but the short version is that its roughly function application parameterised by a context / container type

18:20 Frozenlock: seangrove: https://www.refheap.com/paste/11953 If it can help...

18:21 kaoD: enquora: and what's helping you on reactive programming ?

18:21 brehaut: noprompt: but noone can tell you what monad is, you have to experience it for yourself

18:21 noprompt: brehaut: are they as important in clojure as they are haskell?

18:21 brehaut: sounds like lisp.

18:21 brehaut: noprompt: not remotely (directly anyway)

18:22 noprompt: for (list comprehensions) is implicitly a monad, as is core.logic

18:22 seangrove: Frozenlock: Yeah, that works, I'll just paste that in, thanks!

18:22 brehaut: noprompt: typically you want want anything like the state monad because you can just use a ref type (and some of the more recursive stuff doesnt work as well without pervasive tail call removal)

18:23 enquora: kaoD: am fussing right now with managing the callback stack for refreshing a dashboard page when contents that it displays exist in multiple other tabs that are changing. chained function calls would be rather nice.

18:24 brehaut: enquora: have you been using a Promise/A library?

18:24 kaoD: hmmm and did you choose tools already? I'm interested in the paradigm

18:24 noprompt: brehaut: i've read lots about them but i never see examples of doing something with and without them side by side.

18:24 enquora: kaoD: paper here explains the problem I'm wrestling with rather well, although in a different context: http://www.cs.umd.edu/projects/PL/arrowlets/

18:25 brehaut: noprompt: best not to start your monads journey with state, its a bit of a brain twister

18:25 noprompt: brehaut: i am ok with that.

18:25 brehaut: noprompt: the traditional place to start is the Maybe monad and List monad

18:26 noprompt: brehaut: should i dive back in to Haskell for that, or are the explanations in clojure?

18:26 brehaut: noprompt: haskell's type system make things quite crisp

18:26 noprompt: but i'd pick which ever you are more comfortable with

18:26 noprompt: i found writing the reductions by hand helped me a lot

18:27 noprompt: brehaut: well. i suppose i could start working with haskell again. it's been a bit though.

18:28 brehaut: haskell was pretty intimidating when i was doing OO, but i think i might be willing to give it another shot.

18:28 brehaut: noprompt: it will make you very concious of the function types which is valuable

18:29 noprompt: avoid the do notation though!

18:29 noprompt: brehaut: after working with clojure and a little scheme these past months, it's been in the back of my mind.

18:29 brehaut: noted.

18:29 brehaut: noprompt: do hides the big bag of functions involved

18:33 noprompt: brehaut: a big win i see with haskell is being able to understand academic papers a bit better.

18:35 enquora: brehaut: speaking of type systems, since Clojure is apparently one of its targets, have you used Shen?

18:35 noprompt: enquora: funny you should bring that up. i was just asking about it.

18:36 supersym: noprompt: lovely isnt it when pieces fall into plac3

18:36 noprompt: :)

18:37 enquora: noprompt: I have a need to generate robust PDFs using raw primitives and have been dreading it. a good type system might help ease the pain.

18:47 devinus: does clojure have a built-in exponentiation operator?

18:49 TimMc: Math/pow

18:50 It's a little verbose. :-P

18:50 Frozenlock: And not very clojury :(

18:51 amalloy: for integral powers the problem is too easy to deserve being in the standard library :P

18:51 rabbit_airstrike: someone else has already asked: http://stackoverflow.com/questions/5057047/how-to-do-exponentiation-in-clojure

18:51 amalloy: (defn pow [b n] (apply * (repeat n b)))

18:51 rabbit_airstrike: I'm kind of fond of the (reduce * (repeat n x)) solution, but I've used Math/pow when I've had to do it

18:55 dnolen_: a bit of a subtle victory but I'm excited about this change: http://github.com/clojure/core.logic/compare/374a8f4edf...042df72659

18:55 decoupling nominal stuff from CLP(FD) and any other constraint domains like it

18:56 rabbit_airstrike: I'm looking forward to the confo on core.logic next month :)

18:58 dnolen_: rabbit_airstrike: so am I!

18:58 noprompt: Math/pow

19:04 hiredman: cemerick: interactive-form in friend seems to only work for post requests, which seems kind of broken? if I make a post request to authenticate, and then using the cookies I got back make a get request it fails

19:05 supersym: ahh... now I get >>= and =<< in Haskell :)

19:10 bbloom: ibdknox: the commands window produces zero results when i type "client"

19:10 i didn't know how to connect, didn't think to try cmd+enter, wasn't sure what to do

19:11 only remembered to use cmd+enter after i saw your comment on HN

19:13 ibdknox: also, there is no pointer feedback in the command window, so i wasn't sure if i was clicking in the right spot & not all the commands have an obvious effect. like "Toggle Vim Mode". I wasn't sure if I should click, double click, press enter. or what

19:13 needs some visual feedback & maybe even show the state of the flag when toggling

19:13 ibdknox: also what? no visual block mode. boooo :-P

19:13 ibdknox: otherwise, looking sexy

19:14 ibdknox: appealing to the sublime text 2 crowd soon, i'm sure!

19:15 congrats on the release!

19:19 noprompt: wait. is there a new version of lightbox?

19:19 bbloom: lighttable

19:20 noprompt: whoops, i meant that.

19:20 bbloom: yeah:

19:20 http://www.chris-granger.com/2013/02/27/light-table-030-experience/

19:20 noprompt: sweet.

19:21 i hope one day i can replace vim with it.

19:22 supersym: i was hoping the same

19:22 oh.. a new post

19:23 noprompt: wait, vim keybindings? yes!

19:24 SegFaultAX: noprompt: Why would you ever want to replace vim?

19:24 Foxboron: bblom, seems too me they copied some sublime features :P

19:25 noprompt: SegFaultAX: honestly, i wouldn't. but if the light table team can pull of some of there ideas it'd but tough not to wanna use it.

19:25 s/there/their

19:26 ibdknox: will light table ever support something like :! ?

19:30 auser: has anyone here used clojure to talk to a google drive document?

19:30 noprompt: i think this is an interesting way to express exponents (reduce * (take m (repeat n)))

19:32 ,(time (Math/pow 2 10))

19:32 clojurebot: "Elapsed time: 10.415219 msecs"\n1024.0

19:32 noprompt: ,(time (reduce * (take 10 (repeat 2))))

19:32 clojurebot: "Elapsed time: 0.152463 msecs"\n1024

19:32 noprompt: huh. that's neat.

19:32 brehaut: noprompt: thats testing approximately nothing

19:33 noprompt: brehaut: could you explain?

19:33 brehaut: noprompt: JVM benchmarking is difficult because of hotspot's complex JIT compiler

19:33 noprompt: it recompiles a piece of code potentially many times based on runtime statistics to find the fastest possible version.

19:33 noprompt: brehaut: how do you test stuff like that?

19:34 brehaut: noprompt: you run it a bunch of times, a bunch of times

19:34 noprompt: interesting.

19:34 brehaut: someone wrote a lib

19:34 im blanking on who and what

19:34 mechazoidal: criterium

19:34 brehaut: mechazoidal: thanks

19:35 Raynes: brehaut: crit...

19:35 SegFaultAX: noprompt: Protip - you can tell repeat how many times ##(reduce * (repeat 10 2))

19:35 lazybot: ⇒ 1024

19:35 brehaut: https://github.com/hugoduncan/criterium

19:35 Raynes: mechazoidal: How dare you speak before I have spoken.

19:35 mechazoidal: revenge for having to beat my head against clj-native/jna all day

19:35 noprompt: SegFaultAX: thanks! that's a new one by me.

19:38 auser: or

19:38 noprompt: this lib is good to know about.

20:38 konr: Is there a better option than Heroku for hosting clojure webapps?

20:38 SegFaultAX: konr: Linode!

20:38 hiredman: aws

20:39 SegFaultAX: Rackspace.

20:39 hiredman: google app engine

20:39 etc

20:39 any place wars are accepted

20:39 openshift? that's a thing right?

20:40 konr: I think so! From Red Hat

20:42 SegFaultAX: It's probably pretty easy to get going with ElasticBeanstalk, no?

20:45 Pff, just upload a war file and press go from the looks of it.

20:49 Frozenlock: While we are on the subject of hosting, would any of those would recommended to host a webapp/mongodb ?

20:49 Clojure app, of course.

20:49 SegFaultAX: Frozenlock: All of them are applicable.

20:49 Except GAE probably.

20:50 supersym: is it me or does GAE seem to have some issues with moving certain things forward

20:50 konr: I think these drop-the-war hosting services would require additional an hosting service for the mongodb server

20:51 SegFaultAX: konr: Well for Elastic Beanstalk in particular, it's all just EC2+S3

20:52 konr: So you can always just spin up instances for your db, which is pretty easy.

20:54 Frozenlock: Rackspace: cloud database pricing: 512mb, 1 month, 43.80$. Wow... I was way of in my estimates...

20:54 *off

20:54 Oh wait, that's the RAM -_-

20:55 brehaut: ~ram

20:55 clojurebot: logic programming is the new monads

20:56 brehaut: O_o

20:56 SegFaultAX: Does that mean everyone is going to start writing about how core.logic and prolog are like burritos?

20:56 brehaut: bound to

20:57 Frozenlock: https://en.wikipedia.org/wiki/Random-access_memory

20:57 (if that's what you were looking for)

20:57 SegFaultAX: dnolen should make it happen.

20:57 brehaut: no.

20:57 SegFaultAX: And he should change his conj talk to burrito.logic.

20:59 brehaut: Frozenlock: http://i.qkme.me/35juyw.jpg

20:59 technomancy's gag

21:00 i was sure he had taught clojurebot about it

21:02 catgen: the light table ide project has an IRC channel?

21:15 ravster: I've got weird datomic output in my program. Could someone let me know what I'm doing wrong with my own query? tia --> https://www.refheap.com/paste/11956

21:23 bpr: ravster: i would recommend using ' rather than `

21:25 ravster: thanks bpr, had it that way since I was going to put an argument in the where clause , but then decided I'll take anything I can get.

21:25 Changed it. No difference to output.

21:28 bpr: ravster: what's your schema?

21:29 ravster: bpr: https://www.refheap.com/paste/11958 <-- :tag/category and :tag/sub_category, both strings

21:30 bpr: well, that's not the schema, but based on what you just said: the attributes are :tag/category and :tag/sub_category?

21:31 ravster: yup

21:32 bpr: ok, lines 16 and 17 of the first paste suggest that your :category and :sub_category are your attributes

21:32 not :tag/*

21:33 i can't help more than that b/c you're doing everything in functions that you haven't shown code for

21:33 ravster: https://www.refheap.com/paste/11959 <-- the tx that creates that schema.

21:34 bpr: ok

21:35 if dm/find-all is returning a seq of entities, then the way that you are making entities is not adding values for :tag/* to them

21:36 ravster: bpr: okay.

21:37 I just tried a query for all entities with a :db/ident attribute, and that returned a bunch of stuff, so I know the query is a working on.

21:37 *one

21:37 thanks, bpr

21:48 bpr: ravster: np, good luck!

21:50 ed_g: is there a way to estimate how much memory a data structure is using? I'm running out of memory and no idea why.

21:54 tomoj: any ideas of examples of what rich was getting at when he said we could do so much better than predicate dispatch?

21:59 gfredericks: I never know what anybody means when they make sweeping value judgments :(

22:03 ivan: ed_g: the JVM lets you use 64MB by default

22:06 ed_g: ivan: thanks -- I know how to increase the amount allocated. what I want to do is measure (or "profile") how much I'm using so I can improve the program. I'm looking for a space analogue of the "time" function.

22:07 ivan: if two persistent data structures share data, which one is using the space?

22:07 perhaps jvisualvm will point to something useful?

22:08 brehaut: ivan: i dont really know what you mean, but the new version points to the shared pieces of the old one, but its just pointers so thats really logical rather than physical

22:09 jemmons: Idiom question: In Other Languages, I often use a constant to represent keys to maps because I'm a horrible speller and this gives me compile time errors if I fat finger it. I never see this in clojure code. Keys are almost always just a bare keywords. How do you prevent yourselves from a typo in an assoc or get that leads to a tricky bug later on?

22:09 ivan: yeah, I'm trying to convince ed_g he wants the very-difficult-or-impossible

22:09 Frozenlock: Is there a way to get the version of a project, but from within? I was using a macro to get (System/getProperty "my-project.version"), but it doesn't work if the project is used as a library in another one :(

22:10 jemmons: REPL powaaaaa

22:10 brehaut: jemmons: you use :keywords and dont pretend you are writing code in a static language

22:11 jemmons: if you really wanted to be AR you could def vars to keywords, and the compiler would check it (because unquoted symbols must resolve at compile time) but thats not idiomatic

22:11 ed_g: I don't care if its not accurate in the presence of sharing. I just want to have some idea how much memory a list of hashmaps is using. my program is crashing from consing too much and I want it to stop crashing. should I install a java debugger?

22:12 brehaut: jemmons: a more idiomatic approach would be to use asserts or pre and post conditions to ensure that your code is doing what it claims to be doing

22:13 jemmons: brehaut: Very helpful. Thanks all!

22:15 brehaut: ed_g: my experience with OOMs in clojrue generally come from misunderstanding laziness semantics rather than anything else. holding the head of a lazy sequence can cause all the interim structures to be held too

22:15 ed_g: no idea if thats relevant to your program

22:22 ed_g: what if I need the data from the lazy sequence? does (lazy-seq '(1 2 3)) use more memory than '(1 2 3) once its "realized"?

22:23 brehaut: about the same, though i dont think lazy-seq does what you think

22:24 ed_g: in this case I'm using it to delay reading a file until the data from the file needs to be used.

22:24 brehaut: although by coincidence it does work there

22:27 ed_g: that sounds potentially squirrelly

22:27 ed_g: brehaut: can you explain why?

22:29 brehaut: depending how you pass the seq around, and what you do with the file, you could consume quite a bit of memory, and also lose a file handle that wont be collected

22:30 (typically you want to use with-open with files so that they are closed when they fall otu of scope, or alternatively you need to be clear and careful you close the file yourself. im pretty sure the IO lib does close files if the are GC'd but the lazy seq can prevent the final reference from dropping away)

22:30 ed_g: the file is read in one go inside (with-open ...) in the body of lazy-seq. (lazy-seq (with-open [file (open code)] (doall (readfile file))))

22:34 supersym: LightTable is so awesome... something like http://drbunsen.github.com/formd/ would be very cool for it as well, since Markdown will prolly remain a factor for a while :)

22:34 ed_g: but this goes back to knowing how much memory has been allocated -- if I can't measure, how can I possibly know the sequence has been used in the "wrong" way until the program crashes?

22:36 Frozenlock: supersym: death to markdown, long live org-mode!

22:36 tomoj: what is the difference between lamina's siphon and join?

22:38 aha! https://groups.google.com/d/msg/aleph-lib/y_M3CVpDyZE/zElylQYcSFoJ

22:39 supersym: Sorry I come from a vim world :p

22:39 I guess I could learn some emacs

22:41 Frozenlock: And you are already using clojure, so won't be horrified by all the parens :)

22:41 *you

22:42 cemerick: mrb_bk: now, you were saying? :-P

22:42 supersym: but with lighttable... its getting along nicely and prolly one day fully replace my vim and sublime...although the packages etc. that come with it..same goes for node.js as well: some libraries are just too juicy

22:42 tomoj: now to figure out what "bridge" means

22:42 supersym: ye

23:05 clizzin: when you lein uberjar, does the jar somehow know to run with the JVM opts specified by :jvm-opts in the project.clj?

23:06 or do the :jvm-opts only apply to when you use leiningen tasks like `lein run`?

23:09 auser: has anyone here used clojure to talk to a google drive documents/google api?

23:10 seangrove: If I add a dependency to my project.clj, is there a way to get it into a currently-running nrepl without killing the server?

23:10 Right now killing nrepl-emacs server buffer hangs emacs for a few seconds, which has been pretty annoying

23:10 Frozenlock: seangrove: you could try pomegranate

23:11 tomoj: ah, I just got the name 'pomegranate'

23:11 seangrove: Frozenlock: That looks pretty close to it, yeah

23:11 I'll give it a try next time, thanks

23:11 ed_g: by the way, I found what I needed with jconsole.

23:26 pppaul: OOMS?

23:32 Frozenlock: If I make a map {:a (some-fn) :b (some-other-fn)}, is it guaranteed that some-other-fn will be evaluated before the other one?

23:35 cemerick: Frozenlock: I wouldn't assume that at all.

23:37 Frozenlock: Yeah that's what I figured... However I suppose that (let [result-a (some-fn)] {:a result-a :b (some-other-fn)}) would do the job?

23:37 alandipert: Frozenlock: order is guaranteed for (hash-map :a (some-fn) :b (some-other-fn))

23:38 Frozenlock: (to the extent anything written on http://clojure.org/evaluation constitutes a guarantee, and it's probly not good if you depend on that behavior)

23:40 Frozenlock: Agreed..

23:40 tomoj: I think you should be able to depend on that behavior

23:41 Frozenlock: But the `let' would work, wouldn't it?

23:41 alandipert: for sure

Logging service provided by n01se.net