Skip to content

Commit dc8e1b5

Browse files
function negation and composition: !f, f∘g
1 parent 861100c commit dc8e1b5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

base/exports.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ export
256256
~,
257257
:,
258258
=>,
259+
,
259260
A_ldiv_B!,
260261
A_ldiv_Bc,
261262
A_ldiv_Bt,

base/operators.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,14 @@ eltype(::Type{Any}) = Any
328328
eltype(t::DataType) = eltype(supertype(t))
329329
eltype(x) = eltype(typeof(x))
330330

331-
# function pipelining
331+
# function pipelining, composition & negation
332+
332333
|>(x, f) = f(x)
333334

335+
(f, g) = (x...)->f(g(x...))
336+
337+
!(f::Function) = (x...)->!f(x...)
338+
334339
# array shape rules
335340

336341
function promote_shape(a::Tuple{Int,}, b::Tuple{Int,})
@@ -672,6 +677,7 @@ export
672677
,
673678
,
674679
,
680+
,
675681
colon,
676682
hcat,
677683
vcat,
@@ -685,6 +691,6 @@ import ..this_module: !, !=, $, %, .%, ÷, .÷, &, *, +, -, .!=, .+, .-, .*, ./,
685691
.>=, .\, .^, /, //, <, <:, <<, <=, ==, >, >=, >>, .>>, .<<, >>>,
686692
<|, |>, \, ^, |, ~, !==, ===, >:, colon, hcat, vcat, hvcat, getindex, setindex!,
687693
transpose, ctranspose,
688-
, , , .≥, .≤, .≠, , ×, , , , , , , , , , ,
694+
, , , .≥, .≤, .≠, , ×, , , , , , , , , , , ,
689695

690696
end

0 commit comments

Comments
 (0)