Eliminate repetitions in a sequence, preserving the first element in each run of repeats.
1 people like thisPosted: 3 hours ago by Kit Eason
An active pattern that protects from null reference exceptions stemming from pattern matches on values materialized by .NET libraries such as Newtonsoft.Json
2 people like thisPosted: 2 days ago by Eirik Tsarpalis
I have seen a few postings on the web about this, with not terribly elegant solutions. Here is how I do it.
1 people like thisPosted: 10 days ago by billhay
I recently wrote a program to automatically solve a category of logic puzzles, alone the lines of 'four men walked into a bar, one who drinks Guinness never pays darts...' The objective is to find a unique combination of attributes - name, age, favorite drink, favorite pub activity etc. I decided on a brute force approach, in which I generate every combination of attributes, apply a set of rules, and then inspect for the one unique solution. My solution starts with producing a list of lists of attributes.
0 people like thisPosted: 10 days ago by billhay
This F# code decrypts an encrypted string using Rijndael symmetric encryption algorithm. It uses key and initialization vector stored in a registry key.
1 people like thisPosted: 15 days ago by Tuomas Hietanen
Computational Expression for Result<'a, 'b>
3 people like thisPosted: 24 days ago by Yuriy Habarov
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.
68 people like thisPosted: 7 years ago by Rick Minerich
Two functions showing how to filter functional lists using the specified predicate. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter.
65 people like thisPosted: 7 years ago by Tomas Petricek
Show's how to define units of measure to add stronger typing to your numerical functions.
74 people like thisPosted: 7 years ago by Robert Pickering
Composition of functions in F# is easily achieved by using the >> operator. You can also chain an arbitary amount of functions (represented as a list or sequence) together by folding the list/seq with >>. [More formally: the set of endomorphisms 'a -> 'a forms a monoid with the binary, associative operator ">>" (or "<<") and the neutral element "id".]
78 people like thisPosted: 7 years ago by Novox
Factory pattern in F#
72 people like thisPosted: 6 years ago by Tao Liu
Some simple functions for writing more idiomatic F# tests with NUnit.
85 people like thisPosted: 7 years ago by Ryan Riley
html (14) fparsec (14) quotations (17) algorithms (25) async (92) game (30) monad (20) silverlight (21) xml (12) lazy (18) fold (19) recursion (27) kata (17) math (32) design patterns (18) list (49) sequence (30) json (12) tutorial (17) mailboxprocessor (26)
Mauricio Scheffer (7) Cesar Mendoza (17) Tomas Petricek (143) Faisal Waris (22) Joel Huang (14) Rick Minerich (15) devshorts (11) Robert Pickering (11) Ankur Dhama (20) Dmitry Soshnikov (7) fholm (26) Carsten König (10) Eirik Tsarpalis (74) Ryan Riley (25) Zhukoff Dima (8) nagat01 (19) David Klein (16) Kit Eason (47) Nick Palladinos (66) Daniel Robinson (7)
Database contains 2216 snippets out of which 1516 is public.