diff options
| author | Paul Buetow <paul@buetow.org> | 2013-02-03 10:44:49 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-02-03 10:44:49 +0100 |
| commit | 025e15b2ba7f54f87cf409fd7c3dd77746c72858 (patch) | |
| tree | 007c5af4f921aa85665f4db56f6f4309668a5dab /perl9.buetow.org/content/New-Features.sub/New-Contexes.xml | |
| parent | fc0acd318710aa0bb566329a36d886b1455c21ec (diff) | |
add hosts
Diffstat (limited to 'perl9.buetow.org/content/New-Features.sub/New-Contexes.xml')
| -rw-r--r-- | perl9.buetow.org/content/New-Features.sub/New-Contexes.xml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/perl9.buetow.org/content/New-Features.sub/New-Contexes.xml b/perl9.buetow.org/content/New-Features.sub/New-Contexes.xml new file mode 100644 index 0000000..8230962 --- /dev/null +++ b/perl9.buetow.org/content/New-Features.sub/New-Contexes.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> +<content> + <pagetitle>Perl 9 contians new datatypes/contexes!</pagetitle> + <text>Perl now got some new data types and contexes:</text> + <textheader>Fuzzy Context ~</textheader> + <text>Everything is not sharp but fuzzy! Fuzzy does always something like the desired value! It is never exact!</text> + <code> +my ~fuz; # Fuzzy type + + +use PHP qw(Function::echo); + +# You don't know if its assigning list or scalar context! +my ~fuzzy = qw(Hello mister Edd); +echo<-~fuzzy; // Can print 'Hello' or can print '3' + +my ~foo = 'Good morning'; +echo<-~foo; # Due a built in AI engine, this may print 'Good morning' or 'Bad afternoon' + </code> + <textheader>Matrix Context []</textheader> + <text>No more limitations to list and scalar and void contexes!</text> + <code> +my ([]matrix1,[]matrix2) = ( + ((1, 0, 0), (0, 1, 0), (0, 0, 1)), + ((0, 1, 0), (0, 0, 1), (1, 0, 0)), +); + +[]matrix1 += []matrix2; # Will add matrix2 to matrix1! + +[]matrix1.say; # Will print ((1, 1, 0), (0, 1, 1), (1, 0, 1)) + </code> + <text>If you want to do multi dimensional matrices then you can do:</text> + <code> +my [][]matrix = + (((1, 0, 0), (0, 1, 0), (0, 0, 1)), + ((0, 1, 0), (0, 0, 1), (1, 0, 0)), + ((0, 1, 0), (0, 0, 1), (1, 0, 0))); + </code> + <text>etc...</text> +</content> |
