stylewarning / quickutil

The solution to the Utility Library problem.
87 stars 8 forks source link

group-into and take #21

Closed samebchase closed 11 years ago

samebchase commented 11 years ago

Please consider these utilities that stassats wrote for inclusion. If you'd like these included, I'll make a proper pull request

(defun group-into (n list)
  (loop while list collect
        (loop repeat n while list
              collect (pop list))))

(defun take (n list)
  (loop repeat n for elt in list
        collect elt))
stylewarning commented 11 years ago

@samebchase There are more generalized versions of group-into and take that work on any kind of sequence. They're called qtl:subdivide and qtl:take respectively. See