What syntax support for SRFI 231? Bradley Lucier (27 Jan 2022 20:48 UTC)
Re: What syntax support for SRFI 231? Alex Shinn (27 Jan 2022 21:42 UTC)
Re: What syntax support for SRFI 231? Bradley Lucier (27 Jan 2022 22:55 UTC)
Re: What syntax support for SRFI 231? Bradley Lucier (10 Feb 2022 02:15 UTC)

Re: What syntax support for SRFI 231? Bradley Lucier 10 Feb 2022 02:14 UTC

On 1/27/22 3:48 PM, Bradley Lucier wrote:
> What syntax support should appear in SRFI 231, the followup to SRFI 179?
>
> I don't think much about syntax, so I'm not the right person to lead on
> this issue.
>
> Jens Axel Jens Axel Søgaard recommended SRFI 42-type comprehensions.  We
> haven't yet determined why SRFI 42's example programs don't run on
> Gambit, but perhaps it would be good to discuss before then how such
> comprehensions would look in use.
>
> What other syntax support should be included in this SRFI?
>
> Brad

SRFI 42 has been added to the current github head of Gambit, so perhaps
we can talk about comprehensions and generators in the style of that SRFI.

My macro abilities are very poor so I will probably need some help to
implement.

Here is my first proposal for SRFI 42-style comprehensions and
generators, written in roughly the same style as used in the SRFI document.

Comments on necessity of adding these features, the design or sample
implementations welcome.

Brad

Comprehension:

(array-ec <interval-or-specification> <qualifier>* <expression>)

<interval-or-specification> =>
<interval>, or
(<interval>), or
(<interval> <storage-class>), or
(<interval> <storage-class> <mutability>), or
(<interval> <storage-class> <mutability> <safety>), where
<interval> is an interval,
<storage-class> is a storage class,
<mutability> is a boolean, and
<safety> is a boolean

Implemented something like vector-of-length-ec, because we're just
copying objects into the body of the array.

Generators:

(:interval (<i_0> <i_k>*) <arg>)

<i_0>, <i_k>* are variables, and
<arg> is an interval

May be implemented as syntax expansion of nested :range's.

(:array <vars> <arg>)

<vars> is as in SRFI 42, and
<arg> is an array

This seems to be trickier to implement.