Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 08 Nov 2012 08:11:51 -0600 From: Chris Hinsley Newsgroups: comp.lang.forth Date: Thu, 8 Nov 2012 14:11:51 +0000 Message-ID: <2012110814115169871-chrishinsley@gmailcom> References: <2012110713421835115-chrishinsley@gmailcom> <509bb9a2$0$6999$882e7ee2@usenet-news.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Genral advise and comments on callback style words User-Agent: Unison/2.1.9 Lines: 44 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-RiieGyVYdlW9HoDSWbI5zviMENc5Qqhz2xRMoaWHUoeRHLEjH7Avdi2W6Oe+VCKfJfbOWHkHNZanHuc!FfmNOn639WktbqvBK0M5xyH3ruLnukvrIVj7L14Xp3Il3gr679cm5zdmeAjyC3agW8zpDyU= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2265 Xref: csiph.com comp.lang.forth:17156 On 2012-11-08 13:54:42 +0000, Josh Grams said: > Chris Hinsley wrote: <2012110713421835115-chrishinsley@gmailcom> >> Folks I have implamented an Amiga style double linked list words set a >> few days back and I have an emueration word as follows: >> >> \ ( u xt lh -- ln | 0) >> \ xt api is ( u ln lh -- ln | 0 ) >> : LISTHEAD-ENUMERATE-FORWARDS >> 0 >R >> DUP LISTHEAD-GET-HEAD DUP >> BEGIN >> NIP DUP LISTNODE-GET-SUCC >> DUP >> WHILE >> 4 PICK 2 PICK 4 PICK >> 6 PICK EXECUTE DUP R! >> UNTIL THEN >> 2DROP 2DROP DROP >> R> >> ; > > There are other interfaces that might work better, but sticking to > yours, how about: > > : LISTHEAD-ENUMERATE-FORWARDS ( u xt lh -- ln | 0 ) > TUCK SWAP 2>R > LISTHEAD-GET-HEAD BEGIN > 2DUP LISTNODE-GET-SUCC > DUP WHILE > 2R@ EXECUTE > ?DUP UNTIL ELSE NIP THEN > NIP NIP 2R> 2DROP ; > > And just out of curiosity, why are you calling GET-HEAD and then > GET-SUCC before you do anything? Doesn't that skip the first list node? > > --Josh The GET-SUCC'd node isn't the node passed into the callback ! That's the node for the next iteration. Chris