good chemistry is complicated,and a little bit messy -LW PerlMonks

### Re: Meditations on the Nature of Code Exams

by jeroenes (Priest)
 on Mar 21, 2001 at 18:06 UTC ( #66022=note: print w/replies, xml ) Need Help??

```Matlab:
a=data;
Perl:
\$a = supersplit_open( 'data.txt' ); #Without supersplit, it's more
+ code
```
```Matlab:
sum(a')
Perl:
\$sum = map{ my \$c = 0; map{ \$c += \$_; }@\$_; \$c; } @\$a;
```
```Matlab:
sum(a)
...
my \$last = \$#{\$a->[0]};
\$sum = [ map {0} 0..\$last ];
map{ \$sum->[\$i] += \$_->[\$i] for my \$i (0..\$last) } @\$a;
```
```large=find( a(:,1) > 1E10 );
large_ok = find( a(:,1) > 1E10 & a(:,3) > 0 );
sum( a(large,:) )
mean( a(large_ok,:) )
```
```SELECT mean(a1), mean(a2), mean(a3), mean(a4), mean(a5)
FROM a
WHERE a1 > 1.0E10 and a3 > 0;
```
```Matlab:
for i=1:length(b)
...
Perl:
my \$localsum = 0;
\$s = [ map{ \$localsum += \$_ } @\$b ];
```

Create A New User
Node Status?
node history
Node Type: note [id://66022]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-02-25 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When it is dark outside I am happiest to see ...

Results (312 votes). Check out past polls.

Notices?