aboutsummaryrefslogtreecommitdiff
path: root/dump/triples.scm
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-07-10 12:22:29 +0300
committerBonfaceKilz2023-07-30 12:29:56 +0300
commit9fd4ef6dc5512aacdc60c1bf0dc378d72a8a3dfe (patch)
treefeff08fdf54a9e68fd735976a4858e9da1c54bc8 /dump/triples.scm
parent7da7e15ac9fa0422caa4fc560f3c6957c2dbcc24 (diff)
downloadgn-transform-databases-9fd4ef6dc5512aacdc60c1bf0dc378d72a8a3dfe.tar.gz
Pass port as an optional argument
* dump/triples.scm (triple): Add port as an optional argument. Defaults to #t. This enables us to use triple to print to other ports E.g in the case of dumping documentation to a different file. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'dump/triples.scm')
-rw-r--r--dump/triples.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/dump/triples.scm b/dump/triples.scm
index a0f8213..19817bd 100644
--- a/dump/triples.scm
+++ b/dump/triples.scm
@@ -44,7 +44,9 @@ characters with an underscore and prefixing with gn:PREFIX."
(string->symbol
`,(format #f "~a~a" prefix value))))
-(define (triple subject predicate object)
+(define* (triple subject predicate object
+ #:optional
+ (port #t))
(unless (or (string? subject)
(symbol? subject))
(error "Triple subject not a string or symbol:"
@@ -63,7 +65,7 @@ characters with an underscore and prefixing with gn:PREFIX."
(? (lambda (el) (string-match "^\\[ .* \\]$" el)) object))
"~a ~a ~a .~%")
(_ "~a ~a \"~a\" .~%"))])
- (format #t pattern subject predicate
+ (format port pattern subject predicate
(if (symbol? object) (symbol->string object) object))))
(define (scm->triples alist id)