1use warnings; 2use strict; 3 4=head1 NAME 5 6Data::SExpression::Cons -- Representation of a Lisp cons read by 7Data::SExpression. 8 9=head1 DESCRIPTION 10 11=cut 12 13package Data::SExpression::Cons; 14use base qw(Class::Accessor::Fast); 15__PACKAGE__->mk_accessors(qw(car cdr)); 16 17=head2 new CAR CDR 18 19Construct a new C<Cons> with the given C<car> and C<cdr> 20 21=cut 22 23sub new { 24 my $class = shift; 25 my ($car, $cdr) = @_; 26 27 my $self = {car => $car, cdr => $cdr}; 28 return bless($self, $class); 29} 30 31=head2 car, cdr 32 33Returns the C<car> or C<cdr> of this C<Cons>. 34 35=head2 set_car CAR, set_cdr CDR 36 37Set the C<car> or C<cdr> of this C<Cons> object. 38 39=cut 40 41sub mutator_name_for { 42 my $self = shift; 43 my $name = shift; 44 return "set_$name"; 45} 46 47=head1 SEE ALSO 48 49L<Data::Sexpression> 50 51=head1 AUTHOR 52 53Nelson Elhage <nelhage@mit.edu> 54 55=cut 56 571; 58