[erlang-questions] "-define" in lfe?

Robert Virding rvirding@REDACTED
Tue Dec 16 22:42:33 CET 2008


Hi Raoul,

As yet there are symbol macros in lfe, i.e. you cannot do the same as with
-define() and define an atom to expand into an expression as for example:

-define(foo, "foo bar").

As yet you can only define macro forms:

(defmacro foo () '"foo bar")

which you would call by (foo). Note that you can use macros anywhere, even
in patterns. If being able to define symbol macros is important for you I
will consider adding them.

There are two sets of defining macros in LFE: an older scheme inspired set
which is not supported any more and will be phased out; and a newer CL
inspired set. The CL based set does include a scheme inspired syntax-rule
macro definer, called defsyntax, as this is practical for simple expansion
macros.

The User Guide describes (briefly) the CL inspired defining macro set.

Robert

2008/12/16 Raoul Duke <raould@REDACTED>

> hi,
>
> lfe seems to be quite rich when it comes to macro forms; might anybody
> know which one should i use to duplicate erl-style "-define()"? i
> tried (define (foo1 "foo2"))  and some variations but get
> {n,lfe_lint,unknown_form}.
>
> thank you.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081216/582633fe/attachment.htm>


More information about the erlang-questions mailing list