[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test for procedure?

In article <28600@yale-celray.yale.UUCP>, @MC.LCS.MIT.EDU,@MCC writes:
> Is there a finer-grained test for procedure values than PROCEDURE? ?
> As it stands, PROCEDURE? answers true to both procedures and
> operations (and any other object that can be applied).  We need to be
> able to distinguish actual, honest-to-goodness closures created by
> LAMBDA from these other apply-able entities

The predicate OPERATION? will let you distinguish operations from everything

    > (operation? (lambda nil nil))
    > (procedure? (lambda nil nil))

However, you should normally not need to rely on this distinction.  There is
probably a better way to do what you need to do.  For example, if you're
trying to distinguish closures that you create for some purpose from other
procedure-like objects lying around, you might create objects instead that
answer #t to a special predicate.

-- Ashwin.

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET:  Ram@yalecs