summaryrefslogtreecommitdiff
path: root/libstd/extremum.myr
diff options
context:
space:
mode:
Diffstat (limited to 'libstd/extremum.myr')
-rw-r--r--libstd/extremum.myr20
1 files changed, 20 insertions, 0 deletions
diff --git a/libstd/extremum.myr b/libstd/extremum.myr
new file mode 100644
index 0000000..5d63acd
--- /dev/null
+++ b/libstd/extremum.myr
@@ -0,0 +1,20 @@
+pkg std =
+ generic min : (a : @a::tcnum, b : @a::tcnum -> @a::tcnum)
+ generic max : (a : @a::tcnum, b : @a::tcnum -> @a::tcnum)
+;;
+
+generic min = {a, b
+ if a < b
+ -> a
+ else
+ -> b
+ ;;
+}
+
+generic max = {a, b
+ if a > b
+ -> a
+ else
+ -> b
+ ;;
+}