Skip to content

Commit

Permalink
function negation and composition: !f, f∘g
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Jun 27, 2016
1 parent 861100c commit dc8e1b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export
~,
:,
=>,
,
A_ldiv_B!,
A_ldiv_Bc,
A_ldiv_Bt,
Expand Down
10 changes: 8 additions & 2 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,14 @@ eltype(::Type{Any}) = Any
eltype(t::DataType) = eltype(supertype(t))
eltype(x) = eltype(typeof(x))

# function pipelining
# function pipelining, composition & negation

|>(x, f) = f(x)

(f, g) = (x...)->f(g(x...))

!(f::Function) = (x...)->!f(x...)

# array shape rules

function promote_shape(a::Tuple{Int,}, b::Tuple{Int,})
Expand Down Expand Up @@ -672,6 +677,7 @@ export
,
,
,
,
colon,
hcat,
vcat,
Expand All @@ -685,6 +691,6 @@ import ..this_module: !, !=, $, %, .%, ÷, .÷, &, *, +, -, .!=, .+, .-, .*, ./,
.>=, .\, .^, /, //, <, <:, <<, <=, ==, >, >=, >>, .>>, .<<, >>>,
<|, |>, \, ^, |, ~, !==, ===, >:, colon, hcat, vcat, hvcat, getindex, setindex!,
transpose, ctranspose,
, , , .≥, .≤, .≠, , ×, , , , , , , , , , ,
, , , .≥, .≤, .≠, , ×, , , , , , , , , , , ,

end

0 comments on commit dc8e1b5

Please sign in to comment.