From b4648b51a8ec02a9a27b868b3254e37f2491f6eb Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Mon, 13 Feb 2023 16:45:46 -0500 Subject: Use SRFI for case-receive instead of my own implementation --- README.org | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'README.org') diff --git a/README.org b/README.org index 1c18542..5e2b95e 100644 --- a/README.org +++ b/README.org @@ -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 -- cgit