PLT Scheme guide says that it’s implemented sort function is able to sort a list according to an extarcted value using a lambda function. link text
The guide provides an unworking code example of this-
(sort '(("aardvark") ("dingo") ("cow") ("bear"))
#:key car string<?)
Which returns an error.
How is this function is supposed to be calles so that it will actually sort a list according to values calculated by a given function?
It works for me. Which Scheme dialect are you using? And what error do you get? In my DrScheme setup, I have “Module” selected from the dropdown at the bottom left, and
run in the top window.