z-logo
open-access-imgOpen Access
Copattern matching and first-class observations in OCaml, with a macro
Author(s) -
Paul Laforgue,
Yann Régis-Gianas
Publication year - 2017
Publication title -
hal (le centre pour la communication scientifique directe)
Language(s) - English
Resource type - Conference proceedings
DOI - 10.1145/3131851.3131869
Subject(s) - functional programming , matching (statistics) , computer science , programming language , pattern matching , class (philosophy) , extension (predicate logic) , generalization , macro , duality (order theory) , theoretical computer science , transformation (genetics) , program transformation , algebra over a field , mathematics , artificial intelligence , discrete mathematics , pure mathematics , mathematical analysis , biochemistry , statistics , chemistry , gene
International audienceInfinite data structures are elegantly defined by means of copatternmatching, a dual construction to pattern matching that expressesthe outcomes of the observations of an infinite structure. We extendthe OCaml programming language with copatterns, exploiting theduality between pattern matching and copattern matching. Pro-vided that a functional programming language has GADTs, everycopattern matching can be transformed into a pattern matching viaa purely local syntactic transformation, a macro. The developmentof this extension leads us to a generalization of previous calculus ofcopatterns: the introduction of first-class observation queries. Westudy this extension both from a formal and practical point of view

The content you want is available to Zendy users.

Already have an account? Click here to sign in.
Having issues? You can contact us here
Accelerating Research

Address

John Eccles House
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom