<commit_before>(in-package #:lisphys)

(defclass vector3 (math)
  ((x :accessor vector3-x :initarg :x :initform 0.)
   (y :accessor vector3-y :initarg :y :initform 0.)
   (z :accessor vector3-z :initarg :z :initform 0.)))

(defclass vector3p (vector3)
  ((add :initform #'- :allocation :class)
   (mult :initform #'/ :allocation :class))
)

(defmethod .+ ((va vector3) (vb vector3))
"Add two vector3."
  (with-slots (x y z (.+ add)) va
    (with-slots ((tx x) (ty y) (tz z)) vb
      (make-instance (type-of va)
		     :x (funcall .+ x tx) 
		     :y (funcall .+ y ty) 
		     :z (funcall .+ z tz) )
      )
    )
  )

(defmethod .- ((va vector3) (vb vector3))
"Substract vector3 vb from va."
  (with-slots (x y z (.- sub) ) va
    (with-slots ((tx x) (ty y) (tz z)) vb
      (make-instance (type-of va) 
		     :x (funcall .- x tx)
		     :y (funcall .- y ty) 
		     :z (funcall .- z tz) )
      )
    )
  )
<commit_msg>Initialize using single-float.<commit_after>(in-package #:lisphys)

(defclass vector3 (math)
  ((x :accessor vector3-x :initarg :x :initform 0.0)
   (y :accessor vector3-y :initarg :y :initform 0.0)
   (z :accessor vector3-z :initarg :z :initform 0.0)))

(defclass vector3p (vector3)
  ((add :initform #'- :allocation :class)
   (mult :initform #'/ :allocation :class))
)

(defmethod .+ ((va vector3) (vb vector3))
"Add two vector3."
  (with-slots (x y z (.+ add)) va
    (with-slots ((tx x) (ty y) (tz z)) vb
      (make-instance (type-of va)
		     :x (funcall .+ x tx) 
		     :y (funcall .+ y ty) 
		     :z (funcall .+ z tz) )
      )
    )
  )

(defmethod .- ((va vector3) (vb vector3))
"Substract vector3 vb from va."
  (with-slots (x y z (.- sub) ) va
    (with-slots ((tx x) (ty y) (tz z)) vb
      (make-instance (type-of va) 
		     :x (funcall .- x tx)
		     :y (funcall .- y ty) 
		     :z (funcall .- z tz) )
      )
    )
  )

{'fraction_non_alphanumeric': 0.1813304721030043, 'fraction_numerical': 0.017703862660944206, 'mean_word_length': 2.3008849557522124, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1298025', 'n_tokens_mistral': 816, 'n_tokens_neox': 774, 'n_words': 228}