I’m building some statistical code and I would like to use Scala literal. It makes the code very readable since the variable name will make the code very similar to the theory.
I can do
val P(X|C) = ....
but it seems that I can’t for
for {
`P(X|C)` <- ...
}
Is it possible to use backticks on the for comprehensions?
Interesting. It seems to be very fragile – here’s an updated fiddle that agrees with your failure observation but succeeds in other places. It suggests a bug in for desugaring; I suspect it’s losing the backticks when it desugars to a val assignment, but not when desugaring to a flatMap or map. I’ve opened a bug report to that effect…