04-datatypes.lpt 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. PSL Manual 7 February 1983 Data Types
  2. section 4.0 page 4.1
  3. CHAPTER 4 CHAPTER 4 CHAPTER 4
  4. DATA TYPES DATA TYPES DATA TYPES
  5. 4.1. Data Types and Structures Supported in PSL . . . . . 4.1
  6. 4.1.1. Data Types. . . . . . . . . . . . . . 4.1
  7. 4.1.2. Other Notational Conventions. . . . . . . . 4.4
  8. 4.1.3. Structures. . . . . . . . . . . . . . 4.4
  9. 4.2. Predicates Useful with Data Types . . . . . . . . 4.5
  10. 4.2.1. Functions for Testing Equality . . . . . . . 4.6
  11. 4.2.2. Predicates for Testing the Type of an Object . . 4.7
  12. 4.2.3. Boolean Functions . . . . . . . . . . . 4.8
  13. 4.3. Converting Data Types . . . . . . . . . . . . 4.9
  14. 4.1. Data Types and Structures Supported in PSL 4.1. Data Types and Structures Supported in PSL 4.1. Data Types and Structures Supported in PSL
  15. 4.1.1. Data Types 4.1.1. Data Types 4.1.1. Data Types
  16. Data objects in PSL are tagged with their type. This means that the type
  17. declarations required in many programming languages are not needed. Some
  18. functions are "generic" in that the result they return depends on the types
  19. ____ ___ of the arguments. A tagged PSL object is called an item, and has a tag
  20. ____ field (9 bits on the DEC-20, 5 bits on the VAX), an info field (18 bits on
  21. the DEC-20, 27 bits on the VAX), and possibly some bits for garbage
  22. ____ collection. The info field is either immediate data or an index or address
  23. __ into some other structure (such as the heap or id space). For the purposes
  24. ____ of input and output of items, an appropriate notation is used (see Chapter
  25. 12 for full details on syntax, restrictions, etc.). More explicit
  26. implementation details can be found in Chapters 20 and 21.
  27. The basic data types supported in PSL and a brief indication of their
  28. representations are described below.
  29. _______ _______ integer The integers are also called "fixed" numbers. The magnitude
  30. _______ of integers is essentially unrestricted if the "big number"
  31. _______ module, BIG, is loaded (LOAD BIG). The notation for integers
  32. is a sequence of digits in an appropriate radix (radix 10 is
  33. the default, which can be overridden by a radix prefix, such
  34. as 2#, 8#, 16# etc). There are three internal
  35. _______ representations of integers, chosen to suit the
  36. implementation:
  37. ____ ______ ____ ____ inum A signed number fitting into info. Inums do not
  38. require dynamic storage and are represented in the Data Types 7 February 1983 PSL Manual
  39. page 4.2 section 4.1
  40. same form as machine integers. (19 bit [-2^18 ...
  41. 2^18 - 1] on the DEC-20, 28 bit on the VAX.)
  42. ______ ____ _______ fixnum A full-word signed integer, allocated in the heap.
  43. (36 bit on the DEC-20, fitting into a register; 32
  44. bit on the VAX.)
  45. [??? Do we need fixnums, and if yes how large [??? Do we need fixnums, and if yes how large [??? Do we need fixnums, and if yes how large
  46. ???] ???] ???]
  47. ______ _______ bignum A signed integer of arbitrary precision, allocated
  48. _______ ______ as a vector of integers. Bignums are currently not
  49. installed by default; to use them, do (LOAD BIG).
  50. _____ ________ _____ float A floating point number, allocated in the heap. The
  51. _____ precision of floats is determined solely by the
  52. implementation, and is 72-bit double precision on the DEC-20,
  53. _____ 64-bit on the VAX. The notation for a float is a sequence of
  54. digits with the addition of a single floating point ( . ) and
  55. optional exponent (E <integer>). (No spaces may occur
  56. between the point and the digits). Radix 10 is used for
  57. representing the mantissa and the exponent of dty(floating
  58. point) numbers.
  59. __ __________ __ ____ id An identifier (or id) is an item whose info field points to a
  60. five-item structure containing the print name, property cell,
  61. value cell, function cell, and package cell. This structure
  62. __ is contained in the id space. The notation for an id is its
  63. print name, an alphanumeric character sequence starting with
  64. __ a letter. One always refers to a particular id by giving its
  65. print name. When presented with an appropriate print name,
  66. __ the PSL reader will find a unique id to associate with it.
  67. __ See Chapters 6 and 12 for more information on ids and their
  68. __ syntax. NIL and T are treated as special ids in PSL.
  69. ____ ____ pair A primitive two-item structure which has a left and right
  70. ___ ________ part. A notation called dot-notation is used, with the form:
  71. (<left-part> . <right-part>). The <left-part> is known as
  72. Car Cdr Car Cdr the Car portion and the <right-part> as the Cdr portion. The
  73. ____ parts may be any item. (Spaces are used to resolve ambiguity
  74. _____ with floats; see Chapter 12).
  75. ______ ____ _______ vector A primitive uniform structure of items; an integer index is
  76. used to access random values in the structure. The
  77. ______ ___ ____ individual elements of a vector may be any item. Access to
  78. ______ vectors is by means of functions for indexing, sub-vector
  79. extraction and concatenation, defined in Section 8.3. In the
  80. ______ ______ notation for vectors, the elements of a vector are surrounded
  81. ____ ____ ____ by square brackets: [item-0 item-1 ... item-n].
  82. ______ ______ ______ string A packed vector (or byte vector) of characters; the elements
  83. _______ are small integers representing the ASCII codes for the PSL Manual 7 February 1983 Data Types
  84. section 4.1 page 4.3
  85. ____ characters (usually inums). The elements may be accessed by
  86. indexing, substring and concatenation functions, defined in
  87. ______ Chapter 8. String notation consists of a series of
  88. characters enclosed in double quotes, as in "THIS IS A
  89. STRING". A quote is included by doubling it, as in "HE SAID,
  90. ______ ""LISP""". (Input strings may cross the end-of-line
  91. boundary, but a warning is given.) See !*EOLINSTRINGOK in
  92. chapter 12.
  93. ____ ______ ______ ____ word-vector A vector of machine-sized words, used to implement such
  94. ______ ______ things as fixnums, bignums, etc. The elements are not
  95. ____ considered to be items, and are not examined by the garbage
  96. collector.
  97. ____ ______ ____ ______ ____ ______ [??? The word-vector could be used to implement [??? The word-vector could be used to implement [??? The word-vector could be used to implement
  98. machine-code blocks on some machines. ???] machine-code blocks on some machines. ???] machine-code blocks on some machines. ???]
  99. ____ ______ ______ ____ ______ Byte-Vector A vector of bytes. Internally a byte-vector is the same as a
  100. ______ string, but it is printed differently as a vector of integers
  101. instead of characters.
  102. ________ ______ Halfword-Vector
  103. ______ A vector of machine-sized halfwords.
  104. ____ _______ ____ code-pointer This item is used to refer to the entry point of compiled
  105. _____ ______ ______ _____ ______ ______ _____ ______ ______ exprs fexprs macros exprs fexprs macros functions (exprs, fexprs, macros, etc.), permitting compiled
  106. functions to be renamed, passed around anonymously, etc. New
  107. Lap Fasl ____ _______ Lap Fasl code-pointers are created by the loader (Lap,Fasl) and
  108. associated functions. They can be printed; the printing
  109. function prints the number of arguments expected as well as
  110. the entry point. The value appears in the convention of the
  111. implementation (#<Code a nnnn> on the DEC-20 and VAX, where a
  112. is the number of arguments and nnnn is the entry point).
  113. ___ ___ ___ [not ___ _______ [not env-pointer A data type used to support a funarg capability. [not
  114. ___________ ___ ___________ ___ ___________ ___ implemented yet] implemented yet] implemented yet]
  115. 4.1.2. Other Notational Conventions 4.1.2. Other Notational Conventions 4.1.2. Other Notational Conventions
  116. Certain functional arguments can be any of a number of types. For
  117. convenience, we give these commonly used sets a name. We refer to these
  118. sets as "classes" of primitive data types. In addition to the types
  119. described above and the names for classes of types given below, we use the
  120. following conventions in the manual. {XXX, YYY} indicates that either data
  121. type XXX or data type YYY will do. {XXX}-{YYY} indicates that any object
  122. of type XXX can be used except those of type YYY; in this case, YYY is a
  123. _______ _____ subset of XXX. For example, {integer, float} indicates that either an
  124. _______ _____ ___ ______ integer or a float is acceptable; {any}-{vector} means any type except a
  125. ______ vector. Data Types 7 February 1983 PSL Manual
  126. page 4.4 section 4.1
  127. ___ _ __________ any Any of the types given above. S-expression is another term
  128. ___ for any. All PSL entities have some value unless an error
  129. occurs during evaluation.
  130. ____ ___ ____ atom The class {any}-{pair}.
  131. _______ boolean The class of global variables {T, NIL}, or their respective
  132. values, {T, NIL}. (See Chapter 6.7).
  133. _________ _______ character Integers in the range of 0 to 127 representing ASCII
  134. character codes. These are distinct from single-character
  135. __ ids.
  136. ________ _______ _____ ______ ______ ____ _______ constant The class of {integer, float, string, vector, code-pointer}.
  137. Eval ________ Eval A constant evaluates to itself (see the definition of Eval
  138. in Chapter 11).
  139. _____ _______ extra-boolean Any value in the system. Anything that is not NIL has the
  140. _______ boolean interpretation T.
  141. _____ __ ftype The class of definable function types. The set of ids
  142. ____ _____ _____ _____ ____ _____ _____ _____ ____ _____ _____ _____ expr fexpr macro nexpr expr fexpr macro nexpr {expr, fexpr, macro, nexpr}.
  143. _____ __________ The ftype is ONLY an attribute of identifiers, and is not
  144. ____ _______ associated with either executable code (code-pointers) or
  145. ______ lambda expressions.
  146. __ _______ _______ io-channel A small integer representing an io channel.
  147. ______ _______ _____ number The class of {integer, float}.
  148. _ ______ ______ ______ ______ ____ ______ x-vector Any kind of vector; i.e. a string, vector, word-vector, or
  149. ____ word.
  150. _________ Undefined An implementation-dependent value returned by some low-level
  151. functions; i.e. the user should not depend on this value.
  152. ____ ________ None Returned A notational convenience used to indicate control functions
  153. that do not return directly to the calling point, and hence
  154. Go Go do not return a value. (e.g. Go)
  155. 4.1.3. Structures 4.1.3. Structures 4.1.3. Structures
  156. ____ ____ Structures are entities created using pairs. Lists are structures very
  157. ____ commonly required as parameters to functions. If a list of homogeneous
  158. ____ entities is required by a function, this class is denoted by xxx-list, in
  159. ____ which xxx is the name of a class of primitives or structures. Thus a list
  160. __ __ ____ ____ _______ _______ ____ of ids is an id-list, a list of integers is an integer-list, and so on.
  161. ____ ____ ____ ___ ____ list A list is recursively defined as NIL or the pair (any . list). A
  162. ____ ________ ____ special notation called list-notation is used to represent lists.
  163. List-notation eliminates the extra parentheses and dots required
  164. by dot-notation, as illustrated below. List-notation and
  165. dot-notation may be mixed, as shown in the second and third
  166. examples. (See section 3.3.3.)
  167. ____________ _____________ dot-notation list-notation
  168. (a . (b . (c . NIL))) (a b c)
  169. (a . (b . c)) (a b . c)
  170. (a . ((b . c) . (d . NIL))) PSL Manual 7 February 1983 Data Types
  171. section 4.1 page 4.5
  172. Note: () is an alternate input representation of NIL.
  173. _ ____ _ ____ ___________ ____ a-list An a-list, or association list, is a list in which each element
  174. Car ____ Car is a pair, the Car part being a key associated with the value in
  175. Cdr Cdr the Cdr part.
  176. ____ ____ form A form is an S-expression (any) which is legally acceptable to
  177. Eval Eval Eval; that is, it is syntactically and semantically accepted by
  178. the interpreter or the compiler. (See Chapter 11 for more
  179. details.)
  180. ______ lambda A lambda expression must have the form (in list-notation):
  181. __ ____ (LAMBDA parameters . body). "Parameters" is an id-list of
  182. ____ formal parameters for "body", which is a form to be evaluated
  183. ProgN ProgN (note the implicit ProgN). The semantics of the evaluation are
  184. Eval Eval defined by the Eval function (see chapter 11).
  185. ________ ______ ____ _______ function A lambda, or a code-pointer. A function is always evaluated as
  186. Eval Spread Eval Spread Eval, Spread.
  187. 4.2. Predicates Useful with Data Types 4.2. Predicates Useful with Data Types 4.2. Predicates Useful with Data Types
  188. Most functions in this Section return T if the condition defined is met
  189. and NIL if it is not. Exceptions are noted. Defined are type-checking
  190. functions and elementary comparisons.
  191. 4.2.1. Functions for Testing Equality 4.2.1. Functions for Testing Equality 4.2.1. Functions for Testing Equality
  192. Functions for testing equality are listed below. For other functions
  193. comparing arithmetic values see Chapter 5.
  194. Eq Eq _ ___ _ ___ _______ ____ ________ ____ (Eq U:any V:any): boolean open-compiled, expr
  195. _ _ Returns T if U points to the same object as V, i.e. if they are
  196. Eq ____ Eq ___ identical items. Eq is not a reliable comparison between numeric
  197. arguments. This function should only be used in special
  198. Equal Equal circumstances. Normally, equality should be tested with Equal,
  199. described below.
  200. EqN EqN _ ___ _ ___ _______ ____ (EqN U:any V:any): boolean expr
  201. Eq _ _ Eq _ _ Returns T if U and V are Eq or if U and V are numbers and have
  202. the same value and type.
  203. [??? Should numbers of different type be EqN? e.g. 0 vs. 0.0 [??? Should numbers of different type be EqN? e.g. 0 vs. 0.0 [??? Should numbers of different type be EqN? e.g. 0 vs. 0.0
  204. ???] ???] ???] Data Types 7 February 1983 PSL Manual
  205. page 4.6 section 4.2
  206. Equal Equal _ ___ _ ___ _______ ____ (Equal U:any V:any): boolean expr
  207. _ _ ____ Returns T if U and V are the same. Pairs are compared
  208. ______ recursively to the bottom levels of their trees. Vectors must
  209. Equal Equal have identical dimensions and Equal values in all positions.
  210. ______ Strings must have identical characters, i.e. all characters must
  211. Eq ____ _______ Eq be of the same case. Code-pointers must have Eq values. Other
  212. Eqn ____ Eqn atoms must be Eqn equal. A usually valid heuristic is that if
  213. Print Print two objects look the same if printed with the function Print,
  214. Equal Equal Equal ____ Equal they are Equal. If one argument is known to be an atom, Equal is
  215. Eq Eq open-compiled as Eq.
  216. For example, if
  217. (Setq X '(A B C)) and (Setq Y X) have been executed, then
  218. (EQ X Y) is T
  219. (EQ X '(A B C)) is NIL
  220. (EQUAL X '(A B C)) is T
  221. (EQ 1 1) is T
  222. (EQ 1.0 1.0) is NIL
  223. (EQN 1.0 1.0) is T
  224. (EQN 1 1.0) is NIL
  225. (EQUAL 0 0.0) is NIL
  226. Neq Neq _ ___ _ ___ _______ _____ (Neq U:any V:any): boolean macro
  227. Not Equal Not Equal _ _ (Not (Equal U V)).
  228. Ne Ne _ ___ _ ___ _______ ____ ________ ____ (Ne U:any V:any): boolean open-compiled, expr
  229. Not Eq Not Eq _ _ (Not (Eq U V)).
  230. EqStr EqStr _ ___ _ ___ _______ ____ (EqStr U:any V:any): boolean expr
  231. ______ Compare two strings, for exact (Case sensitive) equality. For
  232. case-INsensitive equality one must load the STRINGS module (see
  233. EqStr Eq EqStr _ _ Eq _ _ Section 8.7). EqStr returns T if U and V are Eq or if U and V
  234. are equal strings.
  235. EqCar EqCar _ ___ _ ___ _______ ____ (EqCar U:any V:any): boolean expr
  236. Eq Car Eq Car _ _ Tests whether (Eq (Car U) V)). If the first argument is not a
  237. EqCar EqCar pair, EqCar returns NIL. PSL Manual 7 February 1983 Data Types
  238. section 4.2 page 4.7
  239. 4.2.2. Predicates for Testing the Type of an Object 4.2.2. Predicates for Testing the Type of an Object 4.2.2. Predicates for Testing the Type of an Object
  240. Atom Atom _ ___ _______ ____ ________ ____ (Atom U:any): boolean open-compiled, expr
  241. _ ____ Returns T if U is not a pair.
  242. CodeP CodeP _ ___ _______ ____ ________ ____ (CodeP U:any): boolean open-compiled, expr
  243. _ ____ _______ Returns T if U is a code-pointer.
  244. ConstantP ConstantP _ ___ _______ ____ (ConstantP U:any): boolean expr
  245. _ ________ ____ __ Returns T if U is a constant (that is, neither a pair nor an id).
  246. ______ ________ Note that vectors are considered constants.
  247. [??? Should Eval U Eq U if U is a constant? ???] [??? Should Eval U Eq U if U is a constant? ???] [??? Should Eval U Eq U if U is a constant? ???]
  248. FixP FixP _ ___ _______ ____ ________ ____ (FixP U:any): boolean open-compiled, expr
  249. _ _______ Returns T if U is an integer. If BIG is loaded, this function
  250. also returns T for bignums.
  251. FloatP FloatP _ ___ _______ ____ ________ ____ (FloatP U:any): boolean open-compiled, expr
  252. _ _____ Returns T if U is a float.
  253. IdP IdP _ ___ _______ ____ ________ ____ (IdP U:any): boolean open-compiled, expr
  254. _ __ Returns T if U is an id.
  255. Null Null _ ___ _______ ____ ________ ____ (Null U:any): boolean open-compiled, expr
  256. Not _ Not Returns T if U is NIL. This is exactly the same function as Not,
  257. defined in Section 4.2.3. Both are available solely to increase
  258. readability.
  259. NumberP NumberP _ ___ _______ ____ ________ ____ (NumberP U:any): boolean open-compiled, expr
  260. _ ______ _______ _____ Returns T if U is a number (integer or float). Data Types 7 February 1983 PSL Manual
  261. page 4.8 section 4.2
  262. PairP PairP _ ___ _______ ____ ________ ____ (PairP U:any): boolean open-compiled, expr
  263. _ ____ Returns T if U is a pair.
  264. StringP StringP _ ___ _______ ____ ________ ____ (StringP U:any): boolean open-compiled, expr
  265. _ ______ Returns T if U is a string.
  266. VectorP VectorP _ ___ _______ ____ ________ ____ (VectorP U:any): boolean open-compiled, expr
  267. _ ______ Returns T if U is a vector.
  268. 4.2.3. Boolean Functions 4.2.3. Boolean Functions 4.2.3. Boolean Functions
  269. Boolean functions return NIL for "false"; anything non-NIL is taken to be
  270. true, although a conventional way of representing truth is as T. Note that
  271. T always evaluates to itself. NIL may also be represented as '(). The
  272. And Or Not And Or Not Boolean functions And, Or, and Not can be applied to any LISP type, and are
  273. And Or And Or not bitwise functions. And and Or are frequently used in LISP as control
  274. structures as well as Boolean connectives (see Section 9.2). For example,
  275. the following two constructs will give the same result:
  276. (COND ((AND A B C) D))
  277. (AND A B C D)
  278. Since there is no specific Boolean type in LISP and since every LISP
  279. expression has a value which may be used freely in conditionals, there is
  280. no hard and fast distinction between an arbitrary function and a Boolean
  281. function. However, the three functions presented here are by far the most
  282. useful in constructing more complex tests from simple predicates.
  283. Not Not _ ___ _______ ____ ________ ____ (Not U:any): boolean open-compiled, expr
  284. _ Returns T if U is NIL. This is exactly the same function as
  285. Null Null Null, defined in Section 4.2.2. Both are available solely to
  286. increase readability.
  287. And And _ ____ _____ _______ ____ ________ _____ (And [U:form]): extra-boolean open-compiled, fexpr
  288. And And _ And evaluates each U until a value of NIL is found or the end of
  289. ____ the list is encountered. If a non-NIL value is the last value,
  290. And And it is returned; otherwise NIL is returned. Note that And called
  291. with zero arguments returns T. PSL Manual 7 February 1983 Data Types
  292. section 4.2 page 4.9
  293. Or Or _ ____ _____ _______ ____ ________ _____ (Or [U:form]): extra-boolean open-compiled, fexpr
  294. _ U is any number of expressions which are evaluated in order of
  295. their appearance. If one is found to be non-NIL, it is returned
  296. Or Or as the value of Or. If all are NIL, NIL is returned. Note that
  297. Or Or if Or is called with zero arguments, it returns NIL.
  298. 4.3. Converting Data Types 4.3. Converting Data Types 4.3. Converting Data Types
  299. The following functions are used in converting data items from one type
  300. to another. They are grouped according to the type returned. Numeric
  301. Fix Float Fix Float types may be converted using functions such as Fix and Float, described in
  302. Section 5.2.
  303. Intern Intern _ __ ______ __ ____ (Intern U:{id,string}): id expr
  304. Intern ______ __ Intern __ ____ _____ Converts string to id. Intern searches the id-hash-table (or
  305. __ ____ _____ __ current id-hash-table if the package system is loaded) for an id
  306. _ __ with the same print name as U and returns the id on the
  307. __ ____ _____ id-hash-table if a match is found. (See Chapter 6 for a
  308. __ ____ _____ discussion of the id-hash-table. Any properties and GLOBAL values
  309. _ _ associated with the uninterned U are lost. If U does not match
  310. _ any entry, a new one is created and returned. If U has more than
  311. the maximum number of characters permitted by the implementation
  312. (???), an error is signalled:
  313. ***** Too many characters to INTERN
  314. [??? Rewrite for package system; include search path, global, [??? Rewrite for package system; include search path, global, [??? Rewrite for package system; include search path, global,
  315. local, intern, etc. See Chapter 6. ???] local, intern, etc. See Chapter 6. ???] local, intern, etc. See Chapter 6. ???]
  316. The maximum number of characters in any token is 5000.
  317. NewId NewId _ ______ __ ____ (NewId S:string): id expr
  318. __ _____ ____ Allocates a new uninterned id, and sets its print-name to the
  319. ______ _ ______ ___ string S. The string is not copied.
  320. (Setq New (NewId "NEWONE")) returns NEWONE
  321. __ Note that if one refers directly to the id NEWONE, it will become
  322. interned and a new position in the id space will be allocated to
  323. __ __ it. One has to refer to the new id indirectly through the id
  324. New. Data Types 7 February 1983 PSL Manual
  325. page 4.10 section 4.3
  326. Int2Id Int2Id _ _______ __ ____ (Int2Id I:integer): id expr
  327. _______ __ _ __ Converts an integer to an id; this refers to the I'th id in the
  328. Int2Id __ Int2Id id space. Since 0 ... 127 correspond to ASCII characters, Int2Id
  329. with an argument in this range converts an ASCII code to the
  330. __ corresponding single character id.
  331. (Int2Id 250) returns QUOTIENT
  332. Id2Int Id2Int _ __ _______ ____ (Id2Int D:id): integer expr
  333. __ _ _______ Returns the id space position of D as a LISP integer.
  334. (Id2Int 'String) returns 182
  335. Id2String Id2String _ __ ______ ____ (Id2String D:id): string expr
  336. Id2String Print __ Id2String Print Get name from id space. Id2String returns the Print name of its
  337. ______ argument as a string. This is not a copy, so destructive
  338. CopyString CopyString operations should not be performed on the result. See CopyString
  339. in Chapter 8.
  340. [??? Should it be a copy? ???] [??? Should it be a copy? ???] [??? Should it be a copy? ???]
  341. (Id2String 'String) returns "STRING"
  342. String2List String2List _ ______ ____ ____ ____ (String2List S:string): inum-list expr
  343. Length Add1 Size ____ Length Add1 Size _ Creates a list of Length (Add1 (Size S)), converting the ASCII
  344. _______ characters into small integers.
  345. [??? What of 0/1 base for length vs length -1. What of the [??? What of 0/1 base for length vs length -1. What of the [??? What of 0/1 base for length vs length -1. What of the
  346. NUL char added ???] NUL char added ???] NUL char added ???]
  347. (String2List "STRING") returns (83 84 82 73 78 71)
  348. List2String List2String _ ____ ____ ______ ____ (List2String L:inum-list): string expr
  349. Size ______ Size _ ____ Allocates a string of the same Size as L, and converts inums to
  350. ____ characters according to their ASCII code. The inums must be in
  351. the range 0 ... 127.
  352. [??? Check if 0 ... 127, and signal error ???] [??? Check if 0 ... 127, and signal error ???] [??? Check if 0 ... 127, and signal error ???]
  353. (List2String '(83 84 82 73 78 71)) returns "STRING" PSL Manual 7 February 1983 Data Types
  354. section 4.3 page 4.11
  355. String String _ ____ ______ _____ (String [I:inum]): string nexpr
  356. ______ ____ Creates and returns a string containing all the inums given.
  357. (String 83 84 82 73 78 71) returns "STRING"
  358. Vector Vector _ ___ ______ _____ (Vector [U:any]): vector nexpr
  359. ______ _ Creates and returns a vector containing all the Us given.
  360. (Setq X (Vector 83 84 82 73 78 71)) returns
  361. [83 84 82 73 78 71]
  362. Vector2String Vector2String _ ______ ______ ____ (Vector2String V:vector): string expr
  363. _______ ______ ______ Pack the small integers in the vector into a string of the same
  364. Size Size _______ Size, using the integers as ASCII values.
  365. [??? check for integer in range 0 ... 127 ???] [??? check for integer in range 0 ... 127 ???] [??? check for integer in range 0 ... 127 ???]
  366. (Vector2String X) where X is defined as above returns
  367. "STRING"
  368. String2Vector String2Vector _ ______ ______ ____ (String2Vector S:string): vector expr
  369. Size ______ ______ Size Unpack the string into a vector of the same Size. The elements
  370. ______ of the vector are small integers, representing the ASCII values
  371. _ of the characters in S.
  372. (String2Vector "VECTOR") returns [V E C T O R]
  373. Vector2List Vector2List _ ______ ____ ____ (Vector2List V:vector): list expr
  374. Size Length Upbv ____ Size _ Length Upbv _ Create a list of the same Size as V (i.e. of Length Upbv(V)+1),
  375. Upbv Upbv _ copying the elements in order 0, 1, ..., Upbv(V).
  376. (Vector2List [L I S T]) returns (L I S T)
  377. List2Vector List2Vector _ ____ ______ ____ (List2Vector L:list): vector expr
  378. Size ____ ______ Size Copy the elements of the list into a vector of the same Size.
  379. (List2Vector '(V E C T O R)) returns [V E C T O R]