F# Examples

F#Oct 23, 2026

F# aligned plain-text terminal table

Renders headers and rows as a column-aligned plain-text table with separator rules and no dependencies.

formattingtableterminal
000
F#Oct 23, 2026

F# Base64 encode and strict decode

Encodes text to Base64 and decodes it back with validation for bad alphabets and invalid UTF-8.

validationencodingbase64
000
F#Oct 23, 2026

F# field-level input validation errors

Validates name, email, and age fields and returns a map of field names to readable error messages.

recordserrorsvalidation
000
F#Oct 23, 2026

F# build and parse URL query strings

Encodes key-value pairs into a URL query string and parses one back into a map with percent decoding.

query-stringurlparsing
000
F#Oct 23, 2026

F# JSON parsing with descriptive errors

Decodes JSON fields with explicit checks and returns readable error messages instead of raw exceptions.

parsingerrorsvalidationjson
000
F#Oct 23, 2026

F# bounded worker pool collecting results

Runs jobs on a fixed number of workers and returns every result or exception in the original job order.

concurrencyworker-pooltasks
000
F#Oct 23, 2026

F# timed HTTP GET that parses JSON

Performs an HTTP GET with a five second timeout, checks the status, and parses the body as JSON.

httpjsontimeout
000
F#Oct 23, 2026

F# typed environment config with validation

Reads typed settings from environment variables with defaults and fails fast on an invalid port value.

environmentconfigurationvalidation
000
F#Oct 23, 2026

F# token bucket rate limiter for bursts

A synchronous token bucket that allows short bursts while enforcing an average rate of tokens per second.

concurrencytoken-bucketrate-limiting
000
F#Oct 23, 2026

F# bounded LRU cache with recency tracking

A bounded LRU cache built on an immutable map that evicts the least recently used key when it exceeds capacity.

lrucachecollections
000
F#Oct 23, 2026

F# multi-key record sort with null ordering

Stable multi-key sort for records that puts null strings first and then compares by age as a tiebreaker.

comparisonsortingrecords
000
F#Oct 23, 2026

F# chunk a sequence into fixed-size lists

Splits any sequence into lists of at most N items, keeping the final partial batch and rejecting invalid sizes.

chunkingsequencescollections
000
F#Oct 23, 2026

F# stream a text file line by line lazily

Returns a lazy sequence that streams a text file one line at a time without loading the whole file into memory.

streamingsequencesfile-io
000
F#Oct 23, 2026

F# deep clone and recursive merge for trees

Deep-copies an immutable JSON-like tree and merges two trees recursively, with the override winning on leaves.

mergerecursionclonejson
000
F#Oct 23, 2026

F# retry with capped exponential backoff and jitter

Runs an operation up to N times with capped exponential backoff plus random jitter so retries do not stampede.

backoffretryjitter
000