1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
;; -*-theme-d-*-
;; Copyright (C) 2016 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 test462)
(import (standard-library core)
(standard-library string-utilities)
(standard-library stream)
(standard-library console-io)
(standard-library object-string-conversion))
(define-main-proc (() <none> nonpure)
(let* ((l1 '(1 2 3 4 5))
(stm (list->stream l1))
(stm2 (stream-map
(lambda (((i <integer>)) <integer> pure) (+ i 1))
stm))
(l2 (stream->list stm2))
(stm3 (stream-map
(lambda (((i <integer>)) <real> pure) (+ i 0.5))
stm))
(l3 (stream->list stm3))
(stm4 (:nonpure-stream <string>)
(stream-map-nonpure
(lambda (((i <integer>)) <string> nonpure)
(console-display-line "*")
(object->string i))
stm))
(l4 (nonpure-stream->list stm4)))
(console-display-line l2)
(console-display-line l3)
(console-display-line l4)
(stream-for-each (lambda (((r <real>)) <none> nonpure)
(console-display r)
(console-display ", "))
stm3)
(console-newline)
(console-display-line
(nonpure-stream->list
(nonpure-stream-map (lambda (((str <string>)) <string> nonpure)
(console-display-line str)
(string-append str "*"))
stm4)))
(nonpure-stream-for-each (lambda (((str <string>)) <none> nonpure)
(console-display str)
(console-display ", "))
stm4)
(console-newline))
0))
|