(define-entity point () :constraint-variables ((a 0)) :lisp-variables ((m 1) (x #(0 0)) (v #(0 0)) (forces '())) :constraints ((= (sum forces) (* m a))) :after (setf v (+ v (* a *time-unit*)) x (+ x (* v *time-unit*)))) (define-entity spring () :lisp-variables (p1 p2 length k) :constraint-variables ((:vector f1) (:vector f2)) :before (progn (add-force p1 f1) (add-force p1 f2)) :constraints ((= (- f1 f2) (* -1 k (- (distance p1 p2) length))))) (define-entity weight () :lisp-variables ((m 1) (g -9.8) e) :before (progn (add-force e (* m g))))