aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Byte.to.3
blob: 9abc73bb17b35897fffb9746cc8e2bbc8219f521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Byte.to 3 2025-04-21T14:54:02.043965 "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:\ Byte?\ =\ 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	Byte?	An optional step size to use. If unspecified or `none`, the step will be inferred to be `+1` if `last >= first`, otherwise `-1`. 	none
.TE
.SH RETURN
An iterator function that returns each byte in the given range (inclusive).

.SH EXAMPLES
.EX
>> Byte(2).to(5)
= func(->Byte?)
>> [x for x in Byte(2).to(5)]
= [Byte(2), Byte(3), Byte(4), Byte(5)]
>> [x for x in Byte(5).to(2)]
= [Byte(5), Byte(4), Byte(3), Byte(2)]

>> [x for x in Byte(2).to(5, step=2)]
= [Byte(2), Byte(4)]
.EE