From 81ac5b999f1dae8bc821634dc3c3bc43239d8d65 Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 17 Aug 2024 21:19:18 -0700 Subject: Add: optional type --- package.lisp | 1 + petty-types.lisp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/package.lisp b/package.lisp index 57ed987..6472436 100644 --- a/package.lisp +++ b/package.lisp @@ -6,5 +6,6 @@ (#:a #:alexandria-2)) (:export #:type-specifier-p ; function + #:optional ; deftype #:vector-of ; deftype #:list-of)) ; deftype diff --git a/petty-types.lisp b/petty-types.lisp index 1d092b9..994f2e9 100644 --- a/petty-types.lisp +++ b/petty-types.lisp @@ -41,3 +41,6 @@ "Type specifier for vectors all of the same TYPE." `(satisfies ,(sequence-of-predicate-for 'vector type len))) +(deftype optional (type) + "Type specifier for an optional type." + `(or null ,type)) -- cgit v1.2.3