Ticket #1821 (closed todo: fixed)

Opened 4 years ago

Last modified 4 years ago

pdd28 mentions String.reverse, but it's not implemented

Reported by: moritz Owned by: dukeleto
Priority: blocker Milestone:
Component: core Version: 2.8.0
Severity: medium Keywords:
Cc: Language:
Patch status: new Platform: all

Description

pdd28 says

=item reverse

Reverse a string, one grapheme at a time. {{ NOTE: Currently only works for
ASCII strings, because it reverses one C<char> at a time. }}

but neither t/pmc/string.t nor src/pmc/string.pmc mention such a method.

Having it implemented (and preferably with proper Unicode support) would help Rakudo to get a more efficient Str.flip implementation

Attachments

new_reverse.patch Download (1.8 KB) - added by dukeleto 4 years ago.
This patch is a slightly tweked revert of the removal of String.reverse, but it fails it's test

Change History

Changed 4 years ago by dukeleto

This patch is a slightly tweked revert of the removal of String.reverse, but it fails it's test

Changed 4 years ago by dukeleto

  • owner set to dukeleto

Changed 4 years ago by dukeleto

*

The test fails like this:

not ok 90 - reverse string 
# Have: parrot 
# Want: parrot

I have verified that the strings have no trailing whitespace, and even did a hexdump of the output and verified that the strings are exactly the same. Somehow string equality is still failing with is()

Changed 4 years ago by dukeleto

  • priority changed from normal to blocker
  • platform set to all
  • status changed from new to assigned
  • patch set to new

This should be fixed before the 2.9.0 release, since it breaks the deprecation policy.

Changed 4 years ago by cotto

The old interface being insane, I implemented a less surprising one (with tests) and committed it in r49540 (with a couple subsequent docs fixes). There's room for improvement, but the interface at least is usable.

Changed 4 years ago by cotto

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.