Fork me on GitHub
#braveandtrue
<
2020-04-26
>
John MacIsaac05:04:26

I didn’t know destructuring could take this form. All the previous forms of desctructuring I’ve seen listed the collection-to-be destructured after the destructuring,

like this:     [[first second] collection] 
and not just:  [[first second]] 
I also forgot how reduce uses an accumulator: [accumulator [first second]]. So, if I understand it correctly, In the BraveAndTrue example, {} initializes the accumulator, row-map, and [:name “Edward Cullen”] is the structure-argument that gets destructured by the second pair of parameters, by [vamp-key value]:
[row-map [vamp-key value]]
    [{}      [:name "Edward Cullen"]]

John MacIsaac17:04:14

Seeing the actual arguments consumed by the sequence of function calls helps:

; (mapify ["Edward Cullen" "10"] ["Bella Swan" "0"]...)
; (map fn ["Edward Cullen" "10"] ["Bella Swan" "0"]...)
; (fn ["Edward Cullen" "10"])
; (reduce fn {} (map vector [:name :glitter-index] ["Edward Cullen" "10"]))
; (reduce fn {} [:name "Edward Cullen"] [:glitter-index "10"])
; (fn {} :name "Edward Cullen")
; (assoc {} :name "Edward Cullen")