Journal Entry, April 12th to April 19th 2019

April 19, 2019 · 1 min read

Elixir Koans

  1. Thu Apr 18

    • Numbers

      • 2 / 2 = 1.0? Division seems to coerce to floats
      • div() returns the divisor or 2, not 2.5. It's an integer
      • rem() returns the remainder or 1, not 0.5. The .5 is dividing the remainder by 2.
      • (2 * 2.0) = 4.0 as the types coerce the result
      • Float.round(1.2) === round(1.2) == false
      • Individual digits builds an array, not count of digits.

        • i.e. Use that fancy peek feature to determine what each method is doing before blindly answering.
      • Remaining unparsable portion counts the space.
      • Integer.parse returns the unparsable part as a string ".2"
      • Float.ciel seems to round > 0 up to the next integer, even 0.25
    • Atoms
    • Tuples

      • List.delete_at is zero-based or more importantly pretty much all these methods are zero based to match array indexes
    • Lists
    • Keyword Lists koan.

      • It's interesting that it's foo: like json but the tuple reads :foo
      • {:foo , "bar"} Needs the space after :foo