Results for “Stream transformations”
Small, practical examples. Search by task or narrow things down below.
Search a sorted array with bsearch
C: The search uses the same ordering comparator as the sorted input.
C✓ Tested
Set a file to a specific byte length
Linux Commands: Use truncate to shorten a known scratch file without replacing its inode.
Linux Commands✓ Tested
Sort an integer array with qsort
C: The comparator uses relational comparisons to avoid subtraction overflow.
C✓ Tested
Split a file into fixed line-count pieces
Linux Commands: Use numeric suffixes for predictable filenames when splitting a large text file.
Linux Commands✓ Tested
Split values into fixed-size chunks
C#: Enumerable.Chunk creates arrays and allows a shorter final chunk.
C#✓ Tested
Substitute values into a multiline template
Bash Scripts: An unquoted heredoc delimiter enables parameter expansion in the template.
Bash Scripts✓ Tested
Take a page from an ordered sequence
C#: Apply a stable order before Skip and Take for predictable paging.
C#✓ Tested
Test whether any or all values match
C#: Any and All short-circuit instead of materializing filtered collections.
C#✓ 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
Use an automatically removed temporary file
C: tmpfile creates a binary update stream whose file is removed when closed.
C✓ Tested
Write a literal multiline block
Bash Scripts: Quoting the heredoc delimiter disables parameter and command expansion inside it.
Bash Scripts✓ Tested