Skip to content

TyronCameron/Chainables.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development documentation Test workflow status Coverage Docs workflow Status Aqua QA

Chainables.jl

Flip those function calls upside down so that @chain (from Chain.jl) is even nicer!

This is a package for true @chain connoisseurs. Continue that @chain without feeling peer-pressured by those pesky reverse-argument functions.

foo(a,b,c) = a + b + c

@assert @chain 1:100 begin 
    @rev map(x -> x) # put the 1:100 in the last arg slot instead of the first one
    @map x -> x # a whole @map macro which automatically does this -- other functional iterator functions also available
    zip(1:100)
    @map @unpack (a, b) -> a # unpack tuple[1] & tuple[2] into the function
    @apply x -> x # a way to apply a function immediately
    @apply with() do x # do-block support
        x
    end 
    @apply @∂ foo(1, @x, 3) # a partially applied function -- more useful outside @chain, equivalent to foo(1,_,3)
    @reduce init = 100 (acc, inc) -> acc # supports kwargs 
    @convert Float32 # conversions available with type-arg last
    isequal(100.0)
end 

About

Flip those function calls upside down so that @chain is even nicer!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages