Mercurial > hg > amuse
view base/charm/functions.lisp @ 253:b5ffec94ae6d
some very sketchy Charm constituent code
author | Jamie Forth <j.forth@gold.ac.uk> |
---|---|
date | Thu, 24 Feb 2011 11:23:18 +0000 |
parents | |
children |
line wrap: on
line source
(in-package #:amuse-charm) ;;;===================================================================== ;;; Helpful functions ;;;===================================================================== (defun find-first-onset (events) (reduce #'min events :key #'timepoint)) (defun find-last-offset (events) (reduce #'max events :key #'(lambda (event) (timepoint (cut-off event))))) (defgeneric object->db-string (o)) (defmethod object->db-string ((o charm-property-list)) (format nil "~S" (%list-slot-sequence-data o))) (defmethod object->db-string ((o event-identifier)) "This was an earlier approach, that was probably bad." "e") (defmethod object->db-string ((o constituent-identifier)) "This was an earlier approach, that was probably bad." "c") (defun recompute-constituent-timepoint (constituent) (setf (timepoint constituent) (reduce #'min constituent :key 'timepoint))) (defun recompute-constituent-duration (constituent) (setf (duration constituent) (reduce #'max constituent :key 'timepoint)))