Implementation of the main library functions in LISP (manually)

Is there any way by which I can determine the function my_list, my_cons, my_appendwhich perform the same function as the list, consand append, respectively?

Otherwise, where can I find an implementation of these functions?

thank

+2
source share
2 answers

For my_list and my_append solutions:

(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)

I am probably mistaken, but I do not know an alternative method of creating pairs, so an alternative to the minuses is not possible. However, I am completely new to the LISP world.

+2
source

, , , , - , , , , -, - (, CADR). .

, ( ), . http://en.wikipedia.org/wiki/Cons#Not_technically_fundamental

0

Source: https://habr.com/ru/post/1775656/


All Articles