fun pyramid n = let open StringCvt fun f x = (padLeft #" " (n + x - 1) o padRight #"*" (x * 2 - 1)) "" in (app println o map f o List.tabulate) (n, fn x => x + 1) end val _ = pyramid 4