Minilisp.pm/test.pl

21 lines
272 B
Perl
Raw Normal View History

2021-04-01 22:44:06 +02:00
use lib "./lib";
use Minilisp;
use Data::Dumper;
my $term = <<EOF;
2021-04-02 01:07:23 +02:00
(progn
(defun avg-2 (a b) (/ (+ a b) 2))
(write-line (avg-2 1 19)))
2021-04-01 22:44:06 +02:00
EOF
my $parsed = Minilisp::compile($term);
my $ctx = {
'a' => "bar",
};
print "$term\n";
print ":= " . $parsed->($ctx) . "\n";