sf <-> tt logic seems done
This commit is contained in:
parent
7560ee9151
commit
25bcfda65c
@ -7,6 +7,8 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
|
ttfun_to_tt/1,
|
||||||
|
ttfun_to_sf/1,
|
||||||
arity/1,
|
arity/1,
|
||||||
tt/1, sf/1,
|
tt/1, sf/1,
|
||||||
sf_to_tt/1, tt_to_sf/1,
|
sf_to_tt/1, tt_to_sf/1,
|
||||||
@ -19,6 +21,21 @@
|
|||||||
-opaque sf() :: {sf, wfc_bm:bm()}.
|
-opaque sf() :: {sf, wfc_bm:bm()}.
|
||||||
-opaque tt() :: {tt, wfc_bm:bm()}.
|
-opaque tt() :: {tt, wfc_bm:bm()}.
|
||||||
|
|
||||||
|
-spec ttfun_to_tt(fun()) -> tt().
|
||||||
|
|
||||||
|
ttfun_to_tt(Fun) ->
|
||||||
|
{arity, Arity} = erlang:fun_info(Fun, arity),
|
||||||
|
Argses = bfls(Arity),
|
||||||
|
OutputCol = [erlang:apply(Fun, Args) || Args <- Argses],
|
||||||
|
{tt, wfc_bm:col(OutputCol)}.
|
||||||
|
|
||||||
|
|
||||||
|
-spec ttfun_to_sf(fun()) -> sf().
|
||||||
|
|
||||||
|
ttfun_to_sf(Fun) ->
|
||||||
|
tt_to_sf(ttfun_to_tt(Fun)).
|
||||||
|
|
||||||
|
|
||||||
-spec arity(sf() | tt()) -> pos_integer().
|
-spec arity(sf() | tt()) -> pos_integer().
|
||||||
|
|
||||||
arity({sf, BM}) -> matrix_arity(BM);
|
arity({sf, BM}) -> matrix_arity(BM);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
% @doc
|
% @doc
|
||||||
% library of truth tables
|
% library of truth tables
|
||||||
-module(wfc_tts).
|
-module(wfc_ttfuns).
|
||||||
|
|
||||||
-export_type([
|
-export_type([
|
||||||
bit/0,
|
bit/0,
|
||||||
Loading…
x
Reference in New Issue
Block a user