#elixirtil search results
TIL: In Elixir, !! converts any value to its boolean equivalent. !!nil is false, !!value is true. Simple and useful feature i did not know about for longer than i should. #MyElixirStatus #ElixirTIL
Is there was an Elixir forum topic for Elixir TIL and solutions like this? Instead of posting questions, we would post the solutions we found.
Don't know who needs to hear this, but in Elixir `[1 | 2]` is a valid data structure called "improper list". Not to be confused with `[1 | [2]]`. Another way to build one: `[1] ++ 2`. Improper lists are useful for optimizations. Details: dorgan.netlify.app/posts/2021/03/… #elixirTIL
#ElixirTIL: to delete keywords with nil values (i.e. compact) from a KeywordList or Map: my_kwlist |> Enum.reject( fn {_,v} -> is_nil(v) end) to do the same with a map: my_map |> Enum.reject( fn {_,v} -> is_nil(v) end) |> Enum.into(%{})
TIL: In Elixir, !! converts any value to its boolean equivalent. !!nil is false, !!value is true. Simple and useful feature i did not know about for longer than i should. #MyElixirStatus #ElixirTIL
Something went wrong.
Something went wrong.
United States Trends
- 1. Mateer 6,190 posts
- 2. Michigan 148K posts
- 3. Ohio State 66.9K posts
- 4. Tim Banks 1,107 posts
- 5. Oklahoma 25.1K posts
- 6. Pavia 3,279 posts
- 7. Arbuckle 1,132 posts
- 8. Hawkins 13.4K posts
- 9. Vandy 8,435 posts
- 10. Rutgers 3,144 posts
- 11. #SurvivorSeries 22.3K posts
- 12. Venezuela 488K posts
- 13. Buckeyes 21.5K posts
- 14. #Sooners 1,767 posts
- 15. Underwood 10.9K posts
- 16. Jaylen Brown 2,181 posts
- 17. Bono 8,736 posts
- 18. Ryan Day 10.5K posts
- 19. Miami 68K posts
- 20. Jim Knowles N/A