Strings, like symbols, numbers, lists and other primary types, are the main data type, in operation with which the elementary primitive functions and predicates are used. Besides, strings inherit all set of methods of the parent type true.

Characters and strings

  The string can be divided into characters (char). The character also is a data type. Its objects unlike the atoms which name consists of one sign, are represented in sort


  In this record x is represented by the given record by the character or a word in case of the special character, usually not having printing map. For example:

#\e ; small e
#\T ; big t
#\tab ; tabulation

  Value of the character, as well as for constants, the character is:


  Whether is lisp object the character, it is possible to check up a predicate (nil charp x).
  In string, characters are written one after another for which limitation from both sides as the delimiter sign " is used, for example:

  "It is a string"
  "(2 + 3)"
; the string consisting of one delimiter

  If string to enter into the interpreter as result we will receive the same string. The string cannot represent something, except itself. It is the same constant, as numbers and logical values:

>"It is a string"
"It is a string"
>"(2 + 3)"
"(2 + 3)"
>(nil list "abc" "def")
("abc" "def")
; the list of strings

  The function checking, whether has the object string type, is (nil stringp x) which value will be x if x is a string.

Operation with strings

  In operation with strings functions at least for reading of units of string, change of these units and for matching of two strings are necessary.
  It is possible to read any unit of string with function elt:

  (string elt n)

  Let's give an example:

>("Cat" elt 0) ; indexing starts with 0

  The string unit can be changed by means of assignment function setelt, for example:

>("Cat" setelt 0 #\R)

  Strings can be compared with the help of a predicate =:

  (x = y)

  This predicate checks identity of two strings.

>("Cat" = "cat")
>("Cat" = "Cat")