;; -*-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 test252)


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


  (declare <my-list> :union)
  (declare <my-nonempty-list> :pair)

  (define <my-list>
    (:union (:pair <real> <my-list>) <null>))

  (define <my-nonempty-list>
    (:pair <real> <my-list>))
	    


  (define-simple-proc display-list
      (((lst <my-list>))
       <none>
       (nonpure))
    (if (not (equal? lst null))
	(let ((lst1 (cast <my-nonempty-list> lst)))
	  (console-display (car lst1))
	  (console-newline)
	  (display-list (cdr lst1)))))

  (define main
    (lambda (() <none> nonpure)
      (let ((lst (list 1.5 2.5 3.5 4.5 5.5)))
	  (display-list lst)))))
