
19 Sep
2007
19 Sep
'07
6:16 p.m.
On 9/19/07, C.M.Brown
f x = let g (Just x) = x g Nothing = error "Nothing" in g x
That's interesting, thanks!
FYI, you may also use guards, even if you don't have a parameter. For example, you may turn f x = let k = if null x then 10 else head x in froobar $ quox k into f x = let k | null x = 10 | otherwise = head x in froobar $ quox k Okay, this example is ugly, however it serves the purpose of illustrating the idea =). -- Felipe.