#clojure log - Mar 05 2015

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

0:01 tomjack: 75% using transduce over a line-seq

0:01 I expect that not having any seq at all (transducing over a lines reducer) would be even better

0:02 (transducers do not make reducers entirely obsolete, just the reducer transformer functions)

0:03 justin_smith: yeah

0:03 75% sounds about right for that change, yeah

0:03 (inc transducers)

0:03 lazybot: ⇒ 2

0:04 tomjack: (inc justin_smith)

0:05 lazybot: ⇒ 205

1:00 rpaulo_: any ideas when the final 1.7.0 is going to be released?

2:03 tomjack: rpaulo_: no, but I think a beta usually comes after the alphas? so probably not very soon, I suppose

5:14 gphilipp: @hi

5:15 I'd like to create a dynamic var which I could change with set! (similar to *print-length*)

5:15 when I do so, i have the following error : IllegalStateException Can't change/establish root binding of: *auto-layout* with set clojure.lang.Var.set (Var.java:221)

5:16 what am I doing wrong ?

5:20 nsjph: oh

5:20 need to set it to be dynamic

5:20 but

5:20 you might prefer to use an atom instead

5:20 try something like (def myvar (atom "blah"))

5:20 (reset! myvar "somethingelse")

5:22 you can also use swap! on an atom

5:27 hyPiRion: gphilipp: you need to do (binding [*auto-layout* value] ... (set! *auto-layout* value2))

5:28 If you wonder why: My guess is that it's because setting a root binding isn't thread-safe. Setting a non-root is, because it's a thread local.

5:28 nsjph: dynamic vars was one of the very first things i tried to do in clojure

5:29 i rapidly learnt that was probably an indication i was approaching it wrong

5:34 dysfun: IME there's usually an easier way

5:34 nsjph: yep

5:34 clojure's immutability means you have to Think Different

5:40 gphilipp: hyPiRion : why don't you need to use (binding...) while using (set! *print-lenght* n) ?

5:42 i'm about to submit a patch to https://github.com/razum2um/aprint because it does auto layout which gets in the way. I would like to make it an option (using a dynamic var).

6:00 hyPiRion: gphilipp: because Clojure by default puts those in your thread locals

6:01 It's a bit magic, I agree.

6:08 Viesti: hum, it's a convention to use ? at the end of predicate functions, but what about boolean function argument names?

6:09 ro_st: also conventional

6:10 (fn update-users [users with-password-only?] …)

6:10 also conventional to pass a keyword rather than true at call-sites (update-users […] :with-password-only)

6:12 Viesti: yep, was about to ask that too

6:13 passing true doesn't tell much but a keyword has a better chance :)

6:18 ro_st: thanks! :)

6:18 ro_st: any time

6:19 razum2um1: gphilipp: PRs are welcome :)

6:21 michaelr`: oh aprint, nice to meet you.. looks awesome ;)

6:21 where have you been all this time..

6:21 ro_st: wossat michaelr`?

6:23 michaelr`: expressing my happiness of finding out of aprint's existence :)

6:23 ro_st: right. so what is aprint? :-)

6:24 michaelr`: https://github.com/razum2um/aprint

6:24 ro_st: oh nice

6:24 critical question : can i make that my pprinter in emacs/cider?

