Help for this page

Select Code to Download


  1. or download this
    sub intersect { 
        my ($a,$b,$c,$d) = @_; 
    ...
        ($a,$b,$c,$d) = (@n1,@n2); 
        return ($b-$c)*($b>$c)-($b-$d)*($b>$d); 
        }
    
  2. or download this
    sub intersect3 { 
        my ($a,$b,$c,$d) = map {($_->[0],$_->[1])} sort { $a->[0] <=> $b->
    +[0] } ([@_[0,1]],[@_[2,3]]); 
        return ($b-$c)*($b>$c)-($b-$d)*($b>$d); 
        }