#clojure log - Feb 08 2015

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

0:00 julianleviston: OCCAM is an ugly language. It’s not self-similar enough. Function calls (and therefore value passing) would need to be along the same kind of chan idea. I need to think about this more.

0:01 alex1: yo fuck bois

0:02 anyone there?

0:03 montyxcantsin: don't let syntax obscure the essence

0:03 julianleviston: montyxcantsin: syntax is what I’m talking about.

0:03 montyxcantsin: the essence is good. Same as core.async.

0:04 montyxcantsin: the issue I have is with default syntax of most programming languages and the time models they encapsulate.

0:04 montyxcantsin: what we do often should be easier to do than what we do rarely.

0:05 montyxcantsin: and as it stands, we consistently bind instructing the computer that we want sequential processing with the same instruction as when we don’t care because we don’t have any other way to do it.

0:06 vas: julianleviston: your approach makes all the more sense as we approach the ability to quantum compute / settle a multitude of dissonant states into a harmony in a blink

0:07 montyxcantsin: yeah the essence I speak of with occam wrt your statement is that you have to explicitly declare SEQ if you want sequential execution PAR for parallel

0:07 julianleviston: The weird thing is, most people start out thinking that this way I’m describing *is* the way it works… we have to be “educated” that we’re giving the computer sequential instructions...

0:11 for example, in this: (let [a 10 b 20] (doall (doseq [num [a b]] (println num)))) I don’t happen to care what order the let binds its values. In fact, say I have 500 values to bind… then I’m quite happy for it to do it in parallel if it can… what I *do* care about is that the results are then printed in order, so I choose a vector for order, and execute a sequential operation over that vec. Say those values arnâ€

0:11 static, and they’re all the result of getting http requests, then I have different concerns such as contention, throttling, etc., which are expessible via core.async today, but the code to write it is clumsier than it *could* be. A better, more first-class syntax would make expressing the patterns and shapes of computation vastly easier.

0:13 hueyp: is pipe the correct method to apply a transducer to a channel? e.g. (async/pipe in (chan 1 xf))

0:13 ultimately I want to do into ... but async/into doesn't appear to take a transducer?

0:14 julianleviston: hueyp: I think it depends what you’re trying to do.

0:14 hueyp: here is the full ... (async/into [] (async/pipe in (chan 1 xf)))

0:15 julianleviston: hueyp: map?

0:15 into with map?

0:15 hueyp: don’t treat my comments as authoratitive, tho.

0:16 hueyp: having said that, I would use into and map.

0:16 hueyp: just the same as normal programming.

0:17 justin_smith: what do you think?

0:19 justin_smith: hueyp: in this case, pipe will be taking in, running f on each element, and putting it on an anonymous channel that nobody can ever read because it has no binding anywhere

0:19 hueyp: I doubt that is what you were intending to do

0:19 hueyp: pipe returns the out chan

0:19 justin_smith: oh, it does? I didn't realize

0:20 hueyp: ya, it works ... just seems weird that async/into doesn't take a transducer like core into

0:20 justin_smith: hueyp: but why not just async/map ?

0:20 hueyp: xf = (comp (drop 10) (take 50) (map :id))

0:20 justin_smith: (async/into [] (async/map xf in))

0:20 hueyp: sweet, lemme do that

0:21 justin_smith: oh, map takes a coll of chans

0:21 so it would be [in]

0:22 I still think (async/map xf [in]) is clearer than (async/pipe in (chan 1 xf))

0:22 julianleviston: justin_smith: that struck me as weird that it doesn’t follow the core map signature exactly.

0:23 justin_smith: as in one or more colls / (colls/chans)

0:23 hueyp: need to read async/map a bit, it is returning not what I would have expected ;p

0:24 justin_smith: hueyp: extra layer of colls around each element?

3:06 julianleviston: alandipert: ping?

3:37 hehe throwaway line in Micha’s part of the hoplon talk they did at clojure/west 2014: “Sequences get spliced in as children”… that’s what I’ve wanted in Om for ages.

3:38 https://www.youtube.com/watch?v=wVXjExRiFy0#t=1105

3:50 michaelr`: hmm hmm hmm

3:51 i don't get it, how are circle in their frontend code updating the state atom directly and getting the ui to refresh?

3:51 circleci

3:55 julianleviston: michaelr`: give me a context?

3:56 michaelr`: ie what are you looking at that you don’t get?

4:03 michaelr`: julianleviston: hi

4:05 If you start from here: https://github.com/circleci/frontend/blob/master/src-cljs/frontend/core.cljs#L302

4:05 continue through here: https://github.com/circleci/frontend/blob/master/src-cljs/frontend/core.cljs#L222

4:08 ggherdov: Hi. Say I have a PersistentTreeMap. I turn it into a PersistentArrayMap with sorted-map-by. Then, how do I get the first (top ranked) 10 key-val pairs?

4:08 Hi. Say I have a PersistentTreeMap. I turn it into a PersistentArrayMap with sorted-map-by. Then, how do I get the first (top ranked) 10 key-val pairs?

4:08 Hi. Say I have a PersistentTreeMap. I turn it into a PersistentArrayMap with sorted-map-by. Then, how do I get the first (top ranked) 10 key-val pairs?

4:09 michaelr`: julianleviston: and then here: https://github.com/circleci/frontend/blob/master/src-cljs/frontend/core.cljs#L133

4:10 julianleviston: they update the app-state atom directly and not through Om's transact! or update!, when you do it like that it won't trigger a refresh of the component tree.

4:11 So I wonder what's the trick they are using to do that and also get the screen refreshed?

4:11 julianleviston: ggherdov: can’t you just take 10?

4:11 ggherdov: sorry for repeating the question above, client problem

4:11 julianleviston: ggherdov: or am I misunderstanding?

4:11 ggherdov: julianleviston: ah probably

4:12 julianleviston: michaelr`: won’t it?

4:13 michaelr`: I didn’t realise they were using Om.

4:13 oh yeah, right :)

4:13 michaelr`: hmm

4:14 julianleviston: michaelr`: they don’t have an observer on it or something?

4:15 michaelr`: I thought transact! was for cursors.

4:16 michaelr`: no observers

4:16 julianleviston: michaelr`: and cursors maintain their own view into an atom, therefore updating the underlying atom should update the display too, right?

4:16 michaelr`: i think not..

4:17 if you use Om's interface through cursors to update the state then you get Om's functionality but otherwise not IMHO

4:18 I think maybe this is their trick: https://github.com/circleci/frontend/blob/master/src-cljs/frontend/components/app.cljs#L98

4:20 maybe not

4:20 :)

4:23 julianleviston: could it be nav-con/post-navigated-to! ?

4:27 michaelr`: i don't there anything which is supposed to trigger a refresh..

4:27 julianleviston: michaelr`: well there’s a put on some chan there…

4:28 michaelr`: I’m not familiar enough with the architecture to really know what I’m talking about

4:30 michaelr`: yes, it calls someting which calls something else, but I didn't find anything which causes a refresh of the ui :) the state updates are in the handler functions in the core namespace using swap!

4:31 julianleviston: michaelr`: but this is for the setup, so maybe it’s not sufpposed to update the ui>?

4:31 michaelr`: just guessing

4:32 michaelr`: what’s that main fn’s alt! doing?

4:33 michaelr`: waiting for stuff to arrive on multiple channels

4:34 julianleviston: michaelr`: yeah I know what alt! does lol… but you’re assuming a lot unless you know loads about the underlying architecture aren’t you?

4:34 michaelr`: you’re assuming they’re using cursors to update the ui, for example....

4:34 michaelr`: and yet, there’s a websocket channel involved…

4:35 michaelr`: I know in my app, I don’t use cursors to update the state… I update it with component local state over channels… the components themselves update it, based on input from channels.

4:36 michaelr`: so go look at one of their stateful components and see what it’s doing.

4:41 michaelr`: this might be a bit telling? https://github.com/circleci/frontend/blob/master/src-cljs/frontend/components/app.cljs#L97

4:44 michaelr`: I don’t really understand it.

