Re: list* does not make a list?

2011-01-17 Thread Meikel Brandmeyer
Hi,

On 17 Jan., 11:28, LordGeoffrey  wrote:

> The docs don't say that it is lazy. How (as a newbie) can i tell that it
> is lazy?

By the words "the last of which will be treated as a sequence". A
sequence is (in general) lazy. Hence, what list* returns is actually a
sequence and not a list. As mentioned elsewhere the docs could be
improved and the name "list*" was likely a suboptimal choice.

Sincerely
Meikel

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


Re: list* does not make a list?

2011-01-17 Thread LordGeoffrey
The docs don't say that it is lazy. How (as a newbie) can i tell that it 
is lazy?


Docs:
"Creates a new list containing the items prepended to the rest, the
  last of which will be treated as a sequence."

On 17/01/11 06:27, Sean Allen wrote:

the documentation on that could be improved. the doc string for that
is basically the same as for list. but they return different types.

rather surprising when you first see it.


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


Re: list* does not make a list?

2011-01-16 Thread Sean Allen
the documentation on that could be improved. the doc string for that
is basically the same as for list. but they return different types.

rather surprising when you first see it.

On Sun, Jan 16, 2011 at 1:55 PM, Alan  wrote:

> list* consumes its last argument lazily, which means it can't count it
> (a requirement to be a real list). Both functions return objects that
> are seqs, though, so you can (seq?) them if you want.
>
> user=> (def x (list* (range)))
> #'user/x
> user=> (def x (apply list (range)))
> java.lang.OutOfMemoryError: Java heap space (NO_SOURCE_FILE:4)
>
>
> On Jan 16, 10:21 am, Brian Marick  wrote:
> > movies.core> (list? (apply list (map identity [1 2 3])))
> > true
> >
> > Makes sense to me!
> >
> > movies.core> (list? (list* (map identity [1 2 3])))
> > false
> >
> > Huh?
> >
> > -
> > Brian Marick, Artisanal Labrador
> > Contract programming in Ruby and Clojure
> > Author of /Ring/ (forthcoming; sample:
> http://bit.ly/hfdf9T)www.exampler.com,www.exampler.com/blog,www.twitter.com/marick
>
> --
> 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 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

Re: list* does not make a list?

2011-01-16 Thread Brian Marick
On Jan 16, 2011, at 12:55 PM, Alan wrote:

> list* consumes its last argument lazily, which means it can't count it


That is indeed what it does. seq* would have been a better name. Too late now, 
I guess.

-
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Author of /Ring/ (forthcoming; sample: http://bit.ly/hfdf9T)
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

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


Re: list* does not make a list?

2011-01-16 Thread Alan
list* consumes its last argument lazily, which means it can't count it
(a requirement to be a real list). Both functions return objects that
are seqs, though, so you can (seq?) them if you want.

user=> (def x (list* (range)))
#'user/x
user=> (def x (apply list (range)))
java.lang.OutOfMemoryError: Java heap space (NO_SOURCE_FILE:4)


On Jan 16, 10:21 am, Brian Marick  wrote:
>     movies.core> (list? (apply list (map identity [1 2 3])))
>     true
>
> Makes sense to me!
>
>     movies.core> (list? (list* (map identity [1 2 3])))
>     false
>
> Huh?
>
> -
> Brian Marick, Artisanal Labrador
> Contract programming in Ruby and Clojure
> Author of /Ring/ (forthcoming; 
> sample:http://bit.ly/hfdf9T)www.exampler.com,www.exampler.com/blog,www.twitter.com/marick

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