diff --git a/mes/module/mes/scm.mes b/mes/module/mes/scm.mes index 25dcb2fa..3ca92ca1 100644 --- a/mes/module/mes/scm.mes +++ b/mes/module/mes/scm.mes @@ -194,9 +194,6 @@ (define (make-string n . fill) (list->string (apply make-list n fill))) -(define (string-length s) - (length (string->list s))) - (define (string-ref s k) (list-ref (string->list s) k)) diff --git a/src/strings.c b/src/strings.c index 11630a26..9073c2a9 100644 --- a/src/strings.c +++ b/src/strings.c @@ -260,3 +260,10 @@ string_append (SCM x) ///((arity . n)) } return make_string (buf, size); } + +SCM +string_length (SCM string) +{ + assert (TYPE (string) == TSTRING); + return MAKE_NUMBER (LENGTH (string)); +}