Re: balanced REDUCE: a challenge for the brave
- From: Jonah Thomas <jethomas5@xxxxxxxxx>
- Date: Thu, 29 May 2008 07:34:20 -0400
Gerry <gerry@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
Coos Haak <chfo...@xxxxxxxxx> wrote:
schreef Gerry:
If there was something below the 0 at the bottom of the list on the
stack, (reduce) can be simplified to:
: (reduce)
2dup * if
\ Strange, what if x is 256 on a 16 bit or 65536 on a 32 bit CPU?
Dammit, Google Groups just misfired on me. I meant to continue that
2dup m* or
should work.
\ Why not simply
dup 0= if
because it's tring to filter out ( 0 ) and ( 0 x )
OK, I didn't think of that and I had the complication of not knowing how deep the stack was, and I couldn't test the second item until the first had succeeded because there might not be a second item.
But if we just put two zeros down instead of one then it's easy.
( 0 0 x? x? x? ) OVER 0= IF
When we're down to two or three items the second item has to be a zero.
.
- Follow-Ups:
- Re: balanced REDUCE: a challenge for the brave
- From: Gerry
- Re: balanced REDUCE: a challenge for the brave
- References:
- balanced REDUCE: a challenge for the brave
- From: Anton Ertl
- Re: balanced REDUCE: a challenge for the brave
- From: John Passaniti
- Re: balanced REDUCE: a challenge for the brave
- From: Anton Ertl
- Re: balanced REDUCE: a challenge for the brave
- From: Robert Spykerman
- Re: balanced REDUCE: a challenge for the brave
- From: Gerry
- Re: balanced REDUCE: a challenge for the brave
- From: Coos Haak
- Re: balanced REDUCE: a challenge for the brave
- From: Gerry
- balanced REDUCE: a challenge for the brave
- Prev by Date: Re: balanced REDUCE: a challenge for the brave
- Next by Date: Re: balanced REDUCE: a challenge for the brave
- Previous by thread: Re: balanced REDUCE: a challenge for the brave
- Next by thread: Re: balanced REDUCE: a challenge for the brave
- Index(es):
Relevant Pages
|