Remix.run Logo
vintagedave a day ago

    "stressed" [8..1]
    desserts
Beautiful. Far more so than Python’s "stressed"[::-1] (which I also think is very neat.)

Oddly given the comments on Pascal it reminds me most of Pascal’s range syntax. I love its ranges and sets.

Someone a day ago | parent [-]

> Beautiful. Far more so than Python’s "stressed"[::-1]"

“stressed" [8..1]” Looks better, but IMO is worse, as it requires you to know the length of the string. Change the string and forget to update the indexing expression and you’ve got a (possibly silent) bug.

Having said that, Python IMO may be too powerful here, allowing, for example

   "abcdefghijklmnopqrstuvwxyz”[-5:10:-3]

   'vspm'
Makes perfect sense (from the fifth character from the end, step back 3 characters at a time until you reach the 10th character), but may be too cryptic for some.
WillAdams a day ago | parent | next [-]

Every time I see a manipulation like that, I yearn for LISP and CAR and CDR and so forth...

guenthert a day ago | parent | prev [-]

Meh, I prefer (reverse "stressed") myself. Say what you mean!