Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The language looks generally good for its goal, except these two operators

     |/y / maximum
 
     &/y / minimum
Those two characters have no connection with the operation they stand for and seem to be randomly picked from the available symbols on the keyboard. Why not simply max y and min y, which anybody can read and understand?


At least for boolean operations, | (or) can be thought of as the maximum of a vector of 0s (false) and 1s (true). Likewise, & (and) is the minimum of a vector of 0s (false) and 1s (true).

But I don't know if that was the motivation / justification for naming these operators / functions.


if you squint a bit, `x or y` returns the one that's greater, i.e. `0 or 1 == 1`; and `x and y` returns the one that's smaller, i.e. `0 and 1 == 0`. so min/max kind of are a generalization of and/or


Paraphrasing

  fold[max] y  # maximum
  fold[min] y  # minimum
Those two characters have no connection with the operation they stand for

  | — logical-or,  min
  & — logical-and, max

    0|1
  1
    1|42
  42


Sure they do, in most C-like languages || is OR and && is AND.

For OR, from

1 | 0 = 1

It's a small step to generalise to

N | 0 = N (~max)

and then

N | N-1 = N (max)

The same goes for &


Those are “or”=max, “and”=min. They are use sometimes in Mathematics (I have used them) but with the “low angle” and “up angle”. Not too frequently though.


Note that |/y is | (or) over y. Hence, max.


max and min are also available as keywords in k7/shakti




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: