# Re: [stack] same fringe [was: tree-each (was Re: Paul Grahams Accumulator)]

## stevan apter — 2004-06-05 01:24:10

    thanks to both of you for triggering some thoughts on this problem

    (that is, the "same fringe" problem.)

    i've posted those (and some code) at

        http://www.nsl.com/papers/samefringe.htm

    to sum up my findings:

    the challenge was to implement a 'samefringe' function which (a) used

    no (or very little) additional storage over and above what is needed

    for the input trees, (b) discovered fringe-difference as early as possible,

    (c) and didn't use either coroutines or continuations.  (c) was easy,

    since my language of choice, k, doesn't have these critters.  (b) followed

    without additional work from (a), which took a bit of thinking, but my

    solution is now easily generalized to apply to structures other than

    trees, so that's pretty satisfying.

    thanks again.

     ----- Original Message -----

    From: "Slava Pestov" <slava@...>

    To: <concatenative@yahoogroups.com>

    Sent: Thursday, June 03, 2004 9:53 PM

    Subject: Re: [stack] tree-each (was Re: Paul Grahams Accumulator)

    > Hi,

    >

    > Nicely done!

    >

    > The reason it doesn't compile is because it is a higher-order word. Only

    > specific *instances* of higher order words compile. For example, the

    > following word compiles:

    >

    > : tree-each-test [ drop ] tree-each ;

    >

    > To find out why a word doesn't compile, enable verbose compilation:

    >

    > t "verbose-compile" set

    >

    > Although the error messages are quite cryptic right now.

    >

    > Do you want me to include this word in the library?

    >

    > Slava

    >

    >

    >

    >

    >

    > Yahoo! Groups Links

    >

    >

    >

    >

    >