Fork me on GitHub
#clojure
<
2015-08-14
>
timgilbert02:08:13

Hi all… I’m thinking about using lein checkout dependencies for some code that will be shared across maybe three Clojure projects and one ClojureScript project… https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#checkout-dependencies

timgilbert02:08:56

Just curious if anyone has done this and can give me a heads-up about things to watch out for

timgilbert02:08:56

Specifically I’m wondering if it will mess up lein-cljsbuild or IntelliJ Cursive

timgilbert02:08:43

…and also circleci build automation

mccraigmccraig07:08:54

@timgilbert: i've used checkout deps with clj and cljs projects... with cljs i did end up putting the checkouts/x/src paths onto src paths for some reason... figwheel reloading iirc

mpenet08:08:26

ghadi: should IReduceInit & co be considered clojure internals or do you really think it's safe to use in libraries?

mpenet08:08:47

ghadi: squee is nice btw

janiczek11:08:31

Does anybody know what to do in this case? I thought the type at the top will be enough. Do I have to annotate Enlive's html/select with :no-check to force it?

Alex Miller (Clojure team)13:08:46

mpenet: IReduceInit should be safe to use in libraries

Alex Miller (Clojure team)13:08:17

although depending on use, you want to consider extending CollReduce instead

mpenet14:08:32

it's for a "recordset" instance and the way it's handled when used with sequence fns or reduce (lazy vs non lazy, efficiency etc)

mpenet14:08:58

and allow the lib user to choose what fits best easily

mpenet14:08:53

seems like I could have used iter-reduce, but the iter version in the lib I wrap is slighlty less efficient (some duplication between .hasNext and .next

mpenet14:08:40

all this stuff in core is very interesting btw, is this documented somewhere?

mpenet15:08:13

I know about https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/protocols.clj but IReduceInit is a bit lacking docs (even something minimal)

Alex Miller (Clojure team)15:08:23

no, it's not doc'ed anywhere that I know of. maybe it's time to write a blog about it :)

mpenet15:08:14

but yes, a more in-depth post would be interesting for sure

ghadi16:08:01

mpenet: thanks. I think during the 1.7 dev cycle there was a question about IReduceInit vs CollReduce, but now I'm solidly in favor of IReduceInit

ghadi16:08:06

It's a better interface (only one method, requires init value). The downside is no IReduceInit on clojure < 1.7.

Lambda/Sierra18:08:24

Finally, after much deliberation, I've pushed out tools.namespace "0.3.0-alpha1" https://groups.google.com/d/topic/clojure/FQMNZgCfS54/discussion

arrdem18:08:38

stuartsierra: awesome!

whacked20:08:03

Can someone explain to me why the (map ...) part doesn't get swap!-ed in?

(let [out (atom [])]
  (swap! out conj "I appear in @out")
  (map
   #(swap! out conj %)
   ["I don't!"])
  @out)
;; ["I appear in @out"]

cddr20:08:50

laziness?

hlship20:08:56

Try wrapping the (map) call with (doall) or (take 1). It's about lazy evaluation. You can also use mapv which is not lazy.

whacked20:08:43

AH right. Thanks!

hlship23:08:06

@directedglaph: Also, use doseq for a non-lazy iteration for side-effects