Re: Discuss changing the behaviour of append()

new topic     » goto parent     » topic index » view thread      » older message » newer message
gimlet said...

From the Haskell wikibook:

Haskell wiki said...

This property is called associativity, and it doesn't hold for only those selected values but for all integers under addition, all integers under multiplication, and all lists under concatenation.

[] is the identity when appending two lists.

Lists form a monoid under concatenation: ([a], (++), [])

Other than one lapse, the term concatenation is used consistently.

gimlet said...

Our append ... has no identity.

Agreed.

gimlet said...

Our append is strange this way. It has no identity.

Well, I think this is not so strange. Lots of functions lack an identity. f(x) = x + 1 lacks an identity. Logical NOT lacks an identity.

Furthermore, this has nothing to do with the proposed change. Even without it, append lacks an identity. To demonstrate this with the most likely canidate, append({}, {}) does not return {}.

append also lacks associativity. append(1, {}) and append({}, 1) return different things. Again, this is nothing to do with the proposed change - append({1}, {2}) and append({2}, {1}) also return different things. Other mathematical functions, like division or subtraction, also lack associativity.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu