~jleightcap/nonolog

3df83f19a0290dbbd0d4f632fc9592d83286c806 — jleightcap 2 years ago ab3c30b
type annotation comments
1 files changed, 9 insertions(+), 10 deletions(-)

M nono.prolog
M nono.prolog => nono.prolog +9 -10
@@ 20,10 20,9 @@
:- use_module(library(clpfd)). % just used for transpose/2

% solve a given picross puzzle.
%   row restraints list[list[N]] ->
%   column restraints list[list[N]] ->
%   row length int ->
%   column length int ->
%   row restraints :: list[list[Nat]] ->
%   column restraints :: list[list[Nat]] ->
%   length :: Nat ->
%   solved picross
%
% ex:


@@ 42,7 41,7 @@ picross(Rc, Cc, N, X) :-
print_row(R) :- maplist(write, R), nl.

% run-length encoding of a 1's in a given binary list.
%   list[{0,1}] ->
%   input list :: list[{0,1}] ->
%   resulting encoding
%
% ex:


@@ 69,11 68,11 @@ decode(N, E, X) :-
    length(X, N),
    encode(X, E).

% add two encodings based on additional cell.
% user previous cell state to determine if run should be continued.
%   cell int ->
%   previous int ->
%   accumulator encoding ->
% resulting encoding based on next cell.
% use previous cell state to determine if run should be continued.
%   cell :: {0,1} ->
%   previous :: {0,1} ->
%   accumulator encoding :: list[Nat] ->
%   resulting encoding
%
% ex: