Jim Newton

Programmatic manipulation of Common Lisp type specifiers

By Jim Newton, Didier Verna, Maximilien Colange

2017-02-06

In ELS 20217, the 10th european lisp symposium

Abstract

In this article we contrast the use of the s-expression with the BDD (Binary Decision Diagram) as a data structure for programmatically manipulating Common Lisp type specifiers. The s-expression is the de facto standard surface syntax and also programmatic representation of the type specifier, but the BDD data structure offers advantages: most notably, type equivalence checks using s-expressions can be computationally intensive, whereas the type equivalence check using BDDs is a check for object identity. As an implementation and performance experiment, we define the notion of maximal disjoint type decomposition, and discuss implementations of algorithms to compute it: a brute force iteration, and as a tree reduction. The experimental implementations represent type specifiers by both aforementioned data structures, and we compare the performance observed in each approach.

Continue reading

Analysis of algorithms calculating the maximal disjoint decomposition of a set

Abstract

In this article we demonstrate 4 algorithms for calculating the maximal disjoint decomposition of a given set of types. We discuss some advantages and disadvantages of each, and compare their performance. We extended currently known work to describe an efficient algorithm for manipulating binary decision diagrams representing types in a programming language which supports subtyping viewed as subsets.

Continue reading

Monads in Common Lisp

Abstract

In this article we explain monads so they can be understood to the Lisp programmer. We base the explanation on a very clean explanation presented in the Scala programming language. We then proceed to re-present the concepts using mostly simple Common Lisp concepts. We do not attempt to justify the motivation behind the definitions, and we do not attempt to give any examples of applications. Most notably, we do not attempt to explain the connection monads have to modeling side effects.

Continue reading

Finding maximal common joins in a DAG

Abstract

Given a directed acyclic graph (DAG) and two arbitrary nodes, find maximal common joins of the two nodes. In this technical report I suggest an algorithm for efficiently calculating the minimal set of nodes which derive from a pair of nodes.

Continue reading

Type-checking of heterogeneous sequences in Common Lisp

By Jim Newton, Akim Demaille, Didier Verna

2016-03-25

In ELS 2016, the 9th european lisp symposium

Abstract

We introduce the abstract concept of rational type expression and show its relationship to rational language theory. We further present a concrete syntax, regular type expression, and a Common Lisp implementation thereof which allows the programmer to declaratively express the types of heterogeneous sequences in a way which is natural in the Common Lisp language. The implementation uses techniques well known and well founded in rational language theory, in particular the use of the Brzozowski derivative and deterministic automata to reach a solution which can match a sequence in linear time. We illustrate the concept with several motivating examples, and finally explain many details of its implementation.

Continue reading

Efficient dynamic type checking of heterogeneous sequences

Abstract

This report provides detailed background of our development of the rational type expression, concrete syntax, regular type expression, and a Common Lisp implementation which allows the programmer to declarative express the types of heterogeneous sequences in a way which is natural in the Common Lisp language. We present a brief theoretical background in rational language theory, which facilitates the development of rational type expressions, in particular the use of the Brzozowski derivative and deterministic automata to arrive at a solution which can match a sequence in linear time. We illustrate the concept with several motivating examples, and finally explain many details of its implementation.

Continue reading