create account

Functional programming - Functors - Some more intuition by noriega

View this thread on: hive.blogpeakd.comecency.com
· @noriega · (edited)
$7.61
Functional programming - Functors - Some more intuition
![functors.jpg](https://cdn.steemitimages.com/DQmaZC6e8sKUcYwxviB1ngHqx8HF95Z7jDX2YMsHVMbvswf/functors.jpg)

As additional support for my [previous post on functors](https://steemit.com/technology/@noriega/functors-are-not-boxes-the-box-analogy-is-bad-stop-using-it), I want to throw in this less technical example.

As you can see in the drawing, we have the following:

* A little world of transformations between things (currencies), called "Category of currencies"
* Another little world of transformations between things (feelings), called "Category of feelings"
* "f" and "g" are just generic names for transformations (give them any meaning you want.)

The point is that a [functor](https://en.wikipedia.org/wiki/Functor) is a sort of "meta" transformation.
It transforms a category into another category, i.e. a world of transformations into another world of transformations, **in a way that makes sense**.

# What do I mean by "in a way that makes sense"?

In the drawing, all those fat  horizontal arrows in the middle are doing the meta transformation. I.e. they're putting each object and transformation in the right place.
For example, we see that:

* BTC gets mapped to happy feeling.
* USD gets mapped to neutral/meh feeling.

In light of that, it makes sense that "f" (which goes from BTC to USD), gets transformed into a function from happy feeling to neutral/meh feeling.

Of course, saying "it makes sense" is a hand-wavy thing. The mathematical definition of functor is actually precise. But I'm just giving you some more intuition. I hope it helps!
๐Ÿ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 28 others
properties (23)
authornoriega
permlinkfunctional-programming-functors-some-more-intuition
categorytechnology
json_metadata{"tags":["math","programming","functors","functions","technology"],"image":["https://cdn.steemitimages.com/DQmaZC6e8sKUcYwxviB1ngHqx8HF95Z7jDX2YMsHVMbvswf/functors.jpg"],"links":["https://steemit.com/technology/@noriega/functors-are-not-boxes-the-box-analogy-is-bad-stop-using-it","https://en.wikipedia.org/wiki/Functor"],"app":"steemit/0.1","format":"markdown"}
created2018-06-10 05:29:21
last_update2018-06-10 05:41:00
depth0
children7
last_payout2018-06-17 05:29:21
cashout_time1969-12-31 23:59:59
total_payout_value5.751 HBD
curator_payout_value1.857 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,569
author_reputation46,308,199,610
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,094,788
net_rshares2,866,701,556,903
author_curate_reward""
vote details (92)
@a-0-0 ·
Go here https://steemit.com/@a-a-a to get your post resteemed to over 72,000 followers.
properties (22)
authora-0-0
permlinkre-noriega-functional-programming-functors-some-more-intuition-20180610t052945959z
categorytechnology
json_metadata{"tags":["technology"],"links":["https://steemit.com/@a-a-a"],"app":"steemit/0.1"}
created2018-06-10 05:29:48
last_update2018-06-10 05:29:48
depth1
children0
last_payout2018-06-17 05:29:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length87
author_reputation-4,863,186,238,920
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,094,819
net_rshares0
@jaichai · (edited)
Excellent submission.

RE: Your Post

I like to think of the invisible mechanics within the "black box" in between the lambda and the output is akin to the superposition space in quantum physics, or the universe of probabilities in between the Hadamard and output in QCL; that is, it is infinite, "it is what it is", and it JUST WORKS!

Trying to open that black box screws everything up, nullifies the experiment (or function), and effectively negates the whole process.

Why?

Because if you look into the box, the observation changes the result; it forces all the infinite possibilities to collapse into a single result (a la Schrรถdinger's cat).

Thanks for the cool analogy.

Namaste, Jaichai
๐Ÿ‘  ,
properties (23)
authorjaichai
permlinkre-noriega-functional-programming-functors-some-more-intuition-20180611t064511482z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2018-06-11 06:45:12
last_update2018-06-11 06:47:57
depth1
children1
last_payout2018-06-18 06:45:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length696
author_reputation-5,759,614,035,864
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,251,405
net_rshares3,429,742,275
author_curate_reward""
vote details (2)
@noriega ·
Ah, that makes sense indeed. Interesting!
Cheers! :)
๐Ÿ‘  
properties (23)
authornoriega
permlinkre-jaichai-re-noriega-functional-programming-functors-some-more-intuition-20180611t075326684z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2018-06-11 07:53:30
last_update2018-06-11 07:53:30
depth2
children0
last_payout2018-06-18 07:53:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length52
author_reputation46,308,199,610
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,258,235
net_rshares2,770,203,571
author_curate_reward""
vote details (1)
@mathowl ·
Nice post :). Not sure if that functor maps into my emotion. : P
๐Ÿ‘  ,
properties (23)
authormathowl
permlinkre-noriega-functional-programming-functors-some-more-intuition-20180612t084817831z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2018-06-12 08:48:15
last_update2018-06-12 08:48:15
depth1
children1
last_payout2018-06-19 08:48:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation44,993,635,814,620
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,417,392
net_rshares4,492,224,484
author_curate_reward""
vote details (2)
@noriega ·
Thank you! Hahah point taken
properties (22)
authornoriega
permlinkre-mathowl-re-noriega-functional-programming-functors-some-more-intuition-20180612t093923645z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2018-06-12 09:39:24
last_update2018-06-12 09:39:24
depth2
children0
last_payout2018-06-19 09:39:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length28
author_reputation46,308,199,610
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,422,166
net_rshares0
@steemitboard ·
Congratulations @noriega! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/votes.png)](http://steemitboard.com/@noriega) Award for the number of upvotes

<sub>_Click on the badge to view your Board of Honor._</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-noriega-20180610t111432000z
categorytechnology
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-06-10 11:14:33
last_update2018-06-10 11:14:33
depth1
children0
last_payout2018-06-17 11:14:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length659
author_reputation38,975,615,169,260
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,125,878
net_rshares0
@utopian-io ·
#### Hi @noriega!

Your post was upvoted by utopian.io in cooperation with steemstem - supporting knowledge, innovation and technological advancement on the Steem Blockchain.

#### Contribute to Open Source with utopian.io
Learn how to contribute on <a href="https://join.utopian.io">our website</a> and join the new open source economy.

**Want to chat? Join the Utopian Community on Discord https://discord.gg/h52nFrV**
๐Ÿ‘  
properties (23)
authorutopian-io
permlink20180613t133313051z
categorytechnology
json_metadata{"tags":["utopian.tip"],"app":"utopian-io"}
created2018-06-13 13:33:12
last_update2018-06-13 13:33:12
depth1
children0
last_payout2018-06-20 13:33:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length421
author_reputation152,955,367,999,756
root_title"Functional programming - Functors - Some more intuition"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,585,416
net_rshares600,599,164
author_curate_reward""
vote details (1)