In the OP, a notation that looked like [x:y], where x or y could be blank, was given. I noted this equivalence:
| Python | Perl |
|---|---|
| [x:y] | splice ARRAY, x, y |
| [:y] | splice ARRAY, 0, y |
| [x:] | splice ARRAY, x |
| [:] | splice ARRAY, 0 |
I coded that and it passed all tests. I took all given tests, and their results, on face value. One exception is [:], which I added myself and was extrapolated from information already provided.
If the original data was wrong in some way, then I'm working from a false premise. If the tests are insufficient, further tests could show that the seen equivalence doesn't hold for other values.
I'm not trying to sell something here. I don't care what the OP uses for his "poetry" project — as already stated: "What you choose is entirely up to you.".
If you think that there's something wrong with the source, please take it up with the OP, not me.
— Ken
In reply to Re^7: Converting python list range expressions to perl
by kcott
in thread Converting python list range expressions to perl
by ibm1620
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |