Is SML / NJ Lazy working correctly?

I am 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. Am I making a mistake or is it just working incorrectly? Thank.

I believe that this is my mistake, I have to write

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

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

+4
source share

Source: https://habr.com/ru/post/1654674/


All Articles