20 lines
318 B
Perl
20 lines
318 B
Perl
use lib "./lib";
|
|
|
|
use Minilisp;
|
|
use Data::Dumper;
|
|
|
|
my $term = <<EOF;
|
|
(let
|
|
((avg-4 (lambda (a b c d) (/ (+ a b c d) 4))))
|
|
(write-line (avg-4 1 2 3 4))
|
|
(write-line (avg-4 2 3 4 5)))
|
|
EOF
|
|
|
|
my $parsed = Minilisp::compile($term);
|
|
|
|
my $ctx = {
|
|
'a' => "bar",
|
|
};
|
|
|
|
print "$term\n";
|
|
print ":= " . $parsed->($ctx) . "\n";
|