Re: [Scheme-reports] editorial awkwardness for syntax-rules pattern-matching
Per Bothner 04 Sep 2014 00:47 UTC
On 09/03/2014 04:40 PM, John Cowan wrote:
> Per Bothner scripsit:
>
>> Much clearer to write:
>>
>> P is of the form (P_1 . . . P_k P_e ellipsis P_k+1 ... P_k+l)
>> where E is a proper list of n elements, the first
>> k of which match P_1 through P_k , respectively, whose
>> next n−k-l elements each match P_e, whose remaining
>> l elements match P_k+1 through P_k+l
>
> I don't see where the aditional clarity comes in;
Well, in my opinion 'P is of the form (P_1 . . . P_k P_e ellipsis P_m+1 ... P_n)'
is somewhat nonsensical. Where do m and n come from? n is the length of E, but m
is complicated to describe as it depends on both n and the number of patterns
in P following the ellipsis. This seems a rather unusual way to enumerate items in
a list.
Using l (or m) for the number of sub-patterns following the ellipsis is much
easier to understand: l is just the number of sub-patterns following the ellipsis,
and this is obvious from the form P_k+1 ... P_k+l.
> also, having both 1 and l in a formula is asking for trouble.
That occurred to me. Using m in place of l is one option.
Even better if we're willing to use other letters beside P for sub-patterns:
P is of the form (P_1 . . . P_k Q ellipsis R_1 ... R_m)
where E is a proper list of n elements, the first
k of which match P_1 through P_k , respectively, whose
next n−k-m elements each match Q, whose remaining
m elements match R_1 through R_m
--
--Per Bothner
per@bothner.com http://per.bothner.com/
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports