(* Using FIRST_ARG and FILTER write a function THRESHOLD that takes an integer X and returns a function that takes a list L and returns the elements of L that are less than or equal to X. e.g. (THRESHOLD 3) [1,2,3,4,5,6] should return [1,2,3] *) use "FILTER"; local fun KEEP (A:int,B) = not (B > A) (* true if B doesn't exceed threshold A *) in fun THRESHOLD X = FIRST_ARG (FILTER, FIRST_ARG (KEEP,X)) end;