testing :D

This commit is contained in:
qorg11 2021-12-19 13:16:30 +01:00
parent 2d9125d7da
commit 541a0dac1a
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
1 changed files with 15 additions and 15 deletions

View File

@ -12,7 +12,7 @@ promises, lazy evaluation, and grammars.
Sigils in Raku make sense unlike in Perl, for example:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
# Perl:
my %hash = (key1 => "value", key2 => "value2");
$hash{key1} # value;
@ -29,7 +29,7 @@ variables you declare are of the type "Any", which means that variable
can have any time and can be converted to other type. Nevertheless you
can specify which type you want the variable to be:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
my Int $n = 3;
my Str $s = "hello world";
~~~
@ -43,7 +43,7 @@ from `Mu`. All roads lead to Rome and all types lead to `Mu`.
Raku also has a decent Object Oriented interface:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
Class Socket {
has Int $.sockfd;
@ -63,12 +63,12 @@ $sock.send("hello from raku!");
~~~
Calling C functions from Raku is stupidly easy, to do this only use
the [NativeCall](https://docs.raku.org/language/nativecall) module
the [NativeCall](https://docs.perl.org/language/nativecall) module
which is included in the standard library, consider the following:
file.c:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
#include <stdio.h>
int
@ -83,9 +83,9 @@ You have to compile it so it's a shared library:
`gcc -fpic -shared file.c -o libfile.so`
file.raku:
file.perl:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
use NativeCall;
# Libpath, raku will add the lib and the .so automatically so you don't
@ -117,7 +117,7 @@ really easily, but if you *really* want to call `fork()` you can call
Async functions in raku are something very easy. The [language
website](https://raku.org) give us this example:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
start { sleep 1.5; print "hi" }
await Supply.from-list(&lt;A B C D E F&gt;).throttle: 2, {
sleep 0.5;
@ -135,7 +135,7 @@ print the "hi" form the `start {}` block.
Raku also has promises:
~~~{.raku .numberLines}
~~~{.perl .numberLines}
sub counter(Int $n) {
for 0..$n -> $i {
@ -170,17 +170,17 @@ compiles Raku code to be run in MoarVM or, if wanted, the JVM[^2].
## Resources
The [language documentation site](https://docs.raku.org) is pretty
The [language documentation site](https://docs.perl.org) is pretty
solid for reference. But if you want to learn the language from
scratch you can use <https://raku.guide>. If you already know a
programming language you can take the tour which shows you how to do
things you already know in raku:
* [Perl to Raku](https://docs.raku.org/language/5to6-nutshell)
* [JavaScript to Raku](https://docs.raku.org/language/js-nutshell)
* [Haskell to Raku](https://docs.raku.org/language/haskell-to-p6)
* [Python to Raku](https://docs.raku.org/language/py-nutshell)
* [Ruby to Raku](https://docs.raku.org/language/rb-nutshell)
* [Perl to Raku](https://docs.perl.org/language/5to6-nutshell)
* [JavaScript to Raku](https://docs.perl.org/language/js-nutshell)
* [Haskell to Raku](https://docs.perl.org/language/haskell-to-p6)
* [Python to Raku](https://docs.perl.org/language/py-nutshell)
* [Ruby to Raku](https://docs.perl.org/language/rb-nutshell)
There are channels in libera chat to discuss raku, #raku (general talk
about the language), #raku-beginner (for beginner questions) and