Elixir Tips

Elixir Tips

  • In Elixir, sorting occurs between types as: number < atom < reference < function < port < pid < tuple < map < list < bitstring. So be sure that your value is not nil or any other atom.
    nil >= 3
    # => true
    
    
    # Because the following is true
    
    is_atom(nil)
    # => true 
    
    
    # Which also leads to that funny little truth:
    
    :negative_infinitiy > 42
    # => true
    
    
    # Also:
    
    Integer.parse("fortytwo") > 100
    # => true
    
    # => Integer.parse("fortytwo") results in :error
    9 upvotes