use "bb_search.sml"; fun bbOdoIncr4 [] = NONE | bbOdoIncr4 (x::xs) = if x < 4 then SOME ((x+1)::xs) else bbOdoIncr4 xs; fun bbOdoIncr _ [] = NONE | bbOdoIncr top (x::xs) = if x < top then SOME ((x+1)::xs) else bbOdoIncr top xs; fun bbOdoExt lst = SOME (1::lst); (* making a couple of odometers *) val bb04 = bbProducer bbOdoIncr4 bbOdoExt (SOME []); val bb05 = bbProducer (bbOdoIncr 5) bbOdoExt (SOME []); (* a couple of helper function for traversing a bbSearch manually *) fun inc BBEmpty = BBEmpty | inc (BBValue(s, increment, extend)) = increment (); fun ext BBEmpty = BBEmpty | ext (BBValue(s, increment, extend)) = extend (); (* a simple predicate to try and find states with all the same numbers *) fun allEqual [] = true | allEqual [x] = true | allEqual (x::y::xs) = if x = y then allEqual (x::xs) else false; fun allEqualPred l [] = PENDING | allEqualPred l x = if allEqual x then if length x = l then CORRECT else PENDING else INCORRECT