3 ms·
Less repetitions. Instead of roo(X, W) :- zut(X, Z), pum(Z, Y), tos(Y, W) we could write something like roo/2 :- zut . pum . tos
by horsh1 5y ago
Less repetitions. Instead of
roo(X, W) :- zut(X, Z), pum(Z, Y), tos(Y, W)
we could write something like
roo/2 :- zut . pum . tos
- triska 5y agoYou can do this with definite clause grammars (DCGs), which are available in virtually all Prolog systems: roo --> zut, pum, tos. Note the use of (-->)/2 to define a grammar rule. Use phrase/3 to invoke the DCG. DCGs are currently being drafted for inclusion in the Prolog ISO standard: https://www.complang.tuwien.ac.at/ulrich/iso-prolog/#dcg https://www.complang.tuwien.ac.at/ulrich/iso-prolog/#dcg