You are viewing a single comment's thread. Return to all comments →
Quite consise F# solution for generating lines:
let lines n = let rec build (prev : int list) i = [ if i < n then let line = [ yield 1 for p in Seq.pairwise prev do yield (fst p) + (snd p) yield 1 ] yield line yield! build line (i+1) ] [ yield [1]; yield! build [1] 1 ]
A few more solutions: https://alexatnet.com/hr-f-pascals-triangle/
Seems like cookies are disabled on this browser, please enable them to open this website
Pascal's Triangle
You are viewing a single comment's thread. Return to all comments →
Quite consise F# solution for generating lines:
A few more solutions: https://alexatnet.com/hr-f-pascals-triangle/