[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
prolog: CLP-problem
From: |
Wim Vleugels |
Subject: |
prolog: CLP-problem |
Date: |
Sun, 18 Apr 2004 15:57:58 +0200 (MEST) |
Hello,
I'm having some troubles writing the next program.
There 's a problem with the predicate "control".
I just want to have that at least one of the two elements Elem1, Elem2 is a
consonant, but the solver returns all possibilities (i.e. 1 to 4) for Elem1
and Elem2 instead of only the possibilities 1 of 2.
Is there somebody who knows what I'm doing wrong or can someone give me a
working solution without a backtracking mechanism (such like the use of
";")?
Thx,
a Belgian student
test(Elements):-
domein(Elements),
control(Elements),
labeling([],Elements),
write(Elements),
nl,
fail.
control([Elem1,Elem2]):-
((consonant(Elem1)) #\/ (consonant(Elem2))).
consonant(Elem) +: Elem in {1,2}.
dissonant(Elem) +: Elem in {3,4}.
domein(Elements):-
domein2(Low,High),
domain(Elements,Low,High).
domein2(Low,High) :-
Low #= 1,
High #= 4.
--
NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info
- prolog: CLP-problem,
Wim Vleugels <=