Bayesian Erlang: Help with translation from Prolog
Joel Reymont
joelr1@REDACTED
Thu Jan 12 02:14:01 CET 2006
This was an easy one. I'm wondering if backtracking can be
implemented by catching pattern-matching exceptions, though. What do
you think?
-module(p).
-compile([export_all]).
p({patient, cancer}) -> 0.1;
p({patient, smoker}) -> 0.5.
cp({patient, smoker}, {patient, cancer}) -> 0.8;
cp(_, _) -> none.
getp({A, B})
when is_tuple(A),
is_tuple(B) ->
case cp(A, B) of
none ->
Pba = cp(B, A),
Pa = getp(A),
Pb = getp(B),
Pba * Pa / Pb;
X ->
X
end;
getp(A) -> p(A).
On Jan 11, 2006, at 10:52 PM, Joel Reymont wrote:
> Folks,
>
> I'm looking at http://www.ainewsletter.com/newsletters/
> aix_0304.htm#code_corner and trying to translate the following from
> Prolog. Would someone kindly lend me a hand?
>
> Thanks, Joel
>
--
http://wagerlabs.com/
More information about the erlang-questions
mailing list