WolframLang: Rule

By Xah Lee. Date: . Last updated: .

A rule in WolframLang is a pair of values. It is used in:

Rule[lhs,rhs]
(Short syntax: lhs -> rhs)

A pair of values, with left-hand-side lhs and right-hand-side rhs

Both lhs and rhs is evaluated at the time the rule is defined.

Rule
ReplaceAll[ {a, b, c} , x_ -> x+1]
=== {1 + a, 1 + b, 1 + c}
RuleDelayed[lhs,rhs]
(Short syntax: lhs :> rhs)

Same as Rule, but rhs is evaluated at the time the transformation happens.

RuleDelayed

Pattern Matching

WolframLang in Depth

Basics

Comment, Print

String

Arithmetic

List

Expression, Atom, Head

Boolean

Conditional

Variable

Loop

Data Structure

Function

Pattern Matching

Advanced

Shell Tasks

Misc