Truly declarative language?

后端 未结 19 2194
梦毁少年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

    In F#, a little verbosily:

    let x = ref 10
    let y = ref 20
    
    let z () = !x + !y
    
    z();;
    y <- 40
    z();;
    

提交回复
热议问题