Email list hosting service & mailing list manager

Low level procedures Jakub T. Jankiewicz (01 Sep 2021 08:53 UTC)
Re: Low level procedures Marc Nieper-Wißkirchen (01 Sep 2021 09:18 UTC)

Low level procedures Jakub T. Jankiewicz 01 Sep 2021 08:52 UTC

I think it would be better to create low level procedure that will set the tag
on a procedure.

(set-procedure-tag! expr procedure)

You will have more flexibility, because you will be able to change the tag.

Or should tag be immutable?

With set-procedure-tag! you can implement both case-lambda/tag and lambda/tag
with this syntax:

(define-syntax lambda/tag
  (syntax-rules ()
   ((_ expression (formals ...) body ...)
    (let ((proc (lambda (formals ...) body ...)))
       (set-procedure-tag! expression proc)
       proc))))

This API also allows to create immutable tags because the function
set-procedure-tag! can test if the tag is set and raise exception when there
already be tags. But if we want, it can also mutate the tags. We can also make
two procedures one that will make mutable and one for immutable tags.

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