-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Erroneous code is generated for generic, anonymous iterators:
proc count*[T](start: T, step = 1): auto =
iterator counter: T {.closure.} =
## An iterator function that returns evenly spaced values of ordinal T,
## starting with `start`
## Note, this doesn't have any protections against overflow errors!
##
## Parameters:
## start: A starting ordinal
## step: The space between returned values.
var i = start
if step < 0:
while True:
dec(i, step)
yield i
if step > 0:
while True:
inc(i, step)
yield i
return counter
Metadata
Metadata
Assignees
Labels
No labels