I'm new to scheme. I'm wondering how to sort strings in scheme. Now I become to think that using [string=?][string?] will help me to compare contents of the list. However, I'm still struggling with sort it out, literally. Does anyone help me to implement this?
Most Scheme implementations have a builtin sort
that can sort lists:
> (sort '("How" "to" "sort" "strings" "in" "Scheme") string<?)
'("How" "Scheme" "in" "sort" "strings" "to")
If your implementation complain that sort
is an unbound identifier, then lookup sort
in the documentation to see how to include it.
Note that the predicate string<?
is a function that compares two strings. Using <
instead you can sort lists of numbers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.