6:26 michaelr`: i don

6:27 ro_st: i guess i could if i did some (do (in-ns 'clojure.core) (def pprint aprint.core/aprint)) crazy

8:13 noncom: is there a more concise way to write (if (and (sequential? a) (sequential? b)) (concat a b) b)) ?

8:13 * i am creating a fn for (merge-with)

8:20 Bronsa: noncom: you can rewrite that and as (every? sequential? [a b])

8:21 noncom: Bronsa, so there is nothing like juxt, but for arguments..

8:21 essentially, map is like that, but it requires constructing a sequence out of args..

8:21 which you have just proposed..

8:35 agarman: I'm getting an NPE and all I have to go on in the stack trace is user/eval12077 form-init2559650194012227051.clj: 1

8:36 I'm at a loss as to how to figure out what's causing the NPE

8:40 Bronsa: agarman: (.printStackTrace *e)

8:42 agarman: that helped...I was using (pst)

8:45 brkpnt: there is a way to know a all the available methods of a type. Like (type? [1 2]) => clojure.lang.PersistentVector. This beacause how can i know for example the mothod .length? I am using Emacs (:

8:47 TEttinger: brkpnt, likely using reflection yes

8:47 Bronsa: brkpnt: try for example (seq (.getMethods (class [1 2])))

8:49 TEttinger: ,(seq (.getMethods (class [1 2])))

8:49 clojurebot: (#<Method public java.lang.Object clojure.lang.PersistentVector.nth(int)> #<Method public java.lang.Object clojure.lang.PersistentVector.nth(int,java.lang.Object)> #<Method public java.lang.Object[] clojure.lang.PersistentVector.arrayFor(int)> #<Method public clojure.lang.IPersistentMap clojure.lang.PersistentVector.meta()> #<Method public clojure.lang.PersistentVector clojure.lang.PersistentVecto...

8:49 TEttinger: agh

8:51 brkpnt: jap

8:51 thanks

8:51 TEttinger: ,(clojure.reflect/reflect (.getMethods (class [1 2])))

8:51 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.reflect>

8:51 brkpnt: perfect!

8:51 TEttinger: great!

8:51 Bronsa: ,(require 'clojure.reflect)

8:51 TEttinger: (inc Bronsa)

8:51 clojurebot: nil

8:51 lazybot: ⇒ 94

8:51 Bronsa: ,(clojure.reflect/reflect [1 2])

8:51 clojurebot: {:bases #{clojure.lang.APersistentVector clojure.lang.IReduce clojure.lang.IObj clojure.lang.IEditableCollection}, :flags #{:public}, :members #{#clojure.reflect.Method{:name empty, :return-type clojure.lang.IPersistentCollection, :declaring-class clojure.lang.PersistentVector, :parameter-types [], :exception-types [], ...} #clojure.reflect.Method{:name iterator, :return-type java.util.Iterator, :...

8:52 TEttinger: ,:members (clojure.reflect/reflect [1 2]))

8:52 clojurebot: :members

8:52 TEttinger: ,(:members (clojure.reflect/reflect [1 2]))

8:52 clojurebot: #{#clojure.reflect.Method{:name empty, :return-type clojure.lang.IPersistentCollection, :declaring-class clojure.lang.PersistentVector, :parameter-types [], :exception-types [], ...} #clojure.reflect.Method{:name iterator, :return-type java.util.Iterator, :declaring-class clojure.lang.PersistentVector, :parameter-types [], :exception-types [], ...} #clojure.reflect.Method{:name newPath, :return-ty...

8:53 TEttinger: ,(:name (first (:members (clojure.reflect/reflect [1 2]))))

8:53 clojurebot: empty

8:53 TEttinger: ,(map :name (:members (clojure.reflect/reflect [1 2])))

8:53 clojurebot: (empty iterator newPath arrayFor NOEDIT ...)

8:53 TEttinger: cool

8:53 ,(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2]))))

8:53 clojurebot: "empty iterator newPath arrayFor NOEDIT assocN reduce withMeta tail create create nth shift count access$000 cnt reduce EMPTY_NODE kvreduce seq pop nth asTransient clojure.lang.PersistentVector create root popTail clojure.lang.PersistentVector meta asTransient chunkedSeq pop cons tailoff cons rangedIterator EMPTY assocN doAssoc _meta cons pushTail withMeta"

8:54 TEttinger: no length?

8:54 ,(re-find #"length"(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2])))))

8:54 clojurebot: nil

8:54 Glenjamin: cnt?

8:54 sounds like an abbreviation for count to me

8:55 TEttinger: or something not work appropriate

8:56 Bronsa: (re-find #"length"(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2] :ancestors true)))))

8:56 ,(re-find #"length"(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2] :ancestors true)))))

8:56 clojurebot: "length"

8:56 Bronsa: Glenjamin: cnt is an internal field used in the implementation of PV

8:57 it's public to allow stuff like data.avl to hook into the implementation

8:57 nevermind, it's not even public

8:58 TEttinger: damn, nice Bronsa

8:58 another!

8:58 (inc Bronsa)

8:58 lazybot: ⇒ 95

9:25 tomjack: justin_smith: I think my previous results were spurious

9:25 I ran the transducer version in a fresh JVM, and it also brought RES up to 30G according to htop

9:25 and also was only 10% faster

9:26 13min instead of 15mn

9:26 The 3min time must have been due to JVM warmup or something... not sure

9:56 justin_smith: tomjack: interesting

9:57 tomjack: criterium.core/bench will probably be enlightening

9:57 tomjack: I'm wondering whether doing just "-Xmx50G" without an Xms is a problem

9:58 since the biggest observable difference so far was that, on the fast transducer run in the first jvm, the RES was already at ~30G, where on both of the slow runs, it started at ~1-2G

9:58 justin_smith: interesting

9:59 tomjack: but, unfortunately I got the answer I wanted, so I probably won't investigate further :/

10:00 justin_smith: #clojure: "unfortunately I got the answer I wanted"

10:03 xemdetia: the new form of correctness

10:08 tbaldridge: tomjack: of course the other answer is to measure via a profiler and go from there. Depending on how you translated your original code to transducers, there could be still quite a bit of room for improvement

10:09 tomjack: for example: (fnil conj #{}) does a fair amount of allocation for a tight loop, moving that outside of the reduce and into a local could help

10:09 As well as using transients, etc.

10:11 tomjack: I thought of trying yourkit, but assumed that if the problem was heap-related, it would be hard to spot

10:12 justin_smith: tomjack: I don't know yourkit, but jvisualvm definitely profiles heap allocation, and the amount of allocated heap that is in use

10:12 tomjack: "profiles" as in "how much time did that take"? that would be easy enough for me to interpret, I think, thanks

10:14 justin_smith: it shows a graph of usage and allocation, I don't know about a straight up "time spent allocating heap", but that's often not the slow thing (except maybe when you first get the heap space from the OS)

10:15 tomjack: I don't think I have the expertise to (in all cases) correlate what profilers show with what actually matters to me (wall clock runtime)

10:15 but I guess I have to look at profilers more to get that :)

10:18 tbaldridge: yeah, there are memory profilers as well. So in this case, if you see something like "100,000 allocations of fnil_foo_fn42_" you could probably infer that something from fnil was causing allocations

10:18 in this case, its the fact that (fnil conj #{}) allocates a new function on every allocation.

10:19 justin_smith: also, if you do a CPU profile, and the issue is too much allocation, what would show up is the functions that do allocation being slow

10:19 {0}grant: Is toxme.se a trustworthy service?

10:19 Oh, sorry ... thought this was #tox. :^I

10:20 * {0}grant shamefully scuddles away!

10:21 justin_smith: also, CPU profiling reveals how deep the stack of abstractions we use goes

10:21 which can be fascinating, and very overwhelming

10:21 like revealing the massive amount of code the nrepl is running

10:25 tomjack: other things that can be done include graphing CPU usage and GC activity, and that can show you where allocation churn is a factor in your performance

10:25 tbaldridge: Yeah, so it may not be worth it for you tomjack, personally, when I see 10 lines of code and someone saying "why is this slow?" I start to get excited.

10:26 justin_smith: tomjack: jvisualvm comes with the sun jdk (and I think it may come with the openjdk version? not as sure), and it's also a free download

10:36 owl-v-: what graphic library is there for clojure?

10:36 tbaldridge: owl-v-: depends on what you need

10:37 owl-v-: so.. this guy drawing nodes of ANN and weights of the connections. https://www.youtube.com/watch?v=QJ1qgCr09j8

10:38 zeroDivi1: guys (assuming that I'm a Clojure newbie), I started playing with https://github.com/danielsz/system (which is just a handy wrapper arounds stuartsierra/component), but I'm having hard time wrapping my mind around some of the stuff there. Would you know any bigger examples or apps coded using this approach or library?

10:38 cpmcdaniel: owl-v-, maybe look at Quil?

10:38 profil: Hey guys. How do I catch the event when a connection is closed is aleph using tcp?

10:41 in*

10:50 tomjack: tbaldridge: not sure I understand this: "(fnil conj #{}) allocates a new function on every allocation"

10:50 ooh

10:50 now I understand what you said before about a local, thanks

10:50 haha

10:50 * tomjack facepalms

10:56 tbaldridge: tomjack: yeah, it's a general thing to look for, any sort of function composition causes an allocation, so keep an eye out for (fn..), comp, partial, fnil, juxt, etc. inside tight loops.

10:57 H4ns: I have a some functions that perform various checks on a data structure and that need to return true or false based on the validity of the structure. if a rule fails, a message needs to be generated, the first failure should return from the function. I'm using catch/throw right now to do the non-local exit but that seems fishy. Is there some library which makes this pretty?

10:59 justin_smith: H4ns: if you need unconditional exit plus a message, that's pretty much what exceptions are for. I would consider another approach if this is a common code path, since exceptions are slower than a conditional, but for handling invalid input this seems fine

10:59 H4ns: sounds almost like a :pre condition

10:59 ,((fn [a] {:pre [(even? a)]} (inc a)) 1)

10:59 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? a)>

11:00 H4ns: justin_smith: i need custom messages - does :pre have that?

11:01 justin_smith: my coworker just said that preconditions will not be checked when assertions are switched off, so that's probably not the right tool here.

11:01 justin_smith: H4ns: no, but you can use assert (and I really do wish pre had custom messages)

11:01 H4ns: oh, so this is for runtime data validation from a third party?

11:01 I would check out prismatic/schema

11:02 H4ns: justin_smith: i'll have a look at schema, thanks!

11:06 not quite what i was looking for either. i'll just write a with-rule-checking macro to remove the clutter from the checking functions

11:15 justin_smith: H4ns: what sorts of things are you checking for?

11:16 H4ns: justin_smith: these are internal consistency checks and database lookups

11:24 arav93: Hi

11:36 Any idea about gsoc stuff?

11:40 vas: Hi

11:40 What's a gsoc?

11:41 arav93: Google Summer of Code!

11:41 hlprmnky: google summer of code, most likely

11:41 arav93: :)

11:41 vas: can't wait to put my devbox in a bikini...

11:41 :D

11:52 gfredericks: help I am writing a named version of clojure.core/format

11:56 (named-format "You have %amount~d dollars" {:amount 20}), e.g.

11:56 please tell me this exists somewhere already so I can stop

12:05 pjstadig: ,(str (map println (range 1 5)))

12:05 clojurebot: 1\n2\n3\n4\n"clojure.lang.LazySeq@e1781"

12:06 pjstadig: ^ has this ever come up before? the fact that calling toString on a lazyseq realizes it because it has to calculate the hashCode?

12:06 gfredericks: there's a ticket I think

12:06 pjstadig: gfredericks: i did i search but couldn't find anything

12:06 gfredericks: I've definitely discussed it before

12:06 mbac: is there a standard library version of this (defn array-init [len f] (float-array len (map f (range len))))

12:07 gfredericks: pjstadig: also coulda been a ML thread

12:08 chouser: gfredericks: maybe https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/strint.clj

12:08 puredanger: this has come up before

12:08 gfredericks: chouser: yeah I've thought about that, but I don't really want general eval, and I like having all the other features of format

12:09 chouser: I'm thinking this can be a pretty simple parse that defers to c.c/format

12:10 I have a buggy POC already

12:11 whidden: gfredericks: have you looked at cl-format? Its a port of the CL format to clojure and supports a lot of 'interesting' directives

12:11 tomjack: if str on a lazy-seq realizes it, why don't we just return a good str?

12:12 I could understand "we don't want to realize it" as an excuse if you didn't realize it :)

12:12 pjstadig: tomjack: yeah

12:12 tomjack: I guess one response is still "hashCode in the str is a bug, we shouldn't realize"

12:12 pjstadig: alternatively have a toString impl that defers to System.identityHashCode instead of hashCode

12:13 tomjack: yeah. incidentally I always assumed that thingy _was_ identityHashCode

12:16 puredanger: I can't find a ticket for this either but seems reasonable to have one to me

12:17 gfredericks: whidden: is named parameters one of them?

12:18 I just made https://www.refheap.com/98133 /cc whidden chouser

12:25 whidden: gfredericks: the quick answer is no.

12:26 gfredericks: if nobody dissuades me I will probably make this into a library and then add a helper macro to catch-data for throwing ex-info objects whose err messages can reference the attached data

12:27 justin_smith: gfredericks: is there a reason not to use one of the less featureful mustache libs?

12:27 gfredericks: probably not

12:27 I'm not very know about mustache libs

12:27 clostache?

12:28 mnngfltg: I've had bad experiences with clostache

12:28 justin_smith: stencil is decent

12:28 gfredericks: it looks HTML oriented

12:28 automatically escaping html would be a downside

12:28 justin_smith: {{}} turns of html escape

12:29 err, I mean {{{}}} does

12:29 mnngfltg: stencil is better

12:29 gfredericks: and having all the features of c.c/format seems useful

12:29 though with the code I just wrote there are drawbacks like not being able to access nested maps

12:29 justin_smith: that's a good reason not to use a mustache

12:30 gfredericks: now I just have to name the library

12:31 mnngfltg: maybe `selmer`, that seems inspired by python's jinja2

12:32 which is used in ansible (i.e. not for html templating)

12:32 hiredman: https://github.com/gfredericks/one-weird-trick

12:33 Glenjamin: https://github.com/gfredericks/taking-names

12:34 gfredericks: hiredman: lol; that works for a lot of different hypothetical libs :)

12:34 hiredman: I know, that is the problem

12:34 what if you have more than one weird trick?

12:35 gfredericks: which I do

12:35 mnngfltg: they don't want you to know about it

12:35 gfredericks: the mustache people hate me

12:35 add this to your project.clj to find out why

12:37 H4ns: is there a way to access the defined methods of a multimethod?

12:37 hiredman: ,(doc methods)

12:37 clojurebot: "([multifn]); Given a multimethod, returns a map of dispatch values -> dispatch fns"

12:37 H4ns: thanks!

12:40 noncom: i am writing in clojure for like 2+ years already, and i did not use multimethods, records and protocols at all, as they make me feel like they are a little constraining and not too lispy. what do you think?

12:41 H4ns: i like multimethods

12:41 noncom: do i lose something not using them?

12:41 cap10morgan: Is it possible to extend a constructor-less base class (with proxy or gen-class or anything else) from Clojure? Everything seems to want to call a superclass ctor.

12:41 H4ns: i don't care about lispy, and i've written a lot of lisp in my life.

12:41 noncom: you loose the expressiveness that they provide.

12:42 noncom: h4ns: right.. i have to start to use them..

12:42 is there a separate chat for core.async as of now, or do i ask questions here ?

12:43 mnngfltg: noncom, I see them as a way to refactor (cond (= :a obj-type) (do-a) (= :b obj-type) (do-b))

12:43 H4ns: noncom: i did not want to say that. there is plenty of tools in clojure, so if you feel that you can express your ideas clearly without multimethods, you can ignore them safely.

12:44 gfredericks: cap10morgan: is that possible in java?

12:44 mnngfltg: it's totally possible that you siple didn't run into any situations where you needed multimethods

12:44 cap10morgan: gfredericks: yes, the base class is abstract

12:44 noncom: h4ns: well, you see, i tend to agree with you... and with mnngfltg too.

12:44 :)

12:45 cap10morgan: gfredericks: specifically this class: https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/java/com/github/jknack/handlebars/io/URLTemplateLoader.java

12:45 gfredericks: cap10morgan: oh interesting; I don't know actually

12:45 noncom: cap10morgan: why dont you just try? :)

12:46 gfredericks: noncom: try what?

12:46 cap10morgan: noncom: I have been trying for the past hour, and can't get it to work. "No matching ctor found" errors abound.

12:46 noncom: well, extend the class

12:46 hmm i see... let me try too :D

12:46 cap10morgan: presumably when trying to call the non-existent base class constructor

12:46 noncom: cool, thanks

12:49 TimMc: ,(def life-with-newborn (repeatedly #(condp > (rand) 0 "laundry" 0.4 "feed baby" 0.7 "change diaper" 0.8 "misc" 1 "feed self")))

12:49 clojurebot: #'sandbox/life-with-newborn

12:49 TimMc: ,(apply println (take 20 life-with-newborn))

12:49 clojurebot: change diaper feed baby change diaper change diaper feed self change diaper change diaper change diaper change diaper feed baby change diaper feed baby misc change diaper change diaper feed self feed baby feed baby feed baby feed baby\n

12:50 gfredericks: TimMc: do you have a babby?

12:50 TimMc: yep

12:50 as of Saturday

12:51 hmm

12:51 s/misc/sleep/

12:51 gfredericks: TimMc: congrats

12:52 tbaldridge: noncom: you can ask core.async questions here

12:54 noncom: tbaldridge: cool! :) well, i am making a gui system. currently i am having a channel per gui element. the gui element can post messages to it, exclusively to be consumed by its hierarchical children. so, is it ok to have a channel per gui element, or do i better make a common bus and make each element look at it to pick messages related to it?

12:55 tbaldridge: The more ui I work I do, the more I like the common bus pattern perhaps even with a pub/sub. IMO it makes wiring everything much simpler.

12:55 You simply look for messages of a given type, or id, instead of having to attach to a specific instance of a channel.

12:55 noncom: right. that's the point!

12:56 ok, so nice to hear this from your experience

13:00 justin_smith: tbaldridge: hmm, that makes me think you could even use derive / isa? to do your propagation (each thing knows the superclass(es) of what it is interested in)

13:00 not propagation, I mean selection

13:01 tbaldridge: you certainly could

13:01 N8Dawg: Hi All, wondered if theres any AOT Lein experts here, got a problem which is really frustrating

13:01 justin_smith: ~aot

13:01 clojurebot: http://i.qkme.me/3vb225.jpg

13:01 tbaldridge: ~AOT

13:01 clojurebot: AOT is kinda broken already

13:02 N8Dawg: I'm trying to create an uberjar

13:02 ideally i just want the main entry point compiled

13:02 and leave the rest as clj

13:02 tbaldridge: justin_smith: noncom: I've also been experimenting with a model that was pioneered in Pedestal App, where the messages from your UI component's aren't in the form of "Button 1 clicked" in in the form of "Action: Add User, Name: John Doe"

13:03 N8Dawg: is that possible? I specified :aot [mynamespace.main] in project.clj

13:03 tbaldridge: So you don't so much listen to ui events as you do write your whole app in a model that looks a bit like CQRS. Commands to a data-model, updates to the data model propagate to the UI via views.

13:04 aperiodic: N8Dawg: by default AOT transitively compiles all required namespaces. I believe it is possible to achieve this with some indirection; I'm trying to find an example right now.

13:04 N8Dawg: so this is how trapperkeeper achieves that: https://github.com/puppetlabs/trapperkeeper/blob/master/src/puppetlabs/trapperkeeper/main.clj

13:04 noncom: cap10morgan: well... https://www.refheap.com/98134 :)

13:04 is there anything wrong?

13:05 N8Dawg: what's the lein ver?

13:06 cap10morgan: noncom: interesting... I'll play around w/ it and see where I went wrong.

13:06 N8Dawg: noncom: 2.3.4

13:06 aperiodic: Thanks i will give a go

13:06 noncom: N8Dawg: well, i have the same scenario, and i just have (:gen-class) in the main ns, and i have :main [my-main-ns] in project.clj

13:06 that's all

13:07 aperiodic: N8Dawg: keep in mind, though, that by keeping the majority of code dynamically compiled, you're losing a fair amount of the performance benefit of AOT. I think that the above namespace is basically what clojure.main does, so perhaps you should just use that.

13:07 noncom: each time i uberjar, lein threatens me that in version 3.0.0 things will change, but..i am on 2.x now..

13:07 aperiodic: N8Dawg: https://clojure.github.io/clojure/clojure.main-api.html

13:07 N8Dawg: check out the documentation for the `main` function

13:08 noncom: the only thing that will change is that you'll need to add `:aot [my-main-ns]` to your project.clj

13:08 noncom: tbaldridge: interesting

13:08 * sorry, i have :main my-main-ns, not :main [my-main-ns]

13:10 N8Dawg: aperiodic: I want uberjar not for performance but for deployment / running as a server

13:10 noncom: aperiodic: so, the workaround in lein 3+ will be the way that trapperkeeper does ?

13:11 aperiodic: N8Dawg: yeah, just call clojure.main with the appropriate arguments, then

13:12 noncom: no, it's not a workaround. lein will just stop acting like you put the :main namespace in the list of namespaces to AOT; you'll have to do that yourself

13:31 cap10morgan: noncom: I had created a red herring for myself. Thanks for helping me back to path of simplicity. :)

13:43 noncom: cap10morgan: ;)

13:44 N8Dawg: Is Zach Tellman online?

13:44 think i've found an odd bug with aleph + clojure 1.7 alpha 5

13:44 noncom: N8Dawg: can't see him in the list

13:45 i think there was a command...

13:45 ,seen ztellman

13:45 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seen in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:45 noncom: umm.. not that

13:45 aperiodic: $seen ztellman

13:45 lazybot: ztellman was last seen quittingQuit: Computer has gone to sleep. 2 hours and 16 minutes ago.

13:46 noncom: thats it!

13:49 N8Dawg: $seen ztellman

13:49 lazybot: ztellman was last seen quittingQuit: Computer has gone to sleep. 2 hours and 20 minutes ago.

13:56 puredanger: N8Dawg: I'm curious even if ztellman's not around :)

13:57 N8Dawg: puredanger: so the problems in manifold

13:58 puredanger: used by aleph, says cant resolve a symbol. symbol points to a macro, bizarre thing is symbols before and after are read find

13:58 fine, almost as if the entire defmacro form is commented out

13:58 puredanger: can you put the actual error somewhere refheap etc

13:58 justin_smith: N8Dawg: does lein deps :tree show any conflicts?

13:59 puredanger: and how does 1.7 play in?

13:59 N8Dawg: justin_smith: there are conflicts, but dont think they're related

13:59 justin_smith: N8Dawg: so you mean there is no manifold conflict at all?

14:00 because if one lib expects to see a macro in another lib, that is present, my first assumption is versions

14:00 N8Dawg: justin-smith: thats correct

14:01 so the form its not reading is here

14:01 https://github.com/ztellman/manifold/blob/master/src/manifold/utils.clj#L64

14:01 future-with

14:01 max-depth and without-overflow 'are' being read

14:01 which are the forms before and after

14:02 so in the repl I require the namespace

14:02 i see everything but future-with

14:03 justin_smith: N8Dawg: if I browse the history of that file, there was a version from Jan 29th that does not define that funciton

14:03 *macro

14:03 the simplest explanation is that is the version in your release

14:03 try opening the source inside the jar that lein puts on the classpath

14:03 lein cp will show you the path to that jar

14:03 N8Dawg: hmmm you think it might have an old version cached somewhere

14:03 justin_smith: no, it's not about caching

14:03 it's about the version that is resolved

14:03 open the jar that lein cp shows for manifold

14:04 browse that source

14:04 if that is not the version you need, edit your project.clj

14:04 N8Dawg: justin_smith: occams razors suggests thats the most probable explanation

14:04 justin_smith: a good editor can open a jar as if it were a directory (both emacs and vim can do this)

14:09 arav93: Hi!!

14:09 N8Dawg: justin-smith:

14:10 justin-smith: sorry, accidental return, so i did lein cp, looked for the manifold jar, extracted it, and yes the macro IS defined

14:10 justin_smith: OK, that's weird

14:17 N8Dawg: justin-smith: so whats really bizarre is if I run (ns-publics (find-ns 'manifold.utils))

14:17 i see all the vars, except future-with

14:17 i also see future defined

14:18 its as if future-with has been renamed to future

14:18 justin_smith: and you are sure that the repl where you look at this has the same version of the dep as was reported by lein cp? no edit to project.clj in the meantime?

14:19 there is a trick to finding the jar that some namespace was loaded from, but I am forgetting how it works

14:20 N8Dawg: i ran lein repl

14:20 yeah sure is the answer

14:21 AeroNotix: if I defprotocol will java be able to implement it no probz?

14:23 justin_smith: AeroNotix: defprotocol will create an interface, but you may want to directly use definterface if the goal is for it to be usable from java

14:25 N8Dawg: justin-smith: i have an old version kicking around somewhere which is causing issues

14:25 just need to find where, thanks for the pointers

14:27 justin_smith: N8Dawg: this should be handled by project.clj / lein. Just removing the version from ~/.m2/ will not fix anything, because if lein thinks you need that version it will just download it again. The solution is to make sure the precise version you need is specified.

14:28 sometimes there is the issue that some lib was aot-compiled so you get the version of one of its deps that it compiled in, the solution to that is generally not to aot libs, and not use libs that have been aot compiled

14:31 gfredericks: welp https://github.com/gfredericks/like-format-but-with-named-args

14:55 wink: git clone .../not-good-with-names :P

14:56 surrealanalysis: I’m having some trouble with reagent, where a style element isn’t being updated when I think it should be. Offending line is here: https://github.com/KevinGreene/color-eyes/blob/master/src/cljs/color_eyes/color_selector.cljs#L29

14:57 And it stays at what “color-map” was initialized to

14:57 But the line below is updated as changes are made

14:57 Any ideas?

15:37 AeroNotix: justin_smith: thanks mate

16:01 turbofail: welp. bought my clojure/west ticket

16:02 now i need to figure out how i'm getting there

16:03 aconbere: :'( I'm running into a bizarro bug in either pigpen or prismatic/graph where if I try to run a function in pigpen that calls a graph function it fails to find the graph-record generated for the definition :(

16:07 raises a class not found error

16:07 oh the tears

16:47 AeroNotix: did any one implement a UUID type with buffy?

16:47 I can do it, just wanted to see if someone else had done so first.

17:02 how do I express a constructor that takes a [B?

17:23 justin_smith: AeroNotix: do you mean how to do that type hint, or how to pass one in?

17:28 AeroNotix: justin_smith: for ctors in a gen-class you need to specify the types.

17:28 How do I specify a byte-array?

17:28 justin_smith: ^"[B" is a valid type hint

17:29 AeroNotix: so I'm guessing that "[B" would be fine?

17:29 justin_smith: yeah

17:29 AeroNotix: since you don't seem to need the ^ for ctor types

17:29 cool, ok. I'll try thi

17:29 this

17:29 thanks!

17:30 aperiodic: you can also just use the `^bytes`

17:30 the `^bytes` alias

17:31 http://clojure.org/java_interop#Java%20Interop-Aliases

17:31 AeroNotix: aperiodic: thanks

17:49 aconbere: hey all, I'm struggling with an error I'm experiencing in the pigpen library, and it has taken me down a rabbit hole of macros

17:49 I'm curious about what I should expect from the *ns* value in a macro

17:50 would it be evaluated when the file is parsed and thus always have the ns of the file it's in?

17:50 or...

17:50 amalloy: aconbere: the namespace of the code calling it

17:50 aconbere: confusing

17:50 amalloy: gotcha

17:51 amalloy: so I think my questions start with this function

17:51 https://gist.github.com/aconbere/e1a2f003bfc1f6d6d782

17:52 which seems fairly straightforward, it appears to execute f in the ns provided

17:53 it's used in this set of macros/functions

17:53 https://gist.github.com/aconbere/e1a2f003bfc1f6d6d782#file-gistfile2-clj

17:54 and basically what I'm seeing is that I have another library that's got a macro that's generating a symbol (gensym?) in a namespace

17:54 and when I try to call a function from that namespace using the functions I linked

17:54 they can't find the generated symbol

17:54 and it hurts my brain even to say all that

17:54 oof

17:55 lvh: I have some (blocking or core.async chan returning) functions. I have a bunch of work items for them to do, with (limited) parallelism. Is that what pipeline and pipeline-* are for? If so, I guess I get to write a transducer

18:03 martinklepsch: why is there [incanter "1.9.0"] on clojars but the Github repo is at 1.5.6 ?

18:04 nvm. Seems that everthing is happening in "develop" branch

18:29 brkpnt: Any link of how to debug a clojure application? Is posible to step a function via cider?

18:35 justin_smith: brkpnt: the best debugging setup is probably using cursive with intellij at this point

18:37 AeroNotix: so with Buffy how do I just get a [B of my type? Seems non-trivial

18:43 ah you can just pass in your own buffer

18:43 nvm

18:46 turbofail: 33

18:47 AeroNotix: 54

18:47 justin_smith: that's numberwang!

18:48 let's rotate the board

18:48 AeroNotix: haha

18:48 TEttinger: $google herringbone wang tiles

18:49 lazybot: [Herringbone Wang Tiles] http://nothings.org/gamedev/herringbone/

18:49 TEttinger: speaking of boards by Wang

18:49 justin_smith: TEttinger: I assume you've seen the numberwang sketches

18:49 TEttinger: nope

18:50 justin_smith: https://www.youtube.com/watch?v=qjOZtWZ56lc

18:50 TEttinger: my C# generator of a grid of these herringbone wang tiles is much more concise than my clojure one, to be honest. it's a very suitable problem for 2d arrays

18:50 justin_smith: interesting

18:52 TEttinger: heh

18:52 clojurebot: I don't understand.

18:52 TEttinger: you wouldn't, clojurebot

18:52 justin_smith: numberwang gets funnier when you see more episodes

18:53 numberwang, that is

18:54 TEttinger: I liked Homonym on 30 Rock, the parody of game shows used as part of a ploy to make NBC fail

18:54 justin_smith: ~that |is| numberwang

18:54 clojurebot: 'Sea, mhuise.

18:55 TEttinger: https://www.youtube.com/watch?v=3cStRdYg3Wk

18:57 vas: hey party people

18:58 i'm trying to match a compojure route up with some methods... it seems fine, i pass a datomic entity ID and get back info about the entity.. but trying to invoke the same method from my handler tells me that the "processing rule" Cannot resolve key

19:01 actually the stack trace is huuge, but i don't know why it "can't resolve key" via the URL parameter even though it works when i directly invoke the func

19:06 jhn: given that i have a collection as follows: (map vector '(1 2 3) '(4 5 6))

19:06 => ([1 4] [2 5] [3 6])

19:07 how do I pass that into a function like this: (defn signs [[first second]] (if (> first second) first second))

19:07 basically i want this to work: (map signs [1 2]), but I get

19:08 uh wait

19:08 nvm

19:08 :-)

19:09 vas: :-)

19:13 jhn: ok so here's the actual question

19:13 given that i have this function

19:14 (defn zipit [col] (map vector col (rest col)))

19:14 and this other one

19:14 (defn bigger [[first second]] (if (> first second) first second))

19:15 how do I map bigger to the result of zipit?

19:16 chouser: (map bigger (zipit some-collection))

19:16 AeroNotix: for real I can't actually see a good way to retrieve the bytes from a Buffy spec.

19:17 chouser: jhn: or: (map max coll (rest coll))

19:24 AeroNotix: I think I found it, dumb interface.

19:24 https://gist.github.com/AeroNotix/5f1428945cd90ca736b9

19:59 NoCreativity: Hello!

20:00 Does anyone have tips on how to use clojure.test with leiningen? I can't (run-tests) like my tests are never loaded into my classpath.

20:08 hiredman: clojure.test is how leinigen assumes you are writing tests

20:08 lein test will run them

20:09 NoCreativity: Let me test with lein test first then

20:09 hiredman: if you want to run tests from the repl you need to load the tests first, via require, load, whatever load-file thing your editor does, etc, etc

20:14 qux: anyone seesaw friendly :

20:15 i would like a button to be enabled based on the value of a text field

20:15 is seesaw.binding the right-way to do this ?

20:16 NoCreativity: hiredman: thank you!

20:16 hiredman: it worked!

20:49 timvisher: anyone aware of something like this in core? `(fn [ y pred xform ] (if (pred y) y (xform y)))`?

20:50 amalloy: well, if you include flatland/useful that's (fixing (! pred) xform). in core, you can slap it together with cond->

20:51 er, i guess to-fix, not fixing. i always get the conjugations of those things wrong

20:51 or if you want it not point-free, (fn [y] (fix y (! pred) xform))

20:52 Morgawr: I'm trying to do some clojurescript testing for my stuff (first time I do testing in clojure) and this is the output I get when doing (is (= tree-1 tree-2)) (where tree-1 and tree-2 are two data structures I need to compare) https://www.refheap.com/235c06db9ee7d439c55dd854b

20:53 It's SO hard to understand what is going on.. is there a better way to do this? :/

20:53 I mean, I have no idea where to even begin to parse this monster

20:56 There must be a better way to do this...

21:02 nuwanda_: i mean, a pretty printer will help, but the data structure is huge

21:03 Morgawr: nuwanda_: it's jus a very small tree...

21:03 just*

21:04 chouser: data.diff may help you find the diference

21:04 Morgawr: chouser: can I use that in clojurescript?

21:04 chouser: oh! hm, no idea.

21:05 dnolen: Morgawr: yes data.diff exists there

21:06 the only major namespace missing is clojure.pprint

21:07 Morgawr: dnolen: Alright, I'll check it out thanks.

Logging service provided by n01se.net