On Sat, Sep 30, 2000 at 03:48:07PM +0300, Ariel Scolnicov wrote:
> This is done in Lisp, and other functional languages.  Lisp lets you
> declare mutually recursive objects using the (letrec ...)  form.  In
> Scheme, say:
> 
> (letrec ((even? (lambda (x) (if (= x 0) t   (odd?  (- x 1)))))
>          (odd?  (lambda (x) (if (= x 0) nil (even? (- x 1))))))
>   (even? 11))
> 
> [No, this is not a good way to write these functions.]
> 
> I'm unsure how to write this Perlishly.

Hm. How about something like this:

    {
        my sub odd;
        my sub even;

        sub odd  { return !even(shift)}
        sub even { return !odd (shift)}
    }

-- 
It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.
Something is wrong here.

Reply via email to