Snippets tagged lists
Pascal's Triangle
This code sample generates Pascal's triangle as jagged 2D list (list of lists).
13 people like this
Posted: 1 years ago by Dmitry SoshnikovPascal's Triangle (2)
This code sample generates Pascal's triangle as jagged 2D list (list of lists). It takes 0.5 sec to generate 3000 rows (vs 16 sec for http://fssnip.net/23). Tip: try to avoid of using "list1 @ list2" construction.
8 people like this
Posted: 1 years ago by Shamil SayfutdinovPalindromic dates
Today, 11. february 2011, is a palindromic day according to the European date format (day/month/year). This snippet collects all the palindromic dates until 31 dec. 9999. They are 366, a surprisingly low number.
12 people like this
Posted: 1 years ago by Francesco De VittoriPascal's Triangle
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.
12 people like this
Posted: 1 years ago by Horacio NuñezExtensions to the Fold function
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)
22 people like this
Posted: 1 years ago by Horacio NuñezWicked way to solve quadratic equation using list of operators
This is to demonstrate that: (1) there are many ways to solve the same problems; (2) operators can be grouped together into data structures and act as data; (3) you can have fun in F# in many ways.
49 people like this
Posted: 1 years ago by Dmitry Soshnikov
JoinList
A JoinList is a variation on the list type that offers a constant time append operation.
5 people like this
Posted: 9 months ago by Ryan RileyEuler #5
Euler #5 solution
3 people like this
Posted: 8 months ago by Michael FalangaNinety-Nine F# Problems - Problems 1 - 10 - Lists
These are F# solutions of Ninety-Nine Haskell Problems which are themselves translations of Ninety-Nine Lisp Problems and Ninety-Nine Prolog Problems. The solutions are hidden so you can try to solve them yourself.
4 people like this
Posted: 3 months ago by Cesar MendozaNinety-Nine F# Problems - Problems 11 - 20 - List, continued]
These are F# solutions of Ninety-Nine Haskell Problems which are themselves translations of Ninety-Nine Lisp Problems and Ninety-Nine Prolog Problems. The solutions are hidden so you can try to solve them yourself.
3 people like this
Posted: 3 months ago by Cesar MendozaNinety-Nine F# Problems - Problems 21 - 28 - Lists again
These are F# solutions of Ninety-Nine Haskell Problems which are themselves translations of Ninety-Nine Lisp Problems and Ninety-Nine Prolog Problems. The solutions are hidden so you can try to solve them yourself.
3 people like this
Posted: 3 months ago by Cesar Mendoza