Live data from Hacker News

Programming with Categories

brendanfong.com

101–110 of 113 posts

Re: Programming with Categories

#101
post #88

Earlier quoted context omitted.

Tautological sufficiency/necessity relativities for an absolute measure are a pet peeve: “How much salt should I add?” “Oh, not too much.” Practically guarantees a withering glare from me.

That's a really great analogy, actually. You can't tell a brand-new cook "salt to taste," but you can tell a cook with an intermediate level of experience "salt to taste" even if it's a recipe they've never made before. You can't impart the experience in words, pictures, or symbols. You can't add a chapter zero that gets them there. But the right kind of experience will get you there pretty quickly. I admit it's kind…

Giving a precise value for this doesn't work in any case. "Salt to taste" is inherently qualitative.

Most pizza dough recipes quote around 5g of salt for 250g flour. Personally I prefer double that amount, and this is the case with many recipes.

Perhaps specifically with salt there is an insane amount of paranoia about blood pressure. In many ways it feels as irrational as Korean worries about fan death.

On the other hand, giving a "5g of salt" value is a good starting point, to avoid undersalting due to paranoia or oversalting due to inexperience.

Re: Programming with Categories

#104
post #88

Earlier quoted context omitted.

That's a really great analogy, actually. You can't tell a brand-new cook "salt to taste," but you can tell a cook with an intermediate level of experience "salt to taste" even if it's a recipe they've never made before. You can't impart the experience in words, pictures, or symbols. You can't add a chapter zero that gets them there. But the right kind of experience will get you there pretty quickly. I admit it's kind…

Giving a precise value for this doesn't work in any case. "Salt to taste" is inherently qualitative. Most pizza dough recipes quote around 5g of salt for 250g flour. Personally I prefer double that amount, and this is the case with many recipes. Perhaps specifically with salt there is an insane amount of paranoia about blood pressure. In many ways it feels as irrational as Korean worries about fan death. On the other…

What they really need is someone to tell them to add less than they probably need, then taste, add more, taste, add more, and expect to over-season and under-season some dishes as they get experience. Salt quantities in recipes have to be short, sometimes way short, so you're stuck learning the process with or without the quantities. I've never seen this explained in a cookbook, at least not in a way that made an impression on me.

Edit: A piece of advice that has stuck with me for a long time, long after I forgot where it came from, is it's a mistake to look for the state in between "not salty enough" and "too salty." That state doesn't really exist, especially when you're feeling nervous! Instead you should look for the overlap where you can perceive the dish as alternately "not salty enough" and "too salty," like that ambiguous drawing that your brain can resolve to either an old woman or a young woman[0]. That advice really works for me, but my wife, who seasons like a pro, thinks it's nonsense, which I think illustrates how subjective the process is and how it isn't information you can impart but rather experience you have to guide someone toward.

[0] https://en.wikipedia.org/wiki/My_Wife_and_My_Mother-in-Law#/...

Re: Programming with Categories

#105
post #19

I've read a lot about Category Theory, and I'm amazed at the abstraction level that lets you compose with different mathematical domains (geometry, topology, arithmetic, sets, ...). And yet, the current mathematics relies heavily on the ZFC set theory. Why is that ? (Is that assumption even correct ?) From what I've learned so far, the set theory suffers from Russel's Paradox[0] (does the set of all sets that does no…

It may be worth explicitly noting that category theory and set theory are not mutually exclusive. You can use set theory as the foundation, and build category theory on that, and then use category theory to do all that interconnection of fields and whatnot. To me it seems like the most natural way to do it, because set theory is simple and intuitive (kind of), whereas category theory is complicated and extremely abstract.

(Of course there is a lot of stuff in set theory that is counter-intuitive when you get to infinite sets, but I still think that's better than what you have with categories where they're just abstract algebraic objects and there isn't any intuition in the first place.)

Re: Programming with Categories

#106
post #7
post #3

"We will assume no background knowledge on behalf of the student, starting from scratch on both the programming and mathematics." This is a fantastic "side effect" of the fact that category theory isn't built on any other mathematical knowledge. You don't even need even any arithmetics for that.

to get super meta, one could say that the opposite is true: arithmetic requires categories

You should read the famous book by Linderholm, Mathematics Made Difficult

Re: Programming with Categories

#107

If you're interested in how Category theory and Algebra can inform the design of software, have a look at ZIO Prelude. https://github.com/zio/zio-prelude It's a brand new library for Scala that contains reusable mathematical structures. Still based on algebra and category theory, but it expresses them more or less differently than how they've been expressed in Haskell (and similar languages). For example, unlike Hask…

Are there any useful types that have `flatten` but not `map` or `contraMap`?

Re: Programming with Categories

#108
post #38

Earlier quoted context omitted.

You've definitely used Functors or Semigroups as well, you just didn't realize it.

Here is my problem with these ideas in programming: if you recognize that some common construct is in fact a semigroup or functor, does knowing this actually buy you anything? I suppose it might help sometimes when designing an abstraction, to guide you to some nice properties, such as easy composition.

> if you recognize that some common construct is in fact a semigroup or functor, does knowing this actually buy you anything?

At least in Haskell one thing it means is you can use lots of new helper functions.

> guide you to some nice properties, such as easy composition.

Yep, which gets you code re-use for one.

Re: Programming with Categories

#109
post #38

Earlier quoted context omitted.

You've definitely used Functors or Semigroups as well, you just didn't realize it.

Here is my problem with these ideas in programming: if you recognize that some common construct is in fact a semigroup or functor, does knowing this actually buy you anything? I suppose it might help sometimes when designing an abstraction, to guide you to some nice properties, such as easy composition.

While playing around with a problem at work involving Markov chains and graph connectivity, I found it useful to know that I could write (in Java) a generic method that performed "exponentiation by squaring" on semigroups.

So, in addition to being able to raise numbers to powers I could also use it on matrices whose elements belonged to a semiring.

That is, I could use the same code on a matrix of doubles with "times" and "plus" (for the Markov chains), as well as a matrix of booleans with "and" and "or" (for the graph connectivity).

(Of course, I could have used special purpose libraries, but these were small problems and it was fun. :)

Re: Programming with Categories

#110

Earlier quoted context omitted.

> What is the beautiful monospace font in the pdf t1xtt, from the txfonts package, freely available

Thank you! No ttf/otf though :)

It looks like a fork of Luxi Mono with slashed zero, which is available in ttf. And there is a more modern version of it with better character coverage -- Go Mono.
Post reply on HN