Skip to content

Commit 69718b3

Browse files
inline put_chars/2, char_stream/1 -> chars_stream/1
inline put_chars/2 mthom#2968 (comment) char_stream/1 -> chars_stream/1 mthom#2968 (comment)
1 parent e98dc8a commit 69718b3

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

src/lib/charsio.pl

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
read_term_from_chars/3,
1616
write_term_to_chars/3,
1717
chars_base64/3,
18-
char_stream/1,
18+
chars_stream/1,
1919
chars_to_stream/2,
20-
chars_to_stream/3,
21-
put_chars/2]).
20+
chars_to_stream/3]).
2221

2322
:- use_module(library(dcgs)).
2423
:- use_module(library(iso_ext)).
@@ -398,28 +397,10 @@
398397
)
399398
).
400399

401-
%% put_chars(+Stream, +Chars). %
402-
%
403-
% Writes a list of characters to a stream.
404-
%
405-
% `Stream` is the output stream, and `Chars` is the list of characters to write.
406-
%
407-
% Example:
408-
%
409-
% ```
410-
% ?- put_chars(current_output, "hello").
411-
% hello
412-
% true.
413-
% ```
414-
415-
put_chars(Stream, Chars) :-
416-
must_be(chars, Chars),
417-
maplist(put_char(Stream), Chars).
418-
419-
%% char_stream(-Stream)
400+
%% chars_stream(-Stream)
420401
% Stream is a character stream.
421402

422-
char_stream(Stream) :-
403+
chars_stream(Stream) :-
423404
'$memory_stream'(Stream).
424405

425406
%% chars_to_stream(+Chars, -Stream) :-
@@ -445,4 +426,4 @@
445426
chars_to_stream(Chars, Stream, _) :-
446427
must_be(chars, Chars),
447428
'$memory_stream'(Stream),
448-
put_chars(Stream, Chars).
429+
maplist(put_char(Stream), Chars).

src/tests/charsio.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
test("can create string char stream",
11-
( char_stream(Stream),
11+
( chars_stream(Stream),
1212
put_char(Stream, a),
1313
get_char(Stream, C),
1414
C=a
@@ -17,7 +17,7 @@
1717

1818
test("can spell simple word with char stream",
1919
(
20-
char_stream(Stream),
20+
chars_stream(Stream),
2121
put_char(Stream, c),
2222
put_char(Stream, a),
2323
put_char(Stream, t),
@@ -27,7 +27,7 @@
2727

2828
test("can read from and write to char stream",
2929
(
30-
char_stream(Stream),
30+
chars_stream(Stream),
3131
put_char(Stream, c),
3232
put_char(Stream, a),
3333
get_char(Stream, _C),

0 commit comments

Comments
 (0)