<commit_before>(cl:in-package #:sicl-clos)

;;; For the specification of this function, see
;;; http://metamodular.com/CLOS-MOP/ensure-generic-function.html
;;;
;;; This function is also specified in the CLHS.
;;; http://www.lispworks.com/documentation/HyperSpec/Body/f_ensure.htm#ensure-generic-function

(defun ensure-generic-function
    (name
     &rest keys
     &key (environment sicl-env:*global-environment*)
     &allow-other-keys)
  (let ((generic-function
	  (if (sicl-environment:fboundp name environment)
	      (let ((fun (sicl-environment:fdefinition name)))
		(if (typep fun 'generic-function)
		    fun
		    (error 'type-error
			   :datum fun
			   :expected-type '(or null generic-function))))
	      nil)))
    (apply #'ensure-generic-function-using-class
	   generic-function name keys)))<commit_msg>Use function GLOBAL-ENVIRONMENT rather than deprecated variable *GLOBAL-ENVIRONMENT*.<commit_after>(cl:in-package #:sicl-clos)

;;; For the specification of this function, see
;;; http://metamodular.com/CLOS-MOP/ensure-generic-function.html
;;;
;;; This function is also specified in the CLHS.
;;; http://www.lispworks.com/documentation/HyperSpec/Body/f_ensure.htm#ensure-generic-function

(defun ensure-generic-function
    (name
     &rest keys
     &key (environment (sicl-genv:global-environment))
     &allow-other-keys)
  (let ((generic-function
	  (if (sicl-environment:fboundp name environment)
	      (let ((fun (sicl-environment:fdefinition name)))
		(if (typep fun 'generic-function)
		    fun
		    (error 'type-error
			   :datum fun
			   :expected-type '(or null generic-function))))
	      nil)))
    (apply #'ensure-generic-function-using-class
	   generic-function name keys)))
{'fraction_non_alphanumeric': 0.1391962725684333, 'fraction_numerical': 0.0, 'mean_word_length': 3.7327823691460056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7471444', 'n_tokens_mistral': 578, 'n_tokens_neox': 541, 'n_words': 120}