summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-30 09:59:10 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-30 09:59:10 -0400
commit581a2290590268039cacfbe0762b343f710c3116 (patch)
treea464f8a46243a2a77f37e93ab8934b1d7d11f0fc /lib
parent62c7b094ecf7e618a2e31658994bf648e1b36819 (diff)
String.length
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js6
-rw-r--r--lib/ur/basis.urs1
-rw-r--r--lib/ur/string.ur3
-rw-r--r--lib/ur/string.urs4
4 files changed, 11 insertions, 3 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 40b170c4..db3c934c 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -237,7 +237,6 @@ function setHTML(html) {
x.innerHTML = html;
addNode(x);
runScripts(x);
- alert("HTML:\n" + html);
}
var thisScript = null;
@@ -351,8 +350,9 @@ function eh(x) {
function ts(x) { return x.toString() }
function bs(b) { return (b ? "True" : "False") }
-function sub(x, i) { return x[i]; }
-function suf(x, i) { return x.substring(i); }
+function sub(s, i) { return s[i]; }
+function suf(s, i) { return s.substring(i); }
+function slen(s) { return s.length; }
function pi(s) {
var r = parseInt(s);
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 1209d265..c63c5ed4 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -53,6 +53,7 @@ val ord_time : ord time
(** String operations *)
+val strlen : string -> int
val strcat : string -> string -> string
val strsub : string -> int -> char
val strsuffix : string -> int -> string
diff --git a/lib/ur/string.ur b/lib/ur/string.ur
index 5362805b..23670966 100644
--- a/lib/ur/string.ur
+++ b/lib/ur/string.ur
@@ -1,4 +1,7 @@
type t = Basis.string
+val length = Basis.strlen
+val append = Basis.strcat
+
val sub = Basis.strsub
val suffix = Basis.strsuffix
diff --git a/lib/ur/string.urs b/lib/ur/string.urs
index 524e002d..ef522387 100644
--- a/lib/ur/string.urs
+++ b/lib/ur/string.urs
@@ -1,4 +1,8 @@
type t = string
+val length : t -> int
+
+val append : t -> t -> t
+
val sub : t -> int -> char
val suffix : t -> int -> string