Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Jakub T. Jankiewicz 22 Aug 2021 16:50 UTC

I'm trying to use SRFI-1 base implementation in my Scheme but it lack
important pieces. They should be included with the code. Otherwise the code
is broke and doesn't work.

SRFI-1 uses receive macro and the code comment say that it's trivial to
create. Example function.

(define (split-at x k)
  (check-arg integer? k split-at)
  (let recur ((lis x) (k k))
    (if (zero? k) (values '() lis)
        (receive (prefix suffix) (recur (cdr lis) (- k 1))
          (values (cons (car lis) prefix) suffix)))))

My question is this is this receive exactly the same macro as in SRFI-8?

https://srfi.schemers.org/srfi-8/srfi-8.html

With basic implementation like this:

(define-syntax receive
  (syntax-rules ()
    ((receive formals expression body ...)
     (call-with-values (lambda () expression)
                       (lambda formals body ...)))))

If yes then it should be linked somehow so you can actually run the code from
SRFI-1 base implementation.

PS: The other macro that was missing let-optional was not so trivial to
create, I've got help from Reddit:

https://www.reddit.com/r/scheme/comments/p8ovr7/how_to_define_letoptionals_macro_from_srfi1/

That macro can also be documented, because as you can see from the code it's
not so simple.

--
Jakub T. Jankiewicz, Web Developer
https://jcubic.pl/me