I hyperfocused on making evil Rust macros all week and nowf that teh hf is gone I am reduced to a kitty puddle once againf, meowf
fn main() {
let a = mreplace! { (10,20) => (#1 + #2) * (#2 - #1) };
println!("{}", a);
mreplace! {
"hello" => println!("{}", concat!(#1,#1,#1,#1))
};
}300
hellohellohellohello
({$($a:tt)*}{$({$($i: tt)*})*}{$($cm: tt)?}
{{$($r1:tt)*}$($r2:tt)*}{$($l1:tt)*}$({$($lx:tt)*})*) => {
mc_replace!({$($a)*}{$({$($i)*})*}{$($cm)*}
{$($r1)*}{{$($r2)*}$($l1)*}{}$({$($lx)*})*) $($cm)*
};
({$($a:tt)*}{$({$($i: tt)*})*}{$($cm: tt)?}
{$r1:tt$($r2:tt)*}{$($l1:tt)+}{$($l2:tt)*}$({$($lx:tt)*})*) => {
mc_replace!({$($a)*}{$({$($i)*})*}{$($cm)*}
{$($r2)*}{$($l1)*}{$($l2)*$r1}$({$($lx)*})*) $($cm)*
};
({$($a:tt)*}{$({$($i: tt)*})*}{$($cm: tt)?}
{}{($($r1:tt)*)$($r2:tt)*}{$($lz:tt)*}{$($ly:tt)*}$({$($lx:tt)*})*) => {
mc_replace!({$($a)*}{$({$($i)*})*}{$($cm)*}
{$($r1)*}{$($r2)*}{$($ly)*($($lz)*)}$({$($lx)*})*) $($cm)*
};
({$($a:tt)*}{$({$($i: tt)*})*}{$($cm: tt)?}
{}{[$($r1:tt)*]$($r2:tt)*}{$($lz:tt)*}{$($ly:tt)*}$({$($lx:tt)*})*) => {
mc_replace!({$($a)*}{$({$($i)*})*}{$($cm)*}
{$($r1)*}{$($r2)*}{$($ly)*[$($lz)*]}$({$($lx)*})*) $($cm)*
};
({$($a:tt)*}{$({$($i: tt)*})*}{$($cm: tt)?}
{}{{$($r1:tt)*}$($r2:tt)*}{$($lz:tt)*}{$($ly:tt)*}$({$($lx:tt)*})*) => {
mc_replace!({$($a)*}{$({$($i)*})*}{$($cm)*}
{$($r1)*}{$($r2)*}{$($ly)*{$($lz)*}}$({$($lx)*})*) $($cm)*
};
I didn'f feel like writing a proc macro, meowf.
Rufus Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=fc381b07e1a3e05a2179ebe46f592409
doing Things in rustf
fn main() {
let v = vec![1,2,3,4];
let m = Map::gen((|x| x+1,));
let n = Map::gen((|x| x*2,));
let j = Join::gen((m,n));
println!("{:?}", v.iterate(j));
}[4, 6, 8, 10]
u cannof grasp teh True Form of this mess I made
fn main() {
let v = vec![1,2,3,4];
let w = iterate!(v => map(|x| x+1) map(|x| x*2));
println!("{:?}", w);
}[4, 6, 8, 10]
doing Things in rustf
fn main() {
let v = vec![1,2,3,4];
let m = Map::gen((|x| x+1,));
let n = Map::gen((|x| x*2,));
let j = Join::gen((m,n));
println!("{:?}", v.iterate(j));
}[4, 6, 8, 10]