Recent snippets

  • Counting Evens and Odds via Z3

    Counting Evens and Odds via Z3.

    0 people like this

    Posted: 2 days ago by NIck Palladinos

  • Universal Mutator

    Defines a generic `mutate : 'T -> 'T` function that structurally mutates every value in the object graph, without performing new allocations. Needless to say, this is intended for educational purposes only.

    2 people like this

    Posted: 2 days ago by Eirik Tsarpalis

  • F# SRTP of Type Classes from OO Perspective

    Similar to http://fssnip.net/7Tr, this implementation translates the Scala from https://functional.works-hub.com/blog/Type-classes-from-OO-perspective but uses statically resolved type parameters to show how something similar could be done with computation expression instances. It's really too bad you have to pass an instance of the implementation. It would be nice to be able to specify a module or class with a static member.

    1 people like this

    Posted: 7 days ago by Ryan Riley

  • F# version of Type Classes from OO Perspective

    This is the F# translation of the Scala program written for https://functional.works-hub.com/blog/Type-classes-from-OO-perspective. F# doesn't have implicits, so type classes don't work. However, it's interesting to see just how close you can come by passing an instance of the implementation. By flipping the parameters, you can use partial application to create type-specific functions. Here, we follow the use of the interface, but we could also use statically resolved type parameters to structurally infer different implementations.

    1 people like this

    Posted: 7 days ago by Ryan Riley

  • Staged Trampoline

    Staged Trampoline.

    1 people like this

    Posted: 9 days ago by NIck Palladinos

  • yin-yang puzzle in F#

    yin-yang puzzle, based on https://groups.google.com/forum/#!msg/comp.lang.scheme/Fysq_Wplxsw/awxEZ_uxW20J

    0 people like this

    Posted: 10 days ago by NIck Palladinos

Popular snippets

  • Split a list

    Three ways to split a list in half (but not necessarily in the middle). A forth version added that's very short and should be fast, as we only use List.fold. New champ found.

    75 people like this

    Posted: 6 years ago by Dmitri Pavlenkov

  • Implementing active objects with a MailboxProcessor

    Mailbox processors can easily be used to implement active objects. This example shows how to do that with a reusable wrapper type and minimal boilerplate code in the actual class definitions. Supports both asynchronous calls and synchronous calls. For the latter case, exceptions are automatically propagated back to the caller.

    90 people like this

    Posted: 6 years ago by Wolfgang Meyer

  • Top-Down-Operator-Precedence Parser

    F# implementation of a generic Top-Down-Operator-Precedence Parser as described in this paper http://portal.acm.org/citation.cfm?id=512931 Example starts at line ~300

    86 people like this

    Posted: 6 years ago by fholm

Snippets by tags

json (12) parsing (22) design patterns (18) html (14) sequences (47) seq (48) async (92) mailboxprocessor (25) f# (42) fold (19) regex (12) kata (17) array (18) dsl (22) staging (17) wpf (18) math (32) computation builder (14) sequence (29) lists (13)

View all...

Database contains 2132 snippets out of which 1471 is public.