Mercurial > op > Looping
comparison Looping.pm @ 8:30da8c1da4d4 >>178
SmalltalkやScalar版のベンチマークを追加。
author | "uncorrelated zombie" <uncorrelated@yahoo.co.jp> |
---|---|
date | Fri, 18 Feb 2011 19:58:26 +0900 |
parents | 5e09f7cf87f5 |
children |
comparison
equal
deleted
inserted
replaced
4:d788c88f41bd | 8:30da8c1da4d4 |
---|---|
1 package Looping; | |
2 | |
3 sub new { | |
4 my $class = shift; | |
5 my $self = { | |
6 n0 => 1 | |
7 }; | |
8 bless $self, $class; | |
9 } | |
10 | |
11 sub calc { | |
12 my $self = shift; | |
13 my $n = shift; | |
14 my $n1 = $self->{n0} + (1 - 2*($n%2)); | |
15 $self->{n0} = $n; | |
16 return $n1; | |
17 } | |
18 | |
19 1; |