I'm having trouble solving this problem using foldr. I understand foldr for simple problems (like foldr (+) 5 [1,2,3,4]) but this is more complicated:
Question: What is the value of q2?
findSubsequence next highest = case next == highest + 1 of
True -> next
False -> highest
q2 = (foldr findSubsequence 0 [5,6,8,4,7,3,2,1,0,2,3,1,0]
,foldr findSubsequence 0 [0,1,3,2,0,1,2,3,7,4,8,6,5]
,foldr findSubsequence 0 [1,2,3,4,3,2,1]
,foldr findSubsequence 0 [4,3,2,1,2,3,4]
)
Using foldr for each list gives you the value and put together the resulting list is [5,3,4,4] but I don't know the process of solving this. Help would be appreciated :)
foldr. - melpomene