Prolog e1 started

This commit is contained in:
Dan Ballard 2011-03-31 15:32:48 -07:00
parent 97b86f1d3f
commit d6600f66bd
2 changed files with 10 additions and 0 deletions

7
e1.pl Normal file
View File

@ -0,0 +1,7 @@
range(End, End, []) .
range(Start, End, [Start| Acc]) :- Next is Start + 1, range(Next, End, Acc).
divisors_3_5([], []).
divisors_3_5([X|Xs], [X|Ys]) :- 0 is X rem 3, divisors_3_5(Xs, Ys).
divisors_3_5([X|Xs], [X|Ys]) :- 0 is X rem 5, divisors_3_5(Xs, Ys).
divisors_3_5([X|Xs], Ys]) :- divisors_3_5(Xs, Ys).

3
prolog.txt Normal file
View File

@ -0,0 +1,3 @@
swipl
[file].
fn.