💾 Archived View for nanako.mooo.com › programming › cl-sdm.gmi captured on 2023-01-29 at 03:11:14. Gemini links have been rewritten to link to archived content
View Raw
More Information
➡️ Next capture (2023-12-28)
-=-=-=-=-=-=-
The Scarlet Devil Mansion :: CL-SDM
CL-SDM is my personal standard library for Common Lisp. It’s not quite at v1.0
yet, and is written in a rather opinionated way. Most of my other Common Lisp
projects use it in some way or another.
Source Code
Features
Core
- XOR logic function.
- Nicer constant declarations.
- PARSE-INTEGER? that returns NIL instead of raising a condition when it can’t parse.
- Shorter type names for the common (un)signed integer types
- Shorter array/vector declarations
- Pseudo-enums (code is already written, just needs moving to CL-SDM and some expansion)
- DEFINE-TYPED-FN ported from my CL-MeltySynth program and expanded
- Conversion to/from (un)signed integers
- CLAMP macro
- MAPAPPEND function
- Various nice functions inspired by Crystal/Ruby for inspecting sequences.
- SAMPLE function
- Sequence shuffling
- SHIFT functions
- Generic DOSEQ macro
- Equivalent of LAST for any sequence type.
- SWAP function
- Easier string trimming
- Caseless string comparisons
- CASE-like statement for strings
- Easier concatenation of things to a string
- Print numbers as binary sizes (KiB, MiB, etc).
- String spitting
- Pretty string indenting
- STRING-REPLACE
- STRING-STARTS-WITH and -ENDS-WITH
- JOIN function for strings
- Fast approximate trig functions
Argument Parsing
- Support short (-s) and long (--long) arguments.
- Automatic –help and –version handling
- Custom help/version printing
- Positional arg support
- Fast parsing of arguments
- Call arbitrary functions to check argument values
- String arguments
- Flag arguments
- File arguments (like strings, but with some special handling)
- Numeric arguments
I/O
- Fast I/O functions for reading/writing integers in binary.
- Fast I/O functions for reading/writing floats in binary.
- Fast I/O functions for reading/writing strings in binary.
- Conversion of strings to/from sequences of bytes.
- Conversion of integers to/from sequences of bytes.
- 24-bit integer support in the I/O functions
Date/Time
- Date/Time arithmetic
- Time Spans
- Date Time -> String conversions
Terminal Handling
- Basic ANSI support for colors and cursor control
- Progress bar
- Support for the Terminology terminal
Files/Pathnames
- Basename
- Check for existing directory
- Get file size
- Check if a path points to a directory or not
- Get some basic info (last modified, mode, etc.)
Logging
- Tag-based logging, where tags can be muffled.
- Basic logger
- Logger with colored output