Symbols.html (3919B)
1 <html lang="en"> 2 <head> 3 <title>Symbols - klisp Reference Manual</title> 4 <meta http-equiv="Content-Type" content="text/html"> 5 <meta name="description" content="klisp Reference Manual"> 6 <meta name="generator" content="makeinfo 4.13"> 7 <link title="Top" rel="start" href="index.html#Top"> 8 <link rel="prev" href="Equivalence.html#Equivalence" title="Equivalence"> 9 <link rel="next" href="Control.html#Control" title="Control"> 10 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11 <meta http-equiv="Content-Style-Type" content="text/css"> 12 <style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22 --></style> 23 <link rel="stylesheet" type="text/css" href="css/style.css"> 24 </head> 25 <body> 26 <div class="node"> 27 <a name="Symbols"></a> 28 <p> 29 Next: <a rel="next" accesskey="n" href="Control.html#Control">Control</a>, 30 Previous: <a rel="previous" accesskey="p" href="Equivalence.html#Equivalence">Equivalence</a>, 31 Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 32 <hr> 33 </div> 34 35 <!-- node-name, next, previous, up --> 36 <h2 class="chapter">5 Symbols</h2> 37 38 <p><a name="index-symbols-23"></a><!-- TODO add xref to eq?, identifiers, etc --> 39 Two symbols are eq? iff they have the same external 40 representation. Symbols are immutable, and the symbol type is 41 encapsulated. The external representations of symbols are usually 42 identifiers. However, symbols with other external representations may 43 <!-- TODO add xref to string->symbol --> 44 be created. Symbols whose external representation is enclosed within 45 “|” (that is “| ... |”) can contain any character supported by 46 klisp, “|” and “\” can be included by escaping them with a leading 47 “\” (that is “\|” and “\\”). Characters in symbols can also be 48 specified with a unicode hex escape by using the syntax “\x<hex 49 codepoint>;”. This works whether using the “| ... |” syntax or 50 not. 51 52 <div class="defun"> 53 — Applicative: <b>symbol?</b> (<var>symbol? . objects</var>)<var><a name="index-symbol_003f-24"></a></var><br> 54 <blockquote><p> The primitive type predicate for type symbol. <code>symbol?</code> 55 returns true iff all the objects in <code>objects</code> are of type symbol. 56 </p></blockquote></div> 57 58 <div class="defun"> 59 — Applicative: <b>symbol->string</b> (<var>symbol->string symbol</var>)<var><a name="index-symbol_002d_003estring-25"></a></var><br> 60 <blockquote><p> Applicative <code>symbol->string</code> returns the name of <code>symbol</code> 61 as a string. The string returned is immutable. 62 </p></blockquote></div> 63 64 <div class="defun"> 65 — Applicative: <b>string->symbol</b> (<var>string->symbol string</var>)<var><a name="index-string_002d_003esymbol-26"></a></var><br> 66 <blockquote><p> Applicative <code>string->symbol</code> returns the symbol with name 67 <code>string</code>. The symbol is always interned, which means, that it is 68 always the case that: 69 <pre class="example"> (eq? <symbol> (string->symbol (symbol->string <symbol>))) 70 ⇒ #t 71 </pre> 72 <!-- TODO add xrefs for external representation --> 73 <p><code>string->symbol</code> can create symbols whose external 74 representation aren't identifiers. klisp uses the r7rs external 75 representation for such symbols and so all symbols can be written and 76 read back. 77 </p></blockquote></div> 78 79 <!-- *-texinfo-*- --> 80 </body></html> 81