[erlang-questions] Exprecs question

Ulf Wiger <>
Fri Dec 21 19:02:25 CET 2012


For some definition of 'cleaner' and 'better', perhaps…

Given e.g.

https://github.com/esl/parse_trans/blob/master/examples/test_exprecs.erl

1> Wild = fun(Mod, R, Vars) -> Mod:'#set-'(Vars, Mod:'#set-'([{F,'_'} || F <- Mod:'#info-'(R, fields)], Mod:'#new-'(R))) end.
#Fun<erl_eval.18.82930912>

2> Wild(test_exprecs, r, [{b,foo}]).
{r,'_',foo,'_'}

BR,
Ulf W  ;-)

On 21 Dec 2012, at 18:45, Matthew Evans wrote:

> Hi,
> 
> Is there a simple way to use exprecs to create a match specification I can use in ets:match_delete/2?
> 
> I can do something like:
> 
> ets:match_delete(my_table, erlang:make_tuple(custom_record_handler:info_p2_data(size), '_', [{custom_record_handler:pos_p2_data(special_type),123}])).
> 
> I was wondering if there was a "cleaner" or better way of doing this?
> 
> Thanks
> 
> Matt
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121221/1ac674b9/attachment.html>


More information about the erlang-questions mailing list