#22: Curried Application

Tagged as challenge

Written on 2018-01-30

Write a function (@ f x y z …) which applies f to x, and then applies the result of that to y, and so on. For example, clog satisfies the following functional relation: (@ clog 2 5) == ((clog 2) 5). More generally, we have the functional relations:

  • $(@\, f) = f$
  • $(@\, f\, x_1 \ldots x_n) = ((@\,f\,x_1 \ldots x_{n-1})\, x_n)$

Unless otherwise credited all material copyright © 2010–2018 by Robert Smith