Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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??

Help for this page

Select Code to Download


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://66022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2015-07-29 19:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls