vladimir@prosper.EBB.Eng.Sun.COM (Vladimir G. Ivanovic) (12/29/90)
MacScheme and Elk are different in small ways. Elk defines close-port and
MacScheme has close-input-port and close-output-port.
I'd like to write standard Scheme code which works on *both* systems like:
(if (test-for-existence <object>)
(<consequent>)
(<alternative>))
How can I test to see if a procedure (or variable) is defined without causing
an error? (Am I being unusually thick about this ...?)
-- Vladimir (a Scheme Novice)
--
==============================================================================
Vladimir G. Ivanovic Sun Microsystems, Inc
(415) 336-2315 2550 Garcia Ave., MTV12-33
vladimir@Sun.COM Mountain View, CA 94043-1100
Disclaimer: I speak only for myself. Your mileage will vary.
==============================================================================kend@data.UUCP (Ken Dickey) (12/29/90)
vladimir@prosper.EBB.Eng.Sun.COM (Vladimir G. Ivanovic) writes: >I'd like to write standard Scheme code which works on *both* systems like: > (if (test-for-existence <object>) > (<consequent>) > (<alternative>)) >How can I test to see if a procedure (or variable) is defined without causing >an error? (Am I being unusually thick about this ...?) You are not being thick. There is currently no portable way of doing this. The recommended practice is to define a variable with the implementation name and use this to load the appropriate compatability file [unfortunately, LOAD is not standard!]. This compatability file then defines values neccessary to bring the particular implementation to the baseline required for the particular application. Of course, since you are setting a variable, you can load the appropriate file yourself... It would be nice if all implementations would define such a "variable". (define Scheme-Implementation 'random) -Ken Dickey kend@data.uucp