Haskell for Perl ProgrammersList and String Manipulation Routines

4. List and String Manipulation Routines

Function NameDescription
headThe first element in the list
tailThe list containing the second to the other elements
lengthThe length of the list.
reverseA list whose elements are reversed.
take num_elems listExtracts a list with the first num_elems from list.
drop num_elems listExtracts the list starting with the num_elems+1's element.
filter callback listExtracts the list of elements that match a certain callback. A kin to grep in Perl.
map callback listtransforms each element in the list according to the callback
a ++ bConcatenates the lists a and b

Written by Shlomi Fish