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
2.1m questions
2.1m answers
60 comments
57.0k users