i have some type error somewhere in the bit matrices

This commit is contained in:
2025-10-11 04:44:11 -06:00
parent 6c45f30919
commit d8bb83bd4e
4 changed files with 512 additions and 3 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ default() ->
#ctx{snowflakes = default_snowflakes()}.
default_snowflakes() ->
#{<<"and">> => fun wfc:mul/1,
<<"xor">> => fun wfc:add/1}.
#{<<"and">> => fun wfc:mul/1,
<<"xor">> => fun wfc:add/1}.
define(Pat, Sentence, Ctx = #ctx{patterns = OldPatterns}) ->
NewPatterns = maps:put(Pat, Sentence, OldPatterns),
+33 -1
View File
@@ -4,7 +4,9 @@
eval_result/1,
sentence/1,
word/1,
ltr/1
ltr/1,
bm/1,
bm_sparse/1
]).
@@ -48,3 +50,33 @@ letters([]) -> "".
-spec ltr(wfc_ltr:ltr()) -> string().
ltr({c, Binary}) -> unicode:characters_to_list(Binary).
-spec bm(wfc_bm:bm()) -> string().
bm(Matrix) ->
List = wfc_bm:to_list(Matrix),
Strs = lists:map(fun pf_bm_row/1, List),
IoList = ["[", string:join(Strs, "\n "), "]"],
unicode:characters_to_list(IoList).
pf_bm_row(Bits) ->
Strs = lists:map(fun integer_to_list/1, Bits),
["[", string:join(Strs, " "), "]"].
-spec bm_sparse(wfc_bm:bm()) -> string().
bm_sparse(Matrix) ->
List = wfc_bm:to_list(Matrix),
Strs = lists:map(fun pf_bm_row_sparse/1, List),
IoList = ["[", string:join(Strs, "\n "), "]"],
unicode:characters_to_list(IoList).
pf_bm_row_sparse(Bits) ->
Strs = lists:map(fun i2l_sparse/1, Bits),
["[", string:join(Strs, " "), "]"].
i2l_sparse(1) -> "1";
i2l_sparse(0) -> " ".