Syntax sugar (Pipe-calculus): Difference between revisions

No edit summary
Line 15: Line 15:
\def\rew{\mathrel{\Rightarrow}\,}
\def\rew{\mathrel{\Rightarrow}\,}
</math>
</math>
<math>\mathsf{let}</math> is a popular construct in functional languages that declares a lexically scoped local variable. It's usual form is <math>\mathsf{let}~x = t~\mathsf{in}~u</math> which denotes binding the name <math>x</math> to the term <math>t</math> in the term <math>u</math>.  
<math>\mathsf{let}</math> is a popular construct in functional languages that declares a lexically scoped local variable. It's usual form is <math>\mathsf{let}~x = s~\mathsf{in}~t</math> which denotes binding the name <math>x</math> to the term <math>s</math> in the term <math>t</math>.  
In lambda calculus <math>\mathsf{let}</math> can be encoded as <math>(\lambda x . u)~t</math>. Applying the ''<math>\beta</math>-rule'' we get <math>u[t/x]</math>, an instance of <math>u</math> where <math>t</math> is substituted for every free occurence of <math>x</math>.
In lambda calculus <math>\mathsf{let}</math> can be encoded as <math>(\lambda x . t)~s</math>. Applying the ''<math>\beta</math>-rule'' we get <math>t[s/x]</math>, an instance of <math>t</math> where <math>s</math> is substituted for every free occurence of <math>x</math>.
In pipe-calculus we can do similar encoding.
In pipe-calculus we can do similar encoding.


283

edits