diff options
-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> |