[darcs-devel] patch list concatenation
Ganesh Sittampalam
ganesh at earth.li
Mon May 24 12:10:25 UTC 2021
On 24/05/2021 07:36, Ben Franksen wrote:
>>> * use +<<+ instead of +<+ reverseFL
>>
>> Fine though I'm not actually sure this is an improvement, it doesn't
>> have a complexity advantage and is another operator to remember.
>
> It is true that it does not have better asymptotic complexity but it
> fuses the two traversals.
Right. My feeling was that it doesn't really matter. If this was the
only consideration, we could also use a RULES pragma to rewrite it
inside the module.
> Regarding the cognitive burden: We have four concatenation operators:
> +<+ +>+ +<<+ +>>+. They all have the same meaning, but differ in the
> argument and result types. When reading code, it doesn't matter which
> one is used: you can mentally replace them all with "concatenate these
> two lists" without spending any thought on the concrete types.
I suspect my initial reaction was because I didn't remember what it did,
as it's used quite rarely. I might remember next time :-)
Ganesh
More information about the darcs-devel
mailing list