1:- module(concatenated_input_streams,
2 [
3 new_concat_input_stream/2 4 ]).
18:- use_module(library(predicate_streams)). 19:- use_module(library(yall)).
27new_concat_input_stream(List,Stream):-
28 new_predicate_input_stream(
29 [[Code]]>>
30 ((member(S,List),\+ at_end_of_stream(S),get_code(S,Code)) ->
31 check_eof(List,Stream);throw(read_past_input)),
32 Stream).
33
34
35check_eof([S|List],Stream):- at_end_of_stream(S)->check_eof(List,Stream);true.
36check_eof([],Stream):-set_stream(Stream,end_of_stream(at))
concatenated_input_streams - Lazy Input stream from concatenating several inputs
Author: Douglas R. Miles E-mail: logicmoo@gmail.com WWW: http://www.logicmoo.org Copyright (C): 2015
This program is free software; you can redistribute it and/or modify it.