File tree Expand file tree Collapse file tree
modules/std/syntax/functors Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+ Namespace std.syntax
3+
4+ #rem MiniLibrary: Arrays
5+ Since 025-07-16 (Aida 4)
6+ Author: iDkP from GaragePixel
7+ #end
8+
9+ #rem wonkeydoc @pro The ForEach function - A generic iteration utility with callback execution.
10+ @author iDkP from GaragePixel
11+ @since 2025-07-16
12+ A ForEach provides a functional approach to array iteration with custom callback processing.
13+ The ForEach function executes a provided callback for each element within a specified range,
14+ enabling functional programming patterns while maintaining Wonkey's type safety through generics.
15+ #end
16+ Function ForEach<T,B>:T[]( values:T[],
17+ callback:Void(index:B,value:T),
18+ from:B=0, atEnd:B=Null ) Where B Implements IShort Or
19+ B Implements ICompact
20+ If atEnd=Null atEnd=values.Length 'Auto
21+
22+ For Local index:B=from Until atEnd
23+ callback(index,values[index])
24+ End
25+
26+ Return values
27+ End
You can’t perform that action at this time.
0 commit comments