[erlang-questions] how to create user-defined guards
mats cronqvist
masse@REDACTED
Mon Apr 27 12:11:21 CEST 2009
"Ivan Carmenates Garcia" <icarmenates@REDACTED> writes:
> Hi all,
>
> I have a problem if for example I have an mnesia cosult like this
>
> get_students()->
> F = fun()->
> mnesia:select(person_table, [{#person_table{
> id ='$1',
> name ='$2',
> group ='$3',
> type ='$4',
> id_card ='$5',
> user ='$6'},
> [{'=:=', {is_student,'$4'}, true}],
> ['$_']}])
> end,
> mnesia:transaction(F).
>
> is_student(X)->
> if X == "Estudiante"->
> true;
> true->
> false
> end.
>
i don't know anything about this, but the obvious solution would be;
{'=:=', '$4', "Estudiante"}
right? or am i missing something?
mats
More information about the erlang-questions
mailing list