Re: Unary operators [was: Re: ~ patterns]

2006-02-03 Thread Thomas Davie


On Feb 3, 2006, at 9:34 AM, Bulat Ziganshin wrote:


Hello Benjamin,

Friday, February 03, 2006, 2:29:47 AM, you wrote:

(+ x) --->> (? + x)

i like this idea! but i tink that it's too late for such  
incompatible change :(


really, unary operators can be added to language without any troubles.
we need only to prohibit using of the same symbol for unary and binary
operators:

unary 9 #

#n = n-1

f = #1-1

we can even allow prefix and postfix operators as long as they all  
have

different names


The notable exception in this case, '-' (or anything starting with  
-), which breaks block comment syntax (see my earlier example).


Bob
___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime


Re: Unary operators [was: Re: ~ patterns]

2006-02-03 Thread Bulat Ziganshin
Hello Benjamin,

Friday, February 03, 2006, 2:29:47 AM, you wrote:

(+ x) --->> (? + x)

i like this idea! but i tink that it's too late for such incompatible change :(

really, unary operators can be added to language without any troubles.
we need only to prohibit using of the same symbol for unary and binary
operators:

unary 9 #

#n = n-1

f = #1-1

we can even allow prefix and postfix operators as long as they all have
different names


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]



___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime


Re: Unary operators [was: Re: ~ patterns]

2006-02-02 Thread Taral
On 2/2/06, Benjamin Franksen <[EMAIL PROTECTED]> wrote:
> This would open the possibility to allow unary (prefix) operators in
> general which I find rather more useful than sections.

Down that road lies APL.

--
Taral <[EMAIL PROTECTED]>
"Computer science is no more about computers than astronomy is about
telescopes."
-- Edsger Dijkstra
___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime


Unary operators [was: Re: ~ patterns]

2006-02-02 Thread Benjamin Franksen
On Thursday 02 February 2006 23:25, Wolfgang Jeltsch wrote:
> Am Mittwoch, 1. Februar 2006 01:32 schrieb Patryk Zadarnowski:
> > [...]
> >
> > The proposal would be to remove the unary "-" altogether, and,
> > instead, extend the lexical syntax of numeric constant to allow "+"
> > and "-" prefix.
>
> Would this mean that (-x) is a section while (-1) isn't?  That would
> be confusing.
>
> Apart from this, I would like to see the only unary operator of
> Haskell removed.

I'd rather have operator sections removed. They are not very intuitive 
anyway and can be easily replaced, i.e.

(+ x) ---> flip (+) x
(x +) ---> (+) x

which could profit from the proposal to generalize currying:

f ? === (\x -> f x)

[I prefer '?' for the 'left out' argument, rather than '_']

We could then replace the section

(+ x) ---> (+) ? x

or even

(+ x) ---> (? + x)

This would open the possibility to allow unary (prefix) operators in 
general which I find rather more useful than sections.

Ben
___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime