You are looking at historical revision 41884 of this page. It may differ significantly from its current revision.

fix-me-now

If you have a tree that's almost perfect, but you just need to, uh, "fix it up" a little, that's where this fix-me-now macro can be your friend.

It's a combination of strse* from the strse egg and pre-post-order-splice* from sxml-transforms.

The first argument is the tree you wanna fix, followed by zero or more match and replacement numbers (so an even number), followed by zero or one alist of tags and bindings.

The match and replacement works like strse* while the bindings use pre-post-order-splice* but has sane defaults for *default* and *text* (which you can still override).

(fix-me-now
  '(and (she buying) 1 stairway 2 heaven)
  "2 h"
  "to h"
  `((she . ,(fn (cons* x 'is y)))))

⇒ (and (she is buying) 1 stairway to heaven)

(fix-me-now '(a (b c (d e f))) "e f" "(e f)")

⇒ (a (b c (d (e f))))