[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 49512b9 107/426: Simplify -take and -drop with --d
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 49512b9 107/426: Simplify -take and -drop with --dotimes |
Date: |
Tue, 04 Aug 2015 19:37:01 +0000 |
branch: externals/dash
commit 49512b96f4863868381aff5005774b2d50746499
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Simplify -take and -drop with --dotimes
---
dash.el | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/dash.el b/dash.el
index 18ebb54..a3f6855 100644
--- a/dash.el
+++ b/dash.el
@@ -244,21 +244,17 @@ Alias: `-every?'"
(defalias '-none-p '-none?)
(defalias '--none-p '--none?)
-;; simplify with a --dotimes
(defun -take (n list)
"Returns a new list of the first N items in LIST, or all items if there are
fewer than N."
(let (result)
- (while (and list (> n 0))
- (!cons (car list) result)
- (!cdr list)
- (setq n (1- n)))
+ (--dotimes n (when list
+ (!cons (car list) result)
+ (!cdr list)))
(nreverse result)))
(defun -drop (n list)
"Returns the tail of LIST without the first N items."
- (while (and list (> n 0))
- (!cdr list)
- (setq n (1- n)))
+ (--dotimes n (!cdr list))
list)
(defmacro --take-while (form list)
- [elpa] externals/dash a2941cd 097/426: Typo, (continued)
- [elpa] externals/dash a2941cd 097/426: Typo, Phillip Lord, 2015/08/04
- [elpa] externals/dash b9b6330 079/426: Add !take, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6931d8a 094/426: Remove Melpa from installation while waiting for it to be included., Phillip Lord, 2015/08/04
- [elpa] externals/dash 0bd26ac 096/426: Add aliases for -p instead of ?, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38eed45 095/426: Add rainbow-dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash dc6f46c 098/426: Simplify docs-generation using dash., Phillip Lord, 2015/08/04
- [elpa] externals/dash b0da7b2 093/426: Declare macros before using them., Phillip Lord, 2015/08/04
- [elpa] externals/dash 4fedd2e 099/426: Add -partition and -partition-all, Phillip Lord, 2015/08/04
- [elpa] externals/dash 79b56cc 101/426: Use --each, !cons and !cdr to simplify implementations., Phillip Lord, 2015/08/04
- [elpa] externals/dash a08fc14 102/426: Add -each-while, Phillip Lord, 2015/08/04
- [elpa] externals/dash 49512b9 107/426: Simplify -take and -drop with --dotimes,
Phillip Lord <=
- [elpa] externals/dash ed47814 105/426: Add -dotimes, Phillip Lord, 2015/08/04
- [elpa] externals/dash eb50d17 106/426: Add Melpa back in., Phillip Lord, 2015/08/04
- [elpa] externals/dash 0e5c69b 089/426: Docs: more concise example for anaphoric functions., Phillip Lord, 2015/08/04
- [elpa] externals/dash 03370ea 108/426: Simplify examples-to-docs and examples-to-tests with dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash ba80875 109/426: Nice indentation for --each, --each-while and --dotimes, Phillip Lord, 2015/08/04
- [elpa] externals/dash f1c8453 083/426: Rename to dash., Phillip Lord, 2015/08/04
- [elpa] externals/dash 51ddc13 110/426: Nice indentation for threading macros., Phillip Lord, 2015/08/04
- [elpa] externals/dash ba60707 103/426: Use --each-while to simplify implementations., Phillip Lord, 2015/08/04
- [elpa] externals/dash c56925a 111/426: Add font-lock for new functions and the `it` token., Phillip Lord, 2015/08/04
- [elpa] externals/dash a081c72 114/426: Fix tests., Phillip Lord, 2015/08/04