yogthos/Selmer

Iterating over double nested structures

Open

#121 ouverte le 19 avr. 2016

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)Clojure (86 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (670 stars)
Métriques de merge PR
 (Merge moyen 39m) (4 PRs mergées en 30 j)

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

Guide contributeur