yogthos/Selmer

Iterating over double nested structures

Open

#121 opened on Apr 19, 2016

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Clojure (670 stars) (86 forks)batch import
bughelp wanted

Description

Hi

I have the following structure, passed to Selmer as variable 'res':

[ { :a "A1"
    :b "B1"
     :c [{ :aa "AA1"
            :bb "BB1"
            :cc "CC1"}
          { :aa "AA2"
            :bb "BB2"
            :cc "CC2"}
          { :aa "AA3"
            :bb "BB3"
             :cc "CC3"}]}
    {:a "A2"
     :b "B2"
      :c [{ :aa "AA11"
             :bb "BB11"
             :cc "CC11"}
           { :aa "AA21"
             :bb "BB21"
             :cc "CC21"}
          { :aa "AA31"
            :bb "BB31"
             :cc "CC31"}]}]

I want to iterate over the items in the first vector and print them out, and when getting to the ':c' fields I want to then start an inner iteration to print out the contents.

At the moment it is possible to get to every element in the structure with dotted notation. However, when I introduce an iterator using {% for n in res %} I then can not repeat this for the inner vector. Is this a lacking feature or am I not seeing the bigger picture? Thanks

Contributor guide