Snippets created by Nick Palladinos
Functional style Regex engine
Functional style Regex engine
17 people like this
Posted: 1 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.
102 people like this
Posted: 1 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.
164 people like this
Posted: 1 years ago by Nick PalladinosClojure's Atoms
Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics
17 people like this
Posted: 1 years ago by Nick PalladinosLazyList
A LazyList implementation with tail recursive enumeration.
30 people like this
Posted: 1 years ago by Nick PalladinosClojure's Atoms
Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics
16 people like this
Posted: 1 years ago by Nick PalladinosInfinite sequences
Haskell-inspired infinite sequences
37 people like this
Posted: 1 years ago by Nick PalladinosA simple Quine
A simple Quine in F#
16 people like this
Posted: 1 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: 1 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: 1 years ago by Nick PalladinosA Lazy fixed-point combinator
x = f(x) encoded in F#
14 people like this
Posted: 1 years ago by Nick PalladinosMonadic Memoization
Modular memoization within a pure functional setting that is implemented as a convenient computation builder.
56 people like this
Posted: 1 years ago by Nick PalladinosFunctor => Applicative => Monad
Yet another attempt of mine to "haskellify" my F# coding.
8 people like this
Posted: 1 years ago by Nick PalladinosActors acting as Lambdas
The Untyped Lambda Calculus encoded as actors (F#'s MailboxProcessors)
2 people like this
Posted: 1 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: 1 years ago by Nick PalladinosType based Regex Active Patterns
Regex match via Active Patterns with Type based value extraction.
3 people like this
Posted: 1 years ago by Nick Palladinos
Hughes'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: 11 months ago by Nick PalladinosHughes's CPSFuncList
A CPS version of FuncList, in order to avoid blowing the stack.
3 people like this
Posted: 11 months 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: 10 months 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: 10 months 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.
1 people like this
Posted: 9 months ago by Nick PalladinosAsync 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: 9 months 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.
6 people like this
Posted: 8 months 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: 7 months ago by Nick PalladinosPolyvariadic fixpoint
Polyvariadic fixpoint combinator in F# (heavily inspired by Haskell)
2 people like this
Posted: 5 months ago by Nick Palladinosn-ary Seq.map
A pattern for creating n-ary Seq.map functions.
2 people like this
Posted: 4 months ago by Nick Palladinosn-ary Seq.map (Numerals)
A pattern for creating n-ary Seq.map functions, based on numerals.
2 people like this
Posted: 4 months 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: 3 months ago by Nick PalladinosDining philosophers (Joinads)
A simple and declarative solution based on Joinads.
5 people like this
Posted: 2 months ago by Nick PalladinosLazy Xml
A Lazy Xml structure for processing large xml documents.
6 people like this
Posted: 1 months 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: 10 days ago by Nick Palladinos