algorithm

Collection interfaces, comparison helpers, iteration utilities, and view slicing helpers.


Interfaces and conversions


Built-in source adaptation


Matching and branching


Search result conventions


Iteration helpers


View slicing

All slicing helpers require bounds that stay within the current view.


Examples

Counting and searching

"algorithm" use
"control" use

{} () {} [
  (10 20 30 40) count printStack _:;
  (10 20 30 40) (20 30) contains printStack _:;
  (10 20 30 40) [30 =] findOrdinal printStack _:;
] "main" exportFunction

Expected Output During Compilation

4
TRUE
2

View slicing

"algorithm" use
"control" use

{} () {} [
  view: "hello" toView;
  view.size printStack _:;
  1 3 @view.slice.size printStack _:;
] "main" exportFunction

Expected Output During Compilation

5
3

Runtime example

"algorithm" use
"String" use
"control" use

{} Int32 {} [
  ("count=" (10 20 30 40) count LF
   "contains=" (10 20 30 40) (20 30) contains LF
   "find=" (10 20 30 40) [30 =] findOrdinal LF) printList
  0
] "main" exportFunction

Expected Output

count=4
contains=TRUE
find=2

See also