summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2016-08-05 20:06:17 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2016-08-05 20:06:17 -0400
commitc921d0df325c803fed8c7742eb088cb3d030d541 (patch)
tree16d374660aa9adb92c2f08317a20d61ae995ef9a /lib/ur
parenta3e471e933945dcfb54873cb20c691a193b55671 (diff)
parentbd6f549a527856db3878f1586c6666646a45d8ee (diff)
Merge branch 'upstream' into dfsg_clean20160805+dfsg
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/basis.urs15
-rw-r--r--lib/ur/top.ur20
2 files changed, 28 insertions, 7 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 883cc5b1..1163daed 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -152,7 +152,20 @@ val float : int -> float
val ceil : float -> int
val trunc : float -> int
val round : float -> int
-
+val floor : float -> int
+
+(** * Basic Math *)
+
+val sqrt : float -> float
+val sin : float -> float
+val cos : float -> float
+val log : float -> float
+val exp : float -> float
+val asin : float -> float
+val acos : float -> float
+val atan : float -> float
+val atan2 : float -> float -> float
+val abs: float -> float
(** * Time *)
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index e831b4f7..6c6c896c 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -225,15 +225,23 @@ fun query1' [t ::: Name] [fs ::: {Type}] [state ::: Type] (q : sql_query [] [] [
(f : $fs -> state -> state) (i : state) =
query q (fn r s => return (f r.t s)) i
+val rev = fn [a] =>
+ let
+ fun rev' acc (ls : list a) =
+ case ls of
+ [] => acc
+ | x :: ls => rev' (x :: acc) ls
+ in
+ rev' []
+ end
+
fun queryL [tables] [exps] [tables ~ exps] (q : sql_query [] [] tables exps) =
- query q
- (fn r ls => return (r :: ls))
- []
+ ls <- query q (fn r ls => return (r :: ls)) [];
+ return (rev ls)
fun queryL1 [t ::: Name] [fs ::: {Type}] (q : sql_query [] [] [t = fs] []) =
- query q
- (fn r ls => return (r.t :: ls))
- []
+ ls <- query q (fn r ls => return (r.t :: ls)) [];
+ return (rev ls)
fun queryI [tables ::: {{Type}}] [exps ::: {Type}]
[tables ~ exps] (q : sql_query [] [] tables exps)