functional programming - Inverting order of multiple values in Common Lisp -
i've been thinking following problem. suppose i'm dealing function returning multiple values, such truncate
. there clever way reverse order of values returned? i'm talking more clever e.g.
(multiple-value-bind (div rem) (truncate x y) (values rem div))
i don't know how clever is, here's want:
(reverse (multiple-value-list (the-function-that-returns-multiple-values)))
multiple-value-list being key, here.
to return these again separate values, use values-list:
(values-list (reverse (multiple-value-list (the-function-that-returns-multiple-values))))
this whole page may enlightening.
Comments
Post a Comment