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

Re^7: Converting python list range expressions to perl

by kcott (Archbishop)
on Dec 05, 2022 at 19:02 UTC ( [id://11148573]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Converting python list range expressions to perl
in thread Converting python list range expressions to perl

In the OP, a notation that looked like [x:y], where x or y could be blank, was given. I noted this equivalence:

PythonPerl
[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

Replies are listed 'Best First'.
Re^8: Converting python list range expressions to perl
by LanX (Saint) on Dec 05, 2022 at 20:15 UTC
    > please take it up with the OP, not me.

    I'm not "taking it up with you".

    This is a public thread, other readers may get interested to dig deeper.

    edit

    I was just writing up my findings literally "for the record", before they get lost.

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

      You've removed the leading "If you think that there's something wrong with the source, ", thereby changing the context.

      If you think that there's something wrong with what I've written, by all means take it up with me.

      If you think that there's something wrong with the source, take it up with the OP.

      — Ken

      A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-25 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found