-
-
Save ology/2d4868bb10589d532a061375fb48acad to your computer and use it in GitHub Desktop.
require Some::Module in a single function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub cfsqrt { | |
my ($self, $n, $m) = @_; | |
$m ||= $n; | |
my @terms; | |
my $ok = eval { | |
require Math::NumSeq::SqrtContinued; | |
1; | |
}; | |
die 'ERROR: Math::NumSeq::SqrtContinued not installed' | |
unless $ok; | |
my $seq = Math::NumSeq::SqrtContinued->new(sqrt => $n); | |
for my $i (1 .. $m) { | |
my ($j, $value) = $seq->next; | |
push @terms, $value; | |
} | |
return \@terms; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment