Skip to content

Instantly share code, notes, and snippets.

@Steelbirdy
Steelbirdy / euclid.rs
Last active September 4, 2022 16:05
The Euclidean Algorithm implemented entirely in the Rust type system.
#![feature(generic_associated_types)]
use std::marker::PhantomData;
macro_rules! num {
() => { Z };
(* $($rest:tt)*) => { S<num!($($rest)*)> };
}
macro_rules! print_gcd {
@kg583
kg583 / hello_world.py
Created August 7, 2022 22:42
Hello World! with only 2 distinct punctuation marks
from operator import attrgetter
from operator import itemgetter
@itemgetter
@slice
@int
@next
@reversed
@str
from warnings import catch_warnings, filterwarnings # this is always nice to see at the top of a file
class Primitive:
__slots__ = ["args"]
def __init__(self, *args): self.args = args
def __await__(self): return (yield self.args) # also a fun sight to see
async def eof(): return await Primitive("eof")
async def munch(): return await Primitive("munch")
async def choice(*args): return await Primitive("choice", args)