guile-devel
[Top][All Lists]

## Re: SRFI-105 is now in Guile!

 From: nalaginrut Subject: Re: SRFI-105 is now in Guile! Date: Mon, 29 Oct 2012 13:58:04 +0800

```Ah~very good news!

On Fri, 2012-10-26 at 21:51 -0400, Mark H Weaver wrote:
> Hello all,
>
> I'm pleased to announce that Guile's built-in reader (on the stable-2.0
> branch) now includes full support for SRFI-105 curly-infix expressions.
> To use it, simply put "#!curly-infix" in a code (or data) file before
> the first use of curly-infix notation.
>
> See <http://srfi.schemers.org/srfi-105/srfi-105.html> for details, but
> here are some examples:
>
>      #!curly-infix
>
>      {n <= 5}                =>  (<= n 5)
>      {{a > 0} and {b >= 1}}  =>  (and (> a 0) (>= b 1))
>      {a + b + c}             =>  (+ a b c)
>      {a * {b + c}}           =>  (* a (+ b c))
>      {(- a) / b}             =>  (/ (- a) b)
>      {-(a) / b}              =>  (/ (- a) b) as well
>      {(f a b) + (g h)}       =>  (+ (f a b) (g h))
>      {f(a b) + g(h)}         =>  (+ (f a b) (g h)) as well
>      '{a + f(b) + x}         =>  '(+ a (f b) x)
>      {length(x) >= 6}        =>  (>= (length x) 6)
>      {n-1 + n-2}             =>  (+ n-1 n-2)
>      {n * factorial{n - 1}}  =>  (* n (factorial (- n 1)))
>      {f{n - 1}(x)}           =>  ((f (- n 1)) x)
>      {a . z}                 =>  (\$nfx\$ a . z)
>      {a + b - c}             =>  (\$nfx\$ a + b - c)
>      {f[a b] + g(h)}         =>  (+ (\$bracket-apply\$ f a b) (g h))
>
> For those who are skeptical, I would encourage you to read the spec with
> an open mind.  Unlike most previous infix proposals, SRFI-105 preserves
> the special properties of s-expressions that make them so powerful.
> Most notably, curly-infix expressions are _generic_ (the notation does
> not depend on an underlying semantic) and _homoiconic_ (the underlying
> data structure is clear from the syntax).
>
>     Enjoy!
>      Mark
>

```