Skip to content

Instantly share code, notes, and snippets.

@passindro
Last active December 21, 2018 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passindro/57f373466917eb3538a7b8c56b81bf6c to your computer and use it in GitHub Desktop.
Save passindro/57f373466917eb3538a7b8c56b81bf6c to your computer and use it in GitHub Desktop.
For Redy@thautwarm
function emmmm(expr, guard)
@match expr begin
:(function $_(a, b, $(_...), $last)
$(block...) end)
where guard(last) => (last, block)
end
end
head = x->x[1]
guard = islowercase ∘ head ∘ string
emmmm(
:(function f(a, b, c, d, e)_
print(e)
end),
guard)
# =>
# (:e, Any[:(#= REPL[17]:1 =#), :_, :(#= REPL[17]:2 =#), :(print(e))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment