My first implementation of the BreadthFirstHelper procedure made use of LOCAL variables to hold intermediate values and used the REPEAT command to append new child nodes to queue. When I wrote it, I thought this would make it shorter, no need for another helper procedure to append the new child nodes to queue. But, as it turns out, I was wrong. Here is my initial version of breadthFirstHelper: ; :queue is a list of nodes to be processed ; for every member of the queue, from first to last, the first ; node is removed from :queue and two procedures (processNode and ; childNodes) are invoked with it as an input. ; processNode checks to see if its input :node, a pouring data ; structure, has a pitcher with the desired amount. If so, global ; variable solution is set to the node. ; childNodes outputs a list of nodes that are children of the ; input node. These nodes are appended to :queue to be processed. to breadthFirstHelper :queue if empty? :queue [stop] localmake "curNode first :queue make "queue butfirst :queue processNode :curNode if not empty? :solution [stop] localmake "nodeChildren childNodes :curNode repeat (count :nodeChildren) ~ [make "queue lput (item repcount :nodeChildren) :queue] breadthFirstHelper :queue end