Generators
Keywords for resumable return-a-value:
# Python yield def stuff(): yield "start" for i in range(5) yield i yield "end" # Perl 6 gather/take gather { take "start" for 0..4 { take $_ } take "end" }
Python and Perl 6 | Similarities between Python and Perl 6 | #25 |
Keywords for resumable return-a-value:
# Python yield def stuff(): yield "start" for i in range(5) yield i yield "end" # Perl 6 gather/take gather { take "start" for 0..4 { take $_ } take "end" }
Copyright © 2010 http://www.pmichaud.com/2010/pres/ |