@vaporeon_ *gives you
and Vaporeon treats*
@aescling By the way, aren't you a programmer? Please review my little C program: https://glaceon.social/@vaporeon_/116618292096617956
@vaporeon_ i don’t have any experience writing quines so i don’t really have much to say besides “nice, that’s sick”
@vaporeon_ the fact that printf template strings allow quines to happen is more or less the same idea as this hack to do general recursion without explicit recursion
#include <stdio.h>
int fac(void *f, int n) {
int (*g)(void *, int) = f;
if (n == 0) {
return 1;
}
return n * g(f, n - 1);
}
int main(void) {
printf("6! == %d\n", fac(&fac, 6));
}
a technique that is generalizable, btw. (not that you would ever need to use the Y combinator in any purractical situation)
@vaporeon_ potentially fun question: why did i have to use a void pointer fur the type of the furst argument to fac?
@vaporeon_ yeah the purroblem is that the function takes an argument that is of the same type as the function itself. if it were pawsible to (safely) type it it would be a recursive type!
@aescling Are there any programming languages that are capable of such recursive types? What about Haskell?