I hate nested ( ) and tend to avoid them where possible. I’d probably have picked the second one from your examples (although I know some people frown upon using <| as well), but I’d also consider separating this into two (particularly if you’ll be doing this elsewhere too): -
let fileDoesNotExist = not << File.Exists
fileDoesNotExist(wDir + specFile)
--
--
To post, send email to fsharp-o...@googlegroups.com
To unsubscribe, send email to
fsharp-opensou...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/fsharp-opensource
---
You received this message because you are subscribed to the Google Groups "F# Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fsharp-opensou...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
To post, send email to fsharp-o...@googlegroups.com
To unsubscribe, send email to
fsharp-opensou...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/fsharp-opensource
---
You received this message because you are subscribed to the Google Groups "F# Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fsharp-opensou...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
not<<File.Exists<| wDir+specFile
is my favorite for the specific situation you presented, but a word of caution about <|
Unfortunately due to the associativity rules for operators being determined by their first ascii character instead of being set on a per operator basis the backpipe doesn’t work the way it really should
e.g.
not <| File.Exists <| wDir+specFile
will not work because <
is left associative
However if you define a similar operator with the proper associativity you can do
let (^) (fn:'a->'b) x = fn x
let ( ** ) (fn:'a->'b) x = fn x
let x = not ^ File.Exists ^ wDir+specFile
let x = not ** File.Exists ** (wDir+specFile)
^
aka hat
is the best option as it is right associative and has the highest precedence**
is also right associative but has a lower precedence than +
, thus the need for parens.
not(File.Exists<| wDir+specFile)
is another fine option, but not my personal preference
File.Exists>>not<| wDir+specFile
I find this last one amusing, but I wouldn’t use it
// file string -> check exists -> negate
wDir+specFile |> File.Exists |> not