(* Vending machine *) datatype Event = Epsilon | Nickle of Event | Dime of Event | Quarter of Event | Orange of Event | Apple of Event (* 0 deposited *) fun S0 Epsilon = NONE | S0 (Nickle C) = S1 C | S0 (Dime C) = S2 C | S0 (Quarter C) = S5 C | S0 (Orange C) = S0 C | S0 (Apple C) = S0 C (* 5 deposited *) and S1 Epsilon = NONE | S1 (Nickle C) = S2 C | S1 (Dime C) = S3 C | S1 (Quarter C) = S6 C | S1 (Orange C) = S1 C | S1 (Apple C) = S1 C (* 10 deposited *) and S2 Epsilon = NONE | S2 (Nickle C) = S3 C | S2 (Dime C) = S4 C | S2 (Quarter C) = S6 C | S2 (Orange C) = S2 C | S2 (Apple C) = S2 C (* 15 deposited *) and S3 Epsilon = NONE | S3 (Nickle C) = S4 C | S3 (Dime C) = S5 C | S3 (Quarter C) = S6 C | S3 (Orange C) = S3 C | S3 (Apple C) = S3 C (* 20 deposited *) and S4 Epsilon = NONE | S4 (Nickle C) = S5 C | S4 (Dime C) = S6 C | S4 (Quarter C) = S6 C | S4 (Orange C) = S4 C | S4 (Apple C) = S4 C (* 25 deposited *) and S5 Epsilon = NONE | S5 (Nickle C) = S1 C | S5 (Dime C) = S6 C | S5 (Quarter C) = S6 C | S5 (Orange C) = S5 C | S5 (Apple C) = S5 C (* 30 deposited *) and S6 Epsilon = NONE | S6 (Nickle C) = S6 C | S6 (Dime C) = S6 C | S6 (Quarter C) = S6 C | S6 (Orange C) = S0 C | S6 (Apple C) = S0 C