Simpler calling convention? Lassi Kortela (05 May 2020 13:41 UTC)
Re: Simpler calling convention? Marc Nieper-Wißkirchen (05 May 2020 13:52 UTC)
Re: Simpler calling convention? John Cowan (05 May 2020 15:01 UTC)
Re: Simpler calling convention? Marc Nieper-Wißkirchen (05 May 2020 15:13 UTC)
Re: Simpler calling convention? Lassi Kortela (05 May 2020 15:44 UTC)

Re: Simpler calling convention? Marc Nieper-Wißkirchen 05 May 2020 15:12 UTC

Am Di., 5. Mai 2020 um 17:01 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
> I've simplified things by removing the optional *s* argument everywhere, adding a parameter `current-random-source` initialized to SRFI 27's `default-random-source`, and a trivial bit of syntax (with-random-source source proc arg ...) that directly replaces any call that would use an explicit *s* argument.  That puts all the optionality at the right end in the usual way.

(1) Does changing the parameter CURRENT-RANDOM-SOURCE affect existing
generators of random data? I guess not. Is this specified?

(2) Isn't the syntax

(with-random-source source (proc arg ...))

more in line with the bulk of specified procedures than

(with-random-source source proc arg ...)

?

The latter has also two defects: When used in conjunction with, say,
APPLY, it looks even stranger: (with-random-source source apply proc
arg ...). The second defect is that while in the former syntax (proc
arg ...) can be any expression (even a special form), this is no more
true for the latter.

Thus I would propose the following definition:

(define-syntax with-random-source
  (syntax-rules ()
    ((with-random-source source expr) (parameterize
((current-random-source source)) expr))))

Marc