carcdr.cpp 591 B

1234567891011121314151617181920212223
  1. #include "simple/support/carcdr.hpp"
  2. using namespace simple::support;
  3. template <int... Is>
  4. using iseq = std::integer_sequence<int, Is...>;
  5. int main()
  6. {
  7. using ints = lisp_list<int, -1, 10, 13, 999>;
  8. static_assert(car<ints> == -1);
  9. static_assert(std::is_same_v< cdr<ints>, lisp_list<int, 10, 13, 999> >);
  10. static_assert(car< cdr<cdr<ints>> > == 13);
  11. static_assert(car<ints, 3> == 999);
  12. static_assert(car<lisp_list<int>, 0, 321> == 321);
  13. static_assert(car<ints, 10, -9517> == -9517); // *shrug*
  14. static_assert(std::is_same_v<cdr<cdr<cdr<cdr<ints>>>>, lisp_list<int>>);
  15. return 0;
  16. }