mdef alternatives and similar packages
Based on the "Macros" category.
Alternatively, view mdef alternatives based on common mentions on social networks and blogs.
-
typed_struct
An Elixir library for defining structs with a type without writing boilerplate code. -
shorter_maps
Elixir ~M sigil for map shorthand. `~M{id, name} ~> %{id: id, name: name}` -
ok_jose
Pipe elixir functions that match ok/error tuples or custom patterns. -
crudry
Elixir library for DRYing CRUD in Phoenix Contexts and Absinthe Resolvers. -
pipe_to
The enhanced elixir pipe operator which can specify the target position -
pattern_tap
Macro for tapping into a pattern match while using the pipe operator -
guardsafe
Macros expanding into code that can be safely used in guard clauses. -
rulex
This tiny library (2 macros only) allows you to define very simple rule handler using Elixir pattern matching. -
apix
Simple convention and DSL for transformation of elixir functions to an API for later documentation and or validation. -
Bang
Bang simply adds dynamic bang! functions to your existing module functions with after-callback.
ONLYOFFICE Docs — document collaboration in your environment
Do you think we are missing an alternative of mdef or a related project?
Popular Comparisons
README
MultiDef—Define a function with multiple heads
Add the dependency {:multidef, "> 0.0.0"}
to mix.exs.
Use it like this:
defmodule Test do
import MultiDef
mdef fib do
0 -> 0
1 -> 1
n -> fib(n-1) + fib(n-1)
end
end
IO.puts Test.fib(20)
When clauses can be used:
defmodule Test do
import MultiDef
mdef fib do
0 -> 0
1 -> 1
n when n > 0 -> fib(n-1) + fib(n-1)
end
end
IO.puts Test.fib(20)
Does not support default arguments.
Does not enforce that all heads have the same arity (deliberately).
Copyright © 2014 Dave Thomas, The Pragmatic Programmers
@/+pragdave, [email protected]
Licensed under the same terms as Elixir
*Note that all licence references and agreements mentioned in the mdef README section above
are relevant to that project's source code only.