From 27aaee43499c268903332c7e9e1e6ec2d193dc3a Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 6 Feb 2015 19:26:26 +0100 Subject: Revamped to use `Cons` as a function and `Pair` as its result * this is analogous to _Scheme_ where a pair (dot-expression) is returned from a call to `cons` * `Head` and `Tail` are kept as direct references to the `CAR` and `CDR` values of a pair to match e.g. the math operators --- test.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index da3193f..9037e25 100644 --- a/test.cc +++ b/test.cc @@ -189,8 +189,8 @@ static_assert( std::is_same< tav::Int<1>, tav::Car< - tav::Cons, void> - > + tav::Cons, void>::type + >::type >::value, "(car (cons 1 void)) != 1" ); @@ -199,8 +199,8 @@ static_assert( std::is_same< tav::Int<1>, tav::Car< - tav::Cons, tav::Int<2>> - > + tav::Cons, tav::Int<2>>::type + >::type >::value, "(car (cons 1 2)) != 1" ); @@ -209,8 +209,8 @@ static_assert( std::is_same< tav::Int<2>, tav::Cdr< - tav::Cons, tav::Int<2>> - > + tav::Cons, tav::Int<2>>::type + >::type >::value, "(cdr (cons 1 2)) != 2" ); @@ -220,9 +220,9 @@ static_assert( tav::Int<2>, tav::Car< tav::Cdr< - tav::Cons, tav::Cons, tav::Int<3>>> - > - > + tav::Cons, tav::Cons, tav::Int<3>>::type>::type + >::type + >::type >::value, "(car (cdr (cons 1 (cons 2 3)))) != 2" ); @@ -231,7 +231,7 @@ static_assert( static_assert( std::is_same< - tav::Cons, void>, + tav::Pair, void>, tav::List>::type >::value, "(list 1) != (cons 1 void)" @@ -239,7 +239,7 @@ static_assert( static_assert( std::is_same< - tav::Cons, tav::Cons, void>>, + tav::Pair, tav::Pair, void>>, tav::List, tav::Int<2>>::type >::value, "(list 1 2) != (cons 1 (cons 2 void))" @@ -249,7 +249,7 @@ static_assert( static_assert( std::is_same< - tav::Cons, void>, + tav::Pair, void>, tav::ListOfType::type >::value, "(list 1) != (cons 1 void)" @@ -257,7 +257,7 @@ static_assert( static_assert( std::is_same< - tav::Cons, tav::Cons, void>>, + tav::Pair, tav::Pair, void>>, tav::ListOfType::type >::value, "(list 1 2) != (cons 1 (cons 2 void))" @@ -463,7 +463,7 @@ static_assert( static_assert( std::is_same< - tav::Cons< + tav::Pair< tav::List, tav::Int<3>>::type, tav::List>::type >, -- cgit v1.2.3