CSC/ECE 517 Summer 2008/wiki1 2 i2

From Expertiza_Wiki
Jump to navigation Jump to search

The Question

Ruby, like Java, has iterators to facilitate doing operations on each member of a set. Python has generators as well. Describe how generators differ from iterators, and find examples of code sequences using generators that would be awkward with iterators. [edit] Understanding of the question What is an iterator?

[edit]

What is Iterator?

[edit]

Iterators ruby,java,python

[edit]

Example Some code examples References 1. The Pragmatic Programmers - Programming Ruby 2. http://www.google.com/search?q=ruby+iterators&rls=com.microsoft:en-us&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1 3. http://www.devarticles.com/c/a/Ruby-on-Rails/Iterators-in-Ruby/ 4. http://www.math.hokudai.ac.jp/~gotoken/ruby/ruby-uguide/uguide09.html