[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] complex? call hangs function
From: |
Bruno Deferrari |
Subject: |
Re: [Chicken-users] complex? call hangs function |
Date: |
Thu, 18 Oct 2007 08:46:37 -0200 |
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 <address@hidden> 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
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>