commit 57d43acd16795aea159d57cdadd1da739d18a78e Author: lauchmelder Date: Wed Nov 27 20:27:51 2024 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b010b19 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.cache/ +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..40d4d4f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.20) + +project(templates CXX) +set(CMAKE_CXX_STANDARD 20) + +add_executable(templates + src/main.cpp +) diff --git a/src/Data.hpp b/src/Data.hpp new file mode 100644 index 0000000..c210d17 --- /dev/null +++ b/src/Data.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include +template +struct Data { + using type = Type; + static constexpr Type value = Value; +}; + +template +struct Number : + public Data +{}; + diff --git a/src/Lambda.hpp b/src/Lambda.hpp new file mode 100644 index 0000000..e6bc84f --- /dev/null +++ b/src/Lambda.hpp @@ -0,0 +1,35 @@ +#include "Data.hpp" + +template +struct Lambda { + using returnType = Return; + // using paramType = Parameter; +}; + +template +struct Identity : + public Lambda +{ + using value = X; +}; + +template +struct NumericIncrement : + public Lambda +{ + using value = Number; +}; + +template +struct NumericDouble : + public Lambda +{ + using value = Number; +}; + +template +struct NumericAdd : + public Lambda +{ + using value = Number; +}; diff --git a/src/List.hpp b/src/List.hpp new file mode 100644 index 0000000..f4d4afa --- /dev/null +++ b/src/List.hpp @@ -0,0 +1,75 @@ +#pragma once + +#include +#include +#include "Lambda.hpp" + +template +struct List { + using type = typename Head::type; + using value = Head; + using cons = Cons; +}; + +template <> +struct List { + using type = void; + using value = void; +}; + +template +struct List { + using type = typename Head::type; + using value = Head; + using cons = ::List; +}; + +template +struct ListConstructor { + using value = ::List::value>; +}; + +template +struct ListConstructor { + using value = ::List; +}; + +template +struct List_Nth_Element { + using value = typename List_Nth_Element::value; +}; + +template +struct List_Nth_Element { + using value = typename List::value; +}; + + +template