SLIB denotes features by symbols. SLIB maintains a list of features supported by a Scheme session. The set of features provided by a session may change during that session. Some features are properties of the Scheme implementation being used. The following intrinsic features detail what sort of numbers are available from an implementation:
SLIB initialization (in require.scm) tests and provides any of these numeric features which are appropriate.
Other features correspond to the presence of packages of Scheme procedures or syntax (macros).
Returns
#tif feature is present in the current Scheme session; otherwise#f. More specifically,provided?returns#tif the symbol feature is thesoftware-type, thescheme-implementation-type1, or if feature has been provided by a module already loaded; and#fotherwise.In some implementations
provided?tests whether a module has beenrequired by any module or in any thread; other implementations will haveprovided?reflect only the modulesrequired by that particular session or thread.To work portably in both scenarios, use
provided?only to test whether intrinsic properties (like those above) are present.The feature argument can also be an expression calling
and,or, andnotof features. The boolean result of the logical question asked by feature is returned.
The generalization of provided? for arbitrary features and catalog
is feature-eval:
Evaluates
and,or, andnotforms in expression, using the values returned by calling provided? on the leaf symbols.feature-evalreturns the boolean result of the logical combinations.
(provided? 'foo) ⇒ #f
(provide 'foo)
(provided? 'foo) ⇒ #t
[1] scheme-implementation-type is the name symbol of the running Scheme implementation (RScheme, |STk|, Bigloo, chez, Elk, gambit, gauche, guile, JScheme, kawa, MacScheme, MITScheme, Pocket-Scheme, S7, Scheme48, Scheme->C, Scheme48, Scsh, SISC, T, umb-scheme, or Vscm). Dependence on scheme-implementation-type is almost always the wrong way to do things.