You are looking at historical revision 34754 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?] [base BASE])

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, #:module for an module symbol sort, or #:type for a type+indentifier sort, or #f for unsorted. Default is #:type.
BASE
fixnum in 2..16. The default is 10.

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

BASE is used to convert a number to a string PATTERN. Of dubious utility. But can fix the situation of entering a hex number, say #x1c, for the pattern using the REPL and matching against 28!

apropos-list

[procedure] (apropos-list PATTERN [#:macros? MACROS?] [#:qualified? QUALIFIED?] [#:case-insensitive? CASE-INSENSITIVE?] [base BASE]) => 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?] [base BASE]) => list

Like apropos but returns a list key'ed by (MODULE . NAME).

MODULE is the module symbol or || for the null module.

NAME is the base symbol.

The associated information is either:

'macro
'keyword
'variable
'procedure
'(procedure . <lambda-list-specification>)
'(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|#:module|#:type|#f
case-insensitve|ci
#:case-insensitive? #t
base 2..16
#:base 2..16

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
flonum-print-precision                       procedure tmp13141315
fprintf                                      procedure (port732 fstr733 . args734)
max-symbol-printname-length    symbol-utils  procedure (syms273)
pretty-print                                 procedure (obj674 . opt675)
  ...
##sys#register-record-printer                procedure (type3661 proc3662)
##sys#repl-print-hook                        procedure (x2453 port2454)
##sys#repl-print-length-limit                variable
##sys#user-print-hook                        procedure (x3666 readable3667 port3668)
##sys#with-print-length-limit                procedure (limit3703 thunk3704)
#;1> ,a '"w.*e" macros
eval-when                                    macro
when                                         macro
bitwise-and                                  procedure xs3755
bitwise-ior                                  procedure xs3761
bitwise-not                                  procedure (x3773)
bitwise-xor                                  procedure xs3767
call-with-current-continuation               procedure (proc1883)
  ...
write-string                                 procedure (s296 . more297)
char-set:lower-case                          variable
char-set:whitespace                          variable

Usage

(require-extension apropos)

Examples

> (apropos 'print)
flonum-print-precision                     procedure tmp13141315
fprintf                                    procedure (port732 fstr733 . args734)
max-symbol-printname-length  symbol-utils  procedure (syms273)
pretty-print                               procedure (obj674 . opt675)
pretty-print-expand*         expand-full   procedure (form32 . tmp3133)
pretty-print-width                         procedure args2478
print                                      procedure args3344
print*                                     procedure args3377
print-call-chain                           procedure tmp41484149
print-error-message                        procedure (ex5148 . args5149)
printf                                     procedure (fstr736 . args737)
sprintf                                    procedure (fstr739 . args740)
symbol-printname-details     symbol-utils  procedure (sym205)
symbol-printname-length      symbol-utils  procedure (sym270)
symbol-printname<?           symbol-utils  procedure (x241 y242)
symbol-printname=?           symbol-utils  procedure (x215 y216)
char-set:printing                          variable
> (pp (apropos-list 'print))
((expand-full#pretty-print-expand*
  symbol-utils#max-symbol-printname-length
  symbol-utils#symbol-printname-length
  print-error-message
  print-call-chain
  sprintf
  symbol-utils#symbol-printname-details
  printf
  print*
  char-set:printing
  print
  fprintf
  symbol-utils#symbol-printname=?
  symbol-utils#symbol-printname<?
  pretty-print
  flonum-print-precision
  pretty-print-width))
> (pp (apropos-information-list 'print))
((((||: . flonum-print-precision) procedure . tmp13141315)
 ((||: . fprintf) procedure port732 fstr733 . args734)
 ((symbol-utils . max-symbol-printname-length) procedure syms273)
 ((||: . pretty-print) procedure obj674 . opt675)
 ((expand-full . pretty-print-expand*) procedure form32 . tmp3133)
 ((||: . pretty-print-width) procedure . args2478)
 ((||: . print) procedure . args3344)
 ((||: . print*) procedure . args3377)
 ((||: . print-call-chain) procedure . tmp41484149)
 ((||: . print-error-message) procedure ex5148 . args5149)
 ((||: . printf) procedure fstr736 . args737)
 ((||: . sprintf) procedure fstr739 . args740)
 ((symbol-utils . symbol-printname-details) procedure sym205)
 ((symbol-utils . symbol-printname-length) procedure sym270)
 ((symbol-utils . symbol-printname<?) procedure x241 y242)
 ((symbol-utils . symbol-printname=?) procedure x215 y216)
 ((||: . char-set:printing) . variable)))
> (apropos 'print #:qualified? #t)
printer:                                     keyword
flonum-print-precision                       procedure tmp13141315
fprintf                                      procedure (port732 fstr733 . args734)
max-symbol-printname-length    symbol-utils  procedure (syms273)
pretty-print                                 procedure (obj674 . opt675)
pretty-print-expand*           expand-full   procedure (form32 . tmp3133)
pretty-print-width                           procedure args2478
print                                        procedure args3344
print*                                       procedure args3377
print-call-chain                             procedure tmp41484149
print-error-message                          procedure (ex5148 . args5149)
printf                                       procedure (fstr736 . args737)
sprintf                                      procedure (fstr739 . args740)
symbol-printname-details       symbol-utils  procedure (sym205)
symbol-printname-length        symbol-utils  procedure (sym270)
symbol-printname<?             symbol-utils  procedure (x241 y242)
symbol-printname=?             symbol-utils  procedure (x215 y216)
##sys#print                                  procedure (x3415 readable3416 port3417)
##sys#print-length-limit                     procedure args2478
##sys#print-to-string                        procedure (xs3909)
##sys#really-print-call-chain                procedure (port4111 chain4112 header4113)
##sys#register-record-printer                procedure (type3661 proc3662)
##sys#repl-print-hook                        procedure (x2453 port2454)
##sys#user-print-hook                        procedure (x3666 readable3667 port3668)
##sys#with-print-length-limit                procedure (limit3703 thunk3704)
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

Author

Kon Lovett

Version history

2.4.0
Add base.
2.3.0
Identifiers are now (<module> . <name>) for the information-list.
2.2.5
Re-flow.
2.2.4
Less C.
2.2.3
Fix only boolean/char REPL bug, re-flow.
2.2.2
Fix only number REPL bug, re-flow.
2.2.1
.
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.