diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-11-03 20:31:20 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-11-03 20:31:20 +0100 |
commit | 94846eb7cf636276d7f177dc54387162d2593812 (patch) | |
tree | 5f6a4494b0e7bb85dd81b07e052c963a7f4e2796 | |
parent | 3e02069ff0df373cc3211d354429f6f65c71cf72 (diff) | |
download | mew-94846eb7cf636276d7f177dc54387162d2593812.tar.gz mew-94846eb7cf636276d7f177dc54387162d2593812.tar.xz mew-94846eb7cf636276d7f177dc54387162d2593812.zip |
add boolean
-rw-r--r-- | mew.scm | 4 | ||||
-rw-r--r-- | mew.svnwiki | 4 | ||||
-rw-r--r-- | tests/test.mew | 7 |
3 files changed, 15 insertions, 0 deletions
diff --git a/mew.scm b/mew.scm index f70fbee..4fe649d 100644 --- a/mew.scm +++ b/mew.scm @@ -1,6 +1,7 @@ (module mew (export act accumulate andloc at + boolean comp dec def del-at div empty? eof esc @@ -94,6 +95,9 @@ (define (dec i) (- i 1)) + (define (boolean x) + (not (not x))) + (define <>? (case-lambda ((a b) (not (equal? a b))) diff --git a/mew.svnwiki b/mew.svnwiki index 9104155..91f435e 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -166,6 +166,10 @@ added implicitly at the end. {{(op* - 0 ... 2)}} is the function that subtracts all its arguments from 0 and finally 2. +<procedure>(boolean <obj>)</procedure> + +Return false if {{<obj>}} is {{#f}}, and true else. + <procedure>(negate <fun>)</procedure> Alias for {{complement}}. diff --git a/tests/test.mew b/tests/test.mew index f8ee39d..311db5a 100644 --- a/tests/test.mew +++ b/tests/test.mew @@ -64,6 +64,13 @@ (test -1/2 (dec 1/2)) (test-error (dec "foo"))) +(test-group "boolean" + (test #f (boolean #f)) + (test #t (boolean #t)) + (test #t (boolean 1)) + (test #t (boolean "foo")) + (test #t (boolean (void)))) + (test-group "<>?" (test #t (<>? 4 5)) (test #t (<>? 4 5 6)) |