summaryrefslogtreecommitdiff
path: root/lib/ur/string.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-05 14:01:34 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-05 14:01:34 -0500
commit20fe6fd5bb27486a7f3483ead05061e967c5a105 (patch)
tree27acc16bb8d3b12293fbbae8b833d7ff2e731aa9 /lib/ur/string.ur
parent7bfb616805a8c693aeb94067faf1098a0b50cbe5 (diff)
Represent FFI function names as strings, to deal with cross-file recursion
Diffstat (limited to 'lib/ur/string.ur')
-rw-r--r--lib/ur/string.ur11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ur/string.ur b/lib/ur/string.ur
index fb5a3f97..41ec666d 100644
--- a/lib/ur/string.ur
+++ b/lib/ur/string.ur
@@ -26,3 +26,14 @@ fun msplit {Haystack = s, Needle = chs} =
| Some i => Some (substring s {Start = 0, Len = i},
sub s i,
substring s {Start = i + 1, Len = length s - i - 1})
+
+fun all f s =
+ let
+ val len = length s
+
+ fun al i =
+ i >= len
+ || (f (sub s i) && al (i + 1))
+ in
+ al 0
+ end