The Ciao library browser

Author(s): Angel Fernandez Pineda.

The librowser library provides a set of predicates wich enable the user to interactively find Ciao libraries and/or any predicate exported by them.

This is a simple example:

?- apropos('*find*').
persdbrt_sql: dbfindall/4
persdbrtsql: dbfindall/4
conc_aggregates: findall/3
linda: rd_findall/3
vndict: find_name/4
internals: $find_file/8
aggregates: findall/4,findall/3

yes
?-

Librowser is specially useful when inside GNU Emacs: just place the cursor over a librowser response and press C-cTAB in order to get help on the related predicate. Refer to the "Using Ciao inside GNU Emacs" chapter for further information.

Usage and interface

  • Library usage:
    It is not necesary to use this library at user programs. It is designed to be used at the Ciao toplevel shell: ciaosh. In order to do so, just make use of use_module/1 as follows:

    use_module(library(librowser)).

    Then, the library interface must be read. This is automatically done when calling any predicate at librowser, and the entire process will take a little moment.So, you should want to perform such a process after loading the Ciao toplevel:

    Ciao 0.9 #75: Fri Apr 30 19:04:24 MEST 1999
    ?- use_module(library(librowser)).
    
    yes
    ?- update.
    
    

    Whether you want this process to be automatically performed when loading ciaosh, you may include those lines in your .ciaorc personal initialization file.

  • Exports:
  • Other modules used:

Documentation on exports

PREDICATE
This predicate will scan the Ciao system libraries for predicate definitions. This may be done once time before calling any other predicate at this library.

update/0 will also be automatically called (once) when calling any other predicate at librowser.

Usage:

PREDICATE
This predicate is fully reversible, and is provided to inspect concrete predicate specifications. For example:
?- browse(M,findall/A).

A = 3,
M = conc_aggregates ? ;

A = 4,
M = aggregates ? ;

A = 3,
M = aggregates ? ;

no
?-

Usage: browse(Module,Spec)

  • Description: Asocciates the given Spec predicate specification with the Module which exports it.
  • The following properties should hold at call time:
    (librowser:module_name/1)Module is a module name (an atom)
    (librowser:pred_spec/1)Spec is a Functor/Arity predicate specification

PREDICATE
This predicate will print at the screen the module needed in order to import a given predicate specification. For example:
?- where(findall/A).
findall/3 exported at module conc_aggregates
findall/4 exported at module aggregates
findall/3 exported at module aggregates

yes
?-

Usage: where(Spec)

  • Description: Display what module to load in order to import the given Spec.
  • The following properties should hold at call time:
    (librowser:pred_spec/1)Spec is a Functor/Arity predicate specification

PREDICATE
This one is used to find out which predicates were exported by a given module. Very usefull when you know the library, but not the concrete predicate. For example:
?- describe(librowser).
Predicates at library librowser :

apropos/1
system_lib/1
describe/1
where/1
browse/2
update/0

yes
?-

Usage: describe(Module)

  • Description: Display a list of exported predicates at the given Module
  • The following properties should hold at call time:
    (librowser:module_name/1)Module is a module name (an atom)

PREDICATE
It retrieves on backtracking all Ciao system libraries stored in the internal database. Certainly, those which were scanned at update/0 calling.

Usage: system_lib(Module)

  • Description: Module variable will be successively instantiated to the system libaries stored in the internal database.
  • The following properties should hold at call time:
    (librowser:module_name/1)Module is a module name (an atom)

PREDICATE
This tool makes use of regular expresions in order to find predicate specifications. It is very usefull whether you can't remember the full name of a predicate. Regular expresions take the same format as described in library patterns. Example:
?- apropos('atom_*').

terms: atom_concat/2
concurrency: atom_lock_state/2
atomic_basic: atom_concat/3,atom_length/2,atom_codes/2
iso_byte_char: atom_chars/2

yes
?-

Usage: apropos(RegSpec)

  • Description: This will search any predicate specification Spec which matches the given RegSpec incomplete predicate specification.
  • The following properties should hold at call time:
    (librowser:apropos_spec/1)RegSpec is a Pattern/Arity specification.

Documentation on internals

REGTYPE
Defined as:
apropos_spec(_1).
apropos_spec(_1/Arity) :-
        int(Arity).

Usage: apropos_spec(S)

  • Description: S is a Pattern/Arity specification.