News for hackers. Stuff that matters.
Re:Functors and Monads for People Who Have Read Too Many “Tu... by nicolasrusso on Saturday June 26, 2021 @07:15PM (#27646892)
I'm sorry I still barely understand what's going on here. Too many unfamiliar terms. Should note I don't have a CS nor math background, just basic programming.

Here's my best understanding so far:

A functor is a function that takes in a list of things and like a regular function, outputs a list of modified things...

So how is this different from a function?

Re:Functors and Monads for People Who Have Read Too Many “Tu... by chobytes on Sunday June 27, 2021 @02:47AM (#27649214)
A functor is a certain kind of function (Theres a pedantic point to be made but it's mostly irrelevant). However, most functions are not functors.

To give a simpler example, we say a function, f, is monotone when for x<y, f(x)<f(y); that is, it preserves order. Every monotone function is obviously a function, but functions like x^2 are not monotone.

Basically a functor is a function which preserves some other properties. I wont go into detail as many have before me, but thats the gist.

Re:Functors and Monads for People Who Have Read Too Many “Tu... by nicolasrusso on Sunday June 27, 2021 @04:51AM (#27649805)
Interesting, thank you!

For those who like me wanted to see the edge case for the non-monotonic function, if you do:

-2 < -1

-2 is in fact less than -1.

However:

(-2)^2 < (-1)^2 ==becomes==> 4 < 1

And 4 is obviously not less than 1.