top | item 31936206

(no title)

rcollyer | 3 years ago

It's a set of rewrite rules with infinite outlook, i.e. a term will continue to be evaluated (rewritten) until it no longer changes. There are some limits to prevent recursion (4096 iterations is the typical limit), alongside ways to infer what the endpoint will be (again to combat infinite recursion). Alongside that, everything in the language is an expression, i.e. subject to rewrite rules. A function, then, just defines a rewrite rule, a constant (e.g. Pi) does the same with higher precedence than the functions, etc. So, a function can return another expression that is then evaluated until it no longer changes. For example, Sin[1] does not evaluate by default as it is exact while it's floating point representation is not, but Sin[0] does. Oh, the language is also homo-iconic, like Lisp, so that data and code are indistinguishable. I found that to be the hardest mental hurdle in understanding how wl functions.

discuss

order

No comments yet.