diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-10-30 17:47:30 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-10-30 17:47:30 +0100 |
commit | fec64041bc4dde07cf3c8fb87c3cf0a1a1dac28f (patch) | |
tree | 6a7c4e31dbd52eab20edbe658b2cfd995c5f95e9 | |
parent | 5d7684aa5e7ce4934ffaa074bba538d63f82cc06 (diff) | |
download | mew-fec64041bc4dde07cf3c8fb87c3cf0a1a1dac28f.tar.gz mew-fec64041bc4dde07cf3c8fb87c3cf0a1a1dac28f.tar.xz mew-fec64041bc4dde07cf3c8fb87c3cf0a1a1dac28f.zip |
add <>?
-rw-r--r-- | mew.scm | 24 | ||||
-rw-r--r-- | mew.svnwiki | 11 |
2 files changed, 35 insertions, 0 deletions
diff --git a/mew.scm b/mew.scm index 15d3050..1644436 100644 --- a/mew.scm +++ b/mew.scm @@ -19,6 +19,7 @@ until vals -> ->> fun-> fun->> set-> set->> + <>? ~?) (import-for-syntax matchable) @@ -84,6 +85,29 @@ (define (nth n lst) (list-ref lst n)) + (define <>? + (case-lambda + ((a b) (not (equal? a b))) + ((a b c) (and (not (equal? a b)) + (not (equal? b c)) + (not (equal? c a)))) + ((a b c d) (and (not (equal? a b)) + (not (equal? a c)) + (not (equal? a d)) + (not (equal? b c)) + (not (equal? b d)) + (not (equal? c d)))) + ((a b c d . rest) + (call-with-current-continuation + (lambda (return) + (let ((seen (tbl))) + (for-each (lambda (o) + (when (hash-table-update!/default seen o not #t) + (return #f))) + (apply list a b c d rest))) + #t))) + )) + (define (str . args) (with-output-to-string (lambda () diff --git a/mew.svnwiki b/mew.svnwiki index 65aefda..511ee54 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -145,6 +145,17 @@ If {{<obj>}} is a string, read all data from the file named {{<<obj>>}. If {{<obj>}} is false, read all data from {{*current-input-port*}}. +== Equality + +<procedure>(=? <val>...)</procedure> + +Alias for {{equal?}}. + +<procedure>(<>? <val1> <val2> ...)</procedure> + +Return true if all values are pairwise different. + + == Data types <procedure>(get <obj> <idx>)</procedure> |