Hi Daniel,

Your assumption is slightly wrong, F# operators are unary if they have one parameter, it has nothing to do with the ~ sign. The reason you see the behaviour for minus sign is that both ~- and - are defined. I'm not sure why it has two operators for unary minus but I'm guessing ocaml compatablity.

So the answer is if you want both operators to exist then define them both:

1
2
3
4
5
6
#light
let (~!@) x =  x + "; yummy"
let (!@) x =  x + "; yummy"

~!@ "apple"
!@ "apple"

Cheers,
Rob

By on 8/21/2007 12:54 AM ()

The characters with which a unary operator can start is limited.

See Don's post at

[link:cs.hubfs.net]

By on 8/21/2007 3:15 AM ()

I must have done something wrong, because (!@) alone didn't work. I wonder what led me to this kind of confusion [:)]. Anyways, really thanks.

By on 8/21/2007 1:46 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper