user> (source reverse)
(defn reverse
"Returns a seq of the items in coll in reverse order. Not lazy."
{:added "1.0"}
[coll]
(reduce conj () coll))
On Mon, Aug 8, 2011 at 2:29 PM, MarisO <[email protected]> wrote:
> Do you know of any trick to reverse a sequence without reverse or
> rseq ?
>
> I wrote it like this:
>
> ((fn rev
> ([s] (rev '() s))
> ([r s] (if (seq s) (rev (cons (first s) r) (rest s)) r )) )
> '[1 2 3 5] )
>
>
> https://gist.github.com/1132357
>
>
> I wonder if it can be written more shortly.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> 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
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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