Hasantha Lakshan
Hasantha Lakshan

Reputation: 19

Convert Erlang code to elixir in mnesia delete function?

I need to convert this Erlang code to Elixir.

fun(OtpTemp, otp) when OtpTemp#otp.genenrated_time < time  ->  
               [OtpTemp | otp];  
             (_, otp) ->  
                IO.inspect(otp)  
           end,

Upvotes: 1

Views: 60

Answers (1)

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121010

This is not a valid code in the first place. Erlang has no clue about IO.inspect/1 and (_, otp) would raise as well.

Record might (or might not) be a map in elixir, funs are funs.

fn 
  %{generated_time: gt} = temp, otp when gt < time  -> [temp | otp]
  _, otp -> IO.inspect(otp)  
end

Upvotes: 2

Related Questions