Add 'for' iterator and 'if-let' syntax

This commit is contained in:
2024-11-01 18:05:27 -05:00
parent 779bc50a77
commit 56594fd146
2 changed files with 37 additions and 6 deletions

View File

@@ -32,6 +32,19 @@
(negative-case
(assert (unspecified? (when-not #t 'do-some-stuff 'return)))))
(define-test for
(permutation
(define value (for ([i (iota 2)]
[j (iota 2)])
(cons i j)))
(assert (equal? value '((0 . 0) (0 . 1) (1 . 0) (1 . 1))))))
(define-test if-let
(positive-case
(assert (= (if-let ([v (or #f 1)]) (+ v 1)) 2)))
(negative-case
(assert (not (if-let ([v (and #f 1)]) (+ v 1))))))
(define-test partial
(test
(define value (partial / 2))