是否有任何 lisps 的头部都有 s 表达式,例如((f 2) 3 4)?如果不是,为什么? [英] Do any lisps have a s-expression as their head, e.g. ((f 2) 3 4)? If not, why?

查看:12
本文介绍了是否有任何 lisps 的头部都有 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.

是否有可能有一个 lisp 支持这样的事情?或者是否有技术限制禁止这样做/使其不切实际?

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 就是此类 Lisp 的示例.

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 就是此类 Lisp 的示例.

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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