Simon Cozens <[EMAIL PROTECTED]> writes:
> On Fri, Sep 29, 2000 at 04:13:46PM +0100, Piers Cawley wrote:
> > Did anyone suggest the following yet?
> > package Foo;
> > my sub _helper_function { ... }
>
> Todo:
> lexically scoped functions: my sub foo { ... }
> the basic concept is easy and sound,
> the difficulties begin with self-referential
> and mutually referential lexical subs: how to
> declare the subs?
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.
--
Ariel Scolnicov |"GCAAGAATTGAACTGTAG" | [EMAIL PROTECTED]
Compugen Ltd. |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St. |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555 http://3w.compugen.co.il/~ariels