From 87cf60328f59b739de1b282dbd020e70a84f076e Mon Sep 17 00:00:00 2001 From: colin Date: Sun, 28 Jul 2024 08:34:04 -0700 Subject: Add barebones readme --- README.org | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 README.org diff --git a/README.org b/README.org new file mode 100644 index 0000000..efd1ad6 --- /dev/null +++ b/README.org @@ -0,0 +1,40 @@ +* `petty-types` + +#+begin_src lisp + +> (typep (list 1 2 3 4) '(list-of real)) +T +> (typep (list 1 2 3 4 3 2 1) '(list-of real)) +T +> (typep (list 1 2 3 4) '(list-of real 4)) +T +> (typep (list 1 2 #C(0 1)) '(list-of real)) +NIL +> (typep (list 1 2 3 4) '(list-of real 5)) +NIL +> (typep "aaabbb" '(vector-of (member #\a #\b))) +T +> (typep "aacabbb" '(vector-of (member #\a #\b))) +NIL +> (typep "aaabbb" '(vector-of (member #\a #\b) 6)) +T +> (typep "aaaabbb" '(vector-of (member #\a #\b) 6)) +NIL +> (typep "4aabbb" '(vector-of (member #\a #\b) 6)) +NIL +> (typep "aabbba" '(vector-of (member #\a #\b) 6)) +T + +;; THIS IS ESPECIALLY ANNOYING: +> (type-of "abab") +(SIMPLE-ARRAY CHARACTER (4)) +> (typep "abab" '(simple-array (member #\a #\b) (4))) +NIL + +;; but as above, VECTOR-OF works. +> (typep "abab" '(vector-of (member #\a #\b) 4)) +T + + + +#+end_src -- cgit v1.2.3