My various dotfiles

chap-25.texi 57KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850
  1. @node Environment, Glossary (Glossary), System Construction, Top
  2. @chapter Environment
  3. @menu
  4. * The External Environment::
  5. * Environment Dictionary::
  6. @end menu
  7. @node The External Environment, Environment Dictionary, Environment, Environment
  8. @section The External Environment
  9. @c including concept-environment
  10. @menu
  11. * Top level loop::
  12. * Debugging Utilities::
  13. * Environment Inquiry::
  14. * Time::
  15. @end menu
  16. @node Top level loop, Debugging Utilities, The External Environment, The External Environment
  17. @subsection Top level loop
  18. The top level loop is the @r{Common Lisp} mechanism by which the user normally
  19. interacts with the @r{Common Lisp} system. This loop is sometimes referred to
  20. as the @i{Lisp read-eval-print loop}
  21. because it typically consists of an endless loop that reads an expression,
  22. evaluates it and prints the results.
  23. The top level loop is not completely specified; thus the user
  24. interface is @i{implementation-defined}.
  25. The top level loop
  26. prints all values resulting from the evaluation of a
  27. @i{form}.
  28. Figure 25--1 lists variables that are maintained by the @i{Lisp read-eval-print loop}.
  29. @group
  30. @noindent
  31. @w{ * + / - }
  32. @w{ ** ++ // }
  33. @w{ *** +++ /// }
  34. @noindent
  35. @w{ Figure 25--1: Variables maintained by the Read-Eval-Print Loop}
  36. @end group
  37. @node Debugging Utilities, Environment Inquiry, Top level loop, The External Environment
  38. @subsection Debugging Utilities
  39. Figure 25--2 shows @i{defined names} relating to
  40. debugging.
  41. @group
  42. @noindent
  43. @w{ *debugger-hook* documentation step }
  44. @w{ apropos dribble time }
  45. @w{ apropos-list ed trace }
  46. @w{ break inspect untrace }
  47. @w{ describe invoke-debugger }
  48. @noindent
  49. @w{ Figure 25--2: Defined names relating to debugging}
  50. @end group
  51. @node Environment Inquiry, Time, Debugging Utilities, The External Environment
  52. @subsection Environment Inquiry
  53. Environment inquiry @i{defined names} provide information about
  54. the hardware and software configuration on which a @r{Common Lisp} program is
  55. being executed.
  56. Figure 25--3 shows @i{defined names} relating to environment inquiry.
  57. @group
  58. @noindent
  59. @w{ *features* machine-instance short-site-name }
  60. @w{ lisp-implementation-type machine-type software-type }
  61. @w{ lisp-implementation-version machine-version software-version }
  62. @w{ long-site-name room }
  63. @noindent
  64. @w{ Figure 25--3: Defined names relating to environment inquiry. }
  65. @end group
  66. @node Time, , Environment Inquiry, The External Environment
  67. @subsection Time
  68. Time is represented in four different ways in @r{Common Lisp}:
  69. @i{decoded time},
  70. @i{universal time},
  71. @i{internal time},
  72. and seconds.
  73. @i{Decoded time} and @i{universal time} are used primarily to represent calendar time,
  74. and are precise only to one second.
  75. @i{Internal time} is used primarily to represent measurements of computer
  76. time (such as run time) and is precise to some @i{implementation-dependent}
  77. fraction of a second called an @i{internal time unit},
  78. as specified by @b{internal-time-units-per-second}.
  79. An @i{internal time} can be used
  80. for either @i{absolute} and @i{relative} @i{time} measurements.
  81. Both a @i{universal time} and a @i{decoded time} can be used
  82. only for @i{absolute} @i{time} measurements.
  83. In the case of one function, @b{sleep},
  84. time intervals are represented as a non-negative @i{real} number of seconds.
  85. Figure 25--4 shows @i{defined names} relating to @i{time}.
  86. @group
  87. @noindent
  88. @w{ decode-universal-time get-internal-run-time }
  89. @w{ encode-universal-time get-universal-time }
  90. @w{ get-decoded-time internal-time-units-per-second }
  91. @w{ get-internal-real-time sleep }
  92. @noindent
  93. @w{ Figure 25--4: Defined names involving Time. }
  94. @end group
  95. @menu
  96. * Decoded Time::
  97. * Universal Time::
  98. * Internal Time::
  99. * Seconds::
  100. @end menu
  101. @node Decoded Time, Universal Time, Time, Time
  102. @subsubsection Decoded Time
  103. A @i{decoded time}
  104. @IGindex{decoded time}
  105. is an ordered series of nine values that, taken together,
  106. represent a point in calendar time (ignoring @i{leap seconds}):
  107. @table @asis
  108. @item @b{Second}
  109. An @i{integer} between 0 and~59, inclusive.
  110. @item @b{Minute}
  111. An @i{integer} between 0 and~59, inclusive.
  112. @item @b{Hour}
  113. An @i{integer} between 0 and~23, inclusive.
  114. @item @b{Date}
  115. An @i{integer} between 1 and~31, inclusive (the upper limit actually
  116. depends on the month and year, of course).
  117. @item @b{Month}
  118. An @i{integer} between 1 and 12, inclusive;
  119. 1~means January, 2~means February, and so on; 12~means December.
  120. @item @b{Year}
  121. An @i{integer} indicating the year A.D. However, if this
  122. @i{integer}
  123. is between 0 and 99, the ``obvious'' year is used; more precisely,
  124. that year is assumed that is equal to the
  125. @i{integer} modulo 100 and
  126. within fifty years of the current year (inclusive backwards
  127. and exclusive forwards).
  128. Thus, in the year 1978, year 28 is 1928
  129. but year 27 is 2027. (Functions that return time in this format always return
  130. a full year number.)
  131. @item @b{Day of week}
  132. An @i{integer} between~0 and~6, inclusive;
  133. 0~means Monday, 1~means Tuesday, and so on; 6~means Sunday.
  134. @item @b{Daylight saving time flag}
  135. A @i{generalized boolean} that,
  136. if @i{true}, indicates that daylight saving time is in effect.
  137. @item @b{Time zone}
  138. A @i{time zone}.
  139. @end table
  140. Figure 25--5 shows @i{defined names} relating to @i{decoded time}.
  141. @group
  142. @noindent
  143. @w{ decode-universal-time get-decoded-time }
  144. @noindent
  145. @w{ Figure 25--5: Defined names involving time in Decoded Time.}
  146. @end group
  147. @node Universal Time, Internal Time, Decoded Time, Time
  148. @subsubsection Universal Time
  149. @i{Universal time}
  150. @IGindex{universal time}
  151. is an @i{absolute} @i{time} represented as a
  152. single non-negative @i{integer}---the number of seconds since
  153. midnight, January 1, 1900 GMT (ignoring @i{leap seconds}).
  154. Thus the time 1 is 00:00:01 (that is, 12:00:01 a.m.) on January 1, 1900 GMT.
  155. Similarly, the time 2398291201 corresponds to time 00:00:01 on January 1,
  156. 1976 GMT.
  157. Recall that the year 1900 was not a leap year; for the purposes of
  158. @r{Common Lisp}, a year is a leap year if and only if its number is divisible by 4,
  159. except that years divisible by 100 are not leap years, except that years
  160. divisible by 400 are leap years. Therefore the year 2000 will
  161. be a leap year.
  162. Because @i{universal time} must be a non-negative @i{integer},
  163. times before the base time of midnight, January 1, 1900 GMT cannot be processed by @r{Common Lisp}.
  164. @group
  165. @noindent
  166. @w{ decode-universal-time get-universal-time }
  167. @w{ encode-universal-time }
  168. @noindent
  169. @w{ Figure 25--6: Defined names involving time in Universal Time.}
  170. @end group
  171. @node Internal Time, Seconds, Universal Time, Time
  172. @subsubsection Internal Time
  173. @i{Internal time}
  174. @IGindex{internal time}
  175. represents time as a single @i{integer},
  176. in terms of an @i{implementation-dependent} unit called an @i{internal time unit}.
  177. Relative time is measured as a number of these units.
  178. Absolute time is relative to an arbitrary time base.
  179. Figure 25--7 shows @i{defined names} related to @i{internal time}.
  180. @group
  181. @noindent
  182. @w{ get-internal-real-time internal-time-units-per-second }
  183. @w{ get-internal-run-time }
  184. @noindent
  185. @w{ Figure 25--7: Defined names involving time in Internal Time.}
  186. @end group
  187. @node Seconds, , Internal Time, Time
  188. @subsubsection Seconds
  189. One function, @b{sleep}, takes its argument as a non-negative @i{real} number
  190. of seconds. Informally, it may be useful to think of this as
  191. a @i{relative} @i{universal time}, but it differs in one important way:
  192. @i{universal times} are always non-negative @i{integers}, whereas the argument to
  193. @b{sleep} can be any kind of non-negative @i{real}, in order to allow for
  194. the possibility of fractional seconds.
  195. @group
  196. @noindent
  197. @w{ sleep }
  198. @noindent
  199. @w{ Figure 25--8: Defined names involving time in Seconds.}
  200. @end group
  201. @c end of including concept-environment
  202. @node Environment Dictionary, , The External Environment, Environment
  203. @section Environment Dictionary
  204. @c including dict-environment
  205. @menu
  206. * decode-universal-time::
  207. * encode-universal-time::
  208. * get-universal-time::
  209. * sleep::
  210. * apropos::
  211. * describe::
  212. * describe-object::
  213. * trace::
  214. * step::
  215. * time::
  216. * internal-time-units-per-second::
  217. * get-internal-real-time::
  218. * get-internal-run-time::
  219. * disassemble::
  220. * documentation::
  221. * room::
  222. * ed::
  223. * inspect::
  224. * dribble::
  225. * -::
  226. * +::
  227. * *::
  228. * /::
  229. * lisp-implementation-type::
  230. * short-site-name::
  231. * machine-instance::
  232. * machine-type::
  233. * machine-version::
  234. * software-type::
  235. * user-homedir-pathname::
  236. @end menu
  237. @node decode-universal-time, encode-universal-time, Environment Dictionary, Environment Dictionary
  238. @subsection decode-universal-time [Function]
  239. @code{decode-universal-time} @i{universal-time {&optional} time-zone}@*
  240. @result{} @i{second, minute, hour, date, month, year, day, daylight-p, zone}
  241. @subsubheading Arguments and Values::
  242. @i{universal-time}---a @i{universal time}.
  243. @i{time-zone}---a @i{time zone}.
  244. @i{second}, @i{minute}, @i{hour}, @i{date}, @i{month},
  245. @i{year}, @i{day}, @i{daylight-p}, @i{zone}---a @i{decoded time}.
  246. @subsubheading Description::
  247. Returns the @i{decoded time} represented by the given @i{universal time}.
  248. If @i{time-zone} is not supplied,
  249. it defaults to the current time zone adjusted for daylight saving time.
  250. If @i{time-zone} is supplied, daylight saving time information is ignored.
  251. The daylight saving time flag is @b{nil} if @i{time-zone} is supplied.
  252. @subsubheading Examples::
  253. @example
  254. (decode-universal-time 0 0) @result{} 0, 0, 0, 1, 1, 1900, 0, @i{false}, 0
  255. ;; The next two examples assume Eastern Daylight Time.
  256. (decode-universal-time 2414296800 5) @result{} 0, 0, 1, 4, 7, 1976, 6, @i{false}, 5
  257. (decode-universal-time 2414293200) @result{} 0, 0, 1, 4, 7, 1976, 6, @i{true}, 5
  258. ;; This example assumes that the time zone is Eastern Daylight Time
  259. ;; (and that the time zone is constant throughout the example).
  260. (let* ((here (nth 8 (multiple-value-list (get-decoded-time)))) ;Time zone
  261. (recently (get-universal-time))
  262. (a (nthcdr 7 (multiple-value-list (decode-universal-time recently))))
  263. (b (nthcdr 7 (multiple-value-list (decode-universal-time recently here)))))
  264. (list a b (equal a b))) @result{} ((T 5) (NIL 5) NIL)
  265. @end example
  266. @subsubheading Affected By::
  267. @i{Implementation-dependent} mechanisms for calculating when or if daylight
  268. savings time is in effect for any given session.
  269. @subsubheading See Also::
  270. @ref{encode-universal-time}
  271. ,
  272. @ref{get-universal-time; get-decoded-time}
  273. ,
  274. @ref{Time}
  275. @node encode-universal-time, get-universal-time, decode-universal-time, Environment Dictionary
  276. @subsection encode-universal-time [function]
  277. @subsubheading Syntax::
  278. @code{encode-universal-time} @i{second minute hour date month year
  279. {&optional} time-zone}@*
  280. @result{} @i{universal-time}
  281. @subsubheading Arguments and Values::
  282. @i{second}, @i{minute}, @i{hour},
  283. @i{date}, @i{month}, @i{year},
  284. @i{time-zone}---the corresponding parts of a @i{decoded time}.
  285. (Note that some of the nine values in a full @i{decoded time} are redundant,
  286. and so are not used as inputs to this function.)
  287. @i{universal-time}---a @i{universal time}.
  288. @subsubheading Description::
  289. @b{encode-universal-time} converts a time from Decoded Time format
  290. to a @i{universal time}.
  291. If @i{time-zone} is supplied, no adjustment for daylight savings time is performed.
  292. @subsubheading Examples::
  293. @example
  294. (encode-universal-time 0 0 0 1 1 1900 0) @result{} 0
  295. (encode-universal-time 0 0 1 4 7 1976 5) @result{} 2414296800
  296. ;; The next example assumes Eastern Daylight Time.
  297. (encode-universal-time 0 0 1 4 7 1976) @result{} 2414293200
  298. @end example
  299. @subsubheading See Also::
  300. @ref{decode-universal-time}
  301. , @b{get-decoded-time}
  302. @node get-universal-time, sleep, encode-universal-time, Environment Dictionary
  303. @subsection get-universal-time, get-decoded-time [Function]
  304. @code{get-universal-time} @i{<@i{no @i{arguments}}>} @result{} @i{universal-time}
  305. @code{get-decoded-time} @i{<@i{no @i{arguments}}>}@*
  306. @result{} @i{second, minute, hour, date, month, year, day, daylight-p, zone}
  307. @subsubheading Arguments and Values::
  308. @i{universal-time}---a @i{universal time}.
  309. @i{second}, @i{minute}, @i{hour},
  310. @i{date}, @i{month}, @i{year},
  311. @i{day}, @i{daylight-p}, @i{zone}---a @i{decoded time}.
  312. @subsubheading Description::
  313. @b{get-universal-time} returns the current time, represented as a @i{universal time}.
  314. @b{get-decoded-time} returns the current time, represented as a @i{decoded time}.
  315. @subsubheading Examples::
  316. @example
  317. ;; At noon on July 4, 1976 in Eastern Daylight Time.
  318. (get-decoded-time) @result{} 0, 0, 12, 4, 7, 1976, 6, @i{true}, 5
  319. ;; At exactly the same instant.
  320. (get-universal-time) @result{} 2414332800
  321. ;; Exactly five minutes later.
  322. (get-universal-time) @result{} 2414333100
  323. ;; The difference is 300 seconds (five minutes)
  324. (- * **) @result{} 300
  325. @end example
  326. @subsubheading Affected By::
  327. The time of day (@i{i.e.}, the passage of time),
  328. the system clock's ability to keep accurate time,
  329. and the accuracy of the system clock's initial setting.
  330. @subsubheading Exceptional Situations::
  331. An error of @i{type} @b{error} might be signaled if the current time cannot be determined.
  332. @subsubheading See Also::
  333. @ref{decode-universal-time}
  334. ,
  335. @ref{encode-universal-time}
  336. ,
  337. @ref{Time}
  338. @subsubheading Notes::
  339. @example
  340. (get-decoded-time) @equiv{} (decode-universal-time (get-universal-time))
  341. @end example
  342. No @i{implementation} is required to have a way to verify that the
  343. time returned is correct. However, if an @i{implementation} provides
  344. a validity check (@i{e.g.}, the failure to have properly initialized the system
  345. clock can be reliably detected) and that validity check fails,
  346. the @i{implementation} is strongly encouraged (but not required)
  347. to signal an error of @i{type} @b{error} (rather than, for example, returning a
  348. known-to-be-wrong value) that is @i{correctable} by allowing the user
  349. to interactively set the correct time.
  350. @node sleep, apropos, get-universal-time, Environment Dictionary
  351. @subsection sleep [Function]
  352. @code{sleep} @i{seconds} @result{} @i{@b{nil}}
  353. @subsubheading Arguments and Values::
  354. @i{seconds}---a non-negative @i{real}.
  355. @subsubheading Description::
  356. Causes execution to cease and become dormant for approximately the
  357. seconds of real time indicated by @i{seconds},
  358. whereupon execution is resumed.
  359. @subsubheading Examples::
  360. @example
  361. (sleep 1) @result{} NIL
  362. ;; Actually, since SLEEP is permitted to use approximate timing,
  363. ;; this might not always yield true, but it will often enough that
  364. ;; we felt it to be a productive example of the intent.
  365. (let ((then (get-universal-time))
  366. (now (progn (sleep 10) (get-universal-time))))
  367. (>= (- now then) 10))
  368. @result{} @i{true}
  369. @end example
  370. @subsubheading Side Effects::
  371. Causes processing to pause.
  372. @subsubheading Affected By::
  373. The granularity of the scheduler.
  374. @subsubheading Exceptional Situations::
  375. Should signal an error of @i{type} @b{type-error}
  376. if @i{seconds} is not a non-negative @i{real}.
  377. @node apropos, describe, sleep, Environment Dictionary
  378. @subsection apropos, apropos-list [Function]
  379. @code{apropos} @i{string {&optional} package} @result{} @i{<@i{no @i{values}}>}
  380. @code{apropos-list} @i{string {&optional} package} @result{} @i{symbols}
  381. @subsubheading Arguments and Values::
  382. @i{string}---a @i{string designator}.
  383. @i{package}---a @i{package designator} or @b{nil}.
  384. The default is @b{nil}.
  385. @i{symbols}---a @i{list} of @i{symbols}.
  386. @subsubheading Description::
  387. These functions search for @i{interned} @i{symbols}
  388. whose @i{names} contain the substring @i{string}.
  389. For @b{apropos}, as each such @i{symbol} is found,
  390. its name is printed on @i{standard output}.
  391. In addition,
  392. if such a @i{symbol} is defined as a @i{function} or @i{dynamic variable},
  393. information about those definitions might also be printed.
  394. For @b{apropos-list},
  395. no output occurs as the search proceeds;
  396. instead a list of the matching @i{symbols} is returned when the search is complete.
  397. If @i{package} is @i{non-nil},
  398. only the @i{symbols} @i{accessible} in that @i{package} are searched;
  399. otherwise all @i{symbols} @i{accessible} in any @i{package} are searched.
  400. Because a @i{symbol} might be available
  401. by way of more than one inheritance path,
  402. @b{apropos} might print information about the @i{same} @i{symbol} more than once,
  403. or @b{apropos-list} might return a @i{list} containing duplicate @i{symbols}.
  404. Whether or not the search is case-sensitive is @i{implementation-defined}.
  405. @subsubheading Affected By::
  406. The set of @i{symbols} which are currently @i{interned}
  407. in any @i{packages} being searched.
  408. @b{apropos} is also affected by @b{*standard-output*}.
  409. @node describe, describe-object, apropos, Environment Dictionary
  410. @subsection describe [Function]
  411. @code{describe} @i{object {&optional} stream} @result{} @i{<@i{no @i{values}}>}
  412. @subsubheading Arguments and Values::
  413. @i{object}---an @i{object}.
  414. @i{stream}---an @i{output} @i{stream designator}.
  415. The default is @i{standard output}.
  416. @subsubheading Description::
  417. @b{describe} displays information about @i{object}
  418. to @i{stream}.
  419. For example, @b{describe} of a @i{symbol} might show the
  420. @i{symbol}'s value, its definition, and each of its properties.
  421. @b{describe} of a @i{float} might show the number's
  422. internal representation in a way that is useful for tracking
  423. down round-off errors. In all cases, however, the nature and format of the
  424. output of @b{describe} is @i{implementation-dependent}.
  425. @b{describe} can describe something that it finds inside the @i{object};
  426. in such cases, a notational device such as increased indentation or positioning in a
  427. table is typically used in order to visually distinguish such recursive descriptions
  428. from descriptions of the argument @i{object}.
  429. The actual act of describing the object is implemented by @b{describe-object}.
  430. @b{describe} exists as an interface primarily to manage argument defaulting (including
  431. conversion of arguments @b{t} and @b{nil} into @i{stream} @i{objects}) and to inhibit
  432. any return values from @b{describe-object}.
  433. @b{describe} is not intended to be an interactive function. In a
  434. @i{conforming implementation}, @b{describe} must not, by default,
  435. prompt for user input. User-defined methods for @b{describe-object}
  436. are likewise restricted.
  437. @subsubheading Side Effects::
  438. Output to @i{standard output} or @i{terminal I/O}.
  439. @subsubheading Affected By::
  440. @b{*standard-output*} and @b{*terminal-io*},
  441. methods on @b{describe-object} and @b{print-object}
  442. for @i{objects} having user-defined @i{classes}.
  443. @subsubheading See Also::
  444. @ref{inspect}
  445. ,
  446. @ref{describe-object}
  447. @node describe-object, trace, describe, Environment Dictionary
  448. @subsection describe-object [Standard Generic Function]
  449. @subsubheading Syntax::
  450. @code{describe-object} @i{object stream} @result{} @i{@i{implementation-dependent}}
  451. @subsubheading Method Signatures::
  452. @code{describe-object} @i{(@i{object} standard-object) @i{stream}}
  453. @subsubheading Arguments and Values::
  454. @i{object}---an @i{object}.
  455. @i{stream}---a @i{stream}.
  456. @subsubheading Description::
  457. The generic function @b{describe-object} prints a description of
  458. @i{object} to a @i{stream}. @b{describe-object} is called
  459. by @b{describe}; it must not be called by the user.
  460. Each implementation is required to provide a @i{method} on
  461. the @i{class} @b{standard-object} and @i{methods} on enough other
  462. @i{classes} so as to ensure that there is always an applicable @i{method}.
  463. Implementations are free to add @i{methods} for other @i{classes}.
  464. Users can write @i{methods} for @b{describe-object} for their
  465. own @i{classes} if they do not wish to inherit an implementation-supplied
  466. @i{method}.
  467. @i{Methods} on @b{describe-object} can recursively call
  468. @b{describe}. Indentation, depth limits, and circularity detection
  469. are all taken care of automatically, provided that each @i{method}
  470. handles exactly one level of structure and calls @b{describe}
  471. recursively if there are more structural levels. The consequences are
  472. undefined if this rule is not obeyed.
  473. In some implementations the @i{stream} argument passed to a
  474. @b{describe-object} method is not the original @i{stream}, but is
  475. an intermediate @i{stream} that implements parts of @b{describe}.
  476. @i{Methods} should therefore not depend on the identity of this
  477. @i{stream}.
  478. @subsubheading Examples::
  479. @example
  480. (defclass spaceship ()
  481. ((captain :initarg :captain :accessor spaceship-captain)
  482. (serial# :initarg :serial-number :accessor spaceship-serial-number)))
  483. (defclass federation-starship (spaceship) ())
  484. (defmethod describe-object ((s spaceship) stream)
  485. (with-slots (captain serial#) s
  486. (format stream "~&~S is a spaceship of type ~S,~
  487. ~
  488. and with serial number ~D.~
  489. s (type-of s) captain serial#)))
  490. (make-instance 'federation-starship
  491. :captain "Rachel Garrett"
  492. :serial-number "NCC-1701-C")
  493. @result{} #<FEDERATION-STARSHIP 26312465>
  494. (describe *)
  495. @t{ |> } #<FEDERATION-STARSHIP 26312465> is a spaceship of type FEDERATION-STARSHIP,
  496. @t{ |> } with Rachel Garrett at the helm and with serial number NCC-1701-C.
  497. @result{} <@i{no @i{values}}>
  498. @end example
  499. @subsubheading See Also::
  500. @ref{describe}
  501. @subsubheading Notes::
  502. The same implementation techniques that are applicable to @b{print-object} are
  503. applicable to @b{describe-object}.
  504. The reason for making the return values for @b{describe-object}
  505. unspecified is to avoid forcing users to include explicit @t{(values)}
  506. in all of their @i{methods}. @b{describe} takes care of that.
  507. @node trace, step, describe-object, Environment Dictionary
  508. @subsection trace, untrace [Macro]
  509. @code{trace} @i{@{@i{function-name}@}{*}} @result{} @i{trace-result}
  510. @code{untrace} @i{@{@i{function-name}@}{*}} @result{} @i{untrace-result}
  511. @subsubheading Arguments and Values::
  512. @i{function-name}---a @i{function name}.
  513. @i{trace-result}---@i{implementation-dependent},
  514. unless no @i{function-names} are supplied,
  515. in which case @i{trace-result} is a @i{list} of @i{function names}.
  516. @i{untrace-result}---@i{implementation-dependent}.
  517. @subsubheading Description::
  518. @b{trace} and @b{untrace} control the invocation of the trace facility.
  519. Invoking @b{trace} with one or more @i{function-names} causes
  520. the denoted @i{functions} to be ``traced.''
  521. Whenever a traced @i{function} is invoked, information
  522. about the call,
  523. about the arguments passed,
  524. and about any eventually returned values
  525. is printed to @i{trace output}.
  526. If @b{trace} is used with no @i{function-names},
  527. no tracing action is performed;
  528. instead, a list of the @i{functions} currently being traced is returned.
  529. Invoking @b{untrace} with one or more function names causes those
  530. functions to be ``untraced'' (@i{i.e.}, no longer traced).
  531. If @b{untrace} is used with no @i{function-names},
  532. all @i{functions} currently being traced are untraced.
  533. If a @i{function} to be traced has been open-coded
  534. (@i{e.g.}, because it was declared @b{inline}),
  535. a call to that @i{function} might not produce trace output.
  536. @subsubheading Examples::
  537. @example
  538. (defun fact (n) (if (zerop n) 1 (* n (fact (- n 1)))))
  539. @result{} FACT
  540. (trace fact)
  541. @result{} (FACT)
  542. ;; Of course, the format of traced output is implementation-dependent.
  543. (fact 3)
  544. @t{ |> } 1 Enter FACT 3
  545. @t{ |> } | 2 Enter FACT 2
  546. @t{ |> } | 3 Enter FACT 1
  547. @t{ |> } | | 4 Enter FACT 0
  548. @t{ |> } | | 4 Exit FACT 1
  549. @t{ |> } | 3 Exit FACT 1
  550. @t{ |> } | 2 Exit FACT 2
  551. @t{ |> } 1 Exit FACT 6
  552. @result{} 6
  553. @end example
  554. @subsubheading Side Effects::
  555. Might change the definitions of the @i{functions} named by @i{function-names}.
  556. @subsubheading Affected By::
  557. Whether the functions named are defined or already being traced.
  558. @subsubheading Exceptional Situations::
  559. Tracing an already traced function,
  560. or untracing a function not currently being traced,
  561. should produce no harmful effects, but might signal a warning.
  562. @subsubheading See Also::
  563. @b{*trace-output*},
  564. @ref{step}
  565. @subsubheading Notes::
  566. @b{trace} and @b{untrace} may also accept additional
  567. @i{implementation-dependent} argument formats. The format of the trace
  568. output is @i{implementation-dependent}.
  569. Although @b{trace} can be extended to permit non-standard options,
  570. @i{implementations} are nevertheless encouraged (but not required)
  571. to warn about the use of syntax or options
  572. that are neither specified by this standard
  573. nor added as an extension by the @i{implementation},
  574. since they could be symptomatic of typographical errors
  575. or of reliance on features supported in @i{implementations}
  576. other than the current @i{implementation}.
  577. @node step, time, trace, Environment Dictionary
  578. @subsection step [Macro]
  579. @code{step} @i{form} @result{} @i{@{@i{result}@}{*}}
  580. @subsubheading Arguments and Values::
  581. @i{form}---a @i{form}; evaluated as described below.
  582. @i{results}---the @i{values} returned by the @i{form}.
  583. @subsubheading Description::
  584. @b{step} implements a debugging paradigm wherein the programmer
  585. is allowed to @i{step} through the @i{evaluation} of a @i{form}.
  586. The specific nature of the interaction,
  587. including which I/O streams are used and
  588. whether the stepping has lexical or dynamic scope,
  589. is @i{implementation-defined}.
  590. @b{step} evaluates @i{form} in the current @i{environment}.
  591. A call to @b{step} can be compiled, but it is acceptable for an
  592. implementation to interactively step through only those parts of the computation
  593. that are interpreted.
  594. It is technically permissible for a @i{conforming implementation}
  595. to take no action at all other than normal @i{execution} of the @i{form}.
  596. In such a situation,
  597. @t{(step @i{form})}
  598. is equivalent to, for example,
  599. @t{(let () @i{form})}.
  600. In implementations where this is the case, the associated documentation
  601. should mention that fact.
  602. @subsubheading See Also::
  603. @ref{trace; untrace}
  604. @subsubheading Notes::
  605. @i{Implementations} are encouraged to respond to the typing of @t{?}
  606. or the pressing of a ``help key'' by providing help including a list of
  607. commands.
  608. @node time, internal-time-units-per-second, step, Environment Dictionary
  609. @subsection time [Macro]
  610. @code{time} @i{form} @result{} @i{@{@i{result}@}{*}}
  611. @subsubheading Arguments and Values::
  612. @i{form}---a @i{form}; evaluated as described below.
  613. @i{results}---the @i{values} returned by the @i{form}.
  614. @subsubheading Description::
  615. @b{time} evaluates @i{form} in the current @i{environment} (lexical and dynamic).
  616. A call to @b{time} can be compiled.
  617. @b{time} prints various timing data and other information to @i{trace output}.
  618. The nature and format of the printed information is @i{implementation-defined}.
  619. Implementations are encouraged to provide such information as
  620. elapsed real time,
  621. machine run time,
  622. and storage management statistics.
  623. @subsubheading Affected By::
  624. The accuracy of the results depends, among other things, on the accuracy
  625. of the corresponding functions provided by the underlying operating system.
  626. The magnitude of the results may depend on
  627. the hardware,
  628. the operating system,
  629. the lisp implementation,
  630. and the state of the global environment.
  631. Some specific issues which frequently affect the outcome are
  632. hardware speed,
  633. nature of the scheduler (if any),
  634. number of competing processes (if any),
  635. system paging,
  636. whether the call is interpreted or compiled,
  637. whether functions called are compiled,
  638. the kind of garbage collector involved and whether it runs,
  639. whether internal data structures (e.g., hash tables) are implicitly reorganized,
  640. @i{etc.}
  641. @subsubheading See Also::
  642. @ref{get-internal-real-time}
  643. ,
  644. @ref{get-internal-run-time}
  645. @subsubheading Notes::
  646. In general, these timings are not guaranteed to be reliable enough for
  647. marketing comparisons. Their value is primarily heuristic, for tuning
  648. purposes.
  649. For useful background information on the complicated issues involved in
  650. interpreting timing results, see {Performance and Evaluation of Lisp Programs}.
  651. @node internal-time-units-per-second, get-internal-real-time, time, Environment Dictionary
  652. @subsection internal-time-units-per-second [Constant Variable]
  653. @subsubheading Constant Value::
  654. A positive @i{integer}, the magnitude of which is @i{implementation-dependent}.
  655. @subsubheading Description::
  656. The number of @i{internal time units} in one second.
  657. @subsubheading See Also::
  658. @ref{get-internal-run-time}
  659. ,
  660. @ref{get-internal-real-time}
  661. @subsubheading Notes::
  662. These units form the basis of the Internal Time format representation.
  663. @node get-internal-real-time, get-internal-run-time, internal-time-units-per-second, Environment Dictionary
  664. @subsection get-internal-real-time [Function]
  665. @code{get-internal-real-time} @i{<@i{no @i{arguments}}>} @result{} @i{internal-time}
  666. @subsubheading Arguments and Values::
  667. @i{internal-time}---a non-negative @i{integer}.
  668. @subsubheading Description::
  669. @b{get-internal-real-time} returns as an @i{integer} the
  670. current time in @i{internal time units}, relative to an arbitrary
  671. time base. The difference between the values of two calls to this
  672. function is the amount of elapsed real time (@i{i.e.}, clock time) between the two calls.
  673. @subsubheading Affected By::
  674. Time of day (@i{i.e.}, the passage of time).
  675. The time base affects the result magnitude.
  676. @subsubheading See Also::
  677. @ref{internal-time-units-per-second}
  678. @node get-internal-run-time, disassemble, get-internal-real-time, Environment Dictionary
  679. @subsection get-internal-run-time [Function]
  680. @code{get-internal-run-time} @i{<@i{no @i{arguments}}>} @result{} @i{internal-time}
  681. @subsubheading Arguments and Values::
  682. @i{internal-time}---a non-negative @i{integer}.
  683. @subsubheading Description::
  684. Returns as an @i{integer} the current
  685. run time in @i{internal time units}. The precise meaning of this quantity is
  686. @i{implementation-defined}; it may measure real time, run time, CPU cycles, or some
  687. other quantity. The intent is that the difference between the values of two calls
  688. to this function be the amount of time between the two calls during which
  689. computational effort was expended on behalf of the executing program.
  690. @subsubheading Affected By::
  691. The @i{implementation},
  692. the time of day (@i{i.e.}, the passage of time).
  693. @subsubheading See Also::
  694. @ref{internal-time-units-per-second}
  695. @subsubheading Notes::
  696. Depending on the @i{implementation}, paging time and garbage
  697. collection time might be included in this measurement. Also, in a
  698. multitasking environment, it might not be possible to show the time for
  699. just the running process, so in some @i{implementations}, time taken
  700. by other processes during the same time interval might be included in
  701. this measurement as well.
  702. @node disassemble, documentation, get-internal-run-time, Environment Dictionary
  703. @subsection disassemble [Function]
  704. @code{disassemble} @i{fn} @result{} @i{@b{nil}}
  705. @subsubheading Arguments and Values::
  706. @i{fn}---an @i{extended function designator}
  707. or a @i{lambda expression}.
  708. @subsubheading Description::
  709. The @i{function} @b{disassemble} is a debugging aid that composes symbolic
  710. instructions or expressions in some @i{implementation-dependent}
  711. language which represent the code used to produce the @i{function}
  712. which is or is named by the argument @i{fn}. The result is displayed
  713. to @i{standard output} in an @i{implementation-dependent} format.
  714. If @i{fn} is a @i{lambda expression} or @i{interpreted function},
  715. it is compiled first and the result is disassembled.
  716. If the @i{fn} @i{designator} is a @i{function name},
  717. the @i{function} that it @i{names} is disassembled.
  718. (If that @i{function} is an @i{interpreted function},
  719. it is first compiled but the result of this implicit compilation is not installed.)
  720. @subsubheading Examples::
  721. @example
  722. (defun f (a) (1+ a)) @result{} F
  723. (eq (symbol-function 'f)
  724. (progn (disassemble 'f)
  725. (symbol-function 'f))) @result{} @i{true}
  726. @end example
  727. @subsubheading Affected By::
  728. @b{*standard-output*}.
  729. @subsubheading Exceptional Situations::
  730. Should signal an error of @i{type} @b{type-error}
  731. if @i{fn} is not an @i{extended function designator}
  732. or a @i{lambda expression}.
  733. @node documentation, room, disassemble, Environment Dictionary
  734. @subsection documentation, (setf documentation) [Standard Generic Function]
  735. @subsubheading Syntax::
  736. @code{documentation} @i{x doc-type} @result{} @i{documentation}
  737. @code{(setf documentation)} @i{new-value x doc-type} @result{} @i{new-value}
  738. @subsubheading Argument Precedence Order::
  739. @i{doc-type}, @i{object}
  740. @subsubheading Method Signatures::
  741. @subsubheading Functions, Macros, and Special Forms
  742. documentation (@i{x} @code{function}) (doc-type (eql 't))@*
  743. (setf documentation) @i{new-value}(@i{x} @code{function}) (doc-type (eql 't))
  744. documentation (@i{x} @code{function}) (doc-type (eql 'function))@*
  745. (setf documentation) @i{new-value}(@i{x} @code{function}) (doc-type (eql 'function))
  746. documentation (@i{x} @code{list}) (doc-type (eql 'function))@*
  747. (setf documentation) @i{new-value}(@i{x} @code{list}) (doc-type (eql 'function))
  748. documentation (@i{x} @code{list}) (doc-type (eql 'compiler-macro))@*
  749. (setf documentation) @i{new-value}(@i{x} @code{list}) (doc-type (eql 'compiler-macro))
  750. documentation (@i{x} @code{symbol}) (doc-type (eql 'function))@*
  751. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'function))
  752. documentation (@i{x} @code{symbol}) (doc-type (eql 'compiler-macro))@*
  753. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'compiler-macro))
  754. documentation (@i{x} @code{symbol}) (doc-type (eql 'setf))@*
  755. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'setf))
  756. @subsubheading Method Combinations
  757. documentation (@i{x} @code{method-combination}) (doc-type (eql 't))@*
  758. (setf documentation) @i{new-value}(@i{x} @code{method-combination}) (doc-type (eql 't))
  759. documentation (@i{x} @code{method-combination}) (doc-type (eql 'method-combination))@*
  760. (setf documentation) @i{new-value}(@i{x} @code{method-combination}) (doc-type (eql 'method-combination))
  761. documentation (@i{x} @code{symbol}) (doc-type (eql 'method-combination))@*
  762. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'method-combination))
  763. @subsubheading Methods
  764. documentation (@i{x} @code{standard-method}) (doc-type (eql 't))@*
  765. (setf documentation) @i{new-value}(@i{x} @code{standard-method}) (doc-type (eql 't))
  766. @subsubheading Packages
  767. documentation (@i{x} @code{package}) (doc-type (eql 't))@*
  768. (setf documentation) @i{new-value}(@i{x} @code{package}) (doc-type (eql 't))
  769. @subsubheading Types, Classes, and Structure Names
  770. documentation (@i{x} @code{standard-class}) (doc-type (eql 't))@*
  771. (setf documentation) @i{new-value}(@i{x} @code{standard-class}) (doc-type (eql 't))
  772. documentation (@i{x} @code{standard-class}) (doc-type (eql 'type))@*
  773. (setf documentation) @i{new-value}(@i{x} @code{standard-class}) (doc-type (eql 'type))
  774. documentation (@i{x} @code{structure-class}) (doc-type (eql 't))@*
  775. (setf documentation) @i{new-value}(@i{x} @code{structure-class}) (doc-type (eql 't))
  776. documentation (@i{x} @code{structure-class}) (doc-type (eql 'type))@*
  777. (setf documentation) @i{new-value}(@i{x} @code{structure-class}) (doc-type (eql 'type))
  778. documentation (@i{x} @code{symbol}) (doc-type (eql 'type))@*
  779. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'type))
  780. documentation (@i{x} @code{symbol}) (doc-type (eql 'structure))@*
  781. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'structure))
  782. @subsubheading Variables
  783. documentation (@i{x} @code{symbol}) (doc-type (eql 'variable))@*
  784. (setf documentation) @i{new-value}(@i{x} @code{symbol}) (doc-type (eql 'variable))
  785. @subsubheading Arguments and Values::
  786. @i{x}---an @i{object}.
  787. @i{doc-type}---a @i{symbol}.
  788. @i{documentation}---a @i{string}, or @b{nil}.
  789. @i{new-value}---a @i{string}.
  790. @subsubheading Description::
  791. The @i{generic function} @b{documentation} returns the @i{documentation string}
  792. associated with the given @i{object} if it is available;
  793. otherwise it returns @b{nil}.
  794. The @i{generic function} @t{(setf documentation)} updates the
  795. @i{documentation string} associated with @i{x} to @i{new-value}.
  796. If @i{x} is a @i{list},
  797. it must be of the form @t{(setf @i{symbol})}.
  798. @i{Documentation strings} are made available for debugging purposes.
  799. @i{Conforming programs} are permitted to use @i{documentation strings}
  800. when they are present, but should not depend for their correct behavior on
  801. the presence of those @i{documentation strings}.
  802. An @i{implementation} is permitted to discard @i{documentation strings}
  803. at any time for @i{implementation-defined} reasons.
  804. The nature of the @i{documentation string} returned depends on the
  805. @i{doc-type}, as follows:
  806. @table @asis
  807. @item @b{compiler-macro}
  808. Returns the @i{documentation string} of the @i{compiler macro}
  809. whose @i{name} is the @i{function name} @i{x}.
  810. @item @b{function}
  811. If @i{x} is a @i{function name},
  812. returns the @i{documentation string} of
  813. the @i{function}, @i{macro}, or @i{special operator}
  814. whose @i{name} is @i{x}.
  815. If @i{x} is a @i{function},
  816. returns the @i{documentation string} associated with @i{x}.
  817. @item @b{method-combination}
  818. If @i{x} is a @i{symbol},
  819. returns the @i{documentation string} of
  820. the @i{method combination}
  821. whose @i{name} is @i{x}.
  822. If @i{x} is a @i{method combination},
  823. returns the @i{documentation string} associated with @i{x}.
  824. @item @b{setf}
  825. Returns the @i{documentation string} of
  826. the @i{setf expander}
  827. whose @i{name} is the @i{symbol} @i{x}.
  828. @item @b{structure}
  829. Returns the @i{documentation string}
  830. associated with the @i{structure name} @i{x}.
  831. @item @b{t}
  832. Returns a @i{documentation string} specialized on the @i{class} of
  833. the argument @i{x} itself.
  834. For example, if @i{x} is a @i{function},
  835. the @i{documentation string} associated with the @i{function} @i{x} is returned.
  836. @item @b{type}
  837. If @i{x} is a @i{symbol},
  838. returns the @i{documentation string} of the @i{class}
  839. whose @i{name} is the @i{symbol} @i{x},
  840. if there is such a @i{class}.
  841. Otherwise, it returns the @i{documentation string} of the @i{type}
  842. which is the @i{type specifier} @i{symbol} @i{x}.
  843. If @i{x} is a @i{structure class} or @i{standard class},
  844. returns the @i{documentation string} associated with
  845. the @i{class} @i{x}.
  846. @item @b{variable}
  847. Returns the @i{documentation string} of
  848. the @i{dynamic variable} or @i{constant variable}
  849. whose @i{name} is the @i{symbol} @i{x}.
  850. @end table
  851. A @i{conforming implementation} or a @i{conforming program}
  852. may extend the set of @i{symbols} that are acceptable as the @i{doc-type}.
  853. @subsubheading Notes::
  854. This standard prescribes no means to retrieve the @i{documentation strings}
  855. for individual slots specified in a @b{defclass} form, but
  856. @i{implementations} might still provide debugging tools and/or
  857. programming language extensions which manipulate this information.
  858. Implementors wishing to provide such support are encouraged to consult the
  859. @i{Metaobject Protocol} for suggestions about how this might be done.
  860. @node room, ed, documentation, Environment Dictionary
  861. @subsection room [Function]
  862. @code{room} @i{{&optional} x} @result{} @i{@i{implementation-dependent}}
  863. @subsubheading Arguments and Values::
  864. @i{x}---one of @b{t}, @b{nil}, or @t{:default}.
  865. @subsubheading Description::
  866. @b{room} prints, to @i{standard output},
  867. information about the state of internal storage and its management.
  868. This might include descriptions of the amount of memory in use and
  869. the degree of memory compaction, possibly broken down by internal data type if that
  870. is appropriate. The nature and format of the printed information is
  871. @i{implementation-dependent}.
  872. The intent is to provide information that a @i{programmer}
  873. might use to tune a @i{program} for a particular @i{implementation}.
  874. @t{(room nil)} prints out a minimal amount of information.
  875. @t{(room t)} prints out a maximal amount of information.
  876. @t{(room)} or @t{(room :default)} prints out an intermediate amount
  877. of information that is likely to be useful.
  878. @subsubheading Side Effects::
  879. Output to @i{standard output}.
  880. @subsubheading Affected By::
  881. @b{*standard-output*}.
  882. @node ed, inspect, room, Environment Dictionary
  883. @subsection ed [Function]
  884. @code{ed} @i{{&optional} x} @result{} @i{@i{implementation-dependent}}
  885. @subsubheading Arguments and Values::
  886. @i{x}---@b{nil}, a @i{pathname}, a @i{string}, or a @i{function name}.
  887. The default is @b{nil}.
  888. @subsubheading Description::
  889. @b{ed} invokes the editor if the @i{implementation} provides a resident editor.
  890. If @i{x} is @b{nil}, the editor is entered.
  891. If the editor had been previously entered, its prior state is resumed, if possible.
  892. If @i{x} is a @i{pathname} or @i{string},
  893. it is taken as the @i{pathname designator} for a @i{file} to be edited.
  894. If @i{x} is a @i{function name}, the text of its definition is edited.
  895. The means by which the function text is obtained is @i{implementation-defined}.
  896. @subsubheading Exceptional Situations::
  897. The consequences are undefined if the @i{implementation} does not provide a resident editor.
  898. Might signal @b{type-error} if its argument is supplied but is not
  899. a @i{symbol}, a @i{pathname}, or @b{nil}.
  900. If a failure occurs when performing some operation on the @i{file system}
  901. while attempting to edit a @i{file},
  902. an error of @i{type} @b{file-error} is signaled.
  903. An error of @i{type} @b{file-error} might be signaled if @i{x}
  904. is a @i{designator} for a @i{wild} @i{pathname}.
  905. @i{Implementation-dependent} additional conditions might be signaled as well.
  906. @subsubheading See Also::
  907. @b{pathname},
  908. @b{logical-pathname},
  909. @ref{compile-file}
  910. ,
  911. @ref{load}
  912. ,
  913. @ref{Pathnames as Filenames}
  914. @node inspect, dribble, ed, Environment Dictionary
  915. @subsection inspect [Function]
  916. @code{inspect} @i{object} @result{} @i{@i{implementation-dependent}}
  917. @subsubheading Arguments and Values::
  918. @i{object}---an @i{object}.
  919. @subsubheading Description::
  920. @b{inspect} is an interactive version of @b{describe}.
  921. The nature of the interaction is @i{implementation-dependent},
  922. but the purpose of @b{inspect} is to make it easy to wander
  923. through a data structure, examining and modifying parts of it.
  924. @subsubheading Side Effects::
  925. @i{implementation-dependent}.
  926. @subsubheading Affected By::
  927. @i{implementation-dependent}.
  928. @subsubheading Exceptional Situations::
  929. @i{implementation-dependent}.
  930. @subsubheading See Also::
  931. @ref{describe}
  932. @subsubheading Notes::
  933. Implementations are encouraged to respond to the typing
  934. of @t{?} or a ``help key'' by providing help, including a list
  935. of commands.
  936. @node dribble, -, inspect, Environment Dictionary
  937. @subsection dribble [Function]
  938. @code{dribble} @i{{&optional} pathname} @result{} @i{@i{implementation-dependent}}
  939. @subsubheading Arguments and Values::
  940. @i{pathname}---a @i{pathname designator}.
  941. @subsubheading Description::
  942. Either @i{binds} @b{*standard-input*} and @b{*standard-output*}
  943. or takes other appropriate action,
  944. so as to send a record of the input/output interaction to a file
  945. named by @i{pathname}. @b{dribble} is intended to create
  946. a readable record of an interactive session.
  947. If @i{pathname} is a @i{logical pathname}, it is translated
  948. into a physical pathname as if by calling @b{translate-logical-pathname}.
  949. @t{(dribble)} terminates the recording of input and output
  950. and closes the dribble file.
  951. If @b{dribble} is @i{called} while a @i{stream} to a ``dribble file''
  952. is still open from a previous @i{call} to @b{dribble},
  953. the effect is @i{implementation-defined}. For example,
  954. the already-@i{open} @i{stream} might be @i{closed},
  955. or dribbling might occur both to the old @i{stream} and to a new one,
  956. or the old @i{stream} might stay open but not receive any further output,
  957. or the new request might be ignored,
  958. or some other action might be taken.
  959. @subsubheading Affected By::
  960. The @i{implementation}.
  961. @subsubheading Exceptional Situations::
  962. If a failure occurs when performing some operation on the @i{file system}
  963. while creating the dribble file,
  964. an error of @i{type} @b{file-error} is signaled.
  965. An error of @i{type} @b{file-error} might be signaled if @i{pathname}
  966. is a @i{designator} for a @i{wild} @i{pathname}.
  967. @subsubheading See Also::
  968. @ref{Pathnames as Filenames}
  969. @subsubheading Notes::
  970. @b{dribble} can return before subsequent
  971. @i{forms} are executed. It also
  972. can enter a recursive interaction loop,
  973. returning only when @t{(dribble)} is done.
  974. @b{dribble} is intended primarily for interactive debugging;
  975. its effect cannot be relied upon when used in a program.
  976. @node -, +, dribble, Environment Dictionary
  977. @subsection - [Variable]
  978. @subsubheading Value Type::
  979. a @i{form}.
  980. @subsubheading Initial Value::
  981. @i{implementation-dependent}.
  982. @subsubheading Description::
  983. The @i{value} of @b{-} is the @i{form} that is currently being evaluated by
  984. the @i{Lisp read-eval-print loop}.
  985. @subsubheading Examples::
  986. @example
  987. (format t "~&Evaluating ~S~
  988. @t{ |> } Evaluating (FORMAT T "~&Evaluating ~S~
  989. @result{} NIL
  990. @end example
  991. @subsubheading Affected By::
  992. @i{Lisp read-eval-print loop}.
  993. @subsubheading See Also::
  994. @b{+} (@i{variable}),
  995. @b{*} (@i{variable}),
  996. @ref{/}
  997. (@i{variable}),
  998. @ref{Top level loop}
  999. @node +, *, -, Environment Dictionary
  1000. @subsection +, ++, +++ [Variable]
  1001. @subsubheading Value Type::
  1002. an @i{object}.
  1003. @subsubheading Initial Value::
  1004. @i{implementation-dependent}.
  1005. @subsubheading Description::
  1006. The @i{variables} @b{+}, @b{++}, and @b{+++} are maintained by the
  1007. @i{Lisp read-eval-print loop} to save @i{forms} that were
  1008. recently @i{evaluated}.
  1009. The @i{value} of @b{+} is the last @i{form} that was @i{evaluated},
  1010. the @i{value} of @b{++} is the previous value of @b{+}, and
  1011. the @i{value} of @b{+++} is the previous value of @b{++}.
  1012. @subsubheading Examples::
  1013. @example
  1014. (+ 0 1) @result{} 1
  1015. (- 4 2) @result{} 2
  1016. (/ 9 3) @result{} 3
  1017. (list + ++ +++) @result{} ((/ 9 3) (- 4 2) (+ 0 1))
  1018. (setq a 1 b 2 c 3 d (list a b c)) @result{} (1 2 3)
  1019. (setq a 4 b 5 c 6 d (list a b c)) @result{} (4 5 6)
  1020. (list a b c) @result{} (4 5 6)
  1021. (eval +++) @result{} (1 2 3)
  1022. #.`(,@@++ d) @result{} (1 2 3 (1 2 3))
  1023. @end example
  1024. @subsubheading Affected By::
  1025. @i{Lisp read-eval-print loop}.
  1026. @subsubheading See Also::
  1027. @ref{-}
  1028. (@i{variable}),
  1029. @b{*} (@i{variable}),
  1030. @ref{/}
  1031. (@i{variable}),
  1032. @ref{Top level loop}
  1033. @node *, /, +, Environment Dictionary
  1034. @subsection *, **, *** [Variable]
  1035. @subsubheading Value Type::
  1036. an @i{object}.
  1037. @subsubheading Initial Value::
  1038. @i{implementation-dependent}.
  1039. @subsubheading Description::
  1040. The @i{variables} @b{*}, @b{**}, and @b{***} are
  1041. maintained by the @i{Lisp read-eval-print loop} to save the
  1042. values of results that are printed each time through the loop.
  1043. The @i{value} of @b{*} is the most recent @i{primary value} that was printed,
  1044. the @i{value} of @b{**} is the previous value of @b{*}, and
  1045. the @i{value} of @b{***} is the previous value of @b{**}.
  1046. If several values are produced, @b{*} contains the first value only;
  1047. @b{*} contains @b{nil} if zero values are produced.
  1048. The @i{values} of @b{*}, @b{**}, and @b{***} are updated immediately
  1049. prior to printing the @i{return value} of a top-level @i{form} by the
  1050. @i{Lisp read-eval-print loop}. If the @i{evaluation} of such a @i{form}
  1051. is aborted prior to its normal return, the values of @b{*}, @b{**}, and @b{***}
  1052. are not updated.
  1053. @subsubheading Examples::
  1054. @example
  1055. (values 'a1 'a2) @result{} A1, A2
  1056. 'b @result{} B
  1057. (values 'c1 'c2 'c3) @result{} C1, C2, C3
  1058. (list * ** ***) @result{} (C1 B A1)
  1059. (defun cube-root (x) (expt x 1/3)) @result{} CUBE-ROOT
  1060. (compile *) @result{} CUBE-ROOT
  1061. (setq a (cube-root 27.0)) @result{} 3.0
  1062. (* * 9.0) @result{} 27.0
  1063. @end example
  1064. @subsubheading Affected By::
  1065. @i{Lisp read-eval-print loop}.
  1066. @subsubheading See Also::
  1067. @ref{-}
  1068. (@i{variable}),
  1069. @b{+} (@i{variable}),
  1070. @ref{/}
  1071. (@i{variable}),
  1072. @ref{Top level loop}
  1073. @subsubheading Notes::
  1074. @example
  1075. * @equiv{} (car /)
  1076. ** @equiv{} (car //)
  1077. *** @equiv{} (car ///)
  1078. @end example
  1079. @node /, lisp-implementation-type, *, Environment Dictionary
  1080. @subsection /, //, /// [Variable]
  1081. @subsubheading Value Type::
  1082. a @i{proper list}.
  1083. @subsubheading Initial Value::
  1084. @i{implementation-dependent}.
  1085. @subsubheading Description::
  1086. The @i{variables} @b{/}, @b{//}, and @b{///} are maintained by
  1087. the @i{Lisp read-eval-print loop} to save the values of results that
  1088. were printed at the end of the loop.
  1089. The @i{value} of @b{/} is a @i{list} of the most recent @i{values} that were printed,
  1090. the @i{value} of @b{//} is the previous value of @b{/}, and
  1091. the @i{value} of @b{///} is the previous value of @b{//}.
  1092. The @i{values} of @b{/}, @b{//}, and @b{///} are updated immediately
  1093. prior to printing the @i{return value} of a top-level @i{form} by the
  1094. @i{Lisp read-eval-print loop}. If the @i{evaluation} of such a @i{form}
  1095. is aborted prior to its normal return, the values of @b{/}, @b{//}, and @b{///}
  1096. are not updated.
  1097. @subsubheading Examples::
  1098. @example
  1099. (floor 22 7) @result{} 3, 1
  1100. (+ (* (car /) 7) (cadr /)) @result{} 22
  1101. @end example
  1102. @subsubheading Affected By::
  1103. @i{Lisp read-eval-print loop}.
  1104. @subsubheading See Also::
  1105. @ref{-}
  1106. (@i{variable}),
  1107. @b{+} (@i{variable}),
  1108. @b{*} (@i{variable}),
  1109. @ref{Top level loop}
  1110. @node lisp-implementation-type, short-site-name, /, Environment Dictionary
  1111. @subsection lisp-implementation-type,
  1112. @subheading lisp-implementation-version
  1113. @flushright
  1114. @i{[Function]}
  1115. @end flushright
  1116. @code{lisp-implementation-type} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1117. @code{lisp-implementation-version} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1118. @subsubheading Arguments and Values::
  1119. @i{description}---a @i{string} or @b{nil}.
  1120. @subsubheading Description::
  1121. @b{lisp-implementation-type} and @b{lisp-implementation-version}
  1122. identify the current implementation of @r{Common Lisp}.
  1123. @b{lisp-implementation-type} returns a @i{string}
  1124. that identifies the generic name of
  1125. the particular @r{Common Lisp} implementation.
  1126. @b{lisp-implementation-version}
  1127. returns a @i{string} that identifies the version of
  1128. the particular @r{Common Lisp} implementation.
  1129. If no appropriate
  1130. and relevant result can be produced, @b{nil} is returned instead
  1131. of a @i{string}.
  1132. @subsubheading Examples::
  1133. @example
  1134. (lisp-implementation-type)
  1135. @result{} "ACME Lisp"
  1136. @i{OR}@result{} "Joe's Common Lisp"
  1137. (lisp-implementation-version)
  1138. @result{} "1.3a"
  1139. @result{} "V2"
  1140. @i{OR}@result{} "Release 17.3, ECO #6"
  1141. @end example
  1142. @node short-site-name, machine-instance, lisp-implementation-type, Environment Dictionary
  1143. @subsection short-site-name, long-site-name [Function]
  1144. @code{short-site-name} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1145. @code{long-site-name} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1146. @subsubheading Arguments and Values::
  1147. @i{description}---a @i{string} or @b{nil}.
  1148. @subsubheading Description::
  1149. @b{short-site-name} and @b{long-site-name} return
  1150. a @i{string} that identifies the physical location
  1151. of the computer hardware,
  1152. or @b{nil} if no appropriate @i{description} can be produced.
  1153. @subsubheading Examples::
  1154. @example
  1155. (short-site-name)
  1156. @result{} "MIT AI Lab"
  1157. @i{OR}@result{} "CMU-CSD"
  1158. (long-site-name)
  1159. @result{} "MIT Artificial Intelligence Laboratory"
  1160. @i{OR}@result{} "CMU Computer Science Department"
  1161. @end example
  1162. @subsubheading Affected By::
  1163. The implementation,
  1164. the location of the computer hardware,
  1165. and the installation/configuration process.
  1166. @node machine-instance, machine-type, short-site-name, Environment Dictionary
  1167. @subsection machine-instance [Function]
  1168. @code{machine-instance} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1169. @subsubheading Arguments and Values::
  1170. @i{description}---a @i{string} or @b{nil}.
  1171. @subsubheading Description::
  1172. Returns a @i{string} that identifies the particular instance of
  1173. the computer hardware on which @r{Common Lisp} is running,
  1174. or @b{nil} if no such @i{string} can be computed.
  1175. @subsubheading Examples::
  1176. @example
  1177. (machine-instance)
  1178. @result{} "ACME.COM"
  1179. @i{OR}@result{} "S/N 123231"
  1180. @i{OR}@result{} "18.26.0.179"
  1181. @i{OR}@result{} "AA-00-04-00-A7-A4"
  1182. @end example
  1183. @subsubheading Affected By::
  1184. The machine instance,
  1185. and the @i{implementation}.
  1186. @subsubheading See Also::
  1187. @ref{machine-type}
  1188. ,
  1189. @ref{machine-version}
  1190. @node machine-type, machine-version, machine-instance, Environment Dictionary
  1191. @subsection machine-type [Function]
  1192. @code{machine-type} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1193. @subsubheading Arguments and Values::
  1194. @i{description}---a @i{string} or @b{nil}.
  1195. @subsubheading Description::
  1196. Returns a @i{string} that identifies the generic name of
  1197. the computer hardware on which @r{Common Lisp} is running.
  1198. @subsubheading Examples::
  1199. @example
  1200. (machine-type)
  1201. @result{} "DEC PDP-10"
  1202. @i{OR}@result{} "Symbolics LM-2"
  1203. @end example
  1204. @subsubheading Affected By::
  1205. The machine type.
  1206. The implementation.
  1207. @subsubheading See Also::
  1208. @ref{machine-version}
  1209. @node machine-version, software-type, machine-type, Environment Dictionary
  1210. @subsection machine-version [Function]
  1211. @code{machine-version} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1212. @subsubheading Arguments and Values::
  1213. @i{description}---a @i{string} or @b{nil}.
  1214. @subsubheading Description::
  1215. Returns a @i{string} that identifies the version of the computer hardware
  1216. on which @r{Common Lisp} is running, or @b{nil} if no such value can be computed.
  1217. @subsubheading Examples::
  1218. @example
  1219. (machine-version) @result{} "KL-10, microcode 9"
  1220. @end example
  1221. @subsubheading Affected By::
  1222. The machine version,
  1223. and the @i{implementation}.
  1224. @subsubheading See Also::
  1225. @ref{machine-type}
  1226. ,
  1227. @ref{machine-instance}
  1228. @node software-type, user-homedir-pathname, machine-version, Environment Dictionary
  1229. @subsection software-type, software-version [Function]
  1230. @code{software-type} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1231. @code{software-version} @i{<@i{no @i{arguments}}>} @result{} @i{description}
  1232. @subsubheading Arguments and Values::
  1233. @i{description}---a @i{string} or @b{nil}.
  1234. @subsubheading Description::
  1235. @b{software-type} returns a @i{string} that identifies the
  1236. generic name of any relevant supporting software, or @b{nil} if no
  1237. appropriate or relevant result can be produced.
  1238. @b{software-version} returns a @i{string} that identifies
  1239. the version of any relevant supporting software, or @b{nil} if no
  1240. appropriate or relevant result can be produced.
  1241. @subsubheading Examples::
  1242. @example
  1243. (software-type) @result{} "Multics"
  1244. (software-version) @result{} "1.3x"
  1245. @end example
  1246. @subsubheading Affected By::
  1247. Operating system environment.
  1248. @subsubheading Notes::
  1249. This information should be of use to maintainers of the @i{implementation}.
  1250. @node user-homedir-pathname, , software-type, Environment Dictionary
  1251. @subsection user-homedir-pathname [Function]
  1252. @code{user-homedir-pathname} @i{{&optional} host} @result{} @i{pathname}
  1253. @subsubheading Arguments and Values::
  1254. @i{host}---a @i{string}, a @i{list} of @i{strings}, or @t{:unspecific}.
  1255. @i{pathname}---a @i{pathname}, or @b{nil}.
  1256. @subsubheading Description::
  1257. @b{user-homedir-pathname} determines the @i{pathname} that corresponds
  1258. to the user's home directory on @i{host}.
  1259. If @i{host} is not supplied, its value is @i{implementation-dependent}.
  1260. For a description of @t{:unspecific}, see @ref{Pathname Components}.
  1261. The definition of home directory is @i{implementation-dependent},
  1262. but defined in @r{Common Lisp} to mean the directory where the user
  1263. keeps personal files such as initialization files and mail.
  1264. @b{user-homedir-pathname} returns a @i{pathname} without any name,
  1265. type, or version component (those components are all @b{nil})
  1266. for the user's home directory on @i{host}.
  1267. If it is impossible to determine the user's home directory on @i{host},
  1268. then @b{nil} is returned.
  1269. @b{user-homedir-pathname} never returns @b{nil} if @i{host} is not supplied.
  1270. @subsubheading Examples::
  1271. @example
  1272. (pathnamep (user-homedir-pathname)) @result{} @i{true}
  1273. @end example
  1274. @subsubheading Affected By::
  1275. The host computer's file system,
  1276. and the @i{implementation}.
  1277. @c end of including dict-environment
  1278. @c %**end of chapter