Re: First comments Marc Nieper-Wißkirchen 09 Jun 2020 08:29 UTC

Am Di., 9. Juni 2020 um 09:27 Uhr schrieb Linus Björnstam
<xxxxxx@veryfast.biz>:

> That one also addresses placeholders: we already have srfi-26 <> and <...> are perfect for this kind of thing.

If this means that we can get rid of the dichotomy between `->' and
`->>' all the better (as they only handle special cases anyway). So
you think of something like this?

(-> x (f <> 1) (+ 2 <> 4))

If we go this route, the macro arguments of `->' can all be
expressions and do not have to be procedure calls, widening the
applicability of the `->' syntax. In that case, however, you don't
want to scan for `<>' recursively in the argument expressions (this
won't understand lexical scoping), but you would make `<>' a syntax
parameter bound to identifier syntax (as yield in SRFI 190). This is
easily implementable in Guile and would just work.

[Exactly for macros like these, I am hoping that R7RS-large will
include SRFI 139 (syntax parameters) and identifier syntax (a question
that is orthogonal to the existence of low-level macro systems).]

However, I would then unify the syntax with the existing constructs of
Scheme to simply and regularize things:

(-> x (f <> 1) (+ 2 <> 4))

would become

(let* ((x) ((f <> 1))) (+ 2 <> 4))

In other words, we simply extend the let* syntax as it is done with
and-let* in SRFI 2 by allowing binding clauses to be a list of length
1. In these cases, the result is bound to an implicit identifier,
which is then bound to `<>' in subsequent steps.

Replacing `let*' by `and-let*' would implement the `some->' semantics.

Marc