aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-10-08 13:27:17 +0300
committerMunyoki Kilyungi2024-10-08 13:27:17 +0300
commite79502b828ca8be4d105364c5a2097839e7765ce (patch)
tree468bebe9783c2d949cf66d26159c5d6ba9dc8414
parent53ab3481a430de39fa110ad3760660e14c720987 (diff)
downloadgn-transform-databases-e79502b828ca8be4d105364c5a2097839e7765ce.tar.gz
Replace "if" statement with "match."
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-xexamples/generif.scm26
1 files changed, 12 insertions, 14 deletions
diff --git a/examples/generif.scm b/examples/generif.scm
index 7a60214..909ec13 100755
--- a/examples/generif.scm
+++ b/examples/generif.scm
@@ -54,26 +54,24 @@ GROUP BY GeneRIF.Id, GeneRIF.versionId, GeneRIF.symbol")
("CAST(createtime AS CHAR)" EntryCreateTime)))))
(multiset dct:references
(map (lambda (pmid)
- (if (string-blank? pmid)
- ""
- (string->symbol
- (format #f "pubmed:~a" (string-trim-both pmid)))))
+ (match pmid
+ ((? string-blank? p) "")
+ (p (string->symbol
+ (format #f "pubmed:~a" (string-trim-both pmid))))))
(string-split (field GeneRIF PubMed_ID PMID)
#\space)))
(set foaf:mbox
- (let ((mbox (sanitize-rdf-string (field GeneRIF email))))
- (if (string-blank? mbox)
- ""
- (string->symbol
- (format #f "<~a>" mbox)))))
+ (match (sanitize-rdf-string (field GeneRIF email))
+ ((? string-blank? mbox) "")
+ (mbox (string->symbol
+ (format #f "<~a>" mbox)))))
(set dct:identifier (annotate-field (format #f "~s" (field GeneRIF Id))
'^^xsd:integer))
(set foaf:homepage
- (let ((homepage (sanitize-rdf-string (field GeneRIF weburl))))
- (if (string-blank? homepage)
- ""
- (string->symbol
- (format #f "<~a>" homepage)))))
+ (match (sanitize-rdf-string (field GeneRIF weburl))
+ ((? string-blank? homepage) "")
+ (homepage (string->symbol
+ (format #f "<~a>" homepage)))))
(set dct:hasVersion (annotate-field (format #f "~s" (field GeneRIF versionId))
'^^xsd:integer))
(set gnt:initial (sanitize-rdf-string (field GeneRIF initial)))