考虑以下代码:
let list1 = [1; 2; 3; 4; 5];;
let getThird3 = function
|[] ->[];
| _::_::l3::t -> t;;
getThird3 list1;
当粘贴在运行 fsharpi 的终端上时,它给了我这个错误
> let list1 = [1; 2; 3; 4; 5];;
val list1 : int list = [1; 2; 3; 4; 5]
> let getThird3 = function
- |[] ->[];
- | _::_::l3::t -> t;;
let getThird3 = function
----------------^^^^^^^^
/Users/nickolasmorales/stdin(17,17): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_]' may indicate a case not covered by the pattern(s).
val getThird3 : _arg1:'a list -> 'a list
有什么建议么?我尝试同时使用两者:仅 TAB 和空格,但在函数之后它不识别任何内容。