// STRYKE — FULL REFERENCE

stryke v0.8.11 · 3260 topics · 33 chapters · generated from src/lsp.rs

Hub GitHub
// Color scheme

>_LANGUAGE REFERENCE

Every builtin, keyword, alias, and extension with an LSP hover doc — rendered from the exact markdown that `stryke docs` shows in the terminal. Jump via the chapter index, or Ctrl+F for a specific name.

Chapters

Parallel Primitives

18 topics

# pmap

Parallel map powered by rayon's work-stealing thread pool. Every element of the input list is processed concurrently across all available CPU cores, and the output order is guaranteed to match the input order. This is the primary workhorse for CPU-bound transforms in stryke — use it whenever you have a pure function and a large list. Pass progress => 1 to get a live progress bar on STDERR for long-running jobs.

Two equivalent surface syntaxes: • Block form — pmap BLOCK LIST — element bound to _ • Bare-fn form — pmap FUNC, LIST — single-arg function name as first argument

# Block form
my @out = pmap { _ * 2 } 1:1_000_000
my @hashes = pmap sha256 @blobs, progress => 1
1:100 |> pmap { fetch("https://api.example.com/item/$_") } |> e p

# Bare-fn form (works for builtins and user-defined subs)
my @hashes = pmap sha256, @blobs, progress => 1
sub double { $_0 * 2 }
my @r = pmap double, (1:1_000_000)

# pmaps

Streaming parallel map — returns a lazy iterator that processes items across all CPU cores using a persistent worker-thread pool. Unlike pmap which eagerly collects all results into an array, pmaps yields results as they complete through a bounded channel, so downstream consumers see output immediately. Output order is non-deterministic (completion order). Each worker thread reuses a single interpreter instance, making it faster than pmap for large inputs.

Best for: • Pipelines with take/head — avoids processing the full list • Very large inputs where holding all results in memory is impractical • Streaming pipelines where you want progressive output

range(0, 1e9) |> pmaps { _ * 2 } |> take 10 |> ep
t 1:1e6 pmaps { expensive(_) } ep
range(0, 1e6) |> pmaps { fetch("https://api/item/$_") } |> pgreps { _->{ok} } |> ep

# pmap_chunked

Parallel map that groups input into contiguous batches of N elements before distributing to threads. This reduces per-item scheduling overhead when the per-element work is very cheap (e.g. a few arithmetic ops). Each thread receives a slice of N consecutive items, processes them sequentially within the batch, then returns the batch result. Use this instead of pmap when profiling shows rayon overhead dominates the actual computation.

my @out = pmap_chunked 100, { _ ** 2 } 1:1_000_000
my @parsed = pmap_chunked 50, { json_decode } @json_strings

# pgrep

Parallel grep that evaluates the filter predicate concurrently across all CPU cores using rayon. The result preserves the original input order, so it is a drop-in replacement for grep on large lists. Best suited for predicates that do meaningful work per element — if the predicate is trivial (e.g. a single regex on short strings), sequential grep may be faster due to lower scheduling overhead.

Two equivalent surface syntaxes: pgrep { BLOCK } LIST or pgrep FUNC, LIST.

# Block form
my @matches = pgrep { /complex_pattern/ } @big_list
my @primes = pgrep { is_prime } 2:1_000_000
@files |> pgrep { -s _ > 1024 } |> e p

# Bare-fn form
sub even { $_0 % 2 == 0 }
my @e = pgrep even, 1:10        # (2,4,6,8,10)

# pgreps

Streaming parallel grep — returns a lazy iterator that filters items across all CPU cores. Unlike pgrep which eagerly collects all matching items, pgreps yields matches as they are found through a bounded channel. Output order is non-deterministic (completion order). Each worker thread reuses a single interpreter instance.

range(0, 1e6) |> pgreps { is_prime(_) } |> take 100 |> ep
t 1:1e9 pgreps { _ % 7 == 0 } take 10 ep

# pfor

Parallel foreach that executes a side-effecting block across all CPU cores with no return value. Use this when you need to perform work for each element (writing files, sending requests, updating shared state) but don't need to collect results. The block receives each element as _. Iteration order is non-deterministic, so the block must be safe to run concurrently.

Two equivalent surface syntaxes: pfor { BLOCK } LIST or pfor FUNC, LIST.

# Block form
pfor { write_report } @records
pfor { compress_file } glob("*.log")
@urls |> pfor { fetch
    p "done: $_" }

# Bare-fn form
sub work { print "did $_0\n" }
pfor work, (1, 2, 3)

# psort

Parallel sort that uses rayon's parallel merge-sort algorithm. Accepts an optional comparator block using $_0/$_1 (or $a/$b). For large lists (10k+ elements), this significantly outperforms the sequential sort by splitting the array, sorting partitions in parallel, and merging. The sort is stable — equal elements retain their relative order.

my @sorted = psort { $_0 <=> $_1 } @big_list
my @by_name = psort { $_0->{name} cmp $_1->{name} } @records
@nums |> psort { $a <=> $b } |> e p

# pcache

Parallel memoized map — each element is processed concurrently, but results are cached by the stringified value of _ so duplicate inputs are computed only once. This is ideal when your input list contains many repeated values and the computation is expensive. The cache is a concurrent hash map shared across all threads, so there is no lock contention on reads after the first computation.

Two equivalent surface syntaxes: pcache { BLOCK } LIST or pcache FUNC, LIST.

# Block form
my @out = pcache { expensive_lookup } @list_with_dupes
my @resolved = pcache { dns_resolve } @hostnames

# Bare-fn form
my @resolved = pcache dns_resolve, @hostnames

# preduce

Parallel tree-fold using rayon's reduce — splits the list into chunks, reduces each chunk independently, then merges partial results. The combining operation **must be associative** (e.g. +, *, max); non-associative ops will produce incorrect results. Much faster than sequential reduce on large numeric lists because the tree structure allows O(log n) merge depth across cores.

my $total = preduce { $_0 + $_1 } @nums
my $biggest = preduce { $_0 > $_1 ? $_0 : $_1 } @vals
my $product = preduce { $a * $b } 1:100

# preduce_init

Parallel fold with identity value.

my $total = preduce_init 0, { $_0 + $_1 } @list

# pmap_reduce

Fused parallel map + tree reduce.

my $sum = pmap_reduce { _*2 } { $_0 + $_1 } @list

# pany

pany { COND } @list — parallel short-circuit any.

# pfirst

pfirst { COND } @list — parallel first matching element.

# puniq

puniq @list — parallel unique elements.

# pflat_map

Parallel flat-map: map + flatten results. Each element produces zero or more output values via the block/function, and the outputs are concatenated in input order.

Two equivalent surface syntaxes: pflat_map BLOCK LIST or pflat_map FUNC, LIST.

# Block form
my @out = pflat_map expand @list

# Bare-fn form
sub expand { ($_0, $_0 * 10) }
my @r = pflat_map expand, (1, 2, 3)   # (1, 10, 2, 20, 3, 30)

# pflat_maps

Streaming parallel flat-map — like pmaps but flattens array results. Returns a lazy iterator.

range(0, 1e6) |> pflat_maps { [_, _ * 10] } |> ep

# fan

Execute BLOCK or FUNC N times in parallel (_/$_0 = index 0..N-1). With no count, defaults to the rayon pool size (stryke -j).

Two equivalent surface syntaxes: • Block form — fan N { BLOCK } or fan { BLOCK } • Bare-fn form — fan N, FUNC or fan FUNC

# Block form
fan 8 { work(_) }
fan { work(_) } progress => 1

# Bare-fn form
sub work { print "tick $_0\n" }
fan 8, work
fan work, progress => 1   # uses pool size

# fan_cap

Like fan but captures return values in index order. Two surface syntaxes: fan_cap N { BLOCK } or fan_cap N, FUNC.

# Block form
my @results = fan_cap 8 { compute(_) }

# Bare-fn form
sub compute { $_0 * $_0 }
my @squares = fan_cap 8, compute

Shared State & Concurrency

11 topics

# mysync

Declare shared variables for parallel blocks (Arc<Mutex>).

mysync $counter = 0
fan 10000 { $counter++ }   # always exactly 10000
mysync @results
mysync %histogram$1

Compound ops (`++`, `+=`, `.=`, `|=`, `&=`) are fully atomic.

# async

async { BLOCK } — schedule a block for execution on a background worker thread and return a task handle immediately.

The block begins executing as soon as a thread is available in stryke's global rayon thread pool, while the calling code continues without blocking. To retrieve the result, pass the task handle to await, which blocks until the task completes and returns its value. If the block panics, the panic is captured and re-raised at the await call site. Use async for fire-and-forget background work, overlapping I/O with computation, or launching multiple independent tasks that you later join. For structured fan-out with index-based parallelism, prefer fan or fan_cap instead.

my $task = async { long_compute() }
do_other_work()
my $val = await $task

# Overlapping multiple fetches:
my @tasks = map { async { fetch("https://api.example.com/$_") } } 1:10
my @results = map await @tasks

# spawn

spawn { BLOCK } — Rust-style alias for async; schedules a block on a background thread and returns a joinable task handle.

This is identical to async in every respect — same thread pool, same semantics, same await for joining. The name exists for developers coming from Rust's tokio::spawn or std::thread::spawn who find spawn more natural. Use whichever reads better in your code; mixing async and spawn in the same program is perfectly fine since they share the same underlying pool.

my $task = spawn { expensive_io() }
my $val = await $task

my @handles = map { spawn { process } } @items
my @out = map await @handles

# await

await $task — block the current thread until an async/spawn task completes and return its result value.

If the background task has already finished by the time await is called, the result is returned immediately with no scheduling overhead. If the task panicked, await re-raises the panic as a die in the calling thread, preserving the original error message and backtrace. You can await a task exactly once; calling await on an already-joined handle is a fatal error. For waiting on multiple tasks, simply map over the handles — stryke does not yet provide a join_all primitive, but map await @tasks achieves the same effect.

my $task = async { 42 }
my $result = await $task              # 42

# Await with error handling:
my $t = spawn { die "oops" }
eval { await $t }                     # $@ eq "oops"

# pchannel

pchannel(N) — create a bounded multi-producer multi-consumer (MPMC) channel with capacity N, returning a ($tx, $rx) pair.

The transmitter $tx supports ->send($val) which blocks if the channel is full (backpressure). The receiver $rx supports ->recv which blocks until a value is available, and ->try_recv which returns undef immediately if the channel is empty. Both ends can be cloned and shared across threads — clone $tx with $tx->clone to create additional producers, or clone $rx for additional consumers. When all transmitters are dropped, ->recv on the receiver returns undef to signal completion. Use pchannel to build producer-consumer pipelines, rate-limited work queues, or to communicate between async/spawn tasks.

my ($tx, $rx) = pchannel(100)
async { $tx->send(_) for 1:1000
    undef $tx }
while (defined(my $val = $rx->recv)) {
    p $val
}

# Multiple producers:
my ($tx, $rx) = pchannel(50)
for my $i (1:4) {
    my $t = $tx->clone
    spawn { $t->send("from worker $i: _") for 1:100 }
}
undef $tx  # drop original so channel closes when workers finish

# pselect

pselect(@channels) — wait on multiple pchannel receivers.

# barrier

barrier(N) — create a synchronization barrier that blocks until exactly N threads have arrived at the wait point.

Each thread calls $b->wait and is suspended until all N participants have reached the barrier, at which point all are released simultaneously. This is useful for coordinating phased parallel algorithms where all workers must complete step K before any worker begins step K+1. The barrier is reusable — after all threads are released, it resets and can be waited on again. Internally backed by a Rust std::sync::Barrier for zero-overhead synchronization.

my $b = barrier(4)
for my $i (0:3) {
    spawn {
        setup_phase($i)
        $b->wait                      # all 4 threads sync here
        compute_phase($i)
    }
}

# ppool

ppool(N, fn { ... }) — create a persistent thread pool of N worker threads, each running the provided subroutine in a loop.

The pool is typically paired with a pchannel: workers pull items from the channel's receiver, process them, and optionally send results to an output channel. Unlike pmap which is a one-shot parallel transform, ppool keeps threads alive for the lifetime of the pool, making it ideal for long-running server-style workloads, background drain loops, or scenarios where thread startup cost would dominate short-lived pmap calls. Workers exit when their input channel is closed (all transmitters dropped). The pool object supports ->join to block until all workers have finished.

my ($tx, $rx) = pchannel(100)
my $pool = ppool 4, fn {
    while (defined(my $job = $rx->recv)) {
        process($job)
    }
}
$tx->send(_) for @work_items
undef $tx                             # signal completion
$pool->join                           # wait for drain

# deque

deque LIST — create a double-ended queue initialized with the given elements.

A deque supports efficient O(1) insertion and removal at both ends via ->push_front($val), ->push_back($val), ->pop_front, and ->pop_back. It also supports ->len and iteration. Internally backed by a Rust VecDeque, it is ideal for sliding window algorithms, BFS traversals, or any scenario where you need fast access to both ends of a sequence.

my $dq = deque(1, 2, 3)
$dq->push_front(0)
$dq->push_back(4)
p $dq->pop_front                      # 0

# heap

heap LIST — create a min-heap (priority queue) from the given elements.

Elements are heapified on construction so that ->pop always returns the smallest element in O(log n) time. ->push($val) inserts a new element, also in O(log n). The heap supports ->peek to inspect the minimum without removing it, and ->len for the current size. Internally backed by a Rust BinaryHeap (inverted for min-heap semantics), it is the go-to structure for top-K queries, Dijkstra, and merge-K-sorted-lists problems.

my $h = heap(5, 3, 8, 1)
p $h->pop                             # 1 (smallest first)
p $h->peek                            # 3 (next smallest)
$h->push(0)

# set

set LIST — create a set (unique unordered collection) from the given elements.

Duplicate values are collapsed on construction so the set contains each value exactly once. The set object provides ->contains($val) for O(1) membership testing, plus ->union($s), ->intersection($s), ->difference($s), and ->len methods. Internally backed by a Rust HashSet for performance. Use to_set to convert an existing iterator into a set.

my $s = set(1, 2, 3, 2, 1)
p $s->contains(2)                     # 1
p $s->len                             # 3
my $both = $s->union(set(3, 4, 5))

Pipeline & Pipe-Forward

7 topics

# |>

Pipe-forward operator — threads LHS as first argument of RHS call.

"hello" |> uc |> rev |> p              # OLLEH
1:10 |> grep _ > 5 |> map _ * 2 |> e p
$url |> fetch_json |> json_jq '.name' |> p
"hello world" |> s/world/perl/ |> p     # hello perl

Zero runtime cost (parse-time desugaring). Binds looser than ||, tighter than ?:.

# thread

Thread-first macro — chain stages where the threaded value is injected as the **first** argument (like Clojure's ->).

~> @data grep { _ > 5 } map { _ * 2 } sort { $_0 <=> $_1 } |> join "," |> p
~> " hello " tm uc rv lc ufc sc cc kc tj p  # short aliases
fn div { $_0 / $_1 }
~> 10 div(2) p                               # div(10, 2) = 5
~> 10 div(_, 2) p                           # explicit _ position: div(10, 2) = 5

Spellings: ~>, thread, t. Stages: bare function (uc, tm, …), function with block (map { … }, grep { … }), name(args) call where _ is the threaded-value placeholder, or >{} anonymous block. |> terminates the macro.

# ->>

Thread-last macro — chain stages where the threaded value is injected as the **last** argument (like Clojure's ->>).

fn div { $_0 / $_1 }
~>> 10 div(2) p                              # div(2, 10) = 0.2
->> 10 div(_, 2) p                          # explicit _ overrides: div(10, 2) = 5

# Thread-last is useful for list-consuming functions:
fn take_n { @_[0..$_[-1]-1] }               # take_n(list, n)
~>> (1,2,3,4,5) take_n(3) p                  # take_n(1,2,3,4,5, 3) = (1,2,3)

Spellings: ~>>, ->>. The explicit _ placeholder always takes precedence.

# pipeline

pipeline(@list) — wrap a list (or iterator) in a lazy pipeline object supporting chained ->map, ->filter, ->take, ->skip, ->flat_map, ->tap, and other transforms that execute zero work until a terminal method is called.

No intermediate lists are allocated between stages — each element flows through the full chain one at a time, making pipelines memory-efficient even on very large or infinite inputs. Terminal methods include ->collect (materialize to list), ->reduce { ... } (fold), ->for_each { ... } (side-effect iteration), and ->count. Pipelines compose naturally with stryke's |> operator: you can feed pipeline(...) output into further |> stages or vice versa. Use pipeline when you want explicit method-chaining style rather than the flat |> pipe syntax — both compile to the same lazy evaluation engine.

my @out = pipeline(@data)
  ->filter { _ > 0 }
  ->map { _ * 2 }
  ->take(10)
  ->collect

pipeline(1:1_000_000)
  ->filter { _ % 3 == 0 }
  ->map { _ ** 2 }
  ->take(5)
  ->for_each { p _ }                # 9 36 81 144 225

my $sum = pipeline(@scores)
  ->filter { _ >= 60 }
  ->reduce { $_0 + $_1 }

# par_pipeline

par_pipeline(source => \@data, stages => [...], workers => N) — build a multi-stage parallel pipeline where each stage's map/filter block runs concurrently across N worker threads.

Unlike pmap which parallelizes a single transform, par_pipeline lets you define a sequence of named stages — each with its own block — that execute in parallel while preserving input order in the final output. Internally, stryke partitions the source into chunks, distributes them across workers, and pipelines the stages so that stage 2 can begin processing a chunk as soon as stage 1 finishes it, overlapping computation across stages. This is ideal for multi-step ETL workloads where each step is CPU-bound and the data volume is large. The workers parameter defaults to the number of logical CPUs.

my @results = par_pipeline(
    source  => \@raw_records,
    stages  => [
        { name => "parse",     map => fn { json_decode } },
        { name => "transform", map => fn { enrich } },
        { name => "validate",  filter => fn { _->{valid} } },
    ],
    workers => 8,
)

# par_pipeline_stream

par_pipeline_stream(source => ..., stages => [...], workers => N) — streaming variant of par_pipeline that connects stages via bounded pchannel queues instead of materializing intermediate arrays.

Each stage runs as an independent pool of workers, pulling from an input channel and pushing to an output channel. This gives true pipelined parallelism: stage 1 workers produce items while stage 2 workers consume them concurrently, bounded by channel capacity to prevent memory blowup. The streaming design makes this suitable for infinite or very large data sources (file streams, network feeds) where materializing the full dataset between stages is impractical. Results are emitted in arrival order by default; pass ordered => 1 to reorder them to match input order at the cost of buffering.

par_pipeline_stream(
    source  => fn { while (my $line = <STDIN>) { yield $line } },
    stages  => [
        { name => "parse", map => fn { json_decode } },
        { name => "score", map => fn { compute_score } },
    ],
    workers => 4,
    on_item => fn { p _ },           # process results as they arrive
)

# collect

collect ITERATOR — materialize a lazy iterator or pipeline into a concrete list.

Pipeline stages in stryke are lazy: chaining |> map {...} |> grep {...} builds up a deferred computation without consuming any elements. Calling collect forces evaluation and returns all results as a regular Perl list. This is the standard way to terminate a lazy chain when you need the full result in an array. Without collect, the iterator is consumed element-by-element by e, take, or other streaming sinks.

my @out = range(1,5) |> map { _ * 2 } |> collect
gen { yield _ for 1:3 } |> collect |> e p
my @data = stdin |> grep /INFO/ |> collect

Streaming Iterators

24 topics

# maps

maps { BLOCK } LIST — the lazy, streaming counterpart of map. Instead of materializing the entire output list, maps returns a pull iterator that evaluates the block on demand as downstream consumers request values. This makes it ideal for |> pipeline chains, especially when combined with take, greps, or collect. Use maps over map when working with large ranges, infinite sequences, or when you want to short-circuit processing early with take. Memory usage is constant regardless of input size.

1:10 |> maps { _ * 3 } |> take 4 |> e p
# 3 6 9 12
1:1_000_000 |> maps { _ ** 2 } |> greps { _ > 100 } |> take 3 |> e p

# greps

greps { BLOCK } LIST — the lazy, streaming counterpart of grep. Returns a pull iterator that only evaluates the predicate as elements are requested downstream. This is the preferred filtering function in |> pipelines because it avoids materializing intermediate lists. Combine with take to short-circuit early, or with maps and collect for full lazy pipelines. The block receives _ just like grep.

1:100 |> greps { _ % 7 == 0 } |> take 3 |> e p
# 7 14 21
@lines |> greps { /ERROR/ } |> maps { tm } |> e p

# filter

filter (alias fi) { BLOCK } LIST — stryke-native lazy filter that returns a pull iterator, functionally identical to greps but named for familiarity with Rust/Ruby/JS conventions. Use filter or greps interchangeably in |> chains; both are streaming and both set _ in the block. The result must be consumed with collect, e p, foreach, or another terminal. Prefer filter when writing stryke-idiomatic code; prefer grep/greps when porting from Perl.

my @big = 1:1000 |> filter { _ > 990 } |> collect
@big |> e p   # 991 992 993 994 995 996 997 998 999 1000
1:50 |> fi { _ % 2 } |> take 5 |> e p   # 1 3 5 7 9

# tap

tap { BLOCK } LIST — execute a side-effecting block for each element, then pass the element through unchanged.

The return value of the block is ignored; the original element is always forwarded to the next pipeline stage. This makes tap ideal for injecting logging, debugging, or metrics collection into the middle of a pipeline without altering the data flow. It is fully streaming and preserves element order.

1:5 |> tap { log_debug "saw: $_" } |> map { _ * 2 } |> e p
@files |> tap { p "processing: $_" } |> map slurp |> e p

# peek

peek ITERATOR — inspect the next element of an iterator without consuming it.

The peeked value is buffered internally so that the next call to ->next or pipeline pull returns the same element. This is useful for lookahead parsing, conditional branching on the next value, or implementing take_while-style logic manually. Calling peek multiple times without advancing the iterator returns the same value each time. Works with any stryke iterator including gen, range, stdin, and pipeline results.

my $g = gen { yield _ for 1:5 }
p peek $g                             # 1 (not consumed)
p $g->next                            # 1
p peek $g                             # 2

# tee

tee FILE, ITERATOR — write each element to a file as a side effect while passing it through the pipeline.

Every element that flows through tee is appended as a line to the specified file, and the element itself continues downstream unchanged. The file is opened once on first element and closed when the iterator is exhausted. This is the stryke equivalent of the Unix tee command, useful for auditing or logging intermediate pipeline results to disk.

1:10 |> tee "/tmp/log.txt" |> map { _ * 2 } |> e p
stdin |> tee "/tmp/raw.log" |> grep /ERROR/ |> e p

# take

take N, LIST / head N, LIST / hd N, LIST — return at most the first N elements.

In streaming mode, take pulls exactly N elements from the upstream iterator and then stops, so it short-circuits infinite or very large sources efficiently. This makes it safe to write range(1, 1_000_000) |> take 5 without allocating a million-element list. If the source has fewer than N elements, all of them are returned. The head and hd aliases mirror Unix head semantics.

1:100 |> take 5 |> e p               # 1 2 3 4 5
my @top = hd 3, @sorted
stdin |> hd 10 |> e p                 # first 10 lines

# tail

tail N, @list — returns the last N elements of the list. If N exceeds the list length, the entire list is returned. The alias tl is also available. This is the complement of head/take and mirrors Perl's List::Util::tail. In stryke, it works both as a function call and in |> pipelines.

my @t = tail 2, 1:5
@t |> e p   # 4 5
1:100 |> tl 3 |> e p  # 98 99 100

# drop

drop N, LIST / skip N, LIST / drp N, LIST — skip the first N elements and return the rest.

This operation is fully streaming: when used in a pipeline, the first N elements are consumed and discarded without buffering, and all subsequent elements flow through to the next stage. If the list contains fewer than N elements, the result is empty. The skip and drp aliases exist for readability in different contexts — all three compile to the same internal op.

1:10 |> drop 3 |> e p                # 4 5 6 7 8 9 10
my @rest = drp 2, @data
stdin |> skip 1 |> e p                # skip header line

# take_while

take_while { COND } LIST — emit leading elements while the predicate returns true, then stop.

The block receives each element as _. Elements are emitted as long as the predicate holds; the moment it returns false, the pipeline terminates immediately without consuming further input. This short-circuit behavior makes take_while efficient on infinite iterators and large streams. It is the complement of drop_while.

1:10 |> take_while { _ < 5 } |> e p # 1 2 3 4
stdin |> take_while { !/^END/ } |> e p

# drop_while

drop_while { COND } LIST — skip leading elements while the predicate returns true, then emit everything after.

The block receives each element as _. Once the predicate returns false for the first time, that element and all remaining elements pass through unconditionally — the predicate is never consulted again. This is streaming: elements are tested one at a time without buffering. Useful for skipping headers, preamble, or sorted prefixes in data streams.

1:10 |> drop_while { _ < 5 } |> e p # 5 6 7 8 9 10
@log |> drop_while { /^ #/ } |> e p    # skip comment header

# reject

reject { BLOCK } LIST — stryke-native streaming inverse of filter/greps. It keeps only the elements for which the block returns false. This reads more naturally than filter { !(...) } when the condition describes what you want to exclude rather than what you want to keep. Like filter and greps, it returns a lazy iterator suitable for |> chains. The block receives _ as the current element.

1:10 |> reject { _ % 3 == 0 } |> e p
# 1 2 4 5 7 8 10
@files |> reject { /\.bak$/ } |> e p   # skip backups

# compact

compact (alias cpt) — stryke-native streaming operator that removes undef and empty-string values from a list or iterator. This is a common data-cleaning step when dealing with parsed input, optional fields, or split results that produce empty segments. It is equivalent to greps { defined(_) && _ ne "" } but more concise and faster because the check is inlined in Rust. Numeric zero and the string "0" are preserved since they are defined and non-empty.

my @raw = (1, undef, "", 2, undef, 3)
@raw |> compact |> e p   # 1 2 3
split(/,/, "a,,b,,,c") |> cpt |> e p   # a b c

# concat

concat (alias chain) — stryke-native streaming operator that concatenates multiple lists or iterators into a single sequential iterator. Pass array references and they will be yielded in order without copying. This is useful for merging data from multiple sources into a unified pipeline. The operation is lazy: each source is drained in turn, so memory usage stays proportional to the largest single element, not the total.

my @a = 1:3
my @b = 7:9
concat(\@a, \@b) |> e p   # 1 2 3 7 8 9
my @c = ("x")
concat(\@a, \@b, \@c) |> maps { uc } |> e p

# enumerate

enumerate ITERATOR / en ITERATOR — yield [$index, $item] pairs from a streaming iterator.

Each element is wrapped as [$index, $item] where the index starts at 0 and increments for each element. Unlike with_index which returns [item, index], enumerate uses the Rust/Python convention of [index, item]. This is a streaming operation: the index counter is maintained lazily as elements flow through the pipeline.

stdin |> en |> e { p "_->[0]: _->[1]" }
1:5 |> en |> e { p "_->[0]: _->[1]" }
@lines |> en |> grep { _->[0] < 10 } |> e { p _->[1] }

# chunk

chunk N, ITERATOR / chk N, ITERATOR — group elements into N-sized arrayrefs as they stream through.

Elements are buffered until N are collected, then the group is emitted as a single arrayref. The final chunk may contain fewer than N elements if the source is not evenly divisible. This is fully streaming: only one chunk is held in memory at a time, making it safe for large or infinite iterators. Use chunk for batching work (e.g., bulk database inserts) or formatting output into rows.

1:9 |> chk 3 |> e { p join ",", @_ }
# 1,2,3  4,5,6  7,8,9
stdin |> chk 100 |> e { bulk_insert(@_) }

# dedup

dedup ITERATOR / dup ITERATOR — drop consecutive duplicate elements from a stream.

Only adjacent duplicates are removed: if the same value appears later after an intervening different value, it is emitted again. Comparison is string-based by default. This is a streaming operation that holds only the previous element in memory, so it works on infinite iterators. For global deduplication across the entire stream, use distinct instead.

1,1,2,2,3,1,1 |> dedup |> e p        # 1 2 3 1
@sorted |> dedup |> e p              # like uniq(1)
stdin |> dedup |> e p                 # collapse repeated lines

# distinct

distinct LIST — remove duplicate elements, preserving first-occurrence order (alias for uniq).

Each element is compared as a string; the first time a value is seen it is emitted, and all subsequent occurrences are silently dropped. When used in a pipeline the deduplication state is maintained across streamed chunks, so distinct works correctly on lazy iterators and generators. This is a stryke built-in backed by a hash set internally, so it runs in O(n) time regardless of list size.

my @u = distinct(3,1,2,1,3)           # (3,1,2)
1,2,2,3,3,3 |> distinct |> e p        # 1 2 3
stdin |> distinct |> e p              # unique lines

# flatten

flatten LIST / fl LIST — recursively flatten nested arrayrefs into a single flat list.

Flatten walks every element: scalars pass through unchanged, arrayrefs are opened and their contents are recursively flattened, so arbitrarily deep nesting is handled in one call. In pipeline mode (|> fl) it streams element-by-element, so you can chain it with map, grep, or take without materializing the entire intermediate list. The fl alias keeps pipeline chains concise.

my @flat = flatten([1,[2,3]],[4])     # (1,2,3,4)
[1,[2,[3,4]]] |> fl |> e p            # 1 2 3 4
@nested |> fl |> grep { _ > 0 } |> e p

# with_index

with_index LIST / wi LIST — pair each element with its 0-based index as [$item, $index].

Each element is wrapped in a two-element arrayref where _->[0] is the original value and _->[1] is its position. This is useful when you need positional information during a map or grep without maintaining a manual counter. Note the order is [item, index], which differs from enumerate which yields [index, item].

qw(a b c) |> wi |> e { p "_->[1]: _->[0]" }
# 0: a  1: b  2: c
@data |> wi |> grep { _->[1] % 2 == 0 } |> e { p _->[0] }

# first_or

first_or DEFAULT, LIST — return the first element of the list, or DEFAULT if the list is empty.

This is a streaming terminal: it pulls exactly one element from the upstream iterator and returns it, or returns the default value if the iterator is exhausted. It never buffers the entire list. This is especially useful at the end of a grep or map pipeline where you need a safe fallback instead of undef when no match is found.

my $v = first_or 0, @maybe_empty
my $x = grep { _ > 99 } @nums |> first_or -1
stdin |> grep /^ERROR/ |> first_or "(none)" |> p

# range

range(START, END [, STEP]) — create a lazy integer iterator from START to END with an optional step.

The range is inclusive on both ends. When START > END and no step is given, stryke automatically counts downward. An explicit STEP controls the increment and must be negative when counting down, or the range will be empty. The iterator is fully lazy: no list is allocated, and elements are generated on demand, making range(1, 1_000_000) as cheap to create as range(1, 5). Combine with |> to feed into streaming pipelines.

range(1, 5) |> e p                    # 1 2 3 4 5
range(5, 1) |> e p                    # 5 4 3 2 1
range(0, 10, 2) |> e p                # 0 2 4 6 8 10
range(10, 0, -2) |> e p               # 10 8 6 4 2 0

# stdin

stdin — return a streaming iterator over lines read from standard input.

Each call to the iterator reads one line from STDIN, strips the trailing newline, and yields it. The iterator terminates at EOF. Because it is lazy, combining stdin with take, grep, or first_or processes only as many lines as needed — the rest of STDIN is left unconsumed. This is the idiomatic stryke way to build Unix-style filters.

stdin |> grep /error/i |> e p
stdin |> take 5 |> e p
stdin |> en |> e { p "_->[0]: _->[1]" }

# nth

nth N, LIST — return the Nth element using 0-based indexing.

When used in a pipeline, nth consumes and discards the first N elements, returns the next one, and stops — so it short-circuits on infinite iterators. On a plain list, it is equivalent to $list[N] but works as a function call for pipeline composition. Returns undef if the list has fewer than N+1 elements.

my $third = nth 2, @data
1:10 |> nth 4 |> p                   # 5
stdin |> nth 0 |> p                   # first line

List Operations

62 topics

# map

map BLOCK LIST — evaluates the block for each element of the list, setting _ to the current element, and returns a new list of all the block's return values. This is the eager version: it consumes the entire input list and produces the entire output list before returning. Use map when you need the full result array or when the input is small. For large or infinite sequences, prefer maps (the streaming variant). The block can return zero, one, or multiple values per element, making map useful for both transformation and flattening. Use { |$var| body } to name the block parameter instead of _.

my @sq = map { _ ** 2 } 1:5
@sq |> e p   # 1 4 9 16 25
map { |$n| $n * $n }, 1:5   # named param
my @pairs = map { (_, _ * 10) } 1:3
@pairs |> e p   # 1 10 2 20 3 30

# grep

grep { BLOCK } LIST — filters the list, returning only elements for which the block evaluates to true. The current element is available as _. This is the eager version: it processes the entire list and returns a new list. It is Perl-compatible and works exactly like Perl's builtin grep. For streaming/lazy filtering in |> pipelines, use greps or filter instead. Use { |$var| body } to name the block parameter instead of _.

my @evens = grep { _ % 2 == 0 } 1:10
@evens |> e p   # 2 4 6 8 10
grep { |$x| $x > 3 }, 1:6   # named param
my @long = grep { length(_) > 3 } @words

# sort

sort [BLOCK] LIST — returns a new list sorted in ascending order. Without a block, sort compares elements as strings (lexicographic). Pass a comparator block using $_0 and $_1 (stryke style) or $a and $b (classic Perl) to control ordering: use <=> for numeric and cmp for string comparison. The sort is stable in stryke, meaning equal elements preserve their original relative order. For descending order, reverse the operands in the comparator. Use { |$x, $y| body } to name the two comparator params. Works naturally in |> pipelines.

my @nums = (3, 1, 4, 1, 5)
my @asc = sort { $_0 <=> $_1 } @nums
@asc |> e p   # 1 1 3 4 5
sort { |$x, $y| $y <=> $x }, @nums   # named params
my @desc = sort { $_1 <=> $_0 } @nums
@desc |> e p  # 5 4 3 1 1
@nums |> sort |> e p   # string sort in pipeline

# reverse

reverse LIST — in list context, return the elements in reverse order; in scalar context, reverse the characters of a string.

The dual nature of reverse is context-dependent: reverse @array flips element order, while scalar reverse $string (or just reverse $string in scalar context) reverses character order. In stryke, the string form is Unicode-aware, correctly reversing multi-byte characters rather than individual bytes. In |> pipelines, use the t rev shorthand for a concise streaming string reverse. reverse does not modify the original — it always returns a new list or string.

p reverse "hello"       # olleh
my @r = reverse 1:5   # (5,4,3,2,1)
@r |> e p               # 5 4 3 2 1
"abc" |> t rev |> p     # cba

# reduce

reduce { $_0 OP $_1 } @list — performs a sequential left fold over the list. The first two elements are passed as $_0 and $_1 to the block; the result becomes $_0 for the next iteration. The traditional $a/$b names are also supported for Perl compatibility. Use { |$acc, $val| body } to name the two params. Returns undef for an empty list and the single element for a one-element list. For a fold with an explicit initial value, see fold.

my $fac = reduce { $_0 * $_1 } 1:6
p $fac   # 720
reduce { |$acc, $val| $acc + $val }, 1:10   # 55 (named params)
my $longest = reduce { length($_0) > length($_1) ? $_0 : $_1 } @words

# fold

fold { $_0 OP $_1 } INIT, @list — left fold with an explicit initial accumulator value. The initial value is passed as the first $_0, and each list element arrives as $_1. Unlike reduce, fold never returns undef for an empty list — it returns the initial value instead. Both $a/$b and $_0/$_1 are supported in the block. Use fold when you need a guaranteed starting point for the accumulation.

my $total = fold { $_0 + $_1 } 100, 1:5
p $total   # 115
my $csv = fold { "$_0,$_1" } "", @fields

# reductions

reductions { $_0 OP $_1 } @list — returns the running (cumulative) results of a left fold, also known as a scan or prefix-sum. Each element of the output is the accumulator state after processing the corresponding input element. The output list has the same length as the input. Both $_0/$_1 and $a/$b naming conventions are supported.

my @pfx = reductions { $_0 + $_1 } 1:4
@pfx |> e p   # 1 3 6 10
1:5 |> reductions { $_0 * $_1 } |> e p  # 1 2 6 24 120

# all

all { COND } @list — returns true (1) if every element in the list satisfies the predicate, false ("") otherwise. The block receives each element as _ and should return a boolean. Short-circuits on the first failing element, so it never evaluates more than necessary. Works with |> pipelines and accepts bare lists or array variables.

my @nums = 2, 4, 6, 8
p all { _ % 2 == 0 } @nums   # 1
1:100 |> all { _ > 0 } |> p  # 1

# any

any { COND } @list — returns true (1) if at least one element satisfies the predicate, false ("") if none do. The block receives each element as _. Short-circuits on the first match, making it efficient even on large lists. This is the stryke equivalent of Perl's List::Util::any and can be used in |> pipelines.

my @vals = 1, 3, 5, 8
p any { _ > 7 } @vals   # 1
1:1000 |> any { _ == 42 } |> p  # 1

# none

none { COND } @list — returns true (1) if no element satisfies the predicate, false ("") if any element matches. Logically equivalent to !any { COND } @list but reads more naturally in guard clauses. Short-circuits on the first match. Useful for validation checks where you want to assert the absence of a condition.

my @words = ("cat", "dog", "bird")
p none { /z/ } @words   # 1
p "all non-negative" if none { _ < 0 } @vals

# first

first { COND } @list — returns the first element for which the block returns true, or undef if no element matches. The alias fst is also available. Short-circuits immediately upon finding a match, so only the minimum number of elements are tested. Ideal for searching sorted or unsorted lists when you need a single result.

my $f = first { _ > 10 } 3, 7, 12, 20
p $f   # 12
1:1_000_000 |> first { _ % 9999 == 0 } |> p  # 9999

# min

min @list — returns the numerically smallest value from a list. Compares all elements using numeric (<=>) comparison, so stringy values are coerced to numbers. Returns undef for an empty list. In stryke, min is a built-in that does not require use List::Util and works directly in |> pipelines.

p min(5, 3, 9, 1)   # 1
my @temps = (72.1, 68.5, 74.3)
@temps |> min |> p  # 68.5

# max

max @list — returns the numerically largest value from a list. Compares all elements using numeric (<=>) comparison. Returns undef for an empty list. Like min, this is a stryke built-in available without imports and works in |> pipelines. Combine with map to extract max values from complex structures.

p max(5, 3, 9, 1)   # 9
1:100 |> map { _ ** 2 } |> max |> p  # 10000

# sum

sum @list returns the numeric sum of all elements. Returns undef for an empty list. sum0 is identical except it returns 0 for an empty list, which avoids the need for a fallback // 0 guard. Both are stryke built-ins that work in |> pipelines. Use sum0 in contexts where an empty input is expected and you need a safe numeric default.

p sum(1:100)    # 5050
p sum0()          # 0
@prices |> map { _->{amount} } |> sum0 |> p

# product

product @list — returns the product of all numeric elements in the list. Returns undef for an empty list. Useful for computing factorials, combinatoric products, and compound multipliers. In stryke this is a built-in that composes naturally with |> pipelines and range.

p product(1:5)   # 120
range(1, 10) |> product |> p  # 3628800

# mean

mean @list — returns the arithmetic mean (average) of a numeric list. Computed as sum / count in a single pass. Returns undef for an empty list. The result is always a floating-point value even if all inputs are integers. Combine with map to compute averages over extracted fields.

p mean(2, 4, 6, 8)   # 5
@students |> map { _->{score} } |> mean |> p

# median

median @list — returns the median value of a numeric list. For odd-length lists, this is the middle element after sorting. For even-length lists, it is the arithmetic mean of the two middle elements. The input list does not need to be pre-sorted. Returns undef for an empty list.

p median(1, 3, 5, 7, 9)   # 5
p median(1, 3, 5, 7)      # 4
1:100 |> median |> p     # 50.5

# mode

mode @list — returns the most frequently occurring value in the list. If there is a tie, the value that appears first in the list wins. Returns undef for an empty list. Works with both numeric and string values — comparison is done by stringification. Useful for finding the dominant category in a dataset.

p mode(1, 2, 2, 3, 3, 3)   # 3
my @logs = qw(INFO WARN INFO ERROR INFO)
p mode(@logs)  # INFO

# stddev

stddev @list (alias std) — returns the population standard deviation of a numeric list. This is the square root of the population variance, measuring how spread out values are from the mean. Uses N (not N-1) in the denominator, so it computes the population statistic rather than the sample statistic. Returns undef for an empty list.

p stddev(2, 4, 4, 4, 5, 5, 7, 9)   # 2
1:10 |> std |> p

# variance

variance @list — returns the population variance of a numeric list, computed as the mean of the squared deviations from the mean. Like stddev, this uses N (not N-1) as the divisor. The variance is stddev ** 2. Returns undef for an empty list. Useful for statistical analysis and as a building block for higher-order stats.

p variance(2, 4, 4, 4, 5, 5, 7, 9)   # 4
my @samples = map { rand(100) } 1:1000
p variance(@samples)

# sample

sample N, @list — returns a random sample of N elements drawn without replacement from the list. The returned elements are in random order. If N exceeds the list length, the entire list is returned (shuffled). Uses a Fisher-Yates partial shuffle internally for efficiency. Each call produces a different result due to random selection.

my @pick = sample 3, 1:100
@pick |> e p   # 3 random values
my @test_cases = sample 10, @all_cases

# shuffle

shuffle @list — returns a new list with all elements in random order using a Fisher-Yates shuffle. The original list is not modified. Every permutation is equally likely. In stryke this is a built-in; no use List::Util is needed. The alias shuf is also available. Commonly used with |> and take to draw random subsets.

my @deck = shuffle 1:52
@deck |> take 5 |> e p   # 5 random cards
my @randomized = shuffle @questions

# uniq

uniq @list — removes duplicate elements from a list, preserving the order of first occurrence. Comparison is done by string equality. The alias uq is also available. This is eager (not streaming) and returns a new list. For streaming deduplication in |> pipelines, use distinct. For type-specific comparison, see uniqnum, uniqstr, and uniqint.

my @u = uniq 1, 2, 2, 3, 1, 3
@u |> e p   # 1 2 3
my @hosts = uniq @all_hosts

# uniqint

uniqint @list — removes duplicate elements comparing values as integers. Each element is truncated to its integer part before comparison, so 1.1 and 1.9 are considered equal (both become 1). The first occurrence is kept. This is useful when you have floating-point data but care only about the integer portion for uniqueness.

my @u = uniqint 1, 1.1, 1.9, 2
@u |> e p   # 1 2
my @distinct_ids = uniqint @raw_ids

# uniqnum

uniqnum @list — removes duplicate elements comparing values as floating-point numbers. Unlike uniq (which compares as strings), uniqnum treats 1.0 and 1.00 as equal because they have the same numeric value. The first occurrence of each numeric value is preserved. Use this when your data contains numbers that may have different string representations.

my @u = uniqnum 1.0, 1.00, 2.5, 2.50
@u |> e p   # 1 2.5
my @prices = uniqnum @all_prices

# uniqstr

uniqstr @list — removes duplicate elements comparing values strictly as strings. This is the same comparison as uniq but makes the intent explicit. Numeric values 1 and 1.0 are considered different because their string representations differ. Use uniqstr when you want to be explicit that string semantics are intended.

my @u = uniqstr "a", "b", "a", "c"
@u |> e p   # a b c
my @tags = uniqstr @all_tags

# zip

zip(\@a, \@b, ...) — combines multiple arrays element-wise into a list of arrayrefs. Each output arrayref contains one element from each input array at the corresponding index. Accepts two or more array references. The alias zp is also available. By default, zip pads shorter arrays with undef (equivalent to zip_longest). For truncating behavior, use zip_shortest.

my @a = 1:3
my @b = ("a","b","c")
zip(\@a, \@b) |> e p   # [1,a] [2,b] [3,c]
my @matrix = zip(\@xs, \@ys, \@zs)

# zip_longest

zip_longest(\@a, \@b, ...) — combines arrays element-wise, padding shorter arrays with undef to match the longest. This is the explicit version of the default zip behavior. Every input array contributes exactly one element per output tuple; missing elements become undef. Useful when you need to process all data from unequal-length sources.

my @a = 1:3
my @b = ("x")
zip_longest(\@a, \@b) |> e p   # [1,x] [2,undef] [3,undef]

# zip_shortest

zip_shortest(\@a, \@b, ...) — combines arrays element-wise, stopping at the shortest input array. No undef padding is produced; the output length equals the minimum input length. Use this when you only want complete tuples and extra trailing elements should be discarded.

my @a = 1:5
my @b = ("x","y")
zip_shortest(\@a, \@b) |> e p   # [1,x] [2,y]
my @paired = zip_shortest(\@keys, \@values)

# chunked

chunked N, @list — splits a list into non-overlapping chunks of N elements each. Each chunk is an arrayref. The final chunk may contain fewer than N elements if the list length is not evenly divisible. The alias chk is also available. In stryke, chunked is eager and returns a list of arrayrefs; for streaming chunk behavior in pipelines, use chunk.

my @ch = chunked 3, 1:7
@ch |> e p   # [1,2,3] [4,5,6] [7]
1:12 |> chunked 4 |> e { p join ",", @_ }

# windowed

windowed N, @list — returns a sliding window of N consecutive elements over the list. Each window is an arrayref. The output contains len - N + 1 windows. Unlike chunked, windows overlap: each successive window advances by one element. The alias win is also available. Useful for computing moving averages, detecting patterns in sequences, or n-gram extraction.

my @w = windowed 3, 1:5
@w |> e p   # [1,2,3] [2,3,4] [3,4,5]
my @deltas = windowed(2, @vals) |> map { _->[1] - _->[0] }

# pairs

pairs @list — takes a flat list and groups consecutive elements into pairs, returning a list of two-element arrayrefs ([$k, $v], ...). The input list must have an even number of elements. Each pair can be accessed via array indexing (_->[0], _->[1]). This is the inverse of unpairs and is commonly used to iterate over hash-like flat lists in a structured way.

my @p = pairs "a", 1, "b", 2
@p |> e { p "_->[0]=_->[1]" }   # a=1 b=2
my @entries = pairs %hash

# unpairs

unpairs @list_of_pairs — flattens a list of two-element arrayrefs back into a flat key-value list. This is the inverse of pairs. Each arrayref [$k, $v] becomes two consecutive elements in the output. Useful for converting structured pair data back into a format suitable for hash assignment or flat list processing.

my @flat = unpairs ["a",1], ["b",2]
@flat |> e p   # a 1 b 2
my %h = unpairs @filtered_pairs

# pairkeys

pairkeys @list — extracts the keys (even-indexed elements) from a flat pairlist. Given a list like ("a", 1, "b", 2, "c", 3), returns ("a", "b", "c"). This is equivalent to map { _->[0] } pairs @list but more concise and efficient. Useful for extracting just the key side of a key-value flat list without constructing intermediate pair objects.

my @k = pairkeys "a", 1, "b", 2, "c", 3
@k |> e p   # a b c
my @config_pairs = (host => "localhost", port => 8080)
my @names = pairkeys @config_pairs

# pairvalues

pairvalues @list — extracts the values (odd-indexed elements) from a flat pairlist. Given ("a", 1, "b", 2), returns (1, 2). This is equivalent to map { _->[1] } pairs @list but more concise. Pair it with pairkeys to split a flat key-value list into separate key and value arrays.

my @v = pairvalues "a", 1, "b", 2
@v |> e p   # 1 2
my @defaults = (timeout => 30, retries => 3)
my @settings = pairvalues @defaults

# pairmap

pairmap BLOCK @list — maps over consecutive pairs in a flat list, passing the key as $_0 (or $a) and the value as $_1 (or $b). The block can return any number of elements. This is the pair-aware equivalent of map and is ideal for transforming hash-like flat lists. The result is a flat list of whatever the block returns.

my @out = pairmap { "$_0=$_1" } "a", 1, "b", 2
@out |> e p   # a=1 b=2
my @cfg_pairs = (host => "x", port => 80)
my @upper = pairmap { uc($_0), $_1 } @cfg_pairs

# pairgrep

pairgrep { BLOCK } @list — filters consecutive pairs from a flat list, keeping only those where the block returns true. The key is available as $_0 (or $a) and the value as $_1 (or $b). Returns a flat list of the matching key-value pairs. This is the pair-aware equivalent of grep and is useful for filtering hash-like data by both key and value simultaneously.

my @big = pairgrep { $_1 > 5 } "a", 3, "b", 9, "c", 1
@big |> e p   # b 9
my @alert_pairs = (info => 1, critical_a => 9, critical_b => 7)
my @important = pairgrep { $_0 =~ /^critical/ } @alert_pairs

# pairfirst

pairfirst { BLOCK } @list — returns the first pair from a flat list where the block returns true, as a two-element list ($key, $value). The key is $_0 (or $a) and the value is $_1 (or $b). Short-circuits on the first match. Returns an empty list if no pair matches. This is the pair-aware equivalent of first.

my @hit = pairfirst { $_1 > 5 } "x", 2, "y", 8
p "@hit"   # y 8
my @flags = (info => 1, debug => 7, trace => 0)
my ($k, $v) = pairfirst { $_0 eq "debug" } @flags

# mesh

mesh(\@a, \@b, ...) — interleaves multiple arrays into a flat list rather than arrayrefs. While zip returns ([1,"a"], [2,"b"]), mesh returns (1, "a", 2, "b"). This makes it ideal for constructing hashes from parallel key and value arrays. The result is a flat list suitable for direct hash assignment.

my @k = ("a","b")
my @v = (1,2)
my %h = mesh(\@k, \@v)
p $h{a}   # 1
my %lookup = mesh(\@ids, \@names)

# mesh_longest

mesh_longest(\@a, \@b, ...) — interleaves arrays into a flat list, padding shorter arrays with undef to match the longest. Like mesh, the output is flat (not arrayrefs). Missing elements become undef in the output sequence. Use this when building a flat interleaved list from arrays of unequal length where you need every element represented.

my @a = 1:3
my @b = ("x")
my @r = mesh_longest(\@a, \@b)
@r |> e p   # 1 x 2 undef 3 undef

# mesh_shortest

mesh_shortest(\@a, \@b, ...) — interleaves arrays into a flat list, stopping at the shortest input array. No undef padding is produced; trailing elements from longer arrays are silently dropped. Use this when you only want complete interleaved groups and partial data should be discarded.

my @a = 1:3
my @b = ("x","y")
my @r = mesh_shortest(\@a, \@b)
@r |> e p   # 1 x 2 y

# partition

partition — pipeline / string helpers builtin. Alias for drop.

my $result = partition $x 
# or in a pipeline:
@list |> map partition |> p

# frequencies

frequencies (aliases freq, frq) counts how many times each distinct element appears in a list and returns a hashref mapping each value to its count. This is the stryke equivalent of a histogram or counter — useful for analyzing log files, counting word occurrences, tallying categorical data, or finding duplicates. The input list is flattened, so you can pass arrays directly. The returned hashref can be fed into dd for inspection or to_json for serialization.

my @words = qw(apple banana apple cherry banana apple)
my $counts = freq @words
p $counts   # {apple => 3, banana => 2, cherry => 1}
rl("access.log") |> map { /^(\S+)/ && $1 } |> freq |> dd
my @rolls = map { 1 + int(rand 6) } 1:1000
frq(@rolls) |> to_json |> p

# tally

tally counts how many times each distinct element appears in a list and returns a hash ref mapping element → count. This is the same as Ruby's Enumerable#tally or Python's Counter. Similar to frequencies but follows the Ruby naming convention.

my $t = tally("a", "b", "a", "c", "a", "b")
p $t->{a}   # 3
p $t->{b}   # 2
qw(red blue red green blue red) |> tally |> dd

# interleave

interleave (alias il) merges two or more arrays by alternating their elements: first element of each array, then second element of each, and so on. If the arrays have different lengths, shorter arrays contribute undef for their missing positions. This is useful for building key-value pair lists from separate key and value arrays, creating round-robin schedules, or weaving parallel data streams together.

my @keys = qw(name age city)
my @vals = ("Alice", 30, "NYC")
my @pairs = il \@keys, \@vals
p @pairs   # name, Alice, age, 30, city, NYC
my %h = il \@keys, \@vals
p $h{name} # Alice
my @rgb = il [255,0,0], [0,255,0], [0,0,255]

# pluck

pluck KEY, LIST_OF_HASHREFS — extract a single key from each hashref in the list.

For each element, pluck dereferences it as a hashref and returns the value at the given key. Elements where the key is missing yield undef. This is a streaming operation: in a pipeline, each hashref is processed and the extracted value is emitted immediately. It is the stryke equivalent of map { _->{KEY} } but more readable and optimized internally.

@users |> pluck "name" |> e p
my @ids = pluck "id", @records
@rows |> pluck "email" |> distinct |> e p

# grep_v

grep_v PATTERN, LIST — inverse grep: reject elements that match the pattern, keep the rest.

This is the complement of grep — any element where the pattern matches is dropped, and non-matching elements pass through. It accepts a regex, a string, or a code block as the pattern. In streaming mode, each element is tested and either forwarded or discarded without buffering. This is a stryke built-in that avoids the awkward grep { !/pattern/ } double-negation.

@words |> grep_v /^ #/ |> e p          # drop comments
my @clean = grep_v qr/tmp/, @files
stdin |> grep_v /^\s*$/ |> e p        # drop blank lines

# select_keys

select_keys — pipeline / string helpers builtin.

my $result = select_keys $x 
# or in a pipeline:
@list |> map select_keys |> p

# clamp

clamp (alias clp) constrains each value in a list to lie within a specified minimum and maximum range. Values below the minimum are raised to it; values above the maximum are lowered to it; values already in range pass through unchanged. This is essential for sanitizing user input, bounding computed values before display, or enforcing physical constraints in simulations. When given a single scalar, it returns a single clamped value.

my @scores = (105, -3, 42, 99, 200)
my @clamped = clp 0, 100, @scores
p @clamped   # 100, 0, 42, 99, 100
my $val = clp 0, 255, $input   # bound to byte range
my @pct = map { clp 0.0, 1.0, _ } @raw_ratios

# normalize

normalize (alias nrm) rescales a list of numeric values so that the minimum maps to 0 and the maximum maps to 1, using min-max normalization. This is a standard preprocessing step for machine learning features, data visualization (mapping values to color gradients or bar heights), and statistical analysis. If all values are identical, the result is a list of zeros to avoid division by zero. The output preserves the relative ordering of the input.

my @temps = (32, 68, 100, 212)
my @normed = nrm @temps
p @normed   # 0, 0.2, 0.377..., 1
my @pixels = nrm @raw_intensities
@pixels |> map { int(_ * 255) } |> e p  # scale to 0-255

# compose

compose (alias comp) creates a right-to-left function composition. Given compose(\&f, \&g), calling the result with x computes f(g(x)). Chain any number of functions — they apply from right to left (last argument first). This is the standard mathematical function composition found in Haskell, Clojure, and Ramda. The returned code ref can be stored, passed around, or used in pipelines.

my $double = fn { $_[0] * 2 }
my $inc    = fn { $_[0] + 1 }
my $f = compose($inc, $double)
p $f->(5)   # 11  (double 5 → 10, inc 10 → 11)

my $pipeline = compose(
    fn { join ",", @{$_[0]} },
    fn { [sort @{$_[0]}] },
    fn { [grep { _ > 2 } @{$_[0]}] },
)
p $pipeline->([3,1,4,1,5])  # 3,4,5

# partial

partial returns a partially applied function — the bound arguments are prepended to any arguments supplied at call time. partial(\&f, @bound)->(x) is equivalent to f(@bound, x). This is the standard partial application from functional programming, useful for creating specialized versions of general functions without closures.

my $add = fn { $_[0] + $_[1] }
my $add5 = partial($add, 5)
p $add5->(3)   # 8

my $log = fn { p "[$_[0]] $_[1]" }
my $warn_log = partial($log, "WARN")
$warn_log->("disk full")   # [WARN] disk full

# curry

curry auto-curries a function with a given arity. The curried function accumulates arguments across calls and invokes the original only when enough have been collected. curry(\&f, N)->(a)->(b) calls f(a, b) when N=2. If all arguments are supplied at once, it calls immediately.

my $add = curry(fn { $_[0] + $_[1] }, 2)
my $add5 = $add->(5)
p $add5->(3)       # 8
p $add->(10, 20)   # 30  (enough args — calls immediately)

# memoize

memoize (alias memo) wraps a function so that repeated calls with the same arguments return a cached result instead of re-executing the function. Arguments are stringified and joined as the cache key. This is essential for expensive pure functions like recursive algorithms, API lookups with stable results, or any computation where the same inputs always produce the same output.

my $fib = memoize(fn {
    my $n = $_[0]
    $n < 2 ? $n : $fib->($n-1) + $fib->($n-2)
})
p $fib->(30)   # instant (without memoize: ~1B calls)

my $fetch_user = memo(fn { fetch_json("https://api/users/$_[0]") })
$fetch_user->(42)   # hits API
$fetch_user->(42)   # returns cached

# once

once wraps a function so it is called at most once. The first invocation executes the function and caches the result; all subsequent calls return the cached value without re-executing. This is ideal for lazy initialization, one-time setup, or singleton patterns.

my $init = once(fn { p "initializing..."
    42 })
p $init->()   # prints "initializing..." → 42
p $init->()   # 42 (no print — cached)
p $init->()   # 42 (still cached)

# constantly

constantly (alias const) returns a function that ignores all arguments and always returns the given value. Useful as a default callback, a stub in higher-order function pipelines, or anywhere a function is required but a fixed value suffices.

my $zero = constantly(0)
p $zero->("anything")   # 0
my @defaults = map { constantly(0)->() } 1:5   # [0,0,0,0,0]

# complement

complement (alias compl) wraps a predicate function and returns a new function that negates its boolean result. complement(\&even?)->(3) returns true. This is the functional equivalent of !f(x) without creating a closure.

my $even = fn { $_[0] % 2 == 0 }
my $odd = complement($even)
p $odd->(3)   # 1
p $odd->(4)   # 0
1:10 |> grep { complement($even)->(_) } |> e p  # 1 3 5 7 9

# juxt

juxt (juxtapose) takes multiple functions and returns a new function that calls each one with the same arguments and collects the results into an array. This is useful for computing multiple derived values from the same input in a single pass.

my $stats = juxt(fn { min @_ }, fn { max @_ }, fn { avg @_ })
my @r = $stats->(3, 1, 4, 1, 5)
p "@r"   # 1 5 2.8

# fnil

fnil wraps a function so that any undef arguments are replaced with the given defaults before the function is called. This eliminates repetitive // $default patterns inside function bodies.

my $greet = fnil(fn { "Hello, $_[0]!" }, "World")
p $greet->(undef)    # Hello, World!
p $greet->("Alice")  # Hello, Alice!

# deep_clone

deep_clone (alias dclone) performs a recursive deep copy of a nested data structure. Array refs, hash refs, and scalar refs are cloned recursively so that the result shares no references with the original. Modifications to the clone never affect the source. This is the stryke equivalent of JavaScript's structuredClone or Perl's Storable::dclone.

my $orig = {users => [{name => "Alice"}], meta => {v => 1}}
my $copy = deep_clone($orig)
$copy->{users}[0]{name} = "Bob"
p $orig->{users}[0]{name}   # Alice (unchanged)

# deep_merge

deep_merge (alias dmerge) recursively merges two hash references. When both sides have a hash ref for the same key, they are merged recursively; otherwise the right-hand value wins. This is the standard deep merge from Lodash, Ruby's deep_merge, and config-file overlay patterns. Returns a new hash ref — neither input is modified.

my $defaults = {db => {host => "localhost", port => 5432}, debug => 0}
my $overrides = {db => {port => 3306}, debug => 1}
my $cfg = deep_merge($defaults, $overrides)
p $cfg->{db}{host}   # localhost (from defaults)
p $cfg->{db}{port}   # 3306 (overridden)
p $cfg->{debug}      # 1 (overridden)

# deep_equal

deep_equal (alias deq) performs structural equality comparison of two values, recursively descending into array refs, hash refs, and scalar refs. Returns 1 if the structures are identical, 0 otherwise. This is the stryke equivalent of Node's assert.deepStrictEqual, Lodash isEqual, or Python's == on nested dicts/lists.

p deep_equal([1, {a => 2}], [1, {a => 2}])   # 1
p deep_equal([1, {a => 2}], [1, {a => 3}])   # 0
p deq({x => [1,2]}, {x => [1,2]})            # 1

stryke Extensions

19 topics

# fn

Define a named or anonymous function with optional typed parameters and default values. Named functions are installed into the current package; anonymous functions (closures) capture their enclosing lexical scope. Functions are first-class values — assign them to scalars, store in arrays, pass as callbacks. The last expression evaluated is the implicit return value unless an explicit return is used.

fn double($x) { $x * 2 }
my $f = fn { _ * 2 }
my $add = fn ($a: Int, $b: Int) { $a + $b }

# Default parameter values:
fn greet($name = "world") { p "hello $name" }
greet()           # hello world
greet("Alice")    # hello Alice

fn range_check($x, $min = 0, $max = 100) { $min <= $x <= $max }
fn with_list(@items = (1, 2, 3)) { join "-", @items }
fn with_hash(%opts = (debug => 0)) { $opts{debug} }

Default values are evaluated at call time if the argument is not provided.

# struct

struct declares a named record type with typed fields, giving stryke lightweight struct semantics similar to Rust structs or Python dataclasses. Structs support multiple construction syntaxes, default values, field mutation, user-defined methods, functional updates, and structural equality.

**Declaration:**

struct Point { x => Float, y => Float }           # typed fields
struct Point { x => Float = 0.0, y => Float = 0.0 } # with defaults
struct Pair { key, value }                        # untyped (Any)

**Construction:**

my $p = Point(x => 1.5, y => 2.0)  # function-call with named args
my $p = Point(1.5, 2.0)            # positional (declaration order)
my $p = Point->new(x => 1.5, y => 2.0) # traditional OO style
my $p = Point()                    # uses defaults if defined

**Field access (getter/setter):**

p $p->x       # getter (0 args)
$p->x(3.0)    # setter (1 arg)

**User-defined methods:**

struct Circle {
    radius => Float,
    fn area { 3.14159 * $self->radius ** 2 }
    fn scale($factor: Float) {
        Circle(radius => $self->radius * $factor)
    }
}
my $c = Circle(radius => 5)
p $c->area        # 78.53975
p $c->scale(2)    # Circle(radius => 10)

**Built-in methods:**

my $q = $p->with(x => 5)  # functional update — new instance
my $h = $p->to_hash       # { x => 1.5, y => 2.0 }
my @f = $p->fields        # (x, y)
my $c = $p->clone         # deep copy

**Smart stringify:**

p $p  # Point(x => 1.5, y => 2)

**Structural equality:**

my $a = Point(1, 2)
my $b = Point(1, 2)
p $a == $b  # 1 (compares all fields)

Note: field type is checked at construction and mutation; unknown field names are fatal errors.

# typed

typed adds optional runtime type annotations to lexical variables and subroutine parameters. When a typed declaration is in effect, stryke inserts a lightweight check at assignment time that verifies the value matches the declared type (Int, Str, Float, Bool, ArrayRef, HashRef, or a user-defined struct name). This is especially useful for catching accidental type mismatches at function boundaries in larger programs. The annotation is purely a runtime guard — it has zero impact on pipeline performance because the check is only performed once at the point of assignment, not on every read.

typed my $x : Int = 42
typed my $name : Str = "hello"
typed my $pi : Float = 3.14
my $add = fn ($a: Int, $b: Int) { $a + $b }
p $add->(3, 4)   # 7

Note: assigning a value of the wrong type raises a runtime exception immediately.

You can mix typed and untyped variables freely in the same scope, so adopting typed is incremental — annotate the variables that matter and leave the rest dynamic. Subroutine parameters declared with type annotations in fn are checked on every call, giving you contract-style validation at function boundaries without a separate assertion library.

typed my @nums : Int = (1, 2, 3)
typed my %cfg : Str = (host => "localhost", port => "8080")

# match

Algebraic pattern matching (stryke extension).

match ($val) {
    /^\d+$/ => p "number: $val",
    [1, 2, _] => p "array starting with 1,2",
    { name => $n } => p "name is $n",
    _ => p "default",
}

Patterns: regex, array, hash, literal, wildcard _. Optional if guard per arm.

# frozen

Declare an immutable lexical variable. const my and frozen my are interchangeable spellings; const reads more naturally for engineers coming from other languages.

const my $pi = 3.14159
# $pi = 3  # ERROR: cannot assign to frozen variable

frozen my @primes = (2, 3, 5, 7, 11)

# fore

Side-effect-only list iterator (like map but void, returns item count).

qw(a b c) |> e p           # prints a, b, c; returns 3
1:5 |> map _ * 2 |> e p  # prints 2,4,6,8,10

# ep

ep — shorthand for e { p } (foreach + print). Iterates the list and prints each element.

qw(a b c) |> ep            # prints a, b, c (one per line)
filef |> sorted |> ep      # print sorted file list
1:5 |> map _ * 2 |> ep   # prints 2,4,6,8,10

# p

p — alias for say (print with newline).

p "hello"       # hello\n
p 42            # 42\n
1:5 |> e p     # prints each on its own line

# gen

Create a generator — lazy yield values on demand.

my $g = gen { yield _ for 1:5 }
my ($val, $more) = @{$g->next}

# yield

Yield a value from inside a gen { } generator block, suspending the generator until the consumer calls ->next again. Each yield produces one element in the lazy sequence. When the block finishes without yielding, the generator signals exhaustion. This is the stryke equivalent of Python's yield or Rust's Iterator::next.

my $fib = gen {
    my ($a, $b) = (0, 1)
    while (1) {
        yield $a
        ($a, $b) = ($b, $a + $b)
    }
}
for (1:10) {
    my ($val) = @{$fib->next}
    p $val
}

# trace

Trace mysync mutations to stderr (tagged with worker index under fan).

trace { fan 10 { $counter++ } }

# timer

Measure wall-clock milliseconds for a block.

my $ms = timer { heavy_work() }

# bench

Benchmark a block N times; returns "min/mean/p99".

my $report = bench { work() } 1000

# eval_timeout

Run a block with a wall-clock timeout (seconds).

eval_timeout 5 { slow_operation() }

# retry

Retry a block on failure.

retry { http_call() } times => 3, backoff => 'exponential'

# rate_limit

Limit invocations per time window.

rate_limit(10, "1s") { hit_api() }

# every

Run a block at a fixed interval.

every "500ms" { tick() }

# watch

Watch a single file for changes (non-parallel).

watch "/tmp/x", fn { process }

# capture

Run a command and capture structured output. Returns an object with ->stdout, ->stderr, ->exitcode, and ->failed methods. When piped to lines or words, stdout is auto-extracted so you can chain directly.

my $r = capture("ls -la")
p $r->stdout, $r->stderr, $r->exitcode
capture("ps aux") |> lines |> map { columns } |> tbl |> p

Data & Serialization

45 topics

# json_encode

json_encode serializes any Perl data structure — hashrefs, arrayrefs, nested combinations, numbers, strings, booleans, and undef — into a compact JSON string. It uses a fast Rust-backed serializer so it is significantly faster than JSON::XS for large payloads. The output is always valid UTF-8 JSON suitable for writing to files, sending over HTTP, or piping to other tools. Use json_decode to round-trip back.

my %cfg = (debug => 1, paths => ["/tmp", "/var"])
my $j = json_encode(\%cfg)
p $j   # {"debug":1,"paths":["/tmp","/var"]}
$j |> spurt "/tmp/cfg.json"$1

Note: undef becomes JSON `null`; Perl booleans serialize as `true`/`false`.

# json_decode

json_decode parses a JSON string and returns the corresponding Perl data structure — hashrefs for objects, arrayrefs for arrays, and native scalars for strings/numbers/booleans. It is strict by default: malformed JSON raises an exception rather than returning partial data. This makes it safe to use in pipelines where corrupt input should halt processing. The Rust parser underneath handles large documents efficiently and supports full Unicode.

my $data = json_decode('{"name":"stryke","ver":1}')
p $data->{name}   # stryke
slurp("data.json") |> json_decode |> dd$1

Note: JSON `null` becomes Perl `undef`; trailing commas and comments are not allowed.

# json_jq

json_jq applies a jq-style query expression to a stryke data structure and returns the matched value. This brings the power of the jq command-line JSON processor directly into stryke without shelling out. Dot notation traverses hash keys, bracket notation indexes arrays, and nested paths are separated by dots. It is ideal for extracting deeply nested values from API responses or config files without chains of hash dereferences.

my $data = json_decode(slurp "api.json")
p json_jq($data, ".results[0].name")
my $cfg = rj "config.json"
p json_jq($cfg, ".database.host")  # deep extract
fetch_json("https://api.example.com/users") |> json_jq(".data[0].email") |> p

# to_json

to_json (alias tj) converts a stryke data structure into a JSON string, functioning as a convenient shorthand for json_encode. It accepts hashrefs, arrayrefs, scalars, and nested combinations, producing compact JSON output suitable for APIs, config files, or inter-process communication. The alias tj is particularly useful at the end of a pipeline to serialize the final result. The Rust-backed serializer handles large structures efficiently and always produces valid UTF-8.

my %user = (name => "Bob", age => 30)
p tj \%user   # {"age":30,"name":"Bob"}
my @items = map { {id => _, val => _ * 2} } 1:3
p tj \@items  # [{"id":1,"val":2},{"id":2,"val":4},{"id":3,"val":6}]
@data |> tj |> spurt "out.json"

# to_csv

to_csv (alias tc) serializes a list of hashrefs or arrayrefs into a CSV-formatted string, complete with a header row derived from hash keys when given hashrefs. This is the fastest way to produce spreadsheet-ready output from structured data. Fields containing commas, quotes, or newlines are automatically escaped according to RFC 4180. The alias tc keeps one-liners terse when piping query results or API responses straight to CSV.

my @rows = ({name => "Alice", age => 30}, {name => "Bob", age => 25})
p tc \@rows   # name,age\nAlice,30\nBob,25
tc(\@rows) |> spurt "people.csv"
my @grid = ([1, 2, 3], [4, 5, 6])
p tc \@grid   # 1,2,3\n4,5,6

# to_toml

to_toml (alias tt) serializes a stryke hashref into a TOML-formatted string. TOML is a popular configuration format that maps cleanly to hash structures, making tt ideal for generating config files programmatically. Nested hashes become TOML sections, arrays become TOML arrays, and scalar values are serialized with their natural types. The output is always valid TOML that can be parsed back with toml_decode.

my %cfg = (database => {host => "localhost", port => 5432}, debug => 1)
p tt \%cfg
# [database]
# host = "localhost"
# port = 5432
# debug = 1
tt(\%cfg) |> spurt "config.toml"

# to_yaml

to_yaml (alias ty) serializes a stryke data structure into a YAML-formatted string. YAML is widely used for configuration and data exchange where human readability matters. Nested structures are represented with indentation, arrays with leading dashes, and strings are quoted only when necessary. The output is valid YAML 1.2 that round-trips cleanly through yaml_decode. The alias ty is convenient for quick inspection of complex data.

my %app = (name => "myapp", deps => ["tokio", "serde"], version => "1.0")
p ty \%app
# name: myapp
# version: "1.0"
# deps:
#   - tokio
#   - serde
ty(\%app) |> spurt "app.yaml"

# to_xml

to_xml (alias tx) serializes a stryke data structure into an XML string. Hash keys become element names, array values become repeated child elements, and scalar values become text content. This is useful for generating XML payloads for SOAP APIs, RSS feeds, or configuration files that require XML format. The output is well-formed XML that can be parsed back with xml_decode.

my %doc = (root => {title => "Hello", items => ["a", "b", "c"]})
p tx \%doc
# <root><title>Hello</title><items>a</items><items>b</items><items>c</items></root>
tx(\%doc) |> spurt "doc.xml"

# to_html

to_html (alias th) serializes a stryke data structure into a self-contained HTML document with cyberpunk styling (dark background, neon cyan/magenta accents, monospace fonts). Arrays of hashrefs render as full tables with headers, plain arrays as bullet lists, single hashes as key-value tables, and scalars as styled text blocks. Pipe to a file and open in a browser for instant data visualization.

fr |> map +{name => _, size => format_bytes(size)} |> th |> to_file("report.html")
my @rows = ({name => "Alice", age => 30}, {name => "Bob", age => 25})
@rows |> th |> to_file("people.html")
th({host => "localhost", port => 5432}) |> p

# to_markdown

to_markdown (aliases to_md, tmd) serializes a stryke data structure into Markdown text. Arrays of hashrefs render as GFM tables with headers and separator rows, plain arrays as bullet lists, single hashes as 2-column key-value tables, and scalars as plain text. The output is valid GitHub-Flavored Markdown suitable for README files, issue comments, or any Markdown renderer.

fr |> map +{name => _, size => format_bytes(size)} |> tmd |> to_file("report.md")
my @rows = ({name => "Alice", age => 30}, {name => "Bob", age => 25})
@rows |> tmd |> p
# | name | age |
# | --- | --- |
# | Alice | 30 |
# | Bob | 25 |

# from_json

from_json (alias fj) parses a JSON string into a stryke data structure (hashref, arrayref, scalar). This is the inverse of to_json and the idiomatic way to decode JSON responses from APIs, config files, or inter-process communication. The Rust-backed parser handles large documents efficiently.

my $json = '{"name":"Alice","age":30}'
my $data = from_json($json)
p $data->{name}   # Alice
my $arr = fj '[1, 2, {"x": 3}]'
p $arr->[2]{x}    # 3
slurp("config.json") |> fj

# from_yaml

from_yaml (alias fy) parses a YAML string into a stryke data structure. YAML is commonly used for configuration files due to its human-readable syntax. Handles scalars, arrays, hashes, and nested combinations. The parser supports common YAML features like multi-line strings and bare unquoted keys.

my $yaml = "name: Alice\nage: 30"
my $data = from_yaml($yaml)
p $data->{name}   # Alice
slurp("config.yaml") |> fy |> say _->{database}{host}

# from_toml

from_toml (alias ftoml) parses a TOML string into a stryke hashref. TOML is popular for Rust, Python, and other config files due to its explicit syntax. Sections become nested hashes, arrays stay arrays, and typed values (integers, floats, strings, booleans) are preserved.

my $toml = "[package]\nname = \"myapp\"\nversion = \"1.0\""
my $data = from_toml($toml)
p $data->{package}{name}   # myapp
slurp("Cargo.toml") |> ftoml |> say _->{package}{version}

# from_xml

from_xml (alias fx) parses an XML string into a stryke hashref. Element names become hash keys, text content becomes string values, nested elements become nested hashes. The parser handles the XML declaration and basic structures.

my $xml = '<root><name>Alice</name><age>30</age></root>'
my $data = from_xml($xml)
p $data->{root}{name}   # Alice
slurp("config.xml") |> fx |> say _->{config}{database}{host}

# from_csv

from_csv (alias fcsv) parses a CSV string into an arrayref of hashrefs, treating the first line as headers. This is the inverse of to_csv and handles quoted fields containing commas according to RFC 4180.

my $csv = "name,age\nAlice,30\nBob,25"
my $rows = from_csv($csv)
p $rows->[0]{name}   # Alice
p $rows->[1]{age}    # 25
slurp("data.csv") |> fcsv |> grep { _->{age} > 25 }

# xopen

xopen (alias xo) opens a file or URL with the system default handler — open on macOS, xdg-open on Linux, start on Windows. Returns the path unchanged so it can sit transparently in a pipeline. This is the missing link between generating output files and viewing them: pipe the path through xopen and the OS opens it in the appropriate app (browser for HTML, viewer for PDF, editor for text).

fr |> map +{name => _, size => format_bytes(size)} |> th |> to_file("report.html") |> xopen
xopen "https://github.com/MenkeTechnologies/stryke"
xopen "output.pdf"

# clip

clip (aliases clipboard, pbcopy) copies text to the system clipboard (pbcopy on macOS, xclip/xsel on Linux). Returns the text unchanged for pipeline chaining. This is the missing link between generating output and sharing it — pipe any serializer's output through clip and paste directly into Slack, GitHub, docs, or email.

fr |> map +{name => _, size => format_bytes(size)} |> tmd |> clip   # markdown table → clipboard
qw(a b c) |> join "," |> clip |> p                                  # also prints
"some text" |> clip                                                  # just copy

# paste

paste (alias pbpaste) reads text from the system clipboard (pbpaste on macOS, xclip/xsel on Linux). Returns the clipboard contents as a string, ready for pipeline processing.

p paste                              # print clipboard contents
paste |> lines |> grep /error/i |> p  # search clipboard for errors
paste |> wc |> p                      # word count of clipboard

# to_table

to_table (aliases table, tbl) renders data as a plain-text column-aligned table with Unicode box-drawing borders. Arrays of hashrefs render as full tables with headers, plain arrays as numbered rows, single hashes as key-value tables. The output is fixed-width text suitable for terminal display, log files, or any monospace context.

my @r = ({name => "Alice", age => 30}, {name => "Bob", age => 25})
@r |> tbl |> p
# ┌───────┬─────┐
# │ name  │ age │
# ├───────┼─────┤
# │ Alice │ 30  │
# │ Bob   │ 25  │
# └───────┴─────┘
fr |> map +{name => _, size => format_bytes(size)} |> tbl |> p

# sparkline

sparkline (alias spark) renders a list of numbers as a compact Unicode sparkline string using block characters (▁▂▃▄▅▆▇█). Each value maps to a bar height proportional to the min/max range. Ideal for inline data visualization in terminal output, dashboards, or log summaries.

(3,7,1,9,4,2,8,5) |> spark |> p   # ▃▆▁█▄▂▇▅
@daily_sales |> spark |> p         # quick trend line
fr |> map { size } |> spark |> p   # file size distribution

# bar_chart

bar_chart (alias bars) renders a hashref as a colored horizontal bar chart in the terminal. Each key becomes a label, each value a proportional bar. Colors cycle automatically. Pairs naturally with freq for instant word/event counting visualization.

qw(a b a c a b) |> freq |> bars |> p
# a │ ████████████████████████████████████████ 3
# b │ ███████████████████████████ 2
# c │ █████████████ 1
bars({cpu => 73, mem => 45, disk => 91}) |> p

# flame

flame (alias flamechart) renders a hierarchical hashref as a terminal flamechart with colored stacked bars. Nested hashes become child rows; widths are proportional to leaf values (weights). Useful for visualizing call stacks, cost breakdowns, or any tree-structured data.

flame({main => {parse => 30, eval => {compile => 15, run => 45}}, init => 10}) |> p
my $profile = read_json "profile.json"
flame($profile) |> p

# histo

histo renders a vertical histogram in the terminal. Given a hashref (label → count), it draws colored vertical bars. Given a flat array of numbers, it auto-bins into 10 buckets and shows the distribution. Pairs with freq for categorical data.

qw(a b a c a b) |> freq |> histo |> p   # vertical bars for a/b/c
(map { int(rand(100)) } 1:1000) |> histo |> p  # distribution of randoms

# gauge

gauge renders a single value as a horizontal gauge bar with color coding (green ≥80%, yellow ≥50%, magenta ≥25%, red below). Accepts a fraction (0.0–1.0) or a value with max: gauge(45, 100).

p gauge(0.73)       # [██████████████████████░░░░░░░░] 73%
p gauge(45, 100)    # [█████████████░░░░░░░░░░░░░░░░] 45%

# spinner

spinner shows an animated braille spinner on stderr while a block executes, then clears the spinner and returns the block's result. Useful for long-running one-liners where you want visual feedback without polluting stdout.

my $r = spinner "loading" { fetch_json("https://api.example.com/data") }
spinner { sleep 2
    42 }   # default message "working"

# csv_read

csv_read (alias cr) reads CSV data from a file path or string and returns an array of arrayrefs, where each inner arrayref represents one row. The parser handles RFC 4180 CSV correctly — quoted fields with embedded commas, newlines inside quotes, and escaped double quotes are all supported. The first row is treated as data (not a header) unless you process it separately. This is the fastest way to ingest tabular data in stryke.

my @rows = csv_read "data.csv"
p $rows[0]             # first row as arrayref
@rows |> e { p _->[0] }  # print first column
my @inline = csv_read "a,b,c\n1,2,3\n4,5,6"
p scalar @inline       # 3 rows (including header)

# csv_write

csv_write (alias cw) serializes an array of arrayrefs into a CSV-formatted string. Each inner arrayref becomes one row, and fields are automatically quoted when they contain commas, quotes, or newlines. This is the complement of csv_read and produces output conforming to RFC 4180. Use it to generate CSV files from computed data, export database query results, or prepare data for spreadsheet import.

my @data = (["name", "age"], ["Alice", 30], ["Bob", 25])
csv_write(\@data) |> spurt "people.csv"
my @report = map { [_->{id}, _->{score}] } @results
p csv_write \@report

# dataframe

dataframe (alias df) creates a columnar dataframe from tabular data, providing a structured way to work with rows and columns. You can construct a dataframe from an array of hashrefs, an array of arrayrefs with a header row, or from a CSV file. The dataframe supports column selection, filtering, sorting, and aggregation operations. This is stryke's answer to Python's pandas DataFrame — lightweight but sufficient for common data manipulation tasks.

my $df = df [{name => "Alice", age => 30}, {name => "Bob", age => 25}]
p $df
my $df2 = df csv_read "data.csv"
my @ages = $df->{age}
p @ages   # 30, 25

# sqlite

sqlite (alias sql) executes a SQL statement against an SQLite database file and returns the results. For SELECT queries, it returns an array of hashrefs where each hashref represents one row with column names as keys. For INSERT, UPDATE, and DELETE statements, it returns the number of affected rows. Bind parameters prevent SQL injection and handle quoting automatically. The database file is created if it does not exist, making sqlite a zero-setup embedded database.

sqlite("app.db", "CREATE TABLE users (name TEXT, age INT)")
sqlite("app.db", "INSERT INTO users VALUES (?, ?)", "Alice", 30)
my @rows = sqlite("app.db", "SELECT * FROM users WHERE age > ?", 20)
@rows |> e { p _->{name} }
sqlite("app.db", "SELECT count(*) as n FROM users") |> dd

# digits

digits (alias dg) extracts all digit characters from a string and returns them as a list. This is a quick way to pull numbers out of mixed text without writing a regex. Pairs naturally with join to reconstruct the numeric string, or freq for digit distribution analysis.

p join "", digits("phone: 555-1234")     # 5551234
"abc123def456" |> digits |> cnt |> p     # 6
cat("log.txt") |> digits |> freq |> bars |> p

# letters

letters (alias lts) extracts all alphabetic characters from a string and returns them as a list. Filters out digits, punctuation, whitespace — keeps only letters.

p join "", letters("h3ll0 w0rld!")   # hllwrld
"abc123DEF" |> letters |> cnt |> p   # 6

# sentences

sentences (alias sents) splits text on sentence boundaries (. ! ? followed by whitespace or end of string). Returns a list of trimmed sentences. Useful for NLP pipelines, text analysis, or splitting prose into processable units.

"Hello world. How are you? Fine!" |> sentences |> e p
# Hello world.
# How are you?
# Fine!
cat("essay.txt") |> sentences |> cnt |> p    # sentence count

# paragraphs

paragraphs (alias paras) splits text on blank lines (one or more consecutive newlines). Returns a list of trimmed paragraph strings. Useful for processing structured documents, README files, or any text with paragraph breaks.

cat("README.md") |> paragraphs |> cnt |> p   # paragraph count
cat("essay.txt") |> paragraphs |> map { sentences |> cnt } |> spark |> p  # sentences per paragraph

# sections

sections (alias sects) splits text on markdown-style headers (# ..., ## ...) or lines of ===/---. Returns a list of arrayrefs [heading, body] where each section's heading and body are separated. Useful for parsing structured documents.

cat("README.md") |> sections |> cnt |> p     # section count
cat("README.md") |> sections |> map { _->[0] } |> e p  # list all headings

# numbers

numbers (alias nums) extracts all numbers (integers and floats, including negatives) from a string and returns them as numeric values. Unlike digits which returns individual digit characters, numbers returns actual parsed values. Useful for pulling measurements, scores, or IDs out of mixed text.

p join ",", numbers("temp 98.6F, -20C, ver 3")  # 98.6,-20,3
cat("log.txt") |> numbers |> avg |> p              # average of all numbers in file
"price: $12.99 qty: 5" |> numbers |> e p            # 12.99, 5

# graphemes

graphemes (alias grs) splits a string into Unicode grapheme clusters. Unlike chars which splits on code points, graphemes keeps combining marks and emoji sequences together as single visual units. "cafe\u{0301}" gives 4 graphemes (not 5 code points). Essential for correct text processing of accented characters, emoji, and non-Latin scripts.

p cnt graphemes("cafe\u{0301}")    # 4 (not 5)
graphemes("hello") |> e p          # h, e, l, l, o

# columns

columns (alias cols) splits fixed-width columnar text into fields. Without a widths argument, it auto-detects columns by splitting on runs of 2+ whitespace (ideal for ps aux, ls -l, df output). With an arrayref of widths, it splits at exact fixed positions. Pairs with lines for processing tabular command output.

my @fields = columns("USER  PID  %CPU")             # auto-detect: [USER, PID, %CPU]
my @fixed = columns("John   Doe   30", [7, 7, 3])   # fixed-width: [John, Doe, 30]
capture("ps aux") |> lines |> map { columns } |> tbl |> p

# stringify

stringify (alias str) converts any stryke value — scalars, array refs, hash refs, nested structures, undef — into a string representation that is a valid stryke literal. The output is designed for round-tripping: you can eval the returned string to reconstruct the original data structure. This makes it ideal for serializing state to a file in a Perl-native format, generating code fragments, or building reproducible test fixtures. Unlike dd, which targets human readability, str prioritizes parseability.

my $s = str {a => 1, b => [2, 3]}
p $s               # {a => 1, b => [2, 3]}
my $copy = eval $s # round-trip back to hashref
my @list = (1, "hello", undef)
p str \@list        # [1, "hello", undef]

Note: references are serialized recursively; circular references will cause infinite recursion.

# ddump

ddump (alias dd) pretty-prints any stryke data structure to stderr in a human-readable, indented format similar to Perl's Data::Dumper. It is the go-to tool for quick debugging — drop a dd call anywhere in a pipeline to inspect intermediate values without disrupting the data flow. The output is colorized when stderr is a terminal. Unlike str, the output is not meant for eval round-tripping; it prioritizes clarity over parseability. dd returns its argument unchanged, so it can be inserted into pipelines transparently.

my %h = (name => "Alice", scores => [98, 87, 95])
dd \%h                        # pretty-prints to stderr
my @result = @data |> dd |> grep { _->{active} } |> dd
dd [1, {a => 2}, [3, 4]]     # nested structure

Note: dd writes to stderr, not stdout, so it never contaminates pipeline output.

# toml_decode

toml_decode (alias td) parses a TOML-formatted string and returns the corresponding stryke hash structure. TOML sections become nested hashrefs, arrays map to arrayrefs, and typed scalars (integers, floats, booleans, datetime strings) are preserved. This is useful for reading configuration files, parsing Cargo.toml manifests, or processing any TOML input. Malformed TOML raises an exception.

my $cfg = toml_decode(slurp "config.toml")
p $cfg->{database}{host}   # localhost
my $cargo = toml_decode(slurp "Cargo.toml")
p $cargo->{package}{version}
slurp("settings.toml") |> toml_decode |> dd

# toml_encode

toml_encode (alias te) serializes a stryke hashref into a valid TOML string. Nested hashes become TOML sections with [section] headers, arrays become TOML arrays, and scalars are serialized with appropriate quoting. This is the inverse of toml_decode and is useful for generating or updating configuration files programmatically. The output is human-readable and can be written directly to a .toml file.

my %cfg = (server => {host => "0.0.0.0", port => 8080}, debug => 0)
toml_encode(\%cfg) |> spurt "server.toml"
my $round = toml_decode(toml_encode(\%cfg))
p $round->{server}{port}  # 8080

# yaml_decode

yaml_decode (alias yd) parses a YAML string and returns the corresponding stryke data structure. Mappings become hashrefs, sequences become arrayrefs, and scalars are coerced to their natural Perl types. This handles YAML 1.2 including multi-document streams, anchors/aliases, and flow notation. It is the go-to function for reading YAML configuration files, Kubernetes manifests, or CI pipeline definitions. Invalid YAML raises an exception.

my $cfg = yaml_decode(slurp "docker-compose.yml")
p $cfg->{services}{web}{image}
my $ci = yaml_decode(slurp ".github/workflows/ci.yml")
dd $ci->{jobs}
slurp("values.yaml") |> yaml_decode |> json_encode |> p

# yaml_encode

yaml_encode (alias ye) serializes a stryke data structure into a valid YAML string. Hashes become YAML mappings, arrays become sequences with dash prefixes, and scalars are quoted only when necessary for disambiguation. The output is human-readable and suitable for writing config files, generating Kubernetes resources, or producing YAML-based API payloads. It is the inverse of yaml_decode.

my %svc = (name => "api", replicas => 3, ports => [80, 443])
yaml_encode(\%svc) |> spurt "service.yaml"
my $round = yaml_decode(yaml_encode(\%svc))
p $round->{replicas}   # 3
rj("config.json") |> yaml_encode |> p  # JSON to YAML

# xml_decode

xml_decode (alias xd) parses an XML string and returns a stryke data structure. Elements become hash keys, text content becomes scalar values, repeated child elements become arrayrefs, and attributes are accessible through a conventions-based mapping. This is useful for consuming SOAP responses, RSS feeds, SVG files, or any XML-based API. Malformed XML raises an exception rather than returning partial data.

my $doc = xml_decode('<root><name>stryke</name><ver>1</ver></root>')
p $doc->{root}{name}   # stryke
slurp("feed.xml") |> xml_decode |> dd
my $svg = xml_decode(fetch("https://example.com/image.svg"))
p $svg->{svg}

# xml_encode

xml_encode (alias xe) serializes a stryke data structure into a well-formed XML string. Hash keys become element names, scalar values become text content, and arrayrefs become repeated sibling elements. This is useful for generating XML payloads for SOAP APIs, creating RSS or Atom feeds, or producing configuration files in XML format. The output is the inverse of xml_decode and round-trips cleanly.

my %data = (root => {title => "Test", items => [{id => 1}, {id => 2}]})
p xml_encode \%data
xml_encode(\%data) |> spurt "output.xml"
my $payload = xml_encode {request => {action => "query", id => 42}}
http_request(method => "POST", url => $endpoint, body => $payload)

HTTP & Networking

23 topics

# fetch

fetch (alias ft) performs a blocking HTTP GET request to the given URL and returns the response body as a string. It follows redirects automatically and raises an exception on network errors or non-2xx status codes. This is the simplest way to retrieve content from the web in stryke — no need to configure a client or parse response objects. For JSON APIs, prefer fetch_json which additionally decodes the response.

my $html = fetch "https://example.com"
p $html
my $ip = fetch "https://api.ipify.org"
p "My IP: $ip"
fetch("https://example.com/data.txt") |> spurt "local.txt"$1

Note: for POST, PUT, DELETE, or custom headers, use `http_request` instead.

# fetch_json

fetch_json (alias ftj) performs a blocking HTTP GET request and automatically decodes the JSON response body into a stryke data structure. This combines fetch and json_decode into a single call, which is the common case when consuming REST APIs. It raises an exception if the response is not valid JSON or the request fails. The returned value is typically a hashref or arrayref ready for immediate use.

my $data = fetch_json "https://api.github.com/repos/stryke/stryke"
p $data->{stargazers_count}
fetch_json("https://jsonplaceholder.typicode.com/todos") |> e { p _->{title} }
my $weather = fetch_json "https://wttr.in/?format=j1"
p $weather->{current_condition}[0]{temp_C}

# fetch_async

fetch_async (alias fta) initiates a non-blocking HTTP GET request and returns a task handle that can be awaited later. This allows you to fire off multiple HTTP requests concurrently and wait for them all to complete, dramatically reducing total latency when fetching from several endpoints. The task resolves to the response body as a string, just like fetch. Use this when you need to parallelize network I/O without threads.

my $t1 = fetch_async "https://api.example.com/users"
my $t2 = fetch_async "https://api.example.com/posts"
my $users = await $t1
my $posts = await $t2
p "Got users and posts concurrently"

# fetch_async_json

fetch_async_json (alias ftaj) initiates a non-blocking HTTP GET request that automatically decodes the JSON response when awaited. This combines fetch_async with json_decode, making it the ideal choice for concurrent API calls where every response is JSON. The task resolves to the decoded stryke data structure — a hashref, arrayref, or scalar depending on the JSON content.

my @urls = map { "https://api.example.com/item/$_" } 1:10
my @tasks = map fetch_async_json @urls
my @results = map await @tasks
@results |> e { p _->{name} }

# http_request

http_request (alias hr) performs a fully configurable HTTP request with control over method, headers, body, and timeout. Unlike fetch which is limited to GET, http_request supports POST, PUT, PATCH, DELETE, and any other HTTP method. Pass named parameters for configuration. The response is returned as a hashref containing status, headers, and body fields, giving you full access to the HTTP response. This is the right tool when you need to send data, set authentication headers, or inspect status codes.

my $res = http_request(method => "POST", url => "https://api.example.com/users",
    headers => {"Content-Type" => "application/json", Authorization => "Bearer $token"},
    body => tj {name => "Alice"})
p $res->{status}   # 201
my $data = json_decode $res->{body}
my $del = http_request(method => "DELETE", url => "https://api.example.com/users/42")

# par_fetch

par_fetch @urls — fetch a list of URLs in parallel using async HTTP, returning an array of response bodies in input order.

Under the hood, stryke spawns concurrent HTTP GET requests across a connection pool with keep-alive and automatic retry on transient failures (5xx, timeouts). The degree of parallelism is bounded by the connection pool size (default 64) to avoid overwhelming the target server. For heterogeneous HTTP methods or custom headers, use http_request inside pmap instead. par_fetch is the right tool when you have a homogeneous list of URLs and just need the bodies — it handles connection reuse, DNS caching, and TLS session resumption automatically for maximum throughput.

my @bodies = par_fetch @urls

# Fetch and decode JSON in one shot:
my @data = par_fetch(@api_urls) |> map json_decode

# Download pages with progress:
my @pages = par_fetch @urls, progress => 1

# serve

Start a blocking HTTP server.

serve 8080, fn ($req) {
    # $req = { method, path, query, headers, body, peer }
    { status => 200, body => "hello" }
}

serve 3000, fn ($req) {
    my $data = { name => "stryke", version => "0.4" }
    { status => 200, body => json_encode($data) }
}, { workers => 8 }$1

Handler returns: hashref `{ status, body, headers }`, string (200 OK), or undef (404).
JSON content-type auto-detected when body starts with `{` or `[`.

# socket

Create a network socket with the specified domain, type, and protocol. The socket handle is stored in the first argument and can then be used with bind, connect, send, recv, and other socket operations. Domain constants include AF_INET (IPv4) and AF_INET6 (IPv6); type constants include SOCK_STREAM (TCP) and SOCK_DGRAM (UDP).

socket(my $sock, AF_INET, SOCK_STREAM, 0)
my $addr = sockaddr_in(8080, inet_aton("127.0.0.1"))
connect($sock, $addr)
send($sock, "GET / HTTP/1.0\r\n\r\n", 0)

# bind

Bind a socket to a local address so it can accept connections or receive datagrams on that address. The address is a packed sockaddr_in or sockaddr_in6 structure. Binding is required before calling listen on a server socket. Dies if the address is already in use unless SO_REUSEADDR is set.

socket(my $srv, AF_INET, SOCK_STREAM, 0)
setsockopt($srv, SOL_SOCKET, SO_REUSEADDR, 1)
bind($srv, sockaddr_in(8080, INADDR_ANY)) or die "bind: $!"
listen($srv, 5)

# listen

Mark a bound socket as passive, ready to accept incoming connections. The backlog argument specifies the maximum number of pending connections the OS will queue before refusing new ones. This is only meaningful for stream (TCP) sockets. Call accept in a loop after listen to handle clients.

socket(my $srv, AF_INET, SOCK_STREAM, 0)
bind($srv, sockaddr_in(9000, INADDR_ANY))
listen($srv, 128) or die "listen: $!"
while (accept(my $client, $srv)) {
    send($client, "hello\n", 0)
}

# accept

Accept a pending connection on a listening socket and return a new connected socket handle. The new handle is used for communication with that specific client while the original listening socket continues accepting others. Returns the packed remote address on success, false on failure.

listen($srv, 5)
while (my $remote = accept(my $client, $srv)) {
    my ($port, $ip) = sockaddr_in($remote)
    p "connection from " . inet_ntoa($ip) . ":$port"
    send($client, "welcome\n", 0)
}

# connect

Initiate a connection from a socket to a remote address. For TCP sockets this performs the three-way handshake; for UDP it sets the default destination so subsequent send calls do not need an address. Dies or returns false if the connection is refused or times out.

socket(my $sock, AF_INET, SOCK_STREAM, 0)
my $addr = sockaddr_in(80, inet_aton("example.com"))
connect($sock, $addr) or die "connect: $!"
send($sock, "GET / HTTP/1.0\r\n\r\n", 0)
recv($sock, my $buf, 4096, 0)
p $buf

# send

Send data through a connected socket. The flags argument controls behavior — use 0 for normal sends. For UDP sockets you can supply a destination address as a fourth argument to send to a specific peer without calling connect first. Returns the number of bytes sent, or undef on error.

send($sock, "hello world\n", 0)
my $n = send($sock, $payload, 0)
p "sent $n bytes"
# UDP to specific peer
send($udp, $msg, 0, sockaddr_in(5000, inet_aton("10.0.0.1")))

# recv

Receive data from a socket into a buffer. The length argument specifies the maximum number of bytes to read. For stream sockets a short read is normal — loop until you have all expected data. For datagram sockets each call returns exactly one datagram. Returns the sender address for UDP, or empty string for TCP.

recv($sock, my $buf, 4096, 0) or die "recv: $!"
p $buf
my $data = ""
while (recv($sock, my $chunk, 8192, 0) && length($chunk)) {
    $data .= $chunk
}

# shutdown

Shut down part or all of a socket connection without closing the file descriptor. The how argument controls direction: 0 stops reading, 1 stops writing (sends FIN to peer), 2 stops both. This is useful for signaling end-of-data to the remote side while still reading its response.

send($sock, $request, 0)
shutdown($sock, 1)           # done writing
recv($sock, my $resp, 65536, 0)  # still read response
shutdown($sock, 2)           # fully close

# setsockopt

Set an option on a socket at the specified protocol level. Common uses include enabling SO_REUSEADDR to allow immediate rebinding after a server restart, setting TCP_NODELAY to disable Nagle's algorithm, or adjusting buffer sizes. The value is typically a packed integer.

setsockopt($srv, SOL_SOCKET, SO_REUSEADDR, 1)
setsockopt($sock, IPPROTO_TCP, TCP_NODELAY, 1)
setsockopt($sock, SOL_SOCKET, SO_RCVBUF, pack("I", 262144))

# getsockopt

Retrieve the current value of a socket option at the specified protocol level. Returns the option value as a packed binary string — use unpack to interpret it. Useful for inspecting buffer sizes, checking whether SO_REUSEADDR is set, or reading OS-assigned values.

my $val = getsockopt($sock, SOL_SOCKET, SO_RCVBUF)
p unpack("I", $val)                 # e.g. 131072
my $reuse = getsockopt($srv, SOL_SOCKET, SO_REUSEADDR)
p unpack("I", $reuse)               # 1 or 0

# getsockname

Return the packed socket address of the local end of a socket. This is useful when the socket was bound to INADDR_ANY or port 0 (OS-assigned) and you need to discover the actual address and port the OS chose. Unpack the result with sockaddr_in.

bind($sock, sockaddr_in(0, INADDR_ANY))  # OS picks port
my $local = getsockname($sock)
my ($port, $ip) = sockaddr_in($local)
p "listening on port $port"

# getpeername

Return the packed socket address of the remote end of a connected socket. Use sockaddr_in or sockaddr_in6 to unpack it into a port and IP address. This is how a server discovers which client it is talking to after accept, or how a client confirms the peer address after connect.

my $packed = getpeername($client)
my ($port, $ip) = sockaddr_in($packed)
p "peer: " . inet_ntoa($ip) . ":$port"

# gethostbyname

Resolve a hostname to its network addresses using the system resolver. Returns ($name, $aliases, $addrtype, $length, @addrs). The addresses are packed binary — pass them through inet_ntoa to get dotted-quad strings. This is the classic DNS forward-lookup function.

my @info = gethostbyname("example.com")
my @addrs = @info[4..$ #info]
@addrs |> map inet_ntoa |> e p
my $ip = inet_ntoa((gethostbyname("localhost"))[4])
p $ip   # 127.0.0.1

# gethostbyaddr

Perform a reverse DNS lookup — given a packed binary IP address and address family, return the hostname associated with that address. Returns ($name, $aliases, $addrtype, $length, @addrs) on success, or empty list if no PTR record exists.

my $packed = inet_aton("8.8.8.8")
my $name = (gethostbyaddr($packed, AF_INET))[0]
p $name   # dns.google

# getprotobyname

Look up a network protocol by its name and return protocol information. Returns ($name, $aliases, $proto_number). The protocol number is what you pass to socket as the protocol argument. Common names include tcp, udp, and icmp.

my ($name, $aliases, $proto) = getprotobyname("tcp")
p "$name = protocol $proto"   # tcp = protocol 6
socket(my $raw, AF_INET, SOCK_RAW, (getprotobyname("icmp"))[2])

# getservbyname

Look up a network service by its name and protocol, returning the port number and related information. Returns ($name, $aliases, $port, $proto). The port is in host byte order. This resolves well-known service names like http, ssh, or smtp to their port numbers portably.

my ($name, $aliases, $port) = getservbyname("http", "tcp")
p "$name => port $port"         # http => port 80
my $ssh_port = (getservbyname("ssh", "tcp"))[2]
p $ssh_port                     # 22

Crypto & Encoding

133 topics

# sha256

sha256 (alias s256) computes the SHA-256 cryptographic hash of the input data and returns it as a 64-character lowercase hexadecimal string. SHA-256 is the most widely used hash function for data integrity verification, content addressing, and digital signatures. The Rust implementation is significantly faster than pure-Perl alternatives. Accepts strings or byte buffers.

p sha256 "hello world"   # b94d27b9934d3e08...
my $checksum = sha256 slurp "release.tar.gz"
p $checksum
rl("passwords.txt") |> map sha256 |> e p

# sha224

sha224 (alias s224) computes the SHA-224 cryptographic hash and returns a 56-character hex string. SHA-224 is a truncated variant of SHA-256 that produces a shorter digest while maintaining strong collision resistance. It is sometimes preferred when storage or bandwidth for the hash value is constrained, such as in compact data structures or short identifiers.

p sha224 "hello world"   # 2f05477fc24bb4fa...
my $h = sha224(tj {key => "value"})
p $h

# sha384

sha384 (alias s384) computes the SHA-384 cryptographic hash and returns a 96-character hex string. SHA-384 is a truncated variant of SHA-512 that offers a middle ground between SHA-256 and SHA-512 in both digest length and security margin. It is commonly used in TLS certificate fingerprints and government security standards that require larger-than-256-bit digests.

p sha384 "hello world"   # fdbd8e75a67f29f7...
my $sig = sha384(slurp "document.pdf")
spurt "document.pdf.sha384", $sig

# sha512

sha512 (alias s512) computes the SHA-512 cryptographic hash and returns a 128-character hex string. SHA-512 provides the largest digest size in the SHA-2 family and is the strongest option when maximum collision resistance is needed. On 64-bit systems, SHA-512 is often faster than SHA-256 because it operates on 64-bit words natively. Use this for high-security applications or when you need a longer hash.

p sha512 "hello world"   # 309ecc489c12d6eb...
my $hash = sha512(slurp "firmware.bin")
p $hash
my @hashes = map sha512 @files

# sha1

sha1 (alias s1) computes the SHA-1 hash and returns a 40-character hex string. SHA-1 is considered cryptographically broken for collision resistance and should not be used for security-sensitive applications. However, it remains widely used for non-security purposes such as Git object IDs, cache keys, and deduplication checksums where collision attacks are not a concern.

p sha1 "hello world"   # 2aae6c35c94fcfb4...
my $git_id = sha1("blob " . length($content) . "\0" . $content)
p $git_id$1

Note: prefer SHA-256 for any security-related use case.

# crc32

crc32 computes the CRC-32 checksum of the input data and returns it as an unsigned 32-bit integer. CRC-32 is not a cryptographic hash — it is a fast error-detection code used in network protocols (Ethernet, ZIP, PNG), file integrity checks, and hash table bucketing. It is extremely fast compared to SHA functions, making it suitable for high-throughput deduplication or quick change detection where collision resistance is not required.

p crc32 "hello world"   # 222957957
my $chk = crc32(slurp "archive.zip")
p sprintf "0x%08x", $chk  # hex representation
my @checksums = map crc32 @chunks

# hmac_sha256

hmac_sha256 (alias hmac) computes an HMAC-SHA256 message authentication code using the given data and secret key, returning a hex string. HMAC combines a cryptographic hash with a secret key to produce a signature that verifies both data integrity and authenticity. This is the standard mechanism for signing API requests (AWS, Stripe, GitHub webhooks), generating secure tokens, and verifying message authenticity.

my $sig = hmac_sha256 "request body", "my-secret-key"
p $sig
my $webhook_sig = hmac("POST /hook\n$body", $secret)
p $webhook_sig eq $expected ? "valid" : "tampered"

# blake2b

blake2b (alias b2b) computes the BLAKE2b-512 cryptographic hash and returns a 128-character hex string. BLAKE2b is faster than SHA-256 while being at least as secure. It is used in Argon2 password hashing, libsodium, WireGuard, and many modern cryptographic protocols. Prefer BLAKE2b or BLAKE3 for new projects over SHA-256.

p blake2b "hello world"   # 021ced8799...
my $hash = b2b(slurp "large-file.bin")
my @hashes = map blake2b @messages

# blake2s

blake2s (alias b2s) computes the BLAKE2s-256 cryptographic hash and returns a 64-character hex string. BLAKE2s is optimized for 8-32 bit platforms while BLAKE2b targets 64-bit. Use BLAKE2s when targeting embedded systems, WebAssembly, or when a 256-bit digest suffices.

p blake2s "hello world"   # 9aec6806...
my $checksum = b2s($firmware_blob)

# blake3

blake3 (alias b3) computes the BLAKE3 cryptographic hash and returns a 64-character hex string (256-bit). BLAKE3 is the latest evolution — it is parallelizable, even faster than BLAKE2, and suitable for hashing large files at maximum speed. It is the recommended hash function for new projects where legacy compatibility is not required.

p blake3 "hello world"   # d74981efa...
my $hash = b3(slurp "gigabyte-file.bin")  # fast!

# argon2_hash

argon2_hash (alias argon2) hashes a password using Argon2id, the winner of the Password Hashing Competition. Returns a PHC-format string containing algorithm parameters, salt, and hash. Argon2 is memory-hard and resistant to GPU/ASIC attacks. Use this for user password storage — never use MD5/SHA for passwords.

my $hash = argon2_hash("user-password")
to_file("user.hash", $hash)
# later...
if (argon2_verify("user-password", $hash)) {
    p "login successful"
}

# argon2_verify

argon2_verify verifies a password against an Argon2 PHC hash string. Returns 1 if the password matches, 0 otherwise. The verification automatically extracts parameters from the stored hash, so changing Argon2 settings for new hashes does not break existing ones.

my $stored = rl("user.hash")
if (argon2_verify($user_input, $stored)) {
    p "access granted"
} else {
    p "invalid password"
}

# bcrypt_hash

bcrypt_hash (alias bcrypt) hashes a password using the bcrypt algorithm, returning a standard $2b$... format string. Bcrypt has been the industry standard for password hashing for over 20 years. While Argon2 is now preferred for new systems, bcrypt remains secure and widely deployed.

my $hash = bcrypt_hash("my-password")
p $hash  # $2b$12$...
if (bcrypt_verify("my-password", $hash)) {
    p "correct"
}

# bcrypt_verify

bcrypt_verify verifies a password against a bcrypt hash string. Returns 1 if correct, 0 otherwise. The cost factor and salt are extracted from the stored hash automatically.

if (bcrypt_verify($password, $stored_hash)) {
    grant_access()
}

# scrypt_hash

scrypt_hash (alias scrypt) hashes a password using the scrypt algorithm, returning a PHC-format string. Scrypt is memory-hard like Argon2 and is used in cryptocurrency (Litecoin) and some enterprise systems. It predates Argon2 but remains secure.

my $hash = scrypt_hash("password123")
if (scrypt_verify("password123", $hash)) {
    p "verified"
}

# scrypt_verify

scrypt_verify verifies a password against a scrypt PHC hash. Returns 1 on match, 0 otherwise.

if (scrypt_verify($input, $stored)) {
    p "valid"
}

# pbkdf2

pbkdf2 (alias pbkdf2_derive) derives a cryptographic key from a password using PBKDF2-HMAC-SHA256. Returns a 64-character hex string (32 bytes). Takes password, salt, and optional iteration count (default 100,000). Use this when you need a fixed-length key from a password — for encryption keys, not password storage (use Argon2/bcrypt for that).

my $key = pbkdf2("password", "random-salt")
p $key  # 64 hex chars = 32 bytes
my $strong = pbkdf2("pass", $salt, 200_000)  # more iterations

# random_bytes

random_bytes (alias randbytes) generates cryptographically secure random bytes using the OS CSPRNG. Returns a byte buffer of the specified length. Use for encryption keys, nonces, salts, and any security-sensitive randomness. Never use rand() for cryptographic purposes.

my $key = random_bytes(32)   # 256-bit key
my $nonce = random_bytes(12) # 96-bit nonce for AES-GCM
p hex_encode($key)

# random_bytes_hex

random_bytes_hex (alias randhex) generates cryptographically secure random bytes and returns them as a hex string. Convenient when you need a random hex token or key without a separate hex_encode call.

my $token = random_bytes_hex(16)  # 32 hex chars
p $token   # 7a3f9b2c1d...
my $api_key = "sk_" . randhex(24)

# aes_encrypt

aes_encrypt (alias aes_enc) encrypts plaintext using AES-256-GCM authenticated encryption. Takes a 32-byte key (use random_bytes(32) or pbkdf2). Returns a base64 string containing the nonce and ciphertext. AES-GCM provides both confidentiality and integrity — tampering is detected on decryption.

my $key = random_bytes(32)
my $cipher = aes_encrypt($key, "secret message")
p $cipher  # base64 encoded
my $plain = aes_decrypt($key, $cipher)
p $plain   # secret message

# aes_decrypt

aes_decrypt (alias aes_dec) decrypts AES-256-GCM ciphertext produced by aes_encrypt. Takes the same 32-byte key and the base64 ciphertext. Dies if the key is wrong or the ciphertext was tampered with (authentication failure).

my $plain = aes_decrypt($key, $ciphertext)
p $plain
# wrong key or tampered data raises exception

# chacha_encrypt

chacha_encrypt (alias chacha_enc) encrypts plaintext using ChaCha20-Poly1305 authenticated encryption. Takes a 32-byte key. Returns base64(nonce || ciphertext || tag). ChaCha20-Poly1305 is the modern alternative to AES-GCM — faster in software, constant-time, and used in TLS 1.3, WireGuard, and SSH.

my $key = random_bytes(32)
my $cipher = chacha_encrypt($key, "secret data")
my $plain = chacha_decrypt($key, $cipher)
p $plain

# chacha_decrypt

chacha_decrypt (alias chacha_dec) decrypts ChaCha20-Poly1305 ciphertext. Takes the same 32-byte key and base64 ciphertext. Dies on wrong key or tampering.

my $plain = chacha_decrypt($key, $cipher)
p $plain

# ed25519_keygen

ed25519_keygen (alias ed_keygen) generates an Ed25519 signing keypair. Returns [private_key_hex, public_key_hex]. Ed25519 is the modern standard for digital signatures — fast, secure, and used in SSH, GPG, and cryptocurrency. The private key is 32 bytes (64 hex), the public key is also 32 bytes.

my ($priv, $pub) = @{ ed25519_keygen() }
p "Private: $priv"
p "Public:  $pub"
my $sig = ed25519_sign($priv, "message")

# ed25519_sign

ed25519_sign (alias ed_sign) signs a message with an Ed25519 private key. Takes the private key (hex) and message. Returns a 128-character hex signature (64 bytes). Signatures are deterministic — the same key+message always produces the same signature.

my $sig = ed25519_sign($private_key, "hello world")
p $sig   # 128 hex chars

# ed25519_verify

ed25519_verify (alias ed_verify) verifies an Ed25519 signature. Takes public_key_hex, message, signature_hex. Returns 1 if valid, 0 if invalid. Never trust unsigned data in security contexts.

if (ed25519_verify($pub, "hello world", $sig)) {
    p "signature valid"
} else {
    p "FORGED!"
}

# x25519_keygen

x25519_keygen (alias x_keygen) generates an X25519 key-exchange keypair. Returns [private_key_hex, public_key_hex]. X25519 is the modern Diffie-Hellman — used in TLS 1.3, Signal, WireGuard. Both parties generate keypairs and exchange public keys to derive a shared secret.

my ($my_priv, $my_pub) = @{ x25519_keygen() }
# send $my_pub to peer, receive $their_pub
my $shared = x25519_dh($my_priv, $their_pub)

# x25519_dh

x25519_dh (alias x_dh) performs X25519 Diffie-Hellman key exchange. Takes your private key and their public key. Returns a 64-character hex shared secret. Both parties derive the same secret, which can be used as an encryption key.

my $shared = x25519_dh($my_private, $their_public)
my $key = hex_decode(substr($shared, 0, 64))  # use as AES key

# base64_encode

base64_encode (alias b64e) encodes a string or byte buffer as a Base64 string using the standard alphabet (A-Z, a-z, 0-9, +, /). Base64 is the standard way to embed binary data in text-based formats like JSON, XML, email (MIME), and data URIs. The output length is always a multiple of 4, padded with = as needed. Use base64_decode to reverse the encoding.

my $encoded = base64_encode "hello world"
p $encoded   # aGVsbG8gd29ybGQ=
my $img_data = slurp "photo.png"
my $data_uri = "data:image/png;base64," . base64_encode($img_data)
p base64_decode(base64_encode("round trip"))  # round trip

# base64_decode

base64_decode (alias b64d) decodes a Base64-encoded string back to its original bytes. It accepts standard Base64 with padding and is tolerant of line breaks within the input. This is essential for processing email attachments, decoding JWT payloads, extracting embedded images from data URIs, or reading any Base64-encoded field from an API response. Raises an exception on invalid Base64 input.

my $decoded = base64_decode "aGVsbG8gd29ybGQ="
p $decoded   # hello world
my $img = base64_decode($api_response->{avatar_b64})
spurt "avatar.png", $img
my $json = base64_decode($jwt_parts[1])
dd json_decode $json

# hex_encode

hex_encode (alias hxe) converts a string or byte buffer into its lowercase hexadecimal representation, with two hex characters per input byte. This is useful for displaying binary data in a human-readable format, generating hex-encoded keys or IDs, logging raw bytes, or preparing data for protocols that use hex encoding. The output is always an even number of characters.

p hex_encode "hello"   # 68656c6c6f
my $raw = slurp "key.bin"
p hex_encode $raw
my $color = hex_encode chr(255) . chr(128) . chr(0)
p "#$color"   # #ff8000

# hex_decode

hex_decode (alias hxd) converts a hexadecimal string back to its original bytes, interpreting every two hex characters as one byte. This is the inverse of hex_encode and is useful for parsing hex-encoded binary data from config files, network protocols, or cryptographic outputs. The input must have an even number of valid hex characters (0-9, a-f, A-F) or an exception is raised.

my $bytes = hex_decode "68656c6c6f"
p $bytes   # hello
my $key = hex_decode $env_hex_key
my $mac = hmac_sha256($data, hex_decode($secret_hex))
p hex_decode(hex_encode("round trip"))  # round trip

# uuid

uuid generates a cryptographically random UUID version 4 string in the standard 8-4-4-4-12 hyphenated format. Each call produces a unique identifier suitable for database primary keys, correlation IDs, session tokens, temporary file names, or any situation requiring a globally unique identifier without coordination. The randomness comes from the OS CSPRNG.

my $id = uuid()
p $id   # e.g., 550e8400-e29b-41d4-a716-446655440000
my %record = (id => uuid(), name => "Alice", created => time)
my @ids = map { uuid() } 1:10

# jwt_encode

jwt_encode creates a signed JSON Web Token from a payload hashref and a secret key. The default algorithm is HS256 (HMAC-SHA256), but you can specify an alternative as the third argument. JWTs are the standard for stateless authentication tokens, API authorization, and secure inter-service communication. The returned string contains the base64url-encoded header, payload, and signature separated by dots.

my $token = jwt_encode({sub => "user123", exp => time + 3600}, "my-secret")
p $token
my $admin = jwt_encode({role => "admin", iat => time}, $secret, "HS512")
# send as Authorization header
http_request(method => "GET", url => $api_url,
    headers => {Authorization => "Bearer $token"})

# jwt_decode

jwt_decode verifies the signature of a JSON Web Token using the provided secret key and returns the decoded payload as a hashref. If the signature is invalid, the token has been tampered with, or it has expired (when an exp claim is present), the function raises an exception. This is the secure way to validate incoming JWTs from clients or other services — always use this over jwt_decode_unsafe in production.

my $payload = jwt_decode($token, "my-secret")
p $payload->{sub}   # user123
my $claims = jwt_decode($bearer_token, $secret)
if ($claims->{role} eq "admin") {
    p "admin access granted"
}

Note: raises an exception on expired tokens, invalid signatures, or malformed input.

# jwt_decode_unsafe

jwt_decode_unsafe decodes a JSON Web Token and returns the payload as a hashref without verifying the signature. This is intentionally insecure and should only be used for debugging, logging, or inspecting token contents in development environments. Never use this to make authorization decisions in production — an attacker can stryke arbitrary payloads. The function still parses the JWT structure and base64-decodes the payload, but skips all cryptographic checks.

# debugging only — never use for auth
my $claims = jwt_decode_unsafe($token)
dd $claims
p $claims->{sub}   # inspect without needing the secret
my $exp = $claims->{exp}
p "Expires: " . datetime_from_epoch($exp)$1

Note: this function exists for debugging. Use `jwt_decode` with a secret for any security-relevant validation.

# url_encode

Percent-encode a string so it is safe to embed in a URL query parameter or path segment. Unreserved characters (alphanumeric, -, _, ., ~) are left as-is; everything else becomes %XX. The alias uri_escape matches the classic URI::Escape name for Perl muscle-memory.

my $q = "hello world & friends"
my $safe = url_encode($q)
p $safe   # hello%20world%20%26%20friends
my $url = "https://example.com/search?q=" . url_encode($q)
p $url$1

Note: does not encode the full URL structure — encode individual components, not the whole URL.

# url_decode

Decode a percent-encoded string back to its original form, converting %XX sequences to the corresponding bytes and + to space. The alias uri_unescape matches URI::Escape conventions. Use this when parsing query strings from incoming URLs or reading URL-encoded form data.

my $encoded = "hello%20world%20%26%20friends"
p url_decode($encoded)   # hello world & friends
# round-trip
my $orig = "café ☕"
p url_decode(url_encode($orig)) eq $orig  # 1

# gzip

Compress a string or byte buffer using the gzip (RFC 1952) format and return the compressed bytes. Useful for shrinking data before writing to disk or sending over the network. Pairs with gunzip for decompression. The compression level is chosen automatically for a good speed/size tradeoff.

my $raw = "hello world" x 1000
my $gz = gzip($raw)
to_file("data.gz", $gz)
p length($gz)       # much smaller than original
p gunzip($gz) eq $raw  # 1

# gunzip

Decompress gzip-compressed data (RFC 1952) and return the original bytes. Dies if the input is not valid gzip. Use this to read .gz files or decompress data received from HTTP responses with Content-Encoding: gzip. Always the inverse of gzip.

my $compressed = rl("archive.gz")
my $text = gunzip($compressed)
p $text
# round-trip in a pipeline
"payload" |> gzip |> gunzip |> p  # payload

# zstd

Compress a string or byte buffer using the Zstandard algorithm and return the compressed bytes. Zstandard offers significantly better compression ratios and speed compared to gzip, making it ideal for large datasets, IPC buffers, and caching. Pairs with zstd_decode for decompression.

my $big = "x]" x 100_000
my $compressed = zstd($big)
p length($compressed)  # fraction of original
to_file("data.zst", $compressed)
p zstd_decode($compressed) eq $big  # 1

# zstd_decode

Decompress Zstandard-compressed data and return the original bytes. Dies if the input is not valid Zstandard. This is the inverse of zstd. Use it to read .zst files or decompress cached buffers that were compressed with zstd.

my $packed = zstd("important data\n" x 500)
my $original = zstd_decode($packed)
p $original
# file round-trip
to_file("cache.zst", zstd($payload))
p zstd_decode(rl("cache.zst"))

# sha3_256

sha3_256 (alias s3_256) computes the SHA3-256 hash (NIST FIPS 202) and returns a 64-character hex string. SHA-3 is the newest NIST-approved hash family, designed as a backup if SHA-2 is ever compromised. It uses the Keccak sponge construction which is fundamentally different from SHA-2.

p sha3_256 "hello world"   # 644bcc7e...
my $h = s3_256(slurp "file.bin")

# sha3_512

sha3_512 (alias s3_512) computes the SHA3-512 hash and returns a 128-character hex string. Provides a 512-bit digest with the SHA-3 sponge construction.

p sha3_512 "hello world"   # 840006...

# shake128

shake128 is a SHA-3 extendable-output function (XOF). Unlike fixed-length hashes, SHAKE can produce arbitrary-length output. Takes data and output length in bytes, returns hex. Useful for key derivation or when you need a variable-length digest.

p shake128("seed", 32)   # 64 hex chars (32 bytes)
p shake128("seed", 64)   # 128 hex chars

# shake256

shake256 is a SHA-3 XOF with higher security margin than SHAKE128. Takes data and output length in bytes, returns hex.

p shake256("seed", 32)
p shake256("key material", 64)

# ripemd160

ripemd160 (alias rmd160) computes the RIPEMD-160 hash and returns a 40-character hex string. RIPEMD-160 is used in Bitcoin addresses (Hash160 = RIPEMD160(SHA256(pubkey))) and some legacy systems. Not recommended for new designs but essential for Bitcoin/crypto compatibility.

p ripemd160 "hello world"   # 98c615784c...
my $hash160 = ripemd160(hex_decode(sha256($pubkey)))

# siphash

siphash computes SipHash-2-4 with default keys (0,0) and returns a 16-character hex string (64-bit). SipHash is designed for hash table DoS resistance — it's fast and keyed, preventing attackers from crafting collisions. Used in Rust's HashMap, Python dict, and many other hash tables.

p siphash "key"   # 16 hex chars

# hmac_sha1

hmac_sha1 computes HMAC-SHA1 and returns a 40-character hex string. Used in OAuth 1.0, TOTP (Google Authenticator), and legacy APIs. Prefer HMAC-SHA256 for new designs.

p hmac_sha1("secret", "message")   # 40 hex chars

# hmac_sha384

hmac_sha384 computes HMAC-SHA384 and returns a 96-character hex string. Middle ground between SHA-256 and SHA-512.

p hmac_sha384("key", "data")   # 96 hex chars

# hmac_sha512

hmac_sha512 computes HMAC-SHA512 and returns a 128-character hex string. Maximum security margin in the SHA-2 family.

p hmac_sha512("key", "data")   # 128 hex chars

# hmac_md5

hmac_md5 computes HMAC-MD5 and returns a 32-character hex string. Legacy only — MD5 is broken for collision resistance but HMAC-MD5 is still considered safe for authentication. Only use for compatibility with old systems.

p hmac_md5("key", "data")   # 32 hex chars

# hkdf_sha256

hkdf_sha256 (alias hkdf) is HKDF key derivation (RFC 5869) using HMAC-SHA256. Extracts entropy from input key material and expands it to the desired length. Used to derive encryption keys from shared secrets (after ECDH/X25519). Args: ikm, salt, info, output_length.

my $key = hkdf("shared_secret", "salt", "context", 32)  # 64 hex
my $enc_key = hex_decode($key)  # 32 bytes for AES-256

# hkdf_sha512

hkdf_sha512 is HKDF using HMAC-SHA512. Higher security margin than SHA256 variant.

my $key = hkdf_sha512("ikm", "salt", "info", 64)  # 128 hex chars

# poly1305

poly1305 computes a Poly1305 one-time MAC. Takes a 32-byte key and message, returns a 32-character hex tag (128-bit). Poly1305 is used with ChaCha20 in TLS 1.3. CRITICAL: each key must only be used once — reusing a key completely breaks security.

my $key = random_bytes(32)
p poly1305($key, "message")   # 32 hex chars

# rsa_keygen

rsa_keygen generates an RSA keypair. Takes key size in bits (2048, 3072, or 4096). Returns [private_key_pem, public_key_pem]. RSA is the most widely used asymmetric algorithm — essential for TLS, SSH, and JWT RS256 signing.

my @kp = rsa_keygen(2048)
my ($priv, $pub) = @kp
spurt("private.pem", $priv)
spurt("public.pem", $pub)

# rsa_encrypt

rsa_encrypt (alias rsa_enc) encrypts data with RSA-OAEP-SHA256. Takes public_key_pem and plaintext. Returns base64 ciphertext. Message size is limited to key_size/8 - 66 bytes (e.g. 190 bytes for 2048-bit key).

my $cipher = rsa_encrypt($pub_pem, "secret")
my $plain = rsa_decrypt($priv_pem, $cipher)

# rsa_decrypt

rsa_decrypt (alias rsa_dec) decrypts RSA-OAEP ciphertext. Takes private_key_pem and base64 ciphertext.

my $plain = rsa_decrypt($priv, $ciphertext)
p $plain

# rsa_sign

rsa_sign signs a message with RSA-PKCS1v15-SHA256. Takes private_key_pem and message. Returns base64 signature. This is the RS256 algorithm used in JWT.

my $sig = rsa_sign($priv, "message")
if (rsa_verify($pub, "message", $sig)) {
    p "valid"
}

# rsa_verify

rsa_verify verifies an RSA-PKCS1v15-SHA256 signature. Takes public_key_pem, message, and base64 signature. Returns 1 if valid, 0 if not.

if (rsa_verify($pub_pem, $msg, $sig)) {
    p "signature valid"
}

# ecdsa_p256_keygen

ecdsa_p256_keygen (alias p256_keygen) generates an ECDSA P-256 (secp256r1/prime256v1) keypair. Returns [private_hex, public_hex_compressed]. P-256 is the NIST curve used in TLS, ES256 JWT, and WebAuthn.

my @kp = ecdsa_p256_keygen()
my ($priv, $pub) = @kp

# ecdsa_p256_sign

ecdsa_p256_sign (alias p256_sign) signs a message with ECDSA P-256. Takes private_key_hex and message. Returns DER-encoded signature as hex.

my $sig = ecdsa_p256_sign($priv, "hello")

# ecdsa_p256_verify

ecdsa_p256_verify (alias p256_verify) verifies an ECDSA P-256 signature. Returns 1 if valid.

if (ecdsa_p256_verify($pub, "hello", $sig)) {
    p "valid"
}

# ecdsa_p384_keygen

ecdsa_p384_keygen generates an ECDSA P-384 keypair. P-384 offers more security margin than P-256.

my @kp = ecdsa_p384_keygen()

# ecdsa_p384_sign

ecdsa_p384_sign signs with ECDSA P-384.

my $sig = ecdsa_p384_sign($priv, $msg)

# ecdsa_p384_verify

ecdsa_p384_verify verifies an ECDSA P-384 signature.

p ecdsa_p384_verify($pub, $msg, $sig)

# ecdsa_secp256k1_keygen

ecdsa_secp256k1_keygen generates an ECDSA secp256k1 keypair. This is the Bitcoin/Ethereum curve — different from P-256.

my @kp = ecdsa_secp256k1_keygen()

# ecdsa_secp256k1_sign

ecdsa_secp256k1_sign signs with ECDSA secp256k1.

my $sig = ecdsa_secp256k1_sign($priv, $msg)

# ecdsa_secp256k1_verify

ecdsa_secp256k1_verify verifies an ECDSA secp256k1 signature.

p ecdsa_secp256k1_verify($pub, $msg, $sig)

# ecdh_p256

ecdh_p256 (alias p256_dh) performs ECDH key exchange on P-256. Takes my_private_hex and their_public_hex, returns shared_secret_hex. Use HKDF to derive encryption keys from the shared secret.

my @alice = ecdsa_p256_keygen()
my @bob = ecdsa_p256_keygen()
my $shared_a = ecdh_p256($alice[0], $bob[1])
my $shared_b = ecdh_p256($bob[0], $alice[1])
p $shared_a eq $shared_b  # 1 — same secret

# ecdh_p384

ecdh_p384 performs ECDH key exchange on P-384.

my $shared = ecdh_p384($my_priv, $their_pub)

# base32_encode

base32_encode (alias b32e) encodes data as RFC 4648 Base32. Used in TOTP secrets, onion addresses, and Bech32. Returns uppercase with padding.

p base32_encode("hello")   # NBSWY3DP
my $secret = base32_encode(random_bytes(20))

# base32_decode

base32_decode (alias b32d) decodes RFC 4648 Base32 back to bytes. Accepts with or without padding.

p base32_decode("NBSWY3DP")   # hello

# base58_encode

base58_encode (alias b58e) encodes data using Bitcoin's Base58 alphabet (no 0, O, I, l to avoid confusion). Used in Bitcoin addresses, IPFS CIDs.

p base58_encode("hello")   # Cn8eVZg

# base58_decode

base58_decode (alias b58d) decodes Base58 back to bytes.

p base58_decode("Cn8eVZg")   # hello

# totp

totp (alias totp_generate) generates a TOTP code (RFC 6238) for 2FA. Takes base32-encoded secret, optional digits (default 6), optional period (default 30s). Compatible with Google Authenticator, Authy, etc.

my $secret = base32_encode(random_bytes(20))
my $code = totp($secret)
p $code   # 6-digit code
# Custom: 8 digits, 60s period
my $code8 = totp($secret, 8, 60)

# totp_verify

totp_verify verifies a TOTP code with optional time window (default ±1 period). Returns 1 if valid.

if (totp_verify($secret, $user_code)) {
    p "2FA valid"
}
# Wider window: ±2 periods
totp_verify($secret, $code, 2)

# hotp

hotp (alias hotp_generate) generates an HOTP code (RFC 4226) using a counter. Takes base32 secret, counter value, optional digits.

my $code = hotp($secret, 42)  # counter=42

# aes_cbc_encrypt

aes_cbc_encrypt (alias aes_cbc_enc) encrypts with AES-256-CBC and PKCS7 padding. Takes 32-byte key, plaintext, optional 16-byte IV (auto-generated if omitted). Returns base64(iv || ciphertext). Legacy mode — prefer aes_encrypt (GCM) for new code.

my $key = random_bytes(32)
my $ct = aes_cbc_encrypt($key, "secret")
my $pt = aes_cbc_decrypt($key, $ct)

# aes_cbc_decrypt

aes_cbc_decrypt (alias aes_cbc_dec) decrypts AES-256-CBC. Takes 32-byte key and base64(iv || ciphertext).

my $pt = aes_cbc_decrypt($key, $ciphertext)

# qr_ascii

qr_ascii (alias qr) generates a QR code as ASCII art. Perfect for terminal output.

p qr("https://example.com")
p qr("otpauth://totp/App:user?secret=$secret&issuer=App")

# qr_png

qr_png generates a QR code as PNG image data (base64 encoded). Optional size parameter. Save to file or embed in HTML.

my $png = qr_png("https://example.com")
spurt("qr.png", base64_decode($png))
# Larger QR
my $big = qr_png($url, 16)

# qr_svg

qr_svg generates a QR code as SVG string. Scalable vector graphics, ideal for web.

my $svg = qr_svg("https://example.com")
spurt("qr.svg", $svg)

# barcode_code128

barcode_code128 (alias code128) generates a Code 128 barcode as ASCII. Code 128 supports alphanumeric data and is widely used in shipping labels.

p code128("ABC-123")

# barcode_code39

barcode_code39 (alias code39) generates a Code 39 barcode. Supports uppercase, digits, and some symbols. Used in automotive and defense.

p code39("HELLO123")

# barcode_ean13

barcode_ean13 (alias ean13) generates an EAN-13 barcode (European Article Number). Standard retail barcode — requires exactly 12-13 digits.

p ean13("5901234123457")

# barcode_svg

barcode_svg generates a barcode as SVG. Second argument specifies type: code128, code39, ean13, upca.

my $svg = barcode_svg("ABC-123", "code128")
spurt("barcode.svg", $svg)
my $retail = barcode_svg("012345678905", "upca")

# brotli

brotli (alias br) compresses data using the Brotli algorithm (RFC 7932). Excellent compression ratio, used in HTTP compression. Returns compressed bytes.

my $compressed = brotli($data)
p length($data) . " -> " . length($compressed)

# brotli_decode

brotli_decode (alias ubr) decompresses Brotli data.

my $original = brotli_decode($compressed)

# xz

xz (alias lzma) compresses data using XZ/LZMA2. Best compression ratio, slower. Returns compressed bytes.

my $compressed = xz($data)
spurt("file.xz", $compressed)

# xz_decode

xz_decode (aliases unxz, unlzma) decompresses XZ/LZMA data.

my $original = xz_decode(slurp("file.xz"))

# bzip2

bzip2 (alias bz2) compresses data using bzip2. Good compression, moderate speed. Returns compressed bytes.

my $compressed = bzip2($data)

# bzip2_decode

bzip2_decode (aliases bunzip2, ubz2) decompresses bzip2 data.

my $original = bunzip2($compressed)

# lz4

lz4 compresses data using LZ4. Very fast compression/decompression, moderate ratio. Ideal for real-time compression.

my $compressed = lz4($data)

# lz4_decode

lz4_decode (alias unlz4) decompresses LZ4 data.

my $original = lz4_decode($compressed)

# snappy

snappy (alias snp) compresses data using Snappy. Fastest compression, used in databases and RPC. Returns compressed bytes.

my $compressed = snappy($data)

# snappy_decode

snappy_decode (alias unsnappy) decompresses Snappy data.

my $original = snappy_decode($compressed)

# lzw

lzw compresses data using LZW (GIF/TIFF style). Classic algorithm.

my $compressed = lzw($data)

# lzw_decode

lzw_decode (alias unlzw) decompresses LZW data.

my $original = lzw_decode($compressed)

# tar_create

tar_create (alias tar) creates a tar archive from a directory. Returns tar bytes.

my $archive = tar_create("./src")
spurt("backup.tar", $archive)

# tar_extract

tar_extract (alias untar) extracts a tar archive to a directory.

tar_extract(slurp("backup.tar"), "./restored")

# tar_list

tar_list lists files in a tar archive. Returns array of paths.

my @files = @{tar_list(slurp("backup.tar"))}
@files |> e p

# tar_gz_create

tar_gz_create (alias tgz) creates a gzipped tar archive. Convenience for tar + gzip.

my $tgz = tgz("./project")
spurt("project.tar.gz", $tgz)

# tar_gz_extract

tar_gz_extract (alias untgz) extracts a .tar.gz archive.

untgz(slurp("project.tar.gz"), "./extracted")

# zip_create

zip_create creates a ZIP archive from a directory. Returns zip bytes.

my $archive = zip_create("./docs")
spurt("docs.zip", $archive)

# zip_extract

zip_extract extracts a ZIP archive to a directory.

zip_extract(slurp("docs.zip"), "./extracted")

# zip_list

zip_list lists files in a ZIP archive. Returns array of paths.

my @files = @{zip_list(slurp("archive.zip"))}

# md4

md4 computes the MD4 hash and returns a 32-character hex string. MD4 is completely broken — only use for legacy NTLM compatibility or historical systems.

p md4("hello")   # 32 hex chars

# xxh32

xxh32 (alias xxhash32) computes xxHash32 — extremely fast non-cryptographic hash. Optional seed parameter. Returns 8 hex chars.

p xxh32("hello")        # default seed 0
p xxh32("hello", 42)    # with seed

# xxh64

xxh64 (alias xxhash64) computes xxHash64 — fast 64-bit hash. Returns 16 hex chars.

p xxh64("hello")

# xxh3

xxh3 (alias xxhash3) computes xxHash3-64 — newest xxHash variant, fastest on modern CPUs. Returns 16 hex chars.

p xxh3("hello")

# xxh3_128

xxh3_128 computes xxHash3-128. Returns 32 hex chars.

p xxh3_128("hello")

# murmur3

murmur3 (alias murmur3_32) computes MurmurHash3 32-bit. Fast non-cryptographic hash, widely used in hash tables and bloom filters. Optional seed. Returns 8 hex chars.

p murmur3("hello")       # default seed 0
p murmur3("hello", 42)   # with seed

# murmur3_128

murmur3_128 computes MurmurHash3 128-bit (x64 variant). Returns 32 hex chars.

p murmur3_128("hello")

# blowfish_encrypt

blowfish_encrypt (alias bf_enc) encrypts with Blowfish-CBC. Key=4-56 bytes, optional 8-byte IV. Legacy cipher — use AES for new code.

my $ct = blowfish_encrypt($key, "secret")
my $pt = blowfish_decrypt($key, $ct)

# blowfish_decrypt

blowfish_decrypt (alias bf_dec) decrypts Blowfish-CBC.

my $pt = blowfish_decrypt($key, $ciphertext)

# des3_encrypt

des3_encrypt (aliases 3des_enc, tdes_enc) encrypts with Triple DES (3DES) CBC. Key=24 bytes (three 8-byte DES keys). Legacy cipher for PCI-DSS compliance.

my $key = random_bytes(24)
my $ct = des3_encrypt($key, "secret")
my $pt = des3_decrypt($key, $ct)

# des3_decrypt

des3_decrypt (aliases 3des_dec, tdes_dec) decrypts Triple DES (3DES) CBC.

my $pt = des3_decrypt($key, $ciphertext)

# twofish_encrypt

twofish_encrypt (alias tf_enc) encrypts with Twofish-CBC. Key=16/24/32 bytes. AES finalist, still secure.

my $key = random_bytes(32)
my $ct = twofish_encrypt($key, "secret")

# twofish_decrypt

twofish_decrypt (alias tf_dec) decrypts Twofish-CBC.

my $pt = twofish_decrypt($key, $ct)

# camellia_encrypt

camellia_encrypt (alias cam_enc) encrypts with Camellia-CBC. Key=16/24/32 bytes. Japanese/EU standard, equivalent security to AES.

my $ct = camellia_encrypt($key, "secret")

# camellia_decrypt

camellia_decrypt (alias cam_dec) decrypts Camellia-CBC.

my $pt = camellia_decrypt($key, $ct)

# cast5_encrypt

cast5_encrypt encrypts with CAST5-CBC. Key=5-16 bytes. Used in PGP.

my $ct = cast5_encrypt($key, "secret")

# cast5_decrypt

cast5_decrypt decrypts CAST5-CBC.

my $pt = cast5_decrypt($key, $ct)

# salsa20

salsa20 encrypts with Salsa20 stream cipher. Key=32 bytes, nonce auto-generated. Fast, secure stream cipher.

my $ct = salsa20($key, "data")
my $pt = salsa20_decrypt($key, $ct)

# salsa20_decrypt

salsa20_decrypt decrypts Salsa20.

my $pt = salsa20_decrypt($key, $ct)

# xsalsa20

xsalsa20 encrypts with XSalsa20 (extended 24-byte nonce). Safer for random nonces.

my $ct = xsalsa20($key, "data")

# xsalsa20_decrypt

xsalsa20_decrypt decrypts XSalsa20.

my $pt = xsalsa20_decrypt($key, $ct)

# secretbox

secretbox (alias secretbox_seal) is NaCl's symmetric authenticated encryption (XSalsa20-Poly1305). Key=32 bytes. Simple, secure, fast.

my $key = random_bytes(32)
my $ct = secretbox($key, "message")
my $pt = secretbox_open($key, $ct)

# secretbox_open

secretbox_open decrypts and authenticates NaCl secretbox.

my $pt = secretbox_open($key, $ct)

# nacl_box_keygen

nacl_box_keygen generates a NaCl box keypair (X25519). Returns [secret_key_hex, public_key_hex].

my @kp = nacl_box_keygen()
my ($sk, $pk) = @kp

# nacl_box

nacl_box is NaCl's asymmetric authenticated encryption. Takes recipient's public key, sender's secret key, plaintext.

my @alice = nacl_box_keygen()
my @bob = nacl_box_keygen()
my $ct = nacl_box($bob[1], $alice[0], "hello")  # to Bob from Alice
my $pt = nacl_box_open($alice[1], $bob[0], $ct)  # Bob decrypts

# nacl_box_open

nacl_box_open decrypts NaCl box. Takes sender's public key, recipient's secret key, ciphertext.

my $pt = nacl_box_open($sender_pk, $my_sk, $ct)

Special Math Functions

12 topics

# erf

erf computes the error function, which arises in probability, statistics, and solutions to the heat equation. erf(x) is the probability that a standard normal random variable falls in [-x√2, x√2]. Returns a value in (-1, 1).

p erf(0)      # 0
p erf(1)      # 0.8427...
p erf(10)     # ~1

# erfc

erfc computes the complementary error function erfc(x) = 1 - erf(x). Numerically stable for large x where erf(x) ≈ 1. Used in computing tail probabilities of normal distributions.

p erfc(0)     # 1
p erfc(3)     # 0.0000220...

# gamma

gamma (alias tgamma) computes the gamma function Γ(x), the extension of factorial to real numbers. Γ(n) = (n-1)! for positive integers. Used throughout statistics, physics, and combinatorics.

p gamma(5)    # 24 (= 4!)
p gamma(0.5)  # √π ≈ 1.7724...
p gamma(1)    # 1

# lgamma

lgamma (alias ln_gamma) computes the natural logarithm of the gamma function: ln(Γ(x)). Avoids overflow for large arguments where Γ(x) would be astronomical. Essential for computing log-probabilities in statistics.

p lgamma(100)  # 359.13...
p lgamma(1000) # 5905.22...

# digamma

digamma (alias psi) computes the digamma function ψ(x) = d/dx ln(Γ(x)), the logarithmic derivative of gamma. Appears in Bayesian statistics (expected log of Dirichlet variables), optimization, and special function theory.

p digamma(1)   # -γ ≈ -0.5772 (Euler-Mascheroni)
p digamma(2)   # 1 - γ ≈ 0.4228

# beta_fn

beta_fn computes the beta function B(a,b) = Γ(a)Γ(b)/Γ(a+b). The beta function is the normalizing constant of the Beta distribution and appears throughout Bayesian statistics and combinatorics.

p beta_fn(2, 3)   # 0.0833...
p beta_fn(0.5, 0.5)  # π

# lbeta

lbeta (alias ln_beta) computes ln(B(a,b)), the log of the beta function. Avoids overflow for small a or b where B(a,b) is very large.

p lbeta(0.01, 0.01)  # large positive

# betainc

betainc (alias beta_reg) computes the regularized incomplete beta function I_x(a,b), the CDF of the Beta distribution. Takes (x, a, b). Essential for computing p-values of F-tests, t-tests, and binomial probabilities.

p betainc(0.5, 2, 3)  # P(Beta(2,3) < 0.5)

# gammainc

gammainc (alias gamma_li) computes the lower incomplete gamma function γ(a,x) = ∫₀ˣ t^(a-1) e^(-t) dt. Used in computing CDFs of gamma and chi-squared distributions.

p gammainc(2, 1)  # γ(2, 1)

# gammaincc

gammaincc (alias gamma_ui) computes the upper incomplete gamma function Γ(a,x) = ∫ₓ^∞ t^(a-1) e^(-t) dt = Γ(a) - γ(a,x). Useful for tail probabilities.

p gammaincc(2, 1)  # Γ(2, 1)

# gammainc_reg

gammainc_reg (alias gamma_lr) computes the regularized lower incomplete gamma P(a,x) = γ(a,x)/Γ(a), the CDF of the gamma distribution Gamma(a, 1).

p gammainc_reg(2, 1)  # P(Gamma(2,1) < 1)

# gammaincc_reg

gammaincc_reg (alias gamma_ur) computes the regularized upper incomplete gamma Q(a,x) = 1 - P(a,x), the survival function of the gamma distribution.

p gammaincc_reg(2, 1)  # P(Gamma(2,1) > 1)

Parallel I/O

8 topics

# par_lines

par_lines PATH, { code } — memory-map a file and scan its lines in parallel across all available CPU cores.

The file is mmap'd into memory rather than read sequentially, and line boundaries are detected in parallel chunks. Each line is passed to the callback as _. Because the file is memory-mapped, there is no read-buffer overhead and the OS kernel pages data in on demand, making par_lines extremely efficient for multi-gigabyte log files or CSV data. Line order within the callback is not guaranteed (lines run in parallel), so the callback should be a self-contained side-effecting operation (accumulate into a shared structure via pchannel, write to a file, etc.) or use par_lines with a reducer. For ordered processing, use read_lines with pmap instead.

par_lines "data.txt", fn { process }

# Count matching lines in a large log:
my $count = 0
par_lines "/var/log/syslog", fn { $count++ if /ERROR/ }
p $count

# Feed lines into a channel for downstream processing:
my ($tx, $rx) = pchannel(1000)
async { par_lines "huge.csv", fn { $tx->send(_) }
    undef $tx }

# par_walk

par_walk PATH, { code } — recursively walk a directory tree in parallel, invoking the callback for every file path found.

Directory traversal is parallelized using a work-stealing thread pool: multiple directories are read concurrently, and the callback fires as each file is discovered. The path is passed as _ (absolute). This is significantly faster than a sequential find-style walk on SSDs and networked filesystems where directory readdir latency dominates. Symlinks are not followed by default to avoid cycles. The walk visits files only — directories themselves are not passed to the callback unless you pass dirs => 1. Combine with pmap for a two-phase pattern: first collect paths with par_walk, then process file contents in parallel.

par_walk "./src", fn { p _ if /\.rs$/ }

# Collect all JSON files under a directory:
my @json_files
par_walk "/data", fn { push @json_files, _ if /\.json$/ }
p scalar @json_files

# Parallel content search:
par_walk ".", fn {
    if (/\.log$/) {
        my @hits = grep /FATAL/, rl
        p "_: ", scalar @hits, " fatals" if @hits
    }
}

# par_sed

par_sed PATTERN, REPLACEMENT, @files — perform an in-place regex substitution across multiple files in parallel.

Each file is processed by a separate worker thread: the file is read into memory, all matches of PATTERN are replaced with REPLACEMENT, and the result is written back atomically (via a temp file + rename, so readers never see a partially-written file). This is the stryke equivalent of sed -i but parallelized across the file list — ideal for codebase-wide refactors, log scrubbing, or bulk config updates. The pattern uses stryke regex syntax (PCRE-style). Returns the total number of substitutions made across all files.

par_sed qr/oldFunc/, "newFunc", glob("src/*.pl")

# Case-insensitive replace across a project:
par_sed qr/TODO/i, "DONE", par_walk(".", fn { _ if /\.rs$/ })

# Scrub sensitive data from logs:
my $n = par_sed qr/\b\d{3}-\d{2}-\d{4}\b/, "XXX-XX-XXXX", @log_files
p "redacted $n occurrences"

# par_find_files

Recursively search a directory tree in parallel for files matching a glob pattern. Unlike glob_par which takes a single pattern string, par_find_files separates the root directory from the pattern, making it convenient when the search root is a variable. Returns a list of absolute paths to matching files.

my @src = par_find_files("src", "*.rs")
p scalar @src                    # count of Rust files under src/
my @tests = par_find_files(".", "*_test.pl")
@tests |> e p
my @configs = par_find_files("/etc", "*.conf")

# par_line_count

Count lines across multiple files in parallel, returning the total line count. Each file is read and counted by a separate thread, making this dramatically faster than sequential wc -l for large file sets. Useful for codebase metrics, log analysis, or validating data pipeline output.

my @files = glob("src/**/*.rs")
my $total = par_line_count(@files)
p "$total lines of Rust"
my $logs = par_line_count(glob("/var/log/*.log"))
p "$logs log lines"

# par_csv_read

par_csv_read @files — read multiple CSV files in parallel, returning an array of parsed datasets (one per file).

Each file is read and parsed by a separate worker thread using a fast Rust CSV parser that handles quoting, escaping, and UTF-8 correctly. Headers are auto-detected from the first row of each file, and each row is returned as a hashref keyed by header names. This is dramatically faster than sequential CSV parsing when you have many files — common in data engineering pipelines where data arrives as daily/hourly CSV partitions. For a single large CSV file, prefer par_lines with manual splitting, since par_csv_read parallelizes across files, not within a single file.

my @datasets = par_csv_read glob("data/*.csv")
for my $ds (@datasets) {
    p scalar @$ds, " rows"
}

# Merge all CSVs into one list:
my @all_rows = par_csv_read(@files) |> flat
p $all_rows[0]->{name}                # access by header

# Filter and aggregate:
my @sales = par_csv_read(glob("sales_*.csv")) |> flat
  |> grep { _->{region} eq "US" }

# glob_par

Perform a parallel recursive file-system glob, using multiple threads to walk directory trees concurrently. This is significantly faster than glob for deep directory hierarchies with thousands of files. Accepts the same glob syntax (*, **, {a,b}) but returns results as they are discovered across threads. Ideal for large codebases or log directories.

my @logs = glob_par("**/*.log")
p scalar @logs               # count of log files
"**/*.rs" |> glob_par |> e p  # print all Rust files
my @imgs = glob_par("assets/**/*.{png,jpg,webp}")
@imgs |> e { p bn(_) }

# pwatch

pwatch(PATH, fn { ... }) — watch a file or directory for filesystem changes and invoke the callback on each event.

The watcher runs on a background thread using OS-native notifications (FSEvents on macOS, inotify on Linux) so it consumes near-zero CPU while idle. The callback receives the event type and affected path in _. Directory watches are recursive by default. The watcher continues until the returned handle is dropped or the program exits. This is useful for building live-reload dev servers, file-triggered pipelines, or audit logs. Combine with debounce or a pchannel if the callback is expensive and rapid bursts of events need to be coalesced.

my $w = pwatch "./src", fn {
    p "changed: $_"
    rebuild()
}

# Watch multiple paths:
my $w1 = pwatch "/var/log/app.log", fn { p "log updated" }
my $w2 = pwatch "./config", fn { reload_config() }
sleep                                 # block forever

File I/O

35 topics

# open

Open a filehandle for reading, writing, appending, or piping. The three-argument form open my $fh, MODE, EXPR is strongly preferred for safety — it prevents shell injection and makes the mode explicit. Modes include < (read), > (write/truncate), >> (append), +< (read-write), |- (pipe to command), and -| (pipe from command). In stryke, always use lexical filehandles (my $fh) rather than bareword globals. PerlIO layers can be specified in the mode: <:utf8, <:raw, <:encoding(UTF-16). Always check the return value — open ... or die "...: $!" is idiomatic. The $! variable contains the OS error message on failure. Forgetting to check open is one of the most common bugs in Perl code.

open my $fh, '<', 'data.txt' or die "open: $!"
my @lines = <$fh>
close $fh

open my $out, '>>', 'log.txt' or die "append: $!"
print $out tm "event happened\n"
close $out

open my $pipe, '-|', 'ls', '-la' or die "pipe: $!"
while (<$pipe>) { p tm _ }

# close

Close a filehandle, flushing any buffered output and releasing the underlying OS file descriptor. Returns true on success, false on failure — and failure is more common than you might think. For write handles, close is where buffered data actually hits disk, so a full disk or network error may only surface at close time. Always check the return value when writing: close $fh or die "close: $!". For pipe handles opened with |- or -|, close waits for the child process to exit and sets $? to the child's exit status. In stryke, lexical filehandles are automatically closed when they go out of scope, but explicit close is clearer and lets you handle errors.

open my $fh, '>', 'out.txt' or die $!
print $fh "done\n"
close $fh or die "write failed: $!"

open my $p, '|-', 'gzip', '-c' or die $!
print $p $data
close $p
p "gzip exited: $?" if $?

# read

Read a specified number of bytes from a filehandle into a scalar buffer. The signature is read FH, SCALAR, LENGTH [, OFFSET]. Returns the number of bytes actually read (which may be less than requested at EOF or on partial reads), 0 at EOF, or undef on error. The optional OFFSET argument lets you append to an existing buffer at a given position, which is useful for accumulating data in a loop. For text files, the bytes are decoded according to the handle's PerlIO layer — use <:raw for binary data to avoid encoding transforms. In stryke, read works identically to Perl 5. For line-oriented input, prefer <$fh> or readline instead.

open my $fh, '<:raw', $path or die $!
my $buf = ''
while (read $fh, my $chunk, 4096) {
    $buf .= $chunk
}
p "total: " . length($buf) . " bytes"
close $fh

# readline

Read one line (or all remaining lines in list context) from a filehandle. The angle-bracket operator <$fh> is syntactic sugar for readline($fh). In scalar context, returns the next line including the trailing newline (or undef at EOF). In list context, returns all remaining lines as a list. The line ending is determined by $/ (input record separator, default \n). Set $/ = undef to slurp the entire file in one read. In stryke, readline integrates with the pipe operator — you can pipe filehandle lines through maps, greps, and other streaming combinators. Always chomp after reading if you don't want trailing newlines.

while (my $line = <$fh>) {
    chomp $line
    p $line
}

# Slurp entire file
local $/
my $content = <$fh>
p length $content

# eof

Test whether a filehandle has reached end-of-file. Returns 1 if the next read on the handle would return EOF, 0 otherwise. Called without arguments, eof() (with parens) checks the last file in the <> / ARGV stream. Called with no parens as eof, it tests whether the current ARGV file is exhausted but more files may follow. In stryke, eof is typically used in until loops or as a guard before read calls. Note that eof may trigger a blocking read on interactive handles (like STDIN from a terminal) to determine if data is available, so avoid calling it speculatively on interactive input. For most line-processing, while (<$fh>) is simpler and implicitly handles EOF.

until (eof $fh) {
    my $line = <$fh>
    p tm $line
}

# Process multiple files via ARGV
while (<>) {
    p "new file: $ARGV" if eof()
}

# seek

Reposition a filehandle to an arbitrary byte offset. The signature is seek FH, POSITION, WHENCE where WHENCE is 0 (absolute from start), 1 (relative to current position), or 2 (relative to end of file). Use the Fcntl constants SEEK_SET, SEEK_CUR, SEEK_END for clarity. Returns 1 on success, 0 on failure. seek is essential for random-access file I/O — re-reading headers, skipping to known offsets in binary formats, or rewinding a file for a second pass. In stryke, seek flushes the PerlIO buffer before repositioning. Do not mix seek/tell with sysread/syswrite — they use separate buffering layers.

seek $fh, 0, 0         # rewind to start
my $header = <$fh>

seek $fh, -100, 2      # last 100 bytes
read $fh, my $tail, 100
p $tail

# tell

Return the current byte offset of a filehandle's read/write position. Returns a non-negative integer on success, or -1 if the handle is invalid or not seekable (e.g., pipes, sockets). Useful for bookmarking a position before a speculative read so you can seek back if the data doesn't match expectations. In stryke, tell reflects the PerlIO buffered position, not the raw OS file descriptor position — so it correctly accounts for encoding layers and buffered reads. Pair with seek for random-access patterns.

my $pos = tell $fh
p "at byte $pos"

# Bookmark and restore
my $mark = tell $fh
my $line = <$fh>
unless ($line =~ /^HEADER/) {
    seek $fh, $mark, 0   # rewind to before the read
}

# print

Write operands to the selected output handle (default STDOUT) without appending a newline. The output field separator $, is inserted between arguments, and $\ is appended at the end — both default to empty string. You can direct output to a specific handle by passing it as the first argument with no comma: print STDERR "msg". In stryke, print behaves identically to Perl 5 and is useful when you need precise control over output formatting, such as building progress bars, writing binary data, or emitting partial lines. For most line-oriented output, prefer p (say) instead since it handles the newline automatically.

print "no newline"
print STDERR "error msg\n"
print $fh "data to filehandle\n"
for my $pct (0:100) {
    printf "\rprogress: %3d%%", $pct
}
print "\n"

# say

Print operands followed by an automatic newline to STDOUT. In stryke, say is always available without -E or use feature 'say' — it is a first-class builtin. The shorthand p is an alias for say and is preferred in most stryke code. When given a list, say joins elements with $, (output field separator, empty by default) and appends $\ plus a newline. For streaming output over pipelines, combine with e (each) to print one element per line. Gotcha: say always adds a newline — if you need raw output without one, use print instead.

p "hello world"
my @names = ("alice", "bob", "eve")
@names |> e p
1:5 |> maps { _ * 2 } |> e p

# printf

Formatted print to a filehandle (default STDOUT), using C-style format specifiers. The first argument is the format string with %s (string), %d (integer), %f (float), %x (hex), %o (octal), %e (scientific), %g (general float), and %% (literal percent). Width and precision modifiers work as in C: %-10s left-aligns in a 10-char field, %05d zero-pads to 5 digits, %.2f gives 2 decimal places. In stryke, printf supports all standard Perl 5 format specifiers including %v (version strings) and %n is disabled for safety. Direct output to a handle by placing it before the format: printf STDERR "...", @args. Unlike sprintf, printf outputs directly and returns a boolean indicating success.

printf "%-10s %5d\n", $name, $score
printf STDERR "error %d: %s\n", $code, $msg
printf "%08.2f\n", 3.14159   # 00003.14
printf "%s has %d item%s\n", $user, $n, $n == 1 ? "" : "s"

# sprintf

Return a formatted string without printing it, using the same C-style format specifiers as printf. This is the go-to function for building formatted strings for later use — constructing log messages, building padded table columns, converting numbers to hex or binary representations, or assembling strings that will be passed to other functions. In stryke, sprintf is often combined with the pipe operator: $val |> t { sprintf "0x%04x", _ } |> p. The return value is always a string. All format specifiers from printf apply here.

my $hex = sprintf "0x%04x", 255
my $padded = sprintf "%08d", $id
my $msg = sprintf "%-20s: %s", $key, $value
my @rows = map { sprintf "%3d. %s", _, $names[_] } 0..$ #names
@rows |> e p

# slurp

Read an entire file into memory as a single UTF-8 string. The short alias sl is convenient in pipelines. Dies if the file does not exist or cannot be read. This is the complement of spurt/wf — together they form a simple read/write pair for whole-file operations. For binary data, use read_bytes/slurp_raw instead.

my $text = slurp("config.yaml")
p $text
my $json = sl("data.json")
my $data = decode_json($json)
"README.md" |> sl |> length |> p  # character count

# slurp_raw

Read an entire file into memory as raw bytes without any encoding interpretation. Unlike slurp, which returns a decoded UTF-8 string, read_bytes preserves the exact byte content — useful for binary files like images, compressed archives, or protocol buffers. The alias slurp_raw emphasizes the raw nature.

my $png = read_bytes("logo.png")
p length($png)                        # byte count
my $gz = slurp_raw("data.gz")
my $text = gunzip($gz)
p $text

# input

Slurp all of stdin (or a filehandle) as one string.

my $all = input          # slurp stdin
my $fh_data = input($fh) # slurp filehandle

# read_lines

Read a file and return its contents as a list of lines with trailing newlines stripped. This is the idiomatic way to slurp a file line-by-line in stryke without manually opening a filehandle. The short alias rl keeps one-liners concise. If the file does not exist, the program dies with an error message.

my @lines = rl("data.txt")
p scalar @lines               # line count
@lines |> grep /ERROR/ |> e p # print error lines
my $first = (rl "config.ini")[0]$1

Note: returns an empty list for an empty file.

# append_file

Append a string to the end of a file, creating it if it does not exist. This is the safe way to add content without overwriting — useful for log files, CSV accumulation, or incremental output. The short alias af is convenient in pipelines. The file is opened, written, and closed atomically per call.

af("log.txt", "started at " . datetime_utc() . "\n")
1:5 |> e { af("nums.txt", "_\n") }
my @data = ("a","b","c")
@data |> e { af "out.txt", "_\n" }

# to_file

Write a string to a file, truncating any existing content. Unlike append_file, this replaces the file entirely. Returns the written content so it can be used in a pipeline — write to disk and continue processing in one expression. Creates the file if it does not exist.

my $csv = "name,age\nAlice,30\nBob,25"
$csv |> to_file("people.csv") |> p
to_file("empty.txt", "")  # truncate a file

Note: the return-value-for-piping behavior distinguishes this from a plain write.

# write

Output a formatted record to a filehandle using a format declaration. write looks up the format associated with the current (or specified) filehandle, evaluates the format's picture lines against the current variables, and outputs the result. This is Perl's original report-generation mechanism, predating modules like Text::Table and template engines. In stryke, write and format are supported for backward compatibility but are rarely used in new code — printf/sprintf or template strings are more flexible. The format name defaults to the filehandle name (e.g., format STDOUT is used by write STDOUT).

format STDOUT =
@<<<<<<<<<< @>>>>>>
$name,       $score
.

my ($name, $score) = ("alice", 42)
write   # outputs: alice           42

# write_file

Write a string to a file, creating it if it does not exist or truncating it if it does. This is the complement of slurp — together they form a read/write pair for whole-file operations. The short alias wf is convenient for one-liners. The file is opened, written, and closed in a single call.

spurt("hello.txt", "Hello, world!\n")
wf("nums.txt", join("\n", 1:10))
"generated content" |> wf("out.txt")
my $data = slurp("in.txt")
wf("copy.txt", $data)

# write_json

Serialize a stryke data structure (hash ref or array ref) as pretty-printed JSON and write it to a file. Creates or overwrites the target file. The short alias wj pairs with rj for round-trip JSON workflows. Useful for persisting configuration, caching API responses, or generating fixture data.

my %data = (name => "Alice", scores => [98, 87, 95])
wj("out.json", \%data)
my $back = rj("out.json")
p $back->{name}   # Alice

# read_json

Read a JSON file from disk and parse it into a stryke data structure (hash ref or array ref). The short alias rj keeps JSON-config one-liners terse. Dies if the file does not exist or contains malformed JSON. This is the complement of write_json/wj.

my $cfg = rj("config.json")
p $cfg->{database}{host}
my @items = @{ rj("list.json") }
@items |> e { p _->{name} }$1

Note: numeric strings remain strings; use `+0` to coerce if needed.

# tempfile

Create a temporary file in the system temp directory and return its absolute path as a string. The file is created with a unique name and exists on disk immediately. Use tf as a short alias for quick scratch files in one-liners. The caller is responsible for cleanup, though OS temp-directory reaping will eventually reclaim it.

my $tmp = tf()
to_file($tmp, "scratch data\n")
p rl($tmp)           # scratch data
my @all = map { tf() } 1:3  # three temp files

# tempdir

Create a temporary directory in the system temp directory and return its absolute path. The directory is created with a unique name and is ready for use immediately. The short alias tdr mirrors tf for files. Useful for isolating multi-file operations like test fixtures, build artifacts, or staged output.

my $dir = tdr()
to_file("$dir/a.txt", "hello")
to_file("$dir/b.txt", "world")
my @files = glob("$dir/*.txt")
p scalar @files   # 2

# binmode

Set the I/O layer on a filehandle, controlling how bytes are translated during reads and writes. Without a layer argument, binmode $fh switches the handle to raw binary mode (no CRLF translation on Windows, no encoding transforms). With a layer, binmode $fh, ':utf8' enables UTF-8 decoding, binmode $fh, ':raw' strips all layers for pure byte I/O, and binmode $fh, ':encoding(ISO-8859-1)' sets a specific encoding. In stryke, encoding layers can also be specified directly in open: open my $fh, '<:utf8', $path. Call binmode before any I/O on the handle — calling it mid-stream may produce garbled output. For binary file processing (images, archives, network protocols), always use :raw.

open my $fh, '<', $path or die $!
binmode $fh, ':utf8'
my @lines = <$fh>

open my $bin, '<', $img_path or die $!
binmode $bin, ':raw'
read $bin, my $header, 8
p sprintf "magic: %s", unpack("H*", $header)

# fileno

Return the underlying OS file descriptor number for a filehandle, or undef if the handle is not connected to a real file descriptor (e.g., tied handles, in-memory handles opened to scalar refs). File descriptor numbers are small non-negative integers managed by the OS kernel: 0 is STDIN, 1 is STDOUT, 2 is STDERR. This function is mainly useful for interfacing with system calls that require raw fd numbers, checking whether two handles share the same underlying fd, or passing descriptors to child processes. In stryke, fileno is rarely needed in everyday code but is essential for low-level I/O multiplexing and process management.

my $fd = fileno STDOUT
p "stdout fd: $fd"   # 1

if (defined fileno $fh) {
    p "handle is backed by fd " . fileno($fh)
} else {
    p "not a real file descriptor"
}

# flock

Advisory file locking for coordinating access between processes. flock $fh, OPERATION where OPERATION is LOCK_SH (shared/read lock), LOCK_EX (exclusive/write lock), or LOCK_UN (unlock). Add LOCK_NB for non-blocking mode: LOCK_EX | LOCK_NB returns false immediately if the lock is held rather than waiting. Import constants from Fcntl. Advisory locks are cooperative — they only work if all processes accessing the file use flock. In stryke, flock is the standard mechanism for safe concurrent file access in multi-process scripts, cron jobs, and daemons. Always unlock explicitly or let the handle close (which releases the lock). Gotcha: flock does not work on NFS on many systems.

use Fcntl ':flock'
open my $fh, '>>', 'shared.log' or die $!
flock $fh, LOCK_EX or die "lock: $!"
print $fh tm "pid $$ wrote this\n"
flock $fh, LOCK_UN
close $fh

unless (flock $fh, LOCK_EX | LOCK_NB) {
    p "file is locked by another process"
}

# getc

Read a single character from a filehandle (default STDIN). Returns undef at EOF. The character returned respects the handle's encoding layer — under :utf8, getc returns a full Unicode character which may be multiple bytes on disk. This function is useful for interactive single-key input, parsing binary formats one byte at a time, or implementing character-level tokenizers. In stryke, getc blocks until a character is available on the handle. For terminal input, note that most terminals are line-buffered by default, so getc STDIN won't return until the user presses Enter unless you put the terminal into raw mode.

my $ch = getc STDIN
p "you pressed: $ch"

open my $fh, '<:utf8', $path or die $!
while (defined(my $c = getc $fh)) {
    p "char: $c (ord " . ord($c) . ")"
}

# select

In its one-argument form, select HANDLE sets the default output handle for print, say, and write, returning the previously selected handle. This is useful for temporarily redirecting output — for example, sending diagnostics to STDERR while a report goes to a file. In its four-argument form, select RBITS, WBITS, EBITS, TIMEOUT performs POSIX select(2) I/O multiplexing, waiting for one or more file descriptors to become ready for reading, writing, or to report exceptions. The four-argument form is low-level and rarely used directly in stryke — prefer IO::Select or async I/O patterns for multiplexing. select with $| is also the classic way to enable autoflush on a handle.

my $old = select STDERR
p "this goes to stderr"
select $old

# Enable autoflush on STDOUT
select STDOUT; $| = 1
print "immediately flushed"

# truncate

Truncate a file to a specified byte length. Accepts either a filehandle or a filename as the first argument, and the desired length as the second. truncate $fh, 0 empties the file entirely — a common pattern when rewriting a file in place. truncate $fh, $len discards everything beyond byte $len. Returns true on success, false on failure (check $! for the error). In stryke, truncate works on any seekable filehandle. When using truncate to rewrite a file, remember to also seek $fh, 0, 0 to rewind the write position — truncating does not move the file pointer. Gotcha: truncating a file opened read-only will fail.

open my $fh, '+<', 'data.txt' or die $!
truncate $fh, 0       # empty the file
seek $fh, 0, 0        # rewind to start
print $fh "fresh content\n"
close $fh

# sysopen

Low-level open using POSIX flags for precise control over how a file is opened. The signature is sysopen FH, FILENAME, FLAGS [, PERMS]. Flags are bitwise-OR combinations from Fcntl: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_NONBLOCK, and others. The optional PERMS argument (e.g., 0644) sets the file mode when O_CREAT creates a new file, subject to the process umask. sysopen is the right tool when you need O_EXCL for atomic file creation (lock files, temp files), O_NONBLOCK for non-blocking I/O, or other flags that open cannot express. In stryke, prefer three-argument open for routine file access and reserve sysopen for cases requiring specific POSIX semantics.

use Fcntl
# Atomic create — fails if file already exists
sysopen my $lock, '/tmp/my.lock', O_WRONLY|O_CREAT|O_EXCL, 0644
    or die "already running: $!"
print $lock $$

sysopen my $log, 'app.log', O_WRONLY|O_APPEND|O_CREAT, 0644
    or die "open log: $!"

# sysread

Low-level unbuffered read directly from a file descriptor, bypassing PerlIO buffering layers. The signature is sysread FH, SCALAR, LENGTH [, OFFSET]. Returns the number of bytes read, 0 at EOF, or undef on error. Unlike read, sysread issues a single read(2) system call and may return fewer bytes than requested (short read). This is the right choice for sockets, pipes, and non-blocking I/O where you need precise control over how many system calls occur and cannot tolerate buffering. In stryke, never mix sysread/syswrite with buffered I/O (print, read, <$fh>) on the same handle — the buffered and unbuffered positions will diverge and produce corrupted reads.

open my $fh, '<:raw', $path or die $!
my $buf = ''
while (my $n = sysread $fh, $buf, 4096, length($buf)) {
    p "read $n bytes (total: " . length($buf) . ")"
}
close $fh

# syswrite

Low-level unbuffered write directly to a file descriptor, bypassing PerlIO buffering layers. The signature is syswrite FH, SCALAR [, LENGTH [, OFFSET]]. Returns the number of bytes actually written, which may be less than requested on non-blocking handles or when writing to pipes/sockets (short write). Returns undef on error. Like sysread, this issues a single write(2) system call and must not be mixed with buffered I/O on the same handle. In stryke, syswrite is essential for socket programming, IPC, and performance-critical binary output where you need to avoid double-buffering. Always check the return value and handle short writes in a loop for robust code.

my $data = "hello, world"
my $n = syswrite $fh, $data
p "wrote $n bytes"

# Robust write loop for sockets
my $off = 0
while ($off < length $data) {
    my $written = syswrite $fh, $data, length($data) - $off, $off
    die "syswrite: $!" unless defined $written
    $off += $written
}

# sysseek

Low-level seek on a file descriptor, bypassing PerlIO buffering. The signature is sysseek FH, POSITION, WHENCE with the same WHENCE values as seek (0=start, 1=current, 2=end). Returns the new position as a true value, or undef on failure. Unlike seek, sysseek does not flush PerlIO buffers — it operates directly on the underlying OS file descriptor. Use sysseek when working with sysread/syswrite for consistent positioning. In stryke, sysseek with SEEK_CUR and position 0 is an idiom for querying the current fd position without moving: my $pos = sysseek $fh, 0, 1.

sysseek $fh, 0, 0   # rewind to start
sysread $fh, my $buf, 512

my $pos = sysseek $fh, 0, 1
p "fd position: $pos"

# format

Declare a picture-format template for generating fixed-width text reports. The syntax is format NAME = ... . where each line alternates between picture lines (containing field placeholders) and argument lines (listing the variables to fill in). Placeholders include @<<<< (left-align), @>>>> (right-align), @|||| (center), @###.## (numeric with decimal), and @* (multiline block fill). The format ends with a lone . on its own line. In stryke, formats are a legacy feature preserved for compatibility with Perl 5 code — for new reports, prefer printf/sprintf for simple alignment or a templating module for complex layouts. Formats interact with the special variables $~ (current format name), $^ (header format), and $= (lines per page).

format REPORT =
@<<<<<<<<<<<<<<<< @>>>>> @ ###.##
$item,            $qty,  $price
.

my ($item, $qty, $price) = ("Widget", 100, 9.99)
my $old = select REPORT
$~ = 'REPORT'
write REPORT
select $old

# formline

Format a line of output according to a picture template, appending the result to the $^A (format accumulator) variable. This is the low-level engine behind Perl's format/write report-generation system. Template characters like @<<< (left-justify), @>>> (right-justify), and @###.## (numeric) control field placement.

$^A = ""
formline("@<<<< @>>>>>\n", "Name", "Score")
formline("@<<<< @>>>>>\n", "Alice", 98)
formline("@<<<< @>>>>>\n", "Bob", 85)
p $^A

Strings

26 topics

# chomp

chomp STRING — remove the trailing record separator (usually \n) from a string in place and return the number of characters removed.

chomp is the idiomatic way to strip newlines after reading input; unlike chop, it only removes the value of $/ (the input record separator), so it is safe to call on strings that do not end with a newline — it simply does nothing. You can also chomp an entire array to strip every element at once. In stryke, chomp operates on UTF-8 strings and respects multi-byte $/ values. Prefer chomp over chop in virtually all input-processing code; chop is only for when you truly need to remove an arbitrary trailing character regardless of what it is.

my $line = <STDIN>
chomp $line
p $line
chomp(my @lines = <$fh>)  # strip all at once
p scalar @lines

# chop

chop STRING — remove and return the last character of a string, modifying the string in place.

Unlike chomp, chop unconditionally removes whatever the final character is — newline, letter, digit, or even a multi-byte UTF-8 codepoint in stryke. The return value is the removed character. This makes chop useful for peeling off known trailing delimiters or building parsers that consume input character-by-character, but dangerous for general newline removal because it will silently eat a real character if the string does not end with \n. When called on an array, chop removes the last character of every element and returns the last one removed.

my $s = "hello!"
my $last = chop $s  # $last = "!", $s = "hello"
p $s
my @words = ("foo\n", "bar\n")
chop @words  # strips trailing newline from each
@words |> e p

# length

length STRING — return the number of characters in a string, or the number of elements when given an array.

In string context, length counts Unicode characters, not bytes — so length "\x{1F600}" is 1 in stryke even though the emoji occupies 4 bytes in UTF-8. When passed an array, stryke returns the element count (equivalent to scalar @arr), which diverges slightly from Perl where length @arr stringifies the array first. This dual behavior is intentional in stryke for convenience. To get byte length instead of character length, use bytes::length or encode first. Always use length rather than comparing against the empty string when checking for non-empty input.

p length "hello"  # 5
my @a = (1:10)
p length @a       # 10
p length "\x{1F600}"  # 1 (single emoji codepoint)

# substr

substr STRING, OFFSET [, LENGTH [, REPLACEMENT]] — extract or replace a substring.

substr is stryke's Swiss-army knife for positional string manipulation. With two arguments it extracts from OFFSET to end; with three it extracts LENGTH characters; with four it replaces that range with REPLACEMENT and returns the original extracted portion. Negative OFFSET counts from the end of the string (substr $s, -3 gives the last three characters). In stryke, offsets are UTF-8 character positions, making it safe for multi-byte text. substr as an lvalue (substr($s, 0, 1) = "X") is also supported for in-place mutation. Prefer substr over regex when you know exact positions — it is faster and clearer.

my $s = "hello world"
p substr $s, 0, 5              # hello
p substr $s, -5                # world
substr $s, 6, 5, "stryke"     # $s = "hello stryke"
p $s

# index

index STRING, SUBSTRING [, POSITION] — return the zero-based position of the first occurrence of SUBSTRING within STRING, or -1 if not found.

The optional POSITION argument lets you start the search at a given offset, which is essential for scanning forward through a string in a loop (call index repeatedly, advancing POSITION past each hit). In stryke, index operates on UTF-8 character positions, not byte offsets, so it is safe for multi-byte strings. For finding the *last* occurrence, use rindex instead. A common pattern is pairing index with substr to extract fields from fixed-format data without the overhead of a regex or split.

my $i = index "hello world", "world"  # 6
p $i
my $s = "a.b.c.d"
my $pos = 0
while (($pos = index $s, ".", $pos) != -1) {
    p "dot at $pos"
    $pos++
}

# rindex

rindex STRING, SUBSTRING [, POSITION] — return the zero-based position of the last occurrence of SUBSTRING within STRING, searching backward from POSITION (or the end).

rindex mirrors index but searches from right to left, making it ideal for extracting file extensions, final path components, or the last delimiter in a string. The optional POSITION argument caps how far right the search begins — characters after POSITION are ignored. Returns -1 when the substring is not found. In stryke, positions are UTF-8 character offsets. Combine with substr for efficient right-side extraction without regex.

my $path = "foo/bar/baz.tar.gz"
my $i = rindex $path, "/"     # 7
p substr $path, $i + 1        # baz.tar.gz
my $ext = rindex $path, "."   # 15
p substr $path, $ext + 1      # gz

# split

split /PATTERN/, STRING [, LIMIT] — divide STRING into a list of substrings by splitting on each occurrence of PATTERN.

split is one of the most-used string functions. The PATTERN is a regex, so you can split on character classes, alternations, or lookaheads. A LIMIT caps the number of returned fields; the final field contains the unsplit remainder. The special pattern " " (a single space string, not regex) mimics awk-style splitting: it strips leading whitespace and splits on runs of whitespace. In stryke, split integrates with |> pipelines, accepting piped-in strings for ergonomic one-liners. Trailing empty fields are removed by default; pass -1 as LIMIT to preserve them.

my @parts = split /,/, "a,b,c"
"one:two:three" |> split /:/ |> e p   # one two three
my ($user, $domain) = split /@/, $email, 2
p "$user at $domain"

# join

join SEPARATOR, LIST — concatenate all elements of LIST into a single string, placing SEPARATOR between each pair of adjacent elements.

join is the inverse of split. It stringifies each element before joining, so mixing numbers and strings is fine. An empty separator (join "", @list) concatenates without gaps. In stryke, join works naturally with |> pipelines: a range or filtered list can be piped directly into join with a separator argument. This is the standard way to build CSV lines, path strings, or human-readable lists from arrays. join never adds a trailing separator — if you need one, append it yourself.

my $csv = join ",", @fields
1:5 |> join "-" |> p   # 1-2-3-4-5
my @parts = ("usr", "local", "bin")
p join "/", "", @parts   # /usr/local/bin

# uc

uc STRING — return a fully uppercased copy of the string.

uc performs Unicode-aware uppercasing in stryke, correctly handling multi-byte characters and locale-sensitive transformations. It returns a new string without modifying the original. Use uc for normalizing strings before comparison, formatting headers, or transforming pipeline output. In stryke |> chains, combine with maps or t for streaming uppercase transforms. For uppercasing only the first character (e.g., sentence capitalization), use ucfirst instead.

p uc "hello"  # HELLO
@words |> maps { uc } |> e p
"whisper" |> t uc |> p   # WHISPER

# lc

lc STRING — return a fully lowercased copy of the string.

lc performs Unicode-aware lowercasing in stryke, so lc "\x{C4}" (capital A with diaeresis) correctly returns the lowercase form. It does not modify the original string — it returns a new one. This is the standard way to normalize strings for case-insensitive comparison: if (lc $a eq lc $b). In stryke |> pipelines, wrap lc with t to apply it as a streaming transform. For lowercasing only the first character, use lcfirst instead.

p lc "HELLO"               # hello
"SHOUT" |> t lc |> t rev |> p  # tuohs
my @norm = map lc, @words
@norm |> e p

# ucfirst

ucfirst STRING — return a copy of the string with only the first character uppercased, leaving the rest unchanged.

This is the standard way to capitalize the first letter of a word for display, title-casing, or converting camelCase to PascalCase. In stryke, ucfirst is Unicode-aware and correctly handles multi-byte leading characters. It returns a new string and does not modify the original. For full uppercasing, use uc. A common idiom is ucfirst lc $word to normalize a word to "Title" form.

p ucfirst "hello"            # Hello
p ucfirst lc "hELLO"         # Hello
my @titled = map { ucfirst lc } @raw
@titled |> join " " |> p

# lcfirst

lcfirst STRING — return a copy of the string with only the first character lowercased, leaving the rest unchanged.

This is useful for converting PascalCase identifiers to camelCase, or for formatting output where only the initial letter matters. In stryke, lcfirst is Unicode-aware, so it handles accented capitals and multi-byte first characters correctly. Like lc, it returns a new string rather than modifying in place. If you need the entire string lowercased, use lc instead.

p lcfirst "Hello"    # hello
p lcfirst "XMLParser" # xMLParser
my @camel = map lcfirst, @PascalNames
@camel |> e p

# chr

chr NUMBER — return the character represented by the given ASCII or Unicode code point.

chr is the inverse of ord: chr(ord($c)) eq $c always holds. It accepts any non-negative integer and returns a single-character string. In stryke, values above 127 produce valid UTF-8 characters, so chr 0x1F600 gives you a smiley emoji with no special encoding gymnastics. For string literals, stryke supports all standard escapes: \x{hex}, \u{hex}, \o{oct}, \NNN (octal), \cX (control), \N{U+hex}, \N{UNICODE NAME}, plus case modifiers \U..\E, \L..\E, \u, \l, \Q..\E.

p chr 65       # A
p chr 0x1F600  # smiley emoji
p "\u{0301}"   # combining acute accent
p "\N{SNOWMAN}" # ☃
my @abc = map { chr(_ + 64) } 1:26
@abc |> join "" |> p  # ABCDEFGHIJKLMNOPQRSTUVWXYZ

# ord

ord STRING — return the numeric (Unicode code point) value of the first character of the string.

ord is the inverse of chr: ord(chr($n)) == $n always holds. When passed a multi-character string, only the first character is examined — the rest are ignored. In stryke, ord returns the full Unicode code point, not just 0-255, so ord "\u{1F600}" returns 128512. This is useful for character classification, building lookup tables, or implementing custom encodings. For ASCII checks, ord($c) >= 32 && ord($c) <= 126 tests printability.

p ord "A"          # 65
p ord "\n"         # 10
p ord "\u{1F600}"  # 128512
my @codes = map ord, split //, "hello"
@codes |> e p      # 104 101 108 108 111

# hex

hex STRING — interpret a hexadecimal string and return its numeric value.

The leading 0x prefix is optional: both hex "ff" and hex "0xff" return 255. The string is case-insensitive, so hex "DeAdBeEf" works fine. If the string contains non-hex characters, stryke warns and converts up to the first invalid character. This is the standard way to parse hex-encoded values from config files, color codes, or protocol dumps. For the reverse operation (number to hex string), use sprintf "%x". Note that hex always returns a number, never a string — arithmetic is immediate.

my $n = hex "deadbeef"
printf "0x%x = %d\n", $n, $n
p hex "ff"   # 255
"cafe" |> t { hex } |> p   # 51966

# oct

oct STRING — interpret an octal, hexadecimal, or binary string and return its numeric value.

oct is the multi-base cousin of hex: it auto-detects the base from the prefix. Strings starting with 0b are binary, 0x are hex, and bare digits or 0-prefixed digits are octal. This makes it the go-to for parsing Unix file permissions (oct "0755" gives 493), binary literals, or any string where the radix is embedded in the value. In stryke, oct handles arbitrarily large integers via the same big-number pathway as other arithmetic. A common gotcha: oct "8" warns because 8 is not a valid octal digit — use hex or a bare numeric literal instead.

p oct "0755"    # 493
p oct "0b1010"  # 10
p oct "0xff"    # 255
my $perms = oct "644"
p sprintf "%04o", $perms  # 0644

# quotemeta

quotemeta STRING — escape all non-alphanumeric characters with backslashes, returning a string safe for interpolation into a regex.

This is essential when building dynamic regexes from user input: without quotemeta, characters like ., *, (, ), [, and \ would be interpreted as regex metacharacters, leading to either broken patterns or security vulnerabilities (ReDoS). The equivalent inline syntax is \Q..\E inside a regex. In stryke, quotemeta handles the full Unicode range, escaping any character that is not [A-Za-z0-9_]. Use it liberally whenever you splice user-provided strings into patterns.

my $input = "file (1).txt"
my $safe = quotemeta $input
p $safe  # file\ \(1\)\.txt
my $found = ("file (1).txt" =~ /^$safe$/)
p $found  # 1

# trim

trim STRING or trim LIST — strip leading and trailing ASCII whitespace.

When given a single string, trim returns the stripped result. When given a list or used in a pipeline, it operates in streaming mode, trimming each element individually as it flows through. Whitespace includes spaces, tabs, carriage returns, and newlines. The tm alias is convenient in pipeline chains where brevity matters.

" hello " |> tm |> p                  # "hello"
@raw |> tm |> e p
slurp("data.csv") |> ln |> tm |> e p

# lines

lines STRING / ln STRING — split a string on newline boundaries, returning a streaming iterator of lines.

Each line is yielded without the trailing newline character. When piped from slurp, this gives you a lazy line-by-line view of a file without loading all lines into memory at once. Both \n and \r\n line endings are handled. The ln alias keeps pipelines compact.

slurp("data.txt") |> lines |> e p
my @rows = lines $multiline_str
$body |> ln |> grep /TODO/ |> e p

# words

words (alias wd) splits a string on whitespace boundaries and returns the resulting list of words. It handles leading, trailing, and consecutive whitespace gracefully — unlike a naive split / /, it never produces empty strings. This is the idiomatic way to tokenize a line of text in stryke, and the short alias wd keeps pipelines compact. It is equivalent to Perl's split ' ' behavior.

my @w = wd "  hello   world  "
p @w       # hello, world
my $line = "  foo  bar  baz  "
my $count = scalar wd $line
p $count   # 3
rl("data.txt") |> map { scalar wd _ } |> e p

# chars

chars STRING / ch STRING — split a string into individual characters, returning a streaming iterator.

Each Unicode grapheme cluster is yielded as a separate string element. This is useful for character-level processing such as frequency counting, transliteration, or building character n-grams. In pipeline mode the characters stream one at a time, so you can chain with take, grep, or with_index without materializing the full character array.

"hello" |> chars |> e p               # h e l l o
my @c = chars "abc"
"emoji: \x{1F600}" |> ch |> e p

# snake_case

snake_case (alias sc) converts a string from any common casing convention — camelCase, PascalCase, kebab-case, or mixed — into snake_case, where words are lowercase and separated by underscores. This is the standard naming convention for Perl and Rust variables and function names. Consecutive uppercase letters in acronyms are handled intelligently (e.g., parseHTTPResponse becomes parse_http_response).

p sc "camelCase"          # camel_case
p sc "PascalCase"         # pascal_case
p sc "kebab-case"         # kebab_case
p sc "parseHTTPResponse"  # parse_http_response
my @methods = qw(getUserName setEmailAddr)
@methods |> map sc |> e p

# camel_case

camel_case (alias cc) converts a string from any casing convention into camelCase, where the first word is lowercase and subsequent words are capitalized with no separators. This is the standard naming convention for JavaScript variables and Java methods. The function handles underscores, hyphens, and spaces as word boundaries and strips them during conversion.

p cc "snake_case"         # snakeCase
p cc "kebab-case"         # kebabCase
p cc "PascalCase"         # pascalCase
p cc "hello world"        # helloWorld
my @cols = qw(first_name last_name email_addr)
@cols |> map cc |> e p

# kebab_case

kebab_case (alias kc) converts a string from any casing convention into kebab-case, where words are lowercase and separated by hyphens. This is the standard naming convention for CSS classes, URL slugs, and CLI flag names. Like snake_case, it intelligently handles acronyms and mixed-case input. The function treats underscores, spaces, and case transitions as word boundaries.

p kc "camelCase"          # camel-case
p kc "PascalCase"         # pascal-case
p kc "snake_case"         # snake-case
p kc "parseHTTPResponse"  # parse-http-response
my $slug = kc $title      # URL-safe slug

# study

study STRING — hint to the regex engine that the given string will be matched against multiple patterns, allowing it to build an internal lookup table for faster matching.

In classic Perl, study builds a linked list of character positions so subsequent regex matches can skip impossible starting points. In practice, modern regex engines (including stryke's Rust-based engine) already perform these optimizations internally, so study is effectively a no-op in stryke — calling it is harmless but provides no measurable speedup. It exists for compatibility with Perl code that uses it. You only need study when porting legacy scripts that call it; do not add it to new stryke code expecting a performance benefit.

study $text   # no-op in stryke, kept for compatibility
my @hits = grep { /$pattern/ } @lines
p scalar @hits

# pos

pos SCALAR — gets or sets the position where the next m//g (global match) will start searching in the given string. After a successful m//g match, pos returns the offset just past the end of the match. You can assign to pos($s) to manually reposition the search. If the last m//g failed, pos resets to undef. This is essential for writing lexers or tokenizers that consume a string incrementally with \G-anchored patterns. In stryke, pos tracks per-scalar state just like Perl.

my $s = "abcabc"
while ($s =~ /a/g) { p pos($s) }
# 1 4
pos($s) = 0   # reset to scan again
p pos($s)     # 0

Arrays & Hashes

19 topics

# push

push @array, LIST — appends one or more elements to the end of an array and returns the new length. This is the primary way to grow arrays in stryke and works identically to Perl's builtin. You can push scalars, lists, or even the result of a pipeline. In stryke, push is O(1) amortized thanks to the underlying Rust Vec.

my @q
push @q, 1:3
push @q, "four", "five"
p scalar @q   # 5
@q |> e p     # 1 2 3 four five

Returns the new element count, so my $len = push @arr, $val; is valid.

# pop

pop @array — removes and returns the last element of an array, or undef if the array is empty. This is the complement of push and together they give you classic stack (LIFO) semantics. In stryke the operation is O(1) because the underlying Rust Vec::pop simply decrements the length. When called without an argument inside a subroutine, pop operates on @_; at file scope it operates on @ARGV, matching standard Perl behavior.

my @stk = 1:5
my $top = pop @stk
p $top          # 5
p scalar @stk   # 4
@stk |> e p     # 1 2 3 4

# shift

shift @array — removes and returns the first element of an array, sliding all remaining elements down by one index. Like pop, it returns undef on an empty array. Without an explicit argument it defaults to @_ inside subroutines and @ARGV at file scope. Because every element must be moved, shift is O(n); if you only need LIFO access, prefer push/pop. Use shift when processing argument lists or implementing FIFO queues.

my @args = @ARGV
my $cmd = shift @args
p $cmd
@args |> e p   # remaining arguments

# unshift

unshift @array, LIST — prepends one or more elements to the beginning of an array and returns the new length. It is the counterpart of push for the front of the array. Like shift, this is O(n) because existing elements must be moved to make room. When you need to build an array in reverse order or maintain a priority queue with newest items first, unshift is the idiomatic choice. You can pass multiple values and they will appear in the same order they were given.

my @log = ("b", "c")
unshift @log, "a"
@log |> e p   # a b c
my $len = unshift @log, "x", "y"
p $len        # 5
@log |> e p   # x y a b c

# splice

splice @array, OFFSET [, LENGTH [, LIST]] — the Swiss-army knife for array mutation. It can insert, remove, or replace elements at any position in a single call. With just an offset it removes everything from that point to the end. With offset and length it removes that many elements. With a replacement list it inserts those elements in place of the removed ones. The return value is the list of removed elements, which is useful for saving what you cut. In stryke this compiles down to Rust's Vec::splice and Vec::drain.

my @a = 1:5
my @removed = splice @a, 1, 2, 8, 9
@a |> e p        # 1 8 9 4 5
@removed |> e p  # 2 3
splice @a, 2     # remove from index 2 onward
@a |> e p        # 1 8

# keys

keys %hash — returns the list of all keys in a hash in no particular order. When called on an array, it returns the list of valid indices (0 to $#array). In scalar context, keys returns the number of keys. Calling keys resets the each iterator on that hash, which is the standard way to restart iteration. In stryke, this calls Rust's HashMap::keys() and collects into a Vec. For sorted output, chain with sort via the pipe operator.

my %env = (HOME => "/root", USER => "me")
keys(%env) |> sort |> e p   # HOME USER
p scalar keys %env           # 2
my @a = (10, 20, 30)
keys(@a) |> e p              # 0 1 2

# values

values %hash — returns the list of all values in a hash in no particular order (matching the order of keys for the same hash state). When called on an array, it returns the array elements themselves. In scalar context, returns the count of values. Like keys, calling values resets the each iterator. In stryke this maps to Rust's HashMap::values(). Combine with sum, sort, or pipeline operators for common aggregation patterns.

my %scores = (alice => 90, bob => 85)
p sum(values %scores)   # 175
values(%scores) |> sort { $_1 <=> $_0 } |> e p   # 90 85

# each

each %hash — returns the next (key, value) pair from a hash as a two-element list, or an empty list when the iterator is exhausted. Each hash has its own internal iterator, which is reset when you call keys or values on the same hash. This is memory-efficient for large hashes because it does not build the full key list. Gotcha: do not add or delete keys while iterating with each; that can cause skipped or duplicated entries. In stryke, the iteration order is non-deterministic (Rust HashMap order).

my %h = (a => 1, b => 2, c => 3)
while (my ($k, $v) = each %h) { p "$k=$v" }
# output order varies: a=1 b=2 c=3

# delete

delete EXPR — removes a key-value pair from a hash or an element from an array and returns the removed value (or undef if it did not exist). For hashes this is the only way to truly remove a key; assigning undef to $h{key} leaves the key in place. For arrays, delete sets the element to undef but does not shift indices (use splice if you need to close the gap). In stryke, hash deletion maps to Rust's HashMap::remove. You can delete multiple keys at once with a hash slice: delete @h{@keys}.

my %h = (x => 1, y => 2, z => 3)
my $old = delete $h{x}
p $old   # 1
p exists $h{x} ? "yes" : "no"   # no
delete @h{"y", "z"}   # delete multiple keys

# exists

exists EXPR — tests whether a specific key is present in a hash or an index is present in an array, regardless of whether the associated value is undef. This is different from defined: a key can exist but hold undef. Use exists to check hash membership before accessing a value to avoid autovivification side effects. In stryke, exists on a hash compiles to Rust's HashMap::contains_key, and on an array it checks bounds. You can also use it with nested structures: exists $h{a}{b} only checks the final level.

my %h = (a => 1, b => undef)
p exists $h{b} ? "yes" : "no"   # yes (key present, value undef)
p exists $h{c} ? "yes" : "no"   # no
my @a = (10, 20, 30)
p exists $a[5] ? "yes" : "no"   # no

# scalar

scalar EXPR — forces the expression into scalar context. The most common use is scalar @array to get the element count instead of the list of elements. In stryke, scalar context on an array returns its length as a Rust usize. You can also use scalar on a hash to get the number of key-value pairs, or on a function call to force it to return a single value. This is essential when you want a count inside string interpolation or as a function argument where list context would be ambiguous.

my @items = ("a", "b", "c")
p scalar @items   # 3
p "count: " . scalar @items   # count: 3
my %h = (x => 1, y => 2)
p scalar %h       # 2

# defined

defined EXPR — returns true if the expression has a value that is not undef. This is the canonical way to distinguish between "no value" and "a value that happens to be false" (such as 0, "", or "0"). Use defined before dereferencing optional values or checking return codes from functions that return undef on failure. In stryke, defined compiles to a Rust Option::is_some() check internally. Note that defined on an aggregate (hash or array) is deprecated in Perl 5 and is a no-op in stryke.

my $x = undef
p defined($x) ? "yes" : "no"   # no
$x = 0
p defined($x) ? "yes" : "no"   # yes
my $val = fn_that_may_fail()
p $val if defined $val

# undef

undef — the undefined value, representing the absence of a value. As a function, undef $var explicitly undefines a variable, freeing any value it held. undef is falsy in boolean context and triggers "use of uninitialized value" warnings under use warnings. In stryke, undef maps to Rust's None in an Option type internally. Use undef to reset variables, signal missing return values, or clear hash entries without deleting the key.

my $x = 42
undef $x
p defined($x) ? "def" : "undef"   # undef
fn maybe { return undef if !@_
    return $_[0] }
p defined(maybe()) ? "got" : "nothing"   # nothing

# ref

ref EXPR — returns a string indicating the reference type of the value, or an empty string if it is not a reference. Common return values are SCALAR, ARRAY, HASH, CODE, REF, and Regexp. For blessed objects it returns the class name. Use ref to dispatch on data type or validate arguments in polymorphic functions. In stryke, ref inspects the Rust enum variant of the underlying value. Note that ref does not recurse; it only tells you the top-level type.

my $r = [1, 2, 3]
p ref($r)       # ARRAY
p ref(\%ENV)    # HASH
p ref(\&main)   # CODE
p ref(42)       # (empty string)

# bless

Associate a reference with a package name, turning it into an object of that class. The blessed reference can then have methods called on it via ->. The second argument defaults to the current package. This is the foundation of Perl's object system.

fn new($class, %args) {
    bless { %args }, $class
}
my $obj = new("Dog", name => "Rex", breed => "Lab")
p ref($obj)          # Dog
p $obj->{name}       # Rex

# tie

Bind a variable to an implementing class so that all accesses (read, write, delete, etc.) are intercepted by methods on that class. This is Perl's mechanism for transparent object-backed variables — tied hashes can be backed by a database, tied scalars can validate on assignment, etc. Use untie to remove the binding.

tie my %db, 'DB_File', 'cache.db'
$db{key} = "value"         # writes to disk
p $db{key}                  # reads from disk
untie %db

# prototype

Return the prototype string of a named function, or undef if the function has no prototype. Prototypes control how arguments are parsed at compile time — they influence context and reference-passing behavior. Useful for introspection and metaprogramming.

p prototype("CORE::push")     # \@@
p prototype("CORE::map")      # &@
fn greet($name) { p "hi $name" }
p prototype(\&greet)          # undef (signatures, no proto)

# wantarray

wantarray() — returns true if the current subroutine was called in list context, false in scalar context, and undef in void context. This lets a function adapt its return value to the caller's expectations. A common pattern is returning a list in list context and a count or reference in scalar context. In stryke, use fn to define subroutines and wantarray() inside them just like in Perl. Note that wantarray only reflects the immediate call site, not nested contexts.

fn ctx { wantarray() ? "list" : "scalar" }
my @r = ctx()
p $r[0]   # list
my $r = ctx()
p $r      # scalar
fn flexible { wantarray() ? (1, 2, 3) : 3 }
my @all = flexible()
p scalar @all   # 3
my $cnt = flexible()
p $cnt          # 3

# caller

caller [LEVEL] — returns information about the calling subroutine's context. In list context it returns (package, filename, line) for the given call-stack level (default 0, the immediate caller). With higher levels you can walk up the call stack for debugging or generating stack traces. In scalar context, caller returns just the package name. In stryke, caller works with fn-defined subroutines and integrates with the runtime's frame tracking. This is invaluable for building custom error reporters or trace utilities.

fn trace {
    my ($pkg, $f, $ln) = caller()
    p "$f:$ln"
}
trace()   # prints current file:line
fn deep {
    my ($pkg, $f, $ln) = caller(1)
    p "grandparent: $f:$ln"
}

Control Flow

17 topics

# if

The fundamental conditional construct. Evaluates its condition in boolean context and executes the block if true. stryke supports both the block form if (COND) { BODY } and the postfix form EXPR if COND, which is idiomatic for single-statement guards. The condition can be any expression — numbers (0 is false), strings (empty and "0" are false), undef (false), and references (always true). Postfix if cannot have elsif/else — use the block form for multi-branch logic.

my $n = 42
if ($n > 0) { p "positive" }
p "big" if $n > 10          # postfix — clean one-liner
my $label = "even" if $n % 2 == 0
p "got: $n" if defined $n   # guard against undef

# elsif

Chain additional conditions after an if block without nesting. Each elsif is tested in order; the first one whose condition is true has its block executed, and the rest are skipped. There is no limit on the number of elsif branches. In stryke, prefer match for complex multi-branch dispatch since it supports pattern matching, destructuring, and guards — but elsif remains the right tool for simple linear condition chains. Note: it is elsif, not elseif or else if — the latter is a syntax error.

fn classify($n) {
    if    ($n < 0)   { "negative" }
    elsif ($n == 0)  { "zero" }
    elsif ($n < 10)  { "small" }
    elsif ($n < 100) { "medium" }
    else             { "large" }
}
1:200 |> map classify |> frequencies |> dd

# else

The final fallback branch of an if/elsif chain, executed when no preceding condition was true. Every if can have at most one else, and it must come last. For ternary-style expressions, use COND ? A : B instead of an if/else block — it composes better in |> pipes and assignments.

if ($n % 2 == 0) { p "even" }
else             { p "odd" }

# Ternary is often cleaner in pipes:
1:10 |> map { _ % 2 == 0 ? "even" : "odd" } |> e p

# unless

A negated conditional — executes the block when the condition is *false*. This reads more naturally than if (!COND) for guard clauses and early returns. stryke supports both block and postfix forms. Convention: use unless for simple negative guards; avoid unless with complex compound conditions, as double-negatives hurt readability. There is no unlessif — use if/elsif chains for multi-branch logic.

unless ($ENV{QUIET}) { p "verbose output" }
p "missing!" unless -e $path   # postfix guard
die "no input" unless @ARGV
return unless defined $val    # early return pattern

# for

Iterate over a list, binding each element to a loop variable (or _ by default). for and foreach are interchangeable keywords. The loop variable is automatically localized and aliases the original element — modifications to _ inside the loop mutate the list in-place. In stryke, for loops work with ranges, arrays, hash slices, and iterator results. For parallel iteration, see pfor; for pipeline-style processing, prefer |> e or |> map. C-style for (INIT; COND; STEP) is also supported.

for my $f (glob "*.txt") { p $f }
for (1:5) { p _ * 2 }            # _ is default
my @names = qw(alice bob carol)
for (@names) { _ = uc _ }         # mutates in-place
p join ", ", @names                 # ALICE, BOB, CAROL

# while

Loop that re-evaluates its condition before each iteration and continues as long as it is true. Commonly used for reading input line-by-line, polling, and indefinite iteration. The condition is tested in boolean context. while integrates naturally with the diamond operator <> for reading filehandles. The loop variable can be declared in the condition with my, scoping it to the loop body. Postfix form is also supported: EXPR while COND;.

while (my $line = <STDIN>) {
    $line |> tm |> p             # trim + print each line
}
my $i = 0
while ($i < 5) { p $i++ }    # counted loop
while (1) { last if done() }     # infinite loop with break

# until

Loop that continues as long as its condition is *false* — the logical inverse of while. Useful when the termination condition is more naturally expressed as a positive assertion ("keep going until X happens"). Supports both block and postfix forms. Prefer while with a negated condition if until makes the logic harder to read.

my $n = 1
until ($n > 1000) { $n *= 2 }
p $n   # 1024

my $tries = 0
until (connected()) {
    $tries++
    sleep 1
}
p "connected after $tries tries"

# do

Execute a block and return its value, or execute a file. As a block, do { ... } creates an expression scope — the last expression in the block is the return value, making it useful for complex initializations. As a file operation, do "file.pl" executes the file in the current scope and returns its last expression. Unlike require, do does not cache and re-executes on each call. do { ... } while (COND) creates a loop that always runs at least once.

my $val = do { my $x = 10
    $x ** 2 }   # 100
p $val
my $cfg = do "config.pl"               # load config
# do-while: body runs at least once
my $input
do { $input = readline(STDIN) |> tm } while ($input eq "")

# last

Immediately exit the innermost enclosing loop (equivalent to break in C/Rust). Execution continues after the loop. last LABEL can target a labeled outer loop to break out of nested loops. Works in for, foreach, while, until, and do-while. Does *not* work inside map, grep, or |> pipeline stages — use take, first, or take_while for early termination in functional contexts.

for (1:1_000_000) {
    last if _ > 5
    p _
}   # prints 1 2 3 4 5

OUTER: for my $i (1:10) {
    for my $j (1:10) {
        last OUTER if $i * $j > 50   # break both loops
    }
}

For pipeline early-exit: 1:1000 |> take_while { _ < 50 } |> e p.

# next

Skip the rest of the current loop iteration and jump to the next one. The loop condition (for while/until) or the next element (for for/foreach) is evaluated immediately. Like last, next supports labeled loops with next LABEL for skipping in nested loops. This is the primary tool for filtering within imperative loops. In stryke, consider grep/filter or |> reject for functional-style filtering instead.

for (1:10) {
    next if _ % 2        # skip odds
    p _
}   # 2 4 6 8 10

for my $file (glob "*") {
    next unless -f $file   # skip non-files
    next if $file =~ /^\./  # skip hidden
    p $file
}

# redo

Restart the current loop iteration from the top of the loop body *without* re-evaluating the loop condition or advancing to the next element. The loop variable retains its current value. This is a niche but powerful tool for retry logic within loops — when an iteration fails, redo lets you try again with the same input. Use sparingly, as it can create infinite loops if the retry condition never resolves. Always pair with a guard or counter. For automated retry with backoff, prefer retry { ... } times => N, backoff => 'exponential'.

for my $url (@urls) {
    my $body = eval { fetch($url) }
    if ($@) {
        warn "retry $url: $@"
        sleep 1
        redo   # try same URL again
    }
    p length($body)
}

# continue

A block attached to a for/foreach/while loop that executes after each iteration, even when next is called. Analogous to the increment expression in a C-style for loop. The continue block does *not* run when last or redo is used. Useful for unconditional per-iteration bookkeeping like incrementing counters, logging progress, or flushing buffers. Rarely used but fully supported in stryke.

my $count = 0
for my $item (@work) {
    next if $item->{skip}
    process($item)
} continue {
    $count++
    p "processed $count so far" if $count % 100 == 0
}

# given

A switch-like construct that evaluates an expression and dispatches to when blocks via smartmatch semantics. The topic variable _ is set to the given expression for the duration of the block. Each when clause is tested in order; the first match executes its block and control passes out of the given (implicit break). A default block handles the no-match case. In stryke, prefer the match keyword for new code — it offers pattern destructuring, typed patterns, array/hash shape matching, and if guards that given/when cannot express.

given ($cmd) {
    when ("start")   { p "starting up" }
    when ("stop")    { p "shutting down" }
    when (/^re/)     { p "restarting" }
    default          { p "unknown: $cmd" }
}

See match for stryke-native pattern matching with destructuring.

# when

A case clause inside a given block. The expression is matched against the topic _ using smartmatch semantics: strings match exactly, regexes match against _, arrayrefs check membership, coderefs are called with _ as argument, and numbers compare numerically. When a when clause matches, its block executes and control exits the enclosing given (implicit break). Multiple when clauses are tried in order until one matches.

given ($val) {
    when (/^\d+$/)      { p "number" }
    when (["a","b","c"]) { p "early letter" }
    when (42)            { p "the answer" }
    default              { p "something else" }
}

In stryke, the match keyword provides more powerful pattern matching.

# default

The fallback clause in a given block, executed when no when clause matched. Every given should have a default to handle unexpected values, similar to else in an if chain or the wildcard _ arm in stryke match. If no default is present and nothing matches, execution simply continues after the given block. In stryke match, use _ => ... for the default arm instead.

given ($exit_code) {
    when (0) { p "success" }
    when (1) { p "general error" }
    when (2) { p "misuse" }
    default  { p "unknown exit code: $exit_code" }
}

# return

Return a value from a subroutine.

fn clamp($v, $lo, $hi) {
    return $lo if $v < $lo
    return $hi if $v > $hi
    $v
}

# not

Low-precedence logical negation — returns true if the expression is false, and false if it is true. Functionally identical to ! but binds looser than almost everything, so not $a == $b is not($a == $b) rather than (!$a) == $b. Useful for readable boolean conditions.

if (not defined $val) {
    p "val is undef"
}
my @missing = grep { not -e _ } @files
@missing |> e p
p not 0    # 1
p not 1    # (empty string)

Error Handling

8 topics

# try

Structured exception handling that cleanly separates the happy path from error recovery. The try block runs the code; if it throws (via die), execution jumps to the catch block with the exception bound to the declared variable. An optional finally block runs unconditionally afterward — ideal for cleanup like closing filehandles or releasing locks. Unlike eval, try/catch is a first-class statement with proper scoping and no $@ pollution. In stryke, try integrates with all exception types including string messages, hashrefs, and objects.

try {
    my $data = fetch_json($url)
    p $data->{name}
} catch ($e) {
    warn "request failed: $e"
    return fallback()
} finally {
    log_info("fetch attempt complete")
}

Prefer try/catch over eval { } for new code — it reads better and avoids $@ clobbering races.

# catch

The error-handling clause that follows a try block. When the try block throws an exception, execution transfers to catch with the exception value bound to the declared variable (e.g. $e). The catch variable is lexically scoped to the catch block. You can inspect the exception — it may be a string, a hashref with structured error info, or an object with methods. Multiple error types can be differentiated with ref or match inside the catch body. If the catch block itself throws, the exception propagates upward (the finally block still runs first, if present).

try { die { code => 404, msg => "not found" } }
catch ($e) {
    if (ref $e eq 'HASH') {
        p "error $e->{code}: $e->{msg}"
    } else {
        p "caught: $e"
    }
}

# finally

A cleanup block that runs after try/catch regardless of whether an exception was thrown or not. This guarantees resource cleanup even if the try block throws or the catch block re-throws. The finally block cannot change the exception or the return value — it is strictly for side effects like closing filehandles, releasing locks, or logging. If finally itself throws, that exception replaces the original one (avoid throwing in finally). finally is optional — you can use try/catch without it.

my $fh
try {
    open $fh, '<', $path or die $!
    process(<$fh>)
} catch ($e) {
    log_error("failed: $e")
} finally {
    close $fh if $fh   # always cleanup
}

# eval

The classic Perl exception-catching mechanism. eval { BLOCK } executes the block in an exception-trapping context: if the block throws (via die), execution continues after the eval with the error stored in $@. eval "STRING" compiles and executes Perl code at runtime — powerful but dangerous (code injection risk). In stryke, prefer try/catch for exception handling as it avoids the $@ clobbering pitfalls and reads more clearly. eval remains useful for dynamic code evaluation and backward compatibility with Perl 5 idioms.

eval { die "oops" }
if ($@) { p "caught: $@" }

# Eval string — dynamic code execution
my $expr = "2 + 2"
my $result = eval $expr
p $result   # 4

Caveat: $@ can be clobbered by intervening evals or destructors — try/catch avoids this.

# die

Raise an exception, immediately unwinding the call stack until caught by try/catch or eval. The argument can be a string (most common), a reference (hashref for structured errors), or an object. If uncaught, the program terminates and the message is printed to STDERR. In stryke, die works identically to Perl 5 and integrates with try/catch, eval, and the $@ mechanism. Convention: end die messages with \n to suppress the automatic "at FILE line LINE" suffix, or omit it to get location info for debugging.

fn divide($a, $b) {
    die "division by zero\n" unless $b
    $a / $b
}

# Structured error
die { code => 400, msg => "bad request", field => "email" }

# With automatic location
die "something broke"   # prints: something broke at script.pl line 5.

# warn

Print a warning message to STDERR without terminating the program. Behaves like die but only emits the message instead of throwing an exception. If the message does not end with \n, Perl appends the current file and line number. Warnings can be intercepted with $SIG{__WARN__} or suppressed with no warnings. In stryke, warn is useful for non-fatal diagnostics; for structured logging, use log_warn instead.

warn "file not found: $path" unless -e $path
warn "deprecated: use fetch_json instead\n"  # no line number

# Intercept warnings
local $SIG{__WARN__} = fn ($msg) { log_warn($msg) }
warn "redirected to logger"

# croak

Die from the caller's perspective — the error message reports the file and line of the *caller*, not the function that called croak. This is the right choice for library/module functions where the error is the caller's fault (bad arguments, misuse). Without croak, the user sees an error pointing at library internals, which is unhelpful. In stryke, croak is available as a builtin without use Carp. For debugging deep call chains, use confess instead to get a full stack trace.

fn parse($s) {
    croak "parse: empty input" unless length $s
    croak "parse: not JSON" unless $s =~ /^[{\[]/
    json_decode($s)
}

# Error will point at the call site, not inside parse()
my $data = parse("")   # dies: "parse: empty input at caller.pl line 5"

# confess

Die with a full stack trace from the point of the error all the way up through every caller. This is invaluable for debugging deep call chains where die or croak only show one frame. Each frame includes the package, file, and line number. In stryke, confess is available as a builtin without use Carp. Use confess during development for maximum diagnostic info; switch to croak in production-facing libraries where the trace would confuse end users.

fn validate($data) {
    confess "missing required field 'name'" unless $data->{name}
}
fn process($input) { validate($input) }
fn main { process({}) }   # full trace: main -> process -> validate

The trace output shows: missing required field 'name' at script.pl line 2.\n\tmain::validate called at line 4\n\t....

Declarations

10 topics

# my

Declare a lexically scoped variable visible only within the enclosing block or file. my is the workhorse of Perl variable declarations — use it for scalars ($), arrays (@), and hashes (%). Variables declared with my are invisible outside their scope, which prevents accidental cross-scope mutation. In stryke, my variables participate in pipe chains and can be destructured in list context. Uninitialized my variables default to undef.

my $name = "world"
my @nums = 1:5
my %cfg = (debug => 1, verbose => 0)
p "hello $name"
@nums |> grep _ > 2 |> e p$1

Use `my` everywhere unless you specifically need `our` (package global), `local` (dynamic scope), or `state` (persistent).

# our

Declare a package-global variable that is accessible as a lexical alias in the current scope. Unlike my, our variables are visible across the entire package and can be accessed from other packages via their fully qualified name (e.g. $Counter::total). This is useful for package-level configuration, shared counters, or variables that need to survive across file boundaries. In stryke, our variables are not mutex-protected — use mysync instead for parallel-safe globals.

package Counter
our $total = 0
fn bump { $total++ }
package main
Counter::bump() for 1:5
p $Counter::total   # 5

Prefer my for local state; reach for our only when other packages need access.

# local

Temporarily override a global variable's value for the duration of the current dynamic scope. When the scope exits, the original value is automatically restored. This is essential for modifying Perl's special variables (like $/, $\, $,) without permanently altering global state. Unlike my which creates a new variable, local saves and restores an existing global. In stryke, local works with all special variables and respects the same restoration semantics during exception unwinding.

local $/ = undef       # slurp mode
open my $fh, '<', 'data.txt' or die $!
my $body = <$fh>       # reads entire file
close $fh
# $/ restored to "\n" when scope exits

Common patterns: local $/ = undef (slurp), local $, = "," (join print args), local %ENV (temporary env).

# state

Declare a persistent lexical variable that retains its value across calls to the enclosing subroutine. Unlike my, which reinitializes on each call, state initializes only once — the first time execution reaches the declaration — and preserves the value for all subsequent calls. This is perfect for counters, caches, and memoization without resorting to globals or closures over external variables. In stryke, state variables are per-thread when used inside ~> { } or fan blocks; they are not shared across workers.

fn counter {
    state $n = 0
    ++$n
}
p counter() for 1:5   # 1 2 3 4 5
fn memo($x) {
    state %cache
    $cache{$x} //= expensive($x)
}

Requires use feature 'state' in standard Perl, but is always available in stryke.

# package

Set the current package namespace for all subsequent declarations. Package names are conventionally CamelCase with :: separators (e.g. Math::Utils). All unqualified function and our variable names are installed into the current package. In stryke, packages work identically to standard Perl — they provide namespace isolation but are not classes by themselves (use struct or bless for OOP). Switching packages mid-file is allowed but discouraged; prefer one package per file.

package Math::Utils
fn factorial($n) { $n <= 1 ? 1 : $n * factorial($n - 1) }
fn fib($n) { $n < 2 ? $n : fib($n - 1) + fib($n - 2) }
package main
p Math::Utils::factorial(10)   # 3628800

# use

Load and import a module at compile time: use Module qw(func);.

use List::Util qw(sum max)
my @vals = 1:10
p sum(@vals)   # 55
p max(@vals)   # 10

# no

Unimport a module or pragma: no strict 'refs';.

no warnings 'experimental'
given ($x) { when (1) { p "one" } }

# require

Load a module at runtime: require Module;.

require JSON
my $data = JSON::decode_json($text)
p $data->{name}

# BEGIN

BEGIN { } — runs at compile time, before the rest of the program.

BEGIN { p "compiling..." }
p "running"
# output: compiling... then running

# END

END { } — runs after the program finishes (or on exit).

END { p "cleanup done" }
p "main work"
# output: main work then cleanup done

Cluster / Distributed

4 topics

# cluster

cluster(["host1:N", "host2:M", ...]) — build an SSH-backed worker pool for distributing stryke workloads across multiple machines.

Each entry in the list is a hostname (or user@host) followed by a colon and the number of worker slots to allocate on that host. Under the hood, stryke opens persistent SSH multiplexed connections to each host, deploys lightweight stryke --remote-worker processes, and manages a work-stealing scheduler across the entire cluster. The cluster object is then passed to distributed primitives like pmap_on and pflat_map_on. Workers must have stryke installed and accessible on $PATH. If a host becomes unreachable mid-computation, its in-flight tasks are automatically re-queued to surviving hosts.

my $cl = cluster(["server1:8", "server2:4", "gpu-box:16"])
my @results = pmap_on $cl, { heavy_compute } @jobs

# Single-machine cluster for testing:
my $local = cluster(["localhost:4"])

# pmap_on

pmap_on $cluster, { BLOCK } @list — distributed parallel map that fans work across a cluster of remote machines.

Elements from @list are serialized, shipped to remote stryke --remote-worker processes over SSH, executed in parallel across every worker slot in the cluster, and the results are gathered back in input order. This is the distributed equivalent of pmap: same interface, same order guarantee, but the thread pool spans multiple hosts instead of local cores. Use this when a single machine's CPU count is the bottleneck. The block must be self-contained — it cannot close over local file handles or database connections, since it executes in a separate process on a remote host. Large closures are serialized once and cached on each worker for the lifetime of the cluster.

my $cl = cluster(["host1:8", "host2:8"])
my @hashes = pmap_on $cl, { sha256(slurp) } @file_paths
my @results = pmap_on $cl, { fetch("https://api.example.com/$_") } 1:10_000

# pflat_map_on

Distributed parallel flat-map over cluster.

# ssh

ssh($host, $command) — execute a shell command on a remote host via SSH and return its stdout as a string.

This is a simple synchronous wrapper around an SSH invocation. The command is run in the remote user's default shell, and stdout is captured and returned. If the remote command exits non-zero, stryke dies with the stderr output. For bulk remote work, prefer cluster + pmap_on which manages connection pooling and parallelism automatically. ssh is best for one-off administrative commands, health checks, or bootstrapping a remote environment before building a cluster.

my $uptime = ssh("server1", "uptime")
p ssh("deploy@prod", "cat /etc/hostname")
my $free = ssh("gpu-box", "nvidia-smi --query-gpu=memory.free --format=csv,noheader")

Datetime

15 topics

# datetime_utc

Return the current UTC date and time as an ISO 8601 string (e.g. 2026-04-15T12:30:00Z). This is the simplest way to get a portable, unambiguous timestamp for logging, file naming, or serialization. The returned string always ends with Z indicating UTC, so there is no timezone ambiguity.

my $now = datetime_utc()
p $now                          # 2026-04-15T12:30:00Z
af("audit.log", "$now: started\n")
my %event = (ts => datetime_utc(), action => "deploy")
wj("event.json", \%event)

# datetime_from_epoch

Convert a Unix epoch timestamp (seconds since 1970-01-01 00:00:00 UTC) into an ISO 8601 datetime string. This is useful when you have raw epoch values from time(), file modification times, or external APIs and need a human-readable representation. Fractional seconds are truncated.

my $ts = 1700000000
p datetime_from_epoch($ts)       # 2023-11-14T22:13:20Z
my $born = datetime_from_epoch(0)
p $born                          # 1970-01-01T00:00:00Z
my @epochs = (1e9, 1.5e9, 2e9)
@epochs |> e { p datetime_from_epoch }

# datetime_strftime

Format an epoch timestamp using a strftime-style format string, giving full control over the output representation. The first argument is the format pattern and the second is the epoch value. Supports all standard specifiers: %Y (4-digit year), %m (month), %d (day), %H (hour), %M (minute), %S (second), %A (weekday name), and more.

my $t = time()
p datetime_strftime("%Y-%m-%d", $t)        # 2026-04-15
p datetime_strftime("%H:%M:%S", $t)        # 14:23:07
p datetime_strftime("%A, %B %d", $t)       # Wednesday, April 15
my $log_ts = datetime_strftime("%Y%m%d_%H%M%S", $t)
to_file("backup_$log_ts.sql", $data)

# datetime_now_tz

Return the current date and time in a specified IANA timezone as a formatted string. Pass a timezone name like America/New_York, Europe/London, or Asia/Tokyo. This avoids manual UTC-offset arithmetic and handles daylight saving transitions correctly. Dies if the timezone name is not recognized.

p datetime_now_tz("America/New_York")    # 2026-04-15 08:30:00 EDT
p datetime_now_tz("Asia/Tokyo")           # 2026-04-15 21:30:00 JST
p datetime_now_tz("UTC")                  # same as datetime_utc
my @offices = ("US/Pacific", "Europe/Berlin", "Asia/Kolkata")
@offices |> e { p "_: " . datetime_now_tz }

# datetime_format_tz

Format an epoch timestamp in a specific IANA timezone, combining the capabilities of datetime_strftime and datetime_now_tz. This lets you render a historical or future timestamp as it would appear on the wall clock in any timezone. Handles DST transitions automatically.

my $epoch = 1700000000
p datetime_format_tz($epoch, "America/Chicago")
# 2023-11-14 16:13:20 CST
p datetime_format_tz($epoch, "Europe/London")
# 2023-11-14 22:13:20 GMT
p datetime_format_tz(time(), "Australia/Sydney")

# datetime_parse_local

Parse a local datetime string (without timezone info) into a Unix epoch timestamp, interpreting it in the system's local timezone. Accepts common formats like 2026-04-15 14:30:00 or 2026-04-15T14:30:00. Dies if the string cannot be parsed. This is the inverse of formatting with localtime.

my $epoch = datetime_parse_local("2026-04-15 14:30:00")
p $epoch                          # Unix timestamp
p datetime_from_epoch($epoch)     # back to ISO 8601
my $midnight = datetime_parse_local("2026-01-01 00:00:00")
p time() - $midnight              # seconds since New Year

# datetime_parse_rfc3339

Parse an RFC 3339 / ISO 8601 datetime string (with timezone offset or Z suffix) into a Unix epoch timestamp. This is the standard format used by JSON APIs, RSS feeds, and git timestamps. Accepts strings like 2026-04-15T14:30:00Z or 2026-04-15T14:30:00+05:30. Dies on malformed input.

my $epoch = datetime_parse_rfc3339("2026-04-15T12:00:00Z")
p $epoch
my $with_tz = datetime_parse_rfc3339("2026-04-15T08:00:00-04:00")
p $epoch == $with_tz              # 1 (same instant)
# parse API response timestamps
my $created = $response->{created_at}
my $age = time() - datetime_parse_rfc3339($created)
p "created ${age}s ago"

# datetime_add_seconds

Add (or subtract) a number of seconds to an ISO 8601 datetime string and return the resulting ISO 8601 string. This performs calendar-aware arithmetic, correctly crossing day, month, and year boundaries. Pass a negative number to subtract time. Useful for computing deadlines, expiration times, or time windows.

my $now = datetime_utc()
my $later = datetime_add_seconds($now, 3600)     # +1 hour
p $later
my $yesterday = datetime_add_seconds($now, -86400) # -1 day
p $yesterday
my $deadline = datetime_add_seconds($now, 7 * 86400) # +1 week
p "due by $deadline"

# elapsed

Return the number of seconds elapsed since the stryke process started, using a monotonic clock that is immune to system clock adjustments. The short alias el keeps benchmarking one-liners terse. Returns a floating-point value with sub-millisecond precision. Useful for timing operations, profiling hot loops, or adding relative timestamps to log output.

my $t0 = el()
my @sorted = sort @big_array
my $dur = el() - $t0
p "sort took ${dur}s"
# progress logging
1:100 |> e { do_work
    log_info("step $_ at " . el() . "s") }

# time

Return the current Unix epoch as an integer — the number of seconds since 1970-01-01 00:00:00 UTC. This is the standard wall-clock timestamp used for file times, database records, and interop with external systems. For monotonic timing of code sections, prefer elapsed/el instead since time can jump if the system clock is adjusted.

my $start = time()
sleep(2)
p time() - $start   # ~2
my $ts = time()
wj("stamp.json", { created => $ts })
p datetime_from_epoch($ts)  # human-readable form

# times

Return the accumulated CPU times for the process as a four-element list: ($user, $system, $child_user, $child_system). User time is CPU spent executing your code; system time is CPU spent in kernel calls on your behalf. Child times cover subprocesses. Values are in seconds (floating point). Useful for profiling whether a script is CPU-bound or I/O-bound.

my ($u, $s, $cu, $cs) = times()
p "user=${u}s sys=${s}s"
# after heavy computation
my ($u2, $s2) = times()
p "used " . ($u2 - $u) . "s of CPU"
p "total CPU: " . ($u2 + $s2) . "s"

# localtime

Convert a Unix epoch timestamp to a nine-element list of broken-down local time components: ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst). Follows the Perl convention where $mon is 0-based (January=0) and $year is years since 1900. When called without arguments, uses the current time. Use gmtime for the UTC equivalent.

my @t = localtime(time())
p "$t[2]:$t[1]:$t[0]"                 # HH:MM:SS
my $year = $t[5] + 1900
my $mon  = $t[4] + 1
p "$year-$mon-$t[3]"                   # YYYY-M-D
my @days = qw(Sun Mon Tue Wed Thu Fri Sat)
p $days[$t[6]]                          # day of week

# gmtime

Convert a Unix epoch timestamp to a nine-element list of broken-down UTC time components, identical in structure to localtime but always in the UTC timezone. The fields are ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) where $isdst is always 0. When called without arguments, uses the current time.

my @utc = gmtime(time())
my $year = $utc[5] + 1900
my $mon  = $utc[4] + 1
p sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
    $year, $mon, @utc[3,2,1,0])
# compare local vs UTC
my @loc = localtime(time())
p "UTC hour=$utc[2] local hour=$loc[2]"

# sleep

Pause execution for the specified number of seconds. Accepts both integer and fractional values for sub-second sleeps (e.g. sleep 0.1 for 100ms). The process yields the CPU during the sleep, so it is safe to use in polling loops without burning cycles. Returns the unslept time (always 0 unless interrupted by a signal).

p "waiting..."
sleep(2)
p "done"
# polling loop
while (!-e "done.flag") {
    sleep(0.5)
}
# rate limiting
my @urls = @targets
@urls |> e { fetch
    sleep(0.1) }

# alarm

Schedule a SIGALRM signal to be delivered to the process after the specified number of seconds. Calling alarm(0) cancels any pending alarm. Only one alarm can be active at a time — setting a new alarm replaces the previous one. Returns the number of seconds remaining on the previous alarm (or 0 if none was set). Combine with eval and $SIG{ALRM} to implement timeouts around potentially hanging operations.

eval {
    local $SIG{ALRM} = fn { die "timeout\n" }
    alarm(5)           # 5 second deadline
    my $data = slow_network_call()
    alarm(0)           # cancel on success
}
if ($@ =~ /timeout/) {
    log_error("operation timed out")
}

Math

13 topics

# abs

Return the absolute value of a number, stripping any negative sign. Returns the argument unchanged if it is already non-negative. Works on both integers and floating-point numbers.

p abs(-42)       # 42
p abs(3.14)      # 3.14
my $diff = abs($a - $b)
p "distance: $diff"
1:5 |> map { _ - 3 } |> map abs |> e p  # 2 1 0 1 2

# int

Truncate a floating-point number toward zero, discarding the fractional part. This is not rounding — int(1.9) is 1 and int(-1.9) is -1. Use sprintf("%.0f", $n) or POSIX::round for proper rounding. Commonly paired with rand to generate random integers.

p int(3.7)       # 3
p int(-3.7)      # -3
p int(rand(6)) + 1  # dice roll 1:6
1:10 |> map { _ / 3 } |> map int |> e p

# sqrt

Return the square root of a non-negative number. Dies if the argument is negative — use abs first or check the sign. For the inverse operation, use squared/sq or the ** operator.

p sqrt(144)         # 12
p sqrt(2)           # 1.41421356...
my $hyp = sqrt($a**2 + $b**2)  # Pythagorean theorem
1:5 |> map sqrt |> e { p sprintf("%.3f", _) }

# squared

Return the square of a number (N * N). This is a stryke convenience function — clearer than writing $n ** 2 or $n * $n in pipelines. The aliases sq and square are interchangeable.

p squared(5)        # 25
p sq(12)            # 144
1:5 |> map sq |> e p    # 1 4 9 16 25
my $hyp = sqrt(sq($a) + sq($b))  # Pythagorean theorem

# cubed

Return the cube of a number (N * N * N). This is a stryke convenience function for the common $n ** 3 operation, useful in math-heavy pipelines. The aliases cb and cube are interchangeable.

p cubed(3)          # 27
p cb(10)            # 1000
1:4 |> map cb |> e p  # 1 8 27 64
my $vol = cb($side)             # volume of a cube

# expt

Raise a base to an arbitrary exponent and return the result. This is the function form of the ** operator. Accepts integer and floating-point exponents, including negative values for reciprocals and fractional values for roots.

p expt(2, 10)       # 1024
p expt(27, 1/3)     # 3.0 (cube root)
p expt(10, -2)      # 0.01
1:8 |> map { expt(2, _) } |> e p  # 2 4 8 16 32 64 128 256

# exp

Return Euler's number *e* raised to the given power. exp(0) is 1, exp(1) is approximately 2.71828. This is the inverse of log. Useful for exponential growth/decay calculations, probability distributions, and converting between logarithmic and linear scales.

p exp(1)            # 2.71828182845905
p exp(0)            # 1
my $growth = $initial * exp($rate * $time)
1:5 |> map exp |> e { p sprintf("%.4f", _) }

# log

Return the natural (base-*e*) logarithm of a positive number. Dies if the argument is zero or negative. For base-10 logarithms, divide by log(10). For base-2, divide by log(2). This is the inverse of exp.

p log(exp(1))       # 1.0
p log(100) / log(10)  # 2.0 (log base 10)
my $bits = log($n) / log(2)  # log base 2
1:5 |> map log |> e { p sprintf("%.3f", _) }

# sin

Return the sine of an angle given in radians. The result ranges from -1 to 1. For degrees, convert first: sin($deg * 3.14159265 / 180). Use atan2 to go in the reverse direction.

p sin(0)               # 0
p sin(3.14159265 / 2)  # 1.0
my @wave = map { sin(_ * 0.1) } 0:62
@wave |> e { p sprintf("%6.3f", _) }

# cos

Return the cosine of an angle given in radians. The result ranges from -1 to 1. cos(0) is 1. Like sin, convert degrees to radians before calling.

p cos(0)                 # 1
p cos(3.14159265)        # -1.0
my $x = $radius * cos($theta)
my $y = $radius * sin($theta)
p "($x, $y)"

# atan2

Return the arctangent of Y/X in radians, using the signs of both arguments to determine the correct quadrant. The result ranges from -pi to pi. This is the standard way to compute angles from Cartesian coordinates and is more robust than atan(Y/X) because it handles X=0 correctly.

my $pi = atan2(0, -1)       # 3.14159265...
p atan2(1, 1)               # 0.785... (pi/4)
my $angle = atan2($dy, $dx)
p sprintf("%.1f degrees", $angle * 180 / $pi)

# rand

Return a pseudo-random floating-point number in the range [0, N). If N is omitted it defaults to 1. The result is never exactly equal to N. For integer results, combine with int. Seed the generator with srand for reproducible sequences.

p rand()                # e.g. 0.7342...
p int(rand(100))        # random int 0:99
my @deck = 1:52
my @shuffled = sort { rand() <=> rand() } @deck  # poor shuffle
my $coin = rand() < 0.5 ? "heads" : "tails"
p $coin

# srand

Seed the pseudo-random number generator used by rand. Calling srand with a specific value produces a reproducible sequence, which is useful for testing. Without arguments, Perl seeds from a platform-specific entropy source. You rarely need to call this explicitly — Perl auto-seeds on first use of rand.

srand(42)                   # reproducible sequence
p int(rand(100))            # always the same value
srand(42)
p int(rand(100))            # same value again
srand()                     # re-seed from entropy

File System

34 topics

# basename

Extract the filename component from a path, stripping all leading directory segments. The short alias bn keeps one-liner pipelines terse. If an optional suffix argument is provided, that suffix is also stripped from the result, which is handy for removing extensions.

p basename("/usr/local/bin/stryke")        # stryke
p bn("/tmp/data.csv", ".csv")           # data
"/etc/nginx/nginx.conf" |> bn |> p      # nginx.conf

# dirname

Return the directory portion of a path, stripping the final filename component. The short alias dn mirrors bn. This is a pure string operation — it does not touch the filesystem, so it works on paths that do not exist yet. Useful for deriving output directories from input file paths.

p dirname("/usr/local/bin/stryke")          # /usr/local/bin
p dn("/tmp/data.csv")                   # /tmp
my $dir = dn($0)                        # directory of current script

# fileparse

Split a path into its three logical components: the filename, the directory prefix, and a suffix that matches one of the supplied patterns. This mirrors Perl's File::Basename::fileparse and is the most flexible path decomposition available. When no suffix patterns are given the suffix is empty.

my ($name, $dir, $sfx) = fileparse("/home/user/report.txt", qr/\.txt/)
p "$dir | $name | $sfx"  # /home/user/ | report | .txt
my ($n, $d) = fileparse("./lib/Foo/Bar.pm")
p "$d$n"                 # ./lib/Foo/Bar.pm

# realpath

Resolve a path to its absolute canonical form by following all symbolic links and eliminating . and .. segments. Unlike canonpath, this hits the filesystem and will die if any component does not exist. The short alias rp is convenient in pipelines. Use this when you need a guaranteed unique path for deduplication or comparison.

p realpath(".")                      # /home/user/project
p rp("../sibling")                   # /home/user/sibling
my $canon = rp($0)                  # absolute path of current script
"." |> rp |> p

# canonpath

Clean up a file path by collapsing redundant separators, resolving . and .. segments, and normalizing trailing slashes — all without touching the filesystem. Unlike realpath, this is a purely lexical operation so it works on paths that do not exist. Use it to normalize user-supplied paths before comparison or storage.

p canonpath("/usr/./local/../local/bin/")   # /usr/local/bin
p canonpath("a/b/../c")                     # a/c
my $clean = canonpath($ENV{HOME} . "/./docs/../docs")
p $clean

# getcwd

Return the current working directory as an absolute path string. This calls the underlying OS getcwd function, so it always reflects the real directory even if the process changed directories via chdir. The alias pwd matches the familiar shell command. Often used to save and restore directory context around chdir calls.

my $orig = pwd()
chdir("/tmp")
p pwd()      # /tmp
chdir($orig)
p getcwd()   # back to original

# which

Search the PATH environment variable for the first executable matching the given command name and return its absolute path, or undef if not found. This is the programmatic equivalent of the shell which command. Useful for checking tool availability before calling system or exec.

my $gcc = which("gcc") // die "gcc not found"
p $gcc                       # /usr/bin/gcc
if (which("rg")) {
    system("rg pattern file")
} else {
    system("grep pattern file")
}

# glob

Expand a shell-style glob pattern against the filesystem and return a list of matching paths. Supports *, ?, [abc], {a,b} patterns, and ** for recursive matching. This actually reads the filesystem, unlike glob_match which is a pure string test.

my @scripts = glob("*.pl")
@scripts |> e p
my @all_rs = glob("src/**/*.rs")
p scalar @all_rs              # count of Rust files
my @cfg = glob("/etc/{nginx,apache2}/*.conf")

# glob_match

Test whether a filename or path matches a shell-style glob pattern. Returns true (1) on match, false (empty string) otherwise. Supports *, ?, [abc], and {a,b} patterns. This is a pure string match — it does not read the filesystem, so it works for filtering lists of paths you already have.

p glob_match("*.pl", "script.pl")        # 1
p glob_match("*.pl", "script.py")        # (empty)
my @perl = grep { glob_match("*.{pl,pm}", _) } @files
@perl |> e p

# copy

Copy a file from a source path to a destination path. The destination can be a file path or a directory (in which case the source filename is preserved). Dies on failure. This is the programmatic equivalent of cp and avoids shelling out. Metadata such as permissions is preserved where possible.

copy("src/config.yaml", "/tmp/config.yaml")
copy("report.pdf", "/backup/")
my $tmp = tf()
copy($0, $tmp)  # back up the current script
p slurp($tmp)

# move

Move or rename a file from source to destination. If the source and destination are on the same filesystem this is an atomic rename; otherwise it falls back to copy-then-delete. Dies on failure. The short alias mv mirrors the shell command.

move("draft.txt", "final.txt")         # rename in place
mv("output.csv", "/archive/output.csv") # move across dirs
my $tmp = tf()
spurt($tmp, "data")
mv($tmp, "data.txt")

# rename

Rename a file or directory from an old name to a new name. This is an atomic operation on the same filesystem. If the destination already exists it is silently replaced. Dies on failure. Unlike move/mv, this does not fall back to copy-then-delete across filesystems.

rename("draft.md", "final.md")
rename("output", "output_v2")          # works on dirs too
my $bak = "config.yaml.bak"
rename("config.yaml", $bak)
spurt("config.yaml", $new_config)

# unlink

Delete one or more files from the filesystem. Returns the number of files successfully removed. Does not remove directories — use rmdir for those. Dies on permission errors. Accepts a list of paths, making it convenient for batch cleanup.

unlink("temp.log")
my $n = unlink("a.tmp", "b.tmp", "c.tmp")
p "removed $n files"
my @old = glob("*.bak")
unlink(@old)

# mkdir

Create a directory at the given path. An optional second argument specifies the permission mode as an octal number (default 0777, modified by the current umask). Dies if the directory cannot be created. Only creates one level — use make_path or shell out for recursive creation.

mkdir("output")
mkdir("/tmp/secure", 0700)
my $dir = tdr() . "/sub"
mkdir($dir)
p -d $dir    # 1

# rmdir

Remove an empty directory. Dies if the directory does not exist, is not empty, or cannot be removed due to permissions. This only removes a single directory — it will not recursively delete contents. Remove files with unlink first, then call rmdir.

mkdir("scratch")
rmdir("scratch")
p -d "scratch"   # (empty, dir is gone)
unlink("tmp/file.txt")
rmdir("tmp")

# chmod

Change the permission bits of one or more files. The mode is specified as an octal number. Returns the number of files successfully changed. Does not follow symlinks on some platforms. Use stat to read the current mode before modifying.

chmod(0755, "script.pl")
chmod(0644, "config.yaml", "data.json")
my $n = chmod(0600, glob("*.key"))
p "secured $n key files"

# chown

Change the owner and group of one or more files, specified as numeric UID and GID. Pass -1 for either to leave it unchanged. Returns the number of files successfully changed. Typically requires root privileges.

chown(1000, 1000, "app.log")
chown(-1, 100, "shared.txt")     # change group only
my $uid = (getpwnam("deploy"))[2]
chown($uid, -1, "release.tar")

# chdir

Change the current working directory of the process. Dies if the directory does not exist or is not accessible. This affects all subsequent relative path operations. Pair with getcwd/pwd to save and restore the original directory.

my $orig = pwd()
chdir("/tmp")
spurt("scratch.txt", "hello")
chdir($orig)                  # return to original

# stat

Return a 13-element list of file status information for a path or filehandle: ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks). This calls the POSIX stat system call. Use it to check file size, modification time, permissions, and other metadata without reading the file.

my @st = stat("data.bin")
p "size: $st[7] bytes"
p "modified: " . datetime_from_epoch($st[9])
my ($mode) = (stat($0))[2]
p sprintf("perms: %04o", $mode & 07777)

# link

Create a hard link — a new directory entry pointing to the same underlying inode as the original file. Both names are indistinguishable and share the same data; removing one does not affect the other. Hard links cannot cross filesystem boundaries and typically cannot link directories.

link("data.csv", "data_backup.csv")
my @st1 = stat("data.csv")
my @st2 = stat("data_backup.csv")
p $st1[1] == $st2[1]   # 1 — same inode

# symlink

Create a symbolic (soft) link that points to a target path. Unlike hard links, symlinks can cross filesystems and can point to directories. The link stores the target as a string, so it can dangle if the target is later removed. Use readlink to inspect where a symlink points.

symlink("/usr/local/bin/stryke", "pe_link")
p readlink("pe_link")       # /usr/local/bin/stryke
p -l "pe_link"              # 1 (is a symlink)
symlink("../lib", "lib_link")  # relative target

# readlink

Return the target path that a symbolic link points to, without following the link further. Returns undef if the path is not a symlink. This is useful for inspecting symlink chains, verifying link targets, or resolving one level of indirection at a time.

symlink("real.conf", "link.conf")
my $target = readlink("link.conf")
p $target                    # real.conf
if (defined readlink($path)) {
    p "$path is a symlink"
}

# utime

Set the access time and modification time of one or more files. Times are specified as epoch seconds. Pass undef for either time to set it to the current time. Returns the number of files successfully updated. Useful for cache invalidation, build systems, or preserving timestamps after transformations.

utime(time(), time(), "output.txt")     # touch to now
my $epoch = 1700000000
utime($epoch, $epoch, @files)           # backdate files
utime(undef, undef, "marker.flag")      # equivalent of touch

# umask

Get or set the file creation mask, which controls the default permissions for newly created files and directories. When called with an argument, sets the new mask and returns the previous one. When called without arguments, returns the current mask. The mask is subtracted from the requested permissions in mkdir, open, etc.

my $old = umask(0077)         # restrict: owner-only
mkdir("private")               # created with 0700
umask($old)                    # restore previous mask
p sprintf("%04o", umask())     # print current mask

# uname

Return system identification as a five-element list: ($sysname, $nodename, $release, $version, $machine). This calls the POSIX uname system call and is useful for platform-specific logic, logging system info, or generating diagnostic reports without shelling out.

my ($sys, $node, $rel, $ver, $arch) = uname()
p "$sys $rel ($arch)"           # Linux 6.1.0 (x86_64)
if ($sys eq "Darwin") {
    p "running on macOS"
}
log_info("host: $node, kernel: $rel")

# gethostname

Return the hostname of the current machine as a string. This calls the POSIX gethostname system call. The short alias hn is useful in log prefixes, temp-file naming, or distributed-system identifiers where you need to tag output by machine.

p gethostname()                          # myhost.local
my $log_prefix = hn() . ":" . $$        # myhost.local:12345
log_info("running on " . hn())

# opendir

Open a directory handle for reading its entries. Returns a directory handle that can be passed to readdir, seekdir, telldir, rewinddir, and closedir. Dies if the directory does not exist or cannot be opened. For most use cases glob or readdir with a path is simpler.

opendir(my $dh, "/tmp") or die "cannot open: $!"
my @entries = readdir($dh)
closedir($dh)
@entries |> grep { _ !~ /^\./ } |> e p  # skip dotfiles

# readdir

Read entries from a directory handle opened with opendir. In list context, returns all remaining entries. In scalar context, returns the next single entry or undef when exhausted. Entries include . and .. so you typically filter them out.

opendir(my $dh, ".") or die $!
while (my $entry = readdir($dh)) {
    next if $entry =~ /^\./
    p $entry
}
closedir($dh)

# closedir

Close a directory handle previously opened with opendir, releasing the underlying OS resource. While directory handles are closed automatically when they go out of scope, explicit closedir is good practice in long-running programs or loops that open many directories.

opendir(my $dh, "/var/log") or die $!
my @logs = readdir($dh)
closedir($dh)
@logs |> grep { /\.log$/ } |> e p

# seekdir

Set the current position in a directory handle to a location previously obtained from telldir. This allows you to revisit directory entries without closing and reopening the handle. Rarely needed in practice, but useful for multi-pass directory scanning.

opendir(my $dh, ".") or die $!
my $pos = telldir($dh)
my @first_pass = readdir($dh)
seekdir($dh, $pos)              # rewind to saved position
my @second_pass = readdir($dh)
closedir($dh)

# telldir

Return the current read position within a directory handle as an opaque integer. The returned value can be passed to seekdir to return to that position later. This is the directory-handle equivalent of tell for file handles.

opendir(my $dh, "/tmp") or die $!
readdir($dh)                  # skip .
readdir($dh)                  # skip ..
my $pos = telldir($dh)        # save position after . and ..
my @real = readdir($dh)
seekdir($dh, $pos)            # go back

# rewinddir

Reset a directory handle back to the beginning so that the next readdir returns the first entry again. This is equivalent to closing and reopening the directory but more efficient. Useful when you need to iterate a directory multiple times.

opendir(my $dh, "src") or die $!
my $count = scalar readdir($dh)
rewinddir($dh)
my @entries = readdir($dh)
closedir($dh)
p "$count entries"

# du

du (alias dir_size) — compute the total size of a directory tree in bytes, recursively walking all files.

my $bytes = du("/usr/local")
p "$bytes bytes"

# du_tree

du_tree (alias dir_sizes) — return directory sizes as an array of hashrefs {path, size}, sorted descending by size. Each entry is an immediate child directory.

my @dirs = du_tree("/usr/local")
for (@dirs) { p "_->{path}: _->{size}" }

Process

21 topics

# system

Execute a command in a subshell and wait for it to complete, returning the exit status. A return value of 0 means success; non-zero indicates failure. The exit status is encoded as $? >> 8 for the actual exit code. Use backticks or capture if you need the command's output.

my $rc = system("make", "test")
p "exit code: " . ($rc >> 8)
system("cp data.csv /backup/") == 0 or die "copy failed"
if (system("which rg >/dev/null 2>&1") == 0) {
    p "ripgrep is installed"
}

# exec

Replace the current process image entirely with a new command. This never returns on success — the new program takes over. If exec fails (command not found, permission denied) it returns false and execution continues. Use system instead if you want to run a command and keep the current process alive.

exec("ls", "-la", "/tmp") or die "exec failed: $!"
# code here only runs if exec fails

# common fork+exec pattern
if (fork() == 0) {
    exec("worker", "--daemon")
}

# exe

exe (alias executables) — list executable file names in a directory (default: current directory). Returns a sorted array of filenames that have the executable bit set. On non-Unix platforms, matches files with .exe, .bat, or .cmd extensions.

p for exe                    # list executables in $PWD
p for exe("/usr/local/bin")  # list executables in a specific dir
exe |> grep /^s/ |> e p     # executables starting with 's'

# fork

Fork the current process, creating a child that is an exact copy of the parent. Returns the child's PID to the parent process and 0 to the child, allowing each side to branch. Returns undef on failure. Always pair with wait/waitpid to reap the child and avoid zombies.

my $pid = fork()
if ($pid == 0) {
    p "child $$"
    exit(0)
}
p "parent $$, child is $pid"
waitpid($pid, 0)

# wait

Wait for any child process to terminate and return its PID. The exit status is stored in $?. If there are no child processes, returns -1. This is the simplest reaping function — use waitpid when you need to wait for a specific child or use non-blocking flags.

for (1:3) {
    fork() or do { sleep(1)
    exit(0) }
}
while ((my $pid = wait()) != -1) {
    p "child $pid exited with " . ($? >> 8)
}

# waitpid

Wait for a specific child process identified by PID to change state. The flags argument controls behavior — use 0 for blocking wait, or WNOHANG for non-blocking (returns 0 if child is still running). Returns the PID on success, -1 if the child does not exist. Exit status is in $?.

my $pid = fork() // die "fork: $!"
if ($pid == 0) { sleep(2)
    exit(42) }
waitpid($pid, 0)
p "child exited: " . ($? >> 8)   # 42

# non-blocking poll
while (waitpid($pid, WNOHANG) == 0) {
    p "still running..."
    sleep(1)
}

# kill

Send a signal to one or more processes by PID. The signal can be specified as a number (9) or a name ("TERM"). Sending signal 0 tests whether the process exists without actually sending anything. Returns the number of processes successfully signaled.

kill("TERM", $child_pid)
kill(9, @worker_pids)                # SIGKILL
if (kill(0, $pid)) {
    p "process $pid is alive"
}
my $n = kill("HUP", @daemons)
p "signaled $n processes"

# exit

Terminate the program immediately with the given exit status code. An exit code of 0 conventionally means success; any non-zero value indicates an error. END blocks and object destructors are still run. Use POSIX::_exit to skip cleanup entirely.

exit(0)                 # success
exit(1) if $error       # failure

# conditional exit in a pipeline
my $ok = system("make test")
exit($ok >> 8) if $ok

# getlogin

Return the login name of the user who owns the current terminal session. This reads from the system's utmp/utmpx database and may return undef for processes without a controlling terminal (cron jobs, daemons). For a more reliable alternative, use getpwuid($<) which looks up the effective UID.

my $user = getlogin() // (getpwuid($<))[0]
p "running as $user"
log_info("session started by " . getlogin())

# getpwnam

Look up user account information by username string. Returns the same 9-element list as getpwuid: ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell). Returns empty list if the user does not exist. Useful for resolving a username to a UID before calling chown.

my @info = getpwnam("deploy")
p "uid=$info[2] home=$info[7]"
my $uid = (getpwnam("www-data"))[2]
chown($uid, -1, "public/index.html")

# getpwuid

Look up user account information by numeric UID. Returns ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) on success, or empty list if the UID does not exist. This is the reliable way to map a UID to a username and home directory.

my ($name, undef, undef, undef, undef, undef, undef, $home) = getpwuid($<)
p "user: $name, home: $home"
my $root_shell = (getpwuid(0))[8]
p $root_shell   # /bin/bash or /bin/zsh

# getpwent

Read the next entry from the system password database, iterating through all user accounts. Returns ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) for each user, or empty list when exhausted. Call setpwent to rewind and endpwent to close.

while (my @pw = getpwent()) {
    p "$pw[0]: uid=$pw[2] home=$pw[7]"
}
endpwent()

# getgrgid

Look up group information by numeric GID. Returns ($name, $passwd, $gid, $members) where members is a space-separated string of usernames belonging to the group. Returns empty list if the GID does not exist.

my ($name, undef, undef, $members) = getgrgid(0)
p "group $name: $members"
my $gname = (getgrgid((stat("file.txt"))[5]))[0]
p "file group: $gname"

# getgrnam

Look up group information by group name string. Returns ($name, $passwd, $gid, $members). Useful for resolving a group name to a GID before calling chown, or for checking group membership.

my ($name, undef, $gid, $members) = getgrnam("staff")
p "gid=$gid members=$members"
chown(-1, $gid, "shared_dir")
if ((getgrnam("admin"))[3] =~ /\b$user\b/) {
    p "$user is an admin"
}

# getgrent

Read the next entry from the system group database, iterating through all groups. Returns ($name, $passwd, $gid, $members) for each group, or empty list when exhausted. The members field is a space-separated string of usernames. Call endgrent when done.

while (my @gr = getgrent()) {
    p "$gr[0]: gid=$gr[2] members=$gr[3]"
}
endgrent()

# getppid

Return the process ID of the parent process. This is useful for detecting whether the process has been orphaned (parent PID becomes 1 on Unix when the original parent exits), or for logging the process hierarchy. Always returns a valid PID.

p "my pid: $$, parent: " . getppid()
if (getppid() == 1) {
    log_warn("parent process has exited, we are orphaned")
}

# getpgrp

Return the process group ID of the current process (or of the specified PID). Processes in the same group receive signals together — for example, Ctrl-C sends SIGINT to the entire foreground process group. Use setpgrp to move a process into a different group.

p "process group: " . getpgrp()
my $pg = getpgrp($$)
p $pg == $$ ? "group leader" : "group member"

# setpgrp

Set the process group ID of a process. Call setpgrp(0, 0) to make the current process a new group leader, which is useful for daemonization or isolating a subprocess from the terminal's signal group. Takes (PID, PGID) — use 0 for the current process.

setpgrp(0, 0)   # become process group leader
if (fork() == 0) {
    setpgrp(0, 0)  # child gets its own group
    exec("worker")
}

# getpriority

Get the scheduling priority (nice value) of a process, process group, or user. The which argument selects the target type: PRIO_PROCESS, PRIO_PGRP, or PRIO_USER. Lower values mean higher priority. The default nice value is 0; range is typically -20 to 19.

my $nice = getpriority(0, $$)    # PRIO_PROCESS, current PID
p "nice value: $nice"
my $user_prio = getpriority(2, $<)  # PRIO_USER, current user
p "user priority: $user_prio"

# setpriority

Set the scheduling priority (nice value) of a process, process group, or user. Lowering the nice value (higher priority) typically requires root privileges. Raising it (lower priority) is always allowed. Use this to deprioritize background batch work or boost latency-sensitive tasks.

setpriority(0, $$, 10)   # lower priority for batch work
if (fork() == 0) {
    setpriority(0, 0, 19)  # lowest priority for child
    exec("batch-job")
}

# syscall

Invoke a raw system call by its numeric identifier, passing arguments directly to the kernel. This is an escape hatch for system calls that have no Perl wrapper. The call number is platform-specific and the arguments must be correctly typed (integers or string buffers). Use with caution — incorrect arguments can crash the process.

# SYS_getpid on Linux x86_64 is 39
my $pid = syscall(39)
p $pid                     # same as $$
# SYS_sync on Linux is 162
syscall(162)               # flush filesystem caches

# process_list

process_list (aliases ps, procs) — list running processes as an array of hashrefs with {pid, name, uid} keys.

my @procs = ps()
for (@procs) { p "_->{pid} _->{name}" }

Pack / Binary

3 topics

# pack

Convert a list of values into a binary string according to a template. Each template character specifies how one value is encoded: N for 32-bit big-endian unsigned, n for 16-bit, a for raw bytes, Z for null-terminated string, etc. This is essential for constructing binary protocols, file formats, and sockaddr structures.

my $bin = pack("NnA4", 0xDEADBEEF, 8080, "test")
p length($bin)                # 10 bytes
my $header = pack("A8 N N", "MAGIC01\0", 1, 42)
spurt("data.bin", $header)

# unpack

Decode a binary string into a list of values according to a template, performing the inverse of pack. The template characters must match how the data was packed. Use this for parsing binary file formats, network protocol headers, or any structured binary data.

my ($magic, $version, $count) = unpack("A8 N N", $header)
p "v$version, $count records"
my ($port, $addr) = unpack("n a4", $sockaddr)
p inet_ntoa($addr) . ":$port"

# vec

Treat a string as a bit vector and get or set individual elements at a specified bit width. The first argument is the string, the second is the element offset, and the third is the bit width (1, 2, 4, 8, 16, or 32). As an lvalue, vec modifies the string in place. Useful for compact boolean arrays and bitmap manipulation.

my $bits = ""
vec($bits, 0, 1) = 1   # set bit 0
vec($bits, 7, 1) = 1   # set bit 7
p vec($bits, 0, 1)     # 1
p vec($bits, 3, 1)     # 0
p unpack("B8", $bits)  # 10000001

Logging

7 topics

# log_info

Log a message at INFO level to stderr with a timestamp prefix. INFO is the default visible level and is appropriate for normal operational messages — startup notices, progress milestones, summary statistics. Messages are suppressed if the current log level is set higher than INFO.

log_info("server started on port $port")
my @rows = rl("data.csv")
log_info("loaded " . scalar(@rows) . " rows")
1:5 |> e { log_info("processing item _") }

# log_warn

Log a message at WARN level to stderr. Warnings indicate unexpected but recoverable situations — missing optional config, deprecated usage, slow operations. WARN messages appear at the default log level and are visually distinct from INFO in structured log output.

log_warn("config file not found, using defaults")
log_warn("query took ${elapsed}s, exceeds threshold")
unless (-e $path) {
    log_warn("$path missing, skipping")
}

# log_error

Log a message at ERROR level to stderr. Use this for failures that prevent an operation from completing but do not necessarily terminate the program — failed network requests, invalid input, permission errors. ERROR is always visible regardless of log level.

log_error("failed to connect to $host: $!")
eval { rj("bad.json") }
log_error("parse failed: $@") if $@
log_error("missing required field 'name'")

# log_debug

Log a message at DEBUG level to stderr. Debug messages are hidden by default and only appear when the log level is lowered to DEBUG or TRACE via log_level. Use for detailed internal state that helps during development — variable dumps, branch decisions, intermediate values.

log_level("debug")
log_debug("cache key: $key")
my $result = compute($x)
log_debug("compute($x) => $result")
@items |> e { log_debug("item: $_") }

# log_trace

Log a message at TRACE level to stderr. This is the most verbose level, producing very fine-grained output — loop iterations, function entry/exit, raw payloads. Only visible when log_level("trace") is set. Use sparingly in production code; primarily for deep debugging sessions.

log_level("trace")
fn process($x) {
    log_trace("entering process($x)")
    my $r = $x * 2
    log_trace("leaving process => $r")
    $r
}
1:3 |> map process |> e p

# log_json

Emit a structured JSON log line to stderr containing the message plus any additional key-value metadata. This is designed for machine-parseable logging pipelines — centralized log collectors, JSON-based monitoring, or jq-friendly output. Each call emits exactly one JSON object per line.

log_json("request", method => "GET", path => "/api")
log_json("metric", name => "latency_ms", value => 42)
log_json("error", msg => $@, file => $0)$1

Note: all values are serialized as JSON strings.

# log_level

Get or set the current minimum log level. When called with no arguments, returns the current level as a string. When called with a level name, sets it for all subsequent log calls. Valid levels from most to least verbose: trace, debug, info, warn, error. The default level is info.

p log_level()         # info
log_level("debug")    # enable debug output
log_debug("now visible")
log_level("error")    # suppress everything below error
log_info("hidden")    # not printed

Charts (SVG)

19 topics

# scatter_svg

scatter_svg (alias scatter_plot) — generate an SVG scatter plot. Args: xs, ys [, title]. Dark theme, auto-scaled axes.

scatter_svg([1,2,3,4], [1,4,9,16], "Squares") |> to_file("scatter.svg")

# line_svg

line_svg (alias line_plot) — generate an SVG line plot. Args: xs, ys [, title].

my @x = map { _ * 0.1 } 0:100
my @y = map { sin(_) } @x
line_svg(\@x, \@y, "Sine") |> to_file("sine.svg")

# plot_svg

plot_svg — SVG line plot with auto X axis (0..n-1). Args: ys [, title].

plot_svg([map { _ ** 2 } 0:50], "Parabola") |> to_file("plot.svg")

# hist_svg

hist_svg (alias histogram_svg) — SVG histogram with auto-binning (sqrt rule). Args: data [, bins, title].

rnorm(1000) |> hist_svg(30, "Normal") |> to_file("hist.svg")

# boxplot_svg

boxplot_svg (alias box_plot) — SVG box-and-whisker plot with IQR whiskers and outlier detection. Args: groups [, title]. Groups is array of arrays.

boxplot_svg([[1,2,3,4,5], [3,4,5,6,20]], "Compare") |> to_file("box.svg")

# bar_svg

bar_svg (alias barchart_svg) — SVG bar chart with labeled bars and value annotations. Args: labels, values [, title].

bar_svg(["Rust","Go","C++"], [45,30,25], "Languages") |> to_file("bar.svg")

# pie_svg

pie_svg (alias pie_chart) — SVG pie chart with percentage labels. Args: labels, values [, title].

pie_svg(["A","B","C"], [50,30,20]) |> to_file("pie.svg")

# heatmap_svg

heatmap_svg (alias heatmap) — SVG heatmap with blue-cyan-yellow-red colormap. Args: matrix [, title].

heatmap_svg(cor_mat($data), "Correlation") |> to_file("heat.svg")

# donut_svg

donut_svg (alias donut) — SVG donut chart with percentage labels. Accepts labels+values or a hashref.

donut_svg(["A","B","C"], [50,30,20], "Share") |> to_file("donut.svg")
{Rust => 45, Go => 30} |> donut("Languages") |> to_file("donut.svg")

# area_svg

area_svg (alias area_chart) — SVG filled area chart. Args: xs, ys [, title].

my @x = 0:20
my @y = map { sin(_ * 0.3) } @x
area_svg(\@x, \@y, "Wave") |> to_file("area.svg")

# hbar_svg

hbar_svg (alias hbar) — SVG horizontal bar chart. Accepts labels+values or a hashref.

hbar_svg(["Rust","Go","C++"], [45,30,25], "Speed") |> to_file("hbar.svg")
{alpha => 10, beta => 20} |> hbar |> to_file("hbar.svg")

# radar_svg

radar_svg (aliases radar, spider) — SVG radar/spider chart. Args: labels, values [, title].

radar_svg(["Atk","Def","Spd","HP","MP"], [8,6,9,5,7], "Stats") |> to_file("radar.svg")

# candlestick_svg

candlestick_svg (aliases candlestick, ohlc) — SVG candlestick OHLC chart. Args: array of [open,high,low,close] [, title].

candlestick_svg([[100,110,95,105],[105,115,100,112]], "Stock") |> to_file("ohlc.svg")

# violin_svg

violin_svg (alias violin) — SVG violin plot from array of arrays showing distribution shape.

violin_svg([rnorm(200), rnorm(200, 2)], "Distributions") |> to_file("violin.svg")

# cor_heatmap

cor_heatmap (alias cor_matrix_svg) — SVG correlation matrix heatmap. Computes pairwise correlations and renders as heatmap.

cor_heatmap([rnorm(100), rnorm(100), rnorm(100)], "Correlations") |> to_file("cor.svg")

# stacked_bar_svg

stacked_bar_svg (alias stacked_bar) — SVG stacked bar chart. Args: labels, series (array of arrays) [, title].

stacked_bar_svg(["Q1","Q2","Q3"], [[10,20,30],[5,15,25]], "Revenue") |> to_file("stacked.svg")

# wordcloud_svg

wordcloud_svg (aliases wordcloud, wcloud) — SVG word cloud from frequency hashref. Word size scales with frequency.

{rust => 50, go => 30, python => 40} |> wordcloud("Languages") |> to_file("cloud.svg")

# treemap_svg

treemap_svg (alias treemap) — SVG treemap from frequency hashref. Area proportional to values.

{src => 500, tests => 200, docs => 100} |> treemap("Codebase") |> to_file("tree.svg")

# preview

preview (alias pvw) — wrap SVG/HTML content in a cyberpunk-styled page and open in the default browser.

scatter_svg([1,2,3], [1,4,9]) |> preview
bar_svg(["A","B"], [10,20]) |> pvw

Audio

4 topics

# audio_convert

audio_convert (alias aconv) — convert audio files between WAV, FLAC, AIFF, and MP3 formats.

audio_convert("song.flac", "song.mp3")
aconv("input.wav", "output.mp3")

# audio_info

audio_info (alias ainfo) — get audio file metadata (duration, sample rate, channels, format) as a hashref.

my $info = ainfo("song.mp3")
p $info->{duration}      # seconds
p $info->{sample_rate}   # e.g. 44100

# id3_read

id3_read (alias id3) — read ID3 tags from an MP3 file as a hashref (title, artist, album, year, etc.).

my $tags = id3("song.mp3")
p "$tags->{artist} - $tags->{title}"

# id3_write

id3_write (alias id3w) — write ID3 tags to an MP3 file from a hashref.

id3w("song.mp3", {title => "New Title", artist => "Artist", year => "2026"})

Network Utilities

18 topics

# net_interfaces

net_interfaces (aliases net_ifs, ifconfig) — list all network interfaces with name, IPs, MAC, and status.

my @ifs = net_ifs()
for (@ifs) { p "_->{name}: _->{ipv4}" }

# net_ipv4

net_ipv4 (aliases myip, myip4) — return the first non-loopback IPv4 address as a string.

p myip()   # e.g. 192.168.1.42

# net_ipv6

net_ipv6 (alias myip6) — return the first non-loopback IPv6 address as a string.

p myip6()   # e.g. fe80::1

# net_mac

net_mac (alias mymac) — return the first non-loopback MAC address.

p mymac()   # e.g. aa:bb:cc:dd:ee:ff

# net_public_ip

net_public_ip (aliases pubip, extip) — fetch your public IP address via HTTP.

p pubip()   # e.g. 203.0.113.42

# net_dns

net_dns (aliases dns_resolve, resolve) — resolve a hostname to IP addresses.

my @ips = resolve("github.com")
p @ips

# net_reverse_dns

net_reverse_dns (alias rdns) — reverse DNS lookup via UDP PTR query.

p rdns("8.8.8.8")   # dns.google

# net_ping

net_ping (alias ping) — TCP connect ping to host:port. Returns array of RTT measurements in ms.

my @rtt = ping("google.com", 443, 5)   # 5 pings
p mean(@rtt)

# net_port_open

net_port_open (alias port_open) — check if a TCP port is open on a host. Returns boolean.

p port_open("localhost", 8080)   # 1 or 0

# net_ports_scan

net_ports_scan (aliases port_scan, portscan) — scan a range of TCP ports on a host. Returns list of open ports.

my @open = port_scan("localhost", 80, 443)
p @open   # e.g. 80, 443

# net_latency

net_latency (alias tcplat) — measure TCP connect latency to host:port in milliseconds.

p tcplat("google.com", 443)   # e.g. 12.5

# net_download

net_download (aliases download, wget) — download a URL to a local file via ureq.

wget("https://example.com/data.csv", "data.csv")

# net_headers

net_headers (alias http_headers) — fetch HTTP response headers as a hashref.

my $h = http_headers("https://example.com")
p $h->{"content-type"}

# net_dns_servers

net_dns_servers (alias dns_servers) — return the system's configured DNS server addresses.

my @dns = dns_servers()
p @dns   # e.g. 8.8.8.8, 8.8.4.4

# net_gateway

net_gateway (alias gateway) — return the default gateway IP address.

p gateway()   # e.g. 192.168.1.1

# net_whois

net_whois (alias whois) — WHOIS lookup via raw TCP connection on port 43.

p whois("example.com")

# net_hostname

net_hostname — return the system hostname.

p net_hostname()   # e.g. my-macbook.local

# smtp_send

smtp_send (aliases send_email, email) — send an email via SMTP with TLS. Takes a hashref with to, from, subject, body, and SMTP connection fields.

smtp_send({to => "bob@ex.com", from => "me@ex.com", subject => "Hi",
  body => "Hello!", smtp_host => "smtp.ex.com", smtp_port => 587,
  smtp_user => "me@ex.com", smtp_pass => $pass})

Markup / Web Scraping

4 topics

# html_parse

html_parse (alias parse_html) — parse an HTML string into an array of element hashrefs with tag, text, and attrs.

my @els = html_parse(slurp("page.html"))
for (@els) { p "_->{tag}: _->{text}" }

# css_select

css_select (aliases css, qs, query_selector) — query parsed HTML with a CSS selector. Returns matching elements as hashrefs with tag, text, attrs, and html.

my @links = css_select(slurp("page.html"), "a.nav")
for (@links) { p "_->{tag} _->{attrs}{href}" }

# xml_parse

xml_parse (alias parse_xml) — parse an XML string into a nested hashref tree with tag, text, attrs, and children.

my $root = xml_parse(slurp("data.xml"))
p $root->{tag}
for (@{$root->{children}}) { p _->{text} }

# xpath

xpath (alias xml_select) — query XML with XPath-like expressions (//tag, //tag[@attr='val']). Returns matching nodes as hashrefs.

my @items = xpath(slurp("feed.xml"), "//item")
for (@items) { p _->{text} }

Date Utilities

4 topics

# dateseq

dateseq (alias dseq) — generate a sequence of dates. Args: start, end [, step]. Step defaults to 1 day.

my @days = dseq("2026-01-01", "2026-01-07")
p @days

# dategrep

dategrep (alias dgrep) — filter a list of date strings by a pattern or range.

my @jan = dgrep("2026-01", @dates)

# dateround

dateround (alias dround) — round date strings to a unit (day, hour, month, etc.).

p dround("2026-04-19T14:35:22", "hour")   # 2026-04-19T15:00:00

# datesort

datesort (alias dsort) — sort date strings chronologically.

my @sorted = dsort("2026-03-01", "2026-01-15", "2026-02-10")
p @sorted

Git

10 topics

# git_log

git_log (alias glog) — get the last N commits as an array of hashrefs (hash, author, date, message).

my @commits = glog(10)
for (@commits) { p "_->{hash} _->{message}" }

# git_status

git_status (alias gst) — get working tree status as an array of hashrefs (path, status).

my @st = gst()
for (@st) { p "_->{status} _->{path}" }

# git_diff

git_diff (alias gdiff) — get the current diff as a string.

p gdiff()
gdiff() |> lines |> grep /^\+/ |> e p

# git_branches

git_branches (alias gbr) — list all branches as an array of strings.

my @br = gbr()
p @br

# git_tags

git_tags (alias gtags) — list all tags as an array of strings.

my @tags = gtags()
p @tags

# git_blame

git_blame (alias gblame) — blame a file, returning per-line annotation.

p gblame("src/main.rs")

# git_authors

git_authors (alias gauthors) — list unique authors sorted by commit count as hashrefs.

my @authors = gauthors()
for (@authors) { p "_->{name}: _->{count}" }

# git_files

git_files (alias gfiles) — list all tracked files in the repo.

my @files = gfiles()
p scalar @files   # total tracked files

# git_show

git_show (alias gshow) — show details of a commit (message, diff, author).

p gshow("HEAD")
p gshow("abc1234")

# git_root

git_root (alias groot) — return the repository root path.

p groot()   # e.g. /home/user/project

System

8 topics

# mounts

mounts (aliases disk_mounts, filesystems) — list mounted filesystems with usage (total, used, available).

my @m = mounts()
for (@m) { p "_->{mount}: _->{used}/_->{total}" }

# thread_count

thread_count (alias nthreads) — return the rayon thread pool size.

p nthreads()   # e.g. 8

# pool_info

pool_info (alias par_info) — return thread pool details as a hashref (threads, queued, active).

my $info = par_info()
p $info->{threads}

# par_bench

par_bench (alias pbench) — run a parallel throughput benchmark and return results.

my $result = pbench(1000000)
p $result->{ops_per_sec}

# to_pdf

to_pdf — generate a PDF from text, SVG, or structured data. Returns raw PDF bytes.

"Hello World" |> to_pdf |> to_file("out.pdf")
scatter_svg([1,2,3], [1,4,9]) |> to_pdf |> to_file("plot.pdf")

# pdf_text

pdf_text (aliases pdf_read, pdf_extract) — extract all text content from a PDF file and return it as a string.

my $text = pdf_text("report.pdf")
p $text |> lines |> cnt   # number of lines

# pdf_pages

pdf_pages — return the number of pages in a PDF file.

p pdf_pages("report.pdf")   # e.g. 42

# jq

jq — alias for json_jq. Query JSON data with jq-style expressions.

my $data = json_decode(slurp("data.json"))
p jq($data, ".items[].name")

Testing

15 topics

# assert_eq

assert_eq (alias aeq) — assert that two values are equal as strings. Takes A, B, and an optional message. Fails the test with a diff if A ne B.

assert_eq $got, $expected, "username matches"
aeq length(@arr), 3

# assert_ne

assert_ne (alias ane) — assert that two values are not equal as strings. Takes A, B, and an optional message. Fails if A eq B.

assert_ne $token, "", "token must not be empty"
ane $a, $b

# assert_ok

assert_ok (alias aok) — assert that a value is truthy (defined and non-zero/non-empty). Fails if the value is falsy or undef.

assert_ok $result, "fetch returned data"
aok $user->{active}

# assert_err

assert_err — assert that a value is falsy or undef. The inverse of assert_ok. Useful for verifying error conditions or absent values.

assert_err $deleted_user, "user should be gone"
assert_err 0

# assert_true

assert_true (alias atrue) — alias for assert_ok. Assert that a value is truthy.

assert_true $connected, "should be connected"
atrue $flag

# assert_false

assert_false (alias afalse) — alias for assert_err. Assert that a value is falsy or undef.

assert_false $error, "no error expected"
afalse $disabled

# assert_gt

assert_gt — assert that the first numeric value is strictly greater than the second. Fails with the actual values on mismatch.

assert_gt $elapsed, 0, "elapsed must be positive"
assert_gt scalar(@results), 10

# assert_lt

assert_lt — assert that the first numeric value is strictly less than the second.

assert_lt $latency, 100, "latency under 100ms"
assert_lt $errors, $threshold

# assert_ge

assert_ge — assert that the first numeric value is greater than or equal to the second.

assert_ge $count, 1, "at least one result"
assert_ge $version, 2

# assert_le

assert_le — assert that the first numeric value is less than or equal to the second.

assert_le $memory, $limit, "within memory budget"
assert_le length($buf), 4096

# assert_match

assert_match (alias amatch) — assert that a string matches a regex pattern. Fails with the actual string and pattern on mismatch.

assert_match $email, qr/\@/, "must contain @"
amatch $line, qr/^OK/

# assert_contains

assert_contains (alias acontains) — assert that a string contains a given substring. Fails with both values on mismatch.

assert_contains $html, "<title>", "page has title"
acontains $log, "SUCCESS"

# assert_near

assert_near (alias anear) — assert that two floats are approximately equal within an epsilon tolerance (default 1e-9). Essential for floating-point comparisons.

assert_near 0.1 + 0.2, 0.3, 1e-10, "float add"
anear $pi, 3.14159, 1e-5

# assert_dies

assert_dies (alias adies) — assert that a block throws an error. Passes if the block dies, fails if it returns normally.

assert_dies { die "boom" } "should throw"
adies { 1 / 0 }

# test_run

test_run (alias run_tests) — print a test summary with pass/fail counts and exit with code 1 if any test failed. Call at the end of a test file to report results.

# ... assertions above ...
test_run   # prints summary, exits 1 on failure

Other

2604 topics

# __stryke_rust_compile

__stryke_rust_compile — internal builtin.

my $result = __stryke_rust_compile $x 
# or in a pipeline:
@list |> map __stryke_rust_compile |> p

# a0

bohr_radius (alias a0) — a₀ ≈ 5.29×10⁻¹¹ m. Radius of hydrogen atom ground state.

p a0   # 5.29177210903e-11

# a256

a256 — color operations builtin. Alias for ansi_256.

my $result = a256 $x 
# or in a pipeline:
@list |> map a256 |> p

# a85d

base85_decode (aliases b85d, a85d) decodes an Ascii85/Base85 encoded string.

p b85d(b85e("Hello"))  # Hello

# a85e

base85_encode (aliases b85e, a85e) encodes a string using Ascii85/Base85 encoding. More compact than Base64 (4:5 ratio vs 3:4).

p b85e("Hello")  # encoded string

# abs_ceil

abs_ceil — trivial numeric helpers (batch 4) builtin.

my $result = abs_ceil $x 
# or in a pipeline:
@list |> map abs_ceil |> p

# abs_diff

abs_diff — trivial numeric / predicate builtins builtin.

my $result = abs_diff $x 
# or in a pipeline:
@list |> map abs_diff |> p

# abs_each

abs_each — trivial numeric helpers (batch 4) builtin.

my $result = abs_each $x 
# or in a pipeline:
@list |> map abs_each |> p

# abs_floor

abs_floor — trivial numeric helpers (batch 4) builtin.

my $result = abs_floor $x 
# or in a pipeline:
@list |> map abs_floor |> p

# abundant_numbers

abundant_numbers — number theory / primes builtin.

my $result = abundant_numbers $x 
# or in a pipeline:
@list |> map abundant_numbers |> p

# abunnums

abunnums — number theory / primes builtin. Alias for abundant_numbers.

my $result = abunnums $x 
# or in a pipeline:
@list |> map abunnums |> p

# accum

accum — python/ruby stdlib builtin. Alias for accumulate.

my $result = accum $x 
# or in a pipeline:
@list |> map accum |> p

# accumulate

accumulate — python/ruby stdlib builtin.

my $result = accumulate $x 
# or in a pipeline:
@list |> map accumulate |> p

# acf

acf_fn (alias acf) — autocorrelation function. Returns ACF values for lags 0..max_lag. Like R's acf().

my @a = @{acf([1,3,2,4,3,5,4,6], 5)}
p $a[0]  # 1.0 (lag 0 is always 1)
p $a[1]  # lag-1 autocorrelation

# acirc

acirc — geometry / physics builtin. Alias for area_circle.

my $result = acirc $x 
# or in a pipeline:
@list |> map acirc |> p

# acorr

acorr — math / numeric (uncategorized batch) builtin. Alias for autocorrelation.

my $result = acorr $x 
# or in a pipeline:
@list |> map acorr |> p

# acos

acos — trig / math (batch 2) builtin.

my $result = acos $x 
# or in a pipeline:
@list |> map acos |> p

# acosh

acosh — trig / math (batch 2) builtin.

my $result = acosh $x 
# or in a pipeline:
@list |> map acosh |> p

# acot

acot — trig extensions builtin.

my $result = acot $x 
# or in a pipeline:
@list |> map acot |> p

# acro

acro — string processing (uncategorized batch) builtin. Alias for acronym.

my $result = acro $x 
# or in a pipeline:
@list |> map acro |> p

# acronym

acronym — string processing (uncategorized batch) builtin.

my $result = acronym $x 
# or in a pipeline:
@list |> map acronym |> p

# acsc

acsc — trig extensions builtin.

my $result = acsc $x 
# or in a pipeline:
@list |> map acsc |> p

# add_days

add_days — extended stdlib builtin.

my $result = add_days $x 
# or in a pipeline:
@list |> map add_days |> p

# add_hours

add_hours — extended stdlib builtin.

my $result = add_hours $x 
# or in a pipeline:
@list |> map add_hours |> p

# add_minutes

add_minutes — extended stdlib builtin.

my $result = add_minutes $x 
# or in a pipeline:
@list |> map add_minutes |> p

# addd

addd — extended stdlib builtin. Alias for add_days.

my $result = addd $x 
# or in a pipeline:
@list |> map addd |> p

# addh

addh — extended stdlib builtin. Alias for add_hours.

my $result = addh $x 
# or in a pipeline:
@list |> map addh |> p

# addm

addm — extended stdlib builtin. Alias for add_minutes.

my $result = addm $x 
# or in a pipeline:
@list |> map addm |> p

# adjacent_difference

adjacent_difference — list helpers (batch 4) builtin.

my $result = adjacent_difference $x 
# or in a pipeline:
@list |> map adjacent_difference |> p

# adjacent_pairs

adjacent_pairs — go/general functional utilities builtin.

my $result = adjacent_pairs $x 
# or in a pipeline:
@list |> map adjacent_pairs |> p

# adjp

adjp — go/general functional utilities builtin. Alias for adjacent_pairs.

my $result = adjp $x 
# or in a pipeline:
@list |> map adjp |> p

# adl32

adl32 — extended stdlib builtin. Alias for adler32.

my $result = adl32 $x 
# or in a pipeline:
@list |> map adl32 |> p

# adler32

adler32 — extended stdlib builtin.

my $result = adler32 $x 
# or in a pipeline:
@list |> map adler32 |> p

# aellip

aellip — geometry / physics builtin. Alias for area_ellipse.

my $result = aellip $x 
# or in a pipeline:
@list |> map aellip |> p

# after_n

after_n — functional combinators builtin.

my $result = after_n $x 
# or in a pipeline:
@list |> map after_n |> p

# age_in_years

age_in_years — extended stdlib batch 3 builtin.

my $result = age_in_years $x 
# or in a pipeline:
@list |> map age_in_years |> p

# ageyrs

ageyrs — extended stdlib batch 3 builtin. Alias for age_in_years.

my $result = ageyrs $x 
# or in a pipeline:
@list |> map ageyrs |> p

# ain

ain — algebraic match builtin. Alias for assoc_in.

my $result = ain $x 
# or in a pipeline:
@list |> map ain |> p

# aliquot

aliquot — math / numeric (uncategorized batch) builtin. Alias for aliquot_sum.

my $result = aliquot $x 
# or in a pipeline:
@list |> map aliquot |> p

# aliquot_sum

aliquot_sum — math / numeric (uncategorized batch) builtin.

my $result = aliquot_sum $x 
# or in a pipeline:
@list |> map aliquot_sum |> p

# all_distinct

all_distinct — more list helpers builtin.

my $result = all_distinct $x 
# or in a pipeline:
@list |> map all_distinct |> p

# all_eq

all_eq — more list helpers builtin.

my $result = all_eq $x 
# or in a pipeline:
@list |> map all_eq |> p

# all_match

all_match — predicates (batch 4) builtin.

my $result = all_match $x 
# or in a pipeline:
@list |> map all_match |> p

# all_unique

all_unique — more list helpers builtin. Alias for all_distinct.

my $result = all_unique $x 
# or in a pipeline:
@list |> map all_unique |> p

# alpha_fs

fine_structure_constant (alias alpha_fs) — α ≈ 1/137 ≈ 0.00730. Fundamental constant of electromagnetism.

p alpha_fs       # 0.0072973525693
p 1 / alpha_fs   # ~137.036

# alternate_case

alternate_case — string helpers (batch 4) builtin.

my $result = alternate_case $x 
# or in a pipeline:
@list |> map alternate_case |> p

# always_false

always_false — functional primitives builtin.

my $result = always_false $x 
# or in a pipeline:
@list |> map always_false |> p

# always_true

always_true — functional primitives builtin.

my $result = always_true $x 
# or in a pipeline:
@list |> map always_true |> p

# amax

amax — extended stdlib builtin. Alias for argmax.

my $result = amax $x 
# or in a pipeline:
@list |> map amax |> p

# amin

amin — extended stdlib builtin. Alias for argmin.

my $result = amin $x 
# or in a pipeline:
@list |> map amin |> p

# amort

amortization_schedule($principal, $rate, $periods) (alias amort) — generates a full amortization schedule. Returns arrayref of hashrefs with period, payment, principal, interest, balance.

my $sched = amort(10000, 0.05, 12)
for my $row (@$sched) {
    p "Period $row->{period}: bal=$row->{balance}"
}

# amu

amu — physics constants builtin. Alias for atomic_mass_unit.

my $result = amu $x 
# or in a pipeline:
@list |> map amu |> p

# and

and — control flow builtin.

my $result = and $x 
# or in a pipeline:
@list |> map and |> p

# and_list

and_list — additional missing stdlib functions builtin.

my $result = and_list $x 
# or in a pipeline:
@list |> map and_list |> p

# andl

andl — additional missing stdlib functions builtin. Alias for and_list.

my $result = andl $x 
# or in a pipeline:
@list |> map andl |> p

# angbet

angbet — geometry (extended) builtin. Alias for angle_between.

my $result = angbet $x 
# or in a pipeline:
@list |> map angbet |> p

# angle_between

angle_between($x1, $y1, $x2, $y2) — computes the angle in radians between two 2D vectors from origin. Returns the angle using atan2.

my $angle = angle_between(1, 0, 0, 1)
p $angle   # ~1.5708 (π/2 radians = 90°)

# angle_between_deg

angle_between_deg — math functions builtin.

my $result = angle_between_deg $x 
# or in a pipeline:
@list |> map angle_between_deg |> p

# angle_bracket

angle_bracket — string helpers (batch 4) builtin.

my $result = angle_bracket $x 
# or in a pipeline:
@list |> map angle_bracket |> p

# angular_velocity

angular_velocity — physics formulas builtin.

my $result = angular_velocity $x 
# or in a pipeline:
@list |> map angular_velocity |> p

# angvel

angvel — physics formulas builtin. Alias for angular_velocity.

my $result = angvel $x 
# or in a pipeline:
@list |> map angvel |> p

# anova

anova_oneway (aliases anova, anova1) performs one-way ANOVA. Returns [F-statistic, df_between, df_within].

my ($F, $dfb, $dfw) = @{anova([1,2,3], [4,5,6], [7,8,9])}

# ansi_256

ansi_256 — color operations builtin.

my $result = ansi_256 $x 
# or in a pipeline:
@list |> map ansi_256 |> p

# ansi_black

ansi_black — color / ansi builtin.

my $result = ansi_black $x 
# or in a pipeline:
@list |> map ansi_black |> p

# ansi_blue

ansi_blue — color / ansi builtin.

my $result = ansi_blue $x 
# or in a pipeline:
@list |> map ansi_blue |> p

# ansi_bold

ansi_bold — color / ansi builtin.

my $result = ansi_bold $x 
# or in a pipeline:
@list |> map ansi_bold |> p

# ansi_cyan

ansi_cyan — color / ansi builtin.

my $result = ansi_cyan $x 
# or in a pipeline:
@list |> map ansi_cyan |> p

# ansi_dim

ansi_dim — color / ansi builtin.

my $result = ansi_dim $x 
# or in a pipeline:
@list |> map ansi_dim |> p

# ansi_green

ansi_green — color / ansi builtin.

my $result = ansi_green $x 
# or in a pipeline:
@list |> map ansi_green |> p

# ansi_magenta

ansi_magenta — color / ansi builtin.

my $result = ansi_magenta $x 
# or in a pipeline:
@list |> map ansi_magenta |> p

# ansi_off

ansi_off — color / ansi builtin. Alias for red.

my $result = ansi_off $x 
# or in a pipeline:
@list |> map ansi_off |> p

# ansi_red

ansi_red — color / ansi builtin.

my $result = ansi_red $x 
# or in a pipeline:
@list |> map ansi_red |> p

# ansi_reverse

ansi_reverse — color / ansi builtin.

my $result = ansi_reverse $x 
# or in a pipeline:
@list |> map ansi_reverse |> p

# ansi_truecolor

ansi_truecolor — color operations builtin.

my $result = ansi_truecolor $x 
# or in a pipeline:
@list |> map ansi_truecolor |> p

# ansi_underline

ansi_underline — color / ansi builtin.

my $result = ansi_underline $x 
# or in a pipeline:
@list |> map ansi_underline |> p

# ansi_white

ansi_white — color / ansi builtin.

my $result = ansi_white $x 
# or in a pipeline:
@list |> map ansi_white |> p

# ansi_yellow

ansi_yellow — color / ansi builtin.

my $result = ansi_yellow $x 
# or in a pipeline:
@list |> map ansi_yellow |> p

# any_match

any_match — predicates (batch 4) builtin.

my $result = any_match $x 
# or in a pipeline:
@list |> map any_match |> p

# apery

apery — math constants builtin. Alias for apery_constant.

my $result = apery $x 
# or in a pipeline:
@list |> map apery |> p

# apery_constant

apery_constant — math constants builtin.

my $result = apery_constant $x 
# or in a pipeline:
@list |> map apery_constant |> p

# append_elem

append_elem — list helpers (batch 4) builtin.

my $result = append_elem $x 
# or in a pipeline:
@list |> map append_elem |> p

# appl

appl — algebraic match builtin. Alias for apply.

my $result = appl $x 
# or in a pipeline:
@list |> map appl |> p

# apply

apply — algebraic match builtin.

my $result = apply $x 
# or in a pipeline:
@list |> map apply |> p

# apply_list

apply_list — functional combinators builtin.

my $result = apply_list $x 
# or in a pipeline:
@list |> map apply_list |> p

# apply_window

apply_window(\@signal, \@window) — element-wise multiplies signal by window function. Use before FFT to reduce spectral leakage.

my $w = hann(scalar @signal)
my $windowed = apply_window(\@signal, $w)
my $spectrum = dft($windowed)

# applywin

applywin — dsp / signal (extended) builtin. Alias for apply_window.

my $result = applywin $x 
# or in a pipeline:
@list |> map applywin |> p

# approx

approx_fn (alias approx) — piecewise linear interpolation at query points. Like R's approx().

my @y = @{approx([0,1,2], [0,10,0], [0.5, 1.0, 1.5])}
# [5, 10, 5]

# approx_eq

approx_eq — math functions builtin.

my $result = approx_eq $x 
# or in a pipeline:
@list |> map approx_eq |> p

# apsp

floyd_warshall (aliases floydwarshall, apsp) computes all-pairs shortest paths. Takes a distance matrix (use Inf for no edge).

my $d = apsp([[0,3,1e18],[1e18,0,1],[1e18,1e18,0]])

# arange

arange — matrix / linear algebra builtin.

my $result = arange $x 
# or in a pipeline:
@list |> map arange |> p

# arc_length

arc_length($radius, $theta) — computes the arc length of a circular arc. Theta is the central angle in radians. Returns radius * theta.

p arc_length(10, 3.14159)   # ~31.4 (half circle)
p arc_length(5, 1.57)       # ~7.85 (quarter circle)

# arclen

arclen — geometry (extended) builtin. Alias for arc_length.

my $result = arclen $x 
# or in a pipeline:
@list |> map arclen |> p

# area_circle

area_circle — geometry / physics builtin.

my $result = area_circle $x 
# or in a pipeline:
@list |> map area_circle |> p

# area_ellipse

area_ellipse — geometry / physics builtin.

my $result = area_ellipse $x 
# or in a pipeline:
@list |> map area_ellipse |> p

# area_rectangle

area_rectangle — geometry / physics builtin.

my $result = area_rectangle $x 
# or in a pipeline:
@list |> map area_rectangle |> p

# area_trapezoid

area_trapezoid — geometry / physics builtin.

my $result = area_trapezoid $x 
# or in a pipeline:
@list |> map area_trapezoid |> p

# area_triangle

area_triangle — geometry / physics builtin.

my $result = area_triangle $x 
# or in a pipeline:
@list |> map area_triangle |> p

# arect

arect — geometry / physics builtin. Alias for area_rectangle.

my $result = arect $x 
# or in a pipeline:
@list |> map arect |> p

# argc

argc — process / env builtin.

my $result = argc $x 
# or in a pipeline:
@list |> map argc |> p

# argmax

argmax — extended stdlib builtin.

my $result = argmax $x 
# or in a pipeline:
@list |> map argmax |> p

# argmin

argmin — extended stdlib builtin.

my $result = argmin $x 
# or in a pipeline:
@list |> map argmin |> p

# argsort

argsort — extended stdlib builtin.

my $result = argsort $x 
# or in a pipeline:
@list |> map argsort |> p

# arithmetic_series

arithmetic_series($a1, $d, $n) (alias arithser) — sum of n terms of arithmetic sequence starting at a1 with common difference d. Formula: n/2 × (2a1 + (n-1)d).

p arithser(1, 1, 100)    # 5050 (1+2+...+100)
p arithser(2, 3, 10)     # 155 (2+5+8+...+29)

# arity_of

arity_of — functional combinators builtin.

my $result = arity_of $x 
# or in a pipeline:
@list |> map arity_of |> p

# array_difference

array_difference — collection (batch 2) builtin.

my $result = array_difference $x 
# or in a pipeline:
@list |> map array_difference |> p

# array_intersection

array_intersection — collection (batch 2) builtin.

my $result = array_intersection $x 
# or in a pipeline:
@list |> map array_intersection |> p

# array_union

array_union — collection (batch 2) builtin.

my $result = array_union $x 
# or in a pipeline:
@list |> map array_union |> p

# ascii_chr

ascii_chr — string (batch 2) builtin.

my $result = ascii_chr $x 
# or in a pipeline:
@list |> map ascii_chr |> p

# ascii_ord

ascii_ord — string (batch 2) builtin.

my $result = ascii_ord $x 
# or in a pipeline:
@list |> map ascii_ord |> p

# asec

asec — trig extensions builtin.

my $result = asec $x 
# or in a pipeline:
@list |> map asec |> p

# asin

asin — trig / math (batch 2) builtin.

my $result = asin $x 
# or in a pipeline:
@list |> map asin |> p

# asinh

asinh — trig / math (batch 2) builtin.

my $result = asinh $x 
# or in a pipeline:
@list |> map asinh |> p

# asrt

asrt — extended stdlib builtin. Alias for argsort.

my $result = asrt $x 
# or in a pipeline:
@list |> map asrt |> p

# assert_type

assert_type — conversion / utility (batch 4) builtin.

my $result = assert_type $x 
# or in a pipeline:
@list |> map assert_type |> p

# assoc

assoc — algebraic match builtin.

my $result = assoc $x 
# or in a pipeline:
@list |> map assoc |> p

# assoc_fn

assoc_fn — go/general functional utilities builtin. Alias for associate.

my $result = assoc_fn $x 
# or in a pipeline:
@list |> map assoc_fn |> p

# assoc_in

assoc_in — algebraic match builtin.

my $result = assoc_in $x 
# or in a pipeline:
@list |> map assoc_in |> p

# associate

associate — go/general functional utilities builtin.

my $result = associate $x 
# or in a pipeline:
@list |> map associate |> p

# astronomical_unit

astronomical_unit (alias au) — AU ≈ 1.496×10¹¹ m. Mean Earth-Sun distance.

p au             # 1.495978707e11 m
p au / 1000      # ~149.6 million km

# at_index

at_index — javascript array/object methods builtin.

my $result = at_index $x 
# or in a pipeline:
@list |> map at_index |> p

# atan

atan — trig / math (batch 2) builtin.

my $result = atan $x 
# or in a pipeline:
@list |> map atan |> p

# atanh

atanh — trig / math (batch 2) builtin.

my $result = atanh $x 
# or in a pipeline:
@list |> map atanh |> p

# atbash

atbash — string processing (uncategorized batch) builtin.

my $result = atbash $x 
# or in a pipeline:
@list |> map atbash |> p

# atc

atc — color operations builtin. Alias for ansi_truecolor.

my $result = atc $x 
# or in a pipeline:
@list |> map atc |> p

# ati

ati — javascript array/object methods builtin. Alias for at_index.

my $result = ati $x 
# or in a pipeline:
@list |> map ati |> p

# atime

atime — file stat / path builtin. Alias for file_atime.

my $result = atime $x 
# or in a pipeline:
@list |> map atime |> p

# atomic_mass_unit

atomic_mass_unit — physics constants builtin.

my $result = atomic_mass_unit $x 
# or in a pipeline:
@list |> map atomic_mass_unit |> p

# atrap

atrap — geometry / physics builtin. Alias for area_trapezoid.

my $result = atrap $x 
# or in a pipeline:
@list |> map atrap |> p

# atri

atri — geometry / physics builtin. Alias for area_triangle.

my $result = atri $x 
# or in a pipeline:
@list |> map atri |> p

# attempt

attempt — functional combinators builtin.

my $result = attempt $x 
# or in a pipeline:
@list |> map attempt |> p

# autocorrelation

autocorrelation — math / numeric (uncategorized batch) builtin.

my $result = autocorrelation $x 
# or in a pipeline:
@list |> map autocorrelation |> p

# average

average — additional missing stdlib functions builtin.

my $result = average $x 
# or in a pipeline:
@list |> map average |> p

# avg

avg — pipeline / string helpers builtin.

my $result = avg $x 
# or in a pipeline:
@list |> map avg |> p

# avogadro

avogadro — math / physics constants builtin.

my $result = avogadro $x 
# or in a pipeline:
@list |> map avogadro |> p

# avogadro_number

avogadro_number — constants builtin.

my $result = avogadro_number $x 
# or in a pipeline:
@list |> map avogadro_number |> p

# b2gray

b2gray — base / gray code builtin. Alias for binary_to_gray.

my $result = b2gray $x 
# or in a pipeline:
@list |> map b2gray |> p

# b2i

b2i — boolean combinators builtin. Alias for bool_to_int.

my $result = b2i $x 
# or in a pipeline:
@list |> map b2i |> p

# b64d

b64d — crypto / encoding builtin. Alias for base64_decode.

my $result = b64d $x 
# or in a pipeline:
@list |> map b64d |> p

# b64e

b64e — crypto / encoding builtin. Alias for base64_encode.

my $result = b64e $x 
# or in a pipeline:
@list |> map b64e |> p

# b_to_kb

b_to_kb — unit conversions builtin. Alias for bytes_to_kb.

my $result = b_to_kb $input 

# b_wien

b_wien — physics constants builtin. Alias for wien_constant.

my $result = b_wien $x 
# or in a pipeline:
@list |> map b_wien |> p

# bac

bac — finance builtin. Alias for bac_estimate.

my $result = bac $x 
# or in a pipeline:
@list |> map bac |> p

# bac_estimate

bac_estimate — finance builtin.

my $result = bac_estimate $x 
# or in a pipeline:
@list |> map bac_estimate |> p

# bandpass_filter

bandpass_filter(\@signal, $low, $high) (alias bpf) — applies a band-pass filter passing frequencies between low and high cutoffs. Combines low-pass and high-pass.

my $filtered = bpf(\@signal, 0.1, 0.3)

# bar_to_pascals

bar_to_pascals — file stat / path builtin.

my $result = bar_to_pascals $input 

# base_convert

base_convert — base / gray code builtin.

my $result = base_convert $x 
# or in a pipeline:
@list |> map base_convert |> p

# batch

batch — collection (batch 2) builtin.

my $result = batch $x 
# or in a pipeline:
@list |> map batch |> p

# batched

batched — additional missing stdlib functions builtin.

my $result = batched $x 
# or in a pipeline:
@list |> map batched |> p

# bbox

bounding_box(@points) (alias bbox) — computes the axis-aligned bounding box of 2D points. Returns [min_x, min_y, max_x, max_y].

my @pts = (1,2, 3,4, 0,1, 5,3)
my $bb = bbox(@pts)
p @$bb   # (0, 1, 5, 4)

# bconv

bconv — base / gray code builtin. Alias for base_convert.

my $result = bconv $x 
# or in a pipeline:
@list |> map bconv |> p

# bcount

bcount — extended stdlib batch 3 builtin. Alias for count_bytes.

my $result = bcount $x 
# or in a pipeline:
@list |> map bcount |> p

# bearing

bearing — geometry / physics builtin.

my $result = bearing $x 
# or in a pipeline:
@list |> map bearing |> p

# before_n

before_n — functional combinators builtin.

my $result = before_n $x 
# or in a pipeline:
@list |> map before_n |> p

# bell_number

bell_number — math / numeric (uncategorized batch) builtin.

my $result = bell_number $x 
# or in a pipeline:
@list |> map bell_number |> p

# bellman_ford

bellman_ford (alias bellmanford) computes shortest paths from a source in a graph with negative weights. Takes edges [[u,v,w],...], node count, source index.

my $d = bellmanford([[0,1,4],[0,2,5],[1,2,-3]], 3, 0)

# belln

belln — math / numeric (uncategorized batch) builtin. Alias for bell_number.

my $result = belln $x 
# or in a pipeline:
@list |> map belln |> p

# bernoulli

bernoulli_number (alias bernoulli) computes the nth Bernoulli number. B(0)=1, B(1)=-0.5, odd B(n>1)=0.

p bernoulli(0)   # 1
p bernoulli(2)   # 0.1667
p bernoulli(4)   # -0.0333

# bessel_j0

bessel_j0 (alias j0) computes the Bessel function of the first kind, order 0.

p j0(0)    # 1.0
p j0(2.4)  # ≈ 0 (first zero)

# bessel_j1

bessel_j1 (alias j1) computes the Bessel function of the first kind, order 1.

p j1(0)    # 0.0
p j1(1.84) # ≈ 0.582 (first max)

# beta_pdf

beta_pdf (alias betapdf) evaluates the Beta distribution PDF at x with shape parameters alpha and beta.

p betapdf(0.5, 2, 5)  # Beta(2,5) at x=0.5

# between

between — conversion / utility (batch 4) builtin.

my $result = between $x 
# or in a pipeline:
@list |> map between |> p

# bfs

bfs — extended stdlib builtin. Alias for bfs_traverse.

my $result = bfs $x 
# or in a pipeline:
@list |> map bfs |> p

# bfs_traverse

bfs_traverse — extended stdlib builtin.

my $result = bfs_traverse $x 
# or in a pipeline:
@list |> map bfs_traverse |> p

# bg_black

bg_black — color / ansi builtin. Alias for red.

my $result = bg_black $x 
# or in a pipeline:
@list |> map bg_black |> p

# bg_blue

bg_blue — color / ansi builtin. Alias for red.

my $result = bg_blue $x 
# or in a pipeline:
@list |> map bg_blue |> p

# bg_bright_blue

bg_bright_blue — color / ansi builtin. Alias for red.

my $result = bg_bright_blue $x 
# or in a pipeline:
@list |> map bg_bright_blue |> p

# bg_bright_cyan

bg_bright_cyan — color / ansi builtin. Alias for red.

my $result = bg_bright_cyan $x 
# or in a pipeline:
@list |> map bg_bright_cyan |> p

# bg_bright_green

bg_bright_green — color / ansi builtin. Alias for red.

my $result = bg_bright_green $x 
# or in a pipeline:
@list |> map bg_bright_green |> p

# bg_bright_magenta

bg_bright_magenta — color / ansi builtin. Alias for red.

my $result = bg_bright_magenta $x 
# or in a pipeline:
@list |> map bg_bright_magenta |> p

# bg_bright_red

bg_bright_red — color / ansi builtin. Alias for red.

my $result = bg_bright_red $x 
# or in a pipeline:
@list |> map bg_bright_red |> p

# bg_bright_white

bg_bright_white — color / ansi builtin. Alias for red.

my $result = bg_bright_white $x 
# or in a pipeline:
@list |> map bg_bright_white |> p

# bg_bright_yellow

bg_bright_yellow — color / ansi builtin. Alias for red.

my $result = bg_bright_yellow $x 
# or in a pipeline:
@list |> map bg_bright_yellow |> p

# bg_c256

bg_c256 — color / ansi builtin. Alias for bg_color256.

my $result = bg_c256 $x 
# or in a pipeline:
@list |> map bg_c256 |> p

# bg_color256

bg_color256 — color / ansi builtin.

my $result = bg_color256 $x 
# or in a pipeline:
@list |> map bg_color256 |> p

# bg_cyan

bg_cyan — color / ansi builtin. Alias for red.

my $result = bg_cyan $x 
# or in a pipeline:
@list |> map bg_cyan |> p

# bg_green

bg_green — color / ansi builtin. Alias for red.

my $result = bg_green $x 
# or in a pipeline:
@list |> map bg_green |> p

# bg_magenta

bg_magenta — color / ansi builtin. Alias for red.

my $result = bg_magenta $x 
# or in a pipeline:
@list |> map bg_magenta |> p

# bg_red

bg_red — color / ansi builtin. Alias for red.

my $result = bg_red $x 
# or in a pipeline:
@list |> map bg_red |> p

# bg_rgb

bg_rgb — color / ansi builtin.

my $result = bg_rgb $x 
# or in a pipeline:
@list |> map bg_rgb |> p

# bg_white

bg_white — color / ansi builtin. Alias for red.

my $result = bg_white $x 
# or in a pipeline:
@list |> map bg_white |> p

# bg_yellow

bg_yellow — color / ansi builtin. Alias for red.

my $result = bg_yellow $x 
# or in a pipeline:
@list |> map bg_yellow |> p

# bigram

bigram — string processing (uncategorized batch) builtin. Alias for bigrams.

my $result = bigram $x 
# or in a pipeline:
@list |> map bigram |> p

# bigrams

bigrams — string processing (uncategorized batch) builtin.

my $result = bigrams $x 
# or in a pipeline:
@list |> map bigrams |> p

# bin_of

bin_of — base conversion builtin. Alias for to_bin.

my $result = bin_of $x 
# or in a pipeline:
@list |> map bin_of |> p

# binary_insert

binary_insert — matrix operations (uncategorized batch) builtin.

my $result = binary_insert $x 
# or in a pipeline:
@list |> map binary_insert |> p

# binary_search

binary_search — collection (batch 2) builtin.

my $result = binary_search $x 
# or in a pipeline:
@list |> map binary_search |> p

# binary_to_gray

binary_to_gray — base / gray code builtin.

my $result = binary_to_gray $input 

# binom

binom — extended stdlib batch 3 builtin. Alias for binomial.

my $result = binom $x 
# or in a pipeline:
@list |> map binom |> p

# binom_test

binom_test — exact binomial test. Returns two-sided p-value. Like R's binom.test().

my $p = binomtest(7, 10, 0.5)  # p-value for 7/10 successes vs p=0.5

# binomial

binomial — extended stdlib batch 3 builtin.

my $result = binomial $x 
# or in a pipeline:
@list |> map binomial |> p

# binsert

binsert — matrix operations (uncategorized batch) builtin. Alias for binary_insert.

my $result = binsert $x 
# or in a pipeline:
@list |> map binsert |> p

# bisect

bisection (alias bisect) finds a root of f(x)=0 in [a,b] via the bisection method. Takes a code ref, a, b, and optional tolerance.

my $root = bisect(fn { $_[0]**2 - 2 }, 1, 2)  # √2 ≈ 1.4142

# bit_and

bit_and — bit ops builtin.

my $result = bit_and $x 
# or in a pipeline:
@list |> map bit_and |> p

# bit_clear

bit_clear — bit ops builtin.

my $result = bit_clear $x 
# or in a pipeline:
@list |> map bit_clear |> p

# bit_length

bit_length — base conversion builtin.

my $result = bit_length $x 
# or in a pipeline:
@list |> map bit_length |> p

# bit_not

bit_not — bit ops builtin.

my $result = bit_not $x 
# or in a pipeline:
@list |> map bit_not |> p

# bit_or

bit_or — bit ops builtin.

my $result = bit_or $x 
# or in a pipeline:
@list |> map bit_or |> p

# bit_set

bit_set — bit ops builtin.

my $result = bit_set $x 
# or in a pipeline:
@list |> map bit_set |> p

# bit_test

bit_test — bit ops builtin.

my $result = bit_test $x 
# or in a pipeline:
@list |> map bit_test |> p

# bit_toggle

bit_toggle — bit ops builtin.

my $result = bit_toggle $x 
# or in a pipeline:
@list |> map bit_toggle |> p

# bit_xor

bit_xor — bit ops builtin.

my $result = bit_xor $x 
# or in a pipeline:
@list |> map bit_xor |> p

# bitlen

bitlen — base conversion builtin. Alias for bit_length.

my $result = bitlen $x 
# or in a pipeline:
@list |> map bitlen |> p

# bits_count

bits_count — base conversion builtin.

my $result = bits_count $x 
# or in a pipeline:
@list |> map bits_count |> p

# bits_to_bytes

bits_to_bytes — unit conversions builtin.

my $result = bits_to_bytes $input 

# bitset_clear

bitset_clear — data structure helpers builtin.

my $result = bitset_clear $x 
# or in a pipeline:
@list |> map bitset_clear |> p

# bitset_new

bitset_new — data structure helpers builtin.

my $result = bitset_new $x 
# or in a pipeline:
@list |> map bitset_new |> p

# bitset_set

bitset_set — data structure helpers builtin.

my $result = bitset_set $x 
# or in a pipeline:
@list |> map bitset_set |> p

# bitset_test

bitset_test — data structure helpers builtin.

my $result = bitset_test $x 
# or in a pipeline:
@list |> map bitset_test |> p

# bkt

bkt — matrix operations (uncategorized batch) builtin. Alias for bucket.

my $result = bkt $x 
# or in a pipeline:
@list |> map bkt |> p

# bl

bl — algebraic match builtin. Alias for butlast.

my $result = bl $x 
# or in a pipeline:
@list |> map bl |> p

# black

black — color / ansi builtin. Alias for red.

my $result = black $x 
# or in a pipeline:
@list |> map black |> p

# black_scholes_call

black_scholes_call($S, $K, $r, $T, $sigma) (alias bscall) — computes Black-Scholes price for a European call option. S=spot, K=strike, r=rate, T=time to expiry, sigma=volatility.

p bscall(100, 100, 0.05, 1, 0.2)   # ~10.45

# black_scholes_put

black_scholes_put($S, $K, $r, $T, $sigma) (alias bsput) — computes Black-Scholes price for a European put option.

p bsput(100, 100, 0.05, 1, 0.2)   # ~5.57

# blackman

window_blackman($n) (alias blackman) — generates a Blackman window of length n. Provides excellent sidelobe suppression at the cost of main lobe width.

my $w = blackman(1024)

# blink

blink — color / ansi builtin. Alias for red.

my $result = blink $x 
# or in a pipeline:
@list |> map blink |> p

# block_devices

block_devices — filesystem extensions builtin.

my $result = block_devices $x 
# or in a pipeline:
@list |> map block_devices |> p

# blue

blue — color / ansi builtin. Alias for red.

my $result = blue $x 
# or in a pipeline:
@list |> map blue |> p

# blue_bold

blue_bold — color / ansi builtin. Alias for red.

my $result = blue_bold $x 
# or in a pipeline:
@list |> map blue_bold |> p

# bmi

bmi — finance builtin.

my $result = bmi $x 
# or in a pipeline:
@list |> map bmi |> p

# bmi_calc

bmi_calc — physics formulas builtin.

my $result = bmi_calc $x 
# or in a pipeline:
@list |> map bmi_calc |> p

# bohr_magneton

bohr_magneton — physics constants builtin.

my $result = bohr_magneton $x 
# or in a pipeline:
@list |> map bohr_magneton |> p

# bold

bold — color / ansi builtin. Alias for red.

my $result = bold $x 
# or in a pipeline:
@list |> map bold |> p

# bold_blue

bold_blue — color / ansi builtin. Alias for red.

my $result = bold_blue $x 
# or in a pipeline:
@list |> map bold_blue |> p

# bold_cyan

bold_cyan — color / ansi builtin. Alias for red.

my $result = bold_cyan $x 
# or in a pipeline:
@list |> map bold_cyan |> p

# bold_green

bold_green — color / ansi builtin. Alias for red.

my $result = bold_green $x 
# or in a pipeline:
@list |> map bold_green |> p

# bold_magenta

bold_magenta — color / ansi builtin. Alias for red.

my $result = bold_magenta $x 
# or in a pipeline:
@list |> map bold_magenta |> p

# bold_red

bold_red — color / ansi builtin. Alias for red.

my $result = bold_red $x 
# or in a pipeline:
@list |> map bold_red |> p

# bold_white

bold_white — color / ansi builtin. Alias for red.

my $result = bold_white $x 
# or in a pipeline:
@list |> map bold_white |> p

# bold_yellow

bold_yellow — color / ansi builtin. Alias for red.

my $result = bold_yellow $x 
# or in a pipeline:
@list |> map bold_yellow |> p

# boltz

boltz — constants builtin. Alias for boltzmann_constant.

my $result = boltz $x 
# or in a pipeline:
@list |> map boltz |> p

# boltzmann

boltzmann — math / physics constants builtin.

my $result = boltzmann $x 
# or in a pipeline:
@list |> map boltzmann |> p

# boltzmann_constant

boltzmann_constant — constants builtin.

my $result = boltzmann_constant $x 
# or in a pipeline:
@list |> map boltzmann_constant |> p

# bond_duration

duration($face, $coupon_rate, $ytm, $periods) (alias bond_duration) — computes the Macaulay duration of a bond, measuring interest rate sensitivity as weighted average time to receive cash flows.

p duration(1000, 0.05, 0.05, 10)   # ~7.7 years

# bond_price

bond_price($face, $coupon_rate, $ytm, $periods) — computes the present value (price) of a bond given face value, coupon rate, yield to maturity, and number of periods.

p bond_price(1000, 0.05, 0.04, 10)   # ~1081 (premium)
p bond_price(1000, 0.05, 0.06, 10)   # ~926 (discount)

# bond_yield

bond_yield($price, $face, $coupon_rate, $periods) — computes the yield to maturity of a bond given its current price. Uses Newton-Raphson iteration.

p bond_yield(950, 1000, 0.05, 10)   # ~5.7%

# bondprc

bondprc — finance (extended) builtin. Alias for bond_price.

my $result = bondprc $x 
# or in a pipeline:
@list |> map bondprc |> p

# bondyld

bondyld — finance (extended) builtin. Alias for bond_yield.

my $result = bondyld $x 
# or in a pipeline:
@list |> map bondyld |> p

# bool_each

bool_each — trivial numeric helpers (batch 4) builtin.

my $result = bool_each $x 
# or in a pipeline:
@list |> map bool_each |> p

# bool_to_int

bool_to_int — boolean combinators builtin.

my $result = bool_to_int $input 

# both

both — boolean combinators builtin.

my $result = both $x 
# or in a pipeline:
@list |> map both |> p

# bracket

bracket — string helpers (batch 4) builtin.

my $result = bracket $x 
# or in a pipeline:
@list |> map bracket |> p

# braille

braille — encoding / phonetics builtin. Alias for braille_encode.

my $result = braille $x 
# or in a pipeline:
@list |> map braille |> p

# braille_encode

braille_encode — encoding / phonetics builtin.

my $result = braille_encode $x 
# or in a pipeline:
@list |> map braille_encode |> p

# break_even

break_even — finance builtin.

my $result = break_even $x 
# or in a pipeline:
@list |> map break_even |> p

# break_fn

break_fn — haskell list functions builtin.

my $result = break_fn $x 
# or in a pipeline:
@list |> map break_fn |> p

# breakeven

breakeven — finance builtin. Alias for break_even.

my $result = breakeven $x 
# or in a pipeline:
@list |> map breakeven |> p

# brewster

brewster — physics formulas builtin. Alias for brewster_angle.

my $result = brewster $x 
# or in a pipeline:
@list |> map brewster |> p

# brewster_angle

brewster_angle — physics formulas builtin.

my $result = brewster_angle $x 
# or in a pipeline:
@list |> map brewster_angle |> p

# bright_blue

bright_blue — color / ansi builtin. Alias for red.

my $result = bright_blue $x 
# or in a pipeline:
@list |> map bright_blue |> p

# bright_cyan

bright_cyan — color / ansi builtin. Alias for red.

my $result = bright_cyan $x 
# or in a pipeline:
@list |> map bright_cyan |> p

# bright_green

bright_green — color / ansi builtin. Alias for red.

my $result = bright_green $x 
# or in a pipeline:
@list |> map bright_green |> p

# bright_magenta

bright_magenta — color / ansi builtin. Alias for red.

my $result = bright_magenta $x 
# or in a pipeline:
@list |> map bright_magenta |> p

# bright_red

bright_red — color / ansi builtin. Alias for red.

my $result = bright_red $x 
# or in a pipeline:
@list |> map bright_red |> p

# bright_white

bright_white — color / ansi builtin. Alias for red.

my $result = bright_white $x 
# or in a pipeline:
@list |> map bright_white |> p

# bright_yellow

bright_yellow — color / ansi builtin. Alias for red.

my $result = bright_yellow $x 
# or in a pipeline:
@list |> map bright_yellow |> p

# brkf

brkf — haskell list functions builtin. Alias for break_fn.

my $result = brkf $x 
# or in a pipeline:
@list |> map brkf |> p

# bs_delta

bs_delta (aliases bsdelta, option_delta) computes the Black-Scholes delta (∂C/∂S). Args: S, K, T, r, sigma.

p bsdelta(100, 100, 1, 0.05, 0.2)  # ≈ 0.64

# bs_gamma

bs_gamma computes the Black-Scholes gamma (∂²C/∂S²). Measures convexity of option value.

p bsgamma(100, 100, 1, 0.05, 0.2)  # ≈ 0.019

# bs_rho

bs_rho computes the Black-Scholes rho (∂C/∂r). Sensitivity to interest rate.

p bsrho(100, 100, 1, 0.05, 0.2)  # ≈ 46

# bs_theta

bs_theta computes the Black-Scholes theta (∂C/∂t). Time decay per unit time.

p bstheta(100, 100, 1, 0.05, 0.2)  # negative (time decay)

# bs_vega

bs_vega computes the Black-Scholes vega (∂C/∂σ). Sensitivity to volatility.

p bsvega(100, 100, 1, 0.05, 0.2)  # ≈ 37.5

# bsearch

bsearch — collection (batch 2) builtin. Alias for binary_search.

my $result = bsearch $x 
# or in a pipeline:
@list |> map bsearch |> p

# bsize

bsize — misc / utility builtin. Alias for byte_size.

my $result = bsize $x 
# or in a pipeline:
@list |> map bsize |> p

# btch

btch — additional missing stdlib functions builtin. Alias for batched.

my $result = btch $x 
# or in a pipeline:
@list |> map btch |> p

# bucket

bucket — matrix operations (uncategorized batch) builtin.

my $result = bucket $x 
# or in a pipeline:
@list |> map bucket |> p

# butlast

butlast — algebraic match builtin.

my $result = butlast $x 
# or in a pipeline:
@list |> map butlast |> p

# byte_length

byte_length — string helpers (batch 4) builtin.

my $result = byte_length $x 
# or in a pipeline:
@list |> map byte_length |> p

# byte_size

byte_size — misc / utility builtin.

my $result = byte_size $x 
# or in a pipeline:
@list |> map byte_size |> p

# bytes_to_bits

bytes_to_bits — unit conversions builtin.

my $result = bytes_to_bits $input 

# bytes_to_gb

bytes_to_gb — unit conversions builtin.

my $result = bytes_to_gb $input 

# bytes_to_hex_str

bytes_to_hex_str — string helpers (batch 4) builtin.

my $result = bytes_to_hex_str $input 

# bytes_to_kb

bytes_to_kb — unit conversions builtin.

my $result = bytes_to_kb $input 

# bytes_to_mb

bytes_to_mb — unit conversions builtin.

my $result = bytes_to_mb $input 

# c

c — i/o extensions builtin.

my $result = c $x 
# or in a pipeline:
@list |> map c |> p

# c256

c256 — color / ansi builtin. Alias for color256.

my $result = c256 $x 
# or in a pipeline:
@list |> map c256 |> p

# c2s

c2s — string processing (uncategorized batch) builtin. Alias for camel_to_snake.

my $result = c2s $x 
# or in a pipeline:
@list |> map c2s |> p

# c_to_f

c_to_f — unit conversions builtin.

my $result = c_to_f $input 

# c_to_k

c_to_k — unit conversions builtin.

my $result = c_to_k $input 

# caesar_shift

caesar_shift — string (batch 2) builtin.

my $result = caesar_shift $x 
# or in a pipeline:
@list |> map caesar_shift |> p

# cagr

cagr — math / numeric (uncategorized batch) builtin.

my $result = cagr $x 
# or in a pipeline:
@list |> map cagr |> p

# cal_to_joules

cal_to_joules — file stat / path builtin.

my $result = cal_to_joules $input 

# camel_to_snake

camel_to_snake — string processing (uncategorized batch) builtin.

my $result = camel_to_snake $input 

# camel_words

camel_words — string helpers (batch 4) builtin.

my $result = camel_words $x 
# or in a pipeline:
@list |> map camel_words |> p

# cap

cap — trivial string ops builtin. Alias for capitalize.

my $result = cap $x 
# or in a pipeline:
@list |> map cap |> p

# capacitance

capacitance — physics formulas builtin.

my $result = capacitance $x 
# or in a pipeline:
@list |> map capacitance |> p

# capacitor_energy

capacitor_energy — physics formulas builtin.

my $result = capacitor_energy $x 
# or in a pipeline:
@list |> map capacitor_energy |> p

# capenergy

capenergy — physics formulas builtin. Alias for capacitor_energy.

my $result = capenergy $x 
# or in a pipeline:
@list |> map capenergy |> p

# capg

capg — extended stdlib builtin. Alias for capture_groups.

my $result = capg $x 
# or in a pipeline:
@list |> map capg |> p

# capitalize

capitalize — trivial string ops builtin.

my $result = capitalize $x 
# or in a pipeline:
@list |> map capitalize |> p

# capm

capm($risk_free, $beta, $market_return) — computes expected return using the Capital Asset Pricing Model: rf + β(rm - rf).

p capm(0.02, 1.2, 0.08)   # 9.2% expected return

# capture_groups

capture_groups — extended stdlib builtin.

my $result = capture_groups $x 
# or in a pipeline:
@list |> map capture_groups |> p

# cartesian_power

cartesian_power — extended stdlib batch 3 builtin.

my $result = cartesian_power $x 
# or in a pipeline:
@list |> map cartesian_power |> p

# cartesian_product

cartesian_product — python/ruby stdlib builtin.

my $result = cartesian_product $x 
# or in a pipeline:
@list |> map cartesian_product |> p

# cartpow

cartpow — extended stdlib batch 3 builtin. Alias for cartesian_power.

my $result = cartpow $x 
# or in a pipeline:
@list |> map cartpow |> p

# cat

cat — i/o extensions builtin.

my $result = cat $x 
# or in a pipeline:
@list |> map cat |> p

# catalan

catalan_constant (alias catalan) — Catalan's constant G ≈ 0.9159. Appears in combinatorics and series.

p catalan   # 0.9159655941772190

# catn

catn — extended stdlib batch 3 builtin. Alias for catalan.

my $result = catn $x 
# or in a pipeline:
@list |> map catn |> p

# cauchy_pdf

cauchy_pdf (alias cauchypdf) evaluates the Cauchy distribution PDF at x with location x0 and scale gamma.

p cauchypdf(0, 0, 1)  # peak of standard Cauchy

# cbind

cbind — bind matrices by columns (horizontal join). Like R's cbind().

my $m = cbind([[1],[2]], [[3],[4]])  # [[1,3],[2,4]]

# cblend

cblend — color operations builtin. Alias for color_blend.

my $result = cblend $x 
# or in a pipeline:
@list |> map cblend |> p

# cbrt

cbrt — trivial numeric / predicate builtins builtin.

my $result = cbrt $x 
# or in a pipeline:
@list |> map cbrt |> p

# ccgraph

ccgraph — extended stdlib builtin. Alias for connected_components_graph.

my $result = ccgraph $x 
# or in a pipeline:
@list |> map ccgraph |> p

# ccompl

ccompl — color operations builtin. Alias for color_complement.

my $result = ccompl $x 
# or in a pipeline:
@list |> map ccompl |> p

# ccount

ccount — extended stdlib batch 3 builtin. Alias for count_chars.

my $result = ccount $x 
# or in a pipeline:
@list |> map ccount |> p

# cdarken

cdarken — color operations builtin. Alias for color_darken.

my $result = cdarken $x 
# or in a pipeline:
@list |> map cdarken |> p

# cdist

cdist — color operations builtin. Alias for color_distance.

my $result = cdist $x 
# or in a pipeline:
@list |> map cdist |> p

# ceil

ceil — trivial numeric / predicate builtins builtin.

my $result = ceil $x 
# or in a pipeline:
@list |> map ceil |> p

# ceil_div

ceil_div — trig / math (batch 2) builtin.

my $result = ceil_div $x 
# or in a pipeline:
@list |> map ceil_div |> p

# ceil_each

ceil_each — trivial numeric helpers (batch 4) builtin.

my $result = ceil_each $x 
# or in a pipeline:
@list |> map ceil_each |> p

# ceiling

ceiling — trivial numeric / predicate builtins builtin. Alias for ceil.

my $result = ceiling $x 
# or in a pipeline:
@list |> map ceiling |> p

# center

center — trivial string ops builtin.

my $result = center $x 
# or in a pipeline:
@list |> map center |> p

# center_text

center_text — extended stdlib builtin.

my $result = center_text $x 
# or in a pipeline:
@list |> map center_text |> p

# centrip

centripetal_force($mass, $velocity, $radius) (alias centrip) — F = mv²/r for circular motion.

p centrip(1000, 20, 50)   # 8000 N (car turning)

# centroid

centroid(@points) — computes the centroid (geometric center) of 2D points. Points as flat list [x1,y1,x2,y2,...]. Returns [$cx, $cy].

my @triangle = (0,0, 3,0, 0,3)
my $c = centroid(@triangle)
p @$c   # (1, 1)

# cgray

cgray — color operations builtin. Alias for color_grayscale.

my $result = cgray $x 
# or in a pipeline:
@list |> map cgray |> p

# chain_from

chain_from — python/ruby stdlib builtin.

my $result = chain_from $x 
# or in a pipeline:
@list |> map chain_from |> p

# char_at

char_at — extended stdlib builtin.

my $result = char_at $x 
# or in a pipeline:
@list |> map char_at |> p

# char_count

char_count — trivial string ops builtin.

my $result = char_count $x 
# or in a pipeline:
@list |> map char_count |> p

# char_devices

char_devices — filesystem extensions builtin.

my $result = char_devices $x 
# or in a pipeline:
@list |> map char_devices |> p

# char_frequencies

char_frequencies — string processing (uncategorized batch) builtin.

my $result = char_frequencies $x 
# or in a pipeline:
@list |> map char_frequencies |> p

# char_length

char_length — string helpers (batch 4) builtin.

my $result = char_length $x 
# or in a pipeline:
@list |> map char_length |> p

# charfreq

charfreq — string processing (uncategorized batch) builtin. Alias for char_frequencies.

my $result = charfreq $x 
# or in a pipeline:
@list |> map charfreq |> p

# chars_to_string

chars_to_string — string helpers (batch 4) builtin.

my $result = chars_to_string $input 

# chat

chat — extended stdlib builtin. Alias for char_at.

my $result = chat $x 
# or in a pipeline:
@list |> map chat |> p

# chebyshev_distance

chebyshev_distance — math functions builtin.

my $result = chebyshev_distance $x 
# or in a pipeline:
@list |> map chebyshev_distance |> p

# chfr

chfr — python/ruby stdlib builtin. Alias for chain_from.

my $result = chfr $x 
# or in a pipeline:
@list |> map chfr |> p

# chi2

chi_square_stat(\@observed, \@expected) (alias chi2) — computes the chi-squared test statistic comparing observed vs expected frequencies. Useful for goodness-of-fit tests. Returns the chi-squared value.

my @obs = (10, 20, 30)
my @exp = (15, 20, 25)
p chi2(\@obs, \@exp)   # chi-squared statistic

# chi2_pdf

chi2_pdf (alias chi2pdf) evaluates the chi-squared distribution PDF at x with k degrees of freedom.

p chi2pdf(3.84, 1)  # p-value boundary for df=1

# chinese_remainder

chinese_remainder (alias crt) solves a system of simultaneous congruences via the Chinese Remainder Theorem.

p crt([2,3,2], [3,5,7])  # 23 (x≡2 mod 3, x≡3 mod 5, x≡2 mod 7)

# chirp

chirp generates a linear chirp signal sweeping from f0 to f1 Hz. Args: n_samples, f0, f1, sample_rate.

my @sig = @{chirp(1000, 100, 1000, 8000)}

# chkstr

chkstr — string processing (uncategorized batch) builtin. Alias for chunk_string.

my $result = chkstr $x 
# or in a pipeline:
@list |> map chkstr |> p

# chkw

chkw — ruby enumerable extras builtin. Alias for chunk_while.

my $result = chkw $x 
# or in a pipeline:
@list |> map chkw |> p

# cholesky

matrix_cholesky (aliases mchol, cholesky) computes the Cholesky decomposition of a symmetric positive-definite matrix. Returns lower-triangular L where M = L·L^T.

my $L = cholesky([[4,2],[2,3]])

# chomp_str

chomp_str — string helpers (batch 4) builtin.

my $result = chomp_str $x 
# or in a pipeline:
@list |> map chomp_str |> p

# chop_str

chop_str — string helpers (batch 4) builtin.

my $result = chop_str $x 
# or in a pipeline:
@list |> map chop_str |> p

# chroot

chroot — process / system builtin.

my $result = chroot $x 
# or in a pipeline:
@list |> map chroot |> p

# chull

convex_hull(@points) (alias chull) — computes the convex hull of a set of 2D points. Points given as flat list [x1,y1,x2,y2,...]. Returns the hull vertices in counterclockwise order. Uses Graham scan algorithm.

my @pts = (0,0, 1,1, 2,0, 1,0.5)
my $hull = chull(@pts)
p @$hull

# chunk_by

chunk_by — functional / iterator builtin.

my $result = chunk_by $x 
# or in a pipeline:
@list |> map chunk_by |> p

# chunk_n

chunk_n — collection (batch 2) builtin. Alias for group_of_n.

my $result = chunk_n $x 
# or in a pipeline:
@list |> map chunk_n |> p

# chunk_string

chunk_string — string processing (uncategorized batch) builtin.

my $result = chunk_string $x 
# or in a pipeline:
@list |> map chunk_string |> p

# chunk_while

chunk_while — ruby enumerable extras builtin.

my $result = chunk_while $x 
# or in a pipeline:
@list |> map chunk_while |> p

# ci

confidence_interval (alias ci) computes a confidence interval for the mean. Default 95%. Returns [lower, upper].

my ($lo, $hi) = @{ci([10,12,14,11,13])}
p "95%% CI: $lo to $hi"
my ($lo99, $hi99) = @{ci([10,12,14,11,13], 0.99)}

# cinv

cinv — extended stdlib batch 3 builtin. Alias for count_inversions.

my $result = cinv $x 
# or in a pipeline:
@list |> map cinv |> p

# cinvert

cinvert — color operations builtin. Alias for color_invert.

my $result = cinvert $x 
# or in a pipeline:
@list |> map cinvert |> p

# circ3pt

circ3pt — geometry (extended) builtin. Alias for circle_from_three_points.

my $result = circ3pt $x 
# or in a pipeline:
@list |> map circ3pt |> p

# circle_from_three_points

circle_from_three_points($x1, $y1, $x2, $y2, $x3, $y3) (alias circ3) — finds the unique circle passing through three non-collinear points. Returns [$cx, $cy, $radius] or undef if collinear.

my $c = circ3(0, 0, 1, 0, 0.5, 0.866)
p "center=($c->[0], $c->[1]) r=$c->[2]"

# circum

circum — geometry / physics builtin. Alias for circumference.

my $result = circum $x 
# or in a pipeline:
@list |> map circum |> p

# circumference

circumference — geometry / physics builtin.

my $result = circumference $x 
# or in a pipeline:
@list |> map circumference |> p

# clamp_array

clamp_array — matrix operations (uncategorized batch) builtin.

my $result = clamp_array $x 
# or in a pipeline:
@list |> map clamp_array |> p

# clamp_each

clamp_each — conversion / utility (batch 4) builtin.

my $result = clamp_each $x 
# or in a pipeline:
@list |> map clamp_each |> p

# clamp_fn

clamp_fn — functional combinators builtin.

my $result = clamp_fn $x 
# or in a pipeline:
@list |> map clamp_fn |> p

# clamp_int

clamp_int — extended stdlib builtin.

my $result = clamp_int $x 
# or in a pipeline:
@list |> map clamp_int |> p

# clamp_list

clamp_list — functional combinators builtin.

my $result = clamp_list $x 
# or in a pipeline:
@list |> map clamp_list |> p

# clarr

clarr — matrix operations (uncategorized batch) builtin. Alias for clamp_array.

my $result = clarr $x 
# or in a pipeline:
@list |> map clarr |> p

# clighten

clighten — color operations builtin. Alias for color_lighten.

my $result = clighten $x 
# or in a pipeline:
@list |> map clighten |> p

# clpi

clpi — extended stdlib builtin. Alias for clamp_int.

my $result = clpi $x 
# or in a pipeline:
@list |> map clpi |> p

# cm_to_inches

cm_to_inches — unit conversions builtin.

my $result = cm_to_inches $input 

# cmap

cmap — additional missing stdlib functions builtin. Alias for concat_map.

my $result = cmap $x 
# or in a pipeline:
@list |> map cmap |> p

# cmd_exists

cmd_exists — process / env builtin.

my $result = cmd_exists $x 
# or in a pipeline:
@list |> map cmd_exists |> p

# cmp_num

cmp_num — file stat / path builtin. Alias for spaceship.

my $result = cmp_num $x 
# or in a pipeline:
@list |> map cmp_num |> p

# cmp_str

cmp_str — file stat / path builtin.

my $result = cmp_str $x 
# or in a pipeline:
@list |> map cmp_str |> p

# cmpr

cmpr — python/ruby stdlib builtin. Alias for compress.

my $result = cmpr $x 
# or in a pipeline:
@list |> map cmpr |> p

# cnt

count (aliases len, cnt) returns the number of elements in a list, the number of characters in a string, the number of key-value pairs in a hash, or the cardinality of a set. It is a universal length function that dispatches based on the type of its argument. This replaces the need to use scalar @array or length $stringcnt is shorter and works uniformly across types. In a pipeline, it naturally reduces a collection to a single number.

Note: size is NOT a count alias — it returns a file's byte size (see size).

my @arr = (1, 2, 3, 4, 5)
p cnt @arr          # 5
p len "hello"       # 5
my %h = (a => 1, b => 2)
p cnt \%h           # 2
rl("file.txt") |> cnt |> p  # line count

# cntw

cntw — ruby enumerable extras builtin. Alias for count_while.

my $result = cntw $x 
# or in a pipeline:
@list |> map cntw |> p

# coalesce

coalesce — functional combinators builtin.

my $result = coalesce $x 
# or in a pipeline:
@list |> map coalesce |> p

# code_point_at

code_point_at — extended stdlib builtin.

my $result = code_point_at $x 
# or in a pipeline:
@list |> map code_point_at |> p

# coeff_of_variation

coeff_of_variation — math / numeric (uncategorized batch) builtin.

my $result = coeff_of_variation $x 
# or in a pipeline:
@list |> map coeff_of_variation |> p

# cohen_d

cohen_d (alias cohend) computes Cohen's d effect size between two samples. Small=0.2, medium=0.5, large=0.8.

p cohend([1,2,3], [4,5,6])  # large effect

# coin_flip

coin_flip — random builtin.

my $result = coin_flip $x 
# or in a pipeline:
@list |> map coin_flip |> p

# colMeans

col_means (alias colMeans) — mean of each column. Like R's colMeans().

p colMeans([[2,4],[6,8]])  # [4, 6]

# colSums

col_sums (alias colSums) — sum of each column. Like R's colSums().

p colSums([[1,2],[3,4]])  # [4, 6]

# collapse_whitespace

collapse_whitespace — string processing (uncategorized batch) builtin.

my $result = collapse_whitespace $x 
# or in a pipeline:
@list |> map collapse_whitespace |> p

# collatz

collatz — math / numeric (uncategorized batch) builtin. Alias for collatz_length.

my $result = collatz $x 
# or in a pipeline:
@list |> map collatz |> p

# collatz_length

collatz_length — math / numeric (uncategorized batch) builtin.

my $result = collatz_length $x 
# or in a pipeline:
@list |> map collatz_length |> p

# collatz_sequence

collatz_sequence — math / numeric (uncategorized batch) builtin.

my $result = collatz_sequence $x 
# or in a pipeline:
@list |> map collatz_sequence |> p

# collatzseq

collatzseq — math / numeric (uncategorized batch) builtin. Alias for collatz_sequence.

my $result = collatzseq $x 
# or in a pipeline:
@list |> map collatzseq |> p

# collws

collws — string processing (uncategorized batch) builtin. Alias for collapse_whitespace.

my $result = collws $x 
# or in a pipeline:
@list |> map collws |> p

# color256

color256 — color / ansi builtin.

my $result = color256 $x 
# or in a pipeline:
@list |> map color256 |> p

# color_blend

color_blend — color operations builtin.

my $result = color_blend $x 
# or in a pipeline:
@list |> map color_blend |> p

# color_complement

color_complement — color operations builtin.

my $result = color_complement $x 
# or in a pipeline:
@list |> map color_complement |> p

# color_darken

color_darken — color operations builtin.

my $result = color_darken $x 
# or in a pipeline:
@list |> map color_darken |> p

# color_distance

color_distance — color operations builtin.

my $result = color_distance $x 
# or in a pipeline:
@list |> map color_distance |> p

# color_grayscale

color_grayscale — color operations builtin.

my $result = color_grayscale $x 
# or in a pipeline:
@list |> map color_grayscale |> p

# color_invert

color_invert — color operations builtin.

my $result = color_invert $x 
# or in a pipeline:
@list |> map color_invert |> p

# color_lighten

color_lighten — color operations builtin.

my $result = color_lighten $x 
# or in a pipeline:
@list |> map color_lighten |> p

# comb

combinations($n, $r) (alias comb) — number of ways to choose r items from n. Formula: n!/(r!(n-r)!). Order doesn't matter.

p comb(5, 3)    # 10 (ways to choose 3 items from 5)
p comb(52, 5)   # 2598960 (poker hands)

# combinations_rep

combinations_rep — additional missing stdlib functions builtin.

my $result = combinations_rep $x 
# or in a pipeline:
@list |> map combinations_rep |> p

# combrep

combrep — additional missing stdlib functions builtin. Alias for combinations_rep.

my $result = combrep $x 
# or in a pipeline:
@list |> map combrep |> p

# common_prefix

common_prefix — extended stdlib builtin.

my $result = common_prefix $x 
# or in a pipeline:
@list |> map common_prefix |> p

# common_suffix

common_suffix — extended stdlib builtin.

my $result = common_suffix $x 
# or in a pipeline:
@list |> map common_suffix |> p

# compare_versions

compare_versions — file stat / path builtin.

my $result = compare_versions $x 
# or in a pipeline:
@list |> map compare_versions |> p

# compound_interest

compound_interest — physics formulas builtin.

my $result = compound_interest $x 
# or in a pipeline:
@list |> map compound_interest |> p

# compress

compress — python/ruby stdlib builtin.

my $result = compress $x 
# or in a pipeline:
@list |> map compress |> p

# concat_map

concat_map — additional missing stdlib functions builtin.

my $result = concat_map $x 
# or in a pipeline:
@list |> map concat_map |> p

# cond

matrix_cond (aliases mcond, cond) estimates the condition number of a matrix (ratio of largest to smallest singular value). Large values indicate ill-conditioning.

p cond([[1,0],[0,1]])    # 1 (perfect)
p cond([[1,2],[2,4]])    # Inf (singular)

# cone_volume

cone_volume — geometry / physics builtin.

my $result = cone_volume $x 
# or in a pipeline:
@list |> map cone_volume |> p

# conevol

conevol — geometry / physics builtin. Alias for cone_volume.

my $result = conevol $x 
# or in a pipeline:
@list |> map conevol |> p

# confint

confint_lm (alias confint) — confidence intervals for model coefficients. Returns hash with intercept_lower/upper, slope_lower/upper.

my $ci = confint(lm([1,2,3,4,5], [2,4,5,4,5]))
p $ci->{slope_lower}

# conj

conj — algebraic match builtin.

my $result = conj $x 
# or in a pipeline:
@list |> map conj |> p

# connected_components_graph

connected_components_graph — extended stdlib builtin.

my $result = connected_components_graph $x 
# or in a pipeline:
@list |> map connected_components_graph |> p

# cons

cons — algebraic match builtin.

my $result = cons $x 
# or in a pipeline:
@list |> map cons |> p

# consecutive_eq

consecutive_eq — collection more builtin.

my $result = consecutive_eq $x 
# or in a pipeline:
@list |> map consecutive_eq |> p

# consecutive_pairs

consecutive_pairs — list helpers (batch 4) builtin.

my $result = consecutive_pairs $x 
# or in a pipeline:
@list |> map consecutive_pairs |> p

# const_fn

const_fn — functional primitives builtin.

my $result = const_fn $x 
# or in a pipeline:
@list |> map const_fn |> p

# constant_case

constant_case — string (batch 2) builtin.

my $result = constant_case $x 
# or in a pipeline:
@list |> map constant_case |> p

# contains

contains — trivial string ops builtin.

my $result = contains $x 
# or in a pipeline:
@list |> map contains |> p

# contains_all

contains_all — string (batch 2) builtin.

my $result = contains_all $x 
# or in a pipeline:
@list |> map contains_all |> p

# contains_any

contains_any — string (batch 2) builtin.

my $result = contains_any $x 
# or in a pipeline:
@list |> map contains_any |> p

# contains_elem

contains_elem — list helpers (batch 4) builtin.

my $result = contains_elem $x 
# or in a pipeline:
@list |> map contains_elem |> p

# contcomp

contcomp — finance (extended) builtin. Alias for continuous_compound.

my $result = contcomp $x 
# or in a pipeline:
@list |> map contcomp |> p

# continuous_compound

continuous_compound($principal, $rate, $time) (alias ccomp) — computes future value with continuous compounding: P × e^(rt).

p ccomp(1000, 0.05, 10)   # ~1648.72

# conv

conv — math / numeric (uncategorized batch) builtin. Alias for convolution.

my $result = conv $x 
# or in a pipeline:
@list |> map conv |> p

# converge

converge — functional combinators builtin.

my $result = converge $x 
# or in a pipeline:
@list |> map converge |> p

# convolution

convolution — math / numeric (uncategorized batch) builtin.

my $result = convolution $x 
# or in a pipeline:
@list |> map convolution |> p

# copy_sign

copy_sign — extended stdlib builtin.

my $result = copy_sign $x 
# or in a pipeline:
@list |> map copy_sign |> p

# copy_within

copy_within — additional missing stdlib functions builtin.

my $result = copy_within $x 
# or in a pipeline:
@list |> map copy_within |> p

# copysign

copysign — math functions builtin.

my $result = copysign $x 
# or in a pipeline:
@list |> map copysign |> p

# cor_mat

cor_matrix (alias cor_mat) — correlation matrix from observations. Each row is an observation vector.

my $R = cor_mat([[1,2],[3,4],[5,6]])  # 2x2 correlation matrix

# corr

corr — extended stdlib builtin. Alias for correlation.

my $result = corr $x 
# or in a pipeline:
@list |> map corr |> p

# correlation

correlation — extended stdlib builtin.

my $result = correlation $x 
# or in a pipeline:
@list |> map correlation |> p

# cosh

cosh — trig / math (batch 2) builtin.

my $result = cosh $x 
# or in a pipeline:
@list |> map cosh |> p

# cosine_similarity

cosine_similarity — math functions builtin.

my $result = cosine_similarity $x 
# or in a pipeline:
@list |> map cosine_similarity |> p

# cot

cot returns the cotangent (1/tan) of an angle in radians.

p cot(0.7854)  # ≈ 1.0 (cot 45°)

# coulomb

coulomb_force($q1, $q2, $r) (alias coulomb) — Coulomb's law: F = kq₁q₂/r². Charges in Coulombs, distance in meters.

p coulomb(1e-6, 1e-6, 0.1)   # ~0.9 N (two 1μC charges 10cm apart)

# coulomb_constant

coulomb_constant — physics constants builtin.

my $result = coulomb_constant $x 
# or in a pipeline:
@list |> map coulomb_constant |> p

# count_by

count_by — pipeline / string helpers builtin. Alias for drop.

my $result = count_by $x 
# or in a pipeline:
@list |> map count_by |> p

# count_bytes

count_bytes — extended stdlib batch 3 builtin.

my $result = count_bytes $x 
# or in a pipeline:
@list |> map count_bytes |> p

# count_char

count_char — string (batch 2) builtin.

my $result = count_char $x 
# or in a pipeline:
@list |> map count_char |> p

# count_chars

count_chars — extended stdlib batch 3 builtin.

my $result = count_chars $x 
# or in a pipeline:
@list |> map count_chars |> p

# count_consonants

count_consonants — string (batch 2) builtin.

my $result = count_consonants $x 
# or in a pipeline:
@list |> map count_consonants |> p

# count_digits

count_digits — counters (batch 4) builtin.

my $result = count_digits $x 
# or in a pipeline:
@list |> map count_digits |> p

# count_elem

count_elem — list helpers (batch 4) builtin.

my $result = count_elem $x 
# or in a pipeline:
@list |> map count_elem |> p

# count_eq

count_eq — more list helpers builtin.

my $result = count_eq $x 
# or in a pipeline:
@list |> map count_eq |> p

# count_inversions

count_inversions — extended stdlib batch 3 builtin.

my $result = count_inversions $x 
# or in a pipeline:
@list |> map count_inversions |> p

# count_letters

count_letters — counters (batch 4) builtin.

my $result = count_letters $x 
# or in a pipeline:
@list |> map count_letters |> p

# count_lines

count_lines — extended stdlib batch 3 builtin.

my $result = count_lines $x 
# or in a pipeline:
@list |> map count_lines |> p

# count_lower

count_lower — counters (batch 4) builtin.

my $result = count_lower $x 
# or in a pipeline:
@list |> map count_lower |> p

# count_match

count_match — counters (batch 4) builtin.

my $result = count_match $x 
# or in a pipeline:
@list |> map count_match |> p

# count_ne

count_ne — more list helpers builtin.

my $result = count_ne $x 
# or in a pipeline:
@list |> map count_ne |> p

# count_punctuation

count_punctuation — counters (batch 4) builtin.

my $result = count_punctuation $x 
# or in a pipeline:
@list |> map count_punctuation |> p

# count_regex_matches

count_regex_matches — file stat / path builtin.

my $result = count_regex_matches $x 
# or in a pipeline:
@list |> map count_regex_matches |> p

# count_spaces

count_spaces — counters (batch 4) builtin.

my $result = count_spaces $x 
# or in a pipeline:
@list |> map count_spaces |> p

# count_substring

count_substring — file stat / path builtin.

my $result = count_substring $x 
# or in a pipeline:
@list |> map count_substring |> p

# count_upper

count_upper — counters (batch 4) builtin.

my $result = count_upper $x 
# or in a pipeline:
@list |> map count_upper |> p

# count_vowels

count_vowels — string (batch 2) builtin.

my $result = count_vowels $x 
# or in a pipeline:
@list |> map count_vowels |> p

# count_while

count_while — ruby enumerable extras builtin.

my $result = count_while $x 
# or in a pipeline:
@list |> map count_while |> p

# count_words

count_words — extended stdlib batch 3 builtin.

my $result = count_words $x 
# or in a pipeline:
@list |> map count_words |> p

# counter

counter — data structure helpers builtin.

my $result = counter $x 
# or in a pipeline:
@list |> map counter |> p

# counter_most_common

counter_most_common — data structure helpers builtin.

my $result = counter_most_common $x 
# or in a pipeline:
@list |> map counter_most_common |> p

# cov

cov — extended stdlib builtin. Alias for covariance.

my $result = cov $x 
# or in a pipeline:
@list |> map cov |> p

# cov2cor

cov2cor — convert covariance matrix to correlation matrix. Like R's cov2cor().

my $cor = cov2cor(cov_mat($data))

# cov_mat

cov_matrix (alias cov_mat) — covariance matrix from observations.

my $S = cov_mat([[1,2],[3,4],[5,6]])

# covariance

covariance — extended stdlib builtin.

my $result = covariance $x 
# or in a pipeline:
@list |> map covariance |> p

# cpat

cpat — extended stdlib builtin. Alias for code_point_at.

my $result = cpat $x 
# or in a pipeline:
@list |> map cpat |> p

# cpfx

cpfx — extended stdlib builtin. Alias for common_prefix.

my $result = cpfx $x 
# or in a pipeline:
@list |> map cpfx |> p

# cprod

cprod — python/ruby stdlib builtin. Alias for cartesian_product.

my $result = cprod $x 
# or in a pipeline:
@list |> map cprod |> p

# cprod_acc

cprod_acc — extended stdlib builtin. Alias for cumprod.

my $result = cprod_acc $x 
# or in a pipeline:
@list |> map cprod_acc |> p

# cpsgn

cpsgn — extended stdlib builtin. Alias for copy_sign.

my $result = cpsgn $x 
# or in a pipeline:
@list |> map cpsgn |> p

# cpu_count

cpu_count — more process / system builtin.

my $result = cpu_count $x 
# or in a pipeline:
@list |> map cpu_count |> p

# cpyw

cpyw — additional missing stdlib functions builtin. Alias for copy_within.

my $result = cpyw $x 
# or in a pipeline:
@list |> map cpyw |> p

# cr

cr — data / network builtin. Alias for csv_read.

my $result = cr $x 
# or in a pipeline:
@list |> map cr |> p

# critang

critang — physics formulas builtin. Alias for critical_angle.

my $result = critang $x 
# or in a pipeline:
@list |> map critang |> p

# critical_angle

critical_angle — physics formulas builtin.

my $result = critical_angle $x 
# or in a pipeline:
@list |> map critical_angle |> p

# cross_correlation

cross_correlation(\@a, \@b) (alias xcorr) — computes the cross-correlation of two signals. Measures similarity as a function of time-lag. Peak location indicates time delay between signals.

my $xcor = xcorr(\@signal1, \@signal2)
my $lag = max_index(@$xcor)   # find peak lag

# cross_entropy

cross_entropy — math / numeric (uncategorized batch) builtin.

my $result = cross_entropy $x 
# or in a pipeline:
@list |> map cross_entropy |> p

# cross_product

cross_product — extended stdlib builtin.

my $result = cross_product $x 
# or in a pipeline:
@list |> map cross_product |> p

# crossp

crossp — extended stdlib builtin. Alias for cross_product.

my $result = crossp $x 
# or in a pipeline:
@list |> map crossp |> p

# crossprod

crossprod — cross product t(M) * M (R's crossprod). Efficiently computes M^T M without explicit transpose.

my $ata = crossprod([[1,2],[3,4]])  # [[10,14],[14,20]]

# csc

csc returns the cosecant (1/sin) of an angle in radians.

p csc(1.5708)  # ≈ 1.0 (csc 90°)

# csfx

csfx — extended stdlib builtin. Alias for common_suffix.

my $result = csfx $x 
# or in a pipeline:
@list |> map csfx |> p

# cspline

cubic_spline (aliases cspline, spline) performs natural cubic spline interpolation. Takes xs, ys, and a query point x.

p spline([0,1,2,3], [0,1,0,1], 1.5)  # smooth interpolation

# csum

csum — extended stdlib builtin. Alias for cumsum.

my $result = csum $x 
# or in a pipeline:
@list |> map csum |> p

# ctime

ctime — file stat / path builtin. Alias for file_ctime.

my $result = ctime $x 
# or in a pipeline:
@list |> map ctime |> p

# ctxt

ctxt — extended stdlib builtin. Alias for center_text.

my $result = ctxt $x 
# or in a pipeline:
@list |> map ctxt |> p

# cube_fn

cube_fn — trig / math (batch 2) builtin.

my $result = cube_fn $x 
# or in a pipeline:
@list |> map cube_fn |> p

# cube_root

cube_root — math functions builtin.

my $result = cube_root $x 
# or in a pipeline:
@list |> map cube_root |> p

# cubes_seq

cubes_seq — sequences builtin.

my $result = cubes_seq $x 
# or in a pipeline:
@list |> map cubes_seq |> p

# cummax

cummax — cumulative maximum. Each element is the max of all elements up to that position.

p cummax([3,1,4,1,5,9])  # [3,3,4,4,5,9]

# cummin

cummin — cumulative minimum.

p cummin([9,5,1,4,3])  # [9,5,1,1,1]

# cumprod

cumprod — extended stdlib builtin.

my $result = cumprod $x 
# or in a pipeline:
@list |> map cumprod |> p

# cumsum

cumsum — extended stdlib builtin.

my $result = cumsum $x 
# or in a pipeline:
@list |> map cumsum |> p

# cumtrapz

cumtrapz cumulative trapezoidal integration. Returns running integral array.

my @y = (1, 2, 3, 4)
my @F = @{cumtrapz(\@y)}  # [0, 1.5, 4.0, 7.5]

# cups_to_ml

cups_to_ml — file stat / path builtin.

my $result = cups_to_ml $input 

# cut

cut — bin continuous values into intervals. Returns integer bin indices. Like R's cut().

p cut([1.5, 3.2, 7.8], [0, 2, 5, 10])  # [1, 2, 3]

# cutree

cutree — cut a dendrogram into k clusters. Takes merge list from hclust and k. Returns cluster assignments. Like R's cutree().

my @clusters = @{cutree(hclust(dist_mat($data)), 3)}

# cv

cv — math / numeric (uncategorized batch) builtin. Alias for coeff_of_variation.

my $result = cv $x 
# or in a pipeline:
@list |> map cv |> p

# cw

cw — data / network builtin. Alias for csv_write.

my $result = cw $x 
# or in a pipeline:
@list |> map cw |> p

# cwd

cwd — more process / system builtin.

my $result = cwd $x 
# or in a pipeline:
@list |> map cwd |> p

# cyan

cyan — color / ansi builtin. Alias for red.

my $result = cyan $x 
# or in a pipeline:
@list |> map cyan |> p

# cyan_bold

cyan_bold — color / ansi builtin. Alias for red.

my $result = cyan_bold $x 
# or in a pipeline:
@list |> map cyan_bold |> p

# cyber_banner

cyber_banner (alias neon_banner) — large neon block-letter banner with gradient coloring and border. Args: text.

p cyber_banner("STRYKE")
p cyber_banner("HACK THE PLANET")

# cyber_circuit

cyber_circuit — circuit board pattern with traces, intersections, and glowing nodes. Args: [width, height, seed].

p cyber_circuit()             # 60x20 default
p cyber_circuit(80, 30, 42)   # custom

# cyber_city

cyber_city — procedural neon cityscape with buildings, windows, stars, and antennas. Args: [width, height, seed]. Output: ANSI-colored string for terminal.

p cyber_city()              # 80x24 default
p cyber_city(120, 40, 99)   # custom size and seed

# cyber_eye

cyber_eye — cyberpunk all-seeing eye motif with layered glow. Args: [size]. Size: "small" (default) or "large".

p cyber_eye()          # small eye
p cyber_eye("large")   # large eye

# cyber_glitch

cyber_glitch (alias glitch_text) — glitch-distort text with ANSI corruption, screen tears, and neon color bleeding. Args: text [, intensity 1-10].

p cyber_glitch("SYSTEM BREACH", 7)
p cyber_glitch("hello world")

# cyber_grid

cyber_grid — retro perspective grid with vanishing point and neon glow (Tron/synthwave style). Args: [width, height].

p cyber_grid()           # 80x24 default
p cyber_grid(120, 30)    # wider grid

# cyber_rain

cyber_rain (alias matrix_rain) — matrix-style digital rain with Japanese katakana and green phosphor glow. Args: [width, height, seed].

p cyber_rain()              # 80x24 default
p cyber_rain(120, 40, 42)   # custom

# cyber_skull

cyber_skull — neon skull ASCII art with glitch effects. Args: [size]. Size: "small" (default) or "large".

p cyber_skull()          # small skull
p cyber_skull("large")   # large skull

# cyc

cyc — algebraic match builtin. Alias for cycle.

my $result = cyc $x 
# or in a pipeline:
@list |> map cyc |> p

# cycle

cycle — algebraic match builtin.

my $result = cycle $x 
# or in a pipeline:
@list |> map cycle |> p

# cycle_n

cycle_n — collection (batch 2) builtin. Alias for repeat_list.

my $result = cycle_n $x 
# or in a pipeline:
@list |> map cycle_n |> p

# cylinder_volume

cylinder_volume — geometry / physics builtin.

my $result = cylinder_volume $x 
# or in a pipeline:
@list |> map cylinder_volume |> p

# cylvol

cylvol — geometry / physics builtin. Alias for cylinder_volume.

my $result = cylvol $x 
# or in a pipeline:
@list |> map cylvol |> p

# d

d — filesystem extensions builtin.

my $result = d $x 
# or in a pipeline:
@list |> map d |> p

# d2comp

d2comp — misc / utility builtin. Alias for degrees_to_compass.

my $result = d2comp $x 
# or in a pipeline:
@list |> map d2comp |> p

# d2r

d2r — trivial numeric / predicate builtins builtin. Alias for deg_to_rad.

my $result = d2r $x 
# or in a pipeline:
@list |> map d2r |> p

# day_of_year

day_of_year — extended stdlib batch 3 builtin.

my $result = day_of_year $x 
# or in a pipeline:
@list |> map day_of_year |> p

# days_in_month

days_in_month — date helpers builtin.

my $result = days_in_month $x 
# or in a pipeline:
@list |> map days_in_month |> p

# days_in_month_fn

days_in_month_fn — extended stdlib batch 3 builtin.

my $result = days_in_month_fn $x 
# or in a pipeline:
@list |> map days_in_month_fn |> p

# days_to_hours

days_to_hours — unit conversions builtin.

my $result = days_to_hours $input 

# days_to_seconds

days_to_seconds — unit conversions builtin.

my $result = days_to_seconds $input 

# daysinmo

daysinmo — extended stdlib batch 3 builtin. Alias for days_in_month_fn.

my $result = daysinmo $x 
# or in a pipeline:
@list |> map daysinmo |> p

# db

db — physics formulas builtin. Alias for decibel_ratio.

my $result = db $x 
# or in a pipeline:
@list |> map db |> p

# dbinom

dbinom — binomial PMF. P(X = k) for Binom(n, p). Args: k, n, p.

p dbinom(5, 10, 0.5)   # P(exactly 5 heads in 10 flips)

# dbmclose

dbmclose — ipc builtin.

my $result = dbmclose $x 
# or in a pipeline:
@list |> map dbmclose |> p

# dbmopen

dbmopen — ipc builtin.

my $result = dbmopen $x 
# or in a pipeline:
@list |> map dbmopen |> p

# dct

dct computes the Type-II Discrete Cosine Transform of a signal. Used in JPEG, MP3, and speech processing.

my @coeffs = @{dct([1,2,3,4])}

# ddt

ddt — extended stdlib builtin. Alias for dedent.

my $result = ddt $x 
# or in a pipeline:
@list |> map ddt |> p

# de_broglie_wavelength

de_broglie_wavelength($mass, $velocity) (alias debroglie) — quantum wavelength λ = h/(mv). Defaults to electron mass.

p debroglie(9.109e-31, 1e6)   # ~7.3e-10 m (electron at 1 km/s)

# debug_val

debug_val — functional combinators builtin.

my $result = debug_val $x 
# or in a pipeline:
@list |> map debug_val |> p

# dec

dec — pipeline / string helpers builtin.

my $result = dec $x 
# or in a pipeline:
@list |> map dec |> p

# dec_each

dec_each — trivial numeric helpers (batch 4) builtin.

my $result = dec_each $x 
# or in a pipeline:
@list |> map dec_each |> p

# decibel_ratio

decibel_ratio — physics formulas builtin.

my $result = decibel_ratio $x 
# or in a pipeline:
@list |> map decibel_ratio |> p

# dedent

dedent — extended stdlib builtin.

my $result = dedent $x 
# or in a pipeline:
@list |> map dedent |> p

# dedent_text

dedent_text — string processing (uncategorized batch) builtin.

my $result = dedent_text $x 
# or in a pipeline:
@list |> map dedent_text |> p

# default_to

default_to — functional combinators builtin.

my $result = default_to $x 
# or in a pipeline:
@list |> map default_to |> p

# defaultdict

defaultdict — data structure helpers builtin.

my $result = defaultdict $x 
# or in a pipeline:
@list |> map defaultdict |> p

# deficient_numbers

deficient_numbers — number theory / primes builtin.

my $result = deficient_numbers $x 
# or in a pipeline:
@list |> map deficient_numbers |> p

# defined_count

defined_count — counters (batch 4) builtin.

my $result = defined_count $x 
# or in a pipeline:
@list |> map defined_count |> p

# definums

definums — number theory / primes builtin. Alias for deficient_numbers.

my $result = definums $x 
# or in a pipeline:
@list |> map definums |> p

# deg_to_rad

deg_to_rad — trivial numeric / predicate builtins builtin.

my $result = deg_to_rad $input 

# degrees

degrees — trig / math (batch 2) builtin.

my $result = degrees $x 
# or in a pipeline:
@list |> map degrees |> p

# degrees_to_compass

degrees_to_compass — misc / utility builtin.

my $result = degrees_to_compass $input 

# dela

dela — go/general functional utilities builtin. Alias for delete_at.

my $result = dela $x 
# or in a pipeline:
@list |> map dela |> p

# delby

delby — additional missing stdlib functions builtin. Alias for delete_by.

my $result = delby $x 
# or in a pipeline:
@list |> map delby |> p

# delete_at

delete_at — go/general functional utilities builtin.

my $result = delete_at $x 
# or in a pipeline:
@list |> map delete_at |> p

# delete_by

delete_by — additional missing stdlib functions builtin.

my $result = delete_by $x 
# or in a pipeline:
@list |> map delete_by |> p

# delete_first

delete_first — additional missing stdlib functions builtin.

my $result = delete_first $x 
# or in a pipeline:
@list |> map delete_first |> p

# delfst

delfst — additional missing stdlib functions builtin. Alias for delete_first.

my $result = delfst $x 
# or in a pipeline:
@list |> map delfst |> p

# demorse

demorse — encoding / phonetics builtin. Alias for morse_decode.

my $result = demorse $x 
# or in a pipeline:
@list |> map demorse |> p

# dense_rank

dense_rank — extended stdlib builtin.

my $result = dense_rank $x 
# or in a pipeline:
@list |> map dense_rank |> p

# density

density — kernel density estimation with Gaussian kernel and Silverman bandwidth. Returns [[x_grid], [density_values]]. Like R's density().

my ($x, $y) = @{density([1,2,2,3,3,3,4,4,5])}
# $x is grid of 512 points, $y is estimated density

# depdbl

depdbl — math / numeric (uncategorized batch) builtin. Alias for depreciation_double.

my $result = depdbl $x 
# or in a pipeline:
@list |> map depdbl |> p

# deplin

deplin — math / numeric (uncategorized batch) builtin. Alias for depreciation_linear.

my $result = deplin $x 
# or in a pipeline:
@list |> map deplin |> p

# depreciation_double

depreciation_double — math / numeric (uncategorized batch) builtin.

my $result = depreciation_double $x 
# or in a pipeline:
@list |> map depreciation_double |> p

# depreciation_linear

depreciation_linear — math / numeric (uncategorized batch) builtin.

my $result = depreciation_linear $x 
# or in a pipeline:
@list |> map depreciation_linear |> p

# derangements

derangements counts the number of derangements (subfactorial !n) — permutations with no fixed points.

p derangements(4)   # 9
p derangements(5)   # 44

# deroman

deroman — roman numerals builtin. Alias for roman_to_int.

my $result = deroman $x 
# or in a pipeline:
@list |> map deroman |> p

# describe

describe(@data) — returns a hashref with comprehensive descriptive statistics: count, mean, std, min, 25%, 50%, 75%, max. Similar to pandas DataFrame.describe().

my $stats = describe(1:100)
p $stats->{mean}    # 50.5
p $stats->{std}     # ~29.0
p $stats->{"50%"}   # median

# det

matrix_det_general (aliases mdetg, det) computes the determinant of any NxN matrix via LU decomposition.

p det([[1,2,3],[4,5,6],[7,8,0]])  # 27

# detect

detect — functional / iterator builtin.

my $result = detect $x 
# or in a pipeline:
@list |> map detect |> p

# dew_point

dew_point — physics formulas builtin.

my $result = dew_point $x 
# or in a pipeline:
@list |> map dew_point |> p

# df

df — data / network builtin. Alias for dataframe.

my $result = df $x 
# or in a pipeline:
@list |> map df |> p

# dfact

dfact — math formulas builtin. Alias for double_factorial.

my $result = dfact $x 
# or in a pipeline:
@list |> map dfact |> p

# dfs

dfs — extended stdlib builtin. Alias for dfs_traverse.

my $result = dfs $x 
# or in a pipeline:
@list |> map dfs |> p

# dfs_traverse

dfs_traverse — extended stdlib builtin.

my $result = dfs_traverse $x 
# or in a pipeline:
@list |> map dfs_traverse |> p

# dft

dft(\@signal) — computes the Discrete Fourier Transform. Returns arrayref of complex numbers as [re, im] pairs. O(n²) reference implementation; for large n, use FFT libraries.

my @signal = map { sin(2 * 3.14159 * _ / 64) } 0:63
my $spectrum = dft(\@signal)

# dgeom

dgeom — geometric PMF P(X=k). Args: k, prob.

p dgeom(3, 0.5)  # P(first success on 4th trial)

# dhyper

dhyper — hypergeometric PMF. Args: k, m (white), n (black), nn (draws).

p dhyper(2, 5, 5, 3)  # P(2 white balls in 3 draws from 5W+5B)

# diag

diag — extended stdlib builtin. Alias for diagonal.

my $result = diag $x 
# or in a pipeline:
@list |> map diag |> p

# diagonal

diagonal — extended stdlib builtin.

my $result = diagonal $x 
# or in a pipeline:
@list |> map diagonal |> p

# dice_coefficient

dice_coefficient — extended stdlib batch 3 builtin.

my $result = dice_coefficient $x 
# or in a pipeline:
@list |> map dice_coefficient |> p

# dice_roll

dice_roll — random builtin.

my $result = dice_roll $x 
# or in a pipeline:
@list |> map dice_roll |> p

# dicecoef

dicecoef — extended stdlib batch 3 builtin. Alias for dice_coefficient.

my $result = dicecoef $x 
# or in a pipeline:
@list |> map dicecoef |> p

# die_if

die_if — conversion / utility (batch 4) builtin.

my $result = die_if $x 
# or in a pipeline:
@list |> map die_if |> p

# die_unless

die_unless — conversion / utility (batch 4) builtin.

my $result = die_unless $x 
# or in a pipeline:
@list |> map die_unless |> p

# diff

diff — extended stdlib builtin.

my $result = diff $x 
# or in a pipeline:
@list |> map diff |> p

# diff_array

numerical_diff (aliases numdiff, diff_array) computes the numerical first derivative via central differences. Returns an array.

my @y = map { _ ** 2 } 0:10
my @dy = @{numdiff(\@y)}  # ≈ [0, 2, 4, 6, ...]

# diff_days

diff_days — extended stdlib builtin.

my $result = diff_days $x 
# or in a pipeline:
@list |> map diff_days |> p

# diff_hours

diff_hours — extended stdlib builtin.

my $result = diff_hours $x 
# or in a pipeline:
@list |> map diff_hours |> p

# diff_lag

diff_lag (alias diff_ts) — lagged differences. Args: vec [, lag, differences]. Like R's diff().

p diff_lag([1,3,6,10])       # [2,3,4] (lag=1)
p diff_lag([1,3,6,10], 2)    # [5,7] (lag=2)
p diff_lag([1,3,6,10], 1, 2) # [1,1] (second differences)

# diffd

diffd — extended stdlib builtin. Alias for diff_days.

my $result = diffd $x 
# or in a pipeline:
@list |> map diffd |> p

# diffh

diffh — extended stdlib builtin. Alias for diff_hours.

my $result = diffh $x 
# or in a pipeline:
@list |> map diffh |> p

# dig

dig — python/ruby stdlib builtin.

my $result = dig $x 
# or in a pipeline:
@list |> map dig |> p

# digital_root

digital_root — extended stdlib batch 3 builtin.

my $result = digital_root $x 
# or in a pipeline:
@list |> map digital_root |> p

# digits_of

digits_of — list helpers (batch 4) builtin.

my $result = digits_of $x 
# or in a pipeline:
@list |> map digits_of |> p

# digroot

digroot — extended stdlib batch 3 builtin. Alias for digital_root.

my $result = digroot $x 
# or in a pipeline:
@list |> map digroot |> p

# dijkstra

dijkstra (alias shortest_path) computes shortest paths from a source node. Graph is a hash of {node => [[neighbor, weight], ...]}. Returns {node => distance}.

my $g = {A => [["B",1],["C",4]], B => [["C",2]], C => []}
my $d = dijkstra($g, "A")  # {A=>0, B=>1, C=>3}

# dim

dim — color / ansi builtin. Alias for red.

my $result = dim $x 
# or in a pipeline:
@list |> map dim |> p

# diopter

diopter — physics formulas builtin. Alias for lens_power.

my $result = diopter $x 
# or in a pipeline:
@list |> map diopter |> p

# dirs

dirs — filesystem extensions builtin.

my $result = dirs $x 
# or in a pipeline:
@list |> map dirs |> p

# discount

discount — math / numeric (uncategorized batch) builtin.

my $result = discount $x 
# or in a pipeline:
@list |> map discount |> p

# discount_amount

discount_amount — physics formulas builtin.

my $result = discount_amount $x 
# or in a pipeline:
@list |> map discount_amount |> p

# discounted_payback

discounted_payback($initial, $rate, @cashflows) — computes payback period using discounted cash flows. Accounts for time value of money.

p discounted_payback(1000, 0.1, 400, 400, 400, 400)

# disk_avail

disk_avail PATH — available disk space in bytes for non-root users. Uses f_bavail from statvfs, which excludes blocks reserved for the superuser.

p format_bytes(disk_avail)               # 76.3 GiB
gauge(1 - disk_avail / disk_total) |> p  # usage gauge

# disk_free

disk_free PATH — free disk space in bytes (superuser view). Uses f_bfree from statvfs.

p format_bytes(disk_free)                # 76.3 GiB
p format_bytes(disk_free("/tmp"))

# disk_total

disk_total PATH — total disk space in bytes for the filesystem containing PATH (default /). Uses statvfs on unix. Returns undef on unsupported platforms.

p format_bytes(disk_total)               # 1.8 TiB
p format_bytes(disk_total("/home"))       # specific mount

# disk_used

disk_used PATH — used disk space in bytes (total - free).

p format_bytes(disk_used)                # 1.7 TiB
my $pct = int(disk_used / disk_total * 100)
p "$pct% disk used"

# dissoc

dissoc — algebraic match builtin.

my $result = dissoc $x 
# or in a pipeline:
@list |> map dissoc |> p

# dist

dist — extended stdlib builtin. Alias for distance.

my $result = dist $x 
# or in a pipeline:
@list |> map dist |> p

# dist_mat

dist_matrix (alias dist_mat) — pairwise distance matrix. Supports 'euclidean' (default), 'manhattan', 'maximum'. Like R's dist().

my $D = dist_mat([[0,0],[1,0],[0,1]])  # 3x3 distance matrix
my $D2 = dist_mat([[0,0],[1,1]], "manhattan")  # Manhattan

# distance

distance — extended stdlib builtin.

my $result = distance $x 
# or in a pipeline:
@list |> map distance |> p

# distb

distb — additional missing stdlib functions builtin. Alias for distinct_by.

my $result = distb $x 
# or in a pipeline:
@list |> map distb |> p

# distinct_by

distinct_by — additional missing stdlib functions builtin.

my $result = distinct_by $x 
# or in a pipeline:
@list |> map distinct_by |> p

# distinct_count

distinct_count — collection (batch 2) builtin.

my $result = distinct_count $x 
# or in a pipeline:
@list |> map distinct_count |> p

# divisors

divisors — math / numeric (uncategorized batch) builtin.

my $result = divisors $x 
# or in a pipeline:
@list |> map divisors |> p

# divmod

divmod — python/ruby stdlib builtin.

my $result = divmod $x 
# or in a pipeline:
@list |> map divmod |> p

# divs

divs — math / numeric (uncategorized batch) builtin. Alias for divisors.

my $result = divs $x 
# or in a pipeline:
@list |> map divs |> p

# djb2

djb2 — extended stdlib builtin.

my $result = djb2 $x 
# or in a pipeline:
@list |> map djb2 |> p

# dm

dm — python/ruby stdlib builtin. Alias for divmod.

my $result = dm $x 
# or in a pipeline:
@list |> map dm |> p

# dmetph

dmetph — encoding / phonetics builtin. Alias for double_metaphone.

my $result = dmetph $x 
# or in a pipeline:
@list |> map dmetph |> p

# dnbinom

dnbinom — negative binomial PMF. Args: k, size, prob.

p dnbinom(3, 5, 0.5)  # P(3 failures before 5 successes)

# do_call

do_call — call a function with args from a list. Like R's do.call().

my $result = docall(fn { $_[0] + $_[1] }, [3, 4])  # 7

# doppler

doppler_frequency($source_freq, $source_vel, $observer_vel) (alias doppler) — observed frequency with Doppler effect. Uses speed of sound (343 m/s).

p doppler(440, -30, 0)   # ~482 Hz (ambulance approaching at 30 m/s)
p doppler(440, 30, 0)    # ~405 Hz (ambulance receding)

# dot_case

dot_case — string (batch 2) builtin.

my $result = dot_case $x 
# or in a pipeline:
@list |> map dot_case |> p

# dot_product

dot_product — extended stdlib builtin.

my $result = dot_product $x 
# or in a pipeline:
@list |> map dot_product |> p

# dotp

dotp — extended stdlib builtin. Alias for dot_product.

my $result = dotp $x 
# or in a pipeline:
@list |> map dotp |> p

# double

double — trivial numeric / predicate builtins builtin.

my $result = double $x 
# or in a pipeline:
@list |> map double |> p

# double_each

double_each — trivial numeric helpers (batch 4) builtin.

my $result = double_each $x 
# or in a pipeline:
@list |> map double_each |> p

# double_factorial

double_factorial — math formulas builtin.

my $result = double_factorial $x 
# or in a pipeline:
@list |> map double_factorial |> p

# double_metaphone

double_metaphone — encoding / phonetics builtin.

my $result = double_metaphone $x 
# or in a pipeline:
@list |> map double_metaphone |> p

# downcase_each

downcase_each — trivial numeric helpers (batch 4) builtin.

my $result = downcase_each $x 
# or in a pipeline:
@list |> map downcase_each |> p

# downsample

downsample(\@signal, $factor) (alias decimate) — reduces sample rate by keeping every nth sample. Apply anti-aliasing filter first to avoid aliasing.

my $decimated = decimate(\@signal, 4)  # keep every 4th sample

# downto

downto — python/ruby stdlib builtin.

my $result = downto $x 
# or in a pipeline:
@list |> map downto |> p

# doy

doy — extended stdlib batch 3 builtin. Alias for day_of_year.

my $result = doy $x 
# or in a pipeline:
@list |> map doy |> p

# dpayback

dpayback — finance (extended) builtin. Alias for discounted_payback.

my $result = dpayback $x 
# or in a pipeline:
@list |> map dpayback |> p

# dr

dr — filesystem extensions builtin.

my $result = dr $x 
# or in a pipeline:
@list |> map dr |> p

# drag_force

drag_force (alias fdrag) computes aerodynamic drag: F = 0.5·Cd·ρ·A·v². Args: drag_coeff, air_density, area, velocity.

p fdrag(0.47, 1.225, 0.01, 30)  # drag on a ball at 30 m/s

# drnk

drnk — extended stdlib builtin. Alias for dense_rank.

my $result = drnk $x 
# or in a pipeline:
@list |> map drnk |> p

# drop_every

drop_every — list helpers (batch 4) builtin.

my $result = drop_every $x 
# or in a pipeline:
@list |> map drop_every |> p

# drop_last

drop_last — file stat / path builtin.

my $result = drop_last $x 
# or in a pipeline:
@list |> map drop_last |> p

# drop_n

drop_n — collection helpers (trivial) builtin.

my $result = drop_n $x 
# or in a pipeline:
@list |> map drop_n |> p

# dsamp

dsamp — dsp / signal (extended) builtin. Alias for downsample.

my $result = dsamp $x 
# or in a pipeline:
@list |> map dsamp |> p

# dte

dte — date / time builtin. Alias for datetime_from_epoch.

my $result = dte $x 
# or in a pipeline:
@list |> map dte |> p

# dtf

dtf — date / time builtin. Alias for datetime_strftime.

my $result = dtf $x 
# or in a pipeline:
@list |> map dtf |> p

# dump

dump — process / system builtin.

my $result = dump $x 
# or in a pipeline:
@list |> map dump |> p

# dunif

dunif — uniform PDF. Args: x, a, b.

p dunif(0.5, 0, 1)  # 1.0

# duped

duplicated — boolean array: 1 if element appeared earlier in the vector, 0 otherwise. Like R's duplicated().

p duplicated([1,2,3,2,1])  # [0,0,0,1,1]

# duplicate_count

duplicate_count — list helpers (batch 4) builtin.

my $result = duplicate_count $x 
# or in a pipeline:
@list |> map duplicate_count |> p

# each_cons

each_cons — python/ruby stdlib builtin.

my $result = each_cons $x 
# or in a pipeline:
@list |> map each_cons |> p

# each_slice

each_slice — python/ruby stdlib builtin.

my $result = each_slice $x 
# or in a pipeline:
@list |> map each_slice |> p

# each_with_index

each_with_index — functional / iterator builtin.

my $result = each_with_index $x 
# or in a pipeline:
@list |> map each_with_index |> p

# each_with_object

each_with_object — additional missing stdlib functions builtin.

my $result = each_with_object $x 
# or in a pipeline:
@list |> map each_with_object |> p

# earth_mass

earth_mass (alias mearth) — M⊕ ≈ 5.972×10²⁴ kg. Mass of Earth.

p mearth   # 5.972167867e24 kg

# earth_radius

earth_radius — physics constants builtin.

my $result = earth_radius $x 
# or in a pipeline:
@list |> map earth_radius |> p

# ecdf

ecdf — empirical CDF: proportion of data ≤ x. Like R's ecdf().

p ecdf([1,2,3,4,5], 3)  # 0.6 (3 of 5 values ≤ 3)

# echarge

echarge — constants builtin. Alias for elementary_charge.

my $result = echarge $x 
# or in a pipeline:
@list |> map echarge |> p

# econs

econs — python/ruby stdlib builtin. Alias for each_cons.

my $result = econs $x 
# or in a pipeline:
@list |> map econs |> p

# efield

efield — physics formulas builtin. Alias for electric_field.

my $result = efield $x 
# or in a pipeline:
@list |> map efield |> p

# eig

matrix_eigenvalues (aliases meig, eig) computes eigenvalues of a square matrix via QR iteration. Returns an array of eigenvalues.

my @eigs = @{eig([[2,1],[1,2]])}   # [3, 1]

# either

either — boolean combinators builtin.

my $result = either $x 
# or in a pipeline:
@list |> map either |> p

# electric_field

electric_field — physics formulas builtin.

my $result = electric_field $x 
# or in a pipeline:
@list |> map electric_field |> p

# electron_mass

electron_mass — constants builtin.

my $result = electron_mass $x 
# or in a pipeline:
@list |> map electron_mass |> p

# elem_at

elem_at — list helpers (batch 4) builtin.

my $result = elem_at $x 
# or in a pipeline:
@list |> map elem_at |> p

# elem_index

elem_index — additional missing stdlib functions builtin.

my $result = elem_index $x 
# or in a pipeline:
@list |> map elem_index |> p

# elem_indices

elem_indices — additional missing stdlib functions builtin.

my $result = elem_indices $x 
# or in a pipeline:
@list |> map elem_indices |> p

# elem_of

elem_of — haskell list functions builtin.

my $result = elem_of $x 
# or in a pipeline:
@list |> map elem_of |> p

# elementary_charge

elementary_charge — constants builtin.

my $result = elementary_charge $x 
# or in a pipeline:
@list |> map elementary_charge |> p

# elidx

elidx — additional missing stdlib functions builtin. Alias for elem_index.

my $result = elidx $x 
# or in a pipeline:
@list |> map elidx |> p

# elidxs

elidxs — additional missing stdlib functions builtin. Alias for elem_indices.

my $result = elidxs $x 
# or in a pipeline:
@list |> map elidxs |> p

# ellipperim

ellipperim — geometry (extended) builtin. Alias for ellipse_perimeter.

my $result = ellipperim $x 
# or in a pipeline:
@list |> map ellipperim |> p

# ellipse_perimeter

ellipse_perimeter($a, $b) (alias ellper) — approximates the perimeter of an ellipse with semi-axes a and b. Uses Ramanujan's approximation.

p ellper(5, 3)   # ~25.5
p ellper(10, 10)   # ~62.8 (circle)

# ellipsis

ellipsis — string quote / escape builtin.

my $result = ellipsis $x 
# or in a pipeline:
@list |> map ellipsis |> p

# elof

elof — haskell list functions builtin. Alias for elem_of.

my $result = elof $x 
# or in a pipeline:
@list |> map elof |> p

# elu

elu applies the Exponential Linear Unit: x if x≥0, alpha*(e^x - 1) otherwise.

p elu(1)     # 1
p elu(-1)    # -0.632

# email_domain

email_domain — url / email parts builtin.

my $result = email_domain $x 
# or in a pipeline:
@list |> map email_domain |> p

# email_local

email_local — url / email parts builtin.

my $result = email_local $x 
# or in a pipeline:
@list |> map email_local |> p

# emass

emass — constants builtin. Alias for electron_mass.

my $result = emass $x 
# or in a pipeline:
@list |> map emass |> p

# emavg

emavg — math / numeric (uncategorized batch) builtin. Alias for exponential_moving_average.

my $result = emavg $x 
# or in a pipeline:
@list |> map emavg |> p

# embed

embed — time-delay embedding. Converts a time series into a matrix of lagged values. Like R's embed().

p embed([1,2,3,4,5], 3)  # [[3,2,1],[4,3,2],[5,4,3]]

# emojinum

emojinum — encoding / phonetics builtin. Alias for to_emoji_num.

my $result = emojinum $x 
# or in a pipeline:
@list |> map emojinum |> p

# empc

empc — algebraic match builtin. Alias for empty_clj.

my $result = empc $x 
# or in a pipeline:
@list |> map empc |> p

# empty_clj

empty_clj — algebraic match builtin.

my $result = empty_clj $x 
# or in a pipeline:
@list |> map empty_clj |> p

# empty_count

empty_count — counters (batch 4) builtin.

my $result = empty_count $x 
# or in a pipeline:
@list |> map empty_count |> p

# end_of_day

end_of_day — extended stdlib builtin.

my $result = end_of_day $x 
# or in a pipeline:
@list |> map end_of_day |> p

# endgrent

endgrent — posix metadata builtin.

my $result = endgrent $x 
# or in a pipeline:
@list |> map endgrent |> p

# endhostent

endhostent — posix metadata builtin.

my $result = endhostent $x 
# or in a pipeline:
@list |> map endhostent |> p

# endianness

endianness — byte order of the platform: "little" or "big". Compile-time constant.

p endianness                             # little

# endnetent

endnetent — posix metadata builtin.

my $result = endnetent $x 
# or in a pipeline:
@list |> map endnetent |> p

# endprotoent

endprotoent — posix metadata builtin.

my $result = endprotoent $x 
# or in a pipeline:
@list |> map endprotoent |> p

# endpwent

endpwent — posix metadata builtin.

my $result = endpwent $x 
# or in a pipeline:
@list |> map endpwent |> p

# ends_with

ends_with — trivial string ops builtin.

my $result = ends_with $x 
# or in a pipeline:
@list |> map ends_with |> p

# ends_with_any

ends_with_any — string (batch 2) builtin.

my $result = ends_with_any $x 
# or in a pipeline:
@list |> map ends_with_any |> p

# endservent

endservent — posix metadata builtin.

my $result = endservent $x 
# or in a pipeline:
@list |> map endservent |> p

# energy

energy(\@signal) — computes the total energy of a signal as the sum of squared samples. Useful for audio analysis and feature extraction.

p energy(\@signal)   # total signal energy

# ensure_prefix

ensure_prefix — path helpers builtin.

my $result = ensure_prefix $x 
# or in a pipeline:
@list |> map ensure_prefix |> p

# ensure_suffix

ensure_suffix — path helpers builtin.

my $result = ensure_suffix $x 
# or in a pipeline:
@list |> map ensure_suffix |> p

# entropy

entropy — math functions builtin.

my $result = entropy $x 
# or in a pipeline:
@list |> map entropy |> p

# env

env — dsp / signal (extended) builtin. Alias for envelope.

my $result = env $x 
# or in a pipeline:
@list |> map env |> p

# env_get

env_get — process / env builtin.

my $result = env_get $x 
# or in a pipeline:
@list |> map env_get |> p

# env_has

env_has — process / env builtin.

my $result = env_has $x 
# or in a pipeline:
@list |> map env_has |> p

# env_keys

env_keys — process / env builtin.

my $result = env_keys $x 
# or in a pipeline:
@list |> map env_keys |> p

# env_pairs

env_pairs — more process / system builtin.

my $result = env_pairs $x 
# or in a pipeline:
@list |> map env_pairs |> p

# env_remove

env_remove — more process / system builtin.

my $result = env_remove $x 
# or in a pipeline:
@list |> map env_remove |> p

# env_set

env_set — more process / system builtin.

my $result = env_set $x 
# or in a pipeline:
@list |> map env_set |> p

# envelope

envelope(\@signal) (alias hilbert_env) — computes the amplitude envelope using Hilbert transform magnitude. Useful for amplitude modulation analysis.

my $env = envelope(\@signal)
# $env traces the amplitude of oscillations

# eod

eod — extended stdlib builtin. Alias for end_of_day.

my $result = eod $x 
# or in a pipeline:
@list |> map eod |> p

# epoch

epoch — now / timestamp builtin. Alias for unix_epoch.

my $result = epoch $x 
# or in a pipeline:
@list |> map epoch |> p

# epoch_ms

epoch_ms — now / timestamp builtin. Alias for unix_epoch_ms.

my $result = epoch_ms $x 
# or in a pipeline:
@list |> map epoch_ms |> p

# eps

eps — math / numeric (uncategorized batch) builtin. Alias for epsilon.

my $result = eps $x 
# or in a pipeline:
@list |> map eps |> p

# epsilon

epsilon — math / numeric (uncategorized batch) builtin.

my $result = epsilon $x 
# or in a pipeline:
@list |> map epsilon |> p

# epsilon0

vacuum_permittivity (alias epsilon0) — ε₀ ≈ 8.854×10⁻¹² F/m. Electric constant, permittivity of free space.

p epsilon0   # 8.8541878128e-12

# eqidx

eqidx — extended stdlib batch 3 builtin. Alias for equilibrium_index.

my $result = eqidx $x 
# or in a pipeline:
@list |> map eqidx |> p

# eqrng

eqrng — extended stdlib builtin. Alias for equal_range.

my $result = eqrng $x 
# or in a pipeline:
@list |> map eqrng |> p

# equal_range

equal_range — extended stdlib builtin.

my $result = equal_range $x 
# or in a pipeline:
@list |> map equal_range |> p

# equilibrium_index

equilibrium_index — extended stdlib batch 3 builtin.

my $result = equilibrium_index $x 
# or in a pipeline:
@list |> map equilibrium_index |> p

# erf_approx

erf_approx($x) — error function. Used in probability, statistics, and partial differential equations.

p erf(1)    # ~0.843
p erf(2)    # ~0.995

# escape_json

escape_json — json helpers builtin.

my $result = escape_json $x 
# or in a pipeline:
@list |> map escape_json |> p

# escape_velocity

escape_velocity($mass, $radius) (alias escvel) — minimum velocity to escape gravitational field: v = √(2GM/r). Defaults to Earth values.

p escvel                        # ~11186 m/s (Earth)
p escvel(1.989e30, 6.96e8)      # ~617 km/s (Sun)

# eslice

eslice — python/ruby stdlib builtin. Alias for each_slice.

my $result = eslice $x 
# or in a pipeline:
@list |> map eslice |> p

# etot

etot — extended stdlib batch 3 builtin. Alias for euler_totient.

my $result = etot $x 
# or in a pipeline:
@list |> map etot |> p

# eucdist

eucdist — math / numeric (uncategorized batch) builtin. Alias for euclidean_distance.

my $result = eucdist $x 
# or in a pipeline:
@list |> map eucdist |> p

# euclidean_distance

euclidean_distance — math / numeric (uncategorized batch) builtin.

my $result = euclidean_distance $x 
# or in a pipeline:
@list |> map euclidean_distance |> p

# euler_e

euler_e — math / numeric (uncategorized batch) builtin. Alias for euler_number.

my $result = euler_e $x 
# or in a pipeline:
@list |> map euler_e |> p

# euler_mascheroni

euler_mascheroni (alias gamma_const) — Euler-Mascheroni constant γ ≈ 0.5772. Appears in number theory and analysis.

p euler_mascheroni   # 0.5772156649015329

# euler_method

euler_ode (alias euler_method) solves an ODE dy/dt = f(t,y) using the Euler method. Returns [[t,y], ...].

my $sol = euler_ode(fn { $_[1] }, 0, 1, 0.01, 100)  # exponential growth

# euler_number

euler_number — math / numeric (uncategorized batch) builtin.

my $result = euler_number $x 
# or in a pipeline:
@list |> map euler_number |> p

# euler_totient

euler_totient — extended stdlib batch 3 builtin.

my $result = euler_totient $x 
# or in a pipeline:
@list |> map euler_totient |> p

# eval_rpn

eval_rpn — algorithms / puzzles builtin.

my $result = eval_rpn $x 
# or in a pipeline:
@list |> map eval_rpn |> p

# even

even — trivial numeric / predicate builtins builtin.

my $result = even $x 
# or in a pipeline:
@list |> map even |> p

# every_nth

every_nth — collection helpers (trivial) builtin.

my $result = every_nth $x 
# or in a pipeline:
@list |> map every_nth |> p

# ew

ew — trivial string ops builtin. Alias for ends_with.

my $result = ew $x 
# or in a pipeline:
@list |> map ew |> p

# ewo

ewo — additional missing stdlib functions builtin. Alias for each_with_object.

my $result = ewo $x 
# or in a pipeline:
@list |> map ewo |> p

# exp2

exp2 — trivial numeric / predicate builtins builtin.

my $result = exp2 $x 
# or in a pipeline:
@list |> map exp2 |> p

# exponential_moving_average

exponential_moving_average — math / numeric (uncategorized batch) builtin.

my $result = exponential_moving_average $x 
# or in a pipeline:
@list |> map exponential_moving_average |> p

# exponential_pdf

exponential_pdf — math formulas builtin.

my $result = exponential_pdf $x 
# or in a pipeline:
@list |> map exponential_pdf |> p

# exppdf

exppdf — math formulas builtin. Alias for exponential_pdf.

my $result = exppdf $x 
# or in a pipeline:
@list |> map exppdf |> p

# extract_between

extract_between — string quote / escape builtin.

my $result = extract_between $x 
# or in a pipeline:
@list |> map extract_between |> p

# eye

eye — matrix / linear algebra builtin. Alias for identity_matrix.

my $result = eye $x 
# or in a pipeline:
@list |> map eye |> p

# f

f — filesystem extensions builtin.

my $result = f $x 
# or in a pipeline:
@list |> map f |> p

# f64_max

f64_max — math / numeric (uncategorized batch) builtin.

my $result = f64_max $x 
# or in a pipeline:
@list |> map f64_max |> p

# f64_min

f64_min — math / numeric (uncategorized batch) builtin.

my $result = f64_min $x 
# or in a pipeline:
@list |> map f64_min |> p

# f_pdf

f_pdf (alias fpdf) evaluates the F-distribution PDF at x with d1 and d2 degrees of freedom.

p fpdf(1.0, 5, 10)

# f_to_c

f_to_c — unit conversions builtin.

my $result = f_to_c $input 

# f_to_k

f_to_k — unit conversions builtin.

my $result = f_to_k $input 

# fact

fact — trivial numeric / predicate builtins builtin. Alias for factorial.

my $result = fact $x 
# or in a pipeline:
@list |> map fact |> p

# factorial

factorial — trivial numeric / predicate builtins builtin.

my $result = factorial $x 
# or in a pipeline:
@list |> map factorial |> p

# falf

falf — python/ruby stdlib builtin. Alias for filterfalse.

my $result = falf $x 
# or in a pipeline:
@list |> map falf |> p

# fallback

fallback — functional combinators builtin.

my $result = fallback $x 
# or in a pipeline:
@list |> map fallback |> p

# falling_factorial

falling_factorial — math formulas builtin.

my $result = falling_factorial $x 
# or in a pipeline:
@list |> map falling_factorial |> p

# falsy_count

falsy_count — counters (batch 4) builtin.

my $result = falsy_count $x 
# or in a pipeline:
@list |> map falsy_count |> p

# faraday

faraday_constant (alias faraday) — F ≈ 96485 C/mol. Charge per mole of electrons.

p faraday   # 96485.33212

# fb

fb — algorithms / puzzles builtin. Alias for fizzbuzz.

my $result = fb $x 
# or in a pipeline:
@list |> map fb |> p

# fcntl

fcntl — ipc builtin.

my $result = fcntl $x 
# or in a pipeline:
@list |> map fcntl |> p

# fcp

fcp — extended stdlib builtin. Alias for from_code_point.

my $result = fcp $x 
# or in a pipeline:
@list |> map fcp |> p

# fdivop

fdivop — extended stdlib builtin. Alias for floor_div_op.

my $result = fdivop $x 
# or in a pipeline:
@list |> map fdivop |> p

# feet_to_m

feet_to_m — unit conversions builtin.

my $result = feet_to_m $input 

# feiga

feiga — math constants builtin. Alias for feigenbaum_alpha.

my $result = feiga $x 
# or in a pipeline:
@list |> map feiga |> p

# feigd

feigenbaum_delta (alias feigd) — Feigenbaum constant δ ≈ 4.669. Universal constant in chaos theory.

p feigd   # 4.669201609102990

# feigenbaum_alpha

feigenbaum_alpha — math constants builtin.

my $result = feigenbaum_alpha $x 
# or in a pipeline:
@list |> map feigenbaum_alpha |> p

# fetch_val

fetch_val — python/ruby stdlib builtin.

my $result = fetch_val $x 
# or in a pipeline:
@list |> map fetch_val |> p

# ffact

ffact — math formulas builtin. Alias for falling_factorial.

my $result = ffact $x 
# or in a pipeline:
@list |> map ffact |> p

# ffirst

ffirst — algebraic match builtin.

my $result = ffirst $x 
# or in a pipeline:
@list |> map ffirst |> p

# ffs

ffs — algebraic match builtin. Alias for ffirst.

my $result = ffs $x 
# or in a pipeline:
@list |> map ffs |> p

# fft_magnitude

fft_magnitude — math / numeric (uncategorized batch) builtin.

my $result = fft_magnitude $x 
# or in a pipeline:
@list |> map fft_magnitude |> p

# fftmag

fftmag — math / numeric (uncategorized batch) builtin. Alias for fft_magnitude.

my $result = fftmag $x 
# or in a pipeline:
@list |> map fftmag |> p

# fib

fib — trivial numeric / predicate builtins builtin. Alias for fibonacci.

my $result = fib $x 
# or in a pipeline:
@list |> map fib |> p

# fibonacci

fibonacci — trivial numeric / predicate builtins builtin.

my $result = fibonacci $x 
# or in a pipeline:
@list |> map fibonacci |> p

# fibonacci_seq

fibonacci_seq — sequences builtin.

my $result = fibonacci_seq $x 
# or in a pipeline:
@list |> map fibonacci_seq |> p

# fidx

fidx — python/ruby stdlib builtin. Alias for find_index_fn.

my $result = fidx $x 
# or in a pipeline:
@list |> map fidx |> p

# file_atime

file_atime — file stat / path builtin.

my $result = file_atime $x 
# or in a pipeline:
@list |> map file_atime |> p

# file_ctime

file_ctime — file stat / path builtin.

my $result = file_ctime $x 
# or in a pipeline:
@list |> map file_ctime |> p

# file_mtime

file_mtime — file stat / path builtin.

my $result = file_mtime $x 
# or in a pipeline:
@list |> map file_mtime |> p

# file_size

file_size — file stat / path builtin.

my $result = file_size $x 
# or in a pipeline:
@list |> map file_size |> p

# files

files — filesystem extensions builtin.

my $result = files $x 
# or in a pipeline:
@list |> map files |> p

# filesf

filesf — filesystem extensions builtin.

my $result = filesf $x 
# or in a pipeline:
@list |> map filesf |> p

# fill_arr

fill_arr — javascript array/object methods builtin.

my $result = fill_arr $x 
# or in a pipeline:
@list |> map fill_arr |> p

# filla

filla — javascript array/object methods builtin. Alias for fill_arr.

my $result = filla $x 
# or in a pipeline:
@list |> map filla |> p

# filter_chars

filter_chars — string helpers (batch 4) builtin.

my $result = filter_chars $x 
# or in a pipeline:
@list |> map filter_chars |> p

# filter_indexed

filter_indexed — go/general functional utilities builtin.

my $result = filter_indexed $x 
# or in a pipeline:
@list |> map filter_indexed |> p

# filter_map

filter_map — rust iterator methods builtin.

my $result = filter_map $x 
# or in a pipeline:
@list |> map filter_map |> p

# filter_ts

ts_filter — linear convolution filter. Like R's filter(method='convolution').

my @smooth = @{ts_filter([1,5,2,8,3], [0.25,0.5,0.25])}

# filterfalse

filterfalse — python/ruby stdlib builtin.

my $result = filterfalse $x 
# or in a pipeline:
@list |> map filterfalse |> p

# find

find — functional / iterator builtin.

my $result = find $x 
# or in a pipeline:
@list |> map find |> p

# findInterval

find_interval — for each x, find which interval in breaks it falls into. Like R's findInterval().

p findInterval([1.5, 3.5, 7.5], [0, 2, 5, 10])  # [1, 2, 3]

# find_all

find_all — functional / iterator builtin.

my $result = find_all $x 
# or in a pipeline:
@list |> map find_all |> p

# find_all_indices

find_all_indices — extended stdlib builtin.

my $result = find_all_indices $x 
# or in a pipeline:
@list |> map find_all_indices |> p

# find_first

find_first — list helpers (batch 4) builtin.

my $result = find_first $x 
# or in a pipeline:
@list |> map find_first |> p

# find_index

find_index — functional / iterator builtin.

my $result = find_index $x 
# or in a pipeline:
@list |> map find_index |> p

# find_index_fn

find_index_fn — python/ruby stdlib builtin.

my $result = find_index_fn $x 
# or in a pipeline:
@list |> map find_index_fn |> p

# find_indices

find_indices — additional missing stdlib functions builtin.

my $result = find_indices $x 
# or in a pipeline:
@list |> map find_indices |> p

# find_last

find_last — javascript array/object methods builtin.

my $result = find_last $x 
# or in a pipeline:
@list |> map find_last |> p

# find_last_index

find_last_index — javascript array/object methods builtin.

my $result = find_last_index $x 
# or in a pipeline:
@list |> map find_last_index |> p

# find_map

find_map — rust iterator methods builtin.

my $result = find_map $x 
# or in a pipeline:
@list |> map find_map |> p

# first_arg

first_arg — functional primitives builtin.

my $result = first_arg $x 
# or in a pipeline:
@list |> map first_arg |> p

# first_elem

first_elem — list helpers (batch 4) builtin.

my $result = first_elem $x 
# or in a pipeline:
@list |> map first_elem |> p

# first_eq

first_eq — collection (batch 2) builtin.

my $result = first_eq $x 
# or in a pipeline:
@list |> map first_eq |> p

# first_word

first_word — string (batch 2) builtin.

my $result = first_word $x 
# or in a pipeline:
@list |> map first_word |> p

# five_number_summary

five_number_summary(@data) (alias fivenum) — returns [min, Q1, median, Q3, max], the classic five-number summary used for box plots. Provides a quick view of data distribution.

my @data = 1:100
my $f = fivenum(@data)
p "min=$f->[0] Q1=$f->[1] med=$f->[2] Q3=$f->[3] max=$f->[4]"

# fizzbuzz

fizzbuzz — algorithms / puzzles builtin.

my $result = fizzbuzz $x 
# or in a pipeline:
@list |> map fizzbuzz |> p

# flat_depth

flat_depth — javascript array/object methods builtin.

my $result = flat_depth $x 
# or in a pipeline:
@list |> map flat_depth |> p

# flat_map

flat_map — functional / iterator builtin.

my $result = flat_map $x 
# or in a pipeline:
@list |> map flat_map |> p

# flat_map_fn

flat_map_fn — python/ruby stdlib builtin.

my $result = flat_map_fn $x 
# or in a pipeline:
@list |> map flat_map_fn |> p

# flat_maps

flat_maps { BLOCK } LIST — a lazy streaming flat-map that evaluates the block for each element and flattens the resulting lists into a single iterator. Where maps expects the block to return one value, flat_maps handles blocks that return zero or more values per element and concatenates them seamlessly. This is the streaming equivalent of calling map with a multi-value block. Use it in |> chains when each input element fans out into multiple outputs and you want lazy evaluation.

1:3 |> flat_maps { (_, _ * 10) } |> e p
# 1 10 2 20 3 30
@nested |> flat_maps { @_ } |> e p   # flatten array-of-arrays

# flatten_deep

flatten_deep — collection more builtin.

my $result = flatten_deep $x 
# or in a pipeline:
@list |> map flatten_deep |> p

# flatten_once

flatten_once — list helpers (batch 4) builtin.

my $result = flatten_once $x 
# or in a pipeline:
@list |> map flatten_once |> p

# fldr

fldr — rust iterator methods builtin. Alias for fold_right.

my $result = fldr $x 
# or in a pipeline:
@list |> map fldr |> p

# flip_args

flip_args — functional primitives builtin.

my $result = flip_args $x 
# or in a pipeline:
@list |> map flip_args |> p

# float_bits

float_bits — math functions builtin.

my $result = float_bits $x 
# or in a pipeline:
@list |> map float_bits |> p

# floor

floor — trivial numeric / predicate builtins builtin.

my $result = floor $x 
# or in a pipeline:
@list |> map floor |> p

# floor_div

floor_div — trig / math (batch 2) builtin.

my $result = floor_div $x 
# or in a pipeline:
@list |> map floor_div |> p

# floor_div_op

floor_div_op — extended stdlib builtin.

my $result = floor_div_op $x 
# or in a pipeline:
@list |> map floor_div_op |> p

# floor_each

floor_each — trivial numeric helpers (batch 4) builtin.

my $result = floor_each $x 
# or in a pipeline:
@list |> map floor_each |> p

# floor_mod

floor_mod — extended stdlib builtin.

my $result = floor_mod $x 
# or in a pipeline:
@list |> map floor_mod |> p

# fltd

fltd — javascript array/object methods builtin. Alias for flat_depth.

my $result = fltd $x 
# or in a pipeline:
@list |> map fltd |> p

# flti

flti — go/general functional utilities builtin. Alias for filter_indexed.

my $result = flti $x 
# or in a pipeline:
@list |> map flti |> p

# fltm

fltm — rust iterator methods builtin. Alias for filter_map.

my $result = fltm $x 
# or in a pipeline:
@list |> map fltm |> p

# fma

fma — math functions builtin.

my $result = fma $x 
# or in a pipeline:
@list |> map fma |> p

# fmadd

fmadd — extended stdlib builtin. Alias for fused_mul_add.

my $result = fmadd $x 
# or in a pipeline:
@list |> map fmadd |> p

# fmf

fmf — python/ruby stdlib builtin. Alias for flat_map_fn.

my $result = fmf $x 
# or in a pipeline:
@list |> map fmf |> p

# fmod

fmod — extended stdlib builtin. Alias for floor_mod.

my $result = fmod $x 
# or in a pipeline:
@list |> map fmod |> p

# fndalli

fndalli — extended stdlib builtin. Alias for find_all_indices.

my $result = fndalli $x 
# or in a pipeline:
@list |> map fndalli |> p

# fndidxs

fndidxs — additional missing stdlib functions builtin. Alias for find_indices.

my $result = fndidxs $x 
# or in a pipeline:
@list |> map fndidxs |> p

# fndl

fndl — javascript array/object methods builtin. Alias for find_last.

my $result = fndl $x 
# or in a pipeline:
@list |> map fndl |> p

# fndli

fndli — javascript array/object methods builtin. Alias for find_last_index.

my $result = fndli $x 
# or in a pipeline:
@list |> map fndli |> p

# fndm

fndm — rust iterator methods builtin. Alias for find_map.

my $result = fndm $x 
# or in a pipeline:
@list |> map fndm |> p

# fne

fne — algebraic match builtin. Alias for fnext.

my $result = fne $x 
# or in a pipeline:
@list |> map fne |> p

# fnext

fnext — algebraic match builtin.

my $result = fnext $x 
# or in a pipeline:
@list |> map fnext |> p

# fnv1a

fnv1a — extended stdlib builtin.

my $result = fnv1a $x 
# or in a pipeline:
@list |> map fnv1a |> p

# fold_left

fold_left — list helpers (batch 4) builtin.

my $result = fold_left $x 
# or in a pipeline:
@list |> map fold_left |> p

# fold_right

fold_right — rust iterator methods builtin.

my $result = fold_right $x 
# or in a pipeline:
@list |> map fold_right |> p

# force_mass_acc

force_mass_acc — physics formulas builtin.

my $result = force_mass_acc $x 
# or in a pipeline:
@list |> map force_mass_acc |> p

# format_bytes

format_bytes — file stat / path builtin.

my $result = format_bytes $x 
# or in a pipeline:
@list |> map format_bytes |> p

# format_duration

format_duration — file stat / path builtin.

my $result = format_duration $x 
# or in a pipeline:
@list |> map format_duration |> p

# format_number

format_number — file stat / path builtin.

my $result = format_number $x 
# or in a pipeline:
@list |> map format_number |> p

# format_percent

format_percent — file stat / path builtin.

my $result = format_percent $x 
# or in a pipeline:
@list |> map format_percent |> p

# fr

fr — filesystem extensions builtin.

my $result = fr $x 
# or in a pipeline:
@list |> map fr |> p

# frac_part

frac_part — extended stdlib builtin.

my $result = frac_part $x 
# or in a pipeline:
@list |> map frac_part |> p

# fracp

fracp — extended stdlib builtin. Alias for frac_part.

my $result = fracp $x 
# or in a pipeline:
@list |> map fracp |> p

# freq_wavelength

freq_wavelength — physics formulas builtin.

my $result = freq_wavelength $x 
# or in a pipeline:
@list |> map freq_wavelength |> p

# from_base

from_base — base conversion builtin.

my $result = from_base $x 
# or in a pipeline:
@list |> map from_base |> p

# from_bin

from_bin — base conversion builtin.

my $result = from_bin $x 
# or in a pipeline:
@list |> map from_bin |> p

# from_code_point

from_code_point — extended stdlib builtin.

my $result = from_code_point $x 
# or in a pipeline:
@list |> map from_code_point |> p

# from_csv_line

from_csv_line — string helpers (batch 4) builtin.

my $result = from_csv_line $x 
# or in a pipeline:
@list |> map from_csv_line |> p

# from_digits

from_digits — list helpers (batch 4) builtin.

my $result = from_digits $x 
# or in a pipeline:
@list |> map from_digits |> p

# from_hex

from_hex — base conversion builtin.

my $result = from_hex $x 
# or in a pipeline:
@list |> map from_hex |> p

# from_oct

from_oct — base conversion builtin.

my $result = from_oct $x 
# or in a pipeline:
@list |> map from_oct |> p

# from_pairs

from_pairs — list helpers (batch 4) builtin.

my $result = from_pairs $x 
# or in a pipeline:
@list |> map from_pairs |> p

# frustum_volume

frustum_volume($r1, $r2, $h) — computes the volume of a conical frustum (truncated cone) with base radii r1 and r2 and height h.

p frustum_volume(5, 3, 10)   # ~513

# frustvol

frustvol — geometry (extended) builtin. Alias for frustum_volume.

my $result = frustvol $x 
# or in a pipeline:
@list |> map frustvol |> p

# fsize

fsize — file stat / path builtin. Alias for file_size.

my $result = fsize $x 
# or in a pipeline:
@list |> map fsize |> p

# fst

fst — internal builtin. Alias for __stryke_rust_compile.

my $result = fst $x 
# or in a pipeline:
@list |> map fst |> p

# ft

ft — data / network builtin. Alias for fetch.

my $result = ft $x 
# or in a pipeline:
@list |> map ft |> p

# fta

fta — data / network builtin. Alias for fetch_async.

my $result = fta $x 
# or in a pipeline:
@list |> map fta |> p

# ftaj

ftaj — data / network builtin. Alias for fetch_async_json.

my $result = ftaj $x 
# or in a pipeline:
@list |> map ftaj |> p

# ftj

ftj — data / network builtin. Alias for fetch_json.

my $result = ftj $x 
# or in a pipeline:
@list |> map ftj |> p

# fused_mul_add

fused_mul_add — extended stdlib builtin.

my $result = fused_mul_add $x 
# or in a pipeline:
@list |> map fused_mul_add |> p

# future_value

future_value — physics formulas builtin.

my $result = future_value $x 
# or in a pipeline:
@list |> map future_value |> p

# fv

fv — python/ruby stdlib builtin. Alias for fetch_val.

my $result = fv $x 
# or in a pipeline:
@list |> map fv |> p

# g_to_oz

g_to_oz — unit conversions builtin.

my $result = g_to_oz $input 

# gallons_to_liters

gallons_to_liters — file stat / path builtin.

my $result = gallons_to_liters $input 

# game_of_life_step

game_of_life_step — algorithms / puzzles builtin.

my $result = game_of_life_step $x 
# or in a pipeline:
@list |> map game_of_life_step |> p

# gamma_approx

gamma_approx($z) — Gamma function Γ(z) using Lanczos approximation. Extends factorial: Γ(n) = (n-1)!

p gamma(5)    # 24 (same as 4!)
p gamma(0.5)  # ~1.772 (√π)

# gamma_pdf

gamma_pdf (alias gammapdf) evaluates the Gamma distribution PDF at x with shape k and scale theta.

p gammapdf(2.0, 2, 1)  # Gamma(2,1) at x=2

# gas_constant

gas_constant (alias rgas) — R ≈ 8.314 J/(mol⋅K). Universal gas constant.

p rgas   # 8.314462618

# gasp

ideal_gas_pressure($n, $V, $T) (alias gasp) — pressure P = nRT/V. n moles, V volume (m³), T temperature (K).

p gasp(1, 0.0224, 273.15)   # ~101325 Pa (1 mol at STP)

# gasv

gasv — physics formulas builtin. Alias for ideal_gas_volume.

my $result = gasv $x 
# or in a pipeline:
@list |> map gasv |> p

# gb_to_bytes

gb_to_bytes — unit conversions builtin.

my $result = gb_to_bytes $input 

# gbf

gbf — go/general functional utilities builtin. Alias for group_by_fn.

my $result = gbf $x 
# or in a pipeline:
@list |> map gbf |> p

# gbi

gbi — python/ruby stdlib builtin. Alias for groupby_iter.

my $result = gbi $x 
# or in a pipeline:
@list |> map gbi |> p

# gcby

gcby — matrix operations (uncategorized batch) builtin. Alias for group_consecutive_by.

my $result = gcby $x 
# or in a pipeline:
@list |> map gcby |> p

# gcd

gcd — trivial numeric / predicate builtins builtin.

my $result = gcd $x 
# or in a pipeline:
@list |> map gcd |> p

# gconst

gconst — constants builtin. Alias for gravitational_constant.

my $result = gconst $x 
# or in a pipeline:
@list |> map gconst |> p

# gelu

gelu applies the Gaussian Error Linear Unit, used in BERT/GPT transformers.

p gelu(1)    # 0.8412
p gelu(-1)   # -0.1588

# geometric_mean

geometric_mean — file stat / path builtin.

my $result = geometric_mean $x 
# or in a pipeline:
@list |> map geometric_mean |> p

# geometric_series

geometric_series($a1, $r, $n) (alias geomser) — sum of n terms of geometric sequence. Formula: a1×(1-rⁿ)/(1-r). If r=1, returns a1×n.

p geomser(1, 2, 10)      # 1023 (1+2+4+...+512)
p geomser(1, 0.5, 10)    # ~1.998 (converging to 2)

# get_in

get_in — algebraic match builtin.

my $result = get_in $x 
# or in a pipeline:
@list |> map get_in |> p

# gethostent

gethostent — posix metadata builtin.

my $result = gethostent $x 
# or in a pipeline:
@list |> map gethostent |> p

# getnetbyname

getnetbyname — posix metadata builtin.

my $result = getnetbyname $x 
# or in a pipeline:
@list |> map getnetbyname |> p

# getnetent

getnetent — posix metadata builtin.

my $result = getnetent $x 
# or in a pipeline:
@list |> map getnetent |> p

# getprotoent

getprotoent — posix metadata builtin.

my $result = getprotoent $x 
# or in a pipeline:
@list |> map getprotoent |> p

# getservent

getservent — posix metadata builtin.

my $result = getservent $x 
# or in a pipeline:
@list |> map getservent |> p

# gforce

gravitational_force($m1, $m2, $r) (alias gforce) — Newton's law of gravitation: F = Gm₁m₂/r².

p gforce(5.972e24, 1000, 6.371e6)   # ~9820 N (1 ton at Earth surface)

# gid

gid — system introspection builtin.

my $result = gid $x 
# or in a pipeline:
@list |> map gid |> p

# gin

gin — algebraic match builtin. Alias for get_in.

my $result = gin $x 
# or in a pipeline:
@list |> map gin |> p

# gini

gini(@data) (alias gini_coefficient) — computes the Gini coefficient measuring inequality in a distribution. Returns a value from 0 (perfect equality) to 1 (perfect inequality). Commonly used for income distribution analysis.

p gini(1, 1, 1, 1)     # 0 (perfect equality)
p gini(0, 0, 0, 100)   # ~0.75 (high inequality)

# glaisher

glaisher — math constants builtin. Alias for glaisher_constant.

my $result = glaisher $x 
# or in a pipeline:
@list |> map glaisher |> p

# glaisher_constant

glaisher_constant — math constants builtin.

my $result = glaisher_constant $x 
# or in a pipeline:
@list |> map glaisher_constant |> p

# glob_to_regex

glob_to_regex — more regex builtin.

my $result = glob_to_regex $input 

# goertzel

goertzel computes the magnitude of a single DFT frequency bin using the Goertzel algorithm. Much faster than full FFT when you need one frequency.

my $mag = goertzel(\@signal, 440, 44100)  # 440 Hz component

# goldb

goldb — math / numeric (uncategorized batch) builtin. Alias for goldbach.

my $result = goldb $x 
# or in a pipeline:
@list |> map goldb |> p

# goldbach

goldbach — math / numeric (uncategorized batch) builtin.

my $result = goldbach $x 
# or in a pipeline:
@list |> map goldbach |> p

# golden

golden_section (aliases golden, gss) finds the minimum of f on [a,b] via golden-section search.

my $xmin = golden(fn { ($_[0]-3)**2 }, 0, 10)  # 3.0

# golden_ratio

golden_ratio (alias phi) — φ = (1+√5)/2 ≈ 1.618. The golden ratio, appears throughout nature and art.

p phi   # 1.618033988749895
# Fibonacci limit: fib(n)/fib(n-1) → φ

# golstep

golstep — algorithms / puzzles builtin. Alias for game_of_life_step.

my $result = golstep $x 
# or in a pipeline:
@list |> map golstep |> p

# goto

goto — control flow builtin.

my $result = goto $x 
# or in a pipeline:
@list |> map goto |> p

# gravitational_constant

gravitational_constant — constants builtin.

my $result = gravitational_constant $x 
# or in a pipeline:
@list |> map gravitational_constant |> p

# gravity

gravity — math / physics constants builtin.

my $result = gravity $x 
# or in a pipeline:
@list |> map gravity |> p

# gray

gray — color / ansi builtin. Alias for red.

my $result = gray $x 
# or in a pipeline:
@list |> map gray |> p

# gray2b

gray2b — base / gray code builtin. Alias for gray_to_binary.

my $result = gray2b $x 
# or in a pipeline:
@list |> map gray2b |> p

# gray_code_sequence

gray_code_sequence — base / gray code builtin.

my $result = gray_code_sequence $x 
# or in a pipeline:
@list |> map gray_code_sequence |> p

# gray_to_binary

gray_to_binary — base / gray code builtin.

my $result = gray_to_binary $input 

# grayseq

grayseq — base / gray code builtin. Alias for gray_code_sequence.

my $result = grayseq $x 
# or in a pipeline:
@list |> map grayseq |> p

# green

green — color / ansi builtin. Alias for red.

my $result = green $x 
# or in a pipeline:
@list |> map green |> p

# green_bold

green_bold — color / ansi builtin. Alias for red.

my $result = green_bold $x 
# or in a pipeline:
@list |> map green_bold |> p

# grey

grey — color / ansi builtin. Alias for red.

my $result = grey $x 
# or in a pipeline:
@list |> map grey |> p

# group_by

group_by — functional / iterator builtin.

my $result = group_by $x 
# or in a pipeline:
@list |> map group_by |> p

# group_by_fn

group_by_fn — go/general functional utilities builtin.

my $result = group_by_fn $x 
# or in a pipeline:
@list |> map group_by_fn |> p

# group_by_size

group_by_size — list helpers (batch 4) builtin.

my $result = group_by_size $x 
# or in a pipeline:
@list |> map group_by_size |> p

# group_consecutive

group_consecutive — functional combinators builtin.

my $result = group_consecutive $x 
# or in a pipeline:
@list |> map group_consecutive |> p

# group_consecutive_by

group_consecutive_by — matrix operations (uncategorized batch) builtin.

my $result = group_consecutive_by $x 
# or in a pipeline:
@list |> map group_consecutive_by |> p

# group_number

group_number — file stat / path builtin. Alias for format_number.

my $result = group_number $x 
# or in a pipeline:
@list |> map group_number |> p

# group_of_n

group_of_n — collection (batch 2) builtin.

my $result = group_of_n $x 
# or in a pipeline:
@list |> map group_of_n |> p

# group_runs

group_runs — haskell list functions builtin.

my $result = group_runs $x 
# or in a pipeline:
@list |> map group_runs |> p

# groupby_iter

groupby_iter — python/ruby stdlib builtin.

my $result = groupby_iter $x 
# or in a pipeline:
@list |> map groupby_iter |> p

# gruns

gruns — haskell list functions builtin. Alias for group_runs.

my $result = gruns $x 
# or in a pipeline:
@list |> map gruns |> p

# gz

gz — crypto / encoding builtin. Alias for gzip.

my $result = gz $x 
# or in a pipeline:
@list |> map gz |> p

# h0

h0 — physics constants builtin. Alias for hubble_constant.

my $result = h0 $x 
# or in a pipeline:
@list |> map h0 |> p

# half

half — trivial numeric / predicate builtins builtin.

my $result = half $x 
# or in a pipeline:
@list |> map half |> p

# half_each

half_each — trivial numeric helpers (batch 4) builtin.

my $result = half_each $x 
# or in a pipeline:
@list |> map half_each |> p

# hamdist

hamdist — extended stdlib batch 3 builtin.

my $result = hamdist $x 
# or in a pipeline:
@list |> map hamdist |> p

# hamming

window_hamming($n) (alias hamming) — generates a Hamming window of length n. Similar to Hann but with slightly different coefficients, optimized for speech processing.

my $w = hamming(1024)

# hamming_distance

hamming_distance — string (batch 2) builtin.

my $result = hamming_distance $x 
# or in a pipeline:
@list |> map hamming_distance |> p

# hann

window_hann($n) (alias hann) — generates a Hann (raised cosine) window of length n. Common window function for spectral analysis that reduces spectral leakage.

my $w = hann(1024)

# hanoi

hanoi — algorithms / puzzles builtin. Alias for tower_of_hanoi.

my $result = hanoi $x 
# or in a pipeline:
@list |> map hanoi |> p

# hard_sigmoid

hard_sigmoid — ml activation functions builtin.

my $result = hard_sigmoid $x 
# or in a pipeline:
@list |> map hard_sigmoid |> p

# hard_swish

hard_swish — ml activation functions builtin.

my $result = hard_swish $x 
# or in a pipeline:
@list |> map hard_swish |> p

# hardsigmoid

hardsigmoid — ml activation functions builtin. Alias for hard_sigmoid.

my $result = hardsigmoid $x 
# or in a pipeline:
@list |> map hardsigmoid |> p

# hardswish

hardswish — ml activation functions builtin. Alias for hard_swish.

my $result = hardswish $x 
# or in a pipeline:
@list |> map hardswish |> p

# harmonic

harmonic_number (alias harmonic) computes the nth harmonic number H_n = 1 + 1/2 + 1/3 + ... + 1/n.

p harmonic(1)    # 1.0
p harmonic(10)   # 2.9290
p harmonic(100)  # 5.1874

# harmonic_mean

harmonic_mean — file stat / path builtin.

my $result = harmonic_mean $x 
# or in a pipeline:
@list |> map harmonic_mean |> p

# has_all_keys

has_all_keys — hash helpers builtin.

my $result = has_all_keys $x 
# or in a pipeline:
@list |> map has_all_keys |> p

# has_any_key

has_any_key — hash helpers builtin.

my $result = has_any_key $x 
# or in a pipeline:
@list |> map has_any_key |> p

# has_cycle_graph

has_cycle_graph — extended stdlib builtin.

my $result = has_cycle_graph $x 
# or in a pipeline:
@list |> map has_cycle_graph |> p

# has_duplicates

has_duplicates — more list helpers builtin.

my $result = has_duplicates $x 
# or in a pipeline:
@list |> map has_duplicates |> p

# has_key

has_key — hash helpers builtin.

my $result = has_key $x 
# or in a pipeline:
@list |> map has_key |> p

# has_stderr_tty

has_stderr_tty — process / env builtin.

my $result = has_stderr_tty $x 
# or in a pipeline:
@list |> map has_stderr_tty |> p

# has_stdin_tty

has_stdin_tty — process / env builtin.

my $result = has_stdin_tty $x 
# or in a pipeline:
@list |> map has_stdin_tty |> p

# has_stdout_tty

has_stdout_tty — process / env builtin.

my $result = has_stdout_tty $x 
# or in a pipeline:
@list |> map has_stdout_tty |> p

# hascyc

hascyc — extended stdlib builtin. Alias for has_cycle_graph.

my $result = hascyc $x 
# or in a pipeline:
@list |> map hascyc |> p

# hash_delete

hash_delete — file stat / path builtin.

my $result = hash_delete $x 
# or in a pipeline:
@list |> map hash_delete |> p

# hash_eq

hash_eq — hash ops (batch 2) builtin.

my $result = hash_eq $x 
# or in a pipeline:
@list |> map hash_eq |> p

# hash_filter_keys

hash_filter_keys — list helpers (batch 4) builtin.

my $result = hash_filter_keys $x 
# or in a pipeline:
@list |> map hash_filter_keys |> p

# hash_from_list

hash_from_list — list helpers (batch 4) builtin.

my $result = hash_from_list $x 
# or in a pipeline:
@list |> map hash_from_list |> p

# hash_from_pairs

hash_from_pairs — hash ops (batch 2) builtin.

my $result = hash_from_pairs $x 
# or in a pipeline:
@list |> map hash_from_pairs |> p

# hash_insert

hash_insert — file stat / path builtin.

my $result = hash_insert $x 
# or in a pipeline:
@list |> map hash_insert |> p

# hash_map_values

hash_map_values — list helpers (batch 4) builtin.

my $result = hash_map_values $x 
# or in a pipeline:
@list |> map hash_map_values |> p

# hash_merge_deep

hash_merge_deep — list helpers (batch 4) builtin.

my $result = hash_merge_deep $x 
# or in a pipeline:
@list |> map hash_merge_deep |> p

# hash_size

hash_size — hash ops (batch 2) builtin.

my $result = hash_size $x 
# or in a pipeline:
@list |> map hash_size |> p

# hash_to_list

hash_to_list — list helpers (batch 4) builtin.

my $result = hash_to_list $input 

# hash_update

hash_update — file stat / path builtin.

my $result = hash_update $x 
# or in a pipeline:
@list |> map hash_update |> p

# hash_zip

hash_zip — list helpers (batch 4) builtin.

my $result = hash_zip $x 
# or in a pipeline:
@list |> map hash_zip |> p

# havdist

havdist — geometry (extended) builtin. Alias for haversine_distance.

my $result = havdist $x 
# or in a pipeline:
@list |> map havdist |> p

# haversine

haversine_distance($lat1, $lon1, $lat2, $lon2) (alias haversine) — computes the great-circle distance between two points on Earth given latitude/longitude in degrees. Returns distance in kilometers.

# NYC to LA
p haversine(40.7128, -74.0060, 34.0522, -118.2437)
# ~3940 km

# hclust

hclust — hierarchical clustering (average linkage). Takes a distance matrix. Returns merge list [[i,j,height],...]. Like R's hclust().

my $merges = hclust(dist_mat([[0,0],[1,0],[10,10]]))

# head_lines

head_lines — file stat / path builtin.

my $result = head_lines $x 
# or in a pipeline:
@list |> map head_lines |> p

# head_n

head_n — list helpers (batch 4) builtin.

my $result = head_n $x 
# or in a pipeline:
@list |> map head_n |> p

# head_str

head_str — string (batch 2) builtin. Alias for left_str.

my $result = head_str $x 
# or in a pipeline:
@list |> map head_str |> p

# heat_index

heat_index — physics formulas builtin.

my $result = heat_index $x 
# or in a pipeline:
@list |> map heat_index |> p

# heron

heron — geometry / physics builtin. Alias for heron_area.

my $result = heron $x 
# or in a pipeline:
@list |> map heron |> p

# heron_area

heron_area — geometry / physics builtin.

my $result = heron_area $x 
# or in a pipeline:
@list |> map heron_area |> p

# hex_lower

hex_lower — file stat / path builtin.

my $result = hex_lower $x 
# or in a pipeline:
@list |> map hex_lower |> p

# hex_of

hex_of — base conversion builtin. Alias for to_hex.

my $result = hex_of $x 
# or in a pipeline:
@list |> map hex_of |> p

# hex_to_bytes

hex_to_bytes — string helpers (batch 4) builtin.

my $result = hex_to_bytes $input 

# hex_to_rgb

hex_to_rgb — color / ansi builtin.

my $result = hex_to_rgb $input 

# hex_upper

hex_upper — file stat / path builtin.

my $result = hex_upper $x 
# or in a pipeline:
@list |> map hex_upper |> p

# hidden

hidden — color / ansi builtin. Alias for red.

my $result = hidden $x 
# or in a pipeline:
@list |> map hidden |> p

# highpass_filter

highpass_filter(\@signal, $cutoff) (alias hpf) — applies a simple high-pass filter to remove low-frequency components (DC offset, drift). Signal = original - lowpass.

my @with_dc = map { 5 + sin(_/10) } 1:100
my $ac_only = hpf(\@with_dc, 0.1)

# hist

hist — matrix operations (uncategorized batch) builtin. Alias for histogram.

my $result = hist $x 
# or in a pipeline:
@list |> map hist |> p

# histogram

histogram — matrix operations (uncategorized batch) builtin.

my $result = histogram $x 
# or in a pipeline:
@list |> map histogram |> p

# histogram_bins

histogram_bins — list helpers (batch 4) builtin.

my $result = histogram_bins $x 
# or in a pipeline:
@list |> map histogram_bins |> p

# hk

hk — hash helpers builtin. Alias for has_key.

my $result = hk $x 
# or in a pipeline:
@list |> map hk |> p

# home_dir

home_dir — system introspection builtin.

my $result = home_dir $x 
# or in a pipeline:
@list |> map home_dir |> p

# hooke

hooke — physics formulas builtin. Alias for spring_force.

my $result = hooke $x 
# or in a pipeline:
@list |> map hooke |> p

# hostname_str

hostname_str — more process / system builtin.

my $result = hostname_str $x 
# or in a pipeline:
@list |> map hostname_str |> p

# hours_to_days

hours_to_days — unit conversions builtin.

my $result = hours_to_days $input 

# hours_to_minutes

hours_to_minutes — unit conversions builtin.

my $result = hours_to_minutes $input 

# hours_to_seconds

hours_to_seconds — unit conversions builtin.

my $result = hours_to_seconds $input 

# hp_to_watts

hp_to_watts — file stat / path builtin.

my $result = hp_to_watts $input 

# hr

hr — data / network builtin. Alias for http_request.

my $result = hr $x 
# or in a pipeline:
@list |> map hr |> p

# hsl2rgb

hsl2rgb — color operations builtin. Alias for hsl_to_rgb.

my $result = hsl2rgb $x 
# or in a pipeline:
@list |> map hsl2rgb |> p

# hsl_to_rgb

hsl_to_rgb — color operations builtin.

my $result = hsl_to_rgb $input 

# hsv2rgb

hsv2rgb — color operations builtin. Alias for hsv_to_rgb.

my $result = hsv2rgb $x 
# or in a pipeline:
@list |> map hsv2rgb |> p

# hsv_to_rgb

hsv_to_rgb — color operations builtin.

my $result = hsv_to_rgb $input 

# html_decode

html_decode — extended stdlib builtin.

my $result = html_decode $x 
# or in a pipeline:
@list |> map html_decode |> p

# html_encode

html_encode — extended stdlib builtin.

my $result = html_encode $x 
# or in a pipeline:
@list |> map html_encode |> p

# htmld

htmld — extended stdlib builtin. Alias for html_decode.

my $result = htmld $x 
# or in a pipeline:
@list |> map htmld |> p

# htmle

htmle — extended stdlib builtin. Alias for html_encode.

my $result = htmle $x 
# or in a pipeline:
@list |> map htmle |> p

# hubble_constant

hubble_constant — physics constants builtin.

my $result = hubble_constant $x 
# or in a pipeline:
@list |> map hubble_constant |> p

# human_bytes

human_bytes — file stat / path builtin. Alias for format_bytes.

my $result = human_bytes $x 
# or in a pipeline:
@list |> map human_bytes |> p

# human_duration

human_duration — file stat / path builtin. Alias for format_duration.

my $result = human_duration $x 
# or in a pipeline:
@list |> map human_duration |> p

# hxd

hxd — crypto / encoding builtin. Alias for hex_decode.

my $result = hxd $x 
# or in a pipeline:
@list |> map hxd |> p

# hxe

hxe — crypto / encoding builtin. Alias for hex_encode.

my $result = hxe $x 
# or in a pipeline:
@list |> map hxe |> p

# hyp

hyp — geometry / physics builtin. Alias for triangle_hypotenuse.

my $result = hyp $x 
# or in a pipeline:
@list |> map hyp |> p

# hypot

hypot — trivial numeric / predicate builtins builtin.

my $result = hypot $x 
# or in a pipeline:
@list |> map hypot |> p

# i64_max

i64_max — math / numeric (uncategorized batch) builtin.

my $result = i64_max $x 
# or in a pipeline:
@list |> map i64_max |> p

# i64_min

i64_min — math / numeric (uncategorized batch) builtin.

my $result = i64_min $x 
# or in a pipeline:
@list |> map i64_min |> p

# ical

ical — haskell list functions builtin. Alias for intercalate.

my $result = ical $x 
# or in a pipeline:
@list |> map ical |> p

# id

id — trivial numeric / predicate builtins builtin. Alias for identity.

my $result = id $x 
# or in a pipeline:
@list |> map id |> p

# idct

idct computes the inverse DCT (Type-III). Reconstructs a signal from DCT coefficients.

my @signal = @{idct(dct([1,2,3,4]))}

# ideal_gas

ideal_gas (alias pv_nrt) solves PV=nRT for the unknown (pass 0 for the value to solve). Args: P, V, n, T.

p pv_nrt(0, 0.0224, 1, 273.15)  # pressure at STP
p pv_nrt(101325, 0, 1, 273.15)   # volume at STP

# ideal_gas_volume

ideal_gas_volume — physics formulas builtin.

my $result = ideal_gas_volume $x 
# or in a pipeline:
@list |> map ideal_gas_volume |> p

# identity

identity — trivial numeric / predicate builtins builtin.

my $result = identity $x 
# or in a pipeline:
@list |> map identity |> p

# identity_matrix

identity_matrix — matrix / linear algebra builtin.

my $result = identity_matrix $x 
# or in a pipeline:
@list |> map identity_matrix |> p

# idft

idft(\@spectrum) — computes the Inverse Discrete Fourier Transform. Takes arrayref of [re, im] pairs and returns the time-domain signal.

my $spectrum = dft(\@signal)
my $reconstructed = idft($spectrum)

# idt

idt — extended stdlib builtin. Alias for indent.

my $result = idt $x 
# or in a pipeline:
@list |> map idt |> p

# idxb

idxb — go/general functional utilities builtin. Alias for index_by.

my $result = idxb $x 
# or in a pipeline:
@list |> map idxb |> p

# if_else

if_else — functional combinators builtin.

my $result = if_else $x 
# or in a pipeline:
@list |> map if_else |> p

# ilerp

ilerp — extended stdlib builtin. Alias for inv_lerp.

my $result = ilerp $x 
# or in a pipeline:
@list |> map ilerp |> p

# impedance_rlc

impedance_rlc — physics formulas builtin.

my $result = impedance_rlc $x 
# or in a pipeline:
@list |> map impedance_rlc |> p

# impulse

impulse($force, $time) — compute impulse J = F×t (N⋅s). Change in momentum.

p impulse(100, 0.5)   # 50 N⋅s

# in_range

in_range — extended stdlib builtin.

my $result = in_range $x 
# or in a pipeline:
@list |> map in_range |> p

# inc

inc — pipeline / string helpers builtin.

my $result = inc $x 
# or in a pipeline:
@list |> map inc |> p

# inc_each

inc_each — trivial numeric helpers (batch 4) builtin.

my $result = inc_each $x 
# or in a pipeline:
@list |> map inc_each |> p

# inches_to_cm

inches_to_cm — unit conversions builtin.

my $result = inches_to_cm $input 

# includes_val

includes_val — javascript array/object methods builtin.

my $result = includes_val $x 
# or in a pipeline:
@list |> map includes_val |> p

# incv

incv — javascript array/object methods builtin. Alias for includes_val.

my $result = incv $x 
# or in a pipeline:
@list |> map incv |> p

# indenergy

indenergy — physics formulas builtin. Alias for inductor_energy.

my $result = indenergy $x 
# or in a pipeline:
@list |> map indenergy |> p

# indent

indent — extended stdlib builtin.

my $result = indent $x 
# or in a pipeline:
@list |> map indent |> p

# indent_text

indent_text — string processing (uncategorized batch) builtin.

my $result = indent_text $x 
# or in a pipeline:
@list |> map indent_text |> p

# index_by

index_by — go/general functional utilities builtin.

my $result = index_by $x 
# or in a pipeline:
@list |> map index_by |> p

# index_of

index_of — collection (batch 2) builtin.

my $result = index_of $x 
# or in a pipeline:
@list |> map index_of |> p

# index_of_elem

index_of_elem — list helpers (batch 4) builtin.

my $result = index_of_elem $x 
# or in a pipeline:
@list |> map index_of_elem |> p

# indexes_of

indexes_of — string (batch 2) builtin.

my $result = indexes_of $x 
# or in a pipeline:
@list |> map indexes_of |> p

# inductor_energy

inductor_energy — physics formulas builtin.

my $result = inductor_energy $x 
# or in a pipeline:
@list |> map inductor_energy |> p

# init_list

init_list — list helpers (batch 4) builtin.

my $result = init_list $x 
# or in a pipeline:
@list |> map init_list |> p

# initials

initials — string processing (uncategorized batch) builtin.

my $result = initials $x 
# or in a pipeline:
@list |> map initials |> p

# inits

inits — additional missing stdlib functions builtin.

my $result = inits $x 
# or in a pipeline:
@list |> map inits |> p

# inits_str

inits_str — string processing (uncategorized batch) builtin. Alias for initials.

my $result = inits_str $x 
# or in a pipeline:
@list |> map inits_str |> p

# inject

inject — functional / iterator builtin.

my $result = inject $x 
# or in a pipeline:
@list |> map inject |> p

# inrng

inrng — extended stdlib builtin. Alias for in_range.

my $result = inrng $x 
# or in a pipeline:
@list |> map inrng |> p

# insa

insa — go/general functional utilities builtin. Alias for insert_at.

my $result = insa $x 
# or in a pipeline:
@list |> map insa |> p

# insert_at

insert_at — go/general functional utilities builtin.

my $result = insert_at $x 
# or in a pipeline:
@list |> map insert_at |> p

# insert_sorted

insert_sorted — additional missing stdlib functions builtin.

my $result = insert_sorted $x 
# or in a pipeline:
@list |> map insert_sorted |> p

# insert_str

insert_str — string helpers (batch 4) builtin.

my $result = insert_str $x 
# or in a pipeline:
@list |> map insert_str |> p

# insp

insp — rust iterator methods builtin. Alias for inspect.

my $result = insp $x 
# or in a pipeline:
@list |> map insp |> p

# inspect

inspect — rust iterator methods builtin.

my $result = inspect $x 
# or in a pipeline:
@list |> map inspect |> p

# inssrt

inssrt — additional missing stdlib functions builtin. Alias for insert_sorted.

my $result = inssrt $x 
# or in a pipeline:
@list |> map inssrt |> p

# int_bits

int_bits — math functions builtin.

my $result = int_bits $x 
# or in a pipeline:
@list |> map int_bits |> p

# int_to_ipv4

int_to_ipv4 — network / validation builtin.

my $result = int_to_ipv4 $input 

# int_to_roman

int_to_roman — roman numerals builtin.

my $result = int_to_roman $input 

# intercalate

intercalate — haskell list functions builtin.

my $result = intercalate $x 
# or in a pipeline:
@list |> map intercalate |> p

# interleave_lists

interleave_lists — list helpers (batch 4) builtin.

my $result = interleave_lists $x 
# or in a pipeline:
@list |> map interleave_lists |> p

# interpose

interpose — go/general functional utilities builtin.

my $result = interpose $x 
# or in a pipeline:
@list |> map interpose |> p

# intersect_list

intersect_list — additional missing stdlib functions builtin.

my $result = intersect_list $x 
# or in a pipeline:
@list |> map intersect_list |> p

# intersperse

intersperse — collection helpers (trivial) builtin. Alias for riffle.

my $result = intersperse $x 
# or in a pipeline:
@list |> map intersperse |> p

# intersperse_char

intersperse_char — string helpers (batch 4) builtin.

my $result = intersperse_char $x 
# or in a pipeline:
@list |> map intersperse_char |> p

# intersperse_val

intersperse_val — haskell list functions builtin.

my $result = intersperse_val $x 
# or in a pipeline:
@list |> map intersperse_val |> p

# intersperse_with

intersperse_with — additional missing stdlib functions builtin.

my $result = intersperse_with $x 
# or in a pipeline:
@list |> map intersperse_with |> p

# intl

intl — additional missing stdlib functions builtin. Alias for intersect_list.

my $result = intl $x 
# or in a pipeline:
@list |> map intl |> p

# into

into — algebraic match builtin.

my $result = into $x 
# or in a pipeline:
@list |> map into |> p

# inv_lerp

inv_lerp — extended stdlib builtin.

my $result = inv_lerp $x 
# or in a pipeline:
@list |> map inv_lerp |> p

# inverse

inverse — trivial numeric / predicate builtins builtin.

my $result = inverse $x 
# or in a pipeline:
@list |> map inverse |> p

# inverse_lerp

inverse_lerp — math formulas builtin.

my $result = inverse_lerp $x 
# or in a pipeline:
@list |> map inverse_lerp |> p

# invert

invert — hash helpers builtin.

my $result = invert $x 
# or in a pipeline:
@list |> map invert |> p

# ioctl

ioctl — ipc builtin.

my $result = ioctl $x 
# or in a pipeline:
@list |> map ioctl |> p

# ipos

ipos — go/general functional utilities builtin. Alias for interpose.

my $result = ipos $x 
# or in a pipeline:
@list |> map ipos |> p

# ipv4_to_int

ipv4_to_int — network / validation builtin.

my $result = ipv4_to_int $input 

# iqr

iqr — extended stdlib builtin.

my $result = iqr $x 
# or in a pipeline:
@list |> map iqr |> p

# irr

irr(@cashflows) — computes the Internal Rate of Return for a series of cash flows. First value is typically negative (initial investment). Uses Newton-Raphson iteration.

my @cf = (-1000, 300, 420, 680)
p irr(@cf)   # ~0.166 (16.6%)

# is_abundant

is_abundant — number theory / primes builtin.

my $result = is_abundant $x 
# or in a pipeline:
@list |> map is_abundant |> p

# is_alnum

is_alnum — trivial string ops builtin.

my $result = is_alnum $x 
# or in a pipeline:
@list |> map is_alnum |> p

# is_alpha

is_alpha — trivial string ops builtin.

my $result = is_alpha $x 
# or in a pipeline:
@list |> map is_alpha |> p

# is_anagram

is_anagram — dsp / signal (extended) builtin.

my $result = is_anagram $x 
# or in a pipeline:
@list |> map is_anagram |> p

# is_array

is_array — trivial type predicates builtin.

my $result = is_array $x 
# or in a pipeline:
@list |> map is_array |> p

# is_arrayref

is_arrayref — trivial type predicates builtin. Alias for is_array.

my $result = is_arrayref $x 
# or in a pipeline:
@list |> map is_arrayref |> p

# is_asc

is_asc — predicates (batch 2) builtin. Alias for is_sorted.

my $result = is_asc $x 
# or in a pipeline:
@list |> map is_asc |> p

# is_ascii

is_ascii — extended stdlib builtin.

my $result = is_ascii $x 
# or in a pipeline:
@list |> map is_ascii |> p

# is_balanced_parens

is_balanced_parens — dsp / signal (extended) builtin.

my $result = is_balanced_parens $x 
# or in a pipeline:
@list |> map is_balanced_parens |> p

# is_base64

is_base64 — extended stdlib builtin.

my $result = is_base64 $x 
# or in a pipeline:
@list |> map is_base64 |> p

# is_between

is_between — predicates (batch 4) builtin.

my $result = is_between $x 
# or in a pipeline:
@list |> map is_between |> p

# is_binary_str

is_binary_str — extended stdlib builtin.

my $result = is_binary_str $x 
# or in a pipeline:
@list |> map is_binary_str |> p

# is_bipartite_graph

is_bipartite_graph — extended stdlib builtin.

my $result = is_bipartite_graph $x 
# or in a pipeline:
@list |> map is_bipartite_graph |> p

# is_blank

is_blank — trivial string ops builtin.

my $result = is_blank $x 
# or in a pipeline:
@list |> map is_blank |> p

# is_blank_or_nil

is_blank_or_nil — predicates (batch 4) builtin.

my $result = is_blank_or_nil $x 
# or in a pipeline:
@list |> map is_blank_or_nil |> p

# is_callable

is_callable — functional combinators builtin.

my $result = is_callable $x 
# or in a pipeline:
@list |> map is_callable |> p

# is_code

is_code — trivial type predicates builtin.

my $result = is_code $x 
# or in a pipeline:
@list |> map is_code |> p

# is_coderef

is_coderef — trivial type predicates builtin. Alias for is_code.

my $result = is_coderef $x 
# or in a pipeline:
@list |> map is_coderef |> p

# is_consonant

is_consonant — string (batch 2) builtin.

my $result = is_consonant $x 
# or in a pipeline:
@list |> map is_consonant |> p

# is_control

is_control — dsp / signal (extended) builtin.

my $result = is_control $x 
# or in a pipeline:
@list |> map is_control |> p

# is_coprime

is_coprime — extended stdlib batch 3 builtin.

my $result = is_coprime $x 
# or in a pipeline:
@list |> map is_coprime |> p

# is_credit_card

is_credit_card — extended stdlib builtin.

my $result = is_credit_card $x 
# or in a pipeline:
@list |> map is_credit_card |> p

# is_def

is_def — trivial type predicates builtin. Alias for is_defined.

my $result = is_def $x 
# or in a pipeline:
@list |> map is_def |> p

# is_deficient

is_deficient — number theory / primes builtin.

my $result = is_deficient $x 
# or in a pipeline:
@list |> map is_deficient |> p

# is_defined

is_defined — trivial type predicates builtin.

my $result = is_defined $x 
# or in a pipeline:
@list |> map is_defined |> p

# is_desc

is_desc — predicates (batch 2) builtin. Alias for is_sorted_desc.

my $result = is_desc $x 
# or in a pipeline:
@list |> map is_desc |> p

# is_digit

is_digit — trivial string ops builtin.

my $result = is_digit $x 
# or in a pipeline:
@list |> map is_digit |> p

# is_divisible_by

is_divisible_by — predicates (batch 4) builtin.

my $result = is_divisible_by $x 
# or in a pipeline:
@list |> map is_divisible_by |> p

# is_email

is_email — predicates (batch 4) builtin.

my $result = is_email $x 
# or in a pipeline:
@list |> map is_email |> p

# is_empty

is_empty — trivial string ops builtin.

my $result = is_empty $x 
# or in a pipeline:
@list |> map is_empty |> p

# is_empty_arr

is_empty_arr — predicates (batch 2) builtin.

my $result = is_empty_arr $x 
# or in a pipeline:
@list |> map is_empty_arr |> p

# is_empty_hash

is_empty_hash — predicates (batch 2) builtin.

my $result = is_empty_hash $x 
# or in a pipeline:
@list |> map is_empty_hash |> p

# is_even

is_even — predicates (batch 4) builtin.

my $result = is_even $x 
# or in a pipeline:
@list |> map is_even |> p

# is_even_num

is_even_num — extended stdlib builtin.

my $result = is_even_num $x 
# or in a pipeline:
@list |> map is_even_num |> p

# is_executable

is_executable — file stat / path builtin.

my $result = is_executable $x 
# or in a pipeline:
@list |> map is_executable |> p

# is_falsy

is_falsy — predicates (batch 4) builtin.

my $result = is_falsy $x 
# or in a pipeline:
@list |> map is_falsy |> p

# is_fibonacci

is_fibonacci — predicates (batch 4) builtin.

my $result = is_fibonacci $x 
# or in a pipeline:
@list |> map is_fibonacci |> p

# is_finite

is_finite — trig / math (batch 2) builtin.

my $result = is_finite $x 
# or in a pipeline:
@list |> map is_finite |> p

# is_float

is_float — trivial type predicates builtin.

my $result = is_float $x 
# or in a pipeline:
@list |> map is_float |> p

# is_harshad

is_harshad — extended stdlib batch 3 builtin.

my $result = is_harshad $x 
# or in a pipeline:
@list |> map is_harshad |> p

# is_hash

is_hash — trivial type predicates builtin.

my $result = is_hash $x 
# or in a pipeline:
@list |> map is_hash |> p

# is_hashref

is_hashref — trivial type predicates builtin. Alias for is_hash.

my $result = is_hashref $x 
# or in a pipeline:
@list |> map is_hashref |> p

# is_heterogram

is_heterogram — extended stdlib batch 3 builtin.

my $result = is_heterogram $x 
# or in a pipeline:
@list |> map is_heterogram |> p

# is_hex_color

is_hex_color — predicates (batch 4) builtin.

my $result = is_hex_color $x 
# or in a pipeline:
@list |> map is_hex_color |> p

# is_hex_str

is_hex_str — extended stdlib builtin.

my $result = is_hex_str $x 
# or in a pipeline:
@list |> map is_hex_str |> p

# is_hostname_valid

is_hostname_valid — extended stdlib builtin.

my $result = is_hostname_valid $x 
# or in a pipeline:
@list |> map is_hostname_valid |> p

# is_iban

is_iban — extended stdlib builtin.

my $result = is_iban $x 
# or in a pipeline:
@list |> map is_iban |> p

# is_in_range

is_in_range — predicates (batch 4) builtin.

my $result = is_in_range $x 
# or in a pipeline:
@list |> map is_in_range |> p

# is_inf

is_inf — trig / math (batch 2) builtin. Alias for is_infinite.

my $result = is_inf $x 
# or in a pipeline:
@list |> map is_inf |> p

# is_infinite

is_infinite — trig / math (batch 2) builtin.

my $result = is_infinite $x 
# or in a pipeline:
@list |> map is_infinite |> p

# is_int

is_int — trivial type predicates builtin.

my $result = is_int $x 
# or in a pipeline:
@list |> map is_int |> p

# is_integer

is_integer — trivial type predicates builtin. Alias for is_int.

my $result = is_integer $x 
# or in a pipeline:
@list |> map is_integer |> p

# is_ipv4

is_ipv4 — predicates (batch 4) builtin.

my $result = is_ipv4 $x 
# or in a pipeline:
@list |> map is_ipv4 |> p

# is_ipv4_addr

is_ipv4_addr — extended stdlib builtin.

my $result = is_ipv4_addr $x 
# or in a pipeline:
@list |> map is_ipv4_addr |> p

# is_ipv6_addr

is_ipv6_addr — extended stdlib builtin.

my $result = is_ipv6_addr $x 
# or in a pipeline:
@list |> map is_ipv6_addr |> p

# is_isbn10

is_isbn10 — extended stdlib builtin.

my $result = is_isbn10 $x 
# or in a pipeline:
@list |> map is_isbn10 |> p

# is_isbn13

is_isbn13 — extended stdlib builtin.

my $result = is_isbn13 $x 
# or in a pipeline:
@list |> map is_isbn13 |> p

# is_iso_date

is_iso_date — extended stdlib builtin.

my $result = is_iso_date $x 
# or in a pipeline:
@list |> map is_iso_date |> p

# is_iso_datetime

is_iso_datetime — extended stdlib builtin.

my $result = is_iso_datetime $x 
# or in a pipeline:
@list |> map is_iso_datetime |> p

# is_iso_time

is_iso_time — extended stdlib builtin.

my $result = is_iso_time $x 
# or in a pipeline:
@list |> map is_iso_time |> p

# is_isogram

is_isogram — extended stdlib batch 3 builtin.

my $result = is_isogram $x 
# or in a pipeline:
@list |> map is_isogram |> p

# is_json

is_json — extended stdlib builtin.

my $result = is_json $x 
# or in a pipeline:
@list |> map is_json |> p

# is_kaprekar

is_kaprekar — extended stdlib batch 3 builtin.

my $result = is_kaprekar $x 
# or in a pipeline:
@list |> map is_kaprekar |> p

# is_leap

is_leap — date helpers builtin. Alias for is_leap_year.

my $result = is_leap $x 
# or in a pipeline:
@list |> map is_leap |> p

# is_leap_year

is_leap_year — date helpers builtin.

my $result = is_leap_year $x 
# or in a pipeline:
@list |> map is_leap_year |> p

# is_lower

is_lower — trivial string ops builtin.

my $result = is_lower $x 
# or in a pipeline:
@list |> map is_lower |> p

# is_mac_addr

is_mac_addr — extended stdlib builtin.

my $result = is_mac_addr $x 
# or in a pipeline:
@list |> map is_mac_addr |> p

# is_match

is_match — extended stdlib builtin.

my $result = is_match $x 
# or in a pipeline:
@list |> map is_match |> p

# is_monotonic

is_monotonic — extended stdlib batch 3 builtin.

my $result = is_monotonic $x 
# or in a pipeline:
@list |> map is_monotonic |> p

# is_multiple_of

is_multiple_of — predicates (batch 4) builtin.

my $result = is_multiple_of $x 
# or in a pipeline:
@list |> map is_multiple_of |> p

# is_nan

is_nan — trig / math (batch 2) builtin.

my $result = is_nan $x 
# or in a pipeline:
@list |> map is_nan |> p

# is_narcissistic

is_narcissistic — extended stdlib batch 3 builtin.

my $result = is_narcissistic $x 
# or in a pipeline:
@list |> map is_narcissistic |> p

# is_negative

is_negative — predicates (batch 4) builtin.

my $result = is_negative $x 
# or in a pipeline:
@list |> map is_negative |> p

# is_negative_num

is_negative_num — extended stdlib builtin.

my $result = is_negative_num $x 
# or in a pipeline:
@list |> map is_negative_num |> p

# is_nil

is_nil — predicates (batch 4) builtin.

my $result = is_nil $x 
# or in a pipeline:
@list |> map is_nil |> p

# is_nonzero

is_nonzero — predicates (batch 4) builtin.

my $result = is_nonzero $x 
# or in a pipeline:
@list |> map is_nonzero |> p

# is_numeric

is_numeric — trivial string ops builtin.

my $result = is_numeric $x 
# or in a pipeline:
@list |> map is_numeric |> p

# is_numeric_string

is_numeric_string — dsp / signal (extended) builtin.

my $result = is_numeric_string $x 
# or in a pipeline:
@list |> map is_numeric_string |> p

# is_octal_str

is_octal_str — extended stdlib builtin.

my $result = is_octal_str $x 
# or in a pipeline:
@list |> map is_octal_str |> p

# is_odd

is_odd — predicates (batch 4) builtin.

my $result = is_odd $x 
# or in a pipeline:
@list |> map is_odd |> p

# is_odd_num

is_odd_num — extended stdlib builtin.

my $result = is_odd_num $x 
# or in a pipeline:
@list |> map is_odd_num |> p

# is_pair

is_pair — predicates (batch 2) builtin.

my $result = is_pair $x 
# or in a pipeline:
@list |> map is_pair |> p

# is_palindrome

is_palindrome — string (batch 2) builtin.

my $result = is_palindrome $x 
# or in a pipeline:
@list |> map is_palindrome |> p

# is_pangram

is_pangram — dsp / signal (extended) builtin.

my $result = is_pangram $x 
# or in a pipeline:
@list |> map is_pangram |> p

# is_pentagonal

is_pentagonal — number theory / primes builtin.

my $result = is_pentagonal $x 
# or in a pipeline:
@list |> map is_pentagonal |> p

# is_perfect

is_perfect — number theory / primes builtin.

my $result = is_perfect $x 
# or in a pipeline:
@list |> map is_perfect |> p

# is_perfect_square

is_perfect_square — predicates (batch 4) builtin.

my $result = is_perfect_square $x 
# or in a pipeline:
@list |> map is_perfect_square |> p

# is_permutation

is_permutation — predicates (batch 2) builtin.

my $result = is_permutation $x 
# or in a pipeline:
@list |> map is_permutation |> p

# is_phone_num

is_phone_num — extended stdlib builtin.

my $result = is_phone_num $x 
# or in a pipeline:
@list |> map is_phone_num |> p

# is_port_num

is_port_num — extended stdlib builtin.

my $result = is_port_num $x 
# or in a pipeline:
@list |> map is_port_num |> p

# is_positive

is_positive — predicates (batch 4) builtin.

my $result = is_positive $x 
# or in a pipeline:
@list |> map is_positive |> p

# is_positive_num

is_positive_num — extended stdlib builtin.

my $result = is_positive_num $x 
# or in a pipeline:
@list |> map is_positive_num |> p

# is_pow2

is_pow2 — trivial numeric / predicate builtins builtin. Alias for is_power_of_two.

my $result = is_pow2 $x 
# or in a pipeline:
@list |> map is_pow2 |> p

# is_power_of

is_power_of — predicates (batch 4) builtin.

my $result = is_power_of $x 
# or in a pipeline:
@list |> map is_power_of |> p

# is_power_of_two

is_power_of_two — trivial numeric / predicate builtins builtin.

my $result = is_power_of_two $x 
# or in a pipeline:
@list |> map is_power_of_two |> p

# is_prefix

is_prefix — predicates (batch 4) builtin.

my $result = is_prefix $x 
# or in a pipeline:
@list |> map is_prefix |> p

# is_present

is_present — predicates (batch 4) builtin.

my $result = is_present $x 
# or in a pipeline:
@list |> map is_present |> p

# is_prime

is_prime — trivial numeric / predicate builtins builtin.

my $result = is_prime $x 
# or in a pipeline:
@list |> map is_prime |> p

# is_printable

is_printable — dsp / signal (extended) builtin.

my $result = is_printable $x 
# or in a pipeline:
@list |> map is_printable |> p

# is_probable_prime

miller_rabin (aliases millerrabin, is_probable_prime) performs a probabilistic primality test with k rounds (default 20).

p millerrabin(104729)     # 1 (prime)
p millerrabin(104730)     # 0 (composite)

# is_readable

is_readable — file stat / path builtin.

my $result = is_readable $x 
# or in a pipeline:
@list |> map is_readable |> p

# is_ref

is_ref — trivial type predicates builtin.

my $result = is_ref $x 
# or in a pipeline:
@list |> map is_ref |> p

# is_regex_valid

is_regex_valid — more regex builtin.

my $result = is_regex_valid $x 
# or in a pipeline:
@list |> map is_regex_valid |> p

# is_root

is_root — more process / system builtin.

my $result = is_root $x 
# or in a pipeline:
@list |> map is_root |> p

# is_semver

is_semver — extended stdlib builtin.

my $result = is_semver $x 
# or in a pipeline:
@list |> map is_semver |> p

# is_slug

is_slug — extended stdlib builtin.

my $result = is_slug $x 
# or in a pipeline:
@list |> map is_slug |> p

# is_smith

is_smith — number theory / primes builtin.

my $result = is_smith $x 
# or in a pipeline:
@list |> map is_smith |> p

# is_sorted

is_sorted — predicates (batch 2) builtin.

my $result = is_sorted $x 
# or in a pipeline:
@list |> map is_sorted |> p

# is_sorted_by

is_sorted_by — additional missing stdlib functions builtin.

my $result = is_sorted_by $x 
# or in a pipeline:
@list |> map is_sorted_by |> p

# is_sorted_desc

is_sorted_desc — predicates (batch 2) builtin.

my $result = is_sorted_desc $x 
# or in a pipeline:
@list |> map is_sorted_desc |> p

# is_space

is_space — trivial string ops builtin.

my $result = is_space $x 
# or in a pipeline:
@list |> map is_space |> p

# is_square

is_square — trivial numeric / predicate builtins builtin.

my $result = is_square $x 
# or in a pipeline:
@list |> map is_square |> p

# is_squarefree

is_squarefree — extended stdlib batch 3 builtin.

my $result = is_squarefree $x 
# or in a pipeline:
@list |> map is_squarefree |> p

# is_str

is_str — trivial type predicates builtin. Alias for is_string.

my $result = is_str $x 
# or in a pipeline:
@list |> map is_str |> p

# is_strictly_decreasing

is_strictly_decreasing — predicates (batch 4) builtin.

my $result = is_strictly_decreasing $x 
# or in a pipeline:
@list |> map is_strictly_decreasing |> p

# is_strictly_increasing

is_strictly_increasing — predicates (batch 4) builtin.

my $result = is_strictly_increasing $x 
# or in a pipeline:
@list |> map is_strictly_increasing |> p

# is_string

is_string — trivial type predicates builtin.

my $result = is_string $x 
# or in a pipeline:
@list |> map is_string |> p

# is_subset

is_subset — predicates (batch 2) builtin.

my $result = is_subset $x 
# or in a pipeline:
@list |> map is_subset |> p

# is_suffix

is_suffix — predicates (batch 4) builtin.

my $result = is_suffix $x 
# or in a pipeline:
@list |> map is_suffix |> p

# is_superset

is_superset — predicates (batch 2) builtin.

my $result = is_superset $x 
# or in a pipeline:
@list |> map is_superset |> p

# is_symlink

is_symlink — file stat / path builtin.

my $result = is_symlink $x 
# or in a pipeline:
@list |> map is_symlink |> p

# is_triangular

is_triangular — predicates (batch 4) builtin.

my $result = is_triangular $x 
# or in a pipeline:
@list |> map is_triangular |> p

# is_triple

is_triple — predicates (batch 2) builtin.

my $result = is_triple $x 
# or in a pipeline:
@list |> map is_triple |> p

# is_truthy

is_truthy — predicates (batch 4) builtin.

my $result = is_truthy $x 
# or in a pipeline:
@list |> map is_truthy |> p

# is_tty

is_tty — more process / system builtin.

my $result = is_tty $x 
# or in a pipeline:
@list |> map is_tty |> p

# is_undef

is_undef — trivial type predicates builtin.

my $result = is_undef $x 
# or in a pipeline:
@list |> map is_undef |> p

# is_upper

is_upper — trivial string ops builtin.

my $result = is_upper $x 
# or in a pipeline:
@list |> map is_upper |> p

# is_url

is_url — predicates (batch 4) builtin.

my $result = is_url $x 
# or in a pipeline:
@list |> map is_url |> p

# is_us_zip

is_us_zip — extended stdlib builtin.

my $result = is_us_zip $x 
# or in a pipeline:
@list |> map is_us_zip |> p

# is_uuid

is_uuid — id helpers builtin.

my $result = is_uuid $x 
# or in a pipeline:
@list |> map is_uuid |> p

# is_valid_cidr

is_valid_cidr — dsp / signal (extended) builtin.

my $result = is_valid_cidr $x 
# or in a pipeline:
@list |> map is_valid_cidr |> p

# is_valid_cron

is_valid_cron — dsp / signal (extended) builtin.

my $result = is_valid_cron $x 
# or in a pipeline:
@list |> map is_valid_cron |> p

# is_valid_date

is_valid_date — extended stdlib batch 3 builtin.

my $result = is_valid_date $x 
# or in a pipeline:
@list |> map is_valid_date |> p

# is_valid_email

is_valid_email — network / validation builtin.

my $result = is_valid_email $x 
# or in a pipeline:
@list |> map is_valid_email |> p

# is_valid_hex

is_valid_hex — file stat / path builtin.

my $result = is_valid_hex $x 
# or in a pipeline:
@list |> map is_valid_hex |> p

# is_valid_hex_color

is_valid_hex_color — dsp / signal (extended) builtin.

my $result = is_valid_hex_color $x 
# or in a pipeline:
@list |> map is_valid_hex_color |> p

# is_valid_ipv4

is_valid_ipv4 — network / validation builtin.

my $result = is_valid_ipv4 $x 
# or in a pipeline:
@list |> map is_valid_ipv4 |> p

# is_valid_ipv6

is_valid_ipv6 — network / validation builtin.

my $result = is_valid_ipv6 $x 
# or in a pipeline:
@list |> map is_valid_ipv6 |> p

# is_valid_latitude

is_valid_latitude — dsp / signal (extended) builtin.

my $result = is_valid_latitude $x 
# or in a pipeline:
@list |> map is_valid_latitude |> p

# is_valid_longitude

is_valid_longitude — dsp / signal (extended) builtin.

my $result = is_valid_longitude $x 
# or in a pipeline:
@list |> map is_valid_longitude |> p

# is_valid_mime

is_valid_mime — dsp / signal (extended) builtin.

my $result = is_valid_mime $x 
# or in a pipeline:
@list |> map is_valid_mime |> p

# is_valid_url

is_valid_url — network / validation builtin.

my $result = is_valid_url $x 
# or in a pipeline:
@list |> map is_valid_url |> p

# is_vowel

is_vowel — string (batch 2) builtin.

my $result = is_vowel $x 
# or in a pipeline:
@list |> map is_vowel |> p

# is_weekday

is_weekday — date (batch 2) builtin.

my $result = is_weekday $x 
# or in a pipeline:
@list |> map is_weekday |> p

# is_weekend

is_weekend — date (batch 2) builtin.

my $result = is_weekend $x 
# or in a pipeline:
@list |> map is_weekend |> p

# is_whitespace

is_whitespace — trivial string ops builtin. Alias for is_space.

my $result = is_whitespace $x 
# or in a pipeline:
@list |> map is_whitespace |> p

# is_whole

is_whole — predicates (batch 4) builtin.

my $result = is_whole $x 
# or in a pipeline:
@list |> map is_whole |> p

# is_whole_num

is_whole_num — extended stdlib builtin.

my $result = is_whole_num $x 
# or in a pipeline:
@list |> map is_whole_num |> p

# is_writable

is_writable — file stat / path builtin.

my $result = is_writable $x 
# or in a pipeline:
@list |> map is_writable |> p

# is_zero

is_zero — predicates (batch 4) builtin.

my $result = is_zero $x 
# or in a pipeline:
@list |> map is_zero |> p

# is_zero_num

is_zero_num — extended stdlib builtin.

my $result = is_zero_num $x 
# or in a pipeline:
@list |> map is_zero_num |> p

# isabun

isabun — number theory / primes builtin. Alias for is_abundant.

my $result = isabun $x 
# or in a pipeline:
@list |> map isabun |> p

# isanag

isanag — dsp / signal (extended) builtin. Alias for is_anagram.

my $result = isanag $x 
# or in a pipeline:
@list |> map isanag |> p

# isasc

isasc — extended stdlib builtin. Alias for is_ascii.

my $result = isasc $x 
# or in a pipeline:
@list |> map isasc |> p

# isb64

isb64 — extended stdlib builtin. Alias for is_base64.

my $result = isb64 $x 
# or in a pipeline:
@list |> map isb64 |> p

# isbalp

isbalp — dsp / signal (extended) builtin. Alias for is_balanced_parens.

my $result = isbalp $x 
# or in a pipeline:
@list |> map isbalp |> p

# isbin

isbin — extended stdlib builtin. Alias for is_binary_str.

my $result = isbin $x 
# or in a pipeline:
@list |> map isbin |> p

# isbip

isbip — extended stdlib builtin. Alias for is_bipartite_graph.

my $result = isbip $x 
# or in a pipeline:
@list |> map isbip |> p

# isbn10

isbn10 — extended stdlib builtin. Alias for is_isbn10.

my $result = isbn10 $x 
# or in a pipeline:
@list |> map isbn10 |> p

# isbn13

isbn13 — extended stdlib builtin. Alias for is_isbn13.

my $result = isbn13 $x 
# or in a pipeline:
@list |> map isbn13 |> p

# iscc

iscc — extended stdlib builtin. Alias for is_credit_card.

my $result = iscc $x 
# or in a pipeline:
@list |> map iscc |> p

# iscidr

iscidr — dsp / signal (extended) builtin. Alias for is_valid_cidr.

my $result = iscidr $x 
# or in a pipeline:
@list |> map iscidr |> p

# iscopr

iscopr — extended stdlib batch 3 builtin. Alias for is_coprime.

my $result = iscopr $x 
# or in a pipeline:
@list |> map iscopr |> p

# iscron

iscron — dsp / signal (extended) builtin. Alias for is_valid_cron.

my $result = iscron $x 
# or in a pipeline:
@list |> map iscron |> p

# isctrl

isctrl — dsp / signal (extended) builtin. Alias for is_control.

my $result = isctrl $x 
# or in a pipeline:
@list |> map isctrl |> p

# isdefi

isdefi — number theory / primes builtin. Alias for is_deficient.

my $result = isdefi $x 
# or in a pipeline:
@list |> map isdefi |> p

# iseven

iseven — extended stdlib builtin. Alias for is_even_num.

my $result = iseven $x 
# or in a pipeline:
@list |> map iseven |> p

# isharsh

isharsh — extended stdlib batch 3 builtin. Alias for is_harshad.

my $result = isharsh $x 
# or in a pipeline:
@list |> map isharsh |> p

# ishet

ishet — extended stdlib batch 3 builtin. Alias for is_heterogram.

my $result = ishet $x 
# or in a pipeline:
@list |> map ishet |> p

# ishex

ishex — extended stdlib builtin. Alias for is_hex_str.

my $result = ishex $x 
# or in a pipeline:
@list |> map ishex |> p

# ishexc

ishexc — dsp / signal (extended) builtin. Alias for is_valid_hex_color.

my $result = ishexc $x 
# or in a pipeline:
@list |> map ishexc |> p

# ishost

ishost — extended stdlib builtin. Alias for is_hostname_valid.

my $result = ishost $x 
# or in a pipeline:
@list |> map ishost |> p

# isiban

isiban — extended stdlib builtin. Alias for is_iban.

my $result = isiban $x 
# or in a pipeline:
@list |> map isiban |> p

# isip4

isip4 — extended stdlib builtin. Alias for is_ipv4_addr.

my $result = isip4 $x 
# or in a pipeline:
@list |> map isip4 |> p

# isip6

isip6 — extended stdlib builtin. Alias for is_ipv6_addr.

my $result = isip6 $x 
# or in a pipeline:
@list |> map isip6 |> p

# isiso

isiso — extended stdlib batch 3 builtin. Alias for is_isogram.

my $result = isiso $x 
# or in a pipeline:
@list |> map isiso |> p

# isisodt

isisodt — extended stdlib builtin. Alias for is_iso_date.

my $result = isisodt $x 
# or in a pipeline:
@list |> map isisodt |> p

# isisodtm

isisodtm — extended stdlib builtin. Alias for is_iso_datetime.

my $result = isisodtm $x 
# or in a pipeline:
@list |> map isisodtm |> p

# isisotm

isisotm — extended stdlib builtin. Alias for is_iso_time.

my $result = isisotm $x 
# or in a pipeline:
@list |> map isisotm |> p

# isjson

isjson — extended stdlib builtin. Alias for is_json.

my $result = isjson $x 
# or in a pipeline:
@list |> map isjson |> p

# iskap

iskap — extended stdlib batch 3 builtin. Alias for is_kaprekar.

my $result = iskap $x 
# or in a pipeline:
@list |> map iskap |> p

# isl

isl — python/ruby stdlib builtin. Alias for islice.

my $result = isl $x 
# or in a pipeline:
@list |> map isl |> p

# islat

islat — dsp / signal (extended) builtin. Alias for is_valid_latitude.

my $result = islat $x 
# or in a pipeline:
@list |> map islat |> p

# islice

islice — python/ruby stdlib builtin.

my $result = islice $x 
# or in a pipeline:
@list |> map islice |> p

# islon

islon — dsp / signal (extended) builtin. Alias for is_valid_longitude.

my $result = islon $x 
# or in a pipeline:
@list |> map islon |> p

# ism

ism — extended stdlib builtin. Alias for is_match.

my $result = ism $x 
# or in a pipeline:
@list |> map ism |> p

# ismac

ismac — extended stdlib builtin. Alias for is_mac_addr.

my $result = ismac $x 
# or in a pipeline:
@list |> map ismac |> p

# ismime

ismime — dsp / signal (extended) builtin. Alias for is_valid_mime.

my $result = ismime $x 
# or in a pipeline:
@list |> map ismime |> p

# ismono

ismono — extended stdlib batch 3 builtin. Alias for is_monotonic.

my $result = ismono $x 
# or in a pipeline:
@list |> map ismono |> p

# isnarc

isnarc — extended stdlib batch 3 builtin. Alias for is_narcissistic.

my $result = isnarc $x 
# or in a pipeline:
@list |> map isnarc |> p

# isneg

isneg — extended stdlib builtin. Alias for is_negative_num.

my $result = isneg $x 
# or in a pipeline:
@list |> map isneg |> p

# isnumstr

isnumstr — dsp / signal (extended) builtin. Alias for is_numeric_string.

my $result = isnumstr $x 
# or in a pipeline:
@list |> map isnumstr |> p

# isoct

isoct — extended stdlib builtin. Alias for is_octal_str.

my $result = isoct $x 
# or in a pipeline:
@list |> map isoct |> p

# isodd

isodd — extended stdlib builtin. Alias for is_odd_num.

my $result = isodd $x 
# or in a pipeline:
@list |> map isodd |> p

# isp

isp — haskell list functions builtin. Alias for intersperse_val.

my $result = isp $x 
# or in a pipeline:
@list |> map isp |> p

# ispang

ispang — dsp / signal (extended) builtin. Alias for is_pangram.

my $result = ispang $x 
# or in a pipeline:
@list |> map ispang |> p

# ispent

ispent — number theory / primes builtin. Alias for is_pentagonal.

my $result = ispent $x 
# or in a pipeline:
@list |> map ispent |> p

# isperf

isperf — number theory / primes builtin. Alias for is_perfect.

my $result = isperf $x 
# or in a pipeline:
@list |> map isperf |> p

# isphone

isphone — extended stdlib builtin. Alias for is_phone_num.

my $result = isphone $x 
# or in a pipeline:
@list |> map isphone |> p

# isport

isport — extended stdlib builtin. Alias for is_port_num.

my $result = isport $x 
# or in a pipeline:
@list |> map isport |> p

# ispos

ispos — extended stdlib builtin. Alias for is_positive_num.

my $result = ispos $x 
# or in a pipeline:
@list |> map ispos |> p

# isprint

isprint — dsp / signal (extended) builtin. Alias for is_printable.

my $result = isprint $x 
# or in a pipeline:
@list |> map isprint |> p

# ispw

ispw — additional missing stdlib functions builtin. Alias for intersperse_with.

my $result = ispw $x 
# or in a pipeline:
@list |> map ispw |> p

# isslug

isslug — extended stdlib builtin. Alias for is_slug.

my $result = isslug $x 
# or in a pipeline:
@list |> map isslug |> p

# issmith

issmith — number theory / primes builtin. Alias for is_smith.

my $result = issmith $x 
# or in a pipeline:
@list |> map issmith |> p

# issqfr

issqfr — extended stdlib batch 3 builtin. Alias for is_squarefree.

my $result = issqfr $x 
# or in a pipeline:
@list |> map issqfr |> p

# issrtb

issrtb — additional missing stdlib functions builtin. Alias for is_sorted_by.

my $result = issrtb $x 
# or in a pipeline:
@list |> map issrtb |> p

# issv

issv — extended stdlib builtin. Alias for is_semver.

my $result = issv $x 
# or in a pipeline:
@list |> map issv |> p

# isvdate

isvdate — extended stdlib batch 3 builtin. Alias for is_valid_date.

my $result = isvdate $x 
# or in a pipeline:
@list |> map isvdate |> p

# iswhole

iswhole — extended stdlib builtin. Alias for is_whole_num.

my $result = iswhole $x 
# or in a pipeline:
@list |> map iswhole |> p

# iszero

iszero — extended stdlib builtin. Alias for is_zero_num.

my $result = iszero $x 
# or in a pipeline:
@list |> map iszero |> p

# iszip

iszip — extended stdlib builtin. Alias for is_us_zip.

my $result = iszip $x 
# or in a pipeline:
@list |> map iszip |> p

# italic

italic — color / ansi builtin. Alias for red.

my $result = italic $x 
# or in a pipeline:
@list |> map italic |> p

# iter

iter — algebraic match builtin. Alias for iterate.

my $result = iter $x 
# or in a pipeline:
@list |> map iter |> p

# iterate

iterate — algebraic match builtin.

my $result = iterate $x 
# or in a pipeline:
@list |> map iterate |> p

# iterate_n

iterate_n — functional combinators builtin.

my $result = iterate_n $x 
# or in a pipeline:
@list |> map iterate_n |> p

# jaccard

jaccard — extended stdlib batch 3 builtin. Alias for jaccard_index.

my $result = jaccard $x 
# or in a pipeline:
@list |> map jaccard |> p

# jaccard_index

jaccard_index — extended stdlib batch 3 builtin.

my $result = jaccard_index $x 
# or in a pipeline:
@list |> map jaccard_index |> p

# jaccard_similarity

jaccard_similarity — math functions builtin.

my $result = jaccard_similarity $x 
# or in a pipeline:
@list |> map jaccard_similarity |> p

# jaro_similarity

jaro_similarity — extended stdlib batch 3 builtin.

my $result = jaro_similarity $x 
# or in a pipeline:
@list |> map jaro_similarity |> p

# jarosim

jarosim — extended stdlib batch 3 builtin. Alias for jaro_similarity.

my $result = jarosim $x 
# or in a pipeline:
@list |> map jarosim |> p

# jd

jd — data / network builtin. Alias for json_decode.

my $result = jd $x 
# or in a pipeline:
@list |> map jd |> p

# je

je — data / network builtin. Alias for json_encode.

my $result = je $x 
# or in a pipeline:
@list |> map je |> p

# join_colons

join_colons — conversion / utility (batch 4) builtin.

my $result = join_colons $x 
# or in a pipeline:
@list |> map join_colons |> p

# join_commas

join_commas — conversion / utility (batch 4) builtin.

my $result = join_commas $x 
# or in a pipeline:
@list |> map join_commas |> p

# join_dashes

join_dashes — conversion / utility (batch 4) builtin.

my $result = join_dashes $x 
# or in a pipeline:
@list |> map join_dashes |> p

# join_dots

join_dots — conversion / utility (batch 4) builtin.

my $result = join_dots $x 
# or in a pipeline:
@list |> map join_dots |> p

# join_lines

join_lines — conversion / utility (batch 4) builtin.

my $result = join_lines $x 
# or in a pipeline:
@list |> map join_lines |> p

# join_pipes

join_pipes — conversion / utility (batch 4) builtin.

my $result = join_pipes $x 
# or in a pipeline:
@list |> map join_pipes |> p

# join_slashes

join_slashes — conversion / utility (batch 4) builtin.

my $result = join_slashes $x 
# or in a pipeline:
@list |> map join_slashes |> p

# join_spaces

join_spaces — conversion / utility (batch 4) builtin.

my $result = join_spaces $x 
# or in a pipeline:
@list |> map join_spaces |> p

# join_tabs

join_tabs — conversion / utility (batch 4) builtin.

my $result = join_tabs $x 
# or in a pipeline:
@list |> map join_tabs |> p

# joules_to_cal

joules_to_cal — file stat / path builtin.

my $result = joules_to_cal $input 

# json_escape

json_escape — json helpers builtin. Alias for escape_json.

my $result = json_escape $x 
# or in a pipeline:
@list |> map json_escape |> p

# json_minify

json_minify — json helpers builtin.

my $result = json_minify $x 
# or in a pipeline:
@list |> map json_minify |> p

# json_pretty

json_pretty — json helpers builtin.

my $result = json_pretty $x 
# or in a pipeline:
@list |> map json_pretty |> p

# juxt2

juxt2 — functional combinators builtin.

my $result = juxt2 $x 
# or in a pipeline:
@list |> map juxt2 |> p

# juxt3

juxt3 — functional combinators builtin.

my $result = juxt3 $x 
# or in a pipeline:
@list |> map juxt3 |> p

# k_to_c

k_to_c — unit conversions builtin.

my $result = k_to_c $input 

# k_to_f

k_to_f — unit conversions builtin.

my $result = k_to_f $input 

# kaiser

window_kaiser($n, $beta) (alias kaiser) — generates a Kaiser window with parameter beta controlling the tradeoff between main lobe width and sidelobe level. Beta=0 is rectangular, beta~5 is similar to Hamming.

my $w = kaiser(1024, 5.0)

# kb_to_b

kb_to_b — unit conversions builtin. Alias for kb_to_bytes.

my $result = kb_to_b $input 

# kb_to_bytes

kb_to_bytes — unit conversions builtin.

my $result = kb_to_bytes $input 

# kb_to_mb

kb_to_mb — unit conversions builtin.

my $result = kb_to_mb $input 

# kcoulomb

kcoulomb — physics constants builtin. Alias for coulomb_constant.

my $result = kcoulomb $x 
# or in a pipeline:
@list |> map kcoulomb |> p

# keep

keep — algebraic match builtin.

my $result = keep $x 
# or in a pipeline:
@list |> map keep |> p

# keep_if

keep_if — functional combinators builtin.

my $result = keep_if $x 
# or in a pipeline:
@list |> map keep_if |> p

# kendall

kendall_tau (aliases kendall, ktau) computes Kendall's rank correlation coefficient (tau-b).

p ktau([1,2,3,4], [1,2,4,3])  # 0.67

# keys_sorted

keys_sorted — hash ops (batch 2) builtin.

my $result = keys_sorted $x 
# or in a pipeline:
@list |> map keys_sorted |> p

# kg_to_lbs

kg_to_lbs — unit conversions builtin.

my $result = kg_to_lbs $input 

# kg_to_stone

kg_to_stone — unit conversions builtin.

my $result = kg_to_stone $input 

# khinchin

khinchin — math constants builtin. Alias for khinchin_constant.

my $result = khinchin $x 
# or in a pipeline:
@list |> map khinchin |> p

# khinchin_constant

khinchin_constant — math constants builtin.

my $result = khinchin_constant $x 
# or in a pipeline:
@list |> map khinchin_constant |> p

# kinetic_energy

kinetic_energy — physics formulas builtin.

my $result = kinetic_energy $x 
# or in a pipeline:
@list |> map kinetic_energy |> p

# km_to_miles

km_to_miles — unit conversions builtin.

my $result = km_to_miles $input 

# kmeans

kmeans — k-means clustering (Lloyd's algorithm). Takes array of points and k. Returns cluster assignments. Like R's kmeans().

my @clusters = @{kmeans([[0,0],[1,0],[10,10],[11,10]], 2)}
# [0,0,1,1] — two clusters

# kp

kp — algebraic match builtin. Alias for keep.

my $result = kp $x 
# or in a pipeline:
@list |> map kp |> p

# ks

ks_test (alias ks) — two-sample Kolmogorov-Smirnov test. Returns D statistic (max CDF difference). Like R's ks.test().

my $D = ks([1,2,3,4,5], [2,3,4,5,6])  # small D = similar

# kth_largest

kth_largest — extended stdlib batch 3 builtin.

my $result = kth_largest $x 
# or in a pipeline:
@list |> map kth_largest |> p

# kth_smallest

kth_smallest — extended stdlib batch 3 builtin.

my $result = kth_smallest $x 
# or in a pipeline:
@list |> map kth_smallest |> p

# kthl

kthl — extended stdlib batch 3 builtin. Alias for kth_largest.

my $result = kthl $x 
# or in a pipeline:
@list |> map kthl |> p

# kths

kths — extended stdlib batch 3 builtin. Alias for kth_smallest.

my $result = kths $x 
# or in a pipeline:
@list |> map kths |> p

# kurt

kurt — math / numeric (uncategorized batch) builtin. Alias for kurtosis.

my $result = kurt $x 
# or in a pipeline:
@list |> map kurt |> p

# kurtosis

kurtosis — math / numeric (uncategorized batch) builtin.

my $result = kurtosis $x 
# or in a pipeline:
@list |> map kurtosis |> p

# lagrange

lagrange_interp (aliases lagrange, linterp) performs Lagrange polynomial interpolation. Takes xs, ys, and a query point x.

p lagrange([0,1,2], [0,1,4], 1.5)  # 2.25

# lambert_w

lambert_w (aliases lambertw, productlog) computes the Lambert W function (principal branch): the inverse of f(w) = w·e^w.

p lambertw(1)   # 0.5671 (Omega constant)
p lambertw(exp(1))  # 1.0

# laplace_pdf

laplace_pdf (alias laplacepdf) evaluates the Laplace distribution PDF at x with location mu and scale b.

p laplacepdf(0, 0, 1)  # 0.5 (peak)

# last_arg

last_arg — functional primitives builtin.

my $result = last_arg $x 
# or in a pipeline:
@list |> map last_arg |> p

# last_clj

last_clj — algebraic match builtin.

my $result = last_clj $x 
# or in a pipeline:
@list |> map last_clj |> p

# last_elem

last_elem — list helpers (batch 4) builtin.

my $result = last_elem $x 
# or in a pipeline:
@list |> map last_elem |> p

# last_eq

last_eq — collection (batch 2) builtin.

my $result = last_eq $x 
# or in a pipeline:
@list |> map last_eq |> p

# last_index_of

last_index_of — collection (batch 2) builtin.

my $result = last_index_of $x 
# or in a pipeline:
@list |> map last_index_of |> p

# last_word

last_word — string (batch 2) builtin.

my $result = last_word $x 
# or in a pipeline:
@list |> map last_word |> p

# lastc

lastc — algebraic match builtin. Alias for last_clj.

my $result = lastc $x 
# or in a pipeline:
@list |> map lastc |> p

# lbf_to_newtons

lbf_to_newtons — file stat / path builtin.

my $result = lbf_to_newtons $input 

# lbound

lbound — extended stdlib builtin. Alias for lower_bound.

my $result = lbound $x 
# or in a pipeline:
@list |> map lbound |> p

# lbs_to_kg

lbs_to_kg — unit conversions builtin.

my $result = lbs_to_kg $input 

# lc_lines

lc_lines — trivial string ops builtin. Alias for line_count.

my $result = lc_lines $x 
# or in a pipeline:
@list |> map lc_lines |> p

# lcm

lcm — trivial numeric / predicate builtins builtin.

my $result = lcm $x 
# or in a pipeline:
@list |> map lcm |> p

# lcontract

length_contraction($proper_length, $velocity) (alias lcontract) — contracted length L = L₀ × √(1-v²/c²).

p lcontract(1, 0.99 * 3e8)   # ~0.14 m (1m at 99% c)

# lcount

lcount — extended stdlib batch 3 builtin. Alias for count_lines.

my $result = lcount $x 
# or in a pipeline:
@list |> map lcount |> p

# lcp

lcp — string (batch 2) builtin. Alias for longest_common_prefix.

my $result = lcp $x 
# or in a pipeline:
@list |> map lcp |> p

# lcseq

lcseq — extended stdlib batch 3 builtin. Alias for longest_common_subsequence.

my $result = lcseq $x 
# or in a pipeline:
@list |> map lcseq |> p

# lcsub

lcsub — extended stdlib batch 3 builtin. Alias for longest_common_substring.

my $result = lcsub $x 
# or in a pipeline:
@list |> map lcsub |> p

# ldec

ldec — extended stdlib batch 3 builtin. Alias for longest_decreasing.

my $result = ldec $x 
# or in a pipeline:
@list |> map ldec |> p

# leading_zeros

leading_zeros — base conversion builtin.

my $result = leading_zeros $x 
# or in a pipeline:
@list |> map leading_zeros |> p

# leaky_relu

leaky_relu (alias lrelu) applies Leaky ReLU: x if x≥0, alpha*x otherwise (default alpha=0.01).

p lrelu(5)     # 5
p lrelu(-5)    # -0.05
p lrelu(-5, 0.1)  # -0.5

# least_common

least_common — list helpers (batch 4) builtin.

my $result = least_common $x 
# or in a pipeline:
@list |> map least_common |> p

# leet

leet — string processing (uncategorized batch) builtin. Alias for leetspeak.

my $result = leet $x 
# or in a pipeline:
@list |> map leet |> p

# leetspeak

leetspeak — string processing (uncategorized batch) builtin.

my $result = leetspeak $x 
# or in a pipeline:
@list |> map leetspeak |> p

# left_str

left_str — string (batch 2) builtin.

my $result = left_str $x 
# or in a pipeline:
@list |> map left_str |> p

# length_each

length_each — trivial numeric helpers (batch 4) builtin.

my $result = length_each $x 
# or in a pipeline:
@list |> map length_each |> p

# lens_power

lens_power — physics formulas builtin.

my $result = lens_power $x 
# or in a pipeline:
@list |> map lens_power |> p

# lerp

lerp($a, $b, $t) — linear interpolation between a and b. When t=0 returns a, t=1 returns b, t=0.5 returns midpoint.

p lerp(0, 100, 0.5)   # 50
p lerp(10, 20, 0.25)  # 12.5
# Animation: smoothly transition between values
for my $t (0:10) { p lerp($start, $end, $t/10) }

# less

LIST |> pager / pager LIST — pipe each element (one per line) into the user's $PAGER (default less -R; falls back to more, then plain stdout). Bypasses the pager when stdout isn't a TTY so pipelines like stryke '... |> pager' | grep still compose.

Blocks until the user quits the pager; returns undef.

Aliases: pager, pg, less.

# browse every callable spelling interactively
keys %all |> sort |> pager

# filter the reference for parallel ops
keys %b |> grep { $b{_} eq "parallel" } |> pager

# whole file, one screen at a time
slurp("README.md") |> pager

# letters_lc

letters_lc extracts only lowercase letters from a string.

p join "", letters_lc("Hello World 123")  # elloorld

# letters_uc

letters_uc extracts only uppercase letters from a string.

p join "", letters_uc("Hello World 123")  # HW

# lev

lev — extended stdlib builtin. Alias for levenshtein.

my $result = lev $x 
# or in a pipeline:
@list |> map lev |> p

# levenshtein

levenshtein — extended stdlib builtin.

my $result = levenshtein $x 
# or in a pipeline:
@list |> map levenshtein |> p

# lfrm

lfrm — go/general functional utilities builtin. Alias for lines_from.

my $result = lfrm $x 
# or in a pipeline:
@list |> map lfrm |> p

# light_year

light_year (alias ly) — ly ≈ 9.461×10¹⁵ m. Distance light travels in one year.

p ly             # 9.4607304725808e15 m
p ly / au        # ~63241 AU

# linc

linc — extended stdlib batch 3 builtin. Alias for longest_increasing.

my $result = linc $x 
# or in a pipeline:
@list |> map linc |> p

# line_count

line_count — trivial string ops builtin.

my $result = line_count $x 
# or in a pipeline:
@list |> map line_count |> p

# line_intersection

line_intersection($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4) — finds the intersection point of two lines defined by points (x1,y1)-(x2,y2) and (x3,y3)-(x4,y4). Returns [$x, $y] or undef if parallel.

my $pt = line_intersection(0, 0, 1, 1, 0, 1, 1, 0)
p @$pt   # (0.5, 0.5)

# linear_regression

linear_regression — math / numeric (uncategorized batch) builtin.

my $result = linear_regression $x 
# or in a pipeline:
@list |> map linear_regression |> p

# linear_search

linear_search — collection (batch 2) builtin.

my $result = linear_search $x 
# or in a pipeline:
@list |> map linear_search |> p

# lineintr

lineintr — geometry (extended) builtin. Alias for line_intersection.

my $result = lineintr $x 
# or in a pipeline:
@list |> map lineintr |> p

# lines_from

lines_from — go/general functional utilities builtin.

my $result = lines_from $x 
# or in a pipeline:
@list |> map lines_from |> p

# linreg

linreg — math / numeric (uncategorized batch) builtin. Alias for linear_regression.

my $result = linreg $x 
# or in a pipeline:
@list |> map linreg |> p

# linspace

linspace — matrix / linear algebra builtin.

my $result = linspace $x 
# or in a pipeline:
@list |> map linspace |> p

# list_compact

list_compact — list helpers (batch 4) builtin.

my $result = list_compact $x 
# or in a pipeline:
@list |> map list_compact |> p

# list_count

list_count (alias list_size) returns the total number of elements after flattening a nested list structure. Unlike count which returns the top-level element count, list_count recursively descends into array references and counts only leaf values. This is useful when you have a list of lists and need to know the total number of individual items rather than the number of sublists.

my @nested = ([1, 2], [3, 4, 5], [6])
p list_count @nested   # 6
my @deep = ([1, [2, 3]], [4])
p list_size @deep      # 4
p list_count 1, 2, 3   # 3  (flat list works too)

# list_difference

list_difference — collection (batch 2) builtin. Alias for array_difference.

my $result = list_difference $x 
# or in a pipeline:
@list |> map list_difference |> p

# list_eq

list_eq — list helpers (batch 4) builtin.

my $result = list_eq $x 
# or in a pipeline:
@list |> map list_eq |> p

# list_flatten_deep

list_flatten_deep — list helpers (batch 4) builtin.

my $result = list_flatten_deep $x 
# or in a pipeline:
@list |> map list_flatten_deep |> p

# list_intersection

list_intersection — collection (batch 2) builtin. Alias for array_intersection.

my $result = list_intersection $x 
# or in a pipeline:
@list |> map list_intersection |> p

# list_reverse

list_reverse — file stat / path builtin. Alias for reverse_list.

my $result = list_reverse $x 
# or in a pipeline:
@list |> map list_reverse |> p

# list_union

list_union — collection (batch 2) builtin. Alias for array_union.

my $result = list_union $x 
# or in a pipeline:
@list |> map list_union |> p

# liters_to_gallons

liters_to_gallons — file stat / path builtin.

my $result = liters_to_gallons $input 

# liters_to_ml

liters_to_ml — file stat / path builtin.

my $result = liters_to_ml $input 

# ljt

ljt — extended stdlib builtin. Alias for ljust_text.

my $result = ljt $x 
# or in a pipeline:
@list |> map ljt |> p

# ljust

ljust — string helpers (batch 4) builtin.

my $result = ljust $x 
# or in a pipeline:
@list |> map ljust |> p

# ljust_text

ljust_text — extended stdlib builtin.

my $result = ljust_text $x 
# or in a pipeline:
@list |> map ljust_text |> p

# lkpa

lkpa — haskell list functions builtin. Alias for lookup_assoc.

my $result = lkpa $x 
# or in a pipeline:
@list |> map lkpa |> p

# lm

lm_fit (alias lm) — simple linear regression. Returns hash with intercept, slope, r_squared, residuals, fitted. Like R's lm().

my %m = %{lm([1,2,3,4,5], [2,4,5,4,5])}
p $m{slope}       # slope
p $m{r_squared}   # R²

# ln10

ln10 — math / physics constants builtin.

my $result = ln10 $x 
# or in a pipeline:
@list |> map ln10 |> p

# ln2

ln2 — math / physics constants builtin.

my $result = ln2 $x 
# or in a pipeline:
@list |> map ln2 |> p

# lnormpdf

lognormal_pdf (alias lnormpdf) evaluates the log-normal distribution PDF at x with parameters mu and sigma.

p lnormpdf(1.0, 0, 1)  # LogN(0,1) at x=1

# lns

lns — math / numeric (uncategorized batch) builtin. Alias for look_and_say.

my $result = lns $x 
# or in a pipeline:
@list |> map lns |> p

# load_avg

load_avg — system load averages as a 3-element arrayref [1min, 5min, 15min]. Uses getloadavg() on unix. Returns undef on unsupported platforms.

my $la = load_avg
p "1m=$la->[0] 5m=$la->[1] 15m=$la->[2]"
load_avg |> spark |> p                   # sparkline of load

# loess

lowess (alias loess) — locally-weighted scatterplot smoothing (LOWESS/LOESS). Returns smoothed Y values with tricube weighting.

my @smooth = @{lowess([1,2,3,4,5], [2,1,4,3,5])}

# log10

log10 — trivial numeric / predicate builtins builtin.

my $result = log10 $x 
# or in a pipeline:
@list |> map log10 |> p

# log2

log2 — trivial numeric / predicate builtins builtin.

my $result = log2 $x 
# or in a pipeline:
@list |> map log2 |> p

# log_base

log_base — math functions builtin.

my $result = log_base $x 
# or in a pipeline:
@list |> map log_base |> p

# log_with_base

log_with_base — extended stdlib builtin.

my $result = log_with_base $x 
# or in a pipeline:
@list |> map log_with_base |> p

# logb

logb — extended stdlib builtin. Alias for log_with_base.

my $result = logb $x 
# or in a pipeline:
@list |> map logb |> p

# longest

longest — collection (batch 2) builtin.

my $result = longest $x 
# or in a pipeline:
@list |> map longest |> p

# longest_common_prefix

longest_common_prefix — string (batch 2) builtin.

my $result = longest_common_prefix $x 
# or in a pipeline:
@list |> map longest_common_prefix |> p

# longest_common_subsequence

longest_common_subsequence — extended stdlib batch 3 builtin.

my $result = longest_common_subsequence $x 
# or in a pipeline:
@list |> map longest_common_subsequence |> p

# longest_common_substring

longest_common_substring — extended stdlib batch 3 builtin.

my $result = longest_common_substring $x 
# or in a pipeline:
@list |> map longest_common_substring |> p

# longest_decreasing

longest_decreasing — extended stdlib batch 3 builtin.

my $result = longest_decreasing $x 
# or in a pipeline:
@list |> map longest_decreasing |> p

# longest_increasing

longest_increasing — extended stdlib batch 3 builtin.

my $result = longest_increasing $x 
# or in a pipeline:
@list |> map longest_increasing |> p

# longest_run

longest_run — extended stdlib batch 3 builtin.

my $result = longest_run $x 
# or in a pipeline:
@list |> map longest_run |> p

# look_and_say

look_and_say — math / numeric (uncategorized batch) builtin.

my $result = look_and_say $x 
# or in a pipeline:
@list |> map look_and_say |> p

# lookup_assoc

lookup_assoc — haskell list functions builtin.

my $result = lookup_assoc $x 
# or in a pipeline:
@list |> map lookup_assoc |> p

# lorentz

lorentz_factor($velocity) (alias lorentz) — relativistic gamma factor γ = 1/√(1-v²/c²). Returns infinity at v ≥ c.

p lorentz(0)           # 1 (at rest)
p lorentz(0.9 * 3e8)   # ~2.29 (at 90% speed of light)

# lorenz

lorenz_curve(@data) (alias lorenz) — computes the Lorenz curve as an arrayref of [cumulative_share_of_population, cumulative_share_of_wealth] pairs. Used to visualize inequality. The diagonal represents perfect equality.

my $curve = lorenz(10, 20, 30, 40)
for my $pt (@$curve) {
    p "$pt->[0], $pt->[1]"
}

# lower_bound

lower_bound — extended stdlib builtin.

my $result = lower_bound $x 
# or in a pipeline:
@list |> map lower_bound |> p

# lowercase

lowercase — string (batch 2) builtin.

my $result = lowercase $x 
# or in a pipeline:
@list |> map lowercase |> p

# lowpass_filter

lowpass_filter(\@signal, $cutoff) (alias lpf) — applies a simple low-pass filter to remove high-frequency components. Cutoff is normalized (0-1). Uses exponential moving average.

my @noisy = map { sin(_/10) + rand(0.2) } 1:100
my $smooth = lpf(\@noisy, 0.1)

# lpad

lpad — trivial string ops builtin. Alias for pad_left.

my $result = lpad $x 
# or in a pipeline:
@list |> map lpad |> p

# lplanck

planck_length (alias lplanck) — lP ≈ 1.616×10⁻³⁵ m. Smallest meaningful length in quantum mechanics.

p lplanck   # 1.616255e-35 m

# lru_new

lru_new — data structure helpers builtin.

my $result = lru_new $x 
# or in a pipeline:
@list |> map lru_new |> p

# lrun

lrun — extended stdlib batch 3 builtin. Alias for longest_run.

my $result = lrun $x 
# or in a pipeline:
@list |> map lrun |> p

# lsearch

lsearch — collection (batch 2) builtin. Alias for linear_search.

my $result = lsearch $x 
# or in a pipeline:
@list |> map lsearch |> p

# lstat

lstat — filesystem builtin.

my $result = lstat $x 
# or in a pipeline:
@list |> map lstat |> p

# lucas

lucas — math / numeric (uncategorized batch) builtin.

my $result = lucas $x 
# or in a pipeline:
@list |> map lucas |> p

# luhn

luhn — math / numeric (uncategorized batch) builtin. Alias for luhn_check.

my $result = luhn $x 
# or in a pipeline:
@list |> map luhn |> p

# luhn_check

luhn_check — math / numeric (uncategorized batch) builtin.

my $result = luhn_check $x 
# or in a pipeline:
@list |> map luhn_check |> p

# lz

lz — base conversion builtin. Alias for leading_zeros.

my $result = lz $x 
# or in a pipeline:
@list |> map lz |> p

# m5

m5 — crypto / encoding builtin. Alias for md5.

my $result = m5 $x 
# or in a pipeline:
@list |> map m5 |> p

# m_to_feet

m_to_feet — unit conversions builtin.

my $result = m_to_feet $input 

# m_to_miles

m_to_miles — unit conversions builtin.

my $result = m_to_miles $input 

# m_to_s

m_to_s — unit conversions builtin. Alias for minutes_to_seconds.

my $result = m_to_s $input 

# m_to_yards

m_to_yards — unit conversions builtin.

my $result = m_to_yards $input 

# mac_duration

bond_duration (alias mac_duration) computes Macaulay duration — the weighted-average time to receive cash flows.

my $dur = bond_duration([5,5,5,105], 0.05)  # ≈ 3.72 years

# macdur

macdur — finance (extended) builtin. Alias for duration.

my $result = macdur $x 
# or in a pipeline:
@list |> map macdur |> p

# mad

mad — math / numeric (uncategorized batch) builtin. Alias for median_absolute_deviation.

my $result = mad $x 
# or in a pipeline:
@list |> map mad |> p

# madd

madd — extended stdlib builtin. Alias for matrix_add.

my $result = madd $x 
# or in a pipeline:
@list |> map madd |> p

# mae

mae — math functions builtin.

my $result = mae $x 
# or in a pipeline:
@list |> map mae |> p

# mag

mag — extended stdlib builtin. Alias for magnitude.

my $result = mag $x 
# or in a pipeline:
@list |> map mag |> p

# magenta

magenta — color / ansi builtin. Alias for red.

my $result = magenta $x 
# or in a pipeline:
@list |> map magenta |> p

# magenta_bold

magenta_bold — color / ansi builtin. Alias for red.

my $result = magenta_bold $x 
# or in a pipeline:
@list |> map magenta_bold |> p

# maglens

maglens — physics formulas builtin. Alias for magnification_lens.

my $result = maglens $x 
# or in a pipeline:
@list |> map maglens |> p

# magnification_lens

magnification_lens — physics formulas builtin.

my $result = magnification_lens $x 
# or in a pipeline:
@list |> map magnification_lens |> p

# magnitude

magnitude — extended stdlib builtin.

my $result = magnitude $x 
# or in a pipeline:
@list |> map magnitude |> p

# mahal

mahalanobis — Mahalanobis distance. Args: data, center, inverse_covariance. Like R's mahalanobis().

my @d = @{mahal([[1,2],[3,4]], [2,3], [[1,0],[0,1]])}

# majority

majority — extended stdlib batch 3 builtin. Alias for majority_element.

my $result = majority $x 
# or in a pipeline:
@list |> map majority |> p

# majority_element

majority_element — extended stdlib batch 3 builtin.

my $result = majority_element $x 
# or in a pipeline:
@list |> map majority_element |> p

# mall

mall — extended stdlib builtin. Alias for match_all.

my $result = mall $x 
# or in a pipeline:
@list |> map mall |> p

# mandel

mandel — algorithms / puzzles builtin. Alias for mandelbrot_char.

my $result = mandel $x 
# or in a pipeline:
@list |> map mandel |> p

# mandelbrot_char

mandelbrot_char — algorithms / puzzles builtin.

my $result = mandelbrot_char $x 
# or in a pipeline:
@list |> map mandelbrot_char |> p

# manhattan_distance

manhattan_distance — extended stdlib builtin.

my $result = manhattan_distance $x 
# or in a pipeline:
@list |> map manhattan_distance |> p

# mann_whitney

wilcox_test (aliases wilcox, mann_whitney) — Wilcoxon rank-sum test (Mann-Whitney U). Returns U statistic. Like R's wilcox.test().

my $U = wilcox([1,2,3], [4,5,6])  # 0 (no overlap)

# map_chars

map_chars — string helpers (batch 4) builtin.

my $result = map_chars $x 
# or in a pipeline:
@list |> map map_chars |> p

# map_indexed

map_indexed — go/general functional utilities builtin.

my $result = map_indexed $x 
# or in a pipeline:
@list |> map map_indexed |> p

# map_keys_fn

map_keys_fn — hash ops (batch 2) builtin.

my $result = map_keys_fn $x 
# or in a pipeline:
@list |> map map_keys_fn |> p

# map_range

map_range($value, $in_min, $in_max, $out_min, $out_max) (alias remap) — remap a value from one range to another.

p remap(50, 0, 100, 0, 1)     # 0.5
p remap(75, 0, 100, 0, 255)   # 191.25 (percent to byte)

# map_values_fn

map_values_fn — hash ops (batch 2) builtin.

my $result = map_values_fn $x 
# or in a pipeline:
@list |> map map_values_fn |> p

# map_while

map_while — rust iterator methods builtin.

my $result = map_while $x 
# or in a pipeline:
@list |> map map_while |> p

# mapcat

mapcat — algebraic match builtin.

my $result = mapcat $x 
# or in a pipeline:
@list |> map mapcat |> p

# mapi

mapi — go/general functional utilities builtin. Alias for map_indexed.

my $result = mapi $x 
# or in a pipeline:
@list |> map mapi |> p

# mapw

mapw — rust iterator methods builtin. Alias for map_while.

my $result = mapw $x 
# or in a pipeline:
@list |> map mapw |> p

# margin

margin — finance builtin.

my $result = margin $x 
# or in a pipeline:
@list |> map margin |> p

# margin_price

margin_price — physics formulas builtin.

my $result = margin_price $x 
# or in a pipeline:
@list |> map margin_price |> p

# markup

markup — finance builtin.

my $result = markup $x 
# or in a pipeline:
@list |> map markup |> p

# markup_price

markup_price — physics formulas builtin.

my $result = markup_price $x 
# or in a pipeline:
@list |> map markup_price |> p

# mask

mask — string processing (uncategorized batch) builtin. Alias for mask_string.

my $result = mask $x 
# or in a pipeline:
@list |> map mask |> p

# mask_string

mask_string — string processing (uncategorized batch) builtin.

my $result = mask_string $x 
# or in a pipeline:
@list |> map mask_string |> p

# mat_mul

mat_mul — matrix / linear algebra builtin. Alias for matrix_multiply.

my $result = mat_mul $x 
# or in a pipeline:
@list |> map mat_mul |> p

# mat_scale

mat_scale — extended stdlib builtin. Alias for matrix_scale.

my $result = mat_scale $x 
# or in a pipeline:
@list |> map mat_scale |> p

# match_all

match_all — extended stdlib builtin.

my $result = match_all $x 
# or in a pipeline:
@list |> map match_all |> p

# matches_regex

matches_regex — file stat / path builtin.

my $result = matches_regex $x 
# or in a pipeline:
@list |> map matches_regex |> p

# matmul

matmul — extended stdlib builtin. Alias for matrix_mul.

my $result = matmul $x 
# or in a pipeline:
@list |> map matmul |> p

# matrix_add

matrix_add — extended stdlib builtin.

my $result = matrix_add $x 
# or in a pipeline:
@list |> map matrix_add |> p

# matrix_col

matrix_col — extended stdlib builtin.

my $result = matrix_col $x 
# or in a pipeline:
@list |> map matrix_col |> p

# matrix_det

matrix_det — extended stdlib builtin.

my $result = matrix_det $x 
# or in a pipeline:
@list |> map matrix_det |> p

# matrix_diag

matrix_diag — extended stdlib builtin.

my $result = matrix_diag $x 
# or in a pipeline:
@list |> map matrix_diag |> p

# matrix_flatten

matrix_flatten — matrix operations (uncategorized batch) builtin.

my $result = matrix_flatten $x 
# or in a pipeline:
@list |> map matrix_flatten |> p

# matrix_from_rows

matrix_from_rows — matrix operations (uncategorized batch) builtin.

my $result = matrix_from_rows $x 
# or in a pipeline:
@list |> map matrix_from_rows |> p

# matrix_hadamard

matrix_hadamard — matrix operations (uncategorized batch) builtin.

my $result = matrix_hadamard $x 
# or in a pipeline:
@list |> map matrix_hadamard |> p

# matrix_identity

matrix_identity — extended stdlib builtin.

my $result = matrix_identity $x 
# or in a pipeline:
@list |> map matrix_identity |> p

# matrix_inverse

matrix_inverse — matrix operations (uncategorized batch) builtin.

my $result = matrix_inverse $x 
# or in a pipeline:
@list |> map matrix_inverse |> p

# matrix_lu

matrix_lu (alias mlu) computes the LU decomposition with partial pivoting. Returns [L, U, P] where PA = LU.

my ($L, $U, $P) = @{mlu([[4,3],[6,3]])}

# matrix_map

matrix_map — matrix operations (uncategorized batch) builtin.

my $result = matrix_map $x 
# or in a pipeline:
@list |> map matrix_map |> p

# matrix_max

matrix_max — matrix operations (uncategorized batch) builtin.

my $result = matrix_max $x 
# or in a pipeline:
@list |> map matrix_max |> p

# matrix_min

matrix_min — matrix operations (uncategorized batch) builtin.

my $result = matrix_min $x 
# or in a pipeline:
@list |> map matrix_min |> p

# matrix_mul

matrix_mul — extended stdlib builtin.

my $result = matrix_mul $x 
# or in a pipeline:
@list |> map matrix_mul |> p

# matrix_mult

matrix_mult — extended stdlib builtin.

my $result = matrix_mult $x 
# or in a pipeline:
@list |> map matrix_mult |> p

# matrix_multiply

matrix_multiply — matrix / linear algebra builtin.

my $result = matrix_multiply $x 
# or in a pipeline:
@list |> map matrix_multiply |> p

# matrix_norm

matrix_norm (alias mnorm) computes a matrix norm. Default is Frobenius; pass 1 for max-column-sum, Inf for max-row-sum.

p mnorm([[3,4]])           # 5 (Frobenius)
p mnorm([[1,2],[3,4]], 1)  # 6 (1-norm)

# matrix_ones

matrix_ones — extended stdlib builtin.

my $result = matrix_ones $x 
# or in a pipeline:
@list |> map matrix_ones |> p

# matrix_pinv

matrix_pinv (aliases mpinv, pinv) computes the Moore-Penrose pseudo-inverse via (A^T A)^{-1} A^T.

my $A_plus = pinv([[1,2],[3,4],[5,6]])

# matrix_power

matrix_power — matrix operations (uncategorized batch) builtin.

my $result = matrix_power $x 
# or in a pipeline:
@list |> map matrix_power |> p

# matrix_qr

matrix_qr (alias mqr) computes the QR decomposition via Gram-Schmidt orthogonalization. Returns [Q, R] where A = QR.

my ($Q, $R) = @{mqr([[1,1],[1,-1]])}

# matrix_row

matrix_row — extended stdlib builtin.

my $result = matrix_row $x 
# or in a pipeline:
@list |> map matrix_row |> p

# matrix_scalar

matrix_scalar — extended stdlib builtin.

my $result = matrix_scalar $x 
# or in a pipeline:
@list |> map matrix_scalar |> p

# matrix_scale

matrix_scale — extended stdlib builtin.

my $result = matrix_scale $x 
# or in a pipeline:
@list |> map matrix_scale |> p

# matrix_shape

matrix_shape — extended stdlib builtin.

my $result = matrix_shape $x 
# or in a pipeline:
@list |> map matrix_shape |> p

# matrix_solve

matrix_solve (aliases msolve, solve) solves the linear system Ax=b via Gaussian elimination with partial pivoting. Returns the solution vector x.

my $A = [[2,1],[-1,1]]
my $b = [5,2]
my $x = solve($A, $b)   # [1, 3]

# matrix_sub

matrix_sub — extended stdlib builtin.

my $result = matrix_sub $x 
# or in a pipeline:
@list |> map matrix_sub |> p

# matrix_sum

matrix_sum — matrix operations (uncategorized batch) builtin.

my $result = matrix_sum $x 
# or in a pipeline:
@list |> map matrix_sum |> p

# matrix_trace

matrix_trace — extended stdlib builtin.

my $result = matrix_trace $x 
# or in a pipeline:
@list |> map matrix_trace |> p

# matrix_transpose

matrix_transpose — matrix operations (uncategorized batch) builtin.

my $result = matrix_transpose $x 
# or in a pipeline:
@list |> map matrix_transpose |> p

# matrix_zeros

matrix_zeros — extended stdlib builtin.

my $result = matrix_zeros $x 
# or in a pipeline:
@list |> map matrix_zeros |> p

# max2

max2 — trivial numeric / predicate builtins builtin.

my $result = max2 $x 
# or in a pipeline:
@list |> map max2 |> p

# max_abs

max_abs — trig / math (batch 2) builtin.

my $result = max_abs $x 
# or in a pipeline:
@list |> map max_abs |> p

# max_by

max_by — pipeline / string helpers builtin. Alias for drop.

my $result = max_by $x 
# or in a pipeline:
@list |> map max_by |> p

# max_drawdown

max_drawdown(@equity_curve) (alias mdd) — computes the maximum peak-to-trough decline in a series of values. Returns as a decimal (0.2 = 20% drawdown). Key risk metric.

my @equity = (100, 120, 90, 110, 85, 130)
p mdd(@equity)   # ~0.29 (29% max drawdown)

# max_float

max_float — conversion / utility (batch 4) builtin.

my $result = max_float $x 
# or in a pipeline:
@list |> map max_float |> p

# max_list

max_list — list helpers (batch 4) builtin.

my $result = max_list $x 
# or in a pipeline:
@list |> map max_list |> p

# max_of

max_of — more list helpers builtin.

my $result = max_of $x 
# or in a pipeline:
@list |> map max_of |> p

# max_sum_subarray

max_sum_subarray — extended stdlib batch 3 builtin.

my $result = max_sum_subarray $x 
# or in a pipeline:
@list |> map max_sum_subarray |> p

# maxby

maxby — additional missing stdlib functions builtin. Alias for maximum_by.

my $result = maxby $x 
# or in a pipeline:
@list |> map maxby |> p

# maxdd

maxdd — finance (extended) builtin. Alias for max_drawdown.

my $result = maxdd $x 
# or in a pipeline:
@list |> map maxdd |> p

# maximum_by

maximum_by — additional missing stdlib functions builtin.

my $result = maximum_by $x 
# or in a pipeline:
@list |> map maximum_by |> p

# maxsub

maxsub — extended stdlib batch 3 builtin. Alias for max_sum_subarray.

my $result = maxsub $x 
# or in a pipeline:
@list |> map maxsub |> p

# mb_to_bytes

mb_to_bytes — unit conversions builtin.

my $result = mb_to_bytes $input 

# mb_to_gb

mb_to_gb — unit conversions builtin.

my $result = mb_to_gb $input 

# mcat

mcat — algebraic match builtin. Alias for mapcat.

my $result = mcat $x 
# or in a pipeline:
@list |> map mcat |> p

# mcol

mcol — extended stdlib builtin. Alias for matrix_col.

my $result = mcol $x 
# or in a pipeline:
@list |> map mcol |> p

# md5

md5 — crypto / encoding builtin.

my $result = md5 $x 
# or in a pipeline:
@list |> map md5 |> p

# mdet

mdet — extended stdlib builtin. Alias for matrix_det.

my $result = mdet $x 
# or in a pipeline:
@list |> map mdet |> p

# mdiag

mdiag — extended stdlib builtin. Alias for matrix_diag.

my $result = mdiag $x 
# or in a pipeline:
@list |> map mdiag |> p

# mdist

mdist — extended stdlib builtin. Alias for manhattan_distance.

my $result = mdist $x 
# or in a pipeline:
@list |> map mdist |> p

# mean_absolute_error

mean_absolute_error — math / numeric (uncategorized batch) builtin.

my $result = mean_absolute_error $x 
# or in a pipeline:
@list |> map mean_absolute_error |> p

# mean_list

mean_list — list helpers (batch 4) builtin.

my $result = mean_list $x 
# or in a pipeline:
@list |> map mean_list |> p

# mean_squared_error

mean_squared_error — math / numeric (uncategorized batch) builtin.

my $result = mean_squared_error $x 
# or in a pipeline:
@list |> map mean_squared_error |> p

# measure

measure — conversion / utility (batch 4) builtin.

my $result = measure $x 
# or in a pipeline:
@list |> map measure |> p

# medfilt

median_filter(\@signal, $window_size) (alias medfilt) — applies a median filter for noise removal. Each output is the median of the surrounding window. Excellent for removing impulse noise while preserving edges.

my @spiky = (1, 2, 100, 3, 4)   # 100 is spike
my $clean = medfilt(\@spiky, 3)
p @$clean   # spike removed

# median_absolute_deviation

median_absolute_deviation — math / numeric (uncategorized batch) builtin.

my $result = median_absolute_deviation $x 
# or in a pipeline:
@list |> map median_absolute_deviation |> p

# mem_free

mem_free — free/available physical RAM in bytes. On Linux reads MemAvailable from /proc/meminfo (falls back to MemFree). On macOS uses vm.page_free_count via sysctl. Returns undef on unsupported platforms.

p mem_free                               # 3821666304
p format_bytes(mem_free)                 # 3.6 GiB
my $pct = int(mem_free / mem_total * 100)
p "$pct% free"

# mem_total

mem_total — total physical RAM in bytes. Uses /proc/meminfo on Linux, sysctlbyname("hw.memsize") on macOS. Returns undef on unsupported platforms.

p mem_total                              # 68719476736
p format_bytes(mem_total)                # 64.0 GiB

# mem_used

mem_used — used physical RAM in bytes (total - free). Returns undef if either mem_total or mem_free is unavailable.

p format_bytes(mem_used)                 # 60.4 GiB
gauge(mem_used / mem_total) |> p         # memory usage gauge

# merge_hash

merge_hash — hash helpers builtin.

my $result = merge_hash $x 
# or in a pipeline:
@list |> map merge_hash |> p

# merge_sorted

merge_sorted — matrix operations (uncategorized batch) builtin.

my $result = merge_sorted $x 
# or in a pipeline:
@list |> map merge_sorted |> p

# metaphone

metaphone — encoding / phonetics builtin.

my $result = metaphone $x 
# or in a pipeline:
@list |> map metaphone |> p

# metph

metph — encoding / phonetics builtin. Alias for metaphone.

my $result = metph $x 
# or in a pipeline:
@list |> map metph |> p

# mflat

mflat — matrix operations (uncategorized batch) builtin. Alias for matrix_flatten.

my $result = mflat $x 
# or in a pipeline:
@list |> map mflat |> p

# mfromr

mfromr — matrix operations (uncategorized batch) builtin. Alias for matrix_from_rows.

my $result = mfromr $x 
# or in a pipeline:
@list |> map mfromr |> p

# mhad

mhad — matrix operations (uncategorized batch) builtin. Alias for matrix_hadamard.

my $result = mhad $x 
# or in a pipeline:
@list |> map mhad |> p

# mid_str

mid_str — string (batch 2) builtin.

my $result = mid_str $x 
# or in a pipeline:
@list |> map mid_str |> p

# mident

mident — extended stdlib builtin. Alias for matrix_identity.

my $result = mident $x 
# or in a pipeline:
@list |> map mident |> p

# midpnt

midpnt — geometry / physics builtin. Alias for midpoint.

my $result = midpnt $x 
# or in a pipeline:
@list |> map midpnt |> p

# midpoint

midpoint — geometry / physics builtin.

my $result = midpoint $x 
# or in a pipeline:
@list |> map midpoint |> p

# midpoint_of

midpoint_of — extended stdlib builtin.

my $result = midpoint_of $x 
# or in a pipeline:
@list |> map midpoint_of |> p

# midpt

midpt — extended stdlib builtin. Alias for midpoint_of.

my $result = midpt $x 
# or in a pipeline:
@list |> map midpt |> p

# miles_to_km

miles_to_km — unit conversions builtin.

my $result = miles_to_km $input 

# miles_to_m

miles_to_m — unit conversions builtin.

my $result = miles_to_m $input 

# min2

min2 — trivial numeric / predicate builtins builtin.

my $result = min2 $x 
# or in a pipeline:
@list |> map min2 |> p

# min_abs

min_abs — trig / math (batch 2) builtin.

my $result = min_abs $x 
# or in a pipeline:
@list |> map min_abs |> p

# min_by

min_by — pipeline / string helpers builtin. Alias for drop.

my $result = min_by $x 
# or in a pipeline:
@list |> map min_by |> p

# min_float

min_float — conversion / utility (batch 4) builtin.

my $result = min_float $x 
# or in a pipeline:
@list |> map min_float |> p

# min_list

min_list — list helpers (batch 4) builtin.

my $result = min_list $x 
# or in a pipeline:
@list |> map min_list |> p

# min_max

min_max — file stat / path builtin.

my $result = min_max $x 
# or in a pipeline:
@list |> map min_max |> p

# min_of

min_of — more list helpers builtin.

my $result = min_of $x 
# or in a pipeline:
@list |> map min_of |> p

# minby

minby — additional missing stdlib functions builtin. Alias for minimum_by.

my $result = minby $x 
# or in a pipeline:
@list |> map minby |> p

# minimum_by

minimum_by — additional missing stdlib functions builtin.

my $result = minimum_by $x 
# or in a pipeline:
@list |> map minimum_by |> p

# minkdist

minkdist — math / numeric (uncategorized batch) builtin. Alias for minkowski_distance.

my $result = minkdist $x 
# or in a pipeline:
@list |> map minkdist |> p

# minkowski_distance

minkowski_distance — math / numeric (uncategorized batch) builtin.

my $result = minkowski_distance $x 
# or in a pipeline:
@list |> map minkowski_distance |> p

# minmax

minmax — python/ruby stdlib builtin.

my $result = minmax $x 
# or in a pipeline:
@list |> map minmax |> p

# minmax_by

minmax_by — python/ruby stdlib builtin.

my $result = minmax_by $x 
# or in a pipeline:
@list |> map minmax_by |> p

# minutes_to_hours

minutes_to_hours — unit conversions builtin.

my $result = minutes_to_hours $input 

# minutes_to_seconds

minutes_to_seconds — unit conversions builtin.

my $result = minutes_to_seconds $input 

# minv

minv — matrix operations (uncategorized batch) builtin. Alias for matrix_inverse.

my $result = minv $x 
# or in a pipeline:
@list |> map minv |> p

# mirror_string

mirror_string — string helpers (batch 4) builtin.

my $result = mirror_string $x 
# or in a pipeline:
@list |> map mirror_string |> p

# mish

mish applies the Mish activation: x·tanh(softplus(x)). Often outperforms ReLU/Swish.

p mish(1)    # 0.8651
p mish(-1)   # -0.3034

# ml_to_cups

ml_to_cups — file stat / path builtin.

my $result = ml_to_cups $input 

# ml_to_liters

ml_to_liters — file stat / path builtin.

my $result = ml_to_liters $input 

# mm

mm — extended stdlib builtin. Alias for matrix_mul.

my $result = mm $x 
# or in a pipeline:
@list |> map mm |> p

# mmap

mmap — matrix operations (uncategorized batch) builtin. Alias for matrix_map.

my $result = mmap $x 
# or in a pipeline:
@list |> map mmap |> p

# mmax

mmax — matrix operations (uncategorized batch) builtin. Alias for matrix_max.

my $result = mmax $x 
# or in a pipeline:
@list |> map mmax |> p

# mmin

mmin — matrix operations (uncategorized batch) builtin. Alias for matrix_min.

my $result = mmin $x 
# or in a pipeline:
@list |> map mmin |> p

# mmult

mmult — extended stdlib builtin. Alias for matrix_mult.

my $result = mmult $x 
# or in a pipeline:
@list |> map mmult |> p

# mmx

mmx — python/ruby stdlib builtin. Alias for minmax.

my $result = mmx $x 
# or in a pipeline:
@list |> map mmx |> p

# mmxb

mmxb — python/ruby stdlib builtin. Alias for minmax_by.

my $result = mmxb $x 
# or in a pipeline:
@list |> map mmxb |> p

# mob

mob — extended stdlib batch 3 builtin. Alias for mobius.

my $result = mob $x 
# or in a pipeline:
@list |> map mob |> p

# mobius

mobius — extended stdlib batch 3 builtin.

my $result = mobius $x 
# or in a pipeline:
@list |> map mobius |> p

# mod_exp

mod_exp (aliases modexp, powmod) computes modular exponentiation: base^exp mod m, using fast binary exponentiation.

p powmod(2, 10, 1000)  # 24 (2^10 mod 1000)
p powmod(3, 13, 50)    # 7

# mod_inv

mod_inv (alias modinv) computes the modular multiplicative inverse via extended Euclidean algorithm. Errors if no inverse exists.

p modinv(3, 7)   # 5 (3*5 ≡ 1 mod 7)

# mod_op

mod_op — trig / math (batch 2) builtin.

my $result = mod_op $x 
# or in a pipeline:
@list |> map mod_op |> p

# moddur

moddur — finance (extended) builtin. Alias for modified_duration.

my $result = moddur $x 
# or in a pipeline:
@list |> map moddur |> p

# mode_list

mode_list — list helpers (batch 4) builtin.

my $result = mode_list $x 
# or in a pipeline:
@list |> map mode_list |> p

# mode_stat

mode_stat — extended stdlib builtin.

my $result = mode_stat $x 
# or in a pipeline:
@list |> map mode_stat |> p

# mode_val

mode_val — trivial numeric / predicate builtins builtin.

my $result = mode_val $x 
# or in a pipeline:
@list |> map mode_val |> p

# modified_duration

modified_duration($face, $coupon_rate, $ytm, $periods) (alias mod_dur) — computes modified duration, which directly measures price sensitivity to yield changes. Equal to Macaulay duration / (1 + ytm).

p mod_dur(1000, 0.05, 0.05, 10)   # ~7.3

# momentum

momentum($mass, $velocity) — compute momentum p = mv (kg⋅m/s).

p momentum(10, 5)   # 50 kg⋅m/s

# mones

mones — extended stdlib builtin. Alias for matrix_ones.

my $result = mones $x 
# or in a pipeline:
@list |> map mones |> p

# month_name

month_name — date helpers builtin.

my $result = month_name $x 
# or in a pipeline:
@list |> map month_name |> p

# month_short

month_short — date helpers builtin.

my $result = month_short $x 
# or in a pipeline:
@list |> map month_short |> p

# morse

morse — encoding / phonetics builtin. Alias for morse_encode.

my $result = morse $x 
# or in a pipeline:
@list |> map morse |> p

# morse_decode

morse_decode — encoding / phonetics builtin.

my $result = morse_decode $x 
# or in a pipeline:
@list |> map morse_decode |> p

# morse_encode

morse_encode — encoding / phonetics builtin.

my $result = morse_encode $x 
# or in a pipeline:
@list |> map morse_encode |> p

# mortgage_payment

mortgage_payment — physics formulas builtin.

my $result = mortgage_payment $x 
# or in a pipeline:
@list |> map mortgage_payment |> p

# most_common

most_common — list helpers (batch 4) builtin.

my $result = most_common $x 
# or in a pipeline:
@list |> map most_common |> p

# movavg

movavg — math / numeric (uncategorized batch) builtin. Alias for moving_average.

my $result = movavg $x 
# or in a pipeline:
@list |> map movavg |> p

# moving_average

moving_average — math / numeric (uncategorized batch) builtin.

my $result = moving_average $x 
# or in a pipeline:
@list |> map moving_average |> p

# mplanck

mplanck — physics constants builtin. Alias for planck_mass.

my $result = mplanck $x 
# or in a pipeline:
@list |> map mplanck |> p

# mpow

mpow — matrix operations (uncategorized batch) builtin. Alias for matrix_power.

my $result = mpow $x 
# or in a pipeline:
@list |> map mpow |> p

# mrow

mrow — extended stdlib builtin. Alias for matrix_row.

my $result = mrow $x 
# or in a pipeline:
@list |> map mrow |> p

# ms_to_ns

ms_to_ns — file stat / path builtin.

my $result = ms_to_ns $input 

# ms_to_s

ms_to_s — file stat / path builtin.

my $result = ms_to_s $input 

# mscal

mscal — extended stdlib builtin. Alias for matrix_scalar.

my $result = mscal $x 
# or in a pipeline:
@list |> map mscal |> p

# mse

mse — math functions builtin.

my $result = mse $x 
# or in a pipeline:
@list |> map mse |> p

# msgctl

msgctl — sysv ipc builtin.

my $result = msgctl $x 
# or in a pipeline:
@list |> map msgctl |> p

# msgget

msgget — sysv ipc builtin.

my $result = msgget $x 
# or in a pipeline:
@list |> map msgget |> p

# msgrcv

msgrcv — sysv ipc builtin.

my $result = msgrcv $x 
# or in a pipeline:
@list |> map msgrcv |> p

# msgsnd

msgsnd — sysv ipc builtin.

my $result = msgsnd $x 
# or in a pipeline:
@list |> map msgsnd |> p

# mshape

mshape — extended stdlib builtin. Alias for matrix_shape.

my $result = mshape $x 
# or in a pipeline:
@list |> map mshape |> p

# msorted

msorted — matrix operations (uncategorized batch) builtin. Alias for merge_sorted.

my $result = msorted $x 
# or in a pipeline:
@list |> map msorted |> p

# mst

prim_mst (aliases mst, prim) computes the minimum spanning tree weight via Prim's algorithm. Takes an adjacency matrix.

p mst([[0,2,0],[2,0,3],[0,3,0]])  # 5

# mstat

mstat — extended stdlib builtin. Alias for mode_stat.

my $result = mstat $x 
# or in a pipeline:
@list |> map mstat |> p

# msub

msub — extended stdlib builtin. Alias for matrix_sub.

my $result = msub $x 
# or in a pipeline:
@list |> map msub |> p

# msum

msum — matrix operations (uncategorized batch) builtin. Alias for matrix_sum.

my $result = msum $x 
# or in a pipeline:
@list |> map msum |> p

# msun

sun_mass (alias msun) — M☉ ≈ 1.989×10³⁰ kg. Mass of Sun (solar mass).

p msun   # 1.98892e30 kg

# mtime

mtime — file stat / path builtin. Alias for file_mtime.

my $result = mtime $x 
# or in a pipeline:
@list |> map mtime |> p

# mtrace

mtrace — extended stdlib builtin. Alias for matrix_trace.

my $result = mtrace $x 
# or in a pipeline:
@list |> map mtrace |> p

# mtrans

mtrans — matrix operations (uncategorized batch) builtin. Alias for matrix_transpose.

my $result = mtrans $x 
# or in a pipeline:
@list |> map mtrans |> p

# mu0

mu0 — physics constants builtin. Alias for vacuum_permeability.

my $result = mu0 $x 
# or in a pipeline:
@list |> map mu0 |> p

# mub

mub — physics constants builtin. Alias for bohr_magneton.

my $result = mub $x 
# or in a pipeline:
@list |> map mub |> p

# multinom

multinom — math / numeric (uncategorized batch) builtin. Alias for multinomial.

my $result = multinom $x 
# or in a pipeline:
@list |> map multinom |> p

# multinomial

multinomial — math / numeric (uncategorized batch) builtin.

my $result = multinomial $x 
# or in a pipeline:
@list |> map multinomial |> p

# mun

mun — physics constants builtin. Alias for nuclear_magneton.

my $result = mun $x 
# or in a pipeline:
@list |> map mun |> p

# mzeros

mzeros — extended stdlib builtin. Alias for matrix_zeros.

my $result = mzeros $x 
# or in a pipeline:
@list |> map mzeros |> p

# nanoid

nanoid — id helpers builtin.

my $result = nanoid $x 
# or in a pipeline:
@list |> map nanoid |> p

# nato

nato — encoding / phonetics builtin. Alias for nato_phonetic.

my $result = nato $x 
# or in a pipeline:
@list |> map nato |> p

# nato_phonetic

nato_phonetic — encoding / phonetics builtin.

my $result = nato_phonetic $input 

# ncol

ncol — number of columns in a matrix.

p ncol([[1,2,3],[4,5,6]])  # 3

# ndivs

ndivs — math / numeric (uncategorized batch) builtin. Alias for num_divisors.

my $result = ndivs $x 
# or in a pipeline:
@list |> map ndivs |> p

# neg_inf

neg_inf — math / numeric (uncategorized batch) builtin.

my $result = neg_inf $x 
# or in a pipeline:
@list |> map neg_inf |> p

# neg_n

neg_n — trivial numeric / predicate builtins builtin. Alias for negative.

my $result = neg_n $x 
# or in a pipeline:
@list |> map neg_n |> p

# negate

negate — trivial numeric / predicate builtins builtin.

my $result = negate $x 
# or in a pipeline:
@list |> map negate |> p

# negate_each

negate_each — trivial numeric helpers (batch 4) builtin.

my $result = negate_each $x 
# or in a pipeline:
@list |> map negate_each |> p

# negative

negative — trivial numeric / predicate builtins builtin.

my $result = negative $x 
# or in a pipeline:
@list |> map negative |> p

# neither

neither — boolean combinators builtin.

my $result = neither $x 
# or in a pipeline:
@list |> map neither |> p

# neutron_mass

neutron_mass — physics constants builtin.

my $result = neutron_mass $x 
# or in a pipeline:
@list |> map neutron_mass |> p

# newton

newton_method (aliases newton, newton_raphson) finds a root via Newton-Raphson. Takes f, f', x0, and optional tolerance.

my $root = newton(fn { $_[0]**2 - 2 }, fn { 2*$_[0] }, 1.5)  # √2

# newtons_to_lbf

newtons_to_lbf — file stat / path builtin.

my $result = newtons_to_lbf $input 

# next_permutation

next_permutation — matrix operations (uncategorized batch) builtin.

my $result = next_permutation $x 
# or in a pipeline:
@list |> map next_permutation |> p

# next_prime

next_prime — number theory / primes builtin.

my $result = next_prime $x 
# or in a pipeline:
@list |> map next_prime |> p

# nfirst

nfirst — algebraic match builtin.

my $result = nfirst $x 
# or in a pipeline:
@list |> map nfirst |> p

# nfs

nfs — algebraic match builtin. Alias for nfirst.

my $result = nfs $x 
# or in a pipeline:
@list |> map nfs |> p

# ngram

ngram — string processing (uncategorized batch) builtin. Alias for ngrams.

my $result = ngram $x 
# or in a pipeline:
@list |> map ngram |> p

# ngrams

ngrams — string processing (uncategorized batch) builtin.

my $result = ngrams $x 
# or in a pipeline:
@list |> map ngrams |> p

# nmass

nmass — physics constants builtin. Alias for neutron_mass.

my $result = nmass $x 
# or in a pipeline:
@list |> map nmass |> p

# nne

nne — algebraic match builtin. Alias for nnext.

my $result = nne $x 
# or in a pipeline:
@list |> map nne |> p

# nnext

nnext — algebraic match builtin.

my $result = nnext $x 
# or in a pipeline:
@list |> map nnext |> p

# nohtml

nohtml — string processing (uncategorized batch) builtin. Alias for strip_html.

my $result = nohtml $x 
# or in a pipeline:
@list |> map nohtml |> p

# none_match

none_match — python/ruby stdlib builtin.

my $result = none_match $x 
# or in a pipeline:
@list |> map none_match |> p

# nonem

nonem — python/ruby stdlib builtin. Alias for none_match.

my $result = nonem $x 
# or in a pipeline:
@list |> map nonem |> p

# nonempty_count

nonempty_count — counters (batch 4) builtin.

my $result = nonempty_count $x 
# or in a pipeline:
@list |> map nonempty_count |> p

# nonzero

nonzero — trivial numeric / predicate builtins builtin.

my $result = nonzero $x 
# or in a pipeline:
@list |> map nonzero |> p

# noop_val

noop_val — conversion / utility (batch 4) builtin.

my $result = noop_val $x 
# or in a pipeline:
@list |> map noop_val |> p

# nop

nop — conversion / utility (batch 4) builtin.

my $result = nop $x 
# or in a pipeline:
@list |> map nop |> p

# normal_cdf

normal_cdf($x, $mu, $sigma) (alias normcdf) — cumulative distribution function. Returns probability that a value is ≤ x.

p normcdf(0)              # 0.5 (half below mean)
p normcdf(1.96)           # ~0.975 (95% confidence bound)

# normal_pdf

normal_pdf($x, $mu, $sigma) (alias normpdf) — normal/Gaussian distribution probability density function. Default: μ=0, σ=1 (standard normal).

p normpdf(0)              # ~0.399 (peak of standard normal)
p normpdf(0, 100, 15)     # PDF at IQ=100, mean=100, stddev=15

# normalize_array

normalize_array — matrix operations (uncategorized batch) builtin.

my $result = normalize_array $x 
# or in a pipeline:
@list |> map normalize_array |> p

# normalize_list

normalize_list — functional combinators builtin.

my $result = normalize_list $x 
# or in a pipeline:
@list |> map normalize_list |> p

# normalize_range

normalize_range — matrix operations (uncategorized batch) builtin.

my $result = normalize_range $x 
# or in a pipeline:
@list |> map normalize_range |> p

# normalize_signal

normalize_signal(\@signal) (alias normsig) — scales signal to range [-1, 1] based on its peak absolute value. Useful for audio processing.

my $norm = normsig(\@audio)
p max(map { abs } @$norm)   # 1

# normalize_spaces

normalize_spaces — extended stdlib builtin.

my $result = normalize_spaces $x 
# or in a pipeline:
@list |> map normalize_spaces |> p

# normalize_vec

normalize_vec — extended stdlib builtin.

my $result = normalize_vec $x 
# or in a pipeline:
@list |> map normalize_vec |> p

# normalize_whitespace

normalize_whitespace — string helpers (batch 4) builtin.

my $result = normalize_whitespace $x 
# or in a pipeline:
@list |> map normalize_whitespace |> p

# normarr

normarr — matrix operations (uncategorized batch) builtin. Alias for normalize_array.

my $result = normarr $x 
# or in a pipeline:
@list |> map normarr |> p

# not_any

not_any — algebraic match builtin.

my $result = not_any $x 
# or in a pipeline:
@list |> map not_any |> p

# not_each

not_each — trivial numeric helpers (batch 4) builtin.

my $result = not_each $x 
# or in a pipeline:
@list |> map not_each |> p

# not_elem

not_elem — haskell list functions builtin.

my $result = not_elem $x 
# or in a pipeline:
@list |> map not_elem |> p

# not_every

not_every — algebraic match builtin.

my $result = not_every $x 
# or in a pipeline:
@list |> map not_every |> p

# now

now — date / time builtin. Alias for datetime_now_tz.

my $result = now $x 
# or in a pipeline:
@list |> map now |> p

# now_ms

now_ms — now / timestamp builtin.

my $result = now_ms $x 
# or in a pipeline:
@list |> map now_ms |> p

# now_ns

now_ns — now / timestamp builtin.

my $result = now_ns $x 
# or in a pipeline:
@list |> map now_ns |> p

# now_us

now_us — now / timestamp builtin.

my $result = now_us $x 
# or in a pipeline:
@list |> map now_us |> p

# nper

nper($rate, $pmt, $pv) (alias num_periods) — computes the number of periods needed to pay off a loan given rate, payment, and principal.

p nper(0.05/12, 500, 50000)   # ~127 months

# npv

npv — math / numeric (uncategorized batch) builtin.

my $result = npv $x 
# or in a pipeline:
@list |> map npv |> p

# nrmrng

nrmrng — matrix operations (uncategorized batch) builtin. Alias for normalize_range.

my $result = nrmrng $x 
# or in a pipeline:
@list |> map nrmrng |> p

# nrmsp

nrmsp — extended stdlib builtin. Alias for normalize_spaces.

my $result = nrmsp $x 
# or in a pipeline:
@list |> map nrmsp |> p

# nrmv

nrmv — extended stdlib builtin. Alias for normalize_vec.

my $result = nrmv $x 
# or in a pipeline:
@list |> map nrmv |> p

# nroot

nroot — extended stdlib builtin. Alias for nth_root_of.

my $result = nroot $x 
# or in a pipeline:
@list |> map nroot |> p

# nrow

nrow — number of rows in a matrix.

p nrow([[1,2],[3,4],[5,6]])  # 3

# ns_to_ms

ns_to_ms — file stat / path builtin.

my $result = ns_to_ms $input 

# ns_to_us

ns_to_us — file stat / path builtin.

my $result = ns_to_us $input 

# ntelm

ntelm — haskell list functions builtin. Alias for not_elem.

my $result = ntelm $x 
# or in a pipeline:
@list |> map ntelm |> p

# nth_prime

nth_prime — number theory / primes builtin.

my $result = nth_prime $x 
# or in a pipeline:
@list |> map nth_prime |> p

# nth_root

nth_root — math functions builtin.

my $result = nth_root $x 
# or in a pipeline:
@list |> map nth_root |> p

# nth_root_of

nth_root_of — extended stdlib builtin.

my $result = nth_root_of $x 
# or in a pipeline:
@list |> map nth_root_of |> p

# nth_word

nth_word — file stat / path builtin.

my $result = nth_word $x 
# or in a pipeline:
@list |> map nth_word |> p

# nthp

nthp — number theory / primes builtin. Alias for nth_prime.

my $result = nthp $x 
# or in a pipeline:
@list |> map nthp |> p

# nub

nub — haskell list functions builtin.

my $result = nub $x 
# or in a pipeline:
@list |> map nub |> p

# nub_by

nub_by — additional missing stdlib functions builtin.

my $result = nub_by $x 
# or in a pipeline:
@list |> map nub_by |> p

# nubb

nubb — additional missing stdlib functions builtin. Alias for nub_by.

my $result = nubb $x 
# or in a pipeline:
@list |> map nubb |> p

# nuclear_magneton

nuclear_magneton — physics constants builtin.

my $result = nuclear_magneton $x 
# or in a pipeline:
@list |> map nuclear_magneton |> p

# num_cpus

num_cpus — system introspection builtin.

my $result = num_cpus $x 
# or in a pipeline:
@list |> map num_cpus |> p

# num_divisors

num_divisors — math / numeric (uncategorized batch) builtin.

my $result = num_divisors $x 
# or in a pipeline:
@list |> map num_divisors |> p

# numeric_count

numeric_count — counters (batch 4) builtin.

my $result = numeric_count $x 
# or in a pipeline:
@list |> map numeric_count |> p

# nxtp

nxtp — number theory / primes builtin. Alias for next_prime.

my $result = nxtp $x 
# or in a pipeline:
@list |> map nxtp |> p

# nxtperm

nxtperm — matrix operations (uncategorized batch) builtin. Alias for next_permutation.

my $result = nxtperm $x 
# or in a pipeline:
@list |> map nxtperm |> p

# object_entries

object_entries — javascript array/object methods builtin.

my $result = object_entries $x 
# or in a pipeline:
@list |> map object_entries |> p

# object_from_entries

object_from_entries — javascript array/object methods builtin.

my $result = object_from_entries $x 
# or in a pipeline:
@list |> map object_from_entries |> p

# object_keys

object_keys — javascript array/object methods builtin.

my $result = object_keys $x 
# or in a pipeline:
@list |> map object_keys |> p

# object_values

object_values — javascript array/object methods builtin.

my $result = object_values $x 
# or in a pipeline:
@list |> map object_values |> p

# oct_of

oct_of — base conversion builtin. Alias for to_oct.

my $result = oct_of $x 
# or in a pipeline:
@list |> map oct_of |> p

# odd

odd — trivial numeric / predicate builtins builtin.

my $result = odd $x 
# or in a pipeline:
@list |> map odd |> p

# oents

oents — javascript array/object methods builtin. Alias for object_entries.

my $result = oents $x 
# or in a pipeline:
@list |> map oents |> p

# ofents

ofents — javascript array/object methods builtin. Alias for object_from_entries.

my $result = ofents $x 
# or in a pipeline:
@list |> map ofents |> p

# off

off — color / ansi builtin. Alias for red.

my $result = off $x 
# or in a pipeline:
@list |> map off |> p

# offset_each

offset_each — trivial numeric helpers (batch 4) builtin.

my $result = offset_each $x 
# or in a pipeline:
@list |> map offset_each |> p

# ohms_law_i

ohms_law_i — physics formulas builtin.

my $result = ohms_law_i $x 
# or in a pipeline:
@list |> map ohms_law_i |> p

# ohms_law_r

ohms_law_r — physics formulas builtin.

my $result = ohms_law_r $x 
# or in a pipeline:
@list |> map ohms_law_r |> p

# ohms_law_v

ohms_law_v — physics formulas builtin.

my $result = ohms_law_v $x 
# or in a pipeline:
@list |> map ohms_law_v |> p

# okeys

okeys — javascript array/object methods builtin. Alias for object_keys.

my $result = okeys $x 
# or in a pipeline:
@list |> map okeys |> p

# omit

omit — hash ops (batch 2) builtin. Alias for omit_keys.

my $result = omit $x 
# or in a pipeline:
@list |> map omit |> p

# omit_keys

omit_keys — hash ops (batch 2) builtin.

my $result = omit_keys $x 
# or in a pipeline:
@list |> map omit_keys |> p

# one

one — python/ruby stdlib builtin.

my $result = one $x 
# or in a pipeline:
@list |> map one |> p

# ones

ones — matrix / linear algebra builtin.

my $result = ones $x 
# or in a pipeline:
@list |> map ones |> p

# ones_mat

ones_mat — matrix / linear algebra builtin. Alias for ones_matrix.

my $result = ones_mat $x 
# or in a pipeline:
@list |> map ones_mat |> p

# ones_matrix

ones_matrix — matrix / linear algebra builtin.

my $result = ones_matrix $x 
# or in a pipeline:
@list |> map ones_matrix |> p

# only_alnum

only_alnum — string helpers (batch 4) builtin.

my $result = only_alnum $x 
# or in a pipeline:
@list |> map only_alnum |> p

# only_alpha

only_alpha — string helpers (batch 4) builtin.

my $result = only_alpha $x 
# or in a pipeline:
@list |> map only_alpha |> p

# only_ascii

only_ascii — string helpers (batch 4) builtin.

my $result = only_ascii $x 
# or in a pipeline:
@list |> map only_ascii |> p

# only_digits

only_digits — string helpers (batch 4) builtin.

my $result = only_digits $x 
# or in a pipeline:
@list |> map only_digits |> p

# or

or — control flow builtin.

my $result = or $x 
# or in a pipeline:
@list |> map or |> p

# or_list

or_list — additional missing stdlib functions builtin.

my $result = or_list $x 
# or in a pipeline:
@list |> map or_list |> p

# orbital_period

orbital_period($mass, $radius) (alias orbper) — period for circular orbit: T = 2π√(r³/GM). Returns seconds.

my $t = orbper       # ~5560 s (ISS orbital period)
p $t / 60            # ~93 minutes

# orbital_velocity

orbital_velocity($mass, $radius) (alias orbvel) — velocity for circular orbit: v = √(GM/r). Defaults to LEO around Earth.

p orbvel    # ~7672 m/s (ISS orbital speed)

# ordered_set

ordered_set — data structure helpers builtin.

my $result = ordered_set $x 
# or in a pipeline:
@list |> map ordered_set |> p

# ordinalize

ordinalize — extended stdlib builtin.

my $result = ordinalize $x 
# or in a pipeline:
@list |> map ordinalize |> p

# ordn

ordn — extended stdlib builtin. Alias for ordinalize.

my $result = ordn $x 
# or in a pipeline:
@list |> map ordn |> p

# orl

orl — additional missing stdlib functions builtin. Alias for or_list.

my $result = orl $x 
# or in a pipeline:
@list |> map orl |> p

# os_arch

os_arch — system introspection builtin.

my $result = os_arch $x 
# or in a pipeline:
@list |> map os_arch |> p

# os_family

os_family — OS family string: "unix" or "windows". From std::env::consts::FAMILY.

p os_family                              # unix
die "unix only" unless os_family eq "unix"

# os_name

os_name — system introspection builtin.

my $result = os_name $x 
# or in a pipeline:
@list |> map os_name |> p

# os_version

os_version — OS kernel version/release string from uname. Returns undef on non-unix.

p os_version                             # 25.4.0
p "kernel: " . os_version

# outer

outer — outer product of two vectors. Returns matrix where M[i][j] = v1[i] * v2[j].

my $m = outer([1,2,3], [10,20])  # [[10,20],[20,40],[30,60]]

# outliers

outliers — statistics (extended) builtin. Alias for outliers_iqr.

my $result = outliers $x 
# or in a pipeline:
@list |> map outliers |> p

# outliers_iqr

outliers_iqr(@data) — identifies outliers using the IQR method (1.5 × IQR beyond Q1/Q3). Returns an arrayref of outlier values. Standard approach for detecting unusual data points.

my @data = (1, 2, 3, 4, 5, 100)
my $out = outliers_iqr(@data)
p @$out   # (100)

# ovals

ovals — javascript array/object methods builtin. Alias for object_values.

my $result = ovals $x 
# or in a pipeline:
@list |> map ovals |> p

# overlap_coefficient

overlap_coefficient — extended stdlib batch 3 builtin.

my $result = overlap_coefficient $x 
# or in a pipeline:
@list |> map overlap_coefficient |> p

# overlapcoef

overlapcoef — extended stdlib batch 3 builtin. Alias for overlap_coefficient.

my $result = overlapcoef $x 
# or in a pipeline:
@list |> map overlapcoef |> p

# overline

overline — color / ansi builtin. Alias for red.

my $result = overline $x 
# or in a pipeline:
@list |> map overline |> p

# oz_to_g

oz_to_g — unit conversions builtin.

my $result = oz_to_g $input 

# pacf

pacf_fn (alias pacf) — partial autocorrelation function via Durbin-Levinson. Like R's pacf().

my @pa = @{pacf([1,3,2,4,3,5], 3)}

# pad_left

pad_left — trivial string ops builtin.

my $result = pad_left $x 
# or in a pipeline:
@list |> map pad_left |> p

# pad_number

pad_number — file stat / path builtin.

my $result = pad_number $x 
# or in a pipeline:
@list |> map pad_number |> p

# pad_right

pad_right — trivial string ops builtin.

my $result = pad_right $x 
# or in a pipeline:
@list |> map pad_right |> p

# page_size

page_size — memory page size in bytes. Uses sysconf(_SC_PAGESIZE) on unix.

p page_size                              # 16384 (Apple Silicon)
p page_size                              # 4096 (x86_64)

# paired_ttest

paired_ttest (alias pairedt) performs a paired t-test on two matched samples. Returns [t-statistic, degrees of freedom].

my ($t, $df) = @{pairedt([85,90,78], [88,92,80])}

# pairs_from_hash

pairs_from_hash — hash ops (batch 2) builtin.

my $result = pairs_from_hash $x 
# or in a pipeline:
@list |> map pairs_from_hash |> p

# pairwise

pairwise — file stat / path builtin.

my $result = pairwise $x 
# or in a pipeline:
@list |> map pairwise |> p

# pairwise_iter

pairwise_iter — python/ruby stdlib builtin.

my $result = pairwise_iter $x 
# or in a pipeline:
@list |> map pairwise_iter |> p

# pall

pall — algebraic match builtin. Alias for partition_all.

my $result = pall $x 
# or in a pipeline:
@list |> map pall |> p

# parenthesize

parenthesize — string helpers (batch 4) builtin.

my $result = parenthesize $x 
# or in a pipeline:
@list |> map parenthesize |> p

# pareto_pdf

pareto_pdf (alias paretopdf) evaluates the Pareto distribution PDF at x with minimum xm and shape alpha.

p paretopdf(2, 1, 3)  # Pareto(1,3) at x=2

# parse_bool

parse_bool — extended stdlib builtin.

my $result = parse_bool $x 
# or in a pipeline:
@list |> map parse_bool |> p

# parse_float

parse_float — extended stdlib builtin.

my $result = parse_float $x 
# or in a pipeline:
@list |> map parse_float |> p

# parse_int

parse_int — extended stdlib builtin.

my $result = parse_int $x 
# or in a pipeline:
@list |> map parse_int |> p

# parsec

parsec (alias pc) — pc ≈ 3.086×10¹⁶ m ≈ 3.26 ly. Common astronomical distance unit.

p pc        # 3.0856775814913673e16 m
p pc / ly   # ~3.26 light years

# partition_all

partition_all — algebraic match builtin.

my $result = partition_all $x 
# or in a pipeline:
@list |> map partition_all |> p

# partition_by

partition_by — algebraic match builtin.

my $result = partition_by $x 
# or in a pipeline:
@list |> map partition_by |> p

# partition_either

partition_either — rust iterator methods builtin.

my $result = partition_either $x 
# or in a pipeline:
@list |> map partition_either |> p

# partition_n

partition_n — go/general functional utilities builtin.

my $result = partition_n $x 
# or in a pipeline:
@list |> map partition_n |> p

# partition_number

partition_number — math / numeric (uncategorized batch) builtin.

my $result = partition_number $x 
# or in a pipeline:
@list |> map partition_number |> p

# partition_point

partition_point — extended stdlib builtin.

my $result = partition_point $x 
# or in a pipeline:
@list |> map partition_point |> p

# partition_two

partition_two — list helpers (batch 4) builtin.

my $result = partition_two $x 
# or in a pipeline:
@list |> map partition_two |> p

# partn

partn — go/general functional utilities builtin. Alias for partition_n.

my $result = partn $x 
# or in a pipeline:
@list |> map partn |> p

# partn_num

partn_num — math / numeric (uncategorized batch) builtin. Alias for partition_number.

my $result = partn_num $x 
# or in a pipeline:
@list |> map partn_num |> p

# pascal_case

pascal_case — string (batch 2) builtin.

my $result = pascal_case $x 
# or in a pipeline:
@list |> map pascal_case |> p

# pascal_row

pascal_row — extended stdlib batch 3 builtin.

my $result = pascal_row $x 
# or in a pipeline:
@list |> map pascal_row |> p

# pascals_to_bar

pascals_to_bar — file stat / path builtin.

my $result = pascals_to_bar $input 

# pascals_to_psi

pascals_to_psi — file stat / path builtin.

my $result = pascals_to_psi $input 

# pascals_triangle

pascals_triangle — math / numeric (uncategorized batch) builtin.

my $result = pascals_triangle $x 
# or in a pipeline:
@list |> map pascals_triangle |> p

# pascrow

pascrow — extended stdlib batch 3 builtin. Alias for pascal_row.

my $result = pascrow $x 
# or in a pipeline:
@list |> map pascrow |> p

# pasctri

pasctri — math / numeric (uncategorized batch) builtin. Alias for pascals_triangle.

my $result = pasctri $x 
# or in a pipeline:
@list |> map pasctri |> p

# pass

pass — conversion / utility (batch 4) builtin.

my $result = pass $x 
# or in a pipeline:
@list |> map pass |> p

# path_case

path_case — string (batch 2) builtin.

my $result = path_case $x 
# or in a pipeline:
@list |> map path_case |> p

# path_ext

path_ext — path helpers builtin.

my $result = path_ext $x 
# or in a pipeline:
@list |> map path_ext |> p

# path_is_abs

path_is_abs — file stat / path builtin.

my $result = path_is_abs $x 
# or in a pipeline:
@list |> map path_is_abs |> p

# path_is_rel

path_is_rel — file stat / path builtin.

my $result = path_is_rel $x 
# or in a pipeline:
@list |> map path_is_rel |> p

# path_join

path_join — path helpers builtin.

my $result = path_join $x 
# or in a pipeline:
@list |> map path_join |> p

# path_parent

path_parent — path helpers builtin.

my $result = path_parent $x 
# or in a pipeline:
@list |> map path_parent |> p

# path_split

path_split — path helpers builtin.

my $result = path_split $x 
# or in a pipeline:
@list |> map path_split |> p

# path_stem

path_stem — path helpers builtin.

my $result = path_stem $x 
# or in a pipeline:
@list |> map path_stem |> p

# payback

payback_period($initial, @cashflows) (alias payback) — computes the number of periods to recover initial investment. Returns fractional periods.

p payback(1000, 300, 400, 500)   # 2.6 periods

# pbeta

pbeta — beta CDF (regularized incomplete beta). Args: x, a, b.

p pbeta(0.5, 2, 5)  # P(X ≤ 0.5) for Beta(2,5)

# pbinom

pbinom — binomial CDF. P(X ≤ k) for Binom(n, p). Args: k, n, p.

p pbinom(5, 10, 0.5)   # P(≤5 heads in 10 flips)

# pbool

pbool — extended stdlib builtin. Alias for parse_bool.

my $result = pbool $x 
# or in a pipeline:
@list |> map pbool |> p

# pby

pby — algebraic match builtin. Alias for partition_by.

my $result = pby $x 
# or in a pipeline:
@list |> map pby |> p

# pc_case

pc_case — string (batch 2) builtin. Alias for pascal_case.

my $result = pc_case $x 
# or in a pipeline:
@list |> map pc_case |> p

# pca

prcomp (alias pca) — Principal Component Analysis via eigendecomposition of covariance matrix. Returns eigenvalues (variance explained). Like R's prcomp().

my @var = @{pca([[1,2],[3,4],[5,6],[7,8]])}
# variance explained by each component

# pcauchy

pcauchy — Cauchy CDF. P(X ≤ x). Args: x [, location, scale].

p pcauchy(0, 0, 1)  # 0.5

# pchisq

pchisq — chi-squared CDF. Args: x, df.

p pchisq(3.84, 1)  # 0.95 (critical value for p=0.05)

# pcr

pcr — data / network builtin. Alias for par_csv_read.

my $result = pcr $x 
# or in a pipeline:
@list |> map pcr |> p

# pct

pct — trivial numeric / predicate builtins builtin. Alias for percent.

my $result = pct $x 
# or in a pipeline:
@list |> map pct |> p

# pctrank

pctrank — statistics (extended) builtin. Alias for percentile_rank.

my $result = pctrank $x 
# or in a pipeline:
@list |> map pctrank |> p

# peak_detect

peak_detect — matrix operations (uncategorized batch) builtin.

my $result = peak_detect $x 
# or in a pipeline:
@list |> map peak_detect |> p

# peaks

peaks — matrix operations (uncategorized batch) builtin. Alias for peak_detect.

my $result = peaks $x 
# or in a pipeline:
@list |> map peaks |> p

# peek_clj

peek_clj — algebraic match builtin.

my $result = peek_clj $x 
# or in a pipeline:
@list |> map peek_clj |> p

# peith

peith — rust iterator methods builtin. Alias for partition_either.

my $result = peith $x 
# or in a pipeline:
@list |> map peith |> p

# pendper

pendulum_period($length) (alias pendper) — period T = 2π√(L/g) of a simple pendulum.

p pendper(1)      # ~2.01 s (1 meter pendulum)
p pendper(0.25)   # ~1.00 s (grandfather clock)

# pentagonal_number

pentagonal_number — number theory / primes builtin.

my $result = pentagonal_number $x 
# or in a pipeline:
@list |> map pentagonal_number |> p

# pentnum

pentnum — number theory / primes builtin. Alias for pentagonal_number.

my $result = pentnum $x 
# or in a pipeline:
@list |> map pentnum |> p

# percent

percent — trivial numeric / predicate builtins builtin.

my $result = percent $x 
# or in a pipeline:
@list |> map percent |> p

# percentile

percentile — file stat / path builtin.

my $result = percentile $x 
# or in a pipeline:
@list |> map percentile |> p

# percentile_rank

percentile_rank($value, @data) — returns the percentile rank (0-100) of a value within a dataset. Indicates what percentage of the data falls below the given value. Useful for ranking and normalization.

my @scores = 1:100
p percentile_rank(50, @scores)   # ~50
p percentile_rank(90, @scores)   # ~90

# perfect_numbers

perfect_numbers — number theory / primes builtin.

my $result = perfect_numbers $x 
# or in a pipeline:
@list |> map perfect_numbers |> p

# perfnums

perfnums — number theory / primes builtin. Alias for perfect_numbers.

my $result = perfnums $x 
# or in a pipeline:
@list |> map perfnums |> p

# perimeter_rectangle

perimeter_rectangle — geometry / physics builtin.

my $result = perimeter_rectangle $x 
# or in a pipeline:
@list |> map perimeter_rectangle |> p

# perimeter_triangle

perimeter_triangle — geometry / physics builtin.

my $result = perimeter_triangle $x 
# or in a pipeline:
@list |> map perimeter_triangle |> p

# perm

permutations($n, $r) (alias perm) — number of ways to arrange r items from n. Formula: n!/(n-r)!. Order matters.

p perm(5, 3)    # 60 (ways to arrange 3 items from 5)
p perm(10, 2)   # 90

# pexp

pexp — exponential CDF. P(X ≤ x) for Exp(rate). Args: x, rate.

p pexp(1, 1)     # 0.6321 (1 - e^-1)
p pexp(5, 0.5)   # P(wait ≤ 5 with avg wait 2)

# pf

pf — F-distribution CDF. Args: x, d1, d2.

p pf(4.0, 5, 10)  # P(F ≤ 4) for F(5,10)

# pfact

pfact — number theory / primes builtin. Alias for prime_factors.

my $result = pfact $x 
# or in a pipeline:
@list |> map pfact |> p

# pflt

pflt — extended stdlib builtin. Alias for parse_float.

my $result = pflt $x 
# or in a pipeline:
@list |> map pflt |> p

# pft

pft — data / network builtin. Alias for par_fetch.

my $result = pft $x 
# or in a pipeline:
@list |> map pft |> p

# pgamma

pgamma — gamma CDF. Args: x, shape [, scale].

p pgamma(2, 2, 1)  # P(X ≤ 2) for Gamma(2,1)

# phase_spectrum

phase_spectrum(\@signal) — computes the phase angle (in radians) at each frequency bin from the DFT.

my $phases = phase_spectrum(\@signal)

# phasespec

phasespec — dsp / signal (extended) builtin. Alias for phase_spectrum.

my $result = phasespec $x 
# or in a pipeline:
@list |> map phasespec |> p

# phonedigit

phonedigit — encoding / phonetics builtin. Alias for phonetic_digit.

my $result = phonedigit $x 
# or in a pipeline:
@list |> map phonedigit |> p

# phonetic_digit

phonetic_digit — encoding / phonetics builtin.

my $result = phonetic_digit $x 
# or in a pipeline:
@list |> map phonetic_digit |> p

# photon_energy

photon_energy($frequency) (alias photonenergy) — energy E = hf (Joules) of a photon.

p photonenergy(5e14)   # ~3.3e-19 J (visible light)

# photon_energy_wavelength

photon_energy_wavelength — physics formulas builtin.

my $result = photon_energy_wavelength $x 
# or in a pipeline:
@list |> map photon_energy_wavelength |> p

# photonlambda

photonlambda — physics formulas builtin. Alias for photon_energy_wavelength.

my $result = photonlambda $x 
# or in a pipeline:
@list |> map photonlambda |> p

# pi

pi — constants builtin.

my $result = pi $x 
# or in a pipeline:
@list |> map pi |> p

# pick

pick — hash ops (batch 2) builtin. Alias for pick_keys.

my $result = pick $x 
# or in a pipeline:
@list |> map pick |> p

# pick_keys

pick_keys — hash ops (batch 2) builtin.

my $result = pick_keys $x 
# or in a pipeline:
@list |> map pick_keys |> p

# pid

pid — system introspection builtin.

my $result = pid $x 
# or in a pipeline:
@list |> map pid |> p

# pig_latin

pig_latin — string processing (uncategorized batch) builtin.

my $result = pig_latin $x 
# or in a pipeline:
@list |> map pig_latin |> p

# piglat

piglat — string processing (uncategorized batch) builtin. Alias for pig_latin.

my $result = piglat $x 
# or in a pipeline:
@list |> map piglat |> p

# pint

pint — extended stdlib builtin. Alias for parse_int.

my $result = pint $x 
# or in a pipeline:
@list |> map pint |> p

# pipe

Create a unidirectional pipe, returning a pair of connected filehandles: one for reading and one for writing. Data written to the write end can be read from the read end, making pipes the fundamental building block for inter-process communication. Commonly used with fork so the parent and child can exchange data.

pipe(my $rd, my $wr) or die "pipe: $!"
if (fork() == 0) {
    close($rd)
    print $wr "hello from child\n"
    exit(0)
}
close($wr)
my $msg = <$rd>
p $msg   # hello from child

# pipes

pipes — filesystem extensions builtin.

my $result = pipes $x 
# or in a pipeline:
@list |> map pipes |> p

# pkc

pkc — algebraic match builtin. Alias for peek_clj.

my $result = pkc $x 
# or in a pipeline:
@list |> map pkc |> p

# planck

planck — math / physics constants builtin.

my $result = planck $x 
# or in a pipeline:
@list |> map planck |> p

# planck_constant

planck_constant — constants builtin.

my $result = planck_constant $x 
# or in a pipeline:
@list |> map planck_constant |> p

# planck_mass

planck_mass — physics constants builtin.

my $result = planck_mass $x 
# or in a pipeline:
@list |> map planck_mass |> p

# planck_temperature

planck_temperature — physics constants builtin.

my $result = planck_temperature $x 
# or in a pipeline:
@list |> map planck_temperature |> p

# planck_time

planck_time — physics constants builtin.

my $result = planck_time $x 
# or in a pipeline:
@list |> map planck_time |> p

# plastic

plastic — math constants builtin. Alias for plastic_number.

my $result = plastic $x 
# or in a pipeline:
@list |> map plastic |> p

# plastic_number

plastic_number — math constants builtin.

my $result = plastic_number $x 
# or in a pipeline:
@list |> map plastic_number |> p

# plnorm

plnorm — log-normal CDF. P(X ≤ x) for LogN(mu, sigma). Args: x, mu, sigma.

p plnorm(1, 0, 1)   # 0.5 (median of LogN(0,1))

# plur

plur — extended stdlib builtin. Alias for pluralize.

my $result = plur $x 
# or in a pipeline:
@list |> map plur |> p

# pluralize

pluralize — extended stdlib builtin.

my $result = pluralize $x 
# or in a pipeline:
@list |> map pluralize |> p

# pmass

pmass — constants builtin. Alias for proton_mass.

my $result = pmass $x 
# or in a pipeline:
@list |> map pmass |> p

# pmt

pmt($rate, $nper, $pv) — computes the periodic payment for a loan given interest rate, number of periods, and present value. Standard amortization formula.

# $100k loan, 5% annual rate, 30 years
p pmt(0.05/12, 360, 100000)   # ~$537/month

# pnorm

pnorm — normal CDF. P(X ≤ x) for N(mu, sigma). Args: x [, mu, sigma]. Default standard normal.

p pnorm(0)          # 0.5
p pnorm(1.96)       # 0.975
p pnorm(100, 90, 15) # z-score for IQ 100

# point_distance

point_distance — geometry / physics builtin.

my $result = point_distance $x 
# or in a pipeline:
@list |> map point_distance |> p

# point_in_polygon

point_in_polygon($x, $y, @polygon) (alias pip) — tests if a point lies inside a polygon. Polygon is given as flat list [x1,y1,x2,y2,...]. Returns 1 if inside, 0 if outside. Uses ray-casting algorithm.

my @square = (0,0, 4,0, 4,4, 0,4)
p pip(2, 2, @square)   # 1 (inside)
p pip(5, 5, @square)   # 0 (outside)

# pointer_width

pointer_width — pointer width in bits: 32 or 64. Compile-time constant.

p pointer_width                          # 64

# poisson

poisson_pmf($k, $lambda) (alias poisson) — Poisson probability mass function. P(X=k) for events with rate λ.

p poisson(3, 5)   # P(X=3) when avg rate is 5

# poly_eval

poly_eval (alias polyval) evaluates a polynomial c0 + c1·x + c2·x² + ... using Horner's method.

p polyval([1, 0, 1], 3)  # 1 + 0*3 + 1*9 = 10

# polyarea

polyarea — geometry / physics builtin. Alias for polygon_area.

my $result = polyarea $x 
# or in a pipeline:
@list |> map polyarea |> p

# polyfit

polynomial_fit (alias polyfit) performs least-squares polynomial fitting. Returns coefficients [c0, c1, ..., cn].

my $c = polyfit([0,1,2,3], [1,3,5,7], 1)  # linear fit

# polygon_area

polygon_area — geometry / physics builtin.

my $result = polygon_area $x 
# or in a pipeline:
@list |> map polygon_area |> p

# polygon_perimeter

polygon_perimeter(@points) (alias polyper) — computes the perimeter of a polygon. Points as flat list [x1,y1,x2,y2,...]. Assumes closed polygon.

my @square = (0,0, 1,0, 1,1, 0,1)
p polyper(@square)   # 4

# polyperim

polyperim — geometry (extended) builtin. Alias for polygon_perimeter.

my $result = polyperim $x 
# or in a pipeline:
@list |> map polyperim |> p

# pop_clj

pop_clj — algebraic match builtin.

my $result = pop_clj $x 
# or in a pipeline:
@list |> map pop_clj |> p

# popc

popc — algebraic match builtin. Alias for pop_clj.

my $result = popc $x 
# or in a pipeline:
@list |> map popc |> p

# popcount

popcount — base conversion builtin. Alias for bits_count.

my $result = popcount $x 
# or in a pipeline:
@list |> map popcount |> p

# pos_n

pos_n — trivial numeric / predicate builtins builtin. Alias for positive.

my $result = pos_n $x 
# or in a pipeline:
@list |> map pos_n |> p

# positions_of

positions_of — collection (batch 2) builtin.

my $result = positions_of $x 
# or in a pipeline:
@list |> map positions_of |> p

# positive

positive — trivial numeric / predicate builtins builtin.

my $result = positive $x 
# or in a pipeline:
@list |> map positive |> p

# potential_energy

potential_energy — physics formulas builtin.

my $result = potential_energy $x 
# or in a pipeline:
@list |> map potential_energy |> p

# pow2

pow2 — trivial numeric / predicate builtins builtin.

my $result = pow2 $x 
# or in a pipeline:
@list |> map pow2 |> p

# power_phys

power_phys — physics formulas builtin.

my $result = power_phys $x 
# or in a pipeline:
@list |> map power_phys |> p

# power_set

power_set — extended stdlib batch 3 builtin.

my $result = power_set $x 
# or in a pipeline:
@list |> map power_set |> p

# power_spectrum

power_spectrum(\@signal) (alias psd) — computes the power spectral density (magnitude squared of DFT). Returns real values representing power at each frequency bin.

my $psd = psd(\@signal)
@$psd |> e p

# powers_of_seq

powers_of_seq — sequences builtin.

my $result = powers_of_seq $x 
# or in a pipeline:
@list |> map powers_of_seq |> p

# powerset

powerset — extended stdlib batch 3 builtin. Alias for power_set.

my $result = powerset $x 
# or in a pipeline:
@list |> map powerset |> p

# powspec

powspec — dsp / signal (extended) builtin. Alias for power_spectrum.

my $result = powspec $x 
# or in a pipeline:
@list |> map powspec |> p

# ppi

ppi — number theory / primes builtin. Alias for prime_pi.

my $result = ppi $x 
# or in a pipeline:
@list |> map ppi |> p

# ppid

ppid — system introspection builtin.

my $result = ppid $x 
# or in a pipeline:
@list |> map ppid |> p

# ppois

ppois — Poisson CDF. P(X ≤ k) for Poisson(lambda). Args: k, lambda.

p ppois(3, 2.5)  # P(≤3 events when avg is 2.5)

# ppt

ppt — extended stdlib builtin. Alias for partition_point.

my $result = ppt $x 
# or in a pipeline:
@list |> map ppt |> p

# prect

prect — geometry / physics builtin. Alias for perimeter_rectangle.

my $result = prect $x 
# or in a pipeline:
@list |> map prect |> p

# pred

pred — conversion / utility (batch 4) builtin.

my $result = pred $x 
# or in a pipeline:
@list |> map pred |> p

# predict

predict_lm (alias predict) — predict from a linear model at new x values.

my $model = lm([1,2,3], [2,4,6])
my @pred = @{predict($model, [4,5,6])}  # [8,10,12]

# prefix_sums

prefix_sums — list helpers (batch 4) builtin.

my $result = prefix_sums $x 
# or in a pipeline:
@list |> map prefix_sums |> p

# prepend

prepend — list helpers (batch 4) builtin.

my $result = prepend $x 
# or in a pipeline:
@list |> map prepend |> p

# present_value

present_value — physics formulas builtin.

my $result = present_value $x 
# or in a pipeline:
@list |> map present_value |> p

# prev_prime

prev_prime — number theory / primes builtin.

my $result = prev_prime $x 
# or in a pipeline:
@list |> map prev_prime |> p

# prime_factors

prime_factors — number theory / primes builtin.

my $result = prime_factors $x 
# or in a pipeline:
@list |> map prime_factors |> p

# prime_pi

prime_pi — number theory / primes builtin.

my $result = prime_pi $x 
# or in a pipeline:
@list |> map prime_pi |> p

# primes_seq

primes_seq — sequences builtin.

my $result = primes_seq $x 
# or in a pipeline:
@list |> map primes_seq |> p

# primes_up_to

primes_up_to — number theory / primes builtin.

my $result = primes_up_to $x 
# or in a pipeline:
@list |> map primes_up_to |> p

# proc_mem

proc_mem (alias rss) — current process resident set size (RSS) in bytes. On Linux reads VmRSS from /proc/self/status. On macOS uses getrusage(RUSAGE_SELF). Returns undef on unsupported platforms.

p format_bytes(rss)                      # 18.5 MiB
my $before = rss
do_work()
p format_bytes(rss - $before) . " allocated"

# product_list

product_list — list helpers (batch 4) builtin.

my $result = product_list $x 
# or in a pipeline:
@list |> map product_list |> p

# product_of

product_of — more list helpers builtin.

my $result = product_of $x 
# or in a pipeline:
@list |> map product_of |> p

# projectile_max_height

projectile_max_height($velocity, $angle) (alias projheight) — maximum height H = v²sin²(θ)/(2g).

p projheight(100, 45)   # ~255 m
p projheight(100, 90)   # ~510 m (straight up)

# projectile_range

projectile_range($velocity, $angle) (alias projrange) — horizontal range R = v²sin(2θ)/g. Angle in degrees.

p projrange(100, 45)   # ~1020 m (optimal angle for range)
p projrange(100, 30)   # ~884 m

# projectile_time

projectile_time — physics formulas builtin.

my $result = projectile_time $x 
# or in a pipeline:
@list |> map projectile_time |> p

# projtime

projtime — physics formulas builtin. Alias for projectile_time.

my $result = projtime $x 
# or in a pipeline:
@list |> map projtime |> p

# prop_table

prop_table — convert a count matrix to proportions (each cell / total). Like R's prop.table().

p prop_table([[10,20],[30,40]])  # [[0.1,0.2],[0.3,0.4]]

# prop_test

prop_test — one-sample proportion z-test. Returns [z-statistic, p-value]. Like R's prop.test().

my ($z, $pval) = @{proptest(55, 100, 0.5)}  # test if 55/100 differs from 50%%

# proton_mass

proton_mass — constants builtin.

my $result = proton_mass $x 
# or in a pipeline:
@list |> map proton_mass |> p

# prvp

prvp — number theory / primes builtin. Alias for prev_prime.

my $result = prvp $x 
# or in a pipeline:
@list |> map prvp |> p

# psi_to_pascals

psi_to_pascals — file stat / path builtin.

my $result = psi_to_pascals $input 

# pt

pt — Student's t CDF. Args: x, df.

p pt(1.96, 100)  # ≈ 0.975

# ptdist

ptdist — geometry / physics builtin. Alias for point_distance.

my $result = ptdist $x 
# or in a pipeline:
@list |> map ptdist |> p

# ptinpoly

ptinpoly — geometry (extended) builtin. Alias for point_in_polygon.

my $result = ptinpoly $x 
# or in a pipeline:
@list |> map ptinpoly |> p

# ptri

ptri — geometry / physics builtin. Alias for perimeter_triangle.

my $result = ptri $x 
# or in a pipeline:
@list |> map ptri |> p

# punct

punctuation (alias punct) extracts all ASCII punctuation characters from a string and returns them as a list. Filters out letters, digits, whitespace — keeps only punctuation.

p join "", punctuation("Hello, world!")  # ,!
"a.b-c" |> punct |> cnt |> p             # 2

# punif

punif — uniform CDF. P(X ≤ x) for Uniform(a, b). Args: x, a, b.

p punif(0.5, 0, 1)  # 0.5
p punif(3, 0, 10)   # 0.3

# purple

purple — color / ansi builtin. Alias for red.

my $result = purple $x 
# or in a pipeline:
@list |> map purple |> p

# pv

pv — finance (extended) builtin.

my $result = pv $x 
# or in a pipeline:
@list |> map pv |> p

# pwd_str

pwd_str — more process / system builtin. Alias for cwd.

my $result = pwd_str $x 
# or in a pipeline:
@list |> map pwd_str |> p

# pweibull

pweibull — Weibull CDF. P(X ≤ x) for Weibull(shape, scale). Args: x, shape, scale.

p pweibull(1, 1, 1)  # same as exponential

# pwi

pwi — python/ruby stdlib builtin. Alias for pairwise_iter.

my $result = pwi $x 
# or in a pipeline:
@list |> map pwi |> p

# pyramid_volume

pyramid_volume($base_area, $height) — computes the volume of a pyramid. Returns (1/3) * base_area * height.

p pyramid_volume(100, 15)   # 500

# pyrvol

pyrvol — geometry (extended) builtin. Alias for pyramid_volume.

my $result = pyrvol $x 
# or in a pipeline:
@list |> map pyrvol |> p

# q

q — quoting builtin.

my $result = q $x 
# or in a pipeline:
@list |> map q |> p

# qbeta

qbeta — beta quantile. Args: p, alpha, beta.

p qbeta(0.5, 2, 5)  # median of Beta(2,5)

# qbinom

qbinom — binomial quantile (smallest k where P(X≤k) ≥ p). Args: p, n, prob.

p qbinom(0.5, 10, 0.5)  # median of Binom(10, 0.5) = 5

# qcauchy

qcauchy — Cauchy quantile. Args: p [, location, scale].

p qcauchy(0.75, 0, 1)  # 1.0

# qchisq

qchisq — chi-squared quantile. Args: p, df.

p qchisq(0.95, 1)  # 3.84 (critical value)
p qchisq(0.95, 5)  # 11.07

# qdisc

quadratic_discriminant($a, $b, $c) (alias qdisc) — computes b² - 4ac. Positive = two real roots, zero = one repeated root, negative = complex roots.

p qdisc(1, -5, 6)   # 1 (two distinct real roots)
p qdisc(1, 2, 1)    # 0 (one repeated root)
p qdisc(1, 2, 5)    # -16 (complex roots)

# qexp

qexp — exponential quantile. Args: p [, rate].

p qexp(0.5, 1)       # 0.693 (median of Exp(1))

# qf

qf — F-distribution quantile. Args: p, d1, d2.

p qf(0.95, 5, 10)  # critical F value

# qgamma

qgamma — gamma quantile (inverse CDF). Args: p, shape [, scale].

p qgamma(0.95, 2, 1)  # 95th percentile of Gamma(2,1)

# qlnorm

qlnorm — log-normal quantile. Args: p [, mu, sigma].

p qlnorm(0.5, 0, 1)  # 1.0 (median of LogN(0,1))

# qm

qm — string builtin. Alias for quotemeta.

my $result = qm $x 
# or in a pipeline:
@list |> map qm |> p

# qnorm

qnorm — normal quantile (inverse CDF). Returns x such that P(X ≤ x) = p. Args: p [, mu, sigma].

p qnorm(0.975)      # 1.96
p qnorm(0.5)        # 0.0
p qnorm(0.95, 100, 15)  # 90th percentile IQ

# qntl

qntl — extended stdlib builtin. Alias for quantile.

my $result = qntl $x 
# or in a pipeline:
@list |> map qntl |> p

# qpois

qpois — Poisson quantile (smallest k where P(X≤k) ≥ p). Args: p, lambda.

p qpois(0.5, 5)  # median of Poisson(5)

# qq

qq — quoting builtin.

my $result = qq $x 
# or in a pipeline:
@list |> map qq |> p

# qroots

quadratic_roots($a, $b, $c) (alias qroots) — solves ax² + bx + c = 0. Returns [x1, x2] for real roots, undef if no real solutions (discriminant < 0).

my @roots = quadratic_roots(1, -5, 6)  # [3, 2] (x² - 5x + 6 = 0)
p qroots(1, 0, -4)                      # [2, -2]
p qroots(1, 2, 5)                       # undef (complex roots)

# qt

qt — Student's t quantile. Args: p, df.

p qt(0.975, 10)   # ≈ 2.228 (two-tailed 5%)

# quantile

quantile — extended stdlib builtin.

my $result = quantile $x 
# or in a pipeline:
@list |> map quantile |> p

# quarter_of

quarter_of — date helpers builtin.

my $result = quarter_of $x 
# or in a pipeline:
@list |> map quarter_of |> p

# quartiles

quartiles(@data) — returns the three quartile values [Q1, Q2, Q3] of a dataset. Q1 is the 25th percentile, Q2 is the median (50th), Q3 is the 75th percentile. Useful for understanding data distribution and computing IQR.

my @data = 1:100
my $q = quartiles(@data)
p "Q1=$q->[0] Q2=$q->[1] Q3=$q->[2]"

# quarts

quarts — statistics (extended) builtin. Alias for quartiles.

my $result = quarts $x 
# or in a pipeline:
@list |> map quarts |> p

# queue_new

queue_new — data structure helpers builtin.

my $result = queue_new $x 
# or in a pipeline:
@list |> map queue_new |> p

# qunif

qunif — uniform quantile. Args: p [, min, max].

p qunif(0.5, 0, 10)  # 5.0 (median)

# quote

quote — string quote / escape builtin.

my $result = quote $x 
# or in a pipeline:
@list |> map quote |> p

# qw

qw — quoting builtin.

my $result = qw $x 
# or in a pipeline:
@list |> map qw |> p

# qweibull

qweibull — Weibull quantile. Args: p, shape [, scale].

p qweibull(0.5, 1, 1)  # same as qexp

# r2d

r2d — trivial numeric / predicate builtins builtin. Alias for rad_to_deg.

my $result = r2d $x 
# or in a pipeline:
@list |> map r2d |> p

# r72

rule_of_72($rate) (alias r72) — estimates years to double investment using the Rule of 72: 72 / (rate × 100). Quick mental math approximation.

p r72(0.06)   # 12 years to double at 6%
p r72(0.10)   # 7.2 years at 10%

# r_squared

r_squared — math functions builtin.

my $result = r_squared $x 
# or in a pipeline:
@list |> map r_squared |> p

# rad_to_deg

rad_to_deg — trivial numeric / predicate builtins builtin.

my $result = rad_to_deg $input 

# radd

radd — roman numerals builtin. Alias for roman_add.

my $result = radd $x 
# or in a pipeline:
@list |> map radd |> p

# radians

radians — trig / math (batch 2) builtin.

my $result = radians $x 
# or in a pipeline:
@list |> map radians |> p

# random_alpha

random_alpha — random builtin.

my $result = random_alpha $x 
# or in a pipeline:
@list |> map random_alpha |> p

# random_between

random_between — random builtin.

my $result = random_between $x 
# or in a pipeline:
@list |> map random_between |> p

# random_bool

random_bool — random builtin.

my $result = random_bool $x 
# or in a pipeline:
@list |> map random_bool |> p

# random_char

random_char — file stat / path builtin.

my $result = random_char $x 
# or in a pipeline:
@list |> map random_char |> p

# random_choice

random_choice — random builtin.

my $result = random_choice $x 
# or in a pipeline:
@list |> map random_choice |> p

# random_color

random_color — color operations builtin.

my $result = random_color $x 
# or in a pipeline:
@list |> map random_color |> p

# random_digit

random_digit — random builtin.

my $result = random_digit $x 
# or in a pipeline:
@list |> map random_digit |> p

# random_float

random_float — random builtin.

my $result = random_float $x 
# or in a pipeline:
@list |> map random_float |> p

# random_int

random_int — random builtin.

my $result = random_int $x 
# or in a pipeline:
@list |> map random_int |> p

# random_sample

random_sample — collection (batch 2) builtin.

my $result = random_sample $x 
# or in a pipeline:
@list |> map random_sample |> p

# random_string

random_string — random builtin.

my $result = random_string $x 
# or in a pipeline:
@list |> map random_string |> p

# range_compress

range_compress — matrix operations (uncategorized batch) builtin.

my $result = range_compress $x 
# or in a pipeline:
@list |> map range_compress |> p

# range_exclusive

range_exclusive — conversion / utility (batch 4) builtin.

my $result = range_exclusive $x 
# or in a pipeline:
@list |> map range_exclusive |> p

# range_expand

range_expand — matrix operations (uncategorized batch) builtin.

my $result = range_expand $x 
# or in a pipeline:
@list |> map range_expand |> p

# range_inclusive

range_inclusive — conversion / utility (batch 4) builtin.

my $result = range_inclusive $x 
# or in a pipeline:
@list |> map range_inclusive |> p

# range_of

range_of — more list helpers builtin.

my $result = range_of $x 
# or in a pipeline:
@list |> map range_of |> p

# rank

rank — extended stdlib builtin.

my $result = rank $x 
# or in a pipeline:
@list |> map rank |> p

# rapid_blink

rapid_blink — color / ansi builtin. Alias for red.

my $result = rapid_blink $x 
# or in a pipeline:
@list |> map rapid_blink |> p

# rb

rb — filesystem extensions builtin. Alias for read_bytes.

my $result = rb $x 
# or in a pipeline:
@list |> map rb |> p

# rbeta

rbeta — generate n random beta variates. Args: n, alpha, beta. Like R's rbeta().

my @x = @{rbeta(100, 2, 5)}     # Beta(2,5)

# rbind

rbind — bind matrices/vectors by rows (vertical stack). Like R's rbind().

my $m = rbind([1,2,3], [4,5,6])  # [[1,2,3],[4,5,6]]

# rbinom

rbinom — generate n random binomial variates. Args: n, size, prob. Like R's rbinom().

my @x = @{rbinom(100, 10, 0.3)} # 100 draws from Binom(10,0.3)

# rc_time_constant

rc_time_constant — physics formulas builtin.

my $result = rc_time_constant $x 
# or in a pipeline:
@list |> map rc_time_constant |> p

# rcauchy

rcauchy — generate n random Cauchy variates. Args: n [, location, scale].

my @x = @{rcauchy(100, 0, 1)}   # standard Cauchy

# rchisq

rchisq — generate n random chi-squared variates. Args: n, df. Like R's rchisq().

my @x = @{rchisq(100, 5)}       # Chi-sq with 5 df

# rcolor

rcolor — color operations builtin. Alias for random_color.

my $result = rcolor $x 
# or in a pipeline:
@list |> map rcolor |> p

# rctau

rctau — physics formulas builtin. Alias for rc_time_constant.

my $result = rctau $x 
# or in a pipeline:
@list |> map rctau |> p

# rdcs

rdcs — algebraic match builtin. Alias for reductions.

my $result = rdcs $x 
# or in a pipeline:
@list |> map rdcs |> p

# re_escape

re_escape — more regex builtin.

my $result = re_escape $x 
# or in a pipeline:
@list |> map re_escape |> p

# re_find_all

re_find_all — more regex builtin.

my $result = re_find_all $x 
# or in a pipeline:
@list |> map re_find_all |> p

# re_groups

re_groups — more regex builtin.

my $result = re_groups $x 
# or in a pipeline:
@list |> map re_groups |> p

# re_match

re_match — file stat / path builtin. Alias for matches_regex.

my $result = re_match $x 
# or in a pipeline:
@list |> map re_match |> p

# re_split_limit

re_split_limit — more regex builtin.

my $result = re_split_limit $x 
# or in a pipeline:
@list |> map re_split_limit |> p

# re_test

re_test — more regex builtin.

my $result = re_test $x 
# or in a pipeline:
@list |> map re_test |> p

# rearth

rearth — physics constants builtin. Alias for earth_radius.

my $result = rearth $x 
# or in a pipeline:
@list |> map rearth |> p

# recip

recip — extended stdlib builtin. Alias for reciprocal_of.

my $result = recip $x 
# or in a pipeline:
@list |> map recip |> p

# reciprocal

reciprocal — math functions builtin.

my $result = reciprocal $x 
# or in a pipeline:
@list |> map reciprocal |> p

# reciprocal_of

reciprocal_of — extended stdlib builtin.

my $result = reciprocal_of $x 
# or in a pipeline:
@list |> map reciprocal_of |> p

# red

red — color / ansi builtin.

my $result = red $x 
# or in a pipeline:
@list |> map red |> p

# red_bold

red_bold — color / ansi builtin. Alias for red.

my $result = red_bold $x 
# or in a pipeline:
@list |> map red_bold |> p

# redi

redi — go/general functional utilities builtin. Alias for reduce_indexed.

my $result = redi $x 
# or in a pipeline:
@list |> map redi |> p

# redr

redr — additional missing stdlib functions builtin. Alias for reduce_right.

my $result = redr $x 
# or in a pipeline:
@list |> map redr |> p

# reduce_indexed

reduce_indexed — go/general functional utilities builtin.

my $result = reduce_indexed $x 
# or in a pipeline:
@list |> map reduce_indexed |> p

# reduce_right

reduce_right — additional missing stdlib functions builtin.

my $result = reduce_right $x 
# or in a pipeline:
@list |> map reduce_right |> p

# reflect_point

reflect_point($x, $y, $axis) — reflects a point across an axis. Axis can be 'x', 'y', or 'origin'. Returns the reflected coordinates.

p reflect_point(3, 4, 'x')       # [3, -4]
p reflect_point(3, 4, 'y')       # [-3, 4]
p reflect_point(3, 4, 'origin')  # [-3, -4]

# reflpt

reflpt — geometry (extended) builtin. Alias for reflect_point.

my $result = reflpt $x 
# or in a pipeline:
@list |> map reflpt |> p

# regex_extract

regex_extract — file stat / path builtin.

my $result = regex_extract $x 
# or in a pipeline:
@list |> map regex_extract |> p

# regex_replace_str

regex_replace_str — file stat / path builtin.

my $result = regex_replace_str $x 
# or in a pipeline:
@list |> map regex_replace_str |> p

# regex_split_str

regex_split_str — file stat / path builtin.

my $result = regex_split_str $x 
# or in a pipeline:
@list |> map regex_split_str |> p

# reject_if

reject_if — functional combinators builtin.

my $result = reject_if $x 
# or in a pipeline:
@list |> map reject_if |> p

# relativistic_energy

relativistic_energy — physics formulas builtin.

my $result = relativistic_energy $x 
# or in a pipeline:
@list |> map relativistic_energy |> p

# relativistic_mass

relativistic_mass — physics formulas builtin.

my $result = relativistic_mass $x 
# or in a pipeline:
@list |> map relativistic_mass |> p

# relenergy

relenergy — physics formulas builtin. Alias for relativistic_energy.

my $result = relenergy $x 
# or in a pipeline:
@list |> map relenergy |> p

# relmass

relmass — physics formulas builtin. Alias for relativistic_mass.

my $result = relmass $x 
# or in a pipeline:
@list |> map relmass |> p

# relu

relu — math functions builtin.

my $result = relu $x 
# or in a pipeline:
@list |> map relu |> p

# remc

remc — algebraic match builtin. Alias for remove_clj.

my $result = remc $x 
# or in a pipeline:
@list |> map remc |> p

# remove_all_str

remove_all_str — extended stdlib builtin.

my $result = remove_all_str $x 
# or in a pipeline:
@list |> map remove_all_str |> p

# remove_at

remove_at — list helpers (batch 4) builtin.

my $result = remove_at $x 
# or in a pipeline:
@list |> map remove_at |> p

# remove_clj

remove_clj — algebraic match builtin.

my $result = remove_clj $x 
# or in a pipeline:
@list |> map remove_clj |> p

# remove_consonants

remove_consonants — string processing (uncategorized batch) builtin.

my $result = remove_consonants $x 
# or in a pipeline:
@list |> map remove_consonants |> p

# remove_elem

remove_elem — list helpers (batch 4) builtin.

my $result = remove_elem $x 
# or in a pipeline:
@list |> map remove_elem |> p

# remove_first_elem

remove_first_elem — list helpers (batch 4) builtin.

my $result = remove_first_elem $x 
# or in a pipeline:
@list |> map remove_first_elem |> p

# remove_keys

remove_keys — hash ops (batch 2) builtin.

my $result = remove_keys $x 
# or in a pipeline:
@list |> map remove_keys |> p

# remove_str

remove_str — string helpers (batch 4) builtin.

my $result = remove_str $x 
# or in a pipeline:
@list |> map remove_str |> p

# remove_vowels

remove_vowels — string processing (uncategorized batch) builtin.

my $result = remove_vowels $x 
# or in a pipeline:
@list |> map remove_vowels |> p

# remove_whitespace

remove_whitespace — extended stdlib builtin.

my $result = remove_whitespace $x 
# or in a pipeline:
@list |> map remove_whitespace |> p

# rep

rep — r base builtin. Alias for rep_fn.

my $result = rep $x 
# or in a pipeline:
@list |> map rep |> p

# rep_fn

rep_fn — repeat a value N times. Like R's rep().

my @r = @{rep_fn(0, 10)}   # ten zeros
my @s = @{rep_fn("x", 5)}  # five "x"s

# repa

repa — javascript array/object methods builtin. Alias for replace_at.

my $result = repa $x 
# or in a pipeline:
@list |> map repa |> p

# repeat

repeat — trivial string ops builtin.

my $result = repeat $x 
# or in a pipeline:
@list |> map repeat |> p

# repeat_elem

repeat_elem — list helpers (batch 4) builtin.

my $result = repeat_elem $x 
# or in a pipeline:
@list |> map repeat_elem |> p

# repeat_list

repeat_list — collection (batch 2) builtin.

my $result = repeat_list $x 
# or in a pipeline:
@list |> map repeat_list |> p

# repeat_string

repeat_string — string helpers (batch 4) builtin.

my $result = repeat_string $x 
# or in a pipeline:
@list |> map repeat_string |> p

# repeatedly

repeatedly — algebraic match builtin.

my $result = repeatedly $x 
# or in a pipeline:
@list |> map repeatedly |> p

# replace_all_str

replace_all_str — string (batch 2) builtin.

my $result = replace_all_str $x 
# or in a pipeline:
@list |> map replace_all_str |> p

# replace_at

replace_at — javascript array/object methods builtin.

my $result = replace_at $x 
# or in a pipeline:
@list |> map replace_at |> p

# replace_first

replace_first — string (batch 2) builtin.

my $result = replace_first $x 
# or in a pipeline:
@list |> map replace_first |> p

# replace_n_times

replace_n_times — extended stdlib builtin.

my $result = replace_n_times $x 
# or in a pipeline:
@list |> map replace_n_times |> p

# replace_regex

replace_regex — extended stdlib builtin.

my $result = replace_regex $x 
# or in a pipeline:
@list |> map replace_regex |> p

# replicate_val

replicate_val — haskell list functions builtin.

my $result = replicate_val $x 
# or in a pipeline:
@list |> map replicate_val |> p

# repln

repln — extended stdlib builtin. Alias for replace_n_times.

my $result = repln $x 
# or in a pipeline:
@list |> map repln |> p

# replre

replre — extended stdlib builtin. Alias for replace_regex.

my $result = replre $x 
# or in a pipeline:
@list |> map replre |> p

# repv

repv — haskell list functions builtin. Alias for replicate_val.

my $result = repv $x 
# or in a pipeline:
@list |> map repv |> p

# resample

resample(\@signal, $factor) — resamples signal by a rational factor. Factor > 1 upsamples, factor < 1 downsamples. Uses linear interpolation.

my $up = resample(\@signal, 2)     # double sample rate
my $down = resample(\@signal, 0.5) # halve sample rate

# reservoir_sample

reservoir_sample — matrix operations (uncategorized batch) builtin.

my $result = reservoir_sample $x 
# or in a pipeline:
@list |> map reservoir_sample |> p

# reset

reset — process / system builtin.

my $result = reset $x 
# or in a pipeline:
@list |> map reset |> p

# resfreq

resfreq — physics formulas builtin. Alias for resonant_frequency.

my $result = resfreq $x 
# or in a pipeline:
@list |> map resfreq |> p

# resonant_frequency

resonant_frequency — physics formulas builtin.

my $result = resonant_frequency $x 
# or in a pipeline:
@list |> map resonant_frequency |> p

# rest

rest — algebraic match builtin.

my $result = rest $x 
# or in a pipeline:
@list |> map rest |> p

# rest_energy

rest_energy — physics formulas builtin.

my $result = rest_energy $x 
# or in a pipeline:
@list |> map rest_energy |> p

# restenergy

restenergy — physics formulas builtin. Alias for rest_energy.

my $result = restenergy $x 
# or in a pipeline:
@list |> map restenergy |> p

# rev

rev — short aliases builtin.

my $result = rev $x 
# or in a pipeline:
@list |> map rev |> p

# rev_str

rev_str — trivial string ops builtin. Alias for reverse_str.

my $result = rev_str $x 
# or in a pipeline:
@list |> map rev_str |> p

# rev_vec

rev_vec — r base builtin.

my $result = rev_vec $x 
# or in a pipeline:
@list |> map rev_vec |> p

# reverse_each

reverse_each — trivial numeric helpers (batch 4) builtin.

my $result = reverse_each $x 
# or in a pipeline:
@list |> map reverse_each |> p

# reverse_each_word

reverse_each_word — string processing (uncategorized batch) builtin.

my $result = reverse_each_word $x 
# or in a pipeline:
@list |> map reverse_each_word |> p

# reverse_list

reverse_list — file stat / path builtin.

my $result = reverse_list $x 
# or in a pipeline:
@list |> map reverse_list |> p

# reverse_str

reverse_str — trivial string ops builtin.

my $result = reverse_str $x 
# or in a pipeline:
@list |> map reverse_str |> p

# reverse_words

reverse_words — string (batch 2) builtin.

my $result = reverse_words $x 
# or in a pipeline:
@list |> map reverse_words |> p

# revwords

revwords — string processing (uncategorized batch) builtin. Alias for reverse_each_word.

my $result = revwords $x 
# or in a pipeline:
@list |> map revwords |> p

# rexp

rexp — generate n random exponential variates. Args: n [, rate]. Like R's rexp().

my @x = @{rexp(100, 0.5)}       # rate=0.5 (mean=2)

# rf

rf — generate n random F variates. Args: n, d1, d2. Like R's rf().

my @x = @{rf(100, 5, 10)}       # F(5,10)

# rfact

rfact — math formulas builtin. Alias for rising_factorial.

my $result = rfact $x 
# or in a pipeline:
@list |> map rfact |> p

# rgamma

rgamma — generate n random gamma variates. Args: n, shape [, scale]. Like R's rgamma().

my @x = @{rgamma(100, 2, 1)}    # Gamma(2,1)

# rgb

rgb — color / ansi builtin. Alias for red.

my $result = rgb $x 
# or in a pipeline:
@list |> map rgb |> p

# rgb2hsl

rgb2hsl — color operations builtin. Alias for rgb_to_hsl.

my $result = rgb2hsl $x 
# or in a pipeline:
@list |> map rgb2hsl |> p

# rgb2hsv

rgb2hsv — color operations builtin. Alias for rgb_to_hsv.

my $result = rgb2hsv $x 
# or in a pipeline:
@list |> map rgb2hsv |> p

# rgb_to_hex

rgb_to_hex — color / ansi builtin.

my $result = rgb_to_hex $input 

# rgb_to_hsl

rgb_to_hsl — color operations builtin.

my $result = rgb_to_hsl $input 

# rgb_to_hsv

rgb_to_hsv — color operations builtin.

my $result = rgb_to_hsv $input 

# rgeom

rgeom — generate n random geometric variates. Args: n, prob.

my @x = @{rgeom(100, 0.3)}      # trials until first success

# rho

spearman (aliases spearman_corr, rho) computes Spearman's rank correlation coefficient between two samples.

p rho([1,2,3,4,5], [5,6,7,8,7])  # ~0.82

# ridx

ridx — python/ruby stdlib builtin. Alias for rindex_fn.

my $result = ridx $x 
# or in a pipeline:
@list |> map ridx |> p

# riffle

riffle — collection helpers (trivial) builtin.

my $result = riffle $x 
# or in a pipeline:
@list |> map riffle |> p

# right_str

right_str — string (batch 2) builtin.

my $result = right_str $x 
# or in a pipeline:
@list |> map right_str |> p

# rindex_fn

rindex_fn — python/ruby stdlib builtin.

my $result = rindex_fn $x 
# or in a pipeline:
@list |> map rindex_fn |> p

# rising_factorial

rising_factorial — math formulas builtin.

my $result = rising_factorial $x 
# or in a pipeline:
@list |> map rising_factorial |> p

# rjt

rjt — extended stdlib builtin. Alias for rjust_text.

my $result = rjt $x 
# or in a pipeline:
@list |> map rjt |> p

# rjust

rjust — string helpers (batch 4) builtin.

my $result = rjust $x 
# or in a pipeline:
@list |> map rjust |> p

# rjust_text

rjust_text — extended stdlib builtin.

my $result = rjust_text $x 
# or in a pipeline:
@list |> map rjust_text |> p

# rk4

rk4 (aliases runge_kutta, rk4_ode) solves an ODE dy/dt = f(t,y) using 4th-order Runge-Kutta. Returns [[t,y], ...].

# dy/dt = -y, y(0) = 1 → y = e^(-t)
my $sol = rk4(fn { -$_[1] }, 0, 1, 0.1, 100)

# rl_time_constant

rl_time_constant — physics formulas builtin.

my $result = rl_time_constant $x 
# or in a pipeline:
@list |> map rl_time_constant |> p

# rld

rld — collection more builtin. Alias for run_length_decode.

my $result = rld $x 
# or in a pipeline:
@list |> map rld |> p

# rld_str

rld_str — matrix operations (uncategorized batch) builtin. Alias for run_length_decode_str.

my $result = rld_str $x 
# or in a pipeline:
@list |> map rld_str |> p

# rle

rle — collection more builtin. Alias for run_length_encode.

my $result = rle $x 
# or in a pipeline:
@list |> map rle |> p

# rle_str

rle_str — matrix operations (uncategorized batch) builtin. Alias for run_length_encode_str.

my $result = rle_str $x 
# or in a pipeline:
@list |> map rle_str |> p

# rlnorm

rlnorm — generate n random log-normal variates. Args: n [, mu, sigma].

my @x = @{rlnorm(100, 0, 1)}    # LogN(0,1)

# rltau

rltau — physics formulas builtin. Alias for rl_time_constant.

my $result = rltau $x 
# or in a pipeline:
@list |> map rltau |> p

# rmall

rmall — extended stdlib builtin. Alias for remove_all_str.

my $result = rmall $x 
# or in a pipeline:
@list |> map rmall |> p

# rmcons

rmcons — string processing (uncategorized batch) builtin. Alias for remove_consonants.

my $result = rmcons $x 
# or in a pipeline:
@list |> map rmcons |> p

# rms

rms — extended stdlib builtin.

my $result = rms $x 
# or in a pipeline:
@list |> map rms |> p

# rmse

rmse — math functions builtin.

my $result = rmse $x 
# or in a pipeline:
@list |> map rmse |> p

# rmvowel

rmvowel — string processing (uncategorized batch) builtin. Alias for remove_vowels.

my $result = rmvowel $x 
# or in a pipeline:
@list |> map rmvowel |> p

# rmws

rmws — extended stdlib builtin. Alias for remove_whitespace.

my $result = rmws $x 
# or in a pipeline:
@list |> map rmws |> p

# rngcmp

rngcmp — matrix operations (uncategorized batch) builtin. Alias for range_compress.

my $result = rngcmp $x 
# or in a pipeline:
@list |> map rngcmp |> p

# rngexp

rngexp — matrix operations (uncategorized batch) builtin. Alias for range_expand.

my $result = rngexp $x 
# or in a pipeline:
@list |> map rngexp |> p

# rnk

rnk — extended stdlib builtin. Alias for rank.

my $result = rnk $x 
# or in a pipeline:
@list |> map rnk |> p

# rnorm

rnorm — generate n random normal variates. Args: n [, mu, sigma]. Like R's rnorm().

my @x = @{rnorm(1000)}          # 1000 standard normal
my @y = @{rnorm(100, 50, 10)}   # mean=50, sd=10

# roi

roi — finance builtin.

my $result = roi $x 
# or in a pipeline:
@list |> map roi |> p

# roman

roman — roman numerals builtin. Alias for int_to_roman.

my $result = roman $x 
# or in a pipeline:
@list |> map roman |> p

# roman_add

roman_add — roman numerals builtin.

my $result = roman_add $x 
# or in a pipeline:
@list |> map roman_add |> p

# roman_numeral_list

roman_numeral_list — roman numerals builtin.

my $result = roman_numeral_list $x 
# or in a pipeline:
@list |> map roman_numeral_list |> p

# roman_to_int

roman_to_int — roman numerals builtin.

my $result = roman_to_int $input 

# romanlist

romanlist — roman numerals builtin. Alias for roman_numeral_list.

my $result = romanlist $x 
# or in a pipeline:
@list |> map romanlist |> p

# rot13

rot13 — string (batch 2) builtin.

my $result = rot13 $x 
# or in a pipeline:
@list |> map rot13 |> p

# rot47

rot47 — string (batch 2) builtin.

my $result = rot47 $x 
# or in a pipeline:
@list |> map rot47 |> p

# rotate

rotate — collection helpers (trivial) builtin.

my $result = rotate $x 
# or in a pipeline:
@list |> map rotate |> p

# rotate_point

rotate_point — math functions builtin.

my $result = rotate_point $x 
# or in a pipeline:
@list |> map rotate_point |> p

# round

round — trivial numeric / predicate builtins builtin.

my $result = round $x 
# or in a pipeline:
@list |> map round |> p

# round_each

round_each — trivial numeric helpers (batch 4) builtin.

my $result = round_each $x 
# or in a pipeline:
@list |> map round_each |> p

# round_to

round_to — math functions builtin.

my $result = round_to $x 
# or in a pipeline:
@list |> map round_to |> p

# rowMeans

row_means (alias rowMeans) — mean of each row. Like R's rowMeans().

p rowMeans([[2,4],[6,8]])  # [3, 7]

# rowSums

row_sums (alias rowSums) — sum of each row in a matrix. Like R's rowSums().

p row_sums([[1,2,3],[4,5,6]])  # [6, 15]

# rpad

rpad — trivial string ops builtin. Alias for pad_right.

my $result = rpad $x 
# or in a pipeline:
@list |> map rpad |> p

# rpn

rpn — algorithms / puzzles builtin. Alias for eval_rpn.

my $result = rpn $x 
# or in a pipeline:
@list |> map rpn |> p

# rpois

rpois — generate n random Poisson variates. Args: n, lambda. Like R's rpois().

my @x = @{rpois(100, 5)}        # Poisson with mean 5

# rptd

rptd — algebraic match builtin. Alias for repeatedly.

my $result = rptd $x 
# or in a pipeline:
@list |> map rptd |> p

# rsa_decrypt_pkcs1

rsa_decrypt_pkcs1 decrypts RSA-PKCS1v15 ciphertext.

my $plain = rsa_decrypt_pkcs1($priv, $cipher)

# rsa_encrypt_pkcs1

rsa_encrypt_pkcs1 encrypts with legacy RSA-PKCS1v15 padding. Only for compatibility with old systems — prefer OAEP.

my $cipher = rsa_encrypt_pkcs1($pub, "data")

# rsamp

rsamp — matrix operations (uncategorized batch) builtin. Alias for reservoir_sample.

my $result = rsamp $x 
# or in a pipeline:
@list |> map rsamp |> p

# rst

rst — algebraic match builtin. Alias for rest.

my $result = rst $x 
# or in a pipeline:
@list |> map rst |> p

# rsun

rsun — physics constants builtin. Alias for sun_radius.

my $result = rsun $x 
# or in a pipeline:
@list |> map rsun |> p

# rt

rt — generate n random Student's t variates. Args: n, df. Like R's rt().

my @x = @{rt(100, 10)}          # t with 10 df

# run_length_decode

run_length_decode — collection more builtin.

my $result = run_length_decode $x 
# or in a pipeline:
@list |> map run_length_decode |> p

# run_length_decode_str

run_length_decode_str — matrix operations (uncategorized batch) builtin.

my $result = run_length_decode_str $x 
# or in a pipeline:
@list |> map run_length_decode_str |> p

# run_length_encode

run_length_encode — collection more builtin.

my $result = run_length_encode $x 
# or in a pipeline:
@list |> map run_length_encode |> p

# run_length_encode_str

run_length_encode_str — matrix operations (uncategorized batch) builtin.

my $result = run_length_encode_str $x 
# or in a pipeline:
@list |> map run_length_encode_str |> p

# runif

runif — generate n random uniform variates. Args: n [, min, max]. Like R's runif().

my @x = @{runif(100, 0, 1)}     # 100 uniform [0,1]

# running_max

running_max — list helpers (batch 4) builtin.

my $result = running_max $x 
# or in a pipeline:
@list |> map running_max |> p

# running_min

running_min — list helpers (batch 4) builtin.

my $result = running_min $x 
# or in a pipeline:
@list |> map running_min |> p

# running_reduce

running_reduce — additional missing stdlib functions builtin.

my $result = running_reduce $x 
# or in a pipeline:
@list |> map running_reduce |> p

# runred

runred — additional missing stdlib functions builtin. Alias for running_reduce.

my $result = runred $x 
# or in a pipeline:
@list |> map runred |> p

# rweibull

rweibull — generate n random Weibull variates. Args: n, shape [, scale].

my @x = @{rweibull(100, 2, 1)}  # Weibull(2,1)

# rydberg

rydberg — physics constants builtin. Alias for rydberg_constant.

my $result = rydberg $x 
# or in a pipeline:
@list |> map rydberg |> p

# rydberg_constant

rydberg_constant — physics constants builtin.

my $result = rydberg_constant $x 
# or in a pipeline:
@list |> map rydberg_constant |> p

# s1

s1 — crypto / encoding builtin. Alias for sha1.

my $result = s1 $x 
# or in a pipeline:
@list |> map s1 |> p

# s224

s224 — crypto / encoding builtin. Alias for sha224.

my $result = s224 $x 
# or in a pipeline:
@list |> map s224 |> p

# s256

s256 — crypto / encoding builtin. Alias for sha256.

my $result = s256 $x 
# or in a pipeline:
@list |> map s256 |> p

# s2c

s2c — string processing (uncategorized batch) builtin. Alias for snake_to_camel.

my $result = s2c $x 
# or in a pipeline:
@list |> map s2c |> p

# s384

s384 — crypto / encoding builtin. Alias for sha384.

my $result = s384 $x 
# or in a pipeline:
@list |> map s384 |> p

# s512

s512 — crypto / encoding builtin. Alias for sha512.

my $result = s512 $x 
# or in a pipeline:
@list |> map s512 |> p

# s_to_m

s_to_m — unit conversions builtin. Alias for seconds_to_minutes.

my $result = s_to_m $input 

# s_to_ms

s_to_ms — file stat / path builtin.

my $result = s_to_ms $input 

# safe_div

safe_div — functional combinators builtin.

my $result = safe_div $x 
# or in a pipeline:
@list |> map safe_div |> p

# safe_log

safe_log — functional combinators builtin.

my $result = safe_log $x 
# or in a pipeline:
@list |> map safe_log |> p

# safe_mod

safe_mod — functional combinators builtin.

my $result = safe_mod $x 
# or in a pipeline:
@list |> map safe_mod |> p

# safe_sqrt

safe_sqrt — functional combinators builtin.

my $result = safe_sqrt $x 
# or in a pipeline:
@list |> map safe_sqrt |> p

# sample_n

sample_n — collection (batch 2) builtin. Alias for random_sample.

my $result = sample_n $x 
# or in a pipeline:
@list |> map sample_n |> p

# sample_one

sample_one — list helpers (batch 4) builtin.

my $result = sample_one $x 
# or in a pipeline:
@list |> map sample_one |> p

# sample_stddev

sample_stddev — statistics (extended) builtin.

my $result = sample_stddev $x 
# or in a pipeline:
@list |> map sample_stddev |> p

# sample_variance

sample_variance — statistics (extended) builtin.

my $result = sample_variance $x 
# or in a pipeline:
@list |> map sample_variance |> p

# sampn

sampn — extended stdlib builtin.

my $result = sampn $x 
# or in a pipeline:
@list |> map sampn |> p

# sapply

sapply — apply a function to each element, return a vector. Like R's sapply().

my @sq = @{sapply([1,2,3,4], fn { $_[0] ** 2 })}  # [1,4,9,16]

# sat01

sat01 — trig / math (batch 2) builtin. Alias for saturate.

my $result = sat01 $x 
# or in a pipeline:
@list |> map sat01 |> p

# saturate

saturate — trig / math (batch 2) builtin.

my $result = saturate $x 
# or in a pipeline:
@list |> map saturate |> p

# scale

scale — standardize a vector: (x - mean) / sd. Like R's scale().

my @z = @{scale([10,20,30])}  # [-1, 0, 1]

# scale_each

scale_each — trivial numeric helpers (batch 4) builtin.

my $result = scale_each $x 
# or in a pipeline:
@list |> map scale_each |> p

# scale_point

scale_point($x, $y, $sx, $sy) — scales a 2D point by factors sx and sy from the origin. Returns [$x*$sx, $y*$sy]. Use for geometric transformations.

my $p = scale_point(2, 3, 2, 2)
p @$p   # (4, 6)

# scalept

scalept — geometry (extended) builtin. Alias for scale_point.

my $result = scalept $x 
# or in a pipeline:
@list |> map scalept |> p

# scan

scan — functional combinators builtin.

my $result = scan $x 
# or in a pipeline:
@list |> map scan |> p

# scan_left

scan_left — list helpers (batch 4) builtin.

my $result = scan_left $x 
# or in a pipeline:
@list |> map scan_left |> p

# scanl

scanl — haskell list functions builtin.

my $result = scanl $x 
# or in a pipeline:
@list |> map scanl |> p

# scanr

scanr — haskell list functions builtin.

my $result = scanr $x 
# or in a pipeline:
@list |> map scanr |> p

# scentroid

spectral_centroid(\@spectrum) (alias scentroid) — computes the spectral centroid (center of mass) of a spectrum. Indicates the 'brightness' of a sound. Returns frequency bin index.

my $psd = psd(\@signal)
p scentroid($psd)   # brightness measure

# schwarz

schwarzschild_radius($mass) (alias schwarz) — event horizon radius rs = 2GM/c² of a black hole.

p schwarz(1.989e30)   # ~2954 m (Sun as black hole)
p schwarz(5.972e24)   # ~0.009 m (Earth as black hole)

# script_name

script_name — process / env builtin.

my $result = script_name $x 
# or in a pipeline:
@list |> map script_name |> p

# sdivs

sdivs — math / numeric (uncategorized batch) builtin. Alias for sum_divisors.

my $result = sdivs $x 
# or in a pipeline:
@list |> map sdivs |> p

# sdx

sdx — extended stdlib builtin. Alias for soundex.

my $result = sdx $x 
# or in a pipeline:
@list |> map sdx |> p

# sec

sec returns the secant (1/cos) of an angle in radians.

p sec(0)  # 1.0

# second

second — algebraic match builtin.

my $result = second $x 
# or in a pipeline:
@list |> map second |> p

# second_arg

second_arg — functional primitives builtin.

my $result = second_arg $x 
# or in a pipeline:
@list |> map second_arg |> p

# second_elem

second_elem — list helpers (batch 4) builtin.

my $result = second_elem $x 
# or in a pipeline:
@list |> map second_elem |> p

# seconds_to_days

seconds_to_days — unit conversions builtin.

my $result = seconds_to_days $input 

# seconds_to_hours

seconds_to_hours — unit conversions builtin.

my $result = seconds_to_hours $input 

# seconds_to_minutes

seconds_to_minutes — unit conversions builtin.

my $result = seconds_to_minutes $input 

# sectarea

sectarea — geometry (extended) builtin. Alias for sector_area.

my $result = sectarea $x 
# or in a pipeline:
@list |> map sectarea |> p

# sector_area

sector_area($radius, $theta) — computes the area of a circular sector. Theta is the central angle in radians. Returns 0.5 * r² * theta.

p sector_area(10, 3.14159)   # ~157 (half circle)
p sector_area(5, 1.57)       # ~19.6

# selu

selu applies the Scaled ELU with fixed lambda=1.0507, alpha=1.6733 for self-normalizing networks.

p selu(1)    # 1.0507
p selu(-1)   # -1.1113

# semctl

semctl — sysv ipc builtin.

my $result = semctl $x 
# or in a pipeline:
@list |> map semctl |> p

# semget

semget — sysv ipc builtin.

my $result = semget $x 
# or in a pipeline:
@list |> map semget |> p

# semop

semop — sysv ipc builtin.

my $result = semop $x 
# or in a pipeline:
@list |> map semop |> p

# sentence_case

sentence_case — string helpers (batch 4) builtin.

my $result = sentence_case $x 
# or in a pipeline:
@list |> map sentence_case |> p

# seq

seq — algebraic match builtin.

my $result = seq $x 
# or in a pipeline:
@list |> map seq |> p

# seq_fn

seq_fn — generate a numeric sequence from, to, by. Like R's seq().

my @s = @{seq_fn(1, 10, 2)}  # [1,3,5,7,9]
my @r = @{seq_fn(5, 1, -1)}  # [5,4,3,2,1]

# setgrent

setgrent — posix metadata builtin.

my $result = setgrent $x 
# or in a pipeline:
@list |> map setgrent |> p

# sethostent

sethostent — posix metadata builtin.

my $result = sethostent $x 
# or in a pipeline:
@list |> map sethostent |> p

# setnetent

setnetent — posix metadata builtin.

my $result = setnetent $x 
# or in a pipeline:
@list |> map setnetent |> p

# setprotoent

setprotoent — posix metadata builtin.

my $result = setprotoent $x 
# or in a pipeline:
@list |> map setprotoent |> p

# setpwent

setpwent — posix metadata builtin.

my $result = setpwent $x 
# or in a pipeline:
@list |> map setpwent |> p

# setservent

setservent — posix metadata builtin.

my $result = setservent $x 
# or in a pipeline:
@list |> map setservent |> p

# sgnum

sgnum — extended stdlib builtin. Alias for signum_of.

my $result = sgnum $x 
# or in a pipeline:
@list |> map sgnum |> p

# shapiro

shapiro_test (alias shapiro) — Shapiro-Wilk normality test. Returns W statistic (close to 1 = normal). Like R's shapiro.test().

p shapiro([rnorm(100)])  # W ≈ 0.99 for normal data
p shapiro([1,1,1,2,10]) # W < 0.9 for non-normal

# sharpe

sharpe_ratio(\@returns, $risk_free_rate) (alias sharpe) — computes the Sharpe ratio measuring risk-adjusted returns. Higher is better. Returns (mean_return - rf) / stddev.

my @returns = (0.05, -0.02, 0.08, 0.03)
p sharpe(\@returns, 0.02)   # risk-adjusted performance

# shift_left

shift_left — bit ops builtin.

my $result = shift_left $x 
# or in a pipeline:
@list |> map shift_left |> p

# shift_right

shift_right — bit ops builtin.

my $result = shift_right $x 
# or in a pipeline:
@list |> map shift_right |> p

# shl

shl — bit ops builtin. Alias for shift_left.

my $result = shl $x 
# or in a pipeline:
@list |> map shl |> p

# shmctl

shmctl — sysv ipc builtin.

my $result = shmctl $x 
# or in a pipeline:
@list |> map shmctl |> p

# shmget

shmget — sysv ipc builtin.

my $result = shmget $x 
# or in a pipeline:
@list |> map shmget |> p

# shmread

shmread — sysv ipc builtin.

my $result = shmread $x 
# or in a pipeline:
@list |> map shmread |> p

# shmwrite

shmwrite — sysv ipc builtin.

my $result = shmwrite $x 
# or in a pipeline:
@list |> map shmwrite |> p

# short_id

short_id — id helpers builtin.

my $result = short_id $x 
# or in a pipeline:
@list |> map short_id |> p

# shorten

shorten — trivial string ops builtin. Alias for truncate_at.

my $result = shorten $x 
# or in a pipeline:
@list |> map shorten |> p

# shortest

shortest — collection (batch 2) builtin.

my $result = shortest $x 
# or in a pipeline:
@list |> map shortest |> p

# shortest_path_bfs

shortest_path_bfs — extended stdlib builtin.

my $result = shortest_path_bfs $x 
# or in a pipeline:
@list |> map shortest_path_bfs |> p

# shr

shr — bit ops builtin. Alias for shift_right.

my $result = shr $x 
# or in a pipeline:
@list |> map shr |> p

# shuf

shuf — extended stdlib builtin. Alias for shuffle_arr.

my $result = shuf $x 
# or in a pipeline:
@list |> map shuf |> p

# shuffle_arr

shuffle_arr — extended stdlib builtin.

my $result = shuffle_arr $x 
# or in a pipeline:
@list |> map shuffle_arr |> p

# shuffle_chars

shuffle_chars — file stat / path builtin.

my $result = shuffle_chars $x 
# or in a pipeline:
@list |> map shuffle_chars |> p

# shuffled

shuffled — functional / iterator builtin.

my $result = shuffled $x 
# or in a pipeline:
@list |> map shuffled |> p

# sierp

sierp — algorithms / puzzles builtin. Alias for sierpinski.

my $result = sierp $x 
# or in a pipeline:
@list |> map sierp |> p

# sierpinski

sierpinski — algorithms / puzzles builtin.

my $result = sierpinski $x 
# or in a pipeline:
@list |> map sierpinski |> p

# sieve

sieve — number theory / primes builtin. Alias for primes_up_to.

my $result = sieve $x 
# or in a pipeline:
@list |> map sieve |> p

# sigma_sb

sigma_sb — physics constants builtin. Alias for stefan_boltzmann_constant.

my $result = sigma_sb $x 
# or in a pipeline:
@list |> map sigma_sb |> p

# sigmoid

sigmoid — math functions builtin.

my $result = sigmoid $x 
# or in a pipeline:
@list |> map sigmoid |> p

# sign

sign — trivial numeric / predicate builtins builtin.

my $result = sign $x 
# or in a pipeline:
@list |> map sign |> p

# signal_name

signal_name — more process / system builtin.

my $result = signal_name $x 
# or in a pipeline:
@list |> map signal_name |> p

# signum

signum — math functions builtin.

my $result = signum $x 
# or in a pipeline:
@list |> map signum |> p

# signum_of

signum_of — extended stdlib builtin.

my $result = signum_of $x 
# or in a pipeline:
@list |> map signum_of |> p

# silu

silu (alias swish) applies SiLU/Swish: x·sigmoid(x). Smooth approximation to ReLU.

p silu(1)    # 0.7311
p swish(-2)  # -0.2384

# silver

silver_ratio (alias silver) — δS = 1 + √2 ≈ 2.414. Related to Pell numbers.

p silver   # 2.414213562373095

# sim

sim — extended stdlib builtin. Alias for similarity.

my $result = sim $x 
# or in a pipeline:
@list |> map sim |> p

# similarity

similarity — extended stdlib builtin.

my $result = similarity $x 
# or in a pipeline:
@list |> map similarity |> p

# simple_interest

simple_interest — physics formulas builtin.

my $result = simple_interest $x 
# or in a pipeline:
@list |> map simple_interest |> p

# simps

simpson (alias simps) integrates evenly-spaced samples using Simpson's rule. More accurate than trapz for smooth functions.

my @y = map { sin(_ * 0.01) } 0:314
p simps(\@y, 0.01)  # ≈ 2.0

# sinc

sinc returns the unnormalized sinc function: sin(x)/x, with sinc(0)=1.

p sinc(0)       # 1.0
p sinc(3.14159) # ≈ 0

# single_quote

single_quote — string quote / escape builtin.

my $result = single_quote $x 
# or in a pipeline:
@list |> map single_quote |> p

# sinh

sinh — trig / math (batch 2) builtin.

my $result = sinh $x 
# or in a pipeline:
@list |> map sinh |> p

# siphash_keyed

siphash_keyed computes SipHash-2-4 with a custom 128-bit key (two 64-bit integers). The key should be random per application to prevent collision attacks.

p siphash_keyed("data", 0x123456789, 0xabcdef012)  # keyed hash

# size

size returns the byte size of a file on disk — equivalent to Perl's -s FILE file test. With no arguments, it operates on _; with one argument, it stats the given path; with multiple arguments (or a flattened list), it returns an array of sizes. Paths that can't be stat'd return undef. This is a stryke extension that makes pipelines over filenames concise.

p size "Cargo.toml"                   # 2013
f |> map +{ _ => size } |> tj |> p   # [{name => bytes}, ...]
f |> filter { size > 1024 } |> e p    # files larger than 1 KiB

# skew

skew — math / numeric (uncategorized batch) builtin. Alias for skewness.

my $result = skew $x 
# or in a pipeline:
@list |> map skew |> p

# skewness

skewness — math / numeric (uncategorized batch) builtin.

my $result = skewness $x 
# or in a pipeline:
@list |> map skewness |> p

# skip_while

skip_while { COND } LIST — skip leading elements while the predicate is true (alias for drop_while).

Behavior is identical to drop_while: once the predicate returns false, that element and all subsequent elements are emitted. The skip_while name is provided for users coming from Rust or Kotlin where this is the conventional name. Both compile to the same streaming operation internally.

1:10 |> skip_while { _ < 5 } |> e p # 5 6 7 8 9 10
@sorted |> skip_while { _ le "m" } |> e p

# sla

sla — python/ruby stdlib builtin. Alias for slice_arr.

my $result = sla $x 
# or in a pipeline:
@list |> map sla |> p

# slca

slca — additional missing stdlib functions builtin. Alias for slice_after.

my $result = slca $x 
# or in a pipeline:
@list |> map slca |> p

# slcb

slcb — additional missing stdlib functions builtin. Alias for slice_before.

my $result = slcb $x 
# or in a pipeline:
@list |> map slcb |> p

# slcw

slcw — additional missing stdlib functions builtin. Alias for slice_when.

my $result = slcw $x 
# or in a pipeline:
@list |> map slcw |> p

# slice_after

slice_after — additional missing stdlib functions builtin.

my $result = slice_after $x 
# or in a pipeline:
@list |> map slice_after |> p

# slice_arr

slice_arr — python/ruby stdlib builtin.

my $result = slice_arr $x 
# or in a pipeline:
@list |> map slice_arr |> p

# slice_before

slice_before — additional missing stdlib functions builtin.

my $result = slice_before $x 
# or in a pipeline:
@list |> map slice_before |> p

# slice_when

slice_when — additional missing stdlib functions builtin.

my $result = slice_when $x 
# or in a pipeline:
@list |> map slice_when |> p

# sliding_pairs

sliding_pairs — collection more builtin.

my $result = sliding_pairs $x 
# or in a pipeline:
@list |> map sliding_pairs |> p

# sliding_window

sliding_window — functional / iterator builtin.

my $result = sliding_window $x 
# or in a pipeline:
@list |> map sliding_window |> p

# slope

slope — geometry / physics builtin.

my $result = slope $x 
# or in a pipeline:
@list |> map slope |> p

# slug

slug — extended stdlib builtin. Alias for slugify.

my $result = slug $x 
# or in a pipeline:
@list |> map slug |> p

# slugify

slugify — extended stdlib builtin.

my $result = slugify $x 
# or in a pipeline:
@list |> map slugify |> p

# smap

smap — python/ruby stdlib builtin. Alias for starmap.

my $result = smap $x 
# or in a pipeline:
@list |> map smap |> p

# smoothstep

smoothstep($edge0, $edge1, $x) — smooth Hermite interpolation. Returns 0 if x ≤ edge0, 1 if x ≥ edge1, otherwise smooth S-curve. Great for animations.

p smoothstep(0, 1, 0.5)   # 0.5 (but with smooth acceleration/deceleration)
p smoothstep(10, 20, 15)  # 0.5

# smst

smst — extended stdlib builtin. Alias for smoothstep.

my $result = smst $x 
# or in a pipeline:
@list |> map smst |> p

# snake_to_camel

snake_to_camel — string processing (uncategorized batch) builtin.

my $result = snake_to_camel $input 

# snd

snd — algebraic match builtin. Alias for second.

my $result = snd $x 
# or in a pipeline:
@list |> map snd |> p

# snell

snells_law($n1, $n2, $theta1) (alias snell) — refraction angle using Snell's law. Angles in degrees. Returns undef for total internal reflection.

p snell(1, 1.5, 30)     # ~19.5° (air to glass)
p snell(1.5, 1, 45)     # undef (total internal reflection)

# socketpair

socketpair — socket builtin.

my $result = socketpair $x 
# or in a pipeline:
@list |> map socketpair |> p

# sockets

sockets — filesystem extensions builtin.

my $result = sockets $x 
# or in a pipeline:
@list |> map sockets |> p

# sod

sod — extended stdlib builtin. Alias for start_of_day.

my $result = sod $x 
# or in a pipeline:
@list |> map sod |> p

# softmax

softmax — functional combinators builtin.

my $result = softmax $x 
# or in a pipeline:
@list |> map softmax |> p

# softplus

softplus applies the Softplus activation: ln(1 + e^x). Smooth approximation to ReLU.

p softplus(0)   # 0.6931 (ln 2)
p softplus(10)  # ≈ 10

# soh

soh — extended stdlib builtin. Alias for start_of_hour.

my $result = soh $x 
# or in a pipeline:
@list |> map soh |> p

# sol

sol — constants builtin.

my $result = sol $x 
# or in a pipeline:
@list |> map sol |> p

# sole

sole — ruby enumerable extras builtin.

my $result = sole $x 
# or in a pipeline:
@list |> map sole |> p

# som

som — extended stdlib builtin. Alias for start_of_minute.

my $result = som $x 
# or in a pipeline:
@list |> map som |> p

# some

some — algebraic match builtin.

my $result = some $x 
# or in a pipeline:
@list |> map some |> p

# sort_by

sort_by — functional / iterator builtin.

my $result = sort_by $x 
# or in a pipeline:
@list |> map sort_by |> p

# sort_on

sort_on — haskell list functions builtin.

my $result = sort_on $x 
# or in a pipeline:
@list |> map sort_on |> p

# sort_words

sort_words — string processing (uncategorized batch) builtin.

my $result = sort_words $x 
# or in a pipeline:
@list |> map sort_words |> p

# sorted

sorted — file stat / path builtin.

my $result = sorted $x 
# or in a pipeline:
@list |> map sorted |> p

# sorted_by_length

sorted_by_length — file stat / path builtin.

my $result = sorted_by_length $x 
# or in a pipeline:
@list |> map sorted_by_length |> p

# sorted_desc

sorted_desc — file stat / path builtin.

my $result = sorted_desc $x 
# or in a pipeline:
@list |> map sorted_desc |> p

# sorted_nums

sorted_nums — file stat / path builtin.

my $result = sorted_nums $x 
# or in a pipeline:
@list |> map sorted_nums |> p

# sortino

sortino_ratio(\@returns, $target) (alias sortino) — computes the Sortino ratio, similar to Sharpe but only penalizes downside volatility. Better for asymmetric return distributions.

my @returns = (0.05, -0.02, 0.08, -0.01)
p sortino(\@returns, 0.0)   # penalizes only negative returns

# sortw

sortw — string processing (uncategorized batch) builtin. Alias for sort_words.

my $result = sortw $x 
# or in a pipeline:
@list |> map sortw |> p

# soundex

soundex — extended stdlib builtin.

my $result = soundex $x 
# or in a pipeline:
@list |> map soundex |> p

# spaceship

spaceship — file stat / path builtin.

my $result = spaceship $x 
# or in a pipeline:
@list |> map spaceship |> p

# span

span — list helpers (batch 4) builtin.

my $result = span $x 
# or in a pipeline:
@list |> map span |> p

# span_fn

span_fn — haskell list functions builtin.

my $result = span_fn $x 
# or in a pipeline:
@list |> map span_fn |> p

# spanf

spanf — haskell list functions builtin. Alias for span_fn.

my $result = spanf $x 
# or in a pipeline:
@list |> map spanf |> p

# spat

spat — algebraic match builtin. Alias for split_at.

my $result = spat $x 
# or in a pipeline:
@list |> map spat |> p

# spbfs

spbfs — extended stdlib builtin. Alias for shortest_path_bfs.

my $result = spbfs $x 
# or in a pipeline:
@list |> map spbfs |> p

# spearman

spearman_correlation(\@x, \@y) (alias spearman) — computes Spearman's rank correlation coefficient between two datasets. Measures monotonic relationships, robust to outliers. Returns a value from -1 to 1.

my @x = (1, 2, 3, 4, 5)
my @y = (5, 6, 7, 8, 7)
p spearman(\@x, \@y)   # high positive correlation

# spectro

spectro — dsp / signal (extended) builtin. Alias for spectrogram.

my $result = spectro $x 
# or in a pipeline:
@list |> map spectro |> p

# spectrogram

spectrogram(\@signal, $window_size, $hop_size) (alias stft) — computes Short-Time Fourier Transform. Returns a 2D arrayref where each row is the spectrum of a windowed segment. Useful for time-frequency analysis.

my $spec = stft(\@audio, 1024, 512)
# $spec->[t][f] is magnitude at time t, frequency f

# speed_distance_time

speed_distance_time — physics formulas builtin.

my $result = speed_distance_time $x 
# or in a pipeline:
@list |> map speed_distance_time |> p

# speed_of_light

speed_of_light — math / physics constants builtin.

my $result = speed_of_light $x 
# or in a pipeline:
@list |> map speed_of_light |> p

# sphere_surface

sphere_surface — geometry / physics builtin.

my $result = sphere_surface $x 
# or in a pipeline:
@list |> map sphere_surface |> p

# sphere_volume

sphere_volume — geometry / physics builtin.

my $result = sphere_volume $x 
# or in a pipeline:
@list |> map sphere_volume |> p

# sphsurf

sphsurf — geometry / physics builtin. Alias for sphere_surface.

my $result = sphsurf $x 
# or in a pipeline:
@list |> map sphsurf |> p

# sphvol

sphvol — geometry / physics builtin. Alias for sphere_volume.

my $result = sphvol $x 
# or in a pipeline:
@list |> map sphvol |> p

# spinner_start

spinner_start — pipeline / string helpers builtin.

my $result = spinner_start $x 
# or in a pipeline:
@list |> map spinner_start |> p

# spinner_stop

spinner_stop — pipeline / string helpers builtin.

my $result = spinner_stop $x 
# or in a pipeline:
@list |> map spinner_stop |> p

# split_at

split_at — algebraic match builtin.

my $result = split_at $x 
# or in a pipeline:
@list |> map split_at |> p

# split_on

split_on — go/general functional utilities builtin.

my $result = split_on $x 
# or in a pipeline:
@list |> map split_on |> p

# split_regex

split_regex — extended stdlib builtin.

my $result = split_regex $x 
# or in a pipeline:
@list |> map split_regex |> p

# split_with

split_with — algebraic match builtin.

my $result = split_with $x 
# or in a pipeline:
@list |> map split_with |> p

# splre

splre — extended stdlib builtin. Alias for split_regex.

my $result = splre $x 
# or in a pipeline:
@list |> map splre |> p

# spon

spon — go/general functional utilities builtin. Alias for split_on.

my $result = spon $x 
# or in a pipeline:
@list |> map spon |> p

# spring_energy

spring_energy — physics formulas builtin.

my $result = spring_energy $x 
# or in a pipeline:
@list |> map spring_energy |> p

# spring_force

spring_force — physics formulas builtin.

my $result = spring_force $x 
# or in a pipeline:
@list |> map spring_force |> p

# springpe

springpe — physics formulas builtin. Alias for spring_energy.

my $result = springpe $x 
# or in a pipeline:
@list |> map springpe |> p

# spw

spw — algebraic match builtin. Alias for split_with.

my $result = spw $x 
# or in a pipeline:
@list |> map spw |> p

# sql

sql — data / network builtin. Alias for sqlite.

my $result = sql $x 
# or in a pipeline:
@list |> map sql |> p

# sqr

sqr — trig / math (batch 2) builtin.

my $result = sqr $x 
# or in a pipeline:
@list |> map sqr |> p

# sqrt2

sqrt2 — math / physics constants builtin.

my $result = sqrt2 $x 
# or in a pipeline:
@list |> map sqrt2 |> p

# sqrt_each

sqrt_each — trivial numeric helpers (batch 4) builtin.

my $result = sqrt_each $x 
# or in a pipeline:
@list |> map sqrt_each |> p

# square_each

square_each — trivial numeric helpers (batch 4) builtin.

my $result = square_each $x 
# or in a pipeline:
@list |> map square_each |> p

# square_root

square_root — math functions builtin.

my $result = square_root $x 
# or in a pipeline:
@list |> map square_root |> p

# squares_seq

squares_seq — sequences builtin.

my $result = squares_seq $x 
# or in a pipeline:
@list |> map squares_seq |> p

# squish

squish — trivial string ops builtin.

my $result = squish $x 
# or in a pipeline:
@list |> map squish |> p

# srton

srton — haskell list functions builtin. Alias for sort_on.

my $result = srton $x 
# or in a pipeline:
@list |> map srton |> p

# stack_new

stack_new — data structure helpers builtin.

my $result = stack_new $x 
# or in a pipeline:
@list |> map stack_new |> p

# standard_error

standard_error — math / numeric (uncategorized batch) builtin.

my $result = standard_error $x 
# or in a pipeline:
@list |> map standard_error |> p

# starmap

starmap — python/ruby stdlib builtin.

my $result = starmap $x 
# or in a pipeline:
@list |> map starmap |> p

# start_of_day

start_of_day — extended stdlib builtin.

my $result = start_of_day $x 
# or in a pipeline:
@list |> map start_of_day |> p

# start_of_hour

start_of_hour — extended stdlib builtin.

my $result = start_of_hour $x 
# or in a pipeline:
@list |> map start_of_hour |> p

# start_of_minute

start_of_minute — extended stdlib builtin.

my $result = start_of_minute $x 
# or in a pipeline:
@list |> map start_of_minute |> p

# starts_with

starts_with — trivial string ops builtin.

my $result = starts_with $x 
# or in a pipeline:
@list |> map starts_with |> p

# starts_with_any

starts_with_any — string (batch 2) builtin.

my $result = starts_with_any $x 
# or in a pipeline:
@list |> map starts_with_any |> p

# stats_describe

stats_describe — statistics (extended) builtin. Alias for describe.

my $result = stats_describe $x 
# or in a pipeline:
@list |> map stats_describe |> p

# stderr_stat

stderr_stat — math / numeric (uncategorized batch) builtin. Alias for standard_error.

my $result = stderr_stat $x 
# or in a pipeline:
@list |> map stderr_stat |> p

# stefan_boltzmann

stefan_boltzmann — physics formulas builtin.

my $result = stefan_boltzmann $x 
# or in a pipeline:
@list |> map stefan_boltzmann |> p

# stefan_boltzmann_constant

stefan_boltzmann_constant — physics constants builtin.

my $result = stefan_boltzmann_constant $x 
# or in a pipeline:
@list |> map stefan_boltzmann_constant |> p

# stefboltz

stefboltz — physics formulas builtin. Alias for stefan_boltzmann.

my $result = stefboltz $x 
# or in a pipeline:
@list |> map stefboltz |> p

# step

step — python/ruby stdlib builtin.

my $result = step $x 
# or in a pipeline:
@list |> map step |> p

# stirling

stirling — math formulas builtin. Alias for stirling_approx.

my $result = stirling $x 
# or in a pipeline:
@list |> map stirling |> p

# stirling2

stirling2 (alias stirling_second) computes the Stirling number of the second kind S(n,k) — the number of ways to partition n elements into k non-empty subsets.

p stirling2(4, 2)   # 7
p stirling2(5, 3)   # 25

# stirling_approx

stirling_approx — math formulas builtin.

my $result = stirling_approx $x 
# or in a pipeline:
@list |> map stirling_approx |> p

# stone_to_kg

stone_to_kg — unit conversions builtin.

my $result = stone_to_kg $input 

# strdist

strdist — string processing (uncategorized batch) builtin. Alias for string_distance.

my $result = strdist $x 
# or in a pipeline:
@list |> map strdist |> p

# strikethrough

strikethrough — color / ansi builtin. Alias for red.

my $result = strikethrough $x 
# or in a pipeline:
@list |> map strikethrough |> p

# string_count

string_count — string helpers (batch 4) builtin.

my $result = string_count $x 
# or in a pipeline:
@list |> map string_count |> p

# string_distance

string_distance — string processing (uncategorized batch) builtin.

my $result = string_distance $x 
# or in a pipeline:
@list |> map string_distance |> p

# string_multiply

string_multiply — string processing (uncategorized batch) builtin.

my $result = string_multiply $x 
# or in a pipeline:
@list |> map string_multiply |> p

# string_sort

string_sort — string helpers (batch 4) builtin.

my $result = string_sort $x 
# or in a pipeline:
@list |> map string_sort |> p

# string_to_chars

string_to_chars — string helpers (batch 4) builtin.

my $result = string_to_chars $input 

# string_unique_chars

string_unique_chars — string helpers (batch 4) builtin.

my $result = string_unique_chars $x 
# or in a pipeline:
@list |> map string_unique_chars |> p

# strip_ansi

strip_ansi — color / ansi builtin.

my $result = strip_ansi $x 
# or in a pipeline:
@list |> map strip_ansi |> p

# strip_html

strip_html — string processing (uncategorized batch) builtin.

my $result = strip_html $x 
# or in a pipeline:
@list |> map strip_html |> p

# strip_prefix

strip_prefix — path helpers builtin.

my $result = strip_prefix $x 
# or in a pipeline:
@list |> map strip_prefix |> p

# strip_suffix

strip_suffix — path helpers builtin.

my $result = strip_suffix $x 
# or in a pipeline:
@list |> map strip_suffix |> p

# strmul

strmul — string processing (uncategorized batch) builtin. Alias for string_multiply.

my $result = strmul $x 
# or in a pipeline:
@list |> map strmul |> p

# student_pdf

t_pdf (alias tpdf) evaluates Student's t-distribution PDF at x with nu degrees of freedom.

p tpdf(0, 10)    # peak of t(10)
p tpdf(2.228, 10)

# sub

The sub keyword is not supported in stryke. Use fn instead to define functions.

# sub_script

sub_script — encoding / phonetics builtin. Alias for subscript.

my $result = sub_script $x 
# or in a pipeline:
@list |> map sub_script |> p

# subfact

subfact — math / numeric (uncategorized batch) builtin. Alias for subfactorial.

my $result = subfact $x 
# or in a pipeline:
@list |> map subfact |> p

# subfactorial

subfactorial — math / numeric (uncategorized batch) builtin.

my $result = subfactorial $x 
# or in a pipeline:
@list |> map subfactorial |> p

# subscript

subscript — encoding / phonetics builtin.

my $result = subscript $x 
# or in a pipeline:
@list |> map subscript |> p

# subseqs

subseqs — additional missing stdlib functions builtin. Alias for subsequences.

my $result = subseqs $x 
# or in a pipeline:
@list |> map subseqs |> p

# subsequences

subsequences — additional missing stdlib functions builtin.

my $result = subsequences $x 
# or in a pipeline:
@list |> map subsequences |> p

# substring

substring — string helpers (batch 4) builtin.

my $result = substring $x 
# or in a pipeline:
@list |> map substring |> p

# succ

succ — conversion / utility (batch 4) builtin.

my $result = succ $x 
# or in a pipeline:
@list |> map succ |> p

# suffix_sums

suffix_sums — list helpers (batch 4) builtin.

my $result = suffix_sums $x 
# or in a pipeline:
@list |> map suffix_sums |> p

# sum_by

sum_by — python/ruby stdlib builtin.

my $result = sum_by $x 
# or in a pipeline:
@list |> map sum_by |> p

# sum_divisors

sum_divisors — math / numeric (uncategorized batch) builtin.

my $result = sum_divisors $x 
# or in a pipeline:
@list |> map sum_divisors |> p

# sum_list

sum_list — list helpers (batch 4) builtin.

my $result = sum_list $x 
# or in a pipeline:
@list |> map sum_list |> p

# sum_of

sum_of — more list helpers builtin.

my $result = sum_of $x 
# or in a pipeline:
@list |> map sum_of |> p

# sum_squares

sum_squares — extended stdlib builtin.

my $result = sum_squares $x 
# or in a pipeline:
@list |> map sum_squares |> p

# sumb

sumb — python/ruby stdlib builtin. Alias for sum_by.

my $result = sumb $x 
# or in a pipeline:
@list |> map sumb |> p

# sumsq

sumsq — extended stdlib builtin. Alias for sum_squares.

my $result = sumsq $x 
# or in a pipeline:
@list |> map sumsq |> p

# sun_radius

sun_radius — physics constants builtin.

my $result = sun_radius $x 
# or in a pipeline:
@list |> map sun_radius |> p

# sup

sup — encoding / phonetics builtin. Alias for superscript.

my $result = sup $x 
# or in a pipeline:
@list |> map sup |> p

# supergolden

supergolden — math constants builtin. Alias for supergolden_ratio.

my $result = supergolden $x 
# or in a pipeline:
@list |> map supergolden |> p

# supergolden_ratio

supergolden_ratio — math constants builtin.

my $result = supergolden_ratio $x 
# or in a pipeline:
@list |> map supergolden_ratio |> p

# superscript

superscript — encoding / phonetics builtin.

my $result = superscript $x 
# or in a pipeline:
@list |> map superscript |> p

# sw

sw — trivial string ops builtin. Alias for starts_with.

my $result = sw $x 
# or in a pipeline:
@list |> map sw |> p

# swap_case

swap_case — trivial string ops builtin.

my $result = swap_case $x 
# or in a pipeline:
@list |> map swap_case |> p

# swap_free

swap_free — free swap space in bytes.

p format_bytes(swap_free)
my $pct = swap_total > 0 ? int(swap_free / swap_total * 100) : 100
p "$pct% swap free"

# swap_pairs

swap_pairs — collection helpers (trivial) builtin.

my $result = swap_pairs $x 
# or in a pipeline:
@list |> map swap_pairs |> p

# swap_total

swap_total — total swap space in bytes. Linux: /proc/meminfo SwapTotal. macOS: vm.swapusage sysctl. Returns 0 if swap is disabled, undef on unsupported platforms.

p swap_total                             # 8589934592
p format_bytes(swap_total)               # 8.0 GiB

# swap_used

swap_used — used swap space in bytes (total - free).

p format_bytes(swap_used)
p "swap pressure" if swap_used > swap_total * 0.8

# sym_links

sym_links — filesystem extensions builtin.

my $result = sym_links $x 
# or in a pipeline:
@list |> map sym_links |> p

# symmetric_diff

symmetric_diff — collection (batch 2) builtin.

my $result = symmetric_diff $x 
# or in a pipeline:
@list |> map symmetric_diff |> p

# sys_uptime

sys_uptime — system uptime in seconds (float). On Linux reads /proc/uptime. On macOS uses kern.boottime sysctl. This is the wall-clock uptime of the machine, not the stryke process (see uptime_secs for process uptime).

p sys_uptime                             # 147951.5
my $days = int(sys_uptime / 86400)
p "up $days days"

# t_test_one_sample

t_test_one_sample($mu, @sample) (alias ttest1) — performs a one-sample t-test comparing a sample mean against a hypothesized population mean mu. Returns [t_statistic, degrees_of_freedom]. Use t-distribution tables for p-value lookup.

my @sample = (5.1, 4.9, 5.2, 5.0, 4.8)
my $result = ttest1(5.0, @sample)
p "t=$result->[0] df=$result->[1]"

# t_test_two_sample

t_test_two_sample(\@a, \@b) (alias ttest2) — performs an independent two-sample t-test comparing means of two samples. Assumes equal variances. Returns [t_statistic, degrees_of_freedom].

my @a = (5.1, 5.3, 4.9)
my @b = (4.2, 4.5, 4.1)
my $r = ttest2(\@a, \@b)
p "t=$r->[0] df=$r->[1]"

# tabulate

tabulate — frequency table of values. Returns hash of value => count. Like R's table().

my %t = %{tabulate([qw(a b a c b a)])}
p $t{a}  # 3

# tail_lines

tail_lines — file stat / path builtin.

my $result = tail_lines $x 
# or in a pipeline:
@list |> map tail_lines |> p

# tail_n

tail_n — list helpers (batch 4) builtin.

my $result = tail_n $x 
# or in a pipeline:
@list |> map tail_n |> p

# tail_str

tail_str — string (batch 2) builtin. Alias for right_str.

my $result = tail_str $x 
# or in a pipeline:
@list |> map tail_str |> p

# tails

tails — additional missing stdlib functions builtin.

my $result = tails $x 
# or in a pipeline:
@list |> map tails |> p

# take_every

take_every — list helpers (batch 4) builtin.

my $result = take_every $x 
# or in a pipeline:
@list |> map take_every |> p

# take_last

take_last — file stat / path builtin.

my $result = take_last $x 
# or in a pipeline:
@list |> map take_last |> p

# take_n

take_n — collection helpers (trivial) builtin.

my $result = take_n $x 
# or in a pipeline:
@list |> map take_n |> p

# talb

talb — ruby enumerable extras builtin. Alias for tally_by.

my $result = talb $x 
# or in a pipeline:
@list |> map talb |> p

# tally_by

tally_by — ruby enumerable extras builtin.

my $result = tally_by $x 
# or in a pipeline:
@list |> map tally_by |> p

# tan

tan — trig / math (batch 2) builtin.

my $result = tan $x 
# or in a pipeline:
@list |> map tan |> p

# tanh

tanh — trig / math (batch 2) builtin.

my $result = tanh $x 
# or in a pipeline:
@list |> map tanh |> p

# tap_debug

tap_debug — conversion / utility (batch 4) builtin.

my $result = tap_debug $x 
# or in a pipeline:
@list |> map tap_debug |> p

# tap_val

tap_val — functional combinators builtin.

my $result = tap_val $x 
# or in a pipeline:
@list |> map tap_val |> p

# tapply

tapply — apply a function by group. Takes data, group labels, and function. Returns hash. Like R's tapply().

my %means = %{tapply([1,2,3,4], ["a","a","b","b"], fn { avg(@{$_[0]}) })}
p $means{a}  # 1.5
p $means{b}  # 3.5

# tau

tau — constants builtin.

my $result = tau $x 
# or in a pipeline:
@list |> map tau |> p

# tax

tax — finance builtin.

my $result = tax $x 
# or in a pipeline:
@list |> map tax |> p

# tax_amount

tax_amount — physics formulas builtin.

my $result = tax_amount $x 
# or in a pipeline:
@list |> map tax_amount |> p

# tcrossprod

tcrossprod — M * t(M) (R's tcrossprod).

my $aat = tcrossprod([[1,2],[3,4]])  # [[5,11],[11,25]]

# td

td — serialization (stryke-only encoders) builtin. Alias for toml_decode.

my $result = td $x 
# or in a pipeline:
@list |> map td |> p

# tdilate

time_dilation($proper_time, $velocity) (alias tdilate) — dilated time Δt = Δt₀ × γ. Time appears to slow for moving objects.

p tdilate(1, 0.99 * 3e8)   # ~7.09 s (1 second at 99% c)

# te

te — serialization (stryke-only encoders) builtin. Alias for toml_encode.

my $result = te $x 
# or in a pipeline:
@list |> map te |> p

# tee_iter

tee_iter — python/ruby stdlib builtin.

my $result = tee_iter $x 
# or in a pipeline:
@list |> map tee_iter |> p

# teei

teei — python/ruby stdlib builtin. Alias for tee_iter.

my $result = teei $x 
# or in a pipeline:
@list |> map teei |> p

# temp_dir

temp_dir — system introspection builtin.

my $result = temp_dir $x 
# or in a pipeline:
@list |> map temp_dir |> p

# tempplanck

tempplanck — physics constants builtin. Alias for planck_temperature.

my $result = tempplanck $x 
# or in a pipeline:
@list |> map tempplanck |> p

# text_after

text_after — extended stdlib builtin.

my $result = text_after $x 
# or in a pipeline:
@list |> map text_after |> p

# text_after_last

text_after_last — extended stdlib builtin.

my $result = text_after_last $x 
# or in a pipeline:
@list |> map text_after_last |> p

# text_before

text_before — extended stdlib builtin.

my $result = text_before $x 
# or in a pipeline:
@list |> map text_before |> p

# text_before_last

text_before_last — extended stdlib builtin.

my $result = text_before_last $x 
# or in a pipeline:
@list |> map text_before_last |> p

# text_between

text_between — extended stdlib builtin.

my $result = text_between $x 
# or in a pipeline:
@list |> map text_between |> p

# tfld

tfld — rust iterator methods builtin. Alias for try_fold.

my $result = tfld $x 
# or in a pipeline:
@list |> map tfld |> p

# then_fn

then_fn — python/ruby stdlib builtin.

my $result = then_fn $x 
# or in a pipeline:
@list |> map then_fn |> p

# thfn

thfn — python/ruby stdlib builtin. Alias for then_fn.

my $result = thfn $x 
# or in a pipeline:
@list |> map thfn |> p

# thin_lens

thin_lens($object_dist, $focal_length) (alias thinlens) — image distance using 1/f = 1/do + 1/di.

p thinlens(30, 20)   # 60 cm (real image)
p thinlens(10, 20)   # -20 cm (virtual image)

# third_elem

third_elem — list helpers (batch 4) builtin.

my $result = third_elem $x 
# or in a pipeline:
@list |> map third_elem |> p

# tied

tied — type / reflection builtin.

my $result = tied $x 
# or in a pipeline:
@list |> map tied |> p

# times_fn

times_fn — python/ruby stdlib builtin.

my $result = times_fn $x 
# or in a pipeline:
@list |> map times_fn |> p

# timf

timf — python/ruby stdlib builtin. Alias for times_fn.

my $result = timf $x 
# or in a pipeline:
@list |> map timf |> p

# tip

tip — finance builtin.

my $result = tip $x 
# or in a pipeline:
@list |> map tip |> p

# tip_amount

tip_amount — physics formulas builtin.

my $result = tip_amount $x 
# or in a pipeline:
@list |> map tip_amount |> p

# title

title — trivial string ops builtin. Alias for title_case.

my $result = title $x 
# or in a pipeline:
@list |> map title |> p

# title_case

title_case — trivial string ops builtin.

my $result = title_case $x 
# or in a pipeline:
@list |> map title_case |> p

# tkeys

tkeys — python/ruby stdlib builtin. Alias for transform_keys.

my $result = tkeys $x 
# or in a pipeline:
@list |> map tkeys |> p

# to_array

to_array — list helpers (batch 4) builtin.

my $result = to_array $input 

# to_ascii

to_ascii — extended stdlib builtin.

my $result = to_ascii $input 

# to_base

to_base — base conversion builtin.

my $result = to_base $input 

# to_bin

to_bin — base conversion builtin.

my $result = to_bin $input 

# to_bool

to_bool — conversion / utility (batch 4) builtin.

my $result = to_bool $input 

# to_csv_line

to_csv_line — string helpers (batch 4) builtin.

my $result = to_csv_line $input 

# to_emoji_num

to_emoji_num — encoding / phonetics builtin.

my $result = to_emoji_num $input 

# to_float

to_float — conversion / utility (batch 4) builtin.

my $result = to_float $input 

# to_float_each

to_float_each — trivial numeric helpers (batch 4) builtin.

my $result = to_float_each $input 

# to_hash

to_hash LIST — collect a flat list of key-value pairs into a Perl hash.

The list is consumed two elements at a time: odd-positioned elements become keys and even-positioned elements become values. If there is an odd number of elements, the last key maps to undef. This is a terminal operation that materializes the full stream. Useful for converting pipeline output into a lookup table.

my %h = qw(a 1 b 2) |> to_hash
@pairs |> to_hash
my %freq = @words |> map { _, 1 } |> to_hash

# to_hex

to_hex — base conversion builtin.

my $result = to_hex $input 

# to_int

to_int — conversion / utility (batch 4) builtin.

my $result = to_int $input 

# to_int_each

to_int_each — trivial numeric helpers (batch 4) builtin.

my $result = to_int_each $input 

# to_oct

to_oct — base conversion builtin.

my $result = to_oct $input 

# to_pairs

to_pairs — list helpers (batch 4) builtin.

my $result = to_pairs $input 

# to_reversed

to_reversed — javascript array/object methods builtin.

my $result = to_reversed $input 

# to_set

to_set LIST — collect a list or iterator into a set object with O(1) membership testing.

The resulting set contains only unique elements (duplicates are discarded). This is a terminal operation that materializes the full stream. The returned set supports ->contains($val), ->union($other), ->intersection($other), and ->difference($other). Use this when you need fast repeated lookups against a collection of values.

my $s = 1:5 |> to_set
@words |> to_set                      # deduplicated set
my $allowed = to_set @whitelist
p $allowed->contains("foo")

# to_sorted

to_sorted — javascript array/object methods builtin.

my $result = to_sorted $input 

# to_spliced

to_spliced — javascript array/object methods builtin.

my $result = to_spliced $input 

# to_string

to_string — conversion / utility (batch 4) builtin.

my $result = to_string $input 

# to_string_val

to_string_val — misc / utility builtin.

my $result = to_string_val $input 

# toasc

toasc — extended stdlib builtin. Alias for to_ascii.

my $result = toasc $x 
# or in a pipeline:
@list |> map toasc |> p

# today

today — date (batch 2) builtin.

my $result = today $x 
# or in a pipeline:
@list |> map today |> p

# token

token — id helpers builtin.

my $result = token $x 
# or in a pipeline:
@list |> map token |> p

# tomorrow

tomorrow — date (batch 2) builtin.

my $result = tomorrow $x 
# or in a pipeline:
@list |> map tomorrow |> p

# top

top — pipeline / string helpers builtin.

my $result = top $x 
# or in a pipeline:
@list |> map top |> p

# topological_sort

topological_sort — extended stdlib builtin.

my $result = topological_sort $x 
# or in a pipeline:
@list |> map topological_sort |> p

# toposort

toposort — extended stdlib builtin. Alias for topological_sort.

my $result = toposort $x 
# or in a pipeline:
@list |> map toposort |> p

# torque

torque($force, $lever_arm, $angle) — compute torque τ = r×F×sin(θ) (N⋅m). Angle in degrees, default 90.

p torque(50, 0.5)     # 25 N⋅m (perpendicular force)
p torque(50, 0.5, 30) # 12.5 N⋅m

# torus_surface

torus_surface($major_r, $minor_r) — computes the surface area of a torus. Returns 4π²Rr.

p torus_surface(10, 2)   # ~789.6

# torus_volume

torus_volume($major_r, $minor_r) — computes the volume of a torus with major radius R (center to tube center) and minor radius r (tube radius). Returns 2π²Rr².

p torus_volume(10, 2)   # ~789.6

# torussurf

torussurf — geometry (extended) builtin. Alias for torus_surface.

my $result = torussurf $x 
# or in a pipeline:
@list |> map torussurf |> p

# torusvol

torusvol — geometry (extended) builtin. Alias for torus_volume.

my $result = torusvol $x 
# or in a pipeline:
@list |> map torusvol |> p

# totient_sum

totient_sum — math / numeric (uncategorized batch) builtin.

my $result = totient_sum $x 
# or in a pipeline:
@list |> map totient_sum |> p

# totsum

totsum — math / numeric (uncategorized batch) builtin. Alias for totient_sum.

my $result = totsum $x 
# or in a pipeline:
@list |> map totsum |> p

# touch

touch — filesystem extensions builtin.

my $result = touch $x 
# or in a pipeline:
@list |> map touch |> p

# tower_of_hanoi

tower_of_hanoi — algorithms / puzzles builtin.

my $result = tower_of_hanoi $x 
# or in a pipeline:
@list |> map tower_of_hanoi |> p

# tplanck

tplanck — physics constants builtin. Alias for planck_time.

my $result = tplanck $x 
# or in a pipeline:
@list |> map tplanck |> p

# trailing_zeros

trailing_zeros — base conversion builtin.

my $result = trailing_zeros $x 
# or in a pipeline:
@list |> map trailing_zeros |> p

# transform_keys

transform_keys — python/ruby stdlib builtin.

my $result = transform_keys $x 
# or in a pipeline:
@list |> map transform_keys |> p

# transform_values

transform_values — python/ruby stdlib builtin.

my $result = transform_values $x 
# or in a pipeline:
@list |> map transform_values |> p

# translate_point

translate_point($x, $y, $dx, $dy) — translates a 2D point by offset (dx, dy). Returns [$x+$dx, $y+$dy]. Basic vector addition.

my $p = translate_point(1, 2, 3, 4)
p @$p   # (4, 6)

# transpose

transpose — collection more builtin.

my $result = transpose $x 
# or in a pipeline:
@list |> map transpose |> p

# transpt

transpt — geometry (extended) builtin. Alias for translate_point.

my $result = transpt $x 
# or in a pipeline:
@list |> map transpt |> p

# trapezoid

trapz (alias trapezoid) integrates evenly-spaced samples using the trapezoidal rule. Optional dx (default 1).

my @y = map { _ ** 2 } 0:100
p trapz(\@y, 0.01)  # ≈ 0.3333

# trev

trev — javascript array/object methods builtin. Alias for to_reversed.

my $result = trev $x 
# or in a pipeline:
@list |> map trev |> p

# triangle_hypotenuse

triangle_hypotenuse — geometry / physics builtin.

my $result = triangle_hypotenuse $x 
# or in a pipeline:
@list |> map triangle_hypotenuse |> p

# triangular_number

triangular_number — number theory / primes builtin.

my $result = triangular_number $x 
# or in a pipeline:
@list |> map triangular_number |> p

# triangular_seq

triangular_seq — sequences builtin.

my $result = triangular_seq $x 
# or in a pipeline:
@list |> map triangular_seq |> p

# trib

trib — math / numeric (uncategorized batch) builtin. Alias for tribonacci.

my $result = trib $x 
# or in a pipeline:
@list |> map trib |> p

# tribonacci

tribonacci — math / numeric (uncategorized batch) builtin.

my $result = tribonacci $x 
# or in a pipeline:
@list |> map tribonacci |> p

# trigram

trigram — string processing (uncategorized batch) builtin. Alias for trigrams.

my $result = trigram $x 
# or in a pipeline:
@list |> map trigram |> p

# trigrams

trigrams — string processing (uncategorized batch) builtin.

my $result = trigrams $x 
# or in a pipeline:
@list |> map trigrams |> p

# trim_each

trim_each — trivial numeric helpers (batch 4) builtin.

my $result = trim_each $x 
# or in a pipeline:
@list |> map trim_each |> p

# trim_left

trim_left — string helpers (batch 4) builtin.

my $result = trim_left $x 
# or in a pipeline:
@list |> map trim_left |> p

# trim_right

trim_right — string helpers (batch 4) builtin.

my $result = trim_right $x 
# or in a pipeline:
@list |> map trim_right |> p

# trimmed_mean

trimmed_mean — list helpers (batch 4) builtin.

my $result = trimmed_mean $x 
# or in a pipeline:
@list |> map trimmed_mean |> p

# trinum

trinum — number theory / primes builtin. Alias for triangular_number.

my $result = trinum $x 
# or in a pipeline:
@list |> map trinum |> p

# triple

triple — trivial numeric / predicate builtins builtin.

my $result = triple $x 
# or in a pipeline:
@list |> map triple |> p

# trunc

trunc — trivial numeric / predicate builtins builtin.

my $result = trunc $x 
# or in a pipeline:
@list |> map trunc |> p

# truncate_at

truncate_at — trivial string ops builtin.

my $result = truncate_at $x 
# or in a pipeline:
@list |> map truncate_at |> p

# truncn

truncn — trivial numeric / predicate builtins builtin. Alias for trunc.

my $result = truncn $x 
# or in a pipeline:
@list |> map truncn |> p

# truth_table

truth_table — algorithms / puzzles builtin.

my $result = truth_table $x 
# or in a pipeline:
@list |> map truth_table |> p

# truthy_count

truthy_count — counters (batch 4) builtin.

my $result = truthy_count $x 
# or in a pipeline:
@list |> map truthy_count |> p

# try_fn

try_fn — functional combinators builtin.

my $result = try_fn $x 
# or in a pipeline:
@list |> map try_fn |> p

# try_fold

try_fold — rust iterator methods builtin.

my $result = try_fold $x 
# or in a pipeline:
@list |> map try_fold |> p

# tspl

tspl — javascript array/object methods builtin. Alias for to_spliced.

my $result = tspl $x 
# or in a pipeline:
@list |> map tspl |> p

# tsrt

tsrt — javascript array/object methods builtin. Alias for to_sorted.

my $result = tsrt $x 
# or in a pipeline:
@list |> map tsrt |> p

# tstr

tstr — misc / utility builtin. Alias for to_string_val.

my $result = tstr $x 
# or in a pipeline:
@list |> map tstr |> p

# ttable

ttable — algorithms / puzzles builtin. Alias for truth_table.

my $result = ttable $x 
# or in a pipeline:
@list |> map ttable |> p

# tvals

tvals — python/ruby stdlib builtin. Alias for transform_values.

my $result = tvals $x 
# or in a pipeline:
@list |> map tvals |> p

# twin_primes

twin_primes — number theory / primes builtin.

my $result = twin_primes $x 
# or in a pipeline:
@list |> map twin_primes |> p

# twinp

twinp — number theory / primes builtin. Alias for twin_primes.

my $result = twinp $x 
# or in a pipeline:
@list |> map twinp |> p

# txaft

txaft — extended stdlib builtin. Alias for text_after.

my $result = txaft $x 
# or in a pipeline:
@list |> map txaft |> p

# txaftl

txaftl — extended stdlib builtin. Alias for text_after_last.

my $result = txaftl $x 
# or in a pipeline:
@list |> map txaftl |> p

# txbef

txbef — extended stdlib builtin. Alias for text_before.

my $result = txbef $x 
# or in a pipeline:
@list |> map txbef |> p

# txbefl

txbefl — extended stdlib builtin. Alias for text_before_last.

my $result = txbefl $x 
# or in a pipeline:
@list |> map txbefl |> p

# txbtwn

txbtwn — extended stdlib builtin. Alias for text_between.

my $result = txbtwn $x 
# or in a pipeline:
@list |> map txbtwn |> p

# type_each

type_each — trivial numeric helpers (batch 4) builtin.

my $result = type_each $x 
# or in a pipeline:
@list |> map type_each |> p

# type_of

type_of — misc / utility builtin.

my $result = type_of $x 
# or in a pipeline:
@list |> map type_of |> p

# typeof

typeof — misc / utility builtin. Alias for type_of.

my $result = typeof $x 
# or in a pipeline:
@list |> map typeof |> p

# tz

tz — base conversion builtin. Alias for trailing_zeros.

my $result = tz $x 
# or in a pipeline:
@list |> map tz |> p

# ubound

ubound — extended stdlib builtin. Alias for upper_bound.

my $result = ubound $x 
# or in a pipeline:
@list |> map ubound |> p

# ud

ud — crypto / encoding builtin. Alias for url_decode.

my $result = ud $x 
# or in a pipeline:
@list |> map ud |> p

# ue

ue — crypto / encoding builtin. Alias for url_encode.

my $result = ue $x 
# or in a pipeline:
@list |> map ue |> p

# ugz

ugz — crypto / encoding builtin. Alias for gunzip.

my $result = ugz $x 
# or in a pipeline:
@list |> map ugz |> p

# uid

uid — system introspection builtin.

my $result = uid $x 
# or in a pipeline:
@list |> map uid |> p

# uin

uin — algebraic match builtin. Alias for update_in.

my $result = uin $x 
# or in a pipeline:
@list |> map uin |> p

# undef_count

undef_count — counters (batch 4) builtin.

my $result = undef_count $x 
# or in a pipeline:
@list |> map undef_count |> p

# underline

underline — color / ansi builtin. Alias for red.

my $result = underline $x 
# or in a pipeline:
@list |> map underline |> p

# unfold

unfold — functional combinators builtin.

my $result = unfold $x 
# or in a pipeline:
@list |> map unfold |> p

# unfoldr

unfoldr — haskell list functions builtin.

my $result = unfoldr $x 
# or in a pipeline:
@list |> map unfoldr |> p

# unfr

unfr — haskell list functions builtin. Alias for unfoldr.

my $result = unfr $x 
# or in a pipeline:
@list |> map unfr |> p

# union_list

union_list — additional missing stdlib functions builtin.

my $result = union_list $x 
# or in a pipeline:
@list |> map union_list |> p

# unionl

unionl — additional missing stdlib functions builtin. Alias for union_list.

my $result = unionl $x 
# or in a pipeline:
@list |> map unionl |> p

# uniq_by

uniq_by — python/ruby stdlib builtin.

my $result = uniq_by $x 
# or in a pipeline:
@list |> map uniq_by |> p

# unique_count_of

unique_count_of — list helpers (batch 4) builtin.

my $result = unique_count_of $x 
# or in a pipeline:
@list |> map unique_count_of |> p

# unique_words

unique_words — string processing (uncategorized batch) builtin.

my $result = unique_words $x 
# or in a pipeline:
@list |> map unique_words |> p

# uniqw

uniqw — string processing (uncategorized batch) builtin. Alias for unique_words.

my $result = uniqw $x 
# or in a pipeline:
@list |> map uniqw |> p

# unit_vec

unit_vec — matrix / linear algebra builtin. Alias for vec_normalize.

my $result = unit_vec $x 
# or in a pipeline:
@list |> map unit_vec |> p

# unix_epoch

unix_epoch — now / timestamp builtin.

my $result = unix_epoch $x 
# or in a pipeline:
@list |> map unix_epoch |> p

# unix_epoch_ms

unix_epoch_ms — now / timestamp builtin.

my $result = unix_epoch_ms $x 
# or in a pipeline:
@list |> map unix_epoch_ms |> p

# unlines

unlines — go/general functional utilities builtin.

my $result = unlines $x 
# or in a pipeline:
@list |> map unlines |> p

# unlns

unlns — go/general functional utilities builtin. Alias for unlines.

my $result = unlns $x 
# or in a pipeline:
@list |> map unlns |> p

# unquote

unquote — string quote / escape builtin.

my $result = unquote $x 
# or in a pipeline:
@list |> map unquote |> p

# untie

untie — type / reflection builtin.

my $result = untie $x 
# or in a pipeline:
@list |> map untie |> p

# unwds

unwds — go/general functional utilities builtin. Alias for unwords.

my $result = unwds $x 
# or in a pipeline:
@list |> map unwds |> p

# unwords

unwords — go/general functional utilities builtin.

my $result = unwords $x 
# or in a pipeline:
@list |> map unwords |> p

# unzip

unzip — collection more builtin.

my $result = unzip $x 
# or in a pipeline:
@list |> map unzip |> p

# unzip_archive

unzip_archive — crypto / encoding builtin. Alias for zip_extract.

my $result = unzip_archive $x 
# or in a pipeline:
@list |> map unzip_archive |> p

# unzip_pairs

unzip_pairs — go/general functional utilities builtin.

my $result = unzip_pairs $x 
# or in a pipeline:
@list |> map unzip_pairs |> p

# upcase_each

upcase_each — trivial numeric helpers (batch 4) builtin.

my $result = upcase_each $x 
# or in a pipeline:
@list |> map upcase_each |> p

# upda

upda — go/general functional utilities builtin. Alias for update_at.

my $result = upda $x 
# or in a pipeline:
@list |> map upda |> p

# update_at

update_at — go/general functional utilities builtin.

my $result = update_at $x 
# or in a pipeline:
@list |> map update_at |> p

# update_in

update_in — algebraic match builtin.

my $result = update_in $x 
# or in a pipeline:
@list |> map update_in |> p

# upper_bound

upper_bound — extended stdlib builtin.

my $result = upper_bound $x 
# or in a pipeline:
@list |> map upper_bound |> p

# upper_snake

upper_snake — string (batch 2) builtin. Alias for constant_case.

my $result = upper_snake $x 
# or in a pipeline:
@list |> map upper_snake |> p

# uppercase

uppercase — string (batch 2) builtin.

my $result = uppercase $x 
# or in a pipeline:
@list |> map uppercase |> p

# upsample

upsample(\@signal, $factor) (alias interpolate) — increases sample rate by inserting zeros and filtering. Factor must be positive integer.

my $upsampled = interpolate(\@signal, 4)  # 4x sample rate

# uptime_secs

uptime_secs — more process / system builtin.

my $result = uptime_secs $x 
# or in a pipeline:
@list |> map uptime_secs |> p

# upto

upto — python/ruby stdlib builtin.

my $result = upto $x 
# or in a pipeline:
@list |> map upto |> p

# uqb

uqb — python/ruby stdlib builtin. Alias for uniq_by.

my $result = uqb $x 
# or in a pipeline:
@list |> map uqb |> p

# url_host

url_host — url / email parts builtin.

my $result = url_host $x 
# or in a pipeline:
@list |> map url_host |> p

# url_path

url_path — url / email parts builtin.

my $result = url_path $x 
# or in a pipeline:
@list |> map url_path |> p

# url_query

url_query — url / email parts builtin.

my $result = url_query $x 
# or in a pipeline:
@list |> map url_query |> p

# url_scheme

url_scheme — url / email parts builtin.

my $result = url_scheme $x 
# or in a pipeline:
@list |> map url_scheme |> p

# urld

urld — extended stdlib builtin.

my $result = urld $x 
# or in a pipeline:
@list |> map urld |> p

# urle

urle — extended stdlib builtin.

my $result = urle $x 
# or in a pipeline:
@list |> map urle |> p

# us_to_ns

us_to_ns — file stat / path builtin.

my $result = us_to_ns $input 

# usamp

usamp — dsp / signal (extended) builtin. Alias for upsample.

my $result = usamp $x 
# or in a pipeline:
@list |> map usamp |> p

# username

username — system introspection builtin.

my $result = username $x 
# or in a pipeline:
@list |> map username |> p

# utc

utc — date / time builtin. Alias for datetime_utc.

my $result = utc $x 
# or in a pipeline:
@list |> map utc |> p

# uuid_v4

uuid_v4 — id helpers builtin.

my $result = uuid_v4 $x 
# or in a pipeline:
@list |> map uuid_v4 |> p

# uzp

uzp — go/general functional utilities builtin. Alias for unzip_pairs.

my $result = uzp $x 
# or in a pipeline:
@list |> map uzp |> p

# uzst

uzst — crypto / encoding builtin. Alias for zstd_decode.

my $result = uzst $x 
# or in a pipeline:
@list |> map uzst |> p

# vacuum_permeability

vacuum_permeability — physics constants builtin.

my $result = vacuum_permeability $x 
# or in a pipeline:
@list |> map vacuum_permeability |> p

# values_at

values_at — python/ruby stdlib builtin.

my $result = values_at $x 
# or in a pipeline:
@list |> map values_at |> p

# values_sorted

values_sorted — hash ops (batch 2) builtin.

my $result = values_sorted $x 
# or in a pipeline:
@list |> map values_sorted |> p

# vang

vang — geometry (extended) builtin. Alias for vector_angle.

my $result = vang $x 
# or in a pipeline:
@list |> map vang |> p

# vat

vat — python/ruby stdlib builtin. Alias for values_at.

my $result = vat $x 
# or in a pipeline:
@list |> map vat |> p

# vcross

vector_cross(\@a, \@b) (alias vcross) — computes the cross product of two 3D vectors. Returns a 3-element arrayref perpendicular to both inputs.

my $c = vcross([1,0,0], [0,1,0])
p @$c   # (0, 0, 1)

# vdot

vector_dot(\@a, \@b) (alias vdot) — computes the dot product of two vectors. Returns the scalar sum of element-wise products.

p vdot([1,2,3], [4,5,6])   # 32

# vec_add

vec_add — matrix / linear algebra builtin.

my $result = vec_add $x 
# or in a pipeline:
@list |> map vec_add |> p

# vec_clj

vec_clj — algebraic match builtin.

my $result = vec_clj $x 
# or in a pipeline:
@list |> map vec_clj |> p

# vec_normalize

vec_normalize — matrix / linear algebra builtin.

my $result = vec_normalize $x 
# or in a pipeline:
@list |> map vec_normalize |> p

# vec_scale

vec_scale — matrix / linear algebra builtin.

my $result = vec_scale $x 
# or in a pipeline:
@list |> map vec_scale |> p

# vec_sub

vec_sub — matrix / linear algebra builtin.

my $result = vec_sub $x 
# or in a pipeline:
@list |> map vec_sub |> p

# vecc

vecc — algebraic match builtin. Alias for vec_clj.

my $result = vecc $x 
# or in a pipeline:
@list |> map vecc |> p

# vector_angle

vector_angle(\@a, \@b) (alias vangle) — computes the angle in radians between two vectors using the dot product formula.

p vangle([1,0], [0,1])   # ~1.5708 (π/2)
p vangle([1,0], [1,0])   # 0

# vector_magnitude

vector_magnitude(\@v) (alias vmag) — computes the Euclidean length (L2 norm) of a vector.

p vmag([3, 4])   # 5
p vmag([1, 2, 2])   # 3

# vector_normalize

vector_normalize(\@v) (alias vnorm) — returns a unit vector in the same direction. Divides by magnitude.

my $u = vnorm([3, 4])
p @$u   # (0.6, 0.8)

# versin

versin — trig extensions builtin.

my $result = versin $x 
# or in a pipeline:
@list |> map versin |> p

# versine

versine — trig extensions builtin. Alias for versin.

my $result = versine $x 
# or in a pipeline:
@list |> map versine |> p

# version_cmp

version_cmp — file stat / path builtin. Alias for compare_versions.

my $result = version_cmp $x 
# or in a pipeline:
@list |> map version_cmp |> p

# void

void — conversion / utility (batch 4) builtin.

my $result = void $x 
# or in a pipeline:
@list |> map void |> p

# wacc

wacc($equity, $debt, $cost_equity, $cost_debt, $tax_rate) — computes Weighted Average Cost of Capital. Returns the blended cost of capital accounting for the tax shield on debt.

p wacc(60, 40, 0.10, 0.05, 0.25)   # ~7.5%

# watts_to_hp

watts_to_hp — file stat / path builtin.

my $result = watts_to_hp $input 

# wavelength_freq

wavelength_freq — physics formulas builtin.

my $result = wavelength_freq $x 
# or in a pipeline:
@list |> map wavelength_freq |> p

# wc

wc — trivial string ops builtin. Alias for word_count.

my $result = wc $x 
# or in a pipeline:
@list |> map wc |> p

# wcount

wcount — extended stdlib batch 3 builtin. Alias for count_words.

my $result = wcount $x 
# or in a pipeline:
@list |> map wcount |> p

# week_of_year

week_of_year — extended stdlib batch 3 builtin.

my $result = week_of_year $x 
# or in a pipeline:
@list |> map week_of_year |> p

# weekday_name

weekday_name — date helpers builtin.

my $result = weekday_name $x 
# or in a pipeline:
@list |> map weekday_name |> p

# weekday_short

weekday_short — date helpers builtin.

my $result = weekday_short $x 
# or in a pipeline:
@list |> map weekday_short |> p

# weibpdf

weibull_pdf (alias weibpdf) evaluates the Weibull distribution PDF at x with shape k and scale lambda.

p weibpdf(1.0, 1.5, 1.0)

# weighted_mean

weighted_mean — math / numeric (uncategorized batch) builtin.

my $result = weighted_mean $x 
# or in a pipeline:
@list |> map weighted_mean |> p

# weighted_sample

weighted_sample — extended stdlib builtin.

my $result = weighted_sample $x 
# or in a pipeline:
@list |> map weighted_sample |> p

# weighted_var

weighted_var — weighted variance. Args: values, weights.

p wvar([1,2,3,4], [1,1,1,1])  # same as var

# welch_ttest

welch_ttest (alias welcht) performs Welch's t-test for two independent samples with unequal variances. Returns [t-statistic, degrees of freedom].

my ($t, $df) = @{welcht([1,2,3,4,5], [3,4,5,6,7])}
p "t=$t df=$df"

# wfrm

wfrm — go/general functional utilities builtin. Alias for words_from.

my $result = wfrm $x 
# or in a pipeline:
@list |> map wfrm |> p

# wh

wh — filesystem extensions builtin. Alias for which.

my $result = wh $x 
# or in a pipeline:
@list |> map wh |> p

# wha

Return a list of all absolute paths matching the given command name across every directory in PATH, not just the first match. The short alias wha keeps things concise. This is useful for detecting shadowed executables or auditing which versions of a tool are installed.

my @all = which_all("python3")
@all |> e p                # /usr/local/bin/python3
                             # /usr/bin/python3
p scalar wha("perl")        # number of perls on PATH

# when_false

when_false — functional combinators builtin.

my $result = when_false $x 
# or in a pipeline:
@list |> map when_false |> p

# when_true

when_true — functional combinators builtin.

my $result = when_true $x 
# or in a pipeline:
@list |> map when_true |> p

# which_fn

which_fn — return indices where a predicate is true. Like R's which().

my @idx = @{which_fn([1,5,3,8,2], fn { $_[0] > 3 })}  # [1, 3]

# white

white — color / ansi builtin. Alias for red.

my $result = white $x 
# or in a pipeline:
@list |> map white |> p

# white_bold

white_bold — color / ansi builtin. Alias for red.

my $result = white_bold $x 
# or in a pipeline:
@list |> map white_bold |> p

# wien

wien — physics formulas builtin. Alias for wien_displacement.

my $result = wien $x 
# or in a pipeline:
@list |> map wien |> p

# wien_constant

wien_constant — physics constants builtin.

my $result = wien_constant $x 
# or in a pipeline:
@list |> map wien_constant |> p

# wien_displacement

wien_displacement — physics formulas builtin.

my $result = wien_displacement $x 
# or in a pipeline:
@list |> map wien_displacement |> p

# wincirc

wincirc — additional missing stdlib functions builtin. Alias for windowed_circular.

my $result = wincirc $x 
# or in a pipeline:
@list |> map wincirc |> p

# wind_chill

wind_chill — physics formulas builtin.

my $result = wind_chill $x 
# or in a pipeline:
@list |> map wind_chill |> p

# window_n

window_n — go/general functional utilities builtin.

my $result = window_n $x 
# or in a pipeline:
@list |> map window_n |> p

# windowed_circular

windowed_circular — additional missing stdlib functions builtin.

my $result = windowed_circular $x 
# or in a pipeline:
@list |> map windowed_circular |> p

# winn

winn — go/general functional utilities builtin. Alias for window_n.

my $result = winn $x 
# or in a pipeline:
@list |> map winn |> p

# winsor

winsor — math / numeric (uncategorized batch) builtin. Alias for winsorize.

my $result = winsor $x 
# or in a pipeline:
@list |> map winsor |> p

# winsorize

winsorize — math / numeric (uncategorized batch) builtin.

my $result = winsorize $x 
# or in a pipeline:
@list |> map winsorize |> p

# without

without — file stat / path builtin.

my $result = without $x 
# or in a pipeline:
@list |> map without |> p

# without_nth

without_nth — file stat / path builtin.

my $result = without_nth $x 
# or in a pipeline:
@list |> map without_nth |> p

# wmean

wmean — math / numeric (uncategorized batch) builtin. Alias for weighted_mean.

my $result = wmean $x 
# or in a pipeline:
@list |> map wmean |> p

# word_count

word_count — trivial string ops builtin.

my $result = word_count $x 
# or in a pipeline:
@list |> map word_count |> p

# word_frequencies

word_frequencies — string processing (uncategorized batch) builtin.

my $result = word_frequencies $x 
# or in a pipeline:
@list |> map word_frequencies |> p

# word_wrap_text

word_wrap_text — extended stdlib builtin.

my $result = word_wrap_text $x 
# or in a pipeline:
@list |> map word_wrap_text |> p

# wordfreq

wordfreq — string processing (uncategorized batch) builtin. Alias for word_frequencies.

my $result = wordfreq $x 
# or in a pipeline:
@list |> map wordfreq |> p

# words_from

words_from — go/general functional utilities builtin.

my $result = words_from $x 
# or in a pipeline:
@list |> map words_from |> p

# work

work($force, $distance, $angle) — compute work W = F×d×cos(θ) (Joules). Angle in degrees, default 0.

p work(100, 10)       # 1000 J (force parallel to motion)
p work(100, 10, 60)   # 500 J (force at 60°)

# woy

woy — extended stdlib batch 3 builtin. Alias for week_of_year.

my $result = woy $x 
# or in a pipeline:
@list |> map woy |> p

# wrap_around

wrap_around — trig / math (batch 2) builtin.

my $result = wrap_around $x 
# or in a pipeline:
@list |> map wrap_around |> p

# wrap_index

wrap_index — list helpers (batch 4) builtin.

my $result = wrap_index $x 
# or in a pipeline:
@list |> map wrap_index |> p

# wrap_range

wrap_range — extended stdlib builtin.

my $result = wrap_range $x 
# or in a pipeline:
@list |> map wrap_range |> p

# wrap_text

wrap_text — extended stdlib builtin.

my $result = wrap_text $x 
# or in a pipeline:
@list |> map wrap_text |> p

# wrprng

wrprng — extended stdlib builtin. Alias for wrap_range.

my $result = wrprng $x 
# or in a pipeline:
@list |> map wrprng |> p

# wrpt

wrpt — extended stdlib builtin. Alias for wrap_text.

my $result = wrpt $x 
# or in a pipeline:
@list |> map wrpt |> p

# wsamp

wsamp — extended stdlib builtin. Alias for weighted_sample.

my $result = wsamp $x 
# or in a pipeline:
@list |> map wsamp |> p

# wwrap

wwrap — extended stdlib builtin. Alias for word_wrap_text.

my $result = wwrap $x 
# or in a pipeline:
@list |> map wwrap |> p

# xd

xd — serialization (stryke-only encoders) builtin. Alias for xml_decode.

my $result = xd $x 
# or in a pipeline:
@list |> map xd |> p

# xe

xe — serialization (stryke-only encoders) builtin. Alias for xml_encode.

my $result = xe $x 
# or in a pipeline:
@list |> map xe |> p

# xentropy

xentropy — math / numeric (uncategorized batch) builtin. Alias for cross_entropy.

my $result = xentropy $x 
# or in a pipeline:
@list |> map xentropy |> p

# xirr

xirr(\@cashflows, \@dates) — computes IRR for irregularly-spaced cash flows. Dates can be epoch timestamps or date strings. More accurate than irr for real-world investments.

my @cf = (-1000, 500, 600)
my @dates = ('2020-01-01', '2020-07-01', '2021-01-01')
p xirr(\@cf, \@dates)

# xor_bool

xor_bool — boolean combinators builtin.

my $result = xor_bool $x 
# or in a pipeline:
@list |> map xor_bool |> p

# xor_strings

xor_strings — string helpers (batch 4) builtin.

my $result = xor_strings $x 
# or in a pipeline:
@list |> map xor_strings |> p

# yards_to_m

yards_to_m — unit conversions builtin.

my $result = yards_to_m $input 

# yd

yd — serialization (stryke-only encoders) builtin. Alias for yaml_decode.

my $result = yd $x 
# or in a pipeline:
@list |> map yd |> p

# ye

ye — serialization (stryke-only encoders) builtin. Alias for yaml_encode.

my $result = ye $x 
# or in a pipeline:
@list |> map ye |> p

# yellow

yellow — color / ansi builtin. Alias for red.

my $result = yellow $x 
# or in a pipeline:
@list |> map yellow |> p

# yellow_bold

yellow_bold — color / ansi builtin. Alias for red.

my $result = yellow_bold $x 
# or in a pipeline:
@list |> map yellow_bold |> p

# yesterday

yesterday — date (batch 2) builtin.

my $result = yesterday $x 
# or in a pipeline:
@list |> map yesterday |> p

# z_score

z_score($value, $mean, $stddev) — computes the z-score (standard score) of a value given the population mean and standard deviation. Returns how many standard deviations the value is from the mean. Useful for standardizing data and detecting outliers.

my $z = z_score(85, 75, 10)
p $z   # 1 (one stddev above mean)
p z_score(50, 60, 5)   # -2

# z_scores

z_scores(@data) — computes z-scores for all values in a list, returning an arrayref of standardized values. Each z-score indicates how many standard deviations that value is from the mean of the dataset. Useful for comparing values across different scales.

my @grades = (70, 80, 90)
my $zs = z_scores(@grades)
p @$zs   # (-1, 0, 1)
@data |> z_scores |> e p

# zalgo

zalgo — string processing (uncategorized batch) builtin.

my $result = zalgo $x 
# or in a pipeline:
@list |> map zalgo |> p

# zall

zall — go/general functional utilities builtin. Alias for zip_all.

my $result = zall $x 
# or in a pipeline:
@list |> map zall |> p

# zcross

zcross — matrix operations (uncategorized batch) builtin. Alias for zero_crossings.

my $result = zcross $x 
# or in a pipeline:
@list |> map zcross |> p

# zero

zero — trivial numeric / predicate builtins builtin.

my $result = zero $x 
# or in a pipeline:
@list |> map zero |> p

# zero_crossings

zero_crossings — matrix operations (uncategorized batch) builtin.

my $result = zero_crossings $x 
# or in a pipeline:
@list |> map zero_crossings |> p

# zeros

zeros — matrix / linear algebra builtin.

my $result = zeros $x 
# or in a pipeline:
@list |> map zeros |> p

# zeros_mat

zeros_mat — matrix / linear algebra builtin. Alias for zeros_matrix.

my $result = zeros_mat $x 
# or in a pipeline:
@list |> map zeros_mat |> p

# zeros_matrix

zeros_matrix — matrix / linear algebra builtin.

my $result = zeros_matrix $x 
# or in a pipeline:
@list |> map zeros_matrix |> p

# zfill

zfill — extended stdlib builtin.

my $result = zfill $x 
# or in a pipeline:
@list |> map zfill |> p

# zfill_num

zfill_num — extended stdlib builtin.

my $result = zfill_num $x 
# or in a pipeline:
@list |> map zfill_num |> p

# zip_all

zip_all — go/general functional utilities builtin.

my $result = zip_all $x 
# or in a pipeline:
@list |> map zip_all |> p

# zip_apply

zip_apply — functional combinators builtin.

my $result = zip_apply $x 
# or in a pipeline:
@list |> map zip_apply |> p

# zip_archive

zip_archive — crypto / encoding builtin. Alias for zip_create.

my $result = zip_archive $x 
# or in a pipeline:
@list |> map zip_archive |> p

# zip_with

zip_with — pipeline / string helpers builtin. Alias for drop.

my $result = zip_with $x 
# or in a pipeline:
@list |> map zip_with |> p

# zipl

zipl — python/ruby stdlib builtin. Alias for zip_longest.

my $result = zipl $x 
# or in a pipeline:
@list |> map zipl |> p

# zipmap

zipmap — file stat / path builtin.

my $result = zipmap $x 
# or in a pipeline:
@list |> map zipmap |> p

# zrlc

zrlc — physics formulas builtin. Alias for impedance_rlc.

my $result = zrlc $x 
# or in a pipeline:
@list |> map zrlc |> p

# zscore

zscore — file stat / path builtin.

my $result = zscore $x 
# or in a pipeline:
@list |> map zscore |> p

# zscores

zscores — statistics (extended) builtin. Alias for z_scores.

my $result = zscores $x 
# or in a pipeline:
@list |> map zscores |> p

# zst

zst — crypto / encoding builtin. Alias for zstd.

my $result = zst $x 
# or in a pipeline:
@list |> map zst |> p