4:44 michaelr`: sorry if I wasn’t any help.

4:49 Glenjamin: i can't seem to see anything which makes the app re-render when the state atom changes :s

4:50 unless everything just calls reinstall-om!

4:56 the app seems to just swap! the state atom, does om watch the atom you tell it to render?

4:58 michaelr`: https://github.com/omcljs/om/blob/master/src/om/core.cljs#L1161

5:06 ggherdov: I have a function with side effects that takes a number as argument. I want to evaluate the function as the body of an infinite loop, with the argument increased by one at each iteration. What's an idiomatic way to do it? I am not sure if reduce, list comprehension (for) over the list of numbers, while...

5:06 michaelr`: Glenjamin: hmm

5:07 julianleviston: ggherdov: try it out, then ask the question.

5:08 ggherdov: fair enough

5:11 julianleviston: Glenjamin: it calling reinstall-om! every time it needs to update seemed to be what it was doing to me, too… that seems very hackish tho… surely that’s not what they’re doing…

5:13 Glenjamin: julianleviston: reinstall is just for a full-rebuild, otherwise it relies on the add-watch in Om combined with swap! on the state

5:17 julianleviston: Glenjamin: ah ok...

5:18 Glenjamin: ah ok cool… I *thought* updating the state atom re-rendered. Good to know I wasn’t insane :)

5:27 kir: wondering if anyone can recommend some reading on the rational of declarative programming ?

5:29 The more theoratical the better, until now I've been let down by authors trying to 'save' me from the details

5:32 michaelr`: re

5:32 julianleviston: I think that this is exactly what Glenjamin is saying.. though I could not get it to work for me

5:33 julianleviston: michaelr`: ah… you’ve got the atom connected to the root?

5:33 Glenjamin: kir: try "out of the tar pit" perhaps

5:34 michaelr`: julianleviston: yes of course, is there any other way?

5:34 Glenjamin: The main desire with declarative is to separate "what" from "how"

5:34 julianleviston: michaelr`: and where are you doing the swapping? in or out of the render loop?

5:34 michaelr`: just wondering, I suppose. I have some swapping, which I do outside of it.

5:36 michaelr`: doesn’t the basic tutorial actually start with this? (goes to look)

5:36 kir: Glenjamin: Thx.

5:36 michaelr`: oh wait, I think I messed it all up

5:36 julianleviston: ooh it’s all different now! :) cool using figwheel…

5:37 michaelr`: ohh it was stupid me all this time ;)

5:37 julianleviston: yeah… herer’s the relevant section: “ If you change the value of the atom via swap! or reset! this will always trigger a re-render of any Om roots attached to it”

5:37 michaelr`: ah, ok phew :)

5:37 michaelr`: so updating the state atom directly does rerender the component tree

5:38 I was passing the state map instead of the state atom

5:38 julianleviston: michaelr`: it’s the first thing that it goes in to in this: https://github.com/omcljs/om/wiki/Basic-Tutorial

5:38 michaelr`: yeah I know, I just messed up the variables

5:38 julianleviston: soz :)

5:40 michaelr`: hmm, the tutorial has been updated some since I took it..

5:40 anyways, I think that doing the update/rerender thing this way might be a bit more expensive than when doing the same through transact! or update!

5:41 I think I read something about it somewhere simetime

5:47 sveri: Hi, anyone here using the system library from danielsz? I wonder how you declare the dependancy hierarchy? There is no example for this that I can find.

5:50 michaelr`: sveri: using component/system-using

5:50 system is a very thin wrapper around component

5:51 check the component docs

5:53 sveri: michaelr`: yea, I used component already, just wanted to make sure that I am not missing anything, thanw you

5:55 TBH I am not sure what the system library provides then besides prebuilt componentss

5:55 ?

5:56 kir: Glenjamin: 5.2.2 - re:"functionals" - this is what interests me. Thx for the valid reference.

6:04 expez: I want to search for <thing> followed by a \\b, this worked fine until <thing> started containing regexp meta characters. How can I combine the regex quoting of <thing> with the word boundary?

6:05 if I just do the quoting with java.util.regexp.Pattenr/quote and then append \\b before calling re-pattern it doesn't work

6:07 julianleviston: java.util.regex.Pattern/quote ?

6:07 expez: oh, sorry…

6:08 expez: are you using re-pattren?

6:08 expez: re-pattern

6:08 expez: julianleviston: (re-find (re-pattern "\\Q?>\\E\\b") "foo ?> bar") => nil

6:09 I'd like to match ?> but not foo?>

