concept-systems.tex 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. % -*- Mode: TeX -*-
  2. \beginsubsection{Loading}
  3. %% 23.4.0 1
  4. To \funref{load} a \term{file} is to treat its contents as \term{code}
  5. and \term{execute} that \term{code}.
  6. The \term{file} may contain \newterm{source code} or \newterm{compiled code}.
  7. A \term{file} containing \term{source code} is called a \newterm{source file}.
  8. \term{Loading} a \term{source file} is accomplished essentially
  9. by sequentially \term{reading}\meaning{2} the \term{forms} in the file,
  10. \term{evaluating} each immediately after it is \term{read}.
  11. %% 23.4.0 2
  12. A \term{file} containing \term{compiled code} is called a \newterm{compiled file}.
  13. \term{Loading} a \term{compiled file} is similar to \term{loading} a \term{source file},
  14. except that the \term{file} does not contain text but rather an
  15. \term{implementation-dependent} representation of pre-digested \term{expressions}
  16. created by the \term{compiler}. Often, a \term{compiled file} can be \term{loaded}
  17. more quickly than a \term{source file}.
  18. \Seesection\Compilation.
  19. The way in which a \term{source file} is distinguished from a \term{compiled file}
  20. is \term{implementation-dependent}.
  21. \endsubsection%{Loading}
  22. \beginsubsection{Features}
  23. \DefineSection{Features}
  24. A \newterm{feature} is an aspect or attribute
  25. of \clisp,
  26. of the \term{implementation},
  27. or of the \term{environment}.
  28. A \term{feature} is identified by a \term{symbol}.
  29. A \term{feature} is said to be \newterm{present} in a \term{Lisp image}
  30. if and only if the \term{symbol} naming it is an \term{element} of the
  31. \term{list} held by \thevariable{*features*},
  32. which is called the \newterm{features list}.
  33. \beginsubsubsection{Feature Expressions}
  34. \DefineSection{FeatureExpressions}
  35. Boolean combinations of \term{features}, called \newtermidx{feature expressions}{feature expression},
  36. are used by the \f{\#+} and \f{\#-} \term{reader macros} in order to
  37. direct conditional \term{reading} of \term{expressions} by the \term{Lisp reader}.
  38. The rules for interpreting a \term{feature expression} are as follows:
  39. \beginlist
  40. \itemitem{\term{feature}}
  41. If a \term{symbol} naming a \term{feature} is used as a \term{feature expression},
  42. the \term{feature expression} succeeds if that \term{feature} is \term{present};
  43. otherwise it fails.
  44. \itemitem{\f{(not \param{feature-conditional})}}
  45. A \misc{not} \term{feature expression} succeeds
  46. if its argument \param{feature-conditional} fails;
  47. otherwise, it succeeds.
  48. \itemitem{\f{(and \starparam{feature-conditional})}}
  49. An \misc{and} \term{feature expression} succeeds
  50. if all of its argument \param{feature-conditionals} succeed;
  51. otherwise, it fails.
  52. \itemitem{\f{(or \starparam{feature-conditional})}}
  53. An \misc{or} \term{feature expression} succeeds
  54. if any of its argument \param{feature-conditionals} succeed;
  55. otherwise, it fails.
  56. \endlist
  57. \beginsubsubsubsection{Examples of Feature Expressions}
  58. \DefineSection{FeatureExpExamples}
  59. %% 22.1.4 40
  60. For example, suppose that
  61. in \term{implementation} A, the \term{features} \f{spice} and \f{perq} are \term{present},
  62. but the \term{feature} \f{lispm} is not \term{present};
  63. in \term{implementation} B, the feature \f{lispm} is \term{present},
  64. but the \term{features} \f{spice} and \f{perq} are
  65. not \term{present};
  66. and
  67. in \term{implementation} C, none of the features \f{spice}, \term{lispm}, or \f{perq} are
  68. \term{present}.
  69. \Thenextfigure\ shows some sample \term{expressions}, and how they would be
  70. \term{read}\meaning{2} in these \term{implementations}.
  71. \showtwo{Features examples}{
  72. \f{(cons \#+spice "Spice" \#-spice "Lispm" x)} \span \cr
  73. \noalign{\vskip 2pt}
  74. \quad in \term{implementation} A $\ldots$ & \f{(CONS "Spice" X)} \cr
  75. \quad in \term{implementation} B $\ldots$ & \f{(CONS "Lispm" X)} \cr
  76. \quad in \term{implementation} C $\ldots$ & \f{(CONS "Lispm" X)} \cr
  77. \noalign{\vskip 5pt}
  78. \f{(cons \#+spice "Spice" \#+LispM "Lispm" x)} \span \cr
  79. \noalign{\vskip 2pt}
  80. \quad in \term{implementation} A $\ldots$ & \f{(CONS "Spice" X)} \cr
  81. \quad in \term{implementation} B $\ldots$ & \f{(CONS "Lispm" X)} \cr
  82. \quad in \term{implementation} C $\ldots$ & \f{(CONS X)} \cr
  83. \noalign{\vskip 5pt}
  84. \f{(setq a '(1 2 \#+perq 43 \#+(not perq) 27))} \span \cr
  85. \noalign{\vskip 2pt}
  86. \quad in \term{implementation} A $\ldots$ & \f{(SETQ A '(1 2 43))} \cr
  87. \quad in \term{implementation} B $\ldots$ & \f{(SETQ A '(1 2 27))} \cr
  88. \quad in \term{implementation} C $\ldots$ & \f{(SETQ A '(1 2 27))} \cr
  89. \noalign{\vskip 5pt}
  90. \f{(let ((a 3) \#+(or spice lispm) (b 3)) (foo a))} \span \cr
  91. \noalign{\vskip 2pt}
  92. \quad in \term{implementation} A $\ldots$ & \f{(LET ((A 3) (B 3)) (FOO A))} \cr
  93. \quad in \term{implementation} B $\ldots$ & \f{(LET ((A 3) (B 3)) (FOO A))} \cr
  94. \quad in \term{implementation} C $\ldots$ & \f{(LET ((A 3)) (FOO A))} \cr
  95. \noalign{\vskip 5pt}
  96. \f{(cons \#+Lispm "\#+Spice" \#+Spice "foo" \#-(or Lispm Spice) 7 x)} \span \cr
  97. \noalign{\vskip 2pt}
  98. \quad in \term{implementation} A $\ldots$ & \f{(CONS "foo" X)} \cr
  99. \quad in \term{implementation} B $\ldots$ & \f{(CONS "\#+Spice" X)} \cr
  100. \quad in \term{implementation} C $\ldots$ & \f{(CONS 7 X)} \cr
  101. }
  102. \endsubsubsubsection%{Examples of Feature Expressions}
  103. \endsubsubsection%{Feature Expressions}
  104. \endsubsection%{Features}