core: Add string-length.

* src/strings.c (string_length): New function.
* mes/module/mes/scm.mes (string-length): Remove.
This commit is contained in:
Jan Nieuwenhuizen 2018-11-15 23:51:29 +01:00
parent 819b32e61c
commit 6af0b49f09
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 7 additions and 3 deletions

View file

@ -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))

View file

@ -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));
}