142 research outputs found

    Polytypic Genetic Programming

    Get PDF
    Program synthesis via heuristic search often requires a great deal of boilerplate code to adapt program APIs to the search mechanism. In addition, the majority of existing approaches are not type-safe: i.e. they can fail at runtime because the search mechanisms lack the strict type information often available to the compiler. In this article, we describe Polytope, a Scala framework that uses polytypic programming, a relatively recent advance in program abstraction. Polytope requires a minimum of boilerplate code and supports a form of strong-typing in which type rules are automatically enforced by the compiler, even for search operations such as mutation which are applied at run-time. By operating directly on language-native expressions, it provides an embeddable optimization procedure for existing code. We give a tutorial example of the specific polytypic approach we adopt and compare both runtime efficiency and required lines of code against the well-known EpochX GP framework, showing comparable performance in the former and the complete elimination of boilerplate for the latter

    A principled approach to programming with nested types in Haskell

    Get PDF
    Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from them data constructed using the buildcombinator, and immediately consumed using the foldcombinator, for that type. It has long been thought that initial algebra semantics is not expressive enough to provide a similar foundation for programming with nested types in Haskell. Specifically, the standard folds derived from initial algebra semantics have been considered too weak to capture commonly occurring patterns of recursion over data of nested types in Haskell, and no build combinators or fold/build rules have until now been defined for nested types. This paper shows that standard folds are, in fact, sufficiently expressive for programming with nested types in Haskell. It also defines buildcombinators and fold/build fusion rules for nested types. It thus shows how initial algebra semantics provides a principled, expressive, and elegant foundation for programming with nested types in Haskell

    The Sketch of a Polymorphic Symphony

    Full text link
    In previous work, we have introduced functional strategies, that is, first-class generic functions that can traverse into terms of any type while mixing uniform and type-specific behaviour. In the present paper, we give a detailed description of one particular Haskell-based model of functional strategies. This model is characterised as follows. Firstly, we employ first-class polymorphism as a form of second-order polymorphism as for the mere types of functional strategies. Secondly, we use an encoding scheme of run-time type case for mixing uniform and type-specific behaviour. Thirdly, we base all traversal on a fundamental combinator for folding over constructor applications. Using this model, we capture common strategic traversal schemes in a highly parameterised style. We study two original forms of parameterisation. Firstly, we design parameters for the specific control-flow, data-flow and traversal characteristics of more concrete traversal schemes. Secondly, we use overloading to postpone commitment to a specific type scheme of traversal. The resulting portfolio of traversal schemes can be regarded as a challenging benchmark for setups for typed generic programming. The way we develop the model and the suite of traversal schemes, it becomes clear that parameterised + typed strategic programming is best viewed as a potent combination of certain bits of parametric, intensional, polytypic, and ad-hoc polymorphism

    Strategic polymorphism requires just two combinators!

    Get PDF
    In previous work, we introduced the notion of functional strategies: first-class generic functions that can traverse terms of any type while mixing uniform and type-specific behaviour. Functional strategies transpose the notion of term rewriting strategies (with coverage of traversal) to the functional programming paradigm. Meanwhile, a number of Haskell-based models and combinator suites were proposed to support generic programming with functional strategies. In the present paper, we provide a compact and matured reconstruction of functional strategies. We capture strategic polymorphism by just two primitive combinators. This is done without commitment to a specific functional language. We analyse the design space for implementational models of functional strategies. For completeness, we also provide an operational reference model for implementing functional strategies (in Haskell). We demonstrate the generality of our approach by reconstructing representative fragments of the Strafunski library for functional strategies.Comment: A preliminary version of this paper was presented at IFL 2002, and included in the informal preproceedings of the worksho

    A Tutorial on the Universality and Expressiveness of Fold

    Get PDF
    In functional programming, fold is a standard operator that encapsulates a simple pattern of recursion for processing lists. This article is a tutorial on two key aspects of the fold operator for lists. First of all, we emphasize the use of the universal property of fold both as a proof principle that avoids the need for inductive proofs, and as a definition principle that guides the transformation of recursive functions into definitions using fold. Secondly, we show that even though the pattern of recursion encapsulated by fold is simple, in a language with tuples and functions as first-class values the fold operator has greater expressive power than might first be expected

    A runnable functional formal memetic algorithm framework

    Get PDF
    Historically Functional Programming FP for short has been associated with a small scope of applications mainly academic The computer science community did not pay enough attention to its potential perhaps due to the lack of e ciency of functional languages Now new theoretical developments in the eld of FP are emerging and better languages e g Haskell Concurrent and Parallel Haskell have been de ned and implemented Genetic algorithms GA are search and optimization techniques which work on a nature inspired principle the Darwinian evolution The corner idea of Darwin theory is that of natural selection The concept of natural selection is captured by GA Speci cally solutions to a given problem are codi ed in the so called chromosomes The evolution of chromosomes due to the action of crossover mutation and natural selection is simulated through computer code GA have been broadly applied and recognized as a robust search and optimization technique GA combined with a local search stage were called Memetic Algorithms after In this paper a functional framework for formal memetic algorithms is intro duced It can be easily extended by subclassi cation of the class hierarchy to provide genetic algorithm specialization memetic algorithm genetic algorithm with islands of possible solutions etc and additional genetic operators behavior To run the frame work over a particular problem a proper encoding of chromosomes should be provided with an instantiation of the genetic operators We claim that functional programming languages at least the one in which our framework has been developed Haskell have reached the necessary maturity to deal with combinatorial optimization problemsEje: TeoríaRed de Universidades con Carreras en Informática (RedUNCI

    "Explosive" programming controlled by calculation

    Get PDF
    In the design of a functional library in the area of data-mining several algorithmic patterns have been identified which call for generic programming. Some of these have to do with flattening functions which arise in a particular group of hierarchical systems. In this paper we describe our efforts to make such functionalities generic. We start by a generic induc- tive construction of the intended class of hierarchical types. We conclude by relating the structure of the relevant base-functors with the algebraic structure which is required by the generic flattening functionality, in particular concerning its “deforestation” towards a linearly complex implementation. The instances we provide as examples include the widely known bill of materials “explode” operation.FC

    Polytipic recursion patterns

    Get PDF
    Comunicação apresentada em SBLP'00, Proc. 4th Brazilian Symposium on Programming Languages, Recife, May, 2000Recursive schemes over inductive data structures have been recognized as category-theoretic universals, yielding a handful of equational laws for program construction and transformation. This paper introduces the implementation of such recursion patterns as type parametric, or polytypic, functionals in the CAMILA prototyping language. Several examples are discussed

    State-based components made generic

    Get PDF
    Genericity is a topic which is not sufficiently developed in state-based systems modelling, mainly due to a myriad of approaches and behaviour models which lack unification. This paper adopts coalgebra theory to propose a generic notion of a state-based software component, and an associated calculus, by quantifying over behavioural models specified as strong monads. This leads to the pointfree, calculational reasoning style which is typical of the so-called Bird-Meertens school.(undefined
    corecore