I have found one partial work-around: use of the << function composition operator. Thus one could write

myprint << run_attempt <| fail_if_big 999

This is only a partial workaround because << also binds rather

tightly, so you still have to add extra parentheses that are not needed

when using |> instead.

By on 3/18/2008 9:07 AM ()

Thanks for this input. We (the F# team) have registered this as a request for a design change for the associativity and precedence of <|, and we'll look at changing this in a future release.

Kind regards

don

By on 3/20/2008 1:21 AM ()

Hi,

It's sometimes useful to have left associativity for <| when the function has several arguments. I've written this kind of code a few times:

1
2
3
4
5
6
7
printfn "%d, %d, %d"

  <| 3 * (2 + 4)

  <| 2 + 3

  <| abs (-4)

Or:

1
max <| 3 * (5 - 2) <| f (3 * 2)

Current <| is useful to separate arguments and remove some parenthesis. But, I don't know which associativity is the best.

Laurent.

By on 3/20/2008 12:48 PM ()

Agreed.

I've been using the <| operator to clarify my code, but its left associativity has limited its usefulness. Its also rather anti-intuitive.

I assume the <OP %left precedence rule cannot be altered. Would inserting a low precedence <| %left rule be possible?

regards,

Daniel

By on 3/16/2008 9:28 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