Javascript must be enabled to continue!
The Ultimate Conditional Syntax
View through CrossRef
Functional programming languages typically support expressive pattern-matching syntax allowing programmers to write concise and type-safe code, especially appropriate for manipulating algebraic data types. Many features have been proposed to enhance the expressiveness of stock pattern-matching syntax, such as pattern bindings, pattern alternatives (a.k.a. disjunction), pattern conjunction, view patterns, pattern guards, pattern synonyms, active patterns, ‘if-let’ patterns, multi-way if-expressions, etc. In this paper, we propose a new pattern-matching syntax that is both more expressive and (we argue) simpler and more readable than previous alternatives. Our syntax supports parallel and nested matches interleaved with computations and intermediate bindings. This is achieved through a form of nested multi-way if-expressions with a
condition-splitting
mechanism to factor common conditional prefixes as well as a binding technique we call
conditional pattern flowing
. We motivate this new syntax with many examples in the setting of MLscript, a new ML-family programming language. We describe a straightforward desugaring pass from our rich
source
syntax into a minimal
core
syntax that only supports flat patterns and has an intuitive small-step semantics. We then provide a translation from the core syntax into a
normalized
syntax without backtracking, which is more amenable to coverage checking and compilation, and formally prove that our translation is semantics-preserving. We view this work as a step towards rethinking pattern matching to make it more powerful and natural to use. Our syntax can easily be integrated, in part or in whole, into existing as well as future programming language designs.
Association for Computing Machinery (ACM)
Title: The Ultimate Conditional Syntax
Description:
Functional programming languages typically support expressive pattern-matching syntax allowing programmers to write concise and type-safe code, especially appropriate for manipulating algebraic data types.
Many features have been proposed to enhance the expressiveness of stock pattern-matching syntax, such as pattern bindings, pattern alternatives (a.
k.
a.
disjunction), pattern conjunction, view patterns, pattern guards, pattern synonyms, active patterns, ‘if-let’ patterns, multi-way if-expressions, etc.
In this paper, we propose a new pattern-matching syntax that is both more expressive and (we argue) simpler and more readable than previous alternatives.
Our syntax supports parallel and nested matches interleaved with computations and intermediate bindings.
This is achieved through a form of nested multi-way if-expressions with a
condition-splitting
mechanism to factor common conditional prefixes as well as a binding technique we call
conditional pattern flowing
.
We motivate this new syntax with many examples in the setting of MLscript, a new ML-family programming language.
We describe a straightforward desugaring pass from our rich
source
syntax into a minimal
core
syntax that only supports flat patterns and has an intuitive small-step semantics.
We then provide a translation from the core syntax into a
normalized
syntax without backtracking, which is more amenable to coverage checking and compilation, and formally prove that our translation is semantics-preserving.
We view this work as a step towards rethinking pattern matching to make it more powerful and natural to use.
Our syntax can easily be integrated, in part or in whole, into existing as well as future programming language designs.
Related Results
Conditional Constructions in Yemsa
Conditional Constructions in Yemsa
Introduction. The main objective of this study is to produce a comprehensive description of Yemsa conditional constructions. The existing studies do not describe conditional clause...
The utility of SYNTAX score predictability by electrocardiogram parameters in patients with unstable angina
The utility of SYNTAX score predictability by electrocardiogram parameters in patients with unstable angina
Abstract
Background
SYNTAX score is one of the risk assessment systems to predict cardiac events in acute coronary syndrome patients. Despite the la...
P4637Elevated von Willebrand factor (VWF) and factor VIII are associated with higher clinical SYNTAX score in patients with stable coronary artery disease
P4637Elevated von Willebrand factor (VWF) and factor VIII are associated with higher clinical SYNTAX score in patients with stable coronary artery disease
Abstract
Background
Von Willebrand factor (VWF plays) central role in thrombogenesis, and circulates in a noncovalent complex wi...
A Cross-Sectional Study on the Relationship between the HEART Score and the Severity of CAD using the SYNTAX Score in Patients with NSTEMI Admitted to the Emergency Department: A Study from Turkey
A Cross-Sectional Study on the Relationship between the HEART Score and the Severity of CAD using the SYNTAX Score in Patients with NSTEMI Admitted to the Emergency Department: A Study from Turkey
Background:
The HEART score is a risk stratification tool for acute chest pain, evaluating history, ECG, age, risk factors, and troponin. The SYNTAX (synergy between pe...
JOHANN SAMUEL FRIEDRICH BOUBRIGI SÜNTAKSILOENGUD TARTU ÜLIKOOLIS; pp. 62–121
JOHANN SAMUEL FRIEDRICH BOUBRIGI SÜNTAKSILOENGUD TARTU ÜLIKOOLIS; pp. 62–121
Johann Samuel Friedrich Boubrigâs lectures on syntax at the University of Tartu The article gives a detailed overview of the lectures on Estonian syntax delivered by Johann Samu...
Implementation and Implications of Conditional Sentences in English Grammar
Implementation and Implications of Conditional Sentences in English Grammar
This study aims to investigate the role of conditional sentences in English grammar by exploring their structures, functions, and implications in various contexts. The urgency of t...
Association of Triglyceride/High Density Lipoprotein Cholesterol Ratio and Coronary Lesion Severity in Acute Myocardial Infarction Patients at Adam Malik Hospital, Medan
Association of Triglyceride/High Density Lipoprotein Cholesterol Ratio and Coronary Lesion Severity in Acute Myocardial Infarction Patients at Adam Malik Hospital, Medan
Introduction: Coronary heart disease is the leading cause of worldwide death. A number of markers have been identified in terms of the atherogenic potential of the lipid profile.Th...
Biological Foundations and Origin of Syntax
Biological Foundations and Origin of Syntax
Interdisciplinary perspectives on the evolutionary and biological roots of syntax, describing current research on syntax in fields ranging from linguistics to neurology.
...

