Remix.run Logo
ozy a day ago

Useless unless the logical operators receive their rhs unevaluated. And that is generalized as a language feature.

sparkie a day ago | parent [-]

A general language feature would be fexprs, or call-by-name (which can be combined with call-by-value using call-by-push-value).

In Kernel[1] for example, where operatives are an improved fexpr.

    ($define! $if
        ($vau (condition if-true if-false) env
            ($cond 
                ((eval condition env) (eval if-true env))
                (#t (eval if-false env)))))
$vau is similar to $lambda, except it doesn't implicitly evaluate its operands, and it implicitly receives it's caller's dynamic environment as a first class value which gets bound to env.

$lambda is not actually a builtin in Kernel, but wrap is, which constructs an applicative by wrapping an operative.

    ($define! $lambda
        ($vau (args . body) env
            (wrap (eval (list* $vau args #ignore body) env))))
All functions have an underlying operative which can be extracted with unwrap.

[1]:https://ftp.cs.wpi.edu/pub/techreports/pdf/05-07.pdf