• Operators (Algol 68) (was Re: iso646.h)

    From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Fri Jan 26 02:08:09 2024
    On 25.01.2024 21:06, Lawrence D'Oliveiro wrote:

    Why not do what Algol-68 did, and specify a set of characters that could
    be used to define new custom operators?

    What do you mean by "specify a set of characters that could be used"?

    In Algol(68) you can use punctuation characters, letters, or words.
    Just declare the operator and its priority.

    A few examples from some old test source code on my disk...

    OP H = (INT a, b) INT : ( a+b );
    PRIO H = 5;
    OP ~ = (INT a, b) INT : ( a+b );
    PRIO ~ = 5;
    IF 2 H 3 = 5 THEN print (62) ELSE print (63) FI;
    IF 2 ~ 3 = 5 THEN print (72) ELSE print (73) FI;

    PRIO O = 9;
    OP O = (INT a, b) INT : a * b;
    print ((a O b + 1))

    OP MAX = (INT a, INT b) INT : ( a > b | a | b );
    PRIO MAX = 4;
    print (5 MAX 7);


    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)