Skip to content

Latest commit

 

History

History
1508 lines (1085 loc) · 50.4 KB

api.rst

File metadata and controls

1508 lines (1085 loc) · 50.4 KB

API

Core Macros

The following macros are auto imported into all Hy modules as their base names, such that hy.core.macros.foo can be called as just foo.

Placeholder macros

There are a few core macros that are unusual in that all they do, when expanded, is crash, regardless of their arguments:

  • else
  • except
  • except*
  • finally
  • unpack-mapping
  • unquote
  • unquote-splice

The purpose of these macros is merely to reserve their names. Each symbol is interpreted specially by one or more other core macros (e.g., else in while) and thus, in these contexts, any definition of these names as a function or macro would be ignored. If you really want to, you can override these names like any others, but beware that, for example, trying to call your new else inside while may not work.

Hy

The hy module is auto imported into every Hy module and provides convient access to the following methods

Reader Macros

Like regular macros, reader macros should return a Hy form that will then be passed to the compiler for execution. Reader macros access the Hy reader using the &reader name. It gives access to all of the text- and form-parsing logic that Hy uses to parse itself. See :pyHyReader <hy.reader.hy_reader.HyReader> and its base class :pyReader <hy.reader.reader.Reader> for details regarding the available processing methods.

hy.reader.hy_reader.HyReader

hy.reader.reader.Reader

Python Operators

Reserved