【发布时间】:2017-03-22 18:08:16
【问题描述】:
所以我需要编写一个函数,将整数列表中的每个数字加三倍
这是我目前所拥有的:
let number = [1; 2; 3; 4];;
let rec print_list_int myList = match myList with
| [] -> print_endline "This is the end of the int list!"
| head::body ->
begin
print_int head * 3;
print_endline "";
print_list_int body *3
end
;;
print_list_int number;;
它似乎没有做任何有用的事情,我哪里出错了有什么想法吗?需要它输出,但它也不这样做。提前致谢! :)
【问题讨论】:
标签: list functional-programming ocaml