Task

by Artem

JavaScript

'use strict';

const seq=f=>g=>typeof g=='function'?seq(x=>f(g(x))):f(g)

console.log(
	seq(x => x + 7)(x => x * 2)(5)
);

console.log(
	seq(x => x * 2)(x => x + 7)(5)
);

console.log(
	seq(x => x * 2)(x => x + 7)(5)
);

console.log(
	seq(x => x + 1)(x => x * 2)(x => x / 3)(x => x - 4)(7)
);

console.log(`Characters length: ${Function.prototype.toString.call(seq).length}`);