From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 3 Jun 93 00:48:05 GMT From: agate!howland.reston.ans.net!math.ohio-state.edu!caen!saimiri.primate.wis c.edu!usenet.coe.montana.edu!netnews.nwnet.net!news.u.washington.edu!stein.u.wa shington.edu!micah@ucbvax.Berkeley.EDU (Micah Anderson) Subject: Instantiation of a generic Subprogram in a package HELP!! Message-ID: <1ujho5INN6i6@news.u.washington.edu> List-Id: Hello, I am trying to write a generic package that WITHs another package that has some strange generic procedure in it that I dont know how to instantiate in my package. I am looking for some help, and any that I might find would be GRETLY appreciated! Here is the part in the generic_binary_search_tree package where I am confused: generic with procedure process (the_object : object_type); procedure traverse (the_tree: binary_tree; the_order: traverse_order); -- -- Results: Procedure process is applied to the_object in each -- node in the_tree. The order in which the node values are -- processed is specified by the_order as follows: -- -- definitions for pre_order, in_order, and post_order traversals deleted -- -- Ok, the process procedure is where I am confused. I have a subprogram in MY package that gets the next node in the tree, and ONLY the next node. I assume I instantiate a NEW process in my Get_Next procedure that would return the next node. But traverse applies "process" to every node in the tree, so how can I just get the first node, and then next time I call Get_Next I will get the next node, etc. So, in other words, how can I control traverse to give me the next node everytime I call it, instead of coughing up each node all at once? I suppose one idea would be to put each node in the tree into an array and then every time Get_Next is called the next component in the array is spat out. Or even instead of putting each node into an array, put a pointer (access type) to each node of the tree into the array. Any ideas? Please respond by email as I cannot read this group very often. Thanks! Micah