diff options
author | Arun Isaac | 2024-09-13 02:59:25 +0100 |
---|---|---|
committer | Arun Isaac | 2024-09-13 03:02:02 +0100 |
commit | fc1004d6c41c57e5ed9cae5da105e44937722959 (patch) | |
tree | 0ae43175abba5ac2d3022057d06267ea29e11014 | |
parent | 83fe3cca669a569146ab3c0e060f25111c165aae (diff) | |
download | ravanan-fc1004d6c41c57e5ed9cae5da105e44937722959.tar.gz ravanan-fc1004d6c41c57e5ed9cae5da105e44937722959.tar.lz ravanan-fc1004d6c41c57e5ed9cae5da105e44937722959.zip |
work/command-line-tool: Comment on match-type clauses.
* ravanan/work/command-line-tool.scm (match-type): Comment on cond
ladder clauses.
-rw-r--r-- | ravanan/work/command-line-tool.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm index 5000100..a334285 100644 --- a/ravanan/work/command-line-tool.scm +++ b/ravanan/work/command-line-tool.scm @@ -79,20 +79,25 @@ directory after THUNK returns." type. The returned type may be different from @var{type}---for example, when @var{type} is a union type." (cond + ;; Match any type. ((eq? type 'Any) (object-type obj)) + ;; Match null values or empty arrays. ((eq? type 'null) (match obj ((or 'null #()) 'null) (_ #f))) + ;; Recursively match type of every element of array. ((array-type? type) (and (vector? obj) (every (cut match-type <> (array-type-subtype type)) (vector->list obj)) type)) + ;; Match any one of the subtypes of the union type. ((union-type? type) (any (cut match-type obj <>) (union-type-subtypes type))) + ;; Else, match the exact type of the object. (else (and (eq? (object-type obj) type) |