[swift-evolution] About the PermutationGenerator

Susan Cheng susan.doggie at gmail.com
Thu Dec 31 07:36:31 CST 2015


I don't think so.

As we don't say "Fibonacci collection", we know Fibonacci numbers are in
order. But we can't tell the number immediately if I asked a specific index
of Fibonacci sequence. The only way is calculate the sequence one by one
from start.

So we need the collection, and collection do the jobs. But it true that
collections are sequences.
Swift is also have this definition, in concrete implementation way.

Dmitri Gribenko <gribozavr at gmail.com> 於 2015年12月31日星期四 寫道:

> On Thu, Dec 31, 2015 at 3:04 PM, Susan Cheng <susan.doggie at gmail.com
> <javascript:;>> wrote:
> > yes for sequences are not immutable. I get confused.
> >
> > no for sequences should be definition of lists of values. Just like
> > Fibonacci sequence, we can calculate the values form the start of the
> > Fibonacci sequence one by one. But we are not accessing the values of
> > Fibonacci sequence.
>
> Those are collections.  Collections can be iterated over multiple times.
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com
> <javascript:;>>*/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151231/0b055a11/attachment.html>


More information about the swift-evolution mailing list