aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-List.to.3
blob: dd1a23a9c6b20b5f65454828c853740de55e8093 (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
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH List.to 3 2025-11-29 "Tomo man-pages"
.SH NAME
List.to \- slice a list to an end index
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.to\ :\ func(list:\ [T],\ last:\ Int\ ->\ [T])
.fi
.SH DESCRIPTION
Returns a slice of the list from the start of the original list up to a specified index (inclusive).


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
list	[T]	The original list. 	-
last	Int	The index up to which elements should be included. 	-
.TE
.SH RETURN
A new list containing elements from the start up to the specified index.

.SH EXAMPLES
.EX
assert [10, 20, 30, 40, 50].to(3) == [10, 20, 30]
assert [10, 20, 30, 40, 50].to(-2) == [10, 20, 30, 40]
.EE
.SH SEE ALSO
.BR Tomo-List (3)