<commit_before>; tré – Copyright (c) 2006–2009,2011–2015 <NAME> <<EMAIL>>

(defstruct expander
  name
  macros
  pred
  call
  pre
  post
  lookup
  user) ; For external use.

(defun expander-macro (expander macro-name)
  (href (expander-macros expander) macro-name))

(defun expander-argdef (expander macro-name)
  (car (expander-macro expander macro-name)))

(defun expander-function (expander macro-name)
  (cdr (expander-macro expander macro-name)))

;(defun (= expander-function) (new-function expander macro-name)
;  (= (cdr (href (expander-macros expander) macro-name)) new-function))

(defun expander-has-macro? (expander macro-name)
  (href (expander-macros expander) macro-name))

(defun define-expander (expander-name &key (pre nil) (post nil) (pred nil) (call nil))
  (format t "Making expander ~A.~%" expander-name)
  (aprog1 (make-expander :name expander-name
                         :macros (make-hash-table :test #'eq)
                         :pred pred
                         :call call
                         :pre (| pre #'(nil))
                         :post (| post #'(nil)))
    (| pred
       (= (expander-pred !) [& (cons? _)
                               (symbol? _.)
	                           (expander-function ! _.)]))
    (| call<commit_msg>Use PRINT-DEFINITION.<commit_after>; tré – Copyright (c) 2006–2009,2011–2015 <NAME> <<EMAIL>>

(defstruct expander
  name
  macros
  pred
  call
  pre
  post
  lookup
  user) ; For external use.

(defun expander-macro (expander macro-name)
  (href (expander-macros expander) macro-name))

(defun expander-argdef (expander macro-name)
  (car (expander-macro expander macro-name)))

(defun expander-function (expander macro-name)
  (cdr (expander-macro expander macro-name)))

;(defun (= expander-function) (new-function expander macro-name)
;  (= (cdr (href (expander-macros expander) macro-name)) new-function))

(defun expander-has-macro? (expander macro-name)
  (href (expander-macros expander) macro-name))

(defun define-expander (expander-name &key (pre nil) (post nil) (pred nil) (call nil))
  (print-definition `(define-expander ,expander-name))
  (aprog1 (make-expander :name expander-name
                         :macros (make-hash-table :test #'eq)
                         :pred pred
                         :call call
                         :pre (| pre #'(nil))
                         :post (| post #'(nil)))
    (| pred
       (= (expander-pred !) [& (cons? _)
                               (symbol? _.)
	                           (expander-function ! _.)]))
    (| call
{'fraction_non_alphanumeric': 0.1377431906614786, 'fraction_numerical': 0.013229571984435798, 'mean_word_length': 2.2793367346938775, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '796801', 'n_tokens_mistral': 883, 'n_tokens_neox': 828, 'n_words': 209}