【发布时间】:2017-03-27 01:37:48
【问题描述】:
fun randomList(n) = let
val theList = []
val min = 1
val max = 75
val nextInt = Random.randRange(min,max)
val r = Random.rand(1,1)
val randomValue = nextInt r
in
if n = 0 then []
else
(randomValue::theList;
randomList(n-1)) end;
randomList(50);
我正在尝试用随机数填充列表。我得到了 错误
Warning: type vars not generalized because of value restriction are instantiated to dummy types (X1, X2,...)我看到了一些不同的 可能的原因,但我无法弄清楚。我需要做什么 改变?我仍然不确定该功能是否有效,因为我 无法完全运行它。
【问题讨论】: