On Sat, Oct 30, 2021 at 9:03 PM Ralph Mellor <ralphdjmel...@gmail.com>
wrote:

> On Sat, Oct 30, 2021 at 8:38 PM Sean McAfee <eef...@gmail.com> wrote:
> > Anyway, pretty cool!
>
> I agree it's cool, at least in a golfing sense.
>
> But is your explanation right?
>
> The *range* operator (`..`), if the rhs is less than the left,
> yields an empty list rather than iterating between the endpoints.
>
> In contrast, the *sequence* operator (`...`) iterates.
>

Uh.  Yeah.

I didn't explain why .. works for the zero-arg case and ... doesn't,
because the main point of my message was about the R metaoperator and the
associativity of the operator it creates.  But the difference you mention
is indeed exactly why .. works but ... doesn't.

[*] [\*] 0...1  ==> 0
[*] [\R*] 1..0  ==> 1

To expound even further, the second expression works because 1..0 is an
empty list, reducing that empty list with [\R*] produces another empty
list, and reducing *that* empty list with [*] produces 1, the
multiplicative identity element.

Reply via email to