1
0
forked from Alepha/Alepha

Accept some type lisp improvements.

This also introduces some tuple concatenation primitives.

Closes #7
This commit is contained in:
2024-03-21 16:22:13 -04:00
2 changed files with 45 additions and 0 deletions

24
Meta/tuple_cat.h Normal file
View File

@ -0,0 +1,24 @@
static_assert( __cplusplus > 2020'99 );
#pragma once
#include <Alepha/Alepha.h>
#include <tuple>
#include <Alepha/type_lisp.h>
namespace Alepha::Hydrogen::Meta ::detail:: tuple_cat_m
{
inline namespace exports
{
template< typename Left, typename Right >
using tuple_cat_t= tuple_from_list_t< list_cat_t< list_from_tuple_t< Left >, list_from_tuple_t< Right > > >;
}
}
namespace Alepha::Hydrogen::Meta::inline exports::inline tuple_cat_m
{
using namespace detail::tuple_cat_m::exports;
}

View File

@ -141,6 +141,27 @@ namespace Alepha::Hydrogen ::detail:: type_lisp_m
{
using type= TypeList< LeftArgs..., RightArgs... >;
};
template< typename Item, std::size_t count >
struct repeat;
namespace exports
{
template< typename Item, std::size_t count >
using repeat_t= typename repeat< Item, count >::type;
}
template< typename Item, std::size_t count >
struct repeat
{
using type= cons_t< Item, repeat_t< Item, count - 1 > >;
};
template< typename Item >
struct repeat< Item, 0 >
{
using type= Nil;
};
}
namespace Alepha::Hydrogen::inline exports::inline type_lisp_m