diff options
Diffstat (limited to 'common.el')
-rw-r--r-- | common.el | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -450,8 +450,26 @@ current line; negative ARG means to put the line upwards." (num)))) (insert "\n" line))))) +;;; A minor helper function + +;;;###autoload +(defun durand-take (n ls) + "Return the first N items of LS. +If the length of LS is less than N, then return the whole LS." + (cond + ((< (length ls) n) ls) + ((let ((i 0) result) + (while (< i n) + (cond + (ls + (setq result (cons (car ls) result)) + (setq ls (cdr ls)) + (setq i (1+ i))) + ((setq i n)))) + (reverse result))))) + (provide 'common) -;;; common.el ends here. +;; common.el ends here. |