top | item 8558429 Shortest way to reverse a string in programming languages 2 points| aligajani | 11 years ago | reply My vote goes to Python: [::-1]Can your's do better? Better here is "shorter" 6 comments order hn newest [+] [-] dalke|11 years ago|reply As usual, APL wins: ⌽'string' . In J that's |.'string' .See http://rosettacode.org/wiki/Reverse_a_string for plenty of other examples. [+] [-] aligajani|11 years ago|reply Interesting, how would one go about finding ⌽ on a keyboard. load replies (1) [+] [-] JCJoverTCP|11 years ago|reply if length of the string is 1, this may shorten some answers, no? [+] [-] aligajani|11 years ago|reply Well, in Python the reversing is as short as a print [+] [-] kjs3|11 years ago|reply Sure...same as if the cow is spherical.
[+] [-] dalke|11 years ago|reply As usual, APL wins: ⌽'string' . In J that's |.'string' .See http://rosettacode.org/wiki/Reverse_a_string for plenty of other examples. [+] [-] aligajani|11 years ago|reply Interesting, how would one go about finding ⌽ on a keyboard. load replies (1)
[+] [-] aligajani|11 years ago|reply Interesting, how would one go about finding ⌽ on a keyboard. load replies (1)
[+] [-] JCJoverTCP|11 years ago|reply if length of the string is 1, this may shorten some answers, no? [+] [-] aligajani|11 years ago|reply Well, in Python the reversing is as short as a print [+] [-] kjs3|11 years ago|reply Sure...same as if the cow is spherical.
[+] [-] dalke|11 years ago|reply
See http://rosettacode.org/wiki/Reverse_a_string for plenty of other examples.
[+] [-] aligajani|11 years ago|reply
[+] [-] JCJoverTCP|11 years ago|reply
[+] [-] aligajani|11 years ago|reply
[+] [-] kjs3|11 years ago|reply