dev
Download
45 lines 1.2 KiBGroffModified 2026-03-09 raw
123456789101112131415161718192021222324252627282930313233343536373839404142434445
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Byte.to 3 2026-03-08 "Tomo man-pages"
.SH NAME
Byte.to \- iterate over a range of bytes
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Byte.to\ :\ func(first:\ Byte,\ last:\ Byte,\ step:\ Int8?\ =\ none\ ->\ func(->Byte?))
.fi
.SH DESCRIPTION
Returns an iterator function that iterates over the range of bytes specified.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
first	Byte	The starting value of the range. 	-
last	Byte	The ending value of the range. 	-
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. 	none
.TE
.SH RETURN
An iterator function that returns each byte in the given range (inclusive).

.SH EXAMPLES
.EX
iter := Byte(2).to(4)
assert iter() == Byte(2)
assert iter() == Byte(3)
assert iter() == Byte(4)
assert iter() == none

assert [x for x in Byte(2).to(5)] == [Byte(2), Byte(3), Byte(4), Byte(5)]
assert [x for x in Byte(5).to(2)] == [Byte(5), Byte(4), Byte(3), Byte(2)]
assert [x for x in Byte(2).to(5, step=2)] == [Byte(2), Byte(4)]
.EE
.SH SEE ALSO
.BR Tomo-Byte (3)