suppose you have the following obtuse xml doc:

<a>
  <b>
    <c>
      <d>
        <e>e</e>
        <f>
          <g>
          </g>
        </f>
      </d>
      <p>p</p>
      <p>p2</p>
    </c>
  </b>
</a>


You can navigate to the first <p> tag:

> (-> ez z/down z/down z/down z/right first :tag)
:p

And remove it with z/remove. But then you end up in a strange place:

> (-> ez z/down z/down z/down z/right z/remove first :tag)
:g

Inside the <d><f><g>... part of the document! You have to go up twice to
get to the same "level" as where you started. And that information isn't
easily recoverable, AFAICT, from where you end up (since if there had been
an additional <h></h> within the <g>...</g>, it would have required going
up three times).

It seems as if it would be much simpler if the rule for removing a node
were something like "you end up one to the left of where the removed node
was, unless that node was leftmost, in which case you end up one up from
where the removed node was". You can test for leftmost-ness before
removing, and have a pretty good sense where you'll end up.  Is there
something I'm missing? The current behavior seems to toss you into
god-knows-where. Granted, I'm not sure how to implement the behavior that
seems more sensible.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to