<commit_before>;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-

(in-package :Eos)

;;; This is taken from Arnesi's src/one-liners.lisp, and implements a
;;; more sophisticated version of PCL's WITH-GENSYMS.

(defmacro with-unique-names ((&rest bindings) &body body)
  ;; reference implementation posted to comp.lang.lisp as
  ;; <<EMAIL>> by <NAME> - see also
  ;; <http://www.cliki.net/Common%20Lisp%20Utilities>
  `(let ,(mapcar (lambda (binding)
                   (check-type binding (or cons symbol))
                   (destructuring-bind (var &optional (prefix (symbol-name var)))
                       (if (consp binding) binding (list binding))
                     (check-type var symbol)
                     `(,var (gensym ,(concatenate 'string prefix "-")))))
                 bindings)
     ,@body))

;;; This is taken from Arnesi's src/list.lisp, and implements a naive
;;; list matching facility.
;;; <NAME> says in the original:
;;; ;;;; ** Simple list matching based on code from <NAME>ham's On Lisp.

(defmacro acond2 (&rest clauses)
  (if (null clauses)
      nil
      (with-unique-names (val foundp)
        (destructuring-bind ((test &rest progn) &rest others)
            clauses
          `(multiple-value-bind (,val ,foundp)
               ,test<commit_msg>Added FN macro<commit_after>;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-

(in-package :Eos)

(defmacro fn (&body body)
  "An abbreviation for some common lambda use-cases."
  (let ((parameter (intern "_")))
    `(lambda (,parameter) (declare (ignorable ,parameter)) ,@body)))

;;; This is taken from Arnesi's src/one-liners.lisp, and implements a
;;; more sophisticated version of PCL's WITH-GENSYMS.

(defmacro with-unique-names ((&rest bindings) &body body)
  ;; reference implementation posted to comp.lang.lisp as
  ;; <<EMAIL>> by <NAME> - see also
  ;; <http://www.cliki.net/Common%20Lisp%20Utilities>
  `(let ,(mapcar (lambda (binding)
                   (check-type binding (or cons symbol))
                   (destructuring-bind (var &optional (prefix (symbol-name var)))
                       (if (consp binding) binding (list binding))
                     (check-type var symbol)
                     `(,var (gensym ,(concatenate 'string prefix "-")))))
                 bindings)
     ,@body))

;;; This is taken from Arnesi's src/list.lisp, and implements a naive
;;; list matching facility.
;;; <NAME> says in the original:
;;; ;;;; ** Simple list matching based on code from <NAME>'s On Lisp.

(defmacro acond2 (&rest clauses)
  (if (null clauses)
      nil
      (with-unique-names (val foundp)
        (destructuring-bind ((test &rest progn) &rest others)
            clauses
          `(multiple-value-bind (,val ,foundp)
               ,test
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0035714285714285713, 'mean_word_length': 2.5956354300385107, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1494087', 'n_tokens_mistral': 898, 'n_tokens_neox': 844, 'n_words': 267}