Re:A Brief History of the BEAM Compiler
by simplify on Thursday August 02, 2018 @06:59PM
(#17676153)
Can you explain what transitive closure is and how your prolog snippet accomplishes it?
[ Parent
| on HN ]
Re:A Brief History of the BEAM Compiler
by carapace on Thursday August 02, 2018 @11:50PM
(#17677171)
https://en.wikipedia.org/wiki/Transitive_closure#In_graph_th...
> In computer science, the concept of transitive closure can be thought of as constructing a data structure that makes it possible to answer reachability questions. That is, can one get from node a to node d in one or more hops? A binary relation tells you only that node a is connected to node b, and that node b is connected to node c, etc.
That snippet defines a function path(A, B) by specifying two cases:
1. a link(A, B) exists
-or-
2. some element I exists, such that a link(A, I) exists and path(I, B) exists.