Although functional programming languages simplify writing safe parallel programs by helping programmers to avoid data races, they have traditionally delivered poor performance. Recent work improved performance by usi...
详细信息
Although functional programming languages simplify writing safe parallel programs by helping programmers to avoid data races, they have traditionally delivered poor performance. Recent work improved performance by using a hierarchical memory architecture that allows processors to allocate and reclaim memory independently without any synchronization, solving thus the key performance challenge afflicting functional programs. The approach, however, restricts mutation, or memory effects, so as to ensure "disentanglement", a low-level memory property that guarantees independence between different heaps in the hierarchy. This paper proposes techniques for supporting entanglement and for allowing functional programs to use mutation at will. Our techniques manage entanglement by distinguishing between disentangled and entangled objects and shielding disentangled objects from the cost of entanglement management. We present a semantics that formalizes entanglement as a property at the granularity of memory objects, and define several cost metrics to reason about and bound the time and space cost of entanglement. We present an implementation of the techniques by extending the MPL compiler for Parallel ML. The extended compiler supports all features of the Parallel ML language, including unrestricted effects. Our experiments using a variety of benchmarks show that MPL incurs a small time and space overhead compared to sequential runs, scales well, and is competitive with languages such as C++, Go, Java, OCaml. These results show that our techniques can marry the safety benefits of functional programming with performance.
This paper reviews some programming techniques in R that have proved useful, particularly for substantial projects. These include several versions of object-oriented programming, used in a large number of R packages. ...
详细信息
This paper reviews some programming techniques in R that have proved useful, particularly for substantial projects. These include several versions of object-oriented programming, used in a large number of R packages. The review tries to clarify the origins and ideas behind the various versions, each of which is valuable in the appropriate context. R has also been strongly influenced by the ideas of functional programming and, in particular, by the desire to combine functional with object oriented programming. To clarify how this particular mix of ideas has turned out in the current R language and supporting software, the paper will first review the basic ideas behind object-oriented and functional programming, and then examine the evolution of R with these ideas providing context. functional programming supports well-defined, defensible software giving reproducible results. Object-oriented programming is the mechanism par excellence for managing complexity while keeping things simple for the user. The two paradigms have been valuable in supporting major software for fitting models to data and numerous other statistical applications. The paradigms have been adopted, and adapted, distinctively in R. functional programming motivates much of R but R does not enforce the paradigm. Object-oriented programming from a functional perspective differs from that used in non-functional languages, a distinction that needs to be emphasized to avoid confusion. R initially replicated the S language from Bell Labs, which in turn was strongly influenced by earlier program libraries. At each stage, new ideas have been added, but the previous software continues to show its influence in the design as well. Outlining the evolution will further clarify why we currently have this somewhat unusual combination of ideas.
Online programming platforms have immense potential to improve students' educational experience. They make programming more accessible, as no installation is required;and automatic grading facilities provide stude...
详细信息
Online programming platforms have immense potential to improve students' educational experience. They make programming more accessible, as no installation is required;and automatic grading facilities provide students with immediate feedback on their code, allowing them to to fix bugs and address errors in their understanding right away. However, these graders tend to focus heavily on the functional correctness of a solution, neglecting other aspects of students' code and thereby causing students to miss out on a significant amount of valuable feedback. In this paper, we recount our experience in using the Learn-OCaml online programming platform to teach functional programming in a second-year university course on programming languages and paradigms. Moreover, we explore how to leverage Learn-OCaml's automated grading infrastructure to make it easy to write more expressive graders that give students feedback on properties of their code beyond simple input/output correctness, in order to effectively teach elements of functional programming style. In particular, we describe our extensions to the Learn-OCand platform that evaluate students on test quality and code style. By providing these tools and a suite of our own homework problems and associated graders, we aim to promote functional programming education, enhance students' educational experience, and make teaching and learning typed functional programming more accessible to instructors and students alike, in our community and beyond.
The Trends in functional programming Symposia are an annual event dedicated to promoting new research directions in functional programming and to investigating the relationship between functional programming and other...
详细信息
System-on-Chip (SoC) and other complex distributed hardware/software systems contain heterogeneous components whose behavior are best captured by different models of computations (MoCs). As a result, any system design...
详细信息
System-on-Chip (SoC) and other complex distributed hardware/software systems contain heterogeneous components whose behavior are best captured by different models of computations (MoCs). As a result, any system design framework for such systems requires the capability to express heterogeneous MoCs. Although a number of system level design languages (SLDL)s and frameworks have proliferated over the last few years, most of them are lacking in multiple ways. Some of the SLDLs and system design frameworks we have worked with are SpecC, Ptolemy II, SystemC-H, etc. From our analysis of these, we identify their following shortcomings: First, their dependence on specific programming language artifacts (Java or C/C++) make them less amenable to formal analysis. Second, the refinement strategies proposed in the design flows based on these languages lack formal semantics underpinnings making it difficult to prove that refinements preserve correctness, and third, none of the available SLDLs are easily customizable by users. In our work, we address these problems as follows: To alleviate the first problem, we follow Axel Jantschâ s paradigm of function-based semantic definitions of MoCs and formulate a functional programming framework called SML-Sys. We illustrate through a number of examples how to model heterogenous computing systems using SML-Sys. Our framework provides for formal reasoning due to its formal semantic underpinning inherited from SMLâ s precise denotational semantics. To handle the second problem and apply refinement strategies at a higher-level, we propose a refinement methodology and provide a semantics preserving transformation library within our framework. To address the third shortcoming, we have developed EWD, which allows users to customize MoC-specific visual modeling syntax defined as a metamodel. EWD is developed using a metamodeling framework GME (Generic Modeling Environment). It allows for automatic design-time syntactic and semantic checks on th
Facile is a symmetric integration of concurrent and functional programming. The language supports both function and process abstraction. Functions may be defined and used within processes, and processes can be dynamic...
详细信息
Facile is a symmetric integration of concurrent and functional programming. The language supports both function and process abstraction. Functions may be defined and used within processes, and processes can be dynamically created during expression evaluation. In this work we present two different descriptions of the operational semantics of Facile. First, we develop a structural operational semantics for a small core subset of Facile using a labeled transition system. Such a semantics is useful for reasoning about the operational behavior of Facile programs. We then provide an abstract model of implementation for Facile: theConcurrent and functional Abstract Machine (C-FAM). The C-FAM executes concurrent processes evaluating functional expressions. The implementation semantics includes compilation rules from Facile to C-FAM instructions and execution rules for the abstract machine. This level of semantic description is suitable for those interested in implementations.
The model of a computing system — a circular pipeline of identical processing elements with a simple structure — is presented. It is shown that a circular synchronous computer is fit for the execution of functional ...
详细信息
The model of a computing system — a circular pipeline of identical processing elements with a simple structure — is presented. It is shown that a circular synchronous computer is fit for the execution of functional programs. The processing elements of a circular synchronous computer execute in cooperation the same program; during its execution a program, represented as a string that is circularly shifted from one processing element to its next neighbour, is successively transformed until it is turned into the empty string.
Adopting a functional programming style could make your programs more robust, more compact, and more easily parallelizable. However, mastering it requires some effort.
Adopting a functional programming style could make your programs more robust, more compact, and more easily parallelizable. However, mastering it requires some effort.
作者:
Whittle, JNASA
Ames Res Ctr Recom Technol Moffett Field CA 94035 USA Univ Edinburgh
Edinburgh EH8 9YL Midlothian Scotland Napier Univ
Dept Comp Studies Edinburgh EH14 1DJ Midlothian Scotland
functional programming presents new challenges in the design of programming environments. In a strongly typed functional language, such as ML, much conventional debugging of runtime errors is replaced by dealing with ...
详细信息
functional programming presents new challenges in the design of programming environments. In a strongly typed functional language, such as ML, much conventional debugging of runtime errors is replaced by dealing with compile-time error reports. On the other hand, the cleanness of functional programming opens up new possibilities for incorporating sophisticated correctness-checking techniques into such environments. C(Y)NTHIA is a novel editor for ML that both addresses the challenges and explores the possibilities. It uses an underlying proof system as a framework for automatically checking for semantic errors such as non-termination. In addition, C(Y)NTHIA embodies the idea of programming by analogy-whereby users write programs by applying abstract transformations to existing programs. This paper investigates C(Y)NTHIA's potential as a novice ML programming environment. We report on two studies in which it was found that students using C(Y)NTHIA commit fewer errors and correct errors more quickly than when using a compiler/text editor approach. (C) 2000 Academic Press.
Inductive Program Synthesis or Inductive programming (IP) is the task of generating (recursive) programs from an incomplete specification, such as input/output (I/O) examples. All known IP algorithms can be described ...
详细信息
Inductive Program Synthesis or Inductive programming (IP) is the task of generating (recursive) programs from an incomplete specification, such as input/output (I/O) examples. All known IP algorithms can be described as search in the space of all candidate programs, with consequently exponential complexity. To constrain the search space and guide the search traditionally program schemes are used, usually given a priori by an expert user. Consequently, all further given data is interpreted w. r. t. this schema which now almost exclusively decides on success and failure, depending on whether it fits the data or not. Instead of trying to fit the data to a given schema indiscriminately, in my thesis (Schema-guided inductive functional programmin through automatic detection of type morphisms, 2010) I proposed to utilise knowledge about data types to choose and fit a suitable schema to the data! Recursion operators associated with data type definitions are well known in functional programming, but less in IP. I showed how to exploit universal properties of type morphisms which may be detected in the given I/O examples. This technique allows to introduce generic recursion schemes, such as catamorphisms or paramorphisms, on arbitrary inductive data types in the analytical inductive functional programming system IGOR II which was already presented here in a previous issue
暂无评论