getting a whole record in a function call when only a field is be ing matched

Bengt Kleberg bengt.kleberg@REDACTED
Mon Aug 30 17:31:17 CEST 2004


Rachwal Waldemar-AWR001 wrote:
> when compile the function as below the compiler raises 'illegal pattern'.
> 
> fun(State#state{length=unknown}) ->
>     State.
> 
> Isn't it a valid construct, or it must be formulated other way?

alternative formulation:

fun(#state{length=unknown} = State) ->
     State.



bengt



More information about the erlang-questions mailing list