From cb1ee55373e5efd1441664ec4e6942d4ace5e368 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 21 Jan 2015 16:55:17 +0100 Subject: Implemented `Contains` in terms of `Any` * as its name implies this _function_ simplifies checking if a specific value is contained within a given list * updated `Map` to actually resolve the provided _function_ --- test.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test.cc') diff --git a/test.cc b/test.cc index 49b95cb..718fb70 100644 --- a/test.cc +++ b/test.cc @@ -6,6 +6,7 @@ #include "list/cons.h" #include "list/list.h" #include "list/operation/reverse.h" +#include "list/operation/contains.h" #include "list/operation/higher/fold.h" #include "list/operation/higher/misc.h" #include "list/operation/higher/query.h" @@ -466,3 +467,27 @@ static_assert( >::value, "(none even? (list 2 3 5)) != #f" ); + +// list contains + +static_assert( + std::is_same< + tav::Boolean, + tav::Contains< + tav::Int<2>, + tav::List, tav::Int<2>, tav::Int<3>>::type + >::type + >::value, + "(contains 2 (list 1 2 3)) != #t" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::Contains< + tav::Int<0>, + tav::List, tav::Int<2>, tav::Int<3>>::type + >::type + >::value, + "(contains 0 (list 1 2 3)) != #f" +); -- cgit v1.2.3