;; -*-theme-d-*-

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

;; Expected results: translation and running OK


(define-proper-program (tests test190)


  (import (standard-library core)
	  (standard-library console-io))

  


  (define-param-proc-alt display-mutable-vector (%type)
    (lambda (((v (:mutable-vector %type))) <none> nonpure)
      (let ((len (mutable-vector-length v)))
	(let-mutable ((j <integer> 0))
	  (until ((>= j len))
	    (console-display (mutable-vector-ref v j))
	    (console-newline)
	    (set! j (+ j 1)))))))


  (define-param-proc-alt display-mutable-value-vector (%type)
    (lambda (((v (:mutable-value-vector %type))) <none> nonpure)
      (let ((len (mutable-value-vector-length v)))
	(let-mutable ((j <integer> 0))
	  (until ((>= j len))
	    (console-display (mutable-value-vector-ref v j))
	    (console-newline)
	    (set! j (+ j 1)))))))


  (define main
    (lambda (() <none> nonpure)
      (let ((my-vec1 (vector <real> 1.1 2.1 3.1 4.1 5.0))
	    (my-vec2 (vector <integer> 10 9 8 7 6 5)))
	(let ((result-vec1
	       (cast-mutable-vector-metaclass my-vec1))
	      (result-vec2
	       (cast-mutable-value-vector-metaclass my-vec2)))
	  (mutable-vector-set! result-vec1 1 10.5)
	  (mutable-value-vector-set! result-vec2 4 6)
	  (display-mutable-vector result-vec1)
	  (display-mutable-value-vector result-vec2))))))

