;; -*-theme-d-*-

;; Copyright (C) 2008-2013 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 test90)


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


  (define-param-proc my-sum (%type)
    (((vec (:value-vector %type)) (zero %type)) %type pure)
    (let ((len (value-vector-length vec)))
      (let-mutable ((i <integer> 0)
		    (sum %type zero))
		   (until ((>= i len) sum)
			  (set! sum (+ sum (value-vector-ref vec i)))
			  (set! i (+ i 1))))))

		   
  (define-simple-proc main (() <none> nonpure)
    (let* ((my-vec1 (value-vector <real> 2.0 -1.5 4.0 5.6 10.1))
	   (sum1 (my-sum my-vec1 0.0))
	   (my-vec2 (value-vector <integer> 2 -1 4 6 10))
	   (sum2 (my-sum my-vec2 0)))
      (console-display sum1)
      (console-newline)
      (console-display sum2)
      (console-newline))))
