From e12544d7b9e58f26e66aa63bd61fc8c446c71a18 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Wed, 16 Jan 2019 00:06:23 +0100 Subject: ... --- src/ataxic.erl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/ataxic.erl') diff --git a/src/ataxic.erl b/src/ataxic.erl index 6e941c4..2bd8796 100644 --- a/src/ataxic.erl +++ b/src/ataxic.erl @@ -38,6 +38,8 @@ -record(lor, {params :: list(basic())}). -record(neg, {param :: basic()}). +-record(list_cons, {param :: basic()}). + % TODO: list all of the above. -type basic() :: any(). @@ -72,7 +74,8 @@ eq/2, land/1, lor/1, - neg/1 + neg/1, + list_cons/1 ] ). @@ -126,12 +129,13 @@ basic_apply_to (#eq{ p0 = P0, p1 = P1 }, Val) -> basic_apply_to (#land{ params = List }, Val) -> lists:all(fun (E) -> basic_apply_to(E, Val) end, List); - basic_apply_to (#lor{ params = List }, Val) -> lists:any(fun (E) -> basic_apply_to(E, Val) end, List); - basic_apply_to (#neg{ param = V }, Val) -> - not basic_apply_to(V, Val). + not basic_apply_to(V, Val); + +basic_apply_to (#list_cons{ param = V }, Val) -> + [V|Val]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -180,6 +184,9 @@ lor (List) -> #lor{ params = List }. neg (V) -> #neg{ param = V }. +-spec list_cons (basic()) -> basic(). +list_cons (V) -> #list_cons{ param = V}. + -spec sequence_meta (list(meta())) -> meta(). sequence_meta (List) -> #mseq{ ops = List }. -- cgit v1.2.3-70-g09d2