From a0baa9819631ed59d64378deee76feba2153b7e7 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 4 Jan 2017 20:56:47 +0100 Subject: [PATCH] Add string-take, string-drop. * module/srfi/srfi-13.mes (string-take, string-drop): New functions. --- module/srfi/srfi-13.mes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/srfi/srfi-13.mes b/module/srfi/srfi-13.mes index 18a7f650..c4e34c46 100644 --- a/module/srfi/srfi-13.mes +++ b/module/srfi/srfi-13.mes @@ -52,3 +52,9 @@ (loop (cdr rest) (append result (list (list->string (list-head lst (- (length lst) (length rest))))))))))) + +(define (string-take s n) + (list->string (list-head (string->list s) n))) + +(define (string-drop s n) + (list->string (list-tail (string->list s) n)))