runtime library
Ghul.Runtime ships alongside the compiler and supplies Pipe[T] and other everyday building blocks used throughout this site. The reference below covers Ghul.Pipes, the sequence-processing library behind filter, map, reduce and the thread-first operator.
Each entry is a real, compiled declaration checked against the current ghul.runtime package - hover over a name for its full signature, exactly as an editor would show it.
A pipe combinator chain can be written with the thread-first operator |> over free functions, or fluently with . over Pipe[T] methods after wrapping a source with | or pipe(). Both forms call the same underlying code:
sum of even squares: 220
or, fluently:
sum of even squares: 220
Ghul.Pipes
Most combinators below exist in both forms; the free function comes first and the equivalent method beneath it as the alternative.
pipe
Lifts any Iterable[T] - an array, a LIST[T], a MAP[T]'s values, anything with an .iterator - into a Pipe[T]. This is what the | operator calls to wrap its left operand.
filter
or, as a method:
map
or, as a method:
flat_map
or, as a method:
skip
or, as a method:
take
or, as a method:
skip_while
or, as a method:
take_while
or, as a method:
distinct
or, as a method:
peek
or, as a method:
chunk
or, as a method:
windows
or, as a method:
cat
or, as a method:
union_with
or, as a method:
intersect_with
or, as a method:
except
or, as a method:
index
or, as a method:
zip
or, as a method:
reduce
or, as a method:
collect
or, as a method:
collect_array
or, as a method:
collect_list
or, as a method:
collect_set
or, as a method:
collect_map
or, as a method:
partition
or, as a method:
group_by
or, as a method:
min_by
or, as a method:
max_by
or, as a method:
count
or, as a method:
find
or, as a method:
find_map
or, as a method:
find_or_throw
or, as a method:
find_map_or_throw
or, as a method:
first
or, as a method:
first_map
or, as a method:
first_or_throw
or, as a method:
first_map_or_throw
or, as a method:
only
or, as a method:
any
or, as a method:
all
or, as a method:
for_each
or, as a method:
reverse
or, as a method:
sort
or, as a method:
sort_descending
or, as a method:
sort_by
or, as a method:
sort_by_descending
or, as a method:
append_to
or, as a method:
join
or, as a method: