commit c45e96789607472b491fb20c69b4f8f48599708a parent 94ae1ebabe02bf06e1b58184c3d819e1def4be46 Author: AlexKnauth <alexander@knauth.org> Date: Fri, 20 May 2016 13:20:00 -0400 add mlish/sweet-map.rkt test Diffstat:
| A | tapl/tests/mlish/sweet-map.rkt | | | 20 | ++++++++++++++++++++ |
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/tapl/tests/mlish/sweet-map.rkt b/tapl/tests/mlish/sweet-map.rkt @@ -0,0 +1,20 @@ +#lang sweet-exp "../../mlish.rkt" + +define + sum [lst : (List Int)] → Int + match lst with + [] -> 0 + x :: xs -> + {x + sum(xs)} + +define + map [f : (→ X Y)] [lst : (List X)] → (List Y) + match lst with + [] -> nil + x :: xs -> + cons + f x + map f xs + +sum + map string->number (list "1" "2" "3")