Changeset 37971 in project


Ignore:
Timestamp:
10/30/19 02:31:35 (3 weeks ago)
Author:
dieggsy
Message:

Document more recent versions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/srfi-105

    r37969 r37971  
    3131====== Neoteric expressions
    3232
    33 n-expressions (neoteric expressions) inside curly braces (e.g. {{f(x)}}) are
    34 implemented in a different way from the reference implementation's
    35 recommendation, but '''should be fully supported''', including arbitrary
    36 nesting ({{f(g(x))}}) and chaining ({{f(x)(y)}}). If any neoteric expression
    37 does not work correctly, this should be considered a bug.
     33In part due to the way that Chicken's reader {{##sys#read}} is implemented, and
     34in part becasue of the way neoteric-expression (n-expression) support is
     35implemented, n-expressions inside curly braces (e.g. {{f(x)}}) are only
     36partially supported. In particular, they will work as long as the n-expression
     37is not nested directly within a lisp expression. However, this can be worked
     38around by adding curly brackets directly around the n-expression.
     39
     40To show what this means, here are some (non-exhaustive) examples:
     41
     42DOES work - simple n-expressions:
     43
     44* {{{f(x)} ⇒ (f x)}}
     45* {{{f(x) + 1} ⇒ (+ (f x) 1)}}
     46* {{{3 + f(x) + g(x)} ⇒ (+ 3 (f x) (g x))}}
     47
     48DOES work - nested/chained n-expressions:
     49
     50* DOES work: {{{f(x)(y)(z)} ⇒ (((f x) y) z)}}
     51* DOES work: {{{3 + 4 + f(x)(y)(z)} ⇒ (+ 3 4 (((f x) y) z))}}
     52* DOES work: {{{f(g(h(x)))} ⇒ (f (g (h x)))}}
     53* DOES work: {{{f(g(h(x))) * 5 * 3} ⇒ (* 5 3 (f (g (h x))))}}
     54* DOES work: {{{f(g(h(x)))(y)} ⇒ ((f (g (h x))) y)}}
     55* DOES work: {{{f(g{h(x) + 1})} ⇒ (f (g (+ (h x) 1)))}}
     56
     57DOES NOT work - n-expressions nested inside lisp syntax:
     58
     59* {{{ (f (g h(x))) } ⇒ (f (g (h x)))}} - use {{{ (f (g {h(x)})) }}} instead
     60* {{{#(1 2 f(a) 4)} ⇒ #(1 2 (f a) 4)}} - use  {{{#(1 2 {f(a)} 4)}}} instead
     61* {{{(f #;g(x) h(x))} ⇒ (f (h x))}} - no workaround available
     62* Any of the above working neoteric expressions within any lisp syntax - enclose them with additional curly brackets instead.
     63
     64===== Further details
     65
     66n-expression support is implemented by locally modifying the internal
     67{{##sys#read}} procedure which is not itself recursive, but rather uses an
     68internal (and inaccesible) recursive read procedure. This means any
     69modifications made to {{##sys#read}} procedure cannot take effect inside lisp
     70expressions, as the internal recursive read handles those and has no knowledge
     71of the modifications.
     72
     73The internal read procedure does however have knowledge of special read syntax,
     74which is why this limitation can be 'escaped' with more curly bracket
     75expressions.
     76
     77This could potentially be worked around with a solid parser, but is a little
     78out of the scope of this extension.
    3879
    3980==== srfi-105.extra
     
    208249=== Version History
    209250
     251; 0.1.6 : Add simpler and more robust neoteric expression support
     252; 0.1.5 : Rewrite curly expression reader more in accordance with reference
     253; 0.1.5 : Rewrite curly expression reader more in accordance with reference
     254; 0.1.4 : Temporarily drop neoteric expression support
    210255; 0.1.3 : Rename extras module to srfi-105.extra
    211256; 0.1.2 : Use standard keyword syntax, properly check for (#:other) group
Note: See TracChangeset for help on using the changeset viewer.