package fix
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Facilities for memoization and fixed points
Install
dune-project
Dependency
Authors
Maintainers
Sources
archive.tar.gz
md5=7eb570b759635fe66f3556d2b1cc88e3
sha512=344dcc619f9e8b8a6c998775b6d2dab2ea5253e6a67abe4797f76dc5dd30bc776568abce1e90477422e9db447821579889737e3531c42139708f813e983ea5d4
doc/README.html
Fix: memoization and fixed points made easy
fix is an OCaml library that helps with various constructions that involve memoization and recursion.
Installation
Type opam install fix.
Overview
At the top of an OCaml module, declare open Fix. This gives you access to the following submodules:
DataFlowperforms a forward data flow analysis over a directed graph. LikeFix, it computes the least function of typevariable -> propertythat satisfies a fixed point equation. It is less widely applicable thanFix, but, when it is applicable, it is easier to use and more efficient thanFix.Gensymoffers a simple facility for generating fresh integer identifiers.Memoizeoffers a number of combinators that help construct possibly recursive memoizing functions, that is, functions that lazily record their input/output graph, so as to avoid repeated computation.Tabulateoffers facilities for tabulating a function, that is, eagerly evaluating this function at every point in its domain, so as to obtain an equivalent function that can be queried in constant time.Numberingoffers a facility for assigning a unique number to each value in a certain finite set and translating (both ways) between values and their numbers.GraphNumberingoffers a facility for discovering and numbering the reachable vertices in a finite directed graph.HashConsoffers support for setting up a hash-consed data type, that is, a data type whose values carry unique integer identifiers.Fixoffers support for computing the least solution of a set of monotone equations, as described in the unpublished paper Lazy Least Fixed Points in ML. In other words, it allows defining a recursive function of typevariable -> property, where cyclic dependencies between variables are allowed, and properties must be equipped with a partial order. The function thus obtained performs the fixed point computation on demand, in an incremental manner, and is memoizing.Propdefines a few common partial orders, includingProp.Boolean,Prop.Option,Prop.Set.Gluecontains glue code that helps build various implementations of association maps.
The signatures that appear in the above files, such as MEMOIZER, TABULATOR, SOLVER, and so on, are defined here.
The documentation is built by make doc and is then found in the file _build/default/_doc/_html/index.html.
The documentation of the latest released version is also available online.
Demos
A few demos are provided:
brzsets up a hash-consed representation of regular expressions and shows how to convert a regular expression to a deterministic finite-state automaton by Brzozowski's method. This demo exploits almost all of the submodules listed above, and is accompanied with a commentary.cykpresents a CYK-style parsing algorithm as an instance ofFix.cfgusesFixto perform certain static analyses of a context-free grammar; this includes computing nullability information and FIRST sets.fibdefines Fibonacci's function in several different ways using the fixed-point combinators offered byMemoizeandFix.hcosets up simple-minded hash-consed trees usingHashCons.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page