diff options
author | Robby Zambito <contact@robbyzambito.me> | 2023-02-13 16:45:46 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2023-02-13 16:45:46 -0500 |
commit | b4648b51a8ec02a9a27b868b3254e37f2491f6eb (patch) | |
tree | 6406c53181906a029f9eca33c56f9a7ebf105a31 /README.org | |
parent | a55021b7c30c5e8dbd4750e3517b022a55c89de0 (diff) |
Use SRFI for case-receive instead of my own implementation
Diffstat (limited to 'README.org')
-rw-r--r-- | README.org | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -133,16 +133,13 @@ Convert ~lst~ to a ~list?~ of ~json-value?~. #+end_src #+begin_src scheme - (define-syntax case-values - (syntax-rules () - ((_ vals (pattern body1 body2 ...) ...) - (call-with-values (lambda () vals) (case-lambda (pattern body1 body2 ...) ...))))) + (import (srfi 210)) - (case-values (json-ref (json-object `("x" . ,(json-list "hello" "world"))) "x") + (case-receive (json-ref (json-object `("x" . ,(json-list "hello" "world"))) "x") (() 'not-found) ((x) (json-list? x))) ; => #t - (case-values (json-ref (json-object `("x" . ,(json-list "hello" "world"))) "y") + (case-receive (json-ref (json-object `("x" . ,(json-list "hello" "world"))) "y") (() 'not-found) ((x) (json-list? x))) ; => not-found #+end_src |