<commit_before>(ns clojush.individual)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Individuals are records.
;; Populations are vectors of agents with individuals as their states (along with error and
;; history information).

(defrecord individual [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators])

(defn make-individual [& {:keys [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators]
                          :or {genome nil
                               program nil
                               errors nil
                               total-error nil ;; a non-number is used to indicate no value
                               normalized-error nil
                               weighted-error nil
                               meta-errors nil
                               history nil
                               ancestors nil
                               uuid (java.util.UUID/randomUUID)
                               parent-uuids nil
                               genetic-operators nil
                               age 0}}]
  (individual. genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators age))

(defn printable [thing]
  (letfn [(unlazy [[head & tail]]
                  (cons (if (seq? head) (unlazy head) head)
                        (if (nil? tail) tail (unlazy tail))))]
    (cond (seq? thing) (unlazy thing)
          (nil? thing) 'nil
          :else thing)))

(defn individual-string [i]
  (cons 'individual.
        (let [k '(:genome :program :errors :total-error :normalized-error :weighted-error :meta-errors :history :ancestors :uuid :parent-uuids :genetic-operators :age)]
          (interleave k  (map #(printable (get i %)) k)))))
<commit_msg>Fixed missing age args.<commit_after>(ns clojush.individual)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Individuals are records.
;; Populations are vectors of agents with individuals as their states (along with error and
;; history information).

(defrecord individual [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators age])

(defn make-individual [& {:keys [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators age]
                          :or {genome nil
                               program nil
                               errors nil
                               total-error nil ;; a non-number is used to indicate no value
                               normalized-error nil
                               weighted-error nil
                               meta-errors nil
                               history nil
                               ancestors nil
                               uuid (java.util.UUID/randomUUID)
                               parent-uuids nil
                               genetic-operators nil
                               age 0}}]
  (individual. genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators age))

(defn printable [thing]
  (letfn [(unlazy [[head & tail]]
                  (cons (if (seq? head) (unlazy head) head)
                        (if (nil? tail) tail (unlazy tail))))]
    (cond (seq? thing) (unlazy thing)
          (nil? thing) 'nil
          :else thing)))

(defn individual-string [i]
  (cons 'individual.
        (let [k '(:genome :program :errors :total-error :normalized-error :weighted-error :meta-errors :history :ancestors :uuid :parent-uuids :genetic-operators :age)]
          (interleave k  (map #(printable (get i %)) k)))))


{'fraction_non_alphanumeric': 0.12578458448405724, 'fraction_numerical': 0.0005021340697966357, 'mean_word_length': 1.833570412517781, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4197261', 'n_tokens_mistral': 1031, 'n_tokens_neox': 949, 'n_words': 317}