[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash f4ba8db 252/439: Add -snoc
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash f4ba8db 252/439: Add -snoc |
Date: |
Tue, 04 Aug 2015 20:28:41 +0000 |
branch: externals/dash
commit f4ba8db52d110d79c1debacb9cda4b0a49bb55a6
Author: Fuco1 <address@hidden>
Commit: Fuco1 <address@hidden>
Add -snoc
---
README.md | 15 +++++++++++++++
dash.el | 9 +++++++++
dev/examples.el | 5 +++++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
index 5d0357e..d22b9e1 100644
--- a/README.md
+++ b/README.md
@@ -129,6 +129,7 @@ Include this in your emacs settings to get syntax
highlighting:
* [-repeat](#-repeat-n-x) `(n x)`
* [-cons*](#-cons-rest-args) `(&rest args)`
+* [-snoc](#-snoc-list-elem-rest-elements) `(list elem &rest elements)`
* [-interpose](#-interpose-sep-list) `(sep list)`
* [-interleave](#-interleave-rest-lists) `(&rest lists)`
* [-zip-with](#-zip-with-fn-list1-list2) `(fn list1 list2)`
@@ -866,6 +867,20 @@ a dotted list.
(-cons* 1) ;; => 1
```
+#### -snoc `(list elem &rest elements)`
+
+Append `elem` to the end of the list.
+
+This is like `cons`, but operates on the end of list.
+
+If `elements` is non nil, append these to the list as well.
+
+```cl
+(-snoc '(1 2 3) 4) ;; => '(1 2 3 4)
+(-snoc '(1 2 3) 4 5 6) ;; => '(1 2 3 4 5 6)
+(-snoc '(1 2 3) '(4 5 6)) ;; => '(1 2 3 (4 5 6))
+```
+
#### -interpose `(sep list)`
Returns a new list of all elements in `list` separated by `sep`.
diff --git a/dash.el b/dash.el
index 0245bfe..5bb4323 100644
--- a/dash.el
+++ b/dash.el
@@ -275,6 +275,14 @@ a dotted list."
(setq res (cons res it)))))
res))
+(defun -snoc (list elem &rest elements)
+ "Append ELEM to the end of the list.
+
+This is like `cons', but operates on the end of list.
+
+If ELEMENTS is non nil, append these to the list as well."
+ (-concat list (list elem) elements))
+
(defmacro --first (form list)
"Anaphoric form of `-first'."
(let ((n (make-symbol "needle")))
@@ -1225,6 +1233,7 @@ structure such as plist or alist."
"-contains-p"
"-repeat"
"-cons*"
+ "-snoc"
"-sum"
"-product"
"-min"
diff --git a/dev/examples.el b/dev/examples.el
index 64b0c9a..c31f4bf 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -304,6 +304,11 @@
(-cons* 1 2 3) => '(1 2 . 3)
(-cons* 1) => 1)
+ (defexamples -snoc
+ (-snoc '(1 2 3) 4) => '(1 2 3 4)
+ (-snoc '(1 2 3) 4 5 6) => '(1 2 3 4 5 6)
+ (-snoc '(1 2 3) '(4 5 6)) => '(1 2 3 (4 5 6)))
+
(defexamples -interpose
(-interpose "-" '()) => '()
(-interpose "-" '("a")) => '("a")
- [elpa] externals/dash 8e2422a 239/439: Add Christina Whyte (@kurisuwhyte) to list of contributors, (continued)
- [elpa] externals/dash 8e2422a 239/439: Add Christina Whyte (@kurisuwhyte) to list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash b4d84de 243/439: Add debug declarations for `-when-let`s and `-if-let`s, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6d20aa0 241/439: If has an indent function 2, not 1, Phillip Lord, 2015/08/04
- [elpa] externals/dash 459322d 244/439: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9936885 245/439: Merge pull request #51 from Fuco1/debug-decl, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38307e3 223/439: Partition docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash bf99147 247/439: Fix `-tree-mapreduce-from` test & reformat the tests, Phillip Lord, 2015/08/04
- [elpa] externals/dash 75efb60 246/439: Add tree map/reduce, Phillip Lord, 2015/08/04
- [elpa] externals/dash e7bc8fe 250/439: Make dash-specific font lock optional, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2ee84cb 251/439: Release 2.3.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash f4ba8db 252/439: Add -snoc,
Phillip Lord <=
- [elpa] externals/dash 9de1435 248/439: Merge pull request #53 from Fuco1/tree-stuff, Phillip Lord, 2015/08/04
- [elpa] externals/dash 0f4cae9 249/439: Improve docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash ec9afcb 255/439: Merge pull request #54 from Fuco1/index/modify, Phillip Lord, 2015/08/04
- [elpa] externals/dash d8ccf85 254/439: Add replace/update/remove functions for index/indices, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3bbaed5 256/439: Release 2.4.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash ab727ba 257/439: Correct anchors for links starting with '!', Phillip Lord, 2015/08/04
- [elpa] externals/dash 8052eb9 253/439: Merge pull request #55 from Fuco1/snoc, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8005153 259/439: Add customize option to turn on font-lock for dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7357283 258/439: Merge pull request #57 from Silex/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash ba6e3c6 260/439: Add missing keywords, Phillip Lord, 2015/08/04