I toyed with some simple ways of doing this, but I don't think any of them will actually work out. I think the advice you got in #clojure to use zippers is probably correct. Here's a sketch I bashed out that seems to do roughly what you want: https://gist.github.com/1807340 (I took the liberty of wrapping the whole thing in another [] under the assumption you'd want to record multiple top-level calls; if not you can just call first on the result).
On Feb 11, 8:39 pm, jweiss <[email protected]> wrote: > I've been working on a tracing library, that works much like > clojure.contrib.trace (based on it, actually). One sticky problem > I've found is, hierarchical logs are really crappy to try to stream to > a file. You can't just keep writing to the end of the file - new data > needs to be inserted before existing end-tags. So what I'm doing is > storing the data as a list, until I know the data is complete, and > then i turn it back into a tree to write the file. > > However I can't think of a simple way to do it, even though it seems > like a simple operation. > > I want to turn this list of pairs (first item is the fn call or return > value, the second is a truthy value marking whether it's a call or > return) > > '[[(+ 1 (- 5 2) nil] > [(- 5 2) nil] > [3 true] > [4 true]] > > I want to turn that into > [(+ 1 (- 5 2)) > [(- 5 2) > 3] > 4] > > Is there a simple way to do this? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
