Fork me on GitHub
#specter
<
2017-01-15
>
schmee01:01:13

qqq this seems to work:

(def DeepKeys
  (recursive-path [] p
    (if-path (must :children)
      [:children ALL p]
      [:node :key])))

qqq10:01:43

is it possible to go a step further and say ":children" is not empty?

qqq10:01:52

I wnat (must :children -- this part is not empty)

nathanmarz11:01:33

@qqq you can replace (must :children) with [:children FIRST]

qqq11:01:19

@nathanmarz : I found that #(not-empty (:children %)) also worked

qqq11:01:38

is the main disaadvantage t omy appraoch lack of optimizability since the funciton is 'opaque' ?

nathanmarz11:01:06

the function approach might be a little faster

nathanmarz11:01:19

you'd have to profile it

richiardiandrea18:01:04

the recursive approach is very neat