Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-20 Thread minh thu
[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

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-20 Thread oleg
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 You don't have to wonder: http://www.haskell.org/haskellwiki/Infix_expressions Granted, you have to use different characters rather than the backquote. On the other

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-20 Thread Will Ness
Jason Dagit dagit at codersbase.com writes: On Mon, Oct 19, 2009 at 5:53 PM, Will Ness will_n48 at yahoo.com wrote: You think of functions, where domain matters (for purists?). In syntax only the result matter, does it read? Does it have an intended meaning? How is it a mistake if it

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-20 Thread Richard O'Keefe
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

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-20 Thread wren ng thornton
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

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-19 Thread Will Ness
wren ng thornton wren at freegeek.org writes: Will Ness wrote: (`foldl`2) works. (`-`2) should too. The `` syntax is for converting lexical identifiers into infix operators. Symbolic identifiers are already infix, which is why `` So it would be a no-op then. Why make it

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-19 Thread Tom Tobin
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

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-19 Thread Will Ness
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 doesn't change anything (it's not that it can be a part of some name,

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-19 Thread wren ng thornton
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)

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-19 Thread Jason Dagit
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

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-19 Thread Luke Palmer
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.

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-18 Thread Will Ness
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 and editors in the world. It seems natural to me to have (`-`2)

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-18 Thread Luke Palmer
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

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-18 Thread Will Ness
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

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-10-18 Thread wren ng thornton
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

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-18 Thread Ketil Malde
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

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-18 Thread Jon Fairbairn
Ketil Malde ke...@malde.org writes: 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

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-18 Thread Thomas Davie
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: (-)

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-18 Thread Gregory Propf
: From: Jon Fairbairn jon.fairba...@cl.cam.ac.uk Subject: [Haskell-cafe] Re: [Haskell-beginners] map question To: haskell-cafe@haskell.org Date: Friday, September 18, 2009, 2:09 AM Ketil Malde ke...@malde.org writes: Gregory Propf gregorypr...@yahoo.com writes: Heh, perhaps we should petition

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-17 Thread Gregory Propf
Remember that there is asymmetry between (+) and (-).  The former has the commutative property and the latter does not so: (+) 3 4 = 7 and (+) 4 3 = 7 but (-) 3 4 = -1 and (-) 4 3 = 1 --- On Thu, 9/17/09, Tom Doris tomdo...@gmail.com wrote: From: Tom Doris tomdo...@gmail.com Subject:

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-17 Thread Job Vranish
(-) 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

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-17 Thread Deniz Dogan
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]

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-17 Thread Gregory Propf
: [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