On Mon, Dec 13, 2021 at 6:27 PM Alexander Burger <a...@software-lab.de>
wrote:

>
> So I went ahead and implemented the extended 'fill' behavior.
>
>    : (fill (1 ^(+ 1 1) 3))
>    -> (1 2 3)
>
> To make it more consistent, I also changed the '~' read macro in the same
> way.
> Now this works:
>
>    : (~(- 4 3) (2 ~(+ 1 2) 4) 5)
>    -> (1 (2 3 4) 5)
>

And why not following lisp tradition and use comma character  (,) rather
than caret character (^)  for evaluating expressions?

In fact fill is more or less analogous to backquote (`) (also known as
quasiquote) in several lisps :

`(1 2 3) -> (1 2 3)
`(1 (+ 2 4) 3) -> (1 (+ 2 4)  3)
`(1 ,(+ 2 4) 3) -> (1 8 3)

'(1 ,(+ 1 2)) is short writting for (backquote (unquote (+ 1 2)))

You can also introduce ,@ to insert flat lists like in:

(let (x '(1 2)) `(1 ,x 2)) -> (1 (1 2) 2)
(let (x '(1 2)) `(1 ,@x 2)) -> (1 1 2 2)

Even if you don't want to implement quasiquote and unquote you can use
tradicional symbols in fill, that is using , rather than ^ and maybe
introducing ,@ also in fill

see https://www.gnu.org/software/emacs/manual/html_node/elisp/Backquote.html

Reply via email to