append.cpp 297 B

1234567891011121314151617181920212223242526272829303132
  1. // Append one list to another.
  2. #include "stdafx.h"
  3. #include "defs.h"
  4. void
  5. append(void)
  6. {
  7. int h;
  8. save();
  9. p2 = pop();
  10. p1 = pop();
  11. h = tos;
  12. while (iscons(p1)) {
  13. push(car(p1));
  14. p1 = cdr(p1);
  15. }
  16. while (iscons(p2)) {
  17. push(car(p2));
  18. p2 = cdr(p2);
  19. }
  20. list(tos - h);
  21. restore();
  22. }