[Haskell-beginners] Question about recursion

Brent Yorgey byorgey at seas.upenn.edu
Tue Nov 9 11:20:25 EST 2010

On Tue, Nov 09, 2010 at 06:14:49PM +0200, Nadav Chernin wrote:
> There is problem that in each step of recursion this function sort list
> of indexes ( in last line)
> How can I write this code that sorting will be executed only once (in
> first step)?

Just write a helper function that does all the actual work, and have
delIndexes pass it a sorted index list as input:

  delIndexes inds l = delIndexes' (sort ind) l
    where delIndexes' ...


More information about the Beginners mailing list