This page is part of the web mail archives of SRFI 110 from before July 7th, 2015. The new archives for SRFI 110 contain all messages, not just those from before July 7th, 2015.
On 3/18/13, Shiro Kawai <shiro@xxxxxxxx> wrote: > From: Alan Manuel Gloria <almkglor@xxxxxxxxx> > Subject: The ". $" notation (was: Re: how useful are collecting lists?) > Date: Mon, 18 Mar 2013 09:26:04 +0800 > >> 1. Allow "foo . EOL INDENT x ..." ==> "(foo . (x ...))" >> 2. Allow "foo . $ x ..." ==> "(foo x ...)" > > Is the latter "foo . $ x y ..." ==> "(foo x y ...)"? > Because "$" is a valid R5RS identifier, we need to > parse "foo . $ EOL" as a cons of 'foo and '$, correct? > > I'm a bit concerned that it might be confusing that: > > foo . ($ a b c) > > is > > foo . > $ a b c Uhm, no. "$" has a different meaning in an indentation context vs. a non-indentation context. Inside () [] {}, it is *not* in indentation context and thus "$" is the symbol (string->symbol "$") Outside of *explicit* () [] {}, $ means SUBLIST, which has a specific semantic meaning. See: http://srfi.schemers.org/srfi-110/srfi-110.html#sublist So: foo . ($ a b c) ==> (foo . ($ a b c)) ==> (foo $ a b c) and: foo . $ a b c ==> foo . ((a b c)) ==> (foo . ((a b c))) ==> (foo (a b c)) If what you mean is: foo . ($ a b c) is: foo . ($ a b c) Then indentation rules (specifically the "single datum on a line is that datum" rule) make them identical. foo . ($ a b c) ==> (foo . ($ a b c)) ==> (foo $ a b c) If you want to have "$" consistently in either an indentation or in non-indentation contexts, then use {$} instead: foo . {$} ==> (foo . $) (foo . {$}) ==> (foo . $) > > but > > foo . $ $ a b c > > (The two '$' has different meanings!) *shrug* yes. Basically in an indentation context the first SUBLIST re-enters it_expr production. it_expr can start with SUBLIST, which re-enters it_expr and wraps its result in a single-item list, and the outer SUBLIST then appends it as a single item to the outer list. Assuming that "." is at first a symbol which a subsequent pass then converts to the conventional meaning, then: foo . $ $ a b c On reaching the first SUBLIST, the parser has collected (foo |.|) as the initial "head" production's value. The parser consumes that SUBLIST (leaving "$ a b c") in the input stream, and re-enters it_expr. it_expr can start with SUBLIST (consuming the remaining $ and leaving "a b c" in the input stream), and re-enters it_expr again. it_expr then yields the value (a b c). Its next outermost call (the one triggered by the second SUBLIST) wraps a layer of list, yielding ((a b c)). The next outermost call (the one triggered by the first SUBLIST) appends the yielded value as a single item (i.e. an "append1" or "snoc"), so yielding (foo |.| ((a b c))) Assuming that (foo |.| ((a b c))) is then processed to (foo . ((a b c))), then we get (foo (a b c)). And incidentally, thus: foo $ a b c ==> (foo (a b c)) while, as shown above: foo . $ $ a b c ==> (foo (a b c)) So both SUBLIST's have the same meaning, while basically a "." cancels out a subsequent "$". Sincerely, AmkG