31,344 research outputs found
Stream Fusion, to Completeness
Stream processing is mainstream (again): Widely-used stream libraries are now
available for virtually all modern OO and functional languages, from Java to C#
to Scala to OCaml to Haskell. Yet expressivity and performance are still
lacking. For instance, the popular, well-optimized Java 8 streams do not
support the zip operator and are still an order of magnitude slower than
hand-written loops. We present the first approach that represents the full
generality of stream processing and eliminates overheads, via the use of
staging. It is based on an unusually rich semantic model of stream interaction.
We support any combination of zipping, nesting (or flat-mapping), sub-ranging,
filtering, mapping-of finite or infinite streams. Our model captures
idiosyncrasies that a programmer uses in optimizing stream pipelines, such as
rate differences and the choice of a "for" vs. "while" loops. Our approach
delivers hand-written-like code, but automatically. It explicitly avoids the
reliance on black-box optimizers and sufficiently-smart compilers, offering
highest, guaranteed and portable performance. Our approach relies on high-level
concepts that are then readily mapped into an implementation. Accordingly, we
have two distinct implementations: an OCaml stream library, staged via
MetaOCaml, and a Scala library for the JVM, staged via LMS. In both cases, we
derive libraries richer and simultaneously many tens of times faster than past
work. We greatly exceed in performance the standard stream libraries available
in Java, Scala and OCaml, including the well-optimized Java 8 streams
Completeness of algebraic CPS simulations
The algebraic lambda calculus and the linear algebraic lambda calculus are
two extensions of the classical lambda calculus with linear combinations of
terms. They arise independently in distinct contexts: the former is a fragment
of the differential lambda calculus, the latter is a candidate lambda calculus
for quantum computation. They differ in the handling of application arguments
and algebraic rules. The two languages can simulate each other using an
algebraic extension of the well-known call-by-value and call-by-name CPS
translations. These simulations are sound, in that they preserve reductions. In
this paper, we prove that the simulations are actually complete, strengthening
the connection between the two languages.Comment: In Proceedings DCM 2011, arXiv:1207.682
CPS Transformation of Beta-Redexes
The extra compaction of Sabry and Felleisen's transformation is due to making continuations occur first in CPS terms and classifying more redexes as administrative. We show that the extra compaction is actually independent of the relative positions of values and continuations and furthermore that it is solely due to a context-sensitive transformation of beta-redexes. We stage the more compact CPS transformation into a first-order uncurrying phase and a context-insensitive CPS transformation. We also dene a context-insensitive CPS transformation that is just as compact. This CPS transformation operates in one pass and is dependently typed.Keywords: Continuation-passing style (CPS), Plotkin, Fischer, one-pass CPStransformation, two-level lambda-calculus, generalized reduction
CPS Transformation of Beta-Redexes
The extra compaction of the most compacting CPS transformation in existence, which is due to Sabry and Felleisen, is generally attributed to (1) making continuations occur first in CPS terms and (2) classifying more redexes as administrative. We show that this extra compaction is actually independent of the relative positions of values and continuations and furthermore that it is solely due to a context-sensitive transformation of beta-redexes. We stage the more compact CPS transformation into a first-order uncurrying phase and a context-insensitive CPS transformation. We also define a context-insensitive CPS transformation that provides the extra compaction. This CPS transformation operates in one pass and is dependently typed
Chaos in generically coupled phase oscillator networks with nonpairwise interactions
The Kuramoto-Sakaguchi system of coupled phase oscillators, where interaction
between oscillators is determined by a single harmonic of phase differences of
pairs of oscillators, has very simple emergent dynamics in the case of
identical oscillators that are globally coupled: there is a variational
structure that means the only attractors are full synchrony (in-phase) or splay
phase (rotating wave/full asynchrony) oscillations and the bifurcation between
these states is highly degenerate. Here we show that nonpairwise coupling -
including three and four-way interactions of the oscillator phases - that
appears generically at the next order in normal-form based calculations, can
give rise to complex emergent dynamics in symmetric phase oscillator networks.
In particular, we show that chaos can appear in the smallest possible dimension
of four coupled phase oscillators for a range of parameter values
On One-Pass CPS Transformations
We bridge two distinct approaches to one-pass CPS transformations, i.e., CPS transformations that reduce administrative redexes at transformation time instead of in a post-processing phase. One approach is compositional and higher-order, and is due to Appel, Danvy and Filinski, and Wand, building on Plotkin's seminal work. The other is non-compositional and based on a syntactic theory of the lambda-calculus, and is due to Sabry and Felleisen. To relate the two approaches, we use Church encoding, Reynolds's defunctionalization, and an implementation technique for syntactic theories, refocusing, developed in the second author's PhD thesis
- …