(46 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Int.to 3 2026-01-19 "Tomo man-pages"6 .SH NAME7 Int.to \- iterate a range of integers8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Int.to\ :\ func(first:\ Int,\ last:\ Int,\ step:\ Int?\ =\ none\ ->\ func(->Int?))13 .fi14 .SH DESCRIPTION15 Returns an iterator function that iterates over the range of numbers specified.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 first Int The starting value of the range. -26 last Int The ending value of the range. -27 step Int? An optional step size to use. If unspecified or \fBnone\fR, the step will be inferred to be \fB+1\fR if \fBlast >= first\fR, otherwise \fB-1\fR. none28 .TE29 .SH RETURN30 An iterator function that returns each integer in the given range (inclusive).32 .SH EXAMPLES33 .EX34 iter := 2.to(5)35 assert iter() == 236 assert iter() == 337 assert iter() == 438 assert iter() == 539 assert iter() == none41 assert [x for x in 2.to(5)] == [2, 3, 4, 5]42 assert [x for x in 5.to(2)] == [5, 4, 3, 2]43 assert [x for x in 2.to(5, step=2)] == [2, 4]44 .EE45 .SH SEE ALSO46 .BR Tomo-Int (3)