This repository has been archived on 2025-09-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2025LogProg-project-GhentPr.../examples/dcg/tree.pl
2025-03-30 21:56:24 +02:00

10 lines
235 B
Prolog

inorder(nil) --> [].
inorder(node(L, N, R)) --> inorder(L), [N], inorder(R).
:- initialization(main).
main :-
T = node(node(nil, b, node(nil, c, nil)), a, node(nil, d, nil)),
phrase(inorder(T), Names),
write(Names), nl.