aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2024-12-31 13:04:43 -0500
committerGravatar Peter McGoron 2024-12-31 13:04:43 -0500
commit2ff4637b88368a5119a02c94ff4cec7015723404 (patch)
treecd0e47c7ec5c1fa3d87deb64d18d2df0be687e85
parentdocumentation (diff)
fix length=>
-rw-r--r--cond-thunk.egg2
-rw-r--r--mcgoron.cond-thunk.values.scm5
-rw-r--r--tests/values.scm11
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
'//www.gravatar.com/avatar/48ffdcc3b8ccbba5aa7dad49587d1eb5?s=13&d=retro' width='13' height='13' alt='Gravatar' /> dmaas 3-18/+25 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488