Skip to content

Commit 18ebd21

Browse files
committed
El entorno
1 parent 08b8a2d commit 18ebd21

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

12_language.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ JavaScript no válido.
196196

197197
{{index "parseApply function"}}
198198

199-
Luego cortamos la parte que coincidio del string del programa y
199+
Luego cortamos la parte que coincidió del string del programa y
200200
pasamos eso, junto con el objeto para la expresión, a `aplicarAnalisis`,
201201
el cual verifica si la expresión es una aplicación. Si es así,
202202
analiza una lista de los argumentos entre paréntesis.
@@ -443,9 +443,9 @@ specialForms.define = (args, scope) => {
443443
};
444444
```
445445

446-
## The environment
446+
## El entorno
447447

448-
{{index "Egg language", "evaluate function"}}
448+
{{index "lenguaje Egg", "evaluar función"}}
449449

450450
The ((scope)) accepted by `evaluate` is an object with properties
451451
whose names correspond to binding names and whose values correspond to
@@ -572,22 +572,22 @@ specialForms.fun = (args, scope) => {
572572
};
573573
```
574574

575-
{{index "local scope"}}
575+
{{index "ámbito local"}}
576576

577-
Functions in Egg get their own local scope. The function produced by
578-
the `fun` form creates this local scope and adds the argument bindings
579-
to it. It then evaluates the function body in this scope and returns
580-
the result.
577+
Las funciones en Egg tienen su propio ámbito local. La función producida
578+
por la forma `fun` crea este entorno local y agrega las asociaciones de
579+
argumentos a este. Entonces evalúa el cuerpo de la función en este ámbito
580+
y regresa el resultado.
581581

582582
```{startCode: true}
583583
run(`
584-
hacer(definir(plusOne, fun(a, +(a, 1))),
584+
do(define(plusOne, fun(a, +(a, 1))),
585585
imprimir(plusOne(10)))
586586
`);
587587
// → 11
588588
589589
run(`
590-
hacer(definir(pow, fun(base, exp,
590+
do(define(pow, fun(base, exp,
591591
si(==(exp, 0),
592592
1,
593593
*(base, pow(base, -(exp, 1)))))),
@@ -713,14 +713,14 @@ topScope.length = "...";
713713
topScope.element = "...";
714714
715715
run(`
716-
hacer(definir(sum, fun(array,
717-
hacer(definir(i, 0),
718-
definir(sum, 0),
716+
do(define(sum, fun(array,
717+
do(define(i, 0),
718+
define(sum, 0),
719719
while(<(i, length(array)),
720-
hacer(definir(sum, +(sum, element(array, i))),
721-
definir(i, +(i, 1)))),
720+
do(define(sum, +(sum, element(array, i))),
721+
define(i, +(i, 1)))),
722722
sum))),
723-
imprimir(sum(array(1, 2, 3))))
723+
print(sum(array(1, 2, 3))))
724724
`);
725725
// → 6
726726
```
@@ -758,8 +758,8 @@ binding `a`.
758758

759759
```
760760
run(`
761-
hacer(definir(f, fun(a, fun(b, +(a, b)))),
762-
imprimir(f(4)(5)))
761+
do(define(f, fun(a, fun(b, +(a, b)))),
762+
print(f(4)(5)))
763763
`);
764764
// → 9
765765
```

0 commit comments

Comments
 (0)