[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy 0dce844 16/39: Docs: Add example of incremental fi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy 0dce844 16/39: Docs: Add example of incremental filling |
Date: |
Fri, 27 Aug 2021 10:57:32 -0400 (EDT) |
branch: externals/taxy
commit 0dce844733f0e615952a11564a75d2f93ecc13fc
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Docs: Add example of incremental filling
---
README.org | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 68 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index 59679a9..434e44b 100644
--- a/README.org
+++ b/README.org
@@ -15,9 +15,9 @@ Helpful features include:
+ Dynamic taxonomies :: Objects may be classified into hierarchies
automatically defined at runtime based on their attributes.
+ Reusable taxonomies :: Taxonomy definitions may be stored in variables and
reused in other taxonomies' descendant groups.
-* Example
+* Examples
-This is a silly taxonomy of numbers below 100:
+Let's make a silly taxonomy of numbers below 100:
#+BEGIN_SRC elisp
("Numbery" "A silly taxonomy of numbers."
@@ -105,6 +105,72 @@ You might think about how to produce that by writing some
imperative code, but =
The ~taxy-fill~ function applies the numbers in a "cascade" down the hierarchy
of "taxys", and the ~taxy-plain~ function returns a meaningful subset of the
taxys' slots, suitable for display.
+You can also add more objects after the hierarchy has been filled:
+
+#+BEGIN_SRC elisp
+ (defvar lettery
+ (make-taxy :name "Lettery"
+ :description "A comprehensive taxonomy of letters."
+ :taxys (list (make-taxy :name "Vowels"
+ :description "You know what those are."
+ :predicate (lambda (l)
+ (member-ignore-case l
'("a" "e" "i" "o" "u"))))
+ (make-taxy :name "Consonants"
+ :description "Well, if they aren't a
vowel..."))))
+
+ (taxy-plain
+ (taxy-fill (reverse
+ (cl-loop for l from ?a to ?n
+ collect (upcase (char-to-string l))))
+ lettery))
+#+END_SRC
+
+#+BEGIN_SRC elisp
+ ("Lettery" "A comprehensive taxonomy of letters."
+ (("Vowels" "You know what those are."
+ ("A" "E" "I"))
+ ("Consonants" "Well, if they aren't a vowel..."
+ ("B" "C" "D" "F" "G" "H" "J" "K" "L" "M" "N"))))
+#+END_SRC
+
+Oops, we forgot the letters after N! Let's add them, too:
+
+#+BEGIN_SRC elisp
+ (taxy-plain
+ (taxy-fill (reverse
+ (cl-loop for l from ?n to ?z
+ collect (upcase (char-to-string l))))
+ lettery))
+#+END_SRC
+
+#+BEGIN_SRC elisp
+ ("Lettery" "A comprehensive taxonomy of letters."
+ (("Vowels" "You know what those are."
+ ("O" "U" "A" "E" "I"))
+ ("Consonants" "Well, if they aren't a vowel..."
+ ("N" "P" "Q" "R" "S" "T" "V" "W" "X" "Y" "Z" "B" "C" "D" "F" "G" "H" "J"
"K" "L" "M" "N"))))
+#+END_SRC
+
+Oh, they're out of order, now. That won't do. Let's fix that:
+
+#+BEGIN_SRC elisp
+ (cl-loop for taxy in-ref (taxy-taxys lettery)
+ do (setf (taxy-objects taxy) (cl-sort (taxy-objects taxy) #'<
+ :key #'string-to-char)))
+
+ (taxy-plain lettery)
+#+END_SRC
+
+That's better:
+
+#+BEGIN_SRC elisp
+ ("Lettery" "A comprehensive taxonomy of letters."
+ (("Vowels" "You know what those are."
+ ("A" "E" "I" "O" "U"))
+ ("Consonants" "Well, if they aren't a vowel..."
+ ("B" "C" "D" "F" "G" "H" "J" "K" "L" "M" "N" "N" "P" "Q" "R" "S" "T" "V"
"W" "X" "Y" "Z"))))
+#+END_SRC
+
* Contents :noexport:
:PROPERTIES:
:TOC: :include siblings
- [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, 2021/08/27
- [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 <=
- [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
- [elpa] externals/taxy 657823b 03/39: Docs: Tidy example, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy f115919 06/39: Add: taxy-copy and reverse args to taxy-fill, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy a94ab1c 05/39: Tidy, ELPA Syncer, 2021/08/27