When should I use $ (and can it always be replaced with parentheses)?

前端 未结 5 952
伪装坚强ぢ
伪装坚强ぢ 2021-01-04 21:31

From what I\'m reading, $ is described as \"applies a function to its arguments.\" However, it doesn\'t seem to work quite like (apply ...) in Lisp

5条回答
  •  暖寄归人
    2021-01-04 22:02

    Lots of good answers above, but one omission:

    $ cannot always be replace by parentheses

    But any application of $ can be eliminated by using parentheses, and any use of ($) can be replaced by id, since $ is a specialization of the identity function. Uses of (f$) can be replaced by f, but a use like ($x) (take a function as argument and apply it to x) don't have any obvious replacement that I see.

提交回复
热议问题