Question

I am running this code in 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 Error: syntax error found at 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
Was it helpful?

Solution

Some hints :

Comparing is not done by == but =

Using a let needs closing like

let
 declarations
in
 expression
end

EOF usually occurs when you forgot to put some semi-colons or forgot to close stuff like let-in-end :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top