Created
October 13, 2024 03:24
-
-
Save gfldex/c54be3c0967ba8c173ac65eb1bb3a2b8 to your computer and use it in GitHub Desktop.
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
use v6.d; | |
enum Meat <Chicken Beef Pork Fish Veggie>; | |
enum Ingredient <Cheese Rice Beans Salsa Guacamole SourCream Lettuce Tomato Onion Cilantro PicoDeGallo>; | |
subset Burritoish where Meat | Ingredient; | |
sub return-burrito($meat, @ingredients) { | |
$meat, @ingredients | |
} | |
sub tortilla { | |
return-burrito(Veggie, []) | |
} | |
sub add-meat(Meat $meat, [$, @ingredients]) { | |
$meat, @ingredients | |
} | |
sub add-mission-burrito-ingredients([$meat, @ingredients]) { | |
$meat, ( (Cheese, Rice, Beans) ∪ @ingredients ).keys.Array | |
} | |
sub add-ingredient($ingredient, ($meat, @ingredients)) { | |
$meat, (@ingredients ∪ $ingredient).keys.Array | |
} | |
sub hold-the($ingredient, [$meat, @ingredients]) { | |
$meat, (@ingredients ∖ $ingredient).keys.Array | |
} | |
multi infix:«>>=»(\burrito, &f) is looser(&infix:<,>) { | |
} | |
tortilla() | |
==> add-meat Chicken | |
==> add-mission-burrito-ingredients() | |
==> hold-the Cheese | |
==> add-ingredient Salsa | |
==> put(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment