This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule NaivePutIn do | |
@doc """ | |
### What problem does this solve? | |
Sometimes I need a deeply nested map. Maps ALL THE WAY DOWN! | |
If I can safely assume every step is a map, I should be able to do this: | |
iex(0)> put_in(%{}, [:a, :b, :c], "V") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns random-roll) | |
; My friends: "Let's play this stupid game over zoom. Everyone needs some dice" | |
; Me 10 minutes later: | |
(defn single-roll [sides] | |
(inc (rand-int sides))) | |
(defn roll |