Help for this page

Select Code to Download


  1. or download this
    tie %trie, 'Tie::Trie';
    
    $trie{ fred } = 10;
    $trie{ bill } = 20;
    $trie{ total } = sum values %trie;
    
  2. or download this
    my $trie = Trie->new();
    $trie->add( 'fred', 10 );
    $trie->add( 'bill', 20 );
    my $temp = sum map{ $trie->lookup( $_ ) } 'fred', 'bill';
    $trie->add( 'total', $temp );
    
  3. or download this
    my $trie = maketree();
    extend-trie( $trie, 'fred', 10 );
    ...
    ## Does your lisp stuff define a way of iterating the keys?
    my $temp = sum lookup( $trie, 'fred' ), lookup( $trie, 'bill' ); 
    extend-trie( $trie, 'total', $temp );
    
  4. or download this
    $collection->set( 3, $collection->get( 3 ) + 1 );
    
  5. or download this
    $collection[ 3 ]++;