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:2021-1:tarea1 [2021/04/25 13:02] etanterteaching:cc4101:tareas:2021-1:tarea1 [2021/05/10 14:34] (current) – P3, add '}' on first example bortiz
Line 120: Line 120:
  {id 5}}  {id 5}}
  
-{{define {add1 {x : Num}} {+ x 1}}+{{define {add2 {x : Num}} {+ x 2}}
  {with {{oops #f}}  {with {{oops #f}}
-   {add1 oops}}}+   {add2 oops}}}
 </code> </code>
  
Line 149: Line 149:
   > (typecheck '{{define {f {p : Bool}} {&& p {! p}}}   > (typecheck '{{define {f {p : Bool}} {&& p {! p}}}
                           {f {> 3 4}}})                           {f {> 3 4}}})
-  'Bool </code> <code scheme>   +  'Any </code> <code scheme>   
   > (typecheck '{{define {one {x : Num}} 1}   > (typecheck '{{define {one {x : Num}} 1}
                           {one #t}})                           {one #t}})
   "Static type error: expected Num found Bool" </code> <code scheme>   "Static type error: expected Num found Bool" </code> <code scheme>
-  > (typecheck '{> 10 #t})+  > (typecheck '{{> 10 #t}})
   "Static type error: expected Num found Bool"</code> <code scheme>   "Static type error: expected Num found Bool"</code> <code scheme>
-   > (typecheck '{if 73 #t #t})+   > (typecheck '{{if 73 #t #t}})
   "Static type error: expected Bool found Num"</code> <code scheme>   "Static type error: expected Bool found Num"</code> <code scheme>
-  > (typecheck '{with {{x 5} {y : Num #t} {z 42}} +  > (typecheck '{{with {{x 5} {y : Num #t} {z 42}} 
-                            z})+                            z}})
   "Static type error: expected Num found Bool"</code>   "Static type error: expected Num found Bool"</code>
  
Line 205: Line 205:
  {define {positive x} : Bool {> x 0}}  {define {positive x} : Bool {> x 0}}
  {define {percentage? x} : Bool {&& {lt100 x} {positive x}}}  {define {percentage? x} : Bool {&& {lt100 x} {positive x}}}
- {define {calc {x @ positive} {y @ percentage?}+ {define {calc {x @ positive} {y @ percentage?}}
            {/ {* y y} x}}            {/ {* y y} x}}
  {calc 25 3}}  {calc 25 3}}