Skip to content

Instantly share code, notes, and snippets.

@kepler-5
kepler-5 / comp_multi.rs
Last active April 24, 2025 16:15
Python comprehension proc macro that handles multiple nested for-if-clauses, flattening nested structure
// This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
@kepler-5
kepler-5 / cbf.cpp
Created October 12, 2020 03:33
constexpr brainfuck interpreter
#include <array>
#include <cstdint>
#include <cstdio>
#include <string_view>
#include <type_traits>
#include <optional>
#include <variant>
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;