Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Merging arrays

by AnomalousMonk (Monsignor)
on Jun 28, 2013 at 02:19 UTC ( #1041127=note: print w/ replies, xml ) Need Help??


in reply to Re: Merging arrays
in thread Merging arrays

... elements of @array must be unique...

That strikes me as a drawback. After all, there seems to be nothing inherent in the organization of the two source arrays to suggest such a limitation. Why shouldn't one be allowed to end up with data like:

my @AoH = ( { 111 => "acct1" }, { 111 => "hoo" }, { 111 => "ha" }, { 111 => "foo" }, { ... => "..." }, { 888 => "acct8" }, );


Comment on Re^2: Merging arrays
Download Code
Re^3: Merging arrays
by LanX (Abbot) on Jun 28, 2013 at 13:50 UTC
    > Why shouldn't one be allowed to end up with data like:

    No special reason.

    Sometimes one has data structure which have to be unique, then using a hash is handy.

    Sometimes not ... I'm just listing another way to do it for one of those loosely defined PM requirements... :)

    FWIW I'll change my post to make the restriction clearer ...

    update

    The question is rather how to design functional constructs like map which can easily (idiomatically) be used/combined to create nested data-structures which solve all possible requirements (sorted, nested, unique, non-string keys, ...).

    Thats more a design than an implementation question, I rarely see people using List::MoreUtils here.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      ... loosely defined ... requirements...

      Yes, that's always the tricky bit: to divine what the OPer really wants... or, better yet, needs!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-04-21 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (490 votes), past polls