<div dir="ltr"><div> </div>Hello,<br> <br>for a quick review, my last problems I had with going through all the<br>samples and extras, except the wix compiler, that one I didn't figure out yet.<br> <br>branch: master<br>
boehm_gc/.gitignore b/boehm_gc/.gitignore:<br> ignoring Windows 'cl' .obj files<br> <br>extras/xml/xml.dtd.m b/extras/xml/xml.dtd.m:<br>extras/xml/xml.parse.m b/extras/xml/xml.parse.m:<br> Changing multiplicity ('1') -> one, such that it compiles (and works)<br>
in the C# grade.<br><br>samples/rot13/rot13_concise.m:<br> added missing func and pred declarations<br> changed string index_det -> string.det_index.<br> <br>samples/solver_types/sudoku.m:<br> The solution grid is now in a 3x3 block format,<br>
for that the row number is accumulated in write_solution predicate.<br> <br>Cheers,<br> <br>Sebastian.<br><br>diff --git a/boehm_gc/.gitignore b/boehm_gc/.gitignore<br>index 1ccf936..99fe1e6 100644<br>--- a/boehm_gc/.gitignore<br>
+++ b/boehm_gc/.gitignore<br>@@ -10,6 +10,7 @@ mercury_boehm_gc_conf.h<br> gc.lib<br> libgc.lib<br> *.a<br>+*.obj<br> *.exe<br> *.ilk<br> *.o<br>diff --git a/extras/xml/xml.dtd.m b/extras/xml/xml.dtd.m<br>index 3719b13..6906849 100644<br>
--- a/extras/xml/xml.dtd.m<br>+++ b/extras/xml/xml.dtd.m<br>@@ -57,7 +57,7 @@<br> ---> mixed(list(name)).<br> <br> :- type multiplicity<br>- ---> ('1')<br>+ ---> one<br> ; ('*')<br> ; ('+')<br>
; ('?')<br>diff --git a/extras/xml/xml.parse.m b/extras/xml/xml.parse.m<br>index cbf74c3..bd6f528 100644<br>--- a/extras/xml/xml.parse.m<br>+++ b/extras/xml/xml.parse.m<br>@@ -1746,7 +1746,7 @@ children --><br>
:- mode multiplicity(in, out) is det.<br> <br> multiplicity --><br>- opt(lit1(('?'), ('?')) or lit1(('*'), ('*')) or lit1(('+'), ('+')), '1').<br>+ opt(lit1(('?'), ('?')) or lit1(('*'), ('*')) or lit1(('+'), ('+')), one).<br>
<br> % [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?<br> <br>diff --git a/samples/rot13/rot13_concise.m b/samples/rot13/rot13_concise.m<br>index 02217b7..5c063a3 100644<br>--- a/samples/rot13/rot13_concise.m<br>
+++ b/samples/rot13/rot13_concise.m<br>@@ -27,18 +27,23 @@<br> :- import_module char, int, string.<br> <br> % The length of `alphabet' should be a multiple of `cycle'.<br>+:- func alphabet = string.<br>+<br> alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".<br>
+:- func cycle = int.<br> cycle = 26.<br> <br>+:- func rot_n(int, char) = char.<br> rot_n(N, Char) = RotChar :-<br> char_to_string(Char, CharString),<br> ( if sub_string_search(alphabet, CharString, Index) then<br> NewIndex = (Index + N) mod cycle + cycle * (Index // cycle),<br>
- index_det(alphabet, NewIndex, RotChar)<br>+ string.det_index(alphabet, NewIndex, RotChar)<br> else<br> RotChar = Char<br> ).<br> <br>+:- func rot13(char) = char.<br> rot13(Char) = rot_n(13, Char).<br> <br> main --><br>
diff --git a/samples/solver_types/sudoku.m b/samples/solver_types/sudoku.m<br>index 2f34eac..14b2778 100644<br>--- a/samples/solver_types/sudoku.m<br>+++ b/samples/solver_types/sudoku.m<br>@@ -40,7 +40,7 @@ main(!IO) :-<br>
ReadResult = ok(StartString),<br> Start = string.words(StartString),<br> ( if solve_sudoku(Start, Solution) then<br>- write_solution(9, Solution, !IO)<br>
+ write_solution(9, 1, Solution, !IO)<br> else<br> io.write_string("No solution.\n", !IO)<br> )<br>@@ -169,19 +169,27 @@ label_board([EqNeq | EqNeqs], [X | Xs]) :-<br>
<br> % Pretty-print a solution.<br> %<br>-:- pred write_solution(int::in, list(int)::in, io::di, io::uo) is det.<br>+:- pred write_solution(int::in, int::in, list(int)::in, io::di, io::uo) is det.<br> <br>-write_solution(_, [], !IO) :-<br>
+write_solution(_, _, [], !IO) :-<br> <a href="http://io.nl">io.nl</a>(!IO).<br> <br>-write_solution(N, [X | Xs], !IO) :-<br>+write_solution(N, R, [X | Xs], !IO) :-<br> ( if N = 0 then<br> <a href="http://io.nl">io.nl</a>(!IO),<br>
- write_solution(9, [X | Xs], !IO)<br>+ ( if (R mod 3) = 0<br>+ then <a href="http://io.nl">io.nl</a>(!IO)<br>+ else true<br>+ ),<br>+ write_solution(9, R + 1, [X | Xs], !IO)<br>
else<br> io.write_int(X, !IO),<br> io.write_char(' ', !IO),<br>- write_solution(N - 1, Xs, !IO)<br>+ ( if (N mod 3) = 1<br>+ then io.write_char(' ', !IO)<br>
+ else true<br>+ ),<br>+ write_solution(N - 1, R + 1, Xs, !IO)<br> ).<br> <br> %-----------------------------------------------------------------------------%</div>