(defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1))))) (defun pDist (k L) (/ (* (expt L k) (exp (* -1 L))) (factorial k))) (defmacro while (test &rest body) `(do () ((not ,test)) ,@body)) (defun pRandom (lam) (let ((L (exp (* -1 lam))) (k 0) (p 1)) (while (< L p) (incf k) (setf p (* p (my-random 1.0))) ) (- k 1) ) ) (defun split-list (n lst) (let ((plan (subseq lst 0 n)) (heap (subseq lst n))) (append (list plan) heap) ) ) (defun getPlan (split-req-list) (car split-req-list) ) (defun getHeap (split-req-list) (cdr split-req-list) ) (defmacro avg (&rest args) `(/ (+ ,@args) ,(length args)) ) ;(defun updatevalues(inrequirements) ; (mapcar #'(lambda(x) (progn ; (setf (car x) (+ (car x) (randnorm 0 (globdef-req_value_sigma gv)))) ; x ; )) inrequirements) ;) (setf lst '((1 1) (2 2) (3 3) (4 4) (5 5) (6 6))) (defun remove-nth(n l) (if (> (- n 1) (length l)) l (if (= n 0) (cdr l) (cons (car l) (remove-nth (- n 1) (cdr l))))))