;; -*-theme-*-

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

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

  (import (standard-library core)
	  (examples sequence))

  (define-param-class :list-as-sequence (%element) (:sequence %element)
    #t #f #f public ()
    ((contents (:uniform-list %element) public hidden)))

  (declare-method sequence-ref
		  (:param-proc (%element)
			       ((:list-as-sequence %element) <integer>)
			       %element
			       pure))

  (declare-method sequence-length
		  (:param-proc (%element)
			       ((:list-as-sequence %element))
			       <integer>
			       pure))

  (declare-method sequence-map
		  (:param-proc (%source %target)
		  ((:procedure (%source) %target pure)
		   (:list-as-sequence %source))
		  (:list-as-sequence %target)
		  pure)))
