On Tue, Sep 16, 2008 at 4:49 AM, Alexander Kjeldaas
<[EMAIL PROTECTED]> wrote:
>
> 2. Clojure states that it has good support for list comprehensions.
> Maybe I'm misunderstanding list comprehensions, but I'm not completely
> happy.  I want a way to have destructuring work on the sequence, not
> on the individual element. In CL you have (loop for i in '(1 2 3) ...)
> as well as (loop for i on '(1 2 3) ...).  How is the one-liner to
> create a lazy sliding window over a sequence in Clojure?

There are many functions that operate on sequences which are not built
into Clojure's "for" macro.  Perhaps you want partition:

user=> (partition 3 1 (range 5))
((0 1 2) (1 2 3) (2 3 4))

This could then be destructured with for if you want:

user=> (for [[a b c] (partition 3 1 (range 5))] (- c a))
(2 2 2)

> 3. The Clojure coding style sets a bad precedent wrt commenting.
> Using Clojure professionally means you need comments.  The
> (comment ...) form, although theoretically elegant just doesn't look
> good.  There is not a single comment in boot.clj.  Is this a
> coincidence?

Besides (comment ...) there is also ; and documentation strings stored
as meta-data attached to function vars.  boot.clj has all but the
first of these.

--Chouser

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to