File: example

package info (click to toggle)
pdl 1%3A2.4.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,140 kB
  • ctags: 3,310
  • sloc: perl: 22,273; ansic: 7,467; fortran: 6,374; sh: 214; makefile: 53
file content (44 lines) | stat: -rw-r--r-- 969 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use PDL::LiteF;
use PDL::NiceSlice;
   
$a = sequence(10);

print "\n",'source $a'.'((4)) translated -> $a((4))',"\n";
print "Result ",$a((4)),"\n\n";

print 'alternative syntax: $a->'.'((4)) translated -> $a->((4))',"\n\n";

print 'source $a'.'(1:4) .= 2; translated -> $a(1:4) .= 2;',"\n"; # this should be rewritten

($tmp = $a(1:4)) .= 2;

print "Result: $a","\n\n";

print << 'EOP';

The arglist is split at commas but commas within
matched brackets are protected. That should allow
function invocations etc within the arglist:

EOP

print '$a'.'(1:end(0,22)) -> $a(1:end(0,22))',"\n\n";

print "recursive invocation is also supported:\n";
print '$a'.'(1,$b'.'(0:22)) -> $a(1,$b(0:22))',"\n\n";

no PDL::NiceSlice;


print << 'EOP';

Now we have switched off source filtering by issuing

     no PDL::NiceSlice;

Therefore, the next slice expression should not be touched:

EOP

# this shouldn't be touched
print 'Source $a'.'(1:4) translation -> $a(1:4)',"\n\n";