Simple Question Follow Up

Ch. A. Herrmann herrmann@fmi.uni-passau.de
Thu, 16 May 2002 17:43:01 +0200


To make it short:

Main> let append' xs y = init xs ++ [last xs ++ [y]]

This works for the three given examples but maybe incorrect
for the task you have in mind, e.g., if xs is empty.

Main> append' [ [1, 2], [3, 4], [5] ] 6
[[1,2],[3,4],[5,6]]
Main> append' [ ['1', '2'], ['3'] ] '4'
["12","34"]
Main> append' [ [True], [True] ] False
[[True],[True,False]]

Cheers
--
 Christoph