3 ms·
I think it's incorrect to think of prolog's execution model in terms of "functions" and "output". So I don't think the nicities you're hoping for are applicable
by khaled_ismaeel 5y ago
I think it's incorrect to think of prolog's execution model in terms of "functions" and "output". So I don't think the nicities you're hoping for are applicable in prolog (at least not in their straightforward definition).
Though I agree that prolog seems like it came from the 90's; I especially agree with that "functions with slightly different names" bit.
- legerdemain 5y agoO'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.