;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\207" [require cl-lib seq] 2) #@12 (fn OBJ) (defalias 'a-associative-p #[257 "\211?\206\300!\206\211:\205\211@:\207" [hash-table-p] 3 (#$ . 151)]) (defalias 'a-associative\? 'a-associative-p) #@108 Return the value MAP mapped to KEY, NOT-FOUND or nil if key not present. (fn MAP KEY &optional NOT-FOUND) (defalias 'a-get #[770 "<\203 \300#\207\301!\203\302\"\203H\207\207\303!\203)\304#\207\305\306\"\207" [a--alist-get vectorp a-has-key\? hash-table-p gethash user-error "Not associative: %S"] 7 (#$ . 324)]) #@196 Like alist-get, but uses equal instead of eq to look up in map MAP key KEY. Returns NOT-FOUND if the key is not present, or `nil' if NOT-FOUND is not specified. (fn MAP KEY &optional NOT-FOUND) (defalias 'a--alist-get #[770 "\3002\301\302\303\"\"\210\2110\207" [--cl-block-nil-- seq-do make-closure #[257 "\211@\300\232\205\f\301\302A\"\207" [V0 throw --cl-block-nil--] 4 "\n\n(fn PAIR)"]] 7 (#$ . 664)]) #@296 Look up a value in a nested associative structure. Given a data structure M, and a sequence of keys KS, find the value found by using each key in turn to do a lookup in the next "layer". Return `nil' if the key is not present, or the NOT-FOUND value if supplied. (fn M KS &optional NOT-FOUND) (defalias 'a-get-in #[770 "C\3002\301\302\303#\"\210\211\2420\207" [--cl-block-nil-- seq-do make-closure #[257 "\302\301\242\"\203\301\303\301\242\"\240\207\304\305\300\"\207" [V0 V1 a-has-key\? a-get throw --cl-block-nil--] 5 "\n\n(fn K)"]] 9 (#$ . 1083)]) #@181 Look up a value in a nested associative structure. Like a-get-in, but takes the key sequence KEYS directly as vararg arguments, rather than as a single sequence. (fn &rest KEYS) (defalias 'a-get* '(macro . #[128 "\300C\211\301\302\"\240\210\211\242\237!\207" [nil make-closure #[257 "\301A:\203AA\203\300\242A!\202A@@E\207" [V0 a-get] 4 "\n\n(fn KEYS)"]] 6 (#$ . 1653)])) #@82 Check if the given associative collection COLL has a certain key K. (fn COLL K) (defalias 'a-has-key #[514 "<\203\300\301#\301=?\207\302!\203 \211\250\2053\303\304G#\207\305!\203/\306\301#\301=?\207\307\310\"\207" [a--alist-get :not-found vectorp < -1 hash-table-p gethash user-error "Not associative: %S"] 6 (#$ . 2046)]) (defalias 'a-has-key\? 'a-has-key) #@117 Like `a-assoc', (in COLL assoc K with V) but only takes a single k-v pair. Internal helper function. (fn COLL K V) (defalias 'a-assoc-1 #[771 "<\203\300\"\203\301\302\303#\"\207BB\207\304!\203J\250\205I\305V\205\\GW\203<\306!\211I\210\207\307\310GZ\311\"C#\207\312!\205\\\313!\314#\210\211\262\207" [a-has-key\? mapcar make-closure #[257 "\211@\300\232\203 \300\301B\207\207" [V0 V1] 3 "\n\n(fn ENTRY)"] vectorp 0 copy-sequence vconcat make-list nil hash-table-p copy-hash-table puthash] 8 (#$ . 2427)]) #@91 Return an updated collection COLL, associating values with keys KVS. (fn COLL &rest KVS) (defalias 'a-assoc #[385 "\300\301!!\204\f\302\303!\210\304\305\306\307\"#\207" [cl-evenp a-count user-error "a-assoc requires an even number of arguments!" seq-reduce #[514 "\300!\210\301\302\"\301\303\"\304#\207" [seqp seq--elt-safe 1 0 a-assoc-1] 10 "\n\n(fn COLL KV)"] seq-partition 2] 7 (#$ . 2976)]) #@52 Return the keys in the collection COLL. (fn COLL) (defalias 'a-keys #[257 "\211<\203\n\300\301\"\207\302!\205 \211\303C\304\305\306\"\"\210\211\242\237\266\202\207" [mapcar car hash-table-p nil maphash make-closure #[514 "\300\300\242B\240\207" [V0] 5 "\n\n(fn K --CL-VAR--)"]] 7 (#$ . 3391)]) #@54 Return the values in the collection COLL. (fn COLL) (defalias 'a-vals #[257 "\211<\203\n\300\301\"\207\302!\205 \211\303C\304\305\306\"\"\210\211\242\237\266\202\207" [mapcar cdr hash-table-p nil maphash make-closure #[514 "\300\300\242B\240\207" [V0] 5 "\n\n(fn --CL-VAR-- V)"]] 7 (#$ . 3699)]) #@228 Reduce with FN starting from FROM the collection COLL. Reduce an associative collection COLL, starting with an initial value of FROM. The reducing function FN receives the intermediate value, key, and value. (fn FN FROM COLL) (defalias 'a-reduce-kv #[771 "\300\301\302#\303!#\207" [seq-reduce make-closure #[514 "\300\302\301\"#\207" [V0 V1 a-get] 8 "\n\n(fn ACC KEY)"] a-keys] 8 (#$ . 4010)]) #@117 Count the number of key-value pairs in COLL. Like length, but can also return the length of hash tables. (fn COLL) (defalias 'a-count #[257 "\300!\203 \211G\207\301!\205\302!\207" [seqp hash-table-p hash-table-count] 3 (#$ . 4419)]) #@503 Compare collections A, B for value equality. Associative collections (hash tables and a-lists) are considered equal if they contain equal key-value pairs, regardless of order. Sequences (lists or vectors) are considered equal if they contain the same elements in the same order. Collection elements are compared using `a-equal'. In other words, the equality check is recursive, resulting in a "deep" equality check. Anything that isn't associative or a sequence is compared with `equal'. (fn A B) (defalias 'a-equal #[514 "\300!\203.\300!\203.\232\206g\301!\301!=\205-\3022-\303\304\305#\306!\"\210\3070\207\310!\203d\310!\203dGG=\205g\311!\203N\311!\206c\312\313\234\313\234\"\205c\312\314\315\"\314\315\"\"\207\232\207" [a-associative\? a-count --cl-block-nil-- seq-do make-closure #[257 "\302\303\300\"\303\301\"\"?\205\304\305\306\"\207" [V0 V1 a-equal a-get throw --cl-block-nil-- nil] 6 "\n\n(fn K)"] a-keys t sequencep seq-empty-p a-equal 0 seq-drop 1] 7 (#$ . 4666)]) (defalias 'a-equal\? 'a-equal) #@106 Merge multiple associative collections. Return the type of the first collection COLLS. (fn &rest COLLS) (defalias 'a-merge #[128 "\300\301A@#\207" [seq-reduce #[514 "\300\301#\207" [a-reduce-kv #[771 "\300#\207" [a-assoc] 7 "\n\n(fn COLL K V)"]] 6 "\n\n(fn THIS THAT)"]] 5 (#$ . 5721)]) #@190 Merge multiple associative collections. Return the type of the first collection COLLS. If a key exists in both, then combine the associated values by calling f on them. (fn F &rest COLLS) (defalias 'a-merge-with #[385 "\300\301\302\"A@#\207" [seq-reduce make-closure #[514 "\301\302\303\300\"#\207" [V0 a-reduce-kv make-closure #[771 "\301\302\"\203\300\303\"\"\202#\207" [V0 a-assoc a-has-key a-get] 11 "\n\n(fn COLL K V)"]] 6 "\n\n(fn THIS THAT)"]] 6 (#$ . 6023)]) #@200 Create an association list from the given keys and values KVS. Arguments are simply provided in sequence, rather than as lists or cons cells. For example: (a-alist :foo 123 :bar 456) (fn &rest KVS) (defalias 'a-alist #[128 "\300\301\302\303\"\"\207" [mapcar #[257 "\211@A@B\207" [] 3 "\n\n(fn KV)"] seq-partition 2] 6 (#$ . 6519)]) (defalias 'a-list 'a-alist) #@397 Create a hash table from the given keys and values KVS. Arguments are simply provided in sequence, rather than as lists or cons cells. As "test" for the hash table, equal is used. The hash table is created without extra storage space, so with a size equal to amount of key-value pairs, since it is assumed to be treated as immutable. For example: (a-hash-table :foo 123 :bar 456) (fn &rest KVS) (defalias 'a-hash-table #[128 "\300\301\"\302\303\304\305G$\306\307\310\"\"\210\207" [seq-partition 2 make-hash-table :test equal :size seq-do make-closure #[257 "\301@A@\300#\207" [V0 puthash] 5 "\n\n(fn PAIR)"]] 7 (#$ . 6889)]) #@303 In collection COLL, at location KEYS, associate value VALUE. Associates a value in a nested associative collection COLL, where KEYS is a sequence of keys and VALUE is the new value and returns a new nested structure. If any levels do not exist, association lists will be created. (fn COLL KEYS VALUE) (defalias 'a-assoc-in #[771 "G\211\300\267\202\207\301\302\234#\207\301\302\234\303\304\302\234\"\305\306\"##\207" [#s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (0 8 1 10)) a-assoc-1 0 a-assoc-in a-get seq-drop 1] 12 (#$ . 7528)]) #@97 Return updated LIST with KEYS removed. Internal helper. Use `a-dissoc' instead. (fn LIST KEYS) (defalias 'a-dissoc--list #[514 "\300\301\302\"\303#\207" [a-reduce-kv make-closure #[771 "\300\235\203\207BB\207" [V0] 5 "\n\n(fn RES K V)"] nil] 6 (#$ . 8124)]) #@99 Return updated TABLE with KEYS removed. Internal helper. Use `a-dissoc' instead. (fn TABLE KEYS) (defalias 'a-dissoc--hash-table #[514 "\300\301\302!\303\304!$\305\306\307\"\310!\"\311\306\312#\"\210\207" [make-hash-table :size hash-table-count :test hash-table-test seq-remove make-closure #[257 "\211\300\235\207" [V0] 3 "\n\n(fn K)"] a-keys seq-do #[257 "\302\303\300\"\301#\207" [V0 V1 puthash gethash] 6 "\n\n(fn K)"]] 9 (#$ . 8398)]) #@90 Return an updated version of collection COLL with the KEY removed. (fn COLL &rest KEYS) (defalias 'a-dissoc #[385 "<\203\n\300\"\207\301!\205\302\"\207" [a-dissoc--list hash-table-p a-dissoc--hash-table] 5 (#$ . 8857)]) #@356 In collection COLL, at location KEY, apply FN with extra args ARGS. 'Updates' a value in an associative collection COLL, where KEY is a key and FN is a function that will take the old value and any supplied args and return the new value, and returns a new structure. If the key does not exist, nil is passed as the old value. (fn COLL KEY FN &rest ARGS) (defalias 'a-update #[899 "\300\301\302\303\n\n\"$#\207" [a-assoc-1 apply funcall a-get] 13 (#$ . 9094)]) #@389 In collection COLL, at location KEYS, apply FN with extra args ARGS. 'Updates' a value in a nested associative collection COLL, where KEYS is a sequence of keys and FN is a function that will take the old value and any supplied ARGS and return the new value, and returns a new nested structure. If any levels do not exist, association lists will be created. (fn COLL KEYS FN &rest ARGS) (defalias 'a-update-in #[899 "G\211\300\267\202\207\301\302\303\234%\207\304\303\234\301\305\306\n\n\303\234\"\307\n\310\"  %#\207" [#s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (0 8 1 10)) apply a-update 0 a-assoc-1 a-update-in a-get seq-drop 1] 14 (#$ . 9570)]) (provide 'a)