{ ## START | x | x := (sprintf "%b %b" 123 (core.bit-not 123)) expected := "1111011 -1111100" if (core.eql? x "1111011 -1111100") { ## bit-inversion of 123 is -124. printf "OK: %s\n" expected } else { printf "BAD: x is not %s - %s\n" expected x } ##fun Number:"+"(b) { return (core.+ self b) } fun Number:+(b) { return (core.+ self b) } fun Number:-(b) { return (core.- self b) } fun Number:*(b) { return (core.* self b) } fun Number:/(b) { return (core./ self b) } fun Apex:==(b) { return (core.eql? self b) } fun Apex:~=(b) { return (core.nql? self b) } ## big numbers and fixed pointer decimals don't share the same object for the same values. ## we must use eql or nql, can't use eqv or nqv. expected := 2 if ((x := (1 + 2 * 3 / 4)) == expected) { ## note: there is no operator precedence since it doesn't no what operation each binop represents printf "OK: %d\n" expected } else { printf "BAD: x is not %d - %d\n" expected x } expected := 2.2 if ((x := (1.0 + 2 * 3 / 4)) ~= expected) { printf "BAD: x is not %O - %O\n" expected x } else { printf "OK: %O\n" expected } ## END }