{'fraction_non_alphanumeric': 0.02592352559948153, 'fraction_numerical': 0.0038885288399222295, 'mean_word_length': 5.626609442060086, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Functional Abstraction of Typed Contexts

This report investigates abstracting control with functions. This is achieved by defining continuations as functions abstracting lexically a delimited context [C[ ]] rather than dynamically an unlimited one C[ ], as it is usually the case. Because their co-domain is distinguished from the final domain of Answers, such continuations can be composed, and this contrasts with the simple exceptions of ML and Lisp and the unlimited first-class continuations of Scheme. Making these functional control abstractions first-class offers a new area in programming which this paper explores. The key points obtained here are: a denotational semantics for a simple, call-by-value, strongly typed expression language with higher-order functions and first-class continuations; its congruence with a continuation semantics; a polymorphic type inference system for that language; a systematic translation to higher-order functions (continuation-passing style); some worked examples of programming with functional abstractions of control; and an extension towards gaining control over embedding contexts. Sections 1 and 2 present the denotational semantics of the simple expression language and its congruence with a traditional continuation semantics. Section 3 illustrates programming with control abstractions. Section 4 describes its translation to an extended continuation-passing style with higher-order functions, and section 5 describes its type system. Section 6 compares this approach with related work.