some clarification on sre syntax Duy Nguyen (19 Jul 2019 08:57 UTC)
Re: some clarification on sre syntax John Cowan (19 Jul 2019 17:16 UTC)
Re: some clarification on sre syntax Duy Nguyen (20 Jul 2019 00:52 UTC)

Re: some clarification on sre syntax Duy Nguyen 20 Jul 2019 00:51 UTC

On Sat, Jul 20, 2019 at 12:16 AM John Cowan <xxxxxx@ccil.org> wrote:
>> Many sre forms accept multiple <sre> but it's not exactly clear how to
>> interpret it. For example, what does (submatch <sre-1> <sre-2>) mean?
>> I suppose it's the same as (submatch (seq <sre-1> <sre-2>)) though I'm
>> not sure if that's intended.
>
>
> It's always "implicit seq", like the "implicit begin" in similar Scheme constructs like lambda and define.

It's not always "seq" though. (or <sre>...) definitely cannot be
rewritten as (or (seq <sre>...)). If the document is updated, maybe we
should add a line about this implicit seq.

>> (~ sre1 sre2 sre3) could use some elaboration too. It briefly mentions
>> "complement _of union_" in the syntax summary. (- sre1 sre2 sre3)
>> follows the same "of union" rule according to chibi scheme, though it
>> feels weird because (- 1 2 3) is (- (- 1 2) 3) not (- 1 (+ 2 3)).''
>
>
> I don't follow you.  In Scheme, (- 1 2 3), (- (- 1 2) 3), and (- 1 (+ 2 3)) are all -4, which could be described as "difference of sum".  (Long ago I worked with a Lisp in which - and / were right-associative, so that (- 1 2 3) was (+ -1 +2 -3), but that has never been true in any mainstream Lisp.)

Ah I didn't realize that. So implementing (- <sre>...) as
(char-set-difference <cset> ...) also works and chibi's way is
probably more of an optimization.
--
Duy