Mercurial > urweb
changeset 2035:a3435112b83e
Top.max and Top.min
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 29 Jun 2014 08:33:47 -0400 |
parents | 1d36654c2d21 |
children | 16e4e50470b2 |
files | lib/ur/top.ur lib/ur/top.urs |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/ur/top.ur Sun Jun 29 08:31:21 2014 -0400 +++ b/lib/ur/top.ur Sun Jun 29 08:33:47 2014 -0400 @@ -405,3 +405,8 @@ "application/x-www-form-urlencoded" => postFields' (postData pb) | _ => error <xml>Tried to get POST fields, but MIME type is not "application/x-www-form-urlencoded"</xml> end + +fun max [t] ( _ : ord t) (x : t) (y : t) : t = + if x > y then x else y +fun min [t] ( _ : ord t) (x : t) (y : t) : t = + if x < y then x else y
--- a/lib/ur/top.urs Sun Jun 29 08:31:21 2014 -0400 +++ b/lib/ur/top.urs Sun Jun 29 08:33:47 2014 -0400 @@ -287,3 +287,6 @@ val mkRead' : t ::: Type -> (string -> option t) -> string -> read t val postFields : postBody -> list (string * string) + +val max : t ::: Type -> ord t -> t -> t -> t +val min : t ::: Type -> ord t -> t -> t -> t