Next: iklib syntaxes infix prec, Up: iklib syntaxes infix [Index]
Some expression syntax interpretation rules:
#!vicare (infix list("ciao", 'hello, '#ve(ascii "salut"))) ⇒ ("ciao" hello #ve(ascii "salut"))
(vicare)
are
interpreted as binary infix operators:
+ - * / div div0 mod mod0 expt fl+ fl- fl* fl/ flexpt fx+ fx- fx* fxdiv fxdiv0 fxmod fxmod0 < > <= >= = != fx<? fx>? fx<=? fx>=? fx=? fl<? fl>? fl<=? fl>=? fl=? eq? eqv? equal? and or xor bitwise-and bitwise-ior bitwise-xor bitwise-arithmetic-shift-left bitwise-arithmetic-shift-right fxand fxior fxxor fxarithmetic-shift-left fxarithmetic-shift-right
in addition the following identifiers are recognised by their symbol name and interpreted as aliases of binary infix operators:
&& → and \x23D0;\x23D0; → or \x00AC; → not \x2227; → and \x2228; → or \x22BB; → xor == → = <> → != \x00D7; → * \x22C5; → * ** → expt % → mod & → bitwise-and \x23D0; → bitwise-ior ^ → bitwise-xor << → bitwise-arithmetic-shift-left >> → bitwise-arithmetic-shift-right
where the symbols with escape sequences are:
Unicode character not sign.
Unicode character times.
Unicode character logical and.
Unicode character logical or.
Unicode character xor.
Unicode character dot operator.
Unicode character vertical bar extension.
(vicare)
are
interpreted as unary prefix operators:
+ - ++ -- fx+ fx- fl+ fl- not bitwise-not fxnot
in addition the following identifiers are recognised by their symbol name and interpreted as aliases of unary prefix operators:
! → not ~ → bitwise-not
(vicare)
are
interpreted as unary postfix operators:
++ --
in addition the following identifiers are recognised by their symbol name and interpreted as aliases of unary postfix operators:
! → factorial
expt
and flexpt
which are right–associative:
;; left-associative (infix 10 - 5 - 3) → (- (- 10 5) 3) (infix 10 - 5 - 3) → (- 10 5 3) (infix 10 / 5 / 3) → (/ (/ 10 5) 3) (infix 10 / 5 / 3) → (/ 10 5 3) ;; right-associative (infix 10 expt 5 expt 3) → (expt 10 (expt 5 3))
++
and --
are unary operators that can be
applied to expressions both in prefix and postfix positions. They
expand as follows:
#!vicare (infix ++ X) → (pre-incr! X) (infix -- X) → (pre-decr! X) (infix X ++) → (post-incr! X) (infix X --) → (post-decr! X)
where pre-incr!
, pre-decr!
, post-incr!
and
post-decr!
are the bindings exported by (vicare)
.
?
and
:
, which are recognised by their symbol name.
(infix 1 > 2 ? 3 + 4 : 5 * 6) → (if (> 1 2) (+ 3 4) (* 5 6))
(define (fun a b c) (+ a b c)) (infix fun (1, 2, 3)) → (fun 1 2 3)
NOTE The Scheme reader transforms the sequence:
, ?forminto:
(unsyntax ?form)so the list of arguments is:
( ?arg1 (unsyntax ?arg) ... )R6RS does not define the comma to be a delimiter, so writing:
func (?arg1, ?arg, ...)with no space between the ?arg and the comma is a syntax error in strict R6RS implementations. Vicare extends the reader to handle the comma as a delimiter, so the above expression is valid in the
infix
syntax.
quote
, quasiquote
, syntax
and
quasisyntax
are not subject to infix to prefix conversion; the
use of such syntaxes just expands to the prefix object:
(infix (quote ciao)) → (quote ciao) (infix (quasiquote ciao)) → (quasiquote ciao) (infix (syntax ciao)) → (syntax ciao) (infix (quasisyntax ciao)) → (quasisyntax ciao)
Next: iklib syntaxes infix prec, Up: iklib syntaxes infix [Index]