aboutsummaryrefslogtreecommitdiff
path: root/perl/core.pm
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-21 21:13:04 -0500
committerJoel Martin <github@martintribe.org>2014-04-21 21:13:04 -0500
commitfd637e0385f4b39a0d9e109c8b4b8afe20874fa7 (patch)
treec5bec673165e467a827a2a69d314e5fc3a3386b7 /perl/core.pm
parent074cd7482bd5e6b0f5170f0128d417c1560ca00e (diff)
downloadmal-fd637e0385f4b39a0d9e109c8b4b8afe20874fa7.tar.gz
mal-fd637e0385f4b39a0d9e109c8b4b8afe20874fa7.zip
Perl: add step7_quote
Diffstat (limited to 'perl/core.pm')
-rw-r--r--perl/core.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/perl/core.pm b/perl/core.pm
index a529d21..a243dcb 100644
--- a/perl/core.pm
+++ b/perl/core.pm
@@ -38,6 +38,23 @@ sub slurp {
}
+# List functions
+
+sub cons {
+ my ($a, $b) = @_;
+ my @new_arr = @{[$a]};
+ push @new_arr, @$b;
+ List->new(\@new_arr);
+}
+
+sub concat {
+ my ($a, $b) = @_;
+ my @new_arr = @{$a};
+ push @new_arr, @$b;
+ List->new(\@new_arr);
+}
+
+
our $core_ns = {
'=' => sub { _equal_Q($_[0][0], $_[0][1]) ? $true : $false },
@@ -58,6 +75,9 @@ our $core_ns = {
'list' => sub { $_[0] },
'list?' => sub { _list_Q($_[0][0]) ? $true : $false },
+
+ 'cons' => sub { cons($_[0][0], $_[0][1]) },
+ 'concat' => sub { concat($_[0][0], $_[0][1]) },
'empty?' => sub { scalar(@{$_[0][0]}) == 0 ? $true : $false },
'count' => sub { Integer->new(scalar(@{$_[0][0]})) },
};