Re: procedure-body

[email protected]
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
On Fri, Apr 18, 2003 at 11:19:17PM +0100, Matthias Radestock wrote:
> Turadg Aleahmad wrote:
> >Hi.
> >
> >I'm porting some code to SISC that makes use of STk's |procedure-body| 
> >function.  The docs <http://kaolin.unice.fr/STk/Doc/STk.pdf> describe it:
> >
> >(procedure-body procedure <proc>)
> >returns the body of procedure <proc>. If procedure <proc> is not a 
> >closure, procedure-body returns #f.
> >(define (f a b) (+ a (* b 2)))
> >(procedure-body f) ??? (lambda (a b) (+ a (* b 2)))
> >(procedure-body car) ??? #f
> >
> >There is no such function in SISC, correct?  Is it possible to write one?  
> >Any pointers?
> >
> 

Your best bet is to modify the optimizer, or create your own, that emits 
the following code:

(define lhs (lambda formals body)) =>
(define lhs (let ([tmp (lambda formals xbody)])
              (procedure-property tmp 'body 'xbody)
              tmp))

Then:

(define (procedure-body v)
  (procedure-property v 'body))

	Scott
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+oHxqr9IW4v3mHtQRAm48AJ92TdJNu6Dh4Q65JCPuSbs9rL83wgCfbHES
wDUrbBXW+BH+nccIrWKN9wU=
=WkGu
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.