- Notifications
You must be signed in to change notification settings - Fork1
FitEx is a Macro-Module which provides a bit of sugar for function definitions.
License
timdeputter/FitEx
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
FitEx is a little Macro-Module which provides a alternative way for function definitions.If you need an anonymous functions which takes a single argument like this:
fnparam->param+1end
you can use the short version:
fit+1
I know, I know... You could use &(&1+1). That's right, but maybe the provided syntax is a little bit more readable.And anyway, I more or less created this to try out macros, inspired by the Kotlin lambda syntax:http://kotlinlang.org/docs/reference/lambdas.html
Add FitEx as a dependency in your mix.exs file:
defpdepsdo[FitEx:"~> 0.0.1"]end
and runmix deps.get
.
By using FitEx you can write one parameter functions with the f macro. The parameter is named 'it'.
defmoduleSomeModuledouseFitExdefsome_functiondo# One linerfunc=fit+1# or multi line function-bodyfunc=fdoit_plus_one=it+1it_plus_one*2endendend
CheckLICENSE file for more information.
About
FitEx is a Macro-Module which provides a bit of sugar for function definitions.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.