Fork me on GitHub

@profil you might want to use core.matrix if you are doing a lot of computations with arrays of numbers


(sub xs (shift xs [-1])) is close to what you want


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: 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


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?


(take x) returns a transducer


(take n coll) takes n elements of the collection coll


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 (


I want to call (fn[x] (take x)), instead of take directly


just to lean clojure function


that anonymous function takes only one argument but you're passing it two.


core=> ((fn[x] (take x)) 4) ArityException Wrong number of args (1) passed to: core/take clojure.lang.AFn.t hrowArity (


still wrong


((fn [x c] (take x c)) 4 [1 2 3 4])


@wqhhust: there is a #C053AK3F9 channel


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>


no, you can. but that arity of take is not available in your version of clojure.


(fn [x] (take)) also returns a fn object, but it will throw an exception when called.


ok, a valid function could just throw exception when call, thanks.


that doesn't really have much to do with what you seem to be trying to do though


i really liked Marginalia for generating docs, but it doesn't work with the latest clojure and generally seems abandoned


what are options for minimalistic but beautiful doc generation today?


@ul I've seen this one in several places:


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))

    (cr/quick-bench (doall (map neighbors-a sample-points)) :verbose))
    (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.


Any advice?


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 😉


But I expect to personally use it mostly on clojurescript


lein uberjar && lein deps ?


oh when sorry


lein deps is run automatically I think

Pablo Fernandez14:09:29

Argh. Maybe, I run into another problem that’s preventing me from figuring that one out right now. Having node installed on Heroku.


I'm not familiar wth heroku. maybe i'ts limiting the memory ?


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.

Alex Miller (Clojure team)15:09:52

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!


There’s also a #C0744GXCJ room


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 (:require [ :as foo])) should work. Try it.


Awesome, thanks!

Pablo Fernandez16:09:45

sgerguri: there’s also a #C0744GXCJ room.

Pablo Fernandez16:09:08

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


xeqi: does uberjar ignore the top-level :prep-tasks, or is it a merge?

Pablo Fernandez16:09:23

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

Pablo Fernandez16:09:19

I’m trying this in Heroku now, thanks xeqi


using ^:replace or such could work depending on exactly what you want


it took me a while to realize that there is an uberjar task and an :uberjar profile, and they are not the same thing.


dang! I thought they were the same.


@pupeno: np. having it globally shouldn't cause a problem, but I always like to scope thing narrow

Pablo Fernandez16:09:29

xeqi: yeah, this should be safe, albeit unnecessary slow in some situations. I’m going to limit it to uberjar for now.


curtosis: what do you mean?


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.

Pablo Fernandez17:09:42

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

Pablo Fernandez17:09:06

xeqi: that sounds plausible. I’m trying to understand the semantics of prep-tasks.


oh profile merging.. how you work?


pupeno: i'd prolly just add "compile" to the list to test if thats it


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

Pablo Fernandez17:09:39

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)


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

Ivan Fedorov18:09:51

Hello, is there any former ztellman/lamina users?

Ivan Fedorov18:09:41

I wanted to ask about migration to ztellman/manifold.