From 3b1acb8ac5788061b90aeb9069ddecacf265f20c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 21 Apr 2025 14:55:19 -0400 Subject: Add missing files --- man/man3/tomo-List.first.3 | 37 ------------------------------------- man/man3/tomo-List.where.3 | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 man/man3/tomo-List.first.3 create mode 100644 man/man3/tomo-List.where.3 (limited to 'man') diff --git a/man/man3/tomo-List.first.3 b/man/man3/tomo-List.first.3 deleted file mode 100644 index a8183cc8..00000000 --- a/man/man3/tomo-List.first.3 +++ /dev/null @@ -1,37 +0,0 @@ -'\" t -.\" Copyright (c) 2025 Bruce Hill -.\" All rights reserved. -.\" -.TH List.first 3 2025-04-21T14:44:34.258746 "Tomo man-pages" -.SH NAME -List.first \- find an index where a predicate matches -.SH LIBRARY -Tomo Standard Library -.SH SYNOPSIS -.nf -.BI List.first\ :\ func(list:\ [T],\ predicate:\ func(item:&T\ ->\ Bool)\ ->\ Int) -.fi -.SH DESCRIPTION -Find the index of the first item that matches a predicate function (if any). - - -.SH ARGUMENTS - -.TS -allbox; -lb lb lbx lb -l l l l. -Name Type Description Default -list [T] The list to search through. - -predicate func(item:&T -> Bool) A function that returns `yes` if the item should be returned or `no` if it should not. - -.TE -.SH RETURN -Returns the index of the first item where the predicate is true or `!Int` if no item matches. - -.SH EXAMPLES -.EX ->> [4, 5, 6].find(func(i:&Int): i.is_prime()) -= 5 : Int? ->> [4, 6, 8].find(func(i:&Int): i.is_prime()) -= none : Int? -.EE diff --git a/man/man3/tomo-List.where.3 b/man/man3/tomo-List.where.3 new file mode 100644 index 00000000..88520918 --- /dev/null +++ b/man/man3/tomo-List.where.3 @@ -0,0 +1,37 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH List.where 3 2025-04-21T14:54:02.045598 "Tomo man-pages" +.SH NAME +List.where \- find an index where a predicate matches +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI List.where\ :\ func(list:\ [T],\ predicate:\ func(item:&T\ ->\ Bool)\ ->\ Int) +.fi +.SH DESCRIPTION +Find the index of the first item that matches a predicate function (if any). + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +list [T] The list to search through. - +predicate func(item:&T -> Bool) A function that returns `yes` if the item's index should be returned or `no` if it should not. - +.TE +.SH RETURN +Returns the index of the first item where the predicate is true or `!Int` if no item matches. + +.SH EXAMPLES +.EX +>> [4, 5, 6].where(func(i:&Int): i.is_prime()) += 5 : Int? +>> [4, 6, 8].find(func(i:&Int): i.is_prime()) += none : Int? +.EE -- cgit v1.2.3