From 025e15b2ba7f54f87cf409fd7c3dd77746c72858 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 3 Feb 2013 10:44:49 +0100 Subject: add hosts --- .../content/New-Features.sub/New-Contexes.xml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 perl9.buetow.org/content/New-Features.sub/New-Contexes.xml (limited to 'perl9.buetow.org/content/New-Features.sub/New-Contexes.xml') 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 @@ + + + Perl 9 contians new datatypes/contexes! + Perl now got some new data types and contexes: + Fuzzy Context ~ + Everything is not sharp but fuzzy! Fuzzy does always something like the desired value! It is never exact! + +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' + + Matrix Context [] + No more limitations to list and scalar and void contexes! + +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)) + + If you want to do multi dimensional matrices then you can do: + +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))); + + etc... + -- cgit v1.2.3