I agree that what's said can cause damage. I don't want to cause harm.
In the hope it helps me cause less confusion in future discussions of P6's sort builtin, please consider putting the +* snippet and ST aside for a moment and answering the following questions. Simple yes answers would be ideal. If your answer is no, then elaboration would be helpful.
- You posted something that can be seen as a simple coding challenge. That is, a solution either does or does not get the same results as your P5 code. Did you understand enough of the P6 code I posted to conclude it might get the same results?
- Did you catch the point that a key extractor closure (eg { ~days(.day-of-week) }), if not explicitly coupled with an arbitrary comparator closure, is automatically coupled with a generated { $^a cmp $^b } comparator closure?
- Did you see how { ~days(.day-of-week) }, { ~months(.month) } directly corresponds to substr(scalar localtime($_),0,3), substr(scalar localtime($_),+5,3)?
- Did you understand how having two key extractor closures leads to an equivalent of the || construct in your P5 comparator closure?
- Did you understand that ~days(*.day-of-week) is shorthand for { ~days(.day-of-week) }?
Thank you for helping me straighten this out.
-
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 How to display code and escape characters
are good places to start.
|