Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: (Efficiency Golf) Triangular numbers

by blakem (Monsignor)
on May 31, 2001 at 11:28 UTC ( #84481=note: print w/replies, xml ) Need Help??

in reply to Re: (Efficiency Golf) Triangular numbers
in thread (Efficiency Golf) Triangular numbers

I'm familiar with assigning to slices of a hash, and its use in this line:

@seen {$t, $h, $r, $e} = ();

was very clever. However, why did you use slices in these lines?

@seen {$n,} = (); .... @seen {$o,} = ();
Aren't they equivalent to:
$seen{$n} = undef; $seen{$o} = undef;
Or even just:
@seen {$n} = (); # note the lack of comma after $n .... @seen {$o} = ();
I guess its that trailing comma that looks odd to me.

p.s. props on the @HIGH and @LOW generation... very sneaky!

Replies are listed 'Best First'.
Re: Re: Re: (Efficiency Golf) Triangular numbers
by Abigail (Deacon) on May 31, 2001 at 18:51 UTC
    I used @seen {$n,} = (); and not $seen {$n} = undef; because I used the slice in the other case as well. I wanted to use as much identical syntax as possible, and didn't see a reason to special case adding a single key.

    As for using a trailing comma, all I can say is that using -w is useful. If you use it, you'll see why the comma was used.

    -- Abigail

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://84481]
[Discipulus]: ;=) I will unavailable this week during eu morning time: I'm following a redhat 7 basci course, finally
[1nickt]: bravo
[jedikaiti]: wheee
[Discipulus]: bravo the $employer who pay 1.340 neuros + vat ;=)
[Discipulus]: but i'd need 2 courses o acces the first lvl examen: they didnt pay it this year
[1nickt]: damn. pricey. I would have said there's not much to learn but apt-get, and do everything else in Perl ... but maybe I am forgetting some of the learning curve ;-)
[Discipulus]: the teacher is a python programmer.. ;=) he said it was fshion when he had to choose..

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2017-12-11 17:14 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (308 votes). Check out past polls.