;; -*-theme-*-

;; Copyright (C) 2014  Tommi Höynälänmaa
;; Distributed under GNU Lesser General Public License version 3,
;; see file doc/LGPL-3.


(define-body (examples list-as-sequence)


  (import (standard-library list-utilities))
  
  (define-param-method sequence-ref (%element)
  		       (((seq (:list-as-sequence %element)) (index <integer>))
			%element pure)
    (uniform-list-ref (field-ref seq 'contents) index))


  (define-param-method sequence-length (%element)
		       (((seq (:list-as-sequence %element))) <integer> pure)
    (length (field-ref seq 'contents)))


  (define-param-method sequence-map (%source %target)
    (((proc (:procedure (%source) %target pure)) 
      (seq (:list-as-sequence %source)))
     (:list-as-sequence %target) pure)
    (make (:list-as-sequence %target)
	  (map proc (field-ref seq 'contents)))))
