[Haskell-beginners] Understanding some notation

Jack Henahan jhenahan at uvm.edu
Mon Jun 27 00:14:44 CEST 2011

I have this code snippet:

    import Data.List

    aaa x (y:ys) = case splitAt x (y:ys) of
      (n, x:xs) -> x:n ++ xs
      (n, xs) -> n ++ xs

I understand what it's meant to do (that is, split a list at index `x` and make a new list with that element at the head, or just return the list when given a singleton), but my brain is failing me when trying to read the notation `n ++ xs`.

Is there some obvious explanation that I'm just forgetting?

"Computer Science is no more about computers than astronomy is about telescopes."
-- Edsger Dijkstra

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 398E692F.asc
Type: application/x-apple-msg-attachment
Size: 24295 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110626/38e4099b/attachment-0001.bin>
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 881 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110626/38e4099b/attachment-0001.pgp>

More information about the Beginners mailing list