[snip]
Not a hack, a solution. A consistent one. Look:
(`foldl` 0)
(`-` 2)
Don't they look exactly the same?
[snip]
These look the same too (and *are* consistent):
(f a b)
(+ a b)
But it's not Haskell..
IMO conflating binary minus and unary minus is not consistent.
Something I wonder
It's worth remembering that APL and SML, amongst others,
distinguish between the sign used for a negative literal
(¯1 in APL, ~1 in SML) and the sign used for subtraction
(the hyphen/minus in both of them). It doesn't seem to
be a hard thing to get your head around in practice.
From having
minh thu wrote:
Something I wonder from time to time if it would be a good thing or
not is to allow
a `f g` b
to mean
f g a b
This comes up from time to time, though it is often met with stern
disapproval because it can easily lead to loss of clarity. There is a
valid alternative, though
On Mon, Oct 19, 2009 at 5:34 PM, Will Ness will_...@yahoo.com wrote:
This syntax already exists. The '`' symbol is non-collating already, so using
it for symbol chars doesn't change anything (it's not that it can be a part of
some name, right?). To turn an infix op into an infix op is an id
Will Ness wrote:
wren ng thornton writes:
Attack the underlying problem, don't introduce hacks to cover up broken
hacks. This isn't C++.
The underlying problem is a broken scanner where it can't distinguish between a
binary op and a number read syntax.
The underlying problem is that (1)
On Mon, Oct 19, 2009 at 5:53 PM, Will Ness will_...@yahoo.com wrote:
Tom Tobin korpios at korpios.com writes:
On Mon, Oct 19, 2009 at 5:34 PM, Will Ness will_n48 at yahoo.com
wrote:
This syntax already exists. The '`' symbol is non-collating already, so
using it for symbol chars
On Sun, Oct 18, 2009 at 5:31 PM, Will Ness will_...@yahoo.com 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 think at about this point, this stopped being an intellectual
discussion.
On Sun, Oct 18, 2009 at 4:47 PM, Will Ness will_...@yahoo.com wrote:
Gregory Propf gregorypropf at yahoo.com writes:
I actually meant it as sort of a joke but maybe it's not after all.
Seriously though, using anything non-ASCII in source code is a bad idea,
because there are lots of fonts
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
Gregory Propf gregorypr...@yahoo.com writes:
Heh, perhaps we should petition to have a new computer key and symbol
added to the world's way of writing maths, something like maybe a
downward angled slash to mean prefix (-)
Or just use 'negate' and 'subtract'?
-k
--
If I haven't seen
On 18 Sep 2009, at 04:32, Gregory Propf wrote:
Heh, perhaps we should petition to have a new computer key and
symbol added to the world's way of writing maths, something like
maybe a downward angled slash to mean prefix (-)
Such a symbol already exists, but isn't in the ASCII set:
(-)
I actually meant it as sort of a joke but maybe it's not after all. Among the
many benefits, think of all the delightful conspiracy theories such a change
would spawn - even our math isn't safe now!, Save the minus sign!.
--- On Fri, 9/18/09, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote:
(-) happens to be the only prefix operator in haskell, it also an infix
operator.
so:
4 - 2
2
-3
-3
((-) 5) 3 -- note that in this case (-) is treated like any regular
function so 5 is the first parameter
2
(5 - ) 3
2
(-5 )
-5
(flip (-) 5) 3
-2
It's a little wart brought about by the
2009/9/17 Joost Kremers joostkrem...@fastmail.fm
Hi all,
I've just started learning Haskell and while experimenting with map a bit, I
ran
into something I don't understand. The following commands do what I'd expect:
Prelude map (+ 1) [1,2,3,4]
[2,3,4,5]
Prelude map (* 2) [1,2,3,4]
: [Haskell-cafe] Re: [Haskell-beginners] map question
To: Gregory Propf gregorypr...@yahoo.com
Cc: Tom Doris tomdo...@gmail.com, Haskell-Cafe
haskell-cafe@haskell.org, joostkrem...@fastmail.fm
Date: Thursday, September 17, 2009, 9:04 AM
(-) happens to be the only prefix operator in haskell, it also
15 matches
Mail list logo