Next: iklib syntaxes increments, Previous: iklib syntaxes splice1st, Up: iklib syntaxes [Index]
The infix
macro converts the traditional infix notation for
mathematical expressions to the equivalent Scheme’s prefix notation.
infix
expands to a prefix expression to be evaluated at
run–time, in the lexical context of the macro use; as a special case
(infix)
is equivalent to (values)
.
The macro allows us to evaluate forms like:
(infix atan(1, 2)) → (atan 1 2) (infix 1 + 2 + 3) → (+ (+ 1 2) 3) (infix 1 + 2 * 3) → (+ 1 (* 2 3)) (infix (1 + 2) * 3) → (* (+ 1 2) 3) (infix 2 expt 3 expt 4) → (expt 2 (expt 3 4)) (infix 2 ** 3 ** 4) → (expt 2 (expt 3 4)) (infix - 5) → (- 5) (infix + 5) → (+ 5) (infix 5 !) → (factorial 5) (infix 1 > 2 ? 3 + 4 : 5 * 6) → (if (> 1 2) (+ 3 4) (* 5 6)) (define a 1) (define b 2) (define c 3) (infix cos(a) * tan(b) / c) → (/ (* (cos a) (tan b)) c)
• iklib syntaxes infix syntax: | Notes on the supported syntax. | |
• iklib syntaxes infix prec: | Operators precedence. | |
• iklib syntaxes infix notes: | Random notes on the features. |