Content deleted Content added
m →Examples: meaining → meaning |
|||
Line 3:
In the most trivial [[implementation]], they are essentially named [[integer]]s (e.g. the [[enumerated type]] in C).
==
The following [[programming language]]s provide support for symbols:
{| class="wikitable sortable"
Line 37 ⟶ 36:
|}
===
A symbol in [[Lisp (programming language)|Lisp]] is unique in a [[namespace]] (or ''package'' in [[Common Lisp]]). Symbols can be tested for equality with the function EQ. Lisp programs can generate new symbols at runtime. When Lisp reads data that contains textual represented symbols, existing symbols are referenced. If a symbol is unknown, the Lisp reader creates a new symbol.
In
In
Symbols can be interned in a package.<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/t_pkg.htm#package Common Lisp HyperSpec, system class Package]</ref> Keyword symbols are self-evaluating<ref>[[Peter Norvig]]: ''Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp'', Morgan Kaufmann, 1991, ISBN 1-55860-191-0, [http://norvig.com/paip.html Web]</ref> and interned in the package named KEYWORD.
====
The following is a simple external representation of a [[Common Lisp]] symbol:
<source lang="lisp">
Line 58 ⟶ 55:
</source>
In
<source lang="lisp">
:keyword-symbol
Line 74 ⟶ 71:
===Prolog===
In [[Prolog (programming language)|Prolog]], symbols (or atoms) are the primary primitive data types, similar to numbers.<ref name=Bratko2001>{{Cite book | last1 = Bratko | first1 = Ivan | title = Prolog programming for artificial intelligence | year = 2001 | publisher = Addison Wesley | ___location = Harlow, England ; New York | isbn = 0-201-40375-7 | pages = }}</ref> The exact notation may differ in different
Contrary to other languages, it is possible to give symbols some ''meaning'' by creating some
====Examples====
Line 149 ⟶ 146:
</source>
==
<references/>
|