naivehgz
naivehgz

Reputation: 71

Using SML/NJ's Lazy — expression should be 15, but it diverges

I'm using SML/NJ v110.80 and Lazy.

I tried the following code in repl

Control.lazysml := true;
open Lazy;
fun f x = f x;
let val x = $(f(4)) in 15 end; 

The last expression should be 15 but it diverges.

Did I make a mistake or it just works improperly?

Upvotes: 7

Views: 359

Answers (1)

ruakh
ruakh

Reputation: 183514

The OP writes:

I find that it's my fault I should write

let val lazy x = $(f(4)) in 15 end;

I found this information here --http://www.geocities.jp/m_hiroi/func/smlnj16.html

Upvotes: 0

Related Questions