Hi Alex,

> FEXPRs a not so very important. They just allow you to avoid having to
> quote everything.
> I don't understand all the fuss that is made about them. It is perhaps
> because they are more powerful than the holy macros.

If you don't have a compiler, then it doesn't matter.  However, they
make compilation impossible.

For example, you wrote a compiler from picolisp64 assembly to gas
assembly.  The compiler is a function that transforms input to output,
which are "quoted" arguments.  Now you could not do the compilation if
the values were not quoted, i.e. the compilation process would depend on
some user input at the point where he's already using the result of the
compilation.  Similar problem arises when trying to compile 'if', but in
that case, there is a finite set of choises that the compiler can list
them and delay the actual choosing one of them to run-time.

> Right. As I said above, they are mainly a cosmetic issue. But you have
> to keep in mind that in typical PicoLisp code, almost *everything* runs
> in a FEXPR. Take a simple HTML form like
> Without FEXPRS, this example would look like
>    (action
>       '(html 0 "Form" "@lib.css" NIL
>          '(<h2> NIL "Title")
>          '(<div> 'cls
>             '(form NIL
>                '(gui '(+TextField) 10 "Text")
>                '(gui '(+NumField) 10 "Number")
>                '(gui '(+Button) "Action"
>                   ''(doSomething) ) ) ) ) )

Not necessarily, you could use macros if you didn't want to write the
quotes.  An example, the following 'off' works exactly like in PicoLisp,
i.e. removes the need for quoting:

(defmacro off (&rest vars)
  `(setq ,@(loop for x in vars appending `(,x nil))))

Not everything you think is a fexpr is needs to be _fundamentally_
fexpr.  However, for some things, e.g. 'if', macros are not expressive
enough.  Because 'if' needs an input at runtime so macros themselves are
not general enough.

> Macros make only sense if you compile the code

Yes.  On the other hand, fexprs only make sense if you don't compile the


UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to