diff options
Diffstat (limited to 'transform')
-rw-r--r-- | transform/strings.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/transform/strings.scm b/transform/strings.scm index 98f828f..c7eb64a 100644 --- a/transform/strings.scm +++ b/transform/strings.scm @@ -10,6 +10,7 @@ string-split-substring delete-substrings replace-substrings + remove-duplicates sanitize-rdf-string snake->lower-camel string-capitalize-first)) @@ -99,3 +100,9 @@ association list mapping substrings to their replacements." (string-titlecase (string-downcase string) 0 1)) +(define (remove-duplicates lst) + (let loop ((lst lst) (result '())) + (cond + ((null? lst) (reverse result)) + ((memq (car lst) result) (loop (cdr lst) result)) + (else (loop (cdr lst) (cons (car lst) result)))))) |