2015-03-05
| 00:01 | tomjack | 75% using transduce over a line-seq |
| 00:01 | tomjack | I expect that not having any seq at all (transducing over a lines reducer) would be even better |
| 00:02 | tomjack | (transducers do not make reducers entirely obsolete, just the reducer transformer functions) |
| 00:03 | justin_smith | yeah |
| 00:03 | justin_smith | 75% sounds about right for that change, yeah |
| 00:03 | justin_smith | (inc transducers) |
| 00:03 | lazybot | ⇒ 2 |
| 00:04 | tomjack | (inc justin_smith) |
| 00:05 | lazybot | ⇒ 205 |
| 01:00 | rpaulo_ | any ideas when the final 1.7.0 is going to be released? |
| 02:03 | tomjack | rpaulo_: no, but I think a beta usually comes after the alphas? so probably not very soon, I suppose |
| 05:14 | gphilipp | @hi |
| 05:15 | gphilipp | I'd like to create a dynamic var which I could change with set! (similar to *print-length*) |
| 05:15 | gphilipp | 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) |
| 05:16 | gphilipp | what am I doing wrong ? |
| 05:20 | nsjph | oh |
| 05:20 | nsjph | need to set it to be dynamic |
| 05:20 | nsjph | but |
| 05:20 | nsjph | you might prefer to use an atom instead |
| 05:20 | nsjph | try something like (def myvar (atom "blah")) |
| 05:20 | nsjph | (reset! myvar "somethingelse") |
| 05:22 | nsjph | you can also use swap! on an atom |
| 05:27 | hyPiRion | gphilipp: you need to do (binding [*auto-layout* value] ... (set! *auto-layout* value2)) |
| 05:28 | hyPiRion | 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. |
| 05:28 | nsjph | dynamic vars was one of the very first things i tried to do in clojure |
| 05:29 | nsjph | i rapidly learnt that was probably an indication i was approaching it wrong |
| 05:34 | dysfun | IME there's usually an easier way |
| 05:34 | nsjph | yep |
| 05:34 | nsjph | clojure's immutability means you have to Think Different |
| 05:40 | gphilipp | hyPiRion : why don't you need to use (binding...) while using (set! *print-lenght* n) ? |
| 05:42 | gphilipp | 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). |
| 06:00 | hyPiRion | gphilipp: because Clojure by default puts those in your thread locals |
| 06:01 | hyPiRion | It's a bit magic, I agree. |
| 06:08 | Viesti | hum, it's a convention to use ? at the end of predicate functions, but what about boolean function argument names? |
| 06:09 | ro_st | also conventional |
| 06:10 | ro_st | (fn update-users [users with-password-only?] …) |
| 06:10 | ro_st | also conventional to pass a keyword rather than true at call-sites (update-users […] :with-password-only) |
| 06:12 | Viesti | yep, was about to ask that too |
| 06:13 | Viesti | passing true doesn't tell much but a keyword has a better chance :) |
| 06:18 | Viesti | ro_st: thanks! :) |
| 06:18 | ro_st | any time |
| 06:19 | razum2um1 | gphilipp: PRs are welcome :) |
| 06:21 | michaelr` | oh aprint, nice to meet you.. looks awesome ;) |
| 06:21 | michaelr` | where have you been all this time.. |
| 06:21 | ro_st | wossat michaelr`? |
| 06:23 | michaelr` | expressing my happiness of finding out of aprint's existence :) |
| 06:23 | ro_st | right. so what is aprint? :-) |
| 06:24 | michaelr` | https://github.com/razum2um/aprint |
| 06:24 | ro_st | oh nice |
| 06:24 | ro_st | critical question : can i make that my pprinter in emacs/cider? |
| 06:26 | michaelr` | i don |
| 06:27 | ro_st | i guess i could if i did some (do (in-ns 'clojure.core) (def pprint aprint.core/aprint)) crazy |
| 08:13 | noncom | is there a more concise way to write (if (and (sequential? a) (sequential? b)) (concat a b) b)) ? |
| 08:13 | noncom | * i am creating a fn for (merge-with) |
| 08:20 | Bronsa | noncom: you can rewrite that and as (every? sequential? [a b]) |
| 08:21 | noncom | Bronsa, so there is nothing like juxt, but for arguments.. |
| 08:21 | noncom | essentially, map is like that, but it requires constructing a sequence out of args.. |
| 08:21 | noncom | which you have just proposed.. |
| 08: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 |
| 08:36 | agarman | I'm at a loss as to how to figure out what's causing the NPE |
| 08:40 | Bronsa | agarman: (.printStackTrace *e) |
| 08:42 | agarman | that helped...I was using (pst) |
| 08: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 (: |
| 08:47 | TEttinger | brkpnt, likely using reflection yes |
| 08:47 | Bronsa | brkpnt: try for example (seq (.getMethods (class [1 2]))) |
| 08:49 | TEttinger | ,(seq (.getMethods (class [1 2]))) |
| 08: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... |
| 08:49 | TEttinger | agh |
| 08:51 | brkpnt | jap |
| 08:51 | brkpnt | thanks |
| 08:51 | TEttinger | ,(clojure.reflect/reflect (.getMethods (class [1 2]))) |
| 08:51 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.reflect> |
| 08:51 | brkpnt | perfect! |
| 08:51 | TEttinger | great! |
| 08:51 | Bronsa | ,(require 'clojure.reflect) |
| 08:51 | TEttinger | (inc Bronsa) |
| 08:51 | clojurebot | nil |
| 08:51 | lazybot | ⇒ 94 |
| 08:51 | Bronsa | ,(clojure.reflect/reflect [1 2]) |
| 08: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, :... |
| 08:52 | TEttinger | ,:members (clojure.reflect/reflect [1 2])) |
| 08:52 | clojurebot | :members |
| 08:52 | TEttinger | ,(:members (clojure.reflect/reflect [1 2])) |
| 08: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... |
| 08:53 | TEttinger | ,(:name (first (:members (clojure.reflect/reflect [1 2])))) |
| 08:53 | clojurebot | empty |
| 08:53 | TEttinger | ,(map :name (:members (clojure.reflect/reflect [1 2]))) |
| 08:53 | clojurebot | (empty iterator newPath arrayFor NOEDIT ...) |
| 08:53 | TEttinger | cool |
| 08:53 | TEttinger | ,(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2])))) |
| 08: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" |
| 08:54 | TEttinger | no length? |
| 08:54 | TEttinger | ,(re-find #"length"(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2]))))) |
| 08:54 | clojurebot | nil |
| 08:54 | Glenjamin | cnt? |
| 08:54 | Glenjamin | sounds like an abbreviation for count to me |
| 08:55 | TEttinger | or something not work appropriate |
| 08:56 | Bronsa | (re-find #"length"(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2] :ancestors true))))) |
| 08:56 | Bronsa | ,(re-find #"length"(clojure.string/join " " (mapv :name (:members (clojure.reflect/reflect [1 2] :ancestors true))))) |
| 08:56 | clojurebot | "length" |
| 08:56 | Bronsa | Glenjamin: cnt is an internal field used in the implementation of PV |
| 08:57 | Bronsa | it's public to allow stuff like data.avl to hook into the implementation |
| 08:57 | Bronsa | nevermind, it's not even public |
| 08:58 | TEttinger | damn, nice Bronsa |
| 08:58 | TEttinger | another! |
| 08:58 | TEttinger | (inc Bronsa) |
| 08:58 | lazybot | ⇒ 95 |
| 09:25 | tomjack | justin_smith: I think my previous results were spurious |
| 09:25 | tomjack | I ran the transducer version in a fresh JVM, and it also brought RES up to 30G according to htop |
| 09:25 | tomjack | and also was only 10% faster |
| 09:26 | tomjack | 13min instead of 15mn |
| 09:26 | tomjack | The 3min time must have been due to JVM warmup or something... not sure |
| 09:56 | justin_smith | tomjack: interesting |
| 09:57 | justin_smith | tomjack: criterium.core/bench will probably be enlightening |
| 09:57 | tomjack | I'm wondering whether doing just "-Xmx50G" without an Xms is a problem |
| 09:58 | tomjack | 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 |
| 09:58 | justin_smith | interesting |
| 09: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 | tbaldridge | 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 | tbaldridge | 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 | tomjack | 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 | tbaldridge | 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 | {0}grant | Oh, sorry ... thought this was #tox. :^I |
| 10:21 | justin_smith | also, CPU profiling reveals how deep the stack of abstractions we use goes |
| 10:21 | justin_smith | which can be fascinating, and very overwhelming |
| 10:21 | justin_smith | like revealing the massive amount of code the nrepl is running |
| 10:25 | justin_smith | 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 | profil | in* |
| 10:50 | tomjack | tbaldridge: not sure I understand this: "(fnil conj #{}) allocates a new function on every allocation" |
| 10:50 | tomjack | ooh |
| 10:50 | tomjack | now I understand what you said before about a local, thanks |
| 10:50 | tomjack | haha |
| 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 | justin_smith | H4ns: sounds almost like a :pre condition |
| 10:59 | justin_smith | ,((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 | H4ns | 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 | justin_smith | H4ns: oh, so this is for runtime data validation from a third party? |
| 11:01 | justin_smith | I would check out prismatic/schema |
| 11:02 | H4ns | justin_smith: i'll have a look at schema, thanks! |
| 11:06 | H4ns | 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 | arav93 | Any idea about gsoc stuff? |
| 11:40 | vas | Hi |
| 11:40 | vas | 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 | vas | :D |
| 11:52 | gfredericks | help I am writing a named version of clojure.core/format |
| 11:56 | gfredericks | (named-format "You have %amount~d dollars" {:amount 20}), e.g. |
| 11:56 | gfredericks | 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 | gfredericks | chouser: I'm thinking this can be a pretty simple parse that defers to c.c/format |
| 12:10 | gfredericks | 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 | tomjack | 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 | gfredericks | 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 | gfredericks | I'm not very know about mustache libs |
| 12:27 | gfredericks | 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 | gfredericks | automatically escaping html would be a downside |
| 12:28 | justin_smith | {{}} turns of html escape |
| 12:29 | justin_smith | 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 | gfredericks | 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 | mnngfltg | 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 | hiredman | 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 | gfredericks | 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 | H4ns | noncom: you loose the expressiveness that they provide. |
| 12:42 | noncom | h4ns: right.. i have to start to use them.. |
| 12:42 | noncom | 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 | noncom | :) |
| 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 | noncom | hmm i see... let me try too :D |
| 12:46 | cap10morgan | presumably when trying to call the non-existent base class constructor |
| 12:46 | cap10morgan | 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 | TimMc | as of Saturday |
| 12:51 | TimMc | hmm |
| 12:51 | TimMc | 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 | tbaldridge | 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 | noncom | 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 | justin_smith | 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 | N8Dawg | ideally i just want the main entry point compiled |
| 13:02 | N8Dawg | 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 | aperiodic | 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 | noncom | is there anything wrong? |
| 13:05 | noncom | 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 | N8Dawg | 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 | noncom | 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 | aperiodic | N8Dawg: check out the documentation for the `main` function |
| 13:08 | aperiodic | 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 | noncom | * 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 | aperiodic | 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 | N8Dawg | 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 | noncom | i think there was a command... |
| 13:45 | noncom | ,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 | N8Dawg | 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 | N8Dawg | 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 | justin_smith | 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 | N8Dawg | so the form its not reading is here |
| 14:01 | N8Dawg | https://github.com/ztellman/manifold/blob/master/src/manifold/utils.clj#L64 |
| 14:01 | N8Dawg | future-with |
| 14:01 | N8Dawg | max-depth and without-overflow 'are' being read |
| 14:01 | N8Dawg | which are the forms before and after |
| 14:02 | N8Dawg | so in the repl I require the namespace |
| 14:02 | N8Dawg | 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 | justin_smith | *macro |
| 14:03 | justin_smith | the simplest explanation is that is the version in your release |
| 14:03 | justin_smith | try opening the source inside the jar that lein puts on the classpath |
| 14:03 | justin_smith | 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 | justin_smith | it's about the version that is resolved |
| 14:03 | justin_smith | open the jar that lein cp shows for manifold |
| 14:04 | justin_smith | browse that source |
| 14:04 | justin_smith | 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 | N8Dawg | 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 | N8Dawg | i see all the vars, except future-with |
| 14:17 | N8Dawg | i also see future defined |
| 14:18 | N8Dawg | 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 | justin_smith | 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 | N8Dawg | 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 | N8Dawg | 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 | justin_smith | 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 | surrealanalysis | And it stays at what “color-map” was initialized to |
| 14:57 | surrealanalysis | But the line below is updated as changes are made |
| 14:57 | surrealanalysis | Any ideas? |
| 15:37 | AeroNotix | justin_smith: thanks mate |
| 16:01 | turbofail | welp. bought my clojure/west ticket |
| 16:02 | turbofail | 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 | aconbere | raises a class not found error |
| 16:07 | aconbere | oh the tears |
| 16:47 | AeroNotix | did any one implement a UUID type with buffy? |
| 16:47 | AeroNotix | I can do it, just wanted to see if someone else had done so first. |
| 17:02 | AeroNotix | 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 | AeroNotix | 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 | AeroNotix | cool, ok. I'll try thi |
| 17:29 | AeroNotix | this |
| 17:29 | AeroNotix | thanks! |
| 17:30 | aperiodic | you can also just use the `^bytes` |
| 17:30 | aperiodic | the `^bytes` alias |
| 17:31 | aperiodic | 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 | aconbere | I'm curious about what I should expect from the *ns* value in a macro |
| 17:50 | aconbere | would it be evaluated when the file is parsed and thus always have the ns of the file it's in? |
| 17:50 | aconbere | or... |
| 17:50 | amalloy | aconbere: the namespace of the code calling it |
| 17:50 | aconbere | confusing |
| 17:50 | aconbere | amalloy: gotcha |
| 17:51 | aconbere | amalloy: so I think my questions start with this function |
| 17:51 | aconbere | https://gist.github.com/aconbere/e1a2f003bfc1f6d6d782 |
| 17:52 | aconbere | which seems fairly straightforward, it appears to execute f in the ns provided |
| 17:53 | aconbere | it's used in this set of macros/functions |
| 17:53 | aconbere | https://gist.github.com/aconbere/e1a2f003bfc1f6d6d782#file-gistfile2-clj |
| 17:54 | aconbere | 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 | aconbere | and when I try to call a function from that namespace using the functions I linked |
| 17:54 | aconbere | they can't find the generated symbol |
| 17:54 | aconbere | and it hurts my brain even to say all that |
| 17:54 | aconbere | 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 | martinklepsch | 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 | AeroNotix | ah you can just pass in your own buffer |
| 18:43 | AeroNotix | nvm |
| 18:46 | turbofail | 33 |
| 18:47 | AeroNotix | 54 |
| 18:47 | justin_smith | that's numberwang! |
| 18:48 | justin_smith | 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 | justin_smith | 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 | vas | 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 | vas | 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 | jhn | => ([1 4] [2 5] [3 6]) |
| 19:07 | jhn | how do I pass that into a function like this: (defn signs [[first second]] (if (> first second) first second)) |
| 19:07 | jhn | basically i want this to work: (map signs [1 2]), but I get |
| 19:08 | jhn | uh wait |
| 19:08 | jhn | nvm |
| 19:08 | jhn | :-) |
| 19:09 | vas | :-) |
| 19:13 | jhn | ok so here's the actual question |
| 19:13 | jhn | given that i have this function |
| 19:14 | jhn | (defn zipit [col] (map vector col (rest col))) |
| 19:14 | jhn | and this other one |
| 19:14 | jhn | (defn bigger [[first second]] (if (> first second) first second)) |
| 19:15 | jhn | 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 | AeroNotix | https://gist.github.com/AeroNotix/5f1428945cd90ca736b9 |
| 19:59 | NoCreativity | Hello! |
| 20:00 | NoCreativity | 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 | hiredman | 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 | qux | i would like a button to be enabled based on the value of a text field |
| 20:15 | qux | is seesaw.binding the right-way to do this ? |
| 20:16 | NoCreativity | hiredman: thank you! |
| 20:16 | NoCreativity | 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 | amalloy | er, i guess to-fix, not fixing. i always get the conjugations of those things wrong |
| 20:51 | amalloy | 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 | Morgawr | It's SO hard to understand what is going on.. is there a better way to do this? :/ |
| 20:53 | Morgawr | I mean, I have no idea where to even begin to parse this monster |
| 20:56 | Morgawr | 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 | Morgawr | 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 | dnolen | the only major namespace missing is clojure.pprint |
| 21:07 | Morgawr | dnolen: Alright, I'll check it out thanks. |