Files
2026-10-15 19:01:09 -07:00

9 lines
284 B
Elixir

defmodule Lab4b do
for line <- String.split(File.read!("atomic-weights.txt"), "\n", trim: true) do
[_number, symbol, _name, weight] = String.split(line)
def atomic_weight(unquote(symbol)), do: unquote(String.to_float(weight))
end
def atomic_weight(_symbol), do: -1
end