Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One test I always do is ask for an absolutely minimal language interpreter with TCO.

This is part of the code output (after several interactions of it not returning actual code):

        // Tail Call Optimization (very basic)
        if(func->type == VAL_FUNCTION){
            return apply(func, args, env); //no stack growth.
        }
        else{
            return apply(func, args, env);
        }
I'm not very impressed.

I pointed out that part of the code, and answered:

You've correctly pointed out that the TCO implementation in the provided C code snippet is essentially a no-op. The if and else blocks do the same thing: they both call apply(func, args, env). This means there's no actual tail call optimization happening; it's just a regular function call.

But then follows with even worst code. It does not even compile!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: