Skip to content

Underscore placeholders for convenient closure syntax

License

Notifications You must be signed in to change notification settings

c42f/Underscores.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Underscores

Stable Docs Dev Docs Build Status

Underscores provides a macro @_ for passing closures to functions by interpreting _ placeholders as anonymous function arguments. For example @_ map(_+1, xs) means map(x->x+1, xs).

Underscores is useful for writing anonymous functions succinctly and without naming the arguments. This is particular useful for data processing pipelines such as

@_ people |> filter(_.age > 40, __) |> map(_.name, __)

Read the documentation for more information, or see the online help for the @_ macro.