You are looking at historical revision 20581 of this page. It may differ significantly from its current revision.
apropos
Documentation
An apropos facility for Chicken Scheme.
When loaded by the interpreter csi apropos provides the interpreter command a.
Apropos API
apropos
[procedure] (apropos PATTERN [ENVIRONMENT] [#:macros? MACROS?] [#:qualified? QUALIFIED?] [#:sort SORT])Displays information about identifiers matching PATTERN in the ENVIRONMENT and, optionally, a MACRO-ENVIRONMENT.
- PATTERN
- A symbol, string or regexp. When symbol or string substring matching is performed.
- ENVIRONMENT
- An environment. The default is the (interaction-environment).
- MACROS?
- Either #t to include macros, or #f to skip them. Default is #f.
- QUALIFIED?
- Either #t to include qualified identifiers or #f to skip them. Default is #f.
- SORT
- Either #:name for an identifier sort, or #:type for a type+indentifier sort, or #f for unsorted. The default is #:type.
Should PATTERN be a namespace qualified symbol the namespace will be dropped before conversion to a regular-expression.
apropos-list
[procedure] (apropos-list PATTERN [ENVIRONMENT] [#:macros? MACROS?] [#:qualified? QUALIFIED?])Like apropos but returns a list of matching identifiers.
apropos-information-list
[procedure] (apropos-information-list PATTERN [ENVIRONMENT] [#:macros? MACROS?] [#:qualified? QUALIFIED?] [#:sort? SORT?])Like apropos but returns an association list keyed by symbol. The associated information is either 'macro, 'keyword, 'variable, 'procedure, '(procedure . <lambda-list-specification>) or '(procedure . <core procedure name>).
Interpreter Usage
A toplevel command is added when the `apropos' extension is loaded by `csi': `,a'. Command help is available.
Usage
(require-extension apropos)
Examples
- YMMV
> (apropos 'print) expand-full#pretty-print-expand* procedure (form32 . tmp3133) flonum-print-precision procedure tmp11801181 fprintf procedure (port742 fstr743 . args744) pretty-print procedure (obj681 . opt682) pretty-print-width procedure arg2051 print procedure args2753 print* procedure args2782 print-call-chain procedure tmp34643465 print-error-message procedure (ex4314 . args4315) printf procedure (fstr746 . args747) sprintf procedure (fstr749 . args750) char-set:printing variable
(apropos-list 'print) (char-set:printing print flonum-print-precision pretty-print pretty-print-width sprintf printf print* print-error-message expand-full#pretty-print-expand* print-call-chain fprintf)
> (apropos 'print #:qualified? #t) printer: keyword expand-full#pretty-print-expand* procedure (form32 . tmp3133) flonum-print-precision procedure tmp11801181 fprintf procedure (port742 fstr743 . args744) pretty-print procedure (obj681 . opt682) pretty-print-width procedure arg2051 print procedure args2753 print* procedure args2782 print-call-chain procedure tmp34643465 print-error-message procedure (ex4314 . args4315) printf procedure (fstr746 . args747) sprintf procedure (fstr749 . args750) ##csi#print-banner procedure ##csi#print-usage procedure ##sys#print procedure (x2819 readable2820 port2821) ##sys#print-to-string procedure (xs3218) ##sys#really-print-call-chain procedure (port3428 chain3429 header3430) ##sys#register-record-printer procedure (type3024 proc3025) ##sys#repl-print-hook procedure (x2218 port2219) ##sys#user-print-hook procedure (x3029 readable3030 port3031) ##sys#with-print-length-limit procedure (limit3063 thunk3064) char-set:printing variable ##sys#record-printers variable ##sys#repl-print-length-limit variable
Notes
- The support for macros is brittle due to subtle details of the core macro machinary assumed by this extension. Submit a bug report if it breaks.
- Module qualified symbols are displayed whether the module is "imported" or not.
Requirements
Bugs and Limitations
- Doesn't show something similar to procedure-information for macros.
Requires meta-information beyond that supplied by the transformer procedure.
Author
Version history
- 1.4.2
- Using utility libraries, rather than own routines.
- 1.4.1
- Bugfix for sorting symbols by printname. kind: is now type:.
- 1.4.0
- Macros are back but brittle
- 1.3.0
- 1.1.2
- 1.1.1
- 1.1.0
- Needs "check-errors" extension.
- 1.0.0
- Chicken 4 release.
License
Copyright (C) 2009 Kon Lovett. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.