3 ms·
> The normal order sequencing combinator is: Seq = λx.λy.(λz.y x) where z is chosen so that it does not appear free in y. > This combinator guarantees that x i
by tromp 3y ago
> The normal order sequencing combinator is: Seq = λx.λy.(λz.y x) where z is chosen so that it does not appear free in y.
> This combinator guarantees that x is evaluated before y, which is important
in programs with side-effects
This part didn't make sense to me. I can apply Seq to x = Ω = (λx.x x)(λx.x x) and y = (λa.λb.b) and z = λx.x, resulting in Seq x y z = y x = λb.b, which leaves x unevaluated.
A sequencing operator cannot be defined within the lambda calculus, which has no notion of side-effect; it must be a function defined in a runtime, i.e. in an implementation of lambda calculus. An example is the function seq in Haskell.
- layer8 3y agoYes, with lazy evaluation, there is no guarantee that x will be evaluated before y (rather the opposite).