[plt-scheme] Quicksort in Scheme
Matt Jadud writes:
> I've always wondered: why does Scheme have cons, but not snoc? A point
> of history, a point of practicality, neither, or both?
SRFI 1 has xcons:
xcons d a -> pair
(lambda (d a) (cons a d))
Of utility only as a value to be conveniently passed to
higher-order procedures.
(xcons '(b c) 'a) => (a b c)
The name stands for "eXchanged CONS."
Is that what you meant by "snoc"? Or did you mean this:
car+cdr pair -> [x y]
The fundamental pair deconstructor:
(lambda (p) (values (car p) (cdr p)))
This can, of course, be implemented more efficiently by a compiler.
--dougorleans at gmail.com