Clojure裡面的Higher-Order Function

wolvever發表於2011-10-27

還是在翻譯《seven programming languages in seven weeks》時遇到了問題。需要請教一下大家。我認為mapfilter都是高階函式,但是原書中有兩處讓我感到困惑。

1. We can build a list of the lengths of the names, like this:

user=> (map count people)
(3 8)

You've seen these concepts before. count in this context is a higher-order function.

2. Here are some of the functions on collections that use higher-order functions.

  • apply ...
  • filter ...

給我的感覺好像是原作者認為傳遞給map,apply的函式才是更高階。我去wiki確認了一下:

In computer science, higher-order functions, are functions which do at least one of the following:

  • take one or more functions as an input
  • output a function

又去線上書店查了Errata,也沒找到相關資訊。

原作者的表述有錯嗎?我翻譯的時候該怎麼辦呢?

相關文章