I haven't follow all the discussions nor read all specification (WTF?!), so I'm not sure if the following code is too much #\{ and #\} or it's supposed to be like this;
;; Sagittarius need this line
#!read-macro=curly-infix
;; For portability with other implementations.
#!curly-infix
(import (rnrs))
(define (fact n)
(if {n = 0}
1
;; Here, it seems too much. If I could write
;; fact(n - 1), it seems way better. But my
;; implementation (mostly taken from reference
;; implementation) doesn't allow me.
{n * fact({n - 1})}))
{print fact(5)} ;; -> 120
As far as I understood, inside of #\( must be treated the same as usual Scheme way. So if I want to pass calculated argument(s) with infix style, then I need to wrap with extra pair of #\{ and #\}. If I'm not understanding correctly, please let me know :-)Some part such as
{n = 0} might be easier to understand for people who are not so familier with polish notation. However for people who already wrote a lot of Lisp programme, this might make them confused (or maybe not?).Anyway, providing choices to users is a good thing, I believe.
No comments:
Post a Comment