In pure functional languages, is there an algorithm to get the inverse function?

前端 未结 10 1216
野的像风
野的像风 2020-12-04 06:10

In pure functional languages like Haskell, is there an algorithm to get the inverse of a function, (edit) when it is bijective? And is there a specific way to program your f

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 06:32

    Not in most functional languages, but in logic programming or relational programming, most functions you define are in fact not functions but "relations", and these can be used in both directions. See for example prolog or kanren.

提交回复
热议问题