about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-09-14 13:34:39 +0530
committerArun Isaac2021-09-14 13:39:46 +0530
commit573f49eb873651f1fecfda352007da8429e2bc8a (patch)
tree68a36a7350fcb5e164ec35f7ed2d8ce98f2c0807
parent2dd92a874655087181123276f9d3d02003a7bb94 (diff)
downloadgn-transform-databases-573f49eb873651f1fecfda352007da8429e2bc8a.tar.gz
Abstract out deleting substrings.
* dump.scm (delete-substrings): New function.
(dump-publication): Replace string-replace-substring with
delete-substrings.
-rwxr-xr-xdump.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/dump.scm b/dump.scm
index 88e0bbc..0e57a03 100755
--- a/dump.scm
+++ b/dump.scm
@@ -75,6 +75,11 @@
 
 ;;; Dump tables
 
+(define (delete-substrings str . substrings)
+  (fold (lambda (substring result)
+          (string-replace-substring result substring ""))
+        str
+        substrings))
 
 (define (snake->lower-camel str)
   (let ((char-list (string->list str)))
@@ -244,7 +249,7 @@ Lab_code, Submitter, Owner, Authorized_Users FROM Phenotype"))
                                     ;; TODO: Handle unprintable
                                     ;; characters better.
                                     (list (cons 'gn:abstract
-                                                (string-replace-substring abstract "\x01" ""))))
+                                                (delete-substrings abstract "\x01"))))
                                    (x (list x)))
                                  (process-metadata-alist alist))
                      id)))