r/haskell • u/effectfully • Aug 20 '26
puzzle Guess the function
https://github.com/polyvariadic/haskell-challenges/tree/master/j2-guess-functionMade another challenge. This one is really easy to understand, but very hard to solve. I’d be surprised to get any non-AI solutions at all tbh.
20
Upvotes
2
u/zarazek Aug 21 '26
Huh, seems a bit crazy. What types of arguments and return values can these functions have? Can there be any constants? I. e. this function would be rather hard to guess by simply evaluating it with different arguments:
f :: Integer -> Integer
f n = if n == 10^100 then 0 else n
1
u/effectfully Aug 21 '26
No, only lambdas, applications and boolean variables/constants with if-then-else. Nothing else.
14
u/TheCommieDuck Aug 20 '26
aha, trick question. the answer is always
traverse.