Builds a string representation of the node list and returns it. The representation is
"gi(firstchildgi()secondchildgi(firstgrandchildgi())) secondgi()..."
This is a debugging function, in case that wasn't obvious...
(define (node-list->string nodelist)
;; Return a string representation of the node list
(let loop ((nl nodelist) (res ""))
(if (node-list-empty? nl)
res
(loop (node-list-rest nl)
(string-append res
(if (gi (node-list-first nl))
(string-append
(gi (node-list-first nl))
"("
(node-list->string
(children (node-list-first nl)))
")")
""))))))