Skip to content

Navigation Menu

Sign in
Appearance settings

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

Appearance settings

aenglisc/the_f

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The f

GitHub Workflow Status Erlang Hex.pm

A collection of functions and types to make your Erlang code more functional, funky and/or fancy.

Examples

curry

Multiply = f:curry(fun erlang:'*'/2),
Triple = Multiply(3),
Triple(23).
% 69

flip

Get = (f:curry(fun maps:get/3))(a),
GetWithDefault = (f:flip(Get))(42),
GetWithDefault(#{}).
% 42

partial

Sum = f:partial(fun lists:foldl/3, [fun erlang:'+'/2, 0]),
Sum(lists:seq(1, 10)).
% 55

pipe

f:pipe(1, [
    (f:curry(fun erlang:'+'/2))(1),
    (fun(X) -> X * 2 end),
    (f:partial(fun lists:seq/3, [1, 50]))
]).
% [1,5,9,13,17,21,25,29,33,37,41,45,49]

do

f:do(2, [
   (fun(X) -> f:ok(X * 21) end),
   (fun(X) -> f:ok(X * 10) end)
]).
% {ok, 420}

f:do(1, [
   (fun(X) -> f:ok(X * 1) end),
   (fun(_) -> f:err(go_away) end),
   (fun(X) -> f:ok(X + 1) end)
]).
% {error, go_away}

About

Make your Erlang code a bit more fancy.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.