5 ms·
I've always liked the idea of a language that combined syntax level support for functional reactive programming and symbolic programming. So you define z as x +
by c3534l 8y ago
I've always liked the idea of a language that combined syntax level support for functional reactive programming and symbolic programming. So you define z as x + y. Then you change the value of x and that change cascades across your program, like a spreadsheet almost.
- jmickey 8y agoI understand that is how object oriented databases work. For example, you can define the equation for a financial derivative, then change the price of one of the components and derivative price is updated automatically.
- lifthrasiir 8y agoTry Mozart/Oz [1]. For example, a symbolic constraint solver for Minesweeper [2] had been written in it. [1] https://mozart.github.io/ https://mozart.github.io/ [2] https://www.info.ucl.ac.be/~pvr/minesweeper.pdf https://www.info.ucl.ac.be/~pvr/minesweeper.pdf
- voldacar 8y agoYou can do this easily in lispy languages with eval
- etatoby 8y agoIsn't that Haskell? Or any other declarative, lazily-evaluated landuage. Granted, you need to use something like the ST monad to be able to "change the value of x," but once you do, all other values fall into place like dominoes.
- barrkel 8y agoThat's pull rather than push, though.
- geocar 8y agok/q does this. They're called views[1] z::x+y x:42 y:42 z y:69 z [1]: https://code.kx.com/v2/ref/view/ https://code.kx.com/v2/ref/view/
- repsilat 8y agoAnd JS :-). let x = ()=>42 let y = ()=>42 let z = ()=>x()+y() z() // 84 y = ()->69 z() // 111
- geocar 8y agoNot exactly the same thing, for one these aren't function calls, and for another the view is memoized: You can see the difference with some print statements: q)z::show(x;y;x+y);x+y q)x:42 q)y:42 q)z 42 42 84 84 q)x:69 q)z 69 42 111 111 q)z 111 Views are also aware of what's changed: q)a:1234 q)z 111 q)y:69 q)z 69 69 138 138
- wool_gather 8y agoWell, you can do that in any language with first-class functions. But there's obviously a syntactical difference between a function invocation and a variable read.