;; -*-theme-d-*-

;; Copyright (C) 2015 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 test314)

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

  (declare a (:procedure ((:uniform-list <integer>)) <none> nonpure))

  (define-simple-proc b (((lst (:uniform-list <integer>))) <none> nonpure)
    (if (not-null? lst)
	(let ((lst1 (cast (:nonempty-uniform-list <integer>) lst)))
	  (console-display "b: ")
	  (console-display-line (car lst1))
	  (a (cdr lst1)))))

  (define-simple-proc a (((lst (:uniform-list <integer>))) <none> nonpure)
    (if (not-null? lst)
	(let ((lst1 (cast (:nonempty-uniform-list <integer>) lst)))
	  (console-display "a: ")
	  (console-display-line (car lst1))
	  (b (cdr lst1)))))

  (declare-method c (:simple-proc ((:uniform-list <integer>)) <none> nonpure))

  (define-simple-method d (((lst (:uniform-list <integer>))) <none> nonpure)
    (if (not-null? lst)
	(let ((lst1 (cast (:nonempty-uniform-list <integer>) lst)))
	  (console-display "d: ")
	  (console-display-line (car lst1))
	  (c (cdr lst1)))))

  (define-simple-method c (((lst (:uniform-list <integer>))) <none> nonpure)
    (if (not-null? lst)
	(let ((lst1 (cast (:nonempty-uniform-list <integer>) lst)))
	  (console-display "c: ")
	  (console-display-line (car lst1))
	  (d (cdr lst1)))))

  (define-simple-proc main (() <none> nonpure)
    (let ((lst '(1 2 3 4 5)))
      (a lst)
      (c lst))))

