% $Id: ChoiceExamples.oz,v 1.1 2007/11/26 20:01:28 leavens Exp leavens $ \insert 'SolveFirst.oz' declare fun {Vowel} choice a [] e [] i [] o [] u end end % Solve returns a lazy List L = {Solve Vowel} {Browse L} {Delay 5000} _={List.take L 2} % A choice suspends if used directly % {Browse {Vowel}} % But can be used in a search with Solve {Browse {List.take {Solve Vowel} 4}} % fail continues with next alternative of most recent choice fun {Distinct} V1 V2 in V1={Vowel} V2={Vowel} if V1 == V2 then fail end V1#V2 end {Browse {List.take {Solve Distinct} 7}} {Browse {List.take {Solve Distinct} 15}}