TSa (Thomas Sandlaß) wrote:
I'm not sure but Perl6 could do better or at least trickier ;) Let's assume that < > <= >= when chained return an accumulated boolean and the least or greatest value where the condition was true. E.g. 0 < 2 < 3 returns 0 but true 1 < 2 < 1 returns 1 but false 4 < 5 < 2 returns 2 but false
An interesting idea, but seems a bit heavy..
Is it correct that [min] won't parse unless min is declared as an infix op, which looks a bit strange? if 3 min 4 { ... }
Sure. Again there is a Haskell example to heed closely here; for instance, the function: divMod :: (Integral a) => a -> a -> (a, a) Can be written as either; divMod 42 9 or: 42 `divMod` 9 The reverse direction is (); (+) :: (Num a) => a -> a -> a (+) 7 5 7 + 5 Sam.