implemented all enumerable functions using each