squeeze

A static site generator that can put the toothpaste back in the tube.
git clone https://git.mulligrubs.me/squeeze
Log | Files | Refs | README | LICENSE

commit daa45c22af0e94d6caf1197dc6745e527f386394
parent c78cfa3292631e2989fceb8d7e9878ab999f7f69
Author: St John Karp <stjohn@mulligrubs.me>
Date:   Tue, 25 Aug 2020 17:29:10 -0500

Fix some GNU-Prolog bugs in the helpers

Fixed a bug in the join predicate where I left out one of the
parameters. Also rewrote the read_file predicate so it looks for
-1 instead of testing at_end_of_stream. -1 seems like a more reliable
indicator when reading from a command's output.

Diffstat:
Mhelpers.pl | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/helpers.pl b/helpers.pl @@ -5,12 +5,13 @@ % read_file(+Stream, -Codes). % Read a file to a list of character codes. -read_file(Stream, []):- - at_end_of_stream(Stream). - -read_file(Stream, [Code|Rest]):- - \+ at_end_of_stream(Stream), +read_file(Stream, Codes):- get_code(Stream, Code), + read_file_next(Code, Stream, Codes). + +read_file_next(-1, _, []). + +read_file_next(Code, Stream, [Code|Rest]):- read_file(Stream, Rest). @@ -50,7 +51,7 @@ join([], _, ''). join([A], _, A). join([First|Rest], Separator, Result):- - join(Rest, End), + join(Rest, Separator, End), atom_concat(First, Separator, FirstPlusSeparator), atom_concat(FirstPlusSeparator, End, Result).