Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

raku, library was not found

I was trying to execute this program in Raku but I got an error below: How should I provide raku with the perl library there; what to copy where ?

use Math::BigInt;
$i = Math::BigInt->new($string);
use Math::BigInt ':constant';
print 10**121900;

enter image description here

Could not find Math::BigInt in

EDIT

I have failed to run zef after installing it:

enter image description here

Failed to stat file: no such file or directory

EDIT

enter image description here

Failed to stat file: no such file or directory

like image 995
user2925716 Avatar asked May 29 '21 20:05

user2925716


People also ask

How to list the contents of a directory in raku?

Working with files and directories Raku can list the contents of a directory without resorting to shell commands (by using ls, for example). saydir; # List files and folders in the current directorysaydir"/Documents"; # List files and folders in the specified directory

How do I run a file in raku terminal?

Run the file by typing raku filename.rakuinto the terminal window and hitting [Enter]. Unlike the REPL, this will not automatically print the result of each line: the code must contain a statement like sayto print output. The REPL is mostly used for trying a specific piece of code, typically a single line.

What is the generator of the lazy list in raku?

The initial elements are 0 and 2 and the endpoint is 10. No generator was defined, but using the initial elements, Raku will deduce that the generator is (+2) This lazy list may return (if requested) the following elements (0, 2, 4, 6, 8, 10) Lazy list built using a defined generator my$lazylist= (0, { $_+ 3} ... 12); say$lazylist;

What editor should I use to write Raku programs?

1.5. Editors Since most of the time we will be writing and storing our Raku programs in files, we should have a decent text editor that recognizes Raku syntax. Commais the Integrated Development Environment designed specifically for Raku. The community also uses frequently the following editors:


1 Answers

Math::BigInt is a Perl module

  1. Inline::Perl needs to be installed in Raku
  2. Math::BigInt needs to be installed in Perl
  3. You need to tell Raku that it is a Perl module rather than the default of being a Raku module
use Inline::Perl5;
use Math::BigInt:from<Perl5>;

my $string = "121900";
my $i = Math::BigInt->new($string);

say 10**$i;

(Untested as I am away from my computer)

Of course that is rather pointless as Raku already supports large integers.

say 10**121900;
like image 148
Brad Gilbert Avatar answered Oct 17 '22 12:10

Brad Gilbert