Skip to content

Commit

Permalink
Add hissp..prelude# and hissp..alias#
Browse files Browse the repository at this point in the history
Shorthand tags for the first form of a module to initialize the other local or aliased macros.
  • Loading branch information
gilch committed Jul 19, 2024
1 parent 55b0038 commit 9fb0aaa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/hissp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,23 @@
print("Unable to import hissp macros.", file=__import__("sys").stderr)

VERSION = "0.5.dev"


def prelude(ns):
"""Lissp prelude shorthand tag.
``hissp..prelude#:`` is short for
``hissp..prelude#(builtins..globals)``.
Expands to ``(hissp.macros.._macro_.prelude ns)``
"""
return "hissp.macros.._macro_.prelude", *([] if ns == ":" else [ns])


def alias(abbreviation, qualifier="hissp.macros.._macro_"):
"""Lissp alias shorthand tag.
Usage: ``hissp..alias## abbreviation qualifier``,
which expands to
``(hissp.macros.._macro_.alias abbreviation qualifier)``
"""
return "hissp.macros.._macro_.alias", abbreviation, qualifier

0 comments on commit 9fb0aaa

Please sign in to comment.