Comment

Comment by goldmab

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
parent goldmab 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton