|
This is a fun demo of functional programming, but Lisp isn't so special anymore. In Python: >>> def deriv(f):
... dx = 0.0001
... def fp(x):
... return (f(x + dx) - f(x)) / dx
... return fp
...
>>> cube = lambda x: x**3
>>> deriv(cube)(2.0)
12.000600010022566
|
Does it just take some serious perseverance? Or am I just Lisp-dumb?