yolo007wizard

yolo007wizard

Kernel.apply/3 exception

Kernel.apply/3 keeps throwing this exception. I’m trying to dynamically run a module name + def from a map string field.

MathOperators.multiplier(event, inputs)

works however

Marked As Solved

JohnnyCurran

JohnnyCurran

Hi,

In Elixir, Module names are actually prefixed with “Elixir” – You can see this in IEx:

iex(18)> Atom.to_string(MyModule)
"Elixir.MyModule"

So, the error is technically correct – “MathOperators” as a module doesn’t exist, but “Elixir.MathOperators” does!

The Module concat/1 and concat/2 functions can help alleviate this problem for you:

So, instead of, String.to_atom("MathOperators"), try: Module.concat(["MathOperators"]) :slight_smile:

Last Post!

yolo007wizard

yolo007wizard

ahah that worked thank you good sir. I knew it was something easy and now I know :stuck_out_tongue:

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement