Expected results for test: P3-59.pl460 P3-59.pl460 : (define (insert_last ls v) (if (list? ls) (if (null? ls) (cons v '()) (cons (car ls) (insert_last (cdr ls) v)) ) "first argument of insert_last must be a list" ) ) (define (all_reverse ls) (if (list? ls) (if (null? ls) '() (if (list? (car ls)) (insert_last (all_reverse (cdr ls)) (all_reverse (car ls))) (insert_last (all_reverse (cdr ls)) (car ls)) ) ) "all_reverse requires a list argument" ) ) (define (main) (display (all_reverse '(1 5 3 6 8 92 -1 0 4 5 3))) (newline) (display (all_reverse '(1 (2 3 f 4) 5 (a (6 (7 8) d 9))))) (newline) ) (main) Input file: P3-59.pl460 0 errors found in input file P3-59.cpp : // Autogenerated PL460 to C++ Code // File: P3-59.cpp #include #include "Object.h" using namespace std; Object insert_last (Object ls, Object v) { Object __RetVal; if (listp (ls)) { if (nullp (ls)) { __RetVal = listop ("cons", v, Object("()")); } else { __RetVal = listop ("cons", listop ("car", ls), insert_last(listop ("cdr", ls), v)); } } else { __RetVal = Object("first argument of insert_last must be a list"); } return __RetVal; } Object all_reverse (Object ls) { Object __RetVal; if (listp (ls)) { if (nullp (ls)) { __RetVal = Object("()"); } else { if (listp (listop ("car", ls))) { __RetVal = insert_last(all_reverse(listop ("cdr", ls)), all_reverse(listop ("car", ls))); } else { __RetVal = insert_last(all_reverse(listop ("cdr", ls)), listop ("car", ls)); } } } else { __RetVal = Object("all_reverse requires a list argument"); } return __RetVal; } int main () { Object __RetVal; cout << all_reverse(Object("(1 5 3 6 8 92 -1 0 4 5 3 )")); cout << endl; cout << all_reverse(Object("(1 (2 3 f 4 ) 5 (a (6 (7 8 ) d 9 ) ) )")); cout << endl; return 0; } PL460 program output: (3 5 4 0 -1 92 8 6 3 5 1) (((9 d (8 7) 6) a) 5 (4 f 3 2) 1) C++ program output: (3 5 4 0 -1 92 8 6 3 5 1) (((9 d (8 7) 6) a) 5 (4 f 3 2) 1) Differences: < pl460 | cpp > (3 5 4 0 -1 92 8 6 3 5 1) (3 5 4 0 -1 92 8 6 3 5 1) (((9 d (8 7) 6) a) 5 (4 f 3 2) 1) (((9 d (8 7) 6) a) 5 (4 f 3 2) 1)