3 ms·
Hm, this works and is about as terse as `pattern_tap`: :erlang.localtime() |> case do; {_, {h,m,_}} -> {h, m}; end |> do_something Not that I'd wa
by losvedir 5y ago
Hm, this works and is about as terse as `pattern_tap`:
:erlang.localtime()
|> case do; {_, {h,m,_}} -> {h, m}; end
|> do_something
Not that I'd want to do that in production code, but I felt a bit nerd-sniped here, to see the shortest way I could find without dependencies.
- klibertp 5y agoThat's actually what pattern_tap's tap macro expands into :) See: https://github.com/mgwidmann/elixir-pattern_tap/blob/master/lib/pattern_tap.ex#L79-L81 https://github.com/mgwidmann/elixir-pattern_tap/blob/master/...