大家好我想表达函数调用test1而不首先定义更高的函数
let higher = fun a b -> a>b
let rec test1 test2 number list=
match (number,list) with
|number,[] -> []
|number,x1::xs when test2 a x = true -> x1::test1 test2 number xs
|number,x1::xs -> test1 test2 number xs
printfn "%A" (test1 (higher 5 [5;2;7;8]))
Run Code Online (Sandbox Code Playgroud) 我需要将一个字符串转换为一个没有内置函数的单词列表,这是我到目前为止所做的,显然是错误的:
let rec convert word =
match word with
|"." ->[]
|word -> ["word"]
|word + " " + words -> [word]@convert words
Run Code Online (Sandbox Code Playgroud)