!! -package:base

List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.
>>> ['a', 'b', 'c'] !! 0
'a'

>>> ['a', 'b', 'c'] !! 2
'c'

>>> ['a', 'b', 'c'] !! 3
*** Exception: Prelude.!!: index too large

>>> ['a', 'b', 'c'] !! (-1)
*** Exception: Prelude.!!: negative index
WARNING: This function is partial. You can use atMay instead.
xs !! n returns the element of the stream xs at index n. Note that the head of the stream has index 0. Beware: a negative or out-of-bounds index will cause an error.
List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type. WARNING: This function is partial, and should only be used if you are sure that the indexing will not fail. Otherwise, use !?. WARNING: This function takes linear time in the index.

Examples

>>> ['a', 'b', 'c'] !! 0
'a'
>>> ['a', 'b', 'c'] !! 2
'c'
>>> ['a', 'b', 'c'] !! 3
*** Exception: Prelude.!!: index too large
>>> ['a', 'b', 'c'] !! (-1)
*** Exception: Prelude.!!: negative index
List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.
xs !! n returns the element of the stream xs at index n. Note that the head of the stream has index 0. Beware: a negative or out-of-bounds index will cause an error.
List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.
>>> ['a', 'b', 'c'] !! 0
'a'

>>> ['a', 'b', 'c'] !! 2
'c'

>>> ['a', 'b', 'c'] !! 3
*** Exception: Prelude.!!: index too large

>>> ['a', 'b', 'c'] !! (-1)
*** Exception: Prelude.!!: negative index
Lookup a property based on its index.
>>> testJSaddle $ eval "'Hello World'[6]"
W

>>> testJSaddle $ val "Hello World" !! 6
W
The index must be smaller than the length of the list, otherwise the result is undefined.
Lookup the element at the given index.
xs !! n returns the element of the stream xs at index n. Note that the head of the stream has index 0. Beware: passing a negative integer as the first argument will cause an error.
Return the value in a list at a given index
"xs !! n" returns the n'th element of xs. NB: Vector elements have an ASCENDING subscript starting from 0 and ending at length - 1.
>>> (1:>2:>3:>4:>5:>Nil) !! 4
5

>>> (1:>2:>3:>4:>5:>Nil) !! (length (1:>2:>3:>4:>5:>Nil) - 1)
5

>>> (1:>2:>3:>4:>5:>Nil) !! 1
2

>>> (1:>2:>3:>4:>5:>Nil) !! 14
*** Exception: Clash.Sized.Vector.(!!): index 14 is larger than maximum index 4
...
/. Returns the (k+1)th largest element of the queue.
/. Index (subscript) operator, starting from 0. queue !! k returns the (k+1)th smallest element in the queue. Equivalent to toAscList queue !! k.
Short cut for elemAt
Short cut for strToCharAt
A variant of !! that might provide more informative error messages if the index is out of bounds. Precondition: The index should not be out of bounds.