in reply to Re^3: Syntactic sugar for tail call optimizations
in thread Syntactic sugar for tail call optimizations

Ah I see a trivial example already remotely requiring recursion

without sample data for your spontaneous example I can't test, but the following should do.

use enum qw[ CODE GRAPH START PATH SEEN ]; sub _pathsFrom { _PATHSFROM: { return $_[CODE]->( @{ $_[PATH] }, $_[START] ) unless exists $_[GRAPH]->{ $_[START] }; for ( @{ $_[GRAPH]->{ $_[START] } } ) { if ( exists $_[SEEN]->{ $_[START] . "-$_" } ) { return $_[CODE]->( @{ $_[PATH] }, $_[START] ); } else { @_=( @_[ CODE, GRAPH ], $_, [ @{ $_[PATH] }, $_[START] ], { %{ $_[SEEN] }, $_[START] . "-$_", undef } ); redo _PATHSFROM; } } } }

If not, enlighten us!

UPDATE(18:16 CEST): This thread is about implementating tail call recursions, thanks for trolling with a graph-search recursion which isn't tail code.

Cheers Rolf

Replies are listed 'Best First'.
Re^5: Syntactic sugar for tail call optimizations
by BrowserUk (Patriarch) on May 27, 2011 at 16:38 UTC
    This thread is about implementating tail call recursions, thanks for trolling with a graph-search recursion which isn't tail code.

    Oh, sorry. I thought you'd know that every recursive algorithm can be made into a tail-recursive one(*).

    So you see there is no trolling and no polemic; just an example, as you requested, that you don't know how to handle.

    And, BTW, one disproves your flimsily expounded theory.

    * All you need to do is implement the CPS transform.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I thought you'd know that every recursive algorithm can be made into a tail-recursive one

      Well - believe it or not - I knew. But your undocumented cut&paste doesn't worth it.

      This thread is about syntactic alternatives to goto &sub for implementing tail-call patterns and not about your inquisitional tactics to sabotage threads you consider heretical.

      So I better resort in not feeding the BUK!

      And now you have the last word ... :)

      Cheers Rolf

        Well - believe it or not - I knew. But your undocumented cut&paste doesn't worth it.

        Hm. I assumed you'd remember from the last time we dicussed this.

        You bottled out of supporting your own pretensions that time also.

        This thread is about implementating tail call recursions,
        This thread is about syntactic alternatives to goto &sub for implementing tail-call patterns

        Next?

        sabotage threads you consider heretical.

        I don't consider the thread OP heretical, just a bad conclusion drawn on the basis of poor examples.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.