Use list cons operator (a :: b) as a function

前端 未结 3 423
隐瞒了意图╮
隐瞒了意图╮ 2021-01-07 21:40

F# lets you turn operators into functions by surrounding them with ( ): for instance, (+) is of type int -> int -> int

3条回答
  •  鱼传尺愫
    2021-01-07 22:18

    Unfortunately, no, you can't. :: is not an operator, but a "symbolic keyword" according to the language grammar (see section 3.6 of the spec), as are :?> and a few others. The language doesn't seem completely consistent here, though, since there are a few symbolic keywords which can be treated as though they were operators (at least (*) and (<@ @>)).

提交回复
热议问题