常见的Lisp函数/宏别名 [英] common lisp function/macro aliases

查看:105
本文介绍了常见的Lisp函数/宏别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为常用命令(例如 defun和 lambda等)的常用lisp(准确地说是clisp)设置别名,是否可以这样做?

I would like to set aliases in common lisp(clisp to be exact) for commands that are used a lot, such as "defun" and "lambda" etc, is it possible to do this?

这实际上是此的副本问题,但我无法评论,该解决方案对于sbcl和clisp中的defun或lambda都不起作用

This is actually kind of a duplicate of this question, but I can not comment and the solution does not work for defun or lambda in both sbcl and clisp

推荐答案

宏:

CL-USER 5 > (setf (macro-function 'dm) (macro-function 'defmethod))
#<Function DEFMETHOD 410009A014>

CL-USER 6 > (dm m1+ ((v vector)) (map 'vector #'1+ v))
#<STANDARD-METHOD M1+ NIL (VECTOR) 4130003913>

CL-USER 7 > (m1+ #(1 2 3 4))
#(2 3 4 5)

这篇关于常见的Lisp函数/宏别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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