Spent a lot of time Googling in order to complete exercise #4. Wrapping my head around piping and enumeration. Testing helps. Short snippets in LiveBook helps. Practiced documenting.
mix newdid not create the ./config directory.elemaccesses a tuple by index.Elixir builtins
Erlang documentation Application Group sidebar.
Elixir hex
Version control the mix.lock for applications. Review when building a public library.
Mix.Config is deprecated. Use Config
The configuration sets the minimal log level compiled into the application. Code for lower-levels is not even compiled into the application. For example, setting it at
:infomeans you cannot log:debug.Set the compile-time logging in issues/config/config.exs:
config :logger, compile_time_purge_level: :infoAlready outdated, use:
config :logger, compile_time_purge_matching: [ [lower_level_than: :info] ]The string passed to the log function is always evaluated, even if it is never logged.
Use the function variant when expensive information may not be logged. For example:
Logger.debug fn -> "#{expensive(value)}"The documentation to add
ex_docandearmarkto themix.exsdevelopment-only and non-runtime flags:{:ex_doc, "~> 0.27", only: :dev, runtime: false}, {:earmark, "~> 1.14", only: :dev, runtime: false},
Exercises
OrganizingAProject-1
Copied the project as recommended.
OrganizingAProject-2
Added dependency as directed.
OrganizingAProject-3
- Sort of duplicated the code.
- In playing around with the
Poisonmodule I accidentally usedencode!instead ofparse!, which led me down a rabbit hole of learning how to debug in IEx.
OrganizingAProject-4
My Solution to formatting a table is moderately different from Dave’s. I see where I can improve efficiencies by using map/reduce and doing additional pipelining.
Most importantly, it works!
Reduce a list of maps into a map:
Enum.reduce(list_of_maps, fn x, y -> Map.merge(x, y, fn _k, v1, v2 -> v2 ++ v1 end) end)Reduce a list of tuples into a map:
Enum.into(list, %{})
OrganizingAProject-5
Worked through the logging, debugging, and documentation steps. Had made the commandline application earlier.
OrganizingAProject-6
My Solution to the NOAA airport weather lookup.
- Needed to add
:httpoisonand:elixir_xml_to_mapto applications.
All notes and comments are my own opinion. Follow me at @rgacote@genserver.social