In article <44t5ba$5mj@pravda.cc.gatech.edu>, Kurt Eiselt wrote: >CS 2360 >Fall 1995 >Homework Assignment 2 > >The functions that you are to define are listed below, along with examples of >how we expect them to work. For all the functions, you can obtain the name of >their pre-existing counterparts by just removing the prefix "my-". NOTE: A portion of the assignment asks for you to write BOTH a "regular" recursive AND a "tail" recursive version of some of the functions. You must ADD to your tail recursive version a suffix of "-tr". Examples: my-member-tr , my-reverse-tr , my-remove-tr, etc. if you have two definitions of the same name in a file the second definition will be the only visible one after loading the file. We'll want to test both of them. NOTE: If you peruse Steele looking at the specifications to many of these functions you will find that they can take "optional" and "optional keyword" arguments. You do NOT have to implement that functionality.... not that we've told you how to anyway. :-) > >To construct these functions, you may use DEFUN, COND, IF, NULL, FIRST, REST, >CONS, the equality predicates (EQ, EQL, EQUAL, and EQUALP), QUOTE (or '), the >arithmetic functions (+, -, *, and /), and the Boolean functions (AND, OR, and >NOT; we haven't mentioned these in class yet, but if you look them up you'll >see what they're all about pretty quickly). And I guess we should allow >the inequality predicates, like > and <. If there's something I forgot, In the addition to the above you might find some use for the predicates ATOM CONSP LISTP Again you may not need these, but if you find the need..... > >1) my-member > >(my-member 'c '(a b c d e)) => (c d e) ; you get this one for free > ; right out of the lecture Remember that the common lisp function (member '(a b ) '( d ( a b ) c e ) => NIL whereas the one FROM CLASS would: (my-member '(a b ) '( d ( a b ) c e ) => T You are to match Common Lisp's behavior. ( HINT: eql vs. equal ) NOTE: intersection and union treat lists as though they were Sets. They are essentially Set ADT operators where the "implementation" of sets is a list. Which is why order is unimportant. >7) my-intersection > >(my-intersection '(a b c) '(b c d)) => (b c) ; order is unimportant > >8) my-union > >(my-union '(a b c) '(b c d)) => (a b c d) ; order is unimportant > -- Lyman S. Taylor "Computers are too reliable to replace (lyman@cc.gatech.edu) humans effectively." Commander Nathan Spring, "Starcops"