On Thu, Dec 31, 2015 at 2:01 PM, Susan Cheng via swift-evolution <
[email protected]> wrote:
> As I know SequenceType should have behaved as immutable structure and it
> provides method to get a mutable GeneratorType which generates value from
> start of sequence.
Sequences are not immutable. A sequence is allowed to be consumed by
iterating over its generator. If the type you have is a sequence, you can
only assume that you can access the elements only once. For example, a
socket can be modeled as a sequence of bytes. Once the bytes are consumed
from the corresponding generator, they are gone from the sequence.
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 <[email protected]>*/
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution