<div dir="ltr">GCC has min and max operators, and the syntax is very clever:<div style>  min = a <? b;</div><div style>  max = a >? b;</div><div style>Ie, a shorthand of the ?: operator, in a similar way that C# has '??' (another really nice shorthand).</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 2 March 2013 10:20, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Maybe #* #max #min? (Also usable with a "=" prefix, #=* #=max #=min).<br>
</blockquote>
<br></div>
Sorry, I meant postfix:<br>
<br>
#*= #max= #min=<br>
<br>
So instead of:<br>
<br>
foo = min(foo, bar);<br>
foo = foo.min(bar);<br>
<br>
You write:<br>
<br>
foo #min= bar;<br>
<br>
(This syntax is generalizable to any diadic function. But I don't think D has to go there.)<br>
<br>
<br>
An alternative syntax:<br>
<br>
@* @max @min @*= @max= @min=<br>
<br>
Another alternative syntax for the second multiplication operator:<br>
<br>
auto M3 = M1 ^* M2;<br>
<br>
Having all future D scientific libraries use the same nice and clean standard operator has some advantages.<br>
<br>
Bye,<br>
bearophile<br>
</blockquote></div><br></div>