Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #17115 > unrolled thread
| Started by | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| First post | 2012-11-07 13:42 +0000 |
| Last post | 2012-11-08 20:50 +0000 |
| Articles | 5 on this page of 45 — 8 participants |
Back to article view | Back to comp.lang.forth
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
Page 3 of 3 — ← Prev page 1 2 [3]
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Date | 2012-11-08 19:57 +0000 |
| Message-ID | <2012110819575749197-chrishinsley@gmailcom> |
| In reply to | #17175 |
On 2012-11-08 18:23:21 +0000, Josh Grams said: > Chris Hinsley wrote: <2012110814515560672-chrishinsley@gmailcom> >> On 2012-11-08 14:31:20 +0000, Chris Hinsley said: >>>> Josh Grams wrote: >>>>> >>>>> : 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 ; >>> >>> Err, I'm not sure that works! You are skipping the first node. > > Yeah, sorry; I thought that's what your code was doing; see my response > to your first reply to mine. > >>> Isn't the 2DUP also blowing up the stack with an extra copy of the >>> original LH each time ? >> >> And it's not passing the user value into the callback at all ? > > In this case, EXECUTE is ( u ln lh xt -- ln | 0 ), right? So the 2DUP > provides two of those four items, and the 2R@ provides the other two. > > : LISTHEAD-ENUMERATE-FORWARDS ( u xt lh -- ln | 0 ) > TUCK SWAP 2>R LISTHEAD-GET-HEAD > BEGIN DUP WHILE ( u ln ) ( R: lh xt ) > 2DUP LISTNODE-GET-SUCC 2SWAP > 2R@ EXECUTE > ?DUP UNTIL THEN ( u ln ln|0 ) NIP NIP 2R> 2DROP ; > > --Josh I'll go over this one on paper :) You might have a winner ! ;) Chris
[toc] | [prev] | [next] | [standalone]
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Date | 2012-11-08 20:04 +0000 |
| Message-ID | <2012110820040689990-chrishinsley@gmailcom> |
| In reply to | #17175 |
On 2012-11-08 18:23:21 +0000, Josh Grams said: > Chris Hinsley wrote: <2012110814515560672-chrishinsley@gmailcom> >> On 2012-11-08 14:31:20 +0000, Chris Hinsley said: >>>> Josh Grams wrote: >>>>> >>>>> : 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 ; >>> >>> Err, I'm not sure that works! You are skipping the first node. > > Yeah, sorry; I thought that's what your code was doing; see my response > to your first reply to mine. > >>> Isn't the 2DUP also blowing up the stack with an extra copy of the >>> original LH each time ? >> >> And it's not passing the user value into the callback at all ? > > In this case, EXECUTE is ( u ln lh xt -- ln | 0 ), right? So the 2DUP > provides two of those four items, and the 2R@ provides the other two. > > : LISTHEAD-ENUMERATE-FORWARDS ( u xt lh -- ln | 0 ) > TUCK SWAP 2>R LISTHEAD-GET-HEAD > BEGIN DUP WHILE ( u ln ) ( R: lh xt ) > 2DUP LISTNODE-GET-SUCC 2SWAP > 2R@ EXECUTE > ?DUP UNTIL THEN ( u ln ln|0 ) NIP NIP 2R> 2DROP ; > > --Josh Does the inner loop there beat the inner loop here ? I like that you've got rid of the PICK. \ ( u xt lh -- r | 0 ) \ xt api is ( u ln lh -- r | 0 ) : LISTHEAD-ENUMERATE-FORWARDS SWAP OVER 2>R LISTHEAD-GET-HEAD BEGIN DUP LISTNODE-GET-SUCC DUP WHILE 2 PICK ROT 2R@ EXECUTE ?DUP UNTIL THEN 2RDROP NIP NIP ; Chris
[toc] | [prev] | [next] | [standalone]
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Date | 2012-11-08 20:17 +0000 |
| Message-ID | <2012110820173759604-chrishinsley@gmailcom> |
| In reply to | #17180 |
On 2012-11-08 20:04:06 +0000, Chris Hinsley said: > On 2012-11-08 18:23:21 +0000, Josh Grams said: > >> Chris Hinsley wrote: <2012110814515560672-chrishinsley@gmailcom> >>> On 2012-11-08 14:31:20 +0000, Chris Hinsley said: >>>>> Josh Grams wrote: >>>>>> >>>>>> : 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 ; >>>> >>>> Err, I'm not sure that works! You are skipping the first node. >> >> Yeah, sorry; I thought that's what your code was doing; see my response >> to your first reply to mine. >> >>>> Isn't the 2DUP also blowing up the stack with an extra copy of the >>>> original LH each time ? >>> >>> And it's not passing the user value into the callback at all ? >> >> In this case, EXECUTE is ( u ln lh xt -- ln | 0 ), right? So the 2DUP >> provides two of those four items, and the 2R@ provides the other two. >> >> : LISTHEAD-ENUMERATE-FORWARDS ( u xt lh -- ln | 0 ) >> TUCK SWAP 2>R LISTHEAD-GET-HEAD >> BEGIN DUP WHILE ( u ln ) ( R: lh xt ) >> 2DUP LISTNODE-GET-SUCC 2SWAP >> 2R@ EXECUTE >> ?DUP UNTIL THEN ( u ln ln|0 ) NIP NIP 2R> 2DROP ; >> >> --Josh Ah, no that crashes ! Reason is that you end up processing the end of list marker, ie the bottom two thirds of the listheader as if it was an actual node ! Nice try ! ;) Chris
[toc] | [prev] | [next] | [standalone]
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Date | 2012-11-08 20:29 +0000 |
| Message-ID | <2012110820295238952-chrishinsley@gmailcom> |
| In reply to | #17181 |
On 2012-11-08 20:17:37 +0000, Chris Hinsley said: > On 2012-11-08 20:04:06 +0000, Chris Hinsley said: > >> On 2012-11-08 18:23:21 +0000, Josh Grams said: >> >>> Chris Hinsley wrote: <2012110814515560672-chrishinsley@gmailcom> >>>> On 2012-11-08 14:31:20 +0000, Chris Hinsley said: >>>>>> Josh Grams wrote: >>>>>>> >>>>>>> : 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 ; >>>>> >>>>> Err, I'm not sure that works! You are skipping the first node. >>> >>> Yeah, sorry; I thought that's what your code was doing; see my response >>> to your first reply to mine. >>> >>>>> Isn't the 2DUP also blowing up the stack with an extra copy of the >>>>> original LH each time ? >>>> >>>> And it's not passing the user value into the callback at all ? >>> >>> In this case, EXECUTE is ( u ln lh xt -- ln | 0 ), right? So the 2DUP >>> provides two of those four items, and the 2R@ provides the other two. >>> >>> : LISTHEAD-ENUMERATE-FORWARDS ( u xt lh -- ln | 0 ) >>> TUCK SWAP 2>R LISTHEAD-GET-HEAD >>> BEGIN DUP WHILE ( u ln ) ( R: lh xt ) >>> 2DUP LISTNODE-GET-SUCC 2SWAP >>> 2R@ EXECUTE >>> ?DUP UNTIL THEN ( u ln ln|0 ) NIP NIP 2R> 2DROP ; >>> >>> --Josh > > Ah, no that crashes ! Reason is that you end up processing the end of > list marker, ie the bottom two thirds of the listheader as if it was an > actual node ! Nice try ! ;) > > Chris This however does work, but leaves me debateing that single PICK and ROT verses the 2SWAP 2DUP and the extra NIP needed at the ELSE ! \ ( u xt lh -- r | 0 ) \ xt api is ( u ln lh -- r | 0 ) : LISTHEAD-ENUMERATE-FORWARDS SWAP OVER 2>R LISTHEAD-GET-HEAD BEGIN 2DUP LISTNODE-GET-SUCC DUP WHILE 2SWAP 2R@ EXECUTE ?DUP UNTIL ELSE NIP THEN 2RDROP NIP NIP ; Chris
[toc] | [prev] | [next] | [standalone]
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Date | 2012-11-08 20:50 +0000 |
| Message-ID | <2012110820500166622-chrishinsley@gmailcom> |
| In reply to | #17182 |
On 2012-11-08 20:29:52 +0000, Chris Hinsley said: > This however does work, but leaves me debateing that single PICK and > ROT verses the 2SWAP 2DUP and the extra NIP needed at the ELSE ! > > \ ( u xt lh -- r | 0 ) > \ xt api is ( u ln lh -- r | 0 ) > : LISTHEAD-ENUMERATE-FORWARDS > SWAP OVER 2>R LISTHEAD-GET-HEAD > BEGIN > 2DUP LISTNODE-GET-SUCC DUP > WHILE > 2SWAP 2R@ EXECUTE ?DUP > UNTIL ELSE NIP THEN > 2RDROP NIP NIP > ; vs. : LISTHEAD-ENUMERATE-FORWARDS SWAP OVER 2>R LISTHEAD-GET-TAIL BEGIN DUP LISTNODE-GET-SUCC DUP WHILE 2 PICK ROT 2R@ EXECUTE ?DUP UNTIL THEN 2RDROP NIP NIP ; The extra NIP or jump on exit is negligable on any list worth a damb, so its the DUP, 2 PICK, ROT vs the 2DUP, 2SWAP ? Care to convince me to go with your 2 cell stuff :) I'm half way persuaded allready. Chris
[toc] | [prev] | [standalone]
Page 3 of 3 — ← Prev page 1 2 [3]
Back to top | Article view | comp.lang.forth
csiph-web