Pattern matching for lambda expressions

Posted by alphomega on Stack Overflow See other posts from Stack Overflow or by alphomega
Published on 2010-05-10T10:05:27Z Indexed on 2010/05/10 10:34 UTC
Read the original article Hit count: 219

Filed under:
 21 --Primitive recursion constructor
 22 pr :: ([Int] -> Int) -> ([Int] -> Int) -> ([Int] -> Int)
 23 pr f g = \xs 0 -> f xs
 24 pr f g = \xs (y+1) -> g xs y ((pr f g) xs y)

I want the function this function creates to act differently on different inputs, so that it can create a recursive function. As expected, the above code doesn't work. How do I do something like pattern matching, but for the function it creates?

Thanks

© Stack Overflow or respective owner

Related posts about haskell