[Haskell-beginners] Question about recursion

Nadav Chernin NadavC at riscogroup.com
Tue Nov 9 11:14:49 EST 2010


Hi, all

 

I wrote function that delete elements from list by indexes:

 

delIndexes::[Int]->[a]->[a]

delIndexes [] list = list

delIndexes _ [] = []

delIndexes indexes list = take x list  ++ delIndexes ( map (\y->y-x-1)
xs ) ( drop (x+1) list(

            where

                        )x:xs)=sort indexes

 

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)?

 

Thank you, Nadav

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20101109/058f3d25/attachment.html


More information about the Beginners mailing list