setf中的f代表什么? [英] What does the f in setf stand for?
问题描述
LISP具有setf
函数,用于将值分配给变量.现在我一直在想函数的名称:set
部分很明显,但是f
后缀代表什么?
LISP has the setf
function to assign a value to a variable. Now I have been wondering about the function's name: The set
part is obvious, but what does the f
suffix stand for?
推荐答案
F的实际含义经常被遗忘.根据某些消息来源,后缀f可以代表:
The actual meaning of F is often forgotten. According to some sources, f suffix could stand for:
- 字段(例如,参见此 answer )
- 表格(如各种教学材料和手册中所述)
但是,根据加百列和斯蒂尔的 Lisp的演变,SETF来了来自Peter Deutsch的一台Lisp机器,带有非常紧凑的程序(于1973年发布),F表示功能.
However, according to Gabriel and Steele's The Evolution of Lisp, SETF comes from Peter Deutsch's A Lisp Machine with Very Compact Programs (published in 1973) and F stands for function.
本文中,彼得·德意志(Peter Deutsch)写道:
In this paper, Peter Deutsch wrote:
扩展了SET函数,以便如果第一个参数是列表
(fn argl ... argn)
而不是变量,则函数"fn"在存储"模式下使用参数argl ... argn
和newvalue(SET的第二个参数)进行调用). SETQ也以明显的方式扩展,但不是特别有用.(SETFQ (fn argl ... argn) newvalue)
是更有用的功能,它引用 功能名称并评估其他所有内容.例如,这允许将RPLACA定义为(LAMBDA (X Y) (SETFQ (CAR X) Y))
.
The SET function is extended so that so that if the first argument is a list
(fn argl ... argn)
rather than a variable, the function fn is called in "store" mode with argumentsargl ... argn
and newvalue (the second argument of SET). SETQ is also extended in the obvious way, but is not particularly useful. A more useful function is(SETFQ (fn argl ... argn) newvalue)
which quotes the function name and evaluates everything else. This allows RPLACA, for example, to be defined as(LAMBDA (X Y) (SETFQ (CAR X) Y))
.
(重点是我的)
Gabriel和Steele解释了这是如何成为SETF的:
Gabriel and Steele explain how this became SETF:
此名称在Lisp-Machine Lisp中缩写为SETF.
This name was abbreviated to SETF in Lisp-Machine Lisp.
这篇关于setf中的f代表什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!