Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!unido!majestix!uh From: uh@informatik.uni-kiel.dbp.de (Ulrich Hoffmann) Newsgroups: comp.lang.forth Subject: Re: TEXIT Message-ID: <2236@batman.informatik.uni-kiel.dbp.de> Date: 13 Feb 91 12:30:53 GMT References: <9102122127.AA04970@ucbvax.Berkeley.EDU> Organization: Informatik CAU Kiel BRD Lines: 51 In <9102122127.AA04970@ucbvax.Berkeley.EDU> wmb@MITCH.ENG.SUN.COM (Mitch Bradley) writes: B.Rod>> Here's something else which (to my mind) cannot be implemented _efficiently_ B.Rod>> in a portable way using ANS Forth. Even the inefficient ways are difficult. B.Rod>> B.Rod>> : || IF R> DROP -1 THEN ; ( t - t) ( f - ) ( exit on true) B.Rod>> : && 0= IF R> DROP 0 THEN ; ( t - ) ( f - f) ( exit on false) M.Bra>: || M.Bra> POSTPONE DUP POSTPONE IF POSTPONE EXIT POSTPONE THEN M.Bra>; IMMEDIATE M.Bra>: && M.Bra> POSTPONE DUP POSTPONE 0= POSTPONE IF POSTPONE EXIT POSTPONE THEN M.Bra>; IMMEDIATE Mitch, I think you misinterpreted Brad's words. && and || are ment to leave a flag on exit, to _drop_ it otherwise. Thus possible definitions might be: : || ( true -- true&EXIT ) ( false -- ) ( comp: -- ) POSTPONE DUP POSTPONE IF POSTPONE EXIT POSTPONE THEN POSTPONE DROP ; IMMEDIATE ( ^^^^^^^^^^^^^ ) : && ( true -- ) ( false -- false&EXIT ) ( comp: -- ) POSTPONE DUP POSTPONE 0= POSTPONE IF POSTPONE EXIT POSTPONE THEN POSTPONE DROP ; IMMEDIATE ( ^^^^^^^^^^^^^ ) Apart from that I fully agree to what you stated. || and && CAN implemented portably and (at least runtime efficiently) using ANS Forth. Ulrich Ulrich Hoffmann ---------------------------------------------------------------------- Christian-Albrechts-Universitaet Kiel, Institut fuer Informatik Preusserstr. 1 - 9 , D - 2300 Kiel 1 Telefon: ++49-431-5604-59 , Telefax: ++49-431-566143 EMail: uh@majestix.informatik.uni-kiel.dbp.de ---------------------------------------------------------------------- Ulrich Hoffmann ---------------------------------------------------------------------- Christian-Albrechts-Universitaet Kiel, Institut fuer Informatik Preusserstr. 1 - 9 , D - 2300 Kiel 1 Telefon: ++49-431-5604-59 , Telefax: ++49-431-566143 EMail: uh@majestix.informatik.uni-kiel.dbp.de ----------------------------------------------------------------------