aboutsummaryrefslogtreecommitdiff
path: root/qklib
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-09-03 03:29:14 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-09-03 03:29:14 +0900
commit630e733ca860dcd97517adb8ef663a9d204ad22e (patch)
tree55f70cec314a5820691d52b61dcaaa5daada8e9b /qklib
parent09f34fb35201affe4cd40d674456023504b5b15e (diff)
Add `operator-prefix-symbol` to (qklib infix rule-set)
Diffstat (limited to 'qklib')
-rw-r--r--qklib/infix/rule-set.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/qklib/infix/rule-set.scm b/qklib/infix/rule-set.scm
index 0c83d8d..70c3540 100644
--- a/qklib/infix/rule-set.scm
+++ b/qklib/infix/rule-set.scm
@@ -21,6 +21,7 @@
operator
operator?
operator-symbol
+ operator-prefix-symbol
operator-precedence
operator-left?
operator-prefix
@@ -67,8 +68,7 @@
(hashmap-unfold null?
(lambda (ops)
(let ((op (car ops)))
- (values (cond ((operator-prefix op) => prefix-symbol)
- (else (operator-symbol (car ops))))
+ (values (operator-prefix-symbol op)
(car ops))))
cdr
ops
@@ -105,6 +105,10 @@
(error "operator: The 3rd argument must be 'left or 'right" left-or-right))
(make-operator symbol precedence (eq? 'left left-or-right) unit prefix))))
+ (define (operator-prefix-symbol op)
+ (cond ((operator-prefix op) => prefix-symbol)
+ (else (operator-symbol op))))
+
(define-record-type <prefix>
(make-prefix symbol flip?)
prefix?