I've written a Scheme function to sort strings in ascending order. Here's my code:
(define (sort-word word)
(list->string (sort (string->list word) char<?)))
(display (sort-word "Hello"))
I expect this to sort the word "Hello" in lexicographically ascending order but it outputs "Hello". However, if I enter "cba" for my input, I get "abc as output. Where could the issue in my code be, and how can I achieve the desired behavior?
Thank you!