From 630e733ca860dcd97517adb8ef663a9d204ad22e Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Tue, 3 Sep 2024 03:29:14 +0900 Subject: Add `operator-prefix-symbol` to (qklib infix rule-set) --- qklib/infix/rule-set.scm | 8 ++++++-- 1 file 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 (make-prefix symbol flip?) prefix? -- cgit v1.2.3