我在 SMLNJ 中运行此代码。
val evenfibs=
let
fun SIFT NIL = NIL
| SIFT l =
CONS(0, fn () =>
SIFT(FILTER (fn x => x mod 2 == 0) (TL l) ) );
val oddfibs=
let
fun SIFT NIL = NIL
| SIFT l =
CONS(0, fn () =>
SIFT(FILTER (fn x => x mod 2 <> 0) (TL l) ));
assign3.sml:60.1 错误:在 EOF 发现语法错误
uncaught exception Compile [Compile: "syntax error"]
raised at: ../compiler/Parse/main/smlfile.sml:15.24-15.46
../compiler/TopLevel/interact/evalloop.sml:44.55
../compiler/TopLevel/interact/evalloop.sml:296.17-296.20