I am trying to learn F # and I have come to the conclusion that I do not understand what I am doing wrong. I wrote the following code:
let p = 0.2::0.2::0.2::0.2::0.2::[] let world = "g"::"r"::"r"::"g"::"g"::[] let measurements = "r"::"g"::[] let pHit = 0.6 let pMiss = 0.2 let rec sense world probs measurement = match world, probs with | measurement::row, p::rop -> (p*pHit)::sense row rop measurement | _::row, p::rop -> (p*pMiss)::sense row rop measurement | [],_ -> [] | _,[] -> []
The problem I got is that the compiler tells me that the second rule of the match expression will never be consistent. What I am trying to express with the second rule is that when the head of the "world" list is different from the dimension, we will do the calculation as follows in the example.
Can anyone give me a hint with this?
f #
Grzegorz sławecki
source share