I open raku/rakudo/perl6 thus:
con@V:~/Scripts/perl6$ perl6
To exit type 'exit' or '^D'
>
Is the above environment called the "interpreter"? I have been searching forever, and I cannot find what it's called.
How can I execute a rakudo script like I would do
source('script.R')
in R, or exec(open('script.py').read())
in python3?
To clarify, I would like the functions and libraries in the script to be available in REPL, which run
doesn't seem to do.
I'm sure this exists in documentation somewhere but I can't find it :(
A Raku program consists of zero or more statements. A statement ends with a semicolon or a curly brace at the end of a line. In Raku, single line comments start with a single hash character # and extend until the end of the line. Raku also supports multi-line/embedded comments.
Depending on your needs, Raku and its compilers may or may not be ready for you. That said, version 6.c (Christmas 2015) is the first official release of Raku as a language, along with a validation suite and a compiler that passes it. Why should I learn Raku?
A statement ends with a semicolon or a curly brace at the end of a line. In Raku, single line comments start with a single hash character # and extend until the end of the line. Raku also supports multi-line/embedded comments. The compiler doesn't evaluate comments as program text and they're only intended for human readers.
Visit the site of the Raku Conference 2021 to see all the recorded talks! Hi, my name is Camelia. I'm the spokesbug for the Raku Programming Language. Raku has been developed by a team of dedicated and enthusiastic open source volunteers, and continues to be developed.
As Valle Lukas has said, there's no exact replacement. However, all usual functions are there to run external programs,
shell("raku multi-dim-hash.raku")
will run that as an external program.source
also evaluated the source. So you might want to use require
, although symbols will not be imported directly and you'll have to use indirect lookup for that.EVAL
on the loaded module, but again, variables and symbols will not be imported.It's called Read-Eval-Print Loop REPL. You can execute raku scripts direct in the shell: raku filename.raku
without REPL. To run code from REPL you can have a look at run (run <raku test.raku>
) or EVALFILE.
The rosettacode page Include a file has some information. But it looks like there is no exact replacement for your R source('script.R')
example at the moment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With