开发者

How do I manipulate a lowlevelarray in Opa?

For instance, how do I create a LowLevelArray that contains a set of integers: 1, 2, 3, 4, and 5?

My understanding is that the easy way is to do myarray = @llarray(1, 2, 3, 4, 5) and that's great. But how do I loop t开发者_运维百科hrough the array to pull out values and println them?

I tried do inrange(0,4,(i -> println("{myarray.get(i)}"))) but get the error: Record expression has type llarray(int) but field access expected it to have type { get: 'a; 'r.a }


Take a look at the docs. Instead of myarray.get(i) you'll have to write LowLevelArray.get(myarray, i) (you can make an abbreviation for the LowLevelArray module, or even the getter for a particular array, if that's too verbose for you).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