i have some type error somewhere in the bit matrices
This commit is contained in:
@@ -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
@@ -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) -> " ".
|
||||
|
||||
Reference in New Issue
Block a user