[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/sci/ - Science & Math

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • Additional supported file types are: PDF
  • Use with [math] tags for inline and [eqn] tags for block equations.
  • Right-click equations to view the source.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 0_uh4tBSWjidlCTdhJ.png (122 KB, 700x457)
122 KB
122 KB PNG
What is a monad.

If you can't explain it to a child then you don't understand it.
>>
>>16927810
You know that Canadian TV show "How It's Made"?

I would put on an episode of that show, like, one where it shows the robots in the factories making coke bottles or toy cars or something, and explain that the factory is like a category, and the robots are like the monads. They check the object as it passes through and make sure it's exactly the same as all the others. If it's not, then it makes sure it is or it discards it.

Or I would show the child like a fingerprint scanner on my tablet that I use to unlock it and say "this is like a monad, this monad checks to make sure I'm me. If I'm not me, it won't unlock. And that's all it does. It just checks to make sure it's me."

These are all very basic and excellent examples of a monad that even a child would understand. But, now you will argue with me and call me a faggot and tell me I don't know what a monad is and be the stupid retarded nigger you came here to be. Since there's not a single fucking chance you came here to ask an honest simple question that has such an honest simple answer. You want to bicker and watch people argue for your own amusement. So, let's go then. Get on with it you fucking piece of shit.
>>
File: monad_hibernacula[1].jpg (163 KB, 900x708)
163 KB
163 KB JPG
>>16927810
The Monad is the original substance of the universe from which all other things are derived. The most high and holy, from this singular point all others are subsidiary
>>
File: smart_brainlet.jpg (30 KB, 700x567)
30 KB
30 KB JPG
>If you can't explain it to a child then you don't understand it.
Holy retard cope.
>>
>>16927815
The leaf is fundamentally stupid.
>>
>>16927815
No child will ever abstract over your examples and actually arrive at a monad and I seriously doubt adults with no prior knowledge would have any clue what you're talking about, either.
>>
>>16927857
those are perfectly expected responses, monads only make sense with a highly sophisticated form of brain damage in the first place
however, OP didn't demand the child to understand the explanation, so suck it
>>
>>16927818
this line has ethered mathfags lol
>>
>>16927816
What if its just hydrogen?
I personally dont subscribe to the idea of "union of opposites" as that just creates contradictions that go nowhere. Legitimately. Its not at all that poetic, romantic idea of "opposites attract".

In fact, Im thinking its just one huge scam for people to pin the blame for everything on a singular thing and call it a day.
>>
generalized monoid, a monoid in the category of endofunctors, ie, an endofunctor, ie, a triple of functor T and 2 of its natural transformations n and u that satisfies associativity and unitality: (T, n, u)

if category theory is a zoo
a monad is a transport crate, n is loading dock and u is the crate unpacker, and animals are objects of categories, endofunctor being it doesn't move the animals outside of the zoo, just transforms it from one place to another

t. pro
>>
>>16927902
My kid points out that you never specified what a category is in this analogy. You fail.
>>
>>16927909
zoo
>>
File: 1768133328321284.png (358 KB, 360x480)
358 KB
358 KB PNG
>>16927810
>What is a monad.
A miserable pile of secrets!
>>
>>16927810
Service announcement:

The anon who posts these threads is a 36 year old unemployed Mexican called Carlos, who lives with his alcoholic uncle. He copes about his situation by trying to learn math from ChatGPT and Wikipedia, however he can't understand it, which is why he repeatedly spams these questions.
>>
File: 1758776211740849.png (9 KB, 720x73)
9 KB
9 KB PNG
>>16927945
but chatgpt knows what a monad is
>>
>>16927946
Isn't that just a type in programming?
>>
you don't learn category theory by learning monad, it's a special endofunctor to make it make sense, it's more of a definition thing, you need to understand the why, how category theory came to be, there is a reason why it's not taught, if you are learning math for application don't start with ct
>>
>>16927948
>not taught
not taught at basic level*
>>
say you have a collection of things in a bag. it could be a bag of marbles. you can arrange them in a whole bunch of ways, using a whole bunch of tricks. now let's say you made a list of all those ways, all those tricks.

now you realize you can combine your tricks to make a new one. this applies to every single trick. your list includes every combination here.

that's a monad. it's the list of all the tricks.
>>
>>16927896
The union of opposites is a direct requirement for comparison at all. The differences between things are along particular aspects which they share. A red ball and blue ball are different in the common aspect of color..

>>16928020
is this a category theory monad? Some kind of state space for morphisms?
>>
>>16928024
pretty much yeah i went with the category explanation, not the programming one although that probably would have worked better by using functions, but that goes back to just describing it as a box or conveyer belt type of analogy. i think having it just be a collection of things in a bag is as far as you can go with the analogy to a kid. trying to talk about how information in a box is swapped would lead to confusion no matter what.
>>
>>16928025
Would the monad operate on the entire state space of all morphisms within the graph or the space of morphisms at some defined boundary of the graph like an interface?
>>
OP here.

It's a conspiracy. It's literally never going to make sense. It's incredibly simple and applies to many things but literally no one is able to explain what it is.

Other data structures have some kind of real life analogue. If you tell me what a tree is then I instantly get it because I've seen a tree before and I know how they work.
When someone says monad I think of the floating black rectangle from 2001.

Perhaps a monad is such a profound truth that as soon as you learn it it becomes you but then it robs you of the ability to explain it. It's a one way ticket.
>>
>>16927947
objects of various type can be set to Null. If the null case isn't handled, then bugs occur. This is the cause of so many issues that the creator of Null regretted it. To him it was easy and obvious, but in hindsight it's sorta bad. Having a box means you're forced to open the box to check if it's empty or not. If it's empty, then you're forced to handle it. If not, then you can use it.

Obviously, you can do the same thing with if (x != null), but its easy to forget or to think, oh it'll never happen, until it does
>>
>>16927946
No it doesn't. Being able to chain operations is not enough.
This code allows to chain operations but can't compose functions into a new function:
https://godbolt.org/z/Y98fh71fj
>>16927947
Nope, a monad can be used to compose functions:
https://godbolt.org/z/181PaYWrK
>>
File: suiseiseki.jpg (40 KB, 474x543)
40 KB
40 KB JPG
>>16927810 (OP)
You can do it with a set of toys and cards with instructions that take a toy and return a toy.
The domain is the set of toys. The cards are endofunctors. The monoid is the set of cards, and combining the operations of two cards always result in following the operations of another card. There must be also a card that takes and returns the same toy.
A simple example:
Two toys: A B
Four cards:
1. Returns the same toy.
2. Returns the other toy.
3. Returns toy A.
4. Returns toy B.
>>
File: 1762758336205419.png (49 KB, 500x500)
49 KB
49 KB PNG
>>16927810
>If you can't explain it to a child then you don't understand it.
A cope meme for retarded faggots.
>>
>>16927816
OP didn't ask about The Monad, he asked about a monad and you completely skipped over that part to explain some greater context that depends on the underlying concept that you failed to explain in the first place.
>>
>>16927863
Children are literally retarded, though, we actually measure and scale retardation in how closely to early childhood the retarded person's thought processes are, so no matter how well you articulate something to an average child, they are either not going to understand or going to pretend they understand.
>>
>>16927931
>zoo
You said category theory is a zoo. I'm pretty sure "category theory" and "category" mean different things.
>>
>>16928128
category theory is the principle of organizing category like a zoo, hence a zoo is a category, as there can be many
The category is the zoo. Objects are enclosures. Morphisms are paths. A monad is a crate system for transporting animals around the zoo.
>>
>>16928122
>Children are incapable of learning anything
Meanwhile, in reality, children learn all the time.
>>
>>16928135
OP didn't say to teach children anything, he said to explain it in a way they would already understand what you are talking about and children don't even learn through explanation, they learn through experience or teachers wouldn't even need 99% of the school curriculum since the majority of teaching to the point of understanding is about repetition rather than the base explanation.
>>
>>16927810
A monad is an endofunctor together with two natural transformations satifying the pentagon diagram and the unitor diagram

Hope this helps
>>
>>16928083
I mean, if null is the only issue you can just carefully construct the program and sanatize input such that unintentional nulls never occur and intentional ones are checked for... basically just a domain restriction... if a violation never occurs then how can you say that it doesn't pass...
>>
You grasp abstractions by seeing enough concrete examples of those abstractions that you notice the underlying pattern and start to perceive it in new examples. The problem with monads and other such things is that they are abstractions over abstractions, many times over. Teaching this to a child is a monumental task that has little to do with explaining things and everything to do with slowly building up towards it. Nothing in this thread comes close to teaching anything and I'll readily admit I can't do better.
>>
>>16927946
No, it doesn't. The overwhelming majority of things that fit that description aren't monads.
>>
>>16928122
>>16928140
mathfags still seething over this lol
>>
If you can't explain a mathematical concept to a woman, you don't understand it.
>>
>>16928158
Yes, it is very annoying to mathfags and anyone who can develop an understanding of reality that human children are born completely retarded, too retarded to even walk or feed themselves, and it takes decades before they can actually understand anything if they ever actually understand anything at all instead of just falling into line.
>>
adding integer is a monoid, 5,3 ->8
flattening a list is a monad [5],[3]->[5,3]
>>
>>16928040
nta but a monad is an "interface" between a category and itself
peano's successor function is an example of the free monad
>>
>>16927934
Mathkind ill needs an abstraction such as you!
>>
>>16927810
An array of numbers.
>>
why even have numbers... their useless... i just want to play logic puzzles all day...
>>
>>16928201
there are no numbers in category theory
>>
What happens if I add green to yellow then subtract blue and multiply by magenta? You should be able to solve this.
>>
>>16928209
abstractions say not what you get but what kind of answer do you want, transformation, literal brown goo, mapping, group, etc, it is all about how you formalize it
>>
>>16928120
An idiot admires complexity.
This quote from Terry Davis, a man that has abstracted minimalism down to using a plastic milkcrate as a desk behind a Mcdonalds.
>>
>>16928168
Enough definitions. Have at you!
>>
>>16928142
That's like saying if you want to prevent memory leaks then just "carefully construct the program..." or if you want an 100% on your test, just don't give a wrong answer. Yeah no duh, but shit happens anyway.
>>
>>16928546
damn, crazy how all these programs written in c/c++ just work then and crashes are a rare anomaly
>>
>>16928546
What do you think a memory leak means in the pataphorical sense? The reason I say this is that good design and assembly isn't always sufficient for preventing leaks within the rated lifetime of a given feature.
>>
File: 1762117001960333.jpg (121 KB, 1920x1541)
121 KB
121 KB JPG
>addition isn't a valid operation because you might accidentally add the numbers together wrong
>>
>>16927815
I used to watch that as a kid, good times
>>
>>16927815
Is each robot a monad or is the entire collection a monad, or is it just the validation robots that are gating? Or is it just the final robot at the end of the line with the go/no-go
>>
>>16928564
What if you add them carefully?
>>
>>16928606
write a proof showing that you have never made a mistake
>>
>>16928619
Theorem: I am always right
Proof: Trivial
>>
>>16927810
Seems simple enough
>>
>>16928606
I already added them.
>>
>>16928631
Carbon is simple but explaining what a carbon based lifeform is is pretty difficult.
"It's so general that it can be almost anything" doesn't help much.
>>
they're whatever you want them to be
humans just made them up
>>
>>16928166
flattening a list is a monoid too though
>>
File: IMG_3389.gif (800 KB, 1372x1024)
800 KB
800 KB GIF
>>16927810
Put yourself in the designer's shoes:
>be Simon Alex-Jones
>be designing languge
>want something that behaves like a "not const" tag in other languages, i.e. when you calculate something using a "not const" value the new value is "not const" too
>but in our language, everything is a term like f(g(x),h(x)), so how?
>solution: represent the tag with a new unary function symbol, say m()
>add some rules saying it doesn't matter where in the term m is
>e.g. f(g(m(x)),h(x)) is formally equivalent to m(f(g(x),h(x))
>later, find "monad" in a category-theory book
This is not an analogy or anything, this is literally how/why they came up with it and I have no clue why people try to understand it in any different way
>>
>>16928819
Programming languages shouldn't attempt to obfuscate the way the underlying hardware actually works.
>>
>>16928821
Why not?
>>
>>16928821
>I want my browser to download machine code from the internet and run it in order to render webpages
>>
>>16928821
CSlets should stop polluting languages with implementation details and UB obfuscating and subverting otherwise straightforward semantics
>but if i add hackslop you can use it for systems programming
don't care, fuck off to C
>>
>>16930369
I agree that no one should want to compute with real numbers, and that the attempt betrays a fundamental lack of understanding of the nature of computation.
>>
>>16930369
I think volatile accesses should have been implemented with intrinsics
Architecture-dependent layout "guarantees" are fucking retarded
>>
>>16930391
At no point was the inclusion of a null pointer necessary, either, and even Ritchie doesn't excuse it.
>>
>>16930483
pointers be allowed to be null is literally half the point of pointers...
>>
>>16928821
>Programming languages shouldn't attempt to obfuscate the way the underlying hardware actually works.
Name any programming language that does that besides C itself.
>>
>>16930486
It's the point of many things. Sometimes a pointer has to be nullable, sometimes it doesn't. Using an object that has more possible states is bad for optimisation, so it's really better if pointers aren't nullable by default. The concept of nullability can instead be implemented with the Maybe monad. This has the advantage that it can be applied to more general types, not just pointers.
>>
File: frhi643mpmt31.png (113 KB, 480x360)
113 KB
113 KB PNG
>They took everything that wasn't nailed to the floor. Including my floor-nailing machine, which because it has to move from place to place to do so isn't itself nailed to the floor.

This is an introduction to category theory. You can infer the nature of an object based on its relationship with other objects in the category.

This doesn't explain what a monad is, but sets the stage for category theory and closed dynamical systems where causal relationships are downstream from the input.
>>
>>16930486
>one 'value' is categorically different in behaviour from all other values
>shares none of the properties of other values of the type
>it's the same type because it just is, ok??
lol
>>
>>16930702
#1 it's programming not math (math does the same shit anyways)
#2 the goal is to write performant and simple code, and allowing null is better for both compared to constructing an entire framework around which the pointer can never be null (which would also conflict with the physical reality of how the computer functions)
>>
>>16930702
>0+0i is a completely normal complex number guys
>>
>>16930702
This but with 0 and division
>>
>>16930702
Don't forget the one-past-the-end pointer
>>
>>16930719
>performance requires a dogshit type system that can't catch errors that are obvious at compile time
>that is just how computers werk
C's poor design has ruined generations of programmers making up ever new excuses why compilers should be "simple" (poorly designed) yet arbitrarily complicated (muh -O3 go brrr)
>>
>>16930735
>>16930754
Which is exactly why there is specific sets (types) excluding it, yes. That is how it works.
>>
You know, just stating that "pointers can't be null" doesn't magically make your program bug free. In fact it's worse - rather than crashing when you do something wrong it just silently lets you make mistakes which are probably going to crash the program at some later harder to diagnose point.
>>
Bunch of retards arguing about nothing. TypeScript, of all things, implements the objectively correct answer to the null pointer question without any of that Maybe boilerplate nonsense.
>>
>>16927816
pseud schizo onions babble
>>
>>16927810
a set of possible choices
>>
File: 8d0.jpg (24 KB, 600x600)
24 KB
24 KB JPG
>>16927810
excessive nothingness .. explicit 2-4 , 3-5 ...whole fuckin things the complete incomplete rn lol
>>
>>16928587
I am the Monard.
>>
I reject your premise (stolen from the jew Einstein) and assert my own:

dont try to explain things to retards, it is a massive waste of time
>>
>>16930569
>This is an introduction to category theory. You can infer the nature of an object based on its relationship with other objects in the category.
Category theory is trans. I hate people making up random new names for things and being all smug about it. What the fuck is wrong with plain old sets.
>>
>>16930781
nocoder who never debugged a serious memory bug in his life thinks the program just crashes
lmao



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.