221,396 research outputs found

    An Elementary affine λ-calculus with multithreading and side effects (extended version)

    Get PDF
    Linear logic provides a framework to control the complexity of higher-order functional programs. We present an extension of this framework to programs with multithreading and side effects focusing on the case of elementary time. Our main contributions are as follows. First, we provide a new combinatorial proof of termination in elementary time for the functional case. Second, we develop an extension of the approach to a call-by-value lambdalambda-calculus with multithreading and side effects. Third, we introduce an elementary affine type system that guarantees the standard subject reduction and progress properties. Finally, we illustrate the programming of iterative functions with side effects in the presented formalism

    chemf : a purely functional chemistry toolkit

    Get PDF
    Background: Although programming in a type-safe and referentially transparent style offers several advantages over working with mutable data structures and side effects, this style of programming has not seen much use in chemistry-related software. Since functional programming languages were designed with referential transparency in mind, these languages offer a lot of support when writing immutable data structures and side-effects free code. We therefore started implementing our own toolkit based on the above programming paradigms in a modern, versatile programming language. Results: We present our initial results with functional programming in chemistry by first describing an immutable data structure for molecular graphs together with a couple of simple algorithms to calculate basic molecular properties before writing a complete SMILES parser in accordance with the OpenSMILES specification. Along the way we show how to deal with input validation, error handling, bulk operations, and parallelization in a purely functional way. At the end we also analyze and improve our algorithms and data structures in terms of performance and compare it to existing toolkits both object-oriented and purely functional. All code was written in Scala, a modern multi-paradigm programming language with a strong support for functional programming and a highly sophisticated type system. Conclusions: We have successfully made the first important steps towards a purely functional chemistry toolkit. The data structures and algorithms presented in this article perform well while at the same time they can be safely used in parallelized applications, such as computer aided drug design experiments, without further adjustments. This stands in contrast to existing object-oriented toolkits where thread safety of data structures and algorithms is a deliberate design decision that can be hard to implement. Finally, the level of type-safety achieved by Scala highly increased the reliability of our code as well as the productivity of the programmers involved in this project

    Continutation Semantics for Parallel Haskell Dialects.

    Get PDF
    The aim of the present work is to compare, from a formal semantic basis, the different approaches to the parallelization of functional programming languages. For this purpose, we define a continuation semantics model which allows us to deal with side-effects and parallelism. To verify the suitability of our model we have applied it to three programming languages that introduce parallelism in very different ways, but whose common functional kernel is the lazy functional language Haskell

    JEff: objects for effect

    Get PDF
    Effect handling is a way to structure and scope side-effects which is gaining popularity as an alternative to monads in purely functional programming languages. Languages with support for effect handling allow the programmer to define idioms for state, exception handling, asynchrony, backtrack-ing, etc. from within the language. Functional programming languages, however, prohibit certain patterns of modular-ity well-known from object-oriented languages. In this paper we introduce JEff, an object-oriented programming language with native support for effect handling, to provide first answers to the question what it would mean to integrate object-oriented programming with effect handling. We illustrate how user-defined effects could benefit from interface polymorphism, and present its runtime semantics and type system

    An Elementary Affine λ-Calculus with Multithreading and Side Effects

    Get PDF
    International audienceLinear logic provides a framework to control the complexity of higher-order functional programs. We present an extension of this framework to programs with multithreading and side effects focusing on the case of elementary time. Our main contributions are as follows. First, we introduce a modal call-by-value λ-calculus with multithreading and side effects. Second, we provide a combinatorial proof of termination in elementary time for the language. Third, we introduce an elementary affine type system that guarantees the standard subject reduction and progress properties. Finally, we illustrate the programming of iterative functions with side effects in the presented formalism

    The Quantum Monadology

    Full text link
    The modern theory of functional programming languages uses monads for encoding computational side-effects and side-contexts, beyond bare-bone program logic. Even though quantum computing is intrinsically side-effectful (as in quantum measurement) and context-dependent (as on mixed ancillary states), little of this monadic paradigm has previously been brought to bear on quantum programming languages. Here we systematically analyze the (co)monads on categories of parameterized module spectra which are induced by Grothendieck's "motivic yoga of operations" -- for the present purpose specialized to HC-modules and further to set-indexed complex vector spaces. Interpreting an indexed vector space as a collection of alternative possible quantum state spaces parameterized by quantum measurement results, as familiar from Proto-Quipper-semantics, we find that these (co)monads provide a comprehensive natural language for functional quantum programming with classical control and with "dynamic lifting" of quantum measurement results back into classical contexts. We close by indicating a domain-specific quantum programming language (QS) expressing these monadic quantum effects in transparent do-notation, embeddable into the recently constructed Linear Homotopy Type Theory (LHoTT) which interprets into parameterized module spectra. Once embedded into LHoTT, this should make for formally verifiable universal quantum programming with linear quantum types, classical control, dynamic lifting, and notably also with topological effects.Comment: 120 pages, various figure
    corecore