summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-28 06:22:24 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-28 06:22:24 -0700
commitac18f54aca98531e8200d8bcc012555c1f195ec1 (patch)
treec43f2f7517c5c3772afa753c68ef52d566e4e7b3 /win
parent4462afdd0a80cbf8c73faa58fb0540b70bd0d890 (diff)
downloadtxr-ac18f54aca98531e8200d8bcc012555c1f195ec1.tar.gz
txr-ac18f54aca98531e8200d8bcc012555c1f195ec1.tar.bz2
txr-ac18f54aca98531e8200d8bcc012555c1f195ec1.zip
constantp: fully expand; recognize functions.
This patch improves the constantp function dramatically. It now performs a full expansion of its argument, and recognizes all of the constant foldable functions that the compiler recognizes. * eval.c (const_foldable_s): New symbol variable. (const_foldable_hash): New static variable. (constantp_noex): Look up function in the hash table of const foldable functions, including in the case when it appears in a dwim form as in [+ 2 2] which is (dwim + 2 2). In this case, recursively check the arguments for constantp_noex. We get the hash table of foldable functions from the sys:%const-foldable% variable, which comes from an autoloaded module. (constantp): Fully expand the input form, not just m macroexpand. (eval_init): Register the const_foldable_s variable. * lisplib.c (constfun_instantiate, constfun_set_entries): New static functions. (lisplib_init): Register auto-loading of constfun module via new static functions. * stdlib/compiler.tl; Load the constfun module if %const-foldable% is not defined. (%const-foldable-funs%, %const-foldable%): Removed from here. * stdlib/constfun.tl: New file. (%const-foldable-funs%, %const-foldable%): Moved here. * txr.1: Documented changes to constantp.
Diffstat (limited to 'win')
0 files changed, 0 insertions, 0 deletions