21 hours ago
- The author wrote a Datalog program called Mixologician to determine which ingredients to buy to maximize the number of new cocktails they can make at home.
- The program uses relations like Has, Needs, Begets, and Composite to model ingredients, recipes, and transformations (e.g., limes beget lime juice, lime zest, and more).
- A key rule (Enables) finds ingredients that, if acquired, would make a currently unmakeable drink mixable by comparing the count of missing ingredients with those the ingredient can beget.
- Begets includes self-begetting for all ingredients, and transitive begets, allowing complex ingredient substitutions (e.g., reposado tequila can stand in for tequila).
- Composite handles multi-ingredient preparations like lime cordial (sugar + lime zest), enabling indirect solutions.
- Recipes were scraped from Tuxedo No. 2 using wget, pup, and sed, with 'or' ingredients handled as begets and marked unbuyable to avoid listing them as purchase suggestions.
- Running Mixologician on the author's bar produced a shopping list; Peychaud's bitters was the most efficient purchase, enabling seven new cocktails.