Changeset 37971 in project
 Timestamp:
 10/30/19 02:31:35 (12 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

wiki/eggref/5/srfi105
r37969 r37971 31 31 ====== Neoteric expressions 32 32 33 nexpressions (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. 33 In part due to the way that Chicken's reader {{##sys#read}} is implemented, and 34 in part becasue of the way neotericexpression (nexpression) support is 35 implemented, nexpressions inside curly braces (e.g. {{f(x)}}) are only 36 partially supported. In particular, they will work as long as the nexpression 37 is not nested directly within a lisp expression. However, this can be worked 38 around by adding curly brackets directly around the nexpression. 39 40 To show what this means, here are some (nonexhaustive) examples: 41 42 DOES work  simple nexpressions: 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 48 DOES work  nested/chained nexpressions: 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 57 DOES NOT work  nexpressions 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 66 nexpression support is implemented by locally modifying the internal 67 {{##sys#read}} procedure which is not itself recursive, but rather uses an 68 internal (and inaccesible) recursive read procedure. This means any 69 modifications made to {{##sys#read}} procedure cannot take effect inside lisp 70 expressions, as the internal recursive read handles those and has no knowledge 71 of the modifications. 72 73 The internal read procedure does however have knowledge of special read syntax, 74 which is why this limitation can be 'escaped' with more curly bracket 75 expressions. 76 77 This could potentially be worked around with a solid parser, but is a little 78 out of the scope of this extension. 38 79 39 80 ==== srfi105.extra … … 208 249 === Version History 209 250 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 210 255 ; 0.1.3 : Rename extras module to srfi105.extra 211 256 ; 0.1.2 : Use standard keyword syntax, properly check for (#:other) group
Note: See TracChangeset
for help on using the changeset viewer.