简体   繁体   中英

What is the function “defs” in Lisp?

In the "Dictio" file, located at the link "Text-only console version" of this site , I've noticed a Lisp command (?) called defs .

I assume that this is something similar to defun , but am unable to find any information on what defs does; is it used to define a function, or maybe a variable? I am looking to reproduce this code using modern techniques and it would help to know the purpose of defs .

The defs calls seem to also include more than a name before the arguments (I would expect it to read ( defs name () body ).

Looking at the first function in the list, there appears to be more included in this "function definition" [the word 'features' specifically] and in the third function, there is ['semantics'] included after what appears to be the name of the function (before the arguments).

DEFS is defined by the software in the file SYSCOM .

It is a FEXPR , which is a function which gets the arguments unevaluated. Common Lisp has no such feature. It uses macros instead.

Example use:

(DEFS \#COLOR 
    FEXPR (LAMBDA (A)
            (EVAL (SUBST (CAR A)
                         'COLOR
                         '(OBJECT 
                           (MARKERS\: (\#PHYSOB COLOR) 
                                      PROCEDURE\: ((\#COLOR *** COLOR))))))) 
    PRIORITY 192. 
    SYS (\#PROPERTY))

Here you have a symbol #COLOR . It gets a function (actually a FEXPR ) defined under this name. Also it puts a PRIORITY and SYS onto the property list of the symbol. Thus DEFS is used to define symbols with functions and properties in one defining form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM