Syntax sugar (Pipe-calculus): Difference between revisions

Tags: Mobile edit Mobile web edit
Line 14: Line 14:
\def\out{!}
\def\out{!}
\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 = 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>.  
<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 . t)~s</math>. Using 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 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