; Finding closure of a set of attributes. ; ; Representation of a FD X --> Y: ; ; ((attributes in X) (attributes in Y)) ; (defun find-closure (x fds) (let ((x-new x) (x-old) ) (loop (setf x-old x-new) (setq x-new (update-closure x-new fds)) (if (equal x-old x-new) (return x-new)) ) ) ) (defun update-closure (x fds) (catch 'closure (u-c x fds)) ) (defun u-c (x fds) (dolist (fd fds x) (if (and (subsetp (first fd) x) (not (subsetp (second fd) x)) ) (throw 'closure (union x (second fd))) ) ) )