Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

FitEx is a Macro-Module which provides a bit of sugar for function definitions.

License

NotificationsYou must be signed in to change notification settings

timdeputter/FitEx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Installation

Add FitEx as a dependency in your mix.exs file:

defpdepsdo[FitEx:"~> 0.0.1"]end

and runmix deps.get.

Usage

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

License

CheckLICENSE file for more information.

About

FitEx is a Macro-Module which provides a bit of sugar for function definitions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp