At 2010-10-04T01:52:05+04:00, Victor Nazarov wrote: > I suggest to pay more attention to haskell's standard library. > > "allButLast" is called "init" in Data.List module.
Thanks for that. I should keep printouts of the Prelude handy. > Second, do not use explicit recursion. You can capture recursion using > some high-order function like map, filter, foldr and so on: > > lastToTheLength xs = map f xs > where f = const . last $ xs > > And last, your type signatures are too restrictive. You can apply your > functions to arbitrary lists. > > lastToTheLength :: [a] -> [a] > > Standard library knowledge is very helpful in producing short and > clear definitions. > > blowup = concat . zipWith replicate [1..] That looks neat! Many thanks for the detailed remarks. Regards, Raghavendra. -- N. Raghavendra <ra...@mri.ernet.in> | http://www.retrotexts.net/ Harish-Chandra Research Institute | http://www.mri.ernet.in/ See message headers for contact and OpenPGP information. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe