Skip to content

Instantly share code, notes, and snippets.

@vitalipe
Created August 17, 2020 20:48
Show Gist options
  • Select an option

  • Save vitalipe/f47eadc1d03e9b7ca9e9a2d18d53bd08 to your computer and use it in GitHub Desktop.

Select an option

Save vitalipe/f47eadc1d03e9b7ca9e9a2d18d53bd08 to your computer and use it in GitHub Desktop.
(unpack
;; data
{:parent {:nested [{:name "banana" :price 1}
{:name "banana2" :price 2}]}}
;; query:
{:all-names [:parent :nested [[:name]]]
:all-names-in-caps [:parent :nested [[:name to-upper]]]
:max-price [:parent :nested [[:price] *|> max]]
:same+1-to-price {:parent [:parent {:nested [:nested [[{:name :name
:price [:price inc]}]]]}]}})
;; result:
{:all-names ["banana" "banana2"]
:all-names-in-caps ["BANANA" "BANANA2"]
:max-price 2
:same+1-to-price {:parent
{:nested [{:name "banana" :price 2}
{:name "banana2" :price 3}]}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment