This paper gives a proposal for how order-sorted algebraic specification languages can be extended with higher-order functions. The approach taken is a generalisation to the order-sorted case of an approach given by M...
详细信息
This paper gives a proposal for how order-sorted algebraic specification languages can be extended with higher-order functions. The approach taken is a generalisation to the order-sorted case of an approach given by Moller, Tarlecki and Wirsing for the many-sorted case. The main idea in the proposal is to only consider reachable extensional algebras. This leads to a very simple theory, where it is possible to relate the higher-order specifications to first-order specifications.
A higher-order function takes one or more functions as inputs or outputs to support the generality of function definitions. In modern programming languages, higher-order functions are designed as a feature to enhance ...
详细信息
A higher-order function takes one or more functions as inputs or outputs to support the generality of function definitions. In modern programming languages, higher-order functions are designed as a feature to enhance usability and scalability. ing higher-order functions from existing functions decreases the number of similar functions and improves the code reuse. However, due to the complexity, defining and calling higher-order functions are not widely used in practice. In this paper, we investigate the use of higher-order functions in Scala programs. We collected 8,285 higher-order functions from 35 Scala projects in GitHub with the most stars and conducted an exploratory study via answering five research questions of using higher-order functions, including the data scale, the definition types, the definition distribution, the factor that correlates with the function calls, and the developer contribution. Our study mainly shows five empirical results about the common use of higher-order functions in Scala programs. Our findings are listed as follows. (1) Among 35 Scala projects, 6.84% of functions are defined as higher-order functions on average and the average calls per function show that higher-order functions are called more frequently than first-orderfunctions. (2) In all higher-order functions in the study, 87.35% of definitions of higher-order functions and 90.66% of calls belong to the type that only takes functions as parameters. (3) Three measurements (including lines of executable code, Cyclomatic complexity, and warnings in the code style) in higher-order functions are lower than those of first-orderfunctions. (4) Regression analysis on all projects suggests that the number of calling higher-order functions highly correlates with the Cyclomatic complexity. (5) In all projects in the study, 43.82% calls of higher-order functions are written by the same developers who have defined the functions and results show that top 20% authors of higher-order functi
Intensional computations are those that query the internal structure of their arguments. In a higher-order setting, such queries perform program analysis. This is beyond the expressive power of traditional term rewrit...
详细信息
Intensional computations are those that query the internal structure of their arguments. In a higher-order setting, such queries perform program analysis. This is beyond the expressive power of traditional term rewriting systems, such as lambda-calculus or combinatory logic, as they are extensional. In such settings it has been necessary to encode or quote the program before analysis. However, there are intensional calculi, specifically confluent term rewriting systems, that can analyse higher-order programs within the calculus proper, without quotation;there are even programs that produce the Goedel numbers of their program argument This paper summarizes the current situation. Highlights include the following observations. We have known since 2011 that the simplest intensional calculus, SF-calculus, supports arbitrary queries of closed normal forms, including equality, pattern-matching, searching and self-interpretation. Recent work, verified using the Coq proof assistant, has shown that all recursive programs can be represented as closed normal forms in SF-calculus, and even in combinatory logic. Thus, we can here deduce that SF-calculus (but not combinatory logic) can define queries of programs. These results are compatible with direct support for lambda-abstraction. Although these results conflict with the traditional understanding of expressive power of combinatory logic and lambda-calculus, as developed by Church and Kleene, our recent publication has shown that their approach is compromised by its reliance on encodings. To drive the point home, this paper uses a non-standard encoding to lambda-define a trivial solution of the Halting Problem. (C) 2019 Elsevier B.V. All rights reserved.
State-of-the-art C/C++ synthesis tools lack abstractions and conveniences that are pervasive in modern software languages. higher-order functions are particularly important as they increase productivity by concisely r...
详细信息
State-of-the-art C/C++ synthesis tools lack abstractions and conveniences that are pervasive in modern software languages. higher-order functions are particularly important as they increase productivity by concisely representing common design patterns. Providing these in hardware design environments would improve the accessibility of hardware tools for software engineers by providing familiar interfaces and abstractions. We have created an open-source library of higher-order functions synthesizable in C/C++ hardware development tools. We implement six common algorithms on a PYNQ board and conclude that our library produces results that are generally statistically indistinguishable from nonrecursive techniques.
A commonly cited advantage of Prolog and similar logic languages is that data structures may contain logical (i.e. free) variables. These variables may be regarded as hooks into the data structure, to places where uni...
详细信息
A commonly cited advantage of Prolog and similar logic languages is that data structures may contain logical (i.e. free) variables. These variables may be regarded as hooks into the data structure, to places where unification may be used to insert new information into the data structure. We show that the same technique can be used in a functional programming language. A data structure is represented as a function. The formal parameter of the function is used to provide direct access to the part of a data structure where new information is to be inserted.
Test generation has proven to provide an effective way of identifying programming errors. Unfortunately, current test generation techniques are challenged by higher-order functions in dynamic languages, such as JavaSc...
详细信息
Test generation has proven to provide an effective way of identifying programming errors. Unfortunately, current test generation techniques are challenged by higher-order functions in dynamic languages, such as JavaScript functions that receive callbacks. In particular, existing test generators suffer from the unavailability of statically known type signatures, do not provide functions or provide only trivial functions as inputs, and ignore callbacks triggered by the code under test. This paper presents LambdaTester, a novel test generator that addresses the specific problems posed by higher-order functions in dynamic languages. The approach automatically infers at what argument position a method under test expects a callback, generates and iteratively improves callback functions given as input to this method, and uses novel test oracles that check whether and how callback functions are invoked. We apply LambdaTester to test 43 higher-order functions taken from 13 popular JavaScript libraries. The approach detects unexpected behavior in 12 of the 13 libraries, many of which are missed by a state-of-the-art test generator.
In teaching students to program with compositions of higher-order functions, we have encountered a sharp distinction in the difficulty of problems as perceived by students. This distinction especially matters as growi...
详细信息
In teaching students to program with compositions of higher-order functions, we have encountered a sharp distinction in the difficulty of problems as perceived by students. This distinction especially matters as growing numbers of programmers learn about functional programming for data processing. We have made initial progress on identifying this distinction, which appears counter-intuitive to some. We describe the phenomenon, provide some preliminary evidence of the difference in difficulty, and suggest consequences for functional programming pedagogy.
Motivation. higher-order functions are a standard and increasingly central component in many kinds of modern programming, including data science and Web development. Yet little research has been devoted to student lea...
详细信息
ISBN:
(纸本)9781450383264
Motivation. higher-order functions are a standard and increasingly central component in many kinds of modern programming, including data science and Web development. Yet little research has been devoted to student learning or understanding of this topic. Objectives. We conducted formative research on how well students are able to correlate higher-order functions with their inputoutput behavior. We also wanted to evaluate a variety of techniques for assessing their understanding. Method. We created a series of instruments in which students were given either concrete input/output examples or abstracted diagrams of list transformations. Students were asked to cluster or classify these examples by their behavior, sometimes against a concrete list of higher-order functions and sometimes free-form. We administered these over the course of a month, and then once again three months later. Results. We find that students initially have several difficulties with clustering higher-order function examples. With different instruments, we find that students are later able to do quite well, largely avoiding large-scale errors but making several small-scale ones. We also find some evidence of growth in their thinking about these operations. We also find weaknesses in the nature and order of techniques we used. Discussion. higher-order functions deserve far more attention than they have been paid in the literature on programming education. Their increasing use in several important domains makes this need critical. Our proposed methods for conducting such research are another contribution of this work. Our findings and methods should also be relevant for exploring how students understand libraries and APIs.
Background and Context. Program planning has been a longstanding and important problem in computing education. Finding useful primitives for planning and assessing whether students are able to understand and use these...
详细信息
ISBN:
(纸本)9781450391948
Background and Context. Program planning has been a longstanding and important problem in computing education. Finding useful primitives for planning and assessing whether students are able to understand and use these primitives remain open problems. We make progress on this problem by using higher-order functions (hofs) as planning operations. Not only are hofs increasingly prevalent in computing broadly, some data science programming sources also recommend their use in planning solutions to data-processing pipelines, giving our task additional applicability. Objectives. We first wish to confirm that students can understand the behavior of individual hofs. We also seek to understand which behavioral features of these hofs are reflected in their understanding. We then investigate their ability to plan solutions as the composition of hofs. We examine this from two perspectives: recognizing compositions from examples, and describing compositions to solve problems. Method. Our work is situated in early-stage tertiary education. To investigate student understanding of individual hofs, we present them with both input-output examples and open-ended questions. To investigate the composition of hofs, we use two formats. First, we use the same input-output format as for individual hofs. We then ask students to construct concrete plans for programming problems defined using text. These plans were constructed using a tool that was custom-built for this work. Students were then asked to write programs to solve the same problems. We perform both quantitative and qualitative analysis of the responses. Findings. We find students are proficient at recognizing individual hofs through input-output examples. They use a variety of features to identify hofs, with the most prominent features being type-based. While they do have difficulty recognizing compositions of hofs presented in the same input-output example format, there may be simple explanations for this. Either way, students are
This article introduces an application of higherorderfunctions as structure abstractions of recursive(1) functions as a method to reduce a search effort needed for the automatic programming (evolving) of common type...
详细信息
This article introduces an application of higherorderfunctions as structure abstractions of recursive(1) functions as a method to reduce a search effort needed for the automatic programming (evolving) of common types of recursive functions. We will shortly describe a functional paradigm based language specially designed for automatic programming. Henceforward we introduce the structure abstraction functions (AR-functions) and the results of experiments.
暂无评论