[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy 9d44dba 13/39: Change: taxy-apply -> taxy-map
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy 9d44dba 13/39: Change: taxy-apply -> taxy-map |
Date: |
Fri, 27 Aug 2021 10:57:31 -0400 (EDT) |
branch: externals/taxy
commit 9d44dba49984928c4b049cf6f6ce2df78f228fd6
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Change: taxy-apply -> taxy-map
---
README.org | 10 +++++-----
taxy.el | 15 ++++++++-------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/README.org b/README.org
index fcef2ee..f6bbb51 100644
--- a/README.org
+++ b/README.org
@@ -158,7 +158,7 @@ The ~:then~ function determines what happens to an object
after being taken in:
After defining a taxy, call ~taxy-fill~ with it and a list of objects to fill
the taxy's hierarchy. *Note:* ~taxy-fill~ modifies the taxy given to it
(filling its ~:objects~ and those of its ~:taxys~), so when using a statically
defined taxy (e.g. one defined with ~defvar~), you should pass ~taxy-fill~ a
taxy copied with ~taxy-copy~, which recursively copies a taxy without
~:objects~.
-To return a taxy in a more human-readable format (with only relevant fields
included), use ~taxy-plain~. You may also use ~taxy-apply~ to replace objects
in a taxy with, e.g. a more useful representation.
+To return a taxy in a more human-readable format (with only relevant fields
included), use ~taxy-plain~. You may also use ~taxy-map~ to replace objects in
a taxy with, e.g. a more useful representation.
** Dynamic taxys
@@ -262,14 +262,14 @@ Since taxys are structs, they may be stored in variables
and used in other struc
Note how the taxys defined in the first three variables are used in subsequent
taxys. As well, the ~ement-roomy-opened~ taxy has an "anonymous" taxy, which
collects any rooms that aren't collected by its sibling taxy (otherwise those
objects would be collected into the parent, "Opened" taxy, which may not always
be the most useful way to present the objects).
-Using those defined taxys, we then fill the ~ement-roomy~ taxy with all of the
rooms in the user's session, and then use ~taxy-apply~ to replace the room
structs with useful representations for display:
+Using those defined taxys, we then fill the ~ement-roomy~ taxy with all of the
rooms in the user's session, and then use ~taxy-map~ to replace the room
structs with useful representations for display:
#+BEGIN_SRC elisp
(let ((ement-session (alist-get "@USER:HOST" ement-sessions nil nil
#'equal)))
(taxy-plain
- (taxy-apply (lambda (room)
- (setf room (list (ement-room--room-display-name room)
- (ement-room-id room))))
+ (taxy-map (lambda (room)
+ (list (ement-room--room-display-name room)
+ (ement-room-id room)))
(taxy-fill (ement-session-rooms ement-session)
(taxy-copy ement-roomy)))))
#+END_SRC
diff --git a/taxy.el b/taxy.el
index a7d4073..adbf69e 100644
--- a/taxy.el
+++ b/taxy.el
@@ -83,16 +83,17 @@ Clears TAXY's objects and those of its descendant taxys."
(taxy-taxys taxy) (mapcar #'taxy-copy (taxy-taxys taxy)))
taxy)
-(defun taxy-apply (fn taxy)
- "Return TAXY, having applied FN to each object in it, including descendants.
-Used to apply side effects, e.g. to transform objects into a more
-useful form after classification."
+(defun taxy-map (fn taxy)
+ "Return TAXY, having replaced each object in it with the value of FN on it.
+Replaces every object in TAXY and its descendants. Useful to
+replace objects with a more useful form after classification."
(declare (indent defun))
- ;; I can't seem to find a way to do this without consing new lists.
- ;; Even using `cl-loop' with `in-ref' didn't work.
+ ;; It might be preferable to destructively replace objects rather
+ ;; than consing new lists, but I haven't found a way that works
+ ;; (even `cl-loop' with `in-ref' hasn't worked).
(setf (taxy-objects taxy) (mapcar fn (taxy-objects taxy))
(taxy-taxys taxy) (cl-loop for taxy in (taxy-taxys taxy)
- collect (taxy-apply fn taxy)))
+ collect (taxy-map fn taxy)))
taxy)
(cl-defun taxy-take-keyed (key-fn object taxy &key (key-name-fn #'identity))
- [elpa] branch externals/taxy created (now 2c044ed), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy dbad5b9 01/39: Let there be taxonomy!, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 8797141 02/39: Dynamic, consuming, and non-consuming, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 6c5b7c7 07/39: Add: taxy-apply, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 02217c4 11/39: Docs: Add comments, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 408a32b 09/39: Docs: Tidy, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 09724dd 10/39: Add: taxy-take-keyed, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 9d44dba 13/39: Change: taxy-apply -> taxy-map,
ELPA Syncer <=
- [elpa] externals/taxy 6eff6ae 18/39: Docs: Put Contents first, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 0a57638 17/39: Docs: Mention threading macros, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 0dce844 16/39: Docs: Add example of incremental filling, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy e09dc38 32/39: Add: (taxy-mapc*) And musicy.el example, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy bd28836 24/39: Meta: Headers, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy f0b926f 34/39: Add: Diredy example, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 21e6fa6 22/39: Docs: Commentary, header, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy e56ae33 26/39: Meta: .gitignore, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 15eb9b7 31/39: Docs: Tidy, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 01e956a 04/39: Rename function, ELPA Syncer, 2021/08/27