Snippets tagged learning f#

  • Pascal's Triangle

    This code sample generates Pascal's triangle as jagged 2D list (list of lists).

    19 people like this

    Posted: 13 years ago by Dmitry Soshnikov

  • Scheme interpreter in F#

    A small Scheme interpreter using Higher Order Abstract Syntax (HOAS) encoding for terms. The essence of the technique is to use F# (meta-level) functions to encode Scheme (object-level) functions and other binding constructs, thus avoiding the need for representing variables, bindings, explicit substitution and dealing with shadowing.

    37 people like this

    Posted: 13 years ago by Anton Tayanovskyy

  • Finding matching pairs in two sequences

    Here's a function which takes a comparator function and two sequences, and returns tuples consisting of an item from each sequence, where the comparator function returns true for those two items. This is a small part of my wider project to generate guitar chord shapes. One of the requirements there is to take a list of 'wanted' notes for a chord, and a list of 'available' notes within a range of frets and to combine them into an actual set of frettings. That's what led to tryFindFirstPair and hence to findPairs.

    1 people like this

    Posted: 13 years ago by Kit Eason

  • Langton's ant

    Implementation of Langton's ant route.. Takes first 1000 steps and returns only black fields.

    2 people like this

    Posted: 12 years ago by stejcz

  • What word is most like the word "turtle"?

    A while ago I posted a snippet to calculate the 'Discrete Fréchet Distance' between two curves. If we treat a word as a 'curve' by giving each letter an index (with similar-sounding letters having closer indices) we can compare words by the Fréchet distance between them! An alternative to edit-distance...

    3 people like this

    Posted: 12 years ago by Kit Eason

  • Calculate the root-mean-square (RMS) of a dataset

    Calculate the root-mean-square of a dataset. Eg. given the voltages over time of an alternating current, calculate the RMS voltage.

    3 people like this

    Posted: 11 years ago by Kit Eason

  • Monad Bind 2 of 3

    After watching this clip (http://www.youtube.com/watch?v=ZhuHCtR3xq8) on Youtube featuring Brian Beckman I wanted to try to sketch Brian's main argument that Monads' main purpose is function composition. I will post my sketch to http://rodhern.wordpress.com/2014/02/ . These snippets are the companion examples to the blog post.

    1 people like this

    Posted: 10 years ago by Robert Nielsen

  • Text file line filter (script)

    A script suitable for FSI that copies a (UTF-8) text file throwing away uninteresting lines in the process.

    2 people like this

    Posted: 10 years ago by Robert Nielsen

  • Pascal'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.

    13 people like this

    Posted: 13 years ago by Shamil Sayfutdinov

  • Wicked 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.

    57 people like this

    Posted: 13 years ago by Dmitry Soshnikov

  • Euler #5

    Euler #5 solution

    4 people like this

    Posted: 13 years ago by Michael Falanga

  • Langton's ant // OOP :)

    Implementation of Langton's ant route.. Takes first 1000 steps and returns only black fields.

    4 people like this

    Posted: 12 years ago by stejcz

  • Eurovision - Some(points)

    The Eurovision final scoring system using records and some higher order functions. (Results are fictional - no-one seems to publish the full voting live online.)

    2 people like this

    Posted: 12 years ago by Kit Eason

  • Monad Bind 1 of 3

    After watching this clip (http://www.youtube.com/watch?v=ZhuHCtR3xq8) on Youtube featuring Brian Beckman I wanted to try to sketch Brian's main argument that Monads' main purpose is function composition. I will post my sketch to http://rodhern.wordpress.com/2014/02/ . These snippets are the companion examples to the blog post.

    3 people like this

    Posted: 10 years ago by Robert Nielsen

  • Monad Bind 2 of 3

    After watching this clip (http://www.youtube.com/watch?v=ZhuHCtR3xq8) on Youtube featuring Brian Beckman I wanted to try to sketch Brian's main argument that Monads' main purpose is function composition. I will post my sketch to http://rodhern.wordpress.com/2014/02/ . These snippets are the companion examples to the blog post.

    1 people like this

    Posted: 10 years ago by Robert Nielsen

  • Monad Bind 3 of 3

    After watching this clip (http://www.youtube.com/watch?v=ZhuHCtR3xq8) on Youtube featuring Brian Beckman I wanted to try to sketch Brian's main argument that Monads' main purpose is function composition. I will post my sketch to http://rodhern.wordpress.com/2014/02/ . These snippets are the companion examples to the blog post.

    1 people like this

    Posted: 10 years ago by Robert Nielsen

  • Use right russian word for number of days

    Select right russian word for number of days

    0 people like this

    Posted: 9 years ago by runiner