Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do you determine if a procedure is defined?

0 views
Skip to first unread message

Mac Michaels

unread,
May 9, 1990, 5:17:11 PM5/9/90
to
Using only essential Scheme procedures, I have not been able to determine if
a non-essential Scheme procedure is already defined.

PROCEDURE? fails with an undefined symbol error when given a non-existent
symbol name. If you quote the argument to PROCEDURE? it always returns #F.

To attempt to get around this with SYMBOL? is also futile. SYMBOL? also
gets an undefined symbol error when given a non-existent symbol name and
always returns #T when given a quoted name.

Why is it needed? I am trying to write a file that can be loaded into any
Scheme that will add some of the missing procedure definitions. This will
allow me to easily port code to a number of different Scheme
implementations. I do not want to replace the implementation's
non-essential function if it already exists.

Some ways that this problem could be addressed are:

Add a special form (say DEFINED?) that returns #T if it's unquoted
argument exists.

Add a procedure to return the Scheme system name and version number.

--
USPS: Mac Michaels, 3500 West Balcones Center Dr., Austin,TX 78759
ARPA: m...@mcc.com TELE: (512) 338-3509 FAX: (512) 338-3600
UUCP: {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!cadillac!mac

:-)))))))) She had so many chins, she looked like a piece of Lisp code!

Oliver Laumann

unread,
May 10, 1990, 12:29:41 PM5/10/90
to
In article <MAC.90Ma...@k9.cad.mcc.com> m...@mcc.com (Mac Michaels) writes:
> Some ways that this problem could be addressed are:
>
> Add a special form (say DEFINED?) that returns #T if it's unquoted
> argument exists.

Elk has a predicate "bound?" which, when applied to a symbol, returns
#t iff the variable named by the symbol is bound in the current
environment.

I think T has a "bound?" predicate, too; at least a "grep" on the
sources says so.

I'm sure C-Scheme has a similar function as well (it must, since it
has virtually everything :-)

XScheme has a "bound?" predicate similar to the one in Elk.

Regards,
--
Oliver Laumann n...@TUB.BITNET n...@tub.cs.tu-berlin.de n...@tub.UUCP

0 new messages