Simple library that encourage the use of functional programming + pattern matching.
defstruct--- provides truely nondestructive structure + integrates well to the pattern matchers (either optima or trivia).
ftype--- shorthand expression of
macro defstruct (name-and-options &rest slots)
A variation of defstruct, with read-only slots and automatically defined constructor.
- Read-only, Noninterned Slot Name
:read-onlyfeature in cl does not prohibit the use of slot-value.
- Constructor Function with the Same Syntax as that of Pattern Matcher
- (<name> &optional <slots...>). No keyword argument.
macro ftype (name-or-names &rest types)
(declaim (ftype (function (<types...>) <type>) <name-or-names...>)). In a smart implementation like sbcl, using
ftype declaration is preferred over
(declare (type ...)).
ftype both have 5 characters and gives cleaner code.
(ftype my+ fixnum fixnum fixnum) (defun my+ (a b) (+ a b))
This library is at least tested on implementation listed below:
- SBCL 1.2.8 on X86-64 Linux 3.13.0-45-generic (author's environment)
Also, it depends on the following libraries:
- Trivia by me
- Alexandria is a collection of portable public domain utilities.
Copyright (c) 2015 Masataro Asai (firstname.lastname@example.org)
Licensed under the LLGPL License.
- Masataro Asai