[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 6fc652d 331/426: Merge pull request #95 from Wilfr
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 6fc652d 331/426: Merge pull request #95 from Wilfred/shallow-copy-function |
Date: |
Tue, 04 Aug 2015 19:38:40 +0000 |
branch: externals/dash
commit 6fc652de8c88e7bce1e2d8feeccb2ef9abfdbc68
Merge: d9879e9 25c114c
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Merge pull request #95 from Wilfred/shallow-copy-function
Implementing a shallow copy counterpart to -clone.
---
README.md | 10 ++++++++++
dash.el | 4 ++++
dev/examples.el | 8 ++++++--
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 435879e..8eb8e26 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,7 @@ new list.
* [-splice](#-splice-pred-fun-list) `(pred fun list)`
* [-splice-list](#-splice-list-pred-new-list-list) `(pred new-list list)`
* [-mapcat](#-mapcat-fn-list) `(fn list)`
+* [-copy](#-copy-list) `(list)`
### Sublist selection
@@ -369,6 +370,15 @@ Thus function `fn` should return a list.
(--mapcat (list 0 it) '(1 2 3)) ;; => '(0 1 0 2 0 3)
```
+#### -copy `(list)`
+
+Create a shallow copy of `list`.
+
+```cl
+(-copy '(1 2 3)) ;; => '(1 2 3)
+(let ((a '(1 2 3))) (eq a (-copy a))) ;; => nil
+```
+
## Sublist selection
diff --git a/dash.el b/dash.el
index c8a1253..e83324d 100644
--- a/dash.el
+++ b/dash.el
@@ -311,6 +311,9 @@ See also: `-flatten'"
Thus function FN should return a list."
(--mapcat (funcall fn it) list))
+(defalias '-copy 'copy-sequence
+ "Create a shallow copy of LIST.")
+
(defun -splice (pred fun list)
"Splice lists generated by FUN in place of elements matching PRED in LIST.
@@ -1559,6 +1562,7 @@ structure such as plist or alist."
"-concat"
"-mapcat"
"--mapcat"
+ "-copy"
"-cons*"
"-snoc"
"-first"
diff --git a/dev/examples.el b/dev/examples.el
index 26ed0e4..d42b05c 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -48,7 +48,11 @@ new list."
(defexamples -mapcat
(-mapcat 'list '(1 2 3)) => '(1 2 3)
(-mapcat (lambda (item) (list 0 item)) '(1 2 3)) => '(0 1 0 2 0 3)
- (--mapcat (list 0 it) '(1 2 3)) => '(0 1 0 2 0 3)))
+ (--mapcat (list 0 it) '(1 2 3)) => '(0 1 0 2 0 3))
+
+ (defexamples -copy
+ (-copy '(1 2 3)) => '(1 2 3)
+ (let ((a '(1 2 3))) (eq a (-copy a))) => nil))
(def-example-group "Sublist selection"
"Functions returning a sublist of the original list."
@@ -620,7 +624,7 @@ new list."
"}"
'((elips-mode (foo (bar . booze)) (baz . qux)) (c-mode (foo .
bla) (bum . bam)))))
=> "{elips-mode : {foo : {bar -> booze}, baz -> qux}, c-mode : {foo ->
bla, bum -> bam}}")
-
+
(defexamples -clone
(let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) => '(1 2 3)))
- [elpa] externals/dash 25c114c 330/426: Implementing a shallow copy counterpart to -clone., (continued)
- [elpa] externals/dash 25c114c 330/426: Implementing a shallow copy counterpart to -clone., Phillip Lord, 2015/08/04
- [elpa] externals/dash f257fb9 328/426: Add -butlast, Phillip Lord, 2015/08/04
- [elpa] externals/dash 174747e 323/426: Add -splice and -splice-list, Phillip Lord, 2015/08/04
- [elpa] externals/dash ab99be6 335/426: Add -fix, Phillip Lord, 2015/08/04
- [elpa] externals/dash b1e585d 337/426: Update copyright notice, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3adad97 334/426: Add -non-nil, Phillip Lord, 2015/08/04
- [elpa] externals/dash 166bccd 333/426: Add -tree-map-nodes, Phillip Lord, 2015/08/04
- [elpa] externals/dash 05fa92f 342/426: [-let] Transpose nreverse/flatten, Phillip Lord, 2015/08/04
- [elpa] externals/dash f0831d3 339/426: Add -lambda, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9ebcce6 325/426: Add some niceties to font-locking of examples, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6fc652d 331/426: Merge pull request #95 from Wilfred/shallow-copy-function,
Phillip Lord <=
- [elpa] externals/dash 5637bd6 322/426: Add alias from -find to -first, Phillip Lord, 2015/08/04
- [elpa] externals/dash a4be872 338/426: Add `-let` and `-let*`, Phillip Lord, 2015/08/04
- [elpa] externals/dash 947ffda 341/426: Add support for &rest match for non-list sequences (like . for improper lists), Phillip Lord, 2015/08/04
- [elpa] externals/dash 9065e1b 344/426: [-let] Final cdr shift optimization, Phillip Lord, 2015/08/04
- [elpa] externals/dash d37947a 332/426: Add -tree-seq, Phillip Lord, 2015/08/04
- [elpa] externals/dash 51a0c9f 350/426: [-let] Fix expansion of _ symbols in vector matcher, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8f9fc41 340/426: Add support for multiple input arguments to -lambda, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7f2b3c7 343/426: [-lambda] test all match-forms before converting to regular lambda, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6f81492 346/426: [-lambda] Better error-handling, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6f0bb7d 348/426: [-let] Fix dynamic scoping issue, Phillip Lord, 2015/08/04