Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
teaching:cc4101:tareas:2026-1:tarea1b [2026/03/16 05:06] – [Actualizando el AST y Parser] msegurteaching:cc4101:tareas:2026-1:tarea1b [2026/03/16 05:21] (current) – [Parte 3. Contratos en funciones de primer orden (1 pt. de bonus)] msegur
Line 305: Line 305:
   "Static type error: expected Num found Bool" </code> <code scheme>   "Static type error: expected Num found Bool" </code> <code scheme>
   > (typecheck (parse-prog  '{{< 10 #t}}))   > (typecheck (parse-prog  '{{< 10 #t}}))
-  "Static type error: operator < expected Num found Bool"</code> <code scheme>+  "Static type error: expected Num found Bool"</code> <code scheme>
    > (typecheck (parse-prog '{{if 73 #t #t}}))    > (typecheck (parse-prog '{{if 73 #t #t}}))
   "Static type error: expected Bool found Num"</code> <code scheme>   "Static type error: expected Bool found Num"</code> <code scheme>
Line 359: Line 359:
  
 <code scheme> <code scheme>
-{{define {pair-non-zero? {p : {Pair Num Num}}} : Bool {&& {= 0 {fst p}} {= 0 {snd p}}}}+{{define {pair-non-zero? {p : {Pair Num Num}}} : Bool {! {|| {= 0 {fst p}} {= 0 {snd p}}}}}
  {define {pair-div {p : {Pair Num Num} @ pair-non-zero?}} : Num {/ {fst x} {snd x}}}  {define {pair-div {p : {Pair Num Num} @ pair-non-zero?}} : Num {/ {fst x} {snd x}}}
  {+ {pair-div {cons 30 5}} {pair-div {cons 60 0}}}  {+ {pair-div {cons 30 5}} {pair-div {cons 60 0}}}