Implement recursion

This commit is contained in:
madmaurice 2021-04-02 02:46:14 +02:00
parent 65f17aba82
commit 59610c58a1

View file

@ -362,7 +362,12 @@ sub macro_defun {
return sub { return sub {
my $ctx = shift; my $ctx = shift;
my $fn = $body->($ctx); my $fn;
my $self = sub {
return $fn->(@_);
};
$ctx->{$ident->{value}} = $self;
$fn = $body->($ctx);
$ctx->{$ident->{value}} = $fn; $ctx->{$ident->{value}} = $fn;
return $fn; return $fn;
} }