How can I access a list by index in Haskell, analog to this C code?
int a[] = { 34, 45, 56 }; return a[1];
Look here, the operator used is !!.
!!
I.e. [1,2,3]!!1 gives you 2, since lists are 0-indexed.
[1,2,3]!!1
2
1.4m articles
1.4m replys
5 comments
57.0k users