Re: Converting from 0 and 1 to -1 and 1



On 05/10/10 18:12, Jussi Piitulainen wrote:
Anything vaguely usable with three operands would do. Median of
three numbers. Majority vote of three booleans.

Many of these are just special cases of N-operand operators. The
challenge is an operator syntax that allows an arbitrary number of
operands (and which doesn't look like a single operand which happens
to be a list, although that is another way of doing it).
Yes, I have trouble thinking up any naturally ternary operations. As
soon as the notation has brackets and a comma in it, it is natural to
extend the number of operands arbitrarily. We do zero, one, two, many.

Think again: function call is an N-ary operator

all the unary, binary, ternary operator can be thought a syntax sugar
for calling functions (some gotcha: laziness).


btw, is there any language that have zero-ary operator? otherise we
should go one, two, many not zero, one, two, many...
.



Relevant Pages

  • Re: Converting from 0 and 1 to -1 and 1
    ... > Many of these are just special cases of N-operand operators. ... > challenge is an operator syntax that allows an arbitrary number of ... extend the number of operands arbitrarily. ... Certainly in the languages I'm involved with, ...
    (comp.programming)
  • Re: Converting from 0 and 1 to -1 and 1
    ... challenge is an operator syntax that allows an arbitrary number of ... operands (and which doesn't look like a single operand which happens ... extend the number of operands arbitrarily. ... in Haskell, function call is binary, which is a kind of N-ary. ...
    (comp.programming)
  • Re: Converting from 0 and 1 to -1 and 1
    ... challenge is an operator syntax that allows an arbitrary number of ... extend the number of operands arbitrarily. ... function call is an N-ary operator ... in Haskell, function call is binary, which is a kind of N-ary. ...
    (comp.programming)
  • Re: Converting from 0 and 1 to -1 and 1
    ... Many of these are just special cases of N-operand operators. ... The challenge is an operator syntax that allows an arbitrary ... natural to extend the number of operands arbitrarily. ... Not in the minds of the people who succesfully speak of ?: ...
    (comp.programming)