From 4e160e50150972fd4a8611082459c850bbf07e0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Tue, 15 Jan 2008 10:49:13 +0100 Subject: [PATCH] moved set_component() at its place --- lib/Language/Befunge/Vector.pm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/Language/Befunge/Vector.pm b/lib/Language/Befunge/Vector.pm index 6ea7482..27a2fed 100644 --- a/lib/Language/Befunge/Vector.pm +++ b/lib/Language/Befunge/Vector.pm @@ -80,6 +80,20 @@ sub get_dims { } +# - mutators + +# +# $vec->set_component($dim, $value); +# +# Set the value for dimension $dim to $value. +# +sub set_component { + my ($self, $dim, $val) = @_; + croak "No such dimension $dim!" unless $dim >= 0 && $self->get_dims > $dim; + $self->[$dim] = $val; +} + + #- math ops # @@ -173,20 +187,6 @@ sub vector_copy { # -# set_component( dimension, data ) -# -# $v->set_component(0, 1); # set X to 1 -# -# Sets the value for dimension dimension to the value data. -# -sub set_component { - my ($self, $d, $data) = @_; - croak "No such dimension $d!" unless ($d >= 0 && $self->get_dims > $d); - $self->[$d] = $data; -} - - -# # get_component( dimension ) # # my $x = $v->get_component(0); -- 2.11.4.GIT