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

Raku (https://raku.org) supports the same design as Python3 ...

  0 < 5 < 100;     #True
  10 == 10 == 10;  #True
The Chaining Binary Precedence is specified for this https://docs.raku.org/language/operators#Chaining_binary_pre...

That means you can make your own chaining comparison ops (or overload the current ones) with something like:

  multi infix:<~=>(Rat $l, Rat $r) { ($l-$r) < 0.1 ?? True !! False }
        is equivalent('<');
Much of Raku such as the default use of Rationals (Rat) is intended to make the language more approachable for non CS experts, so yes:

  0.1 + 0.2 = 0.3 # True


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

Search: