Netlogo:生成一个项目列表,其中每个项目都是一个列表,其成员数等于其索引

Netlogo: produce a list of items in which each item is a list whose number of members equals its index

我需要生成一个列表,其中每个项目代表一个(嵌套的)列表,其成员数等于它的索引,换句话说,我应该制作以下列表:

[[] [0] [0 1] [0 1 2] [0 1 2 3]] 

我明白我应该使用 n 值来做到这一点,但我坚持不下去了。任何帮助,将不胜感激。

试试这个。 +2是考虑空列表,包括上界。

to-report indexed-list [some-size]
   report n-values (some-size + 2) [n-values ? [?]]
end