Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guicho271828/immutable-struct
Simple library that encourage the use of functional programming + pattern matching.
https://github.com/guicho271828/immutable-struct
Last synced: 29 days ago
JSON representation
Simple library that encourage the use of functional programming + pattern matching.
- Host: GitHub
- URL: https://github.com/guicho271828/immutable-struct
- Owner: guicho271828
- Created: 2015-02-20T03:35:50.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-03T15:45:40.000Z (over 9 years ago)
- Last Synced: 2024-10-15T14:11:00.231Z (3 months ago)
- Language: Common Lisp
- Homepage:
- Size: 246 KB
- Stars: 8
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* IMMUTABLE-STRUCT
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 =declaim ftype=** macro defstruct (name-and-options &rest slots)
A variation of defstruct, with read-only slots and automatically defined constructor.
+ Read-only, Noninterned Slot Name :: Standard =:read-only= feature in cl
does not prohibit the use of slot-value.
+ Constructor Function with the Same Syntax as that of Pattern Matcher :: (
&optional ). No keyword argument.** macro ftype (name-or-names &rest types)
Abbreviation of =(declaim (ftype (function () ) ))=.
In a smart implementation like sbcl, using =ftype= declaration is preferred
over =the= and =(declare (type ...))=.Besides, =defun= and =ftype= both have 5 characters and gives cleaner code.
: (ftype my+ fixnum fixnum fixnum)
: (defun my+ (a b) (+ a b))** Dependencies
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 ::
Alexandria is a collection of portable public domain utilities.* Copyright
Copyright (c) 2015 Masataro Asai ([email protected])
* License
Licensed under the LLGPL License.