Friday, 15 August 2014

Haskell Function that Takes a List of Pairs and A list and Returns a List -



Haskell Function that Takes a List of Pairs and A list and Returns a List -

i have write haskell function following:

mysub takes list of pairs , list of values , returns new list each occurrence of first value in pair replaced sec value in pair. replacement should occur in order of pairs. e.g., mysub [('a','b'), ('c','d')] "abcd" should give "bbdd" , mysub [(1,2), (2,3)] [1,2,3,4] should give [3,3,3,4].

i not sure start on one.

try solving problem first: write function onesub takes tuple , list , replaces each element in list equal first element in tuple sec element. onesub ('h','c') "hat" evaluate "cat".

one write function, seek utilize implement mysub

list haskell pair

No comments:

Post a Comment