[英]how to pass a gensym to a function name in common lisp
I'm using Lucerne to build an api, and experimenting with generating those apis based off of a list (they're very simple endpoints).我正在使用 Lucerne 构建一个 api,并尝试根据列表(它们是非常简单的端点)生成这些 api。 The problem is that the views lucerne uses are just functions, so if I pass
(gensym)
to the macro at runtime the name of that view function is just set to (gensym)
(or it fails, can't remember which).问题是
(gensym)
使用的视图只是函数,所以如果我在运行时将(gensym)
传递给宏,则该视图函数的名称只是设置为(gensym)
(或者它失败了,不记得是哪个)。
I'd like to dynamically name a set of those view functions in a macro that will be in a loop of some kind, each time the code that macro has expanded too is run the functions have a new name (so if I just use a standard gensym
each time the macro was run each of the functions would always have the same name, and overwrite each other).我想在一个宏中动态命名一组这些视图函数,该宏将处于某种循环中,每次运行宏扩展的代码时,函数都有一个新名称(所以如果我只使用每次运行宏时的标准
gensym
每个函数将始终具有相同的名称,并相互覆盖)。 Is there some way to do this?有没有办法做到这一点?
您可能希望使用intern
创建“公共”符号(用户将按名称调用)和“私有”符号(存储在某处)的make-symbol
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.