This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(generic_associated_types)] | |
use std::marker::PhantomData; | |
macro_rules! num { | |
() => { Z }; | |
(* $($rest:tt)*) => { S<num!($($rest)*)> }; | |
} | |
macro_rules! print_gcd { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operator import attrgetter | |
from operator import itemgetter | |
@itemgetter | |
@slice | |
@int | |
@next | |
@reversed | |
@str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |