Fork me on GitHub
#beginners
<
2017-09-29
>
Lucas Barbosa01:09:58

I am reading the “Clojure Programming” book (by Chas Emerick) and something made me intrigued. It mentions the “head retention” problem, with an example. Here’s the example: This apparently causes an OutOfMemoryError: `(let [[t d] (split-with #(< % 12) (range 1e8))] [(count d) (count t)])` While this doesn’t: `(let [[t d] (split-with #(< % 12) (range 1e8))] [(count t) (count d)])` The explanation is: “Since the last reference to t occurs before the processing of d, no reference to the head of the range is kept, and no memory issues arise.” I read this many times and I simply cannot understand the reason why this is happening. Can someone help me to understand this?

danny23:09:32

How can I include all clojure core libraries in a file so I don't have to fully qualify functions (clojure.string/upper-case "string") vs (upper-case "string")

didibus23:09:44

Its 100% bad practice, so much so ClojureScript decided to just remove the feature completly.

didibus23:09:56

Use :as for alias always.

didibus23:09:15

Using fully qualified is also bad practice. Alias is always the way to go.

danny09:10:59

Thank you! I had a feeling that was a bad idea, sure enough when I tried it I immediately got namespace collision related Warnings in REPL, so I switched to using :as and will be doing so from here out

danny23:09:43

or is that bad practice...

rcustodio23:09:14

@dannystanny01 (require [clojure.string :refer :all])

rcustodio23:09:47

Something like this, afaik it’s not a bad practice

manas_marthi23:09:47

hi all, pls could you advise how do I use apache derby within a lein project