在LISP实现基本库函数(手动) [英] Implementing basic library functions in LISP (manually)

查看:114
本文介绍了在LISP实现基本库函数(手动)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法由我可以定义函数 my_list my_cons my_append 执行类似的功能列表劣势追加分别?

Is there any way by which I can define functions my_list, my_cons, my_append which perform similar function as list, cons and append respectively?

否则,我在哪里可以找到这些功能的实现?

Otherwise where can I find the implementation of these functions?

感谢

推荐答案

有关my_list和my_append,该解决方案是:

For my_list and my_append, the solutions are:

(defun my_list (&rest arguments)
    `(,@arguments)
)

(defun my_append (a_list an_item)
    `(,@a_list ,an_item)
)

(my_append (my_list 'a 'b 'c) 'd)

我可能错了,但我不知道任何其他方法,以对,所以利弊替代不似是可能。不过,我很新的LISP世界。

I'm probably wrong but I dont know any alternative method to make pairs, so an alternative to cons do not seems possible. Still, I'm quite new to the LISP world.

这篇关于在LISP实现基本库函数(手动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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