#clojure logs

2015-05-24

00:03justin_smithbeat it at what?
00:03justin_smithperformance? never
00:03justin_smithadoption? it would take an immense amount of work, mostly PR
00:03justin_smithdeveloper productivity? they already win on that metric
00:05crocketjustin_smith, haskell performance could be indistinguishable from C++ performance.
00:05crocketfor most practical purposes.
00:06justin_smiththat's not the same as haskell every outperforming c++
00:06crocketWill haskell GPU programming become simple?
00:06justin_smith*ever
00:06crocketWill haskell GPU programming become simple without losing performance?
00:07epicherocrocket... if you want functional GPU programming try http://fsharp.org/use/gpu/
00:07crocketF#
00:08epicheroyes, Alea GPU
00:08crocketIf F# can do it, then other languages, too..
00:08epicheroyou could also probably use clojure clr
00:09justin_smithepichero: sure, but even for that, the first step is turning your code into matrix operations, and often that's the hard part, and it's language agnostic
00:09crocketjustin_smith, It is going to require you to think in terms of matrix.
00:09justin_smithI mean if you are doing a media encoder / decoder / renderer / DSP yeah it'll be easy to use, because what you are doing is matrixes
00:09crocketIf you know how to think in matrix, then it's not that difficult.
00:09crocketmatrices
00:09justin_smithcrocket: sure, but most of the stuff we do now, that is too slow, isn't matrix problems
00:10crocketjustin_smith, Can you give me specific examples of slow things?
00:10justin_smithunless you are doing DSP, media work, etc.
00:10justin_smithleiningen startup time
00:10justin_smithclojure boot time
00:10crocketwell...
00:10justin_smithgood luck turning those into matrix operations
00:10crocketboot time is one-time cost.
00:10epicherohaving toolchain support is important for things like this but tbh i'm not invested in this topic
00:11crocketAfter starting up, it is fast...
00:12justin_smithcrocket: OK, eval is slow
00:12crocketDoesn't clojure compile once and just use the bytecodes?
00:13justin_smithyes, but you can use the compiler at runtime, which we avoid, because it is slow
00:13justin_smith*compile
00:13crocketWhy don't you compile it in advance?
00:14justin_smithcrocket: we do, but if eval wasn't slow, we wouldn't need to. See fexprs (runtime macros). A feature clojure won't have for performance reasons, (maybe other reasons too)
00:14justin_smithcrocket: I'm nost saying cuda is useless, but if you keep track of the things you wait for your computer to do, many of them simply are not reducable to matrix operations
00:15justin_smiththe javascript engine in my browser, waiting for tools like leiningen to execute some task, these are the sorts of things I notice waiting on.
00:15crocketjustin_smith, I was thinking about machine learning applications.
00:16crocketWhy does your browser wait for leiningen?
00:17crocketDoes ClojureScript launch leiningen on web browsers?
00:18justin_smithcrocket: those are two examples of what is actually too slow on my computer
00:19justin_smithI don't use machine learning at the moment, if I was using it, I would look into cuda, yes
00:20crocketI really don't want to use C++...
00:20crocketC++ is complex
00:21justin_smithmaking clojure perform 1/10th as fast as c++ (usually the limit) is also quite complex
00:21crocket1/10th is harsh.
00:21justin_smithperformance requires work and expertise, if you are interested in high performance computing, it's a whole field, but it's not easy
00:21crocketI though it was close to 1/3rd.
00:21justin_smith1/10th the speed of c++ is amazing
00:21justin_smithif js could get that fast they would be bragging
00:22crocketIf most of your operations run on cuda, clojure wouldn't be 1/10th as fast as C++.
00:22crocketBecause clojure isn't the bottleneck.
00:23justin_smith1/10th is a fudge. idiomatic clojure at its best is about 1/10th the speed of java, in most cases to go faster than that it is easier to write a java class. java can approach 1/3 the speed of c++ or maybe slightly better for some problems
00:23crocketMost machine learning applications run on cuda.
00:23justin_smithcrocket: clojure is a huge bottleneck
00:23crocketjustin_smith, I think you can outsource performance-sensitive tasks to java or C++ from clojure.
00:24crocketvectorz-clj and clatrix do that.
00:24justin_smithcrocket: as I mentioned, you end up using cuda as a sub-language or a domain specific language, at that point it hardly matters whether the host is c++, clojure, assembly, python - the operations available and their semantics don't change at all
00:24justin_smithcrocket: yes, any language can shell out to something faster, but that isn't free.
00:25crocketjustin_smith, In case of vectorz-clj, is it almost free.
00:25justin_smithI'm not saying you shouldn't try to do high performance clojure (I got an excellent book on the topic, I highly recommend it), but high performance clojure isn't easy, and often the easiest thing for the last mile is just write some java
00:25crocketwel
00:27justin_smithcrocket: and vectorz-clj isn't free. To get the best performance you give up on immutability, which is likely clojure's single most important feature.
00:30justin_smitheven more so with haskell's usage of cuda - you end up in a subdomain that lacks lazy evaluation, monadic control of side effects, and immutability, and has almost zero useful type system. It's effectivly C with a weird syntax at that point regardless of the language you think you are using. Which is a large part of why people using those facilities are just programming in C or C++.
00:47crocketjustin_smith, You give up on immutability in tiny corner cases....
00:47crocketWhich can still be manageable.
00:48crocketIn most parts of your AI program, performance is not that important.
00:48crocketExtreme performance is needed in tiny areas.
00:49crocketRather than giving up the productivity of clojure and haskell, you just use them.
03:56dfletcherhi file-seq is giving me the whole tree. similar func that gives just one dir level? or hum, filter this list I guess?
04:18dfletcherhum well that's rather unsatisfying http://pastebin.com/PvurL4Au .. works though I suppose.
04:34crocketIt's important to distinguish parallelism from distribution. Distributed computing is a specialization of parallel computing where the processors don't reside in the same computer and where tasks are distributed to computers over a network. It'd be like Lady Gaga asking Beyoncé, "Please text this guy while I drink."
04:35crocketA quote from braveclojure.com
04:38entityI have coded this ery simple REPL , but for some reason, it won't let me redefine global bindings: http://pastie.org/10204590
04:39entityand I can't figure out why not :(
04:39crocketPlease text this guy while I drink.
04:40entitynot helpful
04:42entityI'm open to suggestions as to how to correctly implement a REPL into my app that imports a couple namespaces at startup
05:15[mad]hi
06:30crocketAre macros expanded after compilation?
06:32jack0Does anyone know how to setup leningen on windows?
06:36crocketjack0, It's leiningen.
06:46amalloyentity: you can't use def in namespace a to replace a var in namespace b
06:48amalloyeg, try this in clojure's built-in repl, and you get the same result: (intern (create-ns 'test.foo) 'x 1) (refer 'test.foo) (def x 2)
07:10crocket(defn-
07:10crocket,(defn- screw-you [] true)
07:10clojurebot#'sandbox/screw-you
07:10crocket,(defn screw-you [] true)
07:10clojurebot#'sandbox/screw-you
07:10crocket,(defn screw-you [] true)
07:10clojurebot#'sandbox/screw-you
07:16Kneiva,(let [op (first '(+ 1 2)) rst (rest '(+ 1 2))] (apply op rst))
07:16clojurebot2
07:16KneivaWhat's happening here? ^
07:18crocket(+ 1 2) happened.
07:18clojurebot3
07:18crocketKneiva, Do not try to complicate.
07:18crocketIt just means (+ 1 2)
07:18crocket,(rest '(+ 1 2))
07:18clojurebot(1 2)
07:19crocket,(doc apply)
07:19clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
07:19KneivaBut the result is 2 not 3...
07:23crocketKneiva, I think you just found a bug.
07:23crocketA clojure bug
07:24clojerI have Midje running on autotest in an Emacs cider repl but after a source update it's still showing old test results. Any ideas?
07:25crocketKneiva, The result was (apply '+ '(1 2))
07:26winkyeah
07:26wink(type +) != (type (first '(+ 1 2))
07:26winkthe former is clojure.core$_PLUS_$
07:26winkthe latter is Symbol
07:26crocketWhy does (apply '+ '(1 2)) return 2?
07:28crocketHow do I get the value that '+ refers to?
07:30winkthat's a good question
07:32Kneiva,(resolve '+)
07:32clojurebot#'clojure.core/+
07:33Kneivabut applying something to '+ (or any symbol) seems a bit strange
07:33winkmaybe quote helps?
07:34winkyou might find help when reading stuff about macros
07:34winkbut otherwise, no idea :)
07:37Kneiva,(doc symbol)
07:37clojurebot"([name] [ns name]); Returns a Symbol with the given namespace and name."
07:37crocket,(let [op (first (eval '(+ 1 2))) rst (rest '(+ 1 2))] (apply op rst))
07:37clojurebot#error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 528]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 528]\n [clojure.lang.RT seq "RT.java" 509]\n [clojure.lang.RT first "RT.java" 654]\n [clojure.core$first__4107 ...
07:37crocket,(let [op (eval (first '(+ 1 2))) rst (rest '(+ 1 2))] (apply op rst))
07:37clojurebot3
07:38crocketKneiva, ^^
07:38crocketevaluate the symbol to the function
07:38crocketevaluate the symbol to get the function
07:39OrbitalKitten,(let [op (first '(+ 1 2)) rst (rest '(+ 1 2))] (apply (resolve op) rst))
07:39clojurebot3
07:39OrbitalKittenthat doesn't explain how apply to a Symbol returns the second argument
07:39KneivaYeah, but that won't work since I'm doing 4clojure and it doesn't allow evaluate =)
07:40crocketok
07:40crocketI think the behavior of apply is undefined when the first argument is a symbol.
07:41crocketProbably, apply just uses 'second' when it is passed a symbol in the first parameter.
07:41crocket,(second [1 2])
07:41clojurebot2
07:41crocket,(apply '+ 2)
07:41clojurebot#error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 528]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 528]\n [clojure.lang.RT seq "RT.java" 509]\n [clojure.core$seq__4125 invoke "core.clj" 135]\n [clojure.core$app...
07:41crocket,(apply '+ [2])
07:41clojurebotnil
07:41crocket,(second [2])
07:41clojurebotnil
07:44Kneivaok. maybe apply shouldn't accept symbols
07:45OrbitalKittenoh
07:46OrbitalKittenso
07:46OrbitalKittenSymbol implements IFn
07:47OrbitalKittenand extends AFn which provides an invoke method
07:47OrbitalKittenpublic Object invoke(Object obj, Object notFound) {
07:47OrbitalKitten return RT.get(obj, this, notFound);
07:47OrbitalKitten}
07:48OrbitalKittenHence returning the 'second' argument
07:48Kneivaah
07:54luxbock,('foo {'foo :bar})
07:54clojurebot:bar
07:54luxbock,('foo {'bar :bar} :not-found)
07:54clojurebot:not-found
08:01TMA,(apply '+ [{'+ 1} :nf])
08:01clojurebot1
08:07kaiyinhi. could anyone help me with this? http://stackoverflow.com/questions/30418232/contextual-eval-in-clojure/30423110?noredirect=1#comment48931815_30423110
08:09winkKneiva: you could try aliasing "add" to +
08:56gfrederickskaiyin: looking at your modification, I would guess the two are only equivalent when the values in your context map are literals
08:56gfrederickswhich they are in this example, since they're numbers
08:56kaiyinyeah.
08:57gfredericks,(def literal-expr 42)
08:57clojurebot#'sandbox/literal-expr
08:58gfredericks,(def other-expr '(* 2 3 7))
08:58clojurebot#'sandbox/other-expr
08:58gfredericks,`(let [v1 `'~literal-expr, v2 `'~other-expr] ...)
08:58clojurebot(clojure.core/let [sandbox/v1 (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list sandbox/literal-expr))) sandbox/v2 (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list sandbox/other-expr)))] ...)
08:58gfrederickshah ew
08:59gfredericks,`(let [v1 ~`'~literal-expr, v2 ~`'~other-expr] ...)
08:59clojurebot(clojure.core/let [sandbox/v1 (quote 42) sandbox/v2 (quote (* 2 3 7))] ...)
08:59gfredericks,`(let [v1 ~`'~literal-expr, v2 ~`'~other-expr v3 ~`~literal-expr v4 ~`~other-expr] ...)
08:59clojurebot(clojure.core/let [sandbox/v1 (quote 42) sandbox/v2 (quote (* 2 3 7)) sandbox/v3 ...] ...)
08:59gfrederickswell clojurebot is not helping
08:59gfredericksanyhow
08:59gfrederickskaiyin: is there still something you need help with?
09:00kaiyingfredericks: nothing specific, I am just trying to get a better understanding of the quote/unquote business.
09:01gfredericksit's easy to play with at a repl without calling eval or using macros
09:01kaiyingfredericks: I have added more examples to the question, could you have a look again? http://stackoverflow.com/questions/30418232/contextual-eval-in-clojure
09:06gfrederickskaiyin: so when you say "gets the job done" you mean that (pprint (contextual-eval '{a (* 2 3) b (inc 11)} '(+ a b))) returns 17?
09:06gfredericksor 18 rather
09:07kaiyinyeah, 18
09:07gfredericksI guess the key point here is that it's not obvious whether that's correct or not
09:07gfredericksdepends on the requirements for the function
09:07gfrederickswhich depends either on what the book is aiming at or what you're interested in writing
09:08gfredericksit's totally plausible to have a function like this where you *don't* want the values in the map to be evaluated
09:08gfredericksin fact I would expect that to be a more plausible use case than the other way
09:08gfrederickswhich is probably why JoC has theirs the way it is
09:17kaiyingfredericks: using `'v might actually cause serious trouble here, please see the SO question again (edited).
09:18gfrederickskaiyin: that's consistent with what I'm saying
09:18gfrederickskaiyin: the trouble is just the function being implemented one way and the user expecting the other
09:19gfrederickskaiyin: if you instead call it like: (pprint (contextual-eval {'a (inc 3) 'b (* 3 4)} '(+ a b)))
09:19gfredericksthen it should work
09:24kaiyin,(eval (clojure.core/let [a '(* 2 3) b '(inc 11)] (+ a b)))
09:25clojurebot#error {\n :cause "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers add "Numbers.java" 128]}]\n :trace\n [[clojure.lang.Numbers add "Numbers.java" 128]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "C...
09:25kaiyin,(eval (let [a '6 b '12] (+ a b)))
09:25clojurebot18
09:26kaiyinstrange. why isn't '(* 2 3) evaluated?
09:26gfredericksthe '6 isn't evaluated either
09:27gfredericksputting a ' in front of something is exactly to prevent it from being evaluated
09:27gfredericksalso note that your eval call in these examples is redundant
09:27gfredericks,(let [a '(* 2 3) b '(inc 11)] (+ a b))
09:27clojurebot#error {\n :cause "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers add "Numbers.java" 128]}]\n :trace\n [[clojure.lang.Numbers add "Numbers.java" 128]\n [sandbox$eval73 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "C...
09:27gfredericks,(let [a '6 b '12] (+ a b))
09:27clojurebot18
09:28kaiyin,(eval `(let [a '6 b '12] (+ a b)))
09:28clojurebot#error {\n :cause "Can't let qualified name: sandbox/a"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Can't let qualified name: sandbox/a, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]}\n {:type java.lang.RuntimeException\n :message "Can't let qualified name: sandbox/a"\n :at [clojure.lang.U...
09:28gfrederickskaiyin: this might help http://www.infoq.com/presentations/macros-clojure-west-2013
09:29kaiyincool.
09:32gfrederickskaiyin: also it looks like your repl prints things out using the "'" and "~" characters?
09:33gfredericksthat's not how most repls work; I'm not sure if that ends up being more or less confusing though
09:33gfredericksmight be worth comparing to a normal repl
09:36kaiyinok, I am using a repl in cursive.
09:36kaiyinwill try it in lein repl.
09:36clojurebotIt's greek to me.
09:38gfredericksI would've guessed cursive :) it's colin being fancy I bet
09:39kaiyingfredericks: I don't observe any difference in lein repl, though.
09:41gfrederickskaiyin: compare entering "''x" in each
09:41gfredericksmy guess is your cursive repl prints "'x"
09:41gfrederickswhereas:
09:41gfredericks, ''x
09:41clojurebot(quote x)
09:41gfredericksalso try "~x"
09:41gfredericksor '~x rather
09:41gfredericks, '~x
09:42clojurebot(clojure.core/unquote x)
09:52kaiyingfredericks: ah, that is rather pprint being fancy.
09:52justin_smith,(clojure.pprint/pprint '~x)
09:52clojurebot#error {\n :cause "clojure.pprint"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "clojure.pprint"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.n...
09:53justin_smith(require 'clojure.pprint)
09:53justin_smith,(require 'clojure.pprint)
09:53clojurebotnil
09:53justin_smith,(clojure.pprint/pprint '~x)
09:53clojurebot~x\n
09:53justin_smithyup, pprint
09:54kaiyin,(eval '(clojure.core/let [a (quote 6) b (quote 12)] (+ a b)))
09:54clojurebot18
09:55kaiyin,(eval '(clojure.core/let [a (quote (* 2 3)) b (quote (inc 11))] (+ a b)))
09:55clojurebot#error {\n :cause "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers add "Numbers.java" 128]}]\n :trace\n [[clojure.lang.Numbers add "Numbers.java" 128]\n [sandbox$eval123 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "...
09:55kaiyinnow, the question is why the form 1 get evaled ok, but not form 2.
09:55gfredericksman I would not have guessed
09:56justin_smith,(type '1)
09:56gfredericks,(+ (quote 6) (quote 12))
09:56clojurebot18
09:56clojurebotjava.lang.Long
09:56gfrederickskaiyin: ^ that's why
09:56justin_smith,(type '(inc 1))
09:56clojurebotclojure.lang.PersistentList
09:56justin_smiththat's the issue
09:56kaiyinso '6 is implicitly coerced into a long?
09:57justin_smith'6 is a long, there is no coersion
09:57gfrederickssorta
09:57gfredericksit has to be evaluated first :)
09:57gfredericksit's read as a list, then eval'd to a long, then sometimes evaled again where it stays a long
09:58gfredericksthere's a lot of confusion when trying to work these things out because the repl itself does an extra eval
09:58justin_smithrEpl
09:58gfredericks,(clojure.pprint/pprint ''''x)
09:58clojurebot'''x\n
09:58gfredericks^ note the transition from "''''x" to "'''x"
09:59gfredericks,(clojure.pprint/pprint (eval ''''x))
09:59clojurebot''x\n
09:59gfredericks,(clojure.pprint/pprint (eval (eval ''''x)))
09:59clojurebot'x\n
09:59gfrederickseach evaluation loses a '
09:59kaiyinhm, i see.
09:59gfredericksbut one of them gets lost right away because of the repl evaling implicitly
10:00gfredericksthe other cause of confusion is that most literals, including numbers, eval to themselves
10:00gfredericks,4
10:00clojurebot4
10:00gfredericks,(eval 4)
10:00clojurebot4
10:00gfredericks,(eval (eval 4))
10:00clojurebot4
10:00gfredericksetc.
10:00gfredericksso you could be evaluating something more times than you thought and not notice
10:07crocketBy measuring the time it takes to multiply two 100x100 matrices, core.matrix performs at the same level as vectorz-clj.
10:07crocketDid I measure the time wrong?
10:09justin_smiththe reliable way to microbenchmark clojure performance is to use criterium
10:13crocketHow do I make sure core.matrix is used if project.clj contains both core.matrix and vectorz-clj?
10:14justin_smithcore.matrix is not an implementation, it's a protocol that a matrix library can implement
10:15crocketI was talking about :persistent-vector implementation.
10:15crocketThe default implementation.
10:16justin_smithit should be tied to the type, thus the code that creates the matrix
10:25crocketJesus
10:25crocketHoly Christ
10:26crocketvectorz-clj is as performant as clatrix when it comes to multiplication of two 100x100 matrices.
10:26crocketAlmost same performance
10:26crocketindistinguishable
10:26crocketYay
12:10luxbockcrocket: there's also: http://neanderthal.uncomplicate.org/
12:10luxbockhttp://neanderthal.uncomplicate.org/articles/benchmarks.html
12:39gfredericksgood morning
12:57justin_smithgood morning
13:45mmeixgood evening from Austria
13:45mmeixshort question:
13:45justin_smithmmeix: it was afternoon in gfredericks' timezone when he said that
13:45mmeixah ok -)
13:46TimMcg'mornin'
13:46mmeixso:
13:46mmeix,(apply min [1 2])
13:46clojurebot1
13:46mmeixok
13:46mmeixhow to guard again:
13:46mmeix,(apply min [])
13:46clojurebot#error {\n :cause "Wrong number of args (0) passed to: core/min"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (0) passed to: core/min"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.RestFn invoke "RestFn.java" 399]\n [clojure.lang.AFn applyToHelper "AFn.java" 152]\n [clojure.lang....
13:47mmeixthe vector might come in as empty
13:47TimMcmmeix: You could call empty? on the collection to check.
13:47mmeixok, easy enough
13:47mmeixthanks
13:48justin_smith,(min-key identity [])
13:48clojurebot[]
13:48justin_smith,(apply min-key identity [])
13:48clojurebot#error {\n :cause "Wrong number of args (1) passed to: core/min-key"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: core/min-key"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.RestFn invoke "RestFn.java" 412]\n [clojure.lang.AFn applyToHelper "AFn.java" 154]\n [cloju...
13:48justin_smithsame issue, just checking
13:49mmeixwould this be a use case for :pre ?
13:49mmeix(and does :pre work as expected in clojurescript?)
13:57gfredericksjustin_smith no it wasn't
14:01kaiyinin lein repl, using files that have been modified after repl started causes an error: CompilerException java.lang.Exception: namespace '...' not found
14:01kaiyinhow do you solved this?
14:02justin_smithkaiyin: (require 'some.ns :reload)
14:07justin_smithand that error specifically happens if there was an error when you first loaded the namespace. The require mechanism thinks it's been fulfilled, but the code didn't get loaded.
14:08augustlis it possible to merge component system-maps?
14:09justin_smithaugustl: the system using other components can merge their maps, that's easy to do
14:09augustljustin_smith: using clojure.core/merge?
14:10justin_smithwell, all the maps come in as keys under one map
14:10augustljustin_smith: should I merge the raw map before calling system-map on them?
14:10justin_smithno, I'm saying one of the components can merge them before using them
14:11justin_smithmerging them on that level would ruin one of the main points of using component
14:12justin_smithwhich is explicitly declaring access between dependencies. If you could merge the system maps, the dependency graph wouldn't make sense.
14:12augustljustin_smith: I'll re-read what you said after eating some food, my brain is running on low gear :)
14:22TimMcmmeix: Probably not, unless you just want an AssertionError instead of an ArityException.
14:23mmeixok, so it's better to think through all cases and build branches into a function
14:24mmeix(if I cannot guarantee, that a coll could come in empty)
14:24mmeixthanks!
14:40kaiyinIsn't this a bug, allowing function name to be nil? https://github.com/joyofclojure/book-source/blob/959578a5514e8a2d1d2da7e7f8ed84c517f5c9cb/first-edition/src/joy/contracts.clj#L11
14:41kaiyin,(fn nil [x] (inc x))
14:41clojurebot#error {\n :cause "Parameter declaration should be a vector"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Parameter declaration should be a vector, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.IllegalArgumentException\n :message "Parameter declaration should ...
14:41kaiyin,(fn f [x] (inc x))
14:41clojurebot#object[sandbox$eval47$f__48 0x495d0dbf "sandbox$eval47$f__48@495d0dbf"]
14:55jack0how clojure.xml/parse work?
14:55TimMckaiyan, that does seem odd even though you're no longer in the room.
15:06justin_smith,(list* 'fn nil '[[](a b c)))
15:06clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
15:06justin_smith,(list* 'fn nil '[[](a b c))
15:06clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
15:06justin_smith,(list* 'fn nil '[[](a b c)])
15:06clojurebot(fn nil [] (a b c))
15:07gfredericks,(eval (list* 'fn nil '[[](a b c)]))
15:07clojurebot#error {\n :cause "Parameter declaration should be a vector"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Parameter declaration should be a vector, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.IllegalArgumentException\n :message "Parameter declaration should ...
15:07justin_smithmaybe it worked with some ancient clojure version?
15:18gfredericksyeah that was my first guess
16:37augustljustin_smith: hmm, food didn't help :) Do you have a concrete example?
16:48amalloy&(fn nil [] 1)
16:48lazybotjava.lang.IllegalArgumentException: Parameter declaration should be a vector
16:50amalloymaybe it never worked, but they didn't test it that way. the only exampe in that gist supplies the optional name param
17:40kaiyinanyone here who is also good at R? http://stackoverflow.com/questions/30428610/compute-in-a-new-thread-and-refer-to-results-later-in-r
18:46cfleminggfredericks: I haven't read that whole thread, but am I correct in thinking that the fanciness wasn't mine in the end?
19:01justin_smithcfleming: it was pprint
19:01cflemingjustin_smith: Ok, thanks.
19:32justin_smithaugustl: so the normal thing is that you use system-using to declare which components access data from other components
19:32justin_smithaugustl: you can merge the incoming components with (reduce merge (vals this)) in your start method
19:32justin_smithor (reduce merge (vals component)) to use the name usually provided in the examples
19:33justin_smithaugustl: but there is a benefit to isolating the dependencies (including the fact that components might have duplicate resources like :channel or :server)
20:23gfredericks~the fanciness |was not| cfleming's in the end
20:23clojurebotAlles klar
20:23cfleminggfredericks: I mean, I'm pretty fancy
20:25cfleminggfredericks: But not as fancy as pprint, as it turns out
20:26gfredericks~cfleming |has| a fanciness level strictly between println and pprint
20:26clojurebot'Sea, mhuise.
20:26cflemingclojurebot gets wiser by the day
20:26gfredericksin particular his fanciness is normalled called "cflprint"
20:27gfredericksnormally*
20:27gfrederickswhich is pronounced "siffle-print"
20:28cflemingI like that.
20:29gfredericksthe implementation of cflprint is left as an exercise for the reader
20:31gfredericksset theory notation doesn't have disj do they
20:31gfredericksthey just have $X \setminus \{x\}$
20:36gfredericksso let's say my :user profile is
20:36gfredericks[{...} :foo]
20:36gfredericksshould it be possible to use `with-profile -foo ...` to obtain just the {...} part?
21:02justin_smithgfredericks: are you using a weird pseudo syntax there?
21:05SeyleriusI can't seem to actually load the clojure cheatsheet's link to the / function
21:06gfredericksjustin_smith: latex?
21:06gfredericksjustin_smith: or the profile stuff?
21:06justin_smithgfredericks: the :user profile
21:06SeyleriusIt's giving me a 404.
21:06gfredericksjustin_smith: no, profiles can be vectors
21:07gfredericksjustin_smith: a vector of maps and names of other profiles
21:07justin_smithdoesn't look like any profile I have used, so I wondered
21:07justin_smithOK, cool, feature I've never used
21:07gfredericksjustin_smith: I use it pretty heavily https://github.com/gfredericks/dotfiles/blob/master/.lein/profiles.clj.symlink
21:07gfrederickshelps keep things organized
21:08justin_smithSeylerius: http://conj.io/store/v1/org.clojure/clojure/1.7.0-alpha4/clj/clojure.core/%2F/ conj.io (grimoire) version
21:09justin_smithgfredericks: cool, it uses a bunch of stuff I haven't tried, I'll need to try some of that
21:09justin_smithgfredericks: was thinking of making a lein alias for my coworkers that would launch figwheel and "less auto" automatically
21:18SeyleriusWhat's the simplest way to turn [1 2 3 4 5 6 7 8 9] into [1 1 1 2 2 2 3 3 3]?
21:18SeyleriusI feel like quot is close, but it'll just round to the nearest, when I need up.
21:19justin_smith,(apply concat (map (partial repeat 3) [1 2 3 4 5 6 7 8]))
21:19clojurebot(1 1 1 2 2 ...)
21:19justin_smithoh, wrong pattern
21:20justin_smith,(map (comp inc (partial rem 3)) [1 2 3 4 5 6 7 8 9])
21:20SeyleriusMore precisely, I'm passing &&(range 1 10) into a function,
21:20clojurebot(1 2 1 4 4 ...)
21:20justin_smitherr...
21:21Seylerius(I thought && woke up lazybot...)
21:21SeyleriusIt must be ##
21:21justin_smith,(map (comp inc #(rem % 3)) [1 2 3 4 5 6 7 8 9])
21:21clojurebot(2 3 1 2 3 ...)
21:21justin_smithugh
21:21SeyleriusRight.
21:21justin_smith,(map (comp inc #(quot % 3)) [1 2 3 4 5 6 7 8 9])
21:21clojurebot(1 1 2 2 2 ...)
21:21justin_smithstill not it
21:22justin_smith&(map (comp inc #(quot % 3) dec) [1 2 3 4 5 6 7 8 9])
21:22lazybot⇒ (1 1 1 2 2 2 3 3 3)
21:22Seylerius,(map #(quot % 3) (range 9))
21:22clojurebot(0 0 0 1 1 ...)
21:22justin_smithso you want dec, quot, inc
21:23SeyleriusThat oughta do it, thanks.
21:23SeyleriusWidgets in a seesaw container should retain order, right?
21:24justin_smithSeylerius: some containers have rules for how they place things
21:24justin_smithI don't know what the default is though
21:41drojasHi, is anyone here familiar with core.match?
21:57TEttinger,(map (comp inc int (partial * 0.333333)) [1 2 3 4 5 6 7 8 9])
21:57clojurebot(1 1 1 2 2 ...)
21:58justin_smithTEttinger: heh, that's another way to do it
21:58TEttingeror!
21:58TEttinger,(map (comp inc int (partial * 1/3)) [1 2 3 4 5 6 7 8 9])
21:58clojurebot(1 1 2 2 2 ...)
21:58TEttingeroooh!
21:58TEttingerdifferent
21:58justin_smiththose tricksy decimals
21:58gfredericksthere might be a continuous function for this
22:01TEttingergfredericks: continuous for the 1 1 1 2 2 2 ... problem?
22:01gfredericksyeah
22:02TEttingerso what would 3.5 be?
22:19gfredericks(f 3.5)?
22:21TEttinger1 2 3 4 5 6 => 1 1 1 2 2 2
22:22TEttinger2 2.5 3 3.5 4 4.5 => ???
22:22lazybotTEttinger: Oh, absolutely.
22:24gfredericksTEttinger: gimme a minute
22:34TEttingerthis is fun
22:34TEttinger,(map #(inc (read-string (apply str (drop-last (format "3r%03d" (Integer. (Integer/toString (dec %) 3))))))) [1 2 3 4 5 6 7 8 9])
22:34clojurebot(1 1 1 2 2 ...)
22:34TEttingerI wish dealing with non-binary, non-decimal, non-hex bases was easier
22:35TEttingerthis one converts it to a string of ternary digits and discards the least significant trit
22:39gfredericks,(defn triples [x] (let [f #(/ (- (Math/sin (* Math/PI (+ % (/ 7.0 4)) (/ 2.0 3))) (Math/sin (* 7 (/ Math/PI 6)))) 1.5)] (+ (/ x 3) (* (/ 2.0 3) (f (+ 1 x))) (* (/ 1.0 3) (f x)))))
22:39clojurebot#'sandbox/triples
22:39gfredericks,(map triples [1 2 3 4 5 6])
22:39clojurebot(0.9999999999999994 1.0000000000000002 0.9999999999999993 1.9999999999999991 2.000000000000001 ...)
22:39gfredericks,(map triples [2 2.5 3 3.5 4 4.5])
22:39clojurebot(1.0000000000000002 0.8333333333333331 0.9999999999999993 1.4999999999999996 1.9999999999999991 ...)
22:39gfrederickspardon my floats
22:40gfredericksTEttinger: ^
22:40TEttinger&(let [base 36] (map #(inc (read-string (apply str (drop-last (format "%dr%03d" base (Integer. (Integer/toString (dec %) base))))))) (range 1 100)))
22:40lazybotjava.lang.NumberFormatException: For input string: "a"
22:40TEttingeraw
22:44cryptackanyone have a mac and experienced problems with tab completion when using lien's repl?
22:44TEttinger&(let [base 36] (map #(inc (read-string (apply str "0" (drop-last (Integer/toString (dec %) base))))) (range 1 100)))
22:44lazybot⇒ (1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3)
22:44TEttingernice
22:44cryptackfor whatever reason, it works just fine on Windows, but when attempting on OS X it doesn't provide any completion
22:45TEttingercryptack, is your mac using macports' version of lein?
22:45TEttingerit may be very outdated
22:45TEttinger&(let [base 17] (map #(inc (read-string (apply str "0" (drop-last (Integer/toString (dec %) base))))) (range 1 100)))
22:45lazybot⇒ (1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6)
22:46cryptackTEttinger: no, it was installed via brew
22:47TEttingerif you run the command: lein version
22:47TEttingerwhat does that print?
22:47TEttinger(possible there's something wrong with the jline or whatever wrapper it uses)
22:47cryptackTEttinger: Leiningen 2.5.1 on Java 1.8.0_45 Java HotSpot(TM) 64-Bit Server VM
22:47TEttingerthat's about as new as it gets
22:48cryptackyeah, it seems pretty strange to me
22:49cryptackand I'm very new to clojure/lien so I'm not even certain where to start to look into it
22:49TEttingerI'd try re-self-installing. you can rename the jar that lein downloads when it installs, that's where the whole program is except for the launcher script 'lein', then running 'lein selfinstall' or it might be 'lein self-install'
22:49TEttingerlet me see where that jar is on mac
22:49cryptackok
22:52TEttingerok, run: lein self-install
22:53TEttingerthat will tell you where the jar is; delete or preferably rename it, then run 'lein self-install' again
22:58MichaelGreevesi find 4 year old girls sexually attractive
23:05currentoorHey does anyone have a break point repl that works inside a webserver?
23:05currentoorSort of like the pry gem that you can use in rails?
23:06TEttingercurrentoor: cursive does have a breakpoint debugger
23:07currentoorbut I'd have to use intellij for that right?
23:07cflemingcurrentoor: Right.
23:07currentoorI was thinking of something that I could use in the terminal
23:07currentooreditor agnostic
23:08cflemingcurrentoor: You could check out clj-debugger
23:09currentoorhmm thanks!
23:16smokeinkhello ! has anyone got an emacs configuration for opening local "/usr/share/doc/java8-openjdk/api/" javadoc in w3m inside emacs?
23:34bluesnowWhy does (remove #{5 7 false} (cons false (range 10))) return (false 0 1 2 3 4 6 8 9)?
23:35bluesnowShouldn't the predicate evaluate to true on false, since false is a member of the set?
23:35bluesnowI thought that false would be removed from the result
23:37TimMcbluesnow: ##(map #{1 2 nil true false} [1 2 nil true false "hello"])
23:37lazybot⇒ (1 2 nil true false nil)
23:37bluesnowoh never mind, I see what's happening. the set is used as a function to look up false, false is returned, and evals to false
23:38bluesnowyeah, thanks
23:38TimMcSets return the element if they contain it. Sometimes this is not what you wanted.
23:38bluesnowyep
23:38bluesnowhave to use contains? for this case
23:59TimMc&(map (partial contains? #{1 2 nil true false}) [1 2 nil true false "hello"])
23:59lazybot⇒ (true true true true true false)