chickadee » srfi-259 » lambda/this

(lambda/this this formal body ...)syntax

this is an identifier. formal is a lambda formal.

Create a procedure such that this is bound to the location of the current procedure. If the procedure is tagged by a constructor made by define-procedure-tag, then that new procedure will have this bound to the new procedure.

Here is an example of its usage:

(import (srfi 259 extensions))
(define-procedure-tag tag-foo tag-foo? get-tag-foo)

(define f (lambda/this this (x)
            (if (tag-foo? this)
                (+ x (get-tag-foo this))
                x)))

(f 10) ; => 10
(define g (tag-foo 10 f))
(g 10) ; => 20
(f 10) ; => 10