The basic problem in Lisp-like languages is stuff gets buried inside many levels of parentheses, which screws up code-indenting. Suppose we have a function that takes 4 args, of which the last arg is often complex containing another instance of foo.
(foo bar bar bar (foo bar2 bar2 bar2 (foo bar3 bar3 bar3 (foo ... ))))
We want to transform ("lift") so that it looks like this
(lift (foo bar bar bar)
(foo bar2 bar2 bar2)
(foo bar3 bar3 bar3)
(foo ...))
This would be all well and good if it weren't for the fact that the embedding has to span multiple levels of parens:
(foo xa1 xa2 (bar ya1 (foo xb1 xb2 (bar yb1 ...))))
You begin to need templates (or code!) describing exactly how to perform the lifting you want this time.
***
The only case I really care about are :case statements in parenthesized haskell anyway, so I'll apply a one-time band-aid instead. It's all interesting in general in theory...
No comments :
Post a Comment