<commit_before>;; test-utils.lisp - utility forms [AFFTA]

(in-package #:mcicl.test)

(defclass closure-container () ;; cf. PREDICATE (?)
  ;; FIXME: Reevaluate this class' application
  ((environment
    :initarg :environment
    :initform nil
    :accessor container-environment)))

;;; % Set Equivalence Operations


(defmacro do-seo (op (a b))
  ;; do-set-equivalence-op
  (with-gensym (%a %b len-a len-b n)
    `(let ((,%a ,a)
           (,%b ,b)
           (,len-a (length a))
           (,len-b (length b)))
       (declare (type unsigned-byte ,len-a ,len-b)
                (inline ,op))
       ;; NB: This might avert some compiler transformations, in using
       ;; DOTIMES instead of EVERY. Notably, SBCL converts an EVERY
       ;; call to a MAP call. Perhaps there may be not much of an
       ;; optimization lost, in this alternate approach of using
       ;; DOTIMES instead of EVERY -- with LEN-A and LEN-B already
       ;; available, as needed for this set/elements form.
       ;;
       ;; NB: A compiler optimization may be defined for the LENGTH calls
       ;; in this form, for when A and/or B can be determined to be of
       ;; type VECTOR or SIMPLE-ARRAY [SBCL 1.2.6]
       (and (= ,len-a ,len-b)
            (dotimes (,n ,len-a t)
              (unless (funcall (function ,op) (elt ,%a ,n) (elt ,%b ,n))
                (return nil)))))))


(defun set= (a b)
  (declare (type sequence a b)
           (values boolean))
  (do-seo = (a b)))

;; (set= '(1.0 2.0) '(1 2.0d0))
;; => T
;; ;; (set= '(1.0 2.0) '(1 2.0d0 3))
;; => NIL


(defun set-eql (a b)
  (declare (type sequence a b)
           (values boolean))
  (do-seo eql (a b)))
<commit_msg>refinements in coments<commit_after>;; test-utils.lisp - utility forms [AFFTA]

(in-package #:mcicl.test)

(defclass closure-container () ;; cf. PREDICATE (?)
  ;; FIXME: Reevaluate this class' application
  ((environment
    :initarg :environment
    :initform nil
    :accessor container-environment)))

;;; % Set Equivalence Operations


(defmacro do-seo (op (a b))
  ;; do-set-equivalence-op
  (with-gensym (%a %b len-a len-b n)
    `(let ((,%a ,a)
           (,%b ,b)
           (,len-a (length a))
           (,len-b (length b)))
       (declare (type unsigned-byte ,len-a ,len-b)
                (inline ,op))
       ;; NB: This might avert some compiler transformations, in using
       ;; DOTIMES instead of EVERY. Notably, SBCL converts an EVERY
       ;; call to a MAP call. Perhaps there may be not much of an
       ;; optimization lost, in this alternate approach of using
       ;; DOTIMES instead of EVERY -- with LEN-A and LEN-B already
       ;; available, as needed for this set/elements form.
       ;;
       ;; NB: A compiler optimization may be defined for the LENGTH
       ;; and ELT calls in this form, for when A and/or B can be
       ;; determined to be type VECTOR or SIMPLE-ARRAY [SBCL
       ;; 1.2.6]. Perhaps that may behoove a design for a method for
       ;; dispatching optimizations. Alternately, this may be
       ;; implemented within a generic function in which the types of
       ;; A and B would be more specificall defined
       (and (= ,len-a ,len-b)
            (dotimes (,n ,len-a t)
              (unless (funcall (function ,op) (elt ,%a ,n) (elt ,%b ,n))
                (return nil)))))))


(defun set= (a b)
  (declare (type sequence a b)
           (values boolean))
  (do-seo = (a b)))

;; (set= '(1.0 2.0) '(1 2.0d0))
;; => T
;; (set= '(1.0 2.0) '(1 2.0d0 3))
;; => NIL
;; (set= '(1.0 3.0) '(1 2.0d0))
;; => NIL


(defun set-eql (a b)
  (declare (type sequence a b)
           (values boolean))
  (do-seo eql (a b)))

{'fraction_non_alphanumeric': 0.14489181046288688, 'fraction_numerical': 0.01314708299096138, 'mean_word_length': 2.287128712871287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3491436', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1232, 'n_words': 449}