Clamps Dictionary
r-getf
Function
(r-getf list &rest props)
Recursively traverse nested list using props as idx. The values for props can be either keywords/symbols (using #'getf) or numbers (using #'elt).
Arguments
list |
a nested List to search. |
props |
one or more Keywords/Symbols, or Numbers interpreted as idx. |
Examples
(defvar *geodata* '(:Italy (:Latium (:Rome (:Inhabitants 2749031 :size 1287.36 :River "Tevere")) :Lombardy (:Milano (:Inhabitants 1349930 :size 182 :River "Naviglio Grande"))) :Kenia (:Nairobi (:Nairobi (:Inhabitants 4397073 :size 703.9 :River "Athi"))) :Germany (:Bavaria (:Munich (:Inhabitants 1510378 :size 310.7 :River "Isar")) :Berlin (:Berlin (:Inhabitants 6340918 :size 891.7 :River "Spree"))))) (r-getf *geodata* :Kenia :Nairobi :Nairobi :Inhabitants) ; => 4397073 (r-getf *geodata* :Germany) ;; => (:bavaria (:munich (:inhabitants 1510378 :size 310.7 :river "Isar")) ;; :berlin (:berlin (:inhabitants 6340918 :size 891.7 :river "Spree"))) (r-getf *geodata* :Italy 3 :Rome) ;; => (:inhabitants 2749031 :size 1287.36 :river "Tevere") (r-getf *geodata* 5 3) ;; => (:berlin (:inhabitants 6340918 :size 891.7 :river "Spree")) (r-getf *geodata* :Italy 1 1 5) ; => "Naviglio Grande"
Created: 2025-02-18 Di 12:58