Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
tutorial:perl_continued [2017/07/11 08:52] – removed bullet points oroehrig | tutorial:perl_continued [2017/07/11 09:04] – oroehrig | ||
---|---|---|---|
Line 5: | Line 5: | ||
The Perl programming language originally provides three different data structures, scalars($), arrays(@), and hashes(%). The user always has to specify the type of a variable using the appropriate symbol '' | The Perl programming language originally provides three different data structures, scalars($), arrays(@), and hashes(%). The user always has to specify the type of a variable using the appropriate symbol '' | ||
< | < | ||
- | polytope > i=5; | + | polytope > i=5; |
polymake: | polymake: | ||
</ | </ | ||
Line 40: | Line 40: | ||
A complete list of these so-called "small objects" | A complete list of these so-called "small objects" | ||
< | < | ||
- | > $my_var=new [SMALL_OBJECT]([INITIALIZATION]); | + | > $my_var = new [SMALL_OBJECT]([INITIALIZATION]); |
</ | </ | ||
Note that the '' | Note that the '' | ||
< | < | ||
- | > print ref($my_var); | + | > print ref($my_var); |
</ | </ | ||
Here is a selection of three different structures that facilitate everyday work with '' | Here is a selection of three different structures that facilitate everyday work with '' | ||
Line 110: | Line 110: | ||
===" | ===" | ||
+ | A big object is an instance of a data type which represents a mathematical concept with clear semantics. They may have template parameters. Big objects have properties which come with a type, which is either built-in or a small object type or a big object type, and which can be accessed using the '' | ||
< | < | ||
> $p=new Polytope< | > $p=new Polytope< | ||
> $lp=new LinearProgram< | > $lp=new LinearProgram< | ||
+ | > # access the property named '' | ||
> $p-> | > $p-> | ||
+ | > # properties can have properties themselves. | ||
> print $p-> | > print $p-> | ||
</ | </ | ||
Line 119: | Line 122: | ||
{{: | {{: | ||
< | < | ||
- | > open(INPUT, "< $HOME/ | + | open(INPUT, "< $HOME/ |
- | > $matrix=new Matrix< | + | $matrix=new Matrix< |
- | > close(INPUT); | + | close(INPUT); |
- | > print $matrix; | + | print $matrix; |
- | > | + | |
- | > $p=new Polytope< | + | $p=new Polytope< |
- | > print $p-> | + | print $p-> |
- | > print $p-> | + | print $p-> |
- | > print $p-> | + | print $p-> |
- | > ### choose " | + | ### choose " |
- | > for(my $i=0; | + | for(my $i=0; |
- | > if($p-> | + | if($p-> |
- | > print $i.": " | + | print $i.": " |
- | > } | + | } |
- | > } | + | } |
- | > $s=new Set< | + | $s=new Set< |
- | > for(my $i=0; | + | for(my $i=0; |
- | > if($p-> | + | if($p-> |
- | > $s+=$i; | + | $s+=$i; |
- | > } | + | } |
- | > } | + | } |
- | > $special_points=$p-> | + | $special_points=$p-> |
- | > | + | |
- | > foreach(@{$s}){ | + | foreach(@{$s}){ |
- | > print $p-> | + | print $p-> |
- | > } | + | } |
- | > foreach my $index(@{$s}){ | + | foreach my $index(@{$s}){ |
- | > print $p-> | + | print $p-> |
- | > } | + | } |
</ | </ | ||
- | ===Scripts=== | + | ===Scripts=== |
[[scripting: | [[scripting: |