問題について助けを求めています。ML でリストと関数の両方を渡す関数を作成しようとしています。基本的に、プログラムが行うべきことは、リストを取得し、各要素を関数で実行することです。関数が true を返す場合、要素がリストに追加され、関数の実行が完了するとリストが返されます。これが私のコードです:
fun select(x:list, funct)= (* Define a new function that accepts a list and the prime function as a parameter*)
while (tl(x) not nil) do( (*While the tail is not empty*)
if funct(hd(x)) then (*Then run the function with the the head*)
val l = l::hd(x) (*Adds the head of x to the list *)
(*else 1+tl(x)*));
どんな助けでも大歓迎です。