diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-09-27 08:06:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-09-27 08:06:47 -0700 |
commit | 70dca98f3500158716f49d5281d55769a44f7f67 (patch) | |
tree | a635c43c7710ec946e480f5fc287461c25f035f4 /txr.1 | |
parent | 38868195bfc5df39c11e85df4e1550c197f32009 (diff) | |
download | txr-70dca98f3500158716f49d5281d55769a44f7f67.tar.gz txr-70dca98f3500158716f49d5281d55769a44f7f67.tar.bz2 txr-70dca98f3500158716f49d5281d55769a44f7f67.zip |
symbol-function: support lambda expressions.
* eval.c (lookup_fun): Check for a lambda expression and
return a faked binding containing the interpreted function.
(do_eval, op_fun): Remove checks for lambda that are now
being done in lookup_fun. In many other places where
lookup_fun is used, we still need lambda checks, like
in the expander.
* share/txr/stdlib/place.tl (sys:get-fun-getter-setter): Take
form argument. Diagnose assignments to lambda, and to unknown
function place syntax.
(defplace symbol-function): Pass sys:*pl-form* to
sys:get-fun-getter-setter as form argument.
* txr.1: fboundp and symbol-function doc updated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -16747,10 +16747,10 @@ returns .SS* Global Environment .coNP Accessors @, symbol-function @ symbol-macro and @ symbol-value .synb -.mets (symbol-function >> { symbol | << method-name } ) +.mets (symbol-function >> { symbol | < method-name | << lambda-expr }) .mets (symbol-macro << symbol ) .mets (symbol-value << symbol ) -.mets (set (symbol-function << symbol ) << new-value ) +.mets (set (symbol-function >> { symbol | << method-name }) << new-value ) .mets (set (symbol-macro << symbol ) << new-value ) .mets (set (symbol-value << symbol ) << new-value ) .syne @@ -16797,6 +16797,13 @@ which denote macros. Thus, .code symbol-function provides unified access to functions, methods and macros. +If a +.code lambda +expression is passed to +.codn symbol-function , +then the function implied by that expression is returned. +It is unspecified whether this function is interpreted or compiled. + The .code symbol-macro function retrieves the value of the global macro binding of @@ -16883,6 +16890,10 @@ Storing a value, using any one of these three accessors, to a nonexistent variable, function or macro binding, is not erroneous. It has has the effect of creating that binding. +Using +.code symbol-function +accessor to assign to a lambda expression is erroneous. + Deleting a binding, using any of these three accessors, when the binding does not exist, also isn't erroneous. There is no effect and the .code del @@ -16905,22 +16916,29 @@ function doesn't exist in Common Lisp. .coNP Functions @, boundp @ fboundp and @ mboundp .synb .mets (boundp << symbol ) -.mets (fboundp << symbol ) +.mets (fboundp >> { symbol | < method-name | << lambda-expr }) .mets (mboundp << symbol ) .syne .desc .code boundp returns .code t -if the symbol is bound as a variable or symbol macro in the global +if the +.meta symbol +is bound as a variable or symbol macro in the global environment, otherwise .codn nil . .code fboundp returns .code t -if the symbol has a function binding in the global -environment, otherwise it returns nil +if the +.meta symbol +has a function binding in the global +environment, the method specified by +.meta method-name +exists, or a lambda expression argument is given. +Otherwise it returns nil .codn nil . .code mboundp |