Path: csiph.com!aioe.org!.POSTED!not-for-mail From: Rod Pemberton Newsgroups: comp.lang.forth Subject: Re: Make Forth Small Again! Date: Tue, 21 Mar 2017 16:43:42 -0400 Organization: Aioe.org NNTP Server Lines: 50 Message-ID: <20170321164342.048da9ec@_> References: <87pohbhmxc.fsf@nightsong.com> <380124c4-7591-4c55-a262-3d92b5bd4333@googlegroups.com> <49462cff-1626-4261-9efe-aa74141c9950@googlegroups.com> NNTP-Posting-Host: ZTD62cW/Uw8bymX5ok+0NA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:56056 On Tue, 21 Mar 2017 09:42:01 -0500 Andrew Haley wrote: > Helmar Wodtke wrote: > > Some kind of "odd" is that 2OVER could be defined by: > > > > : 2OVER 3 PICK 3 PICK ; > > > > That might make sense when designing a very small Forth system, but I > can think of no reason to structure a standard in that way. > DUP DROP SWAP >R R> and their two word equivalents are faster or more efficient than PICK and ROLL for coding stack words, but if you're attempting to minimize the set of "primitive" words for a smaller Forth, then PICK and ROLL are effective: : DUP 0 PICK ; : SWAP 1 ROLL ; : OVER 1 PICK ; : ROT 2 ROLL ; : -ROT 2 ROLL 2 ROLL ; : NIP 1 ROLL DROP ; : TUCK 1 ROLL 1 PICK ; : DIP DROP 0 PICK ; : DRIP 1 ROLL DROP 0 PICK ; : TAKE DROP 1 ROLL ; : NUP 1 PICK 1 ROLL ; : 2DUP 1 PICK 1 PICK ; : 2SWAP 3 ROLL 3 ROLL ; : 2OVER 3 PICK 3 PICK ; : 2ROT 5 ROLL 5 ROLL ; : -2ROT 5 ROLL 5 ROLL 5 ROLL 5 ROLL ; : 2NIP 2 ROLL DROP 2 ROLL DROP ; : 2NIP 3 ROLL 3 ROLL DROP DROP ; : 2TUCK 3 ROLL 3 ROLL 3 PICK 3 PICK ; (incomplete) Rod Pemberton -- All it takes for humanity to conquer the world's toughest problems is to hope, to believe, to share, and to do, in cooperation.