diff options
| author | 2024-12-31 13:04:43 -0500 | |
|---|---|---|
| committer | 2024-12-31 13:04:43 -0500 | |
| commit | 2ff4637b88368a5119a02c94ff4cec7015723404 (patch) | |
| tree | cd0e47c7ec5c1fa3d87deb64d18d2df0be687e85 | |
| parent | documentation (diff) | |
fix length=>
| -rw-r--r-- | cond-thunk.egg | 2 | ||||
| -rw-r--r-- | mcgoron.cond-thunk.values.scm | 5 | ||||
| -rw-r--r-- | tests/values.scm | 11 |
3 files changed, 15 insertions, 3 deletions
diff --git a/cond-thunk.egg b/cond-thunk.egg index 36f472b..2cbe3e4 100644 --- a/cond-thunk.egg +++ b/cond-thunk.egg @@ -1,5 +1,5 @@ ((author "Peter McGoron") - (version "0.2.1") + (version "0.2.2") (synopsis "macros for abstracting conditional branches") (category "lang-exts") (license "Apache-2.0") diff --git a/mcgoron.cond-thunk.values.scm b/mcgoron.cond-thunk.values.scm index feb345b..2daffdb 100644 --- a/mcgoron.cond-thunk.values.scm +++ b/mcgoron.cond-thunk.values.scm @@ -87,8 +87,9 @@ (define (length=> whole-list num) (list-length-destructor whole-list num (lambda (_ rest) - (when-ct (null? rest) - (apply values whole-list))))) + (cond-values + (when-ct (null? rest) + (apply values whole-list)))))) (define-syntax define-record-type/destructor (syntax-rules () diff --git a/tests/values.scm b/tests/values.scm index cafa8b0..ef14907 100644 --- a/tests/values.scm +++ b/tests/values.scm @@ -108,6 +108,17 @@ (test-assert "length-at-least=> 3.4" (equal? rest '(4)))) (else (error "length-at-least=> 3" #f))) +(test "length=> 1" + '(1 2 3 4) + (cond-values + (after ((let (length=> '(1 2 3 4) 5) => _)) + 5) + (after ((let (length=> '(1 2 3 4) 3) => _)) + 3) + (after ((let (length=> '(1 2 3 4) 4) => (a b c d))) + (list a b c d)) + (else 'else))) + (test "on-fail 1" 5 (cond-thunk |
