[Haskell-cafe] Lists of Lists
Robert Dockins
robdockins at fastmail.fm
Wed Mar 8 15:27:14 EST 2006
On Mar 8, 2006, at 2:27 PM, zell_ffhut wrote:
> Could you explain what the function does.. I can't seem to peice it
> together.
It takes three things 1) a function 2) an index and 3) a list. It
finds the nth element of the list, applies the function to it and
then returns a new list containing the new element in the same
position. It dies with an error message if you index past the end of
the list.
e.g.
updateList (\x -> x + 10) 3 [0,1,2,3,4,5] == [0,1,2,13,4,5]
Rob Dockins
Speak softly and drive a Sherman tank.
Laugh hard; it's a long way to the bank.
-- TMBG
More information about the Haskell-Cafe
mailing list