lib/List-struct.ss
#lang scheme/base

(require (planet chongkai/sml/ml-package)
         (for-syntax scheme/base)
         (only-in (planet chongkai/sml/ml-primitives)
                  length @ hd tl last getItem nth take drop rev
                  revAppend app map mapPartial find
                  filter partition foldl foldr exists all tabulate
                  Empty-datatype Empty Empty?))

(provide List-struct)

(define-package List-struct (null length @ hd tl last getItem nth take drop rev
                                  concat revAppend app map mapPartial find
                                  filter partition foldl foldr exists all tabulate
                                  Empty-datatype Empty Empty?)
  
  (define (concat l)
    (apply append l))
  
  (define null null?)
  
  (define*-values (length @ hd tl last getItem nth take drop rev
                          revAppend app map mapPartial find
                          filter partition foldl foldr exists all tabulate
                          Empty Empty?)
    (values length @ hd tl last getItem nth take drop rev
            revAppend app map mapPartial find
            filter partition foldl foldr exists all tabulate
            Empty Empty?))
  
  (define*-syntax Empty-datatype (syntax-local-value #'Empty-datatype)))