(45 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Byte.to 3 2026-03-08 "Tomo man-pages"6 .SH NAME7 Byte.to \- iterate over a range of bytes8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Byte.to\ :\ func(first:\ Byte,\ last:\ Byte,\ step:\ Int8?\ =\ none\ ->\ func(->Byte?))13 .fi14 .SH DESCRIPTION15 Returns an iterator function that iterates over the range of bytes specified.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 first Byte The starting value of the range. -26 last Byte The ending value of the range. -27 step Int8? 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 byte in the given range (inclusive).32 .SH EXAMPLES33 .EX34 iter := Byte(2).to(4)35 assert iter() == Byte(2)36 assert iter() == Byte(3)37 assert iter() == Byte(4)38 assert iter() == none40 assert [x for x in Byte(2).to(5)] == [Byte(2), Byte(3), Byte(4), Byte(5)]41 assert [x for x in Byte(5).to(2)] == [Byte(5), Byte(4), Byte(3), Byte(2)]42 assert [x for x in Byte(2).to(5, step=2)] == [Byte(2), Byte(4)]43 .EE44 .SH SEE ALSO45 .BR Tomo-Byte (3)