"Sputnik" help  
Sputnik Help
Language Reference - Operators - Operator ->> (Variable As First Arg)

Operator ->>

Variable as first arg. e.g.

// Define a string
my $a = "Cat and Dog";
// Use the $a as the first arg of a function
my $result = $a->>substr(1);
// Print the result
say $result; // at and Dog
// Prints showing no changes happened to $a
say $a; // Cat and Dog

This can be chained for example:

// Define a string
my $a = "Cat and Dog";
// Use the $a as the first arg of a function many times
my $result = $a->>substr(1)->>substr(0, 8)->>substr(1);
// Print the result
say $result; // t and D
// Prints showing no changes happened to $a
say $a; // Cat and Dog

This is most often used for Linq functions (but can be used for any function of course) heres a little example with Linq:

Class Person
{
    my $Name;
    my $Age;
    Function __Construct($Name, $Age)
    {
        @this->$Name = $Name;
        @this->$Age = $Age;
    }
}
my $people = array(
                new Person("Tom", 23),
                new Person("James", 17),
                new Person("Charles", 19),
                new Person("Mike", 27),
                new Person("Steve", 25)
                );
foreach(my list($name, $age) in $people->>Where($p => $p->$Age > 17)->>Obtain($p => array($p->$Name, $p->$Age)))
{
    say "Name: $name, Age: $age";
}
// PRINTS
// Name: Tom, Age: 23
// Name: Charles, Age: 19
// Name: Mike, Age: 27
// Name: Steve, Age: 25

To see a list of all the operators go here.


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org