Sunday

Symbolic programming with Julia, example using function composition

> julia


julia> f(x) = 2x + 3

f (generic function with 1 method)


julia> g(x) = x^2

g (generic function with 1 method)


# "∘" can be typed by \circ<tab>


julia> @show (f ∘ g)(1)

(f ∘ g)(1) = 5


julia> @show f(g(1))

f(g(1)) = 5


julia> typeof(f ∘ g)

ComposedFunction{typeof(f), typeof(g)}


julia> (f ∘ g)(1) == f(g(1))

true


julia>

No comments:

C++32 (or C++2e), C++ 2032, Cpp 2032, g++ 2032

  Subject: C++ 2032 3 Code example for ? 2 Approximate feature suggestions: - to complete C++29 or C++ 2029 1 Web links, references Wandbox,...