Sigils in Elixir
Three sigils: ~w for word lists, ~s for quote-heavy strings, ~D for real calendar dates.
# Sigils build values from short literal forms.
tools = ~w(plane chisel spokeshave)
IO.inspect(tools, label: "~w gives a word list")
banner = ~s(say "when" and the glue-up stops)
IO.puts(banner)
# ~D is a Date literal; the calendar does real math.
milled = ~D[2026-08-02]
ready = Date.add(milled, 45)
IO.puts("stock milled #{milled}, dry enough on #{ready}")
IO.puts("days on the rack: #{Date.diff(ready, milled)}")
How it works
~w(plane chisel spokeshave)builds the word list without a quote in sight.~s(...)holds double quotes without escaping them.~D[2026-08-02]is aDate, soDate.addandDate.diffdo calendar math on it.
Keywords and builtins used here
DateIO
The run, in numbers
- Lines
- 12
- Characters to type
- 417
- Tokens
- 78
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 67 seconds.
Step 3 of 3 in Strings & sigils, step 18 of 27 in Language basics.