[Swift-devel] iterate behaviour round II

Ben Clifford benc at hawaga.org.uk
Wed Aug 3 06:38:36 CDT 2011


I dislike using array indices for each step. I wanted to figure out something that looked more like a fold/unfold, where the body of the iterate only has access to "previous" and "next" so that you write something like this:

file a[];
file seed <"foo">;
a = iterate from seed {
   next = f(previous)
} until(g(next)=false) ;

but I never figured out a syntax that I liked. (contrast to haskell unfold syntax)




More information about the Swift-devel mailing list