Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!border2.nntp.ams2.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!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: Wed, 07 Nov 2012 07:42:18 -0600 From: Chris Hinsley Newsgroups: comp.lang.forth Date: Wed, 7 Nov 2012 13:42:18 +0000 Message-ID: <2012110713421835115-chrishinsley@gmailcom> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Genral advise and comments on callback style words User-Agent: Unison/2.1.9 Lines: 35 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-pS8CE2AEeyqGUmjK/7L5keI4M7PTbyqoVDj/FPUGYFuuhkNkPVx1l2HxDA4r+w03w+31pjvLVg94ni1!qcI3IMmnOtNu87U4h8AuVZ3qvgErqdHeHXV/KH8wrp0A/T2MTztUbVPamwN4w3WZeq0IYzA= 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: 1961 Xref: csiph.com comp.lang.forth:17115 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> ; This scans down the list until either it hits the end, or the callback for each node returns a value other than 0, that value is returned and the scan stops if it isn't 0 ! I'd like comments and advice on techniuqe, paticularly for things like the PICK stuff that gathers paramaters for each callback, and the use of the return stack for the returned value. Or if you just plain think I could code this a better way ! I'm not wanting to be pointed to "the novice package", thank you, but want this API as stated ! ;) Regards all Chris