593 research outputs found

    Monadic parser combinators

    Get PDF
    In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higher-order functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this report is to provide a step-by-step tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this report can also be viewed as a first introduction to the use of monads in programming

    Functional programming with bananas, lenses, envelopes and barbed wire

    Get PDF
    We develop a calculus for lazy functional programming based on recursion operators associated with data type definitions. For these operators we derive various algebraic laws that are useful in deriving and manipulating programs. We shall show that all example functions in Bird and Wadler's Introduction to Functional Programming can be expressed using these operators

    Matrix algebra for higher order moments

    Get PDF
    AbstractA large part of statistics is devoted to the estimation of models from the sample covariance matrix. The development of the statistical theory and estimators has been greatly facilitated by the introduction of special matrices, such as the commutation matrix and the duplication matrix, and the corresponding matrix algebra. Some more extensive models require, however, estimation based on higher order moments, typically third- and fourth-order moments. An example is the popular Kenny–Judd model that includes interactions between latent variables. This paper introduces some special matrices that can be used to simplify the model expressions for third-, fourth-, and higher order moments, gives some relationships between these matrices and related matrices, and gives some formulas for Kronecker products of three and four matrices. The theory is applied to derive convenient expressions for third- and fourth-order moments of some structural equation models

    Computation of characteristics of value-of-time distributions and their standard errors

    Get PDF
    It is discussed how from some estimated bivariate distributions characteristics of the distribution of the ratio of the two random variables and standard errors thereof can be computed.

    Monadic parser combinators

    Get PDF
    In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higher-order functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this report is to provide a step-by-step tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this report can also be viewed as a first introduction to the use of monads in programming

    Back to Basics: Deriving Representation Changers Functionally

    Get PDF
    Many functional programs can be viewed as representation changers, that is, as functions that convert abstract values from one concrete representation to another. Examples of such programs include base-converters, binary adders and multipliers, and compilers. In this paper we give a number of different approaches to specifying representation changers (pointwise, functional, and relational), and present a simple technique that can be used to derive functional programs from the specifications
    • …
    corecore