Via @DVrandecic, a way to reproduce slowness:
- Create a positive integer type;
- Define a function successor with an implementation in Python (which returns x+1);
- Define a function floored predecessor with an implementation in JS (which returns x-1 or 0, whatever's bigger);
- Define an is_zero function;
- Use that to implement addition via composition as: add(x, y) := if(is zero(y), x, add(successor(x), predecessor (y)))