This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%6. Define a predicate list_of_divisors(N,L) which for a positive integer N | |
%%% calculates the list of its proper divisors. (A proper divisor of n is a positive | |
%%% integer m < n such that m divides n.) | |
divisor(N,P) :- | |
P>0, | |
N>P, | |
0 is N mod P. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Btree a = ND | Data a | Branch (Btree a) (Btree a) | |
deriving (Show,Eq) | |
data Dir = L | R | |
deriving (Show,Eq) | |
type Path = [Dir] | |
--- Part a) | |