SRFI 182: ADBMAL, ALET, and ALET*

by Joo ChurlSoo

status: withdrawn (2020-03-27)

keywords: Data Structure, Multiple Value Returns

See also SRFI 2: AND-LET*: an AND with local bindings, a guarded LET* special form, SRFI 11: Syntax for receiving multiple values, SRFI 51: Handling rest list, SRFI 54: Formatting, SRFI 71: Extended LET-syntax for multiple values, and SRFI 86: MU and NU simulating VALUES & CALL-WITH-VALUES, and their related LET-syntax.

Abstract

Unlike the VALUES and CALL-WITH-VALUES mechanism of R5RS, this one uses an explicit representation for multiple return values as a single value, namely a procedure. Decomposition of multiple values is done by simple application. The macro, ADBMAL, evaluates to a procedure that takes one procedure argument. The ADBMAL macro can be compared with LAMBDA. While a LAMBDA expression that consists of <formals> and <body> requires some actual arguments later when the evaluated LAMBDA expression is called, an ADBMAL expression that consists of <expression>s corresponding to actual arguments of LAMBDA requires <formals> and <body>, that is, an evaluated LAMBDA expression, later when the evaluated ADBMAL expression is called.

This SRFI also introduces the new LET-syntax ALET and ALET*, which depend on ADBMAL to manipulate multiple values, and which are compatible with LET and LET* of R5RS in single-value bindings. They also have a binding form making use of VALUES and CALL-WITH-VALUES to handle multiple values, and new binding forms for list, cons, and other multiple values. In addition, they have several new binding forms for useful functions such as escape, iteration, optional arguments, etc.