depth function

Subject: depth function
From: LINARESA@xxxxxxxxxxxx (LINARESA)
Date: Mon, 12 Jan 1998 14:20:03 -0500
This is an outline of a document I am working with. I have been trying to write
a depth function to to help with indentations of substeps.

My code is:
(define (depth nd)
   (if (not(gi(nd)))
      0
      (+ (if (gi (parent(nd)))
             0
             1)
          (depth (parent(nd)))
      )
   )
)

I have been getting infinite loops when I run this...any ideas?

 <TECHINFO>
  <SYSTEM VERSION="ver0">
   <TASK>
    <STEP-SEQ>
     <STEP VERSION="ver0"></STEP>
     <STEP></STEP>
     <STEP></STEP>
     <STEP>
      <STEP-SEQ>
       <STEP>1</STEP> **depth at this point**
       <STEP>2</STEP>
       <STEP>3</STEP>
       <STEP>4</STEP>
       <STEP>5</STEP>
       <STEP>
        <STEP-SEQ>
         <STEP>5a</STEP> **depth at this point**
         <STEP>
          <STEP-SEQ>
           <STEP>5a1</STEP> **depth at this point**
           <STEP>5a2</STEP> **depth at this point**
          </STEP-SEQ>
         </STEP>
        </STEP-SEQ>
       </STEP>
      </STEP-SEQ>
     </STEP>
    </STEP-SEQ>
   </TASK>
  </SYSTEM>
 </TECHINFO>


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • depth function
    • LINARESA - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id OAA04619Mon, 12 Jan 1998 14:29:35 -0500 (EST) <=
      • Tony Graham - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id QAA06357Mon, 12 Jan 1998 16:29:01 -0500 (EST)
      • Henry S. Thompson - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id EAA14799Tue, 13 Jan 1998 04:31:20 -0500 (EST)