News for hackers. Stuff that matters.
Re:A Grimoire of Functions by HelloNurse on Wednesday July 24, 2019 @05:12AM (#20513440)
Lisp macros are meant to rewrite S-expressions that represent source code in controlled, predictable and well-behaved ways, whereas S-expressions in Fungrim represent data and they can be transformed in generic and aggressive ways to deduce something useful.

Different purposes, with different needs and only a limited technology overlap (the theory of how to maintain program correctness through transformation is related to the theory of how to squash hidden assumptions and subtle type mismatches in algebraic formulas).

Re:A Grimoire of Functions by mruts on Wednesday July 24, 2019 @06:28AM (#20513776)
I think you misunderstand the genericicity of macros in Lisp. Macros take one or more S-exps and return and S-exp. nothing more, nothing less.

There’s no reason why macros need to generate valid code. Though in Lisp, it’s pretty easy to make any code you want valid.

Re:A Grimoire of Functions by lispm on Wednesday July 24, 2019 @05:21AM (#20513485)
> Lisp macros are meant to rewrite S-expressions that represent source code

'source code' is slightly misleading, since the s-expressions don't need to be valid source code. What's valid is only limited by what the macro wants do. If a macro accepts the s-expression form, then it is valid.

For example that means that the macro form itself does not need to be parseable to an AST by an existing language grammar. The macro itself can parse the s-expression in arbitrary ways. If data is source for the macro, then it may do something with it...