[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 25c114c 330/439: Implementing a shallow copy count
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 25c114c 330/439: Implementing a shallow copy counterpart to -clone. |
Date: |
Tue, 04 Aug 2015 20:29:50 +0000 |
branch: externals/dash
commit 25c114c53ca650f978f62285aa78a3f4847a2e3c
Author: Wilfred Hughes <address@hidden>
Commit: Wilfred Hughes <address@hidden>
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 f3b0a55 321/439: Change -predicate-p examples to -predicate? to maintain consistency, (continued)
- [elpa] externals/dash f3b0a55 321/439: Change -predicate-p examples to -predicate? to maintain consistency, Phillip Lord, 2015/08/04
- [elpa] externals/dash a09a4b2 318/439: Add code markup for docstrings and fix erroneous whitespace in docstring, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7e4adb5 319/439: Add missing keywords to highlight list, Phillip Lord, 2015/08/04
- [elpa] externals/dash 174747e 323/439: Add -splice and -splice-list, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5637bd6 322/439: Add alias from -find to -first, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9ebcce6 325/439: Add some niceties to font-locking of examples, Phillip Lord, 2015/08/04
- [elpa] externals/dash f8873a0 327/439: Update readme-template with changes from last release, Phillip Lord, 2015/08/04
- [elpa] externals/dash f18a520 326/439: Release 2.7.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash f257fb9 328/439: Add -butlast, Phillip Lord, 2015/08/04
- [elpa] externals/dash d9879e9 329/439: Release 2.8.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 25c114c 330/439: Implementing a shallow copy counterpart to -clone.,
Phillip Lord <=
- [elpa] externals/dash 6fc652d 331/439: Merge pull request #95 from Wilfred/shallow-copy-function, Phillip Lord, 2015/08/04
- [elpa] externals/dash d37947a 332/439: Add -tree-seq, Phillip Lord, 2015/08/04
- [elpa] externals/dash 166bccd 333/439: Add -tree-map-nodes, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3adad97 334/439: Add -non-nil, Phillip Lord, 2015/08/04
- [elpa] externals/dash ab99be6 335/439: Add -fix, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2626840 336/439: Add -fixfn, Phillip Lord, 2015/08/04
- [elpa] externals/dash c6b92ae 324/439: Reorder the examples into more meaningful blocks, Phillip Lord, 2015/08/04
- [elpa] externals/dash b1e585d 337/439: Update copyright notice, Phillip Lord, 2015/08/04
- [elpa] externals/dash f0831d3 339/439: Add -lambda, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8f9fc41 340/439: Add support for multiple input arguments to -lambda, Phillip Lord, 2015/08/04