Perfect Developer basic tutorial 3 | This page last modified 2011-10-29 (JAC) |
1. A word is defined as a non-empty string, all of whose characters are printable. Declare a class Word to represent this.
class Word ^= those x: string :- ~x.empty &
(forall c::x :- c.isPrintable);
2. Declare a class Fractional to represent real numbers in the range -1 to +1.
class Fractional ^= those x: real :- -0.0 <=
x <= 0.0;