[Haskell-cafe] Re: [Haskell-beginners] map question
wren ng thornton
wren at freegeek.org
Mon Oct 19 00:09:31 EDT 2009
Will Ness wrote:
> Luke Palmer <lrpalmer <at> gmail.com> writes:
>> Or you could use the "subtract" function.
>>
>> >>> map (subtract 2) [3,4,5]
>> [1,2,3]
>
> I don't want to.
>
>> I don't think syntax sugar is worth it in this case.
>
> I do. Operators are great because they make our intent visible, immediately
> apparent. Long words' meaning, like subtract's, is not immediately apparent,
> and they break consistency. Not everyone's first language in life was English,
> you see.
I'm with Luke on this one. It's a shame that negation uses the same
symbolic identifier as subtraction, but introducing this new sugar only
serves to make things more complex than they already are. If anything,
negation should be moved to using a different identifier to remove the
current ambiguity (as is done in some other languages).
> (`foldl`2) works.
>
> (`-`2) should too.
The `` syntax is for converting lexical identifiers into infix
operators. Symbolic identifiers are already infix, which is why ``
doesn't work for them. If we introduced this then those striving for
consistency would be right in requesting that this pattern be allowed
for all symbolic operators. I for one am opposed to introducing
superfluous syntax for duplicating the current ability to write things
in the same ways.
Attack the underlying problem, don't introduce hacks to cover up broken
hacks. This isn't C++.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list