You are looking at historical revision 34110 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 [#:macros? MACROS?] [#:qualified? QUALIFIED?] [#:sort SORT] [#:case-insensitive? CASE-INSENSITIVE?] [#:search-mode? SEARCH-MODE])

Displays information about symbols matching PATTERN in the toplevel environment.

PATTERN
A symbol, string, irregex, irregex-sre, (quote symbol), (quote string). When unquoted symbol or string substring matching is performed. When quoted the string value is taken as an irregex regular expression string for use with search.
MACROS?
Either #t to include macros, or #f to skip them. Default is #f.
QUALIFIED?
Either #t to include qualified symbols or #f to skip them. Default is #f.
CASE-INSENSITIVE?
Either #t to use match case-insensitivity for the PATTERN or #f to be case-sensitive. Default is #f.
SORT
Either #:name for an symbol sort, or #:type for a type+indentifier sort, or #f for unsorted. The default is #:type.
SEARCH-MODE
Either #:prefix, #:suffix, or #t for contains. The default is #t.

Should PATTERN be a namespace qualified symbol the namespace will be dropped before conversion to a regular-expression.

apropos-list

[procedure] (apropos-list PATTERN [#:macros? MACROS?] [#:qualified? QUALIFIED?] [#:case-insensitive? CASE-INSENSITIVE?] [#:search-mode? SEARCH-MODE]) => {{list}}

Like apropos but returns an, unsorted, list of matching symbols.

apropos-information-list

[procedure] (apropos-information-list PATTERN [#:macros? MACROS?] [#:qualified? QUALIFIED?] [#:sort SORT] [#:case-insensitive? CASE-INSENSITIVE?] [#:search-mode? SEARCH-MODE]) => {{list}}

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 csi toplevel-command is added when the apropos extension is loaded: ,a PATTERN ARGUMENT....

ARGUMENT is interpreted as:

mac[ros]
#:macros? #t
qual[ified]
#:qualified? #t
sort [name|type|#f]
#:sort #:name|#:type|#f
case-insensitve|ci
#:case-insensitive? #t
search|mode pre[fix]|suff[ix]|#t
#:search-mode #:prefix|#:suffix|#t

The command is interpreted by the apropos procedure. Unlike apropos sort by type is the default.

Example:

#;1> ,a print qualified macros sort name
char-set:printing                         variable
define-record-printer                     macro
expand-full#pretty-print-expand*          procedure (form33 . tmp3234)
flonum-print-precision                    procedure tmp12681269
  ...
##sys#repl-print-hook                     procedure (x2228 port2229)
##sys#repl-print-length-limit             variable
##sys#user-print-hook                     procedure (x3498 readable3499 port3500)
##sys#with-print-length-limit             procedure (limit3534 thunk3535)
#;1> ,a '"w.*e" macros
eval-when                          macro
when                               macro
bitwise-and                        procedure xs3569
bitwise-ior                        procedure xs3575
bitwise-not                        procedure (x3587)
bitwise-xor                        procedure xs3581
  ...
write-string                       procedure (s297 . more298)
char-set:lower-case                variable
char-set:whitespace                variable

Usage

(require-extension apropos)

Examples

> (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

Requirements

regex check-errors miscmacros symbol-utils string-utils

Bugs and Limitations

Requires meta-information beyond that supplied by the transformer procedure.

Author

Kon Lovett

Version history

2.2.0
re-flow
2.2.0
correct interpretation of unquoted string/symbol as a literal string, fix sorting support for apropos-information-list, add case-insensitive option
2.1.3
fix for ticket #1211, incorrect load of regex when irregex is actual dependency
2.1.2
fix for removed core support routine
2.1.1
Fix for ticket #987
2.1.0
Added irregex sre & POSIX string patterns.
2.0.0
Chicken 4.8 only.
1.4.3
Explicit regex dependency.
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-2017 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.