This function is given a partition predicate and a sequence. Until the predicate returns false, a list will be filled with elements. When it is, both the list and the remainder of the sequence will be returned. Note that this example preserves the laziness of the unchecked sequence elements.
69 people like thisPosted: 13 years ago by Rick Minerich
Jaro-Winkler is a fast and effective name matching algorithm. For more info see "A Comparison of String Distance Metrics for Name-Matching Tasks" http://www.isi.edu/info-agents/workshops/ijcai03/papers/Cohen-p.pdf or the Wikipedia article http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance
29 people like thisPosted: 13 years ago by Rick Minerich
Partitions a sequence into groups linearly by predicate. I use this for breaking up my lazy record parsing with sequences into entity-sized chunks which are then easily digestible. Note: Edited back from the previous edit as these were heavily profiled and yield! tends to be slow. Edit #2: Now correctly using "use" instead of "let" for sequence.GetEnumerator () (Thanks Vladimir Matveev)
1 people like thisPosted: 13 years ago by Rick Minerich
Sometimes you might wish to memoize a function whose input doesn't have the equality and comparison constraints, or maybe the comparison of your given type is just too slow for what you need. To fix this, you simply provide a function which converts the input into something more fitting as an extra parameter.
7 people like thisPosted: 13 years ago by Rick Minerich
A small DSL for graph building by combining paths. It's just a set of edges under the hood, so no need to worry about duplication causing problems. This is part of a larger project I'm calling edgy.
9 people like thisPosted: 12 years ago by Rick Minerich
How to generate functions for copying F# record-array-union trees with Expr.
1 people like thisPosted: 10 years ago by Rick Minerich
This is just the ML code from http://jozefg.bitbucket.org/posts/2015-02-28-type-inference.html ported to F#.
3 people like thisPosted: 9 years ago by Rick Minerich
I spent a lot of time this week profiling different permutation functions from various places on the internet. The following was by far the fastest:
8 people like thisPosted: 4 years ago by Rick Minerich
This is used for building things with reflection at runtime. As ConstructorInfo arguments require typed collections, it is necessary when parsing to reflected records to first build up contents and then afterward convert the collected obj[] to a 'a[]. This is finally cast back to obj so it can be used as a ConstructorInfo argument.
29 people like thisPosted: 13 years ago by Rick Minerich
A broken code example demonstrating how it's you can't catch a single throwing enumeration and continue with F#'s IEnumerable.
2 people like thisPosted: 13 years ago by Rick Minerich
Implementation of Mutable Weighted Quick-Union with Path Compression in F#
5 people like thisPosted: 13 years ago by Rick Minerich
A quick-and-dirty editor for discriminated unions in a property grid. I use this for editing trees of F# records and unions. Note that any records must have a "Default" static property which returns a default instance.
3 people like thisPosted: 12 years ago by Rick Minerich
A small DSL for graph building by combining weighted paths. It's just a map of edges to weights under the hood, so no need to worry about duplication causing problems. This is part of a larger project I'm calling edgy.
2 people like thisPosted: 12 years ago by Rick Minerich
Extended from: http://www.fssnip.net/d2
1 people like thisPosted: 9 years ago by Rick Minerich
I couldn't fine a reasonably fast or good (yuck floats) implementation anywhere so I wrote one. All of the error checking does slow it down and should be ideally done up front.
0 people like thisPosted: 6 years ago by Rick Minerich