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