Newsgroups: comp.lang.lisp.x
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.sprintlink.net!usenet.kornet.nm.kr!news.kreonet.re.kr!news.dacom.co.kr!newsfeed.internetmci.com!howland.reston.ans.net!ix.netcom.com!netcom.com!mayer
From: mayer@netcom.com (Niels P. Mayer)
Subject: Re: print SUBR code?
Message-ID: <mayerDIsD1D.Iq0@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <49d1c9$pkt@fstgal00.tu-graz.ac.at>
Distribution: inet
Date: Wed, 29 Nov 1995 03:44:00 GMT
Lines: 41
Sender: mayer@netcom5.netcom.com

In article <49d1c9$pkt@fstgal00.tu-graz.ac.at>, rurban@sbox.tu-graz.ac.at (Reinhard Urban) writes:
> Hello fellow XLisper!
> From my question you wil see, that I'm a beginner.
> How to print out the code behind a SUBR?
> I need the list as in the defun form.
> 
> eg: (defun a (p) (print p))
> 
> and I want the souurce of a be printed with
> (print a)
> -> ((p) (print p))
> 
> (like in AutoLisp)
> is it possible, or are functions hidden?

It is possible ...

(defun a (p) (print p))
;; ^^^^ returns -- a

(symbol-function 'a)
;; ^^^ returns -- #<Closure-A: #102c2c10>

(generic (symbol-function 'a))
;; ^^^ returns -- #(a lambda (p) nil nil nil nil ((print p)) nil nil (p))

From the result of GENERIC you can pick out the parameter "(p)" and the
code "((print p))"... from there, do what thou wilt shall be the whole of
the law :-) .

For examples of GENERIC in XLISP 2.1g (and versions c, d, e, f ok as well)
see http://www.eit.com/software/winterp/examples/interactive/widgetinsp.lsp

!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!
!   Niels Mayer ..... mayer@eit.com   ! http://www.eit.com/~mayer           !
! Enterprise Integration Technologies ! http://www.eit.com/software/wwweasel!
! 800 El Camino Real, Menlo Park, CA. ! http://www.eit.com/software/winterp !
!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!



