File: stream.thi

package info (click to toggle)
theme-d 7.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,036 kB
  • sloc: lisp: 9,625; sh: 5,321; makefile: 715; ansic: 477
file content (116 lines) | stat: -rw-r--r-- 2,626 bytes parent folder | download | duplicates (3)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
;; -*-theme-d-*-

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

(define-interface (standard-library stream)


  (import (standard-library core)
	  (standard-library promise)
	  (standard-library text-file-io))


  (define-param-logical-type :stream (%type)
    (:union (:pair (:promise %type) (:promise (:stream %type))) <null>))


  (define-param-logical-type :nonempty-stream (%type)
    (:pair (:promise %type) (:promise (:stream %type))))


  (define-param-logical-type :nonpure-stream (%type)
    (:union (:pair (:nonpure-promise %type)
		   (:nonpure-promise (:nonpure-stream %type))) <null>))


  (define-param-logical-type :nonempty-nonpure-stream (%type)
    (:pair (:nonpure-promise %type)
	   (:nonpure-promise (:nonpure-stream %type))))


  (declare-param-method stream-next (%type) ((:stream %type))
			(:stream %type)
			pure)


  (declare-param-method stream-value (%type) ((:stream %type))
			%type
			pure)


  (declare-param-method stream-empty? (%type) ((:stream %type))
			<boolean>
			pure)


  (declare-param-method stream->list (%type) ((:stream %type))
			(:uniform-list %type)
			pure)


  (declare-param-method list->stream (%type) ((:uniform-list %type))
			(:stream %type)
			pure)


  (declare-param-method nonpure-stream-next (%type) ((:nonpure-stream %type))
			(:nonpure-stream %type)
			nonpure)


  (declare-param-method nonpure-stream-value (%type) ((:nonpure-stream %type))
			%type
			nonpure)


  (declare-param-method nonpure-stream-empty? (%type) ((:nonpure-stream %type))
			<boolean>
			pure)


  (declare-param-method nonpure-stream->list (%type) ((:nonpure-stream %type))
			(:uniform-list %type)
			nonpure)


  (declare-param-method stream-map (%type1 %type2)
			((:procedure (%type1) %type2 pure)
			 (:stream %type1))
			(:stream %type2)
			pure)


  (declare-param-method stream-map-nonpure (%type1 %type2)
			((:procedure (%type1) %type2 nonpure)
			 (:stream %type1))
			(:nonpure-stream %type2)
			nonpure)


  (declare-param-method stream-for-each (%type1)
			((:procedure (%type1) <none> nonpure)
			 (:stream %type1))
			<none>
			nonpure)


  (declare-param-method nonpure-stream-map (%type1 %type2)
			((:procedure (%type1) %type2 nonpure)
			 (:nonpure-stream %type1))
			(:nonpure-stream %type2)
			nonpure)


  (declare-param-method nonpure-stream-for-each
			(%type1)
			((:procedure (%type1) <none> nonpure)
			 (:nonpure-stream %type1))
			<none>
			nonpure)


  (declare-simple-method make-input-expr-stream (<input-port>)
			 (:nonpure-stream <object>)
			 nonpure))