Snippets created by Nick Palladinos
Functional style Regex engine
Functional style Regex engine
18 people like this
Posted: 2 years ago by Nick PalladinosHaskell function : iterate
Implements iterate function from Haskell's Prelude. The function generates an infinite sequence by applying a function to the initial value (first) and then to the result of previous application.
135 people like this
Posted: 2 years ago by Nick PalladinosA beautiful fixed-point finding function
We start with an initial value and then applying f repeatedly, until the value does not change anymore.
211 people like this
Posted: 2 years ago by Nick PalladinosClojure's Atoms
Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics
19 people like this
Posted: 2 years ago by Nick PalladinosLazyList
A LazyList implementation with tail recursive enumeration.
35 people like this
Posted: 2 years ago by Nick PalladinosClojure's Atoms
Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics
21 people like this
Posted: 2 years ago by Nick PalladinosInfinite sequences
Haskell-inspired infinite sequences
43 people like this
Posted: 2 years ago by Nick PalladinosA simple Quine
A simple Quine in F#
22 people like this
Posted: 2 years ago by Nick PalladinosA Clojure inspired (race free) memoize function
A Clojure inspired (race free) memoize function, that uses a mutable atom cell.
17 people like this
Posted: 2 years ago by Nick PalladinosAbstracting over 'M'
A higher kind of request to Don Syme... please please please,,,, we desperately need higher kinds!
13 people like this
Posted: 2 years ago by Nick PalladinosA Lazy fixed-point combinator
x = f(x) encoded in F#
22 people like this
Posted: 2 years ago by Nick PalladinosMonadic Memoization
Modular memoization within a pure functional setting that is implemented as a convenient computation builder.
73 people like this
Posted: 2 years ago by Nick PalladinosFunctor => Applicative => Monad
Yet another attempt of mine to "haskellify" my F# coding.
8 people like this
Posted: 2 years ago by Nick PalladinosActors acting as Lambdas
The Untyped Lambda Calculus encoded as actors (F#'s MailboxProcessors)
2 people like this
Posted: 2 years ago by Nick PalladinosThe repmin problem
The repmin problem is to replace all elements of a tree of numbers by the minimum element, making only a single pass over the original tree. Repmin is a very ingenious example of Circular Programming.
1 people like this
Posted: 2 years ago by Nick PalladinosType based Regex Active Patterns
Regex match via Active Patterns with Type based value extraction.
3 people like this
Posted: 2 years ago by Nick PalladinosHughes's FuncList
A FuncList is a "list-like" datatype with constant time append (represented as a function of cons-lists). The implementation is based on a convenient computation builder.
1 people like this
Posted: 1 years ago by Nick PalladinosHughes's CPSFuncList
A CPS version of FuncList, in order to avoid blowing the stack.
3 people like this
Posted: 1 years ago by Nick PalladinosFunctional Unparsing SQL
A combinator based DSL for composing type-safe parameterized sql queries. Inspired by Olivier Danvy's "Functional Unparsing" paper.
8 people like this
Posted: 1 years ago by Nick PalladinosNorvig's Spelling Corrector
A line-by-line translation of Norvig's original Python code. An attempt to view F# as a "typed" Python.
4 people like this
Posted: 1 years ago by Nick PalladinosErik Lippert's Comma Quibbling
An old solution of mine to Erik Lippert's Comma Quibbling challenge. I really like this snippet because it shows that with F# we can hack elegant but also fast code.
3 people like this
Posted: 1 years ago by Nick Palladinos
Async based MapReduce
Async is a very versatile structure, which has been used to compose CPU/IO bound computations. So it is very tempting to implement a MapReduce function based on Async and borrowing ideas from the theory of list homomorphisms.
7 people like this
Posted: 1 years ago by Nick PalladinosScrap Your Boilerplate
Scrap Your Boilerplate with the help of F#. Based on the original paper by Ralf Laemmel and Simon Peyton Jones.
7 people like this
Posted: 1 years ago by Nick PalladinosMonadic Retry
A Monad for composing computations with retry logic. (Useful when we work with Cloud Services)
6 people like this
Posted: 1 years ago by Nick PalladinosPolyvariadic fixpoint
Polyvariadic fixpoint combinator in F# (heavily inspired by Haskell)
2 people like this
Posted: 1 years ago by Nick Palladinosn-ary Seq.map
A pattern for creating n-ary Seq.map functions.
2 people like this
Posted: 1 years ago by Nick Palladinosn-ary Seq.map (Numerals)
A pattern for creating n-ary Seq.map functions, based on numerals.
3 people like this
Posted: 1 years ago by Nick PalladinosBananas in F#
A pattern for programming with generic folds (catamorphisms). Based on the classic "Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire" (1991) (Meijer, Fokkinga, Paterson).
6 people like this
Posted: 1 years ago by Nick PalladinosDining philosophers (Joinads)
A simple and declarative solution based on Joinads.
5 people like this
Posted: 1 years ago by Nick PalladinosLazy Xml
A Lazy Xml structure for processing large xml documents.
8 people like this
Posted: 1 years ago by Nick PalladinosScrap Your Boilerplate (with class)
A typecast free experiment in Generic Programming. Inspired by "Scrap Your Boilerplate (with class)".
4 people like this
Posted: 1 years ago by Nick PalladinosY(n) Polyvariadic fixpoint
Encoding mutually-recursive functions with a Polyvariadic fixpoint combinator.
5 people like this
Posted: 10 months ago by Nick PalladinosHLists, Peano & Type-level computations
An experiment on type-level computations.
3 people like this
Posted: 10 months ago by Nick PalladinosUnlambda
A minimal interpreter for David Madore's crazy-esoteric programming language.
5 people like this
Posted: 9 months ago by Nick PalladinosMonadic Trampoline
A monadic trampoline for stack-overflow free programming.
3 people like this
Posted: 8 months ago by Nick PalladinosAsync.Choice
A simple extension method for asynchronous non-deterministic computations.
2 people like this
Posted: 8 months ago by Nick PalladinosChurch numerals
Church numerals via rank-2 polymorphism
4 people like this
Posted: 4 months ago by Nick PalladinosType Safe Higher-order abstract syntax
Type Safe Higher-order abstract syntax via GADT encoding
2 people like this
Posted: 4 months ago by Nick PalladinosGC Friendly Fixpoint
Fast and GC friendly fixpoint combinator.
6 people like this
Posted: 3 months ago by Nick PalladinosGeneric Collections, Type Classes and friends
A crazy experiment for "Scalable" collections. Inspired by the paper "Fighting Bit Rot with Types"
5 people like this
Posted: 2 months ago by Nick PalladinosLoop Unrolling
C++ style metaprogramming in F#
3 people like this
Posted: 23 days ago by Nick PalladinosReducers
A simple yet powerful library for parallel collection processing. Inspired by Clojure's Reducers.
5 people like this
Posted: 16 days ago by Nick Palladinos