Closed cmeeren closed 6 months ago
Hi @cmeeren - this is indeed a general problem: we don't reduce lambda expressions (because in general we don't have insight into how they may be evaluated, such as this example where the lambda is evaluated multiple times by Array.forall
with dynamic s
; granted width
is static here but it is perhaps too complex to venture that kind of analysis).
There are ways you could refactor your test to gain greater insight, for example:
let width = 2
let testCases =
"a test".Split(" ")
|> Array.map (fun s -> <@ s.Length <= width @>)
for testCase in testCases do
test testCase
produces the following output:
s.Length <= width
"test".Length <= 2
4 <= 2
false
(Not sure how general this problem is.)
Consider this code:
This is displayed as:
It would be nice to have the value of
width
rendered at some point.