3 ms·
As a C programmer, I think it is missing something like -- works for all 32-bit integers fac n = [1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479
by GuB-42 3y ago
As a C programmer, I think it is missing something like
-- works for all 32-bit integers
fac n = [1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600]!!n
- tromp 3y agoIt does have the non-truncated equivalent "Memoizing Haskell programmer"'s fac n = (scanl (*) 1 [1..]) !! n