Returns the pascal triangle in a 2D list . This snippet computes rows translating the 'visual' method taught at school into Lists and the usage of map2 function. It takes almost 5 seconds to compute 5000 rows.
20 people like thisPosted: 11 years ago by Horacio Nuñez
This snippet how we can use F# constructs like discrimated unions, functions and symbolic identifiers to represent proper language statements (albeit limited) using valid F# code.
24 people like thisPosted: 11 years ago by Horacio Nuñez
This snippet is helpfull in the following cases: 1) After a consolidation operation using the fold function we need to know how many elements have been processed. 2) A consolidation operation needs to use the index of each of the elements processed and we don't want to use the mapi function first. 3) A combination of the above. Since the following snippet just adds a wrapper to the existing Fold function we can repeat the approach for arrays and sequences (including the plinq ones)
31 people like thisPosted: 11 years ago by Horacio Nuñez
Asserting a series convergence using high order functions taking for example the 1/pi formula by Ramanujan. Play with the parameters to see where the numeric data types limits makes the function to return false.
24 people like thisPosted: 11 years ago by Horacio Nuñez