开发者

Is there a way to use a keyword as a function in Common Lisp, as one does in Clojure?

In Clojure one can write

(:foo {:foo 3 :bar 5})

which evaluates to 3. Is there any way to extend Common Lisp so that a ke开发者_开发知识库yword will act as a function that looks itself up?


There are no easy, obvious or trivial ways to do that in a general way in portable Common Lisp, AFAIK.

Related functionality (for arrays) was provided in some earlier Lisp dialects, but it was not included in Common Lisp.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