diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-01-21 10:15:07 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-01-21 10:15:07 -0800 |
commit | 47833d3b34633299a1afd778e658bc77f146a03c (patch) | |
tree | 4b6b76094ae546b24e3f0acbb495b3d7c9f46b7c /txr.1 | |
parent | aa355befc89d94f3f43d3ae4124f7d048fb4e588 (diff) | |
download | txr-47833d3b34633299a1afd778e658bc77f146a03c.tar.gz txr-47833d3b34633299a1afd778e658bc77f146a03c.tar.bz2 txr-47833d3b34633299a1afd778e658bc77f146a03c.zip |
Basic implementation of constantp. Does not
recognize forms like (+ 2 2) as constant.
* eval.c (constantp_noex, constantp): New functions.
(eval_init): Registered constantp as intrinsic.
* tl.vim, txr.vim: Updated.
* txr.1: Documented constantp.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -10750,6 +10750,43 @@ already exists in the environment, in the given space, then its value is updated with .codn value . +.coNP Function @ constantp +.synb +.mets (constantp < form >> [ env ]) +.syne +.desc +The +.code constantp +function determines whether +.mode form +is a constant form, with respect to environment +.mode env . + +If +.mode env +is absent, the global environment is used. +The +.mode env +argument is used for macro-expanding +.modn form . + +Currently, +.code constantp +returns true for any form, which, after macro-expansion is a compound +form with the symbol +.code quote +in its first position, a non-symbolic atom, or one of the symbols +which evaluate to themselves and cannot be bound as variables. +These symbols are the keyword symbols, and the symbols +.code t +and +.codn nil . + +In the future, +.code constantp +will be able to recognize more constant forms, such as calls to certain +functions whose arguments are constant forms. + .SS* Mutation .coNP Operators @ inc @ dec @ set @ push @ pop @ flip and @ del |