本文介绍了例如,任何口罩的头部都带有s表达式吗? ((f 2)3 4)?如果没有,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何lisps都支持头上的嵌套s表达式吗?例如

Do any lisps support nested s-expression on their head? For example

((f 2) 3 4)

(对于

(f 2)可能评估为要应用于3 4的功能/宏).

for which (f 2) presumably evaluates to a function/macro to apply on 3 4.

有没有可能支持这种事情的口齿不清?还是有技术限制禁止这样做/使其不切实际?

Is it possible to have a lisp supporting such a thing? Or are there technical limitations that prohibit this/make it impractical?

推荐答案

在那些具有单个变量和函数名称空间的Lisps中,您的表达式有效.这些被称为Lisp-1. Scheme和Clojure就是这种Lips的例子.

In those Lisps, which have single namespace for variables and functions, your expression is valid. These are called Lisp-1. Scheme and Clojure are examples of such Lisps.

在那些Lisps中,它们具有用于变量和函数的单独命名空间,您的表达式将为(funcall (f 2) 3 4).这些被称为Lisp-2. Common Lisp和Emacs Lisp就是这种Lisps的示例.

In those Lisps, which have separate namespaces for variables and functions, your expression would be (funcall (f 2) 3 4). These are called Lisp-2. Common Lisp and Emacs Lisp are examples of such Lisps.

在Lisp-2中,每个符号都有一个值槽和一个功能槽.要调用存储在值槽中的函数,您需要使用 funcall关键字.

In Lisp-2 every symbol has a value slot and a function slot. To call a function, that is stored in a value slot you need to use funcall keyword.

有关此问题的更多信息: http://www.dreamsongs.com/Separation.html

See more on this issue: http://www.dreamsongs.com/Separation.html

编辑:感谢 Rainer Joswig 我纠正了答案.

Thanks to Rainer Joswig i corrected the answer.

这篇关于例如,任何口罩的头部都带有s表达式吗? ((f 2)3 4)?如果没有,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 13:36