diff options
author | Munyoki Kilyungi | 2023-03-27 22:49:49 +0300 |
---|---|---|
committer | BonfaceKilz | 2023-04-05 16:17:11 +0300 |
commit | dc1cdc6c11be05cb21e5b68b6f0d147165867864 (patch) | |
tree | 23de291f19d35ce704b390448f264971b7e67008 | |
parent | 274c4cc42c5451fd073f577bf1592aed091dacf7 (diff) | |
download | gn-transform-databases-dc1cdc6c11be05cb21e5b68b6f0d147165867864.tar.gz |
Add new special form for representing blank nodes
* dump.scm (blank-node): New macro.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-x | dump.scm | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -192,6 +192,28 @@ ALIST field-name) forms." (string-append dump-table "_" (remove-namespace (symbol->string predicate))))))) +(define-syntax blank-node + (syntax-rules () + "Allow having set and multiset within the context of a blank-node" + [(_ (op predicate object) ...) + (let [(node (string-join + (filter-map (match-lambda + ((pred . obj) + (match obj + ((and (? string? obj) + (? string-null? obj)) + #f) + ((? symbol? obj) + (format #f "~a ~a" pred (symbol->string obj))) + (_ + (format #f "~a ~s" pred obj))))) + (map-alist '() + (op predicate object) ...)) + " ; "))] + (if (string-null? node) + "" + (format #f "[ ~a ]" node)))])) + (define-syntax syntax-let (syntax-rules () "Like match-let, but for syntax. |