Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| teaching:cc4101:tareas:2023-1:tarea2:parte3 [2023/05/11 16:38] – [3.1 Modificadores] tvallejos | teaching:cc4101:tareas:2023-1:tarea2:parte3 [2023/05/11 16:50] (current) – [Parte 3. Estrategias de evaluación (2 ptos.)] tvallejos | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| La extensión de SL consiste en agregar // | La extensión de SL consiste en agregar // | ||
| <code scheme> | <code scheme> | ||
| - | ;; La función | + | ;; Una función de tipo Num -> Num significa |
| - | > (run-p-sl '{with {f {fun {Num -> Num} {x} {+ x x}}} | + | > (run-p-sl '{with {f {fun {x : Num} -> Num : {+ x x}}} |
| {f {printn 10}}}) | {f {printn 10}}}) | ||
| (result 20 ' | (result 20 ' | ||
| - | ;; La función | + | ;; Una función |
| - | > (run-p-sl '{with {f {fun {{lazy Num} -> Num} {x} {+ x x}}} | + | > (run-p-sl '{with {f {fun {x : {lazy Num}} -> Num : {+ x x}}} |
| {f {printn 10}}}) | {f {printn 10}}}) | ||
| (result 20 ' | (result 20 ' | ||
| - | ;; La función | + | ;; Una función |
| - | > (run-p-sl '{with {f {fun {{name Num} -> Num} {x} {+ x x}}} | + | > (run-p-sl '{with {f {fun {x : {name Num}} -> Num : {+ x x}}} |
| {f {printn 10}}}) | {f {printn 10}}}) | ||
| (result 20 ' | (result 20 ' | ||
| ;; Otro ejemplo de lazy. Note que efectivamente al evaluarla se comporta correctamente. | ;; Otro ejemplo de lazy. Note que efectivamente al evaluarla se comporta correctamente. | ||
| - | > (run-p-sl '{with {f {fun {{lazy Num} -> Num} {x} 1}} | + | > (run-p-sl '{with {f {fun {x : {lazy Num} -> Num : 1}}} |
| {f {printn 10}}}) | {f {printn 10}}}) | ||
| (result 1 ' | (result 1 ' | ||

