FIND YOUR NEXT FEW LINES

Results for “fold”

Small, practical examples. Search by task or narrow things down below.

668 snippets foundClear filters
GoStrings & text

Trim surrounding whitespace

Trim surrounding whitespace using a complete Go program with explicit sample inputs.

Go✓ Tested
RustStrings & Unicode

Trim whitespace around text

Trim whitespace around text in a complete Rust program using the standard library.

Rust✓ Tested
GoConcurrency & cancellation

Try a channel receive without blocking

Try a channel receive without blocking using a complete Go program with explicit sample inputs.

Go✓ Tested
SQLiteGetting Started

Turn a condition into a result label

SQLite: Use CASE to describe stock availability for each row.

SQLite✓ Tested
SQLiteReporting & grouped calculations

Turn known group values into columns

SQLite: Conditional aggregation gives a portable pivot when the category set is known.

SQLite✓ Tested
GoGetting Started

Understand default zero values

Understand default zero values using a complete Go program with explicit sample inputs.

Go✓ Tested
SQLiteSchema design & transactions

Undo a multi-row transfer atomically

SQLite: The first transaction commits the fixtures. Rolling back the second transaction restores both sides of the attempted transfer.

SQLite✓ Tested
SQLiteSchema design & transactions

Undo only the work after a savepoint

SQLite: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.

SQLite✓ Tested
SQLiteTables & writes

Update a row on conflict

Use a primary key to insert or update one value.

upsert✓ Tested
GoGetting Started

Update a value through a pointer

Update a value through a pointer using a complete Go program with explicit sample inputs.

Go✓ Tested
RustThreads & shared ownership

Update an atomic counter

Update an atomic counter in a complete Rust program using the standard library.

Rust✓ Tested
RustMaps & sets

Update an existing map value

Update an existing map value in a complete Rust program using the standard library.

Rust✓ Tested