Mercurial > hg > Members > toma > Jungle-haskell
changeset 23:7f471687756c
add getChildWithKey
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 26 Jan 2014 20:44:15 +0900 |
parents | 309e3474ae29 |
children | 278bd0dcec51 |
files | Jungle.hs |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Jungle.hs Fri Jan 24 10:55:47 2014 +0900 +++ b/Jungle.hs Sun Jan 26 20:44:15 2014 +0900 @@ -14,6 +14,7 @@ , deleteAttribute , getAttributes , getChildren +, getChildrenWithKey , assocs , numOfChild , currentChild @@ -192,6 +193,12 @@ target = getNode node path map = children target +getChildrenWithKey :: Node -> Path -> [(Int, Node)] +getChildrenWithKey node path = M.assocs map + where + target = getNode node path + map = children target + -- Attributeの連想リストを返す assocs :: Node -> Path -> [(String, B.ByteString)] assocs node path = M.assocs map