Skip to content

dylan-lang/anaphora

Repository files navigation

Anaphora

build-and-test

Anaphoric constructs for Dylan

aif

Sometimes, in a program, we want to test if an expression returns a value or is #f, and if so, to do something with the value. If the expression is costly to evaluate, then we must do something like this:

let result = big-long-calculation();
if (result)
  foo(result)
end;

But with aif we could say:

aif(big-long-calculation())
  foo(it)
end;

or

aif(big-long-calculation())
  foo(it)
else
  bar()
end;

References

On Lisp (ch 14), by Paul Graham, for original Lisp implementation