Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Jakub T. Jankiewicz (22 Aug 2021 16:51 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (23 Aug 2021 15:58 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (23 Aug 2021 20:19 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (23 Aug 2021 21:15 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 07:34 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Daphne Preston-Kendal (24 Aug 2021 06:45 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 07:51 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Daphne Preston-Kendal (24 Aug 2021 08:37 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 09:26 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 17:28 UTC)
(missing)
(missing)
Fwd: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 18:38 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 17:56 UTC)
Re: Is recieve macro from base implementation of SRFI-1 in fact SRFI-8? Marc Nieper-Wißkirchen (24 Aug 2021 17:59 UTC)

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