Metaprogramming with Merl

87 views
Skip to first unread message

Humberto Rodríguez Avila

unread,
Jul 13, 2015, 4:37:50 AM7/13/15
to erlan...@googlegroups.com
Hello Guys,

 I am new programming in Erlang and I don’t have much experience working with Meta-programming. In my learning process I found Merl. I saw some presentations and read about it. I have been try to use the API for building modules (merl_build), but I could not do an example,

-module(recursive). 
-export([fac/1]).

fac(N) when is_integer(N), N == 0 -> 1; 
fac(N) when is_integer(N), N > 0 -> N*fac(N-1).

 maybe due to my reduce knowledge about Erlang :(

I was wondering if someone have some examples of the use of this API?


Best regards, 

--- Humberto

Jordan Wilberding

unread,
Jul 13, 2015, 10:40:08 AM7/13/15
to erlan...@googlegroups.com
Maybe try reading up here, as it was included with synatx_tools in Erlang 18.0: http://www.erlang.org/doc/man/merl.html

In order for people to better help you, could you show exactly what you tried to do, what you expected, and the errors you got?

Thanks!
Jordan

--
You received this message because you are subscribed to the Google Groups "erlangcamp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erlangcamp+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Humberto Rodríguez Avila

unread,
Jul 14, 2015, 8:11:25 AM7/14/15
to erlan...@googlegroups.com
Thanks Jordan! I just fixed my mistake in the creation of the clauses function and it works! :) 

However, I have been try to do the same thing using synatx_tools, but I have problems in to construct a simple import attribute. 
For example:
 -import(mymodule, [myfunction/0])

Thanks in advance!
Humberto
Reply all
Reply to author
Forward
0 new messages