I am curious ...

The functions max and min are defined over a tuple to return a tuple of the same type as per page 123 of the specification. You can also do

        var x = max(int(32))

and that works. Nice. I am curious at the semantics of that.

You also have max and min appearing in reductions nicely documented in the specification.

However, also

        x = min ( 10, 50)

returns x == 10.

But this seems to only appear in

        
https://chapel-lang.org/docs/latest/builtins/internal/UtilMisc_forDocs.html

which I found only by accident. It might be nice to stick that somewhere in the next revision of the specification or at least cross reference it.

In a 'reduce', max and min seem to be interpreted as operators and in other cases as overloaded functions. Is this true or do I just totally misunderstand the difference between a function/proc and an operator?

If they were operators as they appear to be in reduce you could say

        x = a min b

to yield the minimum of 'a' and 'b'.

G++ uses the extension '>?' and '<?' for max and min operators. I am mixed
about whether I like them.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to