Mirzhan Irkegulov
Mirzhan Irkegulov

Reputation: 18055

Reverse string in Common Lisp

How can i reverse a string in Common Lisp?

I want to transform "Hello World" into "dlroW olleH". In Python it is done using extended slice: "Hello World"[::-1].

Upvotes: 4

Views: 2548

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262919

reverse can take any sequence, including strings, so you only have to write:

> (reverse "Hello World")
"dlroW olleH"

Upvotes: 8

Related Questions