;ELC
|
;;; Compiled
|
;;; in Emacs version 26.1
|
;;; with all optimizations.
|
|
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
|
|
;;; This file does not contain utf-8 non-ASCII characters,
|
;;; and so can be loaded in Emacs versions earlier than 23.
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
(require 'map)
|
#@296 Using INNER and OUTER, traverse FORM, an arbitrary data structure.
|
INNER and OUTER are functions. Apply INNER to each element of
|
FORM, building up a data structure of the same type, then apply
|
OUTER to the result. Recognize cons, lists, alists, vectors and
|
hash tables.
|
|
(fn INNER OUTER FORM)
|
(defalias 'treepy-walk #[771 "\211<\203 \211A\203 \211A:\204 @!A!B!\207\211<\203( \300\"!\207\301!\2039 \302\303\300\"\"!\207\304!\203R \305\306\307\310\311\303 !\312\"\313\314%\"!\207!\207" [mapcar vectorp apply vector hash-table-p map-apply make-byte-code 514 "\300B!\207" vconcat [] 5 "\n\n(fn K V)"] 11 (#$ . 424)])
|
#@209 Perform a depth-first, post-order traversal of F applied to FORM.
|
Call F on each sub-form, use F's return value in place of the
|
original. Recognize cons, lists, alists, vectors and
|
hash tables.
|
|
(fn F FORM)
|
(defalias 'treepy-postwalk #[514 "\300\301\302\"#\207" [treepy-walk apply-partially treepy-postwalk] 6 (#$ . 1070)])
|
#@103 Perform a depth-first, pre-order traversal of F applied to FORM.
|
Like `treepy-postwalk'.
|
|
(fn F FORM)
|
(defalias 'treepy-prewalk #[514 "\300\301\302\"\303!#\207" [treepy-walk apply-partially treepy-prewalk identity] 7 (#$ . 1405)])
|
#@112 Demonstrate the behavior of `treepy-postwalk' for FORM.
|
Return a list of each form as it is walked.
|
|
(fn FORM)
|
(defalias 'treepy-postwalk-demo #[257 "\300C\301\302\303\304\305\306!\307\"\310\311%\"\210\312\242!\207" [nil treepy-postwalk make-byte-code 257 "\300\300\242B\240\210\207" vconcat vector [] 4 "\n\n(fn X)" reverse] 9 (#$ . 1646)])
|
#@111 Demonstrate the behavior of `treepy-prewalk' for FORM.
|
Return a list of each form as it is walked.
|
|
(fn FORM)
|
(defalias 'treepy-prewalk-demo #[257 "\300C\301\302\303\304\305\306!\307\"\310\311%\"\210\312\242!\207" [nil treepy-prewalk make-byte-code 257 "\300\300\242B\240\210\207" vconcat vector [] 4 "\n\n(fn X)" reverse] 9 (#$ . 2000)])
|
#@284 Use SMAP to transform FORM by doing replacing operations.
|
Recursively replace in FORM keys in SMAP with their values. Does
|
replacement at the leaves of the tree first. The optional TESTFN
|
parameter is the function to be used by `map-contains-key'.
|
|
(fn SMAP FORM &optional TESTFN)
|
(defalias 'treepy-postwalk-replace #[770 "\300\301\302\303\304\305\"\306\"\307\310%\"\207" [treepy-postwalk make-byte-code 257 "\302\300\301#\203 \303\300\"\207\207" vconcat vector [map-contains-key map-elt] 5 "\n\n(fn X)"] 11 (#$ . 2351)])
|
#@282 Use SMAP to transform FORM by doing replacing operations.
|
Recursively replace in FORM keys in SMAP with their values. Does
|
replacement at the root of the tree first. The optional TESTFN
|
parameter is the function to be used by `map-contains-key'.
|
|
(fn SMAP FORM &optional TESTFN)
|
(defalias 'treepy-prewalk-replace #[770 "\300\301\302\303\304\305\"\306\"\307\310%\"\207" [treepy-prewalk make-byte-code 257 "\302\300\301#\203 \303\300\"\207\207" vconcat vector [map-contains-key map-elt] 5 "\n\n(fn X)"] 11 (#$ . 2890)])
|
#@112 Return context for this LOC.
|
If KEY is given, only return this key's value in context.
|
|
(fn LOC &optional KEY)
|
(defalias 'treepy--context #[513 "@A\211\203 \203 \300\"\202 \211\207" [map-elt] 6 (#$ . 3425)])
|
#@60 Assoc in CONTEXT a key K with a value V.
|
|
(fn CONTEXT K V)
|
(defalias 'treepy--context-assoc-1 #[771 "\300\"\203 \301\302\303\304\305\306\"\307\"\310\311%\"\207BB\207" [map-contains-key mapcar make-byte-code 257 "\211@\300\232\203 \300\301B\207\207" vconcat vector [] 3 "\n\n(fn ENTRY)"] 11 (#$ . 3646)])
|
#@73 Immutable map association in CONTEXT using KVS.
|
|
(fn CONTEXT &rest KVS)
|
(defalias 'treepy--context-assoc #[385 "\300\301\302\303\"#\207" [seq-reduce #[514 "\300\301\"\300\302\"\211\303#\266\202\207" [seq--elt-safe 1 0 treepy--context-assoc-1] 10 "\n\n(fn CONTEXT KV)"] seq-partition 2] 7 (#$ . 3968)])
|
#@130 Return meta information for this LOC.
|
If KEY is given, only return this key's value in meta
|
information.
|
|
(fn LOC &optional KEY)
|
(defalias 'treepy--meta #[513 "A\203 \300\"\202 \211\207" [map-elt] 6 (#$ . 4286)])
|
#@53 Bind OBJ with some META information.
|
|
(fn OBJ META)
|
(defalias 'treepy--with-meta #[514 "B\207" [] 4 (#$ . 4511)])
|
#@164 Return a joining of LEFT-CHILDREN and RIGHT-CHILDREN.
|
Reverses LEFT-CHILDREN so that they are correctly ordered as in
|
the tree.
|
|
(fn LEFT-CHILDREN RIGHT-CHILDREN)
|
(defalias 'treepy--join-children #[514 "\300\301!\"\207" [append reverse] 5 (#$ . 4634)])
|
#@98 Create a lexical context using LOC VARS.
|
Execute BODY in this context.
|
|
(fn LOC VARS &rest BODY)
|
(defalias 'treepy--with-loc '(macro . #[642 "\300\301\302\303\304\305!\306\"\307\310%\"\311BB\207" [mapcar make-byte-code 257 "\301\302\"\203 \303\304\300DD\207\301\305\"\203 \306\307\300DD\207\211\307\300\310\311\312\313!P!DED\207" vconcat vector [memql 'node node treepy-node 'context context treepy--context quote intern ":" symbol-name] 9 "\n\n(fn V)" let*] 10 (#$ . 4895)]))
|
(byte-code "\300\301\302\303#\300\207" [function-put treepy--with-loc lisp-indent-function defun] 4)
|
#@415 Create a new zipper structure.
|
|
BRANCHP is a function that, given a node, returns t if it can
|
have children, even if it currently doesn't.
|
|
CHILDREN is a function that, given a branch node, returns a seq
|
of its children.
|
|
MAKE-NODE is a function that, given an existing node and a seq of
|
children, returns a new branch node with the supplied children.
|
|
ROOT is the root node.
|
|
(fn BRANCHP CHILDREN MAKE-NODE ROOT)
|
(defalias 'treepy-zipper #[1028 "\300\301B\302B\303B\304BE\"\207" [treepy--with-meta nil :branchp :children :make-node] 10 (#$ . 5491)])
|
#@65 Return a zipper for nested lists, given a ROOT list.
|
|
(fn ROOT)
|
(defalias 'treepy-list-zip #[257 "\300\301\302\303$\207" [#[514 "\207" [] 3 "\n\n(fn _ CHILDREN)"] treepy-zipper listp identity] 7 (#$ . 6055)])
|
#@69 Return a zipper for nested vectors, given a ROOT vector.
|
|
(fn ROOT)
|
(defalias 'treepy-vector-zip #[257 "\300\301\302\303$\207" [#[514 "\300\301\"\207" [apply vector] 5 "\n\n(fn _ CHILDREN)"] #[257 "\300\301\"\207" [seq-into list] 4 "\n\n(fn CS)"] treepy-zipper vectorp] 8 (#$ . 6272)])
|
#@35 Return the node at LOC.
|
|
(fn LOC)
|
(defalias 'treepy-node #[257 "\211@@\207" [] 2 (#$ . 6570)])
|
#@52 Return t if the node at LOC is a branch.
|
|
(fn LOC)
|
(defalias 'treepy-branch-p #[257 "\300\301\"\302!!\207" [treepy--meta :branchp treepy-node] 4 (#$ . 6671)])
|
#@78 Return a children list of the node at LOC, which must be a branch.
|
|
(fn LOC)
|
(defalias 'treepy-children #[257 "\300!\203 \301\302\"\303!!\207\304\305!\207" [treepy-branch-p treepy--meta :children treepy-node error "Called children on a leaf node"] 4 (#$ . 6838)])
|
#@175 Return a new branch node.
|
Given an existing LOC, NODE and new CHILDREN, creates a new LOC
|
with them. The LOC is only used to supply the constructor.
|
|
(fn LOC NODE CHILDREN)
|
(defalias 'treepy-make-node #[771 "\300\301\"\"\207" [treepy--meta :make-node] 6 (#$ . 7113)])
|
#@60 Return a list of nodes leading to the given LOC.
|
|
(fn LOC)
|
(defalias 'treepy-path #[257 "\300\301\302\"!\207" [reverse treepy--context :pnodes] 5 (#$ . 7391)])
|
#@59 Return a list of the left siblings of this LOC.
|
|
(fn LOC)
|
(defalias 'treepy-lefts #[257 "\300\301\302\"!\207" [reverse treepy--context :l] 5 (#$ . 7558)])
|
#@60 Return a list of the right siblings of this LOC.
|
|
(fn LOC)
|
(defalias 'treepy-rights #[257 "\300\301\"\207" [treepy--context :r] 4 (#$ . 7720)])
|
#@93 Return the loc of the leftmost child of the node at this LOC.
|
nil if no children.
|
|
(fn LOC)
|
(defalias 'treepy-down #[257 "\300!\205O \301!\302!\303!\303\304\"\305\306\"\307\310\"\211\205G \311\312C\304 \2034 \n B\2027 \nCB\313\nB\314B\257\315!\"\266\202\266\202\266\203\262\207" [treepy-branch-p treepy-children treepy-node treepy--context :pnodes seq-drop 1 seq--elt-safe 0 treepy--with-meta :l :ppath :r treepy--meta] 16 (#$ . 7871)])
|
#@84 Return the loc of the parent of the node at this LOC.
|
nil if at the top.
|
|
(fn LOC)
|
(defalias 'treepy-up #[257 "\300!\301\302\"\301\303\"\301\304\"\301\305\"\301\306\"\205K @\307\203@ \310 \311\fB\"#\205< |