open Array; (* checkAll(A,i) checks that array A has only true elements with indexes 0 through i *) fun checkAll(A,i) = i<0 orelse sub(A,i) andalso checkAll(A,i-1); (* fillAndCheck(A,L) sets the element of array A to true for each letter appearing on list L, then checks that all elements are true *) fun fillAndCheck(A,nil) = checkAll(A,25) | fillAndCheck(A,x::xs) = ( update(A,ord(x)-ord(#"a"),true); fillAndCheck(A,xs) ); fillAndCheck(array(26,false), explode("qwertyuiopasdfghjklzxcvbnm"));