Stdlib: Compression builtins (gzip, zstd) #249

Closed
opened 2026-01-12 02:37:34 +00:00 by navicore · 1 comment
navicore commented 2026-01-12 02:37:34 +00:00 (Migrated from github.com)

Summary

Add compression/decompression builtins for gzip and zstd formats.

Proposed API

# Gzip compression
data compress.gzip        # ( String -- Bytes )
compressed compress.gunzip # ( Bytes -- String Bool )

# Zstd compression (faster, better ratios)
data compress.zstd        # ( String -- Bytes )
compressed compress.unzstd # ( Bytes -- String Bool )

# With compression level
data 9 compress.gzip-level # ( String Int -- Bytes ) level 1-9

Implementation

FFI wrappers around:

  • flate2 crate for gzip/deflate
  • zstd crate for Zstandard

Estimated effort: 1 day each

Deliverables Checklist

  • Runtime builtins in crates/runtime/src/compress.rs
  • Unit tests for each function
  • Integration tests in tests/integration/src/test-compress.seq
  • LSP support: signatures in BUILTIN_SIGNATURES, docs in BUILTIN_DOCS
  • Example: examples/io/compress-demo.seq
  • Update docs/BATTERIES_INCLUDED.md status

Use Cases Unlocked

  • HTTP response compression
  • Log file compression
  • Data archival
  • Efficient network transfer
  • Reading compressed files

Priority

LOW - Useful but not blocking common use cases.

References

## Summary Add compression/decompression builtins for gzip and zstd formats. ## Proposed API ```seq # Gzip compression data compress.gzip # ( String -- Bytes ) compressed compress.gunzip # ( Bytes -- String Bool ) # Zstd compression (faster, better ratios) data compress.zstd # ( String -- Bytes ) compressed compress.unzstd # ( Bytes -- String Bool ) # With compression level data 9 compress.gzip-level # ( String Int -- Bytes ) level 1-9 ``` ## Implementation FFI wrappers around: - `flate2` crate for gzip/deflate - `zstd` crate for Zstandard Estimated effort: 1 day each ## Deliverables Checklist - [ ] Runtime builtins in `crates/runtime/src/compress.rs` - [ ] Unit tests for each function - [ ] Integration tests in `tests/integration/src/test-compress.seq` - [ ] LSP support: signatures in `BUILTIN_SIGNATURES`, docs in `BUILTIN_DOCS` - [ ] Example: `examples/io/compress-demo.seq` - [ ] Update `docs/BATTERIES_INCLUDED.md` status ## Use Cases Unlocked - HTTP response compression - Log file compression - Data archival - Efficient network transfer - Reading compressed files ## Priority LOW - Useful but not blocking common use cases. ## References - See `docs/BATTERIES_INCLUDED.md` gaps table - flate2: https://github.com/rust-lang/flate2-rs - zstd: https://github.com/gyscos/zstd-rs
navicore commented 2026-01-14 02:15:37 +00:00 (Migrated from github.com)
https://github.com/navicore/patch-seq/pull/259
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-seq#249
No description provided.