WolframLang: Symbol

By Xah Lee. Date: . Last updated: .

What is a Symbol

A symbol in WolframLang is similar to identifiers (e.g. variable names and function names) in other programing languages. But can be held unevaluated, just as a inert name by itself, like a string. It need not have a value. (it is like lisp's symbol. 〔see Elisp: Symbol〕)

Any sequence of letters you type into wolfram lang become symbols.

For example:

xx = {3, 4, b + 1}
(* {3, 4, 1 + b} *)

(* 
xx and b are symbols.
b has  no value. *)

(* set a value for b *)
b = 99
(* 99 *)

xx
(* {3, 4, 100} *)
(* b now has value. *)

WolframLang code is essentially a sequence of symbols and operators, such as , [] () + - * / # & etc. 〔see WolframLang: Syntax, Operators Cheatsheet

Some of the symbols, builtin or user-defined, has value. When a symbol has a value, the value automatically replaces the symbol. (or the function's return value replaces it.) This constitutes the heart of WolframLang computational model, a term-rewriting system.

Create Symbol Programatically (Convert String to Symbol)

Symbol[nameStr]

Create a symbol and return it, if not already exist.

Symbol

Convert Symbol to String

SymbolName[symbol]

return the symbol name, as string.

SymbolName

List Existing Symbols

Names[globPatternStr]

List existing symbols. The pattern string can include a asterisk to stand for any char or none.

Names

(* list all symbols whose name contains String *)
Names["*String*"]

Remove a symbol

Clear a Symbol's Value

Check If a Symbol Has Value

WolframLang Syntax