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.
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
- [/] Support for &key, &optional, and &rest in DEFINE-TYPED-FN
- 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
- Make positional arg support optional
- Optionally allow - and – as arguments
- Support short (
- 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.
- Conversion of floats to/from sequences of bytes.
- 24-bit integer support in the I/O functions
- Date/Time
- Date/Time arithmetic
- Time Spans
- Support fractional seconds
- Time Span -> String conversions
- Date Time -> String conversions
- Terminal Handling
- Basic ANSI support for colors and cursor control
- Progress bar
- Support for the Terminology terminal
- Windows support
- 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
- Multi-logger (write to a logger once, and the strings go to 1+ destinations)
- Concurrent logger