close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Changeset 1229


Ignore:
Timestamp:
2015-06-11T14:19:03-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/utils.lisp

    r1228 r1229  
    6464         (declare (fixnum ,var))))))
    6565
    66 (defmacro summation (expr (var lo hi &optional (step 1) (addition '+)))
    67   `(,addition ,@`(makelist ,expr ,var ,lo ,hi ,step)))
     66(defmacro summation (expr (var lo hi &optional (step 1)) &optional (addition '+) (initval 0))
     67  (let ((r (gensym)))
     68    `(do ((,r ,initval)
     69          (,var ,lo (+ ,var ,step)))
     70         ((> ,var ,hi) ,r)
     71       (setf ,r (,addition ,r ,expr)))))
    6872                                       
    6973                               
Note: See TracChangeset for help on using the changeset viewer.