List->new([$a, @$b]);
}
-sub concat {
- List->new([map @$_, @_]);
-}
-
sub nth {
my ($seq,$i) = @_;
return $seq->[$i] || die "nth: index out of bounds";
return $seq->[0] || $nil;
}
-sub rest { return $_[0]->rest(); }
-
-sub count {
- return Integer->new(scalar(@{$_[0]}))
-}
-
sub apply {
my $f = shift;
my $more_args = pop;
return $new_obj;
}
-sub meta {
- return $_[0]->meta;
-}
-
# Atom functions
sub swap_BANG {
'sequential?' => sub { _sequential_Q($_[0]) ? $true : $false },
'nth' => sub { nth($_[0], ${$_[1]}) },
'first' => \&first,
- 'rest' => \&rest,
+ 'rest' => sub { $_[0]->rest() },
'cons' => \&cons,
- 'concat' => \&concat,
+ 'concat' => sub { List->new([map @$_, @_]) },
'empty?' => sub { @{$_[0]} ? $false : $true },
- 'count' => \&count,
+ 'count' => sub { Integer->new(scalar(@{$_[0]})) },
'apply' => \&apply,
'map' => \&mal_map,
'conj' => \&conj,
'seq' => \&seq,
'with-meta' => \&with_meta,
- 'meta' => \&meta,
+ 'meta' => sub { $_[0]->meta },
'atom' => sub { Atom->new($_[0]) },
'atom?' => sub { _atom_Q($_[0]) ? $true : $false },
'deref' => sub { ${$_[0]} },