Results for “read only”
Small, practical examples. Search by task or narrow things down below.
Test any and all elements with predicates
C++: These algorithms stop as soon as their result is known.
C++✓ Tested
Test whether a number is even
Test whether a number is even using a complete Go program with explicit sample inputs.
Go✓ Tested
Test whether any or all values match
C#: Any and All short-circuit instead of materializing filtered collections.
C#✓ Tested
Test whether one revision is an ancestor of another
Git: merge-base --is-ancestor reports its answer through the exit status.
Git✓ Tested
Test whether tracked working files changed
Git: A quiet diff returns status one for differences, so handle it in a conditional.
Git✓ Tested
Track which union member is currently valid
C: An explicit tag tells callers which overlaid union value to read.
C✓ Tested
Transfer unique ownership with move
C++: Moving a unique_ptr leaves the source empty and gives ownership to the destination.
C++✓ Tested
Transform a value by shadowing
Transform a value by shadowing in a complete Rust program using the standard library.
Rust✓ Tested
Transform a vector into a separate result
C++: Pre-size the output before writing through its iterator.
C++✓ Tested
Transform an optional value
Transform an optional value in a complete Rust program using the standard library.
Rust✓ Tested
Transform each item with Select
C#: Project each input value into a new value without modifying the source array.
C#✓ Tested
Transform each value with map
Transform each value with map in a complete Rust program using the standard library.
Rust✓ Tested