Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!sri-spam!mordor!lll-tis!ptsfa!ihnp4!homxb!houxm!hropus!jin From: jin@hropus.UUCP (Jerry Natowitz) Newsgroups: comp.lang.forth Subject: Re: Forth and recursion Message-ID: <1180@hropus.UUCP> Date: Fri, 24-Jul-87 13:23:29 EDT Article-I.D.: hropus.1180 Posted: Fri Jul 24 13:23:29 1987 Date-Received: Tue, 28-Jul-87 03:09:08 EDT References: <1644@xanth.UUCP> Organization: Bell Labs, Holmdel, NJ Lines: 23 > > I am a beginning Forth user, and I am intrigued by Forth's syntax, which > is completely different than anything else I've ever tinkered with. Since > Forth is a stack oriented language, it seems to me that it would be very > suitable for recursive programming. Do any implementations of Forth directly > support recursively defined words? Is it possible to program extensions in > Forth that will add this capability? I worked on a FORTH from Transportable Software (now defunct) that included a RECURSIVE word that would recursively "thread" the currently constructing colon definition. As an example ( no flames please, I haven't written FORTH code for over two years). : FACTORIAL ( N -> M ASSUME N >= 1 ) DUP 1 <> IF 1 - * RECURSIVE THEN ; I believe that RECURSIVE looked at current and got the CFA or whatever and did a "," (store word in dictionary). -- ---------------- Jerry Natowitz ihnp4!hropus!jin