Skip to content

Commit

Permalink
Merge pull request #14 from jrincayc/fix_9
Browse files Browse the repository at this point in the history
Fix 9: lamda definition
  • Loading branch information
jrincayc authored Sep 11, 2022
2 parents acbe88e + a9fa09f commit 5403ce8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
19 changes: 7 additions & 12 deletions expr.tex
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,11 @@ \subsection{Procedures}\unsection
procedure. When the procedure is later called with some actual
arguments, the environment in which the \lambdaexp{} was evaluated will
be extended by binding the variables in the formal argument list to
fresh locations, and the corresponding actual argument values will be stored
in those locations.
(A \defining{fresh} location is one that is distinct from every previously
existing location.)
Next, the expressions in the
the corresponding actual argument values.
Next, the definitions and expression in the
body of the lambda expression
will be evaluated sequentially in the extended environment.
The results of the last expression in the body will be returned as
The results of the expression in the body will be returned as
the results of the procedure call.

\begin{scheme}
Expand All @@ -164,14 +161,12 @@ \subsection{Procedures}\unsection
\begin{itemize}
\item {\tt(\hyperi{variable} \dotsfoo)}:
The procedure takes a fixed number of arguments; when the procedure is
called, the arguments will be stored in fresh locations
that are bound to the corresponding variables.
called, the arguments will be bound to the corresponding variables.

\item \hyper{variable}:
The procedure takes any number of arguments; when the procedure is
called, the sequence of actual arguments is converted into a newly
allocated list, and the list is stored in a fresh location
that is bound to
allocated list, and the list is bound to
\hyper{variable}.

\end{itemize}
Expand Down Expand Up @@ -330,8 +325,8 @@ \subsection{Binding constructs}

\semantics
The \hyper{init}s are evaluated in the current environment (in some
unspecified order), the \hyper{variable}s are bound to fresh locations
holding the results, the \hyper{body} is evaluated in the extended
unspecified order), the \hyper{variable}s are bound to
the results, the \hyper{body} is evaluated in the extended
environment, and the values of the last expression of \hyper{body}
are returned. Each binding of a \hyper{variable} has \hyper{body} as its
region.\mainindex{region}
Expand Down
3 changes: 1 addition & 2 deletions first.tex
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ \subsection*{Acknowledgments}

The subset of Scheme in
{\em The Little Schemer}~\cite{LittleSchemer} provided inspiration for
Pico Scheme. We would like to thank Masanori Ogino, Wolfgang Corcoran-Mathe and
John Cowan
Pico Scheme. We would like to thank Masanori Ogino, Wolfgang Corcoran-Mathe, José Bollo and John Cowan
for help with the Pico Scheme Report.


Expand Down
6 changes: 4 additions & 2 deletions sem.tex
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ \subsection{Semantic functions}
\begin{semfun}
\Esem\sembrack{\hbox{\texttt{(lambda (\arbno{\I}) \arbno{\D} $\E_0$)}}} =$\\
\go{1}\=$\lambda\rho\:.\:(\lambda\arbno{\epsilon}\:.\:\#\arbno{\epsilon} = \#{\arbno{\I}}\rightarrow$\\
\>\go{1}$(\Esem\sembrack{E_0})((tiedecs\:(extends\:\rho\:\arbno{\I}\:\arbno{\epsilon})\:\Dsem\sembrack{\arbno{\D}})),$\\
\>\go{1}$(\Esem\sembrack{E_0})(tiedecs\:$\=$(extends\:\rho\:\arbno{\I}\:\arbno{\epsilon})$\\
\>\>$\Dsem\sembrack{\arbno{\D}}),$\\
\>\go{1}$ \wrong{wrong number of arguments})
\end{semfun}
\begin{semfun}
\Esem\sembrack{\hbox{\texttt{(lambda \I \: \arbno{\D} $\E_0$)}}} =$\\
\go{1}\=$\lambda\rho\:.\:(\lambda\arbno{\epsilon}\:.\:(\Esem\sembrack{E_0})((\fun{tiedecs}\:(\rho[\langle\arbno{\epsilon}\rangle/\I])\:\Dsem\sembrack{\arbno{\D}})))
\go{1}\=$\lambda\rho\:.\:(\lambda\arbno{\epsilon}\:.\:(\Esem\sembrack{E_0})(\fun{tiedecs}\:$\=$(\rho[\langle\arbno{\epsilon}\rangle/\I])$\\
\>\>$\Dsem\sembrack{\arbno{\D}}))
\end{semfun}
\begin{semfun}
Expand Down

0 comments on commit 5403ce8

Please sign in to comment.