known-to-comp-sl.red 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. %
  2. % KNOWN-TO-COMPILER.RED - Standard Lisp functions which are handled entirely
  3. % by the compiler
  4. %
  5. % Author: Eric Benson
  6. % Symbolic Computation Group
  7. % Computer Science Dept.
  8. % University of Utah
  9. % Date: 17 August 1981
  10. % Copyright (c) 1981 University of Utah
  11. %
  12. % <PSL.INTERP>KNOWN-TO-COMP-SL.RED.4, 4-Jul-82 13:30:59, Edit by BENSON
  13. % CAR and CDR of NIL are legal == NIL
  14. off R2I; % can't do recursion removal, will get infinte recursion
  15. % Section 3.1 -- Elementary predicates
  16. lisp procedure CodeP U; %. Is U a code pointer?
  17. CodeP U;
  18. lisp procedure Eq(U, V); %. Are U and V identical?
  19. U eq V;
  20. lisp procedure FloatP U; %. Is U a floating point number?
  21. FloatP U;
  22. lisp procedure BigP U; %. Is U a bignum?
  23. BigP U;
  24. lisp procedure IDP U; %. Is U an ID?
  25. IDP U;
  26. lisp procedure PairP U; %. Is U a pair?
  27. PairP U;
  28. lisp procedure StringP U; %. Is U a string?
  29. StringP U;
  30. lisp procedure VectorP U; %. Is U a vector?
  31. VectorP U;
  32. % Section 3.2 -- Functions on Dotted-Pairs
  33. % NonPairError found in TYPE-ERRORS.RED
  34. lisp procedure Car U; %. left subtree of pair
  35. if null U then NIL
  36. else if PairP U then car U else NonPairError(U, 'CAR);
  37. lisp procedure Cdr U; %. right subtree of pair
  38. if null U then NIL
  39. else if PairP U then cdr U else NonPairError(U, 'CDR);
  40. lisp procedure RplacA(U, V); %. RePLAce CAr of pair
  41. if PairP U then RplacA(U, V) else NonPairError(U, 'RPLACA);
  42. lisp procedure RplacD(U, V); %. RePLACe CDr of pair
  43. if PairP U then RplacD(U, V) else NonPairError(U, 'RPLACD);
  44. on R2I; % Turn recursion removal back on
  45. END;