Directives as a special case of foreign syntax Lassi Kortela (17 Feb 2021 13:53 UTC)
Re: Directives as a special case of foreign syntax Lassi Kortela (17 Feb 2021 13:58 UTC)
Re: Directives as a special case of foreign syntax Marc Nieper-Wißkirchen (17 Feb 2021 14:16 UTC)
Re: Directives as a special case of foreign syntax Marc Nieper-Wißkirchen (17 Feb 2021 14:09 UTC)

Re: Directives as a special case of foreign syntax Lassi Kortela 17 Feb 2021 13:58 UTC

> ;;> \section{Interface}
> ;;>
> ;;> \procedure{(show out [args ...])}
> ;;>
> ;;> The primary interface.  Analogous to CL's \scheme{format}, the first
> ;;> argument is either an output port or a boolean, with \scheme{#t}
> ;;> indicating \scheme{current-output-port} and \scheme{#f} indicating a
> ;;> string port.  The remaining arguments are formatters, combined as with
> ;;> \scheme{each}, run with output to the given destination.  If \var{out}
> ;;> is \scheme{#f} then the accumulated output is returned, otherwise
> ;;> the result is unspecified.

Ideally this could be written directly as S-expressions but markup is a
difficult case. S-expressions are optimized for a lot of structure with
little bits of free-form text here and there. Markup is the inverse of
that situation: a lot of free-form text with a little structure here and
there.

If we had a line-oriented multi-line string syntax, we could do
something like:

#!scribble
$ \section{Interface}
$
$ \procedure{(show out [args ...])}
$
$ The primary interface.  Analogous to CL's \scheme{format}, the first
$ argument is either an output port or a boolean, with \scheme{#t}
$ indicating \scheme{current-output-port} and \scheme{#f} indicating a
$ string port.  The remaining arguments are formatters, combined as with
$ \scheme{each}, run with output to the given destination.  If \var{out}
$ is \scheme{#f} then the accumulated output is returned, otherwise
$ the result is unspecified.

Here, `$` is an imaginary syntax for a string that runs until
end-of-line, with a special twist: if the next datum is also a `$`
string, it's appended to the previous string with a newline in between;
any number of `$` strings may be put next to each other for multi-line
strings.