Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #17178
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Date | 2012-11-08 19:42 +0000 |
| Message-ID | <2012110819424774822-chrishinsley@gmailcom> (permalink) |
| References | <2012110713421835115-chrishinsley@gmailcom> <509bb9a2$0$6999$882e7ee2@usenet-news.net> <201211081406178276-chrishinsley@gmailcom> <509bf42e$0$11653$882e7ee2@usenet-news.net> <201211081938193500-chrishinsley@gmailcom> |
| Subject | Re: Genral advise and comments on callback style words |
On 2012-11-08 19:38:19 +0000, Chris Hinsley said: > On 2012-11-08 18:04:30 +0000, Josh Grams said: > >> Chris Hinsley wrote: <201211081406178276-chrishinsley@gmailcom> >>> 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> >>>>> ; >>>> >>>> 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? >>> >>> I'm keeping a 'look ahead' pointer to the next node in the list, as the >>> callback is allowed to trash the current node ! For instance it could >>> remove the node and then your left dangling ! >> >> Ah, I see. I thought you were keeping the previous one and getting the >> successor of that after the XT returned. Guess I didn't untangle the >> PICKs carefully enough. >> >> Hrm...I still think it's wrong...unless LISTNODE-GET-SUCC does something >> really strange like ( node node -- node.next node ), then your WHILE is >> checking the successor to see if it's null, so you won't process the >> final element in the list...? Or am I missing something again? >> >> --Josh > > In this forward enum case both HEAD and SUCC end up being just a ! > because HEAD and SUCC are 0. But in the backwards enumeration TAIL and > PRED are 8 and 4 respectivly. > > Chris Here are the structure defs: 0 BEGIN-STRUCTURE LISTNODE-STRUCTURE FIELD _SUCC FIELD _PRED END-STRUCTURE 0 BEGIN-STRUCTURE LISTHEAD-STRUCTURE FIELD _HEAD FIELD _END FIELD _TAIL END-STRUCTURE And this is the init words for a list to show how an empty list is set up. \ ( lh -- ) : LISTHEAD-INIT DUP >FIELD _END OVER LISTHEAD-SET-HEAD 0 OVER LISTHEAD-SET-END DUP >FIELD _HEAD SWAP LISTHEAD-SET-TAIL ; Regards Chris
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 13:42 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 13:51 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 13:56 +0000
Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-07 13:55 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:29 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:35 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:32 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:37 +0000
Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-08 16:31 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 17:02 +0000
Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-08 17:07 +0000
Re: Genral advise and comments on callback style words Mark Wills <forthfreak@gmail.com> - 2012-11-09 01:16 -0800
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-07 15:41 +0000
Re: Genral advise and comments on callback style words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-11-08 16:39 +0000
Re: Genral advise and comments on callback style words Brad Eckert <hwfwguy@gmail.com> - 2012-11-07 08:07 -0800
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 12:52 +0000
Re: Genral advise and comments on callback style words humptydumpty <ouatubi@gmail.com> - 2012-11-07 13:04 -0800
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:04 +0000
Re: Genral advise and comments on callback style words Mark Wills <forthfreak@gmail.com> - 2012-11-08 06:34 -0800
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:40 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:14 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:23 +0000
Re: Genral advise and comments on callback style words Ouatu Bogdan <ouatubi@gmail.com> - 2012-11-08 13:45 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 13:59 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:02 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 15:35 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 16:24 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 16:39 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 16:57 +0000
Re: Genral advise and comments on callback style words "Elizabeth D. Rather" <erather@forth.com> - 2012-11-08 07:56 -1000
Re: Genral advise and comments on callback style words Josh Grams <josh@qualdan.com> - 2012-11-08 13:54 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:06 +0000
Re: Genral advise and comments on callback style words Josh Grams <josh@qualdan.com> - 2012-11-08 18:04 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:36 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:38 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:42 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:11 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:31 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 14:51 +0000
Re: Genral advise and comments on callback style words Josh Grams <josh@qualdan.com> - 2012-11-08 18:23 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 19:57 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:04 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:17 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:29 +0000
Re: Genral advise and comments on callback style words Chris Hinsley <chris.hinsley@gmail.com> - 2012-11-08 20:50 +0000
csiph-web