try to write toy interpreter in functional programming style