4

I'm commenting some code right now, and I'm looking for a word meaning the thing being iterated over. Iterator is an object performing an iteration, but what's the object that the iterator is iterating; the result of one iteration?

20
  • 3
    @gnat Question is looking for a standard term for a well known concept, so should be accepted per the quoted discussion, imo
    – Jules
    Feb 15, 2016 at 20:15
  • 2
  • 1
    I was about to say the same thing as @Jules. The general idea of iteration originates from mathematics, so I'd say it's a pretty well-known concept, which should have fixed and well-defined terminology. This question is not primarily opinion-based, and I don't think it's off-topic. Feb 15, 2016 at 20:19
  • 3
    I can't find anything as a search result for 'iterand' and 'perl' or 'java'. And 'iterand' isn't even mentioned on the Wikipedia page for iterator. There doesn't appear to be a standard term for this, and it doesn't appear to be a well known concept. It might be such in academic discussion (and behind paywalls apparently) - but this isn't anything that people talk about. Its a loop variable. The index. But I get blank looks from all of my coworkers when asking them what an iterand is. Shoot, it even comes up as an unknown word as I type it.
    – user40980
    Feb 15, 2016 at 20:24
  • 5
    I hereby propose "iteree".
    – Mike Nakis
    Feb 15, 2016 at 20:43

2 Answers 2

10

Iterand

I've seen this term used in some scholarly publications online (Google search results that link to pages I don't want to pay to access), but I can't find any etymology or published definition of it.

Hopefully someone else has a more thorough answer.

Update, years later

It looks like at least one language (Chapel) has documentation that uses the term iterand:

Chapel's for-loops (and their parallel counterparts, coforall and forall) can be driven by multiple iterands in a coordinated manner known as zippered iteration. This is expressed using the zip keyword, followed by a parenthesized list of the iterands.

https://chapel-lang.org/docs/users-guide/base/zip.html

3

The Java API uses Iterable as the name of the interface that produces an Iterator. The docs for Iterator refer to the object of each iteration as an element.

1
  • Any answer not starting with "other" or "enum" gets an upvote from me. "Element" is a bit too specific in the general case of something like an ES6 generator, but fits most of the cases and is clear and concise for the most common case of looping through an array or collection.
    – user949300
    Feb 16, 2016 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.