Welcome to SWI-Prolog (Multi-threaded, Version 5.6.20) Copyright (c) 1990-2006 University of Amsterdam. SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). Yes Yes Command? Echo turned on; prompt turned off Command: info pipes -- show the current set of pipes weld(P1,P2) -- weld P2 onto P1 cut(P1,P2Len,P2) -- cut P2Len off P1, forming P2 trim(P,Length) -- shorten P by Length echo -- toggle command echo info -- print this message done -- exit Command: pipes a, length: 10, diameter: 1 b, length: 5, diameter: 1 c, length: 20, diameter: 2 Command: weld(a, b) b welded onto a Command: pipes a, length: 15, diameter: 1 c, length: 20, diameter: 2 Command: trim(a, 12) 12 trimmed from a Command: pipes a, length: 3, diameter: 1 c, length: 20, diameter: 2 Command: cut(c, 10, d) 10 cut from c to form d Command: pipes a, length: 3, diameter: 1 c, length: 10, diameter: 2 d, length: 10, diameter: 2 Command: cut(c, 6, c1) 6 cut from c to form c1 Command: weld(d, c1) c1 welded onto d Command: pipes a, length: 3, diameter: 1 c, length: 4, diameter: 2 d, length: 16, diameter: 2 Command: done Yes % halt