As to the error message "unbound variable or constructor: filter", in this case it means that the identifier "filter" is not present in the toplevel environment. Since filter
is defined in the structure List
, you'll have to either use List.filter
, or issue the statement open List
before using filter
. For example,
List.filter (fn x => x <> 5) [1,3,5,2,5];
or
open List;
filter (fn x => x <> 5) [1,3,5,2,5];
As for the error when using Strip
, are you certain that your definition of Strip
was successful and there were no errors? If you tried using filter
like your code shows, and the interpreter couldn't find it, the definition of Strip
should have failed.