Snippets in category Optimizations
Unfolding Sequences
Demonstrates how to use unfold to create an infinite list of the fibonacci numbers
39 people like this
Posted: 1 years ago by Robert PickeringUsing the 'lazy' Keyword
This snippet uses the lazy keyword to create a delayed computation. It then show's using 'force' to evaluate the computation.
23 people like this
Posted: 1 years ago by Robert PickeringUsing the 'lazy' Keyword
Demonstrates using the 'lazy' keyword. Show's how a lazy value will only ever be evaluated once.
42 people like this
Posted: 1 years ago by Robert PickeringUnfolding Sequences
Show's using the unfold function to create a sequence that terminates once some limit is passed.
25 people like this
Posted: 1 years ago by Robert PickeringBit manipulation methods
Bit manipulation methods
39 people like this
Posted: 1 years ago by Andrei LogunovMemoization and Tail Recursive Function
Hi, I expressed Memoization and Memoization Tail Recursive on the functions. I hope something useful.
12 people like this
Posted: 1 years ago by zeclFibonacci sequence
Cached fib sequence
10 people like this
Posted: 1 years ago by Dmitri PavlenkovA 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 PalladinosIronJS Boxing Struct
This is the struct IronJS uses internally to do NaN-tagging of boxed values, using the technique described here http://blog.mozilla.com/rob-sayre/2010/08/02/mozillas-new-javascript-value-representation/ and here http://article.gmane.org/gmane.comp.lang.lua.general/58908
8 people like this
Posted: 1 years ago by fholmCaching the function object created
Caching the function object created
13 people like this
Posted: 1 years ago by fholmStruct Tuple
Two/Three/Four-element generic tuples implemented as a value types for writing more efficient F# code.
47 people like this
Posted: 1 years ago by fholmA Lazy fixed-point combinator
x = f(x) encoded in F#
14 people like this
Posted: 1 years ago by Nick PalladinosByte literals
Demonstrates an array initialized from byte literals, which use the 'uy' suffix, and an array initialized from a string byte array literal
27 people like this
Posted: 1 years ago by Tim RobinsonImperative computation builder
Defines an F# computation builder for encoding imperative computations. The 'return' construct returns immediately and terminates the rest of the computation. It is also possible to return value from a 'for' or 'while' loop.
6 people like this
Posted: 1 years ago by Tomas Petricek
Efficient Immutable String Concat
Efficient Immutable String Concat
4 people like this
Posted: 1 years ago by fholmLazy String
Lazy string based on seq<char>
4 people like this
Posted: 1 years ago by Ankur DhamaThe 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 PalladinosF# Future using lazy and a threading event
F# Future using lazy and a threading event. Supports creating futures from functions or asyncs. Eager evaluation of can be specified.
3 people like this
Posted: 11 months ago by Ankur DhamamemoizeBy
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 this
Posted: 10 months ago by Rick MinerichLazyBuilder
I made LazyBuilder. The synthesis of the lazy function is troublesome. When the call of the Force() method increases, it is ugly. This solves the problem.
8 people like this
Posted: 10 months ago by zeclIteratee
An iteratee based on https://john-millikin.com/software/enumerator/ and http://okmij.org/ftp/Haskell/Iteratee/IterateeIO-talk-notes.pdf
6 people like this
Posted: 10 months ago by Ryan RileyByteString
An initial attempt at creating a ByteString type based on the Haskell version.
1 people like this
Posted: 10 months ago by Ryan RileyIterateeCPS
An iteratee that uses continuation-passing style as an optimization. There is no more discriminated union, and the signature should feel familiar to those using Async.StartWithContinuations.
5 people like this
Posted: 9 months ago by Ryan RileyClumsy LoopBuilder
Clumsy LoopBuilder.It's mischievous trick.
4 people like this
Posted: 8 months ago by zeclLazy variable
When we need lazy evaluation, we use the Lazy<'T>. However, the Lazy<'T> must evaluate explicitly. This example enables implicit evaluation(call-by-need).
6 people like this
Posted: 6 months ago by NobuhisaSimple timed-expiry cache
Basic thread-safe timed-expiry cache, implemented as a MailboxProcessor.
3 people like this
Posted: 6 months ago by Yusuf MotaraLazy Xml
A Lazy Xml structure for processing large xml documents.
6 people like this
Posted: 1 months ago by Nick PalladinosConcurrent Memoization
Memoize a function in a thread-safe manner.
3 people like this
Posted: 21 hours ago by Matt Collins