3 ms·
O'Keefe's The Craft of Prolog happily describes function arguments as "input" and "output." I'm taking the liberty to say "function" instead of "functor," becau
by legerdemain 5y ago
O'Keefe's The Craft of Prolog happily describes function arguments as "input" and "output." I'm taking the liberty to say "function" instead of "functor," because the latter is more obscure. And there absolutely is a distinction between conceptual inputs and outputs, because many functions can find instantiations only for some arguments and not others. For example, I can query `length([a, b, c], N)`, but not `length(X, 3)`.
- lager 5y agoEh? Your Prolog system must be broken… ?- length(X, 3). X = [_1586, _1592, _1598]. ?-
- legerdemain 5y agoVery well, if you insist on ignoring the broader point in favor of the specific example, then replace `length` with `is`. We can unify `X is 3 * 3`, we cannot unify `9 is 3 * X` (at least not in SWI-Prolog v8.4.1). Therefore, we can call the thing to the left of `is` the output and the thing to the right of `is` the input.