I am working with refs and I need some help.
I have here 2 bank accounts with respective :operations
(ref :name "bank"
:accounts
{12345678 (ref {:name "joey"
:account-number 12345678
:operations (ref {:desc "DESC1" :amount 100 :date "2017-01-10"]})
(ref {:desc "DESC2" :amount 200 :date "2017-01-11"]})
(ref {:desc "DESC3" :amount 300 :date "2017-01-12"]})})
{87654321 (ref {:name "paul"
:account-number 12345678
:operations (ref {:desc "DESC1" :amount 50 :date "2017-01-10"]})
(ref {:desc "DESC2" :amount 10 :date "2017-01-11"]})
(ref {:desc "DESC3" :amount 30 :date "2017-01-12"]})})
})
I need get all :operations
from all accounts to build a collection like this:
[{:desc "DESC1" :amount 100 :date "2017-01-10"]}
{:desc "DESC2" :amount 200 :date "2017-01-11"]}
{:desc "DESC3" :amount 300 :date "2017-01-12"]}
{:desc "DESC1" :amount 50 :date "2017-01-10"]}
{:desc "DESC2" :amount 10 :date "2017-01-11"]}
{:desc "DESC3" :amount 30 :date "2017-01-12"]}]
Don't need be the same its just an idea, I'm trying with map
and deref
but still stuck.