Is there any way to get direct access to an iterators of sequences, tables,
arrays, etc.? Let's say you want to write something like:
# I assume the iterator to be not a closure iterator so I use a template:
template take(iter: iterator, n: Positive): iterator =
# 'take' yields the first 'n' values of 'iter'
...
var wordFrequencies = initCountTable[string]()
# fill wordFrequencies with some values ...
wordFrequencies.sort
for (word, count) in take(wordFrequencies.pairs, 10):
echo count, word
Run
This leads to `Error: undeclared field: 'pairs'` stemming from
`wordFrequencies.pairs` in the for-loop.