Warm tip: This article is reproduced from serverfault.com, please click

haskell-如何从列表中获取第n个元素?

(haskell - How can I get nth element from a list?)

发布于 2011-03-07 07:52:55

如何在Haskell中按索引访问类似于此C代码的列表?

int a[] = { 34, 45, 56 };
return a[1];
Questioner
eonil
Viewed
0
2020-03-24 21:41:02

这里,所用的运算符是!!

[1,2,3]!!1给你2,因为列表是0索引的。