On Sat, Jan 19, 2013 at 7:02 PM, Colin Yates <colin.ya...@gmail.com> wrote:

> user=> (defn stream1 [] repeatedly create-user)
>

This function invokes neither repeatedly nor create-user. It pointlessly
refers to repeatedly and then returns a reference to the create-user
function.
Which is function and not a sequence, which is why you cannot take n from
it.

user=> (defn stream2 [] (repeatedly create-user))
>
> This function invokes repeatedly with a reference to create-user and
returns a lazy-sequence, which you can take n from.

> In other words, what effect does wrapping the function body in quotes
actually do?

By quotes I assume you mean ()'s. The answer is above. in stream1 you are
simply refering to functions. Without the ()'s
you're not invoking anything.

Compare:
user> create-user
#<user$create_user user$create_user@3f8ecde>

to:

user> (create-user)
{:id 1}
user>

/S

-- 
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

Reply via email to