Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.6.5) Copyright (c) 1990-2013 University of Amsterdam, VU 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). true. true. Echo turned on; prompt turned off Command: help 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) -- trim Length off of P echo -- toggle command echo help -- print this message q -- quit 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: q true. % halt