home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / aijournl / 1986_10 / aiapp5.fig < prev    next >
Text File  |  1986-07-16  |  2KB  |  54 lines

  1.  
  2. STEP 1                        
  3.                 |----------|ì
  4. alloc_str ----> ⁿ constant ⁿì
  5.                 |----------|ì
  6.                 |    c     |ì
  7.                 |----------|ì
  8.               ì
  9. alloc_str(constant,'c') 
  10.                         
  11. STEP 2                  
  12.                                 ì
  13.                 |----------|ì
  14.                 ⁿ   cons   ⁿ      tail_ptrì
  15.                 |----------|    ì
  16. cons ---------> |      ---------> NILì
  17.                 |----------|ì
  18.                 |          |ì
  19.                 |----------|ì
  20.                      |       head_ptr
  21.                      Vì
  22.                 |----------|ì
  23.                 ⁿ constant ⁿì
  24.                 |----------|ì
  25.                 |    c     |ì
  26.                 |----------|ì
  27.                                            ì
  28. cons(alloc_str(constant,'c'),NIL)
  29.  
  30.                                                 
  31. STEP 3                  ì
  32.                         ì
  33.                         ì
  34.                 |----------|     |----------|     |----------|ì
  35.                 ⁿ   cons   ⁿ     ⁿ   cons   ⁿ     ⁿ   cons   ⁿì
  36.                 |----------|     |----------|     |----------|ì
  37. list ---------> |      --------->|      --------->|      ------> NILì
  38.                 |----------|     |----------|     |----------|ì
  39.                 |          |     |          |     |          |ì
  40.                 |----|-----|     |----|-----|     |----|-----|ì
  41.                      |                |                |     
  42.                      V                V                V     ì
  43.                 |----------|     |----------|     |----------|ì
  44.                 ⁿ constant ⁿ     ⁿ constant ⁿ     ⁿ constant ⁿì
  45.                 |----------|     |----------|     |----------|ì
  46.                 |    a     |     |    b     |     |    c     |ì
  47.                 |----------|     |----------|     |----------|ì
  48.                                                              ì
  49.  
  50. list := cons(alloc_str(constant,'a'),cons(alloc_str(constant,'b'),
  51.               cons(alloc_str(constant,'c'),NIL)))
  52.                         
  53. Figure 5 - Constructing the list ('a','b','c') .
  54.