summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2024-09-13 02:59:25 +0100
committerArun Isaac2024-09-13 03:02:02 +0100
commitfc1004d6c41c57e5ed9cae5da105e44937722959 (patch)
tree0ae43175abba5ac2d3022057d06267ea29e11014
parent83fe3cca669a569146ab3c0e060f25111c165aae (diff)
downloadravanan-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.scm5
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)