
7 Dec
2006
7 Dec
'06
4:01 a.m.
On 11/30/06, Huazhi (Hank) Gong
Thanks, it make sense here. However, like I want to choose s[1,3,6,10] or something like this. Are there some straightforward function or operator for doing this job? The !! operator in haskell seems does not support multiple indecies.
hI, Hadn't checked my mail in a few days.... but here goes: helper function: index' :: forall a. [a] -> Int -> [a] index' xs i = take 1 $ drop (i-1) xs The real deal: index :: forall a. [a] -> [Int] -> [[a]] index cs xs = map (index' cs) xs simple example of use: Prelude> index "ABCDEFGHIJKLMNOPQRSTUVWXYZ" [2,5..26] ["B","E","H","K","N","Q","T","W","Z"] happy computing, gene