Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

One reasonable metric for rating them might be: Imagine you're seeing the function name for the first time, together with a definition of its signature (parameter/return types). Would you have guessed its correct meaning? How sure would you have been?

Of course that's still subjective, so let me present my intuitive reactions so that you can compare them to your own:

Simple version of the function: Map a list to all its subsequences of 2 adjacent items

For the "pairwise" version, the function would only take a code block and a list. Given that function signature, I think the only ones for which I would have guessed the correct meaning and would have been reasonably sure about it, are:

RESULT_LIST = map_adjacent { CODE } LIST
RESULT_LIST = neighbors { CODE } LIST

A few comments on some of the others:

  • RESULT_LIST = adjoin { CODE } LIST
    Doesn't sound like it operates on adjoining items, but rather like it causes things to adjoin (in some unspecified way).
  • RESULT_LIST = overlaps { CODE } LIST
    Sounds like it does something less generic and more complicated, although I wouldn't be sure what. Maybe LIST accepts a list of ranges rather then numbers, and the function finds (and processes) overlapping ranges? Or something.
  • RESULT_LIST = mapAdj { CODE } LIST
    Map "adjacent"? Map "adjusted"? Map "adjunct"? ...
  • RESULT_LIST = between { CODE } LIST RESULT_LIST = between_pairs { CODE } LIST
    I might have guessed this one correctly, but would have felt unsure about it.
  • RESULT_LIST = pipeline { CODE } LIST
    Sounds like the return value of CODE becomes the first input parameter for the next iteration, like in List::Util's reduce. At least that would match my understanding of pipelines in computing.
  • RESULT_LIST = map_right_neighbour { CODE } LIST
    Sounds like it does one iteration strictly for each element of LIST, with $b set to the element's right neighbor, and on the last iteration, $b set to undef.

Generalized version of the function: Map a list to all its subsequences of n adjacent items

In this case, the function would likely take a code block, a number, and a list. Unfortunately, I don't think I would be very sure about any of my guesses in this scenario, for any of the suggested names. One that hasn't been suggested yet (probably because it's too long), but would be pretty self-explanatory for me, is:

RESULT_LIST = natatime_sliding { CODE } NUMBER, LIST

Those where there's at least a decent chance that I would have guessed the correct meaning, are, in descending order:

RESULT_LIST = map_adjacent { CODE } NUMBER, LIST

moving is nice because it's effectively a generalization of "moving average" to "moving <custom calculation>"...

@moving_averages = moving { sum(@_)/@_ } $n, @data

...but of course if the context in which you're using it has nothing to do with statistics, that recognition value will be lost.

between and map_right_neighbour wouldn't work at all anymore for n > 2.
adjoin, overlaps, mapAdj and pipeline would still have the same problems as above.

In reply to Re^2: Want for a name? (Final thoughts; strong feelings; votes?) by smls
in thread Want for a name? by BrowserUk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2022-05-16 08:10 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (62 votes). Check out past polls.