# HG changeset patch # User Steve Losh # Date 1476538054 0 # Node ID 56f6ff3b225f518632ea8f86383373425ddca42c # Parent 756273274876ca232584a772a2e1397fe66b1c5d Fix numeric contagion in `cycling` diff -r 756273274876 -r 56f6ff3b225f losh.lisp --- a/losh.lisp Sat Oct 15 13:14:57 2016 +0000 +++ b/losh.lisp Sat Oct 15 13:27:34 2016 +0000 @@ -949,11 +949,11 @@ (for x :cycling (print 'beep) :from 1 :downto 0 :by 0.5) (print x)) => - 1 + 1.0 0.5 0.0 BEEP - 1 + 1.0 0.5 " @@ -966,10 +966,12 @@ (let ((kwd (if generate 'generate 'for))) (with-gensyms (%counter %start %end %increment) `(progn - (with ,%start = ,start) (with ,%end = ,end) (with ,%increment = ,increment) (with ,%counter) + ;; ugly hack to get numeric contagion right for the first val + ;; (borrowed from Alexandria) + (with ,%start = (- (+ ,start ,%increment) ,%increment)) (,kwd ,var next (progn (setf ,%counter