News for hackers. Stuff that matters.
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @10:50AM (#33533321)
A lot of people don't agree. But I feel category theory is the Maxwells Equation for software.

What is the shortest distances between two points? A straight line. I calculate the solution to that problem. I don't design it. What's the best way to travel between two points? Do I take a car or plane? Which is cheaper, faster, or more comfortable? I can't calculate a solution because the problem is to complex. Instead I design the solution to the problem. That is the fundamental difference between design and calculation.

Whenever you use the word "design" you are operating in a zone where humans have no foundational optimization theory. You are guessing, using your instincts, your common sense and your gut to find solutions for the problem. It's unlikely you'll hit the most optimal solution, but you can very likely arrive at a "good" solution.

If you squint, Category theory looks to fill this gap for designing programs. Depending on how you look at it, category theory looks like a fundamental theory on how to organize code. It can be thought of as a fundamental theory on abstraction or a fundamental theory on interfaces.

Maybe another way to put it is that the concept of interfaces are the maxwells equations of software..

Even turing machines/lambda caculus seem oddly specific let alone lisp. If we want something fundamental and general I think Category theory is it.

My guess is, if the advancement of computer science was allowed to play out for centuries and we got rid of all the historical baggage, some form of category theory would lie at the heart of it all.

Re:Lisp as the Maxwell’s Equations of Software by martyalain on Wednesday November 09, 2022 @11:01AM (#33533501)
Every time I try to understand what category theory is, I hit an impassable wall, I don't understand it. Alexander Grothendieck is much too intelligent for me. But I don't despair of getting there one day...
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @11:06AM (#33533588)
I'm not an math expert. I hated math. I learned it off of very informal material:

https://bartoszmilewski.com/2014/10/28/category-theory-for-p...

and his associated youtube videos (which are EVEN better):

https://youtube.com/playlist?list=PLbgaMIhjbmEnaH_LTkxLI7FMa...

Re:Lisp as the Maxwell’s Equations of Software by martyalain on Wednesday November 09, 2022 @11:12AM (#33533669)
Thank you so much for these links, a lot to learn ...
Re:Lisp as the Maxwell’s Equations of Software by justinhj on Wednesday November 09, 2022 @12:15PM (#33534706)
Eugenia Cheng has a couple of very accessible books on Category Theory
Re:Lisp as the Maxwell’s Equations of Software by austern on Wednesday November 09, 2022 @12:32PM (#33534958)
I was going to make the same recommendation. In particular I'd recommend her new book, _The Joy of Abstraction_. It's a real textbook that goes up through the Yoneda Lemma, but it isn't too scary and it doesn't assume that the reader already knows any theoretical math.
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @12:40PM (#33535096)
I read the first couple chapters. It's a bit too watered down in the beginning IMO. I couldn't get past the first part especially when she tries to relate category theory to feminism. Might come back to it later.

As a non-math expert and programmer I highly highly recommend Bartosz stuff I linked it in another branch under my original comment.

Re:Lisp as the Maxwell’s Equations of Software by justinhj on Wednesday November 09, 2022 @05:00PM (#33538571)
Bartosz's material is great but it has a practical programming focus, so Cheng's books which focus more on teach Category Theory as mathematics, make a good complement.
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @10:05PM (#33541673)
Yeah you're probably right. Ill dive back into her book eventually.

It's mostly the beginning chapters don't even get into the meat of CT quick enough. Instead it spends a lot of time justifying things. I feel It's written for people who hated math even more then I did.

Re:Lisp as the Maxwell’s Equations of Software by justinhj on Wednesday November 09, 2022 @03:38PM (#33537494)
Yes, that book in particular. I have Emily Riehl's Category Theory in Context which was not immediately accessible to me at all. Joy of Abstraction aims to be an on-ramp to that.
Re:Lisp as the Maxwell’s Equations of Software by gaze on Wednesday November 09, 2022 @01:03PM (#33535462)
It's the idea that most structures in math can be put upon a foundation of a structure consisting of objects and the relationships between those objects.
Re:Lisp as the Maxwell’s Equations of Software by adamddev1 on Wednesday November 09, 2022 @01:36PM (#33535939)
I've found Bartosz Milewski's lectures on category theory for programmers to be very understandable and enlightening. (And I'm weak on math) He explains it really well in plain terms.

https://www.youtube.com/playlist?list=PLbgaMIhjbmEnaH_LTkxLI...

He also has a series of blog posts on it, but I found the lectures especially helpful.

Re:Lisp as the Maxwell’s Equations of Software by sicp-enjoyer on Wednesday November 09, 2022 @03:59PM (#33537736)
I do not agree with this (however, I only have one grad category theory course). I think category theory is a fine tool for formalizing computation and thinking about type systems, but wouldn't approach it as a program design tool.
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @04:25PM (#33538072)
All of computation is related to types.

You are taking Type A and converting it to Type B. That is the entire point of computation. All else is abstractions on top of that and algorithms below.

Category theory is what lives on top. Haskell is a programming language and style that borrows very very heavily from category theory. Getting a certain level of mastery in haskell well help you see how programming is related to CT.

Re:Lisp as the Maxwell’s Equations of Software by sicp-enjoyer on Wednesday November 09, 2022 @04:26PM (#33538090)
I have studied haskell from this perspective. Like I said, you learn how to model computation and how the haskell language works, you don't learn how to design programs. I actually have gotten much more program design ideas from traditional branches of math (analysis, algebra, etc).
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @04:30PM (#33538156)
Then your comment doesn't make sense to me. If you designed programs in haskell then you designed them using concepts from category theory.

Category theory isn't just about how haskell works. You use it to design your programs. Haskell is basically a category theory framework.

I would say you didn't get very far then if you didn't come out of learning haskell with the realization of how you design programs with CT.

Re:Lisp as the Maxwell’s Equations of Software by sicp-enjoyer on Wednesday November 09, 2022 @04:41PM (#33538302)
> If you designed programs in haskell then you designed them using concepts from category theory.

It's the level of abstraction and focus. Category theory can describe "mapping over promises" it doesn't give a lot of insight into how to design an internet communication protocol with low latency (for example).

Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @09:44PM (#33541544)
I actually agree with you. Its not a good theory for finding optimal speed.

I would say it's more of a better theory for optimal organization and reuse of code. It's a theory of interfaces. If programming is all about abstraction then CT is the theory of design and abstraction.

I agree that detail and speed and execution are important in computer science but these things maybe aren't general enough as the efficiency of speed also relies on which turing complete language (out of an unlimited set of languages) that is used to drive the computation.

We also do have a general theory for optimizing speed. Computational Complexity theory. Which is based on Knuth's little assembly language. This theory can literally help you converge onto the best possible solution. Not by calculation but it can quantify the speed of an algorithm for definitive comparisons.

But then would complexity theory be the Maxwell's equations of programming? I think there's a good argument for that route but I don't think that's what the OP is thinking about in his article.

The op is thinking about design because Lisp is definitely a design philosophy. Lisp won't help you design an internet communication protocol for low latency either.

Maybe you did study category theory deeply but your thinking about it from an angle of computational cost. This is certainly valid. Apologies for that comment, Haskell and CT like any other design pattern out there is usually not targeted specifically at optimizing speed, but more for optimizing code reuse and increasing modularity. It's for dealing with technical debt and how to handle the complexity of programming through abstraction.

If you're thinking about it from that angle then I think the universe already has your answer. Computational Complexity theory is the Maxwell's equations of software. It's not a very complete theory but it's much more concrete then all the other "design" stuff in computer science.

Re:Lisp as the Maxwell’s Equations of Software by hither_shores on Wednesday November 09, 2022 @05:16PM (#33538775)
> Haskell is basically a category theory framework.

Haskell probably draws more from category theory than any other mainstream language, but in absolute terms that's still not very much. It's okayish for modelling cartesian closed categories, but if you want any more structure than that things get quite painful. Even something as simple as a category with finitely many objects requires stupid amounts of type-level boilerplate.

Re:Lisp as the Maxwell’s Equations of Software by mbrodersen on Wednesday November 09, 2022 @07:01PM (#33540097)
This is 100% pure nonsense. Haskell is not a category theory framework. 99% of Haskell programmers do great work without understanding or having any interest in CT. There are many mental thinking tools useful when designing Haskell (and other) software. CT is just one of them. And IMHO not a very useful one. I haven’t seen even one software design that benefitted from CT in ways that was better than straight forward transition systems.
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @09:21PM (#33541375)
There is no best mental tool. This is design, we don't have methods to converge on optimums. So you can't probably say any mental tool is better. It's all just different sets of primitives and category primitives, if you squint they feel like the proper theory of design.

Category theory is also so abstract that you can literally find it in everything. So it's not like it doesn't apply, it applies to everything.

When I say Haskell is a category theory framework I mean that Haskell has primitives that are explicitly modeled after CT and named with the same mathematical names. You don't have to know CT from a mathematical angle to use Haskell but it doesn't change the fact you are using CT primitives like functor to build things.

Other languages have CT concepts like functors but they don't crystallize the concept in such a pure and explicit form. That's just my opinion on it. You are welcome to disagree.

But when you say garbage like "100% nonsense" it's just fucking rude and against the rules here at HN. Don't say it again. Speak respectfully or don't speak at all.

Re:Lisp as the Maxwell’s Equations of Software by mbrodersen on Sunday November 13, 2022 @11:40PM (#33590253)
> But when you say garbage like "100% nonsense" it's just fucking rude and against the rules here at HN. Don't say it again. Speak respectfully or don't speak at all.

I found that commment to be seriously rude and disrespectful. Yes I should have avoided the "100% nonsense" comment. However that doesn't give you licence to be rude and abusive in return.

Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 16, 2022 @10:54AM (#33625161)
It is rude, but it is reasonable. When a child acts unruly and immature he must be disciplined with a forceful hand. I called you out harshly and the harshness was fucking deserved, no matter how miffed you get about it.

I mean you expect me to just stand here and get raped by your rudeness? No reasonable man with spine will take that shit in real life and that's also typically why you don't likely speak that way in real life.

Re:Lisp as the Maxwell’s Equations of Software by mbrodersen on Wednesday November 09, 2022 @06:51PM (#33539951)
Lambda Calculus is a much better representation of computation than Category Theory. I can teach somebody functional programming using Lambda Calculus fairly quickly. It would take a lot longer using Category Theory. I have studied quite a bit of Category Theory but I would still struggle to explain beta-reduction using Category Theory. Another better system to use IMHO is Martin Luff style Type Theory. Much simpler. Much more useful in practice.
Re:Lisp as the Maxwell’s Equations of Software by deltasevennine on Wednesday November 09, 2022 @09:46PM (#33541560)
Well if teaching length justified the title of Maxwell's equations I would agree with you. CT does take longer to learn.

However if foundational theory was what justified the title, I believe CT is more foundational then lambda calculus.