Write a Common LISP function called intempty that takes two arguments and evaluates to true (ie T) if both arguments are lists and the intersection of the two lists is empty. Otherwise intempty should evaluate to false (ie nil). Note that you must return T for the true value (rather than some other non-nil value).
Note that for either argument, any element of that list can itself be a list. Make sure that your program works correctly in these case. Here are some examples of the program in action:
(intempty '(1 2 3 4) '(5 6 7)) → T ; Empty (intempty '(1 2 3 4) '(5 6 2 7)) → NIL ; 2 common (intempty '(1 2 3) ()) → T ; Empty (intempty '(1 2 3) 'a) → NIL ; Second argument not a list (intempty '(1 (2 3) 4) '(5 (2 3 4))) → T ; Empty (intempty '(1 (2 3) 4) '(5 (2 3) 4 )) → NIL ; (2 3) common
You may NOT use setq or other programs with side effects in your program. You may use functions like member, listp, and append, but not any function that effectively does the program for you. In general, if you need a function, you should write it yourself.
Your program should follow good style. In this case this means to use white space to make your program easier to understand (ie easy to match parentheses) and to choose meaningful variable names.
You should also include comments to make the code easier to understand as well as a header comment describing you, the project, etc. In Common Lisp, characters following a semicolon (ie ;) are ignored.
Use /usr/bin/gcl on rucs2 to run Common Lisp. You can use (bye) or control D (perhaps twice) to exit gcl.
You might want to try out the command % in vi to help in writing your lisp code.
Put your program in a file called intempty.lsp
and
turn it in using this command
submit itec380-01 intempty.lspRemember that you must be on rucs2 or one of its clients for submit to work correctly.