code logs -> 2020 -> Sun, 04 Oct 2020< code.20201003.log - code.20201005.log >
--- Log opened Sun Oct 04 00:00:08 2020
--- Day changed Sun Oct 04 2020
00:00 catalyst [catalyst@Nightstar-v6lb30.cable.virginm.net] has joined #code
00:38 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has quit [Ping timeout: 121 seconds]
01:01 himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code
01:01 mode/#code [+o himi] by ChanServ
01:12 Misty is now known as Vornicus
01:12 mode/#code [+qo Vornicus Vornicus] by ChanServ
01:18 Kizor is now known as Shirley
01:44 Shirley is now known as Kizor
02:36 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
03:25 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
03:30 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has joined #code
03:30 mode/#code [+o Reiv] by ChanServ
03:38 Degi [Degi@Nightstar-e72506.dyn.telefonica.de] has quit [Ping timeout: 121 seconds]
03:39 Degi [Degi@Nightstar-jf34ka.pool.telefonica.de] has joined #code
04:36 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
04:36 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has joined #code
04:36 mode/#code [+o Reiv] by ChanServ
04:42 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
04:43 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has joined #code
04:43 mode/#code [+o Reiv] by ChanServ
04:48 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
04:48 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:53 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
05:02 Pinkhair [uid208117@Nightstar-h2b233.irccloud.com] has joined #code
05:46
<&McMartin>
Woo
05:46 * McMartin gets a runnable hello world program on the TRS-80
05:46
<&McMartin>
I also note that there is a TRS-80 podcast called "Trash Talk" and this is great
05:49
<~Vornicus>
that is a good name
06:38 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has quit [Connection closed]
06:38 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has joined #code
06:38 mode/#code [+ao VirusJTG VirusJTG] by ChanServ
06:47
<@sshine>
I'm trying to model the set of cocktails as a monoid in Haskell.
06:49
<@sshine>
initially I represent a cocktail as a 'Map Ingredient Natural' (a dictionary mapping ingredients to the number of parts in the cocktail recipe).
06:50
<@sshine>
I also define mix :: Cocktail -> Cocktail -> Cocktail by simply adding the parts together, so if 'gintonic' is {gin:1,tonic:1}, then 'mix gintonic gintonic' simply becomes {gin:2,tonic:2}. the problem with that is that trivially, 'gintonic /= mix gintonic gintonic', which reflects that I've not actually modelled the *recipe* but the *drink*.
06:51
<@sshine>
surely a twice as big gin-tonic is not the same, but recipe-wise, only the ratio between the parts matters.
06:51
<@sshine>
I realize that what I *probably* want to model is the recipe.
06:51
<@sshine>
at least, the recipe forms nicer equivalences for this nicely structured monoid that I'm trying to form.
06:51
<@sshine>
so... really... since there is no point to this, I'd rather model the thing that expresses a nice property.
06:54
<@sshine>
so I need to normalize the parts somewhere
06:55
<@sshine>
I could either do it in the constructor for Cocktail, since then equality testing can be a simple check for structural equality.
06:56
<@sshine>
but the drawback is that I won't be able to have these helper functions: parts :: Natural -> Ingredient -> Cocktail, e.g. 2 `parts` Gin.
06:56
<@sshine>
since 2 `parts` Gin would immediately get reduced to 1 `parts` Gin.
06:57
< Pinkhair>
It seems that not including the glasses could lead to some issues.
06:57
<@sshine>
or I could do it in the Eq instance ('==' operator), which means I can actually have recipes that say "5 parts X" and that's it... maybe that's kinda funny even though it is, normalized, equivalent to 1 part X.
06:58
<@sshine>
one drawback of normalizing when comparing is that it's a bit more expensive if comparing often.
06:59
<@sshine>
another drawback is that eventually I'll need to go and fix the Ord instance ('<=' operator), not because there is any obvious way to order drinks, but because in Haskell it is *very* nice to have some unambiguous, structurally derived ordering relation for practical purposes such as stuffing cocktails inside dictionaries.
07:00
<@sshine>
I think this suggests that the normalization must happen in 'mix' which is going to be the monoidal composition operator.
07:02
<@sshine>
and... argh... that'd mean 1 `parts` Gin /= 2 `parts` Gin which, I guess, is what I'm arguing for, even though... yeah, I guess if you ever go to a bar and one person says they'd like plain gin and you'd say you'd like two parts plain gin, you probably get served twice the alcohol.
07:02
<@sshine>
so... the drink 2 `parts` Gin is distinct from 1 `parts` Gin, and then (1 `parts` Gin) `mix` (2 `parts` Gin) can't become 1 `parts` Gin, that's just silly...
07:03
<@sshine>
OK, clearly I'm being inconsistent here. the distinction of ordering says "cocktail the object", not "cocktail the recipe".
07:03
<@sshine>
I have to stick to one interpretation at a time.
07:04
<~Vornicus>
free commutative monoid
07:05
<@sshine>
cocktail, the beverage, is a free commutative monoid.
07:05
< Pinkhair>
I am reminded of the example from i7
07:06
<@sshine>
i7?
07:07
< Pinkhair>
'Any given liquid can be expressed as a vector in N-space, where N is the number of available ingredients and the length of the vector depends on how much of each ingredient is used; then we find the recipe that best describes the liquid by taking the dot product of our liquid vector with a bunch of sample vectors and selecting the one with the largest result.'
07:07
< Pinkhair>
Inform
07:07
< Pinkhair>
Inform 7 that is
07:07
<@sshine>
cocktail, the recipe, is a quotient subgroup of the free commutative monoid of cocktail, the beverage... I think?
07:08
<@sshine>
Pinkhair, ah :) I know of Inform 7. played with it briefly some years ago. was impressed, yet couldn't concentrate on making use of it.
07:08
<@sshine>
Pinkhair, yeah, so a cocktail recipe is like an N-vector except scaled down to the unit vector.
07:09 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
07:09
<@sshine>
i.e. recipes don't care about quantities, only ratios.
07:10
<@sshine>
so to form the monoid over recipes, I have to scale down the quantities of each ingredient.
07:10
<@sshine>
so scaling *has* to happen while mixing.
07:10
<@sshine>
OK, I just derailed myself a little, but here comes my actual question:
07:12
<@sshine>
if a cocktail (one drink) is easily modelled as a dictionary mapping ingredients to quantities, how do I normalize the sum of two cocktails?
07:13
<@sshine>
e.g. {gin:1} + {tonic:1} = {gin:1,tonic:1}, so if there's no overlap, the parts are preserved.
07:13
<@sshine>
but {gin:1,tonic:2} + {gin:2,tonic:1} = {gin:1,tonic:1}
07:13
< Pinkhair>
I dunno if they actually only care about ratios.
07:13
<@sshine>
I guess one thing I can do is divide by the GCD of every multiplicity.
07:14
<@sshine>
Pinkhair, I think mixologists care about a lot of things that are incompatible with this simplistic understanding of what a cocktail is. for example, real cocktails aren't actually commutative. i.e., order of pouring matters.
07:17
<@sshine>
and yeah, I think they don't actually just care about the ratios, as in, you can't make an a drink with an actual gallon of vodka, unless you call it a punch. :-D
07:18
<@sshine>
so 100 `parts` Vodka isn't just a plain vodka, it's a bad idea.
07:40 Vorntastic [uid293981@Nightstar-h2b233.irccloud.com] has joined #code
07:40 mode/#code [+qo Vorntastic Vorntastic] by ChanServ
07:47 celticminstrel [celticminst@Nightstar-ke9gs7.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
07:52
<@sshine>
when I add two cocktail recipes, I have to make sure that I scale them according to their common ingredients. that was the part I had a hard time articulating, I think.
07:53
<@sshine>
when you combine recipes you have to choose between scaling or not scaling, and I think... I don't even know if it makes sense to always pick one, since such cocktails probably end up pretty bad, anyways.
07:54
<@sshine>
so {gin:1, tonic:1} + {gin:2, lemon:1} = {gin:2, tonic:2} + {gin:2, lemon:1} = {gin:4, tonic:2, lemon:1}... is one possible way to add recipes.
07:55
<@sshine>
but wait, what if there isn't a natural scaling between all ingredients. this is getting ridiculous. I'm clearly over-complicating things.
07:58
<@sshine>
{gin:1, tonic:2} + {gin:2, tonic:3, lemon:1}; now there's no obvious factor between the two. so the only trivial way to add two cocktail recipes is to just combine the verbatim ingredients list. then if I want to normalize that, that is clearly an interpretation in my own imagination of what a cocktail recipe is, since I've made so many assumptions that are not real.
08:02
<~Vorntastic>
Mixology is not exactly abstract algebra
08:17
<@sshine>
also, normalizing recipe quantities when mixing breaks associativity.
08:26
<&McMartin>
Well, this didn't end well. https://imgur.com/a/pXMuJNn
08:58
<&McMartin>
Nothing like having your board cells be 1 2/3s characters tall because that's the largest that fits and the smallest that still lets you distinguish solid from outline.
09:05
<~Vorntastic>
Yikes
09:26
<@sshine>
McMartin, maybe only have the letters at the bottom?
09:30
<@sshine>
Vorntastic, ah, so what I ended up with *was* a free commutative monoid, and the thing I *tried* to make didn't respect the monoid laws. :)
09:31
<~Vorntastic>
Yes
09:31 SmithKurosaki [uid215460@Nightstar-0bi4dv.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
09:43 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has joined #code
10:42 Pinkhair [uid208117@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
12:22 catalyst [catalyst@Nightstar-v6lb30.cable.virginm.net] has quit [[NS] Quit: -a- Connection Timed Out]
12:22 catalyst [catalyst@Nightstar-v6lb30.cable.virginm.net] has joined #code
13:08 catalyst_ [catalyst@Nightstar-36fut4.dab.02.net] has joined #code
13:10 catalyst [catalyst@Nightstar-v6lb30.cable.virginm.net] has quit [Ping timeout: 121 seconds]
13:16 catalyst [catalyst@Nightstar-v6lb30.cable.virginm.net] has joined #code
13:19 catalyst_ [catalyst@Nightstar-36fut4.dab.02.net] has quit [Connection reset by peer]
14:06 SmithKurosaki [uid215460@Nightstar-0bi4dv.irccloud.com] has joined #code
16:15 celticminstrel [celticminst@Nightstar-ke9gs7.dsl.bell.ca] has joined #code
16:15 mode/#code [+o celticminstrel] by ChanServ
18:20 Pinkhair [uid208117@Nightstar-h2b233.irccloud.com] has joined #code
19:09 Vorntastic [uid293981@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
21:10 Pinkhair [uid208117@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
21:43 Pinkhair [uid208117@Nightstar-h2b233.irccloud.com] has joined #code
22:33 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has joined #code
22:33 mode/#code [+o Reiv] by ChanServ
22:55 McMartin [mcmartin@Nightstar-c25omi.ca.comcast.net] has quit [[NS] Quit: Reboot]
22:58 McMartin [mcmartin@Nightstar-c25omi.ca.comcast.net] has joined #code
22:58 mode/#code [+ao McMartin McMartin] by ChanServ
22:59 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has quit [Ping timeout: 121 seconds]
--- Log closed Mon Oct 05 00:00:54 2020
code logs -> 2020 -> Sun, 04 Oct 2020< code.20201003.log - code.20201005.log >

[ Latest log file ]