From 10f0c953a1de12f375d694a0ee0816f7dffa4483 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Fri, 1 Jul 2016 11:10:35 -0400 Subject: Switch to expected order for [queryL] --- lib/ur/top.ur | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'lib') 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) -- cgit v1.2.3