按照序号拆分列表

好像是没有现成的,不太了解 dash,组合行么?

可能比较渣,仅供参考:

(defun my-split (index-list alist)
  (-non-nil
   (--map (-slice alist (car it) (cadr it))
          (-partition-all-in-steps 2 1 (cons 0 (-map #'1+ (sort index-list #'<)))))))

(my-split '(2 6 9) '(a b c d e f g h i j k l m n))
;; => ((a b c) (d e f g) (h i j) (k l m n))
2 个赞