hissp package#

Module contents#

It’s Python with a Lissp.

See the GitHub project for complete documentation and tests.

https://github.com/gilch/hissp

__init__.py defines a few functions meant for use as fully qualified tags and imports several utilities for convenience, including,

as well as the hissp.macros._macro_ namespace, making all the bundled macros available with the shorter hissp. qualifier.

hissp.refresh(module_name)[source]#

REPL convenience tag to recompile and reload a module.

Usage: hissp..refresh#'foo where foo is the __name__.

An empty argument (|| or :) means the current module.

There must be a corresponding .lissp file present to recompile.

Refreshing the main module (which would have side effects) is not supported. Send the REPL updated top-level definitions individually, or restart the REPL instead. (A corresponding compiled Python file is not required for a .lissp file run as the main module.)

While potentially confusing, Python can import the .py file used as main again using its name. These are considered separate modules by the runtime.

See also: subrepl(), hissp.reader.transpile, importlib.reload.

hissp.subrepl(module)[source]#

Convenience tag to start a Lissp subREPL in the given module.

Usage: hissp..subrepl#foo. where foo. evaluates to a module.

Won’t re-enter current module. Prints __name__ on subREPL exit. (Exit a subREPL using EOF.)

See also: refresh, hissp.repl.interact, REPL.

hissp.apropos(term: str, startswith: str = '') Iterator[str][source]#

Scans dir of all imported modules and their classes for term.

>>> 'hissp..apropos' in apropos('apropos')
True

The resulting symbols are qualified in Hissp’s import format, with modules names ending in a period.

Get help for a symbol:

>>> help(next(apropos('apropos')))
Help on function apropos in hissp.:

hissp..apropos = apropos(term: str, startswith: str = '') -> Iterator[str]
    Scans `dir` of all imported modules and their classes for ``term``.
    ...

Print symbols:

>>> for s in apropos(munge('*'), 'hissp.'): print(demunge(s))
hissp.macros.._macro_.any*map
hissp.macros.._macro_.let*call
hissp.macros.._macro_.throw*
hissp.._macro_.any*map
hissp.._macro_.let*call
hissp.._macro_.throw*

List symbols:

>>> [*apropos('Star_', 'hissp.._')]
['hissp.._macro_.anyStar_map', 'hissp.._macro_.letStar_call', 'hissp.._macro_.throwStar_']

Modules themselves are included:

>>> 'hissp.' in apropos('')
True

Submodules#