bug_flatten.cd 345 Bytes
Newer Older
1 2 3 4
let flatten_all (l : X where X = [ ( 'a \ [Any*] | X)* ]) :  [ ( 'a \ [Any*] )* ] =
    match l with
    [] -> []
    | (e \[Any*], ll) -> (e, flatten_all ll)
5
    | (ll1, ll2) -> flatten_all (ll1  @ ll2) 
6 7
;;

8 9
let v = flatten_all [ [ [ `A ] ] ]
;;
10 11 12
let v = flatten_all [ `A [ `B `C  [`D]] [[[[[[[[[[[[[[[[[[[[[[[[[[1]]]]]]]]]]]]]]]]]]]]]]]]]


13
]]