6:10 TEttinger: ,(re-find (re-pattern #"\Q?>\E\b") "foo ?> bar")

6:10 clojurebot: nil

6:10 TEttinger: hm

6:10 oh

6:10 ,(re-find #"\b?>\b" "foo ?> bar")

6:10 clojurebot: nil

6:10 TEttinger: oh!!!

6:10 ,(re-find #"\b\?>\b" "foo ?> bar")

6:10 clojurebot: nil

6:11 julianleviston: ,(re-find (re-pattern "/?>") "foo ?> bar")

6:11 clojurebot: ">"

6:12 TEttinger: woah, weird

6:12 ,(re-find #"\b\?\>" "foo ?> bar")

6:12 clojurebot: nil

6:12 julianleviston: hm

6:12 TEttinger: it works if it doesn't need the \b before a ?

6:12 ,(re-find #"\?\>" "foo ?> bar")

6:12 clojurebot: "?>"

6:13 TEttinger: I think it may be because ? itself counts as non-word, so " ?" is uninterrupted non-word

6:14 julianleviston: ,(re-find (re-pattern "\\?>") "foo ?> bar")

6:14 clojurebot: "?>"

6:14 julianleviston: stupid double-escapes

6:14 expez: well, I really need to regex quote that stuff because it can really be whatever combining the quote with word boundaries is beyond me

6:15 AeroNotix: > Wake up

6:15 > Regexp flood

6:15 > Go back to bed

6:15 julianleviston: AeroNotix: hehe soz :)

6:15 AeroNotix: julianleviston: jk :)

6:16 julianleviston: expez: This might help? ##(re-find (re-pattern (java.util.regex.Pattern/quote "?>")) "foo ?> bar")

6:16 lazybot: ⇒ "?>"

6:16 TEttinger: ,(re-find #"(?<!\w|\b)\?\>" "foo ?> bar")

6:16 clojurebot: "?>"

6:17 julianleviston: TEttinger: yeah but he wants to quote it, because the string isn’t under his control

6:17 TEttinger: yah

6:17 julianleviston: if I understand correctly

6:17 expez: ^

6:17 TEttinger: I have never used pattern quotes

6:18 julianleviston: I’m not really sure I understand them.

6:18 TEttinger: negative lookbehind may help too

6:18 expez: ,(re-find #"\b\Qqux\E\b" "foo qux bar")

6:18 clojurebot: "qux"

6:18 TEttinger: http://www.regular-expressions.info/lookaround.html

6:18 expez: ,(re-find #"\b\Q?>\E\b" "foo ?> bar")

6:18 clojurebot: nil

6:18 TEttinger: what is \Q...

6:18 expez: TEttinger: start literal text \E is end literal text

6:19 julianleviston: wow I’ve never heard of that before

6:19 expez: so it works when the literal text isn't something that would actually need escaping lol

6:19 it's what Pattern/quote produces

6:20 julianleviston: expez: um… why doesn’t it work then?

6:20 expez: julianleviston: indeed!

6:20 julianleviston: oh… coz of the \b

6:22 You want \B

6:23 maybe. lol

6:23 you prolly want whitespace, actually.

6:23 expez: yeah I think that's the problem because ?> aren't word characters

6:23 julianleviston: \b is word boundary, which assumes what’s inside it is a word

6:23 exacty

6:23 expez: ya

6:24 TEttinger: ,(map #(re-find #"(?<!\w|\b)\?\>" %) ["?> bar" "foo ?> bar" "foo?> bar" " ?> bar"])

6:24 clojurebot: ("?>" "?>" nil "?>")

6:24 julianleviston: expez: this site is quite useful, I always find myself there when doing regexp’s… http://www.regular-expressions.info/wordboundaries.html

6:24 TEttinger: this finds the ?> if it isn't preceded by a word character or a boundary character, which may be redundant

6:25 ,(map #(re-find #"(?<!\w)\?\>" %) ["?> bar" "foo ?> bar" "foo?> bar" " ?> bar"])

6:25 clojurebot: ("?>" "?>" nil "?>")

6:25 TEttinger: yup, not needed

6:25 for the other side...

6:27 ah, here we go

6:27 ,(map #(re-find #"(?<!\w)\Q?>\E(?!\w)" %) ["?> bar" "foo ?> bar" "foo?> bar" " ?> bar" "foo?>bar" "foo ?>bar"])

6:27 clojurebot: ("?>" "?>" nil "?>" nil ...)

6:27 TEttinger: ##(map #(re-find #"(?<!\w)\Q?>\E(?!\w)" %) ["?> bar" "foo ?> bar" "foo?> bar" " ?> bar" "foo?>bar" "foo ?>bar"])

6:27 lazybot: ⇒ ("?>" "?>" nil "?>" nil nil)

6:28 TEttinger: you may actually want \S instead of \w there if you expect unicode

6:29 julianleviston: . /Everybody stand back/

6:30 TEttinger: haha

6:31 hejki: for some reason I just got painful flashback from the days I worked as a fulltime Perl developer

6:33 TEttinger: it's really as close as programming comes to writing out magical formulae

6:34 julianleviston: BACK! ARCANE MAGE!

6:34 TEttinger: ...since you only have so many prepared spells a day, and re-reading regexes wasn't one of them

6:39 expez: going with this for now (re-pattern (str "(\\(?|\\s+)" (java.util.regex.Pattern/quote macro) "(\\)?|\\s+)"))

6:41 bleh, that's probably gonna miss a ton

7:47 imanc_: flattened nested sets - is this the optimal way of doing it? (set (flatten (map vec #{ #{1 2} #{2 3} #{3 4}})))

7:48 ,(set (flatten (map vec #{ #{1 2} #{2 3} #{3 4}})))

7:48 clojurebot: #{1 4 3 2}

7:55 shiranaihito: is this wrong: https://www.refheap.com/97043 .. ? -i'm getting a mysterious "nth not supported on this type: Symbol" .. but have no idea why

7:59 wjlroe: shiranaihito: the 4096 - is that supposed to be an argument to the Buffered Input Stream constructor?

8:18 krat0sprakhar: i have this question - how bad is it to loop/recur? Whenever I get frustrated with a problem on 4clojure, i just check map/reduce/etc and just use loop/recur to finish it.. but after that i end up feeling guilty.. :|

8:21 *is it to use loop/recur

8:28 shiranaihito: any idea what's wrong with this: https://www.refheap.com/97044 ? i get the same exception that happens when trying to extend a protocol to a byte array (in the same extend-protocol call as other types): "UnsupportedOperationException: nth not supported on this type: Symbol" - and it supposedly happens on line 16 (which is the first extend-protocol call)

8:29 i don't see a problem, and i've tried running it without the following byte-array extension, and without either one of InputStream or BufferedInputStream

8:29 ( sorry, my shit connection keeps dropping me :/ )

8:32 fnordsensei: imanc_: perhaps (apply clojure.set/union #{#{1 2} #{2 3} #{3 4}}) => #{1 2 3 4}

8:32 imanc_: fnordsensei: looks a lot neater

8:32 thanks

8:32 fnordsensei: No worries

8:39 shiranaihito: (nevermind, my syntax was messed up)

9:17 AeroNotix: uhm, how do you compile a jar for submission to a storm cluster?

9:18 The tutorials mention to keep the Storm jars as dev dependencies, but then I can't seem to compile the jar since storm is not available.

9:26 tcrayford____: krat0sprakhar: depends. I've only ever needed to use loop/recur for performance stuff, other than that I think you can do nearly everything with map/reduce/filter etc, but that might just be the problems I've run into

9:26 gfredericks: AeroNotix: perhaps you're using AOT and are not meant to be?

9:27 AeroNotix: gfredericks: Even the `lein new cookbook-storm-project` bare project doesn't create jars.

9:28 and the template project uses AOT on the Topology namespace.

9:28 gfredericks: I'm not very stormy so can't speculate beyond that

9:29 AeroNotix: rokay

9:29 I'll persevere

9:40 Integralist: Hi everyone. Any one know how I could resolve the following issue: https://github.com/mcohen01/amazonica/issues/119#issuecomment-73412979 I'm trying to access a AWS namespace but seemingly can't load it?

9:43 michaelr`: AeroNotix: you should put it in a provided profile

9:44 AeroNotix: like that: https://www.refheap.com/97045

9:46 AeroNotix: michaelr`: this gets me a bit further. Why is this not in any documentation?

9:48 michaelr`: could you show me the rest of the project.clj that your above paste comes from, please?

9:49 michaelr`: AeroNotix: https://www.refheap.com/97046

9:50 AeroNotix: thanks

9:50 michaelr`: AeroNotix: I think that's because the number of Clojure users of Storm is much smaller than Java users.

9:51 AeroNotix: michaelr`: that's a shame because Marz seems to be a big Clojure fan.

9:51 michaelr`: It's kind of a mainstream tool these days, and most of mainsteam is Java. Just the reality.. :)

9:52 AeroNotix: For sure

9:58 now it seems to try to load in the jar, but then crashes with: https://gist.github.com/AeroNotix/dd38afddfed2e16d8f44

10:00 michaelr`: make sure your version of storm is the same as the one you are using for development

10:00 also maybe look at nimbus logs

10:01 it fails to upload your jar

10:02 AeroNotix: cool, thanks

10:21 ggherdov: Hi. I need to profile a clojure program; what is the first tool I should try?

10:22 allen: Is it possible within a week to learn clojure web dev to the point where I can create a web app with thousands of pages with pdfs?

10:23 sort of like a comprehensive e-library project, but simple in design. The pages are part of a tree heirarchy and there are pdfs and articles categorized in each page

10:23 If I can do it in less than a week and have time to test it, then i'll proceed, or else i'll stick to rails and use clojure for another project

10:26 Integralist: Hi everyone. Any one know how I could resolve the following issue: https://github.com/mcohen01/amazonica/issues/119#issuecomment-73412979 I'm trying to access a AWS namespace but seemingly can't load it?

10:26 opqdonut: ggherdov: jvisualvm sampler/profiler

10:27 ggherdov: opqdonut: thanks, googling that

10:27 opqdonut: ggherdov: or if you can isolate the thing to profile into one function call, just use (time ...) in the repl

10:28 ggherdov: a fancier alternative to the time macro is the criterium library: https://github.com/hugoduncan/criterium

10:28 ggherdov: but jvisualvm can connect to a running application, which might be useful

10:30 ggherdov: opqdonut: I see

10:31 NewToClj: I there I have some java code which i struggle with to translating to clojure... it should be really simple with "doall" I guess? could you help me? http://pastebin.com/36hdfb17

10:32 gfredericks: NewToClj: doseq

10:34 * ggherdov ah cool, criterium is a port of the haskell library by bryan o'sullivan

10:43 opqdonut: ggherdov: indeed

10:47 NewToClj: gfredericks: I'm so confused... because if I want to cal a java method repeatedly in clojure i have to carry arround the instance im refereing to, all the way *_* , in my example case the "modelData" one, how do I do that?

10:52 gfredericks: NewToClj: (defn add-data-to-list [jl data] (let [model-data (DefaultListModel.)] (doseq [data-line data] (.addElement modelData data-line)) (.setModel jl model-data)))

10:52 i.e., use let

10:52 NewToClj: gfredericks: ah i see so i need acombination of let and doseq!

10:53 gfredericks: yep

11:00 michaelr`: anyone is sharing Bidi routes between Clojure and ClojureScript?

11:01 dnolen: ggherdov: Java Mission Control Flight Recorder is much nicer than JVisualVM in my experience and

11:01 michaelr`: I'm not sure how I could use the same routes to match requests in clj and generate service paths in cljs

11:01 dnolen: ggherdov: for serious profiling I haven't found anything better than YourKit

11:04 michaelr`: dnolen: hi, what are the downsides of updating the state atom directly with swap! instead of using transcat! in Om?

11:05 dnolen: michaelr`: less visibility about changes is all, at one point was thinking about deeper integration for transact!

11:05 michaelr`: however I'm pretty excited about the conceptual simplifications offered by Facebook Relay/GraphQL architecture

11:06 if the implementation difficulties to be sorted out Om will probably migrate to it instead

11:06 michaelr`: dnolen: no performance hits?

11:06 dnolen: michaelr`: in this future swap! vs. transact! becomes non-issue, because Om will likely not be involved in that question at all

11:07 michaelr`: no perf hit out of the box no, but transact! is a protocol, so it could have implications in more complicated contexts since someone may have introduced smarter logic and hid it behind transact!

11:08 michaelr`: dnolen: do you think that the API in Om would mostly stay the same?

11:09 dnolen: michaelr`: unlikely, but I'm not interested in breaking existing apps, so the new functionality will likely come along w/ a new API, probably in the form of a new type of compoents

11:09 s/compoent/component

11:09 michaelr`: I was actually thinking of a performance hit in the swap! case because of a full rerender instead of rerendering just what has been transacted. But I guess you are handling it in both cases with immutable data..

11:14 Glenjamin: dnolen: are you imagining some sort of "managed component" that delcares its data and lets the runtime go fetch/provide it & re-render as needed?

11:15 dnolen: Glenjamin: the intention is for the overall design to just be the same as that described by Facebook, with the details swapped out

11:15 Glenjamin: datalog for query lang, immutable entities for query results etc.

11:16 Glenjamin: do you intend to provide the normalisation/collapsing of queries into a single request payload, or will that be left to the implementor?

11:16 dnolen: Glenjamin: that part is trivial w/ datalog

11:16 Glenjamin: oh cool

11:17 and then implementing a server that speaks datalog is up to the user?

11:18 or would you aim to support datomic specifically?

11:18 dnolen: Glenjamin: the model is still useful locally, i.e. DataScript or any client side datalog-y thing

11:19 Glenjamin: the server side bit is really just out of scope, same as it is for FB

11:19 Glenjamin: makes sense

11:20 on an unrelated note, are you aware of any write-ups on clj/cljs/closure.clj aside from the inline comments?

11:20 dnolen: Glenjamin: writeups, like how it works?

11:21 Glenjamin: yeah - i'm thinking about an experiment to allow importing of commonjs modules

11:21 dnolen: Glenjamin: no closure.clj isn't documented beyond comments/docstrings, but it's also pretty simple

11:21 ggherdov: dnolen: thanks for the suggestions, will check Java Mission Control Flight Recorder and YourKit

11:22 Glenjamin: yeah, it seems fairly straightforward so far, i just need to get a handle on closure compiler itself

11:22 then hope that http://www.nonblocking.io/2011/12/experimental-support-for-common-js-and.html and http://javadoc.closure-compiler.googlecode.com/git/com/google/javascript/jscomp/ProcessCommonJSModules.html are still accurate

11:22 dnolen: Glenjamin: Closure has support for CommonJS Modules and AMD style modules, I've never looked at it, would be nice for someone to see how hard it would be to get it work work.

11:22 Glenjamin: that's my plan, yes

11:23 dnolen: Glenjamin: those are definitely still accurate, AMD & CommonJS support exists to this day, and I believe ES6 Modules also already work

11:23 Glenjamin: my current end-goal is to make it easy to use npm modules for browser-targetting cljs

11:24 hopefully i'll find out how feasible that is

11:25 via some sort of mapping of npm module -> namespace in the build config

11:25 dnolen: Glenjamin: that mapping should probably just be provided by :foreign-deps

11:26 Glenjamin: probably the only thing you want to do is supply additional :module-format #{:commonjs :amd}

11:26 Glenjamin: if this is supplied then move it into the build and configure Closure correctly

11:27 Glenjamin: sounds sensible, are foreign libs currently always included, or does the compiler wait until it sees a require for the provided namespace?

11:28 dnolen: Glenjamin: if you don't require it won't be part of the build

11:29 Glenjamin: ok, thanks

11:30 dnolen: Glenjamin: note not interested in anything actually to do w/ Bower/NPM here. Just CommonJS, AMD, ES6 Module compilation support

11:30 Glenjamin: yeah, would be compiler support for commonjs, then some lein plugin to bridge to npm

11:31 the tricky bit might be the node_modules/package.json assumptions in node-flavoured commonjs

11:32 dnolen: Glenjamin: cool a module enhancement patch would be extremely welcome

11:32 Glenjamin: yeah I'm personally not a fan of anything NPM-like for dependency management, it just doesn't work for ClojureScript or ClojureScript style libraries

11:33 Glenjamin: you mean the nested dependency tree stuff?

11:33 dnolen: Glenjamin: yes, because it doesn't solve any of the hard problems. In ClojureScript we've embraced custom data structures and these get passed around

11:34 Glenjamin: the NPM dep model doesn't fix anything at all here

11:34 in fact it's more busted

11:34 since it hides the depedency conflicts

11:34 and Maven won't let you pretend they don't exist

11:35 Glenjamin: well, if you stick to maps/vecs its fine - but yeah, Records/protocols won't work at all

11:36 having to do stuff like https://github.com/moment/moment/blob/develop/moment.js#L2151 is not great

11:36 shiranaihito: should i be worried about using protocols too much? :)

11:37 dnolen: Glenjamin: the NPM model is just an abomination, especially for any library that embraces custom data structures and uses them as currency

11:37 which is what Clojure does!

11:37 Glenjamin: i agree with the latter half of that statement :)

11:37 it also doesn't play nicely with lisp-style late-binding

11:38 dnolen: Glenjamin: there really isn't anything good about it IMO. I woud kill it in a fire if I could.

11:39 Glenjamin: the rough idea is produce something conceptually like "window.moduleA = require('moduleA'); window.moduleB = require('moduleB')"

11:39 expand that

11:39 then cljs can use the exported bits

11:39 so the what type of dependency-tree lives behind that should be irrellevant

11:43 paulswilliamsesq: Hi all, hopefully a quick question - how are people using selenium in clojure these days? It appears clj-webdrive hasn't had much activity over the last few months, and is at least incompatible with recent Firefox versions?

11:43 dnolen: Glenjamin: in anycase I commend the desire to open up more of the JS world to CLJS. But I suspect the CLJSJS model is likely going to win out in the end simply due to a lack of bundled externs for Bower/NPM and an inferior compression story.

11:44 gfredericks: dnolen: I haven't used npm but I've heard it lets you distinguish between public and private deps -- doesn't that resolve the "data structures as currency" tension? (i.e., use public deps for that)

11:44 and libraries that don't have those kinds of requirements can be "private" and thus have multiple versions at runtime

11:44 dnolen: gfredericks: no because you could still pass a data structure in

11:45 gfredericks: if everybody communicates with strings maybe you won't have this problem

11:45 gfredericks: :)

11:45 bbloom: dnolen: everyone communicates with json

11:45 and they still have this problem!

11:45 dnolen: lol

11:45 gfredericks: I'm not sure I understand the objection though -- how does this fall over if you "pass a data structure in"?

11:45 bbloom: npm is extra broken mascarading as fixed

11:45 Glenjamin: strings is a fairly good analog - npm modules are a bit like unix tools in that they have to communicate at a lowest-common-denominator interface

11:46 bbloom: gfredericks: it's like reloading a namespace in clojure w/ a typedef in it

11:46 er deftype in it

11:46 clojurebot: Excuse me?

11:46 dnolen: gfredericks: because that library uses a different version of the data structure via private dep

11:46 bbloom: you get two different versions of the type that respond to different instance? checks

11:46 dnolen: gfredericks: but it's interface doesn't prevent getting something that is actually a different version

11:46 Glenjamin: so you have to "just" not do instance? checks

11:46 gfredericks: dnolen: bbloom: so you don't use this approach for libs that define data types, is what I was suggesting

11:46 Glenjamin: and instead rely on structural typing

11:47 bbloom: well instanceof is just the case where you're going to break in an obvious and strong way

11:47 dnolen: Glenjamin: except immutable data structures don't have any structure you can rely on

11:47 bbloom: dnolen: Glenjamin: you'd have to add a "tag" field

11:47 dnolen: Glenjamin: structural typing only works if you like have both hands & feet tied to paraphrase Sam Tobin-Hochstadt

11:47 bbloom: like function PHM(...) { this.tag = 'PHM-v1'; ...

11:48 dnolen: bbloom: and pay for string comparisons

11:48 bbloom: and agree on tag name

11:48 Glenjamin: what is {:keys [a b c]} if not structural typing?

11:48 bbloom: yup

11:48 dnolen: Glenjamin: the structure of the underlying type isn't a part of that

11:48 bbloom: Glenjamin: explicit use of the associative/lookup type :-)

11:48 Glenjamin: if you use numbers, strings, vectors and maps only, it can work - i can see the argument that this is not enough

11:50 dnolen: Glenjamin: and we don't, we use sorted-sets, sorted-maps, priority-maps, AVL trees, RRB-Trees, CTries, 64 bit ints, BigDecimal ...

11:50 bbloom: it's even a problem if you use a closed set of types

11:50 you still have an open set of schemas

11:50 Glenjamin: right, but the schemas become your contracts

11:50 bbloom: and now you have to version your contracts!

11:51 gfredericks: is there a clear way to characterize what sort of library is safe to have multiple versions of?

11:51 bbloom: i'm not saying these problems aren't solvable. i'm just saying maven is doomed

11:51 and npm is double doomed

11:51 Glenjamin: i'm not saying its necessarily a better model, but i do think it's a tradeoff that has some benefits over one-version-of-each=lib

11:51 s/=/-/

11:51 bbloom: gfredericks: no, you'd have to characterize dataflow paths

11:52 gfredericks: bbloom: dataflow paths relative to a particular library in question?

11:52 Glenjamin: any lib that only takes core types and returns core types is "safe" i'd have said

11:52 and by "safe" i mean, won't break when you add another version elsewhere

11:52 bbloom: the problem is when some data from lib A goes to lib B and there's a dependency on the shape or type of that data

11:52 gfredericks: Glenjamin: I thought that too but it depends on usage of the things it returns and expects

11:53 bbloom: gfredericks: so you can use a lib in isolation & everything is fine

11:53 Glenjamin: ^^ yes, that

11:53 bbloom: ... until you pass a value returned from that lib to another lib that uses a different version

11:53 so there are ways you can say "this lib will never have a version problem"

11:53 gfredericks: bbloom: right; and if Lib A --depends--> Lib B, then Lib A should know whether its usage of B is safe & private, right?

11:53 bbloom: but to do so would be so restrictive as to be silly

11:53 dnolen: gfredericks: in theory with discipline data lib vs. "regular" lib (whatever that meanas) could work, but life is too short. By not using a NPMlike dep model you just don't think about it.

11:54 anyways, this solving problems you have created for yourself

11:54 Glenjamin: but in return, you have to think about your dependency tree more

11:54 bbloom: gfredericks: right but B is supposed to be abstract, so what if B uses A?

11:54 dnolen: Glenjamin: too bad there aren't really good tools for that?

11:54 gfredericks: dnolen: you're saying transitive dependency conflicts are not a problem?

11:55 Glenjamin: so for instance, you can't depend on any version of https://github.com/flatland/useful/

11:55 bbloom: brb

11:55 Glenjamin: or any sort of "generally useful" lib

11:55 dnolen: gfredericks: I can't remember the last time I used a dependency where I had this problem

11:55 Glenjamin: so as a result these don't exist

11:55 dnolen: gfredericks: but I'm also a heathen, every dependency is a liability

11:55 gfredericks: I hate dependencies

11:55 gfredericks: dnolen: we had an http dependency conflict at work just last week

11:55 bbloom: dnolen: that's not heretical to me

11:56 Glenjamin: my theory is that "i hate dependencies" is a symptom of the problem that npm attempts to solve

11:56 gfredericks: we just picked the older version and crossed our fingers

11:56 dnolen: Glenjamin: no I hate dependencies in NPM too

11:56 bbloom: but dnolen already knows i prefer manually vendoring jars and .min.js files

11:56 Glenjamin: haha

11:56 dnolen: I simply hate dependencies

11:56 I don't what language what tool what system

11:56 s/what/care what

11:57 Glenjamin: the only think i hate more than dependencies is large slow moving core libraries :D

11:57 dnolen: to mean the correctly model is the Global Namespace where you just use shit all locked to one version

11:57 aka Google Closure Library

11:57 AeroNotix: If you really want to hate dependencies you should try being an Erlang developer.

11:57 really get that hatred bubbling away

11:57 Glenjamin: i hear cabal hell is pretty bad also

11:58 gfredericks: dnolen: when you say "I hate dependencies" you're not saying "The solution is for us to stop using libraries" are you?

11:58 Glenjamin: dnolen: "correct" as in, "the best possible", or "the best today" ?

11:58 bbloom: gfredericks: more like "start copy pasting libraries"

11:59 gfredericks: haha I was just imagining tools for that

11:59 Glenjamin: isn't the npm-model just automatic copy-pasting?

11:59 hyPiRion: git commit -am "checked in source for lib x"

11:59 gfredericks: yeah what Glenjamin just said

11:59 AeroNotix: this is what Erlang does as well, effectively.

11:59 well, rebar.

11:59 it's tyranny, but mostly because rebar is dumb as a bag of rocks.

11:59 Glenjamin: https://github.com/jonase/eastwood/tree/master/copy-deps-scripts

12:00 https://github.com/jafingerhut/dolly specifically

12:00 copy-paste tooling

12:00 bbloom: gfredericks: gfredericks: no, b/c it copy/pastes multiple versions of the same lib

12:01 er gfredericks & Glenjamin

12:01 you both match /^g/

12:01 gfredericks: bbloom: don't you get the same effect if lib B and C both paste different version of lib D?

12:01 Glenjamin: well, at most 1 per "thing that depended on it"

12:01 bbloom: gfredericks: not if you copy paste in to the root

12:02 AeroNotix: opam tries to use a SAT solver to know whether the dependency graph is sound.

12:02 Glenjamin: bbloom: but only the application knows it is the root

12:02 or are you describing a tool we don't have yet?

12:02 bbloom: what you're doing when you depend on A and B and B both depend on C is you have a choice. you can say "i now depend on C" or you can rename C to A/C and B/C

12:02 the former is what maven does

12:03 and the later is what npm does

12:03 Glenjamin: right

12:03 hyPiRion: relevant: http://leiningen-vs-ant-manual.tumblr.com/post/107990906420/with-a-curse-he-dropped-the-spade-into-the-ditch

12:03 gfredericks: right, and copypasta can only do one of those two, right? can it do a third thing?

12:03 bbloom: gfredericks: copy paste can do any mix of either of those two things, but yeah, it can also do other things

12:04 Glenjamin: like lose the relationship between the source and result :D

12:04 hyPiRion: dependency resolution just seems to be a hard problem

12:04 gfredericks: bbloom: so what are you advocating for? being able to choose which you're doing, or for the third thing?

12:04 Glenjamin: hyPiRion: that's the part i think we can all agree on

12:04 * hyPiRion is taking the neutral stance.

12:04 bbloom: gfredericks: i have two positions: 1 for existing languages/ecosystems and another for some hypothetical design that doesn't exist yet

12:04 gfredericks: Glenjamin: hyPiRion: I dunno it sounded like dnolen thought it wasn't a hard problem and I was trying to figure out why

12:05 bbloom: in a perfect world, you'd have fucking considered versioning in your VM's binary interface

12:05 Glenjamin: i think because it is a hard problem we build libraries that skirt it, and if we had a better solution we'd have more smaller libs

12:05 bbloom: but basically the CLR is the only thing i know that even attempts to get binary compatability right beyond the JVM's "we won't break the byte code level"

12:05 aaanyyway

12:06 gfredericks: yes back to the first position

12:06 bbloom: for existing systems: i'm advocating taking dependencies via a package manager

12:06 and if anything goes wrong at all

12:06 vendor with predjudice

12:06 prejudice*

12:06 basically, do the simplest thing until it's annoying, then copy paste until your problem is solved

12:06 gfredericks: vendor in the app or in a library with its own deps?

12:07 Glenjamin: i guess in the maven model, you find out about clashes at "add-to-project" time, and in npm model you probably never find out

12:07 gfredericks: my understanding was that npm let you pick which style of dependency you wanted

12:07 Glenjamin: gfredericks: sort-of

12:07 gfredericks: and I say that with the least amount of authority possible

12:07 dnolen: gfredericks: hyPiRion: my point wasn't that it wasn't hard, rather when I find myself taking on a non-trivial dependency I nearly always a) audit it's dependency graph b) audit the source c) determine if it's wiser to just write this myself on existing JDK functionality

12:07 Glenjamin: peerDependencies doesn't work that well, and is being deprecated

12:07 gfredericks: oh

12:08 Glenjamin: dnolen: i think that's the most sensible approach, but i wish there were some mythical "better way"

12:08 dnolen: gfredericks: hyPiRion: my experience as Ruby & Node.js dev is that people include dependencies willy-nilly

12:08 and it just always leads to some kind of infernal hell

12:08 gfredericks: dnolen: is this when you're writing libs/tools/languages and not when writing apps?

12:09 dnolen: gfredericks: in both cases

12:09 gfredericks: not that auditing isn't important but rewriting/pasting isn't so useful at the app level is it?

12:10 dnolen: gfredericks: I didn't say anything about copy-pasting. Manual copy-pasting is fine by me.

12:11 AeroNotix: ((resolve (symbol "map")) println [1 2 3])

12:11 ,((resolve (symbol "map")) println [1 2 3])

12:11 clojurebot: (1\n2\n3\nnil nil nil)

12:11 AeroNotix: how does rewriting allow for the above to still work?

12:12 imagine a much more complex symbol than "map"

12:12 gfredericks: dnolen: okay I think I understand, thanks

12:12 justin_smith: AeroNotix: rewriting?

12:12 Glenjamin: https://github.com/jafingerhut/dolly i think

12:12 AeroNotix: as far as I understood rewriting would need to change the symbols/namspaces of things

12:13 gfredericks: AeroNotix: this is related to the deps discussion?

12:13 AeroNotix: gfredericks: yeah

12:13 gfredericks: AeroNotix: what does "much more complex symbol" mean?

12:14 AeroNotix: ,((resolve (symbol "clojure.core/map")) println [1 2 3])

12:14 clojurebot: (1\n2\n3\nnil nil nil)

12:14 AeroNotix: gfredericks: like that^

12:14 Glenjamin: any creation of a symbol name at runtime is hard / impossible to auto-transform to the new generated name

12:14 bbloom: so this dependency thing is actually yet another area where OOP seems like a solution, but really masks the problem

12:14 Glenjamin: eg. when using browserify it can detect require("abc") - but not require("a" + "bc")

12:15 bbloom: if you package up your objects w/ their code, you can get away w/ multiple versions of that object's type for a whole heck of a lot longer than you could otherwise

12:15 gfredericks: Glenjamin: when would this happen?

12:15 Glenjamin: gfredericks: var models = require.glob("models/*.js")

12:15 to which the solution is "don't do that"

12:15 AeroNotix: ewww it lets you glob requires?

12:15 How gross

12:16 Glenjamin: no, i made that up

12:16 AeroNotix: oh ok

12:16 Glenjamin: but you can write your own with readdir + require

12:18 felher: Hey folks. I know that most of the time keywords are used when other languages call for enumerations. My problem is that I have to write hundreds of lines of data of the form (SomeRecord. :type-a :group-b :attribute-c), (SomeRecord. :type-b :group-a :attribute-f) ... now keywords have the big problem as opposed to enumerations in languages like, say, java, that a typo (which surely will happen in a few

12:18 hundred lines) will not be caught because :type-a is as valid a keyword as :tpye-a is. Im currently using (def type-a "type-a"), (def type-b "type-b"), ... to get clojure to complain if I make a typo, but I wonder if that is the best approach. Any thoughts?

12:18 gfredericks: felher: I think the eastwood linter can help with that

12:19 it can check for keywords only used once

12:19 Glenjamin: unless you typo twice :p

12:19 gfredericks: yep

12:19 also: testing

12:19 Glenjamin: another option is to have some macro check names in dev mode

12:19 justin_smith: felher: you could have a wrapper on SOmeRecord. that has a whitelist of keywords and errors on invalid ones

12:19 gfredericks: add a contract so the constructor fns

12:20 (and don't use the record constructors directly)

12:20 Glenjamin: i quite like replacing the built-in ->SomeRecord

12:20 gfredericks: add a before-hook to it

12:20 felher: Okay, I like the eastwood-linter and contract constructor ideas both, thanks. :)

12:21 justin_smith: (defn make-some [& ks] (assert (every? #(contains #{:type-a :type-b etc.} %) ks) (apply ->SomeRecord ks))

12:26 Glenjamin: so, i did a quick bit of analysis on an npm-based JS project i have that contains an HTTP server and a React client application

12:26 https://www.refheap.com/97048

12:26 i'm unsure if that tells a good or a bad story dependency-wise

12:33 dnolen: Glenjamin: argh

12:33 felher: Okay, I think i'll use eastwood. Seems like it will give me a decent protection from typos in my case and doesn't require any new code on my part. Great, thanks. :)

12:35 Glenjamin: dnolen: yeah, this app is internal facing and we're optimising for "less code written", if it was customer facing I'd have been more careful when adding

12:36 I'm definitely not claiming everyone should do deps like that

12:50 dnolen: cfleming: Cursive macroexpander is nice thanks

13:28 ul_: did anybody use fsm/automata not only for parsing, but as app logic basis, with clojure?

13:31 fizbin: So I'm about to ask the standard most annoying question on any language's IRC channel: where can I go to get a taste of clojure that will excite me and make me want to learn more?

13:33 I'm an experienced java programmer who's been getting paid to develop python and haskell for the past year or two. I've also done a passable bit of scala, and lisp (well, scheme) back in college. Didn't ever work with CL or a lisp2 though.

13:33 justin_smith: fizbin: between java / haskell / scheme you'll pick it up very fast

13:33 dnolen: fizbin: if you liked Scheme & Haskell then you'll probably find Clojure plenty exciting - it borrows heavily from both

13:34 fizbin: The thing I liked most about scheme was call/cc...

13:35 justin_smith: fizbin: depends what you are interested in / what would motivate you. There are amazing things happening with cljs and native stuff via om/react on IOS for example

13:35 fizbin: yeah, we don't have that :)

13:38 amalloy: fizbin: for an interactive low-setup taste of the language, you can try 4clojure.com

13:42 apiology: fizbin: These might be relevant: http://thechangelog.com/rich-hickeys-greatest-hits/

14:14 imanc_: ,(Math/sin 1)

14:14 clojurebot: 0.8414709848078965

14:14 imanc_: ,(Math/atan2 90)

14:14 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: atan2, compiling:(NO_SOURCE_PATH:0:0)>

14:14 justin_smith: ,(Math/atan2 90.0)

14:14 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: atan2, compiling:(NO_SOURCE_PATH:0:0)>

14:14 justin_smith: hrmph

14:14 imanc_: how come the java docs show an atan2 method, but I can't acces it?

14:15 http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html

14:15 justin_smith: oh

14:15 ,(Math/atan2 90.0 0.0)

14:15 clojurebot: 1.5707963267948966

14:15 imanc_: oh

14:15 I'm seeing: No matching method: atan2, compiling:

14:15 justin_smith: converts x/y coords to angle theta

14:15 gfredericks: ,(Math/atan2 90.0 0)

14:15 clojurebot: 1.5707963267948966

14:15 gfredericks: ,(Math/atan2 90 0)

14:15 clojurebot: 1.5707963267948966

14:16 gfredericks: I dunnos

14:16 justin_smith: imanc_: how many args are you providing to atan2?

14:17 imanc_: justin_smith: that was it! I had the args wrapped in a list, for some reason

14:17 justin_smith: aha

14:17 imanc_: So presumably it checks the arity of the func or something? But surely that would give a "incorrect arity" error hmm

14:17 gfredericks: it gives the same error no matter what sort of problem it is

14:18 justin_smith: imanc_: I have never seen "incorrect arity" as an error for a java method call

14:18 imanc_: so the arity error only happens for clojure based funcs?

14:18 justin_smith: imanc_: and think of how hard that would be in general - how do you know the arg count is wrong, instead of the type?

14:18 gfredericks: imanc_: yes

14:18 justin_smith: I mean you could do reflection but these things get complicated

14:18 imanc_: yeh, agreed

14:19 gfredericks: if it showed all the possible sigs that'd be nice

14:19 could do that with ex-info

14:19 justin_smith: in clojure we only do overloading of functions on arity

14:19 so that's easy to establish

14:19 gfredericks: I too often have issues with ex-info display though :/

14:19 justin_smith: gfredericks: yeah, do some reflection on error...

14:19 gfredericks: justin_smith: well I think this exception happens when it's already doing reflection

14:20 either that or it happens at compile-time

14:20 justin_smith: hmm, yeah

14:20 gfredericks: "No matching method" is always thrown from some kind of reflecty context I believe

14:22 imanc_: I find clojures errors quite challenging at times

14:22 justin_smith: imanc_: yeah, they are really weird until you learn more about the implementation

14:22 gfredericks: there are a variety of causes for that feeling

14:22 justin_smith: and even then they can still be weird sometimes...

14:23 and it doesn't help that some errors have bugs in the error message generation

14:23 imanc_: ha ha

14:23 jeez

14:23 justin_smith: ,(into {} '(([1 2])))

14:23 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>

14:23 imanc_: hopefully things will improve

14:23 justin_smith: that message is buggy^

14:23 in fact, PersistentVector is the one thing that could have worked, but it got a listy thing instead

14:24 ,(into {} '([1 2]))

14:24 clojurebot: {1 2}

14:24 imanc_: so does tracing these errors sometimes involve devling into clojures java code?

14:24 justin_smith: imanc_: more often just having a good idea of what clojure was doing when it hit that error

14:45 eg. with the vector cast error, into {} will expect the arg to be a sequencable where each element is a two element map$entry, or a vector which can be cast to map$entry

14:47 can-of-bees: hi all. i'm hung up on getting xml written to a file. i have a pastebin (http://pastebin.com/z67S8xbM).

14:48 i can get (xml/emit (tagsoup/parse-xml "my-file.xml")) to print the corrected XML to the REPL but the function i've tried writing (@ line 8 in the paste) doesn't seem to work.

14:49 apologies if you're seeing this question again :)

14:51 justin_smith: can-of-bees: can you use (.getStackTrace *e) after the NPE on line 21 so we can see the actual stack trace?

14:51 can-of-bees: sure thing justin_smith

14:51 thank you

14:53 justin_smith: i probably did this wrong but here's the output from the REPL: => #<StackTraceElement[] [Ljava.lang.StackTraceElement;@4aeb8b6c>

14:53 gfredericks: good ole' error code 4aeb8b6c

14:53 justin_smith: oh, sorry

14:54 I meant (.printStackTrace *e)

14:54 that will work as long as that error was the last one

14:54 (inc gfredericks)

14:54 lazybot: ⇒ 117

14:55 gfredericks: clojurebote: 4aeb8b6c is java.lang.WingsFellOffException

14:55 clojurebot: 4aeb8b6c is java.lang.WingsFellOffException

14:55 clojurebot: A nod, you know, is as good as a wink to a blind horse.

14:55 justin_smith: gfredericks: clojurebote is clearly clojurebot in doge form

14:55 gfredericks: agreed

14:56 can-of-bees: i just updated the pastebin: http://pastebin.com/z67S8xbM

14:56 justin_smith: such sandbox, many exception, wow

14:56 * clojureboat is sailcljing

14:58 amalloy: isn't the problem that .emit writes to *out*, returning nil, and then you try to .write nil to that writer?

14:59 justin_smith: amalloy: oh, that would do it, and also explain all that xml printing

14:59 weird

14:59 so you could do (binding [*out* wrt] (xml/emit ...))

15:00 https://github.com/clojure/clojure/blob/master/src/clj/clojure/xml.clj#L111

15:00 (inc amalloy)

15:00 lazybot: ⇒ 223

15:01 can-of-bees: yeah, sorry. i'm kinda jumping in head first here and so i don't know exactly what i'm doing. the (defn write-xml-file...) is based off of another "write a file in clojure" thing i found from Beacon Hill.

15:01 so i'm floundering around in maps and vectors and whatnot.

15:01 justin_smith: can-of-bees: amalloy is right, emit prints to *out*, so if you use binding *out* as above, or use with-out-str to capture the string, that should work

15:01 can-of-bees: no, wait. those are just vectors.

15:02 justin_smith & amalloy - thanks for the pointers. i'll try again.

15:02 justin_smith: can-of-bees: that's why your xml was being printed, I should have thought more about that weird part of it

15:03 can-of-bees: yeah well :) i thought it was great when i got it to print.

15:03 justin_smith: haha

15:07 r7s: hi, I have a problem with cljfmt: I added it to my ~/.lein/profiles.clj (and to my project.clj, too) as a plugin, but it's not in the classpath and when I try to use vim-cljfmt, it throws "FileNotFoundException Could not locate cljfmt/core__init.class or cljfmt/core.clj on class path: clojure.lang.RT.load (RT.java:443)"

15:07 what am I doing wrong?

15:07 justin_smith: r7s: can you share the relevant part of your profiles.clj?

15:08 r7s: justin_smith: sure, do you mind if I paste it here? it's four lines long

15:08 justin_smith: ehh, I have no idea what the cutoff is

15:09 r7s: I'll just use gist then ;)

15:09 https://gist.github.com/ravicious/21f526ce43a2734a2ab7

15:10 justin_smith: r7s: are you able to call the plugin directly from the command line inside your project?

15:10 eg. "lein cljfmt check"

15:10 r7s: yes, I can run `lein cljfmt check some_file.clj` and it works just fine

15:11 justin_smith: r7s: aha, vim-cljfmt wants to do the formatting from the repl

15:12 r7s: so it needs to be added under dependencies, not plugins, for that to work

15:14 r7s: justin_smith: you're right! it works now, thanks

15:14 but doesn't that mean that I have to add it as a dependency to each project I want to use it with?

15:14 justin_smith: r7s: :dependencies in profiles.clj

15:14 r7s: oh, cool

15:15 thanks once again! :)

15:15 justin_smith: (this is where I put pallet/alembic for adding deps at runtime)

15:15 which I highly recommend :)

15:15 r7s: I just started doing Aphyr's guide and I was struggling with one of the exercises from 6th post and I thought that having a good code formatting may help a little

15:18 justin_smith: r7 which post is that?

15:22 r7s: justin_smith: https://aphyr.com/posts/306-clojure-from-the-ground-up-state

15:32 danielsz`: dnolen: I've been playing with the mixin example. It looks like you need a backing component, right?

15:33 dnolen: danielsz`: I don't know what you're talking in this context

15:33 danielsz`: dnolen: https://github.com/omcljs/om/blob/master/examples/mixins/src/core.cljs

15:34 dnolen: MyComponent looks like the backing component.

15:35 dnolen: danielsz`: ah right, I haven't tried that example in a long time, hopefully works

15:36 danielsz`: dnolen: It works. But what I can't figure out is how to call a function defined on the mixin from a child.

15:36 dnolen: danielsz`: it'll be on the owner

15:37 danielsz`: there is no mixin bridging, but things are decoupled enough you should be able to solve that problem yourself

15:39 can-of-bees: justin_smith & amalloy - folks, thanks again for your help. i don't think i would have ever figured that out by myself.

15:39 the (with-out-str...) works great, at least in my little test.

15:39 really appreciate the help.

15:41 danielsz`: dnolen: If I may step back a little bit. React has no story for touch events. There is tap event plugin, but I have no idea how to integrate it with om. https://github.com/zilverline/react-tap-event-plugin

15:41 dnolen: I thought maybe mixins would help.

15:42 dnolen: danielsz`: I can't really help much here, I've never tried that

15:42 danielsz`: dnolen: I've been trying out all sorts of things for the last two days. I haven't made much progress.

15:43 dnolen: danielsz`: I don't know anything about that plug, nor how it works etc.

15:43 danielsz`: dnolen: I saw one approach that looked promising. It's the last answer on a stack overflow page. http://stackoverflow.com/questions/24335821/can-i-fastclick-reactjs-running-in-cordova

15:43 dnolen: It involves mixins.

15:43 dnolen: danielsz`: I also thought React Addons had some utilities for touch events

15:44 danielsz`: dnolen: Nope.

15:44 dnolen: danielsz`: ok, then yeah I have no suggestions really

15:44 danielsz`: you might just want to drop down to the real touch events

15:46 danielsz`: dnolen: Yes, that would work. But then mixin bridging would be helpful.

15:47 dnolen: Would a custom descriptor work instead?

15:48 sveri: Hi, Is there a way to combine the components reloaded workflow with dynamic vars? I explained this in more detail here: https://groups.google.com/forum/#!topic/clojure/9oAxIhBzW0Y

15:49 dnolen: danielsz`: probably, but again you're asking someone who has never tried what you attemped

15:49 danielsz`: you might want to ask on the ClojureScript mailing list for other approaches

15:50 danielsz`: dnolen: Will do, thanks.

16:56 cfleming: dnolen: Great. I need to implement it for CLJS next.

17:34 ticking: hey has anybody experience with the boot build tool? I wonder if the build.boot name is hardcoded for the default build script. I'd like to rename it to something.clj so that the tools I use recognize it as clojure

17:41 martinklepsch: ticking: I don't think that's possible right now. you can track this issue for now: https://github.com/boot-clj/boot/issues/105

17:41 ticking: I'd recommend setting up your editor to recognize .boot as clojure files

17:41 ticking: martinklepsch: yeah after looking into the source I realized that as well

18:18 notbrent: hey folks, i recently started to help organize the vancouver clojure meetup (canada, not the washington one beside portland), and i'm trying to bring it back to life after two years without events. if anyone is interested in giving a talk over google hangouts sometime we'd love to have you. our first meetup since the revival was on thursday and had about 25 attendees, plenty of people who are passionate about clojure for a smal

18:19 feel free to send me an email at brentvatne@gmail.com if you might be interested. unfortunately we don't have any sponsorship at the moment so we can't really offer any kind of reimbursement, but it could be a great way to get your project some exposure or get feedback on some ideas you're working on

18:19 or just message me here, that works too

18:40 underplank: Hi all. Im doing some unit tests with clojure.test, and I need to compare a list of maps, but one of the keys I want to ignore. Is there a generic way to do this?

18:41 martinklepsch: underplank: dissoc before comparing?

18:41 don't think there's a generic way

18:42 underplank: right. That might have to do. dammit, its a couple of levels deep and in a couple of different places.. grrr.

18:43 martinklepsch: underplank: update-in & dissoc then I guess

18:44 underplank: yeah… Just seems like a handy function to have “Hey compare these two complex data structures but ignore these keys”..

18:45 amalloy: that is a pretty specific thing to want. an alternative possibiility, if you control creation of hese things, would be to smuggle in whatever you don't want counted for equality as metadata

19:21 AeroNotix: grr my previously working protobuf stuff now mysteriously fails to compile

19:35 ggzmask: is there any AABB collision library for clojure?

19:52 justin_smith: ggzmask: wouldn't it need to be very specific to a particular data structure representing the data, and thus more likely to be bundled as a more general 3d geometry package?

19:52 also, I doubt a clojure version exists, but a java one is probably out there somewhere

19:53 ggzmask: yea, I know things like Jbullet etc. are there... too lazy I guess... Will just work the interop :<

19:57 underplank: So I ave two components (in the stuart Sierra component sense). The top level one creates multiple bottom level ones. The bottom level all rely on a common atom to keep a counter and increment it. This causes a circular dependency AFAICT, which I dont like. Any tips of removing this dependency?

20:00 This causes the Circular dependency because at instansiation time at the moment they get the atom from the top level component. So top instansiates-> bottom which requires something from -> top

20:00 justin_smith: how is that circular?

20:01 underplank: yeah I think I just worked it out that it isnt. They do rely on each other, but because it isnt something requiring something which requires somethig from the first, then its actually ok.

20:09 justin_smith: one is on a "higher level" - can both pass something to the lower level, and have a reference to that lower level created with that parameter

20:11 now if they each needed full reference to the other, that would be circular

21:48 sdegutis: Does ClojureScript run on node.js yet?

21:48 I mean the compiler.

21:49 julianleviston: https://github.com/clojure/clojurescript/wiki/Quick-Start#running-clojurescript-on-nodejs

21:50 sdegutis: That's what I found, which makes it look like the answer is "yes", but I remember reading that it's not yet supported the other day in IRC?

21:50 Something about how there's still some work to be done?

21:50 So I'm confused by the conflicting things.

21:51 julianleviston: sdegutis: did you try it?

21:51 sdegutis: No, I am researching to see if there are any unfinished aspects of it first which I wouldn't notice by trying it.

21:52 So far, I can't really tell if there would be any difference between running it this way vs running it via `lein cljsbuild once`

21:52 *between compiling it

21:52 etc

21:52 clojureboat: isn't that link about just using node at runtime?

21:52 sdegutis: Oh. I don't know.

21:52 julianleviston: clojureboat: no.

21:53 clojureboat: oh hey I'm still clojureboat

21:53 sdegutis: uh

21:53 julianleviston: sdegutis: http://clojurescript.net

21:54 sdegutis: julianleviston: I remember hearing that REPL is broken or something?

21:54 gfredericks: julianleviston: it uses cljsc, which is the script that launches the jvm afaik

21:54 sdegutis: Ah.

21:55 gfredericks: the only reference I see on that page to compiler platform mentions the jvm

21:55 julianleviston: gfredericks: thanks

21:57 I’d be surprised if macros didn’t still require CLJ tho

21:58 gfredericks: julianleviston: which is because the compiler is still on the jvm

21:59 sdegutis: I really really liked how my ClojureScript ReactJS app is turning out, but I really don't like that it depends on the JVM. So that's why I'm looking into this node thing.

22:00 julianleviston: sdegutis: but it doesn’t, does it? just the dev process depends on it

22:01 sdegutis: yeah, you’re right. It still depends on clojure, ergo the jvm: https://github.com/clojure/clojurescript/blob/master/project.clj

22:01 sdegutis: julianleviston: okay

22:02 julianleviston: sdegutis: Why are you so jvm averse?

22:02 (for dev)

22:02 sdegutis: julianleviston: I probably don't have good reasons

22:02 julianleviston: haha :) ok.

22:11 ibash: sdegutis: what are you using for your clojurescript reactjs app — om?

22:11 sdegutis: reagent ibash

Logging service provided by n01se.net