aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur/list.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-12-27 15:34:11 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2012-12-27 15:34:11 -0500
commit53c633b53e8825cb9058fb88e86d1ca7828b83e6 (patch)
tree94682452c654491c184a8e2d43d3dbfdb4e46cf9 /lib/ur/list.ur
parentbf6fbd81d4e60a87b19f8c8149349217b4620360 (diff)
Add some name-mangling rules to allow XML attribute 'name' and attributes with dashes
Diffstat (limited to 'lib/ur/list.ur')
-rw-r--r--lib/ur/list.ur12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur
index bce5335e..cbb4faf2 100644
--- a/lib/ur/list.ur
+++ b/lib/ur/list.ur
@@ -437,3 +437,15 @@ fun mapXiM [m ::: Type -> Type] (_ : monad m) [a] [ctx ::: {Unit}] (f : int -> a
in
mapXiM' 0
end
+
+fun tabulateM [m] (_ : monad m) [a] (f : int -> m a) n =
+ let
+ fun tabulate' n acc =
+ if n <= 0 then
+ return acc
+ else
+ (v <- f (n-1);
+ tabulate' (n-1) (v :: acc))
+ in
+ tabulate' n []
+ end