Skip to content

Commit 94ecda6

Browse files
Refactor.
1 parent 9b20799 commit 94ecda6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

data/funds.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
33
:- dynamic type/1, dividend/1, quality/1, highyield/1, category/1, sector/1, fund/1.
44
5-
select :- type(stock), dividend(yes), quality(rising), highyield(yes), assert(fund(sdy)).
6-
select :- type(stock), dividend(yes), quality(rising), highyield(no), assert(fund(pfm)).
7-
select :- type(bond), category(short), sector(broad), assert(fund(bsv)).
8-
select :- type(bond), category(medium), sector(broad), assert(fund(bnd)).
5+
%select :- type(stock), dividend(yes), quality(rising), highyield(yes), assert(fund(sdy)).
6+
fund(sdy) :- type(stock), dividend(yes), quality(rising), highyield(yes).
7+
fund(pfm) :- type(stock), dividend(yes), quality(rising), highyield(no).
8+
fund(bsv) :- type(bond), category(short), sector(broad).
9+
fund(bnd) :- type(bond), category(medium), sector(broad).
910
1011
% By adding this fact, when we set highyield=yes, we also get dividend=yes, thus leading us to fund(sdy).
1112
dividend(yes) :- highyield(yes).
@@ -14,8 +15,10 @@ type(stock).
1415
%dividend(yes).
1516
quality(rising).
1617
highyield(yes).
18+
category(none).
19+
sector(none).
1720
18-
?- select, fund(Which)
21+
?- fund(Which)
1922
2023
% Output: Which = sdy
2124
*/

0 commit comments

Comments
 (0)