RE: [ILUG] impressive...

From: Nick Hilliard (nick at domain iol.ie)
Date: Thu 28 Oct 1999 - 18:50:25 IST


> ok.. all we're missing now are the awk, forth and B implementations.
> volunteers please.

shucks, I'm such a sucker:

awk:
awk '{print factorial($0)} \
                                                \
func factorial(x){ \
        if(x==1) \
                return 1 \
        else \
                return x*factorial(x-1) \
}'

B:
main {
        extrn putchar;

        putchar(factorial(10));
        putchar('*n');
}

factorial(x) {
        if (x == 1)
                return(1);
        return x * factorial(x);
}

Unfortunately, I can't test the B version due to lack of a compiler and I
don't speak forth, so someone else can do that one.

Any sicko on for a BCPL version?

Nick



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:48 GMT