;;;; Copyright 2002, Jonathan Bachrach.  See file TERMS.

(use goo/boot)
(use goo/fun)
(use goo/class)
(use goo/macros)
(use goo/types)
(use goo/math)
(use goo/cols/col)
(use goo/cols/colx)
(use goo/cols/seq)

;; 3.7.6 FLAT SEQUENCES

;;;;!! Interface
(exported
 <flat> ;; (dc <flat> (<seq>))
)

;;;;!! Implementation

(dc <flat-enum> (<enum>))
(dp %dat (<flat-enum> => <flat>))
(dp! %key (<flat-enum> => <int>) 0)
(dm enum (x|<flat> => <flat-enum>) 
  (new <flat-enum> %dat x))
(dm fin? (e|<flat-enum> => <log>)       
  (== (%key e) (len (%dat e))))
(dm nxt (e|<flat-enum> => <flat-enum>)  
  (renew e %key (+ (%key e) 1) ;; %dat (%dat e)
         ))
(dm now (e|<flat-enum> => <any>)         
  (low-elt (%dat e) (%key e)))
(dm now-setter (v|<any> e|<flat-enum>) 
  (set (low-elt (%dat e) (%key e)) v))
(dm now-key (e|<flat-enum> => <int>)   
  (%key e))

