<commit_before>(cl:in-package #:clump-binary-tree)

;;; Make CHILD the left child of NODE.
(defgeneric link-left (parent child))

(defmethod link-left ((parent node) (child node))
  (setf (left parent) child))

(defmethod link-left ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) parent))

;;; Make CHILD the right child of PARENT.
(defgeneric link-right (parent child))

(defmethod link-right ((parent node) (child node))
  (setf (right parent) child))

(defmethod link-right ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) parent))

;;; Remove CHILD as the left child of PARENT.
(defgeneric unlink-left (parent child))

(defmethod unlink-left ((parent node) (child node))
  (setf (left parent) nil))

(defmethod unlink-left ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) nil))

;;; Remove CHILD as the right child of PARENT.
(defgeneric unlink-right (parent child))
<commit_msg>Define methods on UNLINK-RIGHT.<commit_after>(cl:in-package #:clump-binary-tree)

;;; Make CHILD the left child of NODE.
(defgeneric link-left (parent child))

(defmethod link-left ((parent node) (child node))
  (setf (left parent) child))

(defmethod link-left ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) parent))

;;; Make CHILD the right child of PARENT.
(defgeneric link-right (parent child))

(defmethod link-right ((parent node) (child node))
  (setf (right parent) child))

(defmethod link-right ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) parent))

;;; Remove CHILD as the left child of PARENT.
(defgeneric unlink-left (parent child))

(defmethod unlink-left ((parent node) (child node))
  (setf (left parent) nil))

(defmethod unlink-left ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) nil))

;;; Remove CHILD as the right child of PARENT.
(defgeneric unlink-right (parent child))

(defmethod unlink-right ((parent node) (child node))
  (setf (right parent) nil))

(defmethod unlink-right ((parent node-with-parent) (child node-with-parent))
  (call-next-method)
  (setf (parent child) nil))

{'fraction_non_alphanumeric': 0.1461706783369803, 'fraction_numerical': 0.0, 'mean_word_length': 4.7293233082706765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6511376', 'n_tokens_mistral': 771, 'n_tokens_neox': 763, 'n_words': 246}