mini-easy-non-sl.red 777 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. % MINI-NON-SL.RED Simple non sl functions
  2. Procedure Atsoc(x,y);
  3. If Not PAIRP y then NIL
  4. else if Not PAIRP car y then Atsoc(x,cdr y)
  5. else if x EQ car car y then car y
  6. else Atsoc(x, cdr y);
  7. Procedure GEQ(N1,N2);
  8. not(N1< N2);
  9. Procedure LEQ(N1,N2);
  10. not(N1 > N2);
  11. Procedure EqCar(x,y);
  12. PairP x and (Car(x) eq y);
  13. procedure COPYD(newId,OldId);
  14. Begin scalar x;
  15. x:=Getd OldId;
  16. If not Pairp x
  17. then return <<Print List(OLDID, " has no definition in COPYD ");
  18. NIL>>;
  19. Return PUTD(newId,car x,cdr x);
  20. End;
  21. Procedure Delatq(x,y);
  22. If not Pairp y then NIL
  23. else if not Pairp car y then CONS(car y,Delatq(x,cdr y))
  24. else if x eq caar y then cdr y
  25. else CONS(car y,Delatq(x,cdr y));
  26. procedure MkQuote x;
  27. List('quote,x);
  28. End;