Hash-map e contexts
Posted: Thu Sep 09, 2021 3:16 pm
How to filter only the contexts that represent a hash-map?
Example:
(dolist (_el (symbols))
(if (context? (eval _el))
(println (eval _el) {} (length (eval _el)))))
; -> Class 2
; -> MAIN 0
; -> Tree 0
; -> demo 0
; -> myHash 0
(dolist (_el (symbols))
(if (and (context? (eval _el))
(not (= _el 'MAIN))
(not (= _el 'Tree))
(not (= _el 'Class)))
(println (eval _el) {} (eval-string (string "(" _el ")")))))
; -> demo ()
; -> myHash (("1" 1) ("20" 20) ("57" 57) ("59" 59) ("81" 81))
Is there a way that doesn't use "eval-string" to display / count the values of a context representing a hash-map? "
Example:
(dolist (_el (symbols))
(if (context? (eval _el))
(println (eval _el) {} (length (eval _el)))))
; -> Class 2
; -> MAIN 0
; -> Tree 0
; -> demo 0
; -> myHash 0
(dolist (_el (symbols))
(if (and (context? (eval _el))
(not (= _el 'MAIN))
(not (= _el 'Tree))
(not (= _el 'Class)))
(println (eval _el) {} (eval-string (string "(" _el ")")))))
; -> demo ()
; -> myHash (("1" 1) ("20" 20) ("57" 57) ("59" 59) ("81" 81))
Is there a way that doesn't use "eval-string" to display / count the values of a context representing a hash-map? "