logoalt Hacker News

mrkeenlast Monday at 11:42 AM1 replyview on HN

Where did you get that definition?

"function that takes one argument and returns one value of the same type" is the identity function.


Replies

epolanskilast Monday at 12:10 PM

Identity function returns the same _value_.

If it's only the same _type_, but the value is not the same, then it's an endomorphism. The function definitions look the same `a -> a`.

string reversal, integer negation or toUpperCase are classical examples of endomorphisms.

Identity is a specific case of endomorphism.

show 1 reply