[EMAIL PROTECTED] (Mark T.B. Carroll) writes:
(snip)
> algMemo n m = lookupMemo m
> where
> memo = [[]] : map helper [1..m]
> lookupMemo m = if m < 0 then [] else memo !! m
> helper m' = [ x : xs | x <- [1..n], xs <- lookupMemo (m' - x) ]
which, I suppose, is rather like,
algMemo n m = last memo
where
memo = [[]] : map helper [1 .. m]
helper m' = [ x : xs | x <- [1 .. min m' n], xs <- memo !! (m' - x) ]
-- Mark
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe