#functional Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Kotlin map / filter / reduce
The three classic functional combinators. Each takes a lambda and returns a new collection (or a single value for reduce). Chain freely — intermediate allocations only matter at very large scale (use `Sequence` then).
Rust Iterator Chain — map / filter / collect
Rust iterators are lazy and zero-cost. Chain transformations and finally collect into a concrete container. The compiler unrolls the whole pipeline into a tight loop.
JavaScript Memoize Function
Caches the result of a pure function keyed by its serialised arguments. On repeated calls with the same inputs the cached value is returned instantly, skipping expensive computation. Supports single and multi-argument functions via JSON key serialisation.
Go Generic Map / Filter / Reduce
Three classic functional combinators, generically typed. Go's standard library doesn't ship these (yet), but they're short enough to drop into any project.
PHP Memoize a Function's Result
Cache the result of an expensive pure function by its arguments. Returns a closure with the same call signature that only invokes the inner function once per unique argument set.
Go Generic Result / Option Type
Go doesn't have built-in Result types, but generics make them ergonomic. Combine with `errors.Is` and you have type-safe railroaded error handling.
Rust Option Combinators (no unwrap!)
`Option<T>` has a rich combinator API that lets you avoid both `unwrap()` and the verbose `match`. Chain `map`, `and_then`, `unwrap_or`, `or_else` to compose fallible operations.
JavaScript Pipe & Compose
pipe applies a list of functions left-to-right (first function runs first), while compose applies them right-to-left. Both pass the result of each step as input to the next. Fundamental building blocks for functional programming in JavaScript — build data transformation pipelines without intermediate variables.
Java Functional Interfaces — Function / Predicate / Consumer / Supplier
The four core single-method interfaces in `java.util.function`. They're the parameter types for streams, Optional methods, CompletableFuture, and countless library APIs.
JavaScript Curry Function
Transforms a multi-argument function into a chain of single-argument functions. Each call returns a new function until all arguments are supplied, then the original function executes. Enables partial application and cleaner function composition pipelines.
Python Result / Either with Generics
Encode "this might fail" in the type signature instead of throwing. Python 3.12+ generics syntax keeps it compact. Forces the caller to handle the failure branch.