summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-01-26 14:59:19 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-01-26 14:59:19 -0500
commit703661dcfcf96e23acedf7c2a6d36cda3fb68bc6 (patch)
treeee5f39838aeadd38e02c34783400c48d5f2899e9 /lib/ur
parentfba3039a03ae55a080b530665cfa0a9271f55d98 (diff)
Handling errors during commit
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/string.ur11
-rw-r--r--lib/ur/string.urs1
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/ur/string.ur b/lib/ur/string.ur
index 4025cf68..07d7e6b8 100644
--- a/lib/ur/string.ur
+++ b/lib/ur/string.ur
@@ -38,6 +38,17 @@ fun all f s =
al 0
end
+fun mp f s =
+ let
+ fun mp' i acc =
+ if i < 0 then
+ acc
+ else
+ mp' (i - 1) (str (f (sub s i)) ^ acc)
+ in
+ mp' (length s - 1) ""
+ end
+
fun newlines [ctx] [[Body] ~ ctx] s : xml ([Body] ++ ctx) [] [] =
case split s #"\n" of
None => cdata s
diff --git a/lib/ur/string.urs b/lib/ur/string.urs
index 5590b50c..557e73c0 100644
--- a/lib/ur/string.urs
+++ b/lib/ur/string.urs
@@ -20,5 +20,6 @@ val split : t -> char -> option (string * string)
val msplit : {Haystack : t, Needle : t} -> option (string * char * string)
val all : (char -> bool) -> string -> bool
+val mp : (char -> char) -> string -> string
val newlines : ctx ::: {Unit} -> [[Body] ~ ctx] => string -> xml ([Body] ++ ctx) [] []