Anonymous user
Pascal's triangle: Difference between revisions
→Resursive(better)
Line 328:
<lang groovy>pascal = { n -> n <= 1 ? [1] : (0..<n).collect { i -> ([0] + pascal(n - 1))[i] + (pascal(n - 1) + [0])[i]}}</lang>
However, this solution is horribly inefficient (O(''n''!)). It slowly grinds to a halt on a reasonably powerful PC after about line 8 of the triangle.
=={{header|Haskell}}==
|