On Wed, Oct 20, 2010 at 3:21 PM, Rich Hickey richhic...@gmail.com wrote:
On Oct 20, 1:34 pm, cej38 junkerme...@gmail.com wrote:
This question leads into something that I read in Joy of Clojure (page
161 in the latest MEAP edition):
If you manage to hold onto the head of a sequence somewhere
Dave,
Yes, this is perfectly idiomatic and many people in Clojure (and also
Haskell, for example) use let to help document how they're building up
their computation.
Stuart's suggestion is also good and it's largely a matter of personal
preference which to use when.
Of course, as you use
I agree with Tom (and with Stuart). I tend to like using - when it's
convenient, since all you're really doing is performing a list of
transformations on a single object. However, the let is better
documentation if that's ever going to matter. Not because it makes it
easier to understand what
Hi,
readability might be a concern but it's not the only criteria.
a) Do you need to trace intermediate results ? Then you need a
binding so you do not redo the work twice (presumably, I exclude memoized
functions here). Of course if the code has some side effects, the choice
is
By the way, http://tinyurl.com/2a235cn is an example of your style of
let being used in the Clojure source: the definition of defn itself.
It's a little overdone and weird-looking, but the alternative of
deeply nested forms would be much worse.
I didn't notice your question about technical
This question leads into something that I read in Joy of Clojure (page
161 in the latest MEAP edition):
If you manage to hold onto the head of a sequence somewhere within a
function, then that sequence will be prevented from being garbage
collected. The simplest way to retain the head of sequence
When you work with a lazy sequence, Clojure (java really)
automatically garbage-collects elements you're done with. It can only
be certain you're done with them if you no longer have any reference
to them, direct or indirect. If you've bound the head of the sequence
to a local, then you can still
Not only did my question get answered, but I learned several new
things in the process.
Thanks!
Dave
On Wed, Oct 20, 2010 at 1:52 PM, Alan a...@malloys.org wrote:
When you work with a lazy sequence, Clojure (java really)
automatically garbage-collects elements you're done with. It can only
On Oct 20, 1:34 pm, cej38 junkerme...@gmail.com wrote:
This question leads into something that I read in Joy of Clojure (page
161 in the latest MEAP edition):
If you manage to hold onto the head of a sequence somewhere within a
function, then that sequence will be prevented from being
great! good to know
On Oct 20, 3:21 pm, Rich Hickey richhic...@gmail.com wrote:
On Oct 20, 1:34 pm, cej38 junkerme...@gmail.com wrote:
This question leads into something that I read in Joy of Clojure (page
161 in the latest MEAP edition):
If you manage to hold onto the head of a
On Wed, Oct 20, 2010 at 09:52, Alan a...@malloys.org wrote:
I agree with Tom (and with Stuart). I tend to like using - when it's
convenient, since all you're really doing is performing a list of
transformations on a single object. However, the let is better
documentation if that's ever going
Hey,
I'm parsing a file with a chain of filter and map operations. To make
it a little more readable (to me), I put the steps in a let like this:
(defn parse-dictionary
[reader]
(let [lines(read-lines reader)
trimmed (map #(.trim %1) lines)
filtered (filter
12 matches
Mail list logo