This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-22
Channels
- # admin-announcements (5)
- # aws (32)
- # beginners (2)
- # boot (51)
- # cider (33)
- # cljs-dev (4)
- # clojure (83)
- # clojure-berlin (11)
- # clojure-czech (23)
- # clojure-poland (3)
- # clojure-russia (51)
- # clojure-seattle (4)
- # clojure-sg (1)
- # clojure-uk (4)
- # clojurescript (48)
- # clojurex (1)
- # datomic (26)
- # devcards (10)
- # devops (12)
- # editors (9)
- # emacs (12)
- # events (1)
- # funcool (14)
- # hoplon (117)
- # immutant (1)
- # jobs (2)
- # ldnclj (32)
- # ldnproclodo (12)
- # om (51)
- # onyx (17)
- # reagent (11)
- # yada (4)
@profil you might want to use core.matrix
if you are doing a lot of computations with arrays of numbers
hi. is there any way using Stuart’s components to decompose system so, that one of its components depends on the other defined (with all its dependencies) “outside” the function? i tried something like this: https://gist.github.com/mbuczko/f79ff7658c902746fdf0 but it doesn’t really work.
@michal: I've seen namespaced keys within a system recommended as a way to show seperation. Or you could make a new record that implements Lifecycle by doing start/stop on the sub-system
similar question on mailing list while back -- https://groups.google.com/d/msg/clojure/2-baBp61XTs/d42XerDcu2wJ
The folling is a function but how to call it? (fn[x] (take x)) say I want to pass x as 4, and a vector of [1 2 3 4], what's the code to call the function use these paramters?
core=> ((fn[x] (take x)) 4 [1 2 3 4]) ArityException Wrong number of args (2) passed to: core/eval1975/fn--1976 cloju re.lang.AFn.throwArity (AFn.java:429)
core=> ((fn[x] (take x)) 4) ArityException Wrong number of args (1) passed to: core/take clojure.lang.AFn.t hrowArity (AFn.java:429)
ok, then (fn[x] (take x)) is a valid function, but we can't call it? The following shows it's a valid function core=> (fn[x] (take x)) #<core$eval1983$fn__1984 vertica.core$eval1983$fn__1984@4bfcfe4a>
i really liked Marginalia for generating docs, but it doesn't work with the latest clojure and generally seems abandoned
@ul I've seen this one in several places: https://github.com/weavejester/codox
So I've been coding with performance in mind, and benchmarking, and came across the following in my code.
I've got this function:
(defn neighbors-a [[x y]]
(map vector
((juxt inc inc identity dec dec dec identity inc) x)
((juxt identity inc inc inc identity dec dec dec) y)))
And it occurred to me that calculating that juxt
every time might not be super efficient.
So I thought I'd pull those out and benchmark the difference, but I'm new to Criterium so I'm looking for a sanity check on the following:
(def juxt-x (juxt inc inc identity dec dec dec identity inc))
(def juxt-y (juxt identity inc inc inc identity dec dec dec))
(defn neighbors-b [[x y]]
(map vector (juxt-x x) (juxt-y y)))
(defn get-points [max-x max-y]
(for [x (range max-x) y (range max-y)] [x y]))
(def sample-points (get-points 100 100))
(comment
(cr/with-progress-reporting
(cr/quick-bench (doall (map neighbors-a sample-points)) :verbose))
(cr/with-progress-reporting
(cr/quick-bench (doall (map neighbors-b sample-points)) :verbose))
)
According to the benchmarks there is an improvement going from neighbors-a
to neighbors-b
. But I'm just running these benchmarks in a REPL inside Cursive so I'm not sure if this refactoring is a truly good idea, particularly also with ClojureScript and the Google Closure compiler.
You might find Tom Crayford’s talk useful: http://yellerapp.com/posts/2015-06-29-performance-and-lies.html
@donaldball: tyvm
Since your ultimate target is clojurescript, dunno how relevant it actually is, but he does a great job of identifying performance analysis pathologies
I'm actually writing it as a library of cljc code so that it works on both, so twice the fun 😉
Does anybody know how to run another lein task when running uberjar? http://stackoverflow.com/questions/32713364/running-a-another-task-when-an-uberjar-is-created-with-leiningen
Argh. Maybe, I run into another problem that’s preventing me from figuring that one out right now. Having node installed on Heroku.
what's the deal with uberjar again, when does it perform clean and when not? I need to preserve my compiled clojurescript
Anyone using Cursive here? I'm running into a strange issue where the REPL fails to load some of the properties.
The project I'm running it on has been generated using a template, so some props have been there from the start - it's just those that I've added by hand that fail to load. The file has been saved, and this problem manifests itself only in Cursive - lein repls from terminal load the props just fine.
fyi, there is an #C050AN6QW room and @cfleming the Cursive author is on here sometimes
Ah sorry, should have had a look first. Thanks for the heads up, I'll head down there immediately!
ah, yes :)
namespace question... I know I've seen libs before with multiple top-level namespaces... I'm working on some code I plan to extract into a lib, and I'm wondering if src/my-lib
next to src/app
will work, and how I would call/require my-lib
from app
if so (assumption here is defproject app
in project.clj
Am I completely barking up the wrong tree?
The usual (ns app.bar (:require [my-lib.foo :as foo]))
should work. Try it.
Awesome, thanks!
sgerguri: there’s also a #C0744GXCJ room.
Does anybody know how can I automatically trigger lein deps when lein uberjar is run?
@pupeno: it should download things already, but if you want something explicit :profiles {:uberjar {:prep-tasks ["deps"]}}
might work
specifying :prep-tasks outside uberjar works as well (not sure if desirable)
@curtosis: not ignored, should end up with however profiles merge... which I think is just a concat there
I’m trying this in Heroku now, thanks xeqi
it took me a while to realize that there is an uberjar
task and an :uberjar
profile, and they are not the same thing.
@pupeno: np. having it globally shouldn't cause a problem, but I always like to scope thing narrow
xeqi: yeah, this should be safe, albeit unnecessary slow in some situations. I’m going to limit it to uberjar for now.
the uberjar
task invokes the :uberjar
profile... but calling a different task as with-profile uberjar
does not necessarily mean the uberjar
tasks/hooks will be invoked.
xeqi: odd, when I add :prep-tasks, I get this warning: "Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.” and indeed the uberjar doesn’t work.
pupeno: I bet its just replacing the default :prep-tasks then and not getting the compile task run... hmm
xeqi: that sounds plausible. I’m trying to understand the semantics of prep-tasks.
in general, prep-tasks is suppose to be things to run before the task jumps to the project jvm, though uberjar->jar->prep is an explicit invocation since it never starts a project jvm
I added javac and compile and now it works.
@borkdude: instead of preserving your compiled clojurescript, always clean before running uberjar, and run cljsbuild with the prod parameters as a :prep-task for :uberjar
@noisesmith: so uberjar won't clean the result of prep-tasks?
no, the clean is run before prep-tasks (and I am forgetting if specifying prep-tasks replaces the default - I put clean as the explicit first prep-task item just because I want it to be very clear to a reader that it is cleaning every time)
@noisesmith: ok cool, thanks
I do it that way because I have occasionally seen issues with calling cljsbuild with certain kinds of dep changes without a clean in between
and at least a forced clean and rebuild is a predictable and known set of behaviors
what I usually did is in Hudson lein clean, then lein test, then lein cljsbuild once production and then lein uberjar
and I don't know why I got away with uberjar on the build server, but locally it does a clean and wipes the result of lein cljsbuild
Hello, is there any former ztellman/lamina users?
I wanted to ask about migration to ztellman/manifold.