Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!EUTWS1.WIN.TUE.NL!wsbusup From: wsbusup@EUTWS1.WIN.TUE.NL (Jan Stout) Newsgroups: comp.lang.forth Subject: Re: Functional (Applicative) Programming Message-ID: <9103210414.AA14573@ucbvax.Berkeley.EDU> Date: 20 Mar 91 15:51:35 GMT References: <9103201419.AA15196@svin01.win.tue.nl> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Jan Stout Organization: The Internet Lines: 63 > > These are separate issues from how often the keyword "IF" appears in > > your program. > > IF is necessary. But you can try guarded commands.... > GUARDED-BEGIN : > : > ... ... > GUARDED-END > > If no condition is satisfied, the program aborts. If two or more conditions are > satisfied the action assossiated of one of them (non-determined) will be > executed. > > GUARDED-LOOP-BEGIN : > ... ... > GUARDED-LOOP-END > > The loop will be executed as long as there is one condition being satisfied. > You can choose whatever behavior you want when there is more than one condition > being satisfied. > > These are Dijinskra structeres. What's that you said? Dijinskra? (Since you called him that twice I don't consider the posibility of faulty transmission software:) I knew Dutch is not the easiest language for a non-native, but the man was called Dijkstra when he left this university X years ago. Furthermore I would use the original (shorther) spelling, so the constructs become: IF guard0 DO guard0 -> statement0 -> statement0 [] guard1 [] guard1 -> statement1 -> statement1 ... ... [] guardn [] guardn -> statementn -> statementn FI OD By the way, implementing IF/FI and DO/OD as is in Forth, will be a bit hard, because of the prefixedness. Therefore I'd suggest a syntax like the following: guard0 guard0 IF statement0 [] DO statement0 [] guard1 guard1 IF statement1 [] DO statement1 [] ... ... guardn guardn IF statementn FI DO statementn OD Note that when [] gets rewritten as ELSE, you'd have a alternative to the Baden's OF THENS and Eaker's CASE. I'll leave the implementation pleasures to you :) Jan Stout, Eindhoven University of Technology wsbusup@eutws1.win.tue.nl (for now anyway)