[gambit-list] Is there any way to get which procedure a closure comes from?

Mikael mikael.trash at gmail.com
Fri Mar 11 07:14:42 EST 2011


Dear Marc,

Is there any way to get which procedure a closure comes from? If not, would
it be very easy to implement? Just wanted to check.

Kind regards,
Mikael

> (define (gen-closure . a) (lambda* id: type-x* () a))
> (define a (gen-closure))
> (define b (gen-closure))
> a
#<procedure #6*

**
~#a
* *
type-x
**
>
*
> b
#<procedure #7*
 ~#b
**
type-x
**
>
*
*> (closure-id a)*
*
type-x
*
*> (closure-id b)*
type-x

..and/or..
*

> (closure-parent-procedure a)
#<procedure #8 ~#gen-closure>

*
..or..

> (define (gen-closure . a) (lambda () a))
> (define a (gen-closure))
> (define b (gen-closure))
> a
#<procedure #6 ~#a>
> b
#<procedure #7 ~#b>
*> (get-procedure-subprocedures gen-closure)*
*'(1)*
*> (closure-id a)*
*1*
*> (closure-id b)*
*1*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110311/97291634/attachment.htm>


More information about the Gambit-list mailing list