News for hackers. Stuff that matters.
Re:Fast Fibonacci numbers using Monoids by s5ma6n on Thursday April 23, 2020 @05:27AM (#22954186)
I see monoids more and more everyday. A bit outside the topic but does anyone have a good introduction-level resource to learning monoids?
Re:Fast Fibonacci numbers using Monoids by rbonvall on Thursday April 23, 2020 @01:22PM (#22958374)
There is not much to learn, a monoid is a very simple abstraction.

Think for example about learning about the "iterator" abstraction. It's just something with "hasNext" and "next" operations, nothing more to understand. But when you know it you start seeing iterators everywhere, and you get frustrated when something that should be an iterator isn't so you cannot write a simple foreach loop. And you'll start implementing iterators in your own code, because you know that provides a lot of convenience for free to consumers.

Same thing for monoids. They're everywhere, they offer some convenience for free, and you'll be wondering why things that should have monoid instances don't.

Re:Fast Fibonacci numbers using Monoids by Vosporos on Thursday April 23, 2020 @09:49AM (#22955932)
A monoid is an algebraic data structure that has a binary operation (+, *, ++, etc), and an empty element (0, 1, [], etc). In terms of relationship to other algebraic data structure, it "inherits" the binary operation from its Semigroup buddy, which is a very nice data structure to represent non-empty containers (and statically enforce that property).

Julie Moronuki's blog has helped me greatly to understand it all: https://argumatronic.com/posts/2019-06-21-algebra-cheatsheet...

Re:Fast Fibonacci numbers using Monoids by colonwqbang on Thursday April 23, 2020 @05:36AM (#22954242)
It depends on what you mean by introduction. I think the Typeclassopedia entry on Semigroups and Monoids is pretty good, if you are familiar with basic Haskell syntax.

https://wiki.haskell.org/Typeclassopedia#Semigroup

Re:Fast Fibonacci numbers using Monoids by s5ma6n on Thursday April 23, 2020 @06:03AM (#22954361)
Thanks for the link.

I am not good with Haskell but I meant in general mathematical / algebraic introduction, explanation or a lecture.

Re:Fast Fibonacci numbers using Monoids by mgradowski on Thursday April 23, 2020 @06:38AM (#22954526)
In abstract algebra there really is a hierarchy of group-like-structures with different levels of symmetry (see the table in [1]), and a monoid is one of such structures.

I've had some luck with the first chapter of this (free) [2] book, although they explain groups and not monoids but for me it was then rather quick to gain intuition about monoids.

[1] https://en.wikipedia.org/wiki/Monoid#Relation_to_category_th...

[2] https://web.evanchen.cc/napkin.html

Re:Fast Fibonacci numbers using Monoids by JCoder58 on Thursday April 23, 2020 @07:35AM (#22954872)
Re:Fast Fibonacci numbers using Monoids by colonwqbang on Thursday April 23, 2020 @10:54AM (#22956687)
He also has lectures on YouTube which are great.
Re:Fast Fibonacci numbers using Monoids by shigeo on Thursday April 23, 2020 @12:50PM (#22957990)
Side note: the study of monoids isn't a very big field in mathematics, because they're too simple to say too much about them. But if you modify them just a bit, either in the direction of groups or in the direction of categories, you get massive fields of study.
Re:Fast Fibonacci numbers using Monoids by OscarCunningham on Thursday April 23, 2020 @04:05PM (#22960554)
I'm reminded of John Baez writing recently (https://twitter.com/johncarlosbaez/status/124647011232195379...) about commutative semigroups. Even simpler, but still lots to say!
Re:Fast Fibonacci numbers using Monoids by shigeo on Friday April 24, 2020 @09:07PM (#22974666)
I probably still stand corrected, but commutativity is a much stronger condition than the existence of an identity!
Re:Fast Fibonacci numbers using Monoids by OscarCunningham on Saturday April 25, 2020 @06:15AM (#22977079)
I think the existence of an identity isn't very important. You can adjoin an identity to any semigroup to turn it into a monoid.

In any case, doesn't adding more properties make a theory simpler? For example the classification of finite simple groups is much harder than the classification of finite simple commutative groups.

Re:Fast Fibonacci numbers using Monoids by irchans on Thursday April 23, 2020 @09:46AM (#22955900)
Maybe "A first course in Abstract Algebra" by Fraleigh available on Kindle for less than $10. https://www.amazon.com/dp/0201763907

(It's not focused on Monoids. It also covers groups, rings, and fields from a mathematical point of view. It's written for an undergraduate math major with no prior experience in these areas.)

Re:Fast Fibonacci numbers using Monoids by s5ma6n on Monday April 27, 2020 @03:58AM (#22993851)
Thank you everyone for all the links. This is very helpful!
Re:Fast Fibonacci numbers using Monoids by tantalor on Thursday April 23, 2020 @10:41AM (#22956539)
No introduction necessary, monads are just monoids in the category of endofunctors.
Re:Fast Fibonacci numbers using Monoids by OscarCunningham on Thursday April 23, 2020 @12:07PM (#22957443)
Wrong way around. They want to know what monoids are. So you have to tell them that monoids are just modules of the list monad. ;-)
Re:Fast Fibonacci numbers using Monoids by shigeo on Thursday April 23, 2020 @12:42PM (#22957883)
Or that a monoid is merely a category with exactly one object.