func main() print("length of list: "); l = int(scan()); println("Elements of list:"); lst = []; i = 0; while (i < l) print("lst[", i,"] = "); x = int(scan()); append(lst, x); i = i + 1; endwhile println("map(square, lst) = ", map(square, lst)); println("reduce(mul, lst) = ", reduce(mul, lst)); endfunc func square(x) return x*x; endfunc func mul(x, y) return x*y; endfunc func map(f, ref lst) i = 0; res = lst; while (i < len(lst)) res[i] = f(res[i]); i = i + 1; endwhile return res; endfunc func reduce(f, ref lst) if (len(lst) == 0) return; endif res = lst[0]; i = 1; while (i < len(lst)) res = f(res, lst[i]); i = i + 1; endwhile return res; endfunc # Starter main();