Converting string to match specification
Vladimir Sekissov
svg@REDACTED
Thu Jul 31 22:19:07 CEST 2003
Element guard could give you mostly the same result:
(svg@REDACTED)19> test:str2ms("fun (X) when element(1, X) == event ->
{x, X}
end.").
[{'$1',[{'==',{element,1,'$1'},event}],[{{x,'$1'}}]}]
You can add size/1 bif if want to get exact result:
(svg@REDACTED)20> test:str2ms("fun (X) when element(1, X) == event,
size(X) == 3 ->
{x, X}
end.").
[{'$1',[{'==',{element,1,'$1'},event},{'==',{size,'$1'},3}],[{{x,'$1'}}]}]
Best Regards,
Vladimir Sekissov
anders_nygren2002> I was not clear in my first email, what I want is
anders_nygren2002> something similar to.
anders_nygren2002> -module(test).
anders_nygren2002> -include("..../event.hrl").
anders_nygren2002> -export([do/0]).
anders_nygren2002>
anders_nygren2002> do()->
anders_nygren2002> ets:fun2ms("fun (X) when is_record(X,event) ->
anders_nygren2002> {foo,X,bar}
anders_nygren2002> end.").
anders_nygren2002>
anders_nygren2002>
anders_nygren2002> /Anders
anders_nygren2002>
anders_nygren2002> _____________________________________________________
anders_nygren2002> Gå före i kön och få din sajt värderad på nolltid med Yahoo! Express
anders_nygren2002> Se mer på: http://se.docs.yahoo.com/info/express/help/index.html
More information about the erlang-questions
mailing list