Skip to content

Ismael-VC/InfixFunctions.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InfixFunctions

Julia infix function hack, based on this Python hack:


Installation

julia> Pkg.clone("https://github.com/Ismael-VC/InfixFunctions.jl")

Usage

julia> using InfixFunctions

julia> @infix foo(x, y) = x + y
foo (generic infix function with 1 method)

julia> @infix function foo(x::T, y::T) where {T<:Int}
           return Complex(x + y)
       end
foo (generic infix function with 2 methods)

julia> @infix (foo(x::T, y::S)::S) where {T<:Int, S<:Float64} = x - y
foo (generic infix function with 3 methods)

julia> 3.0 |foo| π
6.141592653589793

julia> 3 |foo| 5
8 + 0im

julia> 3 |foo| 5.
-2.0

julia> @infix div
INFO: div has been infixified
div (generic function with 31 methods)

julia> 10 |div| 5
2

About

Julia infix function hack.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages