Question: IN LISP Define the function my-assoc that takes an atom A and a list L and returns the association pair for A. L is of

IN LISP

  1. Define the function my-assoc that takes an atom A and a list L and returns the association pair for A. L is of the form ((key1 . value1)(key2 . value2) (keyn . valuen)) Examples:
    • (my-assoc 'a nil) --> nil
    • (my-assoc 'a '((a . b)(c e f)(b))) --> (a . b)
    • (my-assoc 'c '((a . b)(c e f)(b))) --> (c e f)
    • (my-assoc 'b '((a . b)(c e f)(b))) --> (b)

I have my-length, my-memq, my-append, and my-attach and can only use

  • defun
  • cond
  • cons
  • car
  • cdr
  • operators +, -, <, and >
  • null
  • eq
  • listp
  • atom
  • symbolp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!