[darcs-devel] [patch1267] changed the argument order of PatchSet and backward operators

Ben Franksen ben.franksen at online.de
Mon Jun 15 19:23:34 UTC 2015


Ganesh Sittampalam wrote:
> On 15/06/2015 16:02, Ben Franksen wrote:
>> Ganesh Sittampalam wrote:
>>> On 14/06/2015 20:02, Ben Franksen wrote:
>>>> Ganesh Sittampalam wrote:
>>>>> On 14/06/2015 18:20, Ben Franksen wrote:
>>>
>>>>>> I am not wedded to :- (I agree that sometimes it looks weird,
>>>>>> especially with _ on the RHS i.e. p :- _). We could as well use :|:
>>>>>> or
>>>>>> :* (the latter is often used for product, so that might give people
>>>>>> :an
>>>>>> intuition).
>>>>>
>>>>> :|: wouldn't work well, because we have :||: for parallel pairs (pairs
>>>>> of patches with the same starting and ending contexts).
>>>>
>>>> Right. So what about (:*) ?
>>>
>>> I can live with that, though I'd prefer something less symmetric.
>> 
>> We still have a problem with the operator names. I was wrong to say that
>> the < and > symbols indicate the small and large arguments. I thought it
>> was so and payed the bill just now before I finally realized that I was
>> wrong.
>> 
>> I had also not taken into account the +>+ and +<+ operators for appending
>> FLs and RLs, respectively. With them there is no small or large argument.
>> So the only intuition is that the direction is as in the corresponding
>> FL/RL data constructor. If we also fix the constructor direction we'd
>> get:
>> 
>> :*	pair
>> :<:	FL cons
>> :>:RL cons
>> +<+	FL append
>> +>+	RL append
>> 
>> i.e. exactly the opposite of what we have now =:|
> 
> Just to expand on one proposal of mine from earlier, how about
> 
> :>    pair
> :>:   FL cons
> :>>:  RL cons (snoc)
> +>+   FL append
> +>>+  RL append

I feel quite strongly that the operator naming should (continue to) reflect 
the basic symmetry (or rather: duality) between FL and RL. None of them is 
any more or less fundamental than the other. (If anything, RL is more 
important than FL because most operations access the end of the history.)

Apart from < and >, the only opposite pair of ASCII symbols I found is / and 
\, so alternatively one could use / for FL (mnemonic for cons: upward stroke 
means LHS is smaller than RHS) and \ for RL as in:

:>      pair
:/:     FL cons
:\:     RL cons (snoc)
+/+     FL append
+\+     RL append

This would at least partly address your point because we no longer had 
operators "pointing in the wrong direction". It also enables use of :> for 
pairing without giving it any (misleading) association with FL.

Cheers
Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams




More information about the darcs-devel mailing list