From 39d791fcf4cfc2fe51eee014125a93425bd7eec6 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Fri, 2 Apr 2021 01:12:22 +0200 Subject: [PATCH] Add more functions: null, evenp and oddp --- lib/Minilisp.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Minilisp.pm b/lib/Minilisp.pm index 2e575c2..57bbe83 100644 --- a/lib/Minilisp.pm +++ b/lib/Minilisp.pm @@ -102,6 +102,9 @@ my %stdctx = ( print "$e\n"; return undef; }, + 'null' => sub { my ($a) = @_; return ! defined $a; }, + 'evenp' => sub { my ($a) = @_; return ($a % 2 == 0); }, + 'oddp' => sub { my ($a) = @_; return ($a % 2 != 0); }, 'eq' => sub { my ($a, $b) = @_; return ($a eq $b); }, 'ne' => sub { my ($a, $b) = @_; return ($a ne $b); }, '==' => sub { my ($a, $b) = @_; return ($a == $b); },