Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.lang.forth Subject: Re: Double multiplication Date: Thu, 05 Dec 2013 21:24:24 -0500 Organization: Aioe.org NNTP Server Lines: 49 Message-ID: References: <52a06e37$0$2919$e4fe514c@news2.news.xs4all.nl> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:27162 On Thu, 05 Dec 2013 07:14:43 -0500, Hans Bezemer wrote: > mhx@iae.nl wrote: >> On Sunday, December 1, 2013 8:41:55 PM UTC+8, Ed wrote: >>> Conventionally these would be: >>> 2TUCK ( x1 x2 x3 x4 -- x3 x4 x1 x2 x3 x4 ) >>> 2NIP ( x1 x2 x3 x4 -- x3 x4 ) >>> as they work equally well with pairs of singles. >> >> Actually, I never use DTUCK (too deep for comforth). >> DNIP is because I have seen 2NIP ( x2 x1 x0 -- x1 x0 ). > > 2TUCK is done with 9 instructions: > > : 2tuck over >r rot >r rot over r> r> rot ; > > You won't define 2OVER so easily with these basic instructions. > These were found using a modified version of Peter Sovietov's Forth Wizard. : r@ r> dup >r ; : rot >r swap r> swap ; : -rot swap >r swap r> ; : nip swap drop ; : tuck dup >r swap r> ; : over >r dup r> swap ; : 2drop drop drop ; : 2>r swap >r >r ; : 2r> r> r> swap ; : 2r@ r> r> dup >r swap dup >r ; : 2nip >r >r drop drop r> r> ; : 2dup >r dup r> dup >r swap r> ; : 2swap >r swap r> swap >r >r swap r> swap r> ; : 2tuck over >r rot >r rot over r> r> rot ; : 2over >r >r over over r> r> rot >r rot r> ; : 2rot >r >r 2swap r> r> 2swap ; : -2rot 2swap >r >r 2swap r> r> ; 2tuck 2over 2rot -2rot were taking up too much time finding solutions without rot over 2swap. I expect most of them to expand to around 20 or more. Coos' solution for 2tuck without rot is at 18 using over. Rod Pemberton