Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Want for a name?

by LanX (Cardinal)
on Dec 11, 2013 at 17:41 UTC ( #1066670=note: print w/replies, xml ) Need Help??


in reply to Want for a name?

friends, neighbors, (over)laps

DB<106> sub friends (&@){ my $code=shift; $last=$_; my @result; for (@_) { push @result, $code->($last,$_); $last=$_; } return @result; } DB<107> friends { $_[0]+$_[1] } 1..5 => (1, 3, 5, 7, 9)

update
maybe "friendwise" in analogy to "pairwise" since "friend" is a noun

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^2: Want for a name?
by AnomalousMonk (Bishop) on May 17, 2018 at 15:55 UTC
    maybe "friendwise" ...

    Or "contiguwise"? "adjacentwise"? "adjointwise"? "adjacently"? "adjointly"?


    Give a man a fish:  <%-{-{-{-<

Re^2: Want for a name?
by hdb (Monsignor) on Dec 11, 2013 at 20:28 UTC

    Would there be a way to use $a and $b as in reduce?

      sure, you need to localize them.

      But $a and $b always have the risk to be lexicals from the outer scope▓, I wanted to avoid discussing that problem.╣

      It's about naming after all...

      Cheers Rolf

      ( addicted to the Perl Programming Language)

      ╣) compare this error

      DB<108> my $a=3; sort {$a <=> $b} @a Can't use "my $a" in sort comparison at ...

      ▓) being bound to another package can be solved by investigating the caller, but checking for lexicals involves padwalker.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2020-11-30 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?