In python you can do something like
i = (0, 3, 2) x = [x+1 for x in range(0,5)] operator.itemgetter(*i)(x)
to get (1, 4, 3) . In (emacs) lisp, I wrote this function called extract, which does something like this,
(defun extract (elems seq) (mapcar (lambda (x) (nth x seq)) elems)) (extract '(0 3 2) (number-sequence 1 5))
but do I feel there must be something built in? All I know is first, last, rest, nth, car, cdr ... What should I do? ~ Thanks in advance ~
lisp elisp
hatmatrix
source share