Truly declarative language?

后端 未结 19 2188
梦毁少年i
梦毁少年i 2021-02-04 01:26

Does anyone know of a truly declarative language? The behavior I\'m looking for is kind of what Excel does, where I can define variables and formulas, and have the formula\'s re

19条回答
  •  梦谈多话
    2021-02-04 02:07

    You can mimic it in Ruby:

    x = 10
    y = 20
    z = lambda { x + y }
    z.call    # => 30
    z = 50
    z.call    # => 70
    

    Not quite the same as what you want, but pretty close.

提交回复
热议问题