在 LISP 中实现基本库函数(手动) [英] Implementing basic library functions in LISP (manually)
本文介绍了在 LISP 中实现基本库函数(手动)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以定义函数 my_list
、my_cons
、my_append
,它们执行与 list类似的功能code>、
cons
和 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屋!
查看全文