Machine-translated by Google. Questions are authored in English.
Top

Discussion

In LISP the function that provides the initial element of a list is :

  • A.Car
  • B.Set
  • C.Second
  • D.First

Answer: A

The function is car.

In LISP, (car '(a b c)) returns a, the first element of the list, and cdr returns the rest of the list, (b c). The names come from the IBM 704 register fields used in the original implementation.

set assigns a value to a symbol. second returns the second element. Common Lisp also defines first as a synonym, but the primitive LISP function the question has in mind is car.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.