[racket] Getting a list of keys in specified order
Kieron Hardy wrote at 07/12/2012 01:38 PM:
> Thanks for the tip, Neil.
>
> Does anyone know then if I can I assume dict-keys on an alist will
> continue to return the keys in list order and even if it could/should
> be documented that way?
I'm not surprised that "dict-keys", being a generalized operation,
doesn't make guarantees for some types that it can't make for all types.
Anyway, if you're dealing only with alists, you don't need to know about
"dict-keys" (whatever that is), just like you don't need to know about
Justin Bieber (whatever that is).
#lang racket/base
(define my-alist '((a . x) (b . y) (c . z)))
(map car my-alist)
;;==> (a b c)
For dealing with alists, the first things you want to know about are:
"cons", "car", "cdr", "pair?", "assq", "assoc", "member", named-"let",
"map", "reverse", "list", recursive procedures, "quasiquote"...
Neil V.