Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Want for a name?

by LanX (Sage)
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)

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?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2021-10-17 06:59 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (71 votes). Check out past polls.