@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_ it enables recursion-like behavior in with just lambda abstraction and application:
# (fun f n -> if n == 0 then 1 else n * f f (n - 1))
(fun f n -> if n == 0 then 1 else n * f f (n - 1))
6;;
- : int = 720
@vaporeon_ (i say "pure lambda calculus" but i'm using if statements and purrimitive types. you COULD actually do this in Pure Lambda Calculus but it would be a bit obnoxious)