What about this one? (define Steps-func (lambda (x) (cond ((zero? x) (rank-1 0)) ((negative? x) (reverse (Steps-func (abs x)))) ((not (real? x)) (Steps-func (real-part x))) (else (let* ([total-elems (+ 1 (* 2 x))] [start (* -1 x)]) total-elems)))))
'complex?' is true for every number as reals, rationals and integers are subsets of complex numbers. If you want to test if it is a complex, but not an integer/rational/real you can use '(not (real? x))' as the test. On 10/18/07, Terrence Brannon <[EMAIL PROTECTED]> wrote: > The following function works perfectly fine until I add > > ((complex? x) (steps (real-part x))) > > (use srfi-1) > (use numbers) > > (define steps > (lambda (x) > (cond > ((zero? x) (list 0)) > ((negative? x) (reverse (steps (abs x)))) > ((complex? x) (steps (real-part x))) > (else > (let ([start (* -1 x)] > [count (+ 1 (* 2 x))]) > (iota count start)))))) > > > _______________________________________________ > Chicken-users mailing list > Chicken-users@nongnu.org > http://lists.nongnu.org/mailman/listinfo/chicken-users > _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users