On Jun 20, 2013 3:11 PM, "Jason Gilman" <jason.gil...@gmail.com> wrote:
>
> (defn bar [my-list n]
>   (if (= n 0)
>       (peek my-list)
>       (bar (rest my-list) (dec n))))
> (bar [1 2 3] 1)
>

It seems likely you want either first and rest* (to work from the front of
any seqable) or peek and pop (to work from the back of a vector or the
front of a list or queue). Combining peek and rest on a vector as the bar
function does makes no sense, since they work at opposite ends.

*or next in place of rest.

-- 
-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to