summary refs log tree commit diff
path: root/mew.svnwiki
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2023-01-02 21:14:34 +0100
committerLeah Neukirchen <leah@vuxu.org>2023-01-02 21:14:34 +0100
commita9897295de1c5b7da066aa2693e9dbfeff282fc2 (patch)
tree05f7c967fbc6f57aa12ac8ab14299eb2d5598ceb /mew.svnwiki
parente3ddf82f1ed8abbca9de770cfabda0fd03d95084 (diff)
downloadmew-a9897295de1c5b7da066aa2693e9dbfeff282fc2.tar.gz
mew-a9897295de1c5b7da066aa2693e9dbfeff282fc2.tar.xz
mew-a9897295de1c5b7da066aa2693e9dbfeff282fc2.zip
add generic comparison
Diffstat (limited to 'mew.svnwiki')
-rw-r--r--mew.svnwiki26
1 files changed, 26 insertions, 0 deletions
diff --git a/mew.svnwiki b/mew.svnwiki
index dce8f34..ffb99cb 100644
--- a/mew.svnwiki
+++ b/mew.svnwiki
@@ -355,6 +355,32 @@ set of keys and {{equal?}} values.
 Return true if all values are pairwise different.
 
 
+== Generic comparison
+
+<procedure>(cmp <a> <b>)</procedure>
+
+Compare the real/char/string/list/vector {{<a>}} to {{<b>}} and
+return -1 if {{<a>}} is less than {{<b>}},
+0 if {{<a>}} is equal to {{<b>}}
+1 if {{<a>}} is greater than {{<b>}}.
+Return false if {{<a>}} and {{<b>}} cannot be compared.
+
+Lists and vectors are compared in lexicographic order using {{cmp}}
+recursively.
+
+<procedure>(<? <a> <b> ...)</procedure>
+<procedure>(>? <a> <b> ...)</procedure>
+<procedure>(<=? <a> <b> ...)</procedure>
+<procedure>(>=? <a> <b> ...)</procedure>
+
+Return true if all arguments are monotonically increasing,
+monotonically decreasing, monotonically non-decreasing, or
+monotonically non-increasing according to {{cmp}}, and false
+otherwise.
+
+It is an error to compare uncomparable values.
+
+
 == Data types
 
 <procedure>(get <obj> <idx>)</procedure>