<div dir="ltr"><div><div><div><div><div>Speaking of invariants, from time to time I would like Racket to know some properties about its usual operators, so that some usual treatments get simplified and can be easily generalized.<br>

<br></div>For example, considering group theory, properties like &#39;identity-element&#39;, &#39;absorbing-elements&#39;, &#39;inverse-operator&#39;, &#39;commutative?&#39;, &#39;associative?&#39; and such could be attached to operators like `+&#39;, `*&#39;, `max&#39;, `string-append&#39;, `hc-append&#39;, etc.<br>

</div>Forms like `for/op&#39; could use this information to know how to loop and accumulate, and even possibly to optimize the code, even for newly created operators.<br></div><div>In the simple case of + and such, one also only needs to define the binary operator, and the multi-argument procedure can be generated automatically.<br>

<br></div><div>Of course it needs not be tied to group/category/mathematical theory. It can be about whatever is useful.<br></div><br></div>It&#39;s only an idea, in case this resonates for someone.<br><br></div>Laurent<br>

</div>